@cloakedagent/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -0
- package/dist/agent.d.ts +321 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +877 -0
- package/dist/agent.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +64 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +9 -0
- package/dist/constants.js.map +1 -0
- package/dist/idl.json +1347 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +374 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/tools.d.ts +26 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +320 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +61 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +4 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/relayer.d.ts +130 -0
- package/dist/relayer.d.ts.map +1 -0
- package/dist/relayer.js +225 -0
- package/dist/relayer.js.map +1 -0
- package/dist/signer.d.ts +18 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +34 -0
- package/dist/signer.js.map +1 -0
- package/dist/token.d.ts +320 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +896 -0
- package/dist/token.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/zk/browser-prover.d.ts +85 -0
- package/dist/zk/browser-prover.d.ts.map +1 -0
- package/dist/zk/browser-prover.js +260 -0
- package/dist/zk/browser-prover.js.map +1 -0
- package/dist/zk/discovery.d.ts +65 -0
- package/dist/zk/discovery.d.ts.map +1 -0
- package/dist/zk/discovery.js +143 -0
- package/dist/zk/discovery.js.map +1 -0
- package/dist/zk/index.d.ts +14 -0
- package/dist/zk/index.d.ts.map +1 -0
- package/dist/zk/index.js +47 -0
- package/dist/zk/index.js.map +1 -0
- package/dist/zk/ownership_proof.json +1 -0
- package/dist/zk/poseidon.d.ts +31 -0
- package/dist/zk/poseidon.d.ts.map +1 -0
- package/dist/zk/poseidon.js +103 -0
- package/dist/zk/poseidon.js.map +1 -0
- package/dist/zk/prover.d.ts +49 -0
- package/dist/zk/prover.d.ts.map +1 -0
- package/dist/zk/prover.js +120 -0
- package/dist/zk/prover.js.map +1 -0
- package/dist/zk/secrets.d.ts +62 -0
- package/dist/zk/secrets.d.ts.map +1 -0
- package/dist/zk/secrets.js +98 -0
- package/dist/zk/secrets.js.map +1 -0
- package/package.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @cloakedagent/sdk
|
|
2
|
+
|
|
3
|
+
**Trustless spending accounts for AI agents on Solana**
|
|
4
|
+
|
|
5
|
+
Give AI agents spending power without giving them your wallet keys. On-chain enforced limits they literally cannot bypass.
|
|
6
|
+
|
|
7
|
+
[Documentation](https://cloakedagent.com/docs) · [Website](https://cloakedagent.com) · [GitHub](https://github.com/CloakedAgent/cloaked)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @cloakedagent/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### For AI Agents (MCP)
|
|
18
|
+
|
|
19
|
+
Add to your Claude Desktop or MCP-compatible client:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"cloaked": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["@cloakedagent/sdk/mcp"],
|
|
27
|
+
"env": {
|
|
28
|
+
"CLOAKED_AGENT_KEY": "your-agent-key-here"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### For Developers
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { CloakedAgent } from "@cloakedagent/sdk";
|
|
39
|
+
|
|
40
|
+
// Load agent from key
|
|
41
|
+
const agent = new CloakedAgent(agentKey, rpcUrl);
|
|
42
|
+
|
|
43
|
+
// Check balance
|
|
44
|
+
const balance = await agent.getBalance();
|
|
45
|
+
|
|
46
|
+
// Spend within limits
|
|
47
|
+
await agent.spend({
|
|
48
|
+
destination: recipientPubkey,
|
|
49
|
+
amount: 100_000_000 // 0.1 SOL in lamports
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **On-chain constraints** - Per-tx, daily, and total limits enforced by Solana program
|
|
56
|
+
- **MCP integration** - Works with Claude and other AI agents via Model Context Protocol
|
|
57
|
+
- **x402 support** - Automatic payment for pay-per-use APIs
|
|
58
|
+
- **Privacy mode** - Optional ZK proofs to hide wallet-agent link
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
### `CloakedAgent`
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Create from agent key
|
|
66
|
+
const agent = new CloakedAgent(agentKey: string, rpcUrl: string);
|
|
67
|
+
|
|
68
|
+
// Properties
|
|
69
|
+
agent.publicKey // Agent's public key
|
|
70
|
+
agent.vaultPda // Vault address (holds funds)
|
|
71
|
+
agent.agentStatePda // State account address
|
|
72
|
+
|
|
73
|
+
// Methods
|
|
74
|
+
await agent.getBalance() // Get vault balance in lamports
|
|
75
|
+
await agent.getStatus() // Get full status with constraints
|
|
76
|
+
await agent.spend({ destination, amount }) // Spend SOL
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### MCP Tools
|
|
80
|
+
|
|
81
|
+
When running as MCP server, provides these tools:
|
|
82
|
+
|
|
83
|
+
- `cloak_balance` - Check available balance
|
|
84
|
+
- `cloak_status` - Get spending limits and constraints
|
|
85
|
+
- `cloak_pay` - Send SOL to destination
|
|
86
|
+
- `cloak_x402_fetch` - Fetch x402-protected resources with auto-payment
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { CloakedAgentState, CreateAgentOptions, ConstraintOptions, SpendOptions, SpendResult } from "./types";
|
|
3
|
+
import { Signer } from "./signer";
|
|
4
|
+
/**
|
|
5
|
+
* CloakedAgent - Represents a Cloaked Agent on Solana
|
|
6
|
+
*
|
|
7
|
+
* A Cloaked Agent is a Solana keypair where:
|
|
8
|
+
* - The private key is the "Agent Key" (what users save)
|
|
9
|
+
* - The derived PDA holds the SOL balance
|
|
10
|
+
* - Signing with the keypair authorizes spending
|
|
11
|
+
*
|
|
12
|
+
* Two modes of operation:
|
|
13
|
+
* - Agent mode (via constructor): Has Agent Key, can spend
|
|
14
|
+
* - Owner mode (via forOwner): No Agent Key, can manage (freeze/unfreeze/update/close)
|
|
15
|
+
*/
|
|
16
|
+
export declare class CloakedAgent {
|
|
17
|
+
private keypair;
|
|
18
|
+
private delegatePubkey;
|
|
19
|
+
private connection;
|
|
20
|
+
private _pda;
|
|
21
|
+
private _bump;
|
|
22
|
+
private _ownerCommitment;
|
|
23
|
+
private _agentSecret;
|
|
24
|
+
private _nonce;
|
|
25
|
+
private _agentStatePda;
|
|
26
|
+
private _vaultPda;
|
|
27
|
+
/**
|
|
28
|
+
* Create a CloakedAgent from an Agent Key (agent mode - can spend)
|
|
29
|
+
* @param agentKey - Base58 encoded secret key
|
|
30
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
31
|
+
*/
|
|
32
|
+
constructor(agentKey: string, rpcUrl: string);
|
|
33
|
+
/**
|
|
34
|
+
* Create a CloakedAgent for owner management (freeze, unfreeze, update, close, withdraw, deposit)
|
|
35
|
+
* Does NOT have delegate keypair - cannot spend.
|
|
36
|
+
* Use this when you have the delegate's public key but not the Agent Key.
|
|
37
|
+
*
|
|
38
|
+
* @param delegatePubkey - Public key of the delegate (from URL or on-chain data)
|
|
39
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
40
|
+
*/
|
|
41
|
+
static forOwner(delegatePubkey: PublicKey | string, rpcUrl: string): CloakedAgent;
|
|
42
|
+
/**
|
|
43
|
+
* Create a CloakedAgent for private owner management (ZK proof-based)
|
|
44
|
+
* Uses the master secret and nonce to derive the agent secret and find the agent.
|
|
45
|
+
*
|
|
46
|
+
* @param masterSecret - Master secret derived from wallet signature
|
|
47
|
+
* @param nonce - Agent index (0, 1, 2, ...)
|
|
48
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
49
|
+
* @returns CloakedAgent instance for private management
|
|
50
|
+
*/
|
|
51
|
+
static forPrivateOwner(masterSecret: bigint, nonce: number, rpcUrl: string): Promise<CloakedAgent>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if this agent is in private mode
|
|
54
|
+
*/
|
|
55
|
+
get isPrivateMode(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Get the owner commitment (private mode only)
|
|
58
|
+
*/
|
|
59
|
+
get ownerCommitment(): Uint8Array | null;
|
|
60
|
+
/**
|
|
61
|
+
* The agent's public key (used to derive PDA)
|
|
62
|
+
*/
|
|
63
|
+
get publicKey(): PublicKey;
|
|
64
|
+
/**
|
|
65
|
+
* The PDA that holds this agent's SOL balance
|
|
66
|
+
*/
|
|
67
|
+
get pda(): PublicKey;
|
|
68
|
+
/**
|
|
69
|
+
* The bump seed used for PDA derivation
|
|
70
|
+
*/
|
|
71
|
+
get bump(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Get the CloakedAgentState PDA address for this delegate
|
|
74
|
+
*/
|
|
75
|
+
get agentStatePda(): PublicKey;
|
|
76
|
+
/**
|
|
77
|
+
* Get the Vault PDA address for this agent
|
|
78
|
+
*/
|
|
79
|
+
get vaultPda(): PublicKey;
|
|
80
|
+
/**
|
|
81
|
+
* Get the current SOL balance of this agent
|
|
82
|
+
* @returns Balance in SOL
|
|
83
|
+
*/
|
|
84
|
+
getBalance(): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Get the current balance in lamports
|
|
87
|
+
* @returns Balance in lamports
|
|
88
|
+
*/
|
|
89
|
+
getBalanceLamports(): Promise<number>;
|
|
90
|
+
/**
|
|
91
|
+
* Generate a new random Cloaked Agent
|
|
92
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
93
|
+
* @returns New agent instance and its Agent Key
|
|
94
|
+
*/
|
|
95
|
+
static generate(rpcUrl: string): {
|
|
96
|
+
agent: CloakedAgent;
|
|
97
|
+
agentKey: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Derive the PDA for any public key (without needing full agent)
|
|
101
|
+
* @param publicKey - Agent's public key
|
|
102
|
+
* @returns The PDA address
|
|
103
|
+
*/
|
|
104
|
+
static derivePda(publicKey: PublicKey): PublicKey;
|
|
105
|
+
/**
|
|
106
|
+
* Derive PDA with bump
|
|
107
|
+
* @param publicKey - Agent's public key
|
|
108
|
+
* @returns The PDA address and bump
|
|
109
|
+
*/
|
|
110
|
+
static derivePdaWithBump(publicKey: PublicKey): [PublicKey, number];
|
|
111
|
+
/**
|
|
112
|
+
* Derive CloakedAgentState PDA for a delegate
|
|
113
|
+
*/
|
|
114
|
+
static deriveAgentStatePda(delegate: PublicKey): PublicKey;
|
|
115
|
+
/**
|
|
116
|
+
* Derive Vault PDA from CloakedAgentState PDA
|
|
117
|
+
*/
|
|
118
|
+
static deriveVaultPda(agentStatePda: PublicKey): PublicKey;
|
|
119
|
+
/**
|
|
120
|
+
* Create a new Cloaked Agent with constraints on-chain
|
|
121
|
+
* @param connection - Solana connection
|
|
122
|
+
* @param owner - Owner wallet (Signer - can be wallet adapter or wrapped Keypair)
|
|
123
|
+
* @param options - Agent creation options
|
|
124
|
+
* @returns New CloakedAgent instance and Agent Key
|
|
125
|
+
*/
|
|
126
|
+
static create(connection: Connection, owner: Signer, options: CreateAgentOptions): Promise<{
|
|
127
|
+
agent: CloakedAgent;
|
|
128
|
+
agentKey: string;
|
|
129
|
+
signature: string;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Fetch full agent state from on-chain
|
|
133
|
+
* @returns CloakedAgentState with all constraints and spending info
|
|
134
|
+
*/
|
|
135
|
+
getState(): Promise<CloakedAgentState>;
|
|
136
|
+
/**
|
|
137
|
+
* Spend from vault to destination (delegate signs)
|
|
138
|
+
* Requires agent mode (Agent Key) - throws if in owner mode.
|
|
139
|
+
*
|
|
140
|
+
* Two fee payment modes:
|
|
141
|
+
*
|
|
142
|
+
* 1. **With feePayer (standard mode)**: User's wallet pays tx fee directly
|
|
143
|
+
* - No relayer involved
|
|
144
|
+
* - Normal tx fee (~5k lamports) paid by user wallet
|
|
145
|
+
* - Vault only pays the amount to destination
|
|
146
|
+
*
|
|
147
|
+
* 2. **Without feePayer (agent/MCP mode)**: Relayer pays, vault reimburses
|
|
148
|
+
* - Relayer fronts the tx fee
|
|
149
|
+
* - Vault reimburses relayer 10k lamports
|
|
150
|
+
* - Delegate doesn't need any SOL
|
|
151
|
+
*
|
|
152
|
+
* @param options - Spend options (destination, amount, optional feePayer)
|
|
153
|
+
* @returns Spend result with signature and remaining balances
|
|
154
|
+
*/
|
|
155
|
+
spend(options: SpendOptions): Promise<SpendResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Spend with user-provided fee payer (no relayer)
|
|
158
|
+
*/
|
|
159
|
+
private spendWithFeePayer;
|
|
160
|
+
/**
|
|
161
|
+
* Spend via relayer (relayer pays, vault reimburses)
|
|
162
|
+
*/
|
|
163
|
+
private spendViaRelayer;
|
|
164
|
+
/**
|
|
165
|
+
* Deposit SOL to vault (anyone can call)
|
|
166
|
+
* @param depositor - Signer of the depositor (wallet adapter or wrapped Keypair)
|
|
167
|
+
* @param amount - Amount in lamports
|
|
168
|
+
* @returns Transaction signature
|
|
169
|
+
*/
|
|
170
|
+
deposit(depositor: Signer, amount: number): Promise<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Freeze agent (owner only) - emergency stop
|
|
173
|
+
* @param owner - Owner signer (wallet adapter or wrapped Keypair)
|
|
174
|
+
* @returns Transaction signature
|
|
175
|
+
*/
|
|
176
|
+
freeze(owner: Signer): Promise<string>;
|
|
177
|
+
/**
|
|
178
|
+
* Unfreeze agent (owner only)
|
|
179
|
+
* @param owner - Owner signer (wallet adapter or wrapped Keypair)
|
|
180
|
+
* @returns Transaction signature
|
|
181
|
+
*/
|
|
182
|
+
unfreeze(owner: Signer): Promise<string>;
|
|
183
|
+
/**
|
|
184
|
+
* Update agent constraints (owner only)
|
|
185
|
+
* @param owner - Owner signer (wallet adapter or wrapped Keypair)
|
|
186
|
+
* @param options - New constraint values (null = no change)
|
|
187
|
+
* @returns Transaction signature
|
|
188
|
+
*/
|
|
189
|
+
updateConstraints(owner: Signer, options: ConstraintOptions): Promise<string>;
|
|
190
|
+
/**
|
|
191
|
+
* Close agent and reclaim all funds to owner (owner only)
|
|
192
|
+
* @param owner - Owner signer (wallet adapter or wrapped Keypair)
|
|
193
|
+
* @returns Transaction signature
|
|
194
|
+
*/
|
|
195
|
+
close(owner: Signer): Promise<string>;
|
|
196
|
+
/**
|
|
197
|
+
* Withdraw from vault to any destination (owner only, no constraints)
|
|
198
|
+
* Works even if agent is frozen or expired - owner has full control
|
|
199
|
+
* Preserves privacy by allowing withdrawal to any wallet
|
|
200
|
+
* @param owner - Owner signer (wallet adapter or wrapped Keypair)
|
|
201
|
+
* @param amount - Amount in lamports to withdraw
|
|
202
|
+
* @param destination - Destination wallet (any PublicKey)
|
|
203
|
+
* @returns Transaction signature
|
|
204
|
+
*/
|
|
205
|
+
withdraw(owner: Signer, amount: number, destination: PublicKey): Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Create a new Cloaked Agent in private mode (no wallet linked on-chain)
|
|
208
|
+
*
|
|
209
|
+
* @param connection - Solana connection
|
|
210
|
+
* @param payer - Payer for transaction fees (can be any signer)
|
|
211
|
+
* @param masterSecret - Master secret derived from wallet signature
|
|
212
|
+
* @param nonce - Agent index (0, 1, 2, ...)
|
|
213
|
+
* @param options - Agent creation options
|
|
214
|
+
* @returns New CloakedAgent instance (with private mode) and Agent Key
|
|
215
|
+
*/
|
|
216
|
+
static createPrivate(connection: Connection, payer: Signer, masterSecret: bigint, nonce: number, options: Omit<CreateAgentOptions, "delegate">): Promise<{
|
|
217
|
+
agent: CloakedAgent;
|
|
218
|
+
agentKey: string;
|
|
219
|
+
signature: string;
|
|
220
|
+
}>;
|
|
221
|
+
/**
|
|
222
|
+
* Create a new Cloaked Agent via relayer (truly private - user wallet never signs on-chain)
|
|
223
|
+
*
|
|
224
|
+
* This is the most private mode of operation:
|
|
225
|
+
* 1. User signs message to derive master secret (client-side only)
|
|
226
|
+
* 2. User sends total (fee + funding) to relayer via Privacy Cash
|
|
227
|
+
* 3. Relayer keeps 0.01 SOL fee, forwards rest to vault
|
|
228
|
+
* 4. Relayer creates the agent on-chain (generates delegate)
|
|
229
|
+
* 5. Agent Key encrypted for user (only user can decrypt)
|
|
230
|
+
* 6. User's wallet NEVER appears in any on-chain transaction
|
|
231
|
+
*
|
|
232
|
+
* @param masterSecret - Master secret derived from wallet signature
|
|
233
|
+
* @param nonce - Agent index (0, 1, 2, ...)
|
|
234
|
+
* @param options - Agent creation options
|
|
235
|
+
* @param depositSignature - Privacy Cash tx signature to relayer
|
|
236
|
+
* @param depositAmount - Total lamports sent (fee + vault funding)
|
|
237
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
238
|
+
* @param apiUrl - Optional backend API URL
|
|
239
|
+
* @returns New CloakedAgent instance (with private mode) and Agent Key
|
|
240
|
+
*/
|
|
241
|
+
static createPrivateViaRelayer(masterSecret: bigint, nonce: number, options: Omit<CreateAgentOptions, "delegate" | "initialDeposit">, depositSignature: string, depositAmount: number, rpcUrl: string, apiUrl?: string): Promise<{
|
|
242
|
+
agent: CloakedAgent;
|
|
243
|
+
agentKey: string;
|
|
244
|
+
signature: string;
|
|
245
|
+
vaultPda: PublicKey;
|
|
246
|
+
}>;
|
|
247
|
+
/**
|
|
248
|
+
* Create a new Cloaked Agent using your own relayer keypair (no backend needed, no fees)
|
|
249
|
+
*
|
|
250
|
+
* This is for technical users who want to:
|
|
251
|
+
* - Use their own funded keypair as a relayer
|
|
252
|
+
* - Pay their own rent (no 0.01 SOL fee to our relayer)
|
|
253
|
+
* - Have full control over the creation process
|
|
254
|
+
* - Fund vault separately via Privacy Cash for anonymity
|
|
255
|
+
*
|
|
256
|
+
* Flow:
|
|
257
|
+
* 1. User signs message to derive master secret (client-side only)
|
|
258
|
+
* 2. User provides a funded Keypair to pay rent
|
|
259
|
+
* 3. Creates agent directly on-chain (relayerKeypair signs and pays)
|
|
260
|
+
* 4. User's main wallet NEVER appears in any on-chain transaction
|
|
261
|
+
* 5. Fund vault separately via Privacy Cash for complete anonymity
|
|
262
|
+
*
|
|
263
|
+
* @param masterSecret - Master secret derived from wallet signature
|
|
264
|
+
* @param nonce - Agent index (0, 1, 2, ...)
|
|
265
|
+
* @param options - Agent creation options
|
|
266
|
+
* @param relayerKeypair - User's own funded keypair (pays rent ~0.00138 SOL)
|
|
267
|
+
* @param rpcUrl - Solana RPC endpoint URL
|
|
268
|
+
* @returns New CloakedAgent instance (with private mode) and Agent Key
|
|
269
|
+
*/
|
|
270
|
+
static createPrivateWithRelayer(masterSecret: bigint, nonce: number, options: Omit<CreateAgentOptions, "delegate" | "initialDeposit">, relayerKeypair: Keypair, rpcUrl: string): Promise<{
|
|
271
|
+
agent: CloakedAgent;
|
|
272
|
+
agentKey: string;
|
|
273
|
+
signature: string;
|
|
274
|
+
vaultPda: PublicKey;
|
|
275
|
+
}>;
|
|
276
|
+
/**
|
|
277
|
+
* Freeze agent using ZK proof (private mode only)
|
|
278
|
+
* Uses relayer to submit transaction - vault pays for fees
|
|
279
|
+
* @param apiUrl - Optional API URL for relayer
|
|
280
|
+
* @returns Transaction signature
|
|
281
|
+
*/
|
|
282
|
+
freezePrivate(apiUrl?: string): Promise<string>;
|
|
283
|
+
/**
|
|
284
|
+
* Unfreeze agent using ZK proof (private mode only)
|
|
285
|
+
* Uses relayer to submit transaction - vault pays for fees
|
|
286
|
+
* @param apiUrl - Optional API URL for relayer
|
|
287
|
+
* @returns Transaction signature
|
|
288
|
+
*/
|
|
289
|
+
unfreezePrivate(apiUrl?: string): Promise<string>;
|
|
290
|
+
/**
|
|
291
|
+
* Update constraints using ZK proof (private mode only)
|
|
292
|
+
* Uses relayer to submit transaction - vault pays for fees
|
|
293
|
+
* @param options - New constraint values (undefined = no change)
|
|
294
|
+
* @param apiUrl - Optional API URL for relayer
|
|
295
|
+
* @returns Transaction signature
|
|
296
|
+
*/
|
|
297
|
+
updateConstraintsPrivate(options: ConstraintOptions, apiUrl?: string): Promise<string>;
|
|
298
|
+
/**
|
|
299
|
+
* Close agent and reclaim funds using ZK proof (private mode only)
|
|
300
|
+
* Uses relayer to submit transaction - vault pays for fees
|
|
301
|
+
* @param destination - Destination for remaining funds
|
|
302
|
+
* @param apiUrl - Optional API URL for relayer
|
|
303
|
+
* @returns Transaction signature
|
|
304
|
+
*/
|
|
305
|
+
closePrivate(destination: PublicKey, apiUrl?: string): Promise<string>;
|
|
306
|
+
/**
|
|
307
|
+
* Withdraw using ZK proof (private mode only)
|
|
308
|
+
* Uses relayer to submit transaction - vault pays for fees
|
|
309
|
+
* @param amount - Amount in lamports to withdraw
|
|
310
|
+
* @param destination - Destination for funds
|
|
311
|
+
* @param apiUrl - Optional API URL for relayer
|
|
312
|
+
* @returns Transaction signature
|
|
313
|
+
*/
|
|
314
|
+
withdrawPrivate(amount: number, destination: PublicKey, apiUrl?: string): Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Securely destroy sensitive data in this agent instance
|
|
317
|
+
* Call this when done using the agent to clear secrets from memory
|
|
318
|
+
*/
|
|
319
|
+
destroy(): void;
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAmB,MAAM,UAAU,CAAC;AAyBnD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,KAAK,CAAS;IAGtB,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,MAAM,CAAuB;IAGrC,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,SAAS,CAA0B;IAE3C;;;;OAIG;gBACS,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAe5C;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,SAAS,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAuBjF;;;;;;;;OAQG;WACU,eAAe,CAC1B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,C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