@rabby-wallet/rabby-bridge 0.0.11-alpha.1 → 0.0.11

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 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,17 +481,4 @@ export declare const BRIDGE_ROUTER_WHITELIST_DATA: {
481
481
  readonly BLAST: "0x2d509190ed0172ba588407d4c2df918f955cc6e1";
482
482
  };
483
483
  };
484
- export declare const BRIDGE_SPENDER_ALT_WHITELIST_DATA: {
485
- readonly across: {
486
- readonly [EXTRA_CHAINS.ARC]: readonly ["0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c"];
487
- };
488
- };
489
- export declare const BRIDGE_ROUTER_ALT_WHITELIST_DATA: {
490
- readonly relay: {
491
- readonly [EXTRA_CHAINS.ARC]: readonly ["0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f"];
492
- };
493
- readonly across: {
494
- readonly [EXTRA_CHAINS.ARC]: readonly ["0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c"];
495
- };
496
- };
497
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,20 +499,3 @@ export const BRIDGE_ROUTER_WHITELIST_DATA = {
495
499
  [EXTRA_CHAINS.ARC]: '0x9b4a302a548c7e313c2b74c461db7b84d3074a84',
496
500
  },
497
501
  };
498
- // 仅在指定链生效的额外 spender(approve 目标)。
499
- export const BRIDGE_SPENDER_ALT_WHITELIST_DATA = {
500
- across: {
501
- // arc 专有 SpokePoolPeriphery,swap+bridge 路由的 approve 目标
502
- [EXTRA_CHAINS.ARC]: ['0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c'],
503
- },
504
- };
505
- // 仅在指定链生效的额外 router。
506
- export const BRIDGE_ROUTER_ALT_WHITELIST_DATA = {
507
- relay: {
508
- [EXTRA_CHAINS.ARC]: ['0xb92fe925dc43a0ecde6c8b1a2709c170ec4fff4f'],
509
- },
510
- across: {
511
- // arc 专有 SpokePoolPeriphery,swap+bridge 路由的 tx.to
512
- [EXTRA_CHAINS.ARC]: ['0xe791a2669bef779ff7a4a9cf789f8ee2ca20a32c'],
513
- },
514
- };
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, getBridgeAltRouters, getBridgeAltSpenders, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
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, getBridgeAltRouters, getBridgeAltSpenders, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
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,6 +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 getBridgeAltSpenders: (aggregatorId: BridgeAggregatorId, chainId: string) => string[];
15
- export declare const getBridgeAltRouters: (aggregatorId: BridgeAggregatorId, chainId: string) => string[];
16
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, BRIDGE_ROUTER_ALT_WHITELIST_DATA, BRIDGE_SPENDER_ALT_WHITELIST_DATA, } from './data.js';
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,19 +40,6 @@ export const getBridgeRouter = (aggregatorId, chainId) => {
40
40
  }
41
41
  return BRIDGE_ROUTER_WHITELIST[aggregatorId]?.[chainEnum];
42
42
  };
43
- const getChainAltContracts = (data, aggregatorId, chainId) => {
44
- const chainEnum = normalizeChainEnum(chainId);
45
- if (!chainEnum) {
46
- return [];
47
- }
48
- return [...(data[aggregatorId]?.[chainEnum] || [])];
49
- };
50
- export const getBridgeAltSpenders = (aggregatorId, chainId) => {
51
- return getChainAltContracts(BRIDGE_SPENDER_ALT_WHITELIST_DATA, aggregatorId, chainId);
52
- };
53
- export const getBridgeAltRouters = (aggregatorId, chainId) => {
54
- return getChainAltContracts(BRIDGE_ROUTER_ALT_WHITELIST_DATA, aggregatorId, chainId);
55
- };
56
43
  // 该聚合器的全局合法合约(periphery 等),对其所有链均有效,与逐链白名单并列接受。
57
44
  export const getBridgeAltContracts = (aggregatorId) => {
58
45
  return [
package/dist/quote.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BRIDGE_ENUM } from './consts.js';
2
- import { getBridgeAltContracts, getBridgeAltRouters, getBridgeAltSpenders, getBridgeRouter, getBridgeSpender, isSupportedBridgeAggregator, isSupportedBridgeChain, } from './list.js';
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}`);
@@ -51,7 +51,6 @@ export const validateBridgeQuote = (aggregatorId, fromChainId, quote) => {
51
51
  const allowedSpenders = [
52
52
  expectedSpender,
53
53
  ...getBridgeAltContracts(aggregatorId),
54
- ...getBridgeAltSpenders(aggregatorId, fromChainId),
55
54
  ];
56
55
  if (!allowedSpenders.some((addr) => isSameAddress(addr, receivedSpender))) {
57
56
  throw new InvalidBridgeContractError('spender', aggregatorId, fromChainId, expectedSpender, receivedSpender, quote.bridge_id);
@@ -69,7 +68,6 @@ export const validateBridgeTx = (aggregatorId, fromChainId, bridgeId, tx) => {
69
68
  const allowedRouters = [
70
69
  expectedRouter,
71
70
  ...getBridgeAltContracts(aggregatorId),
72
- ...getBridgeAltRouters(aggregatorId, fromChainId),
73
71
  ];
74
72
  if (!allowedRouters.some((addr) => isSameAddress(addr, tx.to))) {
75
73
  throw new InvalidBridgeContractError('router', aggregatorId, fromChainId, expectedRouter, tx.to, bridgeId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-bridge",
3
- "version": "0.0.11-alpha.1",
3
+ "version": "0.0.11",
4
4
  "description": "Bridge quote helpers and contract allowlists for Rabby",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",