@coinbarrel/sdk 1.2.0 → 1.3.0

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 CHANGED
@@ -1,305 +1,305 @@
1
- # @coinbarrel/sdk
2
-
3
- SDK for integrating with CoinBarrel AMM - bonding curves and liquidity pools on Solana.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @coinbarrel/sdk @solana/web3.js @solana/spl-token
9
- ```
10
-
11
- ## Quick Start
12
-
13
- ```typescript
14
- import { Connection, Keypair, Transaction } from '@solana/web3.js';
15
- import { CoinBarrel, solToLamports } from '@coinbarrel/sdk';
16
-
17
- // Initialize SDK
18
- const connection = new Connection('https://api.mainnet-beta.solana.com');
19
- const sdk = new CoinBarrel({
20
- connection,
21
- network: 'mainnet', // or 'devnet'
22
- });
23
-
24
- // Token to trade
25
- const tokenMint = new PublicKey('YOUR_TOKEN_MINT');
26
- ```
27
-
28
- ## Bonding Curve Trading (Pre-Graduation)
29
-
30
- ### Get Buy Quote
31
-
32
- ```typescript
33
- const quote = await sdk.curve.getBuyQuote(
34
- tokenMint,
35
- solToLamports(0.1) // 0.1 SOL
36
- );
37
-
38
- if (quote) {
39
- console.log(`Tokens out: ${quote.tokensOut}`);
40
- console.log(`Price impact: ${quote.priceImpactBps / 100}%`);
41
- }
42
- ```
43
-
44
- ### Buy Tokens
45
-
46
- ```typescript
47
- import { Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
48
-
49
- const instructions = await sdk.curve.buildBuyInstruction({
50
- tokenMint,
51
- buyer: wallet.publicKey,
52
- lamportsIn: solToLamports(0.1),
53
- });
54
-
55
- const tx = new Transaction().add(...instructions);
56
- const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
57
- ```
58
-
59
- ### Sell Tokens
60
-
61
- ```typescript
62
- const instructions = await sdk.curve.buildSellInstruction({
63
- tokenMint,
64
- seller: wallet.publicKey,
65
- tokenAmount: BigInt(1_000_000), // 1 token (6 decimals)
66
- });
67
-
68
- // Or sell entire balance
69
- const sellMaxIx = await sdk.curve.buildSellMaxInstruction({
70
- tokenMint,
71
- seller: wallet.publicKey,
72
- });
73
- ```
74
-
75
- ## AMM Pool Trading (Post-Graduation)
76
-
77
- ### Get Swap Quote
78
-
79
- ```typescript
80
- const quote = await sdk.pool.getSwapSolToTokenQuote(
81
- tokenMint,
82
- solToLamports(1.0) // 1 SOL
83
- );
84
-
85
- if (quote) {
86
- console.log(`Tokens out: ${quote.amountOut}`);
87
- console.log(`Fee: ${quote.fee} lamports`);
88
- }
89
- ```
90
-
91
- ### Swap SOL for Tokens
92
-
93
- ```typescript
94
- const instructions = await sdk.pool.buildSwapSolToTokenInstruction({
95
- tokenMint,
96
- user: wallet.publicKey,
97
- lamportsIn: solToLamports(1.0),
98
- minimumAmountOut: BigInt(900_000), // Slippage protection
99
- });
100
- ```
101
-
102
- ### Swap Tokens for SOL
103
-
104
- ```typescript
105
- const instructions = await sdk.pool.buildSwapTokenToSolInstruction({
106
- tokenMint,
107
- user: wallet.publicKey,
108
- amountIn: BigInt(1_000_000),
109
- minimumLamportsOut: solToLamports(0.09),
110
- });
111
-
112
- // Or sell entire balance
113
- const sellMaxIx = await sdk.pool.buildSwapTokenToSolMaxInstruction({
114
- tokenMint,
115
- user: wallet.publicKey,
116
- });
117
- ```
118
-
119
- ## Token Creation
120
-
121
- ### Create a New Token
122
-
123
- ```typescript
124
- // Build create token instruction
125
- const { instructions, mintKeypair } = sdk.buildCreateTokenInstruction({
126
- payer: wallet.publicKey,
127
- name: 'My Token',
128
- symbol: 'MTK',
129
- uri: 'https://arweave.net/...', // Metadata JSON URI
130
- creatorFeeRecipient: wallet.publicKey,
131
- traderRewardsShareBps: 3000, // 30% of fees to holders (optional, default 2500)
132
- });
133
-
134
- // Build and send transaction
135
- const tx = new Transaction().add(...instructions);
136
- const signature = await sendAndConfirmTransaction(connection, tx, [wallet, mintKeypair]);
137
-
138
- console.log(`Token created: ${mintKeypair.publicKey.toBase58()}`);
139
- ```
140
-
141
- The token is created with:
142
-
143
- - **Mint authority**: Revoked immediately after minting 1B tokens
144
- - **Freeze authority**: Never set (null from creation)
145
- - **Total supply**: 1,000,000,000 tokens (6 decimals)
146
- - **Metadata**: Created via Metaplex (update_authority = creator)
147
-
148
- ## Holder Rewards
149
-
150
- ### Claim Rewards from Bonding Curve
151
-
152
- ```typescript
153
- const instructions = await sdk.buildClaimRewardsCurveInstruction(tokenMint, wallet.publicKey);
154
-
155
- const tx = new Transaction().add(...instructions);
156
- const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
157
- ```
158
-
159
- ### Claim Rewards from AMM Pool (Post-Graduation)
160
-
161
- ```typescript
162
- const instructions = await sdk.buildClaimRewardsPoolInstruction(tokenMint, wallet.publicKey);
163
-
164
- const tx = new Transaction().add(...instructions);
165
- const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
166
- ```
167
-
168
- ## Market Info
169
-
170
- ### Get Token Market State
171
-
172
- ```typescript
173
- const info = await sdk.getMarketInfo(tokenMint);
174
-
175
- if (info) {
176
- console.log(`Phase: ${info.phase}`); // 'curve' or 'pool'
177
- console.log(`Price: ${info.price} lamports/token`);
178
- console.log(`Market Cap: ${info.marketCapSol} lamports`);
179
- console.log(`Fee: ${info.feeBps / 100}%`);
180
- }
181
- ```
182
-
183
- ### Check Token Phase
184
-
185
- ```typescript
186
- if (await sdk.isOnCurve(tokenMint)) {
187
- // Use curve methods
188
- } else if (await sdk.isOnPool(tokenMint)) {
189
- // Use pool methods
190
- }
191
- ```
192
-
193
- ## Networks
194
-
195
- The SDK supports both devnet and mainnet:
196
-
197
- ```typescript
198
- // Devnet
199
- const devnetSdk = new CoinBarrel({
200
- connection: new Connection('https://api.devnet.solana.com'),
201
- network: 'devnet',
202
- });
203
-
204
- // Mainnet
205
- const mainnetSdk = new CoinBarrel({
206
- connection: new Connection('https://api.mainnet-beta.solana.com'),
207
- network: 'mainnet',
208
- });
209
- ```
210
-
211
- ## Utility Functions
212
-
213
- ```typescript
214
- import { solToLamports, lamportsToSol, toRawAmount, toUiAmount } from '@coinbarrel/sdk';
215
-
216
- // SOL conversions
217
- const lamports = solToLamports(1.5); // 1_500_000_000n
218
- const sol = lamportsToSol(1_500_000_000n); // 1.5
219
-
220
- // Token amount conversions (default 6 decimals)
221
- const raw = toRawAmount(100); // 100_000_000n
222
- const ui = toUiAmount(100_000_000n); // 100
223
- ```
224
-
225
- ## Token Metadata
226
-
227
- Fetch token metadata from the Metaplex Token Metadata program:
228
-
229
- ```typescript
230
- // Get on-chain metadata (fast - just name, symbol, uri)
231
- const metadata = await sdk.getTokenMetadata(tokenMint);
232
- if (metadata) {
233
- console.log(metadata.name); // "My Token"
234
- console.log(metadata.symbol); // "MTK"
235
- console.log(metadata.uri); // "https://..."
236
- }
237
-
238
- // Get full metadata including off-chain JSON (image, socials)
239
- const fullMetadata = await sdk.getTokenMetadataJson(tokenMint);
240
- if (fullMetadata) {
241
- console.log(fullMetadata.image); // "https://..." or "ipfs://..."
242
- console.log(fullMetadata.description); // "A cool token"
243
- console.log(fullMetadata.twitter); // "@mytoken"
244
- console.log(fullMetadata.website); // "https://..."
245
- }
246
-
247
- // Batch fetch for multiple tokens (more efficient)
248
- const mints = [mint1, mint2, mint3];
249
- const metadataMap = await sdk.batchGetTokenMetadata(mints);
250
- for (const [mintStr, meta] of metadataMap) {
251
- console.log(`${mintStr}: ${meta?.name}`);
252
- }
253
- ```
254
-
255
- ## PDA Helpers
256
-
257
- ```typescript
258
- // Get PDAs for a token
259
- const bondingCurve = sdk.getBondingCurvePda(tokenMint);
260
- const pool = sdk.getPoolPda(tokenMint);
261
- const holderReward = sdk.getHolderRewardPda(tokenMint, wallet.publicKey);
262
- const metadataPda = sdk.getMetadataPda(tokenMint); // Metaplex metadata PDA
263
- ```
264
-
265
- ## Fee Structure
266
-
267
- CoinBarrel fees are enforced at the program level and cannot be bypassed:
268
-
269
- - **1% total fee** on all trades
270
- - **50%** goes to CoinBarrel (protocol) - fixed
271
- - **25-40%** goes to holder rewards pool (of total fee, configured by token launcher via `trader_rewards_share_bps`)
272
- - **10-25%** goes to token creator (remainder: 50% - holder%)
273
-
274
- Example: If `trader_rewards_share_bps = 3000` (30%):
275
-
276
- - Platform: 50% of fee
277
- - Holders: 30% of fee
278
- - Creator: 20% of fee
279
-
280
- The split is set when the token is launched (`trader_rewards_share_bps` must be 2500-4000). The SDK reads fee recipients from on-chain state. Integrators cannot modify or bypass fees.
281
-
282
- ## TypeScript
283
-
284
- The SDK is fully typed:
285
-
286
- ```typescript
287
- import type {
288
- BondingCurveState,
289
- PoolState,
290
- MarketInfo,
291
- BuyQuote,
292
- SellQuote,
293
- SwapQuote,
294
- Network,
295
- TokenMetadata,
296
- TokenMetadataJson,
297
- CreateBarrelTokenParams,
298
- ClaimHolderRewardsParams,
299
- ClaimHolderRewardsCurveParams,
300
- } from '@coinbarrel/sdk';
301
- ```
302
-
303
- ## License
304
-
305
- MIT
1
+ # @coinbarrel/sdk
2
+
3
+ SDK for integrating with CoinBarrel AMM - bonding curves and liquidity pools on Solana.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @coinbarrel/sdk @solana/web3.js @solana/spl-token
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { Connection, Keypair, Transaction } from '@solana/web3.js';
15
+ import { CoinBarrel, solToLamports } from '@coinbarrel/sdk';
16
+
17
+ // Initialize SDK
18
+ const connection = new Connection('https://api.mainnet-beta.solana.com');
19
+ const sdk = new CoinBarrel({
20
+ connection,
21
+ network: 'mainnet', // or 'devnet'
22
+ });
23
+
24
+ // Token to trade
25
+ const tokenMint = new PublicKey('YOUR_TOKEN_MINT');
26
+ ```
27
+
28
+ ## Bonding Curve Trading (Pre-Graduation)
29
+
30
+ ### Get Buy Quote
31
+
32
+ ```typescript
33
+ const quote = await sdk.curve.getBuyQuote(
34
+ tokenMint,
35
+ solToLamports(0.1) // 0.1 SOL
36
+ );
37
+
38
+ if (quote) {
39
+ console.log(`Tokens out: ${quote.tokensOut}`);
40
+ console.log(`Price impact: ${quote.priceImpactBps / 100}%`);
41
+ }
42
+ ```
43
+
44
+ ### Buy Tokens
45
+
46
+ ```typescript
47
+ import { Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
48
+
49
+ const instructions = await sdk.curve.buildBuyInstruction({
50
+ tokenMint,
51
+ buyer: wallet.publicKey,
52
+ lamportsIn: solToLamports(0.1),
53
+ });
54
+
55
+ const tx = new Transaction().add(...instructions);
56
+ const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
57
+ ```
58
+
59
+ ### Sell Tokens
60
+
61
+ ```typescript
62
+ const instructions = await sdk.curve.buildSellInstruction({
63
+ tokenMint,
64
+ seller: wallet.publicKey,
65
+ tokenAmount: BigInt(1_000_000), // 1 token (6 decimals)
66
+ });
67
+
68
+ // Or sell entire balance
69
+ const sellMaxIx = await sdk.curve.buildSellMaxInstruction({
70
+ tokenMint,
71
+ seller: wallet.publicKey,
72
+ });
73
+ ```
74
+
75
+ ## AMM Pool Trading (Post-Graduation)
76
+
77
+ ### Get Swap Quote
78
+
79
+ ```typescript
80
+ const quote = await sdk.pool.getSwapSolToTokenQuote(
81
+ tokenMint,
82
+ solToLamports(1.0) // 1 SOL
83
+ );
84
+
85
+ if (quote) {
86
+ console.log(`Tokens out: ${quote.amountOut}`);
87
+ console.log(`Fee: ${quote.fee} lamports`);
88
+ }
89
+ ```
90
+
91
+ ### Swap SOL for Tokens
92
+
93
+ ```typescript
94
+ const instructions = await sdk.pool.buildSwapSolToTokenInstruction({
95
+ tokenMint,
96
+ user: wallet.publicKey,
97
+ lamportsIn: solToLamports(1.0),
98
+ minimumAmountOut: BigInt(900_000), // Slippage protection
99
+ });
100
+ ```
101
+
102
+ ### Swap Tokens for SOL
103
+
104
+ ```typescript
105
+ const instructions = await sdk.pool.buildSwapTokenToSolInstruction({
106
+ tokenMint,
107
+ user: wallet.publicKey,
108
+ amountIn: BigInt(1_000_000),
109
+ minimumLamportsOut: solToLamports(0.09),
110
+ });
111
+
112
+ // Or sell entire balance
113
+ const sellMaxIx = await sdk.pool.buildSwapTokenToSolMaxInstruction({
114
+ tokenMint,
115
+ user: wallet.publicKey,
116
+ });
117
+ ```
118
+
119
+ ## Token Creation
120
+
121
+ ### Create a New Token
122
+
123
+ ```typescript
124
+ // Build create token instruction
125
+ const { instructions, mintKeypair } = sdk.buildCreateTokenInstruction({
126
+ payer: wallet.publicKey,
127
+ name: 'My Token',
128
+ symbol: 'MTK',
129
+ uri: 'https://arweave.net/...', // Metadata JSON URI
130
+ creatorFeeRecipient: wallet.publicKey,
131
+ traderRewardsShareBps: 3000, // 30% of fees to holders (optional, default 2500)
132
+ });
133
+
134
+ // Build and send transaction
135
+ const tx = new Transaction().add(...instructions);
136
+ const signature = await sendAndConfirmTransaction(connection, tx, [wallet, mintKeypair]);
137
+
138
+ console.log(`Token created: ${mintKeypair.publicKey.toBase58()}`);
139
+ ```
140
+
141
+ The token is created with:
142
+
143
+ - **Mint authority**: Revoked immediately after minting 1B tokens
144
+ - **Freeze authority**: Never set (null from creation)
145
+ - **Total supply**: 1,000,000,000 tokens (6 decimals)
146
+ - **Metadata**: Created via Metaplex (update_authority = creator)
147
+
148
+ ## Holder Rewards
149
+
150
+ ### Claim Rewards from Bonding Curve
151
+
152
+ ```typescript
153
+ const instructions = await sdk.buildClaimRewardsCurveInstruction(tokenMint, wallet.publicKey);
154
+
155
+ const tx = new Transaction().add(...instructions);
156
+ const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
157
+ ```
158
+
159
+ ### Claim Rewards from AMM Pool (Post-Graduation)
160
+
161
+ ```typescript
162
+ const instructions = await sdk.buildClaimRewardsPoolInstruction(tokenMint, wallet.publicKey);
163
+
164
+ const tx = new Transaction().add(...instructions);
165
+ const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
166
+ ```
167
+
168
+ ## Market Info
169
+
170
+ ### Get Token Market State
171
+
172
+ ```typescript
173
+ const info = await sdk.getMarketInfo(tokenMint);
174
+
175
+ if (info) {
176
+ console.log(`Phase: ${info.phase}`); // 'curve' or 'pool'
177
+ console.log(`Price: ${info.price} lamports/token`);
178
+ console.log(`Market Cap: ${info.marketCapSol} lamports`);
179
+ console.log(`Fee: ${info.feeBps / 100}%`);
180
+ }
181
+ ```
182
+
183
+ ### Check Token Phase
184
+
185
+ ```typescript
186
+ if (await sdk.isOnCurve(tokenMint)) {
187
+ // Use curve methods
188
+ } else if (await sdk.isOnPool(tokenMint)) {
189
+ // Use pool methods
190
+ }
191
+ ```
192
+
193
+ ## Networks
194
+
195
+ The SDK supports both devnet and mainnet:
196
+
197
+ ```typescript
198
+ // Devnet
199
+ const devnetSdk = new CoinBarrel({
200
+ connection: new Connection('https://api.devnet.solana.com'),
201
+ network: 'devnet',
202
+ });
203
+
204
+ // Mainnet
205
+ const mainnetSdk = new CoinBarrel({
206
+ connection: new Connection('https://api.mainnet-beta.solana.com'),
207
+ network: 'mainnet',
208
+ });
209
+ ```
210
+
211
+ ## Utility Functions
212
+
213
+ ```typescript
214
+ import { solToLamports, lamportsToSol, toRawAmount, toUiAmount } from '@coinbarrel/sdk';
215
+
216
+ // SOL conversions
217
+ const lamports = solToLamports(1.5); // 1_500_000_000n
218
+ const sol = lamportsToSol(1_500_000_000n); // 1.5
219
+
220
+ // Token amount conversions (default 6 decimals)
221
+ const raw = toRawAmount(100); // 100_000_000n
222
+ const ui = toUiAmount(100_000_000n); // 100
223
+ ```
224
+
225
+ ## Token Metadata
226
+
227
+ Fetch token metadata from the Metaplex Token Metadata program:
228
+
229
+ ```typescript
230
+ // Get on-chain metadata (fast - just name, symbol, uri)
231
+ const metadata = await sdk.getTokenMetadata(tokenMint);
232
+ if (metadata) {
233
+ console.log(metadata.name); // "My Token"
234
+ console.log(metadata.symbol); // "MTK"
235
+ console.log(metadata.uri); // "https://..."
236
+ }
237
+
238
+ // Get full metadata including off-chain JSON (image, socials)
239
+ const fullMetadata = await sdk.getTokenMetadataJson(tokenMint);
240
+ if (fullMetadata) {
241
+ console.log(fullMetadata.image); // "https://..." or "ipfs://..."
242
+ console.log(fullMetadata.description); // "A cool token"
243
+ console.log(fullMetadata.twitter); // "@mytoken"
244
+ console.log(fullMetadata.website); // "https://..."
245
+ }
246
+
247
+ // Batch fetch for multiple tokens (more efficient)
248
+ const mints = [mint1, mint2, mint3];
249
+ const metadataMap = await sdk.batchGetTokenMetadata(mints);
250
+ for (const [mintStr, meta] of metadataMap) {
251
+ console.log(`${mintStr}: ${meta?.name}`);
252
+ }
253
+ ```
254
+
255
+ ## PDA Helpers
256
+
257
+ ```typescript
258
+ // Get PDAs for a token
259
+ const bondingCurve = sdk.getBondingCurvePda(tokenMint);
260
+ const pool = sdk.getPoolPda(tokenMint);
261
+ const holderReward = sdk.getHolderRewardPda(tokenMint, wallet.publicKey);
262
+ const metadataPda = sdk.getMetadataPda(tokenMint); // Metaplex metadata PDA
263
+ ```
264
+
265
+ ## Fee Structure
266
+
267
+ CoinBarrel fees are enforced at the program level and cannot be bypassed:
268
+
269
+ - **1% total fee** on all trades
270
+ - **50%** goes to CoinBarrel (protocol) - fixed
271
+ - **25-40%** goes to holder rewards pool (of total fee, configured by token launcher via `trader_rewards_share_bps`)
272
+ - **10-25%** goes to token creator (remainder: 50% - holder%)
273
+
274
+ Example: If `trader_rewards_share_bps = 3000` (30%):
275
+
276
+ - Platform: 50% of fee
277
+ - Holders: 30% of fee
278
+ - Creator: 20% of fee
279
+
280
+ The split is set when the token is launched (`trader_rewards_share_bps` must be 2500-4000). The SDK reads fee recipients from on-chain state. Integrators cannot modify or bypass fees.
281
+
282
+ ## TypeScript
283
+
284
+ The SDK is fully typed:
285
+
286
+ ```typescript
287
+ import type {
288
+ BondingCurveState,
289
+ PoolState,
290
+ MarketInfo,
291
+ BuyQuote,
292
+ SellQuote,
293
+ SwapQuote,
294
+ Network,
295
+ TokenMetadata,
296
+ TokenMetadataJson,
297
+ CreateBarrelTokenParams,
298
+ ClaimHolderRewardsParams,
299
+ ClaimHolderRewardsCurveParams,
300
+ } from '@coinbarrel/sdk';
301
+ ```
302
+
303
+ ## License
304
+
305
+ MIT
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Account Fetching and Parsing
3
+ * Read on-chain account data for bonding curves and pools
4
+ */
5
+ import { Connection, PublicKey } from '@solana/web3.js';
6
+ import type { BondingCurveState, PoolState, MarketInfo } from './types.js';
7
+ /**
8
+ * Fetch and parse bonding curve state
9
+ */
10
+ export declare function getBondingCurveState(connection: Connection, tokenMint: PublicKey, programId: PublicKey): Promise<BondingCurveState | null>;
11
+ /**
12
+ * Get SOL balance in bonding curve escrow
13
+ */
14
+ export declare function getCurveSolBalance(connection: Connection, tokenMint: PublicKey, programId: PublicKey): Promise<bigint>;
15
+ /**
16
+ * Fetch and parse pool state
17
+ */
18
+ export declare function getPoolState(connection: Connection, tokenMint: PublicKey, programId: PublicKey): Promise<PoolState | null>;
19
+ /**
20
+ * Get pool vault balances
21
+ * Uses vault addresses stored in Pool state rather than deriving PDAs
22
+ */
23
+ export declare function getPoolBalances(connection: Connection, tokenMint: PublicKey, programId: PublicKey): Promise<{
24
+ solBalance: bigint;
25
+ tokenBalance: bigint;
26
+ } | null>;
27
+ /**
28
+ * Get comprehensive market info for a token
29
+ * Automatically detects if on bonding curve or AMM pool
30
+ */
31
+ export declare function getMarketInfo(connection: Connection, tokenMint: PublicKey, programId: PublicKey): Promise<MarketInfo | null>;
32
+ /**
33
+ * Get user's token balance
34
+ */
35
+ export declare function getUserTokenBalance(connection: Connection, tokenMint: PublicKey, user: PublicKey): Promise<bigint>;
36
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA4B3E;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA4BnC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,MAAM,CAAC,CAKjB;AAID;;GAEG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CA0B3B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACpC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAyB9D;AAID;;;GAGG;AACH,wBAAsB,aAAa,CAClC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAgE5B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,GACb,OAAO,CAAC,MAAM,CAAC,CAQjB"}
package/dist/accounts.js CHANGED
@@ -197,3 +197,4 @@ async function getUserTokenBalance(connection, tokenMint, user) {
197
197
  return 0n;
198
198
  }
199
199
  }
200
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAqCH,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