@lightprotocol/stateless.js 0.15.0 → 0.15.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 +5 -21
- package/dist/cjs/browser/index.cjs +104 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +104 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +104 -1
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +103 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<img src="https://github.com/ldiego08/light-protocol/raw/main/assets/logo.svg" width="90" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center"
|
|
5
|
+
<h1 align="center">@lightprotocol/stateless.js</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<b>
|
|
8
|
+
<b>This is the JavaScript SDK for building Solana applications with ZK Compression for Node and web.</b>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
@@ -16,14 +16,6 @@
|
|
|
16
16
|
<img src="https://img.shields.io/npm/dw/%40lightprotocol%2Fstateless.js" alt="package weekly downloads" height="18" />
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
## Overview
|
|
20
|
-
|
|
21
|
-
This package provides server and web applications with clients, utilities, and types to leverage the power of [ZK Compression](https://www.zkcompression.com/) on Solana via the Compression RPC API.
|
|
22
|
-
|
|
23
|
-
> The core ZK Compression Solana programs and clients are maintained by
|
|
24
|
-
> [Light](https://github.com/lightprotocol) as a part of the Light Protocol. The RPC API and indexer are maintained by
|
|
25
|
-
> [Helius Labs](https://github.com/helius-labs).
|
|
26
|
-
|
|
27
19
|
## Usage
|
|
28
20
|
|
|
29
21
|
### Installation
|
|
@@ -31,22 +23,14 @@ This package provides server and web applications with clients, utilities, and t
|
|
|
31
23
|
Install this package in your project by running the following terminal command:
|
|
32
24
|
|
|
33
25
|
```bin
|
|
34
|
-
npm install --save
|
|
35
|
-
@lightprotocol/stateless.js \
|
|
36
|
-
@solana/web3.js \
|
|
37
|
-
@coral-xyz/anchor@0.29
|
|
26
|
+
npm install --save @lightprotocol/stateless.js
|
|
38
27
|
```
|
|
39
28
|
|
|
40
|
-
### Dependencies
|
|
41
|
-
|
|
42
|
-
- [`@solana/web3.js`](https://www.npmjs.com/package/@solana/web3.js) — provides access to the Solana network via RPC.
|
|
43
|
-
- [`@coral-xyz/anchor`](https://www.npmjs.com/package/@coral-xyz/anchor) — a client for [Anchor](https://www.anchor-lang.com/) Solana programs.
|
|
44
|
-
|
|
45
29
|
## Documentation and Examples
|
|
46
30
|
|
|
47
31
|
For a more detailed documentation on usage, please check [the respective section at the ZK Compression documentation.](https://www.zkcompression.com/developers/typescript-client)
|
|
48
32
|
|
|
49
|
-
For example implementations, including web and
|
|
33
|
+
For example implementations, including web and Node, refer to the respective repositories:
|
|
50
34
|
|
|
51
35
|
- [Web application example implementation](https://github.com/Lightprotocol/example-web-client)
|
|
52
36
|
|
|
@@ -55,7 +39,7 @@ For example implementations, including web and server, refer to the respective r
|
|
|
55
39
|
## Troubleshooting
|
|
56
40
|
|
|
57
41
|
Have a question or a problem?
|
|
58
|
-
Feel free to ask in the [Light](https://discord.gg/CYvjBgzRFP) and [Helius](https://discord.gg/Uzzf6a7zKr) developer Discord servers. Please, include the following information
|
|
42
|
+
Feel free to ask in the [Light](https://discord.gg/CYvjBgzRFP) and [Helius](https://discord.gg/Uzzf6a7zKr) developer Discord servers. Please, include the following information:
|
|
59
43
|
|
|
60
44
|
- A detailed description or context of the issue or what you are trying to achieve.
|
|
61
45
|
- A code example that we can use to test and debug (if possible). Use [CodeSandbox](https://codesandbox.io/p/sandbox/vanilla-ts) or any other live environment provider.
|
|
@@ -10338,6 +10338,106 @@ const IDL = {
|
|
|
10338
10338
|
},
|
|
10339
10339
|
],
|
|
10340
10340
|
},
|
|
10341
|
+
{
|
|
10342
|
+
name: 'compressSplTokenAccount',
|
|
10343
|
+
accounts: [
|
|
10344
|
+
{
|
|
10345
|
+
name: 'feePayer',
|
|
10346
|
+
isMut: true,
|
|
10347
|
+
isSigner: true,
|
|
10348
|
+
docs: ['UNCHECKED: only pays fees.'],
|
|
10349
|
+
},
|
|
10350
|
+
{
|
|
10351
|
+
name: 'authority',
|
|
10352
|
+
isMut: false,
|
|
10353
|
+
isSigner: true,
|
|
10354
|
+
docs: [
|
|
10355
|
+
'Authority is verified through proof since both owner and delegate',
|
|
10356
|
+
'are included in the token data hash, which is a public input to the',
|
|
10357
|
+
'validity proof.',
|
|
10358
|
+
],
|
|
10359
|
+
},
|
|
10360
|
+
{
|
|
10361
|
+
name: 'cpiAuthorityPda',
|
|
10362
|
+
isMut: false,
|
|
10363
|
+
isSigner: false,
|
|
10364
|
+
},
|
|
10365
|
+
{
|
|
10366
|
+
name: 'lightSystemProgram',
|
|
10367
|
+
isMut: false,
|
|
10368
|
+
isSigner: false,
|
|
10369
|
+
},
|
|
10370
|
+
{
|
|
10371
|
+
name: 'registeredProgramPda',
|
|
10372
|
+
isMut: false,
|
|
10373
|
+
isSigner: false,
|
|
10374
|
+
},
|
|
10375
|
+
{
|
|
10376
|
+
name: 'noopProgram',
|
|
10377
|
+
isMut: false,
|
|
10378
|
+
isSigner: false,
|
|
10379
|
+
},
|
|
10380
|
+
{
|
|
10381
|
+
name: 'accountCompressionAuthority',
|
|
10382
|
+
isMut: false,
|
|
10383
|
+
isSigner: false,
|
|
10384
|
+
},
|
|
10385
|
+
{
|
|
10386
|
+
name: 'accountCompressionProgram',
|
|
10387
|
+
isMut: false,
|
|
10388
|
+
isSigner: false,
|
|
10389
|
+
},
|
|
10390
|
+
{
|
|
10391
|
+
name: 'selfProgram',
|
|
10392
|
+
isMut: false,
|
|
10393
|
+
isSigner: false,
|
|
10394
|
+
docs: ['this program is the signer of the cpi.'],
|
|
10395
|
+
},
|
|
10396
|
+
{
|
|
10397
|
+
name: 'tokenPoolPda',
|
|
10398
|
+
isMut: true,
|
|
10399
|
+
isSigner: false,
|
|
10400
|
+
isOptional: true,
|
|
10401
|
+
},
|
|
10402
|
+
{
|
|
10403
|
+
name: 'compressOrDecompressTokenAccount',
|
|
10404
|
+
isMut: true,
|
|
10405
|
+
isSigner: false,
|
|
10406
|
+
isOptional: true,
|
|
10407
|
+
},
|
|
10408
|
+
{
|
|
10409
|
+
name: 'tokenProgram',
|
|
10410
|
+
isMut: false,
|
|
10411
|
+
isSigner: false,
|
|
10412
|
+
isOptional: true,
|
|
10413
|
+
},
|
|
10414
|
+
{
|
|
10415
|
+
name: 'systemProgram',
|
|
10416
|
+
isMut: false,
|
|
10417
|
+
isSigner: false,
|
|
10418
|
+
},
|
|
10419
|
+
],
|
|
10420
|
+
args: [
|
|
10421
|
+
{
|
|
10422
|
+
name: 'owner',
|
|
10423
|
+
type: 'publicKey',
|
|
10424
|
+
},
|
|
10425
|
+
{
|
|
10426
|
+
name: 'remainingAmount',
|
|
10427
|
+
type: {
|
|
10428
|
+
option: 'u64',
|
|
10429
|
+
},
|
|
10430
|
+
},
|
|
10431
|
+
{
|
|
10432
|
+
name: 'cpiContext',
|
|
10433
|
+
type: {
|
|
10434
|
+
option: {
|
|
10435
|
+
defined: 'CompressedCpiContext',
|
|
10436
|
+
},
|
|
10437
|
+
},
|
|
10438
|
+
},
|
|
10439
|
+
],
|
|
10440
|
+
},
|
|
10341
10441
|
{
|
|
10342
10442
|
name: 'transfer',
|
|
10343
10443
|
docs: [
|
|
@@ -12615,7 +12715,7 @@ async function getCompressedTokenAccountsByOwnerOrDelegate(rpc, ownerOrDelegate,
|
|
|
12615
12715
|
var _a;
|
|
12616
12716
|
const _account = item.account;
|
|
12617
12717
|
const _tokenData = item.tokenData;
|
|
12618
|
-
const compressedAccount = createCompressedAccountWithMerkleContext(createMerkleContext(_account.tree, mockNullifierQueue, _account.hash.toArray('be', 32), _account.leafIndex),
|
|
12718
|
+
const compressedAccount = createCompressedAccountWithMerkleContext(createMerkleContext(_account.tree, mockNullifierQueue, _account.hash.toArray('be', 32), _account.leafIndex), _account.owner, bn(_account.lamports), _account.data ? parseAccountData(_account.data) : undefined, _account.address || undefined);
|
|
12619
12719
|
const parsed = {
|
|
12620
12720
|
mint: _tokenData.mint,
|
|
12621
12721
|
owner: _tokenData.owner,
|
|
@@ -13224,6 +13324,9 @@ class Rpc extends web3_js.Connection {
|
|
|
13224
13324
|
}
|
|
13225
13325
|
return res.result;
|
|
13226
13326
|
}
|
|
13327
|
+
/**
|
|
13328
|
+
* Fetch all the compressed token holders for a given mint. Paginated.
|
|
13329
|
+
*/
|
|
13227
13330
|
async getCompressedMintTokenHolders(mint, options) {
|
|
13228
13331
|
var _a;
|
|
13229
13332
|
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressedMintTokenHolders', {
|