@augustdigital/sdk 9.11.0 → 9.12.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.
Files changed (38) hide show
  1. package/lib/adapters/solana/constants.d.ts +12 -4
  2. package/lib/adapters/solana/constants.js +8 -3
  3. package/lib/adapters/solana/getters.d.ts +5 -0
  4. package/lib/adapters/solana/getters.js +35 -1
  5. package/lib/adapters/solana/idl/vault-idl.d.ts +334 -7
  6. package/lib/adapters/solana/idl/vault-idl.js +600 -59
  7. package/lib/adapters/solana/idl/withdrawal-queue-idl.d.ts +790 -0
  8. package/lib/adapters/solana/idl/withdrawal-queue-idl.js +1868 -0
  9. package/lib/adapters/solana/index.d.ts +108 -10
  10. package/lib/adapters/solana/index.js +137 -12
  11. package/lib/adapters/solana/pricing.d.ts +11 -0
  12. package/lib/adapters/solana/pricing.js +24 -8
  13. package/lib/adapters/solana/queue.actions.d.ts +98 -0
  14. package/lib/adapters/solana/queue.actions.js +488 -0
  15. package/lib/adapters/solana/token-reads.d.ts +108 -0
  16. package/lib/adapters/solana/token-reads.js +145 -0
  17. package/lib/adapters/solana/types.d.ts +200 -1
  18. package/lib/adapters/solana/utils.d.ts +16 -0
  19. package/lib/adapters/solana/utils.js +41 -4
  20. package/lib/adapters/solana/vault.actions.d.ts +17 -0
  21. package/lib/adapters/solana/vault.actions.js +14 -125
  22. package/lib/adapters/solana/withdrawal-queue.d.ts +125 -0
  23. package/lib/adapters/solana/withdrawal-queue.js +301 -0
  24. package/lib/core/analytics/method-taxonomy.js +2 -0
  25. package/lib/core/analytics/version.d.ts +1 -1
  26. package/lib/core/analytics/version.js +1 -1
  27. package/lib/main.d.ts +16 -0
  28. package/lib/main.js +16 -0
  29. package/lib/modules/vaults/getters.d.ts +2 -2
  30. package/lib/modules/vaults/getters.js +103 -3
  31. package/lib/modules/vaults/main.d.ts +12 -0
  32. package/lib/modules/vaults/main.js +17 -1
  33. package/lib/modules/vaults/types.d.ts +14 -1
  34. package/lib/sdk.d.ts +2389 -1723
  35. package/lib/types/vaults.d.ts +47 -1
  36. package/lib/types/vaults.js +5 -0
  37. package/lib/types/webserver.d.ts +8 -0
  38. package/package.json +1 -1
@@ -2,6 +2,14 @@ import type { ISolanaNetwork } from '../../types';
2
2
  import { vaultIdl } from './idl/vault-idl';
3
3
  declare const fallbackDecimals = 8;
4
4
  declare const fallbackNetwork: ISolanaNetwork;
5
+ /**
6
+ * Program ids deployed on one Solana network. `withdrawalQueue` is absent where
7
+ * the queue program is not deployed yet (currently mainnet-beta).
8
+ */
9
+ type ISolanaProgramIds = {
10
+ vault: string;
11
+ withdrawalQueue?: string;
12
+ };
5
13
  declare const fallbackRpcEndpoints: {
6
14
  readonly devnet: "https://api.devnet.solana.com";
7
15
  readonly mainnet: "https://api.mainnet-beta.solana.com";
@@ -11,12 +19,14 @@ declare const fallbackRpcEndpoints: {
11
19
  declare const programIds: {
12
20
  devnet: {
13
21
  vault: string;
22
+ withdrawalQueue: string;
14
23
  };
15
24
  "mainnet-beta": {
16
25
  vault: string;
17
26
  };
18
27
  localnet: {
19
28
  vault: string;
29
+ withdrawalQueue: string;
20
30
  };
21
31
  };
22
32
  /** Solana networks the canonical august_vault program is actually deployed on. */
@@ -26,8 +36,6 @@ type ISolanaDeployedNetwork = keyof typeof programIds;
26
36
  * deployment there (currently `testnet`). Callers must handle `undefined` —
27
37
  * silently substituting a default would hand back a dead address.
28
38
  */
29
- declare function getDeployedProgramIds(network: ISolanaNetwork): {
30
- vault: string;
31
- } | undefined;
39
+ declare function getDeployedProgramIds(network: ISolanaNetwork): ISolanaProgramIds | undefined;
32
40
  export { fallbackDecimals, fallbackNetwork, fallbackRpcEndpoints, getDeployedProgramIds, programIds, vaultIdl, };
33
- export type { ISolanaDeployedNetwork };
41
+ export type { ISolanaDeployedNetwork, ISolanaProgramIds };
@@ -8,9 +8,6 @@ const fallbackDecimals = 8;
8
8
  exports.fallbackDecimals = fallbackDecimals;
9
9
  const fallbackNetwork = 'mainnet-beta';
10
10
  exports.fallbackNetwork = fallbackNetwork;
11
- // ============================================================================
12
- // SOLANA CONFIGURATION
13
- // ============================================================================
14
11
  const fallbackRpcEndpoints = {
15
12
  devnet: 'https://api.devnet.solana.com',
16
13
  mainnet: 'https://api.mainnet-beta.solana.com',
@@ -29,15 +26,23 @@ exports.fallbackRpcEndpoints = fallbackRpcEndpoints;
29
26
  // transaction. Unmapped networks throw from `getProgram`/`getProgramId` instead.
30
27
  // `satisfies` keeps the literal ids in the generated docs while checking keys
31
28
  // against ISolanaNetwork, so `testnet` is absent from the type, not optional.
29
+ //
30
+ // `withdrawalQueue` is the august_withdrawal_queue program. Its id is fixed (the
31
+ // vault binary hardcodes it as `WITHDRAWAL_QUEUE_PROGRAM_ID`), but it is mapped
32
+ // only where deployed: devnet and localnet. Mainnet-beta still runs the pre-queue
33
+ // vault build, which the bundled vault IDL stays compatible with; add the entry
34
+ // there once the mainnet upgrade deploys the queue.
32
35
  const programIds = {
33
36
  devnet: {
34
37
  vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
38
+ withdrawalQueue: 'upQhC7mgYwmHLVaatRWoGAu394piLT9th9FiQZHnPrW',
35
39
  },
36
40
  ['mainnet-beta']: {
37
41
  vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
38
42
  },
39
43
  localnet: {
40
44
  vault: 'up12bytoZBmwofqsySf2uqKQ7zpfeKiAWwfvqzJjtRt',
45
+ withdrawalQueue: 'upQhC7mgYwmHLVaatRWoGAu394piLT9th9FiQZHnPrW',
41
46
  },
42
47
  };
43
48
  exports.programIds = programIds;
@@ -4,6 +4,11 @@ import type { IVaultBaseOptions } from '../../modules/vaults/types';
4
4
  * Fetch Solana vault data from on-chain program state.
5
5
  * Falls back to backend-only data when Solana RPC is unavailable,
6
6
  * ensuring vaults always appear in the list even without on-chain access.
7
+ *
8
+ * When the vault has a withdrawal queue, `withdrawalQueue` carries its live
9
+ * summary, at the cost of one extra `getMultipleAccountsInfo` (the queue and a
10
+ * fresh read of the vault state, for `enabled`). A failed queue read is
11
+ * logged and leaves the field out rather than failing the vault.
7
12
  * @param tokenizedVault Vault metadata from backend
8
13
  * @param options RPC configuration with Solana service
9
14
  * @returns Formatted vault object with Solana-specific fields
@@ -39,10 +39,16 @@ const utils_1 = require("./utils");
39
39
  const SolanaConstants = __importStar(require("./constants"));
40
40
  const core_1 = require("../../core");
41
41
  const utils_2 = require("../../modules/vaults/utils");
42
+ const withdrawal_queue_1 = require("./withdrawal-queue");
42
43
  /**
43
44
  * Fetch Solana vault data from on-chain program state.
44
45
  * Falls back to backend-only data when Solana RPC is unavailable,
45
46
  * ensuring vaults always appear in the list even without on-chain access.
47
+ *
48
+ * When the vault has a withdrawal queue, `withdrawalQueue` carries its live
49
+ * summary, at the cost of one extra `getMultipleAccountsInfo` (the queue and a
50
+ * fresh read of the vault state, for `enabled`). A failed queue read is
51
+ * logged and leaves the field out rather than failing the vault.
46
52
  * @param tokenizedVault Vault metadata from backend
47
53
  * @param options RPC configuration with Solana service
48
54
  * @returns Formatted vault object with Solana-specific fields
@@ -101,6 +107,7 @@ const getSolanaVault = async (tokenizedVault, options) => {
101
107
  // Prefer vaultState.shareMint (correct for multi-vault programs like jitoSOL);
102
108
  // fall back to deriveShareMintPda(programId) for legacy single-vault programs.
103
109
  let totalSupply = (0, core_1.toNormalizedBn)(0, decimals);
110
+ let shareDecimals = decimals;
104
111
  if (onChainAvailable) {
105
112
  try {
106
113
  const shareMintFromState = vaultState?.vaultState?.shareMint;
@@ -112,6 +119,7 @@ const getSolanaVault = async (tokenizedVault, options) => {
112
119
  const parsedData = shareMintAccountInfo.value.data;
113
120
  const { supply, decimals: mintDecimals } = parsedData.parsed.info;
114
121
  totalSupply = (0, core_1.toNormalizedBn)(BigInt(supply), mintDecimals);
122
+ shareDecimals = mintDecimals;
115
123
  }
116
124
  }
117
125
  catch (error) {
@@ -152,8 +160,31 @@ const getSolanaVault = async (tokenizedVault, options) => {
152
160
  vault: tokenizedVault.address,
153
161
  });
154
162
  }
163
+ let withdrawalQueue;
164
+ const solanaService = options.solanaService;
165
+ if (onChainAvailable && vaultState?.vaultState && solanaService) {
166
+ try {
167
+ const queueProgramId = (0, withdrawal_queue_1.resolveQueueProgramId)(solanaService);
168
+ withdrawalQueue = queueProgramId
169
+ ? await (0, withdrawal_queue_1.getSolanaWithdrawalQueueSummary)({
170
+ connection: solanaService.connection,
171
+ queueProgramId,
172
+ vaultState: solanaMetadata?.vault_state_pda
173
+ ? new web3_js_1.PublicKey(solanaMetadata.vault_state_pda)
174
+ : utils_1.SolanaUtils.deriveVaultStatePda(programId),
175
+ shareDecimals,
176
+ })
177
+ : undefined;
178
+ }
179
+ catch (error) {
180
+ core_1.Logger.log.warn('getSolanaVault', 'Withdrawal queue read failed', {
181
+ vault: tokenizedVault.address,
182
+ error,
183
+ });
184
+ }
185
+ }
155
186
  // Build unified vault object combining on-chain and backend data
156
- return (0, utils_2.buildBackendVault)(tokenizedVault, {
187
+ const vault = (0, utils_2.buildBackendVault)(tokenizedVault, {
157
188
  chainId: core_1.SPECIAL_CHAINS.solana.chainId,
158
189
  version: 'sol-0',
159
190
  name: tokenizedVault.vault_name || 'Solana Program',
@@ -167,6 +198,9 @@ const getSolanaVault = async (tokenizedVault, options) => {
167
198
  },
168
199
  programId,
169
200
  });
201
+ if (withdrawalQueue)
202
+ vault.withdrawalQueue = withdrawalQueue;
203
+ return vault;
170
204
  };
171
205
  exports.getSolanaVault = getSolanaVault;
172
206
  //# sourceMappingURL=getters.js.map
@@ -2,8 +2,10 @@
2
2
  * august_vault program IDL (Anchor).
3
3
  *
4
4
  * GENERATED — do not edit by hand. Source of truth is the program repo's build
5
- * artifact: solana-vaults `frontend/idl/august_vault.json` (synced from the
6
- * vendored program by `scripts/sync-idl.sh`). Regenerate from there, NOT with
5
+ * artifact: `target/idl/august_vault.json` from
6
+ * fractal-protocol/solana-upshift-vault-programs, built at the release the SDK
7
+ * targets (solana-vaults' `frontend/idl/august_vault.json` is a copy of the same
8
+ * artifact, synced from its vendored submodule). Regenerate from there, NOT with
7
9
  * `anchor idl fetch`: an Anchor IDL upload is not refreshed by a program
8
10
  * upgrade, so every IDL published for this program lineage is stale — both
9
11
  * `up12…` on mainnet (last written 2026-01-21) and the `C8B1…` devnet reference
@@ -13,6 +15,22 @@
13
15
  * it: SolanaAdapter/getProgram resolve the real program id per network from
14
16
  * programIds, or from an explicit `programId` override.
15
17
  *
18
+ * Writability: generated from the withdrawal-queue release build (#34). Later
19
+ * builds (devnet runs #41) drop `mut` from accounts they only read. Do not
20
+ * regenerate from one of those until mainnet runs it: mainnet's build rejects
21
+ * those accounts arriving read-only, while every build accepts them writable.
22
+ * Guarded by tests/adapters/solana-idl.test.ts. Built with the doc-only fix
23
+ * from program PR #48 applied (`SubaccountDelegationMissing` is 6027), so it
24
+ * differs from #34's artifact in doc strings alone.
25
+ *
26
+ * One hand edit after generation: `operator_token_account` in `operator_deposit`
27
+ * and `operator_withdraw` carries no `pda`. The program derives it as the ATA of
28
+ * the registered subaccount's stored `address`, or of the operator when there is
29
+ * none, which Anchor's IDL cannot express: the generated seed names the
30
+ * `subaccount` account itself, so Anchor would silently resolve the wrong ATA.
31
+ * Without the `pda`, callers must pass the account, and a missing one throws.
32
+ * Pinned by tests/adapters/solana-idl.test.ts; reapply it on every regeneration.
33
+ *
16
34
  * Drift is guarded by tests/vaults/solana-idl-drift.test.ts: the deployed binary
17
35
  * is pinned, every discriminator declared here must appear in that binary, and
18
36
  * live VaultState accounts must decode against this file.
@@ -33,6 +51,32 @@ export declare const vaultIdl: {
33
51
  name: string;
34
52
  }[];
35
53
  instructions: ({
54
+ accounts: ({
55
+ name: string;
56
+ writable: boolean;
57
+ signer?: undefined;
58
+ docs?: undefined;
59
+ } | {
60
+ name: string;
61
+ writable?: undefined;
62
+ signer?: undefined;
63
+ docs?: undefined;
64
+ } | {
65
+ name: string;
66
+ signer: boolean;
67
+ writable?: undefined;
68
+ docs?: undefined;
69
+ } | {
70
+ docs: string[];
71
+ name: string;
72
+ writable?: undefined;
73
+ signer?: undefined;
74
+ })[];
75
+ args: any[];
76
+ discriminator: number[];
77
+ docs: string[];
78
+ name: string;
79
+ } | {
36
80
  accounts: ({
37
81
  name: string;
38
82
  signer: boolean;
@@ -97,6 +141,75 @@ export declare const vaultIdl: {
97
141
  discriminator: number[];
98
142
  docs: string[];
99
143
  name: string;
144
+ } | {
145
+ accounts: ({
146
+ name: string;
147
+ writable: boolean;
148
+ pda?: undefined;
149
+ signer?: undefined;
150
+ } | {
151
+ name: string;
152
+ pda: {
153
+ seeds: ({
154
+ kind: string;
155
+ value: number[];
156
+ path?: undefined;
157
+ account?: undefined;
158
+ } | {
159
+ kind: string;
160
+ path: string;
161
+ value?: undefined;
162
+ account?: undefined;
163
+ } | {
164
+ account: string;
165
+ kind: string;
166
+ path: string;
167
+ value?: undefined;
168
+ })[];
169
+ };
170
+ writable: boolean;
171
+ signer?: undefined;
172
+ } | {
173
+ name: string;
174
+ writable?: undefined;
175
+ pda?: undefined;
176
+ signer?: undefined;
177
+ } | {
178
+ name: string;
179
+ signer: boolean;
180
+ writable: boolean;
181
+ pda?: undefined;
182
+ })[];
183
+ args: any[];
184
+ discriminator: number[];
185
+ docs: string[];
186
+ name: string;
187
+ } | {
188
+ accounts: ({
189
+ name: string;
190
+ writable: boolean;
191
+ signer?: undefined;
192
+ docs?: undefined;
193
+ } | {
194
+ name: string;
195
+ writable?: undefined;
196
+ signer?: undefined;
197
+ docs?: undefined;
198
+ } | {
199
+ name: string;
200
+ signer: boolean;
201
+ writable?: undefined;
202
+ docs?: undefined;
203
+ } | {
204
+ docs: string[];
205
+ name: string;
206
+ signer: boolean;
207
+ writable?: undefined;
208
+ })[];
209
+ args: any[];
210
+ discriminator: number[];
211
+ docs: string[];
212
+ name: string;
100
213
  } | {
101
214
  accounts: ({
102
215
  docs: string[];
@@ -246,13 +359,163 @@ export declare const vaultIdl: {
246
359
  discriminator: number[];
247
360
  docs: string[];
248
361
  name: string;
362
+ } | {
363
+ accounts: ({
364
+ name: string;
365
+ writable: boolean;
366
+ docs?: undefined;
367
+ signer?: undefined;
368
+ optional?: undefined;
369
+ pda?: undefined;
370
+ } | {
371
+ docs: string[];
372
+ name: string;
373
+ writable: boolean;
374
+ signer?: undefined;
375
+ optional?: undefined;
376
+ pda?: undefined;
377
+ } | {
378
+ docs: string[];
379
+ name: string;
380
+ signer: boolean;
381
+ writable?: undefined;
382
+ optional?: undefined;
383
+ pda?: undefined;
384
+ } | {
385
+ name: string;
386
+ writable?: undefined;
387
+ docs?: undefined;
388
+ signer?: undefined;
389
+ optional?: undefined;
390
+ pda?: undefined;
391
+ } | {
392
+ docs: string[];
393
+ name: string;
394
+ optional: boolean;
395
+ pda: {
396
+ seeds: ({
397
+ kind: string;
398
+ value: number[];
399
+ path?: undefined;
400
+ account?: undefined;
401
+ } | {
402
+ kind: string;
403
+ path: string;
404
+ value?: undefined;
405
+ account?: undefined;
406
+ } | {
407
+ account: string;
408
+ kind: string;
409
+ path: string;
410
+ value?: undefined;
411
+ })[];
412
+ };
413
+ writable: boolean;
414
+ signer?: undefined;
415
+ })[];
416
+ args: {
417
+ name: string;
418
+ type: string;
419
+ }[];
420
+ discriminator: number[];
421
+ docs: string[];
422
+ name: string;
423
+ } | {
424
+ accounts: ({
425
+ name: string;
426
+ writable: boolean;
427
+ docs?: undefined;
428
+ signer?: undefined;
429
+ optional?: undefined;
430
+ pda?: undefined;
431
+ } | {
432
+ docs: string[];
433
+ name: string;
434
+ writable: boolean;
435
+ signer?: undefined;
436
+ optional?: undefined;
437
+ pda?: undefined;
438
+ } | {
439
+ name: string;
440
+ signer: boolean;
441
+ writable?: undefined;
442
+ docs?: undefined;
443
+ optional?: undefined;
444
+ pda?: undefined;
445
+ } | {
446
+ name: string;
447
+ writable?: undefined;
448
+ docs?: undefined;
449
+ signer?: undefined;
450
+ optional?: undefined;
451
+ pda?: undefined;
452
+ } | {
453
+ docs: string[];
454
+ name: string;
455
+ optional: boolean;
456
+ pda: {
457
+ seeds: ({
458
+ kind: string;
459
+ value: number[];
460
+ path?: undefined;
461
+ account?: undefined;
462
+ } | {
463
+ kind: string;
464
+ path: string;
465
+ value?: undefined;
466
+ account?: undefined;
467
+ } | {
468
+ account: string;
469
+ kind: string;
470
+ path: string;
471
+ value?: undefined;
472
+ })[];
473
+ };
474
+ writable: boolean;
475
+ signer?: undefined;
476
+ })[];
477
+ args: {
478
+ name: string;
479
+ type: string;
480
+ }[];
481
+ discriminator: number[];
482
+ docs: string[];
483
+ name: string;
249
484
  } | {
250
485
  accounts: ({
251
486
  name: string;
252
487
  writable: boolean;
253
488
  pda?: undefined;
489
+ docs?: undefined;
254
490
  signer?: undefined;
491
+ address?: undefined;
255
492
  } | {
493
+ name: string;
494
+ pda: {
495
+ seeds: ({
496
+ kind: string;
497
+ value: number[];
498
+ path?: undefined;
499
+ } | {
500
+ kind: string;
501
+ path: string;
502
+ value?: undefined;
503
+ })[];
504
+ program?: undefined;
505
+ };
506
+ writable: boolean;
507
+ docs?: undefined;
508
+ signer?: undefined;
509
+ address?: undefined;
510
+ } | {
511
+ name: string;
512
+ writable?: undefined;
513
+ pda?: undefined;
514
+ docs?: undefined;
515
+ signer?: undefined;
516
+ address?: undefined;
517
+ } | {
518
+ docs: string[];
256
519
  name: string;
257
520
  pda: {
258
521
  program: {
@@ -264,17 +527,22 @@ export declare const vaultIdl: {
264
527
  path: string;
265
528
  }[];
266
529
  };
267
- writable: boolean;
530
+ writable?: undefined;
268
531
  signer?: undefined;
532
+ address?: undefined;
269
533
  } | {
534
+ docs: string[];
270
535
  name: string;
271
536
  signer: boolean;
272
- writable?: undefined;
537
+ writable: boolean;
273
538
  pda?: undefined;
539
+ address?: undefined;
274
540
  } | {
541
+ address: string;
275
542
  name: string;
276
543
  writable?: undefined;
277
544
  pda?: undefined;
545
+ docs?: undefined;
278
546
  signer?: undefined;
279
547
  })[];
280
548
  args: {
@@ -286,20 +554,67 @@ export declare const vaultIdl: {
286
554
  name: string;
287
555
  } | {
288
556
  accounts: ({
557
+ name: string;
558
+ writable: boolean;
559
+ pda?: undefined;
560
+ docs?: undefined;
561
+ signer?: undefined;
562
+ } | {
289
563
  name: string;
290
564
  pda: {
291
- seeds: {
565
+ seeds: ({
292
566
  kind: string;
293
567
  value: number[];
294
- }[];
568
+ path?: undefined;
569
+ account?: undefined;
570
+ } | {
571
+ kind: string;
572
+ path: string;
573
+ value?: undefined;
574
+ account?: undefined;
575
+ } | {
576
+ account: string;
577
+ kind: string;
578
+ path: string;
579
+ value?: undefined;
580
+ })[];
581
+ program?: undefined;
295
582
  };
296
583
  writable: boolean;
584
+ docs?: undefined;
297
585
  signer?: undefined;
298
586
  } | {
299
587
  name: string;
300
- signer: boolean;
588
+ writable?: undefined;
301
589
  pda?: undefined;
590
+ docs?: undefined;
591
+ signer?: undefined;
592
+ } | {
593
+ docs: string[];
594
+ name: string;
595
+ pda: {
596
+ program: {
597
+ kind: string;
598
+ value: number[];
599
+ };
600
+ seeds: ({
601
+ account: string;
602
+ kind: string;
603
+ path: string;
604
+ } | {
605
+ kind: string;
606
+ path: string;
607
+ account?: undefined;
608
+ })[];
609
+ };
610
+ writable?: undefined;
611
+ signer?: undefined;
612
+ } | {
613
+ name: string;
614
+ signer: boolean;
302
615
  writable?: undefined;
616
+ pda?: undefined;
617
+ docs?: undefined;
303
618
  })[];
304
619
  args: {
305
620
  name: string;
@@ -435,5 +750,17 @@ export declare const vaultIdl: {
435
750
  repr?: undefined;
436
751
  serialization?: undefined;
437
752
  docs?: undefined;
753
+ } | {
754
+ docs: string[];
755
+ name: string;
756
+ type: {
757
+ fields: {
758
+ name: string;
759
+ type: string;
760
+ }[];
761
+ kind: string;
762
+ };
763
+ repr?: undefined;
764
+ serialization?: undefined;
438
765
  })[];
439
766
  };