@stableflow/bridges 3.0.3 → 3.1.0-rc-d2d5e08ec7-20260706
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/dist/index.d.mts +148 -11
- package/dist/index.d.ts +148 -11
- package/dist/index.js +366 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +365 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,121 @@
|
|
|
1
1
|
import * as _stableflow_core from '@stableflow/core';
|
|
2
|
-
import { Service, TokenConfig, WalletConfig, TransactionStatus } from '@stableflow/core';
|
|
2
|
+
import { Service, TokenConfig, WalletConfig, CancelablePromise, SubmitDepositTxResponse, TransactionStatus } from '@stableflow/core';
|
|
3
3
|
import Big from 'big.js';
|
|
4
4
|
|
|
5
5
|
declare const ServiceMap: Record<Service, any>;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Serializable, unsigned EVM transaction data.
|
|
9
|
+
*
|
|
10
|
+
* This is what an API-driven custody integrator (e.g. an MPC wallet such as
|
|
11
|
+
* Fireblocks) receives. Stableflow builds the calldata; the integrator signs
|
|
12
|
+
* and broadcasts it through their own infrastructure, then reports the
|
|
13
|
+
* resulting hash back via `BridgeSFA.report`.
|
|
14
|
+
*/
|
|
15
|
+
interface EvmTxData {
|
|
16
|
+
chainId: number;
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
/** Hex-encoded calldata. `0x` for a plain native-token transfer. */
|
|
20
|
+
data: string;
|
|
21
|
+
/** Native token amount in wei, as a decimal string. */
|
|
22
|
+
value: string;
|
|
23
|
+
/** Optional gas limit as a decimal string. */
|
|
24
|
+
gasLimit?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* EIP-712 typed data for an ERC20 `Permit`, returned unsigned so an external
|
|
28
|
+
* signer (MPC/Fireblocks) can produce the signature. Nothing is signed or
|
|
29
|
+
* verified inside the SDK for this payload.
|
|
30
|
+
*/
|
|
31
|
+
interface PermitTypedData {
|
|
32
|
+
domain: {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
chainId: number;
|
|
36
|
+
verifyingContract: string;
|
|
37
|
+
};
|
|
38
|
+
types: Record<string, Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
}>>;
|
|
42
|
+
values: {
|
|
43
|
+
owner: string;
|
|
44
|
+
spender: string;
|
|
45
|
+
value: string;
|
|
46
|
+
nonce: string;
|
|
47
|
+
deadline: number;
|
|
48
|
+
};
|
|
49
|
+
deadline: number;
|
|
50
|
+
nonce: number;
|
|
51
|
+
token: string;
|
|
52
|
+
spender: string;
|
|
53
|
+
owner: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of `BridgeSFA.buildTransaction`.
|
|
57
|
+
*
|
|
58
|
+
* Depending on the route, the integrator may need to: broadcast `approveTx`
|
|
59
|
+
* (optionally `approveResetTx` first on Ethereum), sign `permitTypedData`,
|
|
60
|
+
* and always broadcast the main `tx`. See `BridgeSFA.buildTransaction`.
|
|
61
|
+
*/
|
|
62
|
+
interface BuildTransactionResult {
|
|
63
|
+
chainId: number;
|
|
64
|
+
from: string;
|
|
65
|
+
/** Present when `quote.needApprove === true`. */
|
|
66
|
+
approveTx?: EvmTxData;
|
|
67
|
+
/**
|
|
68
|
+
* Present when `quote.needApprove === true` and the source chain is Ethereum.
|
|
69
|
+
* Some Ethereum tokens (e.g. USDT) require resetting the allowance to 0
|
|
70
|
+
* before setting a new non-zero allowance.
|
|
71
|
+
*/
|
|
72
|
+
approveResetTx?: EvmTxData;
|
|
73
|
+
/** Present when `quote.needPermit === true`. Must be signed off-chain. */
|
|
74
|
+
permitTypedData?: PermitTypedData;
|
|
75
|
+
/** The main source-chain transaction to sign and broadcast. */
|
|
76
|
+
tx: EvmTxData;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build the main unsigned source-chain transaction from a quote, mirroring the
|
|
80
|
+
* branching in `BridgeSFA.send` but producing serializable calldata instead of
|
|
81
|
+
* signing/broadcasting.
|
|
82
|
+
*/
|
|
83
|
+
declare const buildSendTx: (serviceType: Service, quote: any) => EvmTxData;
|
|
84
|
+
/**
|
|
85
|
+
* Build the ERC20 approve transaction(s) for a quote that requires approval.
|
|
86
|
+
* On Ethereum an additional `approveResetTx` (approve 0) is returned so the
|
|
87
|
+
* integrator can reset a stale allowance before setting a new one.
|
|
88
|
+
*/
|
|
89
|
+
declare const buildApproveTx: (serviceType: Service, quote: any) => {
|
|
90
|
+
approveTx?: EvmTxData;
|
|
91
|
+
approveResetTx?: EvmTxData;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Build the EIP-712 `Permit` typed data for a permit-required route, returned
|
|
95
|
+
* unsigned. The integrator signs it with their MPC/Fireblocks signer, splits
|
|
96
|
+
* the signature into `v/r/s`, and passes the assembled `permitSignature` to
|
|
97
|
+
* `BridgeSFA.report`.
|
|
98
|
+
*/
|
|
99
|
+
declare const buildPermitTypedData: (params: {
|
|
100
|
+
permitToken: TokenConfig;
|
|
101
|
+
permitAmountWei: string;
|
|
102
|
+
permitSpender: string;
|
|
103
|
+
owner: string;
|
|
104
|
+
}) => Promise<PermitTypedData>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Normalized ERC20 permit signature passed to `BridgeSFA.send` / `BridgeSFA.report`
|
|
108
|
+
* when a route requires a permit (`quote.needPermit === true`).
|
|
109
|
+
*/
|
|
110
|
+
interface PermitSignature {
|
|
111
|
+
amount: string;
|
|
112
|
+
deadline: number;
|
|
113
|
+
nonce: number;
|
|
114
|
+
owner: string;
|
|
115
|
+
r: string;
|
|
116
|
+
s: string;
|
|
117
|
+
v: 27 | 28;
|
|
118
|
+
}
|
|
7
119
|
interface GetAllQuoteParams {
|
|
8
120
|
singleService?: Service;
|
|
9
121
|
disabledServices?: Service[];
|
|
@@ -46,16 +158,41 @@ declare class BridgeSFA {
|
|
|
46
158
|
static send(serviceType: Service, params: {
|
|
47
159
|
wallet: any;
|
|
48
160
|
quote: any;
|
|
49
|
-
permitSignature?:
|
|
50
|
-
amount: string;
|
|
51
|
-
deadline: number;
|
|
52
|
-
nonce: string;
|
|
53
|
-
owner: string;
|
|
54
|
-
r: string;
|
|
55
|
-
s: string;
|
|
56
|
-
v: 27 | 28;
|
|
57
|
-
};
|
|
161
|
+
permitSignature?: PermitSignature;
|
|
58
162
|
}): Promise<string>;
|
|
163
|
+
/**
|
|
164
|
+
* Build the backend report payload for a submitted source-chain transaction.
|
|
165
|
+
* Shared by `send` (fire-and-forget) and `report` (awaited).
|
|
166
|
+
*/
|
|
167
|
+
private static buildReportData;
|
|
168
|
+
/**
|
|
169
|
+
* API-driven custody: build the serializable, unsigned transaction data for a
|
|
170
|
+
* route WITHOUT a signer. Intended for MPC wallets (e.g. Fireblocks) that sign
|
|
171
|
+
* and broadcast through their own infrastructure.
|
|
172
|
+
*
|
|
173
|
+
* Returns any required `approveTx` (and `approveResetTx` on Ethereum), the
|
|
174
|
+
* `permitTypedData` to sign off-chain when `quote.needPermit`, and the main
|
|
175
|
+
* `tx`. After the integrator broadcasts `tx`, call `BridgeSFA.report` with the
|
|
176
|
+
* resulting hash (and the permit signature, if any) so StableFlow can execute
|
|
177
|
+
* the destination leg.
|
|
178
|
+
*
|
|
179
|
+
* EVM only for now; non-EVM source chains throw.
|
|
180
|
+
*/
|
|
181
|
+
static buildTransaction(serviceType: Service, params: {
|
|
182
|
+
quote: any;
|
|
183
|
+
}): Promise<BuildTransactionResult>;
|
|
184
|
+
/**
|
|
185
|
+
* API-driven custody: report an externally signed & broadcast source-chain
|
|
186
|
+
* transaction back to StableFlow so it can track and execute the destination
|
|
187
|
+
* leg. Pair with `BridgeSFA.buildTransaction`.
|
|
188
|
+
*
|
|
189
|
+
* When `quote.needPermit === true`, `permitSignature` is required.
|
|
190
|
+
*/
|
|
191
|
+
static report(serviceType: Service, params: {
|
|
192
|
+
quote: any;
|
|
193
|
+
hash: string;
|
|
194
|
+
permitSignature?: PermitSignature;
|
|
195
|
+
}): CancelablePromise<SubmitDepositTxResponse>;
|
|
59
196
|
static getStatus(serviceType: Service, params: {
|
|
60
197
|
quote: any;
|
|
61
198
|
hash: string;
|
|
@@ -183,4 +320,4 @@ declare const OFT_ABI: ({
|
|
|
183
320
|
declare const FRAXZERO_MIDDLE_TOKEN_USDC: _stableflow_core.TokenConfig;
|
|
184
321
|
declare const FRAXZERO_MIDDLE_TOKEN_FRXUSD: _stableflow_core.TokenConfig;
|
|
185
322
|
|
|
186
|
-
export { BridgeSFA, DATA_HEX_PROTOBUF_EXTRA, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
|
|
323
|
+
export { BridgeSFA, type BuildTransactionResult, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,121 @@
|
|
|
1
1
|
import * as _stableflow_core from '@stableflow/core';
|
|
2
|
-
import { Service, TokenConfig, WalletConfig, TransactionStatus } from '@stableflow/core';
|
|
2
|
+
import { Service, TokenConfig, WalletConfig, CancelablePromise, SubmitDepositTxResponse, TransactionStatus } from '@stableflow/core';
|
|
3
3
|
import Big from 'big.js';
|
|
4
4
|
|
|
5
5
|
declare const ServiceMap: Record<Service, any>;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Serializable, unsigned EVM transaction data.
|
|
9
|
+
*
|
|
10
|
+
* This is what an API-driven custody integrator (e.g. an MPC wallet such as
|
|
11
|
+
* Fireblocks) receives. Stableflow builds the calldata; the integrator signs
|
|
12
|
+
* and broadcasts it through their own infrastructure, then reports the
|
|
13
|
+
* resulting hash back via `BridgeSFA.report`.
|
|
14
|
+
*/
|
|
15
|
+
interface EvmTxData {
|
|
16
|
+
chainId: number;
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
/** Hex-encoded calldata. `0x` for a plain native-token transfer. */
|
|
20
|
+
data: string;
|
|
21
|
+
/** Native token amount in wei, as a decimal string. */
|
|
22
|
+
value: string;
|
|
23
|
+
/** Optional gas limit as a decimal string. */
|
|
24
|
+
gasLimit?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* EIP-712 typed data for an ERC20 `Permit`, returned unsigned so an external
|
|
28
|
+
* signer (MPC/Fireblocks) can produce the signature. Nothing is signed or
|
|
29
|
+
* verified inside the SDK for this payload.
|
|
30
|
+
*/
|
|
31
|
+
interface PermitTypedData {
|
|
32
|
+
domain: {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
chainId: number;
|
|
36
|
+
verifyingContract: string;
|
|
37
|
+
};
|
|
38
|
+
types: Record<string, Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
}>>;
|
|
42
|
+
values: {
|
|
43
|
+
owner: string;
|
|
44
|
+
spender: string;
|
|
45
|
+
value: string;
|
|
46
|
+
nonce: string;
|
|
47
|
+
deadline: number;
|
|
48
|
+
};
|
|
49
|
+
deadline: number;
|
|
50
|
+
nonce: number;
|
|
51
|
+
token: string;
|
|
52
|
+
spender: string;
|
|
53
|
+
owner: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of `BridgeSFA.buildTransaction`.
|
|
57
|
+
*
|
|
58
|
+
* Depending on the route, the integrator may need to: broadcast `approveTx`
|
|
59
|
+
* (optionally `approveResetTx` first on Ethereum), sign `permitTypedData`,
|
|
60
|
+
* and always broadcast the main `tx`. See `BridgeSFA.buildTransaction`.
|
|
61
|
+
*/
|
|
62
|
+
interface BuildTransactionResult {
|
|
63
|
+
chainId: number;
|
|
64
|
+
from: string;
|
|
65
|
+
/** Present when `quote.needApprove === true`. */
|
|
66
|
+
approveTx?: EvmTxData;
|
|
67
|
+
/**
|
|
68
|
+
* Present when `quote.needApprove === true` and the source chain is Ethereum.
|
|
69
|
+
* Some Ethereum tokens (e.g. USDT) require resetting the allowance to 0
|
|
70
|
+
* before setting a new non-zero allowance.
|
|
71
|
+
*/
|
|
72
|
+
approveResetTx?: EvmTxData;
|
|
73
|
+
/** Present when `quote.needPermit === true`. Must be signed off-chain. */
|
|
74
|
+
permitTypedData?: PermitTypedData;
|
|
75
|
+
/** The main source-chain transaction to sign and broadcast. */
|
|
76
|
+
tx: EvmTxData;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build the main unsigned source-chain transaction from a quote, mirroring the
|
|
80
|
+
* branching in `BridgeSFA.send` but producing serializable calldata instead of
|
|
81
|
+
* signing/broadcasting.
|
|
82
|
+
*/
|
|
83
|
+
declare const buildSendTx: (serviceType: Service, quote: any) => EvmTxData;
|
|
84
|
+
/**
|
|
85
|
+
* Build the ERC20 approve transaction(s) for a quote that requires approval.
|
|
86
|
+
* On Ethereum an additional `approveResetTx` (approve 0) is returned so the
|
|
87
|
+
* integrator can reset a stale allowance before setting a new one.
|
|
88
|
+
*/
|
|
89
|
+
declare const buildApproveTx: (serviceType: Service, quote: any) => {
|
|
90
|
+
approveTx?: EvmTxData;
|
|
91
|
+
approveResetTx?: EvmTxData;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Build the EIP-712 `Permit` typed data for a permit-required route, returned
|
|
95
|
+
* unsigned. The integrator signs it with their MPC/Fireblocks signer, splits
|
|
96
|
+
* the signature into `v/r/s`, and passes the assembled `permitSignature` to
|
|
97
|
+
* `BridgeSFA.report`.
|
|
98
|
+
*/
|
|
99
|
+
declare const buildPermitTypedData: (params: {
|
|
100
|
+
permitToken: TokenConfig;
|
|
101
|
+
permitAmountWei: string;
|
|
102
|
+
permitSpender: string;
|
|
103
|
+
owner: string;
|
|
104
|
+
}) => Promise<PermitTypedData>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Normalized ERC20 permit signature passed to `BridgeSFA.send` / `BridgeSFA.report`
|
|
108
|
+
* when a route requires a permit (`quote.needPermit === true`).
|
|
109
|
+
*/
|
|
110
|
+
interface PermitSignature {
|
|
111
|
+
amount: string;
|
|
112
|
+
deadline: number;
|
|
113
|
+
nonce: number;
|
|
114
|
+
owner: string;
|
|
115
|
+
r: string;
|
|
116
|
+
s: string;
|
|
117
|
+
v: 27 | 28;
|
|
118
|
+
}
|
|
7
119
|
interface GetAllQuoteParams {
|
|
8
120
|
singleService?: Service;
|
|
9
121
|
disabledServices?: Service[];
|
|
@@ -46,16 +158,41 @@ declare class BridgeSFA {
|
|
|
46
158
|
static send(serviceType: Service, params: {
|
|
47
159
|
wallet: any;
|
|
48
160
|
quote: any;
|
|
49
|
-
permitSignature?:
|
|
50
|
-
amount: string;
|
|
51
|
-
deadline: number;
|
|
52
|
-
nonce: string;
|
|
53
|
-
owner: string;
|
|
54
|
-
r: string;
|
|
55
|
-
s: string;
|
|
56
|
-
v: 27 | 28;
|
|
57
|
-
};
|
|
161
|
+
permitSignature?: PermitSignature;
|
|
58
162
|
}): Promise<string>;
|
|
163
|
+
/**
|
|
164
|
+
* Build the backend report payload for a submitted source-chain transaction.
|
|
165
|
+
* Shared by `send` (fire-and-forget) and `report` (awaited).
|
|
166
|
+
*/
|
|
167
|
+
private static buildReportData;
|
|
168
|
+
/**
|
|
169
|
+
* API-driven custody: build the serializable, unsigned transaction data for a
|
|
170
|
+
* route WITHOUT a signer. Intended for MPC wallets (e.g. Fireblocks) that sign
|
|
171
|
+
* and broadcast through their own infrastructure.
|
|
172
|
+
*
|
|
173
|
+
* Returns any required `approveTx` (and `approveResetTx` on Ethereum), the
|
|
174
|
+
* `permitTypedData` to sign off-chain when `quote.needPermit`, and the main
|
|
175
|
+
* `tx`. After the integrator broadcasts `tx`, call `BridgeSFA.report` with the
|
|
176
|
+
* resulting hash (and the permit signature, if any) so StableFlow can execute
|
|
177
|
+
* the destination leg.
|
|
178
|
+
*
|
|
179
|
+
* EVM only for now; non-EVM source chains throw.
|
|
180
|
+
*/
|
|
181
|
+
static buildTransaction(serviceType: Service, params: {
|
|
182
|
+
quote: any;
|
|
183
|
+
}): Promise<BuildTransactionResult>;
|
|
184
|
+
/**
|
|
185
|
+
* API-driven custody: report an externally signed & broadcast source-chain
|
|
186
|
+
* transaction back to StableFlow so it can track and execute the destination
|
|
187
|
+
* leg. Pair with `BridgeSFA.buildTransaction`.
|
|
188
|
+
*
|
|
189
|
+
* When `quote.needPermit === true`, `permitSignature` is required.
|
|
190
|
+
*/
|
|
191
|
+
static report(serviceType: Service, params: {
|
|
192
|
+
quote: any;
|
|
193
|
+
hash: string;
|
|
194
|
+
permitSignature?: PermitSignature;
|
|
195
|
+
}): CancelablePromise<SubmitDepositTxResponse>;
|
|
59
196
|
static getStatus(serviceType: Service, params: {
|
|
60
197
|
quote: any;
|
|
61
198
|
hash: string;
|
|
@@ -183,4 +320,4 @@ declare const OFT_ABI: ({
|
|
|
183
320
|
declare const FRAXZERO_MIDDLE_TOKEN_USDC: _stableflow_core.TokenConfig;
|
|
184
321
|
declare const FRAXZERO_MIDDLE_TOKEN_FRXUSD: _stableflow_core.TokenConfig;
|
|
185
322
|
|
|
186
|
-
export { BridgeSFA, DATA_HEX_PROTOBUF_EXTRA, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
|
|
323
|
+
export { BridgeSFA, type BuildTransactionResult, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
|