@across-protocol/contracts 4.0.12 → 4.0.14-alpha.1

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 (51) hide show
  1. package/README.md +186 -3
  2. package/dist/deployments/deployments.json +8 -6
  3. package/dist/scripts/svm/closeRelayerPdas.js +1 -1
  4. package/dist/scripts/svm/createVault.js +2 -2
  5. package/dist/scripts/svm/fakeFillWithRandomDistribution.js +8 -7
  6. package/dist/scripts/svm/findFillStatusPdaFromEvent.js +1 -1
  7. package/dist/scripts/svm/initialize.js +19 -5
  8. package/dist/scripts/svm/nativeDeposit.js +30 -9
  9. package/dist/scripts/svm/queryEvents.js +1 -1
  10. package/dist/scripts/svm/queryEventsV2.js +1 -1
  11. package/dist/scripts/svm/queryFills.js +1 -1
  12. package/dist/scripts/svm/simpleDeposit.js +30 -9
  13. package/dist/scripts/svm/simpleFakeRelayerRepayment.js +19 -12
  14. package/dist/scripts/svm/simpleFill.js +7 -6
  15. package/dist/scripts/svm/squadsIdlUpgrade.d.ts +1 -0
  16. package/dist/scripts/svm/squadsIdlUpgrade.js +76 -0
  17. package/dist/src/svm/assets/idl/svm_spoke.json +77 -40
  18. package/dist/src/svm/assets/svm_spoke.d.ts +77 -40
  19. package/dist/src/svm/clients/SvmSpoke/instructions/deposit.d.ts +2 -2
  20. package/dist/src/svm/clients/SvmSpoke/instructions/deposit.js +2 -2
  21. package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.d.ts +2 -2
  22. package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.js +2 -2
  23. package/dist/src/svm/clients/SvmSpoke/instructions/handleReceiveMessage.d.ts +1 -1
  24. package/dist/src/svm/clients/SvmSpoke/instructions/handleReceiveMessage.js +5 -5
  25. package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.d.ts +2 -2
  26. package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.js +2 -2
  27. package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.d.ts +2 -2
  28. package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.js +1 -1
  29. package/dist/src/svm/clients/SvmSpoke/types/filledRelay.d.ts +2 -2
  30. package/dist/src/svm/clients/SvmSpoke/types/filledRelay.js +2 -2
  31. package/dist/src/svm/clients/SvmSpoke/types/fundsDeposited.d.ts +2 -2
  32. package/dist/src/svm/clients/SvmSpoke/types/fundsDeposited.js +2 -2
  33. package/dist/src/svm/clients/SvmSpoke/types/relayData.d.ts +2 -2
  34. package/dist/src/svm/clients/SvmSpoke/types/relayData.js +2 -2
  35. package/dist/src/svm/clients/SvmSpoke/types/requestedSlowFill.d.ts +2 -2
  36. package/dist/src/svm/clients/SvmSpoke/types/requestedSlowFill.js +2 -2
  37. package/dist/src/svm/web3-v1/helpers.d.ts +6 -6
  38. package/dist/src/svm/web3-v1/helpers.js +2 -2
  39. package/dist/src/svm/web3-v1/relayHashUtils.js +3 -3
  40. package/dist/src/svm/web3-v1/solanaProgramUtils.d.ts +1 -1
  41. package/dist/src/svm/web3-v1/solanaProgramUtils.js +17 -7
  42. package/dist/src/types/svm.d.ts +3 -3
  43. package/dist/target/types/svm_spoke.d.ts +77 -40
  44. package/dist/tasks/enableL1TokenAcrossEcosystem.js +4 -4
  45. package/dist/test/svm/SvmSpoke.Deposit.js +21 -3
  46. package/dist/test/svm/SvmSpoke.Fill.AcrossPlus.js +3 -3
  47. package/dist/test/svm/SvmSpoke.Fill.js +3 -3
  48. package/dist/test/svm/SvmSpoke.SlowFill.AcrossPlus.js +3 -3
  49. package/dist/test/svm/SvmSpoke.SlowFill.js +2 -2
  50. package/dist/test/svm/SvmSpoke.common.js +1 -1
  51. package/package.json +2 -2
@@ -32,7 +32,7 @@ function getUnsafeDepositInstructionDataEncoder() {
32
32
  ['inputToken', (0, kit_1.getAddressEncoder)()],
33
33
  ['outputToken', (0, kit_1.getAddressEncoder)()],
34
34
  ['inputAmount', (0, kit_1.getU64Encoder)()],
35
- ['outputAmount', (0, kit_1.getU64Encoder)()],
35
+ ['outputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
36
36
  ['destinationChainId', (0, kit_1.getU64Encoder)()],
37
37
  ['exclusiveRelayer', (0, kit_1.getAddressEncoder)()],
38
38
  ['depositNonce', (0, kit_1.getU64Encoder)()],
@@ -50,7 +50,7 @@ function getUnsafeDepositInstructionDataDecoder() {
50
50
  ['inputToken', (0, kit_1.getAddressDecoder)()],
51
51
  ['outputToken', (0, kit_1.getAddressDecoder)()],
52
52
  ['inputAmount', (0, kit_1.getU64Decoder)()],
53
- ['outputAmount', (0, kit_1.getU64Decoder)()],
53
+ ['outputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
54
54
  ['destinationChainId', (0, kit_1.getU64Decoder)()],
55
55
  ['exclusiveRelayer', (0, kit_1.getAddressDecoder)()],
56
56
  ['depositNonce', (0, kit_1.getU64Decoder)()],
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { type Address, type ReadonlyUint8Array } from '@solana/kit';
9
9
  import { type ParsedBridgeTokensToHubPoolInstruction, type ParsedClaimRelayerRefundInstruction, type ParsedCloseClaimAccountInstruction, type ParsedCloseFillPdaInstruction, type ParsedCloseInstructionParamsInstruction, type ParsedCreateTokenAccountsInstruction, type ParsedDepositInstruction, type ParsedDepositNowInstruction, type ParsedEmergencyDeleteRootBundleInstruction, type ParsedExecuteRelayerRefundLeafDeferredInstruction, type ParsedExecuteRelayerRefundLeafInstruction, type ParsedExecuteSlowRelayLeafInstruction, type ParsedFillRelayInstruction, type ParsedGetUnsafeDepositIdInstruction, type ParsedHandleReceiveMessageInstruction, type ParsedInitializeClaimAccountInstruction, type ParsedInitializeInstruction, type ParsedInitializeInstructionParamsInstruction, type ParsedPauseDepositsInstruction, type ParsedPauseFillsInstruction, type ParsedRelayRootBundleInstruction, type ParsedRequestSlowFillInstruction, type ParsedSetCrossDomainAdminInstruction, type ParsedSetCurrentTimeInstruction, type ParsedTransferOwnershipInstruction, type ParsedUnsafeDepositInstruction, type ParsedWriteInstructionParamsFragmentInstruction } from '../instructions';
10
- export declare const SVM_SPOKE_PROGRAM_ADDRESS: Address<"JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq">;
10
+ export declare const SVM_SPOKE_PROGRAM_ADDRESS: Address<"4Jg83Lhggz2EdzSsDX2NVcEK56F25jJKK5btUbHAU4Xu">;
11
11
  export declare enum SvmSpokeAccount {
12
12
  ClaimAccount = 0,
13
13
  ExecuteRelayerRefundLeafParams = 1,
@@ -54,7 +54,7 @@ export declare enum SvmSpokeInstruction {
54
54
  export declare function identifySvmSpokeInstruction(instruction: {
55
55
  data: ReadonlyUint8Array;
56
56
  } | ReadonlyUint8Array): SvmSpokeInstruction;
57
- export type ParsedSvmSpokeInstruction<TProgram extends string = 'JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq'> = ({
57
+ export type ParsedSvmSpokeInstruction<TProgram extends string = '4Jg83Lhggz2EdzSsDX2NVcEK56F25jJKK5btUbHAU4Xu'> = ({
58
58
  instructionType: SvmSpokeInstruction.BridgeTokensToHubPool;
59
59
  } & ParsedBridgeTokensToHubPoolInstruction<TProgram>) | ({
60
60
  instructionType: SvmSpokeInstruction.ClaimRelayerRefund;
@@ -11,7 +11,7 @@ exports.SvmSpokeInstruction = exports.SvmSpokeAccount = exports.SVM_SPOKE_PROGRA
11
11
  exports.identifySvmSpokeAccount = identifySvmSpokeAccount;
12
12
  exports.identifySvmSpokeInstruction = identifySvmSpokeInstruction;
13
13
  const kit_1 = require("@solana/kit");
14
- exports.SVM_SPOKE_PROGRAM_ADDRESS = 'JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq';
14
+ exports.SVM_SPOKE_PROGRAM_ADDRESS = '4Jg83Lhggz2EdzSsDX2NVcEK56F25jJKK5btUbHAU4Xu';
15
15
  var SvmSpokeAccount;
16
16
  (function (SvmSpokeAccount) {
17
17
  SvmSpokeAccount[SvmSpokeAccount["ClaimAccount"] = 0] = "ClaimAccount";
@@ -10,7 +10,7 @@ import { type RelayExecutionEventInfo, type RelayExecutionEventInfoArgs } from '
10
10
  export type FilledRelay = {
11
11
  inputToken: Address;
12
12
  outputToken: Address;
13
- inputAmount: bigint;
13
+ inputAmount: ReadonlyUint8Array;
14
14
  outputAmount: bigint;
15
15
  repaymentChainId: bigint;
16
16
  originChainId: bigint;
@@ -27,7 +27,7 @@ export type FilledRelay = {
27
27
  export type FilledRelayArgs = {
28
28
  inputToken: Address;
29
29
  outputToken: Address;
30
- inputAmount: number | bigint;
30
+ inputAmount: ReadonlyUint8Array;
31
31
  outputAmount: number | bigint;
32
32
  repaymentChainId: number | bigint;
33
33
  originChainId: number | bigint;
@@ -16,7 +16,7 @@ function getFilledRelayEncoder() {
16
16
  return (0, kit_1.getStructEncoder)([
17
17
  ['inputToken', (0, kit_1.getAddressEncoder)()],
18
18
  ['outputToken', (0, kit_1.getAddressEncoder)()],
19
- ['inputAmount', (0, kit_1.getU64Encoder)()],
19
+ ['inputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
20
20
  ['outputAmount', (0, kit_1.getU64Encoder)()],
21
21
  ['repaymentChainId', (0, kit_1.getU64Encoder)()],
22
22
  ['originChainId', (0, kit_1.getU64Encoder)()],
@@ -35,7 +35,7 @@ function getFilledRelayDecoder() {
35
35
  return (0, kit_1.getStructDecoder)([
36
36
  ['inputToken', (0, kit_1.getAddressDecoder)()],
37
37
  ['outputToken', (0, kit_1.getAddressDecoder)()],
38
- ['inputAmount', (0, kit_1.getU64Decoder)()],
38
+ ['inputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
39
39
  ['outputAmount', (0, kit_1.getU64Decoder)()],
40
40
  ['repaymentChainId', (0, kit_1.getU64Decoder)()],
41
41
  ['originChainId', (0, kit_1.getU64Decoder)()],
@@ -10,7 +10,7 @@ export type FundsDeposited = {
10
10
  inputToken: Address;
11
11
  outputToken: Address;
12
12
  inputAmount: bigint;
13
- outputAmount: bigint;
13
+ outputAmount: ReadonlyUint8Array;
14
14
  destinationChainId: bigint;
15
15
  depositId: ReadonlyUint8Array;
16
16
  quoteTimestamp: number;
@@ -25,7 +25,7 @@ export type FundsDepositedArgs = {
25
25
  inputToken: Address;
26
26
  outputToken: Address;
27
27
  inputAmount: number | bigint;
28
- outputAmount: number | bigint;
28
+ outputAmount: ReadonlyUint8Array;
29
29
  destinationChainId: number | bigint;
30
30
  depositId: ReadonlyUint8Array;
31
31
  quoteTimestamp: number;
@@ -16,7 +16,7 @@ function getFundsDepositedEncoder() {
16
16
  ['inputToken', (0, kit_1.getAddressEncoder)()],
17
17
  ['outputToken', (0, kit_1.getAddressEncoder)()],
18
18
  ['inputAmount', (0, kit_1.getU64Encoder)()],
19
- ['outputAmount', (0, kit_1.getU64Encoder)()],
19
+ ['outputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
20
20
  ['destinationChainId', (0, kit_1.getU64Encoder)()],
21
21
  ['depositId', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
22
22
  ['quoteTimestamp', (0, kit_1.getU32Encoder)()],
@@ -33,7 +33,7 @@ function getFundsDepositedDecoder() {
33
33
  ['inputToken', (0, kit_1.getAddressDecoder)()],
34
34
  ['outputToken', (0, kit_1.getAddressDecoder)()],
35
35
  ['inputAmount', (0, kit_1.getU64Decoder)()],
36
- ['outputAmount', (0, kit_1.getU64Decoder)()],
36
+ ['outputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
37
37
  ['destinationChainId', (0, kit_1.getU64Decoder)()],
38
38
  ['depositId', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
39
39
  ['quoteTimestamp', (0, kit_1.getU32Decoder)()],
@@ -12,7 +12,7 @@ export type RelayData = {
12
12
  exclusiveRelayer: Address;
13
13
  inputToken: Address;
14
14
  outputToken: Address;
15
- inputAmount: bigint;
15
+ inputAmount: ReadonlyUint8Array;
16
16
  outputAmount: bigint;
17
17
  originChainId: bigint;
18
18
  depositId: ReadonlyUint8Array;
@@ -26,7 +26,7 @@ export type RelayDataArgs = {
26
26
  exclusiveRelayer: Address;
27
27
  inputToken: Address;
28
28
  outputToken: Address;
29
- inputAmount: number | bigint;
29
+ inputAmount: ReadonlyUint8Array;
30
30
  outputAmount: number | bigint;
31
31
  originChainId: number | bigint;
32
32
  depositId: ReadonlyUint8Array;
@@ -18,7 +18,7 @@ function getRelayDataEncoder() {
18
18
  ['exclusiveRelayer', (0, kit_1.getAddressEncoder)()],
19
19
  ['inputToken', (0, kit_1.getAddressEncoder)()],
20
20
  ['outputToken', (0, kit_1.getAddressEncoder)()],
21
- ['inputAmount', (0, kit_1.getU64Encoder)()],
21
+ ['inputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
22
22
  ['outputAmount', (0, kit_1.getU64Encoder)()],
23
23
  ['originChainId', (0, kit_1.getU64Encoder)()],
24
24
  ['depositId', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
@@ -34,7 +34,7 @@ function getRelayDataDecoder() {
34
34
  ['exclusiveRelayer', (0, kit_1.getAddressDecoder)()],
35
35
  ['inputToken', (0, kit_1.getAddressDecoder)()],
36
36
  ['outputToken', (0, kit_1.getAddressDecoder)()],
37
- ['inputAmount', (0, kit_1.getU64Decoder)()],
37
+ ['inputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
38
38
  ['outputAmount', (0, kit_1.getU64Decoder)()],
39
39
  ['originChainId', (0, kit_1.getU64Decoder)()],
40
40
  ['depositId', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
@@ -9,7 +9,7 @@ import { type Address, type Codec, type Decoder, type Encoder, type ReadonlyUint
9
9
  export type RequestedSlowFill = {
10
10
  inputToken: Address;
11
11
  outputToken: Address;
12
- inputAmount: bigint;
12
+ inputAmount: ReadonlyUint8Array;
13
13
  outputAmount: bigint;
14
14
  originChainId: bigint;
15
15
  depositId: ReadonlyUint8Array;
@@ -23,7 +23,7 @@ export type RequestedSlowFill = {
23
23
  export type RequestedSlowFillArgs = {
24
24
  inputToken: Address;
25
25
  outputToken: Address;
26
- inputAmount: number | bigint;
26
+ inputAmount: ReadonlyUint8Array;
27
27
  outputAmount: number | bigint;
28
28
  originChainId: number | bigint;
29
29
  depositId: ReadonlyUint8Array;
@@ -15,7 +15,7 @@ function getRequestedSlowFillEncoder() {
15
15
  return (0, kit_1.getStructEncoder)([
16
16
  ['inputToken', (0, kit_1.getAddressEncoder)()],
17
17
  ['outputToken', (0, kit_1.getAddressEncoder)()],
18
- ['inputAmount', (0, kit_1.getU64Encoder)()],
18
+ ['inputAmount', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
19
19
  ['outputAmount', (0, kit_1.getU64Encoder)()],
20
20
  ['originChainId', (0, kit_1.getU64Encoder)()],
21
21
  ['depositId', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 32)],
@@ -31,7 +31,7 @@ function getRequestedSlowFillDecoder() {
31
31
  return (0, kit_1.getStructDecoder)([
32
32
  ['inputToken', (0, kit_1.getAddressDecoder)()],
33
33
  ['outputToken', (0, kit_1.getAddressDecoder)()],
34
- ['inputAmount', (0, kit_1.getU64Decoder)()],
34
+ ['inputAmount', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
35
35
  ['outputAmount', (0, kit_1.getU64Decoder)()],
36
36
  ['originChainId', (0, kit_1.getU64Decoder)()],
37
37
  ['depositId', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 32)],
@@ -18,7 +18,7 @@ export declare class DepositSeedData {
18
18
  inputToken: Uint8Array;
19
19
  outputToken: Uint8Array;
20
20
  inputAmount: BN;
21
- outputAmount: BN;
21
+ outputAmount: number[];
22
22
  destinationChainId: BN;
23
23
  exclusiveRelayer: Uint8Array;
24
24
  quoteTimestamp: BN;
@@ -31,7 +31,7 @@ export declare class DepositSeedData {
31
31
  inputToken: Uint8Array;
32
32
  outputToken: Uint8Array;
33
33
  inputAmount: BN;
34
- outputAmount: BN;
34
+ outputAmount: number[];
35
35
  destinationChainId: BN;
36
36
  exclusiveRelayer: Uint8Array;
37
37
  quoteTimestamp: BN;
@@ -49,7 +49,7 @@ export declare function getDepositSeedHash(depositData: {
49
49
  inputToken: PublicKey;
50
50
  outputToken: PublicKey;
51
51
  inputAmount: BN;
52
- outputAmount: BN;
52
+ outputAmount: number[];
53
53
  destinationChainId: BN;
54
54
  exclusiveRelayer: PublicKey;
55
55
  quoteTimestamp: BN;
@@ -70,7 +70,7 @@ export declare class DepositNowSeedData {
70
70
  inputToken: Uint8Array;
71
71
  outputToken: Uint8Array;
72
72
  inputAmount: BN;
73
- outputAmount: BN;
73
+ outputAmount: number[];
74
74
  destinationChainId: BN;
75
75
  exclusiveRelayer: Uint8Array;
76
76
  fillDeadlineOffset: BN;
@@ -82,7 +82,7 @@ export declare class DepositNowSeedData {
82
82
  inputToken: Uint8Array;
83
83
  outputToken: Uint8Array;
84
84
  inputAmount: BN;
85
- outputAmount: BN;
85
+ outputAmount: number[];
86
86
  destinationChainId: BN;
87
87
  exclusiveRelayer: Uint8Array;
88
88
  fillDeadlineOffset: BN;
@@ -99,7 +99,7 @@ export declare function getDepositNowSeedHash(depositData: {
99
99
  inputToken: PublicKey;
100
100
  outputToken: PublicKey;
101
101
  inputAmount: BN;
102
- outputAmount: BN;
102
+ outputAmount: number[];
103
103
  destinationChainId: BN;
104
104
  exclusiveRelayer: PublicKey;
105
105
  fillDeadlineOffset: BN;
@@ -60,7 +60,7 @@ const depositSeedSchema = new Map([
60
60
  ["inputToken", [32]],
61
61
  ["outputToken", [32]],
62
62
  ["inputAmount", "u64"],
63
- ["outputAmount", "u64"],
63
+ ["outputAmount", [32]],
64
64
  ["destinationChainId", "u64"],
65
65
  ["exclusiveRelayer", [32]],
66
66
  ["quoteTimestamp", "u32"],
@@ -119,7 +119,7 @@ const depositNowSeedSchema = new Map([
119
119
  ["inputToken", [32]],
120
120
  ["outputToken", [32]],
121
121
  ["inputAmount", "u64"],
122
- ["outputAmount", "u64"],
122
+ ["outputAmount", [32]],
123
123
  ["destinationChainId", "u64"],
124
124
  ["exclusiveRelayer", [32]],
125
125
  ["fillDeadlineOffset", "u32"],
@@ -19,7 +19,7 @@ function calculateRelayHashUint8Array(relayData, chainId) {
19
19
  relayData.exclusiveRelayer.toBuffer(),
20
20
  relayData.inputToken.toBuffer(),
21
21
  relayData.outputToken.toBuffer(),
22
- relayData.inputAmount.toArrayLike(Buffer, "le", 8),
22
+ Buffer.from(relayData.inputAmount),
23
23
  relayData.outputAmount.toArrayLike(Buffer, "le", 8),
24
24
  relayData.originChainId.toArrayLike(Buffer, "le", 8),
25
25
  Buffer.from(relayData.depositId),
@@ -42,7 +42,7 @@ function calculateRelayEventHashUint8Array(relayEventData, chainId) {
42
42
  relayEventData.exclusiveRelayer.toBuffer(),
43
43
  relayEventData.inputToken.toBuffer(),
44
44
  relayEventData.outputToken.toBuffer(),
45
- relayEventData.inputAmount.toArrayLike(Buffer, "le", 8),
45
+ Buffer.from(relayEventData.inputAmount),
46
46
  relayEventData.outputAmount.toArrayLike(Buffer, "le", 8),
47
47
  relayEventData.originChainId.toArrayLike(Buffer, "le", 8),
48
48
  Buffer.from(relayEventData.depositId),
@@ -169,7 +169,7 @@ const slowFillDataSchema = new Map([
169
169
  ["exclusiveRelayer", [32]],
170
170
  ["inputToken", [32]],
171
171
  ["outputToken", [32]],
172
- ["inputAmount", "u64"],
172
+ ["inputAmount", [32]],
173
173
  ["outputAmount", "u64"],
174
174
  ["originChainId", "u64"],
175
175
  ["depositId", [32]],
@@ -39,4 +39,4 @@ export declare function subscribeToCpiEventsForProgram(connection: Connection, p
39
39
  /**
40
40
  * Stringifies a CPI event.
41
41
  */
42
- export declare function stringifyCpiEvent(obj: any): any;
42
+ export declare function stringifyCpiEvent(obj: any, eventName: string): any;
@@ -178,7 +178,7 @@ function parseDepositId(value) {
178
178
  /**
179
179
  * Stringifies a CPI event.
180
180
  */
181
- function stringifyCpiEvent(obj) {
181
+ function stringifyCpiEvent(obj, eventName) {
182
182
  if (obj?.constructor?.toString()?.includes("PublicKey")) {
183
183
  if (obj.toString().startsWith("111111111111")) {
184
184
  // First 12 bytes are 0 for EVM addresses.
@@ -196,16 +196,26 @@ function stringifyCpiEvent(obj) {
196
196
  return Buffer.from(obj).toString("hex"); // Hex representation for fixed-length arrays
197
197
  }
198
198
  else if (Array.isArray(obj)) {
199
- return obj.map(stringifyCpiEvent);
199
+ return obj.map((obj) => stringifyCpiEvent(obj, eventName));
200
200
  }
201
201
  else if (obj !== null && typeof obj === "object") {
202
202
  return Object.fromEntries(Object.entries(obj).map(([key, value]) => {
203
- if (key === "depositId" && Array.isArray(value) && value.length === 32) {
204
- // Parse depositId using the helper function
205
- const parsedValue = parseDepositId(new Uint8Array(value));
206
- return [key, parsedValue];
203
+ if (Array.isArray(value) && value.length === 32) {
204
+ if (key === "depositId" || key === "deposit_id") {
205
+ // Parse depositId using the helper function
206
+ const parsedValue = parseDepositId(new Uint8Array(value));
207
+ return [key, parsedValue];
208
+ }
209
+ else if (eventName.toLowerCase() === "fundsdeposited" &&
210
+ (key === "outputAmount" || key === "output_amount")) {
211
+ return [key, (0, conversionUtils_1.u8Array32ToInt)(new Uint8Array(value)).toString()];
212
+ }
213
+ else if ((eventName.toLowerCase() === "filledrelay" || eventName.toLowerCase() === "requestedslowfill") &&
214
+ (key === "inputAmount" || key === "input_amount")) {
215
+ return [key, (0, conversionUtils_1.u8Array32ToInt)(new Uint8Array(value)).toString()];
216
+ }
207
217
  }
208
- return [key, stringifyCpiEvent(value)];
218
+ return [key, stringifyCpiEvent(value, eventName)];
209
219
  }));
210
220
  }
211
221
  return obj;
@@ -40,7 +40,7 @@ export type RelayData = {
40
40
  exclusiveRelayer: PublicKey;
41
41
  inputToken: PublicKey;
42
42
  outputToken: PublicKey;
43
- inputAmount: BN;
43
+ inputAmount: number[];
44
44
  outputAmount: BN;
45
45
  originChainId: BN;
46
46
  depositId: number[];
@@ -57,7 +57,7 @@ export interface DepositData {
57
57
  inputToken: PublicKey | null;
58
58
  outputToken: PublicKey;
59
59
  inputAmount: BN;
60
- outputAmount: BN;
60
+ outputAmount: number[];
61
61
  destinationChainId: BN;
62
62
  exclusiveRelayer: PublicKey;
63
63
  quoteTimestamp: BN;
@@ -71,7 +71,7 @@ export type DepositDataValues = [
71
71
  PublicKey,
72
72
  PublicKey,
73
73
  BN,
74
- BN,
74
+ number[],
75
75
  BN,
76
76
  PublicKey,
77
77
  number,
@@ -5,7 +5,7 @@
5
5
  * IDL can be found at `target/idl/svm_spoke.json`.
6
6
  */
7
7
  export type SvmSpoke = {
8
- "address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq";
8
+ "address": "4Jg83Lhggz2EdzSsDX2NVcEK56F25jJKK5btUbHAU4Xu";
9
9
  "metadata": {
10
10
  "name": "svmSpoke";
11
11
  "version": "0.1.0";
@@ -751,6 +751,7 @@ export type SvmSpoke = {
751
751
  "amount will be sent to the relayer on their repayment chain of choice as a refund following an optimistic",
752
752
  "challenge window in the HubPool, less a system fee.",
753
753
  "- output_amount: The amount of output tokens that the relayer will send to the recipient on the destination.",
754
+ "This is big-endian encoded as a 32-byte array to match its underlying byte representation on EVM side.",
754
755
  "- destination_chain_id: The destination chain identifier where the fill should be made.",
755
756
  "- exclusive_relayer: The relayer that will be exclusively allowed to fill this deposit before the exclusivity",
756
757
  "deadline timestamp. This must be a valid, non-zero address if the exclusivity deadline is greater than the",
@@ -992,7 +993,12 @@ export type SvmSpoke = {
992
993
  },
993
994
  {
994
995
  "name": "outputAmount";
995
- "type": "u64";
996
+ "type": {
997
+ "array": [
998
+ "u8",
999
+ 32
1000
+ ];
1001
+ };
996
1002
  },
997
1003
  {
998
1004
  "name": "destinationChainId";
@@ -1252,7 +1258,12 @@ export type SvmSpoke = {
1252
1258
  },
1253
1259
  {
1254
1260
  "name": "outputAmount";
1255
- "type": "u64";
1261
+ "type": {
1262
+ "array": [
1263
+ "u8",
1264
+ 32
1265
+ ];
1266
+ };
1256
1267
  },
1257
1268
  {
1258
1269
  "name": "destinationChainId";
@@ -2344,6 +2355,7 @@ export type SvmSpoke = {
2344
2355
  "token on the repayment chain will be sent as a refund to the caller.",
2345
2356
  "- output_token: The token that the caller will send to the recipient on this chain.",
2346
2357
  "- input_amount: This amount, less a system fee, will be sent to the caller on their repayment chain.",
2358
+ "This is big-endian encoded as a 32-byte array to match its underlying byte representation on EVM side",
2347
2359
  "- output_amount: The amount of output tokens that the caller will send to the recipient.",
2348
2360
  "- origin_chain_id: The origin chain identifier.",
2349
2361
  "- exclusive_relayer: The relayer that will be exclusively allowed to fill this deposit before the",
@@ -2723,38 +2735,38 @@ export type SvmSpoke = {
2723
2735
  {
2724
2736
  "kind": "const";
2725
2737
  "value": [
2726
- 255,
2727
- 9,
2728
- 170,
2729
- 45,
2730
- 62,
2731
- 177,
2732
- 188,
2733
- 157,
2734
- 161,
2735
- 158,
2736
- 130,
2737
- 38,
2738
- 73,
2739
- 48,
2740
- 225,
2741
- 61,
2742
- 57,
2743
- 147,
2744
- 225,
2745
- 22,
2746
- 15,
2747
- 48,
2748
- 57,
2738
+ 49,
2739
+ 26,
2740
+ 43,
2741
+ 82,
2742
+ 76,
2749
2743
  239,
2750
- 33,
2751
- 175,
2752
- 209,
2753
- 86,
2754
- 83,
2755
- 118,
2756
- 239,
2757
- 202
2744
+ 117,
2745
+ 32,
2746
+ 212,
2747
+ 230,
2748
+ 107,
2749
+ 40,
2750
+ 205,
2751
+ 152,
2752
+ 207,
2753
+ 87,
2754
+ 23,
2755
+ 16,
2756
+ 110,
2757
+ 169,
2758
+ 19,
2759
+ 114,
2760
+ 44,
2761
+ 25,
2762
+ 207,
2763
+ 28,
2764
+ 149,
2765
+ 223,
2766
+ 193,
2767
+ 138,
2768
+ 247,
2769
+ 52
2758
2770
  ];
2759
2771
  }
2760
2772
  ];
@@ -2847,7 +2859,7 @@ export type SvmSpoke = {
2847
2859
  },
2848
2860
  {
2849
2861
  "name": "program";
2850
- "address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq";
2862
+ "address": "4Jg83Lhggz2EdzSsDX2NVcEK56F25jJKK5btUbHAU4Xu";
2851
2863
  }
2852
2864
  ];
2853
2865
  "args": [
@@ -4102,7 +4114,12 @@ export type SvmSpoke = {
4102
4114
  },
4103
4115
  {
4104
4116
  "name": "outputAmount";
4105
- "type": "u64";
4117
+ "type": {
4118
+ "array": [
4119
+ "u8",
4120
+ 32
4121
+ ];
4122
+ };
4106
4123
  },
4107
4124
  {
4108
4125
  "name": "destinationChainId";
@@ -4872,7 +4889,12 @@ export type SvmSpoke = {
4872
4889
  },
4873
4890
  {
4874
4891
  "name": "inputAmount";
4875
- "type": "u64";
4892
+ "type": {
4893
+ "array": [
4894
+ "u8",
4895
+ 32
4896
+ ];
4897
+ };
4876
4898
  },
4877
4899
  {
4878
4900
  "name": "outputAmount";
@@ -4958,7 +4980,12 @@ export type SvmSpoke = {
4958
4980
  },
4959
4981
  {
4960
4982
  "name": "outputAmount";
4961
- "type": "u64";
4983
+ "type": {
4984
+ "array": [
4985
+ "u8",
4986
+ 32
4987
+ ];
4988
+ };
4962
4989
  },
4963
4990
  {
4964
4991
  "name": "destinationChainId";
@@ -5079,7 +5106,12 @@ export type SvmSpoke = {
5079
5106
  },
5080
5107
  {
5081
5108
  "name": "inputAmount";
5082
- "type": "u64";
5109
+ "type": {
5110
+ "array": [
5111
+ "u8",
5112
+ 32
5113
+ ];
5114
+ };
5083
5115
  },
5084
5116
  {
5085
5117
  "name": "outputAmount";
@@ -5243,7 +5275,12 @@ export type SvmSpoke = {
5243
5275
  },
5244
5276
  {
5245
5277
  "name": "inputAmount";
5246
- "type": "u64";
5278
+ "type": {
5279
+ "array": [
5280
+ "u8",
5281
+ 32
5282
+ ];
5283
+ };
5247
5284
  },
5248
5285
  {
5249
5286
  "name": "outputAmount";
@@ -10,8 +10,8 @@ const utils_1 = require("./utils");
10
10
  const { ARBITRUM, OPTIMISM } = constants_1.CHAIN_IDs;
11
11
  const NO_SYMBOL = "----";
12
12
  const NO_ADDRESS = "------------------------------------------";
13
- const IGNORED_CHAINS = [constants_1.CHAIN_IDs.BOBA, constants_1.CHAIN_IDs.BSC, constants_1.CHAIN_IDs.SOLANA];
14
- const V4_CHAINS = [constants_1.CHAIN_IDs.BSC, constants_1.CHAIN_IDs.LISK, constants_1.CHAIN_IDs.LINEA];
13
+ const IGNORED_CHAINS = [constants_1.CHAIN_IDs.BOBA, constants_1.CHAIN_IDs.SOLANA];
14
+ const V4_CHAINS = [constants_1.CHAIN_IDs.BSC, constants_1.CHAIN_IDs.LISK, constants_1.CHAIN_IDs.LINEA, constants_1.CHAIN_IDs.WORLD_CHAIN];
15
15
  // Supported mainnet chain IDs.
16
16
  const enabledChainIds = (hubChainId) => {
17
17
  const chainIds = hubChainId === constants_1.CHAIN_IDs.MAINNET ? constants_1.MAINNET_CHAIN_IDs : constants_1.TESTNET_CHAIN_IDs;
@@ -26,7 +26,7 @@ const getChainsFromList = (taskArgInput) => taskArgInput
26
26
  ?.map((chainId) => Number(chainId)) || [];
27
27
  (0, config_1.task)("enableToken", "Enable a provided token across the entire ecosystem of supported chains")
28
28
  .addFlag("execute", "Provide this flag if you would like to actually execute the transaction from the EOA")
29
- .addFlag("disableRoutes", "Set to disable deposit routes for the specified chains")
29
+ .addFlag("disable", "Set to disable deposit routes for the specified chains")
30
30
  .addParam("token", "Symbol of token to enable")
31
31
  .addOptionalParam("chains", "Comma-delimited list of chains to enable the token on. Defaults to all supported chains")
32
32
  .addOptionalParam("burn", "Amount of LP token to burn when enabling a new token", 1, config_1.types.int)
@@ -35,7 +35,7 @@ const getChainsFromList = (taskArgInput) => taskArgInput
35
35
  .setAction(async function (taskArguments, hre_) {
36
36
  const hre = hre_;
37
37
  const { burn, chains, execute, token: symbol } = taskArguments;
38
- const enableRoute = !taskArguments.disableRoutes;
38
+ const enableRoute = !taskArguments.disable;
39
39
  const hubChainId = parseInt(await hre.getChainId());
40
40
  if (hubChainId === 31337) {
41
41
  throw new Error(`Defaulted to network \`hardhat\`; specify \`--network mainnet\` or \`--network sepolia\``);