@across-protocol/sdk 4.2.16 → 4.3.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.
Files changed (256) 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 +59 -59
  17. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +16 -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 +2 -2
  34. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +1 -3
  36. package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
  37. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  38. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +66 -46
  39. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  40. package/dist/cjs/clients/SpokePoolClient/index.d.ts +1 -0
  41. package/dist/cjs/clients/SpokePoolClient/index.js +3 -1
  42. package/dist/cjs/clients/SpokePoolClient/index.js.map +1 -1
  43. package/dist/cjs/clients/index.d.ts +1 -1
  44. package/dist/cjs/clients/index.js +2 -1
  45. package/dist/cjs/clients/index.js.map +1 -1
  46. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  47. package/dist/cjs/clients/mocks/MockHubPoolClient.js +15 -9
  48. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  49. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  50. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +40 -36
  51. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  52. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  53. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +6 -4
  54. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  55. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  56. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  57. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  58. package/dist/cjs/interfaces/HubPool.d.ts +19 -14
  59. package/dist/cjs/interfaces/SpokePool.d.ts +18 -19
  60. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  61. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +17 -9
  62. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +24 -15
  63. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  64. package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +1 -1
  65. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +8 -5
  66. package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  67. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +13 -5
  68. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +61 -58
  69. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  70. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +15 -7
  71. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +13 -13
  72. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  73. package/dist/cjs/utils/AddressUtils.d.ts +12 -8
  74. package/dist/cjs/utils/AddressUtils.js +33 -36
  75. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  76. package/dist/cjs/utils/DepositUtils.d.ts +2 -2
  77. package/dist/cjs/utils/DepositUtils.js +1 -1
  78. package/dist/cjs/utils/DepositUtils.js.map +1 -1
  79. package/dist/cjs/utils/SpokeUtils.d.ts +1 -3
  80. package/dist/cjs/utils/SpokeUtils.js +3 -25
  81. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  82. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  83. package/dist/cjs/utils/TokenUtils.js +5 -3
  84. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  85. package/dist/esm/arch/evm/SpokeUtils.d.ts +9 -4
  86. package/dist/esm/arch/evm/SpokeUtils.js +29 -14
  87. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  88. package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -3
  89. package/dist/esm/arch/svm/SpokeUtils.js +42 -55
  90. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  91. package/dist/esm/arch/svm/eventsClient.js +5 -3
  92. package/dist/esm/arch/svm/eventsClient.js.map +1 -1
  93. package/dist/esm/arch/svm/utils.d.ts +3 -3
  94. package/dist/esm/arch/svm/utils.js +17 -15
  95. package/dist/esm/arch/svm/utils.js.map +1 -1
  96. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  97. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  98. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  99. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  100. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +60 -60
  101. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  102. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +18 -15
  103. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  104. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  105. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +7 -7
  106. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  107. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  108. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  109. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  110. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  111. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  112. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +20 -10
  113. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  114. package/dist/esm/clients/HubPoolClient.d.ts +22 -22
  115. package/dist/esm/clients/HubPoolClient.js +93 -66
  116. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  117. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
  118. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  119. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +2 -4
  120. package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
  121. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  122. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +69 -48
  123. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  124. package/dist/esm/clients/SpokePoolClient/index.d.ts +1 -0
  125. package/dist/esm/clients/SpokePoolClient/index.js +1 -0
  126. package/dist/esm/clients/SpokePoolClient/index.js.map +1 -1
  127. package/dist/esm/clients/index.d.ts +1 -1
  128. package/dist/esm/clients/index.js +1 -1
  129. package/dist/esm/clients/index.js.map +1 -1
  130. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  131. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  132. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  133. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  134. package/dist/esm/clients/mocks/MockSpokePoolClient.js +42 -38
  135. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  136. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  137. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +7 -5
  138. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  139. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  140. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  141. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  142. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  143. package/dist/esm/interfaces/SpokePool.d.ts +18 -19
  144. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  145. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +20 -12
  146. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +28 -19
  147. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  148. package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +1 -1
  149. package/dist/esm/relayFeeCalculator/chain-queries/factory.js +9 -6
  150. package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
  151. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +15 -7
  152. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +67 -63
  153. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  154. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +25 -8
  155. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +12 -12
  156. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  157. package/dist/esm/utils/AddressUtils.d.ts +12 -8
  158. package/dist/esm/utils/AddressUtils.js +36 -38
  159. package/dist/esm/utils/AddressUtils.js.map +1 -1
  160. package/dist/esm/utils/DepositUtils.d.ts +2 -2
  161. package/dist/esm/utils/DepositUtils.js +2 -2
  162. package/dist/esm/utils/DepositUtils.js.map +1 -1
  163. package/dist/esm/utils/SpokeUtils.d.ts +1 -8
  164. package/dist/esm/utils/SpokeUtils.js +3 -29
  165. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  166. package/dist/esm/utils/TokenUtils.d.ts +6 -18
  167. package/dist/esm/utils/TokenUtils.js +6 -4
  168. package/dist/esm/utils/TokenUtils.js.map +1 -1
  169. package/dist/types/arch/evm/SpokeUtils.d.ts +9 -4
  170. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  171. package/dist/types/arch/svm/SpokeUtils.d.ts +9 -3
  172. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  173. package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
  174. package/dist/types/arch/svm/utils.d.ts +3 -3
  175. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  176. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  177. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  178. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  179. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  180. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  181. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  182. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  183. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  184. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  185. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
  186. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  187. package/dist/types/clients/HubPoolClient.d.ts +22 -22
  188. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  189. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  190. package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -1
  191. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  192. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  193. package/dist/types/clients/SpokePoolClient/index.d.ts +1 -0
  194. package/dist/types/clients/SpokePoolClient/index.d.ts.map +1 -1
  195. package/dist/types/clients/index.d.ts +1 -1
  196. package/dist/types/clients/index.d.ts.map +1 -1
  197. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  198. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  199. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  200. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  201. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  202. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  203. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  204. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  205. package/dist/types/interfaces/HubPool.d.ts +19 -14
  206. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  207. package/dist/types/interfaces/SpokePool.d.ts +18 -19
  208. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  209. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +20 -12
  210. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  211. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +1 -1
  212. package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
  213. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +15 -7
  214. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  215. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +25 -8
  216. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  217. package/dist/types/utils/AddressUtils.d.ts +12 -8
  218. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  219. package/dist/types/utils/DepositUtils.d.ts +2 -2
  220. package/dist/types/utils/DepositUtils.d.ts.map +1 -1
  221. package/dist/types/utils/SpokeUtils.d.ts +1 -8
  222. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  223. package/dist/types/utils/TokenUtils.d.ts +6 -18
  224. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  225. package/package.json +1 -2
  226. package/src/arch/evm/SpokeUtils.ts +72 -22
  227. package/src/arch/svm/SpokeUtils.ts +67 -53
  228. package/src/arch/svm/eventsClient.ts +40 -8
  229. package/src/arch/svm/utils.ts +6 -6
  230. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  231. package/src/clients/BundleDataClient/BundleDataClient.ts +56 -56
  232. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +32 -15
  233. package/src/clients/BundleDataClient/utils/FillUtils.ts +12 -8
  234. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  235. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  236. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +22 -10
  237. package/src/clients/HubPoolClient.ts +125 -86
  238. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +7 -2
  239. package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +1 -4
  240. package/src/clients/SpokePoolClient/SpokePoolClient.ts +122 -37
  241. package/src/clients/SpokePoolClient/index.ts +1 -0
  242. package/src/clients/index.ts +1 -0
  243. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  244. package/src/clients/mocks/MockSpokePoolClient.ts +39 -27
  245. package/src/clients/mocks/MockSvmCpiEventsClient.ts +8 -5
  246. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  247. package/src/interfaces/HubPool.ts +20 -14
  248. package/src/interfaces/SpokePool.ts +19 -19
  249. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +39 -21
  250. package/src/relayFeeCalculator/chain-queries/factory.ts +8 -5
  251. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +73 -58
  252. package/src/relayFeeCalculator/relayFeeCalculator.ts +23 -21
  253. package/src/utils/AddressUtils.ts +39 -51
  254. package/src/utils/DepositUtils.ts +4 -4
  255. package/src/utils/SpokeUtils.ts +8 -36
  256. 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,24 @@
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
+ Address,
18
19
  } from "../../utils";
19
20
  import assert from "assert";
20
- import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
21
+ import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
21
22
  import { Transport } from "viem";
22
23
  import { getGasPriceEstimate } from "../../gasPriceOracle";
23
24
  import { EvmProvider } from "../../arch/evm/types";
@@ -51,7 +52,7 @@ export class QueryBase implements QueryInterface {
51
52
  readonly provider: EvmProvider,
52
53
  readonly symbolMapping: SymbolMappingType,
53
54
  readonly spokePoolAddress: string,
54
- readonly simulatedRelayerAddress: string,
55
+ readonly simulatedRelayerAddress: EvmAddress,
55
56
  readonly logger: Logger,
56
57
  readonly coingeckoProApiKey?: string,
57
58
  readonly fixedGasPrice?: BigNumberish,
@@ -62,7 +63,7 @@ export class QueryBase implements QueryInterface {
62
63
 
63
64
  /**
64
65
  * Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
65
- * @param deposit V3 deposit instance.
66
+ * @param relayData RelayData instance, supplemented with destinationChainId
66
67
  * @param relayerAddress Relayer address to simulate with.
67
68
  * @param options
68
69
  * @param options.gasPrice Optional gas price to use for the simulation.
@@ -71,8 +72,8 @@ export class QueryBase implements QueryInterface {
71
72
  * @returns The gas estimate for this function call (multiplied with the optional buffer).
72
73
  */
73
74
  async getGasCosts(
74
- deposit: Omit<Deposit, "messageHash">,
75
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
75
+ relayData: RelayData & { destinationChainId: number },
76
+ relayer = getDefaultRelayer(relayData.destinationChainId),
76
77
  options: Partial<{
77
78
  gasPrice: BigNumberish;
78
79
  gasUnits: BigNumberish;
@@ -91,7 +92,12 @@ export class QueryBase implements QueryInterface {
91
92
  transport,
92
93
  } = options;
93
94
 
94
- const tx = await this.getUnsignedTxFromDeposit(deposit, relayer);
95
+ const { recipient, outputToken, exclusiveRelayer } = relayData;
96
+ assert(recipient.isEVM(), `getGasCosts: recipient not an EVM address (${recipient})`);
97
+ assert(outputToken.isEVM(), `getGasCosts: outputToken not an EVM address (${outputToken})`);
98
+ assert(exclusiveRelayer.isEVM(), `getGasCosts: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
99
+
100
+ const tx = await this.getUnsignedTxFromDeposit({ ...relayData, recipient, outputToken, exclusiveRelayer }, relayer);
95
101
  const {
96
102
  nativeGasCost,
97
103
  tokenGasCost,
@@ -116,29 +122,41 @@ export class QueryBase implements QueryInterface {
116
122
 
117
123
  /**
118
124
  * @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
119
- * @param deposit
125
+ * @param relayData RelayData instance, supplemented with destinationChainId
120
126
  * @param relayer Sender of PopulatedTransaction
121
127
  * @returns PopulatedTransaction
122
128
  */
123
129
  getUnsignedTxFromDeposit(
124
- deposit: Omit<Deposit, "messageHash">,
125
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
130
+ relayData: Omit<RelayData, "recipient" | "outputToken"> & {
131
+ destinationChainId: number;
132
+ recipient: EvmAddress;
133
+ outputToken: EvmAddress;
134
+ },
135
+ relayer = getDefaultRelayer(relayData.destinationChainId)
126
136
  ): Promise<PopulatedTransaction> {
127
- return populateV3Relay(this.spokePool, deposit, relayer);
137
+ return populateV3Relay(this.spokePool, relayData, relayer);
128
138
  }
129
139
 
130
140
  /**
131
141
  * @notice Return the gas cost of a simulated transaction
132
- * @param deposit
142
+ * @param relayData RelayData instance, supplemented with destinationChainId
133
143
  * @param relayer Sender of PopulatedTransaction
134
144
  * @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
135
145
  */
136
146
  async getNativeGasCost(
137
- deposit: Omit<Deposit, "messageHash">,
138
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
147
+ relayData: RelayData & { destinationChainId: number },
148
+ relayer = getDefaultRelayer(relayData.destinationChainId)
139
149
  ): Promise<BigNumber> {
140
- const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
141
- const voidSigner = new VoidSigner(relayer, this.provider);
150
+ const { recipient, outputToken, exclusiveRelayer } = relayData;
151
+ assert(recipient.isEVM(), `getNativeGasCost: recipient not an EVM address (${recipient})`);
152
+ assert(outputToken.isEVM(), `getNativeGasCost: outputToken not an EVM address (${outputToken})`);
153
+ assert(exclusiveRelayer.isEVM(), `getNativeGasCost: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
154
+
155
+ const unsignedTx = await this.getUnsignedTxFromDeposit(
156
+ { ...relayData, recipient, outputToken, exclusiveRelayer },
157
+ relayer
158
+ );
159
+ const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
142
160
  return voidSigner.estimateGas(unsignedTx);
143
161
  }
144
162
 
@@ -152,7 +170,7 @@ export class QueryBase implements QueryInterface {
152
170
  */
153
171
  async getOpStackL1DataFee(
154
172
  unsignedTx: PopulatedTransaction,
155
- relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
173
+ relayer = getDefaultRelayer(unsignedTx.chainId),
156
174
  options: Partial<{
157
175
  opStackL2GasUnits: BigNumberish;
158
176
  opStackL1DataFeeMultiplier: BigNumber;
@@ -161,7 +179,7 @@ export class QueryBase implements QueryInterface {
161
179
  const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
162
180
  const { chainId } = await this.provider.getNetwork();
163
181
  assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
164
- const voidSigner = new VoidSigner(relayer, this.provider);
182
+ const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
165
183
  const populatedTransaction = await voidSigner.populateTransaction({
166
184
  ...unsignedTx,
167
185
  gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
@@ -183,7 +201,7 @@ export class QueryBase implements QueryInterface {
183
201
  */
184
202
  async estimateGas(
185
203
  unsignedTx: PopulatedTransaction,
186
- senderAddress: string,
204
+ senderAddress: Address,
187
205
  provider: providers.Provider | L2Provider<providers.Provider>,
188
206
  options: Partial<{
189
207
  gasPrice: BigNumberish;
@@ -204,7 +222,7 @@ export class QueryBase implements QueryInterface {
204
222
  } = options || {};
205
223
 
206
224
  const { chainId } = await provider.getNetwork();
207
- const voidSigner = new VoidSigner(senderAddress, provider);
225
+ const voidSigner = new VoidSigner(senderAddress.toEvmAddress(), provider);
208
226
 
209
227
  // Estimate the Gas units required to submit this transaction.
210
228
  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
+ relayerAddress = getDefaultRelayer(chainId),
29
29
  coingeckoProApiKey?: string,
30
30
  logger: Logger = DEFAULT_LOGGER,
31
31
  coingeckoBaseCurrency = "eth"
@@ -34,12 +34,13 @@ export class QueryBase__factory {
34
34
 
35
35
  const customGasTokenSymbol = CUSTOM_GAS_TOKENS[chainId];
36
36
  if (customGasTokenSymbol) {
37
+ assert(relayerAddress.isEVM());
37
38
  return new CustomGasTokenQueries({
38
39
  queryBaseArgs: [
39
40
  provider as providers.Provider,
40
41
  symbolMapping,
41
42
  spokePoolAddress,
42
- simulatedRelayerAddress,
43
+ relayerAddress,
43
44
  logger,
44
45
  coingeckoProApiKey,
45
46
  fixedGasPrice[chainId],
@@ -49,11 +50,12 @@ export class QueryBase__factory {
49
50
  });
50
51
  }
51
52
  if (chainIsSvm(chainId)) {
53
+ assert(relayerAddress.isSVM());
52
54
  return new SvmQuery(
53
55
  provider as svmProvider,
54
56
  symbolMapping,
55
57
  SvmAddress.from(spokePoolAddress),
56
- SvmAddress.from(simulatedRelayerAddress),
58
+ relayerAddress,
57
59
  logger,
58
60
  coingeckoProApiKey,
59
61
  fixedGasPrice[chainId],
@@ -66,11 +68,12 @@ export class QueryBase__factory {
66
68
  ? asL2Provider(provider as providers.Provider)
67
69
  : (provider as providers.Provider);
68
70
 
71
+ assert(relayerAddress.isEVM());
69
72
  return new QueryBase(
70
73
  provider,
71
74
  symbolMapping,
72
75
  spokePoolAddress,
73
- simulatedRelayerAddress,
76
+ relayerAddress,
74
77
  logger,
75
78
  coingeckoProApiKey,
76
79
  fixedGasPrice[chainId],
@@ -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,17 +18,17 @@ 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 {
23
+ Address,
22
24
  BigNumber,
23
25
  BigNumberish,
24
26
  SvmAddress,
25
27
  TransactionCostEstimate,
26
28
  getRelayDataHash,
27
- 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 = getDefaultRelayer(relayData.destinationChainId),
79
80
  options: Partial<{
80
81
  gasPrice: BigNumberish;
81
82
  gasUnits: BigNumberish;
@@ -83,10 +84,19 @@ 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 { destinationChainId, 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
+ assert(relayer.isSVM());
92
+
93
+ const [repaymentChainId, repaymentAddress] = [destinationChainId, relayer]; // These are not important for gas cost simulation.
94
+ const fillRelayTx = await this.getFillRelayTx(
95
+ { ...relayData, recipient, outputToken, exclusiveRelayer },
96
+ relayer,
97
+ repaymentChainId,
98
+ repaymentAddress
99
+ );
90
100
 
91
101
  const [computeUnitsConsumed, gasPriceEstimate] = await Promise.all([
92
102
  toBN(await this.computeUnitEstimator(fillRelayTx)),
@@ -117,77 +127,82 @@ export class SvmQuery implements QueryInterface {
117
127
  * @returns Estimated gas cost in compute units
118
128
  */
119
129
  async getNativeGasCost(
120
- deposit: Omit<Deposit, "messageHash">,
121
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
130
+ deposit: RelayData & { destinationChainId: number },
131
+ relayer = getDefaultRelayer(deposit.destinationChainId)
122
132
  ): Promise<BigNumber> {
123
- const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
133
+ const { destinationChainId, recipient, outputToken, exclusiveRelayer } = deposit;
134
+ assert(recipient.isSVM(), `getNativeGasCost: recipient not an SVM address (${recipient})`);
135
+ assert(outputToken.isSVM(), `getNativeGasCost: outputToken not an SVM address (${outputToken})`);
136
+ assert(exclusiveRelayer.isSVM(), `getNativeGasCost: exclusiveRelayer not an SVM address (${exclusiveRelayer})`);
137
+ assert(relayer.isSVM());
138
+
139
+ const [repaymentChainId, repaymentAddress] = [destinationChainId, relayer]; // These are not important for gas cost simulation.
140
+ const fillRelayTx = await this.getFillRelayTx(
141
+ { ...deposit, recipient, outputToken, exclusiveRelayer },
142
+ relayer,
143
+ repaymentChainId,
144
+ repaymentAddress
145
+ );
124
146
  return toBN(await this.computeUnitEstimator(fillRelayTx));
125
147
  }
126
148
 
127
149
  /**
128
150
  * @notice Return the fillRelay transaction for a given deposit
129
- * @param deposit
151
+ * @param relayData RelayData instance, supplemented with destinationChainId
130
152
  * @param relayer SVM address of the relayer
131
153
  * @returns FillRelay transaction
132
154
  */
133
- async getFillRelayTx(
134
- deposit: Omit<Deposit, "messageHash">,
135
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
136
- repaymentChainId = deposit.destinationChainId,
137
- repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
155
+ protected async getFillRelayTx(
156
+ relayData: Omit<RelayData, "recipent" | "outputToken"> & {
157
+ destinationChainId: number;
158
+ recipient: SvmAddress;
159
+ outputToken: SvmAddress;
160
+ },
161
+ relayer: SvmAddress,
162
+ repaymentChainId: number,
163
+ repaymentAddress: Address
138
164
  ) {
139
- const toSvmAddress = (address: string, chainId: number) =>
140
- toAddress(toAddressType(address, chainId).forceSvmAddress());
165
+ const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, destinationChainId } = relayData;
141
166
 
142
- const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, originChainId, destinationChainId } =
143
- deposit;
167
+ // tsc appeasement...should be unnecessary, but isn't. @todo Identify why.
168
+ assert(recipient.isSVM(), `getFillRelayTx: recipient not an SVM address (${recipient})`);
169
+ assert(
170
+ repaymentAddress.isValidOn(repaymentChainId),
171
+ `getFillRelayTx: repayment address ${repaymentAddress} not valid on chain ${repaymentChainId})`
172
+ );
144
173
 
145
174
  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);
175
+ const _relayDataHash = getRelayDataHash(relayData, destinationChainId);
151
176
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
152
177
 
153
178
  const [state, delegate] = await Promise.all([
154
179
  getStatePda(program),
155
- getFillRelayDelegatePda(
156
- relayDataHash,
157
- BigInt(repaymentChainId),
158
- toSvmAddress(repaymentAddress, repaymentChainId),
159
- program
160
- ),
180
+ getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
161
181
  ]);
162
182
 
163
- const _mint = toAddressType(outputToken, destinationChainId).forceSvmAddress();
164
- const mint = toAddress(_mint);
183
+ const mint = toAddress(outputToken);
165
184
  const mintInfo = await fetchMint(this.provider, mint);
166
185
 
167
186
  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(),
187
+ getAssociatedTokenAddress(recipient, outputToken, mintInfo.programAddress),
188
+ getAssociatedTokenAddress(SvmAddress.from(relayer.toBase58()), outputToken, mintInfo.programAddress),
189
+ getFillStatusPda(program, relayData, destinationChainId),
190
+ getEventAuthority(program),
176
191
  ]);
177
192
 
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),
193
+ const svmRelayData: SvmSpokeClient.FillRelayInput["relayData"] = {
194
+ depositor: toAddress(depositor),
195
+ recipient: toAddress(recipient),
196
+ exclusiveRelayer: toAddress(exclusiveRelayer),
197
+ inputToken: toAddress(inputToken),
183
198
  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")),
199
+ inputAmount: relayData.inputAmount.toBigInt(),
200
+ outputAmount: relayData.outputAmount.toBigInt(),
201
+ originChainId: relayData.originChainId,
202
+ depositId: new Uint8Array(intToU8Array32(relayData.depositId.toNumber())),
203
+ fillDeadline: relayData.fillDeadline,
204
+ exclusivityDeadline: relayData.exclusivityDeadline,
205
+ message: new Uint8Array(Buffer.from(relayData.message, "hex")),
191
206
  };
192
207
 
193
208
  const simulatedSigner = SolanaVoidSigner(relayer.toBase58());
@@ -205,9 +220,9 @@ export class SvmQuery implements QueryInterface {
205
220
  eventAuthority,
206
221
  program,
207
222
  relayHash: relayDataHash,
208
- relayData,
223
+ relayData: svmRelayData,
209
224
  repaymentChainId: BigInt(repaymentChainId),
210
- repaymentAddress: toSvmAddress(repaymentAddress, repaymentChainId),
225
+ repaymentAddress: toAddress(repaymentAddress),
211
226
  };
212
227
  // Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
213
228
  // if it doesn't exist.