Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions examples/ts/xrp/send-payment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Send a transaction from a TSS wallet at BitGo.
*
* Copyright 2023, BitGo, Inc. All Rights Reserved.
*/
import { BitGo } from 'bitgo';

async function sendTx() {
const coin = 'txrp';

// TODO: set env to 'test' or 'prod'
const env = 'test';

// TODO: set your access token here
// You can get this from User Settings > Developer Options > Add Access Token
const accessToken = '';

// TODO: set your wallet id
const walletId = '';

// TODO: set your wallet passphrase
const walletPassphrase = '';

// TODO: set the receive address to send fund(add destination tag)
const receiveAddress = '';

const bitgo = new BitGo({
env: env,
accessToken,
});

const basecoin = bitgo.coin(coin);
bitgo.authenticateWithAccessToken({ accessToken });
// await bitgo.unlock({ otp: otp, duration: 3600 });

const walletInstance = await basecoin.wallets().get({ id: walletId });
const xrpAmount = '1222500'; // 1.2225 XRP
const sendDetail = await walletInstance.sendMany({
recipients: [
{
amount: xrpAmount,
address: receiveAddress,
},
],
walletPassphrase,
type: 'payment',
isTss: true,
});
console.log(`${JSON.stringify(sendDetail)}`);
}

sendTx().catch((e) => console.error(e));