Skip to content

Commit b53bcba

Browse files
ananas-blocksergeytimoshin
authored andcommitted
stash separated token client
1 parent 964808a commit b53bcba

16 files changed

Lines changed: 2608 additions & 121 deletions

File tree

js/token-client/package.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@lightprotocol/token-client",
3+
"version": "0.1.0",
4+
"description": "Light Protocol indexer client for compressed tokens",
5+
"type": "module",
6+
"main": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"import": "./dist/index.js",
11+
"types": "./dist/index.d.ts"
12+
}
13+
},
14+
"files": [
15+
"dist",
16+
"src"
17+
],
18+
"scripts": {
19+
"build": "tsc",
20+
"clean": "rm -rf dist",
21+
"test": "vitest run",
22+
"test:watch": "vitest"
23+
},
24+
"peerDependencies": {
25+
"@solana/kit": "^2.1.0"
26+
},
27+
"dependencies": {
28+
"@lightprotocol/token-sdk": "workspace:*",
29+
"@solana/addresses": "^2.1.0",
30+
"@solana/codecs": "^2.1.0"
31+
},
32+
"devDependencies": {
33+
"typescript": "^5.7.3",
34+
"vitest": "^2.1.8"
35+
},
36+
"engines": {
37+
"node": ">=18"
38+
},
39+
"keywords": [
40+
"solana",
41+
"light-protocol",
42+
"compressed-token",
43+
"indexer",
44+
"zk-compression"
45+
],
46+
"license": "Apache-2.0",
47+
"repository": {
48+
"type": "git",
49+
"url": "https://github.com/Lightprotocol/light-protocol.git",
50+
"directory": "js/token-client"
51+
}
52+
}

js/token-client/src/index.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Light Protocol Token Client
3+
*
4+
* Indexer client and account loading functions for compressed tokens.
5+
*
6+
* @example
7+
* ```typescript
8+
* import {
9+
* createLightIndexer,
10+
* loadTokenAccountsForTransfer,
11+
* selectAccountsForAmount,
12+
* } from '@lightprotocol/token-client';
13+
*
14+
* // Types from token-sdk:
15+
* import { TreeType, CompressedTokenAccount } from '@lightprotocol/token-sdk';
16+
*
17+
* const indexer = createLightIndexer('https://photon.helius.dev');
18+
* const loaded = await loadTokenAccountsForTransfer(indexer, owner, 1000n);
19+
* ```
20+
*
21+
* @packageDocumentation
22+
*/
23+
24+
// Indexer
25+
export {
26+
type LightIndexer,
27+
PhotonIndexer,
28+
createLightIndexer,
29+
isLightIndexerAvailable,
30+
} from './indexer.js';
31+
32+
// Load functions
33+
export {
34+
// Types
35+
type InputTokenAccount,
36+
type MerkleContext,
37+
type LoadedTokenAccounts,
38+
type LoadTokenAccountsOptions,
39+
type SelectedAccounts,
40+
41+
// Load functions
42+
loadTokenAccountsForTransfer,
43+
loadTokenAccount,
44+
loadAllTokenAccounts,
45+
loadCompressedAccount,
46+
loadCompressedAccountByHash,
47+
48+
// Account selection
49+
selectAccountsForAmount,
50+
51+
// Proof helpers
52+
getValidityProofForAccounts,
53+
needsValidityProof,
54+
getTreeInfo,
55+
getOutputTreeInfo,
56+
} from './load.js';

0 commit comments

Comments
 (0)