@across-protocol/sdk 4.2.16-alpha.0 → 4.2.16-alpha.3
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 +6 -2
- package/dist/cjs/arch/evm/SpokeUtils.js +21 -6
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/cjs/arch/svm/SpokeUtils.js +70 -71
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +3 -5
- package/dist/cjs/arch/svm/utils.js +20 -28
- 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 +4 -2
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
- 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 +2 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- 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 +11 -8
- 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 +83 -58
- 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 +64 -45
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
- 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 +3 -4
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
- 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 +19 -14
- package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +10 -10
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +5 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +42 -49
- 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 +12 -13
- package/dist/cjs/utils/AddressUtils.js +44 -46
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.js +1 -1
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +4 -22
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +4 -6
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +6 -2
- package/dist/esm/arch/evm/SpokeUtils.js +22 -7
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/esm/arch/svm/SpokeUtils.js +74 -75
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +6 -8
- package/dist/esm/arch/svm/utils.js +21 -27
- 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 +4 -2
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
- 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 +2 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +5 -3
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
- 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 +12 -9
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +23 -22
- package/dist/esm/clients/HubPoolClient.js +97 -63
- 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 +67 -47
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
- 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 +4 -5
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +3 -3
- 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 +19 -14
- package/dist/esm/interfaces/SpokePool.d.ts +13 -13
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +11 -11
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +44 -51
- 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 +13 -14
- package/dist/esm/utils/AddressUtils.js +50 -56
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.js +2 -2
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +3 -8
- package/dist/esm/utils/SpokeUtils.js +4 -26
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +4 -16
- package/dist/esm/utils/TokenUtils.js +5 -7
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +6 -2
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +9 -5
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +6 -8
- 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 +4 -4
- 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 +2 -1
- 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 +23 -22
- 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/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 +5 -3
- 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 +3 -3
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +19 -14
- 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 -6
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -6
- 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 +13 -14
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +3 -8
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +4 -16
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/arch/evm/SpokeUtils.ts +52 -12
- package/src/arch/svm/SpokeUtils.ts +108 -59
- package/src/arch/svm/utils.ts +11 -20
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
- package/src/clients/BundleDataClient/BundleDataClient.ts +57 -53
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
- package/src/clients/BundleDataClient/utils/FillUtils.ts +10 -4
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
- package/src/clients/HubPoolClient.ts +126 -82
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +118 -35
- package/src/clients/mocks/MockHubPoolClient.ts +24 -19
- package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +3 -5
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
- package/src/interfaces/HubPool.ts +23 -14
- package/src/interfaces/SpokePool.ts +13 -13
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +14 -12
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +42 -46
- package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
- package/src/utils/AddressUtils.ts +58 -60
- package/src/utils/EventUtils.ts +2 -2
- package/src/utils/SpokeUtils.ts +11 -33
- package/src/utils/TokenUtils.ts +10 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from "../utils";
|
|
1
|
+
import { Address, BigNumber, EvmAddress } 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: EvmAddress[];
|
|
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: Address;
|
|
20
|
+
refundAddresses: Address[];
|
|
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: EvmAddress;
|
|
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: EvmAddress[];
|
|
59
59
|
proof: string[];
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -76,8 +76,14 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
|
|
|
76
76
|
groupIndex: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export interface
|
|
80
|
-
address:
|
|
79
|
+
export interface L1TokenInfo {
|
|
80
|
+
address: EvmAddress;
|
|
81
|
+
symbol: string;
|
|
82
|
+
decimals: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface TokenInfo {
|
|
86
|
+
address: Address;
|
|
81
87
|
symbol: string;
|
|
82
88
|
decimals: number;
|
|
83
89
|
}
|
|
@@ -87,27 +93,30 @@ export interface LpToken {
|
|
|
87
93
|
liquidReserves: BigNumber;
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
90
97
|
export interface CrossChainContractsSet extends SortableEvent {
|
|
91
98
|
l2ChainId: number;
|
|
92
|
-
spokePool:
|
|
99
|
+
spokePool: Address;
|
|
93
100
|
}
|
|
94
101
|
|
|
102
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
95
103
|
export interface DestinationTokenWithBlock extends SortableEvent {
|
|
96
|
-
l2Token:
|
|
97
|
-
l1Token:
|
|
104
|
+
l2Token: Address;
|
|
105
|
+
l1Token: EvmAddress;
|
|
98
106
|
}
|
|
99
107
|
|
|
108
|
+
// TODO: I think I don't change string -> Address in the Events. I change right after the event is read
|
|
100
109
|
export interface SetPoolRebalanceRoot extends SortableEvent {
|
|
101
110
|
destinationChainId: number;
|
|
102
|
-
l1Token:
|
|
103
|
-
destinationToken:
|
|
111
|
+
l1Token: EvmAddress;
|
|
112
|
+
destinationToken: Address;
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
export interface PendingRootBundle {
|
|
107
116
|
poolRebalanceRoot: string;
|
|
108
117
|
relayerRefundRoot: string;
|
|
109
118
|
slowRelayRoot: string;
|
|
110
|
-
proposer:
|
|
119
|
+
proposer: EvmAddress;
|
|
111
120
|
unclaimedPoolRebalanceLeafCount: number;
|
|
112
121
|
challengePeriodEndTimestamp: number;
|
|
113
122
|
bundleEvaluationBlockNumbers: number[];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { SortableEvent } from "./Common";
|
|
2
2
|
import { SpokePoolClient } from "../clients";
|
|
3
|
-
import { BigNumber } from "../utils";
|
|
3
|
+
import { BigNumber, Address, EvmAddress } 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: Address;
|
|
9
|
+
recipient: Address;
|
|
10
10
|
depositId: BigNumber;
|
|
11
|
-
inputToken:
|
|
11
|
+
inputToken: Address;
|
|
12
12
|
inputAmount: BigNumber;
|
|
13
|
-
outputToken:
|
|
13
|
+
outputToken: Address;
|
|
14
14
|
outputAmount: BigNumber;
|
|
15
15
|
message: string;
|
|
16
16
|
fillDeadline: number;
|
|
17
|
-
exclusiveRelayer:
|
|
17
|
+
exclusiveRelayer: Address;
|
|
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?: Address;
|
|
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: Address;
|
|
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: Address;
|
|
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: Address;
|
|
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: EvmAddress;
|
|
83
83
|
depositorSignature: string;
|
|
84
84
|
depositId: BigNumber;
|
|
85
85
|
originChainId: number;
|
|
86
|
-
updatedRecipient:
|
|
86
|
+
updatedRecipient: Address;
|
|
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: Address;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export interface ClaimedRelayerRefundWithBlock extends SortableEvent {
|
|
@@ -15,11 +15,13 @@ import {
|
|
|
15
15
|
bnZero,
|
|
16
16
|
chainIsOPStack,
|
|
17
17
|
fixedPointAdjustment,
|
|
18
|
+
toAddressType,
|
|
19
|
+
Address,
|
|
18
20
|
} from "../../utils";
|
|
19
21
|
import assert from "assert";
|
|
20
22
|
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
21
23
|
import { Transport } from "viem";
|
|
22
|
-
import { getGasPriceEstimate
|
|
24
|
+
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
23
25
|
import { EvmProvider } from "../../arch/evm/types";
|
|
24
26
|
|
|
25
27
|
export type SymbolMappingType = Record<
|
|
@@ -72,7 +74,7 @@ export class QueryBase implements QueryInterface {
|
|
|
72
74
|
*/
|
|
73
75
|
async getGasCosts(
|
|
74
76
|
deposit: Omit<Deposit, "messageHash">,
|
|
75
|
-
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
77
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
|
|
76
78
|
options: Partial<{
|
|
77
79
|
gasPrice: BigNumberish;
|
|
78
80
|
gasUnits: BigNumberish;
|
|
@@ -122,7 +124,7 @@ export class QueryBase implements QueryInterface {
|
|
|
122
124
|
*/
|
|
123
125
|
getUnsignedTxFromDeposit(
|
|
124
126
|
deposit: Omit<Deposit, "messageHash">,
|
|
125
|
-
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
127
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
|
|
126
128
|
): Promise<PopulatedTransaction> {
|
|
127
129
|
return populateV3Relay(this.spokePool, deposit, relayer);
|
|
128
130
|
}
|
|
@@ -135,10 +137,10 @@ export class QueryBase implements QueryInterface {
|
|
|
135
137
|
*/
|
|
136
138
|
async getNativeGasCost(
|
|
137
139
|
deposit: Omit<Deposit, "messageHash">,
|
|
138
|
-
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
140
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
|
|
139
141
|
): Promise<BigNumber> {
|
|
140
142
|
const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
141
|
-
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
143
|
+
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
142
144
|
return voidSigner.estimateGas(unsignedTx);
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -152,7 +154,7 @@ export class QueryBase implements QueryInterface {
|
|
|
152
154
|
*/
|
|
153
155
|
async getOpStackL1DataFee(
|
|
154
156
|
unsignedTx: PopulatedTransaction,
|
|
155
|
-
relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
|
|
157
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(unsignedTx.chainId), CHAIN_IDs.MAINNET),
|
|
156
158
|
options: Partial<{
|
|
157
159
|
opStackL2GasUnits: BigNumberish;
|
|
158
160
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
@@ -161,7 +163,7 @@ export class QueryBase implements QueryInterface {
|
|
|
161
163
|
const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
|
|
162
164
|
const { chainId } = await this.provider.getNetwork();
|
|
163
165
|
assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
|
|
164
|
-
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
166
|
+
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
165
167
|
const populatedTransaction = await voidSigner.populateTransaction({
|
|
166
168
|
...unsignedTx,
|
|
167
169
|
gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
|
|
@@ -183,7 +185,7 @@ export class QueryBase implements QueryInterface {
|
|
|
183
185
|
*/
|
|
184
186
|
async estimateGas(
|
|
185
187
|
unsignedTx: PopulatedTransaction,
|
|
186
|
-
senderAddress:
|
|
188
|
+
senderAddress: Address,
|
|
187
189
|
provider: providers.Provider | L2Provider<providers.Provider>,
|
|
188
190
|
options: Partial<{
|
|
189
191
|
gasPrice: BigNumberish;
|
|
@@ -204,7 +206,7 @@ export class QueryBase implements QueryInterface {
|
|
|
204
206
|
} = options || {};
|
|
205
207
|
|
|
206
208
|
const { chainId } = await provider.getNetwork();
|
|
207
|
-
const voidSigner = new VoidSigner(senderAddress, provider);
|
|
209
|
+
const voidSigner = new VoidSigner(senderAddress.toEvmAddress(), provider);
|
|
208
210
|
|
|
209
211
|
// Estimate the Gas units required to submit this transaction.
|
|
210
212
|
const queries = [
|
|
@@ -213,9 +215,9 @@ export class QueryBase implements QueryInterface {
|
|
|
213
215
|
? Promise.resolve({ maxFeePerGas: _gasPrice })
|
|
214
216
|
: getGasPriceEstimate(provider, { chainId, baseFeeMultiplier, priorityFeeMultiplier, transport, unsignedTx }),
|
|
215
217
|
] as const;
|
|
216
|
-
const [nativeGasCost,
|
|
217
|
-
|
|
218
|
-
const gasPrice =
|
|
218
|
+
const [nativeGasCost, gasPriceEstimate] = await Promise.all(queries);
|
|
219
|
+
|
|
220
|
+
const gasPrice = gasPriceEstimate.maxFeePerGas;
|
|
219
221
|
assert(nativeGasCost.gt(bnZero), "Gas cost should not be 0");
|
|
220
222
|
let tokenGasCost: BigNumber;
|
|
221
223
|
|
|
@@ -6,17 +6,17 @@ import { getComputeUnitEstimateForTransactionMessageFactory } from "@solana/kit"
|
|
|
6
6
|
import {
|
|
7
7
|
SVMProvider,
|
|
8
8
|
SolanaVoidSigner,
|
|
9
|
-
bigToU8a32,
|
|
10
9
|
createFillInstruction,
|
|
11
10
|
getAssociatedTokenAddress,
|
|
12
11
|
getEventAuthority,
|
|
13
12
|
getFillRelayDelegatePda,
|
|
14
13
|
getFillStatusPda,
|
|
15
14
|
getStatePda,
|
|
15
|
+
toAddress,
|
|
16
16
|
} from "../../arch/svm";
|
|
17
17
|
import { Coingecko } from "../../coingecko";
|
|
18
18
|
import { CHAIN_IDs } from "../../constants";
|
|
19
|
-
import {
|
|
19
|
+
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
20
20
|
import { Deposit } from "../../interfaces";
|
|
21
21
|
import {
|
|
22
22
|
BigNumber,
|
|
@@ -41,7 +41,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
41
41
|
* Instantiates a SvmQuery instance
|
|
42
42
|
* @param provider A valid solana/kit rpc client.
|
|
43
43
|
* @param symbolMapping A mapping to valid ERC20 tokens and their respective characteristics
|
|
44
|
-
* @param
|
|
44
|
+
* @param spokePool The valid address of the Spoke Pool deployment
|
|
45
45
|
* @param simulatedRelayerAddress The address that these queries will reference as the sender. Note: This address must be approved for USDC
|
|
46
46
|
* @param logger A logging utility to report logs
|
|
47
47
|
* @param coingeckoProApiKey An optional CoinGecko API key that links to a PRO account
|
|
@@ -51,7 +51,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
51
51
|
constructor(
|
|
52
52
|
readonly provider: SVMProvider,
|
|
53
53
|
readonly symbolMapping: SymbolMappingType,
|
|
54
|
-
readonly
|
|
54
|
+
readonly spokePool: SvmAddress,
|
|
55
55
|
readonly simulatedRelayerAddress: SvmAddress,
|
|
56
56
|
readonly logger: Logger,
|
|
57
57
|
readonly coingeckoProApiKey?: string,
|
|
@@ -75,7 +75,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
75
75
|
*/
|
|
76
76
|
async getGasCosts(
|
|
77
77
|
deposit: Omit<Deposit, "messageHash">,
|
|
78
|
-
|
|
78
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
|
|
79
79
|
options: Partial<{
|
|
80
80
|
gasPrice: BigNumberish;
|
|
81
81
|
gasUnits: BigNumberish;
|
|
@@ -83,10 +83,9 @@ export class SvmQuery implements QueryInterface {
|
|
|
83
83
|
priorityFeeMultiplier: BigNumber;
|
|
84
84
|
}> = {}
|
|
85
85
|
): Promise<TransactionCostEstimate> {
|
|
86
|
-
const
|
|
87
|
-
const fillRelayTx = await this.getFillRelayTx(deposit, relayer.toBase58());
|
|
86
|
+
const fillRelayTx = await this.getFillRelayTx(deposit, relayer);
|
|
88
87
|
|
|
89
|
-
const [computeUnitsConsumed,
|
|
88
|
+
const [computeUnitsConsumed, gasPriceEstimate] = await Promise.all([
|
|
90
89
|
toBN(await this.computeUnitEstimator(fillRelayTx)),
|
|
91
90
|
getGasPriceEstimate(this.provider, {
|
|
92
91
|
unsignedTx: fillRelayTx,
|
|
@@ -97,7 +96,6 @@ export class SvmQuery implements QueryInterface {
|
|
|
97
96
|
|
|
98
97
|
// We can cast the gas price estimate to an SvmGasPriceEstimate here since the oracle should always
|
|
99
98
|
// query the Solana adapter.
|
|
100
|
-
const gasPriceEstimate = _gasPriceEstimate as SvmGasPriceEstimate;
|
|
101
99
|
const gasPrice = gasPriceEstimate.baseFee.add(
|
|
102
100
|
gasPriceEstimate.microLamportsPerComputeUnit.mul(computeUnitsConsumed).div(toBN(1_000_000)) // 1_000_000 microLamports/lamport.
|
|
103
101
|
);
|
|
@@ -117,7 +115,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
117
115
|
*/
|
|
118
116
|
async getNativeGasCost(
|
|
119
117
|
deposit: Omit<Deposit, "messageHash">,
|
|
120
|
-
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
118
|
+
_relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
|
|
121
119
|
): Promise<BigNumber> {
|
|
122
120
|
const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
|
|
123
121
|
return toBN(await this.computeUnitEstimator(fillRelayTx));
|
|
@@ -131,43 +129,41 @@ export class SvmQuery implements QueryInterface {
|
|
|
131
129
|
*/
|
|
132
130
|
async getFillRelayTx(
|
|
133
131
|
deposit: Omit<Deposit, "messageHash">,
|
|
134
|
-
|
|
132
|
+
relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
|
|
135
133
|
repaymentChainId = deposit.destinationChainId,
|
|
136
|
-
repaymentAddress =
|
|
134
|
+
repaymentAddress = toAddressType(
|
|
135
|
+
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
136
|
+
deposit.destinationChainId
|
|
137
|
+
)
|
|
137
138
|
) {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
const _relayDataHash = getRelayDataHash(deposit,
|
|
139
|
+
const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, destinationChainId } = deposit;
|
|
140
|
+
|
|
141
|
+
const program = toAddress(this.spokePool);
|
|
142
|
+
const _relayDataHash = getRelayDataHash(deposit, destinationChainId);
|
|
142
143
|
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const mint =
|
|
150
|
-
const mintInfo = await fetchMint(this.provider, mint
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
mintInfo.programAddress
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
mint,
|
|
159
|
-
mintInfo.programAddress
|
|
160
|
-
);
|
|
161
|
-
const fillStatus = await getFillStatusPda(this.spokePoolAddress.toV2Address(), deposit, deposit.destinationChainId);
|
|
162
|
-
const eventAuthority = await getEventAuthority();
|
|
144
|
+
|
|
145
|
+
const [state, delegate] = await Promise.all([
|
|
146
|
+
getStatePda(program),
|
|
147
|
+
getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
const mint = toAddress(outputToken);
|
|
151
|
+
const mintInfo = await fetchMint(this.provider, mint);
|
|
152
|
+
|
|
153
|
+
const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
|
|
154
|
+
getAssociatedTokenAddress(deposit.recipient, outputToken, mintInfo.programAddress),
|
|
155
|
+
getAssociatedTokenAddress(SvmAddress.from(relayer.toBase58()), outputToken, mintInfo.programAddress),
|
|
156
|
+
getFillStatusPda(program, deposit, destinationChainId),
|
|
157
|
+
getEventAuthority(program),
|
|
158
|
+
]);
|
|
163
159
|
|
|
164
160
|
const relayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
165
|
-
depositor:
|
|
166
|
-
recipient:
|
|
167
|
-
exclusiveRelayer:
|
|
168
|
-
inputToken:
|
|
169
|
-
outputToken: mint
|
|
170
|
-
inputAmount:
|
|
161
|
+
depositor: toAddress(depositor),
|
|
162
|
+
recipient: toAddress(recipient),
|
|
163
|
+
exclusiveRelayer: toAddress(exclusiveRelayer),
|
|
164
|
+
inputToken: toAddress(inputToken),
|
|
165
|
+
outputToken: mint,
|
|
166
|
+
inputAmount: deposit.inputAmount.toBigInt(),
|
|
171
167
|
outputAmount: deposit.outputAmount.toBigInt(),
|
|
172
168
|
originChainId: deposit.originChainId,
|
|
173
169
|
depositId: new Uint8Array(intToU8Array32(deposit.depositId.toNumber())),
|
|
@@ -181,19 +177,19 @@ export class SvmQuery implements QueryInterface {
|
|
|
181
177
|
signer: simulatedSigner,
|
|
182
178
|
state,
|
|
183
179
|
delegate,
|
|
184
|
-
mint
|
|
180
|
+
mint,
|
|
185
181
|
relayerTokenAccount: relayerAta,
|
|
186
182
|
recipientTokenAccount: recipientAta,
|
|
187
183
|
fillStatus,
|
|
188
184
|
tokenProgram: mintInfo.programAddress,
|
|
189
185
|
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
190
186
|
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
191
|
-
eventAuthority
|
|
192
|
-
program
|
|
187
|
+
eventAuthority,
|
|
188
|
+
program,
|
|
193
189
|
relayHash: relayDataHash,
|
|
194
190
|
relayData,
|
|
195
191
|
repaymentChainId: BigInt(repaymentChainId),
|
|
196
|
-
repaymentAddress:
|
|
192
|
+
repaymentAddress: toAddress(repaymentAddress),
|
|
197
193
|
};
|
|
198
194
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
199
195
|
// if it doesn't exist.
|
|
@@ -9,12 +9,9 @@ import { Deposit } from "../interfaces";
|
|
|
9
9
|
import {
|
|
10
10
|
BigNumber,
|
|
11
11
|
BigNumberish,
|
|
12
|
-
ConvertDecimals,
|
|
13
12
|
MAX_BIG_INT,
|
|
14
13
|
TransactionCostEstimate,
|
|
15
14
|
bnZero,
|
|
16
|
-
chainIsSvm,
|
|
17
|
-
compareAddressesSimple,
|
|
18
15
|
fixedPointAdjustment,
|
|
19
16
|
getTokenInfo,
|
|
20
17
|
isDefined,
|
|
@@ -25,13 +22,18 @@ import {
|
|
|
25
22
|
percent,
|
|
26
23
|
toBN,
|
|
27
24
|
toBNWei,
|
|
25
|
+
compareAddressesSimple,
|
|
26
|
+
ConvertDecimals,
|
|
27
|
+
chainIsSvm,
|
|
28
|
+
toAddressType,
|
|
29
|
+
Address,
|
|
28
30
|
} from "../utils";
|
|
29
31
|
|
|
30
32
|
// This needs to be implemented for every chain and passed into RelayFeeCalculator
|
|
31
33
|
export interface QueryInterface {
|
|
32
34
|
getGasCosts: (
|
|
33
35
|
deposit: Omit<Deposit, "messageHash">,
|
|
34
|
-
relayer:
|
|
36
|
+
relayer: Address,
|
|
35
37
|
options?: Partial<{
|
|
36
38
|
gasPrice: BigNumberish;
|
|
37
39
|
gasUnits: BigNumberish;
|
|
@@ -42,7 +44,7 @@ export interface QueryInterface {
|
|
|
42
44
|
}>
|
|
43
45
|
) => Promise<TransactionCostEstimate>;
|
|
44
46
|
getTokenPrice: (tokenSymbol: string) => Promise<number>;
|
|
45
|
-
getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer:
|
|
47
|
+
getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: Address) => Promise<BigNumber>;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
@@ -254,7 +256,10 @@ export class RelayFeeCalculator {
|
|
|
254
256
|
deposit: Deposit,
|
|
255
257
|
outputAmount: BigNumberish,
|
|
256
258
|
simulateZeroFill = false,
|
|
257
|
-
relayerAddress =
|
|
259
|
+
relayerAddress = toAddressType(
|
|
260
|
+
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
261
|
+
deposit.destinationChainId
|
|
262
|
+
),
|
|
258
263
|
_tokenPrice?: number,
|
|
259
264
|
tokenMapping = TOKEN_SYMBOLS_MAP,
|
|
260
265
|
gasPrice?: BigNumberish,
|
|
@@ -271,14 +276,14 @@ export class RelayFeeCalculator {
|
|
|
271
276
|
// undefined address on destination.
|
|
272
277
|
const destinationChainTokenDetails = Object.values(tokenMapping).find(
|
|
273
278
|
(details) =>
|
|
274
|
-
compareAddressesSimple(details.addresses[originChainId], inputToken) &&
|
|
279
|
+
compareAddressesSimple(details.addresses[originChainId], inputToken.toNative()) &&
|
|
275
280
|
isDefined(details.addresses[destinationChainId])
|
|
276
281
|
);
|
|
277
282
|
const outputToken = isZeroAddress(deposit.outputToken)
|
|
278
283
|
? destinationChainTokenDetails!.addresses[destinationChainId]
|
|
279
|
-
: deposit.outputToken;
|
|
284
|
+
: deposit.outputToken.toNative();
|
|
280
285
|
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId, tokenMapping);
|
|
281
|
-
const inputTokenInfo = getTokenInfo(inputToken, originChainId, tokenMapping);
|
|
286
|
+
const inputTokenInfo = getTokenInfo(inputToken.toNative(), originChainId, tokenMapping);
|
|
282
287
|
if (!isDefined(outputTokenInfo) || !isDefined(inputTokenInfo)) {
|
|
283
288
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
284
289
|
}
|
|
@@ -493,7 +498,10 @@ export class RelayFeeCalculator {
|
|
|
493
498
|
deposit: Deposit,
|
|
494
499
|
outputAmount?: BigNumberish,
|
|
495
500
|
simulateZeroFill = false,
|
|
496
|
-
relayerAddress =
|
|
501
|
+
relayerAddress = toAddressType(
|
|
502
|
+
getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
503
|
+
deposit.destinationChainId
|
|
504
|
+
),
|
|
497
505
|
_tokenPrice?: number,
|
|
498
506
|
gasPrice?: BigNumberish,
|
|
499
507
|
gasUnits?: BigNumberish,
|
|
@@ -505,8 +513,8 @@ export class RelayFeeCalculator {
|
|
|
505
513
|
const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
|
|
506
514
|
// We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
|
|
507
515
|
// resolve the L1 token symbol and not the L2 token decimals.
|
|
508
|
-
const inputTokenInfo = getTokenInfo(inputToken, originChainId);
|
|
509
|
-
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
|
|
516
|
+
const inputTokenInfo = getTokenInfo(inputToken.toNative(), originChainId);
|
|
517
|
+
const outputTokenInfo = getTokenInfo(outputToken.toNative(), destinationChainId);
|
|
510
518
|
if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
|
|
511
519
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
512
520
|
}
|