File tree Expand file tree Collapse file tree 5 files changed +72
-5
lines changed
modules/sdk-core/src/bitgo/wallet Expand file tree Collapse file tree 5 files changed +72
-5
lines changed Original file line number Diff line number Diff line change 85
85
/modules /sdk-coin-xtz / @ BitGo/ethalt-team
86
86
/modules /sdk-coin-zketh / @ BitGo/ethalt-team
87
87
88
+ # Examples
89
+ /examples / @ BitGo/ethalt-team
90
+
88
91
# Trade
89
92
/modules /sdk-core /src /bitgo /address-book / @ BitGo/prime
90
93
/modules /sdk-core /src /bitgo /trading / @ BitGo/prime
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Send funds from a gas tank to a BitGo wallet's receive address.
3
+ *
4
+ * Copyright 2025, BitGo, Inc. All Rights Reserved.
5
+ */
6
+ import { BitGoAPI } from '@bitgo/sdk-api' ;
7
+ import { Tapt } from '@bitgo/sdk-coin-apt' ;
8
+ import { FundForwarderParams } from '@bitgo/sdk-core' ;
9
+
10
+ const bitgo = new BitGoAPI ( {
11
+ accessToken : '<access token>' ,
12
+ env : 'test' ,
13
+ } ) ;
14
+
15
+ const coin = 'tapt' ;
16
+ bitgo . register ( coin , Tapt . createInstance ) ;
17
+
18
+ const walletId = '<wallet id>' ;
19
+
20
+ async function main ( ) {
21
+ bitgo . unlock ( { otp : '000000' } ) ;
22
+ const walletInstance = await bitgo . coin ( coin ) . wallets ( ) . get ( { id : walletId } ) ;
23
+
24
+ const fundForwarderParams : FundForwarderParams = {
25
+ forwarders : [
26
+ {
27
+ forwarderAddress : '<forwarder address>' ,
28
+ amount : '<amount>' // optional field
29
+ } ,
30
+ ] ,
31
+ }
32
+
33
+ const response = await walletInstance . fundForwarders ( fundForwarderParams ) ;
34
+ console . log ( 'Response' , response ) ;
35
+ }
36
+
37
+ main ( ) . catch ( ( e ) => console . error ( e ) ) ;
Original file line number Diff line number Diff line change
1
+ import { FundForwarderParams } from "@bitgo/sdk-core" ;
2
+
1
3
/**
2
4
* Send funds from a fee address to a forwarder.
3
5
*
@@ -28,12 +30,16 @@ async function fundForwarder() {
28
30
bitgo . authenticateWithAccessToken ( { accessToken } ) ;
29
31
const wallet = await bitgo . coin ( coin ) . wallets ( ) . get ( { id : walletId } ) ;
30
32
31
- const fundForwarderOptions = {
32
- forwarderAddress : forwarderAddress ,
33
- amount : amount ,
34
- } ;
33
+ const fundForwarderParams : FundForwarderParams = {
34
+ forwarders : [
35
+ {
36
+ forwarderAddress,
37
+ amount, // optional field
38
+ } ,
39
+ ] ,
40
+ }
35
41
36
- const response = await wallet . fundForwarder ( fundForwarderOptions ) ;
42
+ const response = await wallet . fundForwarders ( fundForwarderParams ) ;
37
43
console . log ( 'Response' , response ) ;
38
44
}
39
45
Original file line number Diff line number Diff line change @@ -432,6 +432,10 @@ export interface FundForwardersOptions {
432
432
amount ?: string ;
433
433
}
434
434
435
+ export interface FundForwarderParams {
436
+ forwarders : FundForwardersOptions [ ] ;
437
+ }
438
+
435
439
export interface FlushForwarderTokenOptions {
436
440
address ?: string ;
437
441
id ?: string ;
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ import {
99
99
BulkWalletShareKeychain ,
100
100
ManageUnspentReservationOptions ,
101
101
SignAndSendTxRequestOptions ,
102
+ FundForwarderParams ,
102
103
} from './iWallet' ;
103
104
import { GoStakingWallet , StakingWallet } from '../staking' ;
104
105
import EddsaUtils from '../utils/tss/eddsa' ;
@@ -3629,6 +3630,22 @@ export class Wallet implements IWallet {
3629
3630
return this . _wallet ;
3630
3631
}
3631
3632
3633
+ /**
3634
+ * Send funds from a fee address to a forwarder.
3635
+ *
3636
+ * @param {Object } params - parameters object
3637
+ * @param {List } params.forwarders - list of fund forwarder options
3638
+ * @returns {* }
3639
+ */
3640
+ public async fundForwarders ( params : FundForwarderParams ) : Promise < any > {
3641
+ if ( _ . isUndefined ( params . forwarders ) || params . forwarders . length == 0 ) {
3642
+ throw new Error ( 'fund forwarder options required' ) ;
3643
+ }
3644
+ const url = this . url ( '/fundforwarders' ) ;
3645
+ this . _wallet = await this . bitgo . post ( url ) . send ( params ) . result ( ) ;
3646
+ return this . _wallet ;
3647
+ }
3648
+
3632
3649
/**
3633
3650
* Gets forwarder's balance
3634
3651
* @param params - optional query parameters
You can’t perform that action at this time.
0 commit comments