@rabby-wallet/rabby-bridge 0.0.11-alpha.0 → 0.0.11-alpha.2
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/data.d.ts +1 -9
- package/dist/data.js +4 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/list.d.ts +0 -1
- package/dist/list.js +1 -9
- package/dist/quote.js +1 -2
- package/package.json +1 -1
package/dist/data.d.ts
CHANGED
|
@@ -260,7 +260,7 @@ export declare const BRIDGE_SPENDER_WHITELIST_DATA: {
|
|
|
260
260
|
};
|
|
261
261
|
export declare const BRIDGE_ALT_CONTRACTS_DATA: {
|
|
262
262
|
readonly across: readonly ["0x10d8b8daa26d307489803e10477de69c0492b610", "0x97ccdbea4632140639ad5ea9b944aa034eb15fd4", "0x5a148a9260c1f670429361c34d40b477280f01a9", "0x7c99ced6d8011af8a52488884f7ba2c61b0fa57d"];
|
|
263
|
-
readonly relay: readonly ["0x8754bc615047de01228a7527b712806a71a8dc9a", "0xccc88a9d1b4ed6b0eaba998850414b24f1c315be", "0xf6e54bbf91e564fcf0df3ed9f2dd82913e9232c3"];
|
|
263
|
+
readonly relay: readonly ["0x8754bc615047de01228a7527b712806a71a8dc9a", "0xccc88a9d1b4ed6b0eaba998850414b24f1c315be", "0xf6e54bbf91e564fcf0df3ed9f2dd82913e9232c3", "0x9ef6d3c2f60d7b9008d74cab1fc0f899c957c819", "0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f", "0xe16870b028704e38dbc254a84d3f72c8ba345ca9"];
|
|
264
264
|
};
|
|
265
265
|
export declare const BRIDGE_ROUTER_WHITELIST_DATA: {
|
|
266
266
|
readonly lifi: {
|
|
@@ -481,12 +481,4 @@ export declare const BRIDGE_ROUTER_WHITELIST_DATA: {
|
|
|
481
481
|
readonly BLAST: "0x2d509190ed0172ba588407d4c2df918f955cc6e1";
|
|
482
482
|
};
|
|
483
483
|
};
|
|
484
|
-
export declare const BRIDGE_ROUTER_ALT_WHITELIST_DATA: {
|
|
485
|
-
readonly relay: {
|
|
486
|
-
readonly [EXTRA_CHAINS.ARC]: readonly ["0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f"];
|
|
487
|
-
};
|
|
488
|
-
readonly across: {
|
|
489
|
-
readonly [EXTRA_CHAINS.ARC]: readonly ["0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c"];
|
|
490
|
-
};
|
|
491
|
-
};
|
|
492
484
|
export {};
|
package/dist/data.js
CHANGED
|
@@ -300,6 +300,10 @@ export const BRIDGE_ALT_CONTRACTS_DATA = {
|
|
|
300
300
|
'0x8754bc615047de01228a7527b712806a71a8dc9a', // london
|
|
301
301
|
'0xccc88a9d1b4ed6b0eaba998850414b24f1c315be', // cancun
|
|
302
302
|
'0xf6e54bbf91e564fcf0df3ed9f2dd82913e9232c3', // zero / zkevm
|
|
303
|
+
// Router v3,后端 Relay 报价的 approve_contract_id 同样使用 tx.to
|
|
304
|
+
'0x9ef6d3c2f60d7b9008d74cab1fc0f899c957c819', // london
|
|
305
|
+
'0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f', // cancun
|
|
306
|
+
'0xe16870b028704e38dbc254a84d3f72c8ba345ca9', // zero / zkevm
|
|
303
307
|
],
|
|
304
308
|
};
|
|
305
309
|
export const BRIDGE_ROUTER_WHITELIST_DATA = {
|
|
@@ -495,13 +499,3 @@ export const BRIDGE_ROUTER_WHITELIST_DATA = {
|
|
|
495
499
|
[EXTRA_CHAINS.ARC]: '0x9b4a302a548c7e313c2b74c461db7b84d3074a84',
|
|
496
500
|
},
|
|
497
501
|
};
|
|
498
|
-
// 仅在指定链生效的额外 router。
|
|
499
|
-
export const BRIDGE_ROUTER_ALT_WHITELIST_DATA = {
|
|
500
|
-
relay: {
|
|
501
|
-
[EXTRA_CHAINS.ARC]: ['0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f'],
|
|
502
|
-
},
|
|
503
|
-
across: {
|
|
504
|
-
// arc 专有 SpokePoolPeriphery,swap+bridge 路由的 tx.to
|
|
505
|
-
[EXTRA_CHAINS.ARC]: ['0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c'],
|
|
506
|
-
},
|
|
507
|
-
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BRIDGE_AGGREGATORS, BRIDGE_ENUM } from './consts.js';
|
|
2
2
|
export type { BridgeAggregatorId } from './consts.js';
|
|
3
|
-
export { ALL_SUPPORTED_BRIDGE_CHAINS, BRIDGE_ROUTER_WHITELIST, BRIDGE_SPENDER_WHITELIST, BRIDGE_SUPPORT_CHAINS, CHAINS_ENUM, getBridgeAltContracts,
|
|
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
4
|
export { InvalidBridgeContractError, buildBridgeQuoteTx, buildTx, getQuote, getQuoteList, getQuoteListWithTx, validateBridgeQuote, validateBridgeTx, } from './quote.js';
|
|
5
5
|
export type { BridgeApi, BridgeBuildTxParams, BridgeQuote, BridgeQuoteListItem, BridgeQuoteListParams, BridgeTx, } from './quote.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { BRIDGE_AGGREGATORS, BRIDGE_ENUM } from './consts.js';
|
|
2
|
-
export { ALL_SUPPORTED_BRIDGE_CHAINS, BRIDGE_ROUTER_WHITELIST, BRIDGE_SPENDER_WHITELIST, BRIDGE_SUPPORT_CHAINS, CHAINS_ENUM, getBridgeAltContracts,
|
|
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
3
|
export { InvalidBridgeContractError, buildBridgeQuoteTx, buildTx, getQuote, getQuoteList, getQuoteListWithTx, validateBridgeQuote, validateBridgeTx, } from './quote.js';
|
package/dist/list.d.ts
CHANGED
|
@@ -11,5 +11,4 @@ export declare const isSupportedBridgeAggregator: (aggregatorId: string) => aggr
|
|
|
11
11
|
export declare const isSupportedBridgeChain: (aggregatorId: BridgeAggregatorId, chainId: string) => boolean;
|
|
12
12
|
export declare const getBridgeSpender: (aggregatorId: BridgeAggregatorId, chainId: string) => string | undefined;
|
|
13
13
|
export declare const getBridgeRouter: (aggregatorId: BridgeAggregatorId, chainId: string) => string | undefined;
|
|
14
|
-
export declare const getBridgeAltRouters: (aggregatorId: BridgeAggregatorId, chainId: string) => string[];
|
|
15
14
|
export declare const getBridgeAltContracts: (aggregatorId: BridgeAggregatorId) => string[];
|
package/dist/list.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CHAINS_ENUM, normalizeChainEnum } from './chains.js';
|
|
2
2
|
import { BRIDGE_AGGREGATORS } from './consts.js';
|
|
3
|
-
import { BRIDGE_SUPPORT_CHAINS_DATA, BRIDGE_ROUTER_WHITELIST_DATA, BRIDGE_SPENDER_WHITELIST_DATA, BRIDGE_ALT_CONTRACTS_DATA,
|
|
3
|
+
import { BRIDGE_SUPPORT_CHAINS_DATA, BRIDGE_ROUTER_WHITELIST_DATA, BRIDGE_SPENDER_WHITELIST_DATA, BRIDGE_ALT_CONTRACTS_DATA, } from './data.js';
|
|
4
4
|
export { CHAINS_ENUM };
|
|
5
5
|
export const BRIDGE_SPENDER_WHITELIST = BRIDGE_SPENDER_WHITELIST_DATA;
|
|
6
6
|
export const BRIDGE_ROUTER_WHITELIST = BRIDGE_ROUTER_WHITELIST_DATA;
|
|
@@ -40,14 +40,6 @@ export const getBridgeRouter = (aggregatorId, chainId) => {
|
|
|
40
40
|
}
|
|
41
41
|
return BRIDGE_ROUTER_WHITELIST[aggregatorId]?.[chainEnum];
|
|
42
42
|
};
|
|
43
|
-
export const getBridgeAltRouters = (aggregatorId, chainId) => {
|
|
44
|
-
const chainEnum = normalizeChainEnum(chainId);
|
|
45
|
-
if (!chainEnum) {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
const routers = BRIDGE_ROUTER_ALT_WHITELIST_DATA;
|
|
49
|
-
return [...(routers[aggregatorId]?.[chainEnum] || [])];
|
|
50
|
-
};
|
|
51
43
|
// 该聚合器的全局合法合约(periphery 等),对其所有链均有效,与逐链白名单并列接受。
|
|
52
44
|
export const getBridgeAltContracts = (aggregatorId) => {
|
|
53
45
|
return [
|
package/dist/quote.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BRIDGE_ENUM } from './consts.js';
|
|
2
|
-
import { getBridgeAltContracts,
|
|
2
|
+
import { getBridgeAltContracts, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
|
|
3
3
|
export class InvalidBridgeContractError extends Error {
|
|
4
4
|
constructor(kind, aggregatorId, chainId, expected, received, bridgeId) {
|
|
5
5
|
super(`Invalid bridge ${kind} for ${aggregatorId} on ${chainId}: expected ${expected}, got ${received}`);
|
|
@@ -68,7 +68,6 @@ export const validateBridgeTx = (aggregatorId, fromChainId, bridgeId, tx) => {
|
|
|
68
68
|
const allowedRouters = [
|
|
69
69
|
expectedRouter,
|
|
70
70
|
...getBridgeAltContracts(aggregatorId),
|
|
71
|
-
...getBridgeAltRouters(aggregatorId, fromChainId),
|
|
72
71
|
];
|
|
73
72
|
if (!allowedRouters.some((addr) => isSameAddress(addr, tx.to))) {
|
|
74
73
|
throw new InvalidBridgeContractError('router', aggregatorId, fromChainId, expectedRouter, tx.to, bridgeId);
|