@across-protocol/sdk 4.2.9-alpha.2 → 4.2.10

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 (200) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +2 -5
  2. package/dist/cjs/arch/evm/SpokeUtils.js +3 -19
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.js +7 -7
  5. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  6. package/dist/cjs/arch/svm/utils.d.ts +1 -1
  7. package/dist/cjs/arch/svm/utils.js +13 -15
  8. package/dist/cjs/arch/svm/utils.js.map +1 -1
  9. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  10. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  11. package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  12. package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  13. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +56 -60
  14. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  15. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
  16. package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  17. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  21. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  22. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
  23. package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  24. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  25. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -11
  26. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  27. package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
  28. package/dist/cjs/clients/HubPoolClient.js +59 -83
  29. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  30. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
  31. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  32. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +37 -51
  34. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  35. package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
  36. package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -39
  40. package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
  41. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  42. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
  43. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  44. package/dist/cjs/interfaces/HubPool.d.ts +14 -19
  45. package/dist/cjs/interfaces/SpokePool.d.ts +13 -13
  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 +4 -4
  50. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +15 -14
  51. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  52. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  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 +3 -6
  56. package/dist/cjs/utils/AddressUtils.js +14 -42
  57. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  58. package/dist/cjs/utils/ArrayUtils.js +1 -0
  59. package/dist/cjs/utils/ArrayUtils.js.map +1 -1
  60. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  61. package/dist/cjs/utils/SpokeUtils.js +22 -4
  62. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  63. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  64. package/dist/cjs/utils/TokenUtils.js +3 -3
  65. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  66. package/dist/esm/arch/evm/SpokeUtils.d.ts +2 -5
  67. package/dist/esm/arch/evm/SpokeUtils.js +4 -20
  68. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  69. package/dist/esm/arch/svm/SpokeUtils.js +8 -8
  70. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  71. package/dist/esm/arch/svm/utils.d.ts +1 -1
  72. package/dist/esm/arch/svm/utils.js +13 -15
  73. package/dist/esm/arch/svm/utils.js.map +1 -1
  74. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  75. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
  76. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  78. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +57 -61
  79. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  80. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  81. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  83. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -4
  84. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  85. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
  86. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  88. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  90. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +9 -12
  91. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  92. package/dist/esm/clients/HubPoolClient.d.ts +22 -23
  93. package/dist/esm/clients/HubPoolClient.js +63 -96
  94. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  95. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  96. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  97. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  98. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +38 -53
  99. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  100. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  101. package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
  102. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  103. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  104. package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -41
  105. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  106. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  107. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  108. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  109. package/dist/esm/interfaces/HubPool.d.ts +14 -19
  110. package/dist/esm/interfaces/SpokePool.d.ts +13 -13
  111. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  112. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +8 -8
  113. package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  114. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  115. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +16 -15
  116. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  117. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  118. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +8 -8
  119. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  120. package/dist/esm/utils/AddressUtils.d.ts +3 -7
  121. package/dist/esm/utils/AddressUtils.js +19 -52
  122. package/dist/esm/utils/AddressUtils.js.map +1 -1
  123. package/dist/esm/utils/ArrayUtils.js +1 -0
  124. package/dist/esm/utils/ArrayUtils.js.map +1 -1
  125. package/dist/esm/utils/SpokeUtils.d.ts +8 -3
  126. package/dist/esm/utils/SpokeUtils.js +26 -4
  127. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  128. package/dist/esm/utils/TokenUtils.d.ts +16 -18
  129. package/dist/esm/utils/TokenUtils.js +3 -3
  130. package/dist/esm/utils/TokenUtils.js.map +1 -1
  131. package/dist/types/arch/evm/SpokeUtils.d.ts +2 -5
  132. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  133. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  134. package/dist/types/arch/svm/utils.d.ts +1 -1
  135. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  136. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  137. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  138. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  139. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  140. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  141. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
  142. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  143. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  144. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  145. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  146. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  147. package/dist/types/clients/HubPoolClient.d.ts +22 -23
  148. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  149. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  150. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  151. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  152. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  153. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  154. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +3 -5
  155. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  156. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  157. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  158. package/dist/types/interfaces/HubPool.d.ts +14 -19
  159. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  160. package/dist/types/interfaces/SpokePool.d.ts +13 -13
  161. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  163. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  164. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  165. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  166. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  167. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  168. package/dist/types/utils/AddressUtils.d.ts +3 -7
  169. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  170. package/dist/types/utils/ArrayUtils.d.ts.map +1 -1
  171. package/dist/types/utils/SpokeUtils.d.ts +8 -3
  172. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  173. package/dist/types/utils/TokenUtils.d.ts +16 -18
  174. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  175. package/package.json +3 -2
  176. package/src/arch/evm/SpokeUtils.ts +9 -31
  177. package/src/arch/svm/SpokeUtils.ts +8 -8
  178. package/src/arch/svm/utils.ts +3 -3
  179. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
  180. package/src/clients/BundleDataClient/BundleDataClient.ts +52 -54
  181. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
  182. package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -6
  183. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
  184. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  185. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +9 -13
  186. package/src/clients/HubPoolClient.ts +82 -122
  187. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
  188. package/src/clients/SpokePoolClient/SpokePoolClient.ts +27 -105
  189. package/src/clients/mocks/MockHubPoolClient.ts +19 -24
  190. package/src/clients/mocks/MockSpokePoolClient.ts +26 -37
  191. package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
  192. package/src/interfaces/HubPool.ts +14 -23
  193. package/src/interfaces/SpokePool.ts +13 -13
  194. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +8 -10
  195. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +21 -16
  196. package/src/relayFeeCalculator/relayFeeCalculator.ts +12 -20
  197. package/src/utils/AddressUtils.ts +21 -56
  198. package/src/utils/ArrayUtils.ts +1 -0
  199. package/src/utils/SpokeUtils.ts +33 -11
  200. package/src/utils/TokenUtils.ts +7 -7
@@ -3,7 +3,6 @@ import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
3
3
  import { CHAIN_IDs } from "../../constants";
4
4
  import { Deposit, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
5
5
  import {
6
- EvmAddress,
7
6
  bnUint32Max,
8
7
  BigNumber,
9
8
  toBN,
@@ -14,10 +13,11 @@ import {
14
13
  isDefined,
15
14
  isUnsafeDepositId,
16
15
  isZeroAddress,
16
+ getDepositRelayData,
17
17
  getNetworkName,
18
18
  paginatedEventQuery,
19
19
  spreadEventWithBlockNumber,
20
- Address,
20
+ toBytes32,
21
21
  } from "../../utils";
22
22
 
23
23
  type BlockTag = providers.BlockTag;
@@ -30,31 +30,11 @@ type BlockTag = providers.BlockTag;
30
30
  */
31
31
  export function populateV3Relay(
32
32
  spokePool: Contract,
33
- deposit: Omit<Deposit, "messageHash" | "fromLiteChain" | "toLiteChain"> & {
34
- recipient: EvmAddress;
35
- exclusiveRelayer: EvmAddress;
36
- },
37
- relayer: Address,
33
+ deposit: Omit<Deposit, "messageHash">,
34
+ relayer: string,
38
35
  repaymentChainId = deposit.destinationChainId
39
36
  ): Promise<PopulatedTransaction> {
40
- assert(
41
- relayer.isValidOn(repaymentChainId),
42
- `Invalid repayment address for chain ${repaymentChainId}: ${relayer.toAddress()}.`
43
- );
44
- const relayData = {
45
- depositor: deposit.depositor.toBytes32(),
46
- recipient: deposit.recipient.toBytes32(),
47
- inputToken: deposit.inputToken.toBytes32(),
48
- outputToken: deposit.outputToken.toBytes32(),
49
- inputAmount: deposit.inputAmount,
50
- outputAmount: deposit.outputAmount,
51
- originChainId: deposit.originChainId,
52
- depositId: deposit.depositId,
53
- fillDeadline: deposit.fillDeadline,
54
- exclusivityDeadline: deposit.exclusivityDeadline,
55
- message: deposit.message,
56
- exclusiveRelayer: deposit.exclusiveRelayer.toBytes32(),
57
- };
37
+ const relayData = getDepositRelayData(deposit);
58
38
 
59
39
  if (isDefined(deposit.speedUpSignature)) {
60
40
  assert(isDefined(deposit.updatedRecipient) && !isZeroAddress(deposit.updatedRecipient));
@@ -63,18 +43,16 @@ export function populateV3Relay(
63
43
  return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
64
44
  relayData,
65
45
  repaymentChainId,
66
- relayer.toBytes32(),
46
+ toBytes32(relayer),
67
47
  deposit.updatedOutputAmount,
68
- deposit.updatedRecipient.toBytes32(),
48
+ toBytes32(deposit.updatedRecipient),
69
49
  deposit.updatedMessage,
70
50
  deposit.speedUpSignature,
71
- { from: relayer.toAddress() }
51
+ { from: relayer }
72
52
  );
73
53
  }
74
54
 
75
- return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, relayer.toBytes32(), {
76
- from: relayer.toAddress(),
77
- });
55
+ return spokePool.populateTransaction.fillRelay(relayData, repaymentChainId, toBytes32(relayer), { from: relayer });
78
56
  }
79
57
 
80
58
  /**
@@ -28,7 +28,7 @@ import { Logger } from "winston";
28
28
 
29
29
  import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
30
30
  import { Deposit, DepositWithBlock, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
31
- import { BigNumber, SvmAddress, chainIsSvm, chunk, isUnsafeDepositId, keccak256 } from "../../utils";
31
+ import { BigNumber, SvmAddress, chainIsSvm, chunk, isUnsafeDepositId, keccak256, toAddressType } from "../../utils";
32
32
  import {
33
33
  SvmCpiEventsClient,
34
34
  createDefaultTransaction,
@@ -357,7 +357,7 @@ export async function fillRelayInstruction(
357
357
  deposit.exclusiveRelayer,
358
358
  deposit.inputToken,
359
359
  deposit.outputToken,
360
- ].map((addr) => addr.forceSvmAddress());
360
+ ].map((addr) => toAddressType(addr).forceSvmAddress());
361
361
 
362
362
  const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
363
363
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
@@ -368,7 +368,7 @@ export async function fillRelayInstruction(
368
368
  const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
369
369
  getStatePda(spokePool.toV2Address()),
370
370
  getFillStatusPda(spokePool.toV2Address(), deposit, deposit.destinationChainId),
371
- getEventAuthority(spokePool.toV2Address()),
371
+ getEventAuthority(),
372
372
  ]);
373
373
  const depositIdBuffer = new Uint8Array(32);
374
374
  const shortenedBuffer = new Uint8Array(Buffer.from(deposit.depositId.toHexString().slice(2), "hex"));
@@ -591,11 +591,11 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
591
591
  assert(relayData.message.startsWith("0x"), "Message must be a hex string");
592
592
 
593
593
  const contentToHash = Buffer.concat([
594
- Uint8Array.from(addressEncoder.encode(address(relayData.depositor.toBase58()))),
595
- Uint8Array.from(addressEncoder.encode(address(relayData.recipient.toBase58()))),
596
- Uint8Array.from(addressEncoder.encode(address(relayData.exclusiveRelayer.toBase58()))),
597
- Uint8Array.from(addressEncoder.encode(address(relayData.inputToken.toBase58()))),
598
- Uint8Array.from(addressEncoder.encode(address(relayData.outputToken.toBase58()))),
594
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.depositor, "base16").toV2Address())),
595
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.recipient, "base16").toV2Address())),
596
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.exclusiveRelayer, "base16").toV2Address())),
597
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.inputToken, "base16").toV2Address())),
598
+ Uint8Array.from(addressEncoder.encode(SvmAddress.from(relayData.outputToken, "base16").toV2Address())),
599
599
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.inputAmount.toString()))),
600
600
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
601
601
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.originChainId.toString()))),
@@ -268,13 +268,13 @@ export async function getInstructionParamsPda(programId: Address, signer: Addres
268
268
  * Returns the PDA for the Event Authority.
269
269
  * @returns The PDA for the Event Authority.
270
270
  */
271
- export async function getEventAuthority(programId: Address): Promise<Address> {
271
+ export const getEventAuthority = async () => {
272
272
  const [eventAuthority] = await getProgramDerivedAddress({
273
- programAddress: programId,
273
+ programAddress: address(SvmSpokeClient.SVM_SPOKE_PROGRAM_ADDRESS),
274
274
  seeds: ["__event_authority"],
275
275
  });
276
276
  return eventAuthority;
277
- }
277
+ };
278
278
 
279
279
  /**
280
280
  * Returns a random SVM address.
@@ -5,7 +5,6 @@ import winston from "winston";
5
5
  import { isError } from "../../typeguards";
6
6
  import {
7
7
  EventSearchConfig,
8
- EvmAddress,
9
8
  MakeOptional,
10
9
  isArrayOf,
11
10
  isDefined,
@@ -108,7 +107,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
108
107
  }
109
108
 
110
109
  getRateModelForBlockNumber(
111
- l1Token: EvmAddress,
110
+ l1Token: string,
112
111
  originChainId: number | string,
113
112
  destinationChainId: number | string,
114
113
  blockNumber: number | undefined = undefined
@@ -122,9 +121,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
122
121
 
123
122
  const defaultRateModelUpdate = sortEventsDescending(this.cumulativeRateModelUpdates).find(
124
123
  (config) =>
125
- config.blockNumber <= (blockNumber ?? 0) &&
126
- config.l1Token === l1Token.toEvmAddress() &&
127
- config.rateModel !== undefined
124
+ config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token && config.rateModel !== undefined
128
125
  );
129
126
  if (!defaultRateModelUpdate) {
130
127
  throw new Error(`Could not find TokenConfig update for ${l1Token} at block ${blockNumber}`);
@@ -133,12 +130,12 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
133
130
  }
134
131
 
135
132
  getRouteRateModelForBlockNumber(
136
- l1Token: EvmAddress,
133
+ l1Token: string,
137
134
  route: string,
138
135
  blockNumber: number | undefined = undefined
139
136
  ): RateModel | undefined {
140
137
  const config = (sortEventsDescending(this.cumulativeRouteRateModelUpdates) as RouteRateModelUpdate[]).find(
141
- (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token.toEvmAddress()
138
+ (config) => config.blockNumber <= (blockNumber ?? 0) && config.l1Token === l1Token
142
139
  );
143
140
  if (config?.routeRateModel[route] === undefined) {
144
141
  return undefined;
@@ -40,9 +40,9 @@ import {
40
40
  isZeroValueDeposit,
41
41
  isZeroValueFillOrSlowFillRequest,
42
42
  chainIsEvm,
43
+ isValidEvmAddress,
43
44
  duplicateEvent,
44
45
  invalidOutputToken,
45
- Address,
46
46
  } from "../../utils";
47
47
  import winston from "winston";
48
48
  import {
@@ -67,20 +67,22 @@ type DataCache = Record<string, Promise<LoadDataReturnValue>>;
67
67
  // V3 dictionary helper functions
68
68
  function updateExpiredDepositsV3(dict: ExpiredDepositsToRefundV3, deposit: V3DepositWithBlock): void {
69
69
  // A deposit refund for a deposit is invalid if the depositor has a bytes32 address input for an EVM chain. It is valid otherwise.
70
- if (chainIsEvm(deposit.originChainId) && !deposit.depositor.isValidEvmAddress()) {
70
+ if (chainIsEvm(deposit.originChainId) && !isValidEvmAddress(deposit.depositor)) {
71
71
  return;
72
72
  }
73
73
  const { originChainId, inputToken } = deposit;
74
- dict[originChainId] ??= {};
75
- dict[originChainId][inputToken.toBytes32()] ??= [];
76
- dict[originChainId][inputToken.toBytes32()].push(deposit);
74
+ if (!dict?.[originChainId]?.[inputToken]) {
75
+ assign(dict, [originChainId, inputToken], []);
76
+ }
77
+ dict[originChainId][inputToken].push(deposit);
77
78
  }
78
79
 
79
80
  function updateBundleDepositsV3(dict: BundleDepositsV3, deposit: V3DepositWithBlock): void {
80
81
  const { originChainId, inputToken } = deposit;
81
- dict[originChainId] ??= {};
82
- dict[originChainId][inputToken.toBytes32()] ??= [];
83
- dict[originChainId][inputToken.toBytes32()].push(deposit);
82
+ if (!dict?.[originChainId]?.[inputToken]) {
83
+ assign(dict, [originChainId, inputToken], []);
84
+ }
85
+ dict[originChainId][inputToken].push(deposit);
84
86
  }
85
87
 
86
88
  function updateBundleFillsV3(
@@ -88,28 +90,29 @@ function updateBundleFillsV3(
88
90
  fill: V3FillWithBlock,
89
91
  lpFeePct: BigNumber,
90
92
  repaymentChainId: number,
91
- repaymentToken: Address,
92
- repaymentAddress: Address
93
+ repaymentToken: string,
94
+ repaymentAddress: string
93
95
  ): void {
94
96
  // We shouldn't pass any unrepayable fills into this function, so we perform an extra safety check.
95
- if (chainIsEvm(repaymentChainId) && !fill.relayer.isValidEvmAddress()) {
97
+ if (chainIsEvm(repaymentChainId) && !isValidEvmAddress(fill.relayer)) {
96
98
  return;
97
99
  }
98
- dict[repaymentChainId] ??= {};
99
- dict[repaymentChainId][repaymentToken.toBytes32()] ??= {
100
- fills: [],
101
- totalRefundAmount: bnZero,
102
- realizedLpFees: bnZero,
103
- refunds: {},
104
- };
100
+ if (!dict?.[repaymentChainId]?.[repaymentToken]) {
101
+ assign(dict, [repaymentChainId, repaymentToken], {
102
+ fills: [],
103
+ totalRefundAmount: bnZero,
104
+ realizedLpFees: bnZero,
105
+ refunds: {},
106
+ });
107
+ }
105
108
 
106
109
  const bundleFill: BundleFillV3 = { ...fill, lpFeePct, relayer: repaymentAddress };
107
110
 
108
111
  // Add all fills, slow and fast, to dictionary.
109
- assign(dict, [repaymentChainId, repaymentToken.toBytes32(), "fills"], [bundleFill]);
112
+ assign(dict, [repaymentChainId, repaymentToken, "fills"], [bundleFill]);
110
113
 
111
114
  // All fills update the bundle LP fees.
112
- const refundObj = dict[repaymentChainId][repaymentToken.toBytes32()];
115
+ const refundObj = dict[repaymentChainId][repaymentToken];
113
116
  const realizedLpFee = bundleFill.inputAmount.mul(bundleFill.lpFeePct).div(fixedPointAdjustment);
114
117
  refundObj.realizedLpFees = refundObj.realizedLpFees ? refundObj.realizedLpFees.add(realizedLpFee) : realizedLpFee;
115
118
 
@@ -123,11 +126,10 @@ function updateBundleFillsV3(
123
126
  // Instantiate dictionary if it doesn't exist.
124
127
  refundObj.refunds ??= {};
125
128
 
126
- if (refundObj.refunds[bundleFill.relayer.toBytes32()]) {
127
- refundObj.refunds[bundleFill.relayer.toBytes32()] =
128
- refundObj.refunds[bundleFill.relayer.toBytes32()].add(refundAmount);
129
+ if (refundObj.refunds[bundleFill.relayer]) {
130
+ refundObj.refunds[bundleFill.relayer] = refundObj.refunds[bundleFill.relayer].add(refundAmount);
129
131
  } else {
130
- refundObj.refunds[bundleFill.relayer.toBytes32()] = refundAmount;
132
+ refundObj.refunds[bundleFill.relayer] = refundAmount;
131
133
  }
132
134
  }
133
135
  }
@@ -137,19 +139,21 @@ function updateBundleExcessSlowFills(
137
139
  deposit: V3DepositWithBlock & { lpFeePct: BigNumber }
138
140
  ): void {
139
141
  const { destinationChainId, outputToken } = deposit;
140
- dict[destinationChainId] ??= {};
141
- dict[destinationChainId][outputToken.toBytes32()] ??= [];
142
- dict[destinationChainId][outputToken.toBytes32()].push(deposit);
142
+ if (!dict?.[destinationChainId]?.[outputToken]) {
143
+ assign(dict, [destinationChainId, outputToken], []);
144
+ }
145
+ dict[destinationChainId][outputToken].push(deposit);
143
146
  }
144
147
 
145
148
  function updateBundleSlowFills(dict: BundleSlowFills, deposit: V3DepositWithBlock & { lpFeePct: BigNumber }): void {
146
- if (chainIsEvm(deposit.destinationChainId) && !deposit.recipient.isValidEvmAddress()) {
149
+ if (chainIsEvm(deposit.destinationChainId) && !isValidEvmAddress(deposit.recipient)) {
147
150
  return;
148
151
  }
149
152
  const { destinationChainId, outputToken } = deposit;
150
- dict[destinationChainId] ??= {};
151
- dict[destinationChainId][outputToken.toBytes32()] ??= [];
152
- dict[destinationChainId][outputToken.toBytes32()].push(deposit);
153
+ if (!dict?.[destinationChainId]?.[outputToken]) {
154
+ assign(dict, [destinationChainId, outputToken], []);
155
+ }
156
+ dict[destinationChainId][outputToken].push(deposit);
153
157
  }
154
158
 
155
159
  // @notice Shared client for computing data needed to construct or validate a bundle.
@@ -485,23 +489,21 @@ export class BundleDataClient {
485
489
  // worst from the relayer's perspective.
486
490
  const { relayer, inputAmount: refundAmount } = fill;
487
491
  refundsForChain[chainToSendRefundTo] ??= {};
488
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()] ??= {};
489
- const existingRefundAmount =
490
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()][relayer.toBytes32()] ?? bnZero;
491
- refundsForChain[chainToSendRefundTo][repaymentToken.toBytes32()][relayer.toBytes32()] =
492
- existingRefundAmount.add(refundAmount);
492
+ refundsForChain[chainToSendRefundTo][repaymentToken] ??= {};
493
+ const existingRefundAmount = refundsForChain[chainToSendRefundTo][repaymentToken][relayer] ?? bnZero;
494
+ refundsForChain[chainToSendRefundTo][repaymentToken][relayer] = existingRefundAmount.add(refundAmount);
493
495
  });
494
496
  }
495
497
  return refundsForChain;
496
498
  }
497
499
 
498
- getUpcomingDepositAmount(chainId: number, l2Token: Address, latestBlockToSearch: number): BigNumber {
500
+ getUpcomingDepositAmount(chainId: number, l2Token: string, latestBlockToSearch: number): BigNumber {
499
501
  if (this.spokePoolClients[chainId] === undefined) {
500
502
  return toBN(0);
501
503
  }
502
504
  return this.spokePoolClients[chainId]
503
505
  .getDeposits()
504
- .filter((deposit) => deposit.blockNumber > latestBlockToSearch && deposit.inputToken.eq(l2Token))
506
+ .filter((deposit) => deposit.blockNumber > latestBlockToSearch && deposit.inputToken === l2Token)
505
507
  .reduce((acc, deposit) => {
506
508
  return acc.add(deposit.inputAmount);
507
509
  }, toBN(0));
@@ -624,18 +626,18 @@ export class BundleDataClient {
624
626
  const executedRefunds: { [tokenAddress: string]: { [relayer: string]: BigNumber } } = {};
625
627
  for (const refundLeaf of executedRefundLeaves) {
626
628
  const tokenAddress = refundLeaf.l2TokenAddress;
627
- if (executedRefunds[tokenAddress.toBytes32()] === undefined) {
628
- executedRefunds[tokenAddress.toBytes32()] = {};
629
+ if (executedRefunds[tokenAddress] === undefined) {
630
+ executedRefunds[tokenAddress] = {};
629
631
  }
630
- const executedTokenRefunds = executedRefunds[tokenAddress.toBytes32()];
632
+ const executedTokenRefunds = executedRefunds[tokenAddress];
631
633
 
632
634
  for (let i = 0; i < refundLeaf.refundAddresses.length; i++) {
633
635
  const relayer = refundLeaf.refundAddresses[i];
634
636
  const refundAmount = refundLeaf.refundAmounts[i];
635
- if (executedTokenRefunds[relayer.toBytes32()] === undefined) {
636
- executedTokenRefunds[relayer.toBytes32()] = bnZero;
637
+ if (executedTokenRefunds[relayer] === undefined) {
638
+ executedTokenRefunds[relayer] = bnZero;
637
639
  }
638
- executedTokenRefunds[relayer.toBytes32()] = executedTokenRefunds[relayer.toBytes32()].add(refundAmount);
640
+ executedTokenRefunds[relayer] = executedTokenRefunds[relayer].add(refundAmount);
639
641
  }
640
642
  }
641
643
  return executedRefunds;
@@ -676,15 +678,15 @@ export class BundleDataClient {
676
678
  return allRefunds;
677
679
  }
678
680
 
679
- getRefundsFor(bundleRefunds: CombinedRefunds, relayer: Address, chainId: number, token: Address): BigNumber {
680
- if (!bundleRefunds[chainId] || !bundleRefunds[chainId][token.toBytes32()]) {
681
+ getRefundsFor(bundleRefunds: CombinedRefunds, relayer: string, chainId: number, token: string): BigNumber {
682
+ if (!bundleRefunds[chainId] || !bundleRefunds[chainId][token]) {
681
683
  return BigNumber.from(0);
682
684
  }
683
- const allRefunds = bundleRefunds[chainId][token.toBytes32()];
684
- return allRefunds && allRefunds[relayer.toBytes32()] ? allRefunds[relayer.toBytes32()] : BigNumber.from(0);
685
+ const allRefunds = bundleRefunds[chainId][token];
686
+ return allRefunds && allRefunds[relayer] ? allRefunds[relayer] : BigNumber.from(0);
685
687
  }
686
688
 
687
- getTotalRefund(refunds: CombinedRefunds[], relayer: Address, chainId: number, refundToken: Address): BigNumber {
689
+ getTotalRefund(refunds: CombinedRefunds[], relayer: string, chainId: number, refundToken: string): BigNumber {
688
690
  return refunds.reduce((totalRefund, refunds) => {
689
691
  return totalRefund.add(this.getRefundsFor(refunds, relayer, chainId, refundToken));
690
692
  }, bnZero);
@@ -897,11 +899,7 @@ export class BundleDataClient {
897
899
  "Not using correct bundle deposit hash key"
898
900
  );
899
901
  if (deposit.blockNumber >= originChainBlockRange[0]) {
900
- if (
901
- bundleDepositsV3?.[originChainId]?.[deposit.inputToken.toBytes32()]?.find((d) =>
902
- duplicateEvent(deposit, d)
903
- )
904
- ) {
902
+ if (bundleDepositsV3?.[originChainId]?.[deposit.inputToken]?.find((d) => duplicateEvent(deposit, d))) {
905
903
  this.logger.debug({
906
904
  at: "BundleDataClient#loadData",
907
905
  message: "Duplicate deposit detected",
@@ -17,7 +17,6 @@ import {
17
17
  fixedPointAdjustment,
18
18
  count2DDictionaryValues,
19
19
  count3DDictionaryValues,
20
- toAddressType,
21
20
  } from "../../../utils";
22
21
  import {
23
22
  addLastRunningBalance,
@@ -66,10 +65,10 @@ export function getRefundsFromBundle(
66
65
  Object.entries(depositsForChain).forEach(([l2TokenAddress, deposits]) => {
67
66
  deposits.forEach((deposit) => {
68
67
  if (combinedRefunds[originChainId][l2TokenAddress] === undefined) {
69
- combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor.toBytes32()]: deposit.inputAmount };
68
+ combinedRefunds[originChainId][l2TokenAddress] = { [deposit.depositor]: deposit.inputAmount };
70
69
  } else {
71
- const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor.toBytes32()];
72
- combinedRefunds[originChainId][l2TokenAddress][deposit.depositor.toBytes32()] = deposit.inputAmount.add(
70
+ const existingRefundAmount = combinedRefunds[originChainId][l2TokenAddress][deposit.depositor];
71
+ combinedRefunds[originChainId][l2TokenAddress][deposit.depositor] = deposit.inputAmount.add(
73
72
  existingRefundAmount ?? bnZero
74
73
  );
75
74
  }
@@ -154,23 +153,19 @@ export function _buildPoolRebalanceRoot(
154
153
  // If the repayment token and repayment chain ID do not map to a PoolRebalanceRoute graph, then
155
154
  // there are no relevant L1 running balances.
156
155
  if (
157
- !clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(
158
- toAddressType(l2TokenAddress, repaymentChainId),
159
- repaymentChainId,
160
- mainnetBundleEndBlock
161
- )
156
+ !clients.hubPoolClient.l2TokenHasPoolRebalanceRoute(l2TokenAddress, repaymentChainId, mainnetBundleEndBlock)
162
157
  ) {
163
158
  chainWithRefundsOnly.add(repaymentChainId);
164
159
  return;
165
160
  }
166
161
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
167
- toAddressType(l2TokenAddress, repaymentChainId),
162
+ l2TokenAddress,
168
163
  repaymentChainId,
169
164
  mainnetBundleEndBlock
170
165
  );
171
166
 
172
- updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart.toEvmAddress(), totalRefundAmount);
173
- updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart.toEvmAddress(), totalRealizedLpFee);
167
+ updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart, totalRefundAmount);
168
+ updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart, totalRealizedLpFee);
174
169
  }
175
170
  );
176
171
  });
@@ -187,17 +182,12 @@ export function _buildPoolRebalanceRoot(
187
182
  Object.entries(depositsForChain).forEach(([outputToken, deposits]) => {
188
183
  deposits.forEach((deposit) => {
189
184
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
190
- toAddressType(outputToken, destinationChainId),
185
+ outputToken,
191
186
  destinationChainId,
192
187
  mainnetBundleEndBlock
193
188
  );
194
189
  const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
195
- updateRunningBalance(
196
- runningBalances,
197
- destinationChainId,
198
- l1TokenCounterpart.toEvmAddress(),
199
- deposit.inputAmount.sub(lpFee)
200
- );
190
+ updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, deposit.inputAmount.sub(lpFee));
201
191
  // Slow fill LP fees are accounted for when the slow fill executes and a V3FilledRelay is emitted. i.e. when
202
192
  // the slow fill execution is included in bundleFillsV3.
203
193
  });
@@ -216,17 +206,12 @@ export function _buildPoolRebalanceRoot(
216
206
  Object.entries(slowFilledDepositsForChain).forEach(([outputToken, slowFilledDeposits]) => {
217
207
  slowFilledDeposits.forEach((deposit) => {
218
208
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
219
- toAddressType(outputToken, destinationChainId),
209
+ outputToken,
220
210
  destinationChainId,
221
211
  mainnetBundleEndBlock
222
212
  );
223
213
  const lpFee = deposit.lpFeePct.mul(deposit.inputAmount).div(fixedPointAdjustment);
224
- updateRunningBalance(
225
- runningBalances,
226
- destinationChainId,
227
- l1TokenCounterpart.toEvmAddress(),
228
- lpFee.sub(deposit.inputAmount)
229
- );
214
+ updateRunningBalance(runningBalances, destinationChainId, l1TokenCounterpart, lpFee.sub(deposit.inputAmount));
230
215
  // Slow fills don't add to lpFees, only when the slow fill is executed and a V3FilledRelay is emitted, so
231
216
  // we don't need to subtract it here. Moreover, the HubPoole expects bundleLpFees to be > 0.
232
217
  });
@@ -286,11 +271,11 @@ export function _buildPoolRebalanceRoot(
286
271
  return;
287
272
  }
288
273
  const l1TokenCounterpart = clients.hubPoolClient.getL1TokenForL2TokenAtBlock(
289
- toAddressType(inputToken, originChainId),
274
+ inputToken,
290
275
  originChainId,
291
276
  mainnetBundleEndBlock
292
277
  );
293
- updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart.toEvmAddress(), deposit.inputAmount);
278
+ updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart, deposit.inputAmount);
294
279
  });
295
280
  });
296
281
  });
@@ -2,7 +2,7 @@ import _ from "lodash";
2
2
  import assert from "assert";
3
3
  import { providers } from "ethers";
4
4
  import { DepositWithBlock, Fill, FillWithBlock } from "../../../interfaces";
5
- import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm, Address, toAddressType } from "../../../utils";
5
+ import { isSlowFill, isValidEvmAddress, isDefined, chainIsEvm } from "../../../utils";
6
6
  import { HubPoolClient } from "../../HubPoolClient";
7
7
  import { SVMProvider } from "../../../arch/svm";
8
8
 
@@ -25,7 +25,7 @@ export function getRefundInformationFromFill(
25
25
  bundleEndBlockForMainnet: number
26
26
  ): {
27
27
  chainToSendRefundTo: number;
28
- repaymentToken: Address;
28
+ repaymentToken: string;
29
29
  } {
30
30
  const chainToSendRefundTo = _getRepaymentChainId(relayData, hubPoolClient, bundleEndBlockForMainnet);
31
31
  if (chainToSendRefundTo === relayData.originChainId) {
@@ -49,7 +49,6 @@ export function getRefundInformationFromFill(
49
49
  chainToSendRefundTo,
50
50
  bundleEndBlockForMainnet
51
51
  );
52
-
53
52
  return {
54
53
  chainToSendRefundTo,
55
54
  repaymentToken,
@@ -126,8 +125,7 @@ export async function verifyFillRepayment(
126
125
  return undefined;
127
126
  }
128
127
  }
129
- fill.relayer = toAddressType(destinationRelayer);
130
- assert(fill.relayer.isValidEvmAddress(), `Cannot re-assign fill to msg.sender: ${destinationRelayer}`);
128
+ fill.relayer = destinationRelayer;
131
129
  } else {
132
130
  return undefined;
133
131
  }
@@ -202,5 +200,5 @@ function _repaymentAddressNeedsToBeOverwritten(fill: Fill): boolean {
202
200
  // - i.e. If chainIsSvm && !isValidSvmAddress(fill.relayer) then return false
203
201
  // If chainIsEvm && !isValidEvmAddress(fill.relayer) then return false
204
202
  // If chainIsEvm && isValidEvmAddress(fill.relayer) then return true
205
- return chainIsEvm(fill.repaymentChainId) && !fill.relayer.isValidEvmAddress();
203
+ return !isValidEvmAddress(fill.relayer);
206
204
  }
@@ -21,12 +21,6 @@ export function buildPoolRebalanceLeafTree(poolRebalanceLeaves: PoolRebalanceLea
21
21
  }
22
22
 
23
23
  const paramType = getParamType("MerkleLibTest", "verifyPoolRebalance", "rebalance");
24
- const hashFn = (input: PoolRebalanceLeaf) => {
25
- const ethersLeaf = {
26
- ...input,
27
- l1Tokens: input.l1Tokens.map((l1Token) => l1Token.toEvmAddress()),
28
- };
29
- return utils.keccak256(utils.defaultAbiCoder.encode([paramType], [ethersLeaf]));
30
- };
24
+ const hashFn = (input: PoolRebalanceLeaf) => utils.keccak256(utils.defaultAbiCoder.encode([paramType], [input]));
31
25
  return new MerkleTree<PoolRebalanceLeaf>(poolRebalanceLeaves, hashFn);
32
26
  }
@@ -1,7 +1,7 @@
1
1
  import { MerkleTree } from "@across-protocol/contracts/dist/utils/MerkleTree";
2
2
  import { RunningBalances, PoolRebalanceLeaf, Clients, SpokePoolTargetBalance } from "../../../interfaces";
3
3
  import { SpokePoolClient } from "../../SpokePoolClient";
4
- import { BigNumber, bnZero, compareAddresses, EvmAddress } from "../../../utils";
4
+ import { BigNumber, bnZero, compareAddresses } from "../../../utils";
5
5
  import { HubPoolClient } from "../../HubPoolClient";
6
6
  import { V3DepositWithBlock } from "./shims";
7
7
  import { AcrossConfigStoreClient } from "../../AcrossConfigStoreClient";
@@ -151,7 +151,7 @@ export function addLastRunningBalance(
151
151
  const { runningBalance } = hubPoolClient.getRunningBalanceBeforeBlockForChain(
152
152
  latestMainnetBlock,
153
153
  Number(repaymentChainId),
154
- EvmAddress.from(l1TokenAddress)
154
+ l1TokenAddress
155
155
  );
156
156
  if (!runningBalance.eq(bnZero)) {
157
157
  updateRunningBalance(runningBalances, Number(repaymentChainId), l1TokenAddress, runningBalance);
@@ -172,7 +172,7 @@ export function updateRunningBalanceForDeposit(
172
172
  deposit.originChainId,
173
173
  mainnetBundleEndBlock
174
174
  );
175
- updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart.toEvmAddress(), updateAmount);
175
+ updateRunningBalance(runningBalances, deposit.originChainId, l1TokenCounterpart, updateAmount);
176
176
  }
177
177
 
178
178
  export function constructPoolRebalanceLeaves(
@@ -253,7 +253,7 @@ export function constructPoolRebalanceLeaves(
253
253
  runningBalances: leafRunningBalances,
254
254
  groupIndex: groupIndexForChainId++,
255
255
  leafId: leaves.length,
256
- l1Tokens: l1TokensToIncludeInThisLeaf.map((l1TokenAddr: string) => EvmAddress.from(l1TokenAddr)),
256
+ l1Tokens: l1TokensToIncludeInThisLeaf,
257
257
  });
258
258
  }
259
259
  });
@@ -15,7 +15,7 @@ import {
15
15
  type,
16
16
  } from "superstruct";
17
17
  import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
18
- import { BigNumber, toAddressType, Address } from "../../../utils";
18
+ import { BigNumber } from "../../../utils";
19
19
 
20
20
  const PositiveIntegerStringSS = pattern(string(), /\d+/);
21
21
  const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{40}$/);
@@ -31,23 +31,19 @@ const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (
31
31
  }
32
32
  });
33
33
 
34
- const AddressType = coerce(instance(Address), string(), (value) => {
35
- return toAddressType(value);
36
- });
37
-
38
34
  const FillTypeSS = number();
39
35
 
40
36
  const V3RelayDataSS = {
41
- inputToken: AddressType,
37
+ inputToken: string(),
42
38
  inputAmount: BigNumberType,
43
- outputToken: AddressType,
39
+ outputToken: string(),
44
40
  outputAmount: BigNumberType,
45
41
  fillDeadline: number(),
46
- exclusiveRelayer: AddressType,
42
+ exclusiveRelayer: string(),
47
43
  exclusivityDeadline: number(),
48
44
  originChainId: number(),
49
- depositor: AddressType,
50
- recipient: AddressType,
45
+ depositor: string(),
46
+ recipient: string(),
51
47
  depositId: BigNumberType,
52
48
  message: string(),
53
49
  };
@@ -71,7 +67,7 @@ const V3DepositSS = {
71
67
  quoteTimestamp: number(),
72
68
  relayerFeePct: optional(BigNumberType),
73
69
  speedUpSignature: optional(string()),
74
- updatedRecipient: optional(AddressType),
70
+ updatedRecipient: optional(string()),
75
71
  updatedOutputAmount: optional(BigNumberType),
76
72
  updatedMessage: optional(string()),
77
73
  };
@@ -92,7 +88,7 @@ const V3DepositWithBlockLpFeeSS = object({
92
88
  const V3RelayExecutionEventInfoSS = object({
93
89
  updatedOutputAmount: BigNumberType,
94
90
  fillType: FillTypeSS,
95
- updatedRecipient: AddressType,
91
+ updatedRecipient: string(),
96
92
  updatedMessage: optional(string()),
97
93
  updatedMessageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
98
94
  });
@@ -102,7 +98,7 @@ const V3FillSS = {
102
98
  message: optional(string()),
103
99
  messageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
104
100
  destinationChainId: number(),
105
- relayer: AddressType,
101
+ relayer: string(),
106
102
  repaymentChainId: number(),
107
103
  relayExecutionInfo: V3RelayExecutionEventInfoSS,
108
104
  quoteTimestamp: number(),