@across-protocol/contracts 5.0.28 → 5.1.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 (212) hide show
  1. package/dist/evm/artifacts/AcrossConfigStore.sol/AcrossConfigStore.json +1 -1
  2. package/dist/evm/artifacts/AcrossEventEmitter.sol/AcrossEventEmitter.json +1 -1
  3. package/dist/evm/artifacts/AcrossMerkleDistributor.sol/AcrossMerkleDistributor.json +1 -1
  4. package/dist/evm/artifacts/AcrossMessageHandlerMock.sol/AcrossMessageHandlerMock.json +1 -1
  5. package/dist/evm/artifacts/AdapterStore.sol/AdapterStore.json +1 -1
  6. package/dist/evm/artifacts/AdapterStore.sol/MessengerTypes.json +1 -1
  7. package/dist/evm/artifacts/Address.sol/Address.json +1 -1
  8. package/dist/evm/artifacts/AddressConverters.sol/Bytes32ToAddress.json +1 -1
  9. package/dist/evm/artifacts/AdminRelayTokensAdapter.sol/AdminRelayTokensAdapter.json +1 -1
  10. package/dist/evm/artifacts/AdminWithdrawManager.sol/AdminWithdrawManager.json +1 -1
  11. package/dist/evm/artifacts/ArbitrumMocks.sol/ArbitrumMockErc20GatewayRouter.json +1 -1
  12. package/dist/evm/artifacts/ArbitrumMocks.sol/Inbox.json +1 -1
  13. package/dist/evm/artifacts/ArbitrumMocks.sol/L2GatewayRouter.json +1 -1
  14. package/dist/evm/artifacts/Arbitrum_Adapter.sol/Arbitrum_Adapter.json +1 -1
  15. package/dist/evm/artifacts/Arbitrum_CustomGasToken_Adapter.sol/Arbitrum_CustomGasToken_Adapter.json +1 -1
  16. package/dist/evm/artifacts/Arbitrum_Forwarder.sol/Arbitrum_Forwarder.json +1 -1
  17. package/dist/evm/artifacts/Arbitrum_RescueAdapter.sol/Arbitrum_RescueAdapter.json +1 -1
  18. package/dist/evm/artifacts/Arbitrum_SendTokensAdapter.sol/Arbitrum_SendTokensAdapter.json +1 -1
  19. package/dist/evm/artifacts/Arbitrum_SpokePool.sol/Arbitrum_SpokePool.json +1 -1
  20. package/dist/evm/artifacts/Arbitrum_WithdrawalHelper.sol/Arbitrum_WithdrawalHelper.json +1 -1
  21. package/dist/evm/artifacts/Base_Adapter.sol/Base_Adapter.json +1 -1
  22. package/dist/evm/artifacts/BeaconProxy.sol/BeaconProxy.json +1 -1
  23. package/dist/evm/artifacts/BondToken.sol/BondToken.json +1 -1
  24. package/dist/evm/artifacts/BytesLib.sol/BytesLib.json +1 -1
  25. package/dist/evm/artifacts/Cher_SpokePool.sol/Cher_SpokePool.json +1 -1
  26. package/dist/evm/artifacts/CircleCCTPAdapter.sol/CircleDomainIds.json +1 -1
  27. package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
  28. package/dist/evm/artifacts/Constants.sol/OptimisticOracleConstraints.json +1 -1
  29. package/dist/evm/artifacts/Constants.sol/OracleInterfaces.json +1 -1
  30. package/dist/evm/artifacts/CoreExecution.sol/CoreExecution.json +1 -1
  31. package/dist/evm/artifacts/CoreSimulatorLib.sol/HypeSystemContract.json +1 -1
  32. package/dist/evm/artifacts/CoreState.sol/CoreState.json +1 -1
  33. package/dist/evm/artifacts/CoreView.sol/CoreView.json +1 -1
  34. package/dist/evm/artifacts/CoreWriterLib.sol/CoreWriterLib.json +1 -1
  35. package/dist/evm/artifacts/CoreWriterSim.sol/CoreWriterSim.json +1 -1
  36. package/dist/evm/artifacts/CounterfactualBeacon.sol/CounterfactualBeacon.json +1 -1
  37. package/dist/evm/artifacts/CounterfactualBeaconBootstrap.sol/CounterfactualBeaconBootstrap.json +1 -1
  38. package/dist/evm/artifacts/CounterfactualDeposit.sol/CounterfactualDeposit.json +1 -1
  39. package/dist/evm/artifacts/CounterfactualDepositCCTP.sol/CounterfactualDepositCCTP.json +1 -1
  40. package/dist/evm/artifacts/CounterfactualDepositFactory.sol/CounterfactualDepositFactory.json +1 -1
  41. package/dist/evm/artifacts/CounterfactualDepositFactoryTron.sol/CounterfactualDepositFactoryTron.json +1 -1
  42. package/dist/evm/artifacts/CounterfactualDepositOFT.sol/CounterfactualDepositOFT.json +1 -1
  43. package/dist/evm/artifacts/CounterfactualDepositSpokePool.sol/CounterfactualDepositSpokePool.json +1 -1
  44. package/dist/evm/artifacts/CounterfactualDepositSpokePoolTr.sol/CounterfactualDepositSpokePoolTr.json +1 -1
  45. package/dist/evm/artifacts/CounterfactualDepositVanillaCCTP.sol/CounterfactualDepositVanillaCCTP.json +1 -1
  46. package/dist/evm/artifacts/Create2.sol/Create2.json +1 -1
  47. package/dist/evm/artifacts/CrossDomainEnabled.sol/CrossDomainEnabled.json +1 -1
  48. package/dist/evm/artifacts/DeployedAddresses.sol/DeployedAddresses.json +1 -1
  49. package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
  50. package/dist/evm/artifacts/DoctorWho_Adapter.sol/DoctorWho_Adapter.json +1 -1
  51. package/dist/evm/artifacts/DonationBox.sol/DonationBox.json +1 -1
  52. package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
  53. package/dist/evm/artifacts/ECDSA.sol/ECDSA.json +1 -1
  54. package/dist/evm/artifacts/ERC1155.sol/ERC1155.json +1 -1
  55. package/dist/evm/artifacts/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
  56. package/dist/evm/artifacts/ERC1967Utils.sol/ERC1967Utils.json +1 -1
  57. package/dist/evm/artifacts/ERC20.sol/ERC20.json +1 -1
  58. package/dist/evm/artifacts/Errors.sol/Errors.json +1 -1
  59. package/dist/evm/artifacts/Ethereum_Adapter.sol/Ethereum_Adapter.json +1 -1
  60. package/dist/evm/artifacts/Ethereum_RescueAdapter.sol/Ethereum_RescueAdapter.json +1 -1
  61. package/dist/evm/artifacts/Ethereum_SpokePool.sol/Ethereum_SpokePool.json +1 -1
  62. package/dist/evm/artifacts/ExpandedERC20.sol/ExpandedERC20.json +1 -1
  63. package/dist/evm/artifacts/ExpandedERC20WithBlacklist.sol/ExpandedERC20WithBlacklist.json +1 -1
  64. package/dist/evm/artifacts/HLConstants.sol/HLConstants.json +1 -1
  65. package/dist/evm/artifacts/HLConversions.sol/HLConversions.json +1 -1
  66. package/dist/evm/artifacts/HubPool.sol/HubPool.json +1 -1
  67. package/dist/evm/artifacts/HubPoolStore.sol/HubPoolStore.json +1 -1
  68. package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
  69. package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
  70. package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
  71. package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
  72. package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
  73. package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
  74. package/dist/evm/artifacts/HyperCore.sol/HyperCore.json +1 -1
  75. package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
  76. package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
  77. package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
  78. package/dist/evm/artifacts/Lens_SpokePool.sol/Lens_SpokePool.json +1 -1
  79. package/dist/evm/artifacts/LibVariable.sol/LibVariable.json +1 -1
  80. package/dist/evm/artifacts/LineaMocks.sol/MockL2MessageService.json +1 -1
  81. package/dist/evm/artifacts/LineaMocks.sol/MockL2TokenBridge.json +1 -1
  82. package/dist/evm/artifacts/Linea_Adapter.sol/Linea_Adapter.json +1 -1
  83. package/dist/evm/artifacts/Linea_SpokePool.sol/Linea_SpokePool.json +1 -1
  84. package/dist/evm/artifacts/Lisk_Adapter.sol/Lisk_Adapter.json +1 -1
  85. package/dist/evm/artifacts/Lisk_SpokePool.sol/Lisk_SpokePool.json +1 -1
  86. package/dist/evm/artifacts/Lockable.sol/Lockable.json +1 -1
  87. package/dist/evm/artifacts/LpTokenFactory.sol/LpTokenFactory.json +1 -1
  88. package/dist/evm/artifacts/Merkle.sol/Merkle.json +1 -1
  89. package/dist/evm/artifacts/MerkleDistributor.sol/MerkleDistributor.json +1 -1
  90. package/dist/evm/artifacts/MerkleLibTest.sol/MerkleLibTest.json +1 -1
  91. package/dist/evm/artifacts/MerkleProof.sol/MerkleProof.json +1 -1
  92. package/dist/evm/artifacts/MinimalLZOptions.sol/MinimalLZOptions.json +1 -1
  93. package/dist/evm/artifacts/MintableERC1155.sol/MintableERC1155.json +1 -1
  94. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockCrossDomainMessenger.json +1 -1
  95. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL1StandardBridge.json +1 -1
  96. package/dist/evm/artifacts/MockBedrockStandardBridge.sol/MockBedrockL2StandardBridge.json +1 -1
  97. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitter.json +1 -1
  98. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessageTransmitterV2.json +1 -1
  99. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessenger.json +1 -1
  100. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMessengerV2.json +1 -1
  101. package/dist/evm/artifacts/MockCCTP.sol/MockCCTPMinter.json +1 -1
  102. package/dist/evm/artifacts/MockCaller.sol/MockCaller.json +1 -1
  103. package/dist/evm/artifacts/MockERC1271.sol/MockERC1271.json +1 -1
  104. package/dist/evm/artifacts/MockERC20.sol/MintableERC20.json +1 -1
  105. package/dist/evm/artifacts/MockERC20.sol/MockERC20.json +1 -1
  106. package/dist/evm/artifacts/MockEndpoint.sol/MockEndpoint.json +1 -1
  107. package/dist/evm/artifacts/MockGateway.sol/MockGateway.json +1 -1
  108. package/dist/evm/artifacts/MockHubPool.sol/MockHubPool.json +1 -1
  109. package/dist/evm/artifacts/MockOFTMessenger.sol/MockOFTMessenger.json +1 -1
  110. package/dist/evm/artifacts/MockPermit2.sol/MockPermit2.json +1 -1
  111. package/dist/evm/artifacts/MockPermit2.sol/Permit2EIP712.json +1 -1
  112. package/dist/evm/artifacts/MockPermit2.sol/SignatureVerification.json +1 -1
  113. package/dist/evm/artifacts/MockSpokePool.sol/MockSpokePool.json +1 -1
  114. package/dist/evm/artifacts/MockSpokePoolV2.sol/MockSpokePoolV2.json +1 -1
  115. package/dist/evm/artifacts/MockTronUSDT.sol/MockTronUSDT.json +1 -1
  116. package/dist/evm/artifacts/MockZkStackBridgeHub.sol/MockBridgeHub.json +1 -1
  117. package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Adapter.json +1 -1
  118. package/dist/evm/artifacts/Mock_Adapter.sol/Mock_Bridge.json +1 -1
  119. package/dist/evm/artifacts/Mode_Adapter.sol/Mode_Adapter.json +1 -1
  120. package/dist/evm/artifacts/MultiCaller.sol/MultiCaller.json +1 -1
  121. package/dist/evm/artifacts/MultiCallerUpgradeable.sol/MultiCallerUpgradeable.json +1 -1
  122. package/dist/evm/artifacts/Multicall3.sol/Multicall3.json +1 -1
  123. package/dist/evm/artifacts/MulticallHandler.sol/MulticallHandler.json +1 -1
  124. package/dist/evm/artifacts/OFTTransportAdapter.sol/OFTTransportAdapter.json +1 -1
  125. package/dist/evm/artifacts/OFTTransportAdapterWithStore.sol/OFTTransportAdapterWithStore.json +1 -1
  126. package/dist/evm/artifacts/OP_Adapter.sol/OP_Adapter.json +1 -1
  127. package/dist/evm/artifacts/OP_SpokePool.sol/OP_SpokePool.json +1 -1
  128. package/dist/evm/artifacts/Ovm_Forwarder.sol/Ovm_Forwarder.json +1 -1
  129. package/dist/evm/artifacts/Ovm_SpokePool.sol/Ovm_SpokePool.json +1 -1
  130. package/dist/evm/artifacts/Ovm_WithdrawalHelper.sol/Ovm_WithdrawalHelper.json +1 -1
  131. package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
  132. package/dist/evm/artifacts/PermissionedMulticallHandler.sol/PermissionedMulticallHandler.json +1 -1
  133. package/dist/evm/artifacts/PolygonERC20Test.sol/PolygonERC20Test.json +1 -1
  134. package/dist/evm/artifacts/PolygonMocks.sol/DepositManagerMock.json +1 -1
  135. package/dist/evm/artifacts/PolygonMocks.sol/FxStateSenderMock.json +1 -1
  136. package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20Mock.json +1 -1
  137. package/dist/evm/artifacts/PolygonMocks.sol/PolygonERC20PredicateMock.json +1 -1
  138. package/dist/evm/artifacts/PolygonMocks.sol/PolygonRegistryMock.json +1 -1
  139. package/dist/evm/artifacts/PolygonMocks.sol/RootChainManagerMock.json +1 -1
  140. package/dist/evm/artifacts/PolygonTokenBridger.sol/PolygonTokenBridger.json +1 -1
  141. package/dist/evm/artifacts/Polygon_Adapter.sol/Polygon_Adapter.json +1 -1
  142. package/dist/evm/artifacts/Polygon_SpokePool.sol/Polygon_SpokePool.json +1 -1
  143. package/dist/evm/artifacts/PrecompileLib.sol/PrecompileLib.json +1 -1
  144. package/dist/evm/artifacts/PrecompileSim.sol/PrecompileSim.json +1 -1
  145. package/dist/evm/artifacts/ProxyAdmin.sol/ProxyAdmin.json +1 -1
  146. package/dist/evm/artifacts/Router_Adapter.sol/Router_Adapter.json +1 -1
  147. package/dist/evm/artifacts/SP1AutoVerifier.sol/SP1AutoVerifier.json +1 -1
  148. package/dist/evm/artifacts/SP1Helios.sol/SP1Helios.json +1 -1
  149. package/dist/evm/artifacts/SP1MockVerifier.sol/SP1MockVerifier.json +1 -1
  150. package/dist/evm/artifacts/SafeCast.sol/SafeCast.json +1 -1
  151. package/dist/evm/artifacts/SafeERC20.sol/SafeERC20.json +1 -1
  152. package/dist/evm/artifacts/ShortStrings.sol/ShortStrings.json +1 -1
  153. package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
  154. package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
  155. package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
  156. package/dist/evm/artifacts/SpokePoolVerifier.sol/SpokePoolVerifier.json +1 -1
  157. package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
  158. package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
  159. package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
  160. package/dist/evm/artifacts/StdConfig.sol/StdConfig.json +1 -1
  161. package/dist/evm/artifacts/Strings.sol/Strings.json +1 -1
  162. package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
  163. package/dist/evm/artifacts/Timer.sol/Timer.json +1 -1
  164. package/dist/evm/artifacts/TransferProxy.sol/TransferProxy.json +1 -1
  165. package/dist/evm/artifacts/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +1 -1
  166. package/dist/evm/artifacts/TronMulticallHandler.sol/TronMulticallHandler.json +1 -1
  167. package/dist/evm/artifacts/TronTransferLib.sol/TronTransferLib.json +1 -1
  168. package/dist/evm/artifacts/Tron_SpokePool.sol/Tron_SpokePool.json +1 -1
  169. package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -1
  170. package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -1
  171. package/dist/evm/artifacts/Universal_Adapter.sol/Universal_Adapter.json +1 -1
  172. package/dist/evm/artifacts/Universal_SpokePool.sol/Universal_SpokePool.json +1 -1
  173. package/dist/evm/artifacts/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -1
  174. package/dist/evm/artifacts/WETH9.sol/WETH9.json +1 -1
  175. package/dist/evm/artifacts/WithdrawImplementation.sol/WithdrawImplementation.json +1 -1
  176. package/dist/evm/artifacts/WithdrawImplementationTron.sol/WithdrawImplementationTron.json +1 -1
  177. package/dist/evm/artifacts/ZkStack_Adapter.sol/ZkStack_Adapter.json +1 -1
  178. package/dist/evm/artifacts/ZkStack_CustomGasToken_Adapter.sol/ZkStack_CustomGasToken_Adapter.json +1 -1
  179. package/dist/evm/artifacts/ZkSyncMocks.sol/MockL2Eth.json +1 -1
  180. package/dist/evm/artifacts/ZkSyncMocks.sol/MockZkBridge.json +1 -1
  181. package/dist/evm/artifacts/ZkSync_SpokePool.sol/ZkSync_SpokePool.json +1 -1
  182. package/dist/evm/artifacts/Zora_Adapter.sol/Zora_Adapter.json +1 -1
  183. package/dist/evm/artifacts/eraVM_EIP7702.sol/SimpleContract.json +1 -1
  184. package/dist/evm/artifacts/eraVM_EIP7702.sol/SpokePoolEIP7702Test.json +1 -1
  185. package/dist/evm/artifacts/eraVM_EIP7702.sol/TestableMockSpokePool.json +1 -1
  186. package/dist/src/DeploymentUtils.d.ts +1 -1
  187. package/dist/src/svm/assets/idl/sponsored_cctp_src_periphery.json +6 -46
  188. package/dist/src/svm/assets/sponsored_cctp_src_periphery.d.ts +6 -46
  189. package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.d.ts +7 -23
  190. package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.js +10 -34
  191. package/dist/src/svm/web3-v1/cctpHelpers.d.ts +1 -1
  192. package/dist/src/svm/web3-v1/cctpHelpers.js +2 -0
  193. package/dist/src/svm/web3-v1/cctpV2Helpers.d.ts +6 -6
  194. package/dist/src/svm/web3-v1/cctpV2Helpers.js +4 -6
  195. package/dist/src/svm/web3-v1/constants.d.ts +1 -1
  196. package/dist/src/svm/web3-v1/constants.js +2 -5
  197. package/dist/src/svm/web3-v1/conversionUtils.d.ts +7 -4
  198. package/dist/src/svm/web3-v1/conversionUtils.js +37 -16
  199. package/dist/src/svm/web3-v1/helpers.d.ts +1 -2
  200. package/dist/src/svm/web3-v1/helpers.js +4 -6
  201. package/dist/src/svm/web3-v1/relayHashUtils.d.ts +5 -4
  202. package/dist/src/svm/web3-v1/relayHashUtils.js +38 -25
  203. package/dist/src/svm/web3-v1/solanaProgramUtils.js +2 -3
  204. package/dist/src/svm/web3-v1/transactionUtils.js +2 -2
  205. package/dist/src/svm/web3-v2/solanaProgramUtils.js +3 -3
  206. package/dist/src/types/svm.d.ts +6 -7
  207. package/dist/utils/MerkleTree.js +3 -4
  208. package/package.json +46 -37
  209. package/dist/src/consts.d.ts +0 -51
  210. package/dist/src/consts.js +0 -342
  211. package/dist/utils/utils.d.ts +0 -28
  212. package/dist/utils/utils.js +0 -136
@@ -29,6 +29,6 @@ export declare function getDeployedBlockNumber(contractName: string, networkId:
29
29
  * Returns the chainId and contract name for a given contract address.
30
30
  */
31
31
  export declare function getContractInfoFromAddress(contractAddress: string): {
32
- chainId: Number;
32
+ chainId: number;
33
33
  contractName: string;
34
34
  };
@@ -1395,58 +1395,18 @@
1395
1395
  "errors": [
1396
1396
  {
1397
1397
  "code": 6000,
1398
- "name": "NotUpgradeAuthority",
1399
- "msg": "Only the upgrade authority can call this instruction"
1398
+ "name": "InvalidSignature",
1399
+ "msg": "Invalid quote signature"
1400
1400
  },
1401
1401
  {
1402
1402
  "code": 6001,
1403
- "name": "InvalidProgramData",
1404
- "msg": "Invalid program data account"
1403
+ "name": "InvalidDeadline",
1404
+ "msg": "Invalid quote deadline"
1405
1405
  },
1406
1406
  {
1407
1407
  "code": 6002,
1408
- "name": "CannotSetCurrentTime",
1409
- "msg": "Cannot set time if not in test mode"
1410
- },
1411
- {
1412
- "code": 6003,
1413
- "name": "InvalidBurnToken",
1414
- "msg": "Invalid burn_token key"
1415
- },
1416
- {
1417
- "code": 6004,
1418
- "name": "AmountNotPositive",
1419
- "msg": "Amount must be greater than 0"
1420
- },
1421
- {
1422
- "code": 6005,
1423
- "name": "QuoteDeadlineNotPassed",
1424
- "msg": "The quote deadline has not passed!"
1425
- },
1426
- {
1427
- "code": 6006,
1428
- "name": "SignerUnchanged",
1429
- "msg": "New signer unchanged"
1430
- },
1431
- {
1432
- "code": 6007,
1433
- "name": "DepositAmountBelowMinimum",
1434
- "msg": "Deposit amount below minimum"
1435
- },
1436
- {
1437
- "code": 6008,
1438
- "name": "MissingRentClaimAccount",
1439
- "msg": "Missing rent claim account"
1440
- },
1441
- {
1442
- "code": 6009,
1443
- "name": "RentClaimOverflow",
1444
- "msg": "Rent claim amount overflow"
1445
- },
1446
- {
1447
- "code": 6010,
1448
- "name": "InvalidRecipientKey",
1449
- "msg": "Invalid recipient key"
1408
+ "name": "InvalidSourceDomain",
1409
+ "msg": "Invalid source domain"
1450
1410
  }
1451
1411
  ],
1452
1412
  "types": [
@@ -1401,58 +1401,18 @@ export type SponsoredCctpSrcPeriphery = {
1401
1401
  "errors": [
1402
1402
  {
1403
1403
  "code": 6000;
1404
- "name": "notUpgradeAuthority";
1405
- "msg": "Only the upgrade authority can call this instruction";
1404
+ "name": "invalidSignature";
1405
+ "msg": "Invalid quote signature";
1406
1406
  },
1407
1407
  {
1408
1408
  "code": 6001;
1409
- "name": "invalidProgramData";
1410
- "msg": "Invalid program data account";
1409
+ "name": "invalidDeadline";
1410
+ "msg": "Invalid quote deadline";
1411
1411
  },
1412
1412
  {
1413
1413
  "code": 6002;
1414
- "name": "cannotSetCurrentTime";
1415
- "msg": "Cannot set time if not in test mode";
1416
- },
1417
- {
1418
- "code": 6003;
1419
- "name": "invalidBurnToken";
1420
- "msg": "Invalid burn_token key";
1421
- },
1422
- {
1423
- "code": 6004;
1424
- "name": "amountNotPositive";
1425
- "msg": "Amount must be greater than 0";
1426
- },
1427
- {
1428
- "code": 6005;
1429
- "name": "quoteDeadlineNotPassed";
1430
- "msg": "The quote deadline has not passed!";
1431
- },
1432
- {
1433
- "code": 6006;
1434
- "name": "signerUnchanged";
1435
- "msg": "New signer unchanged";
1436
- },
1437
- {
1438
- "code": 6007;
1439
- "name": "depositAmountBelowMinimum";
1440
- "msg": "Deposit amount below minimum";
1441
- },
1442
- {
1443
- "code": 6008;
1444
- "name": "missingRentClaimAccount";
1445
- "msg": "Missing rent claim account";
1446
- },
1447
- {
1448
- "code": 6009;
1449
- "name": "rentClaimOverflow";
1450
- "msg": "Rent claim amount overflow";
1451
- },
1452
- {
1453
- "code": 6010;
1454
- "name": "invalidRecipientKey";
1455
- "msg": "Invalid recipient key";
1414
+ "name": "invalidSourceDomain";
1415
+ "msg": "Invalid source domain";
1456
1416
  }
1457
1417
  ];
1458
1418
  "types": [
@@ -6,29 +6,13 @@
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
8
  import { type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError } from '@solana/kit';
9
- /** NotUpgradeAuthority: Only the upgrade authority can call this instruction */
10
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__NOT_UPGRADE_AUTHORITY = 6000;
11
- /** InvalidProgramData: Invalid program data account */
12
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_PROGRAM_DATA = 6001;
13
- /** CannotSetCurrentTime: Cannot set time if not in test mode */
14
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__CANNOT_SET_CURRENT_TIME = 6002;
15
- /** InvalidBurnToken: Invalid burn_token key */
16
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_BURN_TOKEN = 6003;
17
- /** AmountNotPositive: Amount must be greater than 0 */
18
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__AMOUNT_NOT_POSITIVE = 6004;
19
- /** QuoteDeadlineNotPassed: The quote deadline has not passed! */
20
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__QUOTE_DEADLINE_NOT_PASSED = 6005;
21
- /** SignerUnchanged: New signer unchanged */
22
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__SIGNER_UNCHANGED = 6006;
23
- /** DepositAmountBelowMinimum: Deposit amount below minimum */
24
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__DEPOSIT_AMOUNT_BELOW_MINIMUM = 6007;
25
- /** MissingRentClaimAccount: Missing rent claim account */
26
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__MISSING_RENT_CLAIM_ACCOUNT = 6008;
27
- /** RentClaimOverflow: Rent claim amount overflow */
28
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__RENT_CLAIM_OVERFLOW = 6009;
29
- /** InvalidRecipientKey: Invalid recipient key */
30
- export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_RECIPIENT_KEY = 6010;
31
- export type SponsoredCctpSrcPeripheryError = typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__AMOUNT_NOT_POSITIVE | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__CANNOT_SET_CURRENT_TIME | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__DEPOSIT_AMOUNT_BELOW_MINIMUM | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_BURN_TOKEN | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_PROGRAM_DATA | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_RECIPIENT_KEY | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__MISSING_RENT_CLAIM_ACCOUNT | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__NOT_UPGRADE_AUTHORITY | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__QUOTE_DEADLINE_NOT_PASSED | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__RENT_CLAIM_OVERFLOW | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__SIGNER_UNCHANGED;
9
+ /** InvalidSignature: Invalid quote signature */
10
+ export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SIGNATURE = 6000;
11
+ /** InvalidDeadline: Invalid quote deadline */
12
+ export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_DEADLINE = 6001;
13
+ /** InvalidSourceDomain: Invalid source domain */
14
+ export declare const SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SOURCE_DOMAIN = 6002;
15
+ export type SponsoredCctpSrcPeripheryError = typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_DEADLINE | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SIGNATURE | typeof SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SOURCE_DOMAIN;
32
16
  export declare function getSponsoredCctpSrcPeripheryErrorMessage(code: SponsoredCctpSrcPeripheryError): string;
33
17
  export declare function isSponsoredCctpSrcPeripheryError<TProgramErrorCode extends SponsoredCctpSrcPeripheryError>(error: unknown, transactionMessage: {
34
18
  instructions: Record<number, {
@@ -7,47 +7,23 @@
7
7
  * @see https://github.com/codama-idl/codama
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_RECIPIENT_KEY = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__RENT_CLAIM_OVERFLOW = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__MISSING_RENT_CLAIM_ACCOUNT = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__DEPOSIT_AMOUNT_BELOW_MINIMUM = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__SIGNER_UNCHANGED = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__QUOTE_DEADLINE_NOT_PASSED = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__AMOUNT_NOT_POSITIVE = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_BURN_TOKEN = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__CANNOT_SET_CURRENT_TIME = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_PROGRAM_DATA = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__NOT_UPGRADE_AUTHORITY = void 0;
10
+ exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SOURCE_DOMAIN = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_DEADLINE = exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SIGNATURE = void 0;
11
11
  exports.getSponsoredCctpSrcPeripheryErrorMessage = getSponsoredCctpSrcPeripheryErrorMessage;
12
12
  exports.isSponsoredCctpSrcPeripheryError = isSponsoredCctpSrcPeripheryError;
13
13
  const kit_1 = require("@solana/kit");
14
14
  const programs_1 = require("../programs");
15
- /** NotUpgradeAuthority: Only the upgrade authority can call this instruction */
16
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__NOT_UPGRADE_AUTHORITY = 0x1770; // 6000
17
- /** InvalidProgramData: Invalid program data account */
18
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_PROGRAM_DATA = 0x1771; // 6001
19
- /** CannotSetCurrentTime: Cannot set time if not in test mode */
20
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__CANNOT_SET_CURRENT_TIME = 0x1772; // 6002
21
- /** InvalidBurnToken: Invalid burn_token key */
22
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_BURN_TOKEN = 0x1773; // 6003
23
- /** AmountNotPositive: Amount must be greater than 0 */
24
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__AMOUNT_NOT_POSITIVE = 0x1774; // 6004
25
- /** QuoteDeadlineNotPassed: The quote deadline has not passed! */
26
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__QUOTE_DEADLINE_NOT_PASSED = 0x1775; // 6005
27
- /** SignerUnchanged: New signer unchanged */
28
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__SIGNER_UNCHANGED = 0x1776; // 6006
29
- /** DepositAmountBelowMinimum: Deposit amount below minimum */
30
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__DEPOSIT_AMOUNT_BELOW_MINIMUM = 0x1777; // 6007
31
- /** MissingRentClaimAccount: Missing rent claim account */
32
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__MISSING_RENT_CLAIM_ACCOUNT = 0x1778; // 6008
33
- /** RentClaimOverflow: Rent claim amount overflow */
34
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__RENT_CLAIM_OVERFLOW = 0x1779; // 6009
35
- /** InvalidRecipientKey: Invalid recipient key */
36
- exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_RECIPIENT_KEY = 0x177a; // 6010
15
+ /** InvalidSignature: Invalid quote signature */
16
+ exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SIGNATURE = 0x1770; // 6000
17
+ /** InvalidDeadline: Invalid quote deadline */
18
+ exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_DEADLINE = 0x1771; // 6001
19
+ /** InvalidSourceDomain: Invalid source domain */
20
+ exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SOURCE_DOMAIN = 0x1772; // 6002
37
21
  let sponsoredCctpSrcPeripheryErrorMessages;
38
22
  if (process.env.NODE_ENV !== 'production') {
39
23
  sponsoredCctpSrcPeripheryErrorMessages = {
40
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__AMOUNT_NOT_POSITIVE]: `Amount must be greater than 0`,
41
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__CANNOT_SET_CURRENT_TIME]: `Cannot set time if not in test mode`,
42
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__DEPOSIT_AMOUNT_BELOW_MINIMUM]: `Deposit amount below minimum`,
43
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_BURN_TOKEN]: `Invalid burn_token key`,
44
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_PROGRAM_DATA]: `Invalid program data account`,
45
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_RECIPIENT_KEY]: `Invalid recipient key`,
46
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__MISSING_RENT_CLAIM_ACCOUNT]: `Missing rent claim account`,
47
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__NOT_UPGRADE_AUTHORITY]: `Only the upgrade authority can call this instruction`,
48
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__QUOTE_DEADLINE_NOT_PASSED]: `The quote deadline has not passed!`,
49
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__RENT_CLAIM_OVERFLOW]: `Rent claim amount overflow`,
50
- [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__SIGNER_UNCHANGED]: `New signer unchanged`,
24
+ [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_DEADLINE]: `Invalid quote deadline`,
25
+ [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SIGNATURE]: `Invalid quote signature`,
26
+ [exports.SPONSORED_CCTP_SRC_PERIPHERY_ERROR__INVALID_SOURCE_DOMAIN]: `Invalid source domain`,
51
27
  };
52
28
  }
53
29
  function getSponsoredCctpSrcPeripheryErrorMessage(code) {
@@ -6,7 +6,7 @@ export type TokenMessengerMessageBody = {
6
6
  version: number;
7
7
  burnToken: anchor.web3.PublicKey;
8
8
  mintRecipient: anchor.web3.PublicKey;
9
- amount: BigInt;
9
+ amount: bigint;
10
10
  messageSender: anchor.web3.PublicKey;
11
11
  };
12
12
  /**
@@ -121,6 +121,7 @@ const AttestationResponseStruct = (0, superstruct_1.object)({
121
121
  * Fetches attestation from attestation service given the txHash.
122
122
  */
123
123
  const getMessages = async (txHash, srcDomain, irisApiUrl) => {
124
+ // eslint-disable-next-line no-console
124
125
  console.log("Fetching attestations and messages for tx...", txHash);
125
126
  let attestationResponse = {};
126
127
  while (attestationResponse.error ||
@@ -140,6 +141,7 @@ const getMessages = async (txHash, srcDomain, irisApiUrl) => {
140
141
  AttestationResponseStruct.assert(attestationResponse);
141
142
  }
142
143
  catch (error) {
144
+ // eslint-disable-next-line no-console
143
145
  console.error("Invalid attestation response structure:", error);
144
146
  throw new Error("Invalid attestation response structure");
145
147
  }
@@ -8,11 +8,11 @@ export type TokenMessengerV2MessageBody = {
8
8
  version: number;
9
9
  burnToken: anchor.web3.PublicKey;
10
10
  mintRecipient: anchor.web3.PublicKey;
11
- amount: BigInt;
11
+ amount: bigint;
12
12
  messageSender: anchor.web3.PublicKey;
13
- maxFee: BigInt;
14
- feeExecuted: BigInt;
15
- expirationBlock: BigInt;
13
+ maxFee: bigint;
14
+ feeExecuted: bigint;
15
+ expirationBlock: bigint;
16
16
  hookData: Buffer;
17
17
  };
18
18
  /**
@@ -22,7 +22,7 @@ export type MessageHeaderV2 = {
22
22
  version: number;
23
23
  sourceDomain: number;
24
24
  destinationDomain: number;
25
- nonce: BigInt;
25
+ nonce: bigint;
26
26
  sender: anchor.web3.PublicKey;
27
27
  recipient: anchor.web3.PublicKey;
28
28
  destinationCaller: anchor.web3.PublicKey;
@@ -38,7 +38,7 @@ export declare const decodeMessageSentDataV2: (message: Buffer) => {
38
38
  version: number;
39
39
  sourceDomain: number;
40
40
  destinationDomain: number;
41
- nonce: BigInt;
41
+ nonce: bigint;
42
42
  sender: anchor.web3.PublicKey;
43
43
  recipient: anchor.web3.PublicKey;
44
44
  destinationCaller: anchor.web3.PublicKey;
@@ -27,8 +27,6 @@ exports.AttestationResponse = exports.AttestationMessage = exports.DecodedMessag
27
27
  exports.getV2BurnAttestation = getV2BurnAttestation;
28
28
  const anchor = __importStar(require("@coral-xyz/anchor"));
29
29
  const superstruct_1 = require("superstruct");
30
- const ethers_1 = require("ethers");
31
- const superstruct_2 = require("superstruct");
32
30
  const relayHashUtils_1 = require("./relayHashUtils");
33
31
  const conversionUtils_1 = require("./conversionUtils");
34
32
  // Index positions to decode Message Header from
@@ -161,7 +159,7 @@ async function getV2BurnAttestation(txSignature, sourceMessageData, irisApiUrl)
161
159
  const attestationResponse = await (await fetch(`${irisApiUrl}/v2/messages/${sourceMessage.sourceDomain}/?transactionHash=${txSignature}`)).json();
162
160
  if (attestationResponse.error)
163
161
  return null;
164
- (0, superstruct_2.assert)(attestationResponse, exports.AttestationResponse);
162
+ (0, superstruct_1.assert)(attestationResponse, exports.AttestationResponse);
165
163
  // Return the first attested message that matches the source message.
166
164
  for (const message of attestationResponse.messages) {
167
165
  if (message.message !== "0x" &&
@@ -169,8 +167,8 @@ async function getV2BurnAttestation(txSignature, sourceMessageData, irisApiUrl)
169
167
  !!message.decodedMessage &&
170
168
  isMatchingV2BurnMessage(sourceMessage, message.decodedMessage)) {
171
169
  return {
172
- destinationMessage: Buffer.from(ethers_1.ethers.utils.arrayify(message.message)),
173
- attestation: Buffer.from(ethers_1.ethers.utils.arrayify(message.attestation)),
170
+ destinationMessage: Buffer.from((0, conversionUtils_1.hexToBytesStrict)(message.message)),
171
+ attestation: Buffer.from((0, conversionUtils_1.hexToBytesStrict)(message.attestation)),
174
172
  };
175
173
  }
176
174
  }
@@ -199,5 +197,5 @@ function isMatchingV2BurnMessage(sourceMessage, destinationMessage) {
199
197
  sourceMessage.messageBody.maxFee.toString() === destinationMessage.decodedMessageBody.maxFee &&
200
198
  // feeExecuted is only set on destination
201
199
  // expirationBlock is only set on destination
202
- sourceMessage.messageBody.hookData.equals(Buffer.from(ethers_1.ethers.utils.arrayify(destinationMessage.decodedMessageBody.hookData || "0x"))));
200
+ sourceMessage.messageBody.hookData.equals(Buffer.from((0, conversionUtils_1.hexToBytesStrict)(destinationMessage.decodedMessageBody.hookData || "0x"))));
203
201
  }
@@ -1,4 +1,4 @@
1
- import BN from "bn.js";
1
+ import { BN } from "@coral-xyz/anchor";
2
2
  export declare const CIRCLE_IRIS_API_URL_DEVNET = "https://iris-api-sandbox.circle.com";
3
3
  export declare const CIRCLE_IRIS_API_URL_MAINNET = "https://iris-api.circle.com";
4
4
  export declare const SOLANA_USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.SOLANA_SPOKE_STATE_SEED = exports.MAINNET_CCTP_MESSAGE_TRANSMITTER_ADDRESS = exports.SEPOLIA_CCTP_MESSAGE_TRANSMITTER_ADDRESS = exports.SOLANA_USDC_DEVNET = exports.SOLANA_USDC_MAINNET = exports.CIRCLE_IRIS_API_URL_MAINNET = exports.CIRCLE_IRIS_API_URL_DEVNET = void 0;
7
- const bn_js_1 = __importDefault(require("bn.js"));
4
+ const anchor_1 = require("@coral-xyz/anchor");
8
5
  exports.CIRCLE_IRIS_API_URL_DEVNET = "https://iris-api-sandbox.circle.com";
9
6
  exports.CIRCLE_IRIS_API_URL_MAINNET = "https://iris-api.circle.com";
10
7
  exports.SOLANA_USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
11
8
  exports.SOLANA_USDC_DEVNET = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
12
9
  exports.SEPOLIA_CCTP_MESSAGE_TRANSMITTER_ADDRESS = "0x7865fAfC2db2093669d92c0F33AeEF291086BEFD";
13
10
  exports.MAINNET_CCTP_MESSAGE_TRANSMITTER_ADDRESS = "0x0a992d191deec32afe36203ad87d7d289a738f81";
14
- exports.SOLANA_SPOKE_STATE_SEED = new bn_js_1.default(0);
11
+ exports.SOLANA_SPOKE_STATE_SEED = new anchor_1.BN(0);
@@ -1,6 +1,5 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey } from "@solana/web3.js";
3
- import { BigNumber } from "ethers";
4
3
  /**
5
4
  * Converts an integer to a 32-byte Uint8Array.
6
5
  */
@@ -10,15 +9,19 @@ export declare function intToU8Array32(num: number | BN): number[];
10
9
  */
11
10
  export declare function u8Array32ToInt(u8Array: Uint8Array | number[]): bigint;
12
11
  /**
13
- * Converts a 32-byte Uint8Array to a BigNumber.
12
+ * Converts a 0x-prefixed, even-length hex string to bytes, of exactly `length` bytes when given. Throws on malformed input.
14
13
  */
15
- export declare function u8Array32ToBigNumber(u8Array: Uint8Array | number[]): BigNumber;
14
+ export declare function hexToBytesStrict(hex: string, length?: number): Uint8Array;
15
+ /**
16
+ * Returns true for a 0x-prefixed 20-byte hex address. Mixed-case input must carry a valid EIP-55 checksum.
17
+ */
18
+ export declare function isEvmAddress(address: string): boolean;
16
19
  /**
17
20
  * Converts a string to a PublicKey.
18
21
  */
19
22
  export declare function strPublicKey(publicKey: PublicKey): string;
20
23
  /**
21
- * Converts an EVM address to a Solana PublicKey.
24
+ * Converts an EVM address or a bytes32 value, with or without 0x, to a Solana PublicKey.
22
25
  */
23
26
  export declare const evmAddressToPublicKey: (address: string) => PublicKey;
24
27
  /**
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addressOrBase58ToBytes32 = exports.fromBytes32ToAddress = exports.fromBase58ToBytes32 = exports.publicKeyToEvmAddress = exports.evmAddressToPublicKey = void 0;
4
4
  exports.intToU8Array32 = intToU8Array32;
5
5
  exports.u8Array32ToInt = u8Array32ToInt;
6
- exports.u8Array32ToBigNumber = u8Array32ToBigNumber;
6
+ exports.hexToBytesStrict = hexToBytesStrict;
7
+ exports.isEvmAddress = isEvmAddress;
7
8
  exports.strPublicKey = strPublicKey;
8
9
  const anchor_1 = require("@coral-xyz/anchor");
9
10
  const web3_js_1 = require("@solana/web3.js");
10
- const ethers_1 = require("ethers");
11
+ const sha3_js_1 = require("@noble/hashes/sha3.js");
12
+ const utils_js_1 = require("@noble/hashes/utils.js");
11
13
  /**
12
14
  * Converts an integer to a 32-byte Uint8Array.
13
15
  */
@@ -30,15 +32,30 @@ function u8Array32ToInt(u8Array) {
30
32
  throw new Error("Input must be a Uint8Array or an array of 32 numbers.");
31
33
  }
32
34
  /**
33
- * Converts a 32-byte Uint8Array to a BigNumber.
35
+ * Returns true for a 0x-prefixed, even-length hex string, of exactly `length` bytes when given.
34
36
  */
35
- function u8Array32ToBigNumber(u8Array) {
36
- const isValidArray = (arr) => Array.isArray(arr) && arr.every(Number.isInteger);
37
- if ((u8Array instanceof Uint8Array || isValidArray(u8Array)) && u8Array.length === 32) {
38
- const hexString = "0x" + Buffer.from(u8Array).toString("hex");
39
- return ethers_1.BigNumber.from(hexString);
40
- }
41
- throw new Error("Input must be a Uint8Array or an array of 32 numbers.");
37
+ function isStrictHex(hex, length) {
38
+ return /^0x([0-9a-fA-F]{2})*$/.test(hex) && (length === undefined || hex.length === 2 + 2 * length);
39
+ }
40
+ /**
41
+ * Converts a 0x-prefixed, even-length hex string to bytes, of exactly `length` bytes when given. Throws on malformed input.
42
+ */
43
+ function hexToBytesStrict(hex, length) {
44
+ if (!isStrictHex(hex, length))
45
+ throw new Error(`Invalid hex string: ${hex}`);
46
+ return Buffer.from(hex.slice(2), "hex");
47
+ }
48
+ /**
49
+ * Returns true for a 0x-prefixed 20-byte hex address. Mixed-case input must carry a valid EIP-55 checksum.
50
+ */
51
+ function isEvmAddress(address) {
52
+ if (!isStrictHex(address, 20))
53
+ return false;
54
+ const hex = address.slice(2);
55
+ if (hex === hex.toLowerCase() || hex === hex.toUpperCase())
56
+ return true;
57
+ const hash = (0, utils_js_1.bytesToHex)((0, sha3_js_1.keccak_256)((0, utils_js_1.utf8ToBytes)(hex.toLowerCase())));
58
+ return [...hex].every((c, i) => c === (parseInt(hash[i], 16) >= 8 ? c.toUpperCase() : c.toLowerCase()));
42
59
  }
43
60
  /**
44
61
  * Converts a string to a PublicKey.
@@ -47,11 +64,13 @@ function strPublicKey(publicKey) {
47
64
  return new web3_js_1.PublicKey(publicKey).toString();
48
65
  }
49
66
  /**
50
- * Converts an EVM address to a Solana PublicKey.
67
+ * Converts an EVM address or a bytes32 value, with or without 0x, to a Solana PublicKey.
51
68
  */
52
69
  const evmAddressToPublicKey = (address) => {
53
- const bytes32Address = `0x000000000000000000000000${address.replace("0x", "")}`;
54
- return new web3_js_1.PublicKey(ethers_1.ethers.utils.arrayify(bytes32Address));
70
+ const hex = address.replace(/^0x/, "");
71
+ if (hex.length !== 40 && hex.length !== 64)
72
+ throw new Error(`Invalid EVM address or bytes32: ${address}`);
73
+ return new web3_js_1.PublicKey(hexToBytesStrict(`0x${hex.padStart(64, "0")}`));
55
74
  };
56
75
  exports.evmAddressToPublicKey = evmAddressToPublicKey;
57
76
  /**
@@ -71,6 +90,8 @@ exports.publicKeyToEvmAddress = publicKeyToEvmAddress;
71
90
  */
72
91
  const fromBase58ToBytes32 = (input) => {
73
92
  const decodedBytes = anchor_1.utils.bytes.bs58.decode(input);
93
+ if (decodedBytes.length !== 32)
94
+ throw new Error(`Invalid base58 bytes32: ${input}`);
74
95
  return "0x" + Buffer.from(decodedBytes).toString("hex");
75
96
  };
76
97
  exports.fromBase58ToBytes32 = fromBase58ToBytes32;
@@ -90,10 +111,10 @@ exports.fromBytes32ToAddress = fromBytes32ToAddress;
90
111
  * Converts EVM or SVM address to a bytes32 string.
91
112
  */
92
113
  const addressOrBase58ToBytes32 = (input) => {
93
- if (ethers_1.ethers.utils.isAddress(input)) {
94
- return ethers_1.ethers.utils.hexZeroPad(input, 32);
114
+ if (isEvmAddress(input)) {
115
+ return "0x" + input.slice(2).padStart(64, "0");
95
116
  }
96
- else if (ethers_1.ethers.utils.isHexString(input, 32)) {
117
+ else if (isStrictHex(input, 32)) {
97
118
  return input;
98
119
  }
99
120
  else {
@@ -1,10 +1,9 @@
1
1
  import { AnchorProvider, BN } from "@coral-xyz/anchor";
2
- import { BigNumber } from "@ethersproject/bignumber";
3
2
  import { PublicKey } from "@solana/web3.js";
4
3
  /**
5
4
  * Returns the chainId for a given solana cluster.
6
5
  */
7
- export declare const getSolanaChainId: (cluster: "devnet" | "mainnet") => BigNumber;
6
+ export declare const getSolanaChainId: (cluster: "devnet" | "mainnet") => bigint;
8
7
  /**
9
8
  * Returns true if the provider is on the devnet cluster.
10
9
  */
@@ -7,16 +7,15 @@ exports.getDepositNowSeedHash = getDepositNowSeedHash;
7
7
  exports.getDepositNowPda = getDepositNowPda;
8
8
  exports.getFillRelayDelegateSeedHash = getFillRelayDelegateSeedHash;
9
9
  exports.getFillRelayDelegatePda = getFillRelayDelegatePda;
10
- const bignumber_1 = require("@ethersproject/bignumber");
11
- const ethers_1 = require("ethers");
12
10
  const web3_js_1 = require("@solana/web3.js");
13
11
  const borsh_1 = require("borsh");
14
- const utils_1 = require("ethers/lib/utils");
12
+ const sha3_js_1 = require("@noble/hashes/sha3.js");
13
+ const utils_js_1 = require("@noble/hashes/utils.js");
15
14
  /**
16
15
  * Returns the chainId for a given solana cluster.
17
16
  */
18
17
  const getSolanaChainId = (cluster) => {
19
- return bignumber_1.BigNumber.from(BigInt(ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(`solana-${cluster}`))) & BigInt("0xFFFFFFFFFFFF"));
18
+ return BigInt("0x" + (0, utils_js_1.bytesToHex)((0, sha3_js_1.keccak_256)((0, utils_js_1.utf8ToBytes)(`solana-${cluster}`)))) & BigInt("0xFFFFFFFFFFFF");
20
19
  };
21
20
  exports.getSolanaChainId = getSolanaChainId;
22
21
  /**
@@ -37,8 +36,7 @@ exports.isSolanaDevnet = isSolanaDevnet;
37
36
  */
38
37
  function deriveSeedHash(schema, seedObj) {
39
38
  const serialized = (0, borsh_1.serialize)(schema, seedObj);
40
- const hashHex = (0, utils_1.keccak256)(serialized);
41
- return Buffer.from(hashHex.slice(2), "hex");
39
+ return Buffer.from((0, sha3_js_1.keccak_256)(serialized));
42
40
  }
43
41
  /**
44
42
  * “Absolute‐deadline” deposit data
@@ -1,5 +1,5 @@
1
1
  import { BN } from "@coral-xyz/anchor";
2
- import { RelayerRefundLeaf, RelayerRefundLeafSolana, SlowFillLeaf } from "../../types/svm";
2
+ import { RelayerRefundLeafSolana, RelayerRefundLeafType, SlowFillLeaf } from "../../types/svm";
3
3
  /**
4
4
  * Calculates the relay hash from relay data and chain ID.
5
5
  */
@@ -11,7 +11,7 @@ export declare function calculateRelayEventHashUint8Array(relayEventData: any, c
11
11
  /**
12
12
  * Reads a 256-bit unsigned integer from a buffer.
13
13
  */
14
- export declare const readUInt256BE: (buffer: Buffer) => BigInt;
14
+ export declare const readUInt256BE: (buffer: Buffer) => bigint;
15
15
  /**
16
16
  * Hashes a non-empty message using Keccak256.
17
17
  */
@@ -21,9 +21,10 @@ export declare function hashNonEmptyMessage(message: Buffer): Uint8Array;
21
21
  */
22
22
  export declare function calculateRelayerRefundLeafHashUint8Array(relayData: RelayerRefundLeafSolana): string;
23
23
  /**
24
- * Hash function for relayer refund leaves.
24
+ * Hash function for relayer refund leaves. EVM leaves are ABI-encoded as a single
25
+ * tuple(uint256 amountToReturn, uint256 chainId, uint256[] refundAmounts, uint256 leafId, address l2TokenAddress, address[] refundAddresses).
25
26
  */
26
- export declare const relayerRefundHashFn: (input: RelayerRefundLeaf | RelayerRefundLeafSolana) => string;
27
+ export declare const relayerRefundHashFn: (input: RelayerRefundLeafType) => string;
27
28
  /**
28
29
  * Hash function for slow fill leaves.
29
30
  */