@imtbl/bridge-sdk 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +176 -0
- package/README.md +3 -0
- package/dist/browser/index.js +2 -0
- package/dist/node/index.cjs +2 -0
- package/dist/node/index.js +2 -0
- package/dist/types/config/config.test.d.ts +1 -0
- package/dist/types/config/index.d.ts +32 -0
- package/dist/types/constants/bridges.d.ts +121 -0
- package/dist/types/constants/values.d.ts +1 -0
- package/dist/types/contracts/ABIs/ChildERC20.d.ts +28 -0
- package/dist/types/contracts/ABIs/ChildERC20Bridge.d.ts +78 -0
- package/dist/types/contracts/ABIs/ERC20.d.ts +39 -0
- package/dist/types/contracts/ABIs/RootAxelarBridgeAdaptor.d.ts +67 -0
- package/dist/types/contracts/ABIs/RootERC20BridgeFlowRate.d.ts +98 -0
- package/dist/types/contracts/createContract.d.ts +2 -0
- package/dist/types/errors/index.d.ts +52 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/lib/axelar.test.d.ts +1 -0
- package/dist/types/lib/axelarUtils.d.ts +20 -0
- package/dist/types/lib/gas.d.ts +3 -0
- package/dist/types/lib/gas.test.d.ts +1 -0
- package/dist/types/lib/gmpRecovery.d.ts +2 -0
- package/dist/types/lib/tenderly.d.ts +31 -0
- package/dist/types/lib/tenderly.test.d.ts +1 -0
- package/dist/types/lib/transactions.d.ts +11 -0
- package/dist/types/lib/transactions.test.d.ts +1 -0
- package/dist/types/lib/utils.d.ts +34 -0
- package/dist/types/lib/utils.test.d.ts +1 -0
- package/dist/types/lib/validation.d.ts +7 -0
- package/dist/types/lib/validation.test.d.ts +1 -0
- package/dist/types/tokenBridge.d.ts +354 -0
- package/dist/types/tokenBridge.test.d.ts +1 -0
- package/dist/types/types/axelar.d.ts +43 -0
- package/dist/types/types/index.d.ts +462 -0
- package/dist/types/types/tenderly.d.ts +13 -0
- package/package.json +71 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { BridgeConfiguration } from './config';
|
|
2
|
+
import { BridgeFeeRequest, BridgeFeeResponse, BridgeTxRequest, ApproveBridgeRequest, ApproveBridgeResponse, BridgeTxResponse, TokenMappingRequest, TokenMappingResponse, TxStatusRequest, TxStatusResponse, FlowRateInfoResponse, PendingWithdrawalsRequest, PendingWithdrawalsResponse, FlowRateWithdrawRequest, FlowRateWithdrawResponse, FlowRateInfoRequest, BridgeBundledTxRequest, BridgeBundledTxResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a token bridge, which manages asset transfers between two chains.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TokenBridge {
|
|
7
|
+
/**
|
|
8
|
+
* @property {BridgeConfiguration} config - The bridge configuration object.
|
|
9
|
+
*/
|
|
10
|
+
private config;
|
|
11
|
+
/**
|
|
12
|
+
* @property {boolean} initialised - Flag to indicate whether this token bridge has been initialised.
|
|
13
|
+
*/
|
|
14
|
+
private initialised;
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a TokenBridge instance.
|
|
17
|
+
*
|
|
18
|
+
* @param {BridgeConfiguration} config - The bridge configuration object.
|
|
19
|
+
*/
|
|
20
|
+
constructor(config: BridgeConfiguration);
|
|
21
|
+
/**
|
|
22
|
+
* Initialise the TokenBridge instance.
|
|
23
|
+
*/
|
|
24
|
+
initialise(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the bridge fee for a specific token.
|
|
27
|
+
*
|
|
28
|
+
* @param {BridgeFeeRequest} req - The fee request object containing the token address for which the fee is required.
|
|
29
|
+
* @returns {Promise<BridgeFeeResponse>} - A promise that resolves to an object containing the bridge fee for the specified
|
|
30
|
+
* token and a flag indicating if the token is bridgeable.
|
|
31
|
+
* @throws {BridgeError} - If an error occurs during the fee retrieval, a BridgeError will be thrown with a specific error type.
|
|
32
|
+
*
|
|
33
|
+
* Possible BridgeError types include:
|
|
34
|
+
* - INVALID_ADDRESS: The token address provided in the request is invalid.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const feeRequest = {
|
|
38
|
+
* action: 'WITHDRAW', // BridgeFeeActions
|
|
39
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
40
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
41
|
+
* destinationChainId: '1' // Ethereum
|
|
42
|
+
* };
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const feeRequest = {
|
|
46
|
+
* action: 'DEPOSIT', // BridgeFeeActions
|
|
47
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
48
|
+
* sourceChainId: '1', // Ethereum
|
|
49
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* bridgeSdk.getFee(feeRequest)
|
|
53
|
+
* .then((feeResponse) => {
|
|
54
|
+
* console.log('Source chain gas fee:', feeResponse.sourceChainFee);
|
|
55
|
+
* console.log('Destination chain gas fee:', feeResponse.destinationChainFee);
|
|
56
|
+
* console.log('Axelar bridge fee (includes destination execution):', feeResponse.bridgeFee);
|
|
57
|
+
* console.log('Immutable fee:', feeResponse.networkFee);
|
|
58
|
+
* console.log('Total Fees (sourceChainFee + bridgeFee + networkFee):', feeResponse.totalFee);
|
|
59
|
+
* })
|
|
60
|
+
* .catch((error) => {
|
|
61
|
+
* console.error('Error:', error.message);
|
|
62
|
+
* });
|
|
63
|
+
*/
|
|
64
|
+
getFee(req: BridgeFeeRequest): Promise<BridgeFeeResponse>;
|
|
65
|
+
private getFinaliseWithdrawFee;
|
|
66
|
+
private getDepositOrWithdrawFee;
|
|
67
|
+
private getFeePrivate;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves the unsigned approval transaction for deposit or withdrawal.
|
|
70
|
+
* Approval is required before depositing or withdrawing tokens to the bridge using
|
|
71
|
+
*
|
|
72
|
+
* @param {ApproveBridgeRequest} req - The approve bridge request object.
|
|
73
|
+
* @returns {Promise<ApproveBridgeResponse>} - A promise that resolves to an object containing the unsigned
|
|
74
|
+
* approval transaction or null if no approaval is required.
|
|
75
|
+
* @throws {BridgeError} - If an error occurs during the transaction creation, a BridgeError will be thrown with a specific error type.
|
|
76
|
+
*
|
|
77
|
+
* Possible BridgeError types include:
|
|
78
|
+
* - UNSUPPORTED_ERROR: The operation is not supported. Currently thrown when attempting to deposit native tokens.
|
|
79
|
+
* - INVALID_ADDRESS: An Ethereum address provided in the request is invalid.
|
|
80
|
+
* - INVALID_AMOUNT: The deposit amount provided in the request is invalid (less than or equal to 0).
|
|
81
|
+
* - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation.
|
|
82
|
+
* - PROVIDER_ERROR: An error occurred while interacting with the Ethereum provider. This includes issues calling the ERC20 smart contract
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const approveDepositRequest = {
|
|
86
|
+
* senderAddress: '0x123456...', // Senders address
|
|
87
|
+
* token: '0xabcdef...', // ERC20 token address
|
|
88
|
+
* amount: ethers.utils.parseUnits('100', 18), // amount being bridged in token's smallest unit (e.g., wei for Ether)
|
|
89
|
+
* sourceChainId: '1', // Ethereum
|
|
90
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
91
|
+
* };
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const approveWithdrawalRequest = {
|
|
95
|
+
* senderAddress: '0x123456...', // Senders address
|
|
96
|
+
* token: '0xabcdef...', // ERC20 token address
|
|
97
|
+
* amount: ethers.utils.parseUnits('100', 18), // amount being bridged in token's smallest unit (e.g., wei for Ether)
|
|
98
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
99
|
+
* destinationChainId: '1', // Ethereum
|
|
100
|
+
* };
|
|
101
|
+
*
|
|
102
|
+
* bridgeSdk.getUnsignedApproveBridgeTx(approveDepositRequest)
|
|
103
|
+
* .then((approveResponse) => {
|
|
104
|
+
* if (approveResponse.unsignedTx !== null) {
|
|
105
|
+
* // Send the unsigned approval transaction to the depositor to sign and send
|
|
106
|
+
* } else {
|
|
107
|
+
* // No approval is required
|
|
108
|
+
* }
|
|
109
|
+
* })
|
|
110
|
+
* .catch((error) => {
|
|
111
|
+
* console.error('Error:', error.message);
|
|
112
|
+
* });
|
|
113
|
+
*/
|
|
114
|
+
getUnsignedApproveBridgeTx(req: ApproveBridgeRequest): Promise<ApproveBridgeResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Get the smart contract function names depending on whether the request is a deposit or withdrawal.
|
|
117
|
+
*/
|
|
118
|
+
private getBridgeMethods;
|
|
119
|
+
/**
|
|
120
|
+
* Get the bridge contract which will be interacted with. Root bridge if deposit, child bridge if withdrawal.
|
|
121
|
+
*/
|
|
122
|
+
private getBridgeContract;
|
|
123
|
+
/**
|
|
124
|
+
* Get the transaction data for a bridge transaction.
|
|
125
|
+
* This will either be a deposit or withdraw, with either the native token or an ERC20 token,
|
|
126
|
+
* and either to the sender or to a different address.
|
|
127
|
+
* This means there are 8 possible transactions:
|
|
128
|
+
* - Deposit native token
|
|
129
|
+
* - Deposit native token TO
|
|
130
|
+
* - Deposit ERC20 token
|
|
131
|
+
* - Deposit ERC20 token TO
|
|
132
|
+
* - Withdraw native token
|
|
133
|
+
* - Withdraw native token TO
|
|
134
|
+
* - Withdraw ERC20 token
|
|
135
|
+
* - Withdraw ERC20 token TO
|
|
136
|
+
* @param sender Bridge depositer/withdrawer
|
|
137
|
+
* @param recipient Deposit or withdrawal recipient
|
|
138
|
+
* @param amount Amount to deposit or withdraw
|
|
139
|
+
* @param token Token to deposit or withdraw. NATIVE if native asset on the source chain.
|
|
140
|
+
* @param sourceChainId Chain ID of the source chain
|
|
141
|
+
* @returns calldata for the requested bridge transaction (i.e. tx.data)
|
|
142
|
+
*/
|
|
143
|
+
private getConfigAndBridgeTxCalldata;
|
|
144
|
+
/**
|
|
145
|
+
* Generates an unsigned deposit or withdrawal transaction for a user to sign and submit to the bridge.
|
|
146
|
+
* Must be called after bridgeSdk.getUnsignedApproveBridgeTx to ensure user has approved sufficient tokens for deposit.
|
|
147
|
+
*
|
|
148
|
+
* @param {BridgeTxRequest} req - The tx request object containing the required data for depositing or withdrawing tokens.
|
|
149
|
+
* @returns {Promise<BridgeTxResponse>} - A promise that resolves to an object containing the fee data and unsigned transaction data.
|
|
150
|
+
* @throws {BridgeError} - If an error occurs during the generation of the unsigned transaction, a BridgeError
|
|
151
|
+
* will be thrown with a specific error type.
|
|
152
|
+
*
|
|
153
|
+
* Possible BridgeError types include:
|
|
154
|
+
* - UNSUPPORTED_ERROR: The operation is not supported. Currently thrown when attempting to deposit native tokens.
|
|
155
|
+
* - INVALID_ADDRESS: An Ethereum address provided in the request is invalid. This could be the depositor's,
|
|
156
|
+
* recipient's or the token's address.
|
|
157
|
+
* - INVALID_AMOUNT: The deposit amount provided in the request is invalid (less than or equal to 0).
|
|
158
|
+
* - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* const depositERC20Request = {
|
|
162
|
+
* senderAddress: '0x123456...', // Senders address
|
|
163
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
164
|
+
* token: '0x123456...', // ERC20 token address
|
|
165
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
166
|
+
* sourceChainId: '1', // Ethereum
|
|
167
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
168
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
169
|
+
* };
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* const depositEtherTokenRequest = {
|
|
173
|
+
* senderAddress: '0x123456...', // Senders address
|
|
174
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
175
|
+
* token: 'NATIVE', // The chain's native token
|
|
176
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
177
|
+
* sourceChainId: '1', // Ethereum
|
|
178
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
179
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
180
|
+
* };
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* const withdrawERC20Request = {
|
|
184
|
+
* senderAddress: '0x123456...', // Senders address
|
|
185
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
186
|
+
* token: '0x123456...', // ERC20 token address
|
|
187
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
188
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
189
|
+
* destinationChainId: '1', // Ethereum
|
|
190
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
191
|
+
* };
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* const withdrawIMXTokenRequest = {
|
|
195
|
+
* senderAddress: '0x123456...', // Senders address
|
|
196
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
197
|
+
* token: 'NATIVE', // The chain's native token
|
|
198
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
199
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
200
|
+
* destinationChainId: '1', // Ethereum
|
|
201
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
202
|
+
* };
|
|
203
|
+
*
|
|
204
|
+
* bridgeSdk.getUnsignedBridgeTx(depositERC20Request)
|
|
205
|
+
* .then((depositResponse) => {
|
|
206
|
+
* console.log('Fee Data', depositResponse.feeData);
|
|
207
|
+
* console.log('Unsigned Tx', depositResponse.unsignedTx);
|
|
208
|
+
* })
|
|
209
|
+
* .catch((error) => {
|
|
210
|
+
* console.error('Error:', error.message);
|
|
211
|
+
* });
|
|
212
|
+
*/
|
|
213
|
+
getUnsignedBridgeTx(req: BridgeTxRequest): Promise<BridgeTxResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Generates the optional approval transaction AND an unsigned deposit or withdrawal transaction for a user to sign
|
|
216
|
+
* and submit to the bridge.
|
|
217
|
+
* It is the combination of bridgeSdk.getUnsignedApproveBridgeTx and bridgeSdk.getUnsignedBridgeTx.
|
|
218
|
+
*
|
|
219
|
+
* @param {BridgeBundledTxRequest} req - The tx request object containing the required data for depositing or withdrawing tokens.
|
|
220
|
+
* @returns {Promise<BridgeBundledTxResponse>} - A promise that resolves to an object containing the optional contract to approve,
|
|
221
|
+
* optional unsigned approval transaction, fee data and unsigned transaction data.
|
|
222
|
+
* @throws {BridgeError} - If an error occurs during the generation of the unsigned transaction, a BridgeError
|
|
223
|
+
* will be thrown with a specific error type.
|
|
224
|
+
*
|
|
225
|
+
* Possible BridgeError types include:
|
|
226
|
+
* - UNSUPPORTED_ERROR: The operation is not supported. Currently thrown when attempting to deposit native tokens.
|
|
227
|
+
* - INVALID_ADDRESS: An Ethereum address provided in the request is invalid. This could be the depositor's,
|
|
228
|
+
* recipient's or the token's address.
|
|
229
|
+
* - INVALID_AMOUNT: The deposit amount provided in the request is invalid (less than or equal to 0).
|
|
230
|
+
* - INTERNAL_ERROR: An unexpected error occurred during the execution, likely due to the bridge SDK implementation.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* const depositERC20Request = {
|
|
234
|
+
* senderAddress: '0x123456...', // Senders address
|
|
235
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
236
|
+
* token: '0x123456...', // ERC20 token address
|
|
237
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
238
|
+
* sourceChainId: '1', // Ethereum
|
|
239
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
240
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
241
|
+
* };
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* const depositEtherTokenRequest = {
|
|
245
|
+
* senderAddress: '0x123456...', // Senders address
|
|
246
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
247
|
+
* token: 'NATIVE', // The chain's native token
|
|
248
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
249
|
+
* sourceChainId: '1', // Ethereum
|
|
250
|
+
* destinationChainId: '13371', // Immutable zkEVM
|
|
251
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
252
|
+
* };
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* const withdrawERC20Request = {
|
|
256
|
+
* senderAddress: '0x123456...', // Senders address
|
|
257
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
258
|
+
* token: '0x123456...', // ERC20 token address
|
|
259
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
260
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
261
|
+
* destinationChainId: '1', // Ethereum
|
|
262
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
263
|
+
* };
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* const withdrawIMXTokenRequest = {
|
|
267
|
+
* senderAddress: '0x123456...', // Senders address
|
|
268
|
+
* recipientAddress: '0x123456...', // Recipient address
|
|
269
|
+
* token: 'NATIVE', // The chain's native token
|
|
270
|
+
* amount: ethers.utils.parseUnits('100', 18), // Bridge amount in wei
|
|
271
|
+
* sourceChainId: '13371', // Immutable zkEVM
|
|
272
|
+
* destinationChainId: '1', // Ethereum
|
|
273
|
+
* gasMultiplier: 1.2, // Buffer to add to the gas estimate, 1.2 = 20% buffer
|
|
274
|
+
* };
|
|
275
|
+
*
|
|
276
|
+
* bridgeSdk.getUnsignedBridgeBundledTx(depositERC20Request)
|
|
277
|
+
* .then((depositResponse) => {
|
|
278
|
+
* console.log('Fee Data', depositResponse.feeData);
|
|
279
|
+
* console.log('Optional contract to approve', depositResponse.contractToApprove);
|
|
280
|
+
* console.log('Optional unsigned approval Tx', depositResponse.unsignedApprovalTx);
|
|
281
|
+
* console.log('Unsigned bridge Tx', depositResponse.unsignedBridgeTx);
|
|
282
|
+
* })
|
|
283
|
+
* .catch((error) => {
|
|
284
|
+
* console.error('Error:', error.message);
|
|
285
|
+
* });
|
|
286
|
+
*/
|
|
287
|
+
getUnsignedBridgeBundledTx(req: BridgeBundledTxRequest): Promise<BridgeBundledTxResponse>;
|
|
288
|
+
private getUnsignedBridgeBundledTxPrivate;
|
|
289
|
+
private getUnsignedBridgeDepositBundledTxPrivate;
|
|
290
|
+
private getUnsignedBridgeWithdrawBundledTxPrivate;
|
|
291
|
+
private getDynamicDepositGas;
|
|
292
|
+
/**
|
|
293
|
+
* Use Tenderly simulations to estimate the gas cost of the destination (root) chain transaction of a withdraw
|
|
294
|
+
*/
|
|
295
|
+
private getDynamicWithdrawGasRootChain;
|
|
296
|
+
private getAllowance;
|
|
297
|
+
/**
|
|
298
|
+
* Query the axelar fee for a transaction using axelarjs-sdk.
|
|
299
|
+
* @param {*} sourceChainId - The source chainId.
|
|
300
|
+
* @param {*} destinationChainId - The destination chainId.
|
|
301
|
+
* @param {*} destinationChainGaslimit - The gas limit for the desired operation.
|
|
302
|
+
* @param {*} gasMultiplier - The gas multiplier to add buffer to the fees.
|
|
303
|
+
* @returns {ethers.BigNumber} - The Axelar Gas amount in the source chain currency.
|
|
304
|
+
*/
|
|
305
|
+
private getAxelarFee;
|
|
306
|
+
/**
|
|
307
|
+
* Queries the status of a bridge transaction.
|
|
308
|
+
*
|
|
309
|
+
* @param {TxStatusRequest} req - The request object containing an array of transactions to query.
|
|
310
|
+
* @returns {Promise<TxStatusResponse>} - A promise that resolves to an array of transaction statuses.
|
|
311
|
+
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
312
|
+
*/
|
|
313
|
+
getTransactionStatus(req: TxStatusRequest): Promise<TxStatusResponse>;
|
|
314
|
+
private getUniqueReceivers;
|
|
315
|
+
private getAxelarStatus;
|
|
316
|
+
/**
|
|
317
|
+
* Queries for the information about which tokens are flowrated and how long the delay is.
|
|
318
|
+
*
|
|
319
|
+
* @param {void} - no params required.
|
|
320
|
+
* @returns {Promise<FlowRateInfoResponse>} - A promise that resolves to an object containing the flow rate information.
|
|
321
|
+
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
322
|
+
* @dev this SDK method is currently stubbed
|
|
323
|
+
*/
|
|
324
|
+
getFlowRateInfo(req: FlowRateInfoRequest): Promise<FlowRateInfoResponse>;
|
|
325
|
+
/**
|
|
326
|
+
* Fetches the pending withdrawals for a given address.
|
|
327
|
+
*
|
|
328
|
+
* @param {PendingWithdrawalsRequest} req - The request object containing the reciever address.
|
|
329
|
+
* @returns {Promise<PendingWithdrawalsResponse>} - A promise that resolves to an object containing the child token address.
|
|
330
|
+
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
331
|
+
* @dev this SDK method is currently stubbed
|
|
332
|
+
*/
|
|
333
|
+
getPendingWithdrawals(req: PendingWithdrawalsRequest): Promise<PendingWithdrawalsResponse>;
|
|
334
|
+
/**
|
|
335
|
+
* Retrieves the unsigned flow rate withdrawal transaction
|
|
336
|
+
*
|
|
337
|
+
* @param {FlowRateWithdrawRequest} req - The request object containing the receiver address and pending withdrawal index.
|
|
338
|
+
* @returns {Promise<FlowRateWithdrawResponse>} - A promise that resolves to an object containing the unsigned transaction.
|
|
339
|
+
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
340
|
+
* @dev this SDK method is currently stubbed
|
|
341
|
+
*/
|
|
342
|
+
getFlowRateWithdrawTx(req: FlowRateWithdrawRequest): Promise<FlowRateWithdrawResponse>;
|
|
343
|
+
/**
|
|
344
|
+
* Retrieves the corresponding token mappings for a given address.
|
|
345
|
+
* This function is used to map a root token to its child token in the context of a bridging system between chains.
|
|
346
|
+
* If the token is native, a special key is used to represent it.
|
|
347
|
+
*
|
|
348
|
+
* @param {TokenMappingRequest} req - The request object containing the root token address or the string 'NATIVE'.
|
|
349
|
+
* @returns {Promise<TokenMappingResponse>} - A promise that resolves to an object containing the child token address.
|
|
350
|
+
* @throws {BridgeError} - If an error occurs during the query, a BridgeError will be thrown with a specific error type.
|
|
351
|
+
* @dev this SDK method is currently stubbed
|
|
352
|
+
*/
|
|
353
|
+
getTokenMapping(req: TokenMappingRequest): Promise<TokenMappingResponse>;
|
|
354
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare enum GMPStatus {
|
|
2
|
+
SRC_GATEWAY_CALLED = "source_gateway_called",
|
|
3
|
+
DEST_GATEWAY_APPROVED = "destination_gateway_approved",
|
|
4
|
+
DEST_EXECUTED = "destination_executed",
|
|
5
|
+
EXPRESS_EXECUTED = "express_executed",
|
|
6
|
+
DEST_EXECUTE_ERROR = "error",
|
|
7
|
+
DEST_EXECUTING = "executing",
|
|
8
|
+
APPROVING = "approving",
|
|
9
|
+
FORECALLED = "forecalled",
|
|
10
|
+
FORECALLED_WITHOUT_GAS_PAID = "forecalled_without_gas_paid",
|
|
11
|
+
NOT_EXECUTED = "not_executed",
|
|
12
|
+
NOT_EXECUTED_WITHOUT_GAS_PAID = "not_executed_without_gas_paid",
|
|
13
|
+
INSUFFICIENT_FEE = "insufficient_fee",
|
|
14
|
+
UNKNOWN_ERROR = "unknown_error",
|
|
15
|
+
CANNOT_FETCH_STATUS = "cannot_fetch_status",
|
|
16
|
+
SRC_GATEWAY_CONFIRMED = "confirmed"
|
|
17
|
+
}
|
|
18
|
+
export declare enum GasPaidStatus {
|
|
19
|
+
GAS_UNPAID = "gas_unpaid",
|
|
20
|
+
GAS_PAID = "gas_paid",
|
|
21
|
+
GAS_PAID_NOT_ENOUGH_GAS = "gas_paid_not_enough_gas",
|
|
22
|
+
GAS_PAID_ENOUGH_GAS = "gas_paid_enough_gas"
|
|
23
|
+
}
|
|
24
|
+
export interface GasPaidInfo {
|
|
25
|
+
status: GasPaidStatus;
|
|
26
|
+
details?: any;
|
|
27
|
+
}
|
|
28
|
+
export interface GMPStatusResponse {
|
|
29
|
+
status: GMPStatus | string;
|
|
30
|
+
timeSpent?: Record<string, number>;
|
|
31
|
+
gasPaidInfo?: GasPaidInfo;
|
|
32
|
+
error?: GMPError;
|
|
33
|
+
callTx?: any;
|
|
34
|
+
executed?: any;
|
|
35
|
+
expressExecuted?: any;
|
|
36
|
+
approved?: any;
|
|
37
|
+
callback?: any;
|
|
38
|
+
}
|
|
39
|
+
export interface GMPError {
|
|
40
|
+
txHash: string;
|
|
41
|
+
chain: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|