@across-protocol/sdk 4.3.2 → 4.3.4

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 (112) hide show
  1. package/dist/cjs/arch/svm/SpokeUtils.d.ts +13 -5
  2. package/dist/cjs/arch/svm/SpokeUtils.js +74 -5
  3. package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
  4. package/dist/cjs/arch/svm/utils.d.ts +4 -1
  5. package/dist/cjs/arch/svm/utils.js +15 -1
  6. package/dist/cjs/arch/svm/utils.js.map +1 -1
  7. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +13 -6
  8. package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  9. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -5
  10. package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  11. package/dist/cjs/clients/HubPoolClient.d.ts +1 -1
  12. package/dist/cjs/clients/HubPoolClient.js +3 -3
  13. package/dist/cjs/clients/HubPoolClient.js.map +1 -1
  14. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  15. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +4 -3
  16. package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  17. package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +1 -1
  18. package/dist/cjs/interfaces/SpokePool.d.ts +18 -0
  19. package/dist/cjs/interfaces/SpokePool.js.map +1 -1
  20. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +2 -1
  21. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +7 -68
  22. package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  23. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +5 -5
  24. package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  25. package/dist/cjs/typeguards/error.d.ts +2 -0
  26. package/dist/cjs/typeguards/error.js +4 -1
  27. package/dist/cjs/typeguards/error.js.map +1 -1
  28. package/dist/cjs/utils/AddressUtils.d.ts +2 -0
  29. package/dist/cjs/utils/AddressUtils.js +4 -0
  30. package/dist/cjs/utils/AddressUtils.js.map +1 -1
  31. package/dist/cjs/utils/DepositUtils.d.ts +3 -1
  32. package/dist/cjs/utils/DepositUtils.js +9 -1
  33. package/dist/cjs/utils/DepositUtils.js.map +1 -1
  34. package/dist/cjs/utils/TokenUtils.d.ts +5 -4
  35. package/dist/cjs/utils/TokenUtils.js +15 -23
  36. package/dist/cjs/utils/TokenUtils.js.map +1 -1
  37. package/dist/esm/arch/svm/SpokeUtils.d.ts +23 -5
  38. package/dist/esm/arch/svm/SpokeUtils.js +86 -5
  39. package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
  40. package/dist/esm/arch/svm/utils.d.ts +7 -1
  41. package/dist/esm/arch/svm/utils.js +14 -0
  42. package/dist/esm/arch/svm/utils.js.map +1 -1
  43. package/dist/esm/clients/BundleDataClient/BundleDataClient.js +14 -7
  44. package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
  45. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +9 -6
  46. package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
  47. package/dist/esm/clients/HubPoolClient.d.ts +1 -1
  48. package/dist/esm/clients/HubPoolClient.js +3 -4
  49. package/dist/esm/clients/HubPoolClient.js.map +1 -1
  50. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  51. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +5 -4
  52. package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
  53. package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +1 -1
  54. package/dist/esm/interfaces/SpokePool.d.ts +18 -0
  55. package/dist/esm/interfaces/SpokePool.js.map +1 -1
  56. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +2 -1
  57. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +9 -73
  58. package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
  59. package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +11 -10
  60. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +6 -6
  61. package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
  62. package/dist/esm/typeguards/error.d.ts +2 -0
  63. package/dist/esm/typeguards/error.js +2 -0
  64. package/dist/esm/typeguards/error.js.map +1 -1
  65. package/dist/esm/utils/AddressUtils.d.ts +2 -0
  66. package/dist/esm/utils/AddressUtils.js +4 -0
  67. package/dist/esm/utils/AddressUtils.js.map +1 -1
  68. package/dist/esm/utils/DepositUtils.d.ts +15 -1
  69. package/dist/esm/utils/DepositUtils.js +19 -1
  70. package/dist/esm/utils/DepositUtils.js.map +1 -1
  71. package/dist/esm/utils/TokenUtils.d.ts +31 -10
  72. package/dist/esm/utils/TokenUtils.js +20 -28
  73. package/dist/esm/utils/TokenUtils.js.map +1 -1
  74. package/dist/types/arch/svm/SpokeUtils.d.ts +23 -5
  75. package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
  76. package/dist/types/arch/svm/utils.d.ts +7 -1
  77. package/dist/types/arch/svm/utils.d.ts.map +1 -1
  78. package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
  79. package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
  80. package/dist/types/clients/HubPoolClient.d.ts +1 -1
  81. package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
  82. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
  83. package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
  84. package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +1 -1
  85. package/dist/types/interfaces/SpokePool.d.ts +18 -0
  86. package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
  87. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +2 -1
  88. package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
  89. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +11 -10
  90. package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
  91. package/dist/types/typeguards/error.d.ts +2 -0
  92. package/dist/types/typeguards/error.d.ts.map +1 -1
  93. package/dist/types/utils/AddressUtils.d.ts +2 -0
  94. package/dist/types/utils/AddressUtils.d.ts.map +1 -1
  95. package/dist/types/utils/DepositUtils.d.ts +15 -1
  96. package/dist/types/utils/DepositUtils.d.ts.map +1 -1
  97. package/dist/types/utils/TokenUtils.d.ts +31 -10
  98. package/dist/types/utils/TokenUtils.d.ts.map +1 -1
  99. package/package.json +4 -3
  100. package/src/arch/svm/SpokeUtils.ts +97 -6
  101. package/src/arch/svm/utils.ts +16 -0
  102. package/src/clients/BundleDataClient/BundleDataClient.ts +15 -6
  103. package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +10 -6
  104. package/src/clients/HubPoolClient.ts +3 -4
  105. package/src/clients/mocks/MockSvmCpiEventsClient.ts +5 -3
  106. package/src/interfaces/SpokePool.ts +23 -0
  107. package/src/relayFeeCalculator/chain-queries/svmQuery.ts +7 -93
  108. package/src/relayFeeCalculator/relayFeeCalculator.ts +6 -5
  109. package/src/typeguards/error.ts +3 -0
  110. package/src/utils/AddressUtils.ts +5 -0
  111. package/src/utils/DepositUtils.ts +49 -1
  112. package/src/utils/TokenUtils.ts +30 -34
@@ -1 +1 @@
1
- {"version":3,"file":"AddressUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/AddressUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,SAAS,EAA0B,MAAM,IAAI,CAAC;AAEvD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,E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AAE,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAM3B,OAAO,CAAC,YAAY,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;IAc1C,KAAK,IAAI,IAAI,IAAI,UAAU;IAI3B,KAAK,IAAI,IAAI,IAAI,UAAU;CAG5B;AAGD,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGnB,UAAU,EAAE,UAAU;IASlC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAMvC,KAAK,IAAI,IAAI,IAAI,UAAU;IAK3B,QAAQ,IAAI,MAAM;IAK3B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,GAAG,QAAmB,GAAG,UAAU;CAGnF;AAGD,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGnB,UAAU,EAAE,UAAU;IASlC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAUvC,KAAK,IAAI,IAAI,IAAI,UAAU;IAM3B,QAAQ,IAAI,MAAM;IAK3B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,GAAG,QAAmB,GAAG,UAAU;CAGnF;AAED,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,UAAU,EAAE,UAAU;CAInC"}
@@ -1,5 +1,5 @@
1
1
  import { SpokePoolClient } from "../clients";
2
- import { CachingMechanismInterface, Deposit, DepositWithBlock, Fill, RelayData, SlowFillRequest } from "../interfaces";
2
+ import { CachingMechanismInterface, Deposit, DepositWithBlock, Fill, RelayData, SlowFillRequest, ConvertedRelayData, ConvertedFill } from "../interfaces";
3
3
  export declare enum InvalidFill {
4
4
  DepositIdInvalid = 0,
5
5
  DepositIdNotFound = 1,
@@ -77,4 +77,18 @@ export declare function isDepositSpedUp(deposit: Deposit): boolean;
77
77
  * @returns Original or updated message string, depending on whether the depositor updated the deposit.
78
78
  */
79
79
  export declare function resolveDepositMessage(deposit: Deposit): string;
80
+ /**
81
+ * Converts a RelayData object with `Address` types as address fields to a `RelayData`-like object with
82
+ * strings as address fields.
83
+ * @param relayData RelayData type.
84
+ * @returns a RelayData-like type which has strings as fields.
85
+ */
86
+ export declare function convertRelayDataParamsToBytes32(relayData: RelayData): ConvertedRelayData;
87
+ /**
88
+ * Converts a Fill object with `Address` types as address fields to a `RelayData`-like object with
89
+ * strings as address fields.
90
+ * @param relayData RelayData type.
91
+ * @returns a RelayData-like type which has strings as fields.
92
+ */
93
+ export declare function convertFillParamsToBytes32(fill: Fill): ConvertedFill;
80
94
  //# sourceMappingURL=DepositUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DepositUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/DepositUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAavH,oBAAY,WAAW;IACrB,gBAAgB,IAAI;IACpB,iBAAiB,IAAA;IACjB,YAAY,IAAA;IACZ,mBAAmB,IAAA;CACpB;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,GAC1C;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD;;;;;;;;;;;GAWG;AAEH,wBAAsB,6BAA6B,CACjD,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,GAAG,eAAe,EA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AAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAkBpD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC,GAAG,OAAO,CAE/F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,OAAO,CAGnF;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,eAAe,EAAE,aAAa,GAAG,aAAa,CAAC,GAC7D,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAgB,GAAG,OAAO,CAE/D;AAED,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAI9D;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,SAAS,GAAG,kBAAkB,CASxF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,CAcpE"}
@@ -2,6 +2,7 @@ import { BlockTag } from "@ethersproject/abstract-provider";
2
2
  import { providers, Signer } from "ethers";
3
3
  import { L1TokenInfo, TokenInfo } from "../interfaces";
4
4
  import { BigNumber } from "./BigNumberUtils";
5
+ import { Address, EvmAddress } from "./AddressUtils";
5
6
  type SignerOrProvider = providers.Provider | Signer;
6
7
  export declare function fetchTokenInfo(address: string, signerOrProvider: SignerOrProvider): Promise<L1TokenInfo>;
7
8
  export declare const getL2TokenAddresses: (l1TokenAddress: string, l1ChainId?: number) => {
@@ -180,6 +181,14 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
180
181
  name: string;
181
182
  symbol: string;
182
183
  decimals: number;
184
+ /**
185
+ * Retrieves the ERC20 balance for a given address and token address.
186
+ * @param address The address to retrieve the balance for.
187
+ * @param tokenAddress The token address
188
+ * @param signerOrProvider A valid ethers.js Signer or Provider object.
189
+ * @param blockTag The block tag to retrieve the balance at.
190
+ * @returns The balance of the given address for the given token address.
191
+ */
183
192
  addresses: {
184
193
  [x: number]: string;
185
194
  };
@@ -323,7 +332,9 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
323
332
  [x: number]: string;
324
333
  };
325
334
  coingeckoId: string;
326
- };
335
+ }; /**
336
+ * @notice Returns the l1 token address matching the given l2TokenAddress and chainId.
337
+ */
327
338
  WAZERO: {
328
339
  name: string;
329
340
  symbol: string;
@@ -416,7 +427,7 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
416
427
  coingeckoId: string;
417
428
  };
418
429
  }) => string | undefined;
419
- export declare function getCoingeckoTokenIdByAddress(contractAddress: string, chainId: number): string;
430
+ export declare function getCoingeckoTokenIdByAddress(address: string, chainId: number): string;
420
431
  /**
421
432
  * Retrieves the ERC20 balance for a given address and token address.
422
433
  * @param address The address to retrieve the balance for.
@@ -432,12 +443,12 @@ export declare function isStablecoin(tokenSymbol: string): boolean;
432
443
  * @notice Returns the Token info for the token mapping in TOKEN_SYMBOLS_MAP matching the given l2TokenAddress
433
444
  * and chainId. If the chain is the hub chain, then will remap the L1 token to its equivalent L1 token symbol for example
434
445
  * it will always return a token info with symbol USDC and never USDC.e if chainId = mainnet.
435
- * @param l2TokenAddress
436
- * @param chainId
437
- * @param tokenMapping
438
- * @returns
446
+ * @param l2Token Address instance.
447
+ * @param chainId ChainId for l2Token address.
448
+ * @param tokenMapping Optional custom token mapping.
449
+ * @returns TokenInfo object.
439
450
  */
440
- export declare function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping?: {
451
+ export declare function getTokenInfo(l2Token: Address, chainId: number, tokenMapping?: {
441
452
  ACX: {
442
453
  name: string;
443
454
  symbol: string;
@@ -595,6 +606,14 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
595
606
  name: string;
596
607
  symbol: string;
597
608
  decimals: number;
609
+ /**
610
+ * Retrieves the ERC20 balance for a given address and token address.
611
+ * @param address The address to retrieve the balance for.
612
+ * @param tokenAddress The token address
613
+ * @param signerOrProvider A valid ethers.js Signer or Provider object.
614
+ * @param blockTag The block tag to retrieve the balance at.
615
+ * @returns The balance of the given address for the given token address.
616
+ */
598
617
  addresses: {
599
618
  [x: number]: string;
600
619
  };
@@ -738,7 +757,9 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
738
757
  [x: number]: string;
739
758
  };
740
759
  coingeckoId: string;
741
- };
760
+ }; /**
761
+ * @notice Returns the l1 token address matching the given l2TokenAddress and chainId.
762
+ */
742
763
  WAZERO: {
743
764
  name: string;
744
765
  symbol: string;
@@ -837,10 +858,10 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
837
858
  * @param chainId A chain Id to reference
838
859
  * @returns Either USDC (if native) or USDbC/USDC.e (if bridged) or undefined if the token address is not recognized.
839
860
  */
840
- export declare function getUsdcSymbol(l2Token: string, chainId: number): string | undefined;
861
+ export declare function getUsdcSymbol(l2Token: Address, chainId: number): string | undefined;
841
862
  /**
842
863
  * @notice Returns the l1 token address matching the given l2TokenAddress and chainId.
843
864
  */
844
- export declare function getL1TokenAddress(l2TokenAddress: string, chainId: number): string;
865
+ export declare function getL1TokenAddress(l2TokenAddress: Address, chainId: number): EvmAddress;
845
866
  export {};
846
867
  //# sourceMappingURL=TokenUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAY,SAAS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": "4.3.4",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
@@ -33,7 +33,8 @@
33
33
  "bump-version:major": "yarn version --major --no-git-tag-version --no-commit-hooks && git commit -m 'chore: bump version' ./package.json --no-verify",
34
34
  "bump-version:minor": "yarn version --minor --no-git-tag-version --no-commit-hooks && git commit -m 'chore: bump version' ./package.json --no-verify",
35
35
  "bump-version:patch": "yarn version --patch --no-git-tag-version --no-commit-hooks && git commit -m 'chore: bump version' ./package.json --no-verify",
36
- "typechain": "typechain --target ethers-v5 --out-dir src/utils/abi/typechain 'src/utils/abi/contracts/*.json' && eslint --fix src/utils/abi/typechain && yarn prettier --write \"src/utils/abi/typechain/**/*.ts\""
36
+ "typechain": "typechain --target ethers-v5 --out-dir src/utils/abi/typechain 'src/utils/abi/contracts/*.json' && eslint --fix src/utils/abi/typechain && yarn prettier --write \"src/utils/abi/typechain/**/*.ts\"",
37
+ "yalc:watch": "nodemon --watch src --ext ts,tsx,json,js,jsx --exec 'yalc push'"
37
38
  },
38
39
  "lint-staged": {
39
40
  "*.ts": "yarn lint"
@@ -105,7 +106,7 @@
105
106
  "dependencies": {
106
107
  "@across-protocol/across-token": "^1.0.0",
107
108
  "@across-protocol/constants": "^3.1.68",
108
- "@across-protocol/contracts": "^4.0.12",
109
+ "@across-protocol/contracts": "^4.1.0",
109
110
  "@coral-xyz/anchor": "^0.30.1",
110
111
  "@eth-optimism/sdk": "^3.3.1",
111
112
  "@ethersproject/bignumber": "^5.7.0",
@@ -1,5 +1,6 @@
1
1
  import { SvmSpokeClient } from "@across-protocol/contracts";
2
2
  import { decodeFillStatusAccount, fetchState } from "@across-protocol/contracts/dist/src/svm/clients/SvmSpoke";
3
+ import { intToU8Array32 } from "@across-protocol/contracts/dist/src/svm/web3-v1/conversionUtils";
3
4
  import { hashNonEmptyMessage } from "@across-protocol/contracts/dist/src/svm/web3-v1";
4
5
  import {
5
6
  ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
@@ -18,6 +19,7 @@ import {
18
19
  getU32Encoder,
19
20
  getU64Encoder,
20
21
  pipe,
22
+ ReadonlyUint8Array,
21
23
  some,
22
24
  type TransactionSigner,
23
25
  } from "@solana/kit";
@@ -39,6 +41,7 @@ import {
39
41
  } from "../../utils";
40
42
  import {
41
43
  SvmCpiEventsClient,
44
+ bigToU8a32,
42
45
  createDefaultTransaction,
43
46
  getEventAuthority,
44
47
  getFillStatusPda,
@@ -447,7 +450,7 @@ export async function fillRelayInstruction(
447
450
  exclusiveRelayer,
448
451
  inputToken,
449
452
  outputToken,
450
- inputAmount: relayData.inputAmount.toBigInt(),
453
+ inputAmount: bigToU8a32(relayData.inputAmount.toBigInt()),
451
454
  outputAmount: relayData.outputAmount.toBigInt(),
452
455
  originChainId: BigInt(relayData.originChainId),
453
456
  fillDeadline: relayData.fillDeadline,
@@ -475,6 +478,94 @@ export function createTokenAccountsInstruction(
475
478
  });
476
479
  }
477
480
 
481
+ /**
482
+ * @notice Return the fillRelay transaction for a given deposit
483
+ * @param spokePoolAddr Address of the spoke pool we're trying to fill through
484
+ * @param solanaClient RPC client to interact with Solana chain
485
+ * @param relayData RelayData instance, supplemented with destinationChainId
486
+ * @param signer signer associated with the relayer creating a Fill. Can be VoidSigner for gas estimation
487
+ * @param repaymentChainId Chain id where relayer repayment is desired
488
+ * @param repaymentAddress Address to which repayment will go to on repaymentChainId
489
+ * @returns FillRelay transaction
490
+ */
491
+ export async function getFillRelayTx(
492
+ spokePoolAddr: SvmAddress,
493
+ solanaClient: SVMProvider,
494
+ relayData: Omit<RelayData, "recipent" | "outputToken"> & {
495
+ destinationChainId: number;
496
+ recipient: SvmAddress;
497
+ outputToken: SvmAddress;
498
+ },
499
+ signer: TransactionSigner,
500
+ repaymentChainId: number,
501
+ repaymentAddress: SdkAddress
502
+ ) {
503
+ const { depositor, recipient, inputToken, outputToken, exclusiveRelayer, destinationChainId } = relayData;
504
+
505
+ // tsc appeasement...should be unnecessary, but isn't. @todo Identify why.
506
+ assert(recipient.isSVM(), `getFillRelayTx: recipient not an SVM address (${recipient})`);
507
+ assert(
508
+ repaymentAddress.isValidOn(repaymentChainId),
509
+ `getFillRelayTx: repayment address ${repaymentAddress} not valid on chain ${repaymentChainId})`
510
+ );
511
+
512
+ const program = toAddress(spokePoolAddr);
513
+ const _relayDataHash = getRelayDataHash(relayData, destinationChainId);
514
+ const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
515
+
516
+ const [state, delegate] = await Promise.all([
517
+ getStatePda(program),
518
+ getFillRelayDelegatePda(relayDataHash, BigInt(repaymentChainId), toAddress(repaymentAddress), program),
519
+ ]);
520
+
521
+ const mint = toAddress(outputToken);
522
+ const mintInfo = await fetchMint(solanaClient, mint);
523
+
524
+ const [recipientAta, relayerAta, fillStatus, eventAuthority] = await Promise.all([
525
+ getAssociatedTokenAddress(recipient, outputToken, mintInfo.programAddress),
526
+ getAssociatedTokenAddress(SvmAddress.from(signer.address), outputToken, mintInfo.programAddress),
527
+ getFillStatusPda(program, relayData, destinationChainId),
528
+ getEventAuthority(program),
529
+ ]);
530
+
531
+ const svmRelayData: SvmSpokeClient.FillRelayInput["relayData"] = {
532
+ depositor: toAddress(depositor),
533
+ recipient: toAddress(recipient),
534
+ exclusiveRelayer: toAddress(exclusiveRelayer),
535
+ inputToken: toAddress(inputToken),
536
+ outputToken: mint,
537
+ inputAmount: bigToU8a32(relayData.inputAmount.toBigInt()),
538
+ outputAmount: relayData.outputAmount.toBigInt(),
539
+ originChainId: relayData.originChainId,
540
+ depositId: new Uint8Array(intToU8Array32(relayData.depositId.toNumber())),
541
+ fillDeadline: relayData.fillDeadline,
542
+ exclusivityDeadline: relayData.exclusivityDeadline,
543
+ message: new Uint8Array(Buffer.from(relayData.message, "hex")),
544
+ };
545
+
546
+ const fillInput: SvmSpokeClient.FillRelayInput = {
547
+ signer: signer,
548
+ state,
549
+ delegate,
550
+ mint,
551
+ relayerTokenAccount: relayerAta,
552
+ recipientTokenAccount: recipientAta,
553
+ fillStatus,
554
+ tokenProgram: mintInfo.programAddress,
555
+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
556
+ systemProgram: SYSTEM_PROGRAM_ADDRESS,
557
+ eventAuthority,
558
+ program,
559
+ relayHash: relayDataHash,
560
+ relayData: svmRelayData,
561
+ repaymentChainId: BigInt(repaymentChainId),
562
+ repaymentAddress: toAddress(repaymentAddress),
563
+ };
564
+ // Pass createRecipientAtaIfNeeded =true to the createFillInstruction function to create the recipient token account
565
+ // if it doesn't exist.
566
+ return createFillInstruction(signer, solanaClient, fillInput, mintInfo.data.decimals, true);
567
+ }
568
+
478
569
  /**
479
570
  * Creates a fill instruction.
480
571
  * @param signer - The signer of the transaction.
@@ -643,7 +734,7 @@ export function getRelayDataHash(relayData: RelayData, destinationChainId: numbe
643
734
  encodeAddress(relayData.exclusiveRelayer),
644
735
  encodeAddress(relayData.inputToken),
645
736
  encodeAddress(relayData.outputToken),
646
- Uint8Array.from(uint64Encoder.encode(BigInt(relayData.inputAmount.toString()))),
737
+ arrayify(hexZeroPad(hexlify(relayData.inputAmount), 32)),
647
738
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.outputAmount.toString()))),
648
739
  Uint8Array.from(uint64Encoder.encode(BigInt(relayData.originChainId.toString()))),
649
740
  arrayify(hexZeroPad(hexlify(relayData.depositId), 32)),
@@ -751,7 +842,7 @@ export async function getDepositDelegatePda(
751
842
  inputToken: Address<string>;
752
843
  outputToken: Address<string>;
753
844
  inputAmount: bigint;
754
- outputAmount: bigint;
845
+ outputAmount: ReadonlyUint8Array;
755
846
  destinationChainId: bigint;
756
847
  exclusiveRelayer: Address<string>;
757
848
  quoteTimestamp: bigint;
@@ -771,7 +862,7 @@ export async function getDepositDelegatePda(
771
862
  Uint8Array.from(addrEnc.encode(depositData.inputToken)),
772
863
  Uint8Array.from(addrEnc.encode(depositData.outputToken)),
773
864
  Uint8Array.from(u64.encode(depositData.inputAmount)),
774
- Uint8Array.from(u64.encode(depositData.outputAmount)),
865
+ Uint8Array.from(depositData.outputAmount),
775
866
  Uint8Array.from(u64.encode(depositData.destinationChainId)),
776
867
  Uint8Array.from(addrEnc.encode(depositData.exclusiveRelayer)),
777
868
  Uint8Array.from(u32.encode(depositData.quoteTimestamp)),
@@ -801,7 +892,7 @@ export async function getDepositNowDelegatePda(
801
892
  inputToken: Address<string>;
802
893
  outputToken: Address<string>;
803
894
  inputAmount: bigint;
804
- outputAmount: bigint;
895
+ outputAmount: ReadonlyUint8Array;
805
896
  destinationChainId: bigint;
806
897
  exclusiveRelayer: Address<string>;
807
898
  fillDeadlineOffset: bigint;
@@ -820,7 +911,7 @@ export async function getDepositNowDelegatePda(
820
911
  Uint8Array.from(addrEnc.encode(depositData.inputToken)),
821
912
  Uint8Array.from(addrEnc.encode(depositData.outputToken)),
822
913
  Uint8Array.from(u64.encode(depositData.inputAmount)),
823
- Uint8Array.from(u64.encode(depositData.outputAmount)),
914
+ Uint8Array.from(depositData.outputAmount),
824
915
  Uint8Array.from(u64.encode(depositData.destinationChainId)),
825
916
  Uint8Array.from(addrEnc.encode(depositData.exclusiveRelayer)),
826
917
  Uint8Array.from(u32.encode(depositData.fillDeadlineOffset)),
@@ -311,3 +311,19 @@ export const createDefaultTransaction = async (rpcClient: SVMProvider, signer: T
311
311
  (tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx)
312
312
  );
313
313
  };
314
+
315
+ /**
316
+ * Convert a bigint (0 ≤ n < 2^256) to a 32-byte Uint8Array (big-endian).
317
+ */
318
+ export function bigintToU8a32(n: bigint): Uint8Array {
319
+ if (n < BigInt(0) || n > ethers.constants.MaxUint256.toBigInt()) {
320
+ throw new RangeError("Value must fit in 256 bits");
321
+ }
322
+ const hexPadded = ethers.utils.hexZeroPad("0x" + n.toString(16), 32);
323
+ return ethers.utils.arrayify(hexPadded);
324
+ }
325
+
326
+ export const bigToU8a32 = (bn: bigint | BigNumber) =>
327
+ bigintToU8a32(typeof bn === "bigint" ? bn : BigInt(bn.toString()));
328
+
329
+ export const numberToU8a32 = (n: number) => bigintToU8a32(BigInt(n));
@@ -43,6 +43,9 @@ import {
43
43
  invalidOutputToken,
44
44
  Address,
45
45
  getNetworkName,
46
+ toBytes32,
47
+ convertRelayDataParamsToBytes32,
48
+ convertFillParamsToBytes32,
46
49
  } from "../../utils";
47
50
  import winston from "winston";
48
51
  import {
@@ -327,7 +330,9 @@ export class BundleDataClient {
327
330
  Object.entries(tokenData).map(([token, data]) => [
328
331
  token,
329
332
  {
330
- refunds: data.refunds,
333
+ refunds: Object.fromEntries(
334
+ Object.entries(data.refunds).map(([refundAddress, refund]) => [toBytes32(refundAddress), refund])
335
+ ),
331
336
  totalRefundAmount: data.totalRefundAmount,
332
337
  realizedLpFees: data.realizedLpFees,
333
338
  fills: convertSortableEventFieldsIntoRequiredFields(data.fills),
@@ -920,7 +925,7 @@ export class BundleDataClient {
920
925
  this.logger.debug({
921
926
  at: "BundleDataClient#loadData",
922
927
  message: "Duplicate deposit detected",
923
- deposit,
928
+ deposit: convertRelayDataParamsToBytes32(deposit),
924
929
  });
925
930
  throw new Error("Duplicate deposit detected");
926
931
  }
@@ -1049,7 +1054,7 @@ export class BundleDataClient {
1049
1054
  this.logger.debug({
1050
1055
  at: "BundleDataClient#loadData",
1051
1056
  message: "Duplicate fill detected",
1052
- fill,
1057
+ fill: convertFillParamsToBytes32(fill),
1053
1058
  });
1054
1059
  throw new Error("Duplicate fill detected");
1055
1060
  }
@@ -1601,9 +1606,13 @@ export class BundleDataClient {
1601
1606
  at: "BundleDataClient#loadData",
1602
1607
  message: "Finished loading V3 spoke pool data and found some invalid fills in range",
1603
1608
  blockRangesForChains,
1604
- invalidFillsWithPartialMatchedDeposits,
1605
- preFillsForNextBundle,
1606
- unknownReasonInvalidFills,
1609
+ invalidFillsWithPartialMatchedDeposits: invalidFillsWithPartialMatchedDeposits.map((invalidFill) =>
1610
+ convertFillParamsToBytes32(invalidFill)
1611
+ ),
1612
+ preFillsForNextBundle: preFillsForNextBundle.map((preFill) => convertFillParamsToBytes32(preFill)),
1613
+ unknownReasonInvalidFills: unknownReasonInvalidFills.map((invalidFill) =>
1614
+ convertFillParamsToBytes32(invalidFill)
1615
+ ),
1607
1616
  });
1608
1617
  }
1609
1618
 
@@ -15,10 +15,10 @@ import {
15
15
  type,
16
16
  } from "superstruct";
17
17
  import { CHAIN_IDs, UNDEFINED_MESSAGE_HASH } from "../../../constants";
18
- import { BigNumber, EvmAddress, RawAddress, SvmAddress, toAddressType } from "../../../utils";
18
+ import { BigNumber, EvmAddress, RawAddress, SvmAddress, toAddressType, toBytes32 } from "../../../utils";
19
19
 
20
20
  const PositiveIntegerStringSS = pattern(string(), /\d+/);
21
- const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{40}$/);
21
+ const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{64}$/);
22
22
 
23
23
  const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (value) => {
24
24
  try {
@@ -43,6 +43,10 @@ const AddressType = coerce(AddressInstanceSS, string(), (value) => {
43
43
  return toAddressType(value, chainId);
44
44
  });
45
45
 
46
+ const Web3AddressType = coerce(Web3AddressSS, string(), (value) => {
47
+ return toBytes32(value);
48
+ });
49
+
46
50
  const FillTypeSS = number();
47
51
 
48
52
  const V3RelayDataSS = {
@@ -126,20 +130,20 @@ const BundleFillV3SS = object({
126
130
  lpFeePct: BigNumberType,
127
131
  });
128
132
 
129
- const nestedV3DepositRecordSS = record(PositiveIntegerStringSS, record(Web3AddressSS, array(V3DepositWithBlockSS)));
133
+ const nestedV3DepositRecordSS = record(PositiveIntegerStringSS, record(Web3AddressType, array(V3DepositWithBlockSS)));
130
134
  const nestedV3DepositRecordWithLpFeePctSS = record(
131
135
  PositiveIntegerStringSS,
132
- record(Web3AddressSS, array(V3DepositWithBlockLpFeeSS))
136
+ record(Web3AddressType, array(V3DepositWithBlockLpFeeSS))
133
137
  );
134
138
 
135
139
  const nestedV3BundleFillsSS = record(
136
140
  // Must be a chainId
137
141
  PositiveIntegerStringSS,
138
142
  record(
139
- Web3AddressSS,
143
+ Web3AddressType,
140
144
  object({
141
145
  fills: array(BundleFillV3SS),
142
- refunds: record(string(), BigNumberType),
146
+ refunds: record(Web3AddressType, BigNumberType),
143
147
  totalRefundAmount: BigNumberType,
144
148
  realizedLpFees: BigNumberType,
145
149
  })
@@ -281,13 +281,12 @@ export class HubPoolClient extends BaseAbstractClient {
281
281
  * @param chainId Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
282
282
  * @returns Token info for the given token address on the L2 chain including symbol and decimal.
283
283
  */
284
- // TODO: didn't change `tokenAddress` here to Address because of downstream getTokenInfo impl
285
- getTokenInfoForAddress(tokenAddress: string, chainId: number): TokenInfo {
286
- const tokenInfo = getTokenInfo(tokenAddress, chainId);
284
+ getTokenInfoForAddress(address: Address, chainId: number): TokenInfo {
285
+ const tokenInfo = getTokenInfo(address, chainId);
287
286
  // @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
288
287
  // entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
289
288
  if (tokenInfo.symbol.toLowerCase() === "usdc" && chainId !== this.chainId) {
290
- tokenInfo.symbol = getUsdcSymbol(tokenAddress, chainId) ?? "UNKNOWN";
289
+ tokenInfo.symbol = getUsdcSymbol(address, chainId) ?? "UNKNOWN USDC";
291
290
  }
292
291
  return tokenInfo;
293
292
  }
@@ -17,6 +17,7 @@ import {
17
17
  SVMEventNames,
18
18
  SVMProvider,
19
19
  getRandomSvmAddress,
20
+ bigToU8a32,
20
21
  } from "../../arch/svm";
21
22
  import { bnZero, bnOne, bs58, getCurrentTime, randomAddress, EvmAddress, SvmAddress } from "../../utils";
22
23
  import { FillType } from "../../interfaces";
@@ -82,7 +83,7 @@ export class MockSvmCpiEventsClient extends SvmCpiEventsClient {
82
83
  const inputToken = deposit.inputToken ?? getRandomSvmAddress();
83
84
  const outputToken = deposit.outputToken ?? SvmAddress.from(randomBytes(32), "base16").toBase58();
84
85
  inputAmount ??= BigInt(random(1, 1000, false));
85
- outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
86
+ outputAmount ??= bigToU8a32((inputAmount * BigInt(95)) / BigInt(100));
86
87
  const message = deposit.message ?? new Uint8Array(32);
87
88
  const quoteTimestamp = deposit.quoteTimestamp ?? getCurrentTime();
88
89
 
@@ -114,8 +115,9 @@ export class MockSvmCpiEventsClient extends SvmCpiEventsClient {
114
115
  const { slot } = fill;
115
116
  let { depositId, inputAmount, outputAmount, fillDeadline } = fill;
116
117
  depositId ??= arrayify(hexZeroPad(hexlify(random(1, 100_000, false)), 32));
117
- inputAmount ??= BigInt(random(1, 1000, false));
118
- outputAmount ??= (inputAmount * BigInt(95)) / BigInt(100);
118
+ const inputAmountBigInt = BigInt(random(1, 1000, false));
119
+ inputAmount ??= bigToU8a32(inputAmountBigInt);
120
+ outputAmount ??= (inputAmountBigInt * BigInt(95)) / BigInt(100);
119
121
  fillDeadline ??= getCurrentTime() + 60;
120
122
 
121
123
  const depositor = fill.depositor ?? EvmAddress.from(randomAddress()).toBase58();
@@ -18,6 +18,15 @@ export interface RelayData {
18
18
  exclusivityDeadline: number;
19
19
  }
20
20
 
21
+ export interface ConvertedRelayData
22
+ extends Omit<RelayData, "depositor" | "recipient" | "inputToken" | "outputToken" | "exclusiveRelayer"> {
23
+ depositor: string;
24
+ recipient: string;
25
+ inputToken: string;
26
+ outputToken: string;
27
+ exclusiveRelayer: string;
28
+ }
29
+
21
30
  export interface SpeedUpCommon {
22
31
  updatedRecipient: Address;
23
32
  updatedOutputAmount: BigNumber;
@@ -69,6 +78,20 @@ export interface Fill extends Omit<RelayData, "message"> {
69
78
  relayExecutionInfo: RelayExecutionEventInfo;
70
79
  }
71
80
 
81
+ export interface ConvertedFill
82
+ extends Omit<
83
+ Fill,
84
+ "depositor" | "recipient" | "inputToken" | "outputToken" | "exclusiveRelayer" | "relayer" | "relayExecutionInfo"
85
+ > {
86
+ depositor: string;
87
+ recipient: string;
88
+ inputToken: string;
89
+ outputToken: string;
90
+ exclusiveRelayer: string;
91
+ relayer: string;
92
+ relayExecutionInfo: Omit<RelayExecutionEventInfo, "updatedRecipient"> & { updatedRecipient: string };
93
+ }
94
+
72
95
  export interface FillWithBlock extends Fill, SortableEvent {}
73
96
  export interface FillWithTime extends Fill, SortableEvent {
74
97
  fillTimestamp: number;