@usesigil/kit 0.15.0 → 0.16.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 (229) hide show
  1. package/dist/agent-bootstrap.d.ts +118 -0
  2. package/dist/agent-bootstrap.d.ts.map +1 -0
  3. package/dist/agent-bootstrap.js +211 -0
  4. package/dist/agent-bootstrap.js.map +1 -0
  5. package/dist/agent-errors.d.ts +3 -3
  6. package/dist/agent-errors.d.ts.map +1 -1
  7. package/dist/agent-errors.js +227 -142
  8. package/dist/agent-errors.js.map +1 -1
  9. package/dist/build-unsigned.d.ts +152 -0
  10. package/dist/build-unsigned.d.ts.map +1 -0
  11. package/dist/build-unsigned.js +152 -0
  12. package/dist/build-unsigned.js.map +1 -0
  13. package/dist/constraints/index.d.ts +23 -0
  14. package/dist/constraints/index.d.ts.map +1 -0
  15. package/dist/constraints/index.js +24 -0
  16. package/dist/constraints/index.js.map +1 -0
  17. package/dist/create-vault.d.ts +10 -1
  18. package/dist/create-vault.d.ts.map +1 -1
  19. package/dist/create-vault.js +10 -2
  20. package/dist/create-vault.js.map +1 -1
  21. package/dist/dashboard/constraint-builders.d.ts +82 -0
  22. package/dist/dashboard/constraint-builders.d.ts.map +1 -0
  23. package/dist/dashboard/constraint-builders.js +204 -0
  24. package/dist/dashboard/constraint-builders.js.map +1 -0
  25. package/dist/dashboard/errors.d.ts +37 -0
  26. package/dist/dashboard/errors.d.ts.map +1 -1
  27. package/dist/dashboard/errors.js +76 -0
  28. package/dist/dashboard/errors.js.map +1 -1
  29. package/dist/dashboard/from-json.d.ts.map +1 -1
  30. package/dist/dashboard/from-json.js +1 -2
  31. package/dist/dashboard/from-json.js.map +1 -1
  32. package/dist/dashboard/index.d.ts +29 -3
  33. package/dist/dashboard/index.d.ts.map +1 -1
  34. package/dist/dashboard/index.js +36 -1
  35. package/dist/dashboard/index.js.map +1 -1
  36. package/dist/dashboard/mutations.d.ts +60 -1
  37. package/dist/dashboard/mutations.d.ts.map +1 -1
  38. package/dist/dashboard/mutations.js +127 -20
  39. package/dist/dashboard/mutations.js.map +1 -1
  40. package/dist/dashboard/post-assertion-validation.d.ts +88 -0
  41. package/dist/dashboard/post-assertion-validation.d.ts.map +1 -0
  42. package/dist/dashboard/post-assertion-validation.js +191 -0
  43. package/dist/dashboard/post-assertion-validation.js.map +1 -0
  44. package/dist/dashboard/reads.d.ts +93 -1
  45. package/dist/dashboard/reads.d.ts.map +1 -1
  46. package/dist/dashboard/reads.js +238 -9
  47. package/dist/dashboard/reads.js.map +1 -1
  48. package/dist/dashboard/types.d.ts +147 -11
  49. package/dist/dashboard/types.d.ts.map +1 -1
  50. package/dist/errors/codes.js +1 -1
  51. package/dist/events.d.ts.map +1 -1
  52. package/dist/events.js +2 -1
  53. package/dist/events.js.map +1 -1
  54. package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts +12 -0
  55. package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts.map +1 -1
  56. package/dist/generated/accounts/pendingAgentPermissionsUpdate.js +3 -1
  57. package/dist/generated/accounts/pendingAgentPermissionsUpdate.js.map +1 -1
  58. package/dist/generated/accounts/pendingCloseConstraints.d.ts +12 -0
  59. package/dist/generated/accounts/pendingCloseConstraints.d.ts.map +1 -1
  60. package/dist/generated/accounts/pendingCloseConstraints.js +4 -2
  61. package/dist/generated/accounts/pendingCloseConstraints.js.map +1 -1
  62. package/dist/generated/accounts/pendingConstraintsUpdate.d.ts +14 -0
  63. package/dist/generated/accounts/pendingConstraintsUpdate.d.ts.map +1 -1
  64. package/dist/generated/accounts/pendingConstraintsUpdate.js +4 -2
  65. package/dist/generated/accounts/pendingConstraintsUpdate.js.map +1 -1
  66. package/dist/generated/accounts/pendingPolicyUpdate.d.ts +24 -4
  67. package/dist/generated/accounts/pendingPolicyUpdate.d.ts.map +1 -1
  68. package/dist/generated/accounts/pendingPolicyUpdate.js +6 -4
  69. package/dist/generated/accounts/pendingPolicyUpdate.js.map +1 -1
  70. package/dist/generated/accounts/policyConfig.d.ts +28 -10
  71. package/dist/generated/accounts/policyConfig.d.ts.map +1 -1
  72. package/dist/generated/accounts/policyConfig.js +4 -4
  73. package/dist/generated/accounts/policyConfig.js.map +1 -1
  74. package/dist/generated/accounts/sessionAuthority.d.ts +18 -4
  75. package/dist/generated/accounts/sessionAuthority.d.ts.map +1 -1
  76. package/dist/generated/accounts/sessionAuthority.js +3 -3
  77. package/dist/generated/accounts/sessionAuthority.js.map +1 -1
  78. package/dist/generated/errors/sigil.d.ts +95 -81
  79. package/dist/generated/errors/sigil.d.ts.map +1 -1
  80. package/dist/generated/errors/sigil.js +107 -86
  81. package/dist/generated/errors/sigil.js.map +1 -1
  82. package/dist/generated/event-discriminators.d.ts.map +1 -1
  83. package/dist/generated/event-discriminators.js +2 -1
  84. package/dist/generated/event-discriminators.js.map +1 -1
  85. package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts +67 -0
  86. package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts.map +1 -0
  87. package/dist/generated/instructions/cleanupOrphanConstraintsPda.js +120 -0
  88. package/dist/generated/instructions/cleanupOrphanConstraintsPda.js.map +1 -0
  89. package/dist/generated/instructions/freezeVault.d.ts +8 -5
  90. package/dist/generated/instructions/freezeVault.d.ts.map +1 -1
  91. package/dist/generated/instructions/freezeVault.js +14 -3
  92. package/dist/generated/instructions/freezeVault.js.map +1 -1
  93. package/dist/generated/instructions/index.d.ts +1 -0
  94. package/dist/generated/instructions/index.d.ts.map +1 -1
  95. package/dist/generated/instructions/index.js +1 -0
  96. package/dist/generated/instructions/index.js.map +1 -1
  97. package/dist/generated/instructions/initializeVault.d.ts +0 -4
  98. package/dist/generated/instructions/initializeVault.d.ts.map +1 -1
  99. package/dist/generated/instructions/initializeVault.js +0 -2
  100. package/dist/generated/instructions/initializeVault.js.map +1 -1
  101. package/dist/generated/instructions/queuePolicyUpdate.d.ts +8 -8
  102. package/dist/generated/instructions/queuePolicyUpdate.d.ts.map +1 -1
  103. package/dist/generated/instructions/queuePolicyUpdate.js +4 -4
  104. package/dist/generated/instructions/queuePolicyUpdate.js.map +1 -1
  105. package/dist/generated/programs/sigil.d.ts +29 -25
  106. package/dist/generated/programs/sigil.d.ts.map +1 -1
  107. package/dist/generated/programs/sigil.js +37 -25
  108. package/dist/generated/programs/sigil.js.map +1 -1
  109. package/dist/generated/types/accountConstraint.d.ts +16 -1
  110. package/dist/generated/types/accountConstraint.d.ts.map +1 -1
  111. package/dist/generated/types/accountConstraint.js +2 -0
  112. package/dist/generated/types/accountConstraint.js.map +1 -1
  113. package/dist/generated/types/accountConstraintZC.d.ts +7 -0
  114. package/dist/generated/types/accountConstraintZC.d.ts.map +1 -1
  115. package/dist/generated/types/accountConstraintZC.js +4 -2
  116. package/dist/generated/types/accountConstraintZC.js.map +1 -1
  117. package/dist/generated/types/constraintEntry.d.ts +0 -4
  118. package/dist/generated/types/constraintEntry.d.ts.map +1 -1
  119. package/dist/generated/types/constraintEntry.js +1 -3
  120. package/dist/generated/types/constraintEntry.js.map +1 -1
  121. package/dist/generated/types/constraintEntryZC.d.ts +17 -12
  122. package/dist/generated/types/constraintEntryZC.d.ts.map +1 -1
  123. package/dist/generated/types/constraintEntryZC.js +2 -2
  124. package/dist/generated/types/constraintEntryZC.js.map +1 -1
  125. package/dist/generated/types/index.d.ts +1 -0
  126. package/dist/generated/types/index.d.ts.map +1 -1
  127. package/dist/generated/types/index.js +1 -0
  128. package/dist/generated/types/index.js.map +1 -1
  129. package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts +22 -0
  130. package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts.map +1 -0
  131. package/dist/generated/types/orphanConstraintsPdaCleaned.js +26 -0
  132. package/dist/generated/types/orphanConstraintsPdaCleaned.js.map +1 -0
  133. package/dist/generated/types/vaultFrozen.d.ts +12 -0
  134. package/dist/generated/types/vaultFrozen.d.ts.map +1 -1
  135. package/dist/generated/types/vaultFrozen.js +3 -1
  136. package/dist/generated/types/vaultFrozen.js.map +1 -1
  137. package/dist/index.d.ts +11 -1
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +22 -1
  140. package/dist/index.js.map +1 -1
  141. package/dist/inscribe.d.ts +0 -4
  142. package/dist/inscribe.d.ts.map +1 -1
  143. package/dist/inscribe.js +0 -1
  144. package/dist/inscribe.js.map +1 -1
  145. package/dist/kit-adapter.d.ts +1 -1
  146. package/dist/kit-adapter.d.ts.map +1 -1
  147. package/dist/kit-adapter.js +1 -1
  148. package/dist/kit-adapter.js.map +1 -1
  149. package/dist/logger.d.ts +48 -0
  150. package/dist/logger.d.ts.map +1 -1
  151. package/dist/logger.js +36 -0
  152. package/dist/logger.js.map +1 -1
  153. package/dist/owner-transaction.d.ts +8 -0
  154. package/dist/owner-transaction.d.ts.map +1 -1
  155. package/dist/owner-transaction.js +1 -0
  156. package/dist/owner-transaction.js.map +1 -1
  157. package/dist/post-assertions/cross-field-lte.d.ts +134 -0
  158. package/dist/post-assertions/cross-field-lte.d.ts.map +1 -0
  159. package/dist/post-assertions/cross-field-lte.js +129 -0
  160. package/dist/post-assertions/cross-field-lte.js.map +1 -0
  161. package/dist/post-assertions/index.d.ts +28 -0
  162. package/dist/post-assertions/index.d.ts.map +1 -0
  163. package/dist/post-assertions/index.js +28 -0
  164. package/dist/post-assertions/index.js.map +1 -0
  165. package/dist/post-assertions/presets/flash-trade.d.ts +139 -0
  166. package/dist/post-assertions/presets/flash-trade.d.ts.map +1 -0
  167. package/dist/post-assertions/presets/flash-trade.js +154 -0
  168. package/dist/post-assertions/presets/flash-trade.js.map +1 -0
  169. package/dist/presets.d.ts +1 -7
  170. package/dist/presets.d.ts.map +1 -1
  171. package/dist/presets.js +0 -5
  172. package/dist/presets.js.map +1 -1
  173. package/dist/preview-create-vault.d.ts +280 -0
  174. package/dist/preview-create-vault.d.ts.map +1 -0
  175. package/dist/preview-create-vault.js +477 -0
  176. package/dist/preview-create-vault.js.map +1 -0
  177. package/dist/protocol-registry/annotations/drift.json +7 -0
  178. package/dist/protocol-registry/annotations/flash-trade.json +7 -0
  179. package/dist/protocol-registry/annotations/jupiter-borrow.json +7 -0
  180. package/dist/protocol-registry/annotations/jupiter-earn.json +7 -0
  181. package/dist/protocol-registry/annotations/jupiter-lend.json +7 -0
  182. package/dist/protocol-registry/annotations/jupiter.json +7 -0
  183. package/dist/protocol-registry/annotations/kamino.json +7 -0
  184. package/dist/protocol-registry/index.d.ts +45 -0
  185. package/dist/protocol-registry/index.d.ts.map +1 -0
  186. package/dist/protocol-registry/index.js +76 -0
  187. package/dist/protocol-registry/index.js.map +1 -0
  188. package/dist/protocol-tier.d.ts +157 -0
  189. package/dist/protocol-tier.d.ts.map +1 -0
  190. package/dist/protocol-tier.js +104 -0
  191. package/dist/protocol-tier.js.map +1 -0
  192. package/dist/seal.d.ts.map +1 -1
  193. package/dist/seal.js +26 -2
  194. package/dist/seal.js.map +1 -1
  195. package/dist/sigil.d.ts +0 -4
  196. package/dist/sigil.d.ts.map +1 -1
  197. package/dist/simulation.d.ts.map +1 -1
  198. package/dist/simulation.js +72 -91
  199. package/dist/simulation.js.map +1 -1
  200. package/dist/testing/devnet.d.ts.map +1 -1
  201. package/dist/testing/devnet.js +0 -1
  202. package/dist/testing/devnet.js.map +1 -1
  203. package/dist/testing/errors/expect.d.ts +137 -0
  204. package/dist/testing/errors/expect.d.ts.map +1 -0
  205. package/dist/testing/errors/expect.js +372 -0
  206. package/dist/testing/errors/expect.js.map +1 -0
  207. package/dist/testing/errors/index.d.ts +3 -0
  208. package/dist/testing/errors/index.d.ts.map +1 -0
  209. package/dist/testing/errors/index.js +8 -0
  210. package/dist/testing/errors/index.js.map +1 -0
  211. package/dist/testing/errors/names.generated.d.ts +188 -0
  212. package/dist/testing/errors/names.generated.d.ts.map +1 -0
  213. package/dist/testing/errors/names.generated.js +183 -0
  214. package/dist/testing/errors/names.generated.js.map +1 -0
  215. package/dist/testing/index.d.ts +1 -0
  216. package/dist/testing/index.d.ts.map +1 -1
  217. package/dist/testing/index.js +8 -0
  218. package/dist/testing/index.js.map +1 -1
  219. package/dist/testing/mock-rpc.d.ts +8 -0
  220. package/dist/testing/mock-rpc.d.ts.map +1 -1
  221. package/dist/testing/mock-rpc.js +14 -0
  222. package/dist/testing/mock-rpc.js.map +1 -1
  223. package/dist/testing/mock-state.js +2 -2
  224. package/dist/testing/mock-state.js.map +1 -1
  225. package/package.json +15 -3
  226. package/dist/integrations/protocol-handler.d.ts +0 -59
  227. package/dist/integrations/protocol-handler.d.ts.map +0 -1
  228. package/dist/integrations/protocol-handler.js +0 -9
  229. package/dist/integrations/protocol-handler.js.map +0 -1
@@ -0,0 +1,477 @@
1
+ /**
2
+ * `@usesigil/kit/previewCreateVault`.
3
+ *
4
+ * Builds a `CreateVaultPreview` that the dashboard split-screen `/onboard`
5
+ * page renders BEFORE the user signs. Wraps the existing `createVault()`
6
+ * + `buildOwnerTransaction()` primitives — does not reinvent PDA derivation,
7
+ * compute-budget construction, or transaction compilation.
8
+ *
9
+ * ## Algorithm
10
+ *
11
+ * 1. **Validate** the config at the API edge. Negative bigints throw
12
+ * `RangeError`; on-chain hard limits (`MIN_TIMELOCK_DURATION`,
13
+ * `MAX_DEVELOPER_FEE_RATE`, `MAX_ALLOWED_PROTOCOLS`,
14
+ * `MAX_ALLOWED_DESTINATIONS`) are mirrored as early throws so the FE
15
+ * surfaces "your config will be rejected" before signing.
16
+ * `validateNetwork()` propagates as-is.
17
+ * 2. **Derive 4 PDAs.** `vault` first (it's the seed for the others),
18
+ * then `policy` / `tracker` / `agent_spend_overlay` in parallel.
19
+ * 3. **Fetch rent** for each PDA size in parallel via
20
+ * `getMinimumBalanceForRentExemption(size)`. The 4 sizes are pinned to
21
+ * the on-chain `<account>::SIZE` constants — drift between Rust and TS
22
+ * is regression-tested.
23
+ * 4. **Build instructions** via `createVault()` (which validates
24
+ * aggregate caps and rejects owner==agent).
25
+ * 5. **Compile transaction** via `buildOwnerTransaction()` with
26
+ * `CU_VAULT_CREATION` (400_000) and the caller's optional priority fee.
27
+ * 6. **Compute totalCostUsd** via BigInt-safe math with explicit
28
+ * mul-before-divide:
29
+ * `(rentLamports + feeLamports) * solPriceUsd / 1_000_000_000n`.
30
+ * Units: lamports × (6-decimal-USD per SOL) ÷ (lamports per SOL)
31
+ * = 6-decimal USD.
32
+ * 7. **Build warnings** for soft-signal issues (cap=0, cap>$1M, allowlist
33
+ * with no protocols, max-tx > daily-cap). Sorted by `code` ascending so
34
+ * React keys don't thrash on re-type.
35
+ * 8. **Freeze + return.** The returned object is `Object.freeze`d; the
36
+ * `pdaList` and `warnings` arrays are also frozen.
37
+ *
38
+ * ## What this does NOT do
39
+ *
40
+ * - **Submit any transaction.** Preview is read-only RPC: rent + blockhash
41
+ * + ALT lookup. No `sendTransaction`, no `simulateTransaction`.
42
+ * - **Sign.** Internally constructs `createNoopSigner(address)` instances
43
+ * so `buildOwnerTransaction` can compile a fee-payer-bound message.
44
+ * Wallet adapter signs the returned `unsignedTxBytes` later.
45
+ * - **Fetch SOL price.** Kit has no oracle. Caller passes
46
+ * `solPriceUsd: bigint` (6-decimal USD per SOL). Without it, the kit
47
+ * would have to either pin a default (silent lie) or take an RPC
48
+ * dependency on a price feed (scope creep).
49
+ */
50
+ import { createNoopSigner } from "./kit-adapter.js";
51
+ import { getVaultPDA, getPolicyPDA, getTrackerPDA, getAgentOverlayPDA, } from "./resolve-accounts.js";
52
+ import { createVault } from "./create-vault.js";
53
+ import { buildOwnerTransaction } from "./owner-transaction.js";
54
+ import { CU_VAULT_CREATION } from "./priority-fees.js";
55
+ import { validateNetwork, SYSTEM_PROGRAM_ADDRESS, MAX_DEVELOPER_FEE_RATE, MAX_ALLOWED_PROTOCOLS, U64_MAX, } from "./types.js";
56
+ import { SigilSdkDomainError } from "./errors/sdk.js";
57
+ import { SIGIL_ERROR__SDK__INVALID_PARAMS } from "./errors/codes.js";
58
+ // ─── On-chain account sizes (verified against programs/sigil/src/state/*.rs) ─
59
+ /**
60
+ * `AgentVault::SIZE` from `programs/sigil/src/state/vault.rs`.
61
+ * Layout: 8 disc + 32 owner + 8 vault_id + 4 vec_prefix + (49 * 10) agents
62
+ * + 32 fee_destination + 1 status + 1 bump + 8 created_at
63
+ * + 8 total_transactions + 8 total_volume + 1 active_escrow_count
64
+ * + 8 total_fees_collected + 8 total_deposited_usd + 8 total_withdrawn_usd
65
+ * + 8 total_failed_transactions + 1 active_sessions = 634.
66
+ */
67
+ const AGENT_VAULT_SIZE = 634;
68
+ /**
69
+ * `PolicyConfig::SIZE` from `programs/sigil/src/state/policy.rs`.
70
+ * Layout: 8 disc + 32 vault + 8 daily_cap + 8 max_tx + 1 protocol_mode
71
+ * + (4 + 32*10) protocols + 2 dev_fee + 2 slippage + 8 timelock
72
+ * + (4 + 32*10) allowed_destinations + 1 has_constraints
73
+ * + 1 has_pending_policy + 1 has_protocol_caps
74
+ * + (4 + 8*10) protocol_caps + 8 session_expiry + 1 bump
75
+ * + 8 policy_version + 1 has_post_assertions = 822.
76
+ */
77
+ const POLICY_CONFIG_SIZE = 822;
78
+ /**
79
+ * `SpendTracker::SIZE` from `programs/sigil/src/state/tracker.rs`.
80
+ * Layout: 8 disc + 32 vault + (16 * 144) buckets + (48 * 10) protocol_counters
81
+ * + 8 last_write_epoch + 1 bump + 7 padding = 2840.
82
+ */
83
+ const SPEND_TRACKER_SIZE = 2_840;
84
+ /**
85
+ * `AgentSpendOverlay::SIZE` from `programs/sigil/src/state/agent_spend_overlay.rs`.
86
+ * Layout: 8 disc + 32 vault + (232 * 10) entries + 1 bump + 7 padding
87
+ * + (8 * 10) lifetime_spend + (8 * 10) lifetime_tx_count = 2528.
88
+ */
89
+ const AGENT_SPEND_OVERLAY_SIZE = 2_528;
90
+ /** Default priority fee when caller doesn't supply one. Conservative. */
91
+ const DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS = 10_000;
92
+ /** `1_000_000_000` lamports per SOL. */
93
+ const LAMPORTS_PER_SOL = 1000000000n;
94
+ /** Microlamports per lamport. */
95
+ const MICRO_LAMPORTS_PER_LAMPORT = 1000000n;
96
+ /** Heuristic: dailyCapUsd above $1,000,000 (6-decimal base units) → warn. */
97
+ const DAILY_CAP_HIGH_THRESHOLD = 1000000000000n;
98
+ /**
99
+ * Upper bound for any 6-decimal USD bigint at the public API edge.
100
+ * Re-exported from `types.U64_MAX` (`18_446_744_073_709_551_615n`). The
101
+ * on-chain program stores these as `u64`; values above overflow there. We
102
+ * reject at the kit edge rather than ship a tx the program will reject.
103
+ */
104
+ const MAX_USD_BASE_UNITS = U64_MAX;
105
+ /** Mirror of `MIN_TIMELOCK_DURATION` (1800) from `state/mod.rs`. */
106
+ const MIN_TIMELOCK_DURATION_SECONDS = 1800n;
107
+ /** Mirror of `MAX_ALLOWED_DESTINATIONS` (10) from `state/mod.rs`. */
108
+ const MAX_ALLOWED_DESTINATIONS_COUNT = 10;
109
+ // ─── Implementation ──────────────────────────────────────────────────────────
110
+ /**
111
+ * Generate a `CreateVaultPreview` for the dashboard split-screen `/onboard`
112
+ * flow. See module JSDoc for the algorithm and design rationale.
113
+ *
114
+ * @throws {RangeError} If any bigint config field is negative or any count
115
+ * exceeds its on-chain maximum, or if `timelockDuration < 1800n`,
116
+ * or if `developerFeeRate > 500`.
117
+ * @throws {SigilSdkDomainError} If `validateNetwork(config.network)` fails,
118
+ * if `getMinimumBalanceForRentExemption` returns 0n / undefined,
119
+ * or if `createVault()` rejects the config (e.g., owner == agent,
120
+ * spendingLimit > dailyCap aggregate).
121
+ */
122
+ export async function previewCreateVault(config) {
123
+ // 1. Validate config at the API edge (fail fast, descriptive errors).
124
+ validateConfig(config);
125
+ // Normalize "mainnet-beta" → "mainnet" for createVault / buildOwnerTransaction
126
+ // (which use the short literal type) while still accepting either form.
127
+ const buildNetwork = toBuildNetwork(config.network);
128
+ // 2 + 3. Derive PDAs and fetch rent concurrently.
129
+ //
130
+ // Rent depends on size only, not address — fire all 4 rent RPC fetches
131
+ // in parallel with PDA derivation. PDA derivation is pure CPU (sha256
132
+ // in a 0..255 bump search loop) so overlapping it with network latency
133
+ // removes the serial CPU step from the wall-clock path on hot
134
+ // dashboard re-types.
135
+ //
136
+ // `vault` is the seed for the other three PDAs, so we wrap the
137
+ // dependent chain (`getVaultPDA` → policy/tracker/overlay) in a single
138
+ // async IIFE and `Promise.all` it alongside the rent fetches. Wrapping
139
+ // (rather than `await`-ing the vault PDA up front) keeps the rent
140
+ // promises in a Promise.all from the moment they're created, so a
141
+ // rejecting RPC never produces a transient
142
+ // `PromiseRejectionHandledWarning`.
143
+ const vaultChain = (async () => {
144
+ const [vAddr, vBump] = await getVaultPDA(config.owner, config.vaultId);
145
+ const [policy, tracker, overlay] = await Promise.all([
146
+ getPolicyPDA(vAddr),
147
+ getTrackerPDA(vAddr),
148
+ getAgentOverlayPDA(vAddr, 0),
149
+ ]);
150
+ return { vAddr, vBump, policy, tracker, overlay };
151
+ })();
152
+ const [{ vAddr, vBump, policy, tracker, overlay }, vaultRent, policyRent, trackerRent, overlayRent,] = await Promise.all([
153
+ vaultChain,
154
+ fetchRentForSize(config.rpc, AGENT_VAULT_SIZE, "AgentVault"),
155
+ fetchRentForSize(config.rpc, POLICY_CONFIG_SIZE, "PolicyConfig"),
156
+ fetchRentForSize(config.rpc, SPEND_TRACKER_SIZE, "SpendTracker"),
157
+ fetchRentForSize(config.rpc, AGENT_SPEND_OVERLAY_SIZE, "AgentSpendOverlay"),
158
+ ]);
159
+ const vaultAddress = vAddr;
160
+ const vaultBump = vBump;
161
+ const [policyAddress, policyBump] = policy;
162
+ const [trackerAddress, trackerBump] = tracker;
163
+ const [overlayAddress, overlayBump] = overlay;
164
+ // 4. Build the pdaList tuple in deterministic on-chain `init` order.
165
+ const pdaList = Object.freeze([
166
+ makePdaInfo("AgentVault", vaultAddress, vaultBump, AGENT_VAULT_SIZE, vaultRent),
167
+ makePdaInfo("PolicyConfig", policyAddress, policyBump, POLICY_CONFIG_SIZE, policyRent),
168
+ makePdaInfo("SpendTracker", trackerAddress, trackerBump, SPEND_TRACKER_SIZE, trackerRent),
169
+ makePdaInfo("AgentSpendOverlay", overlayAddress, overlayBump, AGENT_SPEND_OVERLAY_SIZE, overlayRent),
170
+ ]);
171
+ const rentLamports = vaultRent + policyRent + trackerRent + overlayRent;
172
+ // 5. Build the create-vault instructions. `createVault` validates aggregate
173
+ // caps and owner≠agent for us; we propagate its throws.
174
+ const ownerSigner = createNoopSigner(config.owner);
175
+ const agentSigner = createNoopSigner(config.agentAddress);
176
+ const createResult = await createVault({
177
+ rpc: config.rpc,
178
+ network: buildNetwork,
179
+ owner: ownerSigner,
180
+ agent: agentSigner,
181
+ permissions: config.capabilityTier !== undefined
182
+ ? config.capabilityTier
183
+ : undefined,
184
+ spendingLimitUsd: config.spendingLimitUsd,
185
+ dailySpendingCapUsd: config.dailyCapUsd,
186
+ maxTransactionSizeUsd: config.maxTxSizeUsd,
187
+ feeDestination: config.feeDestination,
188
+ developerFeeRate: config.developerFeeRate,
189
+ protocols: [...config.protocols],
190
+ protocolMode: config.protocolMode,
191
+ maxSlippageBps: config.maxSlippageBps,
192
+ timelockDuration: Number(config.timelockDuration),
193
+ allowedDestinations: [...config.allowedDestinations],
194
+ vaultId: config.vaultId,
195
+ protocolCaps: config.protocolCaps.length > 0 ? [...config.protocolCaps] : undefined,
196
+ });
197
+ // 6. Compile the unsigned transaction.
198
+ const computeUnits = config.computeUnits ?? CU_VAULT_CREATION;
199
+ const priorityFeeMicroLamports = config.priorityFeeMicroLamports ?? DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS;
200
+ const ownerTx = await buildOwnerTransaction({
201
+ rpc: config.rpc,
202
+ owner: ownerSigner,
203
+ instructions: [
204
+ createResult.initializeVaultIx,
205
+ createResult.registerAgentIx,
206
+ ],
207
+ network: buildNetwork,
208
+ computeUnits,
209
+ priorityFeeMicroLamports,
210
+ ...(config.blockhash !== undefined ? { blockhash: config.blockhash } : {}),
211
+ ...(config.addressLookupTables !== undefined
212
+ ? { addressLookupTables: config.addressLookupTables }
213
+ : {}),
214
+ });
215
+ // 7. feeLamports: microLamports per CU * CU / 1_000_000. Mul-before-divide
216
+ // in BigInt to avoid number/bigint mixing.
217
+ const feeLamports = (BigInt(priorityFeeMicroLamports) * BigInt(computeUnits)) /
218
+ MICRO_LAMPORTS_PER_LAMPORT;
219
+ // 8. totalCostUsd: mul-before-divide preserves precision down to 1 unit of
220
+ // 6-decimal USD.
221
+ const totalCostUsd = ((rentLamports + feeLamports) * config.solPriceUsd) / LAMPORTS_PER_SOL;
222
+ const unsignedTxBytes = base64ToUint8Array(ownerTx.wireBase64);
223
+ // 9. lastValidBlockHeight is sourced from the same blockhash baked into the
224
+ // wire bytes — never re-read the cache (TTL refresh would race the bytes
225
+ // the user is about to sign).
226
+ const blockhash = ownerTx.blockhash;
227
+ // 10. Warnings (sorted by code) → undefined when empty so the FE skips
228
+ // rendering the panel.
229
+ const warningsRaw = buildWarnings(config);
230
+ const warnings = warningsRaw.length > 0
231
+ ? Object.freeze(warningsRaw)
232
+ : undefined;
233
+ const preview = {
234
+ pdaList,
235
+ rentLamports,
236
+ computeUnits,
237
+ feeLamports,
238
+ totalCostUsd,
239
+ vaultAddress,
240
+ unsignedTxBytes,
241
+ txSizeBytes: ownerTx.txSizeBytes,
242
+ lastValidBlockHeight: blockhash.lastValidBlockHeight,
243
+ ...(warnings !== undefined ? { warnings } : {}),
244
+ };
245
+ return Object.freeze(preview);
246
+ }
247
+ // ─── Private helpers ─────────────────────────────────────────────────────────
248
+ /**
249
+ * Build one frozen `VaultPdaInfo` entry for `pdaList`. The literal `name`
250
+ * type is preserved so each tuple slot narrows to its specific account class
251
+ * (e.g. `pdaList[0].name === "AgentVault"`).
252
+ */
253
+ function makePdaInfo(name, address, bump, sizeBytes, rentLamports) {
254
+ return Object.freeze({
255
+ name,
256
+ address,
257
+ bump,
258
+ sizeBytes,
259
+ rentLamports,
260
+ });
261
+ }
262
+ /**
263
+ * Validate config at the API edge. Throws `RangeError` for value-out-of-range
264
+ * (matches the `composeAgentBootstrap` convention) and lets `validateNetwork`
265
+ * propagate its `SigilSdkDomainError`.
266
+ */
267
+ function validateConfig(config) {
268
+ // Network — propagates SigilSdkDomainError if invalid.
269
+ validateNetwork(config.network);
270
+ // Negative bigints. `solPriceUsd` rejects 0n too — kit has no oracle, and
271
+ // a price of 0 silently produces `totalCostUsd === 0n` which the FE
272
+ // would render as "Free". Fail loud.
273
+ if (config.vaultId < 0n) {
274
+ throw new RangeError(`vaultId must be >= 0; received ${config.vaultId}`);
275
+ }
276
+ if (config.dailyCapUsd < 0n) {
277
+ throw new RangeError(`dailyCapUsd must be >= 0; received ${config.dailyCapUsd}`);
278
+ }
279
+ if (config.maxTxSizeUsd < 0n) {
280
+ throw new RangeError(`maxTxSizeUsd must be >= 0; received ${config.maxTxSizeUsd}`);
281
+ }
282
+ if (config.spendingLimitUsd < 0n) {
283
+ throw new RangeError(`spendingLimitUsd must be >= 0; received ${config.spendingLimitUsd}`);
284
+ }
285
+ if (config.solPriceUsd <= 0n) {
286
+ throw new RangeError(`solPriceUsd must be > 0n; received ${config.solPriceUsd}. ` +
287
+ `The kit has no oracle — caller must supply a fresh, positive price.`);
288
+ }
289
+ if (config.timelockDuration < 0n) {
290
+ throw new RangeError(`timelockDuration must be >= 0; received ${config.timelockDuration}`);
291
+ }
292
+ // Upper bounds — `u64::MAX` overflow guards. The on-chain program stores
293
+ // these as `u64`; values above `(1 << 64) - 1` overflow there. Reject at
294
+ // the kit edge.
295
+ if (config.dailyCapUsd > MAX_USD_BASE_UNITS) {
296
+ throw new RangeError(`dailyCapUsd must be <= u64::MAX (${MAX_USD_BASE_UNITS}); received ${config.dailyCapUsd}`);
297
+ }
298
+ if (config.maxTxSizeUsd > MAX_USD_BASE_UNITS) {
299
+ throw new RangeError(`maxTxSizeUsd must be <= u64::MAX; received ${config.maxTxSizeUsd}`);
300
+ }
301
+ if (config.spendingLimitUsd > MAX_USD_BASE_UNITS) {
302
+ throw new RangeError(`spendingLimitUsd must be <= u64::MAX; received ${config.spendingLimitUsd}`);
303
+ }
304
+ if (config.solPriceUsd > MAX_USD_BASE_UNITS) {
305
+ throw new RangeError(`solPriceUsd must be <= u64::MAX; received ${config.solPriceUsd}`);
306
+ }
307
+ // `timelockDuration` is a bigint at the API but createVault takes a
308
+ // number. Number can lose precision above 2^53. Reject silently-lossy
309
+ // values rather than ship a tx with a different timelock than the user
310
+ // typed.
311
+ if (config.timelockDuration > BigInt(Number.MAX_SAFE_INTEGER)) {
312
+ throw new RangeError(`timelockDuration must be <= Number.MAX_SAFE_INTEGER (${Number.MAX_SAFE_INTEGER}); ` +
313
+ `received ${config.timelockDuration}. Larger values lose precision in the bigint→number cast.`);
314
+ }
315
+ // On-chain hard limits — mirror as early throws.
316
+ if (config.timelockDuration < MIN_TIMELOCK_DURATION_SECONDS) {
317
+ throw new RangeError(`timelockDuration must be >= ${MIN_TIMELOCK_DURATION_SECONDS}n (MIN_TIMELOCK_DURATION); ` +
318
+ `the on-chain program rejects shorter timelocks. Received ${config.timelockDuration}.`);
319
+ }
320
+ if (!Number.isInteger(config.developerFeeRate) ||
321
+ config.developerFeeRate < 0) {
322
+ throw new RangeError(`developerFeeRate must be a non-negative integer; received ${config.developerFeeRate}`);
323
+ }
324
+ if (config.developerFeeRate > MAX_DEVELOPER_FEE_RATE) {
325
+ throw new RangeError(`developerFeeRate must be <= ${MAX_DEVELOPER_FEE_RATE} BPS (MAX_DEVELOPER_FEE_RATE); ` +
326
+ `received ${config.developerFeeRate}`);
327
+ }
328
+ if (!Number.isInteger(config.maxSlippageBps) || config.maxSlippageBps < 0) {
329
+ throw new RangeError(`maxSlippageBps must be a non-negative integer; received ${config.maxSlippageBps}`);
330
+ }
331
+ if (config.protocols.length > MAX_ALLOWED_PROTOCOLS) {
332
+ throw new RangeError(`protocols.length must be <= ${MAX_ALLOWED_PROTOCOLS} (MAX_ALLOWED_PROTOCOLS); ` +
333
+ `received ${config.protocols.length}`);
334
+ }
335
+ if (config.allowedDestinations.length > MAX_ALLOWED_DESTINATIONS_COUNT) {
336
+ throw new RangeError(`allowedDestinations.length must be <= ${MAX_ALLOWED_DESTINATIONS_COUNT} (MAX_ALLOWED_DESTINATIONS); ` +
337
+ `received ${config.allowedDestinations.length}`);
338
+ }
339
+ // protocol_caps when non-empty must align with allowlist mode and length.
340
+ if (config.protocolCaps.length > 0) {
341
+ if (config.protocolMode !== 1) {
342
+ throw new RangeError(`protocolCaps requires protocolMode === 1 (ALLOWLIST); received ${config.protocolMode}`);
343
+ }
344
+ if (config.protocolCaps.length !== config.protocols.length) {
345
+ throw new RangeError(`protocolCaps.length (${config.protocolCaps.length}) must equal protocols.length (${config.protocols.length})`);
346
+ }
347
+ for (const cap of config.protocolCaps) {
348
+ if (cap < 0n) {
349
+ throw new RangeError(`each protocolCaps entry must be >= 0; received ${cap}`);
350
+ }
351
+ if (cap > MAX_USD_BASE_UNITS) {
352
+ throw new RangeError(`each protocolCaps entry must be <= u64::MAX; received ${cap}`);
353
+ }
354
+ }
355
+ }
356
+ // `feeDestination` cannot be the system program (Pubkey::default = all-1s
357
+ // base58); the on-chain program rejects it at line 91-93 of
358
+ // initialize_vault.rs with `InvalidFeeDestination`.
359
+ if (config.feeDestination === SYSTEM_PROGRAM_ADDRESS) {
360
+ throw new RangeError(`feeDestination must not be the system program ` +
361
+ `(${SYSTEM_PROGRAM_ADDRESS}); the on-chain program rejects it as ` +
362
+ `InvalidFeeDestination`);
363
+ }
364
+ // Optional numeric overrides — must be non-negative integers. Negatives
365
+ // and NaN both produce silent drift (negative fee in preview but skipped
366
+ // on-chain; non-integer throws deep in BigInt(...)).
367
+ if (config.priorityFeeMicroLamports !== undefined) {
368
+ if (!Number.isInteger(config.priorityFeeMicroLamports) ||
369
+ config.priorityFeeMicroLamports < 0) {
370
+ throw new RangeError(`priorityFeeMicroLamports must be a non-negative integer; received ${config.priorityFeeMicroLamports}`);
371
+ }
372
+ }
373
+ if (config.computeUnits !== undefined) {
374
+ if (!Number.isInteger(config.computeUnits) || config.computeUnits <= 0) {
375
+ throw new RangeError(`computeUnits must be a positive integer; received ${config.computeUnits}`);
376
+ }
377
+ }
378
+ }
379
+ /**
380
+ * Resolve a `NetworkInput` to the `"devnet" | "mainnet"` shape that
381
+ * `createVault` and `buildOwnerTransaction` accept. `validateNetwork` has
382
+ * already gated the input by the time this runs.
383
+ */
384
+ function toBuildNetwork(network) {
385
+ // After validateNetwork, network is one of "devnet", "mainnet", "mainnet-beta".
386
+ // createVault accepts only the short literal; "mainnet-beta" → "mainnet".
387
+ return network === "devnet" ? "devnet" : "mainnet";
388
+ }
389
+ /**
390
+ * Wrap `getMinimumBalanceForRentExemption` with explicit defensive checks.
391
+ * If the RPC returns `0n` or anything non-bigint, we surface a typed
392
+ * `SigilSdkDomainError` instead of producing a preview that lies about
393
+ * cost. Caller errors propagate with cause attached.
394
+ */
395
+ async function fetchRentForSize(rpc, size, pdaName) {
396
+ const rent = await rpc.getMinimumBalanceForRentExemption(BigInt(size)).send();
397
+ if (typeof rent !== "bigint") {
398
+ throw new SigilSdkDomainError(SIGIL_ERROR__SDK__INVALID_PARAMS, `getMinimumBalanceForRentExemption returned non-bigint for ${pdaName} (size=${size})`, { context: { field: pdaName, received: typeof rent } });
399
+ }
400
+ // Reject 0n AND negatives. Rent must always be positive — a "free" PDA
401
+ // doesn't exist on Solana, and a negative rent is non-physical and would
402
+ // produce a negative `totalCostUsd` (FE displays "you'll be paid to
403
+ // create this vault"). Both indicate a misbehaving RPC; surface as a
404
+ // typed throw so the caller can retry / switch RPC.
405
+ if (rent <= 0n) {
406
+ throw new SigilSdkDomainError(SIGIL_ERROR__SDK__INVALID_PARAMS, `getMinimumBalanceForRentExemption returned ${rent} for ${pdaName} (size=${size}); ` +
407
+ `expected a positive lamport value. RPC may be misconfigured or returning stale data.`, { context: { field: pdaName, received: rent } });
408
+ }
409
+ return rent;
410
+ }
411
+ /**
412
+ * Build the warnings array. Sorted by `code` ascending so the FE's React
413
+ * keys are stable across re-types (no banner flicker). Returns an empty
414
+ * array when nothing fires; the caller converts to `undefined` for the
415
+ * preview shape.
416
+ */
417
+ function buildWarnings(config) {
418
+ const warnings = [];
419
+ if (config.dailyCapUsd === 0n) {
420
+ warnings.push({
421
+ code: "daily_cap_zero",
422
+ severity: "info",
423
+ message: "Daily spending cap is 0. The vault will accept deposits but the " +
424
+ "agent cannot execute any spending action until the cap is raised.",
425
+ field: "dailyCapUsd",
426
+ });
427
+ }
428
+ if (config.dailyCapUsd > DAILY_CAP_HIGH_THRESHOLD) {
429
+ warnings.push({
430
+ code: "daily_cap_unusually_high",
431
+ severity: "warning",
432
+ message: "Daily spending cap exceeds $1,000,000 — confirm this matches the " +
433
+ "intended risk tolerance.",
434
+ field: "dailyCapUsd",
435
+ suggestedValue: DAILY_CAP_HIGH_THRESHOLD,
436
+ });
437
+ }
438
+ if (config.protocolMode === 1 && config.protocols.length === 0) {
439
+ warnings.push({
440
+ code: "no_protocols_approved",
441
+ severity: "warning",
442
+ message: "Protocol mode is ALLOWLIST but no protocols are listed; the agent " +
443
+ "cannot reach any DeFi protocol with this policy.",
444
+ field: "protocols",
445
+ });
446
+ }
447
+ if (config.maxTxSizeUsd > config.dailyCapUsd) {
448
+ warnings.push({
449
+ code: "max_tx_exceeds_daily_cap",
450
+ severity: "warning",
451
+ message: "Max transaction size exceeds daily cap; a single transaction can " +
452
+ "consume the entire 24h budget.",
453
+ field: "maxTxSizeUsd",
454
+ suggestedValue: config.dailyCapUsd,
455
+ });
456
+ }
457
+ // Sort by code ascending so the FE's React keys stay stable.
458
+ warnings.sort((a, b) => (a.code < b.code ? -1 : a.code > b.code ? 1 : 0));
459
+ // Freeze each warning so callers can't mutate after return. The cast
460
+ // preserves the discriminated-union type Object.freeze would erase to
461
+ // `Readonly<PreviewWarning>`.
462
+ return warnings.map((w) => Object.freeze(w));
463
+ }
464
+ /**
465
+ * Decode a base64 string to `Uint8Array`. Uses `atob` (built-in in browser
466
+ * and Node ≥ 16) so the kit stays Node-only-free. Validates input shape
467
+ * defensively — `atob` will throw `InvalidCharacterError` on non-base64.
468
+ */
469
+ function base64ToUint8Array(b64) {
470
+ const binary = atob(b64);
471
+ const bytes = new Uint8Array(binary.length);
472
+ for (let i = 0; i < binary.length; i++) {
473
+ bytes[i] = binary.charCodeAt(i);
474
+ }
475
+ return bytes;
476
+ }
477
+ //# sourceMappingURL=preview-create-vault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-create-vault.js","sourceRoot":"","sources":["../src/preview-create-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AASH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,OAAO,GAKR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAErE,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC,yEAAyE;AACzE,MAAM,mCAAmC,GAAG,MAAM,CAAC;AAEnD,wCAAwC;AACxC,MAAM,gBAAgB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AE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,qEAAqE;IACrE,sEAAsE;IACtE,8BAA8B;IAC9B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAmB,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,GAAW;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH",
3
+ "name": "Drift",
4
+ "verified": true,
5
+ "category": "perps",
6
+ "notes": "Drift Protocol perpetuals + spot. Not instruction-count-limited. Default CU: 800,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "FLASH6Lo6h3iasJKWDs2F8TkW2UKf3s15C8PMGuVfgBn",
3
+ "name": "Flash Trade",
4
+ "verified": true,
5
+ "category": "perps",
6
+ "notes": "Flash Trade perpetuals DEX. Instruction-count-limited in the Sigil on-chain program. Default CU: 800,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "jupr81YtYssSyPt8jbnGuiWon5f6x9TcDEFxYe3Bdzi",
3
+ "name": "Jupiter Borrow",
4
+ "verified": true,
5
+ "category": "borrow",
6
+ "notes": "Jupiter Borrow protocol. Instruction-count-limited in the Sigil on-chain program. Default CU: 400,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "jup3YeL8QhtSx1e253b2FDvsMNC87fDrgQZivbrndc9",
3
+ "name": "Jupiter Earn",
4
+ "verified": true,
5
+ "category": "yield",
6
+ "notes": "Jupiter Earn protocol. Instruction-count-limited in the Sigil on-chain program. Default CU: 400,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "JLend2fEim9xUFcaHsyGePEoBzFLvkjMi3MnPcSuCdu",
3
+ "name": "Jupiter Lend",
4
+ "verified": true,
5
+ "category": "lending",
6
+ "notes": "Jupiter Lend protocol. Instruction-count-limited in the Sigil on-chain program. Default CU: 400,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
3
+ "name": "Jupiter",
4
+ "verified": true,
5
+ "category": "swap-aggregator",
6
+ "notes": "Jupiter V6 aggregator. Instruction-count-limited in the Sigil on-chain program. Default CU: 600,000."
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "programId": "KLend2g3cP87ber8CzRaqeECGwNvLFM9acPVcRkRHvM",
3
+ "name": "Kamino",
4
+ "verified": true,
5
+ "category": "lending",
6
+ "notes": "Kamino Finance lending (klend). Not instruction-count-limited. Default CU: 400,000."
7
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Single Verified-tier annotation shape. Byte-identical to the dashboard's
3
+ * pre-migration interface at `sigil-dashboard/src/lib/protocol-registry/index.ts`
4
+ * so consumers switching from local imports to `@usesigil/kit` see zero
5
+ * behavioral drift.
6
+ */
7
+ export interface ProtocolAnnotation {
8
+ /** Canonical base58 programId. Hand-verified against the deployed program. */
9
+ readonly programId: string;
10
+ /** Human-readable display name, e.g. "Jupiter V6". */
11
+ readonly name: string;
12
+ /** Always `true` for annotations shipped in this registry. */
13
+ readonly verified: boolean;
14
+ /** Bucket for UI grouping, e.g. "swap-aggregator", "perps", "lending". */
15
+ readonly category: string;
16
+ /** Optional free-form context (CU budget, known quirks, caveats). */
17
+ readonly notes?: string;
18
+ }
19
+ /**
20
+ * All registered annotations in display order (most-used first). Consumers
21
+ * should NOT mutate — the array is `readonly` at the type level; the
22
+ * underlying data is also `as const` below to guard against runtime edits.
23
+ */
24
+ export declare const PROTOCOL_ANNOTATIONS: readonly ProtocolAnnotation[];
25
+ /**
26
+ * The set of programIds in the Verified tier. Computed once at module
27
+ * load. `VERIFIED_PROGRAMS.has(programId)` is the canonical synchronous
28
+ * check for "does Sigil have hand-curated metadata for this program."
29
+ *
30
+ * Consumers (dashboard `/api/resolve-protocol`, mobile tier UI, MCP)
31
+ * should query this set — NOT filter PROTOCOL_ANNOTATIONS linearly on the
32
+ * hot path. Use `lookupProtocolAnnotation()` when metadata is also needed.
33
+ */
34
+ export declare const VERIFIED_PROGRAMS: ReadonlySet<string>;
35
+ /**
36
+ * Look up a protocol annotation by programId. Returns `null` if the
37
+ * programId is NOT in the Verified registry.
38
+ *
39
+ * Currently an O(n) linear search across 7 entries — fast enough that a
40
+ * `Map` lookup would be premature optimization. If the registry grows
41
+ * past ~50 entries, swap to a `Map<string, ProtocolAnnotation>` built
42
+ * once at module load.
43
+ */
44
+ export declare function lookupProtocolAnnotation(programId: string): ProtocolAnnotation | null;
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol-registry/index.ts"],"names":[],"mappings":"AAwCA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAQpD,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAEjD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAChB,kBAAkB,GAAG,IAAI,CAE3B"}