@occa/sdk 0.4.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.
@@ -0,0 +1,442 @@
1
+ import { PublicKey, TransactionInstruction } from '@solana/web3.js';
2
+ import { OperationsKind } from './constants.js';
3
+
4
+ declare const INSTRUCTION_DISCRIMINATOR: {
5
+ readonly createCompany: Buffer<ArrayBuffer>;
6
+ readonly updateCompanyMetadata: Buffer<ArrayBuffer>;
7
+ readonly updateCompanyStatus: Buffer<ArrayBuffer>;
8
+ readonly registerAgentIdentity: Buffer<ArrayBuffer>;
9
+ readonly updateAgentIdentityMetadata: Buffer<ArrayBuffer>;
10
+ readonly createDeployment: Buffer<ArrayBuffer>;
11
+ readonly updateDeploymentMetadata: Buffer<ArrayBuffer>;
12
+ readonly updateDeploymentStatus: Buffer<ArrayBuffer>;
13
+ readonly retireDeployment: Buffer<ArrayBuffer>;
14
+ readonly setReceivingAddress: Buffer<ArrayBuffer>;
15
+ readonly commitDailyAnchor: Buffer<ArrayBuffer>;
16
+ };
17
+ interface CreateCompanyParams {
18
+ /** User wallet — signer + bound into the PDA seed. Sole authority for
19
+ * every state-changing ix on this company. Immutable. */
20
+ owner: PublicKey;
21
+ /** Rent payer. Typically the operator hot wallet (sponsored UX),
22
+ * but may equal `owner`. */
23
+ payer: PublicKey;
24
+ nonce: number;
25
+ name: string;
26
+ /** BCP-47 locale tag (e.g. "en", "id"). Empty string allowed. */
27
+ locale: string;
28
+ /** Off-chain metadata pointer (IPFS / Arweave / HTTPS). */
29
+ metadataUri: string;
30
+ /** SHA-256 of canonical metadata JSON (32 bytes). Pass `Buffer.alloc(32)`
31
+ * if metadata not yet finalized. */
32
+ metadataHash: Uint8Array | Buffer;
33
+ programId?: PublicKey;
34
+ }
35
+ declare function buildCreateCompanyInstruction(params: CreateCompanyParams): {
36
+ instruction: TransactionInstruction;
37
+ companyPda: PublicKey;
38
+ treasuryPda: PublicKey;
39
+ policyPda: PublicKey;
40
+ bump: number;
41
+ };
42
+ interface UpdateCompanyMetadataParams {
43
+ companyPda: PublicKey;
44
+ /** User wallet — must equal `company.owner`. */
45
+ owner: PublicKey;
46
+ name: string;
47
+ locale: string;
48
+ metadataUri: string;
49
+ metadataHash: Uint8Array | Buffer;
50
+ programId?: PublicKey;
51
+ }
52
+ declare function buildUpdateCompanyMetadataInstruction(params: UpdateCompanyMetadataParams): {
53
+ instruction: TransactionInstruction;
54
+ };
55
+ interface UpdateCompanyStatusParams {
56
+ companyPda: PublicKey;
57
+ owner: PublicKey;
58
+ /** 0 = Active, 1 = Paused. See `COMPANY_STATUS`. */
59
+ newStatus: number;
60
+ programId?: PublicKey;
61
+ }
62
+ declare function buildUpdateCompanyStatusInstruction(params: UpdateCompanyStatusParams): {
63
+ instruction: TransactionInstruction;
64
+ };
65
+ interface RegisterAgentIdentityParams {
66
+ /** Stable identity key — typically a fresh keypair pubkey held by the
67
+ * user wallet (NOT the user wallet itself). Baked into the PDA seed. */
68
+ agentPubkey: PublicKey;
69
+ /** Owning user wallet. Immutable — there is no transfer instruction. */
70
+ owner: PublicKey;
71
+ /** Rent payer (typically operator hot wallet). */
72
+ payer: PublicKey;
73
+ name: string;
74
+ metadataUri: string;
75
+ metadataHash: Uint8Array | Buffer;
76
+ programId?: PublicKey;
77
+ }
78
+ declare function buildRegisterAgentIdentityInstruction(params: RegisterAgentIdentityParams): {
79
+ instruction: TransactionInstruction;
80
+ identityPda: PublicKey;
81
+ bump: number;
82
+ };
83
+ interface UpdateAgentIdentityMetadataParams {
84
+ identityPda: PublicKey;
85
+ /** User wallet — must equal `identity.owner`. */
86
+ owner: PublicKey;
87
+ name: string;
88
+ metadataUri: string;
89
+ metadataHash: Uint8Array | Buffer;
90
+ programId?: PublicKey;
91
+ }
92
+ declare function buildUpdateAgentIdentityMetadataInstruction(params: UpdateAgentIdentityMetadataParams): {
93
+ instruction: TransactionInstruction;
94
+ };
95
+ interface CreateDeploymentParams {
96
+ companyPda: PublicKey;
97
+ identityPda: PublicKey;
98
+ /** User wallet — must equal both `company.owner` and `identity.owner`. */
99
+ owner: PublicKey;
100
+ payer: PublicKey;
101
+ /** Per-company u32 counter. Caller picks the next free index. */
102
+ deploymentIndex: number;
103
+ /** Capability persona (e.g. "ceo", "sdr"). Bounded by MAX_ROLE_LEN. */
104
+ role: string;
105
+ /** Reporting parent index within this company (null = top-level). */
106
+ parentDeploymentIndex?: number | null;
107
+ /** Pinned adapter (`PublicKey.default` = unspecified). */
108
+ adapterId: PublicKey;
109
+ metadataUri: string;
110
+ metadataHash: Uint8Array | Buffer;
111
+ programId?: PublicKey;
112
+ }
113
+ declare function buildCreateDeploymentInstruction(params: CreateDeploymentParams): {
114
+ instruction: TransactionInstruction;
115
+ deploymentPda: PublicKey;
116
+ bump: number;
117
+ };
118
+ interface UpdateDeploymentMetadataParams {
119
+ deploymentPda: PublicKey;
120
+ owner: PublicKey;
121
+ role: string;
122
+ metadataUri: string;
123
+ metadataHash: Uint8Array | Buffer;
124
+ programId?: PublicKey;
125
+ }
126
+ declare function buildUpdateDeploymentMetadataInstruction(params: UpdateDeploymentMetadataParams): {
127
+ instruction: TransactionInstruction;
128
+ };
129
+ interface UpdateDeploymentStatusParams {
130
+ deploymentPda: PublicKey;
131
+ owner: PublicKey;
132
+ /** 0 = Active, 1 = Paused. Use `retire_deployment` for terminal. */
133
+ newStatus: number;
134
+ programId?: PublicKey;
135
+ }
136
+ declare function buildUpdateDeploymentStatusInstruction(params: UpdateDeploymentStatusParams): {
137
+ instruction: TransactionInstruction;
138
+ };
139
+ interface RetireDeploymentParams {
140
+ deploymentPda: PublicKey;
141
+ owner: PublicKey;
142
+ programId?: PublicKey;
143
+ }
144
+ declare function buildRetireDeploymentInstruction(params: RetireDeploymentParams): {
145
+ instruction: TransactionInstruction;
146
+ };
147
+ interface SetReceivingAddressParams {
148
+ deploymentPda: PublicKey;
149
+ /** User wallet — must equal `deployment.owner`. */
150
+ owner: PublicKey;
151
+ /** New receiving address (passive destination wallet for funds disbursed
152
+ * *to* this agent). Pass `PublicKey.default` to clear. NEVER a signer
153
+ * on chain — receiving address never authorizes any on-chain action. */
154
+ newReceivingAddress: PublicKey;
155
+ programId?: PublicKey;
156
+ }
157
+ declare function buildSetReceivingAddressInstruction(params: SetReceivingAddressParams): {
158
+ instruction: TransactionInstruction;
159
+ };
160
+ declare const TREASURY_INSTRUCTION_DISCRIMINATOR: {
161
+ readonly setPolicy: Buffer<ArrayBuffer>;
162
+ readonly disburseDiscretionary: Buffer<ArrayBuffer>;
163
+ readonly initProtocolFeeAccount: Buffer<ArrayBuffer>;
164
+ readonly registerCompanyOperations: Buffer<ArrayBuffer>;
165
+ readonly updateOperationsCapability: Buffer<ArrayBuffer>;
166
+ readonly revokeOperations: Buffer<ArrayBuffer>;
167
+ readonly closeOperations: Buffer<ArrayBuffer>;
168
+ readonly disburseRoutine: Buffer<ArrayBuffer>;
169
+ readonly disbursePrivileged: Buffer<ArrayBuffer>;
170
+ };
171
+ /** A per-asset budget / balance entry. `SOL_PSEUDO_MINT` for SOL. */
172
+ interface AssetBudget {
173
+ mint: PublicKey;
174
+ amount: bigint;
175
+ }
176
+ interface SetPolicyParams {
177
+ companyPda: PublicKey;
178
+ treasuryPda: PublicKey;
179
+ policyPda: PublicKey;
180
+ /** Must equal `company.owner` — the sole Privileged-class signer. */
181
+ controllingAuthority: PublicKey;
182
+ /** Per-month routine-class cap. Omit to leave unchanged. */
183
+ routineBudgetPerMonth?: AssetBudget[];
184
+ /** Per-month discretionary-class cap. Omit to leave unchanged. */
185
+ discretionaryBudgetPerMonth?: AssetBudget[];
186
+ /** SOL threshold above which Privileged-class disbursement (= owner +
187
+ * secondary signer) is required. Omit to leave unchanged. Pass
188
+ * `u64::MAX` (-1n cast) to disable (= secondary signer never required). */
189
+ privilegedThresholdLamports?: bigint;
190
+ /** Per-asset threshold variant of the above. Omit to leave unchanged. */
191
+ privilegedThresholdPerToken?: AssetBudget[];
192
+ /** Second signer required for Privileged-class disbursements.
193
+ * Distinguishes three cases:
194
+ * • `undefined` — leave unchanged
195
+ * • `null` — clear (no secondary signer; Privileged disburse
196
+ * then has no valid signer combination, effectively
197
+ * disabling it)
198
+ * • `PublicKey` — set to this pubkey */
199
+ secondarySigner?: PublicKey | null;
200
+ /** Agent Operating Fee in basis points. Omit to leave unchanged. */
201
+ agentOperatingFeeBps?: number;
202
+ /** Accepted-asset allow-list. Omit to leave unchanged. */
203
+ acceptedAssets?: PublicKey[];
204
+ programId?: PublicKey;
205
+ }
206
+ /**
207
+ * Build a `set_policy` instruction. Privileged-class — signed by the
208
+ * controlling authority (= company owner).
209
+ *
210
+ * Every parameter is `Option<T>`: omitted = "leave unchanged". For
211
+ * `secondarySigner`, JS `null` maps to the "clear" case (outer Some,
212
+ * inner None) — see the field doc above.
213
+ */
214
+ declare function buildSetPolicyInstruction(params: SetPolicyParams): {
215
+ instruction: TransactionInstruction;
216
+ };
217
+ interface DisburseDiscretionaryParams {
218
+ companyPda: PublicKey;
219
+ treasuryPda: PublicKey;
220
+ policyPda: PublicKey;
221
+ /** Must equal `company.owner`. */
222
+ controllingAuthority: PublicKey;
223
+ /** Deployment PDA of the agent being paid — chain matches `destination`
224
+ * against its `receiving_address`. */
225
+ deploymentPda: PublicKey;
226
+ /** The agent's receiving address — destination of the funds. */
227
+ destination: PublicKey;
228
+ /** Amount in lamports (SOL only — Phase 1). */
229
+ amountLamports: bigint;
230
+ /** Defaults to `SOL_PSEUDO_MINT`. */
231
+ mint?: PublicKey;
232
+ programId?: PublicKey;
233
+ }
234
+ /**
235
+ * Build a `disburse_discretionary` instruction — Discretionary-class
236
+ * payout to an agent's receiving address, signed by the controlling
237
+ * authority. The 3% Agent Operating Fee is deducted on-chain and routed
238
+ * to the ProtocolFeeAccount.
239
+ */
240
+ declare function buildDisburseDiscretionaryInstruction(params: DisburseDiscretionaryParams): {
241
+ instruction: TransactionInstruction;
242
+ };
243
+ interface InitProtocolFeeAccountParams {
244
+ /** Upgrade authority of the Treasury program. Pays + signs. */
245
+ authority: PublicKey;
246
+ /** Long-lived withdrawal authority for accumulated fees (e.g. governance
247
+ * multisig). Immutable after init. */
248
+ governance: PublicKey;
249
+ /** The Treasury program's own pubkey — passed as an account. Defaults to
250
+ * `TREASURY_PROGRAM_ID`. */
251
+ program?: PublicKey;
252
+ /** The program's ProgramData PDA (BPFLoaderUpgradeable). Anchor uses this
253
+ * to verify the signer is the upgrade authority. Caller derives:
254
+ * `PublicKey.findProgramAddressSync([program.toBuffer()],
255
+ * BPF_LOADER_UPGRADEABLE_PROGRAM_ID)`. */
256
+ programData: PublicKey;
257
+ programId?: PublicKey;
258
+ }
259
+ /**
260
+ * Build an `init_protocol_fee_account` instruction. Singleton — call once
261
+ * per program deployment by the upgrade authority. Subsequent calls fail
262
+ * (PDA already initialized).
263
+ */
264
+ declare function buildInitProtocolFeeAccountInstruction(params: InitProtocolFeeAccountParams): {
265
+ instruction: TransactionInstruction;
266
+ };
267
+ interface RegisterCompanyOperationsParams {
268
+ companyPda: PublicKey;
269
+ /** Must equal `company.owner` — Privileged-class signer. */
270
+ controllingAuthority: PublicKey;
271
+ /** Disbursement or Anchor — determines which OperationsAccount PDA is
272
+ * created. Order matters: enum byte is part of the seed. */
273
+ kind: OperationsKind;
274
+ /** Hot wallet that will sign downstream operations ix (e.g.
275
+ * `disburse_routine` for Disbursement, `commit_daily_anchor` for Anchor). */
276
+ signer: PublicKey;
277
+ /** Each entry = an 8-byte Anchor instruction discriminator the signer
278
+ * is allowed to invoke. Empty = no actions permitted (account exists
279
+ * but is essentially disabled). */
280
+ actionWhitelist: (Uint8Array | Buffer)[];
281
+ /** How many disburse calls this signer may make per calendar month. */
282
+ rateLimitPerPeriod: number;
283
+ /** Unix seconds. `0` = never expires. */
284
+ expiryUnix: bigint;
285
+ /** Rent payer — typically the operator hot wallet. */
286
+ payer: PublicKey;
287
+ programId?: PublicKey;
288
+ }
289
+ /**
290
+ * Build a `register_company_operations` instruction — creates an
291
+ * OperationsAccount binding a hot wallet to a capability set. Privileged-
292
+ * class (signed by `controlling_authority` = company owner).
293
+ */
294
+ declare function buildRegisterCompanyOperationsInstruction(params: RegisterCompanyOperationsParams): {
295
+ instruction: TransactionInstruction;
296
+ };
297
+ interface UpdateOperationsCapabilityParams {
298
+ companyPda: PublicKey;
299
+ controllingAuthority: PublicKey;
300
+ /** Which OperationsAccount (by kind) to update. */
301
+ kind: OperationsKind;
302
+ /** Each field is independently optional — omitted = "leave unchanged". */
303
+ actionWhitelist?: (Uint8Array | Buffer)[];
304
+ rateLimitPerPeriod?: number;
305
+ /** Pass `0n` to set "no expiry" sentinel; `undefined` to leave unchanged. */
306
+ expiryUnix?: bigint;
307
+ programId?: PublicKey;
308
+ }
309
+ /**
310
+ * Build an `update_operations_capability` instruction — Privileged-class
311
+ * mutation of an existing OperationsAccount's whitelist / rate limit /
312
+ * expiry. Each param is Option-encoded.
313
+ */
314
+ declare function buildUpdateOperationsCapabilityInstruction(params: UpdateOperationsCapabilityParams): {
315
+ instruction: TransactionInstruction;
316
+ };
317
+ interface RevokeOperationsParams {
318
+ companyPda: PublicKey;
319
+ controllingAuthority: PublicKey;
320
+ kind: OperationsKind;
321
+ programId?: PublicKey;
322
+ }
323
+ /**
324
+ * Build a `revoke_operations` instruction — flips the `revoked` flag on
325
+ * the OperationsAccount. Subsequent ix attempts by the signer fail. The
326
+ * account stays open (rent retained); call `close_operations` to reclaim.
327
+ */
328
+ declare function buildRevokeOperationsInstruction(params: RevokeOperationsParams): {
329
+ instruction: TransactionInstruction;
330
+ };
331
+ interface CloseOperationsParams {
332
+ companyPda: PublicKey;
333
+ /** Rent refund destination + signer. */
334
+ controllingAuthority: PublicKey;
335
+ kind: OperationsKind;
336
+ programId?: PublicKey;
337
+ }
338
+ /**
339
+ * Build a `close_operations` instruction — closes the OperationsAccount
340
+ * and refunds rent to `controlling_authority`. Permanent: a new
341
+ * register call would create a fresh account at the same PDA.
342
+ */
343
+ declare function buildCloseOperationsInstruction(params: CloseOperationsParams): {
344
+ instruction: TransactionInstruction;
345
+ };
346
+ interface DisburseRoutineParams {
347
+ companyPda: PublicKey;
348
+ treasuryPda: PublicKey;
349
+ policyPda: PublicKey;
350
+ /** Disbursement-kind OperationsAccount for this company. */
351
+ operationsPda: PublicKey;
352
+ /** Hot wallet matching `operations.signer` — the only signer. NOT the
353
+ * controlling authority. */
354
+ operationsSigner: PublicKey;
355
+ /** Deployment PDA of the agent being paid. */
356
+ deploymentPda: PublicKey;
357
+ /** Agent's receiving_address. Chain verifies match against deployment. */
358
+ destination: PublicKey;
359
+ amountLamports: bigint;
360
+ /** Defaults to `SOL_PSEUDO_MINT`. */
361
+ mint?: PublicKey;
362
+ programId?: PublicKey;
363
+ }
364
+ /**
365
+ * Build a `disburse_routine` instruction — Routine-class batched payout.
366
+ * Signed by the Disbursement Wallet (operations_signer), NOT the company
367
+ * owner. Whitelist + rate limit + expiry enforced on-chain by the
368
+ * OperationsAccount. The 3% Agent Operating Fee is deducted and routed
369
+ * to ProtocolFeeAccount.
370
+ */
371
+ declare function buildDisburseRoutineInstruction(params: DisburseRoutineParams): {
372
+ instruction: TransactionInstruction;
373
+ };
374
+ interface DisbursePrivilegedParams {
375
+ companyPda: PublicKey;
376
+ treasuryPda: PublicKey;
377
+ policyPda: PublicKey;
378
+ /** Must equal `company.owner`. */
379
+ controllingAuthority: PublicKey;
380
+ /** Must equal `policy.secondary_signer` (which must be set, i.e. not
381
+ * the default pubkey, for Privileged disbursements to work). */
382
+ secondarySigner: PublicKey;
383
+ /** Deployment of the recipient agent when `isAgentDestination = true`.
384
+ * Still required as a read-only account even for external destinations
385
+ * (chain verifies it belongs to the same company). */
386
+ deploymentPda: PublicKey;
387
+ destination: PublicKey;
388
+ amountLamports: bigint;
389
+ /** Whether the destination is an in-company agent (fee applies) or an
390
+ * external party (no fee). */
391
+ isAgentDestination: boolean;
392
+ mint?: PublicKey;
393
+ programId?: PublicKey;
394
+ }
395
+ /**
396
+ * Build a `disburse_privileged` instruction — over-threshold or
397
+ * externally-destined payout. Requires both the controlling authority
398
+ * (owner) AND a secondary signer. Bypasses normal budget caps; logged
399
+ * in the policy's privileged-spent counter regardless.
400
+ */
401
+ declare function buildDisbursePrivilegedInstruction(params: DisbursePrivilegedParams): {
402
+ instruction: TransactionInstruction;
403
+ };
404
+ interface CommitDailyAnchorParams {
405
+ deploymentPda: PublicKey;
406
+ companyPda: PublicKey;
407
+ /** Anchor Wallet — must equal `operations.signer` (kind=Anchor). */
408
+ anchorSigner: PublicKey;
409
+ /** Anchor-kind OperationsAccount for this company (in TREASURY program,
410
+ * read-only here). Caller derives via `deriveOperationsPda(company,
411
+ * OPERATIONS_KIND.Anchor)`. */
412
+ operationsPda: PublicKey;
413
+ /** Unix seconds aligned to 00:00:00 UTC for the day this anchor covers
414
+ * (multiple of 86_400). Becomes part of the DailyAnchor PDA seed. */
415
+ dayUnix: bigint;
416
+ /** Merkle root over the day's task hashes — 32 bytes. */
417
+ merkleRoot: Uint8Array | Buffer;
418
+ /** Number of leaves in the Merkle tree. Must be > 0. */
419
+ taskCount: number;
420
+ /** Rent payer (typically the operator hot wallet). */
421
+ payer: PublicKey;
422
+ programId?: PublicKey;
423
+ }
424
+ /**
425
+ * Build a `commit_daily_anchor` instruction — Anchor-class single-tx
426
+ * commit of one agent-day's Merkle-rooted task activity. Signed by the
427
+ * Anchor Wallet bound to the company's Anchor-kind OperationsAccount.
428
+ *
429
+ * Caller is responsible for:
430
+ * 1. Hashing each task's content (Blake3) off-chain
431
+ * 2. Building the Merkle tree
432
+ * 3. Passing the root + leaf count here
433
+ *
434
+ * The on-chain handler does NOT verify the Merkle tree itself — chain
435
+ * holds only the commitment; verification happens off-chain against the
436
+ * trace store.
437
+ */
438
+ declare function buildCommitDailyAnchorInstruction(params: CommitDailyAnchorParams): {
439
+ instruction: TransactionInstruction;
440
+ };
441
+
442
+ export { type AssetBudget, type CloseOperationsParams, type CommitDailyAnchorParams, type CreateCompanyParams, type CreateDeploymentParams, type DisburseDiscretionaryParams, type DisbursePrivilegedParams, type DisburseRoutineParams, INSTRUCTION_DISCRIMINATOR, type InitProtocolFeeAccountParams, type RegisterAgentIdentityParams, type RegisterCompanyOperationsParams, type RetireDeploymentParams, type RevokeOperationsParams, type SetPolicyParams, type SetReceivingAddressParams, TREASURY_INSTRUCTION_DISCRIMINATOR, type UpdateAgentIdentityMetadataParams, type UpdateCompanyMetadataParams, type UpdateCompanyStatusParams, type UpdateDeploymentMetadataParams, type UpdateDeploymentStatusParams, type UpdateOperationsCapabilityParams, buildCloseOperationsInstruction, buildCommitDailyAnchorInstruction, buildCreateCompanyInstruction, buildCreateDeploymentInstruction, buildDisburseDiscretionaryInstruction, buildDisbursePrivilegedInstruction, buildDisburseRoutineInstruction, buildInitProtocolFeeAccountInstruction, buildRegisterAgentIdentityInstruction, buildRegisterCompanyOperationsInstruction, buildRetireDeploymentInstruction, buildRevokeOperationsInstruction, buildSetPolicyInstruction, buildSetReceivingAddressInstruction, buildUpdateAgentIdentityMetadataInstruction, buildUpdateCompanyMetadataInstruction, buildUpdateCompanyStatusInstruction, buildUpdateDeploymentMetadataInstruction, buildUpdateDeploymentStatusInstruction, buildUpdateOperationsCapabilityInstruction };
@@ -0,0 +1,51 @@
1
+ import {
2
+ INSTRUCTION_DISCRIMINATOR,
3
+ TREASURY_INSTRUCTION_DISCRIMINATOR,
4
+ buildCloseOperationsInstruction,
5
+ buildCommitDailyAnchorInstruction,
6
+ buildCreateCompanyInstruction,
7
+ buildCreateDeploymentInstruction,
8
+ buildDisburseDiscretionaryInstruction,
9
+ buildDisbursePrivilegedInstruction,
10
+ buildDisburseRoutineInstruction,
11
+ buildInitProtocolFeeAccountInstruction,
12
+ buildRegisterAgentIdentityInstruction,
13
+ buildRegisterCompanyOperationsInstruction,
14
+ buildRetireDeploymentInstruction,
15
+ buildRevokeOperationsInstruction,
16
+ buildSetPolicyInstruction,
17
+ buildSetReceivingAddressInstruction,
18
+ buildUpdateAgentIdentityMetadataInstruction,
19
+ buildUpdateCompanyMetadataInstruction,
20
+ buildUpdateCompanyStatusInstruction,
21
+ buildUpdateDeploymentMetadataInstruction,
22
+ buildUpdateDeploymentStatusInstruction,
23
+ buildUpdateOperationsCapabilityInstruction
24
+ } from "./chunk-N7LNBSDD.js";
25
+ import "./chunk-X6FBCGHU.js";
26
+ import "./chunk-YCSBYRSH.js";
27
+ export {
28
+ INSTRUCTION_DISCRIMINATOR,
29
+ TREASURY_INSTRUCTION_DISCRIMINATOR,
30
+ buildCloseOperationsInstruction,
31
+ buildCommitDailyAnchorInstruction,
32
+ buildCreateCompanyInstruction,
33
+ buildCreateDeploymentInstruction,
34
+ buildDisburseDiscretionaryInstruction,
35
+ buildDisbursePrivilegedInstruction,
36
+ buildDisburseRoutineInstruction,
37
+ buildInitProtocolFeeAccountInstruction,
38
+ buildRegisterAgentIdentityInstruction,
39
+ buildRegisterCompanyOperationsInstruction,
40
+ buildRetireDeploymentInstruction,
41
+ buildRevokeOperationsInstruction,
42
+ buildSetPolicyInstruction,
43
+ buildSetReceivingAddressInstruction,
44
+ buildUpdateAgentIdentityMetadataInstruction,
45
+ buildUpdateCompanyMetadataInstruction,
46
+ buildUpdateCompanyStatusInstruction,
47
+ buildUpdateDeploymentMetadataInstruction,
48
+ buildUpdateDeploymentStatusInstruction,
49
+ buildUpdateOperationsCapabilityInstruction
50
+ };
51
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/pda.cjs ADDED
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/pda.ts
21
+ var pda_exports = {};
22
+ __export(pda_exports, {
23
+ deriveAgentIdentityPda: () => deriveAgentIdentityPda,
24
+ deriveCompanyPda: () => deriveCompanyPda,
25
+ deriveDailyAnchorPda: () => deriveDailyAnchorPda,
26
+ deriveDeploymentPda: () => deriveDeploymentPda,
27
+ deriveOperationsPda: () => deriveOperationsPda,
28
+ derivePolicyPda: () => derivePolicyPda,
29
+ deriveProtocolFeePda: () => deriveProtocolFeePda,
30
+ deriveTreasuryPda: () => deriveTreasuryPda,
31
+ u32LeBytes: () => u32LeBytes
32
+ });
33
+ module.exports = __toCommonJS(pda_exports);
34
+ var import_web32 = require("@solana/web3.js");
35
+
36
+ // src/constants.ts
37
+ var import_web3 = require("@solana/web3.js");
38
+ var REGISTRY_PROGRAM_ID_BASE58 = "occaTHMv5eYG5aZ85jimxTvHkBfsDCvndXC6J2k8kxr";
39
+ var REGISTRY_PROGRAM_ID = new import_web3.PublicKey(REGISTRY_PROGRAM_ID_BASE58);
40
+ var TREASURY_PROGRAM_ID_BASE58 = "occaxyVLnurdjedWCBPrvDCCto8wGYadtTZ3nAmcVzh";
41
+ var TREASURY_PROGRAM_ID = new import_web3.PublicKey(TREASURY_PROGRAM_ID_BASE58);
42
+ var COMPANY_SEED = Buffer.from("company");
43
+ var AGENT_IDENTITY_SEED = Buffer.from("agent_identity");
44
+ var DEPLOYMENT_SEED = Buffer.from("deployment");
45
+ var TREASURY_SEED = Buffer.from("treasury");
46
+ var POLICY_SEED = Buffer.from("policy");
47
+ var PROTOCOL_FEES_SEED = Buffer.from("protocol_fees");
48
+ var OPERATIONS_SEED = Buffer.from("operations");
49
+ var DAILY_ANCHOR_SEED = Buffer.from("daily_anchor");
50
+ var SOL_PSEUDO_MINT = new import_web3.PublicKey(new Uint8Array(32));
51
+ var ACCOUNT_DISCRIMINATOR = {
52
+ AgentIdentity: Buffer.from([11, 149, 31, 27, 186, 76, 241, 72]),
53
+ CompanyAccount: Buffer.from([37, 215, 171, 200, 8, 141, 69, 96]),
54
+ Deployment: Buffer.from([66, 90, 104, 89, 183, 130, 64, 178]),
55
+ DailyAnchorAccount: Buffer.from([218, 106, 107, 94, 194, 48, 111, 254])
56
+ };
57
+ var TREASURY_ACCOUNT_DISCRIMINATOR = {
58
+ TreasuryAccount: Buffer.from([204, 140, 18, 173, 90, 152, 134, 123]),
59
+ PolicyAccount: Buffer.from([218, 201, 183, 164, 156, 127, 81, 175]),
60
+ ProtocolFeeAccount: Buffer.from([5, 171, 24, 9, 150, 135, 135, 201]),
61
+ OperationsAccount: Buffer.from([185, 55, 148, 90, 151, 227, 104, 158])
62
+ };
63
+
64
+ // src/pda.ts
65
+ function u32LeBytes(value) {
66
+ if (!Number.isInteger(value) || value < 0 || value > 4294967295) {
67
+ throw new RangeError(`u32 out of range: ${value}`);
68
+ }
69
+ const buf = Buffer.alloc(4);
70
+ buf.writeUInt32LE(value, 0);
71
+ return buf;
72
+ }
73
+ function deriveCompanyPda(owner, nonce, programId = REGISTRY_PROGRAM_ID) {
74
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
75
+ [COMPANY_SEED, owner.toBuffer(), u32LeBytes(nonce)],
76
+ programId
77
+ );
78
+ return { pda, bump };
79
+ }
80
+ function deriveAgentIdentityPda(agentPubkey, programId = REGISTRY_PROGRAM_ID) {
81
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
82
+ [AGENT_IDENTITY_SEED, agentPubkey.toBuffer()],
83
+ programId
84
+ );
85
+ return { pda, bump };
86
+ }
87
+ function deriveDeploymentPda(companyPda, deploymentIndex, programId = REGISTRY_PROGRAM_ID) {
88
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
89
+ [DEPLOYMENT_SEED, companyPda.toBuffer(), u32LeBytes(deploymentIndex)],
90
+ programId
91
+ );
92
+ return { pda, bump };
93
+ }
94
+ function deriveTreasuryPda(companyPda, programId = TREASURY_PROGRAM_ID) {
95
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
96
+ [TREASURY_SEED, companyPda.toBuffer()],
97
+ programId
98
+ );
99
+ return { pda, bump };
100
+ }
101
+ function derivePolicyPda(companyPda, programId = TREASURY_PROGRAM_ID) {
102
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
103
+ [POLICY_SEED, companyPda.toBuffer()],
104
+ programId
105
+ );
106
+ return { pda, bump };
107
+ }
108
+ function deriveProtocolFeePda(programId = TREASURY_PROGRAM_ID) {
109
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
110
+ [PROTOCOL_FEES_SEED],
111
+ programId
112
+ );
113
+ return { pda, bump };
114
+ }
115
+ function deriveOperationsPda(companyPda, kind, programId = TREASURY_PROGRAM_ID) {
116
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
117
+ [OPERATIONS_SEED, companyPda.toBuffer(), Buffer.from([kind])],
118
+ programId
119
+ );
120
+ return { pda, bump };
121
+ }
122
+ function i64LeBytes(value) {
123
+ const buf = Buffer.alloc(8);
124
+ buf.writeBigInt64LE(value, 0);
125
+ return buf;
126
+ }
127
+ function deriveDailyAnchorPda(deploymentPda, dayUnix, programId = REGISTRY_PROGRAM_ID) {
128
+ const [pda, bump] = import_web32.PublicKey.findProgramAddressSync(
129
+ [DAILY_ANCHOR_SEED, deploymentPda.toBuffer(), i64LeBytes(dayUnix)],
130
+ programId
131
+ );
132
+ return { pda, bump };
133
+ }
134
+ // Annotate the CommonJS export names for ESM import in node:
135
+ 0 && (module.exports = {
136
+ deriveAgentIdentityPda,
137
+ deriveCompanyPda,
138
+ deriveDailyAnchorPda,
139
+ deriveDeploymentPda,
140
+ deriveOperationsPda,
141
+ derivePolicyPda,
142
+ deriveProtocolFeePda,
143
+ deriveTreasuryPda,
144
+ u32LeBytes
145
+ });
146
+ //# sourceMappingURL=pda.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pda.ts","../src/constants.ts"],"sourcesContent":["import { PublicKey } from \"@solana/web3.js\";\nimport {\n AGENT_IDENTITY_SEED,\n COMPANY_SEED,\n DAILY_ANCHOR_SEED,\n DEPLOYMENT_SEED,\n OPERATIONS_SEED,\n POLICY_SEED,\n PROTOCOL_FEES_SEED,\n REGISTRY_PROGRAM_ID,\n TREASURY_PROGRAM_ID,\n TREASURY_SEED,\n type OperationsKind,\n} from \"./constants\";\n\n/**\n * Encode a u32 as little-endian 4 bytes (matches Anchor / Borsh on-chain\n * representation when using a u32 in a PDA seed).\n */\nexport function u32LeBytes(value: number): Buffer {\n if (!Number.isInteger(value) || value < 0 || value > 0xff_ff_ff_ff) {\n throw new RangeError(`u32 out of range: ${value}`);\n }\n const buf = Buffer.alloc(4);\n buf.writeUInt32LE(value, 0);\n return buf;\n}\n\n/**\n * CompanyAccount PDA.\n *\n * seeds = [\"company\", owner, nonce_le_u32]\n *\n * Wallet-bound seed: a wallet's companies can be enumerated directly\n * from chain by probing `(owner, nonce=0..N)`. The owner is also the\n * sole authority for state-changing ix on this account.\n */\nexport function deriveCompanyPda(\n owner: PublicKey,\n nonce: number,\n programId: PublicKey = REGISTRY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [COMPANY_SEED, owner.toBuffer(), u32LeBytes(nonce)],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * AgentIdentity PDA.\n *\n * seeds = [\"agent_identity\", agent_pubkey]\n *\n * `agent_pubkey` is a stable identity key chosen by the caller (typically\n * a fresh keypair generated client-side). Identity is independent of any\n * company — the same identity may be deployed multiple times across the\n * same owner's companies.\n */\nexport function deriveAgentIdentityPda(\n agentPubkey: PublicKey,\n programId: PublicKey = REGISTRY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [AGENT_IDENTITY_SEED, agentPubkey.toBuffer()],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * Deployment PDA.\n *\n * seeds = [\"deployment\", company_pda, deployment_index_le_u32]\n *\n * `deployment_index` is a per-company u32 counter. Maintained by the\n * caller — pick the next free index. Same `agent_identity` may have\n * multiple deployments under the same company (e.g. retired then\n * re-deployed); each deployment gets its own index.\n */\nexport function deriveDeploymentPda(\n companyPda: PublicKey,\n deploymentIndex: number,\n programId: PublicKey = REGISTRY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [DEPLOYMENT_SEED, companyPda.toBuffer(), u32LeBytes(deploymentIndex)],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * TreasuryAccount PDA — owned by Treasury program.\n *\n * seeds = [\"treasury\", company_pda]\n *\n * Initialized atomically with PolicyAccount via Registry's `create_company`\n * CPI to `treasury::init_treasury` (design doc §6).\n */\nexport function deriveTreasuryPda(\n companyPda: PublicKey,\n programId: PublicKey = TREASURY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [TREASURY_SEED, companyPda.toBuffer()],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * PolicyAccount PDA — owned by Treasury program.\n *\n * seeds = [\"policy\", company_pda]\n *\n * Initialized atomically with TreasuryAccount via the same `create_company`\n * CPI flow.\n */\nexport function derivePolicyPda(\n companyPda: PublicKey,\n programId: PublicKey = TREASURY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [POLICY_SEED, companyPda.toBuffer()],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * ProtocolFeeAccount PDA — owned by Treasury program. Singleton: one\n * per program deployment, collects the Agent Operating Fee from every\n * intra-company agent disbursement.\n *\n * seeds = [\"protocol_fees\"]\n */\nexport function deriveProtocolFeePda(\n programId: PublicKey = TREASURY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [PROTOCOL_FEES_SEED],\n programId,\n );\n return { pda, bump };\n}\n\n/**\n * OperationsAccount PDA — owned by Treasury program. One per\n * (company, kind) pair, so Disbursement and Anchor capabilities never\n * share a key.\n *\n * seeds = [\"operations\", company_pda, kind_byte]\n *\n * `kind_byte` is the single-byte discriminator from `OPERATIONS_KIND`\n * (Disbursement=0, Anchor=1). Order MUST NOT change once any account\n * exists.\n */\nexport function deriveOperationsPda(\n companyPda: PublicKey,\n kind: OperationsKind,\n programId: PublicKey = TREASURY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [OPERATIONS_SEED, companyPda.toBuffer(), Buffer.from([kind])],\n programId,\n );\n return { pda, bump };\n}\n\n/** Encode an i64 as little-endian 8 bytes (matches Anchor / Borsh). */\nfunction i64LeBytes(value: bigint): Buffer {\n const buf = Buffer.alloc(8);\n buf.writeBigInt64LE(value, 0);\n return buf;\n}\n\n/**\n * DailyAnchorAccount PDA — owned by Registry program. One per\n * (deployment, UTC day) — captures the Merkle root over that day's\n * task hashes.\n *\n * seeds = [\"daily_anchor\", deployment_pda, day_unix_le_i64]\n *\n * `dayUnix` must be aligned to 00:00:00 UTC (multiple of 86400). The\n * on-chain handler enforces alignment; passing an unaligned value will\n * fail with a constraint error.\n */\nexport function deriveDailyAnchorPda(\n deploymentPda: PublicKey,\n dayUnix: bigint,\n programId: PublicKey = REGISTRY_PROGRAM_ID,\n): { pda: PublicKey; bump: number } {\n const [pda, bump] = PublicKey.findProgramAddressSync(\n [DAILY_ANCHOR_SEED, deploymentPda.toBuffer(), i64LeBytes(dayUnix)],\n programId,\n );\n return { pda, bump };\n}\n","import { PublicKey } from \"@solana/web3.js\";\n\n// Registry program ID. The vanity-grinded program keypair lives at\n// `occa-programs/programs/registry/registry-keypair.json` (gitignored,\n// sibling repo). Public key is committed here so clients (server +\n// web) can derive PDAs without loading the keypair.\n//\n// NOTE: this is the devnet program ID. Mainnet will likely have a\n// different program ID — when that day comes, swap via env or config.\nexport const REGISTRY_PROGRAM_ID_BASE58 =\n \"occaTHMv5eYG5aZ85jimxTvHkBfsDCvndXC6J2k8kxr\";\n\nexport const REGISTRY_PROGRAM_ID = new PublicKey(REGISTRY_PROGRAM_ID_BASE58);\n\n// Treasury program ID — devnet. Registry's `create_company` CPIs into\n// `treasury::init_treasury` to atomically initialize the company's\n// TreasuryAccount + PolicyAccount PDAs (per design doc §6).\nexport const TREASURY_PROGRAM_ID_BASE58 =\n \"occaxyVLnurdjedWCBPrvDCCto8wGYadtTZ3nAmcVzh\";\n\nexport const TREASURY_PROGRAM_ID = new PublicKey(TREASURY_PROGRAM_ID_BASE58);\n\n// PDA seed prefixes. Must match `occa-programs/programs/registry/src/lib.rs` exactly.\nexport const COMPANY_SEED = Buffer.from(\"company\");\nexport const AGENT_IDENTITY_SEED = Buffer.from(\"agent_identity\");\nexport const DEPLOYMENT_SEED = Buffer.from(\"deployment\");\n// Treasury PDA seeds (owned by treasury program). Must match\n// `occa-programs/programs/treasury/src/lib.rs`.\nexport const TREASURY_SEED = Buffer.from(\"treasury\");\nexport const POLICY_SEED = Buffer.from(\"policy\");\nexport const PROTOCOL_FEES_SEED = Buffer.from(\"protocol_fees\");\nexport const OPERATIONS_SEED = Buffer.from(\"operations\");\n// DailyAnchor PDA seed (owned by registry program). Seeds:\n// [\"daily_anchor\", deployment_pda, day_unix_le_i64_8bytes].\nexport const DAILY_ANCHOR_SEED = Buffer.from(\"daily_anchor\");\n\n// OperationsKind discriminator byte — must match the Rust enum order in\n// `treasury/src/lib.rs`. Used as the 3rd seed byte of an OperationsAccount\n// PDA and as a u8 wire arg to `register_company_operations`.\nexport const OPERATIONS_KIND = {\n /** Disbursement Wallet — operator-held only, signs `disburse_routine`. */\n Disbursement: 0,\n /** Anchor Wallet — operator+OCCA shared, signs `commit_daily_anchor`. */\n Anchor: 1,\n} as const;\nexport type OperationsKind =\n (typeof OPERATIONS_KIND)[keyof typeof OPERATIONS_KIND];\n\n// SOL has no real SPL mint — lamports live directly on accounts. The\n// treasury program uses the default (all-zero) pubkey as the SOL marker\n// in accepted-asset lists and disbursement mint args.\nexport const SOL_PSEUDO_MINT = new PublicKey(new Uint8Array(32));\n\n// On-chain bounds — must match `occa-programs/programs/registry/src/lib.rs`.\nexport const MAX_NAME_LEN = 64;\nexport const MAX_LOCALE_LEN = 8;\nexport const MAX_ROLE_LEN = 32;\nexport const MAX_METADATA_URI_LEN = 200;\nexport const MAX_REPUTATION_URI_LEN = 200;\n\n// Status encodings — must match the on-chain constants.\nexport const COMPANY_STATUS = {\n Active: 0,\n Paused: 1,\n} as const;\nexport type CompanyStatus =\n (typeof COMPANY_STATUS)[keyof typeof COMPANY_STATUS];\n\nexport const DEPLOYMENT_STATUS = {\n Active: 0,\n Paused: 1,\n /** Terminal — retired deployments cannot be reactivated. */\n Retired: 2,\n} as const;\nexport type DeploymentStatus =\n (typeof DEPLOYMENT_STATUS)[keyof typeof DEPLOYMENT_STATUS];\n\n// Account discriminators (Anchor sha256(\"account:<Name>\")[..8]).\nexport const ACCOUNT_DISCRIMINATOR = {\n AgentIdentity: Buffer.from([11, 149, 31, 27, 186, 76, 241, 72]),\n CompanyAccount: Buffer.from([37, 215, 171, 200, 8, 141, 69, 96]),\n Deployment: Buffer.from([66, 90, 104, 89, 183, 130, 64, 178]),\n DailyAnchorAccount: Buffer.from([218, 106, 107, 94, 194, 48, 111, 254]),\n} as const;\n\n// Treasury program account discriminators — from\n// `occa-programs/target/idl/treasury.json`.\nexport const TREASURY_ACCOUNT_DISCRIMINATOR = {\n TreasuryAccount: Buffer.from([204, 140, 18, 173, 90, 152, 134, 123]),\n PolicyAccount: Buffer.from([218, 201, 183, 164, 156, 127, 81, 175]),\n Protoc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