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

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 (196) hide show
  1. package/dist/cjs/arch/evm/SpokeUtils.d.ts +5 -2
  2. package/dist/cjs/arch/evm/SpokeUtils.js +22 -5
  3. package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/SpokeUtils.js +14 -11
  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 +15 -13
  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 +4 -2
  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 +60 -56
  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 +2 -1
  18. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -2
  19. package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  20. package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  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 +11 -8
  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 +83 -59
  29. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  30. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  31. package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  32. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -3
  33. package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +55 -49
  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 +15 -9
  37. package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
  38. package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +9 -13
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +42 -56
  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 +19 -14
  45. package/dist/cjs/interfaces/SpokePool.d.ts +14 -16
  46. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  47. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  48. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +7 -7
  49. package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
  50. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  51. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +14 -15
  52. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  53. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  54. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +7 -7
  55. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  56. package/dist/cjs/utils/AddressUtils.d.ts +6 -3
  57. package/dist/cjs/utils/AddressUtils.js +42 -14
  58. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  59. package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
  60. package/dist/cjs/utils/SpokeUtils.js +4 -22
  61. package/dist/cjs/utils/SpokeUtils.js.map +1 -1
  62. package/dist/cjs/utils/TokenUtils.d.ts +4 -4
  63. package/dist/cjs/utils/TokenUtils.js +3 -3
  64. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  65. package/dist/esm/arch/evm/SpokeUtils.d.ts +5 -2
  66. package/dist/esm/arch/evm/SpokeUtils.js +23 -6
  67. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  68. package/dist/esm/arch/svm/SpokeUtils.js +14 -11
  69. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  70. package/dist/esm/arch/svm/utils.d.ts +1 -1
  71. package/dist/esm/arch/svm/utils.js +15 -13
  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 +4 -2
  75. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  76. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  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 +2 -1
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +4 -3
  83. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  84. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  85. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  86. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  87. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  88. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
  90. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  91. package/dist/esm/clients/HubPoolClient.d.ts +23 -22
  92. package/dist/esm/clients/HubPoolClient.js +96 -63
  93. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  94. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +3 -3
  95. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -3
  97. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +57 -50
  98. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  99. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  100. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  101. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +9 -13
  103. package/dist/esm/clients/mocks/MockSpokePoolClient.js +46 -60
  104. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  105. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  106. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  107. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  108. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  109. package/dist/esm/interfaces/SpokePool.d.ts +14 -16
  110. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  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 +15 -16
  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 +7 -3
  121. package/dist/esm/utils/AddressUtils.js +52 -19
  122. package/dist/esm/utils/AddressUtils.js.map +1 -1
  123. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  124. package/dist/esm/utils/SpokeUtils.js +4 -26
  125. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  126. package/dist/esm/utils/TokenUtils.d.ts +18 -16
  127. package/dist/esm/utils/TokenUtils.js +3 -3
  128. package/dist/esm/utils/TokenUtils.js.map +1 -1
  129. package/dist/types/arch/evm/SpokeUtils.d.ts +5 -2
  130. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  131. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  132. package/dist/types/arch/svm/utils.d.ts +1 -1
  133. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  134. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  135. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  136. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  137. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  138. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  139. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  140. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  141. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
  142. package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
  143. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  144. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  145. package/dist/types/clients/HubPoolClient.d.ts +23 -22
  146. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  147. package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
  148. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +5 -3
  149. package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
  150. package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
  151. package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
  152. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +9 -13
  153. package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
  154. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  155. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
  156. package/dist/types/interfaces/HubPool.d.ts +19 -14
  157. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  158. package/dist/types/interfaces/SpokePool.d.ts +14 -16
  159. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  160. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +6 -6
  161. package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +4 -4
  163. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  164. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  165. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  166. package/dist/types/utils/AddressUtils.d.ts +7 -3
  167. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  168. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  169. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  170. package/dist/types/utils/TokenUtils.d.ts +18 -16
  171. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  172. package/package.json +1 -2
  173. package/src/arch/evm/SpokeUtils.ts +41 -11
  174. package/src/arch/svm/SpokeUtils.ts +23 -9
  175. package/src/arch/svm/utils.ts +3 -3
  176. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  177. package/src/clients/BundleDataClient/BundleDataClient.ts +54 -52
  178. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  179. package/src/clients/BundleDataClient/utils/FillUtils.ts +6 -4
  180. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  181. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  182. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
  183. package/src/clients/HubPoolClient.ts +122 -82
  184. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +7 -1
  185. package/src/clients/SpokePoolClient/SpokePoolClient.ts +113 -43
  186. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  187. package/src/clients/mocks/MockSpokePoolClient.ts +55 -74
  188. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  189. package/src/interfaces/HubPool.ts +23 -14
  190. package/src/interfaces/SpokePool.ts +14 -17
  191. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +10 -8
  192. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +16 -21
  193. package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
  194. package/src/utils/AddressUtils.ts +56 -21
  195. package/src/utils/SpokeUtils.ts +11 -33
  196. package/src/utils/TokenUtils.ts +7 -7
@@ -2,7 +2,7 @@ import assert from "assert";
2
2
  import { Contract } from "ethers";
3
3
  import { random } from "lodash";
4
4
  import winston from "winston";
5
- import { EMPTY_MESSAGE, ZERO_ADDRESS } from "../../constants";
5
+ import { EMPTY_MESSAGE, ZERO_ADDRESS, ZERO_BYTES } from "../../constants";
6
6
  import {
7
7
  Log,
8
8
  Deposit,
@@ -25,9 +25,11 @@ import {
25
25
  BigNumber,
26
26
  bnZero,
27
27
  bnOne,
28
- toAddress,
29
28
  toBytes32,
30
29
  spreadEventWithBlockNumber,
30
+ Address,
31
+ toAddressType,
32
+ isDefined,
31
33
  } from "../../utils";
32
34
  import { EVMSpokePoolClient, SpokePoolUpdate } from "../SpokePoolClient";
33
35
  import { HubPoolClient } from "../HubPoolClient";
@@ -63,8 +65,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
63
65
  this.destinationTokenForChainOverride[chainId] = token;
64
66
  }
65
67
 
66
- getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
67
- return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
68
+ getDestinationTokenForDeposit(deposit: DepositWithBlock): Address {
69
+ const override = this.destinationTokenForChainOverride[deposit.originChainId];
70
+ return isDefined(override)
71
+ ? toAddressType(override, deposit.destinationChainId)
72
+ : super.getDestinationTokenForDeposit(deposit);
68
73
  }
69
74
 
70
75
  setLatestBlockNumber(blockNumber: number): void {
@@ -85,6 +90,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
85
90
  lastDepositId = _depositIds[i];
86
91
  }
87
92
  }
93
+
88
94
  _getDepositIdAtBlock(blockTag: number): Promise<BigNumber> {
89
95
  return Promise.resolve(this.depositIdAtBlock[blockTag]);
90
96
  }
@@ -129,28 +135,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
129
135
  return this._deposit("FundsDeposited", deposit);
130
136
  }
131
137
 
132
- depositV3(deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
133
- return this._deposit("V3FundsDeposited", deposit);
134
- }
135
-
136
- protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
138
+ protected _deposit(
139
+ event: string,
140
+ deposit: Omit<Deposit, "messageHash"> & { message?: string } & Partial<SortableEvent>
141
+ ): Log {
137
142
  const { blockNumber, txnIndex } = deposit;
138
143
  let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
139
144
  depositId ??= this.numberOfDeposits;
140
145
  this.numberOfDeposits = depositId.add(bnOne);
141
146
 
142
147
  destinationChainId ??= random(1, 42161, false);
143
- const addressModifier = event === "FundsDeposited" ? toBytes32 : toAddress;
144
- const depositor = addressModifier(deposit.depositor ?? randomAddress());
145
- const recipient = addressModifier(deposit.recipient ?? depositor);
146
- const inputToken = addressModifier(deposit.inputToken ?? randomAddress());
147
- const outputToken = addressModifier(deposit.outputToken ?? inputToken);
148
- const exclusiveRelayer = addressModifier(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
148
+ const depositor = deposit.depositor?.toBytes32() ?? toBytes32(randomAddress());
149
+ const recipient = deposit.recipient?.toBytes32() ?? toBytes32(depositor);
150
+ const inputToken = deposit.inputToken?.toBytes32() ?? toBytes32(randomAddress());
151
+ const outputToken = deposit.outputToken?.toBytes32() ?? inputToken;
152
+ const exclusiveRelayer = deposit.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
149
153
 
150
154
  inputAmount ??= toBNWei(random(1, 1000, false));
151
155
  outputAmount ??= inputAmount.mul(toBN("0.95"));
152
156
 
153
- const message = deposit["message"] ?? "0x";
157
+ const message = deposit.message ?? "0x";
154
158
  const topics = [destinationChainId, depositId, depositor];
155
159
  const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
156
160
  const args = {
@@ -180,17 +184,13 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
180
184
  });
181
185
  }
182
186
 
183
- fillV3Relay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
184
- return this._fillRelay("FilledV3Relay", fill);
185
- }
186
-
187
- fillRelay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
187
+ fillRelay(fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>): Log {
188
188
  return this._fillRelay("FilledRelay", fill);
189
189
  }
190
190
 
191
191
  protected _fillRelay(
192
192
  event: string,
193
- fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>
193
+ fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>
194
194
  ): Log {
195
195
  const { blockNumber, txnIndex } = fill;
196
196
  let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
@@ -200,20 +200,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
200
200
  outputAmount ??= inputAmount;
201
201
  fillDeadline ??= getCurrentTime() + 60;
202
202
 
203
- const addressModifier = event === "FilledRelay" ? toBytes32 : toAddress;
204
- const depositor = addressModifier(fill.depositor ?? randomAddress());
205
- const recipient = addressModifier(fill.recipient ?? depositor);
206
- const inputToken = addressModifier(fill.inputToken ?? randomAddress());
207
- const outputToken = addressModifier(fill.outputToken ?? ZERO_ADDRESS);
208
- const exclusiveRelayer = addressModifier(fill.exclusiveRelayer ?? ZERO_ADDRESS);
209
- const relayer = addressModifier(fill.relayer ?? randomAddress());
203
+ const depositor = fill.depositor?.toBytes32() ?? toBytes32(randomAddress());
204
+ const recipient = fill.recipient?.toBytes32() ?? toBytes32(depositor);
205
+ const inputToken = fill.inputToken?.toBytes32() ?? toBytes32(randomAddress());
206
+ const outputToken = fill.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
207
+ const exclusiveRelayer = fill.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS);
208
+ const relayer = fill.relayer?.toBytes32() ?? toBytes32(randomAddress());
210
209
 
211
- const topics = [originChainId, depositId, relayer]; // @todo verify
210
+ const topics = [originChainId, depositId, relayer];
212
211
  const message = fill.message ?? EMPTY_MESSAGE;
213
212
  const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
213
+ const updatedRecipient = fill.relayExecutionInfo?.updatedRecipient.toBytes32() ?? recipient;
214
214
 
215
215
  const relayExecutionInfo = {
216
- updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
216
+ updatedRecipient,
217
217
  updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
218
218
  fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
219
219
  };
@@ -233,31 +233,20 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
233
233
  depositor,
234
234
  recipient,
235
235
  relayExecutionInfo: {
236
- updatedRecipient: fill.relayExecutionInfo?.updatedRecipient ?? recipient,
236
+ updatedRecipient,
237
237
  updatedOutputAmount: fill.relayExecutionInfo?.updatedOutputAmount ?? outputAmount,
238
238
  fillType: fill.relayExecutionInfo?.fillType ?? FillType.FastFill,
239
239
  },
240
240
  };
241
241
 
242
- const args =
243
- event === "FilledRelay"
244
- ? {
245
- ..._args,
246
- messageHash: getMessageHash(message),
247
- relayExecutionInfo: {
248
- ...relayExecutionInfo,
249
- updatedMessageHash: getMessageHash(updatedMessage),
250
- },
251
- }
252
- : {
253
- // FilledV3Relay
254
- ..._args,
255
- message,
256
- relayExecutionInfo: {
257
- ...relayExecutionInfo,
258
- updatedMessage,
259
- },
260
- };
242
+ const args = {
243
+ ..._args,
244
+ messageHash: getMessageHash(message),
245
+ relayExecutionInfo: {
246
+ ...relayExecutionInfo,
247
+ updatedMessageHash: getMessageHash(updatedMessage),
248
+ },
249
+ };
261
250
 
262
251
  return this.eventManager.generateEvent({
263
252
  event,
@@ -269,17 +258,12 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
269
258
  });
270
259
  }
271
260
 
272
- speedUpV3Deposit(speedUp: SpeedUp): Log {
273
- return this._speedUpDeposit("RequestedSpeedUpV3Deposit", speedUp);
274
- }
275
-
276
261
  speedUpDeposit(speedUp: SpeedUp): Log {
277
262
  return this._speedUpDeposit("RequestedSpeedUpDeposit", speedUp);
278
263
  }
279
264
 
280
265
  protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
281
- const addressModifier = event === "RequestedSpeedUpDeposit" ? toBytes32 : toAddress;
282
- const depositor = addressModifier(speedUp.depositor);
266
+ const depositor = speedUp.depositor.toBytes32();
283
267
  const topics = [speedUp.depositId, depositor];
284
268
  const args = { ...speedUp };
285
269
 
@@ -290,7 +274,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
290
274
  args: {
291
275
  ...args,
292
276
  depositor,
293
- updatedRecipient: addressModifier(speedUp.updatedRecipient),
277
+ updatedRecipient: speedUp.updatedRecipient.toBytes32(),
294
278
  },
295
279
  });
296
280
  }
@@ -308,24 +292,19 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
308
292
  });
309
293
  }
310
294
 
311
- requestV3SlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
312
- return this._requestSlowFill("RequestedV3SlowFill", request);
313
- }
314
-
315
- requestSlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
295
+ requestSlowFill(request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>): Log {
316
296
  return this._requestSlowFill("RequestedSlowFill", request);
317
297
  }
318
298
 
319
299
  protected _requestSlowFill(
320
300
  event: string,
321
- request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>
301
+ request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>
322
302
  ): Log {
323
303
  const { originChainId, depositId } = request;
324
304
  const topics = [originChainId, depositId];
325
305
  const args = { ...request };
326
306
 
327
- const addressModifier = event === "RequestedSlowFill" ? toBytes32 : toAddress;
328
- const depositor = addressModifier(args.depositor ?? randomAddress());
307
+ const depositor = args.depositor.toBytes32() ?? toBytes32(randomAddress());
329
308
 
330
309
  return this.eventManager.generateEvent({
331
310
  event,
@@ -333,24 +312,26 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
333
312
  topics: topics.map((topic) => topic.toString()),
334
313
  args: {
335
314
  ...args,
315
+ destinationChainId: this.chainId,
336
316
  depositor,
337
- recipient: addressModifier(args.recipient ?? depositor),
338
- inputToken: addressModifier(args.inputToken ?? randomAddress()),
339
- outputToken: addressModifier(args.outputToken ?? ZERO_ADDRESS),
340
- exclusiveRelayer: addressModifier(args.exclusiveRelayer ?? ZERO_ADDRESS),
317
+ recipient: args.recipient?.toBytes32() ?? depositor,
318
+ inputToken: args.inputToken?.toBytes32() ?? toBytes32(randomAddress()),
319
+ outputToken: args.outputToken?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
320
+ exclusiveRelayer: args.exclusiveRelayer?.toBytes32() ?? toBytes32(ZERO_ADDRESS),
321
+ messageHash: args.messageHash ?? ZERO_BYTES,
341
322
  },
342
323
  blockNumber: request.blockNumber,
343
324
  transactionIndex: request.txnIndex,
344
325
  });
345
326
  }
346
327
 
347
- // This is a simple wrapper around fillV3Relay().
328
+ // This is a simple wrapper around fillRelay().
348
329
  // rootBundleId and proof are discarded here - we have no interest in verifying that.
349
- executeV3SlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
330
+ executeSlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
350
331
  const fill = {
351
332
  ...leaf.relayData,
352
333
  destinationChainId: this.chainId,
353
- relayer: ZERO_ADDRESS,
334
+ relayer: toAddressType(ZERO_ADDRESS),
354
335
  repaymentChainId: 0,
355
336
  relayExecutionInfo: {
356
337
  updatedRecipient: leaf.relayData.recipient,
@@ -361,7 +342,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
361
342
  },
362
343
  };
363
344
 
364
- return this.fillV3Relay(fill);
345
+ return this.fillRelay(fill);
365
346
  }
366
347
 
367
348
  executeRelayerRefundLeaf(refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
@@ -2,7 +2,15 @@ import winston from "winston";
2
2
  import { SvmSpokeClient } from "@across-protocol/contracts";
3
3
  import { Address } from "@solana/kit";
4
4
  import { DepositWithBlock, RelayerRefundExecution, SortableEvent, SlowFillLeaf, Log } from "../../interfaces";
5
- import { getCurrentTime, bnZero, MakeOptional, EventSearchConfig } from "../../utils";
5
+ import {
6
+ getCurrentTime,
7
+ bnZero,
8
+ MakeOptional,
9
+ EventSearchConfig,
10
+ Address as SDKAddress,
11
+ toAddressType,
12
+ isDefined,
13
+ } from "../../utils";
6
14
  import { SpokePoolUpdate, SVMSpokePoolClient } from "../SpokePoolClient";
7
15
  import { HubPoolClient } from "../HubPoolClient";
8
16
  import { EventOverrides } from "./MockEvents";
@@ -46,8 +54,9 @@ export class MockSvmSpokePoolClient extends SVMSpokePoolClient {
46
54
  this.destinationTokenForChainOverride[chainId] = token;
47
55
  }
48
56
 
49
- getDestinationTokenForDeposit(deposit: DepositWithBlock): string {
50
- return this.destinationTokenForChainOverride[deposit.originChainId] ?? super.getDestinationTokenForDeposit(deposit);
57
+ getDestinationTokenForDeposit(deposit: DepositWithBlock): SDKAddress {
58
+ const override = this.destinationTokenForChainOverride[deposit.originChainId];
59
+ return isDefined(override) ? toAddressType(override) : super.getDestinationTokenForDeposit(deposit);
51
60
  }
52
61
 
53
62
  setLatestBlockNumber(blockNumber: number): void {
@@ -1,4 +1,4 @@
1
- import { BigNumber } from "../utils";
1
+ import { Address, BigNumber, EvmAddress } from "../utils";
2
2
  import { SortableEvent } from "./Common";
3
3
 
4
4
  export interface PoolRebalanceLeaf {
@@ -8,7 +8,7 @@ export interface PoolRebalanceLeaf {
8
8
  netSendAmounts: BigNumber[];
9
9
  runningBalances: BigNumber[];
10
10
  leafId: number;
11
- l1Tokens: string[];
11
+ l1Tokens: EvmAddress[];
12
12
  }
13
13
 
14
14
  export interface RelayerRefundLeaf {
@@ -16,8 +16,8 @@ export interface RelayerRefundLeaf {
16
16
  chainId: number;
17
17
  refundAmounts: BigNumber[];
18
18
  leafId: number;
19
- l2TokenAddress: string;
20
- refundAddresses: string[];
19
+ l2TokenAddress: Address;
20
+ refundAddresses: Address[];
21
21
  }
22
22
 
23
23
  export interface ProposedRootBundle extends SortableEvent {
@@ -27,7 +27,7 @@ export interface ProposedRootBundle extends SortableEvent {
27
27
  poolRebalanceRoot: string;
28
28
  relayerRefundRoot: string;
29
29
  slowRelayRoot: string;
30
- proposer: string;
30
+ proposer: EvmAddress;
31
31
  }
32
32
 
33
33
  export type RealizedLpFee = {
@@ -55,7 +55,7 @@ export interface ExecutedRootBundle extends SortableEvent {
55
55
  netSendAmounts: BigNumber[];
56
56
  runningBalances: BigNumber[];
57
57
  leafId: number;
58
- l1Tokens: string[];
58
+ l1Tokens: EvmAddress[];
59
59
  proof: string[];
60
60
  }
61
61
 
@@ -76,8 +76,14 @@ export interface RelayerRefundLeafWithGroup extends RelayerRefundLeaf {
76
76
  groupIndex: number;
77
77
  }
78
78
 
79
- export interface L1Token {
80
- address: string;
79
+ export interface L1TokenInfo {
80
+ address: EvmAddress;
81
+ symbol: string;
82
+ decimals: number;
83
+ }
84
+
85
+ export interface TokenInfo {
86
+ address: Address;
81
87
  symbol: string;
82
88
  decimals: number;
83
89
  }
@@ -87,27 +93,30 @@ export interface LpToken {
87
93
  liquidReserves: BigNumber;
88
94
  }
89
95
 
96
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
90
97
  export interface CrossChainContractsSet extends SortableEvent {
91
98
  l2ChainId: number;
92
- spokePool: string;
99
+ spokePool: Address;
93
100
  }
94
101
 
102
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
95
103
  export interface DestinationTokenWithBlock extends SortableEvent {
96
- l2Token: string;
97
- l1Token: string;
104
+ l2Token: Address;
105
+ l1Token: EvmAddress;
98
106
  }
99
107
 
108
+ // TODO: I think I don't change string -> Address in the Events. I change right after the event is read
100
109
  export interface SetPoolRebalanceRoot extends SortableEvent {
101
110
  destinationChainId: number;
102
- l1Token: string;
103
- destinationToken: string;
111
+ l1Token: EvmAddress;
112
+ destinationToken: Address;
104
113
  }
105
114
 
106
115
  export interface PendingRootBundle {
107
116
  poolRebalanceRoot: string;
108
117
  relayerRefundRoot: string;
109
118
  slowRelayRoot: string;
110
- proposer: string;
119
+ proposer: EvmAddress;
111
120
  unclaimedPoolRebalanceLeafCount: number;
112
121
  challengePeriodEndTimestamp: number;
113
122
  bundleEvaluationBlockNumbers: number[];
@@ -1,23 +1,20 @@
1
1
  import { SortableEvent } from "./Common";
2
- import { FilledV3RelayEvent, V3FundsDepositedEvent } from "../typechain";
3
2
  import { SpokePoolClient } from "../clients";
4
- import { BigNumber } from "../utils";
3
+ import { BigNumber, Address, EvmAddress } from "../utils";
5
4
  import { RelayerRefundLeaf } from "./HubPool";
6
5
 
7
- export type { FilledV3RelayEvent, V3FundsDepositedEvent };
8
-
9
6
  export interface RelayData {
10
7
  originChainId: number;
11
- depositor: string;
12
- recipient: string;
8
+ depositor: Address;
9
+ recipient: Address;
13
10
  depositId: BigNumber;
14
- inputToken: string;
11
+ inputToken: Address;
15
12
  inputAmount: BigNumber;
16
- outputToken: string;
13
+ outputToken: Address;
17
14
  outputAmount: BigNumber;
18
15
  message: string;
19
16
  fillDeadline: number;
20
- exclusiveRelayer: string;
17
+ exclusiveRelayer: Address;
21
18
  exclusivityDeadline: number;
22
19
  }
23
20
 
@@ -26,7 +23,7 @@ export interface Deposit extends RelayData {
26
23
  destinationChainId: number;
27
24
  quoteTimestamp: number;
28
25
  speedUpSignature?: string;
29
- updatedRecipient?: string;
26
+ updatedRecipient?: Address;
30
27
  updatedOutputAmount?: BigNumber;
31
28
  updatedMessage?: string;
32
29
  fromLiteChain: boolean;
@@ -54,7 +51,7 @@ export enum FillType {
54
51
  }
55
52
 
56
53
  export interface RelayExecutionEventInfo {
57
- updatedRecipient: string;
54
+ updatedRecipient: Address;
58
55
  updatedOutputAmount: BigNumber;
59
56
  updatedMessage?: string;
60
57
  updatedMessageHash: string;
@@ -64,7 +61,7 @@ export interface RelayExecutionEventInfo {
64
61
  export interface Fill extends Omit<RelayData, "message"> {
65
62
  messageHash: string;
66
63
  destinationChainId: number;
67
- relayer: string;
64
+ relayer: Address;
68
65
  repaymentChainId: number;
69
66
  relayExecutionInfo: RelayExecutionEventInfo;
70
67
  }
@@ -75,25 +72,25 @@ export interface FillWithTime extends Fill, SortableEvent {
75
72
  }
76
73
 
77
74
  export interface EnabledDepositRoute {
78
- originToken: string;
75
+ originToken: Address;
79
76
  destinationChainId: number;
80
77
  enabled: boolean;
81
78
  }
82
79
 
83
80
  export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
84
81
  export interface SpeedUp {
85
- depositor: string;
82
+ depositor: EvmAddress;
86
83
  depositorSignature: string;
87
84
  depositId: BigNumber;
88
85
  originChainId: number;
89
- updatedRecipient: string;
86
+ updatedRecipient: Address;
90
87
  updatedOutputAmount: BigNumber;
91
88
  updatedMessage: string;
92
89
  }
93
90
 
94
91
  export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
95
92
 
96
- export interface SlowFillRequest extends RelayData {
93
+ export interface SlowFillRequest extends Omit<RelayData, "message"> {
97
94
  messageHash: string;
98
95
  destinationChainId: number;
99
96
  }
@@ -133,7 +130,7 @@ export interface TokensBridged extends SortableEvent {
133
130
  amountToReturn: BigNumber;
134
131
  chainId: number;
135
132
  leafId: number;
136
- l2TokenAddress: string;
133
+ l2TokenAddress: Address;
137
134
  }
138
135
 
139
136
  export interface SpokePoolClientsByChain {
@@ -15,6 +15,8 @@ import {
15
15
  bnZero,
16
16
  chainIsOPStack,
17
17
  fixedPointAdjustment,
18
+ toAddressType,
19
+ Address,
18
20
  } from "../../utils";
19
21
  import assert from "assert";
20
22
  import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
@@ -72,7 +74,7 @@ export class QueryBase implements QueryInterface {
72
74
  */
73
75
  async getGasCosts(
74
76
  deposit: Omit<Deposit, "messageHash">,
75
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
77
+ relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
76
78
  options: Partial<{
77
79
  gasPrice: BigNumberish;
78
80
  gasUnits: BigNumberish;
@@ -122,7 +124,7 @@ export class QueryBase implements QueryInterface {
122
124
  */
123
125
  getUnsignedTxFromDeposit(
124
126
  deposit: Omit<Deposit, "messageHash">,
125
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
127
+ relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
126
128
  ): Promise<PopulatedTransaction> {
127
129
  return populateV3Relay(this.spokePool, deposit, relayer);
128
130
  }
@@ -135,10 +137,10 @@ export class QueryBase implements QueryInterface {
135
137
  */
136
138
  async getNativeGasCost(
137
139
  deposit: Omit<Deposit, "messageHash">,
138
- relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
140
+ relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
139
141
  ): Promise<BigNumber> {
140
142
  const unsignedTx = await this.getUnsignedTxFromDeposit(deposit, relayer);
141
- const voidSigner = new VoidSigner(relayer, this.provider);
143
+ const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
142
144
  return voidSigner.estimateGas(unsignedTx);
143
145
  }
144
146
 
@@ -152,7 +154,7 @@ export class QueryBase implements QueryInterface {
152
154
  */
153
155
  async getOpStackL1DataFee(
154
156
  unsignedTx: PopulatedTransaction,
155
- relayer = getDefaultSimulatedRelayerAddress(unsignedTx.chainId),
157
+ relayer = toAddressType(getDefaultSimulatedRelayerAddress(unsignedTx.chainId), unsignedTx.chainId),
156
158
  options: Partial<{
157
159
  opStackL2GasUnits: BigNumberish;
158
160
  opStackL1DataFeeMultiplier: BigNumber;
@@ -161,7 +163,7 @@ export class QueryBase implements QueryInterface {
161
163
  const { opStackL2GasUnits, opStackL1DataFeeMultiplier = toBNWei("1") } = options || {};
162
164
  const { chainId } = await this.provider.getNetwork();
163
165
  assert(isOptimismL2Provider(this.provider), `Unexpected provider for chain ID ${chainId}.`);
164
- const voidSigner = new VoidSigner(relayer, this.provider);
166
+ const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
165
167
  const populatedTransaction = await voidSigner.populateTransaction({
166
168
  ...unsignedTx,
167
169
  gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
@@ -183,7 +185,7 @@ export class QueryBase implements QueryInterface {
183
185
  */
184
186
  async estimateGas(
185
187
  unsignedTx: PopulatedTransaction,
186
- senderAddress: string,
188
+ senderAddress: Address,
187
189
  provider: providers.Provider | L2Provider<providers.Provider>,
188
190
  options: Partial<{
189
191
  gasPrice: BigNumberish;
@@ -204,7 +206,7 @@ export class QueryBase implements QueryInterface {
204
206
  } = options || {};
205
207
 
206
208
  const { chainId } = await provider.getNetwork();
207
- const voidSigner = new VoidSigner(senderAddress, provider);
209
+ const voidSigner = new VoidSigner(senderAddress.toEvmAddress(), provider);
208
210
 
209
211
  // Estimate the Gas units required to submit this transaction.
210
212
  const queries = [
@@ -25,6 +25,7 @@ import {
25
25
  getRelayDataHash,
26
26
  toAddressType,
27
27
  toBN,
28
+ Address,
28
29
  } from "../../utils";
29
30
  import { Logger, QueryInterface, getDefaultSimulatedRelayerAddress } from "../relayFeeCalculator";
30
31
  import { SymbolMappingType } from "./";
@@ -74,7 +75,7 @@ export class SvmQuery implements QueryInterface {
74
75
  */
75
76
  async getGasCosts(
76
77
  deposit: Omit<Deposit, "messageHash">,
77
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
78
+ _relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
78
79
  options: Partial<{
79
80
  gasPrice: BigNumberish;
80
81
  gasUnits: BigNumberish;
@@ -82,8 +83,8 @@ export class SvmQuery implements QueryInterface {
82
83
  priorityFeeMultiplier: BigNumber;
83
84
  }> = {}
84
85
  ): Promise<TransactionCostEstimate> {
85
- const relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
86
- const fillRelayTx = await this.getFillRelayTx(deposit, relayer.toBase58());
86
+ const relayer = _relayer ? _relayer.forceSvmAddress() : this.simulatedRelayerAddress;
87
+ const fillRelayTx = await this.getFillRelayTx(deposit, relayer);
87
88
 
88
89
  const [computeUnitsConsumed, _gasPriceEstimate] = await Promise.all([
89
90
  toBN(await this.computeUnitEstimator(fillRelayTx)),
@@ -116,7 +117,7 @@ export class SvmQuery implements QueryInterface {
116
117
  */
117
118
  async getNativeGasCost(
118
119
  deposit: Omit<Deposit, "messageHash">,
119
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
120
+ _relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId)
120
121
  ): Promise<BigNumber> {
121
122
  const fillRelayTx = await this.getFillRelayTx(deposit, _relayer);
122
123
  return toBN(await this.computeUnitEstimator(fillRelayTx));
@@ -130,35 +131,29 @@ export class SvmQuery implements QueryInterface {
130
131
  */
131
132
  async getFillRelayTx(
132
133
  deposit: Omit<Deposit, "messageHash">,
133
- _relayer = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
134
+ relayer = toAddressType(getDefaultSimulatedRelayerAddress(deposit.destinationChainId), deposit.destinationChainId),
134
135
  repaymentChainId = deposit.destinationChainId,
135
- repaymentAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId)
136
+ repaymentAddress = toAddressType(
137
+ getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
138
+ deposit.destinationChainId
139
+ )
136
140
  ) {
137
- const toSvmAddress = (address: string) => toAddressType(address).forceSvmAddress().toV2Address();
138
- const relayer = _relayer ? toAddressType(_relayer).forceSvmAddress() : this.simulatedRelayerAddress;
141
+ const toSvmAddress = (address: Address) => address.toV2Address();
139
142
  const state = await getStatePda(this.spokePoolAddress.toV2Address());
140
143
  const _relayDataHash = getRelayDataHash(deposit, deposit.destinationChainId);
141
144
  const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
142
145
  const delegate = await getFillRelayDelegatePda(
143
146
  relayDataHash,
144
147
  BigInt(repaymentChainId),
145
- toSvmAddress(repaymentAddress),
148
+ repaymentAddress.toV2Address(),
146
149
  this.spokePoolAddress.toV2Address()
147
150
  );
148
- const mint = toAddressType(deposit.outputToken).forceSvmAddress();
151
+ const mint = deposit.outputToken;
149
152
  const mintInfo = await fetchMint(this.provider, mint.toV2Address());
150
- const recipientAta = await getAssociatedTokenAddress(
151
- toAddressType(deposit.recipient).forceSvmAddress(),
152
- mint,
153
- mintInfo.programAddress
154
- );
155
- const relayerAta = await getAssociatedTokenAddress(
156
- SvmAddress.from(relayer.toBase58()),
157
- mint,
158
- mintInfo.programAddress
159
- );
153
+ const recipientAta = await getAssociatedTokenAddress(deposit.recipient, mint, mintInfo.programAddress);
154
+ const relayerAta = await getAssociatedTokenAddress(relayer, mint, mintInfo.programAddress);
160
155
  const fillStatus = await getFillStatusPda(this.spokePoolAddress.toV2Address(), deposit, deposit.destinationChainId);
161
- const eventAuthority = await getEventAuthority();
156
+ const eventAuthority = await getEventAuthority(this.spokePoolAddress.toV2Address());
162
157
 
163
158
  const relayData: SvmSpokeClient.FillRelayInput["relayData"] = {
164
159
  depositor: toSvmAddress(deposit.depositor),