@lightprotocol/stateless.js 0.14.4 → 0.15.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/README.md +5 -21
- package/dist/cjs/browser/index.cjs +98 -129
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +98 -129
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +94 -130
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +75 -141
- package/package.json +1 -1
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -9697,128 +9697,23 @@ const IDL = {
|
|
|
9697
9697
|
errors: [
|
|
9698
9698
|
{
|
|
9699
9699
|
code: 6000,
|
|
9700
|
-
name: '
|
|
9701
|
-
msg: '
|
|
9700
|
+
name: 'SignerCheckFailed',
|
|
9701
|
+
msg: 'Signer check failed',
|
|
9702
9702
|
},
|
|
9703
9703
|
{
|
|
9704
9704
|
code: 6001,
|
|
9705
|
-
name: '
|
|
9706
|
-
msg: '
|
|
9705
|
+
name: 'CreateTransferInstructionFailed',
|
|
9706
|
+
msg: 'Create transfer instruction failed',
|
|
9707
9707
|
},
|
|
9708
9708
|
{
|
|
9709
9709
|
code: 6002,
|
|
9710
|
-
name: '
|
|
9711
|
-
msg: '
|
|
9710
|
+
name: 'AccountNotFound',
|
|
9711
|
+
msg: 'Account not found',
|
|
9712
9712
|
},
|
|
9713
9713
|
{
|
|
9714
9714
|
code: 6003,
|
|
9715
|
-
name: '
|
|
9716
|
-
msg: '
|
|
9717
|
-
},
|
|
9718
|
-
{
|
|
9719
|
-
code: 6004,
|
|
9720
|
-
name: 'ComputeDecompressSumFailed',
|
|
9721
|
-
msg: 'ComputeDecompressSumFailed',
|
|
9722
|
-
},
|
|
9723
|
-
{
|
|
9724
|
-
code: 6005,
|
|
9725
|
-
name: 'SumCheckFailed',
|
|
9726
|
-
msg: 'SumCheckFailed',
|
|
9727
|
-
},
|
|
9728
|
-
{
|
|
9729
|
-
code: 6006,
|
|
9730
|
-
name: 'DecompressRecipientUndefinedForDecompress',
|
|
9731
|
-
msg: 'DecompressRecipientUndefinedForDecompress',
|
|
9732
|
-
},
|
|
9733
|
-
{
|
|
9734
|
-
code: 6007,
|
|
9735
|
-
name: 'CompressedPdaUndefinedForDecompress',
|
|
9736
|
-
msg: 'CompressedPdaUndefinedForDecompress',
|
|
9737
|
-
},
|
|
9738
|
-
{
|
|
9739
|
-
code: 6008,
|
|
9740
|
-
name: 'DeCompressAmountUndefinedForDecompress',
|
|
9741
|
-
msg: 'DeCompressAmountUndefinedForDecompress',
|
|
9742
|
-
},
|
|
9743
|
-
{
|
|
9744
|
-
code: 6009,
|
|
9745
|
-
name: 'CompressedPdaUndefinedForCompress',
|
|
9746
|
-
msg: 'CompressedPdaUndefinedForCompress',
|
|
9747
|
-
},
|
|
9748
|
-
{
|
|
9749
|
-
code: 6010,
|
|
9750
|
-
name: 'DeCompressAmountUndefinedForCompress',
|
|
9751
|
-
msg: 'DeCompressAmountUndefinedForCompress',
|
|
9752
|
-
},
|
|
9753
|
-
{
|
|
9754
|
-
code: 6011,
|
|
9755
|
-
name: 'DelegateSignerCheckFailed',
|
|
9756
|
-
msg: 'DelegateSignerCheckFailed',
|
|
9757
|
-
},
|
|
9758
|
-
{
|
|
9759
|
-
code: 6012,
|
|
9760
|
-
name: 'MintTooLarge',
|
|
9761
|
-
msg: 'Minted amount greater than u64::MAX',
|
|
9762
|
-
},
|
|
9763
|
-
{
|
|
9764
|
-
code: 6013,
|
|
9765
|
-
name: 'SplTokenSupplyMismatch',
|
|
9766
|
-
msg: 'SplTokenSupplyMismatch',
|
|
9767
|
-
},
|
|
9768
|
-
{
|
|
9769
|
-
code: 6014,
|
|
9770
|
-
name: 'HeapMemoryCheckFailed',
|
|
9771
|
-
msg: 'HeapMemoryCheckFailed',
|
|
9772
|
-
},
|
|
9773
|
-
{
|
|
9774
|
-
code: 6015,
|
|
9775
|
-
name: 'InstructionNotCallable',
|
|
9776
|
-
msg: 'The instruction is not callable',
|
|
9777
|
-
},
|
|
9778
|
-
{
|
|
9779
|
-
code: 6016,
|
|
9780
|
-
name: 'ArithmeticUnderflow',
|
|
9781
|
-
msg: 'ArithmeticUnderflow',
|
|
9782
|
-
},
|
|
9783
|
-
{
|
|
9784
|
-
code: 6017,
|
|
9785
|
-
name: 'HashToFieldError',
|
|
9786
|
-
msg: 'HashToFieldError',
|
|
9787
|
-
},
|
|
9788
|
-
{
|
|
9789
|
-
code: 6018,
|
|
9790
|
-
name: 'InvalidAuthorityMint',
|
|
9791
|
-
msg: 'Expected the authority to be also a mint authority',
|
|
9792
|
-
},
|
|
9793
|
-
{
|
|
9794
|
-
code: 6019,
|
|
9795
|
-
name: 'InvalidFreezeAuthority',
|
|
9796
|
-
msg: 'Provided authority is not the freeze authority',
|
|
9797
|
-
},
|
|
9798
|
-
{
|
|
9799
|
-
code: 6020,
|
|
9800
|
-
name: 'InvalidDelegateIndex',
|
|
9801
|
-
},
|
|
9802
|
-
{
|
|
9803
|
-
code: 6021,
|
|
9804
|
-
name: 'TokenPoolPdaUndefined',
|
|
9805
|
-
},
|
|
9806
|
-
{
|
|
9807
|
-
code: 6022,
|
|
9808
|
-
name: 'IsTokenPoolPda',
|
|
9809
|
-
msg: 'Compress or decompress recipient is the same account as the token pool pda.',
|
|
9810
|
-
},
|
|
9811
|
-
{
|
|
9812
|
-
code: 6023,
|
|
9813
|
-
name: 'InvalidTokenPoolPda',
|
|
9814
|
-
},
|
|
9815
|
-
{
|
|
9816
|
-
code: 6024,
|
|
9817
|
-
name: 'NoInputTokenAccountsProvided',
|
|
9818
|
-
},
|
|
9819
|
-
{
|
|
9820
|
-
code: 6025,
|
|
9821
|
-
name: 'NoInputsProvided',
|
|
9715
|
+
name: 'SerializationError',
|
|
9716
|
+
msg: 'Serialization error',
|
|
9822
9717
|
},
|
|
9823
9718
|
],
|
|
9824
9719
|
};
|
|
@@ -10607,6 +10502,10 @@ const TokenBalanceListResult = type({
|
|
|
10607
10502
|
tokenBalances: array(TokenBalanceResult),
|
|
10608
10503
|
cursor: nullable(string()),
|
|
10609
10504
|
});
|
|
10505
|
+
const TokenBalanceListResultV2 = type({
|
|
10506
|
+
items: array(TokenBalanceResult),
|
|
10507
|
+
cursor: nullable(string()),
|
|
10508
|
+
});
|
|
10610
10509
|
const CompressedMintTokenHoldersResult = type({
|
|
10611
10510
|
cursor: nullable(string()),
|
|
10612
10511
|
items: array(type({
|
|
@@ -11064,8 +10963,10 @@ class Rpc extends web3_js.Connection {
|
|
|
11064
10963
|
return { amount: bn(res.result.value.amount) };
|
|
11065
10964
|
}
|
|
11066
10965
|
/**
|
|
10966
|
+
* @deprecated use {@link getCompressedTokenBalancesByOwnerV2} instead.
|
|
10967
|
+
*
|
|
11067
10968
|
* Fetch all the compressed token balances owned by the specified public
|
|
11068
|
-
* key. Can filter by mint
|
|
10969
|
+
* key. Can filter by mint. Returns without context.
|
|
11069
10970
|
*/
|
|
11070
10971
|
async getCompressedTokenBalancesByOwner(owner, options) {
|
|
11071
10972
|
var _a, _b;
|
|
@@ -11092,6 +10993,38 @@ class Rpc extends web3_js.Connection {
|
|
|
11092
10993
|
cursor: res.result.value.cursor,
|
|
11093
10994
|
};
|
|
11094
10995
|
}
|
|
10996
|
+
/**
|
|
10997
|
+
* Fetch the compressed token balances owned by the specified public
|
|
10998
|
+
* key. Paginated. Can filter by mint. Returns with context.
|
|
10999
|
+
*/
|
|
11000
|
+
async getCompressedTokenBalancesByOwnerV2(owner, options) {
|
|
11001
|
+
var _a, _b;
|
|
11002
|
+
if (!options)
|
|
11003
|
+
options = {};
|
|
11004
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressedTokenBalancesByOwnerV2', {
|
|
11005
|
+
owner: owner.toBase58(),
|
|
11006
|
+
mint: (_a = options.mint) === null || _a === void 0 ? void 0 : _a.toBase58(),
|
|
11007
|
+
limit: (_b = options.limit) === null || _b === void 0 ? void 0 : _b.toNumber(),
|
|
11008
|
+
cursor: options.cursor,
|
|
11009
|
+
});
|
|
11010
|
+
const res = create(unsafeRes, jsonRpcResultAndContext(TokenBalanceListResultV2));
|
|
11011
|
+
if ('error' in res) {
|
|
11012
|
+
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get compressed token balances for owner ${owner.toBase58()}`);
|
|
11013
|
+
}
|
|
11014
|
+
if (res.result.value === null) {
|
|
11015
|
+
throw new Error(`failed to get compressed token balances for owner ${owner.toBase58()}`);
|
|
11016
|
+
}
|
|
11017
|
+
const maybeFiltered = options.mint
|
|
11018
|
+
? res.result.value.items.filter(tokenBalance => tokenBalance.mint.toBase58() === options.mint.toBase58())
|
|
11019
|
+
: res.result.value.items;
|
|
11020
|
+
return {
|
|
11021
|
+
context: res.result.context,
|
|
11022
|
+
value: {
|
|
11023
|
+
items: maybeFiltered,
|
|
11024
|
+
cursor: res.result.value.cursor,
|
|
11025
|
+
},
|
|
11026
|
+
};
|
|
11027
|
+
}
|
|
11095
11028
|
/**
|
|
11096
11029
|
* Returns confirmed compression signatures for transactions involving the specified
|
|
11097
11030
|
* account hash forward in time from genesis to the most recent confirmed
|
|
@@ -11161,8 +11094,13 @@ class Rpc extends web3_js.Connection {
|
|
|
11161
11094
|
*
|
|
11162
11095
|
* @param address queried compressed account address
|
|
11163
11096
|
*/
|
|
11164
|
-
async getCompressionSignaturesForAddress(address) {
|
|
11165
|
-
|
|
11097
|
+
async getCompressionSignaturesForAddress(address, options) {
|
|
11098
|
+
var _a;
|
|
11099
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressionSignaturesForAddress', {
|
|
11100
|
+
address: address.toBase58(),
|
|
11101
|
+
cursor: options === null || options === void 0 ? void 0 : options.cursor,
|
|
11102
|
+
limit: (_a = options === null || options === void 0 ? void 0 : options.limit) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
|
11103
|
+
});
|
|
11166
11104
|
const res = create(unsafeRes, jsonRpcResultAndContext(SignatureListWithCursorResult));
|
|
11167
11105
|
if ('error' in res) {
|
|
11168
11106
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get signatures for address ${address.toBase58()}`);
|
|
@@ -11179,8 +11117,13 @@ class Rpc extends web3_js.Connection {
|
|
|
11179
11117
|
*
|
|
11180
11118
|
* @param owner queried owner public key
|
|
11181
11119
|
*/
|
|
11182
|
-
async getCompressionSignaturesForOwner(owner) {
|
|
11183
|
-
|
|
11120
|
+
async getCompressionSignaturesForOwner(owner, options) {
|
|
11121
|
+
var _a;
|
|
11122
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressionSignaturesForOwner', {
|
|
11123
|
+
owner: owner.toBase58(),
|
|
11124
|
+
cursor: options === null || options === void 0 ? void 0 : options.cursor,
|
|
11125
|
+
limit: (_a = options === null || options === void 0 ? void 0 : options.limit) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
|
11126
|
+
});
|
|
11184
11127
|
const res = create(unsafeRes, jsonRpcResultAndContext(SignatureListWithCursorResult));
|
|
11185
11128
|
if ('error' in res) {
|
|
11186
11129
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get signatures for owner ${owner.toBase58()}`);
|
|
@@ -11190,14 +11133,18 @@ class Rpc extends web3_js.Connection {
|
|
|
11190
11133
|
}
|
|
11191
11134
|
return res.result.value;
|
|
11192
11135
|
}
|
|
11193
|
-
/// TODO(photon): needs mint
|
|
11194
11136
|
/**
|
|
11195
11137
|
* Returns confirmed signatures for compression transactions involving the
|
|
11196
11138
|
* specified token account owner forward in time from genesis to the most
|
|
11197
11139
|
* recent confirmed block
|
|
11198
11140
|
*/
|
|
11199
|
-
async getCompressionSignaturesForTokenOwner(owner) {
|
|
11200
|
-
|
|
11141
|
+
async getCompressionSignaturesForTokenOwner(owner, options) {
|
|
11142
|
+
var _a;
|
|
11143
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressionSignaturesForTokenOwner', {
|
|
11144
|
+
owner: owner.toBase58(),
|
|
11145
|
+
cursor: options === null || options === void 0 ? void 0 : options.cursor,
|
|
11146
|
+
limit: (_a = options === null || options === void 0 ? void 0 : options.limit) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
|
11147
|
+
});
|
|
11201
11148
|
const res = create(unsafeRes, jsonRpcResultAndContext(SignatureListWithCursorResult));
|
|
11202
11149
|
if ('error' in res) {
|
|
11203
11150
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get signatures for owner ${owner.toBase58()}`);
|
|
@@ -11247,6 +11194,9 @@ class Rpc extends web3_js.Connection {
|
|
|
11247
11194
|
}
|
|
11248
11195
|
return res.result;
|
|
11249
11196
|
}
|
|
11197
|
+
/**
|
|
11198
|
+
* Fetch all the compressed token holders for a given mint. Paginated.
|
|
11199
|
+
*/
|
|
11250
11200
|
async getCompressedMintTokenHolders(mint, options) {
|
|
11251
11201
|
var _a;
|
|
11252
11202
|
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressedMintTokenHolders', {
|
|
@@ -11275,8 +11225,8 @@ class Rpc extends web3_js.Connection {
|
|
|
11275
11225
|
/**
|
|
11276
11226
|
* Fetch all non-voting signatures
|
|
11277
11227
|
*/
|
|
11278
|
-
async getLatestNonVotingSignatures(limit) {
|
|
11279
|
-
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getLatestNonVotingSignatures', { limit });
|
|
11228
|
+
async getLatestNonVotingSignatures(limit, cursor) {
|
|
11229
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getLatestNonVotingSignatures', { limit, cursor });
|
|
11280
11230
|
const res = create(unsafeRes, jsonRpcResultAndContext(LatestNonVotingSignaturesResult));
|
|
11281
11231
|
if ('error' in res) {
|
|
11282
11232
|
throw new web3_js.SolanaJSONRPCError(res.error, 'failed to get latest non-voting signatures');
|
|
@@ -14238,8 +14188,9 @@ class TestRpc extends web3_js.Connection {
|
|
|
14238
14188
|
return { amount: bn(account.parsed.amount) };
|
|
14239
14189
|
}
|
|
14240
14190
|
/**
|
|
14191
|
+
* @deprecated use {@link getCompressedTokenBalancesByOwnerV2}.
|
|
14241
14192
|
* Fetch all the compressed token balances owned by the specified public
|
|
14242
|
-
* key. Can filter by mint
|
|
14193
|
+
* key. Can filter by mint.
|
|
14243
14194
|
*/
|
|
14244
14195
|
async getCompressedTokenBalancesByOwner(publicKey, options) {
|
|
14245
14196
|
const accounts = await getCompressedTokenAccountsByOwnerTest(this, publicKey, options.mint);
|
|
@@ -14251,6 +14202,23 @@ class TestRpc extends web3_js.Connection {
|
|
|
14251
14202
|
cursor: null,
|
|
14252
14203
|
};
|
|
14253
14204
|
}
|
|
14205
|
+
/**
|
|
14206
|
+
* Fetch all the compressed token balances owned by the specified public
|
|
14207
|
+
* key. Can filter by mint. Uses context.
|
|
14208
|
+
*/
|
|
14209
|
+
async getCompressedTokenBalancesByOwnerV2(publicKey, options) {
|
|
14210
|
+
const accounts = await getCompressedTokenAccountsByOwnerTest(this, publicKey, options.mint);
|
|
14211
|
+
return {
|
|
14212
|
+
context: { slot: 1 },
|
|
14213
|
+
value: {
|
|
14214
|
+
items: accounts.items.map(account => ({
|
|
14215
|
+
balance: bn(account.parsed.amount),
|
|
14216
|
+
mint: account.parsed.mint,
|
|
14217
|
+
})),
|
|
14218
|
+
cursor: null,
|
|
14219
|
+
},
|
|
14220
|
+
};
|
|
14221
|
+
}
|
|
14254
14222
|
/**
|
|
14255
14223
|
* Returns confirmed signatures for transactions involving the specified
|
|
14256
14224
|
* account hash forward in time from genesis to the most recent confirmed
|
|
@@ -14258,14 +14226,14 @@ class TestRpc extends web3_js.Connection {
|
|
|
14258
14226
|
*
|
|
14259
14227
|
* @param hash queried account hash
|
|
14260
14228
|
*/
|
|
14261
|
-
async getCompressionSignaturesForAccount(
|
|
14229
|
+
async getCompressionSignaturesForAccount(_hash) {
|
|
14262
14230
|
throw new Error('getCompressionSignaturesForAccount not implemented in test-rpc');
|
|
14263
14231
|
}
|
|
14264
14232
|
/**
|
|
14265
14233
|
* Fetch a confirmed or finalized transaction from the cluster. Return with
|
|
14266
14234
|
* CompressionInfo
|
|
14267
14235
|
*/
|
|
14268
|
-
async getTransactionWithCompressionInfo(
|
|
14236
|
+
async getTransactionWithCompressionInfo(_signature) {
|
|
14269
14237
|
throw new Error('getCompressedTransaction not implemented in test-rpc');
|
|
14270
14238
|
}
|
|
14271
14239
|
/**
|
|
@@ -14275,7 +14243,7 @@ class TestRpc extends web3_js.Connection {
|
|
|
14275
14243
|
*
|
|
14276
14244
|
* @param address queried compressed account address
|
|
14277
14245
|
*/
|
|
14278
|
-
async getCompressionSignaturesForAddress(_address) {
|
|
14246
|
+
async getCompressionSignaturesForAddress(_address, _options) {
|
|
14279
14247
|
throw new Error('getSignaturesForAddress3 not implemented');
|
|
14280
14248
|
}
|
|
14281
14249
|
/**
|
|
@@ -14285,7 +14253,7 @@ class TestRpc extends web3_js.Connection {
|
|
|
14285
14253
|
*
|
|
14286
14254
|
* @param owner queried owner public key
|
|
14287
14255
|
*/
|
|
14288
|
-
async getCompressionSignaturesForOwner(
|
|
14256
|
+
async getCompressionSignaturesForOwner(_owner, _options) {
|
|
14289
14257
|
throw new Error('getSignaturesForOwner not implemented');
|
|
14290
14258
|
}
|
|
14291
14259
|
/**
|
|
@@ -14293,7 +14261,7 @@ class TestRpc extends web3_js.Connection {
|
|
|
14293
14261
|
* specified token account owner forward in time from genesis to the most
|
|
14294
14262
|
* recent confirmed block
|
|
14295
14263
|
*/
|
|
14296
|
-
async getCompressionSignaturesForTokenOwner(
|
|
14264
|
+
async getCompressionSignaturesForTokenOwner(_owner, _options) {
|
|
14297
14265
|
throw new Error('getSignaturesForTokenOwner not implemented');
|
|
14298
14266
|
}
|
|
14299
14267
|
/**
|
|
@@ -14537,6 +14505,7 @@ exports.SlotResult = SlotResult;
|
|
|
14537
14505
|
exports.TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD = TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD;
|
|
14538
14506
|
exports.TestRpc = TestRpc;
|
|
14539
14507
|
exports.TokenBalanceListResult = TokenBalanceListResult;
|
|
14508
|
+
exports.TokenBalanceListResultV2 = TokenBalanceListResultV2;
|
|
14540
14509
|
exports.TokenBalanceResult = TokenBalanceResult;
|
|
14541
14510
|
exports.TokenDataResult = TokenDataResult;
|
|
14542
14511
|
exports.UTXO_MERGE_MAXIMUM = UTXO_MERGE_MAXIMUM;
|