@across-protocol/sdk 4.2.16-alpha.6 → 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 +3 -8
- package/dist/cjs/arch/evm/SpokeUtils.js +11 -26
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +2 -8
- package/dist/cjs/arch/svm/SpokeUtils.js +50 -41
- 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 +71 -71
- 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 +19 -18
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +7 -15
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +15 -24
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -12
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +44 -46
- 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 +10 -10
- 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 +4 -9
- package/dist/esm/arch/evm/SpokeUtils.js +14 -29
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +3 -9
- package/dist/esm/arch/svm/SpokeUtils.js +55 -42
- 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 +71 -71
- 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 +19 -18
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +20 -29
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -14
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +48 -51
- 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 +9 -9
- 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 +4 -9
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +3 -9
- 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 +71 -71
- 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 +19 -18
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -14
- 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 +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 +22 -72
- package/src/arch/svm/SpokeUtils.ts +53 -67
- 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 +19 -19
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +20 -39
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +56 -57
- package/src/relayFeeCalculator/relayFeeCalculator.ts +13 -15
- 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,34 +1,31 @@
|
|
|
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
|
|
|
21
|
-
export interface
|
|
22
|
-
updatedRecipient: Address;
|
|
23
|
-
updatedOutputAmount: BigNumber;
|
|
24
|
-
updatedMessage: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface Deposit extends RelayData, Partial<SpeedUpCommon> {
|
|
21
|
+
export interface Deposit extends RelayData {
|
|
28
22
|
messageHash: string;
|
|
29
23
|
destinationChainId: number;
|
|
30
24
|
quoteTimestamp: number;
|
|
31
25
|
speedUpSignature?: string;
|
|
26
|
+
updatedRecipient?: string;
|
|
27
|
+
updatedOutputAmount?: BigNumber;
|
|
28
|
+
updatedMessage?: string;
|
|
32
29
|
fromLiteChain: boolean;
|
|
33
30
|
toLiteChain: boolean;
|
|
34
31
|
}
|
|
@@ -54,7 +51,7 @@ export enum FillType {
|
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
export interface RelayExecutionEventInfo {
|
|
57
|
-
updatedRecipient:
|
|
54
|
+
updatedRecipient: string;
|
|
58
55
|
updatedOutputAmount: BigNumber;
|
|
59
56
|
updatedMessage?: string;
|
|
60
57
|
updatedMessageHash: string;
|
|
@@ -64,7 +61,7 @@ export interface RelayExecutionEventInfo {
|
|
|
64
61
|
export interface Fill extends Omit<RelayData, "message"> {
|
|
65
62
|
messageHash: string;
|
|
66
63
|
destinationChainId: number;
|
|
67
|
-
relayer:
|
|
64
|
+
relayer: string;
|
|
68
65
|
repaymentChainId: number;
|
|
69
66
|
relayExecutionInfo: RelayExecutionEventInfo;
|
|
70
67
|
}
|
|
@@ -75,17 +72,20 @@ export interface FillWithTime extends Fill, SortableEvent {
|
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
export interface EnabledDepositRoute {
|
|
78
|
-
originToken:
|
|
75
|
+
originToken: string;
|
|
79
76
|
destinationChainId: number;
|
|
80
77
|
enabled: boolean;
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
|
|
84
|
-
export interface SpeedUp
|
|
85
|
-
depositor:
|
|
81
|
+
export interface SpeedUp {
|
|
82
|
+
depositor: string;
|
|
86
83
|
depositorSignature: string;
|
|
87
84
|
depositId: BigNumber;
|
|
88
85
|
originChainId: number;
|
|
86
|
+
updatedRecipient: string;
|
|
87
|
+
updatedOutputAmount: BigNumber;
|
|
88
|
+
updatedMessage: string;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
|
|
@@ -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 {
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { L2Provider } from "@eth-optimism/sdk/dist/interfaces/l2-provider";
|
|
2
2
|
import { isL2Provider as isOptimismL2Provider } from "@eth-optimism/sdk/dist/l2-provider";
|
|
3
|
+
|
|
3
4
|
import { PopulatedTransaction, providers, VoidSigner } from "ethers";
|
|
4
5
|
import { Coingecko } from "../../coingecko";
|
|
5
6
|
import { CHAIN_IDs } from "../../constants";
|
|
6
|
-
import {
|
|
7
|
+
import { Deposit } from "../../interfaces";
|
|
7
8
|
import { SpokePool, SpokePool__factory } from "../../typechain";
|
|
8
9
|
import { populateV3Relay } from "../../arch/evm";
|
|
9
10
|
import {
|
|
10
11
|
BigNumberish,
|
|
11
|
-
EvmAddress,
|
|
12
12
|
TransactionCostEstimate,
|
|
13
13
|
BigNumber,
|
|
14
14
|
toBNWei,
|
|
15
15
|
bnZero,
|
|
16
16
|
chainIsOPStack,
|
|
17
17
|
fixedPointAdjustment,
|
|
18
|
-
toAddressType,
|
|
19
|
-
Address,
|
|
20
18
|
} from "../../utils";
|
|
21
19
|
import assert from "assert";
|
|
22
|
-
import { Logger, QueryInterface,
|
|
20
|
+
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
23
21
|
import { Transport } from "viem";
|
|
24
22
|
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
25
23
|
import { EvmProvider } from "../../arch/evm/types";
|
|
@@ -64,7 +62,7 @@ export class QueryBase implements QueryInterface {
|
|
|
64
62
|
|
|
65
63
|
/**
|
|
66
64
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
67
|
-
* @param
|
|
65
|
+
* @param deposit V3 deposit instance.
|
|
68
66
|
* @param relayerAddress Relayer address to simulate with.
|
|
69
67
|
* @param options
|
|
70
68
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -73,8 +71,8 @@ export class QueryBase implements QueryInterface {
|
|
|
73
71
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
74
72
|
*/
|
|
75
73
|
async getGasCosts(
|
|
76
|
-
|
|
77
|
-
relayer =
|
|
74
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
75
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
78
76
|
options: Partial<{
|
|
79
77
|
gasPrice: BigNumberish;
|
|
80
78
|
gasUnits: BigNumberish;
|
|
@@ -93,12 +91,7 @@ export class QueryBase implements QueryInterface {
|
|
|
93
91
|
transport,
|
|
94
92
|
} = options;
|
|
95
93
|
|
|
96
|
-
const
|
|
97
|
-
assert(recipient.isEVM(), `getGasCosts: recipient not an EVM address (${recipient})`);
|
|
98
|
-
assert(outputToken.isEVM(), `getGasCosts: outputToken not an EVM address (${outputToken})`);
|
|
99
|
-
assert(exclusiveRelayer.isEVM(), `getGasCosts: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
100
|
-
|
|
101
|
-
const tx = await this.getUnsignedTxFromDeposit({ ...relayData, recipient, outputToken, exclusiveRelayer }, relayer);
|
|
94
|
+
const tx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
102
95
|
const {
|
|
103
96
|
nativeGasCost,
|
|
104
97
|
tokenGasCost,
|
|
@@ -123,41 +116,29 @@ export class QueryBase implements QueryInterface {
|
|
|
123
116
|
|
|
124
117
|
/**
|
|
125
118
|
* @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
|
|
126
|
-
* @param
|
|
119
|
+
* @param deposit
|
|
127
120
|
* @param relayer Sender of PopulatedTransaction
|
|
128
121
|
* @returns PopulatedTransaction
|
|
129
122
|
*/
|
|
130
123
|
getUnsignedTxFromDeposit(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
recipient: EvmAddress;
|
|
134
|
-
outputToken: EvmAddress;
|
|
135
|
-
},
|
|
136
|
-
relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
|
|
124
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
125
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
137
126
|
): Promise<PopulatedTransaction> {
|
|
138
|
-
return populateV3Relay(this.spokePool,
|
|
127
|
+
return populateV3Relay(this.spokePool, deposit, relayer);
|
|
139
128
|
}
|
|
140
129
|
|
|
141
130
|
/**
|
|
142
131
|
* @notice Return the gas cost of a simulated transaction
|
|
143
|
-
* @param
|
|
132
|
+
* @param deposit
|
|
144
133
|
* @param relayer Sender of PopulatedTransaction
|
|
145
134
|
* @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
|
|
146
135
|
*/
|
|
147
136
|
async getNativeGasCost(
|
|
148
|
-
|
|
149
|
-
relayer =
|
|
137
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
138
|
+
relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
150
139
|
): Promise<BigNumber> {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
assert(outputToken.isEVM(), `getNativeGasCost: outputToken not an EVM address (${outputToken})`);
|
|
154
|
-
assert(exclusiveRelayer.isEVM(), `getNativeGasCost: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
155
|
-
|
|
156
|
-
const unsignedTx = await this.getUnsignedTxFromDeposit(
|
|
157
|
-
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
158
|
-
relayer
|
|
159
|
-
);
|
|
160
|
-
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
140
|
+
const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
|
|
141
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
161
142
|
return voidSigner.estimateGas(unsignedTx);
|
|
162
143
|
}
|
|
163
144
|
|
|
@@ -171,7 +152,7 @@ export class QueryBase implements QueryInterface {
|
|
|
171
152
|
*/
|
|
172
153
|
async getOpStackL1DataFee(
|
|
173
154
|
unsignedTx: PopulatedTransaction,
|
|
174
|
-
relayer =
|
|
155
|
+
relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
|
|
175
156
|
options: Partial<{
|
|
176
157
|
opStackL2GasUnits: BigNumberish;
|
|
177
158
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
@@ -180,7 +161,7 @@ export class QueryBase implements QueryInterface {
|
|
|
180
161
|
const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
|
|
181
162
|
const { chainId } = await this.provider.getNetwork();
|
|
182
163
|
assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
|
|
183
|
-
const voidSigner = new VoidSigner(relayer
|
|
164
|
+
const voidSigner = new VoidSigner(relayer, this.provider);
|
|
184
165
|
const populatedTransaction = await voidSigner.populateTransaction({
|
|
185
166
|
...unsignedTx,
|
|
186
167
|
gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
|
|
@@ -202,7 +183,7 @@ export class QueryBase implements QueryInterface {
|
|
|
202
183
|
*/
|
|
203
184
|
async estimateGas(
|
|
204
185
|
unsignedTx: PopulatedTransaction,
|
|
205
|
-
senderAddress:
|
|
186
|
+
senderAddress: string,
|
|
206
187
|
provider: providers.Provider | L2Provider<providers.Provider>,
|
|
207
188
|
options: Partial<{
|
|
208
189
|
gasPrice: BigNumberish;
|
|
@@ -223,7 +204,7 @@ export class QueryBase implements QueryInterface {
|
|
|
223
204
|
} = options || {};
|
|
224
205
|
|
|
225
206
|
const { chainId } = await provider.getNetwork();
|
|
226
|
-
const voidSigner = new VoidSigner(senderAddress
|
|
207
|
+
const voidSigner = new VoidSigner(senderAddress, provider);
|
|
227
208
|
|
|
228
209
|
// Estimate the Gas units required to submit this transaction.
|
|
229
210
|
const queries = [
|
|
@@ -7,7 +7,7 @@ import { CUSTOM_GAS_TOKENS } from "../../constants";
|
|
|
7
7
|
import { chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
8
8
|
import { QueryBase } from "./baseQuery";
|
|
9
9
|
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
10
|
-
import { DEFAULT_LOGGER,
|
|
10
|
+
import { DEFAULT_LOGGER, getDefaultSimulatedRelayerAddress, Logger } from "../relayFeeCalculator";
|
|
11
11
|
import { CustomGasTokenQueries } from "./customGasToken";
|
|
12
12
|
import { SvmQuery } from "./svmQuery";
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ export class QueryBase__factory {
|
|
|
25
25
|
provider: providers.Provider | svmProvider,
|
|
26
26
|
symbolMapping = TOKEN_SYMBOLS_MAP,
|
|
27
27
|
spokePoolAddress = getDeployedAddress("SpokePool", chainId),
|
|
28
|
-
simulatedRelayerAddress =
|
|
28
|
+
simulatedRelayerAddress = getDefaultSimulatedRelayerAddress(chainId),
|
|
29
29
|
coingeckoProApiKey?: string,
|
|
30
30
|
logger: Logger = DEFAULT_LOGGER,
|
|
31
31
|
coingeckoBaseCurrency = "eth"
|
|
@@ -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";
|
|
@@ -18,7 +17,7 @@ import {
|
|
|
18
17
|
import { Coingecko } from "../../coingecko";
|
|
19
18
|
import { CHAIN_IDs } from "../../constants";
|
|
20
19
|
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
21
|
-
import {
|
|
20
|
+
import { Deposit } from "../../interfaces";
|
|
22
21
|
import {
|
|
23
22
|
BigNumber,
|
|
24
23
|
BigNumberish,
|
|
@@ -28,7 +27,7 @@ import {
|
|
|
28
27
|
toAddressType,
|
|
29
28
|
toBN,
|
|
30
29
|
} from "../../utils";
|
|
31
|
-
import { Logger, QueryInterface,
|
|
30
|
+
import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
|
|
32
31
|
import { SymbolMappingType } from "./";
|
|
33
32
|
|
|
34
33
|
/**
|
|
@@ -66,7 +65,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
66
65
|
|
|
67
66
|
/**
|
|
68
67
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
69
|
-
* @param
|
|
68
|
+
* @param deposit V3 deposit instance.
|
|
70
69
|
* @param _relayer Relayer address to simulate with.
|
|
71
70
|
* @param options
|
|
72
71
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -75,8 +74,8 @@ export class SvmQuery implements QueryInterface {
|
|
|
75
74
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
76
75
|
*/
|
|
77
76
|
async getGasCosts(
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
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({ ...relayData, 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,75 +117,77 @@ export class SvmQuery implements QueryInterface {
|
|
|
120
117
|
* @returns Estimated gas cost in compute units
|
|
121
118
|
*/
|
|
122
119
|
async getNativeGasCost(
|
|
123
|
-
deposit:
|
|
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
|
|
|
135
127
|
/**
|
|
136
128
|
* @notice Return the fillRelay transaction for a given deposit
|
|
137
|
-
* @param
|
|
129
|
+
* @param deposit
|
|
138
130
|
* @param relayer SVM address of the relayer
|
|
139
131
|
* @returns FillRelay transaction
|
|
140
132
|
*/
|
|
141
133
|
async getFillRelayTx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId),
|
|
148
|
-
repaymentChainId = relayData.destinationChainId,
|
|
149
|
-
repaymentAddress = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
|
|
134
|
+
deposit: Omit<Deposit, "messageHash">,
|
|
135
|
+
_relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
|
|
136
|
+
repaymentChainId = deposit.destinationChainId,
|
|
137
|
+
repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
|
|
150
138
|
) {
|
|
151
|
-
const
|
|
139
|
+
const toSvmAddress = (address: string, chainId: number) =>
|
|
140
|
+
toAddress(toAddressType(address, chainId).forceSvmAddress());
|
|
152
141
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
assert(
|
|
156
|
-
repaymentAddress.isValidOn(repaymentChainId),
|
|
157
|
-
`getFillRelayTx: repayment address ${repaymentAddress} not valid on chain ${repaymentChainId})`
|
|
158
|
-
);
|
|
142
|
+
const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, originChainId, destinationChainId } =
|
|
143
|
+
deposit;
|
|
159
144
|
|
|
160
145
|
const program = toAddress(this.spokePool);
|
|
161
|
-
const
|
|
146
|
+
const relayer = _relayer
|
|
147
|
+
? toAddressType(_relayer, deposit.destinationChainId).forceSvmAddress()
|
|
148
|
+
: this.simulatedRelayerAddress;
|
|
149
|
+
|
|
150
|
+
const _relayDataHash = getRelayDataHash(deposit, destinationChainId);
|
|
162
151
|
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
163
152
|
|
|
164
153
|
const [state, delegate] = await Promise.all([
|
|
165
154
|
getStatePda(program),
|
|
166
|
-
getFillRelayDelegatePda(
|
|
155
|
+
getFillRelayDelegatePda(
|
|
156
|
+
relayDataHash,
|
|
157
|
+
BigInt(repaymentChainId),
|
|
158
|
+
toSvmAddress(repaymentAddress, repaymentChainId),
|
|
159
|
+
program
|
|
160
|
+
),
|
|
167
161
|
]);
|
|
168
162
|
|
|
169
|
-
const
|
|
163
|
+
const _mint = toAddressType(outputToken, destinationChainId).forceSvmAddress();
|
|
164
|
+
const mint = toAddress(_mint);
|
|
170
165
|
const mintInfo = await fetchMint(this.provider, mint);
|
|
171
166
|
|
|
172
167
|
const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
|
|
173
|
-
getAssociatedTokenAddress(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
getAssociatedTokenAddress(
|
|
169
|
+
toAddressType(deposit.recipient, destinationChainId).forceSvmAddress(),
|
|
170
|
+
_mint,
|
|
171
|
+
mintInfo.programAddress
|
|
172
|
+
),
|
|
173
|
+
getAssociatedTokenAddress(SvmAddress.from(relayer.toBase58()), _mint, mintInfo.programAddress),
|
|
174
|
+
getFillStatusPda(program, deposit, destinationChainId),
|
|
175
|
+
getEventAuthority(),
|
|
177
176
|
]);
|
|
178
177
|
|
|
179
|
-
const
|
|
180
|
-
depositor:
|
|
181
|
-
recipient:
|
|
182
|
-
exclusiveRelayer:
|
|
183
|
-
inputToken:
|
|
178
|
+
const relayData: SvmSpokeClient.FillRelayInput["relayData"] = {
|
|
179
|
+
depositor: toSvmAddress(depositor, originChainId),
|
|
180
|
+
recipient: toSvmAddress(recipient, destinationChainId),
|
|
181
|
+
exclusiveRelayer: toSvmAddress(exclusiveRelayer, destinationChainId),
|
|
182
|
+
inputToken: toSvmAddress(inputToken, originChainId),
|
|
184
183
|
outputToken: mint,
|
|
185
|
-
inputAmount:
|
|
186
|
-
outputAmount:
|
|
187
|
-
originChainId:
|
|
188
|
-
depositId: new Uint8Array(intToU8Array32(
|
|
189
|
-
fillDeadline:
|
|
190
|
-
exclusivityDeadline:
|
|
191
|
-
message: new Uint8Array(Buffer.from(
|
|
184
|
+
inputAmount: deposit.inputAmount.toBigInt(),
|
|
185
|
+
outputAmount: deposit.outputAmount.toBigInt(),
|
|
186
|
+
originChainId: deposit.originChainId,
|
|
187
|
+
depositId: new Uint8Array(intToU8Array32(deposit.depositId.toNumber())),
|
|
188
|
+
fillDeadline: deposit.fillDeadline,
|
|
189
|
+
exclusivityDeadline: deposit.exclusivityDeadline,
|
|
190
|
+
message: new Uint8Array(Buffer.from(deposit.message, "hex")),
|
|
192
191
|
};
|
|
193
192
|
|
|
194
193
|
const simulatedSigner = SolanaVoidSigner(relayer.toBase58());
|
|
@@ -206,9 +205,9 @@ export class SvmQuery implements QueryInterface {
|
|
|
206
205
|
eventAuthority,
|
|
207
206
|
program,
|
|
208
207
|
relayHash: relayDataHash,
|
|
209
|
-
relayData
|
|
208
|
+
relayData,
|
|
210
209
|
repaymentChainId: BigInt(repaymentChainId),
|
|
211
|
-
repaymentAddress:
|
|
210
|
+
repaymentAddress: toSvmAddress(repaymentAddress, repaymentChainId),
|
|
212
211
|
};
|
|
213
212
|
// Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
|
|
214
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"];
|
|
@@ -114,7 +112,7 @@ export const DEFAULT_LOGGER: Logger = {
|
|
|
114
112
|
error: (...args) => console.error(args),
|
|
115
113
|
};
|
|
116
114
|
|
|
117
|
-
export function
|
|
115
|
+
export function getDefaultSimulatedRelayerAddress(chainId?: number) {
|
|
118
116
|
return isDefined(chainId) && chainIsSvm(chainId)
|
|
119
117
|
? DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM
|
|
120
118
|
: DEFAULT_SIMULATED_RELAYER_ADDRESS;
|
|
@@ -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
|
}
|