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