File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Send a transaction from a TSS wallet at BitGo.
3+ *
4+ * Copyright 2023, BitGo, Inc. All Rights Reserved.
5+ */
6+ import { BitGo } from 'bitgo' ;
7+
8+ async function sendTx ( ) {
9+ const coin = 'txrp' ;
10+
11+ // TODO: set env to 'test' or 'prod'
12+ const env = 'test' ;
13+
14+ // TODO: set your access token here
15+ // You can get this from User Settings > Developer Options > Add Access Token
16+ const accessToken = '' ;
17+
18+ // TODO: set your wallet id
19+ const walletId = '' ;
20+
21+ // TODO: set your wallet passphrase
22+ const walletPassphrase = '' ;
23+
24+ // TODO: set the receive address to send fund(add destination tag)
25+ const receiveAddress = '' ;
26+
27+ const bitgo = new BitGo ( {
28+ env : env ,
29+ accessToken,
30+ } ) ;
31+
32+ const basecoin = bitgo . coin ( coin ) ;
33+ bitgo . authenticateWithAccessToken ( { accessToken } ) ;
34+ // await bitgo.unlock({ otp: otp, duration: 3600 });
35+
36+ const walletInstance = await basecoin . wallets ( ) . get ( { id : walletId } ) ;
37+ const xrpAmount = '1222500' ; // 1.2225 XRP
38+ const sendDetail = await walletInstance . sendMany ( {
39+ recipients : [
40+ {
41+ amount : xrpAmount ,
42+ address : receiveAddress ,
43+ } ,
44+ ] ,
45+ walletPassphrase,
46+ type : 'payment' ,
47+ isTss : true ,
48+ } ) ;
49+ console . log ( `${ JSON . stringify ( sendDetail ) } ` ) ;
50+ }
51+
52+ sendTx ( ) . catch ( ( e ) => console . error ( e ) ) ;
You can’t perform that action at this time.
0 commit comments