@across-protocol/sdk 4.2.12 → 4.2.14-alpha.0

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 (194) 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 +19 -14
  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 +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 +53 -61
  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 +5 -3
  39. package/dist/cjs/clients/mocks/MockSpokePoolClient.js +39 -36
  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 +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 +14 -15
  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 +6 -3
  56. package/dist/cjs/utils/AddressUtils.js +42 -14
  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 +4 -22
  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 +5 -2
  65. package/dist/esm/arch/evm/SpokeUtils.js +23 -6
  66. package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
  67. package/dist/esm/arch/svm/SpokeUtils.js +15 -12
  68. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  69. package/dist/esm/arch/svm/utils.d.ts +1 -1
  70. package/dist/esm/arch/svm/utils.js +19 -14
  71. package/dist/esm/arch/svm/utils.js.map +1 -1
  72. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  73. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +4 -2
  74. package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
  75. package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  76. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +61 -57
  77. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  78. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
  79. package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
  80. package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  81. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +4 -3
  82. package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
  83. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +5 -1
  84. package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
  85. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
  86. package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
  87. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +63 -63
  88. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +12 -9
  89. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  90. package/dist/esm/clients/HubPoolClient.d.ts +23 -22
  91. package/dist/esm/clients/HubPoolClient.js +96 -63
  92. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  93. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
  94. package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
  95. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
  96. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +55 -65
  97. package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
  98. package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
  99. package/dist/esm/clients/mocks/MockHubPoolClient.js +16 -10
  100. package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
  101. package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -3
  102. package/dist/esm/clients/mocks/MockSpokePoolClient.js +41 -38
  103. package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
  104. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
  105. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
  106. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
  107. package/dist/esm/interfaces/HubPool.d.ts +19 -14
  108. package/dist/esm/interfaces/SpokePool.d.ts +13 -13
  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 +4 -4
  113. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +15 -16
  114. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  115. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  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 +7 -3
  119. package/dist/esm/utils/AddressUtils.js +52 -19
  120. package/dist/esm/utils/AddressUtils.js.map +1 -1
  121. package/dist/esm/utils/SpokeUtils.d.ts +3 -8
  122. package/dist/esm/utils/SpokeUtils.js +4 -26
  123. package/dist/esm/utils/SpokeUtils.js.map +1 -1
  124. package/dist/esm/utils/TokenUtils.d.ts +18 -16
  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 +5 -2
  128. package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
  129. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  130. package/dist/types/arch/svm/utils.d.ts +1 -1
  131. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  132. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
  133. package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
  134. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +4 -4
  135. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  136. package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
  137. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
  138. package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
  139. package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.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 +23 -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 +2 -2
  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 +5 -3
  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 +19 -14
  155. package/dist/types/interfaces/HubPool.d.ts.map +1 -1
  156. package/dist/types/interfaces/SpokePool.d.ts +13 -13
  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 +4 -4
  161. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  162. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +5 -5
  163. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  164. package/dist/types/utils/AddressUtils.d.ts +7 -3
  165. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  166. package/dist/types/utils/SpokeUtils.d.ts +3 -8
  167. package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
  168. package/dist/types/utils/TokenUtils.d.ts +18 -16
  169. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  170. package/package.json +2 -3
  171. package/src/arch/evm/SpokeUtils.ts +53 -11
  172. package/src/arch/svm/SpokeUtils.ts +44 -11
  173. package/src/arch/svm/utils.ts +9 -4
  174. package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +7 -4
  175. package/src/clients/BundleDataClient/BundleDataClient.ts +54 -52
  176. package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +28 -13
  177. package/src/clients/BundleDataClient/utils/FillUtils.ts +6 -4
  178. package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +7 -1
  179. package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
  180. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +13 -9
  181. package/src/clients/HubPoolClient.ts +122 -82
  182. package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +6 -0
  183. package/src/clients/SpokePoolClient/SpokePoolClient.ts +110 -56
  184. package/src/clients/mocks/MockHubPoolClient.ts +24 -19
  185. package/src/clients/mocks/MockSpokePoolClient.ts +37 -26
  186. package/src/clients/mocks/MockSvmSpokePoolClient.ts +12 -3
  187. package/src/interfaces/HubPool.ts +23 -14
  188. package/src/interfaces/SpokePool.ts +13 -13
  189. package/src/relayFeeCalculator/chain-queries/baseQuery.ts +10 -8
  190. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +16 -21
  191. package/src/relayFeeCalculator/relayFeeCalculator.ts +20 -12
  192. package/src/utils/AddressUtils.ts +56 -21
  193. package/src/utils/SpokeUtils.ts +11 -33
  194. package/src/utils/TokenUtils.ts +7 -7
@@ -1,20 +1,20 @@
1
1
  import { SortableEvent } from "./Common";
2
2
  import { SpokePoolClient } from "../clients";
3
- import { BigNumber } from "../utils";
3
+ import { BigNumber, Address, EvmAddress } from "../utils";
4
4
  import { RelayerRefundLeaf } from "./HubPool";
5
5
 
6
6
  export interface RelayData {
7
7
  originChainId: number;
8
- depositor: string;
9
- recipient: string;
8
+ depositor: Address;
9
+ recipient: Address;
10
10
  depositId: BigNumber;
11
- inputToken: string;
11
+ inputToken: Address;
12
12
  inputAmount: BigNumber;
13
- outputToken: string;
13
+ outputToken: Address;
14
14
  outputAmount: BigNumber;
15
15
  message: string;
16
16
  fillDeadline: number;
17
- exclusiveRelayer: string;
17
+ exclusiveRelayer: Address;
18
18
  exclusivityDeadline: number;
19
19
  }
20
20
 
@@ -23,7 +23,7 @@ export interface Deposit extends RelayData {
23
23
  destinationChainId: number;
24
24
  quoteTimestamp: number;
25
25
  speedUpSignature?: string;
26
- updatedRecipient?: string;
26
+ updatedRecipient?: Address;
27
27
  updatedOutputAmount?: BigNumber;
28
28
  updatedMessage?: string;
29
29
  fromLiteChain: boolean;
@@ -51,7 +51,7 @@ export enum FillType {
51
51
  }
52
52
 
53
53
  export interface RelayExecutionEventInfo {
54
- updatedRecipient: string;
54
+ updatedRecipient: Address;
55
55
  updatedOutputAmount: BigNumber;
56
56
  updatedMessage?: string;
57
57
  updatedMessageHash: string;
@@ -61,7 +61,7 @@ export interface RelayExecutionEventInfo {
61
61
  export interface Fill extends Omit<RelayData, "message"> {
62
62
  messageHash: string;
63
63
  destinationChainId: number;
64
- relayer: string;
64
+ relayer: Address;
65
65
  repaymentChainId: number;
66
66
  relayExecutionInfo: RelayExecutionEventInfo;
67
67
  }
@@ -72,18 +72,18 @@ export interface FillWithTime extends Fill, SortableEvent {
72
72
  }
73
73
 
74
74
  export interface EnabledDepositRoute {
75
- originToken: string;
75
+ originToken: Address;
76
76
  destinationChainId: number;
77
77
  enabled: boolean;
78
78
  }
79
79
 
80
80
  export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
81
81
  export interface SpeedUp {
82
- depositor: string;
82
+ depositor: EvmAddress;
83
83
  depositorSignature: string;
84
84
  depositId: BigNumber;
85
85
  originChainId: number;
86
- updatedRecipient: string;
86
+ updatedRecipient: Address;
87
87
  updatedOutputAmount: BigNumber;
88
88
  updatedMessage: string;
89
89
  }
@@ -130,7 +130,7 @@ export interface TokensBridged extends SortableEvent {
130
130
  amountToReturn: BigNumber;
131
131
  chainId: number;
132
132
  leafId: number;
133
- l2TokenAddress: string;
133
+ l2TokenAddress: Address;
134
134
  }
135
135
 
136
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),
@@ -9,12 +9,9 @@ import { Deposit } from "../interfaces";
9
9
  import {
10
10
  BigNumber,
11
11
  BigNumberish,
12
- ConvertDecimals,
13
12
  MAX_BIG_INT,
14
13
  TransactionCostEstimate,
15
14
  bnZero,
16
- chainIsSvm,
17
- compareAddressesSimple,
18
15
  fixedPointAdjustment,
19
16
  getTokenInfo,
20
17
  isDefined,
@@ -25,13 +22,18 @@ import {
25
22
  percent,
26
23
  toBN,
27
24
  toBNWei,
25
+ compareAddressesSimple,
26
+ ConvertDecimals,
27
+ chainIsSvm,
28
+ toAddressType,
29
+ Address,
28
30
  } from "../utils";
29
31
 
30
32
  // This needs to be implemented for every chain and passed into RelayFeeCalculator
31
33
  export interface QueryInterface {
32
34
  getGasCosts: (
33
35
  deposit: Omit<Deposit, "messageHash">,
34
- relayer: string,
36
+ relayer: Address,
35
37
  options?: Partial<{
36
38
  gasPrice: BigNumberish;
37
39
  gasUnits: BigNumberish;
@@ -42,7 +44,7 @@ export interface QueryInterface {
42
44
  }>
43
45
  ) => Promise<TransactionCostEstimate>;
44
46
  getTokenPrice: (tokenSymbol: string) => Promise<number>;
45
- getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: string) => Promise<BigNumber>;
47
+ getNativeGasCost: (deposit: Omit<Deposit, "messageHash">, relayer: Address) => Promise<BigNumber>;
46
48
  }
47
49
 
48
50
  export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
@@ -254,7 +256,10 @@ export class RelayFeeCalculator {
254
256
  deposit: Deposit,
255
257
  outputAmount: BigNumberish,
256
258
  simulateZeroFill = false,
257
- relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
259
+ relayerAddress = toAddressType(
260
+ getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
261
+ deposit.destinationChainId
262
+ ),
258
263
  _tokenPrice?: number,
259
264
  tokenMapping = TOKEN_SYMBOLS_MAP,
260
265
  gasPrice?: BigNumberish,
@@ -271,14 +276,14 @@ export class RelayFeeCalculator {
271
276
  // undefined address on destination.
272
277
  const destinationChainTokenDetails = Object.values(tokenMapping).find(
273
278
  (details) =>
274
- compareAddressesSimple(details.addresses[originChainId], inputToken) &&
279
+ compareAddressesSimple(details.addresses[originChainId], inputToken.toAddress()) &&
275
280
  isDefined(details.addresses[destinationChainId])
276
281
  );
277
282
  const outputToken = isZeroAddress(deposit.outputToken)
278
283
  ? destinationChainTokenDetails!.addresses[destinationChainId]
279
- : deposit.outputToken;
284
+ : deposit.outputToken.toAddress();
280
285
  const outputTokenInfo = getTokenInfo(outputToken, destinationChainId, tokenMapping);
281
- const inputTokenInfo = getTokenInfo(inputToken, originChainId, tokenMapping);
286
+ const inputTokenInfo = getTokenInfo(inputToken.toAddress(), originChainId, tokenMapping);
282
287
  if (!isDefined(outputTokenInfo) || !isDefined(inputTokenInfo)) {
283
288
  throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
284
289
  }
@@ -493,7 +498,10 @@ export class RelayFeeCalculator {
493
498
  deposit: Deposit,
494
499
  outputAmount?: BigNumberish,
495
500
  simulateZeroFill = false,
496
- relayerAddress = getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
501
+ relayerAddress = toAddressType(
502
+ getDefaultSimulatedRelayerAddress(deposit.destinationChainId),
503
+ deposit.destinationChainId
504
+ ),
497
505
  _tokenPrice?: number,
498
506
  gasPrice?: BigNumberish,
499
507
  gasUnits?: BigNumberish,
@@ -505,8 +513,8 @@ export class RelayFeeCalculator {
505
513
  const { inputToken, originChainId, outputToken, destinationChainId } = deposit;
506
514
  // We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
507
515
  // resolve the L1 token symbol and not the L2 token decimals.
508
- const inputTokenInfo = getTokenInfo(inputToken, originChainId);
509
- const outputTokenInfo = getTokenInfo(outputToken, destinationChainId);
516
+ const inputTokenInfo = getTokenInfo(inputToken.toAddress(), originChainId);
517
+ const outputTokenInfo = getTokenInfo(outputToken.toAddress(), destinationChainId);
510
518
  if (!isDefined(inputTokenInfo) || !isDefined(outputTokenInfo)) {
511
519
  throw new Error(`Could not find token information for ${inputToken} or ${outputToken}`);
512
520
  }
@@ -1,7 +1,8 @@
1
1
  import { providers, utils } from "ethers";
2
+ import assert from "assert";
2
3
  import bs58 from "bs58";
3
4
  import { Address as V2Address } from "@solana/kit";
4
- import { BigNumber, chainIsEvm } from "./";
5
+ import { BigNumber, chainIsEvm, isDefined } from "./";
5
6
 
6
7
  /**
7
8
  * Checks if a contract is deployed at the given address
@@ -75,20 +76,39 @@ export function isValidEvmAddress(address: string): boolean {
75
76
  * Creates the proper address type given the input chain ID corresponding to the address's origin network.
76
77
  * @param address Stringified address type to convert. Can be either hex encoded or base58 encoded.
77
78
  * @param chainId Network ID corresponding to the input address, used to determine which address type to output.
79
+ * If no chain ID is specified, then fallback to inference via the structure of the address string.
78
80
  * @returns a child `Address` type most fitting for the chain ID.
79
81
  * @todo: Change this to `toAddress` once we remove the other `toAddress` function.
80
82
  */
81
- export function toAddressType(address: string): Address | EvmAddress | SvmAddress {
82
- try {
83
- if (utils.isHexString(address)) {
84
- return EvmAddress.from(address);
83
+ export function toAddressType(address: string, chainId?: number): Address | EvmAddress | SvmAddress {
84
+ const parseAddress = (address: string) => {
85
+ try {
86
+ if (utils.isHexString(address)) {
87
+ return EvmAddress.from(address);
88
+ }
89
+ return SvmAddress.from(address);
90
+ } catch (e) {
91
+ // 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
92
+ // return an unchecked address type.
93
+ assert(utils.isHexString(address));
94
+ assert(utils.hexDataLength(address) === 32);
95
+ return Address.__unsafeConstruct(utils.arrayify(address));
96
+ }
97
+ };
98
+ // If there is no network ID, then infer the address by the string format.
99
+ const addressType = parseAddress(address);
100
+ if (!isDefined(chainId)) {
101
+ return addressType;
102
+ }
103
+ // Wrap this in a try/catch in case we are trying to force an invalid EVM address to an EvmAddress type.
104
+ if (chainIsEvm(chainId)) {
105
+ try {
106
+ return addressType.forceEvmAddress();
107
+ } catch {
108
+ return addressType;
85
109
  }
86
- return SvmAddress.from(address);
87
- } catch (e) {
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
89
- // return an unchecked address type.
90
- return new Address(utils.arrayify(address));
91
110
  }
111
+ return addressType.forceSvmAddress();
92
112
  }
93
113
 
94
114
  // The Address class can contain any address type. It is up to the subclasses to determine how to format the address's internal representation,
@@ -113,12 +133,24 @@ export class Address {
113
133
  this.rawAddress = utils.zeroPad(_rawAddress, 32);
114
134
  }
115
135
 
136
+ static __unsafeConstruct(_rawAddress: Uint8Array): Address {
137
+ return new this(_rawAddress);
138
+ }
139
+
116
140
  // 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
117
141
  // throw since address length validation was done at construction time.
118
142
  toBytes32(): string {
119
143
  return (this.bytes32Address ??= utils.hexZeroPad(utils.hexlify(this.rawAddress), 32).toLowerCase());
120
144
  }
121
145
 
146
+ // 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
147
+ // that contain truncated `address` type as one of the fields
148
+ truncateToBytes20(): string {
149
+ // Take the last 20 bytes
150
+ const bytes20 = this.rawAddress.slice(-20);
151
+ return toAddress(utils.hexlify(bytes20));
152
+ }
153
+
122
154
  // 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,
123
155
  // as this address may be needed to represent an EVM address on Solana.
124
156
  toBase58(): string {
@@ -160,7 +192,7 @@ export class Address {
160
192
  // Checks if this address can be coerced into a bytes20 evm address. Returns true if it is possible and false otherwise.
161
193
  isValidEvmAddress(): boolean {
162
194
  try {
163
- this.toAddress();
195
+ this.toEvmAddress();
164
196
  return true;
165
197
  } catch {
166
198
  return false;
@@ -191,6 +223,11 @@ export class Address {
191
223
  return utils.stripZeros(this.rawAddress).length === 0;
192
224
  }
193
225
 
226
+ // Small utility to convert an Address to a Solana Kit branded type.
227
+ toV2Address(): V2Address<string> {
228
+ return this.toBase58() as V2Address<string>;
229
+ }
230
+
194
231
  // Forces `rawAddress` to become an SvmAddress type. This will only throw if `rawAddress.length > 32`.
195
232
  forceSvmAddress(): SvmAddress {
196
233
  return SvmAddress.from(this.toBase58());
@@ -220,6 +257,14 @@ export class Address {
220
257
  return 0;
221
258
  }
222
259
  }
260
+
261
+ static isEvmAddress(address: Address): boolean {
262
+ return address instanceof EvmAddress;
263
+ }
264
+
265
+ static isSvmAddress(address: Address): boolean {
266
+ return address instanceof SvmAddress;
267
+ }
223
268
  }
224
269
 
225
270
  // Subclass of address which strictly deals with 20-byte addresses. These addresses are guaranteed to be valid EVM addresses, so `toAddress` will always succeed.
@@ -269,16 +314,6 @@ export class SvmAddress extends Address {
269
314
  return this.toBase58();
270
315
  }
271
316
 
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
-
282
317
  // Constructs a new SvmAddress type.
283
318
  static from(address: string, encoding: "base58" | "base16" = "base58"): SvmAddress {
284
319
  if (encoding === "base58") {
@@ -1,9 +1,9 @@
1
1
  import { encodeAbiParameters, Hex, keccak256 } from "viem";
2
2
  import { fixedPointAdjustment as fixedPoint } from "./common";
3
- import { MAX_SAFE_DEPOSIT_ID, ZERO_ADDRESS, ZERO_BYTES } from "../constants";
4
- import { Deposit, Fill, FillType, RelayData, SlowFillLeaf } from "../interfaces";
5
- import { toBytes32 } from "./AddressUtils";
3
+ import { MAX_SAFE_DEPOSIT_ID, ZERO_BYTES } from "../constants";
4
+ import { Fill, FillType, RelayData, SlowFillLeaf } from "../interfaces";
6
5
  import { BigNumber } from "./BigNumberUtils";
6
+ import { Address } from "./AddressUtils";
7
7
  import { isMessageEmpty } from "./DepositUtils";
8
8
  import { chainIsSvm } from "./NetworkUtils";
9
9
  import { svm } from "../arch";
@@ -16,28 +16,6 @@ export function getSlowFillLeafLpFeePct(leaf: SlowFillLeaf): BigNumber {
16
16
  const { relayData, updatedOutputAmount } = leaf;
17
17
  return relayData.inputAmount.sub(updatedOutputAmount).mul(fixedPoint).div(relayData.inputAmount);
18
18
  }
19
- /**
20
- * Produce the RelayData for a Deposit.
21
- * @param deposit Deposit instance.
22
- * @returns The corresponding RelayData object.
23
- */
24
- export function getDepositRelayData(deposit: Omit<Deposit, "messageHash">): RelayData {
25
- return {
26
- depositor: toBytes32(deposit.depositor),
27
- recipient: toBytes32(deposit.recipient),
28
- exclusiveRelayer: toBytes32(deposit.exclusiveRelayer),
29
- inputToken: toBytes32(deposit.inputToken),
30
- outputToken: toBytes32(deposit.outputToken),
31
- inputAmount: deposit.inputAmount,
32
- outputAmount: deposit.outputAmount,
33
- originChainId: deposit.originChainId,
34
- depositId: deposit.depositId,
35
- fillDeadline: deposit.fillDeadline,
36
- exclusivityDeadline: deposit.exclusivityDeadline,
37
- message: deposit.message,
38
- };
39
- }
40
-
41
19
  /**
42
20
  * Compute the RelayData hash for a fill. This can be used to determine the fill status.
43
21
  * @param relayData RelayData information that is used to complete a fill.
@@ -68,14 +46,14 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
68
46
 
69
47
  const _relayData = {
70
48
  ...relayData,
71
- depositor: toBytes32(relayData.depositor),
72
- recipient: toBytes32(relayData.recipient),
73
- inputToken: toBytes32(relayData.inputToken),
74
- outputToken: toBytes32(relayData.outputToken),
75
- exclusiveRelayer: toBytes32(relayData.exclusiveRelayer),
49
+ depositor: relayData.depositor.toBytes32(),
50
+ recipient: relayData.recipient.toBytes32(),
51
+ inputToken: relayData.inputToken.toBytes32(),
52
+ outputToken: relayData.outputToken.toBytes32(),
53
+ exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(),
76
54
  };
77
55
  if (chainIsSvm(destinationChainId)) {
78
- return svm.getRelayDataHash(_relayData, destinationChainId);
56
+ return svm.getRelayDataHash(relayData, destinationChainId);
79
57
  }
80
58
  return keccak256(encodeAbiParameters(abi, [_relayData, destinationChainId]));
81
59
  }
@@ -95,8 +73,8 @@ export function isUnsafeDepositId(depositId: BigNumber): boolean {
95
73
  }
96
74
 
97
75
  // Determines if the input address (either a bytes32 or bytes20) is the zero address.
98
- export function isZeroAddress(address: string): boolean {
99
- return address === ZERO_ADDRESS || address === ZERO_BYTES;
76
+ export function isZeroAddress(address: Address): boolean {
77
+ return address.toBytes32() === ZERO_BYTES;
100
78
  }
101
79
 
102
80
  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 { L1Token } from "../interfaces";
4
+ import { TokenInfo } 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<L1Token> {
14
+ export async function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<TokenInfo> {
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, symbol, decimals };
17
+ return { address: toAddressType(address).forceEvmAddress(), 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): L1Token {
36
+ export function resolveSymbolOnChain(chainId: number, symbol: string): TokenInfo {
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): L1Token {
44
44
  const { decimals, addresses } = token;
45
45
  const address = addresses[chainId];
46
46
 
47
- return { symbol, decimals, address };
47
+ return { symbol, decimals, address: toAddressType(address, chainId) };
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): L1Token {
114
+ export function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping = TOKEN_SYMBOLS_MAP): TokenInfo {
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: l2TokenAddress,
131
+ address: toAddressType(l2TokenAddress, chainId),
132
132
  symbol: tokenObject.symbol,
133
133
  decimals: tokenObject.decimals,
134
134
  };