Skip to content

Commit

Permalink
Update stellar.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
julihidalgo authored Nov 29, 2024
1 parent 61347c3 commit 4d152b1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/service/blockchains/stellar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ export async function getBalance(
*/

export let paymentDone: PaymentDone

export let paymentRealized:boolean
export let pagoProcess:boolean
export let paymentRealized:string
export async function createPayment(
monto: number,
payer: User,
beneficiary: string,
assetCode: AssetCodes = AssetCodes.XLM,
) {
paymentRealized="proceso"
try {
let sourceKeys = await StellarSdk.Keypair.fromSecret(payer.privKey);
let sourceAcount = await server.loadAccount(payer.pubKey);
Expand All @@ -94,14 +95,16 @@ export async function createPayment(
pruebaArmada.sign(sourceKeys);
const pruebaTerminada = await server.submitTransaction(pruebaArmada);
console.log(pruebaTerminada);
paymentRealized=true
paymentRealized="hecho"
paymentDone ={
amount:monto,
destination: beneficiary,
};
pagoProcess=false
} catch (err) {
console.log('No se pudo completar la transacción');
paymentRealized=false
paymentRealized="fallido"
pagoProcess=false
}
}

Expand Down

0 comments on commit 4d152b1

Please sign in to comment.