@across-protocol/sdk 4.2.16 → 4.3.0

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.
Files changed (220) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +8 -3
  2. package/dist/cjs/arch/evm/SpokeUtils.js +26 -11
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +8 -2
  5. package/dist/cjs/arch/svm/SpokeUtils.js +41 -50
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/svm/eventsClient.js +4 -2
  8. package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
  9. package/dist/cjs/arch/svm/utils.d.ts +3 -3
  10. package/dist/cjs/arch/svm/utils.js +16 -14
  11. package/dist/cjs/arch/svm/utils.js.map +1 -1
  12. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  13. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  14. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  15. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  16. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +60 -56
  17. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  19. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  21. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
  22. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  23. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  24. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  25. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  26. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  27. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  28. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +13 -8
  29. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  30. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  31. package/dist/cjs/clients/HubPoolClient.js +85 -58
  32. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  33. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  34. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  36. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +65 -45
  37. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  39. package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
  40. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  42. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
  43. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  45. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +6 -4
  46. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  47. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  48. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  49. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  50. package/dist/cjs/interfaces/HubPool.d.ts +19 -14
  51. package/dist/cjs/interfaces/SpokePool.d.ts +18 -19
  52. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  53. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +15 -7
  54. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +24 -15
  55. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  56. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
  57. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  58. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +12 -4
  59. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +46 -44
  60. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  61. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  62. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +10 -10
  63. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  64. package/dist/cjs/utils/AddressUtils.d.ts +12 -8
  65. package/dist/cjs/utils/AddressUtils.js +33 -36
  66. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  67. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  68. package/dist/cjs/utils/SpokeUtils.js +4 -22
  69. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  70. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  71. package/dist/cjs/utils/TokenUtils.js +5 -3
  72. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  73. package/dist/esm/arch/evm/SpokeUtils.d.ts +9 -4
  74. package/dist/esm/arch/evm/SpokeUtils.js +29 -14
  75. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  76. package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -3
  77. package/dist/esm/arch/svm/SpokeUtils.js +42 -55
  78. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  79. package/dist/esm/arch/svm/eventsClient.js +5 -3
  80. package/dist/esm/arch/svm/eventsClient.js.map +1 -1
  81. package/dist/esm/arch/svm/utils.d.ts +3 -3
  82. package/dist/esm/arch/svm/utils.js +17 -15
  83. package/dist/esm/arch/svm/utils.js.map +1 -1
  84. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  85. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  86. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  88. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  89. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  90. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  91. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  92. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  93. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +7 -7
  94. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  95. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  96. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  97. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  98. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  99. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  100. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +20 -10
  101. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  102. package/dist/esm/clients/HubPoolClient.d.ts +22 -22
  103. package/dist/esm/clients/HubPoolClient.js +91 -62
  104. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  105. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  106. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  107. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  108. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +68 -47
  109. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  110. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  111. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  112. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  113. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  114. package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
  115. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  116. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  117. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +7 -5
  118. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  119. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  120. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  121. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  122. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  123. package/dist/esm/interfaces/SpokePool.d.ts +18 -19
  124. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  125. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +18 -10
  126. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +29 -20
  127. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  128. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
  129. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  130. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
  131. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +51 -48
  132. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  133. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  134. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -9
  135. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  136. package/dist/esm/utils/AddressUtils.d.ts +12 -8
  137. package/dist/esm/utils/AddressUtils.js +36 -38
  138. package/dist/esm/utils/AddressUtils.js.map +1 -1
  139. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  140. package/dist/esm/utils/SpokeUtils.js +4 -26
  141. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  142. package/dist/esm/utils/TokenUtils.d.ts +22 -18
  143. package/dist/esm/utils/TokenUtils.js +6 -4
  144. package/dist/esm/utils/TokenUtils.js.map +1 -1
  145. package/dist/types/arch/evm/SpokeUtils.d.ts +9 -4
  146. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  147. package/dist/types/arch/svm/SpokeUtils.d.ts +9 -3
  148. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  149. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
  150. package/dist/types/arch/svm/utils.d.ts +3 -3
  151. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  152. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  153. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  154. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  155. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  156. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  157. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  158. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  159. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  160. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  161. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  162. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  163. package/dist/types/clients/HubPoolClient.d.ts +22 -22
  164. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  165. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  166. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  167. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  168. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  169. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  170. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  171. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  172. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  173. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  174. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  175. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  176. package/dist/types/interfaces/HubPool.d.ts +19 -14
  177. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  178. package/dist/types/interfaces/SpokePool.d.ts +18 -19
  179. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  180. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +18 -10
  181. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  182. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  183. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
  184. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  185. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  186. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  187. package/dist/types/utils/AddressUtils.d.ts +12 -8
  188. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  189. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  190. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  191. package/dist/types/utils/TokenUtils.d.ts +22 -18
  192. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  193. package/package.json +1 -2
  194. package/src/arch/evm/SpokeUtils.ts +72 -22
  195. package/src/arch/svm/SpokeUtils.ts +67 -53
  196. package/src/arch/svm/eventsClient.ts +40 -8
  197. package/src/arch/svm/utils.ts +6 -6
  198. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  199. package/src/clients/BundleDataClient/BundleDataClient.ts +57 -53
  200. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  201. package/src/clients/BundleDataClient/utils/FillUtils.ts +12 -8
  202. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  203. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  204. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +22 -10
  205. package/src/clients/HubPoolClient.ts +123 -82
  206. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
  207. package/src/clients/SpokePoolClient/SpokePoolClient.ts +121 -35
  208. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  209. package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
  210. package/src/clients/mocks/MockSvmCpiEventsClient.ts +8 -5
  211. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  212. package/src/interfaces/HubPool.ts +20 -14
  213. package/src/interfaces/SpokePool.ts +19 -19
  214. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +39 -20
  215. package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
  216. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +57 -56
  217. package/src/relayFeeCalculator/relayFeeCalculator.ts +15 -13
  218. package/src/utils/AddressUtils.ts +39 -51
  219. package/src/utils/SpokeUtils.ts +11 -33
  220. package/src/utils/TokenUtils.ts +10 -8
@@ -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: string[];
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: string;
20
- refundAddresses: string[];
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: string;
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: string[];
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 L1Token {
80
- address: string;
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
  }
@@ -89,25 +95,25 @@ export interface LpToken {
89
95
 
90
96
  export interface CrossChainContractsSet extends SortableEvent {
91
97
  l2ChainId: number;
92
- spokePool: string;
98
+ spokePool: Address;
93
99
  }
94
100
 
95
101
  export interface DestinationTokenWithBlock extends SortableEvent {
96
- l2Token: string;
97
- l1Token: string;
102
+ l2Token: Address;
103
+ l1Token: EvmAddress;
98
104
  }
99
105
 
100
106
  export interface SetPoolRebalanceRoot extends SortableEvent {
101
107
  destinationChainId: number;
102
- l1Token: string;
103
- destinationToken: string;
108
+ l1Token: EvmAddress;
109
+ destinationToken: Address;
104
110
  }
105
111
 
106
112
  export interface PendingRootBundle {
107
113
  poolRebalanceRoot: string;
108
114
  relayerRefundRoot: string;
109
115
  slowRelayRoot: string;
110
- proposer: string;
116
+ proposer: EvmAddress;
111
117
  unclaimedPoolRebalanceLeafCount: number;
112
118
  challengePeriodEndTimestamp: number;
113
119
  bundleEvaluationBlockNumbers: number[];
@@ -1,31 +1,34 @@
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: string;
9
- recipient: string;
8
+ depositor: Address;
9
+ recipient: Address;
10
10
  depositId: BigNumber;
11
- inputToken: string;
11
+ inputToken: Address;
12
12
  inputAmount: BigNumber;
13
- outputToken: string;
13
+ outputToken: Address;
14
14
  outputAmount: BigNumber;
15
15
  message: string;
16
16
  fillDeadline: number;
17
- exclusiveRelayer: string;
17
+ exclusiveRelayer: Address;
18
18
  exclusivityDeadline: number;
19
19
  }
20
20
 
21
- export interface Deposit extends RelayData {
21
+ export interface SpeedUpCommon {
22
+ updatedRecipient: Address;
23
+ updatedOutputAmount: BigNumber;
24
+ updatedMessage: string;
25
+ }
26
+
27
+ export interface Deposit extends RelayData, Partial<SpeedUpCommon> {
22
28
  messageHash: string;
23
29
  destinationChainId: number;
24
30
  quoteTimestamp: number;
25
31
  speedUpSignature?: string;
26
- updatedRecipient?: string;
27
- updatedOutputAmount?: BigNumber;
28
- updatedMessage?: string;
29
32
  fromLiteChain: boolean;
30
33
  toLiteChain: boolean;
31
34
  }
@@ -51,7 +54,7 @@ export enum FillType {
51
54
  }
52
55
 
53
56
  export interface RelayExecutionEventInfo {
54
- updatedRecipient: string;
57
+ updatedRecipient: Address;
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: string;
67
+ relayer: Address;
65
68
  repaymentChainId: number;
66
69
  relayExecutionInfo: RelayExecutionEventInfo;
67
70
  }
@@ -72,20 +75,17 @@ export interface FillWithTime extends Fill, SortableEvent {
72
75
  }
73
76
 
74
77
  export interface EnabledDepositRoute {
75
- originToken: string;
78
+ originToken: Address;
76
79
  destinationChainId: number;
77
80
  enabled: boolean;
78
81
  }
79
82
 
80
83
  export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
81
- export interface SpeedUp {
82
- depositor: string;
84
+ export interface SpeedUp extends SpeedUpCommon {
85
+ depositor: EvmAddress;
83
86
  depositorSignature: string;
84
87
  depositId: BigNumber;
85
88
  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: string;
133
+ l2TokenAddress: Address;
134
134
  }
135
135
 
136
136
  export interface ClaimedRelayerRefundWithBlock extends SortableEvent {
@@ -1,23 +1,25 @@
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
-
4
3
  import { PopulatedTransaction, providers, VoidSigner } from "ethers";
5
4
  import { Coingecko } from "../../coingecko";
6
5
  import { CHAIN_IDs } from "../../constants";
7
- import { Deposit } from "../../interfaces";
6
+ import { RelayData } from "../../interfaces";
8
7
  import { SpokePool, SpokePool__factory } from "../../typechain";
9
8
  import { populateV3Relay } from "../../arch/evm";
10
9
  import {
11
10
  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,
18
20
  } from "../../utils";
19
21
  import assert from "assert";
20
- import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
22
+ import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
21
23
  import { Transport } from "viem";
22
24
  import { getGasPriceEstimate } from "../../gasPriceOracle";
23
25
  import { EvmProvider } from "../../arch/evm/types";
@@ -62,7 +64,7 @@ export class QueryBase implements QueryInterface {
62
64
 
63
65
  /**
64
66
  * Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
65
- * @param deposit V3 deposit instance.
67
+ * @param relayData RelayData instance, supplemented with destinationChainId
66
68
  * @param relayerAddress Relayer address to simulate with.
67
69
  * @param options
68
70
  * @param options.gasPrice Optional gas price to use for the simulation.
@@ -71,8 +73,8 @@ export class QueryBase implements QueryInterface {
71
73
  * @returns The gas estimate for this function call (multiplied with the optional buffer).
72
74
  */
73
75
  async getGasCosts(
74
- deposit: Omit<Deposit, "messageHash">,
75
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
76
+ relayData: RelayData & { destinationChainId: number },
77
+ relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId),
76
78
  options: Partial<{
77
79
  gasPrice: BigNumberish;
78
80
  gasUnits: BigNumberish;
@@ -91,7 +93,12 @@ export class QueryBase implements QueryInterface {
91
93
  transport,
92
94
  } = options;
93
95
 
94
- const tx = await this.getUnsignedTxFromDeposit(deposit, relayer);
96
+ const { recipient, outputToken, exclusiveRelayer } = relayData;
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);
95
102
  const {
96
103
  nativeGasCost,
97
104
  tokenGasCost,
@@ -116,29 +123,41 @@ export class QueryBase implements QueryInterface {
116
123
 
117
124
  /**
118
125
  * @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
119
- * @param deposit
126
+ * @param relayData RelayData instance, supplemented with destinationChainId
120
127
  * @param relayer Sender of PopulatedTransaction
121
128
  * @returns PopulatedTransaction
122
129
  */
123
130
  getUnsignedTxFromDeposit(
124
- deposit: Omit<Deposit, "messageHash">,
125
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
131
+ relayData: Omit<RelayData, "recipient" | "outputToken"> & {
132
+ destinationChainId: number;
133
+ recipient: EvmAddress;
134
+ outputToken: EvmAddress;
135
+ },
136
+ relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
126
137
  ): Promise<PopulatedTransaction> {
127
- return populateV3Relay(this.spokePool, deposit, relayer);
138
+ return populateV3Relay(this.spokePool, relayData, relayer);
128
139
  }
129
140
 
130
141
  /**
131
142
  * @notice Return the gas cost of a simulated transaction
132
- * @param deposit
143
+ * @param relayData RelayData instance, supplemented with destinationChainId
133
144
  * @param relayer Sender of PopulatedTransaction
134
145
  * @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
135
146
  */
136
147
  async getNativeGasCost(
137
- deposit: Omit<Deposit, "messageHash">,
138
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
148
+ relayData: RelayData & { destinationChainId: number },
149
+ relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
139
150
  ): Promise<BigNumber> {
140
- const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
141
- const voidSigner = new VoidSigner(relayer, this.provider);
151
+ const { recipient, outputToken, exclusiveRelayer } = relayData;
152
+ assert(recipient.isEVM(), `getNativeGasCost: recipient not an EVM address (${recipient})`);
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);
142
161
  return voidSigner.estimateGas(unsignedTx);
143
162
  }
144
163
 
@@ -152,7 +171,7 @@ export class QueryBase implements QueryInterface {
152
171
  */
153
172
  async getOpStackL1DataFee(
154
173
  unsignedTx: PopulatedTransaction,
155
- relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
174
+ relayer = toAddressType(getDefaultRelayer(unsignedTx.chainId), CHAIN_IDs.MAINNET),
156
175
  options: Partial<{
157
176
  opStackL2GasUnits: BigNumberish;
158
177
  opStackL1DataFeeMultiplier: BigNumber;
@@ -161,7 +180,7 @@ export class QueryBase implements QueryInterface {
161
180
  const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
162
181
  const { chainId } = await this.provider.getNetwork();
163
182
  assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
164
- const voidSigner = new VoidSigner(relayer, this.provider);
183
+ const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
165
184
  const populatedTransaction = await voidSigner.populateTransaction({
166
185
  ...unsignedTx,
167
186
  gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
@@ -183,7 +202,7 @@ export class QueryBase implements QueryInterface {
183
202
  */
184
203
  async estimateGas(
185
204
  unsignedTx: PopulatedTransaction,
186
- senderAddress: string,
205
+ senderAddress: Address,
187
206
  provider: providers.Provider | L2Provider<providers.Provider>,
188
207
  options: Partial<{
189
208
  gasPrice: BigNumberish;
@@ -204,7 +223,7 @@ export class QueryBase implements QueryInterface {
204
223
  } = options || {};
205
224
 
206
225
  const { chainId } = await provider.getNetwork();
207
- const voidSigner = new VoidSigner(senderAddress, provider);
226
+ const voidSigner = new VoidSigner(senderAddress.toEvmAddress(), provider);
208
227
 
209
228
  // Estimate the Gas units required to submit this transaction.
210
229
  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, getDefaultSimulatedRelayerAddress, Logger } from "../relayFeeCalculator";
10
+ import { DEFAULT_LOGGER, getDefaultRelayer, 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 = getDefaultSimulatedRelayerAddress(chainId),
28
+ simulatedRelayerAddress = getDefaultRelayer(chainId),
29
29
  coingeckoProApiKey?: string,
30
30
  logger: Logger = DEFAULT_LOGGER,
31
31
  coingeckoBaseCurrency = "eth"
@@ -1,3 +1,4 @@
1
+ import assert from "assert";
1
2
  import { SvmSpokeClient } from "@across-protocol/contracts";
2
3
  import { intToU8Array32 } from "@across-protocol/contracts/dist/src/svm/web3-v1/conversionUtils";
3
4
  import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
@@ -17,7 +18,7 @@ import {
17
18
  import { Coingecko } from "../../coingecko";
18
19
  import { CHAIN_IDs } from "../../constants";
19
20
  import { getGasPriceEstimate } from "../../gasPriceOracle";
20
- import { Deposit } from "../../interfaces";
21
+ import { RelayData } from "../../interfaces";
21
22
  import {
22
23
  BigNumber,
23
24
  BigNumberish,
@@ -27,7 +28,7 @@ import {
27
28
  toAddressType,
28
29
  toBN,
29
30
  } from "../../utils";
30
- import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
31
+ import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
31
32
  import { SymbolMappingType } from "./";
32
33
 
33
34
  /**
@@ -65,7 +66,7 @@ export class SvmQuery implements QueryInterface {
65
66
 
66
67
  /**
67
68
  * Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
68
- * @param deposit V3 deposit instance.
69
+ * @param relayData RelayData instance, supplemented with destinationChainId
69
70
  * @param _relayer Relayer address to simulate with.
70
71
  * @param options
71
72
  * @param options.gasPrice Optional gas price to use for the simulation.
@@ -74,8 +75,8 @@ export class SvmQuery implements QueryInterface {
74
75
  * @returns The gas estimate for this function call (multiplied with the optional buffer).
75
76
  */
76
77
  async getGasCosts(
77
- deposit: Omit<Deposit, "messageHash">,
78
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
78
+ relayData: RelayData & { destinationChainId: number },
79
+ relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId),
79
80
  options: Partial<{
80
81
  gasPrice: BigNumberish;
81
82
  gasUnits: BigNumberish;
@@ -83,10 +84,12 @@ export class SvmQuery implements QueryInterface {
83
84
  priorityFeeMultiplier: BigNumber;
84
85
  }> = {}
85
86
  ): Promise<TransactionCostEstimate> {
86
- const relayer = _relayer
87
- ? toAddressType(_relayer, deposit.destinationChainId).forceSvmAddress()
88
- : this.simulatedRelayerAddress;
89
- const fillRelayTx = await this.getFillRelayTx(deposit, relayer.toBase58());
87
+ const { recipient, outputToken, exclusiveRelayer } = relayData;
88
+ assert(recipient.isSVM(), `getGasCosts: recipient not an SVM address (${recipient})`);
89
+ assert(outputToken.isSVM(), `getGasCosts: outputToken not an SVM address (${outputToken})`);
90
+ assert(exclusiveRelayer.isSVM(), `getGasCosts: exclusiveRelayer not an SVM address (${exclusiveRelayer})`);
91
+
92
+ const fillRelayTx = await this.getFillRelayTx({ ...relayData, recipient, outputToken, exclusiveRelayer }, relayer);
90
93
 
91
94
  const [computeUnitsConsumed, gasPriceEstimate] = await Promise.all([
92
95
  toBN(await this.computeUnitEstimator(fillRelayTx)),
@@ -117,77 +120,75 @@ export class SvmQuery implements QueryInterface {
117
120
  * @returns Estimated gas cost in compute units
118
121
  */
119
122
  async getNativeGasCost(
120
- deposit: Omit<Deposit, "messageHash">,
121
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
123
+ deposit: RelayData & { destinationChainId: number },
124
+ _relayer = toAddressType(getDefaultRelayer(deposit.destinationChainId), deposit.destinationChainId)
122
125
  ): Promise<BigNumber> {
123
- const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
126
+ const { recipient, outputToken, exclusiveRelayer } = deposit;
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);
124
132
  return toBN(await this.computeUnitEstimator(fillRelayTx));
125
133
  }
126
134
 
127
135
  /**
128
136
  * @notice Return the fillRelay transaction for a given deposit
129
- * @param deposit
137
+ * @param relayData RelayData instance, supplemented with destinationChainId
130
138
  * @param relayer SVM address of the relayer
131
139
  * @returns FillRelay transaction
132
140
  */
133
141
  async getFillRelayTx(
134
- deposit: Omit<Deposit, "messageHash">,
135
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
136
- repaymentChainId = deposit.destinationChainId,
137
- repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
142
+ relayData: Omit<RelayData, "recipent" | "outputToken"> & {
143
+ destinationChainId: number;
144
+ recipient: SvmAddress;
145
+ outputToken: SvmAddress;
146
+ },
147
+ relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId),
148
+ repaymentChainId = relayData.destinationChainId,
149
+ repaymentAddress = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
138
150
  ) {
139
- const toSvmAddress = (address: string, chainId: number) =>
140
- toAddress(toAddressType(address, chainId).forceSvmAddress());
151
+ const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, destinationChainId } = relayData;
141
152
 
142
- const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, originChainId, destinationChainId } =
143
- deposit;
153
+ // tsc appeasement...should be unnecessary, but isn't. @todo Identify why.
154
+ assert(recipient.isSVM(), `getFillRelayTx: recipient not an SVM address (${recipient})`);
155
+ assert(
156
+ repaymentAddress.isValidOn(repaymentChainId),
157
+ `getFillRelayTx: repayment address ${repaymentAddress} not valid on chain ${repaymentChainId})`
158
+ );
144
159
 
145
160
  const program = toAddress(this.spokePool);
146
- const relayer = _relayer
147
- ? toAddressType(_relayer, deposit.destinationChainId).forceSvmAddress()
148
- : this.simulatedRelayerAddress;
149
-
150
- const _relayDataHash = getRelayDataHash(deposit, destinationChainId);
161
+ const _relayDataHash = getRelayDataHash(relayData, destinationChainId);
151
162
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
152
163
 
153
164
  const [state, delegate] = await Promise.all([
154
165
  getStatePda(program),
155
- getFillRelayDelegatePda(
156
- relayDataHash,
157
- BigInt(repaymentChainId),
158
- toSvmAddress(repaymentAddress, repaymentChainId),
159
- program
160
- ),
166
+ getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
161
167
  ]);
162
168
 
163
- const _mint = toAddressType(outputToken, destinationChainId).forceSvmAddress();
164
- const mint = toAddress(_mint);
169
+ const mint = toAddress(outputToken);
165
170
  const mintInfo = await fetchMint(this.provider, mint);
166
171
 
167
172
  const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
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(),
173
+ getAssociatedTokenAddress(recipient, outputToken, mintInfo.programAddress),
174
+ getAssociatedTokenAddress(SvmAddress.from(relayer.toBase58()), outputToken, mintInfo.programAddress),
175
+ getFillStatusPda(program, relayData, destinationChainId),
176
+ getEventAuthority(program),
176
177
  ]);
177
178
 
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),
179
+ const svmRelayData: SvmSpokeClient.FillRelayInput["relayData"] = {
180
+ depositor: toAddress(depositor),
181
+ recipient: toAddress(recipient),
182
+ exclusiveRelayer: toAddress(exclusiveRelayer),
183
+ inputToken: toAddress(inputToken),
183
184
  outputToken: mint,
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")),
185
+ inputAmount: relayData.inputAmount.toBigInt(),
186
+ outputAmount: relayData.outputAmount.toBigInt(),
187
+ originChainId: relayData.originChainId,
188
+ depositId: new Uint8Array(intToU8Array32(relayData.depositId.toNumber())),
189
+ fillDeadline: relayData.fillDeadline,
190
+ exclusivityDeadline: relayData.exclusivityDeadline,
191
+ message: new Uint8Array(Buffer.from(relayData.message, "hex")),
191
192
  };
192
193
 
193
194
  const simulatedSigner = SolanaVoidSigner(relayer.toBase58());
@@ -205,9 +206,9 @@ export class SvmQuery implements QueryInterface {
205
206
  eventAuthority,
206
207
  program,
207
208
  relayHash: relayDataHash,
208
- relayData,
209
+ relayData: svmRelayData,
209
210
  repaymentChainId: BigInt(repaymentChainId),
210
- repaymentAddress: toSvmAddress(repaymentAddress, repaymentChainId),
211
+ repaymentAddress: toAddress(repaymentAddress),
211
212
  };
212
213
  // Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
213
214
  // 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: string,
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: string) => Promise<BigNumber>;
47
+ getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: Address) => Promise<BigNumber>;
46
48
  }
47
49
 
48
50
  export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
@@ -112,7 +114,7 @@ export const DEFAULT_LOGGER: Logger = {
112
114
  error: (...args) => console.error(args),
113
115
  };
114
116
 
115
- export function getDefaultSimulatedRelayerAddress(chainId?: number) {
117
+ export function getDefaultRelayer(chainId?: number) {
116
118
  return isDefined(chainId) && chainIsSvm(chainId)
117
119
  ? DEFAULT_SIMULATED_RELAYER_ADDRESS_SVM
118
120
  : DEFAULT_SIMULATED_RELAYER_ADDRESS;
@@ -254,7 +256,7 @@ export class RelayFeeCalculator {
254
256
  deposit: Deposit,
255
257
  outputAmount: BigNumberish,
256
258
  simulateZeroFill = false,
257
- relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
259
+ relayerAddress = toAddressType(getDefaultRelayer(deposit.destinationChainId), deposit.destinationChainId),
258
260
  _tokenPrice?: number,
259
261
  tokenMapping = TOKEN_SYMBOLS_MAP,
260
262
  gasPrice?: BigNumberish,
@@ -271,14 +273,14 @@ export class RelayFeeCalculator {
271
273
  // undefined address on destination.
272
274
  const destinationChainTokenDetails = Object.values(tokenMapping).find(
273
275
  (details) =>
274
- compareAddressesSimple(details.addresses[originChainId], inputToken) &&
276
+ compareAddressesSimple(details.addresses[originChainId], inputToken.toNative()) &&
275
277
  isDefined(details.addresses[destinationChainId])
276
278
  );
277
279
  const outputToken = isZeroAddress(deposit.outputToken)
278
280
  ? destinationChainTokenDetails!.addresses[destinationChainId]
279
- : deposit.outputToken;
281
+ : deposit.outputToken.toNative();
280
282
  const outputTokenInfo = getTokenInfo(outputToken, destinationChainId, tokenMapping);
281
- const inputTokenInfo = getTokenInfo(inputToken, originChainId, tokenMapping);
283
+ const inputTokenInfo = getTokenInfo(inputToken.toNative(), originChainId, tokenMapping);
282
284
  if (!isDefined(outputTokenInfo) || !isDefined(inputTokenInfo)) {
283
285
  throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
284
286
  }
@@ -493,7 +495,7 @@ export class RelayFeeCalculator {
493
495
  deposit: Deposit,
494
496
  outputAmount?: BigNumberish,
495
497
  simulateZeroFill = false,
496
- relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
498
+ relayerAddress = toAddressType(getDefaultRelayer(deposit.destinationChainId), deposit.destinationChainId),
497
499
  _tokenPrice?: number,
498
500
  gasPrice?: BigNumberish,
499
501
  gasUnits?: BigNumberish,
@@ -505,8 +507,8 @@ export class RelayFeeCalculator {
505
507
  const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
506
508
  // We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
507
509
  // resolve the L1 token symbol and not the L2 token decimals.
508
- const inputTokenInfo = getTokenInfo(inputToken, originChainId);
509
- const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
510
+ const inputTokenInfo = getTokenInfo(inputToken.toNative(), originChainId);
511
+ const outputTokenInfo = getTokenInfo(outputToken.toNative(), destinationChainId);
510
512
  if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
511
513
  throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
512
514
  }