@q00bs/agent-sdk 1.0.5 → 1.0.6
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 +72 -82
- package/dist/Q00bsAgent.d.ts +50 -60
- package/dist/Q00bsAgent.d.ts.map +1 -1
- package/dist/Q00bsAgent.js +191 -149
- package/dist/Q00bsAgent.js.map +1 -1
- package/dist/index.d.ts +6 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -11
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +33 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,8 +107,9 @@
|
|
|
107
107
|
│ └── ERC8004Manager — ERC-8004 identity & reputation │
|
|
108
108
|
│ │
|
|
109
109
|
│ ── Wallet Mode ─────────────────────────────────────── │
|
|
110
|
-
│
|
|
111
|
-
│
|
|
110
|
+
│ Trust API → Q00bs' Privy HSM custody │
|
|
111
|
+
│ No Privy credentials needed by SDK consumers │
|
|
112
|
+
│ All wallets appear on Q00bs' Privy dashboard │
|
|
112
113
|
│ │
|
|
113
114
|
│ ── On-Chain Contracts (Base Mainnet) ───────────────── │
|
|
114
115
|
│ Q00bFactory → 0xe611...52b0 │
|
|
@@ -142,29 +143,25 @@ The SDK has a single runtime dependency: [`viem`](https://viem.sh) (^2.21.0).
|
|
|
142
143
|
|
|
143
144
|
## Quick Start
|
|
144
145
|
|
|
145
|
-
All Q00bs
|
|
146
|
+
All Q00bs agent wallets are created and managed by **Q00bs' own Privy infrastructure** via the Trust API. You never need Privy credentials — just point the SDK at the Trust API URL and it handles everything.
|
|
146
147
|
|
|
147
148
|
```typescript
|
|
148
149
|
import { Q00bsAgent } from '@q00bs/agent-sdk';
|
|
149
150
|
|
|
150
151
|
const agent = new Q00bsAgent({
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
appSecret: process.env.PRIVY_APP_SECRET!,
|
|
154
|
-
walletId: process.env.PRIVY_WALLET_ID, // optional — creates new if omitted
|
|
155
|
-
},
|
|
156
|
-
rpcUrl: process.env.BASE_RPC_URL || 'https://mainnet.base.org',
|
|
157
|
-
registryAddress: '0xF7c8acecdfbBEAf08F596ab1F85f68f7E6568172',
|
|
158
|
-
escrowAddress: '0xe1139A7BebD89e534d4C459b252BA0963e0A0499',
|
|
159
|
-
consensusAddress: '0xcB4A36a7c99e42B3F4b1c8EE6EDD0f3A7DDEcC76',
|
|
152
|
+
trustApiUrl: 'https://q00bs-trust-api.onrender.com',
|
|
153
|
+
walletId: process.env.Q00BS_WALLET_ID, // optional — creates new if omitted
|
|
160
154
|
maxTransactionValue: '0.1', // Max 0.1 ETH per tx
|
|
161
155
|
dailySpendLimit: '1.0', // Max 1 ETH per day
|
|
162
156
|
});
|
|
163
157
|
|
|
164
158
|
await agent.initialize();
|
|
165
|
-
// → Privy
|
|
166
|
-
// → Private key held in
|
|
159
|
+
// → Wallet created under Q00bs' Privy app (appears on Q00bs' Privy dashboard)
|
|
160
|
+
// → Private key held in Q00bs' HSM — never in your code
|
|
161
|
+
// → Store agent.walletId for reuse in next session
|
|
162
|
+
|
|
167
163
|
console.log(`Agent wallet: ${agent.address}`);
|
|
164
|
+
console.log(`Wallet ID: ${agent.walletId}`); // Save this!
|
|
168
165
|
console.log(`Agent ID: ${agent.agentId}`);
|
|
169
166
|
```
|
|
170
167
|
|
|
@@ -251,8 +248,8 @@ import { Q00bsAgent } from '@q00bs/agent-sdk';
|
|
|
251
248
|
// Create the agent (does NOT connect to blockchain yet)
|
|
252
249
|
const agent = new Q00bsAgent(config: AgentConfig);
|
|
253
250
|
|
|
254
|
-
// Initialize blockchain connections
|
|
255
|
-
await agent.initialize(
|
|
251
|
+
// Initialize blockchain connections, create/load wallet via Trust API
|
|
252
|
+
await agent.initialize(): Promise<void>;
|
|
256
253
|
```
|
|
257
254
|
|
|
258
255
|
**Properties (after initialization):**
|
|
@@ -262,9 +259,7 @@ await agent.initialize(walletPolicy?: PrivyWalletPolicy): Promise<void>;
|
|
|
262
259
|
| `agentId` | `number \| undefined` | On-chain agent ID (set after registration) |
|
|
263
260
|
| `initialized` | `boolean` | Whether `initialize()` has been called |
|
|
264
261
|
| `address` | `string` | Agent's wallet address |
|
|
265
|
-
| `
|
|
266
|
-
| `isPrivyMode` | `boolean` | Whether using Privy wallet |
|
|
267
|
-
| `privyWallet` | `PrivyWalletManager \| undefined` | Privy manager (Mode 2 only) |
|
|
262
|
+
| `walletId` | `string \| undefined` | Privy wallet ID (save for reuse) |
|
|
268
263
|
| `erc8004` | `ERC8004Manager \| undefined` | ERC-8004 manager instance |
|
|
269
264
|
|
|
270
265
|
#### Registration
|
|
@@ -392,26 +387,26 @@ const request: ConsensusRecord = await agent.getConsensusRequest(requestId);
|
|
|
392
387
|
| ≤ 1.00 ETH | 4 of 6 peers | No |
|
|
393
388
|
| > 1.00 ETH | 4 of 6 peers | **Yes** |
|
|
394
389
|
|
|
395
|
-
####
|
|
390
|
+
#### Wallet Management
|
|
396
391
|
|
|
397
|
-
|
|
398
|
-
// Get wallet info
|
|
399
|
-
const walletInfo: PrivyWalletInfo | undefined = agent.getPrivyWalletInfo();
|
|
392
|
+
All wallets are managed via Q00bs' Trust API. No Privy credentials needed.
|
|
400
393
|
|
|
394
|
+
```typescript
|
|
401
395
|
// Update spending policy dynamically
|
|
402
|
-
await agent.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
{ type: 'max_transaction_value', value: '0.5' },
|
|
406
|
-
{ type: 'daily_spend_limit', value: '5.0' },
|
|
407
|
-
{ type: 'allowed_chains', value: ['8453'] },
|
|
408
|
-
{ type: 'allowed_contracts', value: ['0xRegistry...', '0xEscrow...'] },
|
|
409
|
-
{ type: 'require_human_approval', value: true },
|
|
410
|
-
],
|
|
396
|
+
await agent.updateWalletPolicy({
|
|
397
|
+
maxTransactionValue: '0.5',
|
|
398
|
+
dailySpendLimit: '5.0',
|
|
411
399
|
});
|
|
412
400
|
|
|
413
|
-
// Sign a message (
|
|
401
|
+
// Sign a message (routed through Trust API → Q00bs' Privy)
|
|
414
402
|
const signature: string = await agent.signMessage('Hello from Q00bs!');
|
|
403
|
+
|
|
404
|
+
// Send a transaction (policy-checked before broadcast)
|
|
405
|
+
const txHash: string = await agent.sendTransaction(
|
|
406
|
+
'0xContract...', // to
|
|
407
|
+
'1000000000000', // value in wei (optional)
|
|
408
|
+
'0x...', // encoded calldata (optional)
|
|
409
|
+
);
|
|
415
410
|
```
|
|
416
411
|
|
|
417
412
|
#### ERC-8004 Trustless Agents
|
|
@@ -535,39 +530,28 @@ const active = await discovery.isActive(agentId);
|
|
|
535
530
|
|
|
536
531
|
#### PrivyWalletManager
|
|
537
532
|
|
|
533
|
+
> **Note:** This class is used internally by the Q00bs Trust API server. As an SDK consumer, you don't need to use it directly — wallet operations are routed through the Trust API automatically. It is exported for advanced use cases (e.g., running your own Q00bs API node).
|
|
534
|
+
|
|
538
535
|
```typescript
|
|
539
536
|
import { PrivyWalletManager } from '@q00bs/agent-sdk';
|
|
540
537
|
|
|
538
|
+
// Only used by the API server (requires Q00bs' Privy credentials)
|
|
541
539
|
const manager = new PrivyWalletManager(
|
|
542
|
-
{ appId:
|
|
540
|
+
{ appId: PRIVY_APP_ID, appSecret: PRIVY_APP_SECRET },
|
|
543
541
|
logger,
|
|
544
542
|
);
|
|
545
543
|
|
|
546
|
-
// Wallet lifecycle
|
|
547
544
|
const wallet = await manager.createWallet(policy);
|
|
548
545
|
const existing = await manager.getWallet(walletId);
|
|
549
|
-
const info = await manager.initialize(policy);
|
|
550
|
-
|
|
551
|
-
// Policy management
|
|
546
|
+
const info = await manager.initialize(policy);
|
|
552
547
|
await manager.setPolicy(walletId, policy);
|
|
553
|
-
const defaultPolicy = PrivyWalletManager.buildDefaultPolicy(
|
|
554
|
-
'0.1', // maxTxValueEth
|
|
555
|
-
'1.0', // dailyLimitEth
|
|
556
|
-
['0x...'], // allowedContracts
|
|
557
|
-
true, // requireHumanApproval
|
|
558
|
-
);
|
|
559
548
|
|
|
560
|
-
// Transactions
|
|
561
549
|
const result = await manager.sendTransaction(walletId, {
|
|
562
550
|
to: '0xContract...',
|
|
563
|
-
data: '0x...',
|
|
564
|
-
value: '10000000000000',
|
|
551
|
+
data: '0x...',
|
|
552
|
+
value: '10000000000000',
|
|
565
553
|
chainId: 8453,
|
|
566
554
|
});
|
|
567
|
-
|
|
568
|
-
// Signing
|
|
569
|
-
const sig = await manager.signMessage(walletId, 'message');
|
|
570
|
-
const typedSig = await manager.signTypedData(walletId, typedData);
|
|
571
555
|
```
|
|
572
556
|
|
|
573
557
|
#### ERC8004Manager
|
|
@@ -616,8 +600,10 @@ Low-level helpers for creating blockchain clients directly:
|
|
|
616
600
|
import { createPrivyClients, createLogger } from '@q00bs/agent-sdk';
|
|
617
601
|
|
|
618
602
|
// Create Privy-managed blockchain clients
|
|
603
|
+
// NOTE: This requires Q00bs' Privy credentials — used by the API server internally.
|
|
604
|
+
// As an SDK consumer, use Q00bsAgent with trustApiUrl instead.
|
|
619
605
|
const clients = createPrivyClients({
|
|
620
|
-
privy: { appId:
|
|
606
|
+
privy: { appId: PRIVY_APP_ID, appSecret: PRIVY_APP_SECRET },
|
|
621
607
|
rpcUrl: 'https://mainnet.base.org',
|
|
622
608
|
});
|
|
623
609
|
// Returns: { publicClient, privyWalletManager, chain, mode: 'privy' }
|
|
@@ -636,9 +622,10 @@ All types are exported from `@q00bs/agent-sdk` and centralized in `src/types.ts`
|
|
|
636
622
|
|
|
637
623
|
```typescript
|
|
638
624
|
interface AgentConfig {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
625
|
+
trustApiUrl: string; // Q00bs Trust API URL (REQUIRED)
|
|
626
|
+
walletId?: string; // Existing wallet ID (creates new if omitted)
|
|
627
|
+
rpcUrl?: string; // Base mainnet RPC URL (default: public endpoint)
|
|
628
|
+
registryAddress?: string; // AgentRegistry contract (default: SDK constant)
|
|
642
629
|
escrowAddress?: string; // AgentEscrow contract (optional)
|
|
643
630
|
consensusAddress?: string; // ConsensusModule contract (optional)
|
|
644
631
|
agentId?: number; // Pre-existing on-chain agent ID
|
|
@@ -646,6 +633,7 @@ interface AgentConfig {
|
|
|
646
633
|
maxHops?: number; // Max trust-path hops (default: 3)
|
|
647
634
|
maxTransactionValue?: string; // Max ETH per tx (default: '0.1')
|
|
648
635
|
dailySpendLimit?: string; // Max ETH per day (default: '1')
|
|
636
|
+
x402TxHash?: string; // x402 payment hash for API auth
|
|
649
637
|
erc8004?: ERC8004Config; // ERC-8004 registry addresses
|
|
650
638
|
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
651
639
|
}
|
|
@@ -782,11 +770,13 @@ interface ConsensusResult {
|
|
|
782
770
|
|
|
783
771
|
### Privy Types
|
|
784
772
|
|
|
773
|
+
> **Note:** These types are used internally by the Q00bs Trust API server. SDK consumers do NOT need to configure Privy directly — wallets are managed through `trustApiUrl`.
|
|
774
|
+
|
|
785
775
|
```typescript
|
|
786
776
|
interface PrivyConfig {
|
|
787
|
-
appId: string; // Privy App ID
|
|
788
|
-
appSecret: string; // Privy App Secret (server
|
|
789
|
-
walletId?: string; // Existing wallet ID
|
|
777
|
+
appId: string; // Q00bs Privy App ID (API server only)
|
|
778
|
+
appSecret: string; // Q00bs Privy App Secret (API server only)
|
|
779
|
+
walletId?: string; // Existing wallet ID
|
|
790
780
|
userId?: string; // Links wallet to Privy user account
|
|
791
781
|
}
|
|
792
782
|
|
|
@@ -1122,11 +1112,11 @@ The SDK enforces a **3-layer defense-in-depth** model:
|
|
|
1122
1112
|
|
|
1123
1113
|
**Best practices:**
|
|
1124
1114
|
|
|
1125
|
-
1. **
|
|
1126
|
-
2. **
|
|
1127
|
-
3. **
|
|
1128
|
-
4. **
|
|
1129
|
-
5. **
|
|
1115
|
+
1. **Use `trustApiUrl`** — wallets are managed by Q00bs' Privy infrastructure; no credentials needed
|
|
1116
|
+
2. **Store your `walletId`** — save it after first initialization to reuse the same wallet
|
|
1117
|
+
3. **Never hardcode credentials** — use environment variables for API URLs and wallet IDs
|
|
1118
|
+
4. **Set spending limits** — configure `maxTransactionValue` and `dailySpendLimit` in AgentConfig
|
|
1119
|
+
5. **Pay via x402** — all API calls are authenticated via USDC micropayments on Base
|
|
1130
1120
|
|
|
1131
1121
|
---
|
|
1132
1122
|
|
|
@@ -1165,27 +1155,23 @@ The Trust API also provides indexed, paginated endpoints that perform better tha
|
|
|
1165
1155
|
### Full Agent Lifecycle
|
|
1166
1156
|
|
|
1167
1157
|
```typescript
|
|
1168
|
-
import { Q00bsAgent
|
|
1158
|
+
import { Q00bsAgent } from '@q00bs/agent-sdk';
|
|
1169
1159
|
|
|
1170
1160
|
async function main() {
|
|
1171
|
-
// 1. Create and initialize agent
|
|
1161
|
+
// 1. Create and initialize agent — no Privy credentials needed
|
|
1172
1162
|
const agent = new Q00bsAgent({
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
appSecret: process.env.PRIVY_APP_SECRET!,
|
|
1176
|
-
},
|
|
1177
|
-
rpcUrl: 'https://mainnet.base.org',
|
|
1178
|
-
registryAddress: AGENT_REGISTRY_ADDRESS,
|
|
1179
|
-
escrowAddress: AGENT_ESCROW_ADDRESS,
|
|
1163
|
+
trustApiUrl: 'https://q00bs-trust-api.onrender.com',
|
|
1164
|
+
walletId: process.env.Q00BS_WALLET_ID, // reuse wallet from previous session
|
|
1180
1165
|
capabilities: ['data_analysis', 'summarization'],
|
|
1181
1166
|
});
|
|
1182
1167
|
|
|
1183
1168
|
await agent.initialize();
|
|
1184
|
-
console.log(`Agent ready: ${agent.address}
|
|
1169
|
+
console.log(`Agent ready: ${agent.address}`);
|
|
1170
|
+
console.log(`Wallet ID (save this!): ${agent.walletId}`);
|
|
1185
1171
|
|
|
1186
1172
|
// 2. Check if already registered
|
|
1187
1173
|
if (!agent.agentId) {
|
|
1188
|
-
console.log('Agent not registered.
|
|
1174
|
+
console.log('Agent not registered. Call agent.register() to register on-chain.');
|
|
1189
1175
|
return;
|
|
1190
1176
|
}
|
|
1191
1177
|
|
|
@@ -1347,13 +1333,15 @@ console.log(`Vouched by ${networkTrust.vouchCount} agents`);
|
|
|
1347
1333
|
|
|
1348
1334
|
```bash
|
|
1349
1335
|
# ─── Required ────────────────────────────────────────────
|
|
1350
|
-
#
|
|
1351
|
-
|
|
1336
|
+
# Q00bs Trust API URL (all wallet ops go through here)
|
|
1337
|
+
Q00BS_TRUST_API_URL=https://q00bs-trust-api.onrender.com
|
|
1338
|
+
|
|
1339
|
+
# ─── Optional ────────────────────────────────────────────
|
|
1340
|
+
# Reuse an existing wallet from a previous session
|
|
1341
|
+
Q00BS_WALLET_ID=your-wallet-id-from-first-init
|
|
1352
1342
|
|
|
1353
|
-
#
|
|
1354
|
-
|
|
1355
|
-
PRIVY_APP_SECRET=your-privy-app-secret
|
|
1356
|
-
PRIVY_WALLET_ID=optional-existing-wallet-id
|
|
1343
|
+
# Base mainnet RPC for direct on-chain reads (defaults to public endpoint)
|
|
1344
|
+
BASE_RPC_URL=https://mainnet.base.org
|
|
1357
1345
|
|
|
1358
1346
|
# ─── Contract Addresses (defaults built into SDK) ───────
|
|
1359
1347
|
# Override only if using custom deployments:
|
|
@@ -1362,12 +1350,14 @@ PRIVY_WALLET_ID=optional-existing-wallet-id
|
|
|
1362
1350
|
# CONSENSUS_ADDRESS=0xcB4A36a7c99e42B3F4b1c8EE6EDD0f3A7DDEcC76
|
|
1363
1351
|
```
|
|
1364
1352
|
|
|
1353
|
+
> **No Privy credentials needed.** Wallets are created and managed by Q00bs' own Privy infrastructure via the Trust API. All agents appear as users on Q00bs' Privy dashboard.
|
|
1354
|
+
|
|
1365
1355
|
---
|
|
1366
1356
|
|
|
1367
1357
|
## FAQ
|
|
1368
1358
|
|
|
1369
|
-
**Q:
|
|
1370
|
-
|
|
1359
|
+
**Q: Do I need Privy credentials to use the SDK?**
|
|
1360
|
+
No. Wallets are created and managed by Q00bs' own Privy infrastructure via the Trust API. You just need the Trust API URL (`trustApiUrl`). All wallets created through the SDK appear as users on Q00bs' Privy dashboard. Private keys never appear in your code, env vars, or agent memory.
|
|
1371
1361
|
|
|
1372
1362
|
**Q: How much does it cost to use the Trust API?**
|
|
1373
1363
|
API calls are paid via x402 micropayments in USDC on Base. Read operations cost $0.001, writes cost $0.005, and entity creation costs $0.01. No API keys or signup required.
|
package/dist/Q00bsAgent.d.ts
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* modules (trust, escrow, consensus, discovery) behind a clean interface.
|
|
6
6
|
*
|
|
7
7
|
* WHAT THIS CLASS DOES:
|
|
8
|
-
* -
|
|
8
|
+
* - Creates a Privy wallet via the Q00bs Trust API (wallets managed by Q00bs).
|
|
9
9
|
* - Registers the agent on-chain as an ERC-721 on the owner's q00b.
|
|
10
10
|
* - Provides methods for trust verification, agent discovery, payments, and consensus.
|
|
11
11
|
* - Enforces spend limits and trust-path checks BEFORE sending transactions.
|
|
12
12
|
*
|
|
13
|
-
* WALLET MODE —
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* WALLET MODE — Q00bs Trust API:
|
|
14
|
+
* All wallets are created and managed through the Q00bs Trust API, which
|
|
15
|
+
* uses Q00bs' own Privy infrastructure. You NEVER need to supply Privy
|
|
16
|
+
* credentials — just point the SDK at the Trust API URL.
|
|
17
17
|
*
|
|
18
18
|
* SECURITY GUARANTEES:
|
|
19
|
-
* - Private keys are held by
|
|
19
|
+
* - Private keys are held by Q00bs' Privy HSM and NEVER appear in your code.
|
|
20
20
|
* - All state-changing operations go through on-chain contracts.
|
|
21
21
|
* - Spend limits are enforced at 3 layers: Privy policy → SDK pre-check → on-chain.
|
|
22
22
|
* - Trust paths are verified on-chain through the q00b graph before communication.
|
|
@@ -24,28 +24,24 @@
|
|
|
24
24
|
* USAGE:
|
|
25
25
|
* ```ts
|
|
26
26
|
* const agent = new Q00bsAgent({
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* appSecret: process.env.PRIVY_APP_SECRET!,
|
|
30
|
-
* walletId: process.env.PRIVY_WALLET_ID, // optional, creates new if omitted
|
|
31
|
-
* },
|
|
32
|
-
* rpcUrl: process.env.BASE_RPC_URL!,
|
|
33
|
-
* registryAddress: '0x...',
|
|
27
|
+
* trustApiUrl: 'https://q00bs-trust-api.onrender.com',
|
|
28
|
+
* walletId: process.env.Q00BS_WALLET_ID, // optional — creates new if omitted
|
|
34
29
|
* });
|
|
35
30
|
* await agent.initialize();
|
|
31
|
+
* // → Wallet created under Q00bs' Privy app
|
|
32
|
+
* // → Store agent.walletId for next session
|
|
36
33
|
* ```
|
|
37
34
|
*/
|
|
38
|
-
import { PrivyWalletManager } from './privy';
|
|
39
35
|
import { ERC8004Manager } from './erc8004';
|
|
40
|
-
import type { AgentConfig, AgentRecord, TrustPath, AgentQuery, DiscoveredAgent, CreateEscrowParams, EscrowRecord, ConsensusParams, ConsensusResult, ConsensusRecord,
|
|
36
|
+
import type { AgentConfig, AgentRecord, TrustPath, AgentQuery, DiscoveredAgent, CreateEscrowParams, EscrowRecord, ConsensusParams, ConsensusResult, ConsensusRecord, ERC8004Identity, ERC8004ReputationSummary, ERC8004Feedback, GiveFeedbackParams } from './types';
|
|
41
37
|
export declare class Q00bsAgent {
|
|
42
38
|
private config;
|
|
43
39
|
private logger;
|
|
44
40
|
private publicClient;
|
|
45
41
|
private walletClient?;
|
|
46
42
|
private walletAddress;
|
|
43
|
+
private _walletId?;
|
|
47
44
|
private privyManager?;
|
|
48
|
-
private _walletMode;
|
|
49
45
|
private trustResolver;
|
|
50
46
|
private escrowManager?;
|
|
51
47
|
private consensusManager?;
|
|
@@ -57,47 +53,46 @@ export declare class Q00bsAgent {
|
|
|
57
53
|
get agentId(): number | undefined;
|
|
58
54
|
/** Whether initialize() has been called. */
|
|
59
55
|
get initialized(): boolean;
|
|
60
|
-
/** The agent's wallet address (
|
|
56
|
+
/** The agent's wallet address (created by Q00bs' Privy infrastructure). */
|
|
61
57
|
get address(): string;
|
|
62
|
-
/**
|
|
63
|
-
get
|
|
64
|
-
/** Whether this agent uses a Privy-managed wallet (Mode 2). */
|
|
65
|
-
get isPrivyMode(): boolean;
|
|
66
|
-
/** The Privy wallet manager (only available in Mode 2). */
|
|
67
|
-
get privyWallet(): PrivyWalletManager | undefined;
|
|
58
|
+
/** The wallet ID for this agent. Store this to reuse the wallet across sessions. */
|
|
59
|
+
get walletId(): string | undefined;
|
|
68
60
|
/** The ERC-8004 manager (available if erc8004 config is set or after initialize). */
|
|
69
61
|
get erc8004(): ERC8004Manager | undefined;
|
|
70
62
|
/**
|
|
71
63
|
* Create a new Q00bsAgent.
|
|
72
64
|
*
|
|
73
|
-
* @param config - Agent configuration. Must include `
|
|
65
|
+
* @param config - Agent configuration. Must include `trustApiUrl`.
|
|
74
66
|
*
|
|
75
67
|
* NOTE: This does NOT connect to the blockchain yet. Call initialize() next.
|
|
76
68
|
*/
|
|
77
69
|
constructor(config: AgentConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Make an authenticated request to the Q00bs Trust API.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
private apiCall;
|
|
78
75
|
/**
|
|
79
76
|
* Initialize blockchain connections and sub-modules.
|
|
80
77
|
* Must be called before any other method.
|
|
81
78
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* If no walletId is set, creates a new wallet via the Q00bs Trust API.
|
|
80
|
+
* All wallets are managed by Q00bs' Privy infrastructure — you never
|
|
81
|
+
* need Privy credentials.
|
|
84
82
|
*
|
|
85
|
-
* @
|
|
86
|
-
* @throws If configuration is invalid.
|
|
83
|
+
* @throws If configuration is invalid or API is unreachable.
|
|
87
84
|
*/
|
|
88
|
-
initialize(
|
|
85
|
+
initialize(): Promise<void>;
|
|
89
86
|
/**
|
|
90
87
|
* Register this agent on-chain on one side of the owner's q00b.
|
|
91
88
|
*
|
|
89
|
+
* Routes through the Q00bs Trust API, which handles the on-chain transaction
|
|
90
|
+
* using Q00bs' Privy infrastructure. No Privy credentials needed.
|
|
91
|
+
*
|
|
92
92
|
* @param ownerQ00bAddress - The q00b contract address owned by this agent's human.
|
|
93
93
|
* @param sidePosition - Which side of the q00b (0-5) to occupy.
|
|
94
94
|
* @returns The new agent's on-chain ID.
|
|
95
95
|
*
|
|
96
|
-
* IMPORTANT: The transaction sender must be the q00b OWNER (not the agent wallet).
|
|
97
|
-
* In practice, the owner calls registerAgent() from their wallet, passing
|
|
98
|
-
* the agent's wallet address. This method is for convenience when the owner's
|
|
99
|
-
* private key is used.
|
|
100
|
-
*
|
|
101
96
|
* @example
|
|
102
97
|
* ```ts
|
|
103
98
|
* const agentId = await agent.register('0xMyQ00bAddress', 0);
|
|
@@ -182,43 +177,38 @@ export declare class Q00bsAgent {
|
|
|
182
177
|
*/
|
|
183
178
|
getConsensusRequest(requestId: number): Promise<ConsensusRecord>;
|
|
184
179
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* @returns The Privy wallet info, or undefined if not in Privy mode.
|
|
188
|
-
*/
|
|
189
|
-
getPrivyWalletInfo(): PrivyWalletInfo | undefined;
|
|
190
|
-
/**
|
|
191
|
-
* Update the spending policy on this agent's Privy wallet (Mode 2 only).
|
|
180
|
+
* Update the spending policy on this agent's wallet.
|
|
192
181
|
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
182
|
+
* Routes through the Q00bs Trust API. Use this to dynamically adjust
|
|
183
|
+
* limits — for example, after the agent gains more trust.
|
|
195
184
|
*
|
|
196
|
-
* @param policy -
|
|
197
|
-
* @throws
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* ```ts
|
|
201
|
-
* await agent.updatePrivyPolicy({
|
|
202
|
-
* name: 'Elevated Limits',
|
|
203
|
-
* rules: [
|
|
204
|
-
* { type: 'max_transaction_value', value: '0.5' },
|
|
205
|
-
* { type: 'daily_spend_limit', value: '5.0' },
|
|
206
|
-
* ],
|
|
207
|
-
* });
|
|
208
|
-
* ```
|
|
185
|
+
* @param policy - Policy parameters to update.
|
|
186
|
+
* @throws If wallet is not initialized or API call fails.
|
|
209
187
|
*/
|
|
210
|
-
|
|
188
|
+
updateWalletPolicy(policy: {
|
|
189
|
+
maxTransactionValue?: string;
|
|
190
|
+
dailySpendLimit?: string;
|
|
191
|
+
}): Promise<void>;
|
|
211
192
|
/**
|
|
212
193
|
* Sign a message with this agent's wallet.
|
|
213
194
|
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* - Mode 2: Uses Privy's signMessage API
|
|
195
|
+
* Routes through the Q00bs Trust API for signing. The private key
|
|
196
|
+
* never leaves Q00bs' Privy infrastructure.
|
|
217
197
|
*
|
|
218
198
|
* @param message - The message to sign.
|
|
219
199
|
* @returns The signature hex string.
|
|
220
200
|
*/
|
|
221
201
|
signMessage(message: string): Promise<string>;
|
|
202
|
+
/**
|
|
203
|
+
* Send a transaction through the Q00bs Trust API.
|
|
204
|
+
* All transactions are policy-checked before broadcast.
|
|
205
|
+
*
|
|
206
|
+
* @param to - Destination address.
|
|
207
|
+
* @param value - ETH value in wei (optional).
|
|
208
|
+
* @param data - Encoded calldata (optional).
|
|
209
|
+
* @returns Transaction hash.
|
|
210
|
+
*/
|
|
211
|
+
sendTransaction(to: string, value?: string, data?: string): Promise<string>;
|
|
222
212
|
/**
|
|
223
213
|
* Register this agent's ERC-8004 identity in the IdentityRegistry.
|
|
224
214
|
*
|
package/dist/Q00bsAgent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Q00bsAgent.d.ts","sourceRoot":"","sources":["../src/Q00bsAgent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Q00bsAgent.d.ts","sourceRoot":"","sources":["../src/Q00bsAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAWH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAc3C,OAAO,KAAK,EACV,WAAW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