@across-protocol/sdk 4.2.9-alpha.0 → 4.2.9-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +2 -2
  2. package/dist/cjs/arch/evm/SpokeUtils.js +3 -18
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.d.ts +16 -1
  5. package/dist/cjs/arch/svm/SpokeUtils.js +135 -34
  6. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  7. package/dist/cjs/arch/svm/utils.d.ts +5 -1
  8. package/dist/cjs/arch/svm/utils.js +26 -16
  9. package/dist/cjs/arch/svm/utils.js.map +1 -1
  10. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  12. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  13. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +2 -2
  14. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +53 -57
  15. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  16. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  17. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
  20. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  21. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  22. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  23. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  24. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -11
  25. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  26. package/dist/cjs/clients/HubPoolClient.d.ts +20 -20
  27. package/dist/cjs/clients/HubPoolClient.js +57 -78
  28. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  29. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  30. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  31. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
  32. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +29 -35
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  34. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  35. package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
  36. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  37. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +13 -9
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +56 -40
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  40. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  41. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  42. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  43. package/dist/cjs/interfaces/HubPool.d.ts +13 -18
  44. package/dist/cjs/interfaces/SpokePool.d.ts +16 -14
  45. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  46. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  47. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
  48. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  49. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +7 -8
  50. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +73 -64
  51. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  52. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  53. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
  54. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  55. package/dist/cjs/utils/AddressUtils.d.ts +4 -7
  56. package/dist/cjs/utils/AddressUtils.js +8 -21
  57. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  58. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  59. package/dist/cjs/utils/SpokeUtils.js +22 -4
  60. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  61. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  62. package/dist/cjs/utils/TokenUtils.js +3 -3
  63. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  64. package/dist/esm/arch/evm/SpokeUtils.d.ts +2 -2
  65. package/dist/esm/arch/evm/SpokeUtils.js +4 -19
  66. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  67. package/dist/esm/arch/svm/SpokeUtils.d.ts +46 -6
  68. package/dist/esm/arch/svm/SpokeUtils.js +164 -43
  69. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  70. package/dist/esm/arch/svm/utils.d.ts +11 -1
  71. package/dist/esm/arch/svm/utils.js +31 -16
  72. package/dist/esm/arch/svm/utils.js.map +1 -1
  73. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  74. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  75. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  76. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +2 -2
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +54 -58
  78. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  79. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  80. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  81. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
  83. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  84. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  85. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  86. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  87. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +9 -12
  88. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  89. package/dist/esm/clients/HubPoolClient.d.ts +21 -22
  90. package/dist/esm/clients/HubPoolClient.js +61 -91
  91. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  92. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
  93. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  94. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
  95. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +30 -37
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  97. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  98. package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
  99. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  100. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +13 -9
  101. package/dist/esm/clients/mocks/MockSpokePoolClient.js +60 -44
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  103. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  104. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  105. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  106. package/dist/esm/interfaces/HubPool.d.ts +13 -18
  107. package/dist/esm/interfaces/SpokePool.d.ts +16 -14
  108. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  109. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  110. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
  111. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  112. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +8 -9
  113. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +77 -66
  114. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  115. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  116. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
  117. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  118. package/dist/esm/utils/AddressUtils.d.ts +4 -7
  119. package/dist/esm/utils/AddressUtils.js +10 -25
  120. package/dist/esm/utils/AddressUtils.js.map +1 -1
  121. package/dist/esm/utils/SpokeUtils.d.ts +8 -3
  122. package/dist/esm/utils/SpokeUtils.js +26 -4
  123. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  124. package/dist/esm/utils/TokenUtils.d.ts +16 -4
  125. package/dist/esm/utils/TokenUtils.js +3 -3
  126. package/dist/esm/utils/TokenUtils.js.map +1 -1
  127. package/dist/types/arch/evm/SpokeUtils.d.ts +2 -2
  128. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  129. package/dist/types/arch/svm/SpokeUtils.d.ts +46 -6
  130. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  131. package/dist/types/arch/svm/utils.d.ts +11 -1
  132. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  133. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  134. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  135. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +2 -2
  136. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  137. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  138. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  139. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  140. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  141. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  142. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  143. package/dist/types/clients/HubPoolClient.d.ts +21 -22
  144. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  145. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  146. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -5
  147. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  148. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  149. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  150. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +13 -9
  151. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  152. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  153. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  154. package/dist/types/interfaces/HubPool.d.ts +13 -18
  155. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  156. package/dist/types/interfaces/SpokePool.d.ts +16 -14
  157. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  158. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  159. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  160. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +8 -9
  161. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
  163. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  164. package/dist/types/utils/AddressUtils.d.ts +4 -7
  165. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  166. package/dist/types/utils/SpokeUtils.d.ts +8 -3
  167. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  168. package/dist/types/utils/TokenUtils.d.ts +16 -4
  169. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  170. package/package.json +2 -1
  171. package/src/arch/evm/SpokeUtils.ts +8 -22
  172. package/src/arch/svm/SpokeUtils.ts +156 -49
  173. package/src/arch/svm/utils.ts +22 -3
  174. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
  175. package/src/clients/BundleDataClient/BundleDataClient.ts +47 -49
  176. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
  177. package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
  178. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  179. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
  180. package/src/clients/HubPoolClient.ts +79 -113
  181. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -7
  182. package/src/clients/SpokePoolClient/SpokePoolClient.ts +37 -104
  183. package/src/clients/mocks/MockHubPoolClient.ts +19 -24
  184. package/src/clients/mocks/MockSpokePoolClient.ts +74 -53
  185. package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
  186. package/src/interfaces/HubPool.ts +13 -22
  187. package/src/interfaces/SpokePool.ts +17 -14
  188. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
  189. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +92 -91
  190. package/src/relayFeeCalculator/relayFeeCalculator.ts +14 -16
  191. package/src/utils/AddressUtils.ts +14 -32
  192. package/src/utils/SpokeUtils.ts +33 -11
  193. package/src/utils/TokenUtils.ts +7 -7
@@ -1,5 +1,4 @@
1
1
  import { providers, utils } from "ethers";
2
- import assert from "assert";
3
2
  import bs58 from "bs58";
4
3
  import { Address as V2Address } from "@solana/kit";
5
4
  import { BigNumber, chainIsEvm } from "./";
@@ -88,9 +87,7 @@ export function toAddressType(address: string): Address | EvmAddress | SvmAddres
88
87
  } catch (e) {
89
88
  // If we hit this block, then the validation for one of the child address classes failed. We still may want to keep this address in our state, so
90
89
  // return an unchecked address type.
91
- assert(utils.isHexString(address));
92
- assert(utils.hexDataLength(address) === 32);
93
- return Address.__unsafeConstruct(utils.arrayify(address));
90
+ return new Address(utils.arrayify(address));
94
91
  }
95
92
  }
96
93
 
@@ -116,24 +113,12 @@ export class Address {
116
113
  this.rawAddress = utils.zeroPad(_rawAddress, 32);
117
114
  }
118
115
 
119
- static __unsafeConstruct(_rawAddress: Uint8Array): Address {
120
- return new this(_rawAddress);
121
- }
122
-
123
116
  // Converts the address into a bytes32 string. Note that the output bytes will be lowercase so that it matches ethers event data. This function will never
124
117
  // throw since address length validation was done at construction time.
125
118
  toBytes32(): string {
126
119
  return (this.bytes32Address ??= utils.hexZeroPad(utils.hexlify(this.rawAddress), 32).toLowerCase());
127
120
  }
128
121
 
129
- // Returns last 20 bytes of Address as a hex string. Truncates if necessary. This function is useful for comparing some longer addresses(e.g. Solana) to Solidity events
130
- // that contain truncated `address` type as one of the fields
131
- truncateToBytes20(): string {
132
- // Take the last 20 bytes
133
- const bytes20 = this.rawAddress.slice(-20);
134
- return toAddress(utils.hexlify(bytes20));
135
- }
136
-
137
122
  // Converts the address (can be bytes32 or bytes20) to its base58 counterpart. This conversion will always succeed, even if the input address is not valid on Solana,
138
123
  // as this address may be needed to represent an EVM address on Solana.
139
124
  toBase58(): string {
@@ -175,7 +160,7 @@ export class Address {
175
160
  // Checks if this address can be coerced into a bytes20 evm address. Returns true if it is possible and false otherwise.
176
161
  isValidEvmAddress(): boolean {
177
162
  try {
178
- this.toEvmAddress();
163
+ this.toAddress();
179
164
  return true;
180
165
  } catch {
181
166
  return false;
@@ -206,11 +191,6 @@ export class Address {
206
191
  return utils.stripZeros(this.rawAddress).length === 0;
207
192
  }
208
193
 
209
- // Small utility to convert an Address to a Solana Kit branded type.
210
- toV2Address(): V2Address<string> {
211
- return this.toBase58() as V2Address<string>;
212
- }
213
-
214
194
  // Forces `rawAddress` to become an SvmAddress type. This will only throw if `rawAddress.length > 32`.
215
195
  forceSvmAddress(): SvmAddress {
216
196
  return SvmAddress.from(this.toBase58());
@@ -240,20 +220,12 @@ export class Address {
240
220
  return 0;
241
221
  }
242
222
  }
243
-
244
- static isEvmAddress(address: Address): boolean {
245
- return address instanceof EvmAddress;
246
- }
247
-
248
- static isSvmAddress(address: Address): boolean {
249
- return address instanceof SvmAddress;
250
- }
251
223
  }
252
224
 
253
225
  // Subclass of address which strictly deals with 20-byte addresses. These addresses are guaranteed to be valid EVM addresses, so `toAddress` will always succeed.
254
226
  export class EvmAddress extends Address {
255
227
  // On construction, validate that the address can indeed be coerced into an EVM address. Throw immediately if it cannot.
256
- private constructor(rawAddress: Uint8Array) {
228
+ constructor(rawAddress: Uint8Array) {
257
229
  super(rawAddress);
258
230
  const hexString = utils.hexlify(rawAddress);
259
231
  if (!this.isValidEvmAddress()) {
@@ -287,7 +259,7 @@ export class EvmAddress extends Address {
287
259
  // Subclass of address which strictly deals SVM addresses. These addresses are guaranteed to be valid SVM addresses, so `toBase58` will always produce a valid Solana address.
288
260
  export class SvmAddress extends Address {
289
261
  // On construction, validate that the address is a point on Curve25519. Throw immediately if it is not.
290
- private constructor(rawAddress: Uint8Array) {
262
+ constructor(rawAddress: Uint8Array) {
291
263
  super(rawAddress);
292
264
  }
293
265
 
@@ -297,6 +269,16 @@ export class SvmAddress extends Address {
297
269
  return this.toBase58();
298
270
  }
299
271
 
272
+ // Small utility to convert an SvmAddress to a Solana Kit branded type.
273
+ toV2Address(): V2Address<string> {
274
+ return this.toBase58() as V2Address<string>;
275
+ }
276
+
277
+ // Forces an SvmAddress to an EVM address string by truncating the leading 12 bytes.
278
+ override toEvmAddress(): string {
279
+ return toAddress(`0x${this.toBytes32().slice(-40)}`);
280
+ }
281
+
300
282
  // Constructs a new SvmAddress type.
301
283
  static from(address: string, encoding: "base58" | "base16" = "base58"): SvmAddress {
302
284
  if (encoding === "base58") {
@@ -1,12 +1,34 @@
1
1
  import { encodeAbiParameters, Hex, keccak256 } from "viem";
2
- import { MAX_SAFE_DEPOSIT_ID, ZERO_BYTES } from "../constants";
3
- import { RelayData } from "../interfaces";
2
+ import { MAX_SAFE_DEPOSIT_ID, ZERO_ADDRESS, ZERO_BYTES } from "../constants";
3
+ import { Deposit, RelayData } from "../interfaces";
4
+ import { toBytes32 } from "./AddressUtils";
4
5
  import { BigNumber } from "./BigNumberUtils";
5
- import { Address } from "./AddressUtils";
6
6
  import { isMessageEmpty } from "./DepositUtils";
7
7
  import { chainIsSvm } from "./NetworkUtils";
8
8
  import { svm } from "../arch";
9
9
 
10
+ /**
11
+ * Produce the RelayData for a Deposit.
12
+ * @param deposit Deposit instance.
13
+ * @returns The corresponding RelayData object.
14
+ */
15
+ export function getDepositRelayData(deposit: Omit<Deposit, "messageHash">): RelayData {
16
+ return {
17
+ depositor: toBytes32(deposit.depositor),
18
+ recipient: toBytes32(deposit.recipient),
19
+ exclusiveRelayer: toBytes32(deposit.exclusiveRelayer),
20
+ inputToken: toBytes32(deposit.inputToken),
21
+ outputToken: toBytes32(deposit.outputToken),
22
+ inputAmount: deposit.inputAmount,
23
+ outputAmount: deposit.outputAmount,
24
+ originChainId: deposit.originChainId,
25
+ depositId: deposit.depositId,
26
+ fillDeadline: deposit.fillDeadline,
27
+ exclusivityDeadline: deposit.exclusivityDeadline,
28
+ message: deposit.message,
29
+ };
30
+ }
31
+
10
32
  /**
11
33
  * Compute the RelayData hash for a fill. This can be used to determine the fill status.
12
34
  * @param relayData RelayData information that is used to complete a fill.
@@ -37,14 +59,14 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
37
59
 
38
60
  const _relayData = {
39
61
  ...relayData,
40
- depositor: relayData.depositor.toBytes32(),
41
- recipient: relayData.recipient.toBytes32(),
42
- inputToken: relayData.inputToken.toBytes32(),
43
- outputToken: relayData.outputToken.toBytes32(),
44
- exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(),
62
+ depositor: toBytes32(relayData.depositor),
63
+ recipient: toBytes32(relayData.recipient),
64
+ inputToken: toBytes32(relayData.inputToken),
65
+ outputToken: toBytes32(relayData.outputToken),
66
+ exclusiveRelayer: toBytes32(relayData.exclusiveRelayer),
45
67
  };
46
68
  if (chainIsSvm(destinationChainId)) {
47
- return svm.getRelayDataHash(relayData, destinationChainId);
69
+ return svm.getRelayDataHash(_relayData, destinationChainId);
48
70
  }
49
71
  return keccak256(encodeAbiParameters(abi, [_relayData, destinationChainId]));
50
72
  }
@@ -64,8 +86,8 @@ export function isUnsafeDepositId(depositId: BigNumber): boolean {
64
86
  }
65
87
 
66
88
  // Determines if the input address (either a bytes32 or bytes20) is the zero address.
67
- export function isZeroAddress(address: Address): boolean {
68
- return address.toBytes32() === ZERO_BYTES;
89
+ export function isZeroAddress(address: string): boolean {
90
+ return address === ZERO_ADDRESS || address === ZERO_BYTES;
69
91
  }
70
92
 
71
93
  export function getMessageHash(message: string): string {
@@ -1,7 +1,7 @@
1
1
  import { BlockTag } from "@ethersproject/abstract-provider";
2
2
  import { Contract, providers, Signer } from "ethers";
3
3
  import * as constants from "../constants";
4
- import { TokenInfo } from "../interfaces";
4
+ import { L1Token } from "../interfaces";
5
5
  import { ERC20__factory } from "../typechain";
6
6
  import { BigNumber } from "./BigNumberUtils";
7
7
  import { getNetworkName, chainIsL1, chainIsProd, chainIsSvm } from "./NetworkUtils";
@@ -11,10 +11,10 @@ const { TOKEN_SYMBOLS_MAP, CHAIN_IDs, TOKEN_EQUIVALENCE_REMAPPING } = constants;
11
11
 
12
12
  type SignerOrProvider = providers.Provider | Signer;
13
13
 
14
- export async function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<TokenInfo> {
14
+ export async function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<L1Token> {
15
15
  const token = new Contract(address, ERC20__factory.abi, signerOrProvider);
16
16
  const [symbol, decimals] = await Promise.all([token.symbol(), token.decimals()]);
17
- return { address: toAddressType(address), symbol, decimals };
17
+ return { address, symbol, decimals };
18
18
  }
19
19
 
20
20
  export const getL2TokenAddresses = (
@@ -33,7 +33,7 @@ export const getL2TokenAddresses = (
33
33
  * @param chainId Chain ID to query on.
34
34
  * @returns Symbol, decimals and contract address on the requested chain.
35
35
  */
36
- export function resolveSymbolOnChain(chainId: number, symbol: string): TokenInfo {
36
+ export function resolveSymbolOnChain(chainId: number, symbol: string): L1Token {
37
37
  // @dev Suppress tsc complaints by casting symbol to the expected type.
38
38
  const token = TOKEN_SYMBOLS_MAP[symbol as keyof typeof TOKEN_SYMBOLS_MAP];
39
39
  if (!isDefined(token) || !isDefined(token.addresses[chainId])) {
@@ -44,7 +44,7 @@ export function resolveSymbolOnChain(chainId: number, symbol: string): TokenInfo
44
44
  const { decimals, addresses } = token;
45
45
  const address = addresses[chainId];
46
46
 
47
- return { symbol, decimals, address: toAddressType(address) };
47
+ return { symbol, decimals, address };
48
48
  }
49
49
 
50
50
  /**
@@ -111,7 +111,7 @@ export function isStablecoin(tokenSymbol: string): boolean {
111
111
  * @param tokenMapping
112
112
  * @returns
113
113
  */
114
- export function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping = TOKEN_SYMBOLS_MAP): TokenInfo {
114
+ export function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping = TOKEN_SYMBOLS_MAP): L1Token {
115
115
  const parsedAddress = chainIsSvm(chainId)
116
116
  ? toAddressType(l2TokenAddress).toBase58()
117
117
  : toAddressType(l2TokenAddress).toEvmAddress();
@@ -128,7 +128,7 @@ export function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMappi
128
128
  tokenObject = tokenMapping[l1TokenSymbol as keyof typeof tokenMapping];
129
129
  }
130
130
  return {
131
- address: toAddressType(l2TokenAddress),
131
+ address: l2TokenAddress,
132
132
  symbol: tokenObject.symbol,
133
133
  decimals: tokenObject.decimals,
134
134
  };