@across-protocol/sdk 4.2.9-alpha.0 → 4.2.9-alpha.1
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 +3 -18
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +16 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +135 -34
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +5 -1
- package/dist/cjs/arch/svm/utils.js +26 -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 +2 -2
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +53 -57
- 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/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 -11
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +20 -20
- package/dist/cjs/clients/HubPoolClient.js +57 -78
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +29 -35
- 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 +9 -15
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +13 -9
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +56 -40
- package/dist/cjs/clients/mocks/MockSpokePoolClient.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 +13 -18
- package/dist/cjs/interfaces/SpokePool.d.ts +16 -14
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +7 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +73 -64
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +4 -7
- package/dist/cjs/utils/AddressUtils.js +8 -21
- package/dist/cjs/utils/AddressUtils.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 -3
- 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 +4 -19
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +46 -6
- package/dist/esm/arch/svm/SpokeUtils.js +164 -43
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +11 -1
- package/dist/esm/arch/svm/utils.js +31 -16
- 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 +2 -2
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +54 -58
- 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 -4
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.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 +9 -12
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +21 -22
- package/dist/esm/clients/HubPoolClient.js +61 -91
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +30 -37
- 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 +10 -16
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +13 -9
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +60 -44
- package/dist/esm/clients/mocks/MockSpokePoolClient.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 +13 -18
- package/dist/esm/interfaces/SpokePool.d.ts +16 -14
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +8 -9
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +77 -66
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +4 -7
- package/dist/esm/utils/AddressUtils.js +10 -25
- package/dist/esm/utils/AddressUtils.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 +16 -4
- package/dist/esm/utils/TokenUtils.js +3 -3
- 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 +46 -6
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +11 -1
- 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 +2 -2
- 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/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 +21 -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 +3 -5
- 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 +13 -9
- package/dist/types/clients/mocks/MockSpokePoolClient.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 +13 -18
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +16 -14
- 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 +8 -9
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +4 -7
- 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 +16 -4
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/arch/evm/SpokeUtils.ts +8 -22
- package/src/arch/svm/SpokeUtils.ts +156 -49
- package/src/arch/svm/utils.ts +22 -3
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
- package/src/clients/BundleDataClient/BundleDataClient.ts +47 -49
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
- package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
- package/src/clients/HubPoolClient.ts +79 -113
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -7
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +37 -104
- package/src/clients/mocks/MockHubPoolClient.ts +19 -24
- package/src/clients/mocks/MockSpokePoolClient.ts +74 -53
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
- package/src/interfaces/HubPool.ts +13 -22
- package/src/interfaces/SpokePool.ts +17 -14
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +92 -91
- package/src/relayFeeCalculator/relayFeeCalculator.ts +14 -16
- package/src/utils/AddressUtils.ts +14 -32
- package/src/utils/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +7 -7
|
@@ -2,15 +2,7 @@ import winston from "winston";
|
|
|
2
2
|
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
3
3
|
import { Address } from "@solana/kit";
|
|
4
4
|
import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
|
|
5
|
-
import {
|
|
6
|
-
getCurrentTime,
|
|
7
|
-
bnZero,
|
|
8
|
-
MakeOptional,
|
|
9
|
-
EventSearchConfig,
|
|
10
|
-
Address as SDKAddress,
|
|
11
|
-
toAddressType,
|
|
12
|
-
isDefined,
|
|
13
|
-
} from "../../utils";
|
|
5
|
+
import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
|
|
14
6
|
import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
|
|
15
7
|
import { HubPoolClient } from "../HubPoolClient";
|
|
16
8
|
import { EventOverrides } from "./MockEvents";
|
|
@@ -54,9 +46,8 @@ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
|
|
|
54
46
|
this.destinationTokenForChainOverride[chainId] = token;
|
|
55
47
|
}
|
|
56
48
|
|
|
57
|
-
getDestinationTokenForDeposit(deposit: DepositWithBlock):
|
|
58
|
-
|
|
59
|
-
return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
|
|
49
|
+
getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
|
|
50
|
+
return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
|
|
60
51
|
}
|
|
61
52
|
|
|
62
53
|
setLatestBlockNumber(blockNumber: number): void {
|
|
@@ -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 {
|
|
@@ -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,23 @@
|
|
|
1
1
|
import { SortableEvent } from "./Common";
|
|
2
|
+
import { FilledV3RelayEvent, V3FundsDepositedEvent } from "../typechain";
|
|
2
3
|
import { SpokePoolClient } from "../clients";
|
|
3
|
-
import { BigNumber
|
|
4
|
+
import { BigNumber } from "../utils";
|
|
4
5
|
import { RelayerRefundLeaf } from "./HubPool";
|
|
5
6
|
|
|
7
|
+
export type { FilledV3RelayEvent, V3FundsDepositedEvent };
|
|
8
|
+
|
|
6
9
|
export interface RelayData {
|
|
7
10
|
originChainId: number;
|
|
8
|
-
depositor:
|
|
9
|
-
recipient:
|
|
11
|
+
depositor: string;
|
|
12
|
+
recipient: string;
|
|
10
13
|
depositId: BigNumber;
|
|
11
|
-
inputToken:
|
|
14
|
+
inputToken: string;
|
|
12
15
|
inputAmount: BigNumber;
|
|
13
|
-
outputToken:
|
|
16
|
+
outputToken: string;
|
|
14
17
|
outputAmount: BigNumber;
|
|
15
18
|
message: string;
|
|
16
19
|
fillDeadline: number;
|
|
17
|
-
exclusiveRelayer:
|
|
20
|
+
exclusiveRelayer: string;
|
|
18
21
|
exclusivityDeadline: number;
|
|
19
22
|
}
|
|
20
23
|
|
|
@@ -23,7 +26,7 @@ export interface Deposit extends RelayData {
|
|
|
23
26
|
destinationChainId: number;
|
|
24
27
|
quoteTimestamp: number;
|
|
25
28
|
speedUpSignature?: string;
|
|
26
|
-
updatedRecipient?:
|
|
29
|
+
updatedRecipient?: string;
|
|
27
30
|
updatedOutputAmount?: BigNumber;
|
|
28
31
|
updatedMessage?: string;
|
|
29
32
|
fromLiteChain: boolean;
|
|
@@ -51,7 +54,7 @@ export enum FillType {
|
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export interface RelayExecutionEventInfo {
|
|
54
|
-
updatedRecipient:
|
|
57
|
+
updatedRecipient: string;
|
|
55
58
|
updatedOutputAmount: BigNumber;
|
|
56
59
|
updatedMessage?: string;
|
|
57
60
|
updatedMessageHash: string;
|
|
@@ -61,7 +64,7 @@ export interface RelayExecutionEventInfo {
|
|
|
61
64
|
export interface Fill extends Omit<RelayData, "message"> {
|
|
62
65
|
messageHash: string;
|
|
63
66
|
destinationChainId: number;
|
|
64
|
-
relayer:
|
|
67
|
+
relayer: string;
|
|
65
68
|
repaymentChainId: number;
|
|
66
69
|
relayExecutionInfo: RelayExecutionEventInfo;
|
|
67
70
|
}
|
|
@@ -72,25 +75,25 @@ export interface FillWithTime extends Fill, SortableEvent {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
export interface EnabledDepositRoute {
|
|
75
|
-
originToken:
|
|
78
|
+
originToken: string;
|
|
76
79
|
destinationChainId: number;
|
|
77
80
|
enabled: boolean;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
|
|
81
84
|
export interface SpeedUp {
|
|
82
|
-
depositor:
|
|
85
|
+
depositor: string;
|
|
83
86
|
depositorSignature: string;
|
|
84
87
|
depositId: BigNumber;
|
|
85
88
|
originChainId: number;
|
|
86
|
-
updatedRecipient:
|
|
89
|
+
updatedRecipient: string;
|
|
87
90
|
updatedOutputAmount: BigNumber;
|
|
88
91
|
updatedMessage: string;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
|
|
92
95
|
|
|
93
|
-
export interface SlowFillRequest extends
|
|
96
|
+
export interface SlowFillRequest extends RelayData {
|
|
94
97
|
messageHash: string;
|
|
95
98
|
destinationChainId: number;
|
|
96
99
|
}
|
|
@@ -130,7 +133,7 @@ export interface TokensBridged extends SortableEvent {
|
|
|
130
133
|
amountToReturn: BigNumber;
|
|
131
134
|
chainId: number;
|
|
132
135
|
leafId: number;
|
|
133
|
-
l2TokenAddress:
|
|
136
|
+
l2TokenAddress: string;
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
export interface SpokePoolClientsByChain {
|
|
@@ -15,8 +15,6 @@ import {
|
|
|
15
15
|
bnZero,
|
|
16
16
|
chainIsOPStack,
|
|
17
17
|
fixedPointAdjustment,
|
|
18
|
-
toAddressType,
|
|
19
|
-
Address,
|
|
20
18
|
} from "../../utils";
|
|
21
19
|
import assert from "assert";
|
|
22
20
|
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
@@ -74,7 +72,7 @@ export class QueryBase implements QueryInterface {
|
|
|
74
72
|
*/
|
|
75
73
|
async getGasCosts(
|
|
76
74
|
deposit: Omit<Deposit, "messageHash">,
|
|
77
|
-
relayer =
|
|
75
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
78
76
|
options: Partial<{
|
|
79
77
|
gasPrice: BigNumberish;
|
|
80
78
|
gasUnits: BigNumberish;
|
|
@@ -124,7 +122,7 @@ export class QueryBase implements QueryInterface {
|
|
|
124
122
|
*/
|
|
125
123
|
getUnsignedTxFromDeposit(
|
|
126
124
|
deposit: Omit<Deposit, "messageHash">,
|
|
127
|
-
relayer =
|
|
125
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
128
126
|
): Promise<PopulatedTransaction> {
|
|
129
127
|
return populateV3Relay(this.spokePool, deposit, relayer);
|
|
130
128
|
}
|
|
@@ -137,10 +135,10 @@ export class QueryBase implements QueryInterface {
|
|
|
137
135
|
*/
|
|
138
136
|
async getNativeGasCost(
|
|
139
137
|
deposit: Omit<Deposit, "messageHash">,
|
|
140
|
-
relayer =
|
|
138
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
141
139
|
): Promise<BigNumber> {
|
|
142
140
|
const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
143
|
-
const voidSigner = new VoidSigner(relayer
|
|
141
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
144
142
|
return voidSigner.estimateGas(unsignedTx);
|
|
145
143
|
}
|
|
146
144
|
|
|
@@ -154,7 +152,7 @@ export class QueryBase implements QueryInterface {
|
|
|
154
152
|
*/
|
|
155
153
|
async getOpStackL1DataFee(
|
|
156
154
|
unsignedTx: PopulatedTransaction,
|
|
157
|
-
relayer =
|
|
155
|
+
relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
|
|
158
156
|
options: Partial<{
|
|
159
157
|
opStackL2GasUnits: BigNumberish;
|
|
160
158
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
@@ -163,7 +161,7 @@ export class QueryBase implements QueryInterface {
|
|
|
163
161
|
const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
|
|
164
162
|
const { chainId } = await this.provider.getNetwork();
|
|
165
163
|
assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
|
|
166
|
-
const voidSigner = new VoidSigner(relayer
|
|
164
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
167
165
|
const populatedTransaction = await voidSigner.populateTransaction({
|
|
168
166
|
...unsignedTx,
|
|
169
167
|
gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
|
|
@@ -185,7 +183,7 @@ export class QueryBase implements QueryInterface {
|
|
|
185
183
|
*/
|
|
186
184
|
async estimateGas(
|
|
187
185
|
unsignedTx: PopulatedTransaction,
|
|
188
|
-
senderAddress:
|
|
186
|
+
senderAddress: string,
|
|
189
187
|
provider: providers.Provider | L2Provider<providers.Provider>,
|
|
190
188
|
options: Partial<{
|
|
191
189
|
gasPrice: BigNumberish;
|
|
@@ -206,7 +204,7 @@ export class QueryBase implements QueryInterface {
|
|
|
206
204
|
} = options || {};
|
|
207
205
|
|
|
208
206
|
const { chainId } = await provider.getNetwork();
|
|
209
|
-
const voidSigner = new VoidSigner(senderAddress
|
|
207
|
+
const voidSigner = new VoidSigner(senderAddress, provider);
|
|
210
208
|
|
|
211
209
|
// Estimate the Gas units required to submit this transaction.
|
|
212
210
|
const queries = [
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
2
|
+
import { intToU8Array32 } from "@across-protocol/contracts/dist/src/svm/web3-v1/conversionUtils";
|
|
3
|
+
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
|
|
4
|
+
import { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, fetchMint } from "@solana-program/token";
|
|
5
|
+
import { getComputeUnitEstimateForTransactionMessageFactory } from "@solana/kit";
|
|
6
|
+
import {
|
|
7
|
+
SVMProvider,
|
|
8
|
+
SolanaVoidSigner,
|
|
9
|
+
createFillInstruction,
|
|
10
|
+
getAssociatedTokenAddress,
|
|
11
|
+
getEventAuthority,
|
|
12
|
+
getFillRelayDelegatePda,
|
|
13
|
+
getFillStatusPda,
|
|
14
|
+
getStatePda,
|
|
15
|
+
} from "../../arch/svm";
|
|
2
16
|
import { Coingecko } from "../../coingecko";
|
|
3
|
-
import { SymbolMappingType } from "./";
|
|
4
17
|
import { CHAIN_IDs } from "../../constants";
|
|
18
|
+
import { SvmGasPriceEstimate, getGasPriceEstimate } from "../../gasPriceOracle";
|
|
5
19
|
import { Deposit } from "../../interfaces";
|
|
6
|
-
import { getGasPriceEstimate, SvmGasPriceEstimate } from "../../gasPriceOracle";
|
|
7
20
|
import {
|
|
8
|
-
BigNumberish,
|
|
9
|
-
TransactionCostEstimate,
|
|
10
21
|
BigNumber,
|
|
22
|
+
BigNumberish,
|
|
11
23
|
SvmAddress,
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
TransactionCostEstimate,
|
|
25
|
+
getRelayDataHash,
|
|
14
26
|
toAddressType,
|
|
27
|
+
toBN,
|
|
15
28
|
} from "../../utils";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
fillRelayInstruction,
|
|
19
|
-
createApproveInstruction,
|
|
20
|
-
createTokenAccountsInstruction,
|
|
21
|
-
SVMProvider,
|
|
22
|
-
SolanaVoidSigner,
|
|
23
|
-
getAssociatedTokenAddress,
|
|
24
|
-
} from "../../arch/svm";
|
|
25
|
-
import {
|
|
26
|
-
createTransactionMessage,
|
|
27
|
-
setTransactionMessageFeePayer,
|
|
28
|
-
setTransactionMessageLifetimeUsingBlockhash,
|
|
29
|
-
appendTransactionMessageInstructions,
|
|
30
|
-
getComputeUnitEstimateForTransactionMessageFactory,
|
|
31
|
-
fetchEncodedAccount,
|
|
32
|
-
IInstruction,
|
|
33
|
-
} from "@solana/kit";
|
|
34
|
-
import { TOKEN_PROGRAM_ADDRESS, getMintSize, getInitializeMintInstruction, fetchMint } from "@solana-program/token";
|
|
35
|
-
import { getCreateAccountInstruction } from "@solana-program/system";
|
|
29
|
+
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
30
|
+
import { SymbolMappingType } from "./";
|
|
36
31
|
|
|
37
32
|
/**
|
|
38
33
|
* A special QueryBase implementation for SVM used for querying gas costs, token prices, and decimals of various tokens
|
|
@@ -70,7 +65,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
70
65
|
/**
|
|
71
66
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
72
67
|
* @param deposit V3 deposit instance.
|
|
73
|
-
* @param
|
|
68
|
+
* @param _relayer Relayer address to simulate with.
|
|
74
69
|
* @param options
|
|
75
70
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
76
71
|
* @param options.gasUnits Optional gas units to use for the simulation.
|
|
@@ -79,7 +74,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
79
74
|
*/
|
|
80
75
|
async getGasCosts(
|
|
81
76
|
deposit: Omit<Deposit, "messageHash">,
|
|
82
|
-
_relayer =
|
|
77
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
83
78
|
options: Partial<{
|
|
84
79
|
gasPrice: BigNumberish;
|
|
85
80
|
gasUnits: BigNumberish;
|
|
@@ -87,9 +82,8 @@ export class SvmQuery implements QueryInterface {
|
|
|
87
82
|
priorityFeeMultiplier: BigNumber;
|
|
88
83
|
}> = {}
|
|
89
84
|
): Promise<TransactionCostEstimate> {
|
|
90
|
-
const relayer = _relayer ? _relayer.forceSvmAddress() : this.simulatedRelayerAddress;
|
|
91
|
-
|
|
92
|
-
const fillRelayTx = await this.getFillRelayTx(deposit, relayer);
|
|
85
|
+
const relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
|
|
86
|
+
const fillRelayTx = await this.getFillRelayTx(deposit, relayer.toBase58());
|
|
93
87
|
|
|
94
88
|
const [computeUnitsConsumed, _gasPriceEstimate] = await Promise.all([
|
|
95
89
|
toBN(await this.computeUnitEstimator(fillRelayTx)),
|
|
@@ -122,11 +116,10 @@ export class SvmQuery implements QueryInterface {
|
|
|
122
116
|
*/
|
|
123
117
|
async getNativeGasCost(
|
|
124
118
|
deposit: Omit<Deposit, "messageHash">,
|
|
125
|
-
_relayer =
|
|
119
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
126
120
|
): Promise<BigNumber> {
|
|
127
121
|
const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
|
|
128
|
-
|
|
129
|
-
return computeUnitsConsumed;
|
|
122
|
+
return toBN(await this.computeUnitEstimator(fillRelayTx));
|
|
130
123
|
}
|
|
131
124
|
|
|
132
125
|
/**
|
|
@@ -137,65 +130,73 @@ export class SvmQuery implements QueryInterface {
|
|
|
137
130
|
*/
|
|
138
131
|
async getFillRelayTx(
|
|
139
132
|
deposit: Omit<Deposit, "messageHash">,
|
|
140
|
-
_relayer =
|
|
133
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
134
|
+
repaymentChainId = deposit.destinationChainId,
|
|
135
|
+
repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
141
136
|
) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
mint: mint.toV2Address(),
|
|
168
|
-
decimals: mintInfo.data.decimals,
|
|
169
|
-
mintAuthority: owner.toV2Address(),
|
|
170
|
-
});
|
|
171
|
-
recipientCreateTokenAccountInstructions = [createAccountIx, initializeMintIx];
|
|
172
|
-
}
|
|
137
|
+
const toSvmAddress = (address: string) => toAddressType(address).forceSvmAddress().toV2Address();
|
|
138
|
+
const relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
|
|
139
|
+
const state = await getStatePda(this.spokePoolAddress.toV2Address());
|
|
140
|
+
const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
|
|
141
|
+
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
142
|
+
const delegate = await getFillRelayDelegatePda(
|
|
143
|
+
relayDataHash,
|
|
144
|
+
BigInt(repaymentChainId),
|
|
145
|
+
toSvmAddress(repaymentAddress),
|
|
146
|
+
this.spokePoolAddress.toV2Address()
|
|
147
|
+
);
|
|
148
|
+
const mint = toAddressType(deposit.outputToken).forceSvmAddress();
|
|
149
|
+
const mintInfo = await fetchMint(this.provider, mint.toV2Address());
|
|
150
|
+
const recipientAta = await getAssociatedTokenAddress(
|
|
151
|
+
toAddressType(deposit.recipient).forceSvmAddress(),
|
|
152
|
+
mint,
|
|
153
|
+
mintInfo.programAddress
|
|
154
|
+
);
|
|
155
|
+
const relayerAta = await getAssociatedTokenAddress(
|
|
156
|
+
SvmAddress.from(relayer.toBase58()),
|
|
157
|
+
mint,
|
|
158
|
+
mintInfo.programAddress
|
|
159
|
+
);
|
|
160
|
+
const fillStatus = await getFillStatusPda(this.spokePoolAddress.toV2Address(), deposit, deposit.destinationChainId);
|
|
161
|
+
const eventAuthority = await getEventAuthority();
|
|
173
162
|
|
|
174
|
-
const [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
163
|
+
const relayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
164
|
+
depositor: toSvmAddress(deposit.depositor),
|
|
165
|
+
recipient: toSvmAddress(deposit.recipient),
|
|
166
|
+
exclusiveRelayer: toSvmAddress(deposit.exclusiveRelayer),
|
|
167
|
+
inputToken: toSvmAddress(deposit.inputToken),
|
|
168
|
+
outputToken: mint.toV2Address(),
|
|
169
|
+
inputAmount: deposit.inputAmount.toBigInt(),
|
|
170
|
+
outputAmount: deposit.outputAmount.toBigInt(),
|
|
171
|
+
originChainId: deposit.originChainId,
|
|
172
|
+
depositId: new Uint8Array(intToU8Array32(deposit.depositId.toNumber())),
|
|
173
|
+
fillDeadline: deposit.fillDeadline,
|
|
174
|
+
exclusivityDeadline: deposit.exclusivityDeadline,
|
|
175
|
+
message: new Uint8Array(Buffer.from(deposit.message, "hex")),
|
|
176
|
+
};
|
|
185
177
|
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
178
|
+
const simulatedSigner = SolanaVoidSigner(relayer.toBase58());
|
|
179
|
+
const fillInput: SvmSpokeClient.FillRelayInput = {
|
|
180
|
+
signer: simulatedSigner,
|
|
181
|
+
state,
|
|
182
|
+
delegate,
|
|
183
|
+
mint: mint.toV2Address(),
|
|
184
|
+
relayerTokenAccount: relayerAta,
|
|
185
|
+
recipientTokenAccount: recipientAta,
|
|
186
|
+
fillStatus,
|
|
187
|
+
tokenProgram: mintInfo.programAddress,
|
|
188
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
189
|
+
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
190
|
+
eventAuthority: eventAuthority,
|
|
191
|
+
program: this.spokePoolAddress.toV2Address(),
|
|
192
|
+
relayHash: relayDataHash,
|
|
193
|
+
relayData,
|
|
194
|
+
repaymentChainId: BigInt(repaymentChainId),
|
|
195
|
+
repaymentAddress: toSvmAddress(repaymentAddress),
|
|
196
|
+
};
|
|
197
|
+
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
198
|
+
// if it doesn't exist.
|
|
199
|
+
return createFillInstruction(simulatedSigner, this.provider, fillInput, mintInfo.data.decimals, true);
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
|
+
import { Transport } from "viem";
|
|
2
3
|
import {
|
|
3
4
|
DEFAULT_SIMULATED_RELAYER_ADDRESS,
|
|
4
5
|
DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM,
|
|
@@ -8,32 +9,29 @@ import { Deposit } from "../interfaces";
|
|
|
8
9
|
import {
|
|
9
10
|
BigNumber,
|
|
10
11
|
BigNumberish,
|
|
12
|
+
ConvertDecimals,
|
|
11
13
|
MAX_BIG_INT,
|
|
12
14
|
TransactionCostEstimate,
|
|
13
15
|
bnZero,
|
|
16
|
+
chainIsSvm,
|
|
17
|
+
compareAddressesSimple,
|
|
14
18
|
fixedPointAdjustment,
|
|
15
19
|
getTokenInfo,
|
|
16
20
|
isDefined,
|
|
21
|
+
isZeroAddress,
|
|
17
22
|
max,
|
|
18
23
|
min,
|
|
19
24
|
nativeToToken,
|
|
20
25
|
percent,
|
|
21
26
|
toBN,
|
|
22
27
|
toBNWei,
|
|
23
|
-
isZeroAddress,
|
|
24
|
-
compareAddressesSimple,
|
|
25
|
-
ConvertDecimals,
|
|
26
|
-
chainIsSvm,
|
|
27
|
-
toAddressType,
|
|
28
|
-
Address,
|
|
29
28
|
} from "../utils";
|
|
30
|
-
import { Transport } from "viem";
|
|
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,7 +254,7 @@ export class RelayFeeCalculator {
|
|
|
256
254
|
deposit: Deposit,
|
|
257
255
|
outputAmount: BigNumberish,
|
|
258
256
|
simulateZeroFill = false,
|
|
259
|
-
relayerAddress =
|
|
257
|
+
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
260
258
|
_tokenPrice?: number,
|
|
261
259
|
tokenMapping = TOKEN_SYMBOLS_MAP,
|
|
262
260
|
gasPrice?: BigNumberish,
|
|
@@ -273,14 +271,14 @@ export class RelayFeeCalculator {
|
|
|
273
271
|
// undefined address on destination.
|
|
274
272
|
const destinationChainTokenDetails = Object.values(tokenMapping).find(
|
|
275
273
|
(details) =>
|
|
276
|
-
compareAddressesSimple(details.addresses[originChainId], inputToken
|
|
274
|
+
compareAddressesSimple(details.addresses[originChainId], inputToken) &&
|
|
277
275
|
isDefined(details.addresses[destinationChainId])
|
|
278
276
|
);
|
|
279
277
|
const outputToken = isZeroAddress(deposit.outputToken)
|
|
280
278
|
? destinationChainTokenDetails!.addresses[destinationChainId]
|
|
281
|
-
: deposit.outputToken
|
|
279
|
+
: deposit.outputToken;
|
|
282
280
|
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId, tokenMapping);
|
|
283
|
-
const inputTokenInfo = getTokenInfo(inputToken
|
|
281
|
+
const inputTokenInfo = getTokenInfo(inputToken, originChainId, tokenMapping);
|
|
284
282
|
if (!isDefined(outputTokenInfo) || !isDefined(inputTokenInfo)) {
|
|
285
283
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
286
284
|
}
|
|
@@ -495,7 +493,7 @@ export class RelayFeeCalculator {
|
|
|
495
493
|
deposit: Deposit,
|
|
496
494
|
outputAmount?: BigNumberish,
|
|
497
495
|
simulateZeroFill = false,
|
|
498
|
-
relayerAddress =
|
|
496
|
+
relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
499
497
|
_tokenPrice?: number,
|
|
500
498
|
gasPrice?: BigNumberish,
|
|
501
499
|
gasUnits?: BigNumberish,
|
|
@@ -507,8 +505,8 @@ export class RelayFeeCalculator {
|
|
|
507
505
|
const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
|
|
508
506
|
// We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
|
|
509
507
|
// resolve the L1 token symbol and not the L2 token decimals.
|
|
510
|
-
const inputTokenInfo = getTokenInfo(inputToken
|
|
511
|
-
const outputTokenInfo = getTokenInfo(outputToken
|
|
508
|
+
const inputTokenInfo = getTokenInfo(inputToken, originChainId);
|
|
509
|
+
const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
|
|
512
510
|
if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
|
|
513
511
|
throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
|
|
514
512
|
}
|