File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
modules/sdk-core/src/bitgo/wallet Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { BitGo , Wallet } from 'bitgo' ;
2
+
3
+ // change this to env: 'production' when you are ready for production
4
+ const bitgo = new BitGo ( { env : 'test' } ) ;
5
+
6
+ // this can be retrieved by logging into app.bitgo-test.com (app.bitgo.com for production)
7
+ // and going to: User > User Settings > Access Tokens > (+ icon)
8
+ // the token will need Spender permission
9
+ const accessToken = '' ;
10
+
11
+ // change this to 'apt' when you are ready for production
12
+ const coin = 'tapt' ;
13
+ const walletId = '' ;
14
+ const walletPassphrase = '' ;
15
+
16
+ // this will need to be a real OTP code on production
17
+ const otp = '000000' ;
18
+
19
+ async function main ( ) {
20
+ bitgo . authenticateWithAccessToken ( { accessToken } ) ;
21
+
22
+ const wallet : Wallet = await bitgo . coin ( coin ) . wallets ( ) . get ( { id : walletId } ) ;
23
+ if ( ! wallet ) {
24
+ throw new Error ( 'Failed to retrieve wallet' ) ;
25
+ }
26
+
27
+ // we have to unlock this session since we're sending funds
28
+ const unlock = await bitgo . unlock ( { otp, duration : 3600 } ) ;
29
+ if ( ! unlock ) {
30
+ throw new Error ( 'Unlock failed' ) ;
31
+ }
32
+
33
+ const sendConsolidations = await wallet . sendAccountConsolidations ( {
34
+ walletPassphrase,
35
+ consolidateAddresses : [ '' ] ,
36
+ nftCollectionId : '' ,
37
+ nftId : '' ,
38
+ } ) ;
39
+ console . dir ( sendConsolidations , { depth : 6 } ) ;
40
+ }
41
+
42
+ main ( ) . catch ( ( e ) => console . error ( e ) ) ;
Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ export interface PrebuildTransactionOptions {
145
145
comment ?: string ;
146
146
[ index : string ] : unknown ;
147
147
tokenName ?: string ;
148
+ nftCollectionId ?: string ;
149
+ nftId ?: string ;
148
150
enableTokens ?: TokenEnablement [ ] ;
149
151
nonce ?: string ;
150
152
preview ?: boolean ;
Original file line number Diff line number Diff line change @@ -216,6 +216,8 @@ export class Wallet implements IWallet {
216
216
prebuildConsolidateAccountParams ( ) : string [ ] {
217
217
return [
218
218
'consolidateAddresses' ,
219
+ 'nftCollectionId' ,
220
+ 'nftId' ,
219
221
'feeRate' ,
220
222
'maxFeeRate' ,
221
223
'memo' ,
You can’t perform that action at this time.
0 commit comments