Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/mstest', (request, response) => {
- var bobPair = StellarSdk.Keypair.fromSecret("SAN5EIFHBYNOGYNNQWI27DRQ67HHOLEMBM4V3IGSOX2QNNW2O3RBA27Y");
- var alicePair = StellarSdk.Keypair.fromSecret("SDLNYNCBBS5NBGQTWWQR7CMUUADA4NGBUY6WU3TOEKVWET5VGOEKFD4K");
- var fromPair = StellarSdk.Keypair.fromSecret("SBABNCR62PCVUZSJL73KCNKFIQPWYPLAT2IHRCLERHGHCSIWE6HIDS3T");
- var toPair = StellarSdk.Keypair.fromSecret("SDSLMS35MK5X3NOTHEBQW6M22GDDT2OJ76NW4ROOFTNVIKANIR4DFEOC");
- var bobAccount;
- var aliceAccount;
- server.loadAccount(fromPair.publicKey())
- .then(function (account) {
- var transaction = new StellarSdk.TransactionBuilder(account)
- .addOperation(StellarSdk.Operation.payment({
- destination: toPair.publicKey(),
- asset: StellarSdk.Asset.native(),
- amount: '5',
- }))
- .build();
- transaction.sign(bobPair);
- transaction.sign(alicePair);
- server.submitTransaction(transaction)
- .then(() => {
- response.send('5 lumens sent to ' + toPair.publicKey())
- })
- .catch((err) => {
- console.log(err.response.data.extras.result_codes);
- response.send('An error ocurred!')
- });
- }).then(result => {
- console.log('cenas!' + result.response.data.extras.result_codes);
- })
- .catch(function (error) {
- console.error('Error!', error);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement