@augustdigital/sdk 8.19.0 → 8.21.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.
@@ -7,7 +7,7 @@ import * as SolanaConstants from './constants';
7
7
  import * as SolanaGetters from './getters';
8
8
  import * as SolanaActions from './vault.actions';
9
9
  import type { AnchorProvider, web3 } from '@coral-xyz/anchor';
10
- import { Connection, PublicKey, type Transaction } from '@solana/web3.js';
10
+ import { type Commitment, Connection, PublicKey, type Transaction } from '@solana/web3.js';
11
11
  import type { ISolanaNetwork, ISolanaRpcEndpoint } from './types';
12
12
  import type { SendTransactionOptions } from '@solana/wallet-adapter-base';
13
13
  export declare const Solana: {
@@ -61,11 +61,11 @@ export declare const Solana: {
61
61
  fetchUserTokenBalance: ({ connection, publicKey, depositMint, }: {
62
62
  publicKey: PublicKey | string;
63
63
  depositMint?: PublicKey | string;
64
- } & import("./types").ISolanaConnectionOptions) => Promise<any>;
64
+ } & import("./types").ISolanaConnectionOptions) => Promise<string>;
65
65
  fetchUserShareBalance: ({ connection, publicKey, shareMint, }: {
66
66
  publicKey: PublicKey | string;
67
67
  shareMint?: PublicKey | string;
68
- } & import("./types").ISolanaConnectionOptions) => Promise<any>;
68
+ } & import("./types").ISolanaConnectionOptions) => Promise<number>;
69
69
  fetchUserShareBalanceRaw: ({ connection, publicKey, shareMint, }: {
70
70
  publicKey: PublicKey | string;
71
71
  shareMint?: PublicKey | string;
@@ -119,7 +119,23 @@ declare class SolanaAdapter {
119
119
  private _network;
120
120
  private _connection;
121
121
  private _provider;
122
- constructor(endpoint: ISolanaRpcEndpoint, network?: ISolanaNetwork);
122
+ /**
123
+ * @param commitment - Commitment for every read this adapter makes *and* for
124
+ * the confirmation of every write, so the two always describe the same
125
+ * chain state — the vault handlers take it from this same `Connection`.
126
+ *
127
+ * Defaults to `'finalized'`, which is what this adapter has always used in
128
+ * practice: it previously passed no commitment at all, so both reads and
129
+ * confirmations fell through to the RPC's own `'finalized'` default. The
130
+ * default is stated explicitly now rather than inherited, but it is
131
+ * unchanged.
132
+ *
133
+ * Pass `'confirmed'` for a markedly faster round trip — seconds rather
134
+ * than tens of seconds — accepting that the state you act on can still, in
135
+ * principle, be rolled back. Also settable as the `commitment` field of
136
+ * the `solana` config passed to `AugustSDK`.
137
+ */
138
+ constructor(endpoint: ISolanaRpcEndpoint, network?: ISolanaNetwork, commitment?: Commitment);
123
139
  get endpoint(): `https://${string}`;
124
140
  get network(): ISolanaNetwork;
125
141
  get connection(): web3.Connection;
@@ -171,8 +187,8 @@ declare class SolanaAdapter {
171
187
  image: string;
172
188
  }>;
173
189
  getTokenSymbol(mintAddress: string | PublicKey): Promise<string>;
174
- fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<any>;
175
- fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<any>;
190
+ fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<string>;
191
+ fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<number>;
176
192
  /**
177
193
  * BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
178
194
  * `amount` (as a base-units string) plus the mint's `decimals` (or `null`
@@ -212,13 +228,31 @@ declare class SolanaAdapter {
212
228
  /**
213
229
  * Deposit funds into a Solana August vault.
214
230
  * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
231
+ * @param sendTransaction - **Ignored; scheduled for removal (AUGUST-7221).**
232
+ * Share-account creation is now prepended to the deposit instruction, so
233
+ * the SDK sends no second transaction and never invokes this callback —
234
+ * signing goes through the provider's wallet.
235
+ *
236
+ * **Pass `undefined` here; do not delete the argument.** It sits *before*
237
+ * `vaultAddress`, so removing it shifts your vault address into this slot
238
+ * and leaves `vaultAddress` undefined — which silently falls back to the
239
+ * legacy single-vault PDA derivation and targets a different vault.
215
240
  */
216
- vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
241
+ vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
217
242
  /**
218
243
  * Redeem vault shares from a Solana August vault.
219
244
  * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
245
+ * @param sendTransaction - **Ignored; scheduled for removal (AUGUST-7221).**
246
+ * Payout- and fee-recipient-account creation is now prepended to the redeem
247
+ * instruction, so the SDK sends no second transaction and never invokes
248
+ * this callback — signing goes through the provider's wallet.
249
+ *
250
+ * **Pass `undefined` here; do not delete the argument.** It sits *before*
251
+ * `vaultAddress`, so removing it shifts your vault address into this slot
252
+ * and leaves `vaultAddress` undefined — which silently falls back to the
253
+ * legacy single-vault PDA derivation and targets a different vault.
220
254
  */
221
- vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
255
+ vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
222
256
  /**
223
257
  * Canonical program id for a program type on this adapter's network.
224
258
  *
@@ -68,10 +68,29 @@ class SolanaAdapter {
68
68
  _network;
69
69
  _connection;
70
70
  _provider;
71
- constructor(endpoint, network = utils_1.SolanaUtils.fallbackNetwork) {
71
+ /**
72
+ * @param commitment - Commitment for every read this adapter makes *and* for
73
+ * the confirmation of every write, so the two always describe the same
74
+ * chain state — the vault handlers take it from this same `Connection`.
75
+ *
76
+ * Defaults to `'finalized'`, which is what this adapter has always used in
77
+ * practice: it previously passed no commitment at all, so both reads and
78
+ * confirmations fell through to the RPC's own `'finalized'` default. The
79
+ * default is stated explicitly now rather than inherited, but it is
80
+ * unchanged.
81
+ *
82
+ * Pass `'confirmed'` for a markedly faster round trip — seconds rather
83
+ * than tens of seconds — accepting that the state you act on can still, in
84
+ * principle, be rolled back. Also settable as the `commitment` field of
85
+ * the `solana` config passed to `AugustSDK`.
86
+ */
87
+ constructor(endpoint, network = utils_1.SolanaUtils.fallbackNetwork, commitment = 'finalized') {
72
88
  this._endpoint = endpoint;
73
89
  this._network = network;
74
- const connection = new web3_js_1.Connection(endpoint);
90
+ // Explicit rather than inherited: left unset, web3.js omits the parameter
91
+ // and the RPC applies its own default, which is the same 'finalized' —
92
+ // but then nothing ties it to the commitment writes confirm at.
93
+ const connection = new web3_js_1.Connection(endpoint, commitment);
75
94
  this._connection = connection;
76
95
  this._provider = utils_1.SolanaUtils.getReadOnlyProvider({
77
96
  network: this._network,
@@ -238,6 +257,15 @@ class SolanaAdapter {
238
257
  /**
239
258
  * Deposit funds into a Solana August vault.
240
259
  * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
260
+ * @param sendTransaction - **Ignored; scheduled for removal (AUGUST-7221).**
261
+ * Share-account creation is now prepended to the deposit instruction, so
262
+ * the SDK sends no second transaction and never invokes this callback —
263
+ * signing goes through the provider's wallet.
264
+ *
265
+ * **Pass `undefined` here; do not delete the argument.** It sits *before*
266
+ * `vaultAddress`, so removing it shifts your vault address into this slot
267
+ * and leaves `vaultAddress` undefined — which silently falls back to the
268
+ * legacy single-vault PDA derivation and targets a different vault.
241
269
  */
242
270
  async vaultDeposit(vaultProgramId, idl, publicKey, depositAmount, sendTransaction, vaultAddress) {
243
271
  return await (0, vault_actions_1.handleSolanaDeposit)({
@@ -255,6 +283,15 @@ class SolanaAdapter {
255
283
  /**
256
284
  * Redeem vault shares from a Solana August vault.
257
285
  * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
286
+ * @param sendTransaction - **Ignored; scheduled for removal (AUGUST-7221).**
287
+ * Payout- and fee-recipient-account creation is now prepended to the redeem
288
+ * instruction, so the SDK sends no second transaction and never invokes
289
+ * this callback — signing goes through the provider's wallet.
290
+ *
291
+ * **Pass `undefined` here; do not delete the argument.** It sits *before*
292
+ * `vaultAddress`, so removing it shifts your vault address into this slot
293
+ * and leaves `vaultAddress` undefined — which silently falls back to the
294
+ * legacy single-vault PDA derivation and targets a different vault.
258
295
  */
259
296
  async vaultRedeem(vaultProgramId, idl, publicKey, redeemShares, sendTransaction, vaultAddress) {
260
297
  return await (0, vault_actions_1.handleSolanaRedeem)({
@@ -1,5 +1,5 @@
1
1
  import { AnchorProvider, BN, Program, type web3 } from '@coral-xyz/anchor';
2
- import { PublicKey, type Transaction } from '@solana/web3.js';
2
+ import { PublicKey, type ParsedAccountData, type Transaction } from '@solana/web3.js';
3
3
  import type { ISolanaConnectionOptions, ISolanaVaultState } from './types';
4
4
  declare function getExplorerLink({ signature, type, network, }: {
5
5
  signature: string;
@@ -58,14 +58,65 @@ declare function getToken({ mintAddress, endpoint, connection, }: {
58
58
  declare function getTokenSymbol({ endpoint, mintAddress, }: {
59
59
  mintAddress: string | PublicKey;
60
60
  } & ISolanaConnectionOptions): Promise<string | null>;
61
+ /**
62
+ * A wallet's token account of record for one mint: the account holding the
63
+ * largest balance.
64
+ *
65
+ * **This is the single selection rule for the whole Solana adapter.** Reads
66
+ * (balances shown in a UI) and writes (the account a transfer actually names)
67
+ * must agree on which account represents the user, or the two describe
68
+ * different money: a balance read from account A while a deposit mints into
69
+ * account B looks, to the user, like a successful transaction that never
70
+ * arrived. Every reader in this file and both vault handlers call this, so the
71
+ * rule cannot drift.
72
+ *
73
+ * Largest-balance rather than "the first account the RPC returned":
74
+ * `getParsedTokenAccountsByOwner` guarantees no ordering, so taking `[0]` can
75
+ * select an empty leftover while the user's funds sit in a sibling account —
76
+ * which fails on-chain as an insufficient-funds revert *after* they sign.
77
+ *
78
+ * **Spendable accounts win over frozen ones**, regardless of balance: a token
79
+ * issuer can freeze an account, and neither a transfer out of nor a transfer
80
+ * into a frozen account can succeed. Picking the richest account outright would
81
+ * hand a frozen one to the program and revert with SPL `0x11` after the user
82
+ * signs, while a perfectly usable sibling sat next to it. When *every* account
83
+ * is frozen the richest frozen one is still returned, flagged — a reader should
84
+ * show that balance, because the user does own it, and a writer should refuse
85
+ * before asking for a signature.
86
+ *
87
+ * Internal to the adapter: exported for `vault.actions.ts`, deliberately not
88
+ * re-exported on `SolanaUtils`. It takes a raw RPC response shape, which is not
89
+ * a contract worth freezing on the public surface.
90
+ *
91
+ * @param accounts - The `.value` array from `getParsedTokenAccountsByOwner`.
92
+ * @returns The selected account with its raw balance, decimals, the RPC's own
93
+ * `uiAmount`, and whether it is frozen — or `undefined` when the wallet owns
94
+ * no account for the mint.
95
+ * @throws AugustSDKError when an account's balance cannot be read. An
96
+ * unreadable balance is *unknown*, not zero — scoring it zero would silently
97
+ * demote a funded account below a dust one and reinstate the `[0]` behaviour
98
+ * this function exists to prevent.
99
+ */
100
+ export declare function selectRichestTokenAccount(accounts: {
101
+ pubkey: PublicKey;
102
+ account: {
103
+ data: ParsedAccountData | Buffer;
104
+ };
105
+ }[]): {
106
+ pubkey: PublicKey;
107
+ amount: bigint;
108
+ decimals: number | null;
109
+ uiAmount: number | null;
110
+ frozen: boolean;
111
+ } | undefined;
61
112
  declare function fetchUserTokenBalance({ connection, publicKey, depositMint, }: {
62
113
  publicKey: PublicKey | string;
63
114
  depositMint?: PublicKey | string;
64
- } & ISolanaConnectionOptions): Promise<any>;
115
+ } & ISolanaConnectionOptions): Promise<string>;
65
116
  declare function fetchUserShareBalance({ connection, publicKey, shareMint, }: {
66
117
  publicKey: PublicKey | string;
67
118
  shareMint?: PublicKey | string;
68
- } & ISolanaConnectionOptions): Promise<any>;
119
+ } & ISolanaConnectionOptions): Promise<number>;
69
120
  /**
70
121
  * Same on-chain lookup as `fetchUserShareBalance`, but returns the raw u64
71
122
  * `amount` string and the mint's `decimals` — or `null` when the scale can't
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolanaUtils = exports.isSolanaAddress = void 0;
4
+ exports.selectRichestTokenAccount = selectRichestTokenAccount;
4
5
  exports.uiAmountToRawBn = uiAmountToRawBn;
5
6
  const anchor_1 = require("@coral-xyz/anchor");
6
7
  const web3_js_1 = require("@solana/web3.js");
@@ -103,7 +104,11 @@ function getProvider({ connection, publicKey, signTransaction, }) {
103
104
  const signedTransactions = await Promise.all(txs.map(async (tx) => signTransaction(tx)));
104
105
  return signedTransactions;
105
106
  },
106
- }, { commitment: 'confirmed' });
107
+ },
108
+ // Inherited from the connection, not hard-coded: a caller who configured
109
+ // the adapter for 'finalized' must not have writes issued through
110
+ // `getProgram(...).methods…rpc()` confirm at something weaker.
111
+ { commitment: connection.commitment ?? 'finalized' });
107
112
  }
108
113
  // Read-only provider for data fetching without wallet connection
109
114
  function getReadOnlyProvider({ connection }) {
@@ -117,8 +122,10 @@ function getReadOnlyProvider({ connection }) {
117
122
  throw new core_1.AugustValidationError('INVALID_INPUT', 'Cannot sign transactions with read-only provider');
118
123
  },
119
124
  };
125
+ // See `getProvider` — the connection is the single source of truth for
126
+ // commitment, so reads through this provider match reads made directly.
120
127
  return new anchor_1.AnchorProvider(connection, dummyWallet, {
121
- commitment: 'confirmed',
128
+ commitment: connection.commitment ?? 'finalized',
122
129
  });
123
130
  }
124
131
  // ============================================================================
@@ -440,6 +447,87 @@ async function getTokenSymbol({ endpoint, mintAddress, }) {
440
447
  return null;
441
448
  }
442
449
  }
450
+ /**
451
+ * A wallet's token account of record for one mint: the account holding the
452
+ * largest balance.
453
+ *
454
+ * **This is the single selection rule for the whole Solana adapter.** Reads
455
+ * (balances shown in a UI) and writes (the account a transfer actually names)
456
+ * must agree on which account represents the user, or the two describe
457
+ * different money: a balance read from account A while a deposit mints into
458
+ * account B looks, to the user, like a successful transaction that never
459
+ * arrived. Every reader in this file and both vault handlers call this, so the
460
+ * rule cannot drift.
461
+ *
462
+ * Largest-balance rather than "the first account the RPC returned":
463
+ * `getParsedTokenAccountsByOwner` guarantees no ordering, so taking `[0]` can
464
+ * select an empty leftover while the user's funds sit in a sibling account —
465
+ * which fails on-chain as an insufficient-funds revert *after* they sign.
466
+ *
467
+ * **Spendable accounts win over frozen ones**, regardless of balance: a token
468
+ * issuer can freeze an account, and neither a transfer out of nor a transfer
469
+ * into a frozen account can succeed. Picking the richest account outright would
470
+ * hand a frozen one to the program and revert with SPL `0x11` after the user
471
+ * signs, while a perfectly usable sibling sat next to it. When *every* account
472
+ * is frozen the richest frozen one is still returned, flagged — a reader should
473
+ * show that balance, because the user does own it, and a writer should refuse
474
+ * before asking for a signature.
475
+ *
476
+ * Internal to the adapter: exported for `vault.actions.ts`, deliberately not
477
+ * re-exported on `SolanaUtils`. It takes a raw RPC response shape, which is not
478
+ * a contract worth freezing on the public surface.
479
+ *
480
+ * @param accounts - The `.value` array from `getParsedTokenAccountsByOwner`.
481
+ * @returns The selected account with its raw balance, decimals, the RPC's own
482
+ * `uiAmount`, and whether it is frozen — or `undefined` when the wallet owns
483
+ * no account for the mint.
484
+ * @throws AugustSDKError when an account's balance cannot be read. An
485
+ * unreadable balance is *unknown*, not zero — scoring it zero would silently
486
+ * demote a funded account below a dust one and reinstate the `[0]` behaviour
487
+ * this function exists to prevent.
488
+ */
489
+ function selectRichestTokenAccount(accounts) {
490
+ const parsed = accounts.map((entry) => {
491
+ const info = entry.account.data?.parsed?.info;
492
+ const tokenAmount = info?.tokenAmount;
493
+ const raw = tokenAmount?.amount;
494
+ // A u64 string is the only shape the RPC promises here. Anything else
495
+ // (a base64 `data` the node could not jsonParse, a reshaping proxy) means
496
+ // we do not know this balance.
497
+ if (typeof raw !== 'string' || !/^\d+$/.test(raw)) {
498
+ throw new core_1.AugustSDKError('UNKNOWN', `Could not read the balance of token account ${entry.pubkey.toBase58()}. ` +
499
+ 'The RPC returned an unrecognized response; please retry or switch RPC.', {
500
+ context: {
501
+ account: entry.pubkey.toBase58(),
502
+ rawAmount: String(raw),
503
+ },
504
+ });
505
+ }
506
+ return {
507
+ pubkey: entry.pubkey,
508
+ amount: BigInt(raw),
509
+ decimals: typeof tokenAmount?.decimals === 'number' ? tokenAmount.decimals : null,
510
+ // Passed through from the RPC rather than recomputed from `amount`, so
511
+ // the lossy float these legacy readers return is not made lossier.
512
+ uiAmount: typeof tokenAmount?.uiAmount === 'number' ? tokenAmount.uiAmount : null,
513
+ frozen: info?.state === 'frozen',
514
+ };
515
+ });
516
+ const richest = (candidates) => candidates.reduce((best, candidate) => {
517
+ if (!best)
518
+ return candidate;
519
+ if (candidate.amount !== best.amount)
520
+ return candidate.amount > best.amount ? candidate : best;
521
+ // Equal balances: break the tie on the address. Falling back to "whichever
522
+ // the RPC listed first" would leave exactly the ordering dependence this
523
+ // function exists to remove — harmless while the balances match, but it
524
+ // means two calls can name different accounts for the same wallet.
525
+ return candidate.pubkey.toBase58() < best.pubkey.toBase58()
526
+ ? candidate
527
+ : best;
528
+ }, undefined);
529
+ return richest(parsed.filter((a) => !a.frozen)) ?? richest(parsed);
530
+ }
443
531
  async function fetchUserTokenBalance({ connection, publicKey, depositMint, }) {
444
532
  if (!publicKey || !depositMint)
445
533
  return '0';
@@ -449,12 +537,9 @@ async function fetchUserTokenBalance({ connection, publicKey, depositMint, }) {
449
537
  const tokenAccounts = await connection.getParsedTokenAccountsByOwner(_publicKey, {
450
538
  mint: _depositMint,
451
539
  });
452
- if (tokenAccounts.value.length > 0) {
453
- const balance = tokenAccounts?.value?.[0]?.account.data.parsed.info.tokenAmount
454
- .uiAmount;
455
- return balance?.toString() || '0';
456
- }
457
- return '0';
540
+ // Same rule the write path uses — see `selectRichestTokenAccount`.
541
+ const richest = selectRichestTokenAccount(tokenAccounts.value);
542
+ return richest?.uiAmount?.toString() || '0';
458
543
  }
459
544
  catch (e) {
460
545
  const error = e;
@@ -473,12 +558,9 @@ async function fetchUserShareBalance({ connection, publicKey, shareMint, }) {
473
558
  const shareAccounts = await connection.getParsedTokenAccountsByOwner(_publicKey, {
474
559
  mint: _shareMint,
475
560
  });
476
- if (shareAccounts.value.length > 0) {
477
- const balance = shareAccounts?.value?.[0]?.account.data.parsed.info.tokenAmount
478
- .uiAmount;
479
- return balance ?? 0;
480
- }
481
- return 0;
561
+ // Same rule the write path uses — see `selectRichestTokenAccount`.
562
+ const richest = selectRichestTokenAccount(shareAccounts.value);
563
+ return richest?.uiAmount ?? 0;
482
564
  }
483
565
  catch (e) {
484
566
  const error = e;
@@ -519,12 +601,13 @@ async function fetchUserShareBalanceRaw({ connection, publicKey, shareMint, }) {
519
601
  const shareAccounts = await connection.getParsedTokenAccountsByOwner(_publicKey, {
520
602
  mint: _shareMint,
521
603
  });
522
- const tokenAmount = shareAccounts?.value?.[0]?.account?.data?.parsed?.info?.tokenAmount;
523
- if (!tokenAmount)
604
+ // Same rule the write path uses — see `selectRichestTokenAccount`.
605
+ const richest = selectRichestTokenAccount(shareAccounts?.value ?? []);
606
+ if (!richest)
524
607
  return { amount: '0', decimals: null };
525
608
  return {
526
- amount: String(tokenAmount.amount ?? '0'),
527
- decimals: typeof tokenAmount.decimals === 'number' ? tokenAmount.decimals : null,
609
+ amount: richest.amount.toString(),
610
+ decimals: richest.decimals,
528
611
  };
529
612
  }
530
613
  catch (e) {
@@ -1,5 +1,5 @@
1
1
  import { type web3 } from '@coral-xyz/anchor';
2
- import { type Connection, PublicKey, Transaction } from '@solana/web3.js';
2
+ import { type Connection, PublicKey, type Transaction } from '@solana/web3.js';
3
3
  import type { ISolanaConnectionOptions } from './types';
4
4
  import type { SendTransactionOptions } from '@solana/wallet-adapter-base';
5
5
  /**
@@ -26,18 +26,33 @@ export declare function describeSolanaError(e: unknown): string;
26
26
  * @param depositAmount `bigint` is treated as raw on-chain units (preferred
27
27
  * — no JS-float round-trip). `number` is treated as a UI amount and
28
28
  * scaled by the deposit mint's decimals via {@link uiAmountToRawBn}.
29
- * @throws AugustValidationError on missing wallet/programId or invalid amount.
29
+ * @throws AugustValidationError on missing wallet/programId or invalid amount,
30
+ * or when the wallet's deposit-mint balance is below `depositAmount`.
31
+ * @throws AugustSDKError when a candidate token account's balance cannot be
32
+ * read, or wrapping any downstream failure (`cause` preserved).
33
+ * @remarks **Side effects.** Submits exactly one transaction, signed by the
34
+ * provider's wallet. When the wallet has no share account, that transaction
35
+ * also creates one, and `publicKey` pays its rent — roughly 0.00204 SOL,
36
+ * non-refundable while the account stays open — on top of the network fee.
37
+ * Callers should ensure the wallet holds enough SOL for both before
38
+ * prompting the user to sign.
30
39
  * @remarks The on-chain `deposit` instruction has no `min_shares_out`
31
40
  * parameter; slippage cannot be enforced on-chain until the program ships
32
41
  * that argument.
33
42
  */
34
- export declare function handleSolanaDeposit({ provider, connection, network, vaultProgramId, vaultAddress, depositAmount, publicKey, sendTransaction, idl, }: {
43
+ export declare function handleSolanaDeposit({ provider, connection, network, vaultProgramId, vaultAddress, depositAmount, publicKey, idl, }: {
35
44
  vaultProgramId: PublicKey | string;
36
45
  vaultAddress?: PublicKey | string;
37
46
  idl: any;
38
47
  publicKey: PublicKey | string;
39
48
  depositAmount: number | bigint;
40
- sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>;
49
+ /**
50
+ * @deprecated Accepted and ignored. Share-account creation is now prepended
51
+ * to the deposit instruction, so there is no longer a second transaction to
52
+ * send. Kept so existing callers keep compiling; will be removed in the next
53
+ * major.
54
+ */
55
+ sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>;
41
56
  } & ISolanaConnectionOptions): Promise<any>;
42
57
  /**
43
58
  * Redeem vault shares back into the underlying mint on a Solana August vault.
@@ -45,13 +60,28 @@ export declare function handleSolanaDeposit({ provider, connection, network, vau
45
60
  * @param redeemShares `bigint` is treated as raw share-token units;
46
61
  * `number` is treated as a UI amount. See {@link handleSolanaDeposit} for
47
62
  * the same caveat about the missing on-chain slippage guard.
48
- * @throws AugustValidationError on missing wallet/programId or invalid amount.
63
+ * @throws AugustValidationError on missing wallet/programId or invalid amount,
64
+ * or when the wallet holds fewer shares than `redeemShares`.
65
+ * @throws AugustSDKError when a candidate token account's balance cannot be
66
+ * read, or wrapping any downstream failure (`cause` preserved).
67
+ * @remarks **Side effects.** Submits exactly one transaction, signed by the
68
+ * provider's wallet. That transaction also creates the payout account when
69
+ * the wallet has none, and the vault's fee-recipient account when *it* has
70
+ * none — `publicKey` pays rent for both, roughly 0.00204 SOL each and
71
+ * non-refundable, on top of the network fee. Callers should ensure the
72
+ * wallet holds enough SOL for all of it before prompting the user to sign.
49
73
  */
50
- export declare function handleSolanaRedeem({ provider, connection, vaultProgramId, vaultAddress, publicKey, redeemShares, sendTransaction, idl, }: {
74
+ export declare function handleSolanaRedeem({ provider, connection, vaultProgramId, vaultAddress, publicKey, redeemShares, idl, }: {
51
75
  idl: any;
52
76
  vaultProgramId: PublicKey | string;
53
77
  vaultAddress?: PublicKey | string;
54
78
  publicKey: PublicKey | string;
55
79
  redeemShares: number | bigint;
56
- sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>;
80
+ /**
81
+ * @deprecated Accepted and ignored. Payout- and fee-recipient-account
82
+ * creation is now prepended to the redeem instruction, so there is no longer
83
+ * a second transaction to send. Kept so existing callers keep compiling;
84
+ * will be removed in the next major.
85
+ */
86
+ sendTransaction?: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>;
57
87
  } & ISolanaConnectionOptions): Promise<any>;