@stableflow/bridges 3.0.0-beta-02a59f37a0-20260515

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/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @stableflow/bridges
2
+
3
+ StableFlow bridge services: OneClick, CCTP, USDT0, FraxZero, Native, and composite routes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @stableflow/bridges @stableflow/core
9
+ ```
10
+
11
+ Also install the wallet adapter(s) for the chains you support (e.g. `@stableflow/wallet-evm`).
12
+
13
+ ## When to use
14
+
15
+ Use this package when you need:
16
+
17
+ - **Multi-route quotes** across all supported bridge services (`BridgeSFA.getAllQuote`)
18
+ - **Unified send and status** for a selected route (`BridgeSFA.send`, `BridgeSFA.getStatus`)
19
+ - Low-level access to individual bridge implementations via `ServiceMap`
20
+
21
+ For HTTP-only quote/status without wallet orchestration, [`@stableflow/core`](../core/README.md) `SFA` may be enough.
22
+
23
+ ## Main exports
24
+
25
+ | Export | Description |
26
+ |--------|-------------|
27
+ | `BridgeSFA` | Multi-route quote, send, and status |
28
+ | `GetAllQuoteParams` | Parameters for `getAllQuote` |
29
+ | `ServiceMap` | Per-service `quote` / `send` / `getStatus` implementations |
30
+ | `getQuoteModes` | Helpers to interpret quote shape (OneClick, exact output, etc.) |
31
+ | USDT0 / FraxZero | `USDT0_CONFIG`, `OFT_ABI`, `getHopMsgFee`, `FRAXZERO_MIDDLE_TOKEN_*`, … |
32
+
33
+ Supported `Service` values (from `@stableflow/core`): `oneclick`, `usdt0`, `cctp`, `fraxzero`, composite routes (`usdt0-oneclick`, `oneclick-usdt0`, `fraxzero-oneclick`, `oneclick-fraxzero`), and `native`.
34
+
35
+ See `dist/index.d.ts` after `pnpm build`.
36
+
37
+ ## Quick example
38
+
39
+ ```ts
40
+ import { BridgeSFA } from '@stableflow/bridges';
41
+ import { EVMWallet } from '@stableflow/wallet-evm';
42
+
43
+ const wallet = new EVMWallet(/* provider */);
44
+
45
+ const results = await BridgeSFA.getAllQuote({
46
+ dry: true, // fast comparison; use dry: false before send
47
+ prices: { ETH: '3000', BNB: '900' },
48
+ fromToken,
49
+ toToken,
50
+ wallet: wallet.wallet,
51
+ recipient: '0x...',
52
+ refundTo: '0x...',
53
+ amountWei: '1000000',
54
+ slippageTolerance: 0.5,
55
+ });
56
+
57
+ const txHash = await BridgeSFA.send(serviceType, { wallet: wallet.wallet, quote });
58
+ ```
59
+
60
+ ## See also
61
+
62
+ - [Developer Guide](../../DEVELOPER_GUIDE.md) — `dry` flag, wallet integration, Hyperliquid
63
+ - [@stableflow/core](../core/README.md)
@@ -0,0 +1,160 @@
1
+ import * as _stableflow_core from '@stableflow/core';
2
+ import { Service, TokenConfig, WalletConfig, TransactionStatus } from '@stableflow/core';
3
+
4
+ declare const ServiceMap: Record<Service, any>;
5
+
6
+ interface GetAllQuoteParams {
7
+ singleService?: Service;
8
+ disabledServices?: Service[];
9
+ dry?: boolean;
10
+ prices: Record<string, string>;
11
+ fromToken: TokenConfig;
12
+ toToken: TokenConfig;
13
+ wallet: WalletConfig;
14
+ evmWallet?: WalletConfig;
15
+ evmAddress?: string;
16
+ recipient: string;
17
+ refundTo: string;
18
+ amountWei: string;
19
+ slippageTolerance: number;
20
+ minInputAmount?: string;
21
+ /** @deprecated Please migrate to oneclickParams */
22
+ appFees?: {
23
+ recipient: string;
24
+ fee: number;
25
+ }[];
26
+ oneclickParams?: {
27
+ appFees?: {
28
+ recipient: string;
29
+ fee: number;
30
+ }[];
31
+ swapType?: "EXACT_INPUT" | "EXACT_OUTPUT";
32
+ isProxy?: boolean;
33
+ };
34
+ }
35
+ /**
36
+ * Full cross-chain bridge API (multi-route quote, send, status).
37
+ * Install `@stableflow/bridges` alongside `@stableflow/core`.
38
+ */
39
+ declare class BridgeSFA {
40
+ static getAllQuote(params: GetAllQuoteParams): Promise<Array<{
41
+ serviceType: Service;
42
+ quote?: any;
43
+ error?: string;
44
+ }>>;
45
+ static send(serviceType: Service, params: {
46
+ wallet: any;
47
+ quote: any;
48
+ permitSignature?: {
49
+ amount: string;
50
+ deadline: number;
51
+ nonce: string;
52
+ owner: string;
53
+ r: string;
54
+ s: string;
55
+ v: 27 | 28;
56
+ };
57
+ }): Promise<string>;
58
+ static getStatus(serviceType: Service, params: {
59
+ depositAddress?: string;
60
+ hash?: string;
61
+ }): Promise<{
62
+ status: TransactionStatus;
63
+ toChainTxHash?: string;
64
+ }>;
65
+ }
66
+
67
+ interface LayerZeroChainConfig {
68
+ eid: number;
69
+ chainKey: string;
70
+ blockTime: number;
71
+ }
72
+
73
+ declare const getQuoteModes: (params: {
74
+ quoteData?: any;
75
+ bridgeStore?: {
76
+ quoteDataService: Service;
77
+ };
78
+ }) => {
79
+ isExactOutput: boolean;
80
+ isOneClickService: boolean;
81
+ isQuoteParamDepositAddress: boolean;
82
+ isPermitWithNonce: boolean;
83
+ };
84
+
85
+ declare const getHopMsgFee: (params: any) => Promise<bigint>;
86
+
87
+ interface Usdt0Config extends LayerZeroChainConfig {
88
+ contractAddress: string;
89
+ oft?: string;
90
+ oftLegacy?: string;
91
+ oftMultiHopComposer?: string;
92
+ oftTetherTokenOFTExtension?: string;
93
+ confirmations: number;
94
+ lzReceiveOptionGas: number;
95
+ lzReceiveOptionGasLegacy: number;
96
+ composeOptionGas?: number;
97
+ oftApprovalRequired?: boolean;
98
+ oftLegacyApprovalRequired?: boolean;
99
+ }
100
+ declare const USDT0_CONFIG: Record<string, Usdt0Config>;
101
+ declare const LZ_RECEIVE_VALUE: Record<string, any>;
102
+ declare const USDT0_LEGACY_MESH_TRANSFTER_FEE = 0.0003;
103
+ declare const DATA_HEX_PROTOBUF_EXTRA = 3;
104
+ declare const SIGNATURE_SIZE = 67;
105
+
106
+ declare const OFT_ABI: ({
107
+ inputs: never[];
108
+ name: string;
109
+ outputs: {
110
+ internalType: string;
111
+ name: string;
112
+ type: string;
113
+ }[];
114
+ stateMutability: string;
115
+ type: string;
116
+ } | {
117
+ inputs: ({
118
+ components: {
119
+ internalType: string;
120
+ name: string;
121
+ type: string;
122
+ }[];
123
+ internalType: string;
124
+ name: string;
125
+ type: string;
126
+ } | {
127
+ internalType: string;
128
+ name: string;
129
+ type: string;
130
+ components?: undefined;
131
+ })[];
132
+ name: string;
133
+ outputs: {
134
+ components: ({
135
+ internalType: string;
136
+ name: string;
137
+ type: string;
138
+ components?: undefined;
139
+ } | {
140
+ components: {
141
+ internalType: string;
142
+ name: string;
143
+ type: string;
144
+ }[];
145
+ internalType: string;
146
+ name: string;
147
+ type: string;
148
+ })[];
149
+ internalType: string;
150
+ name: string;
151
+ type: string;
152
+ }[];
153
+ stateMutability: string;
154
+ type: string;
155
+ })[];
156
+
157
+ declare const FRAXZERO_MIDDLE_TOKEN_USDC: _stableflow_core.TokenConfig;
158
+ declare const FRAXZERO_MIDDLE_TOKEN_FRXUSD: _stableflow_core.TokenConfig;
159
+
160
+ 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, getHopMsgFee, getQuoteModes };
@@ -0,0 +1,160 @@
1
+ import * as _stableflow_core from '@stableflow/core';
2
+ import { Service, TokenConfig, WalletConfig, TransactionStatus } from '@stableflow/core';
3
+
4
+ declare const ServiceMap: Record<Service, any>;
5
+
6
+ interface GetAllQuoteParams {
7
+ singleService?: Service;
8
+ disabledServices?: Service[];
9
+ dry?: boolean;
10
+ prices: Record<string, string>;
11
+ fromToken: TokenConfig;
12
+ toToken: TokenConfig;
13
+ wallet: WalletConfig;
14
+ evmWallet?: WalletConfig;
15
+ evmAddress?: string;
16
+ recipient: string;
17
+ refundTo: string;
18
+ amountWei: string;
19
+ slippageTolerance: number;
20
+ minInputAmount?: string;
21
+ /** @deprecated Please migrate to oneclickParams */
22
+ appFees?: {
23
+ recipient: string;
24
+ fee: number;
25
+ }[];
26
+ oneclickParams?: {
27
+ appFees?: {
28
+ recipient: string;
29
+ fee: number;
30
+ }[];
31
+ swapType?: "EXACT_INPUT" | "EXACT_OUTPUT";
32
+ isProxy?: boolean;
33
+ };
34
+ }
35
+ /**
36
+ * Full cross-chain bridge API (multi-route quote, send, status).
37
+ * Install `@stableflow/bridges` alongside `@stableflow/core`.
38
+ */
39
+ declare class BridgeSFA {
40
+ static getAllQuote(params: GetAllQuoteParams): Promise<Array<{
41
+ serviceType: Service;
42
+ quote?: any;
43
+ error?: string;
44
+ }>>;
45
+ static send(serviceType: Service, params: {
46
+ wallet: any;
47
+ quote: any;
48
+ permitSignature?: {
49
+ amount: string;
50
+ deadline: number;
51
+ nonce: string;
52
+ owner: string;
53
+ r: string;
54
+ s: string;
55
+ v: 27 | 28;
56
+ };
57
+ }): Promise<string>;
58
+ static getStatus(serviceType: Service, params: {
59
+ depositAddress?: string;
60
+ hash?: string;
61
+ }): Promise<{
62
+ status: TransactionStatus;
63
+ toChainTxHash?: string;
64
+ }>;
65
+ }
66
+
67
+ interface LayerZeroChainConfig {
68
+ eid: number;
69
+ chainKey: string;
70
+ blockTime: number;
71
+ }
72
+
73
+ declare const getQuoteModes: (params: {
74
+ quoteData?: any;
75
+ bridgeStore?: {
76
+ quoteDataService: Service;
77
+ };
78
+ }) => {
79
+ isExactOutput: boolean;
80
+ isOneClickService: boolean;
81
+ isQuoteParamDepositAddress: boolean;
82
+ isPermitWithNonce: boolean;
83
+ };
84
+
85
+ declare const getHopMsgFee: (params: any) => Promise<bigint>;
86
+
87
+ interface Usdt0Config extends LayerZeroChainConfig {
88
+ contractAddress: string;
89
+ oft?: string;
90
+ oftLegacy?: string;
91
+ oftMultiHopComposer?: string;
92
+ oftTetherTokenOFTExtension?: string;
93
+ confirmations: number;
94
+ lzReceiveOptionGas: number;
95
+ lzReceiveOptionGasLegacy: number;
96
+ composeOptionGas?: number;
97
+ oftApprovalRequired?: boolean;
98
+ oftLegacyApprovalRequired?: boolean;
99
+ }
100
+ declare const USDT0_CONFIG: Record<string, Usdt0Config>;
101
+ declare const LZ_RECEIVE_VALUE: Record<string, any>;
102
+ declare const USDT0_LEGACY_MESH_TRANSFTER_FEE = 0.0003;
103
+ declare const DATA_HEX_PROTOBUF_EXTRA = 3;
104
+ declare const SIGNATURE_SIZE = 67;
105
+
106
+ declare const OFT_ABI: ({
107
+ inputs: never[];
108
+ name: string;
109
+ outputs: {
110
+ internalType: string;
111
+ name: string;
112
+ type: string;
113
+ }[];
114
+ stateMutability: string;
115
+ type: string;
116
+ } | {
117
+ inputs: ({
118
+ components: {
119
+ internalType: string;
120
+ name: string;
121
+ type: string;
122
+ }[];
123
+ internalType: string;
124
+ name: string;
125
+ type: string;
126
+ } | {
127
+ internalType: string;
128
+ name: string;
129
+ type: string;
130
+ components?: undefined;
131
+ })[];
132
+ name: string;
133
+ outputs: {
134
+ components: ({
135
+ internalType: string;
136
+ name: string;
137
+ type: string;
138
+ components?: undefined;
139
+ } | {
140
+ components: {
141
+ internalType: string;
142
+ name: string;
143
+ type: string;
144
+ }[];
145
+ internalType: string;
146
+ name: string;
147
+ type: string;
148
+ })[];
149
+ internalType: string;
150
+ name: string;
151
+ type: string;
152
+ }[];
153
+ stateMutability: string;
154
+ type: string;
155
+ })[];
156
+
157
+ declare const FRAXZERO_MIDDLE_TOKEN_USDC: _stableflow_core.TokenConfig;
158
+ declare const FRAXZERO_MIDDLE_TOKEN_FRXUSD: _stableflow_core.TokenConfig;
159
+
160
+ 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, getHopMsgFee, getQuoteModes };