@rabby-wallet/rabby-bridge 0.0.13-alpha.0 → 0.0.13
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 +1 -131
- package/dist/chains.d.ts +2 -1
- package/dist/chains.js +2 -0
- package/dist/data.d.ts +3 -0
- package/dist/data.js +3 -0
- package/dist/index.d.ts +1 -7
- package/dist/index.js +0 -3
- package/dist/quote.d.ts +4 -18
- package/dist/quote.js +65 -282
- package/package.json +3 -13
- package/dist/calldata/abi.d.ts +0 -29
- package/dist/calldata/abi.js +0 -160
- package/dist/calldata/across/deposit.d.ts +0 -2
- package/dist/calldata/across/deposit.js +0 -36
- package/dist/calldata/across/depositNative.d.ts +0 -2
- package/dist/calldata/across/depositNative.js +0 -45
- package/dist/calldata/across/depositNow.d.ts +0 -2
- package/dist/calldata/across/depositNow.js +0 -35
- package/dist/calldata/across/depositV3.d.ts +0 -2
- package/dist/calldata/across/depositV3.js +0 -35
- package/dist/calldata/across/depositV3Now.d.ts +0 -2
- package/dist/calldata/across/depositV3Now.js +0 -34
- package/dist/calldata/across/index.d.ts +0 -4
- package/dist/calldata/across/index.js +0 -31
- package/dist/calldata/across/swapAndBridge.d.ts +0 -2
- package/dist/calldata/across/swapAndBridge.js +0 -70
- package/dist/calldata/across/validate.d.ts +0 -3
- package/dist/calldata/across/validate.js +0 -30
- package/dist/calldata/chains.d.ts +0 -2
- package/dist/calldata/chains.js +0 -35
- package/dist/calldata/destination.d.ts +0 -6
- package/dist/calldata/destination.js +0 -148
- package/dist/calldata/diagnostics.d.ts +0 -4
- package/dist/calldata/diagnostics.js +0 -18
- package/dist/calldata/expect.d.ts +0 -25
- package/dist/calldata/expect.js +0 -129
- package/dist/calldata/hex.d.ts +0 -6
- package/dist/calldata/hex.js +0 -46
- package/dist/calldata/index.d.ts +0 -20
- package/dist/calldata/index.js +0 -85
- package/dist/calldata/lifi/across/acrossV4Erc20Min.d.ts +0 -2
- package/dist/calldata/lifi/across/acrossV4Erc20Min.js +0 -26
- package/dist/calldata/lifi/across/acrossV4NativeMin.d.ts +0 -2
- package/dist/calldata/lifi/across/acrossV4NativeMin.js +0 -22
- package/dist/calldata/lifi/across/index.d.ts +0 -6
- package/dist/calldata/lifi/across/index.js +0 -19
- package/dist/calldata/lifi/allbridge/index.d.ts +0 -3
- package/dist/calldata/lifi/allbridge/index.js +0 -26
- package/dist/calldata/lifi/celer/index.d.ts +0 -4
- package/dist/calldata/lifi/celer/index.js +0 -10
- package/dist/calldata/lifi/centrifuge/index.d.ts +0 -3
- package/dist/calldata/lifi/centrifuge/index.js +0 -22
- package/dist/calldata/lifi/frax/index.d.ts +0 -4
- package/dist/calldata/lifi/frax/index.js +0 -29
- package/dist/calldata/lifi/garden/index.d.ts +0 -3
- package/dist/calldata/lifi/garden/index.js +0 -22
- package/dist/calldata/lifi/gaszip/index.d.ts +0 -6
- package/dist/calldata/lifi/gaszip/index.js +0 -15
- package/dist/calldata/lifi/index.d.ts +0 -4
- package/dist/calldata/lifi/index.js +0 -60
- package/dist/calldata/lifi/intents/index.d.ts +0 -4
- package/dist/calldata/lifi/intents/index.js +0 -10
- package/dist/calldata/lifi/layerswap/index.d.ts +0 -4
- package/dist/calldata/lifi/layerswap/index.js +0 -10
- package/dist/calldata/lifi/m0/index.d.ts +0 -3
- package/dist/calldata/lifi/m0/index.js +0 -33
- package/dist/calldata/lifi/mayan/index.d.ts +0 -4
- package/dist/calldata/lifi/mayan/index.js +0 -10
- package/dist/calldata/lifi/method.d.ts +0 -6
- package/dist/calldata/lifi/method.js +0 -16
- package/dist/calldata/lifi/native/index.d.ts +0 -4
- package/dist/calldata/lifi/native/index.js +0 -80
- package/dist/calldata/lifi/params.d.ts +0 -30
- package/dist/calldata/lifi/params.js +0 -370
- package/dist/calldata/lifi/paxos/index.d.ts +0 -4
- package/dist/calldata/lifi/paxos/index.js +0 -10
- package/dist/calldata/lifi/polymer/index.d.ts +0 -4
- package/dist/calldata/lifi/polymer/index.js +0 -10
- package/dist/calldata/lifi/relay/index.d.ts +0 -6
- package/dist/calldata/lifi/relay/index.js +0 -15
- package/dist/calldata/lifi/shape.d.ts +0 -4
- package/dist/calldata/lifi/shape.js +0 -31
- package/dist/calldata/lifi/squid/index.d.ts +0 -6
- package/dist/calldata/lifi/squid/index.js +0 -15
- package/dist/calldata/lifi/stargate/index.d.ts +0 -5
- package/dist/calldata/lifi/stargate/index.js +0 -15
- package/dist/calldata/lifi/swap/index.d.ts +0 -5
- package/dist/calldata/lifi/swap/index.js +0 -18
- package/dist/calldata/lifi/swap/swapMethod.d.ts +0 -2
- package/dist/calldata/lifi/swap/swapMethod.js +0 -40
- package/dist/calldata/match.d.ts +0 -3
- package/dist/calldata/match.js +0 -21
- package/dist/calldata/mayan/destination.d.ts +0 -2
- package/dist/calldata/mayan/destination.js +0 -13
- package/dist/calldata/mayan/fastMctpBridge.d.ts +0 -3
- package/dist/calldata/mayan/fastMctpBridge.js +0 -43
- package/dist/calldata/mayan/fastMctpCreateOrder.d.ts +0 -3
- package/dist/calldata/mayan/fastMctpCreateOrder.js +0 -39
- package/dist/calldata/mayan/forward.d.ts +0 -8
- package/dist/calldata/mayan/forward.js +0 -35
- package/dist/calldata/mayan/forwardERC20.d.ts +0 -2
- package/dist/calldata/mayan/forwardERC20.js +0 -19
- package/dist/calldata/mayan/forwardEth.d.ts +0 -2
- package/dist/calldata/mayan/forwardEth.js +0 -16
- package/dist/calldata/mayan/index.d.ts +0 -4
- package/dist/calldata/mayan/index.js +0 -21
- package/dist/calldata/mayan/mctp.d.ts +0 -5
- package/dist/calldata/mayan/mctp.js +0 -41
- package/dist/calldata/mayan/readProtocol.d.ts +0 -2
- package/dist/calldata/mayan/readProtocol.js +0 -29
- package/dist/calldata/mayan/swapAndForwardERC20.d.ts +0 -2
- package/dist/calldata/mayan/swapAndForwardERC20.js +0 -24
- package/dist/calldata/mayan/swapAndForwardEth.d.ts +0 -2
- package/dist/calldata/mayan/swapAndForwardEth.js +0 -23
- package/dist/calldata/mayan/swiftCreateOrder.d.ts +0 -3
- package/dist/calldata/mayan/swiftCreateOrder.js +0 -49
- package/dist/calldata/mayan/validate.d.ts +0 -3
- package/dist/calldata/mayan/validate.js +0 -20
- package/dist/calldata/protocols.d.ts +0 -9
- package/dist/calldata/protocols.js +0 -56
- package/dist/calldata/relay/calls.d.ts +0 -13
- package/dist/calldata/relay/calls.js +0 -54
- package/dist/calldata/relay/depositErc20.d.ts +0 -2
- package/dist/calldata/relay/depositErc20.js +0 -22
- package/dist/calldata/relay/depositErc20Allowance.d.ts +0 -2
- package/dist/calldata/relay/depositErc20Allowance.js +0 -20
- package/dist/calldata/relay/depositNative.d.ts +0 -2
- package/dist/calldata/relay/depositNative.js +0 -20
- package/dist/calldata/relay/index.d.ts +0 -4
- package/dist/calldata/relay/index.js +0 -40
- package/dist/calldata/relay/multicall.d.ts +0 -2
- package/dist/calldata/relay/multicall.js +0 -15
- package/dist/calldata/relay/permit2TransferAndMulticall.d.ts +0 -2
- package/dist/calldata/relay/permit2TransferAndMulticall.js +0 -42
- package/dist/calldata/relay/permit3009TransferAndMulticall.d.ts +0 -2
- package/dist/calldata/relay/permit3009TransferAndMulticall.js +0 -41
- package/dist/calldata/relay/permit3009TransferAndMulticallSigned.d.ts +0 -2
- package/dist/calldata/relay/permit3009TransferAndMulticallSigned.js +0 -40
- package/dist/calldata/relay/permitTransferAndMulticall.d.ts +0 -2
- package/dist/calldata/relay/permitTransferAndMulticall.js +0 -34
- package/dist/calldata/relay/permitTransferAndMulticallLegacy.d.ts +0 -2
- package/dist/calldata/relay/permitTransferAndMulticallLegacy.js +0 -35
- package/dist/calldata/relay/transferAndMulticall.d.ts +0 -2
- package/dist/calldata/relay/transferAndMulticall.js +0 -26
- package/dist/calldata/relay/validate.d.ts +0 -3
- package/dist/calldata/relay/validate.js +0 -18
- package/dist/calldata/resolve.d.ts +0 -2
- package/dist/calldata/resolve.js +0 -28
- package/dist/calldata/socket/bridge.d.ts +0 -2
- package/dist/calldata/socket/bridge.js +0 -28
- package/dist/calldata/socket/exec.d.ts +0 -2
- package/dist/calldata/socket/exec.js +0 -71
- package/dist/calldata/socket/index.d.ts +0 -4
- package/dist/calldata/socket/index.js +0 -13
- package/dist/calldata/socket/params.d.ts +0 -5
- package/dist/calldata/socket/params.js +0 -14
- package/dist/calldata/socket/protocols/ccip.d.ts +0 -2
- package/dist/calldata/socket/protocols/ccip.js +0 -32
- package/dist/calldata/socket/protocols/cctp.d.ts +0 -2
- package/dist/calldata/socket/protocols/cctp.js +0 -24
- package/dist/calldata/socket/protocols/eco.d.ts +0 -2
- package/dist/calldata/socket/protocols/eco.js +0 -20
- package/dist/calldata/socket/protocols/index.d.ts +0 -3
- package/dist/calldata/socket/protocols/index.js +0 -81
- package/dist/calldata/socket/protocols/native.d.ts +0 -2
- package/dist/calldata/socket/protocols/native.js +0 -70
- package/dist/calldata/socket/protocols/oft.d.ts +0 -2
- package/dist/calldata/socket/protocols/oft.js +0 -31
- package/dist/calldata/socket/protocols/swapsXYZ.d.ts +0 -2
- package/dist/calldata/socket/protocols/swapsXYZ.js +0 -62
- package/dist/calldata/socket/swapAndBridge.d.ts +0 -2
- package/dist/calldata/socket/swapAndBridge.js +0 -37
- package/dist/calldata/socket/validate.d.ts +0 -3
- package/dist/calldata/socket/validate.js +0 -21
- package/dist/calldata/types.d.ts +0 -82
- package/dist/calldata/types.js +0 -20
- package/dist/errors/constants.d.ts +0 -876
- package/dist/errors/constants.js +0 -883
- package/dist/errors/index.d.ts +0 -61
- package/dist/errors/index.js +0 -53
- package/dist/errors/sanitize.d.ts +0 -3
- package/dist/errors/sanitize.js +0 -75
- package/dist/providers/data.d.ts +0 -23
- package/dist/providers/data.js +0 -116
- package/dist/providers/errors.d.ts +0 -7
- package/dist/providers/errors.js +0 -10
- package/dist/providers/index.d.ts +0 -7
- package/dist/providers/index.js +0 -340
- package/dist/providers/layerswap.d.ts +0 -9
- package/dist/providers/layerswap.js +0 -95
- package/dist/providers/relay.d.ts +0 -59
- package/dist/providers/relay.js +0 -185
- package/dist/providers/request.d.ts +0 -23
- package/dist/providers/request.js +0 -69
- package/dist/providers/socket.d.ts +0 -5
- package/dist/providers/socket.js +0 -57
- package/dist/providers/types.d.ts +0 -36
- package/dist/providers/types.js +0 -1
package/README.md
CHANGED
|
@@ -5,138 +5,8 @@ Minimal bridge SDK for Rabby:
|
|
|
5
5
|
- enumerates supported bridge aggregators and chains
|
|
6
6
|
- maintains per-chain spender/router allowlists
|
|
7
7
|
- validates backend bridge quotes before returning them
|
|
8
|
-
-
|
|
9
|
-
- keeps chain-state-dependent output fields explicitly unverified, without RPC requests
|
|
10
|
-
- validates Relay orders, three Socket routes and LI.FI LayerSwap through direct provider requests
|
|
11
|
-
|
|
12
|
-
See [calldata parsing](src/calldata/README.md) for supported paths, integration and verification boundaries.
|
|
13
|
-
See [direct provider integration](src/providers/README.md) for the shared extension/mobile
|
|
14
|
-
transport interface, quote binding, application-fee constraints and signing checks.
|
|
8
|
+
- does not implement calldata decoding
|
|
15
9
|
|
|
16
10
|
## Test
|
|
17
11
|
|
|
18
12
|
Run `yarn test` to build the package and execute the Jest suite.
|
|
19
|
-
|
|
20
|
-
See [reachable route discovery](tests/fixtures/route-discovery-20261104/README.md) for the latest parsing changes, fixture coverage and remaining verification limits.
|
|
21
|
-
|
|
22
|
-
## Lite rollout
|
|
23
|
-
|
|
24
|
-
Pass `lite: true` to `getQuote`, `buildTx` or `getQuoteListWithTx` to observe new
|
|
25
|
-
validation without letting it change the business decisions from `main`.
|
|
26
|
-
The default is `false`, retaining strict behavior.
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
const quotes = await getQuoteListWithTx(aggregatorId, {
|
|
30
|
-
...params,
|
|
31
|
-
lite: true,
|
|
32
|
-
onError: (report) => reportToBusiness(report),
|
|
33
|
-
}, api);
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- Quotes and transactions come from the existing backend flow, including Relay
|
|
37
|
-
and Socket. Provider quotes never replace the selected backend quote in lite mode.
|
|
38
|
-
- Configured Router/Spender mismatches, unsupported source chains/aggregators,
|
|
39
|
-
missing required slippage, missing backend results and backend request failures
|
|
40
|
-
keep their original blocking behavior.
|
|
41
|
-
- Calldata parsing, intent comparison, missing-field checks, stricter missing
|
|
42
|
-
contract configuration and provider verification still run against the returned
|
|
43
|
-
transaction. Their failures are reported without discarding that quote/transaction.
|
|
44
|
-
- No parser is reported as unsupported, including aggregators that strict mode
|
|
45
|
-
does not currently parse. It is never reported as a successful parse.
|
|
46
|
-
- Relay/Socket verification uses available proof/cache for the selected transaction.
|
|
47
|
-
If that proof or client is missing, the original missing-proof error is reported;
|
|
48
|
-
dependent hash/order checks cannot complete. An unrelated fresh provider quote
|
|
49
|
-
is not fetched or used as evidence for the backend transaction.
|
|
50
|
-
- LayerSwap lookup runs in the background in lite mode. Its result is reported
|
|
51
|
-
through `onError` and does not delay returning the backend transaction.
|
|
52
|
-
|
|
53
|
-
`validateBridgeQuote` also accepts `{ lite, onError }` as its fourth argument;
|
|
54
|
-
`validateBridgeTx` accepts it after the optional expectation as its sixth argument.
|
|
55
|
-
Raw decode/calldata-check results remain truthful (`ok: false` on failure).
|
|
56
|
-
Direct provider-client methods remain strict; use the high-level entry points for
|
|
57
|
-
lite rollout decisions.
|
|
58
|
-
|
|
59
|
-
Error codes and details are preserved. Lite observations carry `lite: true` and
|
|
60
|
-
`blocking: false`; legacy failures carry `blocking: true` when reported by the
|
|
61
|
-
high-level flow. Keep the callback installed while background checks are pending.
|
|
62
|
-
Dependent checks still stop at their first unusable prerequisite, and independent
|
|
63
|
-
stages may emit multiple reports. These are failure-event/path counts, not distinct
|
|
64
|
-
user counts or a denominator for all successful transactions. No user identifiers
|
|
65
|
-
are added. See error reporting below for catching failures that still throw.
|
|
66
|
-
|
|
67
|
-
## Error reporting
|
|
68
|
-
|
|
69
|
-
All stable error codes, stages and messages are defined in
|
|
70
|
-
[`BRIDGE_ERRORS`](src/errors/constants.ts). Codes are explicit constants; callers
|
|
71
|
-
must not classify errors by matching message text. Existing error classes and
|
|
72
|
-
legacy `reason` fields remain available.
|
|
73
|
-
|
|
74
|
-
- `decodeBridgeCalldataResult(aggregatorId, tx)` returns a detailed success/failure
|
|
75
|
-
result. The existing `decodeBridgeCalldata` still returns `null` on failure.
|
|
76
|
-
- `validateBridgeCalldata` returns `errors`, plus `error_code` and `stage` on failure.
|
|
77
|
-
Independent intent mismatches are collected together; decoding or dependent
|
|
78
|
-
protocol operations stop at their first failure.
|
|
79
|
-
- Thrown SDK errors extend `BridgeError`. Use `error.toJSON()` for a report.
|
|
80
|
-
- `onError` receives failures filtered from `getQuote` / `getQuoteListWithTx`.
|
|
81
|
-
Directly thrown errors are handled by the caller, avoiding duplicate reporting.
|
|
82
|
-
Reporting callback failures do not affect validation or quote filtering.
|
|
83
|
-
|
|
84
|
-
```ts
|
|
85
|
-
import { BridgeError, getQuoteListWithTx } from '@rabby-wallet/rabby-bridge';
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const quotes = await getQuoteListWithTx(aggregatorId, {
|
|
89
|
-
...params,
|
|
90
|
-
onError: (report) => reportToBusiness(report),
|
|
91
|
-
}, api);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (error instanceof BridgeError) reportToBusiness(error.toJSON());
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
A report contains a primary `error_code` / `stage` and an `errors` list. The primary
|
|
99
|
-
code is the first failure; inspect the list for every collected failure. Each detail
|
|
100
|
-
contains its fixed message and available context: aggregator, chain, bridge,
|
|
101
|
-
provider, operation, method, selector, nested protocol selector, missing fields or
|
|
102
|
-
HTTP status. SDK reports omit wallet addresses, amounts, raw calldata, response
|
|
103
|
-
bodies and arbitrary transport exception messages. Existing Error messages are
|
|
104
|
-
retained for compatibility; prefer `toJSON()` for reporting.
|
|
105
|
-
|
|
106
|
-
Stages distinguish input checks, contract allowlists, ABI decoding, protocol
|
|
107
|
-
structure, intent comparison, provider requests, provider responses, transaction
|
|
108
|
-
binding and completeness. Unexpected uncategorized failures use `BRIDGE_UNKNOWN`.
|
|
109
|
-
Deferred chain-state output fields remain in `unverifiedFields`; they do not
|
|
110
|
-
become errors merely because RPC validation is postponed.
|
|
111
|
-
|
|
112
|
-
### Privacy-safe diagnostics
|
|
113
|
-
|
|
114
|
-
Use `toBridgeErrorReport(resultOrError)` to convert a failed calldata check,
|
|
115
|
-
detailed decode result or exception into a report. Passing a successful result
|
|
116
|
-
returns `undefined`. The `onError` callback and `BridgeError.toJSON()` use the same
|
|
117
|
-
runtime allowlist. Do not upload the entire check, exception, parsed transaction,
|
|
118
|
-
request parameters or quote response.
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
const check = validateBridgeCalldata(aggregatorId, chainId, tx, expectation);
|
|
122
|
-
const report = toBridgeErrorReport(check);
|
|
123
|
-
if (report) reportToBusiness(report);
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Reports can retain recognized aggregator/bridge/method labels, source/destination
|
|
127
|
-
chains, outer/router/protocol selectors, call-data format and byte lengths, ABI
|
|
128
|
-
failure offsets, bounded destination-call selectors/counts, unsupported command
|
|
129
|
-
bytes/counts, static request categories and HTTP status. Nested diagnostics are
|
|
130
|
-
collected where the parser knows the call layout; arbitrary payload bytes are not
|
|
131
|
-
scanned for possible selectors. Destination selector lists are deduplicated and
|
|
132
|
-
limited to 16 entries.
|
|
133
|
-
|
|
134
|
-
Unknown labels become `unknown` or are omitted. Messages and stages are restored
|
|
135
|
-
from the error-code catalogue, even if an error was modified after construction.
|
|
136
|
-
Arbitrary properties are dropped, including wallet/receiver/refund addresses,
|
|
137
|
-
token addresses, amounts, balances, approvals, transaction/order/quote/request IDs,
|
|
138
|
-
signatures, full calldata, URL/query/header/body contents, raw exception messages
|
|
139
|
-
and stack traces. Contract addresses and hashes are not reported either.
|
|
140
|
-
|
|
141
|
-
These reports identify unsupported function families and failure stages. They
|
|
142
|
-
intentionally cannot reconstruct or identify the original user's transaction.
|
package/dist/chains.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CHAINS_ENUM as DBK_CHAINS_ENUM } from '@debank/common';
|
|
2
2
|
export declare const CHAINS_ENUM: typeof DBK_CHAINS_ENUM;
|
|
3
|
-
export declare const EXTRA_CHAINS: readonly ["XDC", "UNI", "RONIN", "XLAYER", "MONAD", "SONIC", "LENS", "WORLD", "STABLE", "HYPER", "LISK", "SEI", "GRAVITY", "SONEIUM", "SWELL", "ABS", "MORPH", "TEMPO", "MEGAETH", "PLASMA", "APE", "HEMI", "SOPHON", "INK", "BOB", "BERA", "PLUME", "TAIKO", "KATANA", "STORY", "CYBER", "ZIRCUIT", "HOOD", "ARC"];
|
|
3
|
+
export declare const EXTRA_CHAINS: readonly ["XDC", "UNI", "RONIN", "XLAYER", "MONAD", "SONIC", "LENS", "WORLD", "STABLE", "HYPER", "LISK", "SEI", "GRAVITY", "SONEIUM", "SWELL", "ABS", "MORPH", "TEMPO", "MEGAETH", "PLASMA", "APE", "HEMI", "SOPHON", "INK", "BOB", "BERA", "PLUME", "TAIKO", "KATANA", "STORY", "CYBER", "ZIRCUIT", "HOOD", "ARC", "ELYSIUM"];
|
|
4
4
|
export type ExtraChainEnum = (typeof EXTRA_CHAINS)[number];
|
|
5
5
|
export type ChainEnum = DBK_CHAINS_ENUM | ExtraChainEnum;
|
|
6
6
|
export declare const SERVER_ID_TO_CHAIN_ENUM: {
|
|
@@ -62,6 +62,7 @@ export declare const SERVER_ID_TO_CHAIN_ENUM: {
|
|
|
62
62
|
readonly zircuit: ChainEnum;
|
|
63
63
|
readonly hood: ChainEnum;
|
|
64
64
|
readonly arc: ChainEnum;
|
|
65
|
+
readonly elysium: ChainEnum;
|
|
65
66
|
readonly zora: DBK_CHAINS_ENUM.ZORA;
|
|
66
67
|
};
|
|
67
68
|
export declare const CHAIN_ENUM_TO_SERVER_ID: Record<ChainEnum, string>;
|
package/dist/chains.js
CHANGED
|
@@ -35,6 +35,7 @@ export const EXTRA_CHAINS = [
|
|
|
35
35
|
'ZIRCUIT',
|
|
36
36
|
'HOOD',
|
|
37
37
|
'ARC',
|
|
38
|
+
'ELYSIUM',
|
|
38
39
|
];
|
|
39
40
|
export const SERVER_ID_TO_CHAIN_ENUM = {
|
|
40
41
|
eth: CHAINS_ENUM.ETH,
|
|
@@ -95,6 +96,7 @@ export const SERVER_ID_TO_CHAIN_ENUM = {
|
|
|
95
96
|
zircuit: 'ZIRCUIT',
|
|
96
97
|
hood: 'HOOD',
|
|
97
98
|
arc: 'ARC',
|
|
99
|
+
elysium: 'ELYSIUM',
|
|
98
100
|
zora: CHAINS_ENUM.ZORA,
|
|
99
101
|
};
|
|
100
102
|
export const CHAIN_ENUM_TO_SERVER_ID = Object.fromEntries(Object.entries(SERVER_ID_TO_CHAIN_ENUM).map(([serverId, chainEnum]) => [
|
package/dist/data.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ declare const EXTRA_CHAINS: {
|
|
|
35
35
|
readonly ZIRCUIT: ChainEnum;
|
|
36
36
|
readonly HOOD: ChainEnum;
|
|
37
37
|
readonly ARC: ChainEnum;
|
|
38
|
+
readonly ELYSIUM: ChainEnum;
|
|
38
39
|
};
|
|
39
40
|
export declare const BRIDGE_SUPPORT_CHAINS_DATA: {
|
|
40
41
|
readonly near_intents: [import("@debank/common").CHAINS_ENUM.ETH, import("@debank/common").CHAINS_ENUM.ARBITRUM, import("@debank/common").CHAINS_ENUM.BASE, import("@debank/common").CHAINS_ENUM.BSC, import("@debank/common").CHAINS_ENUM.POLYGON, import("@debank/common").CHAINS_ENUM.OP, import("@debank/common").CHAINS_ENUM.AVAX, import("@debank/common").CHAINS_ENUM.GNOSIS, import("@debank/common").CHAINS_ENUM.SCRL, ChainEnum, ChainEnum];
|
|
@@ -175,6 +176,7 @@ export declare const BRIDGE_SPENDER_WHITELIST_DATA: {
|
|
|
175
176
|
readonly [EXTRA_CHAINS.PLASMA]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
176
177
|
readonly [EXTRA_CHAINS.HOOD]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
177
178
|
readonly [EXTRA_CHAINS.ARC]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
179
|
+
readonly [EXTRA_CHAINS.ELYSIUM]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
178
180
|
readonly ETH: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
179
181
|
readonly OP: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
180
182
|
readonly CRO: "0x59916da825d2d2ec1bf878d71c88826f6633ecca";
|
|
@@ -398,6 +400,7 @@ export declare const BRIDGE_ROUTER_WHITELIST_DATA: {
|
|
|
398
400
|
readonly [EXTRA_CHAINS.PLASMA]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
399
401
|
readonly [EXTRA_CHAINS.HOOD]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
400
402
|
readonly [EXTRA_CHAINS.ARC]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
403
|
+
readonly [EXTRA_CHAINS.ELYSIUM]: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
401
404
|
readonly ETH: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
402
405
|
readonly OP: "0x4cd00e387622c35bddb9b4c962c136462338bc31";
|
|
403
406
|
readonly CRO: "0x59916da825d2d2ec1bf878d71c88826f6633ecca";
|
package/dist/data.js
CHANGED
|
@@ -44,6 +44,7 @@ const EXTRA_CHAINS = {
|
|
|
44
44
|
ZIRCUIT: 'ZIRCUIT',
|
|
45
45
|
HOOD: 'HOOD',
|
|
46
46
|
ARC: 'ARC',
|
|
47
|
+
ELYSIUM: 'ELYSIUM',
|
|
47
48
|
};
|
|
48
49
|
const SOCKET_V3_ALLOWANCE_HOLDER = '0x50c4e75a512f2a14a7b304787adf79c4531a5909';
|
|
49
50
|
const SOCKET_V3_CONTRACTS = {
|
|
@@ -218,6 +219,7 @@ export const BRIDGE_SPENDER_WHITELIST_DATA = {
|
|
|
218
219
|
[EXTRA_CHAINS.PLASMA]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
219
220
|
[EXTRA_CHAINS.HOOD]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
220
221
|
[EXTRA_CHAINS.ARC]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
222
|
+
[EXTRA_CHAINS.ELYSIUM]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
221
223
|
},
|
|
222
224
|
stargate: {
|
|
223
225
|
[CHAINS_ENUM.BASE]: '0x8eca03175fd5ac62fb6f4ecbb9a95d13dcdcb4f8',
|
|
@@ -439,6 +441,7 @@ export const BRIDGE_ROUTER_WHITELIST_DATA = {
|
|
|
439
441
|
[EXTRA_CHAINS.PLASMA]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
440
442
|
[EXTRA_CHAINS.HOOD]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
441
443
|
[EXTRA_CHAINS.ARC]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
444
|
+
[EXTRA_CHAINS.ELYSIUM]: '0x4cd00e387622c35bddb9b4c962c136462338bc31',
|
|
442
445
|
},
|
|
443
446
|
stargate: {
|
|
444
447
|
[CHAINS_ENUM.BASE]: '0x7e07a9148e9149e430c6412b79a675028595ff1f',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export { BRIDGE_AGGREGATORS, BRIDGE_ENUM } from './consts.js';
|
|
2
2
|
export type { BridgeAggregatorId } from './consts.js';
|
|
3
3
|
export { ALL_SUPPORTED_BRIDGE_CHAINS, BRIDGE_ROUTER_WHITELIST, BRIDGE_SPENDER_WHITELIST, BRIDGE_SUPPORT_CHAINS, CHAINS_ENUM, getBridgeAltContracts, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
|
|
4
|
-
export { CALLDATA_AGGREGATORS, InvalidBridgeCalldataError, decodeBridgeCalldata, decodeBridgeCalldataResult, hasBridgeCalldata, validateBridgeCalldata, } from './calldata/index.js';
|
|
5
|
-
export type { BridgeCalldataTx, BridgeTokenReference, BridgeAmountReference, BridgeCallExpectation, BridgeCheck, DecodeHit, ParsedBridgeCall, } from './calldata/index.js';
|
|
6
4
|
export { InvalidBridgeContractError, buildBridgeQuoteTx, buildTx, getQuote, getQuoteList, getQuoteListWithTx, validateBridgeQuote, validateBridgeTx, } from './quote.js';
|
|
7
|
-
export type { BridgeApi, BridgeBuildTxParams, BridgeQuote, BridgeQuoteListItem, BridgeQuoteListParams,
|
|
8
|
-
export { BRIDGE_PROVIDER_ORIGINS, InvalidBridgeProviderError, createBridgeFetchRequest, createBridgeProviderClient, isDirectBridgeProviderRoute, } from './providers/index.js';
|
|
9
|
-
export type { BridgeFetch, BridgeProviderClient, BridgeProviderClientOptions, BridgeProviderVerification, BridgeVerificationProvider, BridgeServiceRequest, DirectBridgeProvider, } from './providers/index.js';
|
|
10
|
-
export { BRIDGE_ERRORS, BridgeError, toBridgeErrorReport } from './errors/index.js';
|
|
11
|
-
export type { BridgeErrorCode, BridgeErrorStage, BridgeErrorDefinition, BridgeErrorContext, BridgeErrorDetail, BridgeErrorReport, BridgeErrorReporter } from './errors/index.js';
|
|
5
|
+
export type { BridgeApi, BridgeBuildTxParams, BridgeQuote, BridgeQuoteListItem, BridgeQuoteListParams, BridgeTx, } from './quote.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export { BRIDGE_AGGREGATORS, BRIDGE_ENUM } from './consts.js';
|
|
2
2
|
export { ALL_SUPPORTED_BRIDGE_CHAINS, BRIDGE_ROUTER_WHITELIST, BRIDGE_SPENDER_WHITELIST, BRIDGE_SUPPORT_CHAINS, CHAINS_ENUM, getBridgeAltContracts, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
|
|
3
|
-
export { CALLDATA_AGGREGATORS, InvalidBridgeCalldataError, decodeBridgeCalldata, decodeBridgeCalldataResult, hasBridgeCalldata, validateBridgeCalldata, } from './calldata/index.js';
|
|
4
3
|
export { InvalidBridgeContractError, buildBridgeQuoteTx, buildTx, getQuote, getQuoteList, getQuoteListWithTx, validateBridgeQuote, validateBridgeTx, } from './quote.js';
|
|
5
|
-
export { BRIDGE_PROVIDER_ORIGINS, InvalidBridgeProviderError, createBridgeFetchRequest, createBridgeProviderClient, isDirectBridgeProviderRoute, } from './providers/index.js';
|
|
6
|
-
export { BRIDGE_ERRORS, BridgeError, toBridgeErrorReport } from './errors/index.js';
|
package/dist/quote.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import type { BridgeErrorReporter } from './errors/index.js';
|
|
2
|
-
import { BridgeError } from './errors/index.js';
|
|
3
1
|
import type { OpenApiService } from '@rabby-wallet/rabby-api';
|
|
4
|
-
import type { BridgeCallExpectation } from './calldata/expect.js';
|
|
5
|
-
import type { BridgeProviderClient } from './providers/types.js';
|
|
6
2
|
import type { BridgeAggregatorId } from './consts.js';
|
|
7
|
-
export interface
|
|
8
|
-
/** Observe new validation failures while preserving main's business decisions. Defaults to false. */
|
|
9
|
-
lite?: boolean;
|
|
10
|
-
/** Receives filtered failures and non-blocking lite validation failures. */
|
|
11
|
-
onError?: BridgeErrorReporter;
|
|
12
|
-
}
|
|
13
|
-
export interface BridgeQuoteListParams extends BridgeValidationOptions {
|
|
3
|
+
export interface BridgeQuoteListParams {
|
|
14
4
|
userAddress: string;
|
|
15
5
|
fromChainId: string;
|
|
16
6
|
fromTokenId: string;
|
|
@@ -19,20 +9,16 @@ export interface BridgeQuoteListParams extends BridgeValidationOptions {
|
|
|
19
9
|
toTokenId: string;
|
|
20
10
|
slippage?: string;
|
|
21
11
|
feeRate?: number;
|
|
22
|
-
/** Reuse the same client for quoting/building; transport connects directly to providers. */
|
|
23
|
-
providerClient?: BridgeProviderClient;
|
|
24
12
|
}
|
|
25
13
|
export interface BridgeBuildTxParams extends BridgeQuoteListParams {
|
|
26
14
|
bridgeId: string;
|
|
27
15
|
quoteKey?: string | Record<string, unknown>;
|
|
28
|
-
/** Quoted output in raw units, before applying slippage. */
|
|
29
|
-
toTokenRawAmount?: string;
|
|
30
16
|
}
|
|
31
17
|
export type BridgeApi = Pick<OpenApiService, 'getBridgeQuoteListV2' | 'getBridgeQuoteV2' | 'buildBridgeTx' | 'getBridgeQuoteTxV2'>;
|
|
32
18
|
export type BridgeQuote = Awaited<ReturnType<BridgeApi['getBridgeQuoteTxV2']>>;
|
|
33
19
|
export type BridgeTx = Awaited<ReturnType<BridgeApi['buildBridgeTx']>> | NonNullable<BridgeQuote['tx']>;
|
|
34
20
|
export type BridgeQuoteListItem = Awaited<ReturnType<BridgeApi['getBridgeQuoteV2']>>[number];
|
|
35
|
-
export declare class InvalidBridgeContractError extends
|
|
21
|
+
export declare class InvalidBridgeContractError extends Error {
|
|
36
22
|
readonly kind: 'spender' | 'router';
|
|
37
23
|
readonly aggregatorId: BridgeAggregatorId;
|
|
38
24
|
readonly chainId: string;
|
|
@@ -41,8 +27,8 @@ export declare class InvalidBridgeContractError extends BridgeError {
|
|
|
41
27
|
readonly bridgeId?: string | undefined;
|
|
42
28
|
constructor(kind: 'spender' | 'router', aggregatorId: BridgeAggregatorId, chainId: string, expected: string, received: string, bridgeId?: string | undefined);
|
|
43
29
|
}
|
|
44
|
-
export declare const validateBridgeQuote: (aggregatorId: BridgeAggregatorId, fromChainId: string, quote: BridgeQuoteListItem
|
|
45
|
-
export declare const validateBridgeTx: (aggregatorId: BridgeAggregatorId, fromChainId: string, bridgeId: string, tx: BridgeTx
|
|
30
|
+
export declare const validateBridgeQuote: (aggregatorId: BridgeAggregatorId, fromChainId: string, quote: BridgeQuoteListItem) => boolean;
|
|
31
|
+
export declare const validateBridgeTx: (aggregatorId: BridgeAggregatorId, fromChainId: string, bridgeId: string, tx: BridgeTx) => boolean;
|
|
46
32
|
export declare const getQuote: (aggregatorId: string, params: BridgeQuoteListParams, api: BridgeApi) => Promise<BridgeQuoteListItem[]>;
|
|
47
33
|
export declare const buildTx: (aggregatorId: string, params: BridgeBuildTxParams, api: BridgeApi) => Promise<BridgeTx>;
|
|
48
34
|
export declare const getQuoteListWithTx: (aggregatorId: string, params: BridgeQuoteListParams, api: BridgeApi) => Promise<Array<BridgeQuoteListItem & {
|