@across-protocol/sdk 4.2.16-alpha.5 → 4.2.16
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/cjs/arch/evm/SpokeUtils.d.ts +2 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +6 -21
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +1 -5
- package/dist/cjs/arch/svm/SpokeUtils.js +39 -30
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/eventsClient.js +2 -4
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +3 -3
- package/dist/cjs/arch/svm/utils.js +14 -16
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +83 -78
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -13
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
- package/dist/cjs/clients/HubPoolClient.js +58 -84
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +45 -65
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.d.ts +13 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js +18 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -40
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +4 -6
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/HubPool.d.ts +14 -19
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -10
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +11 -20
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +3 -7
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +32 -34
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +8 -12
- package/dist/cjs/utils/AddressUtils.js +36 -33
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.js +1 -1
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +22 -4
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +3 -5
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +2 -2
- package/dist/esm/arch/evm/SpokeUtils.js +7 -22
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +1 -5
- package/dist/esm/arch/svm/SpokeUtils.js +44 -31
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/eventsClient.js +3 -5
- package/dist/esm/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +3 -3
- package/dist/esm/arch/svm/utils.js +15 -17
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +84 -79
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -5
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +10 -20
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +22 -23
- package/dist/esm/clients/HubPoolClient.js +63 -98
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +47 -68
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.d.ts +28 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js +30 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -42
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +5 -7
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/HubPool.d.ts +14 -19
- package/dist/esm/interfaces/SpokePool.d.ts +13 -13
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -10
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +12 -21
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +3 -8
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +34 -38
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +8 -12
- package/dist/esm/utils/AddressUtils.js +38 -36
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.js +1 -1
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +8 -3
- package/dist/esm/utils/SpokeUtils.js +26 -4
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +18 -22
- package/dist/esm/utils/TokenUtils.js +4 -6
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +2 -2
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +1 -5
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +3 -3
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +22 -23
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts +29 -0
- package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +14 -19
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +13 -13
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -10
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +3 -8
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +8 -12
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +8 -3
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +18 -22
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/arch/evm/SpokeUtils.ts +12 -47
- package/src/arch/svm/SpokeUtils.ts +42 -64
- package/src/arch/svm/eventsClient.ts +8 -40
- package/src/arch/svm/utils.ts +6 -6
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
- package/src/clients/BundleDataClient/BundleDataClient.ts +90 -77
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
- package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -10
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +10 -22
- package/src/clients/HubPoolClient.ts +82 -127
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +35 -121
- package/src/clients/SpokePoolClient/SpokePoolClientManager.ts +36 -0
- package/src/clients/mocks/MockHubPoolClient.ts +19 -24
- package/src/clients/mocks/MockSpokePoolClient.ts +27 -39
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +5 -8
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
- package/src/interfaces/HubPool.ts +14 -23
- package/src/interfaces/SpokePool.ts +13 -13
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +11 -31
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +39 -43
- package/src/relayFeeCalculator/relayFeeCalculator.ts +12 -20
- package/src/utils/AddressUtils.ts +51 -39
- package/src/utils/NetworkUtils.ts +1 -1
- package/src/utils/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +8 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber } from "../utils";
|
|
2
2
|
import { SortableEvent } from "./Common";
|
|
3
3
|
|
|
4
4
|
export interface PoolRebalanceLeaf {
|
|
@@ -8,7 +8,7 @@ export interface PoolRebalanceLeaf {
|
|
|
8
8
|
netSendAmounts: BigNumber[];
|
|
9
9
|
runningBalances: BigNumber[];
|
|
10
10
|
leafId: number;
|
|
11
|
-
l1Tokens:
|
|
11
|
+
l1Tokens: string[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface RelayerRefundLeaf {
|
|
@@ -16,8 +16,8 @@ export interface RelayerRefundLeaf {
|
|
|
16
16
|
chainId: number;
|
|
17
17
|
refundAmounts: BigNumber[];
|
|
18
18
|
leafId: number;
|
|
19
|
-
l2TokenAddress:
|
|
20
|
-
refundAddresses:
|
|
19
|
+
l2TokenAddress: string;
|
|
20
|
+
refundAddresses: string[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface ProposedRootBundle extends SortableEvent {
|
|
@@ -27,7 +27,7 @@ export interface ProposedRootBundle extends SortableEvent {
|
|
|
27
27
|
poolRebalanceRoot: string;
|
|
28
28
|
relayerRefundRoot: string;
|
|
29
29
|
slowRelayRoot: string;
|
|
30
|
-
proposer:
|
|
30
|
+
proposer: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type RealizedLpFee = {
|
|
@@ -55,7 +55,7 @@ export interface ExecutedRootBundle extends SortableEvent {
|
|
|
55
55
|
netSendAmounts: BigNumber[];
|
|
56
56
|
runningBalances: BigNumber[];
|
|
57
57
|
leafId: number;
|
|
58
|
-
l1Tokens:
|
|
58
|
+
l1Tokens: string[];
|
|
59
59
|
proof: string[];
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -76,14 +76,8 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
|
|
|
76
76
|
groupIndex: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export interface
|
|
80
|
-
address:
|
|
81
|
-
symbol: string;
|
|
82
|
-
decimals: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface TokenInfo {
|
|
86
|
-
address: Address;
|
|
79
|
+
export interface L1Token {
|
|
80
|
+
address: string;
|
|
87
81
|
symbol: string;
|
|
88
82
|
decimals: number;
|
|
89
83
|
}
|
|
@@ -93,30 +87,27 @@ export interface LpToken {
|
|
|
93
87
|
liquidReserves: BigNumber;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
97
90
|
export interface CrossChainContractsSet extends SortableEvent {
|
|
98
91
|
l2ChainId: number;
|
|
99
|
-
spokePool:
|
|
92
|
+
spokePool: string;
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
103
95
|
export interface DestinationTokenWithBlock extends SortableEvent {
|
|
104
|
-
l2Token:
|
|
105
|
-
l1Token:
|
|
96
|
+
l2Token: string;
|
|
97
|
+
l1Token: string;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
109
100
|
export interface SetPoolRebalanceRoot extends SortableEvent {
|
|
110
101
|
destinationChainId: number;
|
|
111
|
-
l1Token:
|
|
112
|
-
destinationToken:
|
|
102
|
+
l1Token: string;
|
|
103
|
+
destinationToken: string;
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
export interface PendingRootBundle {
|
|
116
107
|
poolRebalanceRoot: string;
|
|
117
108
|
relayerRefundRoot: string;
|
|
118
109
|
slowRelayRoot: string;
|
|
119
|
-
proposer:
|
|
110
|
+
proposer: string;
|
|
120
111
|
unclaimedPoolRebalanceLeafCount: number;
|
|
121
112
|
challengePeriodEndTimestamp: number;
|
|
122
113
|
bundleEvaluationBlockNumbers: number[];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { SortableEvent } from "./Common";
|
|
2
2
|
import { SpokePoolClient } from "../clients";
|
|
3
|
-
import { BigNumber
|
|
3
|
+
import { BigNumber } from "../utils";
|
|
4
4
|
import { RelayerRefundLeaf } from "./HubPool";
|
|
5
5
|
|
|
6
6
|
export interface RelayData {
|
|
7
7
|
originChainId: number;
|
|
8
|
-
depositor:
|
|
9
|
-
recipient:
|
|
8
|
+
depositor: string;
|
|
9
|
+
recipient: string;
|
|
10
10
|
depositId: BigNumber;
|
|
11
|
-
inputToken:
|
|
11
|
+
inputToken: string;
|
|
12
12
|
inputAmount: BigNumber;
|
|
13
|
-
outputToken:
|
|
13
|
+
outputToken: string;
|
|
14
14
|
outputAmount: BigNumber;
|
|
15
15
|
message: string;
|
|
16
16
|
fillDeadline: number;
|
|
17
|
-
exclusiveRelayer:
|
|
17
|
+
exclusiveRelayer: string;
|
|
18
18
|
exclusivityDeadline: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ export interface Deposit extends RelayData {
|
|
|
23
23
|
destinationChainId: number;
|
|
24
24
|
quoteTimestamp: number;
|
|
25
25
|
speedUpSignature?: string;
|
|
26
|
-
updatedRecipient?:
|
|
26
|
+
updatedRecipient?: string;
|
|
27
27
|
updatedOutputAmount?: BigNumber;
|
|
28
28
|
updatedMessage?: string;
|
|
29
29
|
fromLiteChain: boolean;
|
|
@@ -51,7 +51,7 @@ export enum FillType {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export interface RelayExecutionEventInfo {
|
|
54
|
-
updatedRecipient:
|
|
54
|
+
updatedRecipient: string;
|
|
55
55
|
updatedOutputAmount: BigNumber;
|
|
56
56
|
updatedMessage?: string;
|
|
57
57
|
updatedMessageHash: string;
|
|
@@ -61,7 +61,7 @@ export interface RelayExecutionEventInfo {
|
|
|
61
61
|
export interface Fill extends Omit<RelayData, "message"> {
|
|
62
62
|
messageHash: string;
|
|
63
63
|
destinationChainId: number;
|
|
64
|
-
relayer:
|
|
64
|
+
relayer: string;
|
|
65
65
|
repaymentChainId: number;
|
|
66
66
|
relayExecutionInfo: RelayExecutionEventInfo;
|
|
67
67
|
}
|
|
@@ -72,18 +72,18 @@ export interface FillWithTime extends Fill, SortableEvent {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export interface EnabledDepositRoute {
|
|
75
|
-
originToken:
|
|
75
|
+
originToken: string;
|
|
76
76
|
destinationChainId: number;
|
|
77
77
|
enabled: boolean;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
|
|
81
81
|
export interface SpeedUp {
|
|
82
|
-
depositor:
|
|
82
|
+
depositor: string;
|
|
83
83
|
depositorSignature: string;
|
|
84
84
|
depositId: BigNumber;
|
|
85
85
|
originChainId: number;
|
|
86
|
-
updatedRecipient:
|
|
86
|
+
updatedRecipient: string;
|
|
87
87
|
updatedOutputAmount: BigNumber;
|
|
88
88
|
updatedMessage: string;
|
|
89
89
|
}
|
|
@@ -130,7 +130,7 @@ export interface TokensBridged extends SortableEvent {
|
|
|
130
130
|
amountToReturn: BigNumber;
|
|
131
131
|
chainId: number;
|
|
132
132
|
leafId: number;
|
|
133
|
-
l2TokenAddress:
|
|
133
|
+
l2TokenAddress: string;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export interface ClaimedRelayerRefundWithBlock extends SortableEvent {
|
|
@@ -9,15 +9,12 @@ import { SpokePool, SpokePool__factory } from "../../typechain";
|
|
|
9
9
|
import { populateV3Relay } from "../../arch/evm";
|
|
10
10
|
import {
|
|
11
11
|
BigNumberish,
|
|
12
|
-
EvmAddress,
|
|
13
12
|
TransactionCostEstimate,
|
|
14
13
|
BigNumber,
|
|
15
14
|
toBNWei,
|
|
16
15
|
bnZero,
|
|
17
16
|
chainIsOPStack,
|
|
18
17
|
fixedPointAdjustment,
|
|
19
|
-
toAddressType,
|
|
20
|
-
Address,
|
|
21
18
|
} from "../../utils";
|
|
22
19
|
import assert from "assert";
|
|
23
20
|
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
@@ -75,7 +72,7 @@ export class QueryBase implements QueryInterface {
|
|
|
75
72
|
*/
|
|
76
73
|
async getGasCosts(
|
|
77
74
|
deposit: Omit<Deposit, "messageHash">,
|
|
78
|
-
relayer =
|
|
75
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
79
76
|
options: Partial<{
|
|
80
77
|
gasPrice: BigNumberish;
|
|
81
78
|
gasUnits: BigNumberish;
|
|
@@ -94,12 +91,7 @@ export class QueryBase implements QueryInterface {
|
|
|
94
91
|
transport,
|
|
95
92
|
} = options;
|
|
96
93
|
|
|
97
|
-
const
|
|
98
|
-
assert(recipient.isEVM(), `getGasCosts: recipient not an EVM address (${recipient})`);
|
|
99
|
-
assert(outputToken.isEVM(), `getGasCosts: outputToken not an EVM address (${outputToken})`);
|
|
100
|
-
assert(exclusiveRelayer.isEVM(), `getGasCosts: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
101
|
-
|
|
102
|
-
const tx = await this.getUnsignedTxFromDeposit({ ...deposit, recipient, outputToken, exclusiveRelayer }, relayer);
|
|
94
|
+
const tx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
103
95
|
const {
|
|
104
96
|
nativeGasCost,
|
|
105
97
|
tokenGasCost,
|
|
@@ -129,12 +121,8 @@ export class QueryBase implements QueryInterface {
|
|
|
129
121
|
* @returns PopulatedTransaction
|
|
130
122
|
*/
|
|
131
123
|
getUnsignedTxFromDeposit(
|
|
132
|
-
deposit: Omit<Deposit, "messageHash"
|
|
133
|
-
|
|
134
|
-
outputToken: EvmAddress;
|
|
135
|
-
exclusiveRelayer: EvmAddress;
|
|
136
|
-
},
|
|
137
|
-
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
|
|
124
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
125
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
138
126
|
): Promise<PopulatedTransaction> {
|
|
139
127
|
return populateV3Relay(this.spokePool, deposit, relayer);
|
|
140
128
|
}
|
|
@@ -147,18 +135,10 @@ export class QueryBase implements QueryInterface {
|
|
|
147
135
|
*/
|
|
148
136
|
async getNativeGasCost(
|
|
149
137
|
deposit: Omit<Deposit, "messageHash">,
|
|
150
|
-
relayer =
|
|
138
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
151
139
|
): Promise<BigNumber> {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
assert(outputToken.isEVM(), `getNativeGasCost: outputToken not an EVM address (${outputToken})`);
|
|
155
|
-
assert(exclusiveRelayer.isEVM(), `getNativeGasCost: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
156
|
-
|
|
157
|
-
const unsignedTx = await this.getUnsignedTxFromDeposit(
|
|
158
|
-
{ ...deposit, recipient, outputToken, exclusiveRelayer },
|
|
159
|
-
relayer
|
|
160
|
-
);
|
|
161
|
-
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
140
|
+
const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
141
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
162
142
|
return voidSigner.estimateGas(unsignedTx);
|
|
163
143
|
}
|
|
164
144
|
|
|
@@ -172,7 +152,7 @@ export class QueryBase implements QueryInterface {
|
|
|
172
152
|
*/
|
|
173
153
|
async getOpStackL1DataFee(
|
|
174
154
|
unsignedTx: PopulatedTransaction,
|
|
175
|
-
relayer =
|
|
155
|
+
relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
|
|
176
156
|
options: Partial<{
|
|
177
157
|
opStackL2GasUnits: BigNumberish;
|
|
178
158
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
@@ -181,7 +161,7 @@ export class QueryBase implements QueryInterface {
|
|
|
181
161
|
const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
|
|
182
162
|
const { chainId } = await this.provider.getNetwork();
|
|
183
163
|
assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
|
|
184
|
-
const voidSigner = new VoidSigner(relayer
|
|
164
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
185
165
|
const populatedTransaction = await voidSigner.populateTransaction({
|
|
186
166
|
...unsignedTx,
|
|
187
167
|
gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
|
|
@@ -203,7 +183,7 @@ export class QueryBase implements QueryInterface {
|
|
|
203
183
|
*/
|
|
204
184
|
async estimateGas(
|
|
205
185
|
unsignedTx: PopulatedTransaction,
|
|
206
|
-
senderAddress:
|
|
186
|
+
senderAddress: string,
|
|
207
187
|
provider: providers.Provider | L2Provider<providers.Provider>,
|
|
208
188
|
options: Partial<{
|
|
209
189
|
gasPrice: BigNumberish;
|
|
@@ -224,7 +204,7 @@ export class QueryBase implements QueryInterface {
|
|
|
224
204
|
} = options || {};
|
|
225
205
|
|
|
226
206
|
const { chainId } = await provider.getNetwork();
|
|
227
|
-
const voidSigner = new VoidSigner(senderAddress
|
|
207
|
+
const voidSigner = new VoidSigner(senderAddress, provider);
|
|
228
208
|
|
|
229
209
|
// Estimate the Gas units required to submit this transaction.
|
|
230
210
|
const queries = [
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
1
|
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
2
|
import { intToU8Array32 } from "@across-protocol/contracts/dist/src/svm/web3-v1/conversionUtils";
|
|
4
3
|
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
|
|
@@ -76,7 +75,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
76
75
|
*/
|
|
77
76
|
async getGasCosts(
|
|
78
77
|
deposit: Omit<Deposit, "messageHash">,
|
|
79
|
-
|
|
78
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
80
79
|
options: Partial<{
|
|
81
80
|
gasPrice: BigNumberish;
|
|
82
81
|
gasUnits: BigNumberish;
|
|
@@ -84,12 +83,10 @@ export class SvmQuery implements QueryInterface {
|
|
|
84
83
|
priorityFeeMultiplier: BigNumber;
|
|
85
84
|
}> = {}
|
|
86
85
|
): Promise<TransactionCostEstimate> {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const fillRelayTx = await this.getFillRelayTx({ ...deposit, recipient, outputToken, exclusiveRelayer }, relayer);
|
|
86
|
+
const relayer = _relayer
|
|
87
|
+
? toAddressType(_relayer, deposit.destinationChainId).forceSvmAddress()
|
|
88
|
+
: this.simulatedRelayerAddress;
|
|
89
|
+
const fillRelayTx = await this.getFillRelayTx(deposit, relayer.toBase58());
|
|
93
90
|
|
|
94
91
|
const [computeUnitsConsumed, gasPriceEstimate] = await Promise.all([
|
|
95
92
|
toBN(await this.computeUnitEstimator(fillRelayTx)),
|
|
@@ -120,15 +117,10 @@ export class SvmQuery implements QueryInterface {
|
|
|
120
117
|
* @returns Estimated gas cost in compute units
|
|
121
118
|
*/
|
|
122
119
|
async getNativeGasCost(
|
|
123
|
-
deposit: Omit<Deposit, "messageHash">,
|
|
124
|
-
_relayer =
|
|
120
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
121
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
125
122
|
): Promise<BigNumber> {
|
|
126
|
-
const
|
|
127
|
-
assert(recipient.isSVM(), `getNativeGasCost: recipient not an SVM address (${recipient})`);
|
|
128
|
-
assert(outputToken.isSVM(), `getNativeGasCost: outputToken not an SVM address (${outputToken})`);
|
|
129
|
-
assert(exclusiveRelayer.isSVM(), `getNativeGasCost: exclusiveRelayer not an SVM address (${exclusiveRelayer})`);
|
|
130
|
-
|
|
131
|
-
const fillRelayTx = await this.getFillRelayTx({ ...deposit, recipient, outputToken, exclusiveRelayer }, _relayer);
|
|
123
|
+
const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
|
|
132
124
|
return toBN(await this.computeUnitEstimator(fillRelayTx));
|
|
133
125
|
}
|
|
134
126
|
|
|
@@ -139,51 +131,55 @@ export class SvmQuery implements QueryInterface {
|
|
|
139
131
|
* @returns FillRelay transaction
|
|
140
132
|
*/
|
|
141
133
|
async getFillRelayTx(
|
|
142
|
-
deposit: Omit<Deposit, "
|
|
143
|
-
|
|
144
|
-
outputToken: SvmAddress;
|
|
145
|
-
exclusiveRelayer: SvmAddress;
|
|
146
|
-
},
|
|
147
|
-
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
|
|
134
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
135
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
148
136
|
repaymentChainId = deposit.destinationChainId,
|
|
149
|
-
repaymentAddress =
|
|
150
|
-
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
151
|
-
deposit.destinationChainId
|
|
152
|
-
)
|
|
137
|
+
repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
153
138
|
) {
|
|
154
|
-
const
|
|
139
|
+
const toSvmAddress = (address: string, chainId: number) =>
|
|
140
|
+
toAddress(toAddressType(address, chainId).forceSvmAddress());
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
assert(
|
|
159
|
-
repaymentAddress.isValidOn(repaymentChainId),
|
|
160
|
-
`getFillRelayTx: repayment address ${repaymentAddress} not valid on chain ${repaymentChainId})`
|
|
161
|
-
);
|
|
142
|
+
const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, originChainId, destinationChainId } =
|
|
143
|
+
deposit;
|
|
162
144
|
|
|
163
145
|
const program = toAddress(this.spokePool);
|
|
146
|
+
const relayer = _relayer
|
|
147
|
+
? toAddressType(_relayer, deposit.destinationChainId).forceSvmAddress()
|
|
148
|
+
: this.simulatedRelayerAddress;
|
|
149
|
+
|
|
164
150
|
const _relayDataHash = getRelayDataHash(deposit, destinationChainId);
|
|
165
151
|
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
166
152
|
|
|
167
153
|
const [state, delegate] = await Promise.all([
|
|
168
154
|
getStatePda(program),
|
|
169
|
-
getFillRelayDelegatePda(
|
|
155
|
+
getFillRelayDelegatePda(
|
|
156
|
+
relayDataHash,
|
|
157
|
+
BigInt(repaymentChainId),
|
|
158
|
+
toSvmAddress(repaymentAddress, repaymentChainId),
|
|
159
|
+
program
|
|
160
|
+
),
|
|
170
161
|
]);
|
|
171
162
|
|
|
172
|
-
const
|
|
163
|
+
const _mint = toAddressType(outputToken, destinationChainId).forceSvmAddress();
|
|
164
|
+
const mint = toAddress(_mint);
|
|
173
165
|
const mintInfo = await fetchMint(this.provider, mint);
|
|
174
166
|
|
|
175
167
|
const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
|
|
176
|
-
getAssociatedTokenAddress(
|
|
177
|
-
|
|
168
|
+
getAssociatedTokenAddress(
|
|
169
|
+
toAddressType(deposit.recipient, destinationChainId).forceSvmAddress(),
|
|
170
|
+
_mint,
|
|
171
|
+
mintInfo.programAddress
|
|
172
|
+
),
|
|
173
|
+
getAssociatedTokenAddress(SvmAddress.from(relayer.toBase58()), _mint, mintInfo.programAddress),
|
|
178
174
|
getFillStatusPda(program, deposit, destinationChainId),
|
|
179
|
-
getEventAuthority(
|
|
175
|
+
getEventAuthority(),
|
|
180
176
|
]);
|
|
181
177
|
|
|
182
178
|
const relayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
183
|
-
depositor:
|
|
184
|
-
recipient:
|
|
185
|
-
exclusiveRelayer:
|
|
186
|
-
inputToken:
|
|
179
|
+
depositor: toSvmAddress(depositor, originChainId),
|
|
180
|
+
recipient: toSvmAddress(recipient, destinationChainId),
|
|
181
|
+
exclusiveRelayer: toSvmAddress(exclusiveRelayer, destinationChainId),
|
|
182
|
+
inputToken: toSvmAddress(inputToken, originChainId),
|
|
187
183
|
outputToken: mint,
|
|
188
184
|
inputAmount: deposit.inputAmount.toBigInt(),
|
|
189
185
|
outputAmount: deposit.outputAmount.toBigInt(),
|
|
@@ -211,7 +207,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
211
207
|
relayHash: relayDataHash,
|
|
212
208
|
relayData,
|
|
213
209
|
repaymentChainId: BigInt(repaymentChainId),
|
|
214
|
-
repaymentAddress:
|
|
210
|
+
repaymentAddress: toSvmAddress(repaymentAddress, repaymentChainId),
|
|
215
211
|
};
|
|
216
212
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
217
213
|
// if it doesn't exist.
|
|
@@ -9,9 +9,12 @@ import { Deposit } from "../interfaces";
|
|
|
9
9
|
import {
|
|
10
10
|
BigNumber,
|
|
11
11
|
BigNumberish,
|
|
12
|
+
ConvertDecimals,
|
|
12
13
|
MAX_BIG_INT,
|
|
13
14
|
TransactionCostEstimate,
|
|
14
15
|
bnZero,
|
|
16
|
+
chainIsSvm,
|
|
17
|
+
compareAddressesSimple,
|
|
15
18
|
fixedPointAdjustment,
|
|
16
19
|
getTokenInfo,
|
|
17
20
|
isDefined,
|
|
@@ -22,18 +25,13 @@ import {
|
|
|
22
25
|
percent,
|
|
23
26
|
toBN,
|
|
24
27
|
toBNWei,
|
|
25
|
-
compareAddressesSimple,
|
|
26
|
-
ConvertDecimals,
|
|
27
|
-
chainIsSvm,
|
|
28
|
-
toAddressType,
|
|
29
|
-
Address,
|
|
30
28
|
} from "../utils";
|
|
31
29
|
|
|
32
30
|
// This needs to be implemented for every chain and passed into RelayFeeCalculator
|
|
33
31
|
export interface QueryInterface {
|
|
34
32
|
getGasCosts: (
|
|
35
33
|
deposit: Omit<Deposit, "messageHash">,
|
|
36
|
-
relayer:
|
|
34
|
+
relayer: string,
|
|
37
35
|
options?: Partial<{
|
|
38
36
|
gasPrice: BigNumberish;
|
|
39
37
|
gasUnits: BigNumberish;
|
|
@@ -44,7 +42,7 @@ export interface QueryInterface {
|
|
|
44
42
|
}>
|
|
45
43
|
) => Promise<TransactionCostEstimate>;
|
|
46
44
|
getTokenPrice: (tokenSymbol: string) => Promise<number>;
|
|
47
|
-
getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer:
|
|
45
|
+
getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: string) => Promise<BigNumber>;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
@@ -256,10 +254,7 @@ export class RelayFeeCalculator {
|
|
|
256
254
|
deposit: Deposit,
|
|
257
255
|
outputAmount: BigNumberish,
|
|
258
256
|
simulateZeroFill = false,
|
|
259
|
-
relayerAddress =
|
|
260
|
-
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
261
|
-
deposit.destinationChainId
|
|
262
|
-
),
|
|
257
|
+
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
263
258
|
_tokenPrice?: number,
|
|
264
259
|
tokenMapping = TOKEN_SYMBOLS_MAP,
|
|
265
260
|
gasPrice?: BigNumberish,
|
|
@@ -276,14 +271,14 @@ export class RelayFeeCalculator {
|
|
|
276
271
|
// undefined address on destination.
|
|
277
272
|
const destinationChainTokenDetails = Object.values(tokenMapping).find(
|
|
278
273
|
(details) =>
|
|
279
|
-
compareAddressesSimple(details.addresses[originChainId], inputToken
|
|
274
|
+
compareAddressesSimple(details.addresses[originChainId], inputToken) &&
|
|
280
275
|
isDefined(details.addresses[destinationChainId])
|
|
281
276
|
);
|
|
282
277
|
const outputToken = isZeroAddress(deposit.outputToken)
|
|
283
278
|
? destinationChainTokenDetails!.addresses[destinationChainId]
|
|
284
|
-
: deposit.outputToken
|
|
279
|
+
: deposit.outputToken;
|
|
285
280
|
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId, tokenMapping);
|
|
286
|
-
const inputTokenInfo = getTokenInfo(inputToken
|
|
281
|
+
const inputTokenInfo = getTokenInfo(inputToken, originChainId, tokenMapping);
|
|
287
282
|
if (!isDefined(outputTokenInfo) || !isDefined(inputTokenInfo)) {
|
|
288
283
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
289
284
|
}
|
|
@@ -498,10 +493,7 @@ export class RelayFeeCalculator {
|
|
|
498
493
|
deposit: Deposit,
|
|
499
494
|
outputAmount?: BigNumberish,
|
|
500
495
|
simulateZeroFill = false,
|
|
501
|
-
relayerAddress =
|
|
502
|
-
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
503
|
-
deposit.destinationChainId
|
|
504
|
-
),
|
|
496
|
+
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
505
497
|
_tokenPrice?: number,
|
|
506
498
|
gasPrice?: BigNumberish,
|
|
507
499
|
gasUnits?: BigNumberish,
|
|
@@ -513,8 +505,8 @@ export class RelayFeeCalculator {
|
|
|
513
505
|
const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
|
|
514
506
|
// We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
|
|
515
507
|
// resolve the L1 token symbol and not the L2 token decimals.
|
|
516
|
-
const inputTokenInfo = getTokenInfo(inputToken
|
|
517
|
-
const outputTokenInfo = getTokenInfo(outputToken
|
|
508
|
+
const inputTokenInfo = getTokenInfo(inputToken, originChainId);
|
|
509
|
+
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
|
|
518
510
|
if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
|
|
519
511
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
520
512
|
}
|