@lightprotocol/stateless.js 0.22.1-alpha.0 → 0.22.1-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.
- package/dist/cjs/browser/constants.d.ts +19 -4
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/index.d.ts +0 -1
- package/dist/cjs/browser/programs/system/pack.d.ts +10 -79
- package/dist/cjs/browser/rpc-interface.d.ts +275 -275
- package/dist/cjs/browser/rpc.d.ts +6 -16
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +6 -6
- package/dist/cjs/browser/utils/address.d.ts +7 -19
- package/dist/cjs/browser/utils/conversion.d.ts +1 -1
- package/dist/cjs/browser/utils/index.d.ts +1 -1
- package/dist/cjs/browser/utils/instruction.d.ts +35 -0
- package/dist/cjs/node/constants.d.ts +19 -4
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/index.d.ts +0 -1
- package/dist/cjs/node/programs/system/pack.d.ts +10 -79
- package/dist/cjs/node/rpc-interface.d.ts +275 -275
- package/dist/cjs/node/rpc.d.ts +6 -16
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +6 -6
- package/dist/cjs/node/utils/address.d.ts +7 -19
- package/dist/cjs/node/utils/conversion.d.ts +1 -1
- package/dist/cjs/node/utils/index.d.ts +1 -1
- package/dist/cjs/node/utils/instruction.d.ts +35 -0
- package/dist/es/browser/actions/compress.d.ts +18 -0
- package/dist/es/browser/actions/create-account.d.ts +38 -0
- package/dist/es/browser/actions/decompress.d.ts +15 -0
- package/dist/es/browser/actions/index.d.ts +5 -0
- package/dist/es/browser/actions/transfer.d.ts +16 -0
- package/dist/es/browser/constants.d.ts +157 -0
- package/dist/es/browser/errors.d.ts +74 -0
- package/dist/es/browser/index.d.ts +9 -0
- package/dist/es/browser/index.js +2 -0
- package/dist/es/browser/index.js.map +1 -0
- package/dist/es/browser/programs/index.d.ts +1 -0
- package/dist/es/browser/programs/system/idl.d.ts +997 -0
- package/dist/es/browser/programs/system/index.d.ts +5 -0
- package/dist/es/browser/programs/system/layout.d.ts +77 -0
- package/dist/es/browser/programs/system/pack.d.ts +74 -0
- package/dist/es/browser/programs/system/program.d.ts +175 -0
- package/dist/es/browser/programs/system/select-compressed-accounts.d.ts +10 -0
- package/dist/es/browser/rpc-interface.d.ts +2779 -0
- package/dist/es/browser/rpc.d.ts +284 -0
- package/dist/es/browser/state/BN254.d.ts +13 -0
- package/dist/es/browser/state/bn.d.ts +3 -0
- package/dist/es/browser/state/compressed-account.d.ts +205 -0
- package/dist/es/browser/state/index.d.ts +4 -0
- package/dist/es/browser/state/types.d.ts +449 -0
- package/dist/es/browser/test-helpers/index.d.ts +3 -0
- package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +2 -0
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +85 -0
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +92 -0
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +7 -0
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +40 -0
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +15 -0
- package/dist/es/browser/test-helpers/test-rpc/index.d.ts +3 -0
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +239 -0
- package/dist/es/browser/test-helpers/test-utils.d.ts +31 -0
- package/dist/es/browser/utils/address.d.ts +64 -0
- package/dist/es/browser/utils/airdrop.d.ts +7 -0
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +7 -0
- package/dist/es/browser/utils/conversion.d.ts +36 -0
- package/dist/es/browser/utils/dedupe-signer.d.ts +3 -0
- package/dist/es/browser/utils/get-state-tree-infos.d.ts +48 -0
- package/dist/es/browser/utils/index.d.ts +13 -0
- package/dist/es/browser/utils/instruction.d.ts +35 -0
- package/dist/es/browser/utils/parse-validity-proof.d.ts +20 -0
- package/dist/es/browser/utils/pipe.d.ts +2 -0
- package/dist/es/browser/utils/send-and-confirm.d.ts +52 -0
- package/dist/es/browser/utils/sleep.d.ts +1 -0
- package/dist/es/browser/utils/state-tree-lookup-table.d.ts +68 -0
- package/dist/es/browser/utils/validation.d.ts +8 -0
- package/dist/types/index.d.ts +109 -667
- package/package.json +16 -8
- package/dist/cjs/browser/compressible/action.d.ts +0 -77
- package/dist/cjs/browser/compressible/index.d.ts +0 -13
- package/dist/cjs/browser/compressible/instruction.d.ts +0 -177
- package/dist/cjs/browser/compressible/layout.d.ts +0 -47
- package/dist/cjs/browser/compressible/types.d.ts +0 -112
- package/dist/cjs/browser/compressible/utils.d.ts +0 -16
- package/dist/cjs/browser/utils/packed-accounts.d.ts +0 -161
- package/dist/cjs/node/compressible/action.d.ts +0 -77
- package/dist/cjs/node/compressible/index.d.ts +0 -13
- package/dist/cjs/node/compressible/instruction.d.ts +0 -177
- package/dist/cjs/node/compressible/layout.d.ts +0 -47
- package/dist/cjs/node/compressible/types.d.ts +0 -112
- package/dist/cjs/node/compressible/utils.d.ts +0 -16
- package/dist/cjs/node/utils/packed-accounts.d.ts +0 -161
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { AccountMeta, PublicKey } from '@solana/web3.js';
|
|
2
|
-
/**
|
|
3
|
-
* This file provides two variants of packed accounts for Light Protocol:
|
|
4
|
-
*
|
|
5
|
-
* 1. PackedAccounts - Matches CpiAccounts (11 system accounts)
|
|
6
|
-
* - Includes: LightSystemProgram, Authority, RegisteredProgramPda, NoopProgram,
|
|
7
|
-
* AccountCompressionAuthority, AccountCompressionProgram, InvokingProgram,
|
|
8
|
-
* [Optional: SolPoolPda, DecompressionRecipient], SystemProgram, [Optional: CpiContext]
|
|
9
|
-
*
|
|
10
|
-
* 2. PackedAccountsSmall - Matches CpiAccountsSmall (9 system accounts max)
|
|
11
|
-
* - Includes: LightSystemProgram, Authority, RegisteredProgramPda,
|
|
12
|
-
* AccountCompressionAuthority, AccountCompressionProgram, SystemProgram,
|
|
13
|
-
* [Optional: SolPoolPda, DecompressionRecipient, CpiContext]
|
|
14
|
-
* - Excludes: NoopProgram and InvokingProgram for a more compact structure
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Create a PackedAccounts instance to pack the light protocol system accounts
|
|
18
|
-
* for your custom program instruction. Typically, you will append them to the
|
|
19
|
-
* end of your instruction's accounts / remainingAccounts.
|
|
20
|
-
*
|
|
21
|
-
* This matches the full CpiAccounts structure with 11 system accounts including
|
|
22
|
-
* NoopProgram and InvokingProgram. For a more compact version, use PackedAccountsSmall.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const packedAccounts = PackedAccounts.newWithSystemAccounts(config);
|
|
27
|
-
*
|
|
28
|
-
* const instruction = new TransactionInstruction({
|
|
29
|
-
* keys: [...yourInstructionAccounts, ...packedAccounts.toAccountMetas()],
|
|
30
|
-
* programId: selfProgram,
|
|
31
|
-
* data: data,
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class PackedAccounts {
|
|
36
|
-
private preAccounts;
|
|
37
|
-
private systemAccounts;
|
|
38
|
-
private nextIndex;
|
|
39
|
-
private map;
|
|
40
|
-
static newWithSystemAccounts(config: SystemAccountMetaConfig): PackedAccounts;
|
|
41
|
-
addPreAccountsSigner(pubkey: PublicKey): void;
|
|
42
|
-
addPreAccountsSignerMut(pubkey: PublicKey): void;
|
|
43
|
-
addPreAccountsMeta(accountMeta: AccountMeta): void;
|
|
44
|
-
addSystemAccounts(config: SystemAccountMetaConfig): void;
|
|
45
|
-
insertOrGet(pubkey: PublicKey): number;
|
|
46
|
-
insertOrGetReadOnly(pubkey: PublicKey): number;
|
|
47
|
-
insertOrGetConfig(pubkey: PublicKey, isSigner: boolean, isWritable: boolean): number;
|
|
48
|
-
private hashSetAccountsToMetas;
|
|
49
|
-
private getOffsets;
|
|
50
|
-
toAccountMetas(): {
|
|
51
|
-
remainingAccounts: AccountMeta[];
|
|
52
|
-
systemStart: number;
|
|
53
|
-
packedStart: number;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Creates a PackedAccounts instance with system accounts for the specified
|
|
58
|
-
* program. This is a convenience wrapper around SystemAccountMetaConfig.new()
|
|
59
|
-
* and PackedAccounts.newWithSystemAccounts().
|
|
60
|
-
*
|
|
61
|
-
* @param programId - The program ID that will be using these system accounts
|
|
62
|
-
* @returns A new PackedAccounts instance with system accounts configured
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```ts
|
|
66
|
-
* const packedAccounts = createPackedAccounts(myProgram.programId);
|
|
67
|
-
*
|
|
68
|
-
* const instruction = new TransactionInstruction({
|
|
69
|
-
* keys: [...yourInstructionAccounts, ...packedAccounts.toAccountMetas().remainingAccounts],
|
|
70
|
-
* programId: myProgram.programId,
|
|
71
|
-
* data: instructionData,
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export declare function createPackedAccounts(programId: PublicKey): PackedAccounts;
|
|
76
|
-
/**
|
|
77
|
-
* Creates a PackedAccounts instance with system accounts and CPI context for the specified program.
|
|
78
|
-
* This is a convenience wrapper that includes CPI context configuration.
|
|
79
|
-
*
|
|
80
|
-
* @param programId - The program ID that will be using these system accounts
|
|
81
|
-
* @param cpiContext - The CPI context account public key
|
|
82
|
-
* @returns A new PackedAccounts instance with system accounts and CPI context configured
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* const packedAccounts = createPackedAccountsWithCpiContext(
|
|
87
|
-
* myProgram.programId,
|
|
88
|
-
* cpiContextAccount
|
|
89
|
-
* );
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export declare function createPackedAccountsWithCpiContext(programId: PublicKey, cpiContext: PublicKey): PackedAccounts;
|
|
93
|
-
export declare class SystemAccountMetaConfig {
|
|
94
|
-
selfProgram: PublicKey;
|
|
95
|
-
cpiContext?: PublicKey;
|
|
96
|
-
solCompressionRecipient?: PublicKey;
|
|
97
|
-
solPoolPda?: PublicKey;
|
|
98
|
-
private constructor();
|
|
99
|
-
static new(selfProgram: PublicKey): SystemAccountMetaConfig;
|
|
100
|
-
static newWithCpiContext(selfProgram: PublicKey, cpiContext: PublicKey): SystemAccountMetaConfig;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get the light protocol system accounts for your custom program instruction.
|
|
104
|
-
* Use via `link PackedAccounts.addSystemAccounts(config)`.
|
|
105
|
-
*/
|
|
106
|
-
export declare function getLightSystemAccountMetas(config: SystemAccountMetaConfig): AccountMeta[];
|
|
107
|
-
/**
|
|
108
|
-
* PackedAccountsSmall matches the CpiAccountsSmall structure with simplified account ordering.
|
|
109
|
-
* This is a more compact version that excludes NoopProgram and InvokingProgram.
|
|
110
|
-
*/
|
|
111
|
-
export declare class PackedAccountsSmall {
|
|
112
|
-
private preAccounts;
|
|
113
|
-
private systemAccounts;
|
|
114
|
-
private nextIndex;
|
|
115
|
-
private map;
|
|
116
|
-
static newWithSystemAccounts(config: SystemAccountMetaConfig): PackedAccountsSmall;
|
|
117
|
-
/**
|
|
118
|
-
* Returns the internal map of pubkey to [index, AccountMeta].
|
|
119
|
-
* For debugging purposes only.
|
|
120
|
-
*/
|
|
121
|
-
getNamedMetas(): Map<string, [number, AccountMeta]>;
|
|
122
|
-
addPreAccountsSigner(pubkey: PublicKey): void;
|
|
123
|
-
addPreAccountsSignerMut(pubkey: PublicKey): void;
|
|
124
|
-
addPreAccountsMeta(accountMeta: AccountMeta): void;
|
|
125
|
-
addSystemAccounts(config: SystemAccountMetaConfig): void;
|
|
126
|
-
insertOrGet(pubkey: PublicKey): number;
|
|
127
|
-
insertOrGetReadOnly(pubkey: PublicKey): number;
|
|
128
|
-
insertOrGetConfig(pubkey: PublicKey, isSigner: boolean, isWritable: boolean): number;
|
|
129
|
-
private hashSetAccountsToMetas;
|
|
130
|
-
private getOffsets;
|
|
131
|
-
toAccountMetas(): {
|
|
132
|
-
remainingAccounts: AccountMeta[];
|
|
133
|
-
systemStart: number;
|
|
134
|
-
packedStart: number;
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get the light protocol system accounts for the small variant.
|
|
139
|
-
* This matches CpiAccountsSmall ordering: removes NoopProgram and InvokingProgram.
|
|
140
|
-
*/
|
|
141
|
-
export declare function getLightSystemAccountMetasSmall(config: SystemAccountMetaConfig): AccountMeta[];
|
|
142
|
-
/**
|
|
143
|
-
* Creates a PackedAccountsSmall instance with system accounts for the specified program.
|
|
144
|
-
* This uses the simplified account ordering that matches CpiAccountsSmall.
|
|
145
|
-
*/
|
|
146
|
-
export declare function createPackedAccountsSmall(programId: PublicKey): PackedAccountsSmall;
|
|
147
|
-
/**
|
|
148
|
-
* Creates a PackedAccountsSmall instance with system accounts and CPI context.
|
|
149
|
-
*/
|
|
150
|
-
export declare function createPackedAccountsSmallWithCpiContext(programId: PublicKey, cpiContext: PublicKey): PackedAccountsSmall;
|
|
151
|
-
export declare class SystemAccountPubkeys {
|
|
152
|
-
lightSystemProgram: PublicKey;
|
|
153
|
-
systemProgram: PublicKey;
|
|
154
|
-
accountCompressionProgram: PublicKey;
|
|
155
|
-
accountCompressionAuthority: PublicKey;
|
|
156
|
-
registeredProgramPda: PublicKey;
|
|
157
|
-
noopProgram: PublicKey;
|
|
158
|
-
solPoolPda: PublicKey;
|
|
159
|
-
private constructor();
|
|
160
|
-
static default(): SystemAccountPubkeys;
|
|
161
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ConfirmOptions, PublicKey, Signer, TransactionSignature, AccountMeta } from '@solana/web3.js';
|
|
2
|
-
import { Rpc } from '../rpc';
|
|
3
|
-
import { ValidityProof } from '../state/types';
|
|
4
|
-
import { CompressedAccountMeta } from '../state/compressed-account';
|
|
5
|
-
import { CompressedAccountData } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Initialize a compression config for a compressible program
|
|
8
|
-
*
|
|
9
|
-
* @param rpc RPC connection to use
|
|
10
|
-
* @param payer Fee payer
|
|
11
|
-
* @param programId Program ID for the compressible program
|
|
12
|
-
* @param authority Program upgrade authority
|
|
13
|
-
* @param compressionDelay Compression delay (in slots)
|
|
14
|
-
* @param rentRecipient Rent recipient public key
|
|
15
|
-
* @param addressSpace Array of address space public keys
|
|
16
|
-
* @param configBump Optional config bump (defaults to 0)
|
|
17
|
-
* @param discriminator Optional custom discriminator (defaults to standard)
|
|
18
|
-
* @param confirmOptions Options for confirming the transaction
|
|
19
|
-
*
|
|
20
|
-
* @return Signature of the confirmed transaction
|
|
21
|
-
*/
|
|
22
|
-
export declare function initializeCompressionConfig(rpc: Rpc, payer: Signer, programId: PublicKey, authority: Signer, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null, discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
23
|
-
/**
|
|
24
|
-
* Update a compression config for a compressible program
|
|
25
|
-
*
|
|
26
|
-
* @param rpc RPC connection to use
|
|
27
|
-
* @param payer Fee payer
|
|
28
|
-
* @param programId Program ID for the compressible program
|
|
29
|
-
* @param authority Current config authority
|
|
30
|
-
* @param newCompressionDelay Optional new compression delay
|
|
31
|
-
* @param newRentRecipient Optional new rent recipient
|
|
32
|
-
* @param newAddressSpace Optional new address space array
|
|
33
|
-
* @param newUpdateAuthority Optional new update authority
|
|
34
|
-
* @param discriminator Optional custom discriminator (defaults to standard)
|
|
35
|
-
* @param confirmOptions Options for confirming the transaction
|
|
36
|
-
*
|
|
37
|
-
* @return Signature of the confirmed transaction
|
|
38
|
-
*/
|
|
39
|
-
export declare function updateCompressionConfig(rpc: Rpc, payer: Signer, programId: PublicKey, authority: Signer, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null, discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
40
|
-
/**
|
|
41
|
-
* Compress a generic compressible account
|
|
42
|
-
*
|
|
43
|
-
* @param rpc RPC connection to use
|
|
44
|
-
* @param payer Fee payer and signer
|
|
45
|
-
* @param programId Program ID for the compressible program
|
|
46
|
-
* @param pdaToCompress PDA to compress
|
|
47
|
-
* @param rentRecipient Rent recipient public key
|
|
48
|
-
* @param compressedAccountMeta Compressed account metadata
|
|
49
|
-
* @param validityProof Validity proof for compression
|
|
50
|
-
* @param systemAccounts Additional system accounts (trees, queues, etc.)
|
|
51
|
-
* @param discriminator Custom instruction discriminator (8 bytes)
|
|
52
|
-
* @param confirmOptions Options for confirming the transaction
|
|
53
|
-
*
|
|
54
|
-
* @return Signature of the confirmed transaction
|
|
55
|
-
*/
|
|
56
|
-
export declare function compressAccount(rpc: Rpc, payer: Signer, programId: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: CompressedAccountMeta, validityProof: ValidityProof, systemAccounts: AccountMeta[], discriminator: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
57
|
-
/**
|
|
58
|
-
* Decompress one or more compressed accounts idempotently
|
|
59
|
-
*
|
|
60
|
-
* @param rpc RPC connection to use
|
|
61
|
-
* @param payer Fee payer
|
|
62
|
-
* @param programId Program ID for the compressible program
|
|
63
|
-
* @param feePayer Fee payer (can be same as payer)
|
|
64
|
-
* @param rentPayer Rent payer
|
|
65
|
-
* @param solanaAccounts Array of PDA accounts to decompress
|
|
66
|
-
* @param compressedAccountsData Array of compressed account data
|
|
67
|
-
* @param bumps Array of PDA bumps
|
|
68
|
-
* @param validityProof Validity proof for decompression
|
|
69
|
-
* @param systemAccounts Additional system accounts (trees, queues, etc.)
|
|
70
|
-
* @param dataSchema Borsh schema for account data serialization
|
|
71
|
-
* @param discriminator Optional custom discriminator (defaults to standard)
|
|
72
|
-
* @param confirmOptions Options for confirming the transaction
|
|
73
|
-
*
|
|
74
|
-
* @return Signature of the confirmed transaction
|
|
75
|
-
*/
|
|
76
|
-
export declare function decompressAccountsIdempotent<T = any>(rpc: Rpc, payer: Signer, programId: PublicKey, feePayer: Signer, rentPayer: Signer, solanaAccounts: PublicKey[], compressedAccountsData: CompressedAccountData<T>[], bumps: number[], validityProof: ValidityProof, systemAccounts: AccountMeta[], dataSchema: any, // borsh.Layout<T>
|
|
77
|
-
discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { COMPRESSIBLE_DISCRIMINATORS, DecompressMultipleAccountsIdempotentData, UpdateCompressionConfigData, GenericCompressAccountInstruction, } from './types';
|
|
2
|
-
export { UpdateCompressionConfigSchema, ValidityProofSchema, PackedStateTreeInfoSchema, CompressedAccountMetaSchema, GenericCompressAccountInstructionSchema, createCompressedAccountDataSchema, createDecompressMultipleAccountsIdempotentDataSchema, serializeInstructionData, } from './layout';
|
|
3
|
-
export { createInitializeCompressionConfigInstruction, createUpdateCompressionConfigInstruction, createCompressAccountInstruction, createDecompressAccountsIdempotentInstruction, CompressibleInstruction, } from './instruction';
|
|
4
|
-
export { initializeCompressionConfig, updateCompressionConfig, compressAccount, decompressAccountsIdempotent, } from './action';
|
|
5
|
-
export { deriveCompressionConfigAddress, getProgramDataAccount, checkProgramUpdateAuthority, } from './utils';
|
|
6
|
-
export { serializeInitializeCompressionConfigData } from './layout';
|
|
7
|
-
import { CompressedAccount } from '../state/compressed-account';
|
|
8
|
-
import { CompressedAccountData } from './types';
|
|
9
|
-
/**
|
|
10
|
-
* Convert a compressed account to the format expected by instruction builders
|
|
11
|
-
*/
|
|
12
|
-
export declare function createCompressedAccountData<T>(compressedAccount: CompressedAccount, data: T, seeds: Uint8Array[], outputStateTreeIndex: number): CompressedAccountData<T>;
|
|
13
|
-
export { CompressibleInstruction as compressibleInstruction } from './instruction';
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { PublicKey, TransactionInstruction, AccountMeta } from '@solana/web3.js';
|
|
2
|
-
import { CompressedAccountData } from './types';
|
|
3
|
-
import { CompressedAccount } from '../state/compressed-account';
|
|
4
|
-
/**
|
|
5
|
-
* Create an instruction to initialize a compression config.
|
|
6
|
-
*
|
|
7
|
-
* @param programId Program ID for the compressible program
|
|
8
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
9
|
-
* @param payer Fee payer
|
|
10
|
-
* @param authority Program upgrade authority
|
|
11
|
-
* @param compressionDelay Compression delay (in slots)
|
|
12
|
-
* @param rentRecipient Rent recipient public key
|
|
13
|
-
* @param addressSpace Array of address space public keys
|
|
14
|
-
* @param configBump Optional config bump (defaults to 0)
|
|
15
|
-
* @returns TransactionInstruction
|
|
16
|
-
*/
|
|
17
|
-
export declare function createInitializeCompressionConfigInstruction(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, authority: PublicKey, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null): TransactionInstruction;
|
|
18
|
-
/**
|
|
19
|
-
* Create an instruction to update a compression config.
|
|
20
|
-
*
|
|
21
|
-
* @param programId Program ID for the compressible program
|
|
22
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
23
|
-
* @param authority Current config authority
|
|
24
|
-
* @param newCompressionDelay Optional new compression delay
|
|
25
|
-
* @param newRentRecipient Optional new rent recipient
|
|
26
|
-
* @param newAddressSpace Optional new address space array
|
|
27
|
-
* @param newUpdateAuthority Optional new update authority
|
|
28
|
-
* @returns TransactionInstruction
|
|
29
|
-
*/
|
|
30
|
-
export declare function createUpdateCompressionConfigInstruction(programId: PublicKey, discriminator: Uint8Array | number[], authority: PublicKey, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null): TransactionInstruction;
|
|
31
|
-
/**
|
|
32
|
-
* Create an instruction to compress a generic compressible account.
|
|
33
|
-
*
|
|
34
|
-
* @param programId Program ID for the compressible program
|
|
35
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
36
|
-
* @param payer Fee payer
|
|
37
|
-
* @param pdaToCompress PDA to compress
|
|
38
|
-
* @param rentRecipient Rent recipient public key
|
|
39
|
-
* @param compressedAccountMeta Compressed account metadata
|
|
40
|
-
* @param validityProof Validity proof for compression
|
|
41
|
-
* @param systemAccounts Additional system accounts (optional)
|
|
42
|
-
* @returns TransactionInstruction
|
|
43
|
-
*/
|
|
44
|
-
export declare function createCompressAccountInstruction(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: import('../state/compressed-account').CompressedAccountMeta, validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[]): TransactionInstruction;
|
|
45
|
-
/**
|
|
46
|
-
* Create an instruction to decompress one or more compressed accounts idempotently.
|
|
47
|
-
*
|
|
48
|
-
* @param programId Program ID for the compressible program
|
|
49
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
50
|
-
* @param feePayer Fee payer
|
|
51
|
-
* @param rentPayer Rent payer
|
|
52
|
-
* @param solanaAccounts Array of PDA accounts to decompress
|
|
53
|
-
* @param compressedAccountsData Array of compressed account data
|
|
54
|
-
* @param bumps Array of PDA bumps
|
|
55
|
-
* @param validityProof Validity proof for decompression
|
|
56
|
-
* @param systemAccounts Additional system accounts (optional)
|
|
57
|
-
* @param coder Borsh schema for account data
|
|
58
|
-
* @returns TransactionInstruction
|
|
59
|
-
*/
|
|
60
|
-
export declare function createDecompressAccountsIdempotentInstruction<T = any>(programId: PublicKey, discriminator: Uint8Array | number[], feePayer: PublicKey, rentPayer: PublicKey, solanaAccounts: PublicKey[], compressedAccountsData: import('./types').CompressedAccountData<T>[], bumps: number[], validityProof: import('../state/types').ValidityProof, systemAccounts: AccountMeta[] | undefined, coder: (data: any) => Buffer): TransactionInstruction;
|
|
61
|
-
/**
|
|
62
|
-
* Instruction builders for compressible accounts, following Solana SDK patterns.
|
|
63
|
-
*/
|
|
64
|
-
export declare class CompressibleInstruction {
|
|
65
|
-
/**
|
|
66
|
-
* Create an instruction to initialize a compression config.
|
|
67
|
-
*
|
|
68
|
-
* @param programId Program ID for the compressible program
|
|
69
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
70
|
-
* @param payer Fee payer
|
|
71
|
-
* @param authority Program upgrade authority
|
|
72
|
-
* @param compressionDelay Compression delay (in slots)
|
|
73
|
-
* @param rentRecipient Rent recipient public key
|
|
74
|
-
* @param addressSpace Array of address space public keys
|
|
75
|
-
* @param configBump Optional config bump (defaults to 0)
|
|
76
|
-
* @returns TransactionInstruction
|
|
77
|
-
*/
|
|
78
|
-
static initializeCompressionConfig(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, authority: PublicKey, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null): TransactionInstruction;
|
|
79
|
-
/**
|
|
80
|
-
* Create an instruction to update a compression config.
|
|
81
|
-
*
|
|
82
|
-
* @param programId Program ID for the compressible program
|
|
83
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
84
|
-
* @param authority Current config authority
|
|
85
|
-
* @param newCompressionDelay Optional new compression delay
|
|
86
|
-
* @param newRentRecipient Optional new rent recipient
|
|
87
|
-
* @param newAddressSpace Optional new address space array
|
|
88
|
-
* @param newUpdateAuthority Optional new update authority
|
|
89
|
-
* @returns TransactionInstruction
|
|
90
|
-
*/
|
|
91
|
-
static updateCompressionConfig(programId: PublicKey, discriminator: Uint8Array | number[], authority: PublicKey, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null): TransactionInstruction;
|
|
92
|
-
/**
|
|
93
|
-
* Create an instruction to compress a generic compressible account.
|
|
94
|
-
*
|
|
95
|
-
* @param programId Program ID for the compressible program
|
|
96
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
97
|
-
* @param payer Fee payer
|
|
98
|
-
* @param pdaToCompress PDA to compress
|
|
99
|
-
* @param rentRecipient Rent recipient public key
|
|
100
|
-
* @param compressedAccountMeta Compressed account metadata
|
|
101
|
-
* @param validityProof Validity proof for compression
|
|
102
|
-
* @param systemAccounts Additional system accounts (optional)
|
|
103
|
-
* @returns TransactionInstruction
|
|
104
|
-
*/
|
|
105
|
-
static compressAccount(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: import('../state/compressed-account').CompressedAccountMeta, validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[]): TransactionInstruction;
|
|
106
|
-
/**
|
|
107
|
-
* Create an instruction to decompress one or more compressed accounts idempotently.
|
|
108
|
-
*
|
|
109
|
-
* @param programId Program ID for the compressible program
|
|
110
|
-
* @param discriminator Instruction discriminator (8 bytes)
|
|
111
|
-
* @param feePayer Fee payer
|
|
112
|
-
* @param rentPayer Rent payer
|
|
113
|
-
* @param solanaAccounts Array of PDA accounts to decompress
|
|
114
|
-
* @param compressedAccountsData Array of compressed account data
|
|
115
|
-
* @param bumps Array of PDA bumps
|
|
116
|
-
* @param validityProof Validity proof for decompression
|
|
117
|
-
* @param systemAccounts Additional system accounts (optional)
|
|
118
|
-
* @param dataSchema Borsh schema for account data
|
|
119
|
-
* @returns TransactionInstruction
|
|
120
|
-
*/
|
|
121
|
-
static decompressAccountsIdempotent<T = any>(programId: PublicKey, discriminator: Uint8Array | number[], feePayer: PublicKey, rentPayer: PublicKey, solanaAccounts: PublicKey[], compressedAccountsData: import('./types').CompressedAccountData<T>[], bumps: number[], validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[], dataSchema?: any): TransactionInstruction;
|
|
122
|
-
/**
|
|
123
|
-
* Standard instruction discriminators for compressible instructions
|
|
124
|
-
*/
|
|
125
|
-
static readonly DISCRIMINATORS: {
|
|
126
|
-
readonly INITIALIZE_COMPRESSION_CONFIG: readonly [133, 228, 12, 169, 56, 76, 222, 61];
|
|
127
|
-
readonly UPDATE_COMPRESSION_CONFIG: readonly [135, 215, 243, 81, 163, 146, 33, 70];
|
|
128
|
-
readonly DECOMPRESS_ACCOUNTS_IDEMPOTENT: readonly [114, 67, 61, 123, 234, 31, 1, 112];
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Derive the compression config PDA address
|
|
132
|
-
*
|
|
133
|
-
* @param programId Program ID for the compressible program
|
|
134
|
-
* @param configIndex Config index (defaults to 0)
|
|
135
|
-
* @returns [PDA address, bump seed]
|
|
136
|
-
*/
|
|
137
|
-
static deriveCompressionConfigAddress(programId: PublicKey, configIndex?: number): [PublicKey, number];
|
|
138
|
-
/**
|
|
139
|
-
* Get the program data account address and its raw data for a given program
|
|
140
|
-
*
|
|
141
|
-
* @param programId Program ID
|
|
142
|
-
* @param connection Solana connection
|
|
143
|
-
* @returns Program data address and account info
|
|
144
|
-
*/
|
|
145
|
-
static getProgramDataAccount(programId: PublicKey, connection: import('@solana/web3.js').Connection): Promise<{
|
|
146
|
-
programDataAddress: PublicKey;
|
|
147
|
-
programDataAccountInfo: import('@solana/web3.js').AccountInfo<Buffer>;
|
|
148
|
-
}>;
|
|
149
|
-
/**
|
|
150
|
-
* Check that the provided authority matches the program's upgrade authority
|
|
151
|
-
*
|
|
152
|
-
* @param programDataAccountInfo Program data account info
|
|
153
|
-
* @param providedAuthority Authority to validate
|
|
154
|
-
* @throws Error if authority doesn't match
|
|
155
|
-
*/
|
|
156
|
-
static checkProgramUpdateAuthority(programDataAccountInfo: import('@solana/web3.js').AccountInfo<Buffer>, providedAuthority: PublicKey): void;
|
|
157
|
-
/**
|
|
158
|
-
* Serialize instruction data for initializeCompressionConfig using Borsh
|
|
159
|
-
*
|
|
160
|
-
* @param compressionDelay Compression delay (in slots)
|
|
161
|
-
* @param rentRecipient Rent recipient public key
|
|
162
|
-
* @param addressSpace Array of address space public keys
|
|
163
|
-
* @param configBump Optional config bump
|
|
164
|
-
* @returns Serialized instruction data with discriminator
|
|
165
|
-
*/
|
|
166
|
-
static serializeInitializeCompressionConfigData(compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump: number | null): Buffer;
|
|
167
|
-
/**
|
|
168
|
-
* Convert a compressed account to the format expected by instruction builders
|
|
169
|
-
*
|
|
170
|
-
* @param compressedAccount Compressed account from state
|
|
171
|
-
* @param data Program-specific account data
|
|
172
|
-
* @param seeds PDA seeds (without bump)
|
|
173
|
-
* @param outputStateTreeIndex Output state tree index
|
|
174
|
-
* @returns Compressed account data for instructions
|
|
175
|
-
*/
|
|
176
|
-
static createCompressedAccountData<T>(compressedAccount: CompressedAccount, data: T, seeds: Uint8Array[], outputStateTreeIndex: number): CompressedAccountData<T>;
|
|
177
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as borsh from '@coral-xyz/borsh';
|
|
2
|
-
import { ValidityProof } from '../state/types';
|
|
3
|
-
import { PackedStateTreeInfo, CompressedAccountMeta } from '../state/compressed-account';
|
|
4
|
-
import { CompressionConfigIxData, UpdateCompressionConfigData, GenericCompressAccountInstruction, CompressedAccountData, DecompressMultipleAccountsIdempotentData } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Borsh schema for initializeCompressionConfig instruction data
|
|
7
|
-
* Note: This is also available from '@lightprotocol/stateless.js' main exports
|
|
8
|
-
*/
|
|
9
|
-
export declare const InitializeCompressionConfigSchema: borsh.Layout<CompressionConfigIxData>;
|
|
10
|
-
/**
|
|
11
|
-
* Borsh schema for updateCompressionConfig instruction data
|
|
12
|
-
*/
|
|
13
|
-
export declare const UpdateCompressionConfigSchema: borsh.Layout<UpdateCompressionConfigData>;
|
|
14
|
-
/**
|
|
15
|
-
* Borsh schema for ValidityProof
|
|
16
|
-
*/
|
|
17
|
-
export declare const ValidityProofSchema: borsh.Layout<ValidityProof>;
|
|
18
|
-
/**
|
|
19
|
-
* Borsh schema for PackedStateTreeInfo
|
|
20
|
-
*/
|
|
21
|
-
export declare const PackedStateTreeInfoSchema: borsh.Layout<PackedStateTreeInfo>;
|
|
22
|
-
/**
|
|
23
|
-
* Borsh schema for CompressedAccountMeta
|
|
24
|
-
*/
|
|
25
|
-
export declare const CompressedAccountMetaSchema: borsh.Layout<CompressedAccountMeta>;
|
|
26
|
-
/**
|
|
27
|
-
* Borsh schema for GenericCompressAccountInstruction
|
|
28
|
-
*/
|
|
29
|
-
export declare const GenericCompressAccountInstructionSchema: borsh.Layout<GenericCompressAccountInstruction>;
|
|
30
|
-
/**
|
|
31
|
-
* Helper function to create borsh schema for CompressedAccountData
|
|
32
|
-
* This is generic to work with any data type T
|
|
33
|
-
*/
|
|
34
|
-
export declare function createCompressedAccountDataSchema<T>(dataSchema: borsh.Layout<T>): borsh.Layout<CompressedAccountData<T>>;
|
|
35
|
-
/**
|
|
36
|
-
* Helper function to create borsh schema for DecompressMultipleAccountsIdempotentData
|
|
37
|
-
* This is generic to work with any data type T
|
|
38
|
-
*/
|
|
39
|
-
export declare function createDecompressMultipleAccountsIdempotentDataSchema<T>(dataSchema: borsh.Layout<T>): borsh.Layout<DecompressMultipleAccountsIdempotentData<T>>;
|
|
40
|
-
/**
|
|
41
|
-
* Serialize instruction data with custom discriminator
|
|
42
|
-
*/
|
|
43
|
-
export declare function serializeInstructionData<T>(schema: borsh.Layout<T>, data: T, discriminator: Uint8Array | number[]): Buffer;
|
|
44
|
-
/**
|
|
45
|
-
* Serialize instruction data for initializeCompressionConfig using Borsh
|
|
46
|
-
*/
|
|
47
|
-
export declare function serializeInitializeCompressionConfigData(compressionDelay: number, rentRecipient: import('@solana/web3.js').PublicKey, addressSpace: import('@solana/web3.js').PublicKey[], configBump: number | null): Buffer;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { PublicKey, AccountMeta } from '@solana/web3.js';
|
|
2
|
-
import { ValidityProof } from '../state/types';
|
|
3
|
-
import { CompressedAccountMeta } from '../state/compressed-account';
|
|
4
|
-
/**
|
|
5
|
-
* Standard instruction discriminators for compressible instructions
|
|
6
|
-
* These match the Rust implementation discriminators
|
|
7
|
-
*/
|
|
8
|
-
export declare const COMPRESSIBLE_DISCRIMINATORS: {
|
|
9
|
-
readonly INITIALIZE_COMPRESSION_CONFIG: readonly [133, 228, 12, 169, 56, 76, 222, 61];
|
|
10
|
-
readonly UPDATE_COMPRESSION_CONFIG: readonly [135, 215, 243, 81, 163, 146, 33, 70];
|
|
11
|
-
readonly DECOMPRESS_ACCOUNTS_IDEMPOTENT: readonly [114, 67, 61, 123, 234, 31, 1, 112];
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Generic compressed account data structure for decompress operations
|
|
15
|
-
* This is generic over the account variant type, allowing programs to use their specific enums
|
|
16
|
-
*/
|
|
17
|
-
export type CompressedAccountData<T = any> = {
|
|
18
|
-
/** The compressed account metadata containing tree info, address, and output index */
|
|
19
|
-
meta: CompressedAccountMeta;
|
|
20
|
-
/** Program-specific account variant enum */
|
|
21
|
-
data: T;
|
|
22
|
-
/** PDA seeds (without bump) used to derive the PDA address */
|
|
23
|
-
seeds: Uint8Array[];
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Instruction data structure for decompress_accounts_idempotent
|
|
27
|
-
* This matches the exact format expected by Anchor programs
|
|
28
|
-
*/
|
|
29
|
-
export type DecompressMultipleAccountsIdempotentData<T = any> = {
|
|
30
|
-
proof: ValidityProof;
|
|
31
|
-
compressedAccounts: CompressedAccountData<T>[];
|
|
32
|
-
bumps: number[];
|
|
33
|
-
systemAccountsOffset: number;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Instruction data for update compression config
|
|
37
|
-
*/
|
|
38
|
-
export type UpdateCompressionConfigData = {
|
|
39
|
-
newCompressionDelay: number | null;
|
|
40
|
-
newRentRecipient: PublicKey | null;
|
|
41
|
-
newAddressSpace: PublicKey[] | null;
|
|
42
|
-
newUpdateAuthority: PublicKey | null;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Generic instruction data for compress account
|
|
46
|
-
* This matches the expected format for compress account instructions
|
|
47
|
-
*/
|
|
48
|
-
export type GenericCompressAccountInstruction = {
|
|
49
|
-
proof: ValidityProof;
|
|
50
|
-
compressedAccountMeta: CompressedAccountMeta;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Existing CompressionConfigIxData type (re-exported for compatibility)
|
|
54
|
-
*/
|
|
55
|
-
export type CompressionConfigIxData = {
|
|
56
|
-
compressionDelay: number;
|
|
57
|
-
rentRecipient: PublicKey;
|
|
58
|
-
addressSpace: PublicKey[];
|
|
59
|
-
configBump: number | null;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Common instruction builder parameters
|
|
63
|
-
*/
|
|
64
|
-
export type InstructionBuilderParams = {
|
|
65
|
-
programId: PublicKey;
|
|
66
|
-
discriminator: Uint8Array | number[];
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Initialize compression config instruction parameters
|
|
70
|
-
*/
|
|
71
|
-
export type InitializeCompressionConfigParams = InstructionBuilderParams & {
|
|
72
|
-
payer: PublicKey;
|
|
73
|
-
authority: PublicKey;
|
|
74
|
-
compressionDelay: number;
|
|
75
|
-
rentRecipient: PublicKey;
|
|
76
|
-
addressSpace: PublicKey[];
|
|
77
|
-
configBump?: number | null;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Update compression config instruction parameters
|
|
81
|
-
*/
|
|
82
|
-
export type UpdateCompressionConfigParams = InstructionBuilderParams & {
|
|
83
|
-
authority: PublicKey;
|
|
84
|
-
newCompressionDelay?: number | null;
|
|
85
|
-
newRentRecipient?: PublicKey | null;
|
|
86
|
-
newAddressSpace?: PublicKey[] | null;
|
|
87
|
-
newUpdateAuthority?: PublicKey | null;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Compress account instruction parameters
|
|
91
|
-
*/
|
|
92
|
-
export type CompressAccountParams = InstructionBuilderParams & {
|
|
93
|
-
payer: PublicKey;
|
|
94
|
-
pdaToCompress: PublicKey;
|
|
95
|
-
rentRecipient: PublicKey;
|
|
96
|
-
compressedAccountMeta: CompressedAccountMeta;
|
|
97
|
-
validityProof: ValidityProof;
|
|
98
|
-
systemAccounts?: AccountMeta[];
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Decompress accounts idempotent instruction parameters
|
|
102
|
-
*/
|
|
103
|
-
export type DecompressAccountsIdempotentParams<T = any> = InstructionBuilderParams & {
|
|
104
|
-
feePayer: PublicKey;
|
|
105
|
-
rentPayer: PublicKey;
|
|
106
|
-
solanaAccounts: PublicKey[];
|
|
107
|
-
compressedAccountsData: CompressedAccountData<T>[];
|
|
108
|
-
bumps: number[];
|
|
109
|
-
validityProof: ValidityProof;
|
|
110
|
-
systemAccounts?: AccountMeta[];
|
|
111
|
-
dataSchema?: any;
|
|
112
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Connection, PublicKey, AccountInfo } from '@solana/web3.js';
|
|
2
|
-
/**
|
|
3
|
-
* Derive the compression config PDA address
|
|
4
|
-
*/
|
|
5
|
-
export declare function deriveCompressionConfigAddress(programId: PublicKey, configIndex?: number): [PublicKey, number];
|
|
6
|
-
/**
|
|
7
|
-
* Get the program data account address and its raw data for a given program.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getProgramDataAccount(programId: PublicKey, connection: Connection): Promise<{
|
|
10
|
-
programDataAddress: PublicKey;
|
|
11
|
-
programDataAccountInfo: AccountInfo<Buffer>;
|
|
12
|
-
}>;
|
|
13
|
-
/**
|
|
14
|
-
* Check that the provided authority matches the program's upgrade authority.
|
|
15
|
-
*/
|
|
16
|
-
export declare function checkProgramUpdateAuthority(programDataAccountInfo: AccountInfo<Buffer>, providedAuthority: PublicKey): void;
|