@orca-so/whirlpools-automation 0.3.0 → 0.4.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 (39) hide show
  1. package/README.md +2 -1
  2. package/dist/generated/accounts/automation.d.ts +72 -35
  3. package/dist/generated/accounts/globalConfig.d.ts +52 -19
  4. package/dist/generated/errors/whirlpoolsAutomationProgram.d.ts +54 -8
  5. package/dist/generated/instructions/createAutomation.d.ts +197 -66
  6. package/dist/generated/instructions/fundAutomation.d.ts +86 -27
  7. package/dist/generated/instructions/harvestAndReinvest.d.ts +286 -85
  8. package/dist/generated/instructions/harvestSwapAndReinvestPost.d.ts +278 -82
  9. package/dist/generated/instructions/harvestSwapAndReinvestPre.d.ts +259 -78
  10. package/dist/generated/instructions/initializeGlobalConfig.d.ts +90 -30
  11. package/dist/generated/instructions/removeAutomations.d.ts +154 -45
  12. package/dist/generated/instructions/updateGlobalConfig.d.ts +79 -24
  13. package/dist/generated/programs/whirlpoolsAutomationProgram.d.ts +58 -33
  14. package/dist/generated/shared/index.d.ts +34 -10
  15. package/dist/generated/types/accountDiscriminator.d.ts +8 -5
  16. package/dist/generated/types/action.d.ts +3 -3
  17. package/dist/generated/types/condition.d.ts +63 -33
  18. package/dist/generated/types/event.d.ts +205 -137
  19. package/dist/generated/types/fundAutomationMethod.d.ts +6 -3
  20. package/dist/generated/types/fundAutomationVariant.d.ts +33 -13
  21. package/dist/generated/types/increaseLiquidityByTokenAmountsAccountsType.d.ts +15 -11
  22. package/dist/generated/types/increaseLiquidityByTokenAmountsRemainingAccountsInfo.d.ts +10 -4
  23. package/dist/generated/types/increaseLiquidityByTokenAmountsRemainingAccountsSlice.d.ts +12 -6
  24. package/dist/generated/types/increaseLiquidityMethod.d.ts +30 -15
  25. package/dist/generated/types/nonZeroU32.d.ts +6 -2
  26. package/dist/generated/types/position.d.ts +22 -22
  27. package/dist/generated/types/positionRewardInfo.d.ts +8 -5
  28. package/dist/generated/types/tokenAccount.d.ts +22 -22
  29. package/dist/generated/types/tokenAccountState.d.ts +7 -4
  30. package/dist/generated/types/tokenMint.d.ts +14 -14
  31. package/dist/generated/types/updateGlobalConfigVariant.d.ts +58 -20
  32. package/dist/generated/types/whirlpool.d.ts +40 -40
  33. package/dist/generated/types/whirlpoolRewardInfo.d.ts +14 -11
  34. package/dist/index.browser.js +2490 -2092
  35. package/dist/index.node.js +2497 -2102
  36. package/dist/pda.d.ts +16 -4
  37. package/dist/staging.d.ts +1 -1
  38. package/package.json +3 -3
  39. package/CHANGELOG.md +0 -13
package/README.md CHANGED
@@ -40,7 +40,8 @@ yarn generate
40
40
  ## Publish
41
41
 
42
42
  ```sh
43
- npm publish
43
+ # from the repository root
44
+ yarn publish:js
44
45
  ```
45
46
 
46
47
  Requires npm authentication with publish access to the `@orca-so` scope.
@@ -1,44 +1,81 @@
1
- import { fetchEncodedAccount, fetchEncodedAccounts, Account, Codec, Decoder, EncodedAccount, Encoder, FetchAccountConfig, FetchAccountsConfig, MaybeAccount, MaybeEncodedAccount, ReadonlyUint8Array } from '@solana/kit';
1
+ import {
2
+ fetchEncodedAccount,
3
+ fetchEncodedAccounts,
4
+ Account,
5
+ Codec,
6
+ Decoder,
7
+ EncodedAccount,
8
+ Encoder,
9
+ FetchAccountConfig,
10
+ FetchAccountsConfig,
11
+ MaybeAccount,
12
+ MaybeEncodedAccount,
13
+ ReadonlyUint8Array,
14
+ } from '@solana/kit';
2
15
  import { AccountDiscriminator, AccountDiscriminatorArgs, Address, AddressArgs } from '../types';
3
16
 
4
17
  export type Automation = {
5
- discriminator: AccountDiscriminator;
6
- positionTokenAccount: Address;
7
- actionData: ReadonlyUint8Array;
8
- automationIndex: number;
9
- conditionsData: ReadonlyUint8Array;
10
- bump: number;
11
- authorityBump: number;
12
- padding: ReadonlyUint8Array;
13
- crankReward: bigint;
14
- automationTokenAccountA: Address;
15
- automationTokenAccountB: Address;
16
- tokenMintA: Address;
17
- tokenMintB: Address;
18
- reserved: ReadonlyUint8Array;
18
+ discriminator: AccountDiscriminator;
19
+ positionTokenAccount: Address;
20
+ actionData: ReadonlyUint8Array;
21
+ automationIndex: number;
22
+ conditionsData: ReadonlyUint8Array;
23
+ bump: number;
24
+ authorityBump: number;
25
+ padding: ReadonlyUint8Array;
26
+ crankReward: bigint;
27
+ automationTokenAccountA: Address;
28
+ automationTokenAccountB: Address;
29
+ tokenMintA: Address;
30
+ tokenMintB: Address;
31
+ owner: Address;
32
+ position: Address;
33
+ reserved: ReadonlyUint8Array;
19
34
  };
20
35
  export type AutomationArgs = {
21
- discriminator: AccountDiscriminatorArgs;
22
- positionTokenAccount: AddressArgs;
23
- actionData: ReadonlyUint8Array;
24
- automationIndex: number;
25
- conditionsData: ReadonlyUint8Array;
26
- bump: number;
27
- authorityBump: number;
28
- padding: ReadonlyUint8Array;
29
- crankReward: number | bigint;
30
- automationTokenAccountA: AddressArgs;
31
- automationTokenAccountB: AddressArgs;
32
- tokenMintA: AddressArgs;
33
- tokenMintB: AddressArgs;
34
- reserved: ReadonlyUint8Array;
36
+ discriminator: AccountDiscriminatorArgs;
37
+ positionTokenAccount: AddressArgs;
38
+ actionData: ReadonlyUint8Array;
39
+ automationIndex: number;
40
+ conditionsData: ReadonlyUint8Array;
41
+ bump: number;
42
+ authorityBump: number;
43
+ padding: ReadonlyUint8Array;
44
+ crankReward: number | bigint;
45
+ automationTokenAccountA: AddressArgs;
46
+ automationTokenAccountB: AddressArgs;
47
+ tokenMintA: AddressArgs;
48
+ tokenMintB: AddressArgs;
49
+ owner: AddressArgs;
50
+ position: AddressArgs;
51
+ reserved: ReadonlyUint8Array;
35
52
  };
36
53
  export declare function getAutomationEncoder(): Encoder<AutomationArgs>;
37
54
  export declare function getAutomationDecoder(): Decoder<Automation>;
38
55
  export declare function getAutomationCodec(): Codec<AutomationArgs, Automation>;
39
- export declare function decodeAutomation<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Automation, TAddress>;
40
- export declare function decodeAutomation<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Automation, TAddress>;
41
- export declare function fetchAutomation<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Automation, TAddress>>;
42
- export declare function fetchMaybeAutomation<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Automation, TAddress>>;
43
- export declare function fetchAllAutomation(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Automation>[]>;
44
- export declare function fetchAllMaybeAutomation(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Automation>[]>;
56
+ export declare function decodeAutomation<TAddress extends string = string>(
57
+ encodedAccount: EncodedAccount<TAddress>
58
+ ): Account<Automation, TAddress>;
59
+ export declare function decodeAutomation<TAddress extends string = string>(
60
+ encodedAccount: MaybeEncodedAccount<TAddress>
61
+ ): MaybeAccount<Automation, TAddress>;
62
+ export declare function fetchAutomation<TAddress extends string = string>(
63
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
64
+ address: Address<TAddress>,
65
+ config?: FetchAccountConfig
66
+ ): Promise<Account<Automation, TAddress>>;
67
+ export declare function fetchMaybeAutomation<TAddress extends string = string>(
68
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
69
+ address: Address<TAddress>,
70
+ config?: FetchAccountConfig
71
+ ): Promise<MaybeAccount<Automation, TAddress>>;
72
+ export declare function fetchAllAutomation(
73
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
74
+ addresses: Array<Address>,
75
+ config?: FetchAccountsConfig
76
+ ): Promise<Account<Automation>[]>;
77
+ export declare function fetchAllMaybeAutomation(
78
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
79
+ addresses: Array<Address>,
80
+ config?: FetchAccountsConfig
81
+ ): Promise<MaybeAccount<Automation>[]>;
@@ -1,28 +1,61 @@
1
- import { fetchEncodedAccount, fetchEncodedAccounts, Account, Codec, Decoder, EncodedAccount, Encoder, FetchAccountConfig, FetchAccountsConfig, MaybeAccount, MaybeEncodedAccount, ReadonlyUint8Array } from '@solana/kit';
1
+ import {
2
+ fetchEncodedAccount,
3
+ fetchEncodedAccounts,
4
+ Account,
5
+ Codec,
6
+ Decoder,
7
+ EncodedAccount,
8
+ Encoder,
9
+ FetchAccountConfig,
10
+ FetchAccountsConfig,
11
+ MaybeAccount,
12
+ MaybeEncodedAccount,
13
+ ReadonlyUint8Array,
14
+ } from '@solana/kit';
2
15
  import { AccountDiscriminator, AccountDiscriminatorArgs, Address, AddressArgs } from '../types';
3
16
 
4
17
  export type GlobalConfig = {
5
- discriminator: AccountDiscriminator;
6
- bump: number;
7
- padding: ReadonlyUint8Array;
8
- globalConfigAuthority: Address;
9
- crankRewardDefault: bigint;
10
- reserved: ReadonlyUint8Array;
18
+ discriminator: AccountDiscriminator;
19
+ bump: number;
20
+ padding: ReadonlyUint8Array;
21
+ globalConfigAuthority: Address;
22
+ crankRewardDefault: bigint;
23
+ reserved: ReadonlyUint8Array;
11
24
  };
12
25
  export type GlobalConfigArgs = {
13
- discriminator: AccountDiscriminatorArgs;
14
- bump: number;
15
- padding: ReadonlyUint8Array;
16
- globalConfigAuthority: AddressArgs;
17
- crankRewardDefault: number | bigint;
18
- reserved: ReadonlyUint8Array;
26
+ discriminator: AccountDiscriminatorArgs;
27
+ bump: number;
28
+ padding: ReadonlyUint8Array;
29
+ globalConfigAuthority: AddressArgs;
30
+ crankRewardDefault: number | bigint;
31
+ reserved: ReadonlyUint8Array;
19
32
  };
20
33
  export declare function getGlobalConfigEncoder(): Encoder<GlobalConfigArgs>;
21
34
  export declare function getGlobalConfigDecoder(): Decoder<GlobalConfig>;
22
35
  export declare function getGlobalConfigCodec(): Codec<GlobalConfigArgs, GlobalConfig>;
23
- export declare function decodeGlobalConfig<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<GlobalConfig, TAddress>;
24
- export declare function decodeGlobalConfig<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<GlobalConfig, TAddress>;
25
- export declare function fetchGlobalConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<GlobalConfig, TAddress>>;
26
- export declare function fetchMaybeGlobalConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<GlobalConfig, TAddress>>;
27
- export declare function fetchAllGlobalConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<GlobalConfig>[]>;
28
- export declare function fetchAllMaybeGlobalConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<GlobalConfig>[]>;
36
+ export declare function decodeGlobalConfig<TAddress extends string = string>(
37
+ encodedAccount: EncodedAccount<TAddress>
38
+ ): Account<GlobalConfig, TAddress>;
39
+ export declare function decodeGlobalConfig<TAddress extends string = string>(
40
+ encodedAccount: MaybeEncodedAccount<TAddress>
41
+ ): MaybeAccount<GlobalConfig, TAddress>;
42
+ export declare function fetchGlobalConfig<TAddress extends string = string>(
43
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
44
+ address: Address<TAddress>,
45
+ config?: FetchAccountConfig
46
+ ): Promise<Account<GlobalConfig, TAddress>>;
47
+ export declare function fetchMaybeGlobalConfig<TAddress extends string = string>(
48
+ rpc: Parameters<typeof fetchEncodedAccount>[0],
49
+ address: Address<TAddress>,
50
+ config?: FetchAccountConfig
51
+ ): Promise<MaybeAccount<GlobalConfig, TAddress>>;
52
+ export declare function fetchAllGlobalConfig(
53
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
54
+ addresses: Array<Address>,
55
+ config?: FetchAccountsConfig
56
+ ): Promise<Account<GlobalConfig>[]>;
57
+ export declare function fetchAllMaybeGlobalConfig(
58
+ rpc: Parameters<typeof fetchEncodedAccounts>[0],
59
+ addresses: Array<Address>,
60
+ config?: FetchAccountsConfig
61
+ ): Promise<MaybeAccount<GlobalConfig>[]>;
@@ -32,14 +32,60 @@ export declare const WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_INSTRUCTI
32
32
  export declare const WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOMPANYING_INSTRUCTION = 6029;
33
33
  export declare const WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_INTERMEDIATE_SWAP = 6030;
34
34
  export declare const WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH = 6031;
35
- export type WhirlpoolsAutomationProgramError = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ACCOUNT_ALREADY_INITIALIZED | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ACCOUNT_NOT_INITIALIZED | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ARITHMETIC_ERROR | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__CONDITION_VIOLATION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__EMIT_EVENT_ERROR | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_ACCOUNT_ADDRESS | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_OWNER | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_PROGRAM_ID | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_FUNDS_TO_PAY_CRANK_REWARD | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_INSTRUCTION_COUNT_AFTER | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_INSTRUCTION_COUNT_BEFORE | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOMPANYING_INSTRUCTION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOUNT_DATA | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOUNT_ROLE | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACTION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACTION_DATA_LENGTH | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AMOUNT_TO_FUND_AUTOMATION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AUTOMATION_ACTION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AUTOMATION_INDEX | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CONDITION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CONDITION_DATA_LENGTH | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_C_P_I_ACCOUNTS | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_C_P_I_INSTRUCTION_DATA | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CRANK_REWARD | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_INTERMEDIATE_SWAP | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_NEXT_VALID_EXECUTION_TIMESTAMP_CONDITION | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_POSITION_TOKEN_AMOUNT | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_SEEDS | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__NOT_ENOUGH_ACCOUNT_KEYS | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__REDUNDANT_GLOBAL_CONFIG_UPDATE | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__UNKNOWN_INSTRUCTION_DISCRIMINATOR;
36
- export declare function getWhirlpoolsAutomationProgramErrorMessage(code: WhirlpoolsAutomationProgramError): string;
37
- export declare function isWhirlpoolsAutomationProgramError<TProgramErrorCode extends WhirlpoolsAutomationProgramError>(error: unknown, transactionMessage: {
38
- instructions: Record<number, {
35
+ export declare const WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__UNSUPPORTED_TOKEN_EXTENSION = 6032;
36
+ export type WhirlpoolsAutomationProgramError =
37
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ACCOUNT_ALREADY_INITIALIZED
38
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ACCOUNT_NOT_INITIALIZED
39
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__ARITHMETIC_ERROR
40
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__CONDITION_VIOLATION
41
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__EMIT_EVENT_ERROR
42
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_ACCOUNT_ADDRESS
43
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_OWNER
44
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INCORRECT_PROGRAM_ID
45
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_FUNDS_TO_PAY_CRANK_REWARD
46
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_INSTRUCTION_COUNT_AFTER
47
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INSUFFICIENT_INSTRUCTION_COUNT_BEFORE
48
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOMPANYING_INSTRUCTION
49
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOUNT_DATA
50
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACCOUNT_ROLE
51
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACTION
52
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_ACTION_DATA_LENGTH
53
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AMOUNT_TO_FUND_AUTOMATION
54
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AUTOMATION_ACTION
55
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_AUTOMATION_INDEX
56
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CONDITION
57
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CONDITION_DATA_LENGTH
58
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_C_P_I_ACCOUNTS
59
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_C_P_I_INSTRUCTION_DATA
60
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_CRANK_REWARD
61
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_INTERMEDIATE_SWAP
62
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_NEXT_VALID_EXECUTION_TIMESTAMP_CONDITION
63
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_POSITION_TOKEN_AMOUNT
64
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_REMAINING_ACCOUNTS_LENGTH
65
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__INVALID_SEEDS
66
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__NOT_ENOUGH_ACCOUNT_KEYS
67
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__REDUNDANT_GLOBAL_CONFIG_UPDATE
68
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__UNKNOWN_INSTRUCTION_DISCRIMINATOR
69
+ | typeof WHIRLPOOLS_AUTOMATION_PROGRAM_ERROR__UNSUPPORTED_TOKEN_EXTENSION;
70
+ export declare function getWhirlpoolsAutomationProgramErrorMessage(
71
+ code: WhirlpoolsAutomationProgramError
72
+ ): string;
73
+ export declare function isWhirlpoolsAutomationProgramError<
74
+ TProgramErrorCode extends WhirlpoolsAutomationProgramError,
75
+ >(
76
+ error: unknown,
77
+ transactionMessage: {
78
+ instructions: Record<
79
+ number,
80
+ {
39
81
  programAddress: Address;
40
- }>;
41
- }, code?: TProgramErrorCode): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> & Readonly<{
82
+ }
83
+ >;
84
+ },
85
+ code?: TProgramErrorCode
86
+ ): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
87
+ Readonly<{
42
88
  context: Readonly<{
43
- code: TProgramErrorCode;
89
+ code: TProgramErrorCode;
44
90
  }>;
45
- }>;
91
+ }>;
@@ -1,80 +1,211 @@
1
- import { Address, AccountMeta, AccountSignerMeta, Codec, Decoder, Encoder, Instruction, InstructionWithAccounts, InstructionWithData, ReadonlyAccount, ReadonlyUint8Array, TransactionSigner, WritableAccount, WritableSignerAccount } from '@solana/kit';
1
+ import {
2
+ Address,
3
+ AccountMeta,
4
+ AccountSignerMeta,
5
+ Codec,
6
+ Decoder,
7
+ Encoder,
8
+ Instruction,
9
+ InstructionWithAccounts,
10
+ InstructionWithData,
11
+ ReadonlyAccount,
12
+ ReadonlyUint8Array,
13
+ TransactionSigner,
14
+ WritableAccount,
15
+ WritableSignerAccount,
16
+ } from '@solana/kit';
2
17
  import { WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS } from '../programs';
3
18
  import { Action, ActionArgs, Condition, ConditionArgs } from '../types';
4
19
 
5
20
  export declare const CREATE_AUTOMATION_DISCRIMINATOR = 2;
6
21
  export declare function getCreateAutomationDiscriminatorBytes(): ReadonlyUint8Array;
7
- export type CreateAutomationInstruction<TProgram extends string = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS, TAccountPositionOwner extends string | AccountMeta<string> = string, TAccountAutomation extends string | AccountMeta<string> = string, TAccountAutomationTokenAccountA extends string | AccountMeta<string> = string, TAccountAutomationTokenAccountB extends string | AccountMeta<string> = string, TAccountPosition extends string | AccountMeta<string> = string, TAccountPositionTokenAccount extends string | AccountMeta<string> = string, TAccountWhirlpool extends string | AccountMeta<string> = string, TAccountGlobalConfig extends string | AccountMeta<string> = string, TAccountTokenMintA extends string | AccountMeta<string> = string, TAccountTokenMintB extends string | AccountMeta<string> = string, TAccountTokenProgramA extends string | AccountMeta<string> = string, TAccountTokenProgramB extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111', TAccountAtaProgram extends string | AccountMeta<string> = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
8
- TAccountPositionOwner extends string ? WritableSignerAccount<TAccountPositionOwner> & AccountSignerMeta<TAccountPositionOwner> : TAccountPositionOwner,
9
- TAccountAutomation extends string ? WritableAccount<TAccountAutomation> : TAccountAutomation,
10
- TAccountAutomationTokenAccountA extends string ? WritableAccount<TAccountAutomationTokenAccountA> : TAccountAutomationTokenAccountA,
11
- TAccountAutomationTokenAccountB extends string ? WritableAccount<TAccountAutomationTokenAccountB> : TAccountAutomationTokenAccountB,
12
- TAccountPosition extends string ? ReadonlyAccount<TAccountPosition> : TAccountPosition,
13
- TAccountPositionTokenAccount extends string ? ReadonlyAccount<TAccountPositionTokenAccount> : TAccountPositionTokenAccount,
14
- TAccountWhirlpool extends string ? ReadonlyAccount<TAccountWhirlpool> : TAccountWhirlpool,
15
- TAccountGlobalConfig extends string ? ReadonlyAccount<TAccountGlobalConfig> : TAccountGlobalConfig,
16
- TAccountTokenMintA extends string ? ReadonlyAccount<TAccountTokenMintA> : TAccountTokenMintA,
17
- TAccountTokenMintB extends string ? ReadonlyAccount<TAccountTokenMintB> : TAccountTokenMintB,
18
- TAccountTokenProgramA extends string ? ReadonlyAccount<TAccountTokenProgramA> : TAccountTokenProgramA,
19
- TAccountTokenProgramB extends string ? ReadonlyAccount<TAccountTokenProgramB> : TAccountTokenProgramB,
20
- TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
21
- TAccountAtaProgram extends string ? ReadonlyAccount<TAccountAtaProgram> : TAccountAtaProgram,
22
- ...TRemainingAccounts
23
- ]>;
22
+ export type CreateAutomationInstruction<
23
+ TProgram extends string = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS,
24
+ TAccountPositionOwner extends string | AccountMeta<string> = string,
25
+ TAccountAutomation extends string | AccountMeta<string> = string,
26
+ TAccountAutomationTokenAccountA extends string | AccountMeta<string> = string,
27
+ TAccountAutomationTokenAccountB extends string | AccountMeta<string> = string,
28
+ TAccountPosition extends string | AccountMeta<string> = string,
29
+ TAccountPositionTokenAccount extends string | AccountMeta<string> = string,
30
+ TAccountWhirlpool extends string | AccountMeta<string> = string,
31
+ TAccountGlobalConfig extends string | AccountMeta<string> = string,
32
+ TAccountTokenMintA extends string | AccountMeta<string> = string,
33
+ TAccountTokenMintB extends string | AccountMeta<string> = string,
34
+ TAccountTokenProgramA extends string | AccountMeta<string> = string,
35
+ TAccountTokenProgramB extends string | AccountMeta<string> = string,
36
+ TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111',
37
+ TAccountAtaProgram extends string | AccountMeta<string> =
38
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
39
+ TRemainingAccounts extends readonly AccountMeta<string>[] = [],
40
+ > = Instruction<TProgram> &
41
+ InstructionWithData<ReadonlyUint8Array> &
42
+ InstructionWithAccounts<
43
+ [
44
+ TAccountPositionOwner extends string
45
+ ? WritableSignerAccount<TAccountPositionOwner> & AccountSignerMeta<TAccountPositionOwner>
46
+ : TAccountPositionOwner,
47
+ TAccountAutomation extends string ? WritableAccount<TAccountAutomation> : TAccountAutomation,
48
+ TAccountAutomationTokenAccountA extends string
49
+ ? WritableAccount<TAccountAutomationTokenAccountA>
50
+ : TAccountAutomationTokenAccountA,
51
+ TAccountAutomationTokenAccountB extends string
52
+ ? WritableAccount<TAccountAutomationTokenAccountB>
53
+ : TAccountAutomationTokenAccountB,
54
+ TAccountPosition extends string ? ReadonlyAccount<TAccountPosition> : TAccountPosition,
55
+ TAccountPositionTokenAccount extends string
56
+ ? ReadonlyAccount<TAccountPositionTokenAccount>
57
+ : TAccountPositionTokenAccount,
58
+ TAccountWhirlpool extends string ? ReadonlyAccount<TAccountWhirlpool> : TAccountWhirlpool,
59
+ TAccountGlobalConfig extends string
60
+ ? ReadonlyAccount<TAccountGlobalConfig>
61
+ : TAccountGlobalConfig,
62
+ TAccountTokenMintA extends string ? ReadonlyAccount<TAccountTokenMintA> : TAccountTokenMintA,
63
+ TAccountTokenMintB extends string ? ReadonlyAccount<TAccountTokenMintB> : TAccountTokenMintB,
64
+ TAccountTokenProgramA extends string
65
+ ? ReadonlyAccount<TAccountTokenProgramA>
66
+ : TAccountTokenProgramA,
67
+ TAccountTokenProgramB extends string
68
+ ? ReadonlyAccount<TAccountTokenProgramB>
69
+ : TAccountTokenProgramB,
70
+ TAccountSystemProgram extends string
71
+ ? ReadonlyAccount<TAccountSystemProgram>
72
+ : TAccountSystemProgram,
73
+ TAccountAtaProgram extends string ? ReadonlyAccount<TAccountAtaProgram> : TAccountAtaProgram,
74
+ ...TRemainingAccounts,
75
+ ]
76
+ >;
24
77
  export type CreateAutomationInstructionData = {
25
- discriminator: number;
26
- action: Action;
27
- automationIndex: number;
28
- conditions: Array<Condition>;
78
+ discriminator: number;
79
+ action: Action;
80
+ automationIndex: number;
81
+ conditions: Array<Condition>;
29
82
  };
30
83
  export type CreateAutomationInstructionDataArgs = {
31
- action: ActionArgs;
32
- automationIndex: number;
33
- conditions: Array<ConditionArgs>;
84
+ action: ActionArgs;
85
+ automationIndex: number;
86
+ conditions: Array<ConditionArgs>;
34
87
  };
35
88
  export declare function getCreateAutomationInstructionDataEncoder(): Encoder<CreateAutomationInstructionDataArgs>;
36
89
  export declare function getCreateAutomationInstructionDataDecoder(): Decoder<CreateAutomationInstructionData>;
37
- export declare function getCreateAutomationInstructionDataCodec(): Codec<CreateAutomationInstructionDataArgs, CreateAutomationInstructionData>;
38
- export type CreateAutomationInput<TAccountPositionOwner extends string = string, TAccountAutomation extends string = string, TAccountAutomationTokenAccountA extends string = string, TAccountAutomationTokenAccountB extends string = string, TAccountPosition extends string = string, TAccountPositionTokenAccount extends string = string, TAccountWhirlpool extends string = string, TAccountGlobalConfig extends string = string, TAccountTokenMintA extends string = string, TAccountTokenMintB extends string = string, TAccountTokenProgramA extends string = string, TAccountTokenProgramB extends string = string, TAccountSystemProgram extends string = string, TAccountAtaProgram extends string = string> = {
39
- positionOwner: TransactionSigner<TAccountPositionOwner>;
40
- automation: Address<TAccountAutomation>;
41
- automationTokenAccountA: Address<TAccountAutomationTokenAccountA>;
42
- automationTokenAccountB: Address<TAccountAutomationTokenAccountB>;
43
- position: Address<TAccountPosition>;
44
- positionTokenAccount: Address<TAccountPositionTokenAccount>;
45
- whirlpool: Address<TAccountWhirlpool>;
46
- globalConfig: Address<TAccountGlobalConfig>;
47
- tokenMintA: Address<TAccountTokenMintA>;
48
- tokenMintB: Address<TAccountTokenMintB>;
49
- tokenProgramA: Address<TAccountTokenProgramA>;
50
- tokenProgramB: Address<TAccountTokenProgramB>;
51
- systemProgram?: Address<TAccountSystemProgram>;
52
- ataProgram?: Address<TAccountAtaProgram>;
53
- action: CreateAutomationInstructionDataArgs['action'];
54
- automationIndex: CreateAutomationInstructionDataArgs['automationIndex'];
55
- conditions: CreateAutomationInstructionDataArgs['conditions'];
90
+ export declare function getCreateAutomationInstructionDataCodec(): Codec<
91
+ CreateAutomationInstructionDataArgs,
92
+ CreateAutomationInstructionData
93
+ >;
94
+ export type CreateAutomationInput<
95
+ TAccountPositionOwner extends string = string,
96
+ TAccountAutomation extends string = string,
97
+ TAccountAutomationTokenAccountA extends string = string,
98
+ TAccountAutomationTokenAccountB extends string = string,
99
+ TAccountPosition extends string = string,
100
+ TAccountPositionTokenAccount extends string = string,
101
+ TAccountWhirlpool extends string = string,
102
+ TAccountGlobalConfig extends string = string,
103
+ TAccountTokenMintA extends string = string,
104
+ TAccountTokenMintB extends string = string,
105
+ TAccountTokenProgramA extends string = string,
106
+ TAccountTokenProgramB extends string = string,
107
+ TAccountSystemProgram extends string = string,
108
+ TAccountAtaProgram extends string = string,
109
+ > = {
110
+ positionOwner: TransactionSigner<TAccountPositionOwner>;
111
+ automation: Address<TAccountAutomation>;
112
+ automationTokenAccountA: Address<TAccountAutomationTokenAccountA>;
113
+ automationTokenAccountB: Address<TAccountAutomationTokenAccountB>;
114
+ position: Address<TAccountPosition>;
115
+ positionTokenAccount: Address<TAccountPositionTokenAccount>;
116
+ whirlpool: Address<TAccountWhirlpool>;
117
+ globalConfig: Address<TAccountGlobalConfig>;
118
+ tokenMintA: Address<TAccountTokenMintA>;
119
+ tokenMintB: Address<TAccountTokenMintB>;
120
+ tokenProgramA: Address<TAccountTokenProgramA>;
121
+ tokenProgramB: Address<TAccountTokenProgramB>;
122
+ systemProgram?: Address<TAccountSystemProgram>;
123
+ ataProgram?: Address<TAccountAtaProgram>;
124
+ action: CreateAutomationInstructionDataArgs['action'];
125
+ automationIndex: CreateAutomationInstructionDataArgs['automationIndex'];
126
+ conditions: CreateAutomationInstructionDataArgs['conditions'];
56
127
  };
57
- export declare function getCreateAutomationInstruction<TAccountPositionOwner extends string, TAccountAutomation extends string, TAccountAutomationTokenAccountA extends string, TAccountAutomationTokenAccountB extends string, TAccountPosition extends string, TAccountPositionTokenAccount extends string, TAccountWhirlpool extends string, TAccountGlobalConfig extends string, TAccountTokenMintA extends string, TAccountTokenMintB extends string, TAccountTokenProgramA extends string, TAccountTokenProgramB extends string, TAccountSystemProgram extends string, TAccountAtaProgram extends string, TProgramAddress extends Address = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS>(input: CreateAutomationInput<TAccountPositionOwner, TAccountAutomation, TAccountAutomationTokenAccountA, TAccountAutomationTokenAccountB, TAccountPosition, TAccountPositionTokenAccount, TAccountWhirlpool, TAccountGlobalConfig, TAccountTokenMintA, TAccountTokenMintB, TAccountTokenProgramA, TAccountTokenProgramB, TAccountSystemProgram, TAccountAtaProgram>, config?: {
128
+ export declare function getCreateAutomationInstruction<
129
+ TAccountPositionOwner extends string,
130
+ TAccountAutomation extends string,
131
+ TAccountAutomationTokenAccountA extends string,
132
+ TAccountAutomationTokenAccountB extends string,
133
+ TAccountPosition extends string,
134
+ TAccountPositionTokenAccount extends string,
135
+ TAccountWhirlpool extends string,
136
+ TAccountGlobalConfig extends string,
137
+ TAccountTokenMintA extends string,
138
+ TAccountTokenMintB extends string,
139
+ TAccountTokenProgramA extends string,
140
+ TAccountTokenProgramB extends string,
141
+ TAccountSystemProgram extends string,
142
+ TAccountAtaProgram extends string,
143
+ TProgramAddress extends Address = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS,
144
+ >(
145
+ input: CreateAutomationInput<
146
+ TAccountPositionOwner,
147
+ TAccountAutomation,
148
+ TAccountAutomationTokenAccountA,
149
+ TAccountAutomationTokenAccountB,
150
+ TAccountPosition,
151
+ TAccountPositionTokenAccount,
152
+ TAccountWhirlpool,
153
+ TAccountGlobalConfig,
154
+ TAccountTokenMintA,
155
+ TAccountTokenMintB,
156
+ TAccountTokenProgramA,
157
+ TAccountTokenProgramB,
158
+ TAccountSystemProgram,
159
+ TAccountAtaProgram
160
+ >,
161
+ config?: {
58
162
  programAddress?: TProgramAddress;
59
- }): CreateAutomationInstruction<TProgramAddress, TAccountPositionOwner, TAccountAutomation, TAccountAutomationTokenAccountA, TAccountAutomationTokenAccountB, TAccountPosition, TAccountPositionTokenAccount, TAccountWhirlpool, TAccountGlobalConfig, TAccountTokenMintA, TAccountTokenMintB, TAccountTokenProgramA, TAccountTokenProgramB, TAccountSystemProgram, TAccountAtaProgram>;
60
- export type ParsedCreateAutomationInstruction<TProgram extends string = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
61
- programAddress: Address<TProgram>;
62
- accounts: {
63
- positionOwner: TAccountMetas[0];
64
- automation: TAccountMetas[1];
65
- automationTokenAccountA: TAccountMetas[2];
66
- automationTokenAccountB: TAccountMetas[3];
67
- position: TAccountMetas[4];
68
- positionTokenAccount: TAccountMetas[5];
69
- whirlpool: TAccountMetas[6];
70
- globalConfig: TAccountMetas[7];
71
- tokenMintA: TAccountMetas[8];
72
- tokenMintB: TAccountMetas[9];
73
- tokenProgramA: TAccountMetas[10];
74
- tokenProgramB: TAccountMetas[11];
75
- systemProgram: TAccountMetas[12];
76
- ataProgram: TAccountMetas[13];
77
- };
78
- data: CreateAutomationInstructionData;
163
+ }
164
+ ): CreateAutomationInstruction<
165
+ TProgramAddress,
166
+ TAccountPositionOwner,
167
+ TAccountAutomation,
168
+ TAccountAutomationTokenAccountA,
169
+ TAccountAutomationTokenAccountB,
170
+ TAccountPosition,
171
+ TAccountPositionTokenAccount,
172
+ TAccountWhirlpool,
173
+ TAccountGlobalConfig,
174
+ TAccountTokenMintA,
175
+ TAccountTokenMintB,
176
+ TAccountTokenProgramA,
177
+ TAccountTokenProgramB,
178
+ TAccountSystemProgram,
179
+ TAccountAtaProgram
180
+ >;
181
+ export type ParsedCreateAutomationInstruction<
182
+ TProgram extends string = typeof WHIRLPOOLS_AUTOMATION_PROGRAM_PROGRAM_ADDRESS,
183
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
184
+ > = {
185
+ programAddress: Address<TProgram>;
186
+ accounts: {
187
+ positionOwner: TAccountMetas[0];
188
+ automation: TAccountMetas[1];
189
+ automationTokenAccountA: TAccountMetas[2];
190
+ automationTokenAccountB: TAccountMetas[3];
191
+ position: TAccountMetas[4];
192
+ positionTokenAccount: TAccountMetas[5];
193
+ whirlpool: TAccountMetas[6];
194
+ globalConfig: TAccountMetas[7];
195
+ tokenMintA: TAccountMetas[8];
196
+ tokenMintB: TAccountMetas[9];
197
+ tokenProgramA: TAccountMetas[10];
198
+ tokenProgramB: TAccountMetas[11];
199
+ systemProgram: TAccountMetas[12];
200
+ ataProgram: TAccountMetas[13];
201
+ };
202
+ data: CreateAutomationInstructionData;
79
203
  };
80
- export declare function parseCreateAutomationInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCreateAutomationInstruction<TProgram, TAccountMetas>;
204
+ export declare function parseCreateAutomationInstruction<
205
+ TProgram extends string,
206
+ TAccountMetas extends readonly AccountMeta[],
207
+ >(
208
+ instruction: Instruction<TProgram> &
209
+ InstructionWithAccounts<TAccountMetas> &
210
+ InstructionWithData<ReadonlyUint8Array>
211
+ ): ParsedCreateAutomationInstruction<TProgram, TAccountMetas>;