@lightprotocol/stateless.js 0.22.1-alpha.0 → 0.22.1-alpha.2
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/README.md +4 -1
- package/dist/cjs/browser/constants.d.ts +41 -7
- 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 +371 -277
- package/dist/cjs/browser/rpc.d.ts +79 -12
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +12 -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/get-state-tree-infos.d.ts +15 -0
- package/dist/cjs/browser/utils/index.d.ts +2 -1
- package/dist/cjs/browser/utils/instruction.d.ts +35 -0
- package/dist/cjs/browser/utils/pack-decompress.d.ts +31 -0
- package/dist/cjs/node/constants.d.ts +41 -7
- 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 +371 -277
- package/dist/cjs/node/rpc.d.ts +79 -12
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +12 -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/get-state-tree-infos.d.ts +15 -0
- package/dist/cjs/node/utils/index.d.ts +2 -1
- package/dist/cjs/node/utils/instruction.d.ts +35 -0
- package/dist/cjs/node/utils/pack-decompress.d.ts +31 -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 +176 -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 +2873 -0
- package/dist/es/browser/rpc.d.ts +361 -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 +38 -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 +245 -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 +63 -0
- package/dist/es/browser/utils/index.d.ts +14 -0
- package/dist/es/browser/utils/instruction.d.ts +35 -0
- package/dist/es/browser/utils/pack-decompress.d.ts +31 -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 +340 -661
- package/package.json +18 -10
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightprotocol/stateless.js",
|
|
3
|
-
"version": "0.22.1-alpha.
|
|
3
|
+
"version": "0.22.1-alpha.2",
|
|
4
4
|
"description": "JavaScript API for Light & ZK Compression",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/node/index.cjs",
|
|
@@ -49,9 +49,10 @@
|
|
|
49
49
|
"superstruct": "2.0.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@coral-xyz/anchor": "0.29.0",
|
|
52
|
+
"@coral-xyz/anchor": "^0.29.0",
|
|
53
53
|
"@coral-xyz/borsh": "^0.29.0",
|
|
54
54
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
55
|
+
"@eslint/js": "9.36.0",
|
|
55
56
|
"@lightprotocol/hasher.rs": "0.2.1",
|
|
56
57
|
"@playwright/test": "^1.47.1",
|
|
57
58
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -61,12 +62,12 @@
|
|
|
61
62
|
"@rollup/plugin-replace": "^5.0.7",
|
|
62
63
|
"@rollup/plugin-terser": "^0.4.4",
|
|
63
64
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
64
|
-
"@solana/web3.js": "1.98.
|
|
65
|
+
"@solana/web3.js": "1.98.4",
|
|
65
66
|
"@types/bn.js": "^5.1.5",
|
|
66
67
|
"@types/node": "^22.5.5",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
68
|
-
"@typescript-eslint/parser": "^
|
|
69
|
-
"eslint": "^
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.44.0",
|
|
70
|
+
"eslint": "^9.36.0",
|
|
70
71
|
"eslint-plugin-n": "^17.10.2",
|
|
71
72
|
"eslint-plugin-promise": "^7.1.0",
|
|
72
73
|
"eslint-plugin-vitest": "^0.5.4",
|
|
@@ -81,8 +82,7 @@
|
|
|
81
82
|
"tslib": "^2.7.0",
|
|
82
83
|
"tweetnacl": "1.0.3",
|
|
83
84
|
"typescript": "^5.6.2",
|
|
84
|
-
"vitest": "^2.1.1"
|
|
85
|
-
"@lightprotocol/programs": "0.3.0"
|
|
85
|
+
"vitest": "^2.1.1"
|
|
86
86
|
},
|
|
87
87
|
"nx": {
|
|
88
88
|
"targets": {
|
|
@@ -92,14 +92,21 @@
|
|
|
92
92
|
"{workspaceRoot}/target/idl",
|
|
93
93
|
"{workspaceRoot}/target/types"
|
|
94
94
|
]
|
|
95
|
+
},
|
|
96
|
+
"build-ci": {
|
|
97
|
+
"dependsOn": []
|
|
98
|
+
},
|
|
99
|
+
"test-ci": {
|
|
100
|
+
"dependsOn": []
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
},
|
|
98
104
|
"scripts": {
|
|
99
105
|
"test": "pnpm test:unit:all && pnpm test:e2e:all",
|
|
106
|
+
"test-ci": "vitest run tests/unit && pnpm test:e2e:all",
|
|
107
|
+
"test:v1": "pnpm build:v1 && LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit && LIGHT_PROTOCOL_VERSION=V1 pnpm test:e2e:all",
|
|
108
|
+
"test:v2": "pnpm build:v2 && LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit && LIGHT_PROTOCOL_VERSION=V2 pnpm test:e2e:all",
|
|
100
109
|
"test-all": "vitest run",
|
|
101
|
-
"test:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm test",
|
|
102
|
-
"test:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm test",
|
|
103
110
|
"test:unit:all": "vitest run tests/unit --reporter=verbose",
|
|
104
111
|
"test:unit:all:v1": "LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit --reporter=verbose",
|
|
105
112
|
"test:unit:all:v2": "LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit --reporter=verbose",
|
|
@@ -124,6 +131,7 @@
|
|
|
124
131
|
"build:bundle": "rimraf dist && rollup -c",
|
|
125
132
|
"build:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle",
|
|
126
133
|
"build:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle",
|
|
134
|
+
"build-ci": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi",
|
|
127
135
|
"format": "prettier --write .",
|
|
128
136
|
"lint": "eslint ."
|
|
129
137
|
}
|
|
@@ -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;
|