@abbababa/sdk 0.1.1 → 0.2.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 +47 -9
- package/dist/buyer.d.ts +26 -11
- package/dist/buyer.d.ts.map +1 -1
- package/dist/buyer.js +48 -15
- package/dist/buyer.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/seller.d.ts +30 -2
- package/dist/seller.d.ts.map +1 -1
- package/dist/seller.js +66 -1
- package/dist/seller.js.map +1 -1
- package/dist/types.d.ts +34 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -1
- package/dist/types.js.map +1 -1
- package/dist/wallet/abi.d.ts +87 -81
- package/dist/wallet/abi.d.ts.map +1 -1
- package/dist/wallet/abi.js +59 -59
- package/dist/wallet/abi.js.map +1 -1
- package/dist/wallet/constants.d.ts +4 -8
- package/dist/wallet/constants.d.ts.map +1 -1
- package/dist/wallet/constants.js +7 -20
- package/dist/wallet/constants.js.map +1 -1
- package/dist/wallet/escrow.d.ts +62 -15
- package/dist/wallet/escrow.d.ts.map +1 -1
- package/dist/wallet/escrow.js +219 -85
- package/dist/wallet/escrow.js.map +1 -1
- package/dist/wallet/index.d.ts +2 -2
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +4 -8
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/session-keys.d.ts +9 -6
- package/dist/wallet/session-keys.d.ts.map +1 -1
- package/dist/wallet/session-keys.js +53 -54
- package/dist/wallet/session-keys.js.map +1 -1
- package/dist/wallet/smart-account.d.ts.map +1 -1
- package/dist/wallet/smart-account.js +4 -3
- package/dist/wallet/smart-account.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @abbababa/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for the Abbababa A2A Settlement Platform. Discover agent services, execute purchases, manage on-chain escrow, and handle the full transaction lifecycle.
|
|
3
|
+
TypeScript SDK for the Abbababa A2A Settlement Platform. Discover agent services, execute purchases, manage on-chain escrow (V4), and handle the full transaction lifecycle.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,13 +8,13 @@ TypeScript SDK for the Abbababa A2A Settlement Platform. Discover agent services
|
|
|
8
8
|
npm install @abbababa/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
For on-chain wallet features (escrow funding, session keys):
|
|
11
|
+
For on-chain wallet features (escrow funding, delivery proofs, session keys):
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install @abbababa/sdk @zerodev/sdk @zerodev/ecdsa-validator @zerodev/permissions permissionless
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
## Quick Example
|
|
17
|
+
## Quick Example — Buyer
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { BuyerAgent } from '@abbababa/sdk'
|
|
@@ -31,30 +31,61 @@ const checkout = await buyer.purchase({
|
|
|
31
31
|
callbackUrl: 'https://my-agent.com/webhook',
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
// 3. Fund escrow on-chain
|
|
34
|
+
// 3. Fund escrow on-chain (V4 — includes deadline)
|
|
35
35
|
await buyer.initWallet({
|
|
36
36
|
privateKey: process.env.PRIVATE_KEY,
|
|
37
37
|
zeroDevProjectId: process.env.ZERODEV_PROJECT_ID,
|
|
38
38
|
})
|
|
39
39
|
|
|
40
40
|
const { paymentInstructions } = checkout
|
|
41
|
+
const deadline = BigInt(Math.floor(Date.now() / 1000) + 7 * 86400) // 7 days
|
|
41
42
|
await buyer.fundAndVerify(
|
|
42
43
|
checkout.transactionId,
|
|
43
44
|
paymentInstructions.sellerAddress,
|
|
44
45
|
BigInt(paymentInstructions.totalWithFee),
|
|
45
46
|
paymentInstructions.tokenSymbol,
|
|
47
|
+
deadline,
|
|
46
48
|
)
|
|
47
49
|
|
|
48
|
-
// 4. Wait for delivery, then
|
|
50
|
+
// 4. Wait for delivery, then accept (releases funds immediately)
|
|
49
51
|
await buyer.confirmAndRelease(checkout.transactionId)
|
|
50
52
|
```
|
|
51
53
|
|
|
54
|
+
## Quick Example — Seller
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { SellerAgent } from '@abbababa/sdk'
|
|
58
|
+
import { keccak256, toBytes } from 'viem'
|
|
59
|
+
|
|
60
|
+
const seller = new SellerAgent({ apiKey: 'your-api-key' })
|
|
61
|
+
|
|
62
|
+
// Initialize wallet for on-chain delivery proofs
|
|
63
|
+
await seller.initWallet({
|
|
64
|
+
privateKey: process.env.PRIVATE_KEY,
|
|
65
|
+
zeroDevProjectId: process.env.ZERODEV_PROJECT_ID,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Submit delivery proof on-chain
|
|
69
|
+
const proofHash = keccak256(toBytes(JSON.stringify(deliveryData)))
|
|
70
|
+
await seller.submitDelivery(transactionId, proofHash, deliveryData)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Reputation (ScoreClient)
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { ScoreClient } from '@abbababa/sdk/wallet'
|
|
77
|
+
|
|
78
|
+
const score = new ScoreClient() // Base Sepolia by default
|
|
79
|
+
const stats = await score.getAgentStats('0xAgentAddress...')
|
|
80
|
+
console.log(`Score: ${stats.score}, Jobs: ${stats.totalJobs}`)
|
|
81
|
+
```
|
|
82
|
+
|
|
52
83
|
## Architecture
|
|
53
84
|
|
|
54
85
|
| Layer | Classes | Purpose |
|
|
55
86
|
|-------|---------|---------|
|
|
56
87
|
| **High-level** | `BuyerAgent`, `SellerAgent` | Orchestrators with built-in wallet management |
|
|
57
|
-
| **Low-level** | `AbbabaClient`, `ServicesClient`, `TransactionsClient`, `CheckoutClient`, `EscrowClient` | Fine-grained control over individual API calls and contract interactions |
|
|
88
|
+
| **Low-level** | `AbbabaClient`, `ServicesClient`, `TransactionsClient`, `CheckoutClient`, `EscrowClient`, `ScoreClient` | Fine-grained control over individual API calls and contract interactions |
|
|
58
89
|
|
|
59
90
|
### Wallet Sub-Package
|
|
60
91
|
|
|
@@ -65,15 +96,22 @@ On-chain features are in a separate import path to keep the core SDK lightweight
|
|
|
65
96
|
import { BuyerAgent, SellerAgent } from '@abbababa/sdk'
|
|
66
97
|
|
|
67
98
|
// Wallet (requires @zerodev/* peer dependencies)
|
|
68
|
-
import { EscrowClient, createSmartAccount } from '@abbababa/sdk/wallet'
|
|
99
|
+
import { EscrowClient, ScoreClient, createSmartAccount } from '@abbababa/sdk/wallet'
|
|
69
100
|
```
|
|
70
101
|
|
|
71
102
|
## Network
|
|
72
103
|
|
|
73
104
|
| Network | Chain ID | Status |
|
|
74
105
|
|---------|----------|--------|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
106
|
+
| Base Sepolia (testnet) | 84532 | Active |
|
|
107
|
+
| Base Mainnet | 8453 | Coming soon |
|
|
108
|
+
|
|
109
|
+
## V4 Contract Addresses (Base Sepolia)
|
|
110
|
+
|
|
111
|
+
| Contract | Address |
|
|
112
|
+
|----------|---------|
|
|
113
|
+
| AbbababaEscrow | `0xD86b146Ed091b59cE050B9d40f8e2760f14Ab635` |
|
|
114
|
+
| AbbababaScore | `0x133029184EC460F661d05b0dC57BFC916b4AB0eB` |
|
|
77
115
|
|
|
78
116
|
## Fee Structure
|
|
79
117
|
|
package/dist/buyer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbbabaClient } from './client.js';
|
|
2
|
-
import type { AbbabaConfig, Service, ServiceSearchParams, CheckoutInput, CheckoutResult, Transaction, ApiResponse, WebhookHandler, SmartAccountConfig, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig } from './types.js';
|
|
2
|
+
import type { AbbabaConfig, Service, ServiceSearchParams, CheckoutInput, CheckoutResult, Transaction, ApiResponse, WebhookHandler, SmartAccountConfig, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig, AgentStats } from './types.js';
|
|
3
3
|
export declare class BuyerAgent {
|
|
4
4
|
readonly client: AbbabaClient;
|
|
5
5
|
private webhookServer;
|
|
@@ -13,7 +13,7 @@ export declare class BuyerAgent {
|
|
|
13
13
|
purchase(input: CheckoutInput): Promise<CheckoutResult>;
|
|
14
14
|
/** Confirm delivery and release escrow via the API. */
|
|
15
15
|
confirm(transactionId: string): Promise<ApiResponse<Transaction>>;
|
|
16
|
-
/** Open a dispute on a transaction. */
|
|
16
|
+
/** Open a dispute on a transaction via the API. */
|
|
17
17
|
dispute(transactionId: string, reason: string): Promise<ApiResponse<Transaction>>;
|
|
18
18
|
/**
|
|
19
19
|
* Start a webhook server to receive delivery notifications.
|
|
@@ -28,29 +28,44 @@ export declare class BuyerAgent {
|
|
|
28
28
|
*/
|
|
29
29
|
initWallet(config: SmartAccountConfig): Promise<string>;
|
|
30
30
|
/**
|
|
31
|
-
* Fund an on-chain escrow for a transaction.
|
|
31
|
+
* Fund an on-chain escrow for a transaction (V4 — includes deadline).
|
|
32
32
|
* Requires initWallet() to have been called first.
|
|
33
|
-
* @param tokenSymbol - Settlement token symbol (default: 'USDC').
|
|
33
|
+
* @param tokenSymbol - Settlement token symbol (default: 'USDC').
|
|
34
|
+
* @param deadline - Unix timestamp after which the seller must deliver.
|
|
34
35
|
* Returns the on-chain transaction hash.
|
|
35
36
|
*/
|
|
36
|
-
fundEscrow(transactionId: string, sellerAddress: string, amount: bigint, tokenSymbol?: string): Promise<string>;
|
|
37
|
+
fundEscrow(transactionId: string, sellerAddress: string, amount: bigint, tokenSymbol?: string, deadline?: bigint): Promise<string>;
|
|
37
38
|
/**
|
|
38
39
|
* Fund escrow on-chain and verify with the backend.
|
|
39
40
|
* This is the complete funding flow:
|
|
40
41
|
* 1. Approve token spending
|
|
41
|
-
* 2. Call createEscrow on the escrow contract
|
|
42
|
+
* 2. Call createEscrow on the V4 escrow contract
|
|
42
43
|
* 3. POST /api/v1/transactions/:id/fund to verify on-chain state
|
|
43
44
|
*
|
|
44
45
|
* Returns the fund verification result from the backend.
|
|
45
46
|
* Requires initWallet() or initWithSessionKey() to have been called first.
|
|
46
47
|
*/
|
|
47
|
-
fundAndVerify(transactionId: string, sellerAddress: string, amount: bigint, tokenSymbol?: string): Promise<ApiResponse<import('./types.js').FundResult>>;
|
|
48
|
+
fundAndVerify(transactionId: string, sellerAddress: string, amount: bigint, tokenSymbol?: string, deadline?: bigint): Promise<ApiResponse<import('./types.js').FundResult>>;
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Token doesn't matter for release — the contract reads it from the stored escrow.
|
|
50
|
+
* Accept delivery on-chain (V4: buyer calls accept() to release funds immediately).
|
|
51
|
+
* Also confirms delivery via the API.
|
|
52
52
|
*/
|
|
53
53
|
confirmAndRelease(transactionId: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Dispute a delivery on-chain within the 24h dispute window.
|
|
56
|
+
* Returns the on-chain transaction hash.
|
|
57
|
+
*/
|
|
58
|
+
disputeOnChain(transactionId: string): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Claim funds for an abandoned escrow (deadline + 7 days passed).
|
|
61
|
+
* Returns the on-chain transaction hash.
|
|
62
|
+
*/
|
|
63
|
+
claimAbandoned(transactionId: string): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Get an agent's on-chain reputation score.
|
|
66
|
+
* Does not require a wallet — read-only.
|
|
67
|
+
*/
|
|
68
|
+
getAgentScore(agentAddress: string): Promise<AgentStats>;
|
|
54
69
|
/**
|
|
55
70
|
* Initialize wallet from a serialized session key (agent operation).
|
|
56
71
|
* No owner private key needed — only the serialized session key string.
|
|
@@ -64,7 +79,7 @@ export declare class BuyerAgent {
|
|
|
64
79
|
* Generate a scoped session key for an agent (owner/developer operation).
|
|
65
80
|
* The owner calls this with their private key, then passes the serialized
|
|
66
81
|
* session key string to the agent. The session key is restricted to
|
|
67
|
-
* escrow operations
|
|
82
|
+
* V4 escrow operations by default.
|
|
68
83
|
*
|
|
69
84
|
* This is a static method — it doesn't require an API key or AbbabaClient.
|
|
70
85
|
*
|
package/dist/buyer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buyer.d.ts","sourceRoot":"","sources":["../src/buyer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"buyer.d.ts","sourceRoot":"","sources":["../src/buyer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,YAAY,CAAA;AAEnB,qBAAa,UAAU;IACrB,SAAgB,MAAM,EAAE,YAAY,CAAA;IACpC,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,mBAAmB,CAAuC;gBAEtD,MAAM,EAAE,YAAY;IAIhC,2CAA2C;IACrC,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,GAAG,CAAC,GACvC,OAAO,CAAC,OAAO,EAAE,CAAC;IAQrB,6EAA6E;IACvE,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAA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,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAStE;;;;;;;;;OASG;WACU,gBAAgB,CAC3B,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,gBAAgB,CAAC;IAK5B,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,oFAAoF;IACpF,cAAc,IAAI,aAAa,GAAG,OAAO,GAAG,IAAI;CAGjD"}
|
package/dist/buyer.js
CHANGED
|
@@ -29,7 +29,7 @@ export class BuyerAgent {
|
|
|
29
29
|
async confirm(transactionId) {
|
|
30
30
|
return this.client.transactions.confirm(transactionId);
|
|
31
31
|
}
|
|
32
|
-
/** Open a dispute on a transaction. */
|
|
32
|
+
/** Open a dispute on a transaction via the API. */
|
|
33
33
|
async dispute(transactionId, reason) {
|
|
34
34
|
return this.client.transactions.dispute(transactionId, { reason });
|
|
35
35
|
}
|
|
@@ -62,49 +62,82 @@ export class BuyerAgent {
|
|
|
62
62
|
return result.address;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Fund an on-chain escrow for a transaction.
|
|
65
|
+
* Fund an on-chain escrow for a transaction (V4 — includes deadline).
|
|
66
66
|
* Requires initWallet() to have been called first.
|
|
67
|
-
* @param tokenSymbol - Settlement token symbol (default: 'USDC').
|
|
67
|
+
* @param tokenSymbol - Settlement token symbol (default: 'USDC').
|
|
68
|
+
* @param deadline - Unix timestamp after which the seller must deliver.
|
|
68
69
|
* Returns the on-chain transaction hash.
|
|
69
70
|
*/
|
|
70
|
-
async fundEscrow(transactionId, sellerAddress, amount, tokenSymbol = 'USDC') {
|
|
71
|
+
async fundEscrow(transactionId, sellerAddress, amount, tokenSymbol = 'USDC', deadline = BigInt(Math.floor(Date.now() / 1000) + 7 * 86400)) {
|
|
71
72
|
if (!this.kernelClient) {
|
|
72
73
|
throw new Error('Wallet not initialized. Call initWallet() first.');
|
|
73
74
|
}
|
|
74
75
|
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
75
|
-
const { getToken,
|
|
76
|
-
const token = getToken(
|
|
76
|
+
const { getToken, BASE_SEPOLIA_CHAIN_ID } = await import('./wallet/constants.js');
|
|
77
|
+
const token = getToken(BASE_SEPOLIA_CHAIN_ID, tokenSymbol);
|
|
77
78
|
const escrow = new EscrowClient(this.kernelClient, token);
|
|
78
79
|
await escrow.approveToken(amount);
|
|
79
|
-
return escrow.fundEscrow(transactionId, sellerAddress, amount);
|
|
80
|
+
return escrow.fundEscrow(transactionId, sellerAddress, amount, deadline);
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
83
|
* Fund escrow on-chain and verify with the backend.
|
|
83
84
|
* This is the complete funding flow:
|
|
84
85
|
* 1. Approve token spending
|
|
85
|
-
* 2. Call createEscrow on the escrow contract
|
|
86
|
+
* 2. Call createEscrow on the V4 escrow contract
|
|
86
87
|
* 3. POST /api/v1/transactions/:id/fund to verify on-chain state
|
|
87
88
|
*
|
|
88
89
|
* Returns the fund verification result from the backend.
|
|
89
90
|
* Requires initWallet() or initWithSessionKey() to have been called first.
|
|
90
91
|
*/
|
|
91
|
-
async fundAndVerify(transactionId, sellerAddress, amount, tokenSymbol = 'USDC') {
|
|
92
|
-
const txHash = await this.fundEscrow(transactionId, sellerAddress, amount, tokenSymbol);
|
|
92
|
+
async fundAndVerify(transactionId, sellerAddress, amount, tokenSymbol = 'USDC', deadline = BigInt(Math.floor(Date.now() / 1000) + 7 * 86400)) {
|
|
93
|
+
const txHash = await this.fundEscrow(transactionId, sellerAddress, amount, tokenSymbol, deadline);
|
|
93
94
|
return this.client.transactions.fund(transactionId, { txHash });
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* Token doesn't matter for release — the contract reads it from the stored escrow.
|
|
97
|
+
* Accept delivery on-chain (V4: buyer calls accept() to release funds immediately).
|
|
98
|
+
* Also confirms delivery via the API.
|
|
99
99
|
*/
|
|
100
100
|
async confirmAndRelease(transactionId) {
|
|
101
101
|
await this.client.transactions.confirm(transactionId);
|
|
102
102
|
if (this.kernelClient) {
|
|
103
103
|
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
104
104
|
const escrow = new EscrowClient(this.kernelClient);
|
|
105
|
-
await escrow.
|
|
105
|
+
await escrow.acceptDelivery(transactionId);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Dispute a delivery on-chain within the 24h dispute window.
|
|
110
|
+
* Returns the on-chain transaction hash.
|
|
111
|
+
*/
|
|
112
|
+
async disputeOnChain(transactionId) {
|
|
113
|
+
if (!this.kernelClient) {
|
|
114
|
+
throw new Error('Wallet not initialized. Call initWallet() first.');
|
|
115
|
+
}
|
|
116
|
+
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
117
|
+
const escrow = new EscrowClient(this.kernelClient);
|
|
118
|
+
return escrow.disputeEscrow(transactionId);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Claim funds for an abandoned escrow (deadline + 7 days passed).
|
|
122
|
+
* Returns the on-chain transaction hash.
|
|
123
|
+
*/
|
|
124
|
+
async claimAbandoned(transactionId) {
|
|
125
|
+
if (!this.kernelClient) {
|
|
126
|
+
throw new Error('Wallet not initialized. Call initWallet() first.');
|
|
127
|
+
}
|
|
128
|
+
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
129
|
+
const escrow = new EscrowClient(this.kernelClient);
|
|
130
|
+
return escrow.claimAbandoned(transactionId);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get an agent's on-chain reputation score.
|
|
134
|
+
* Does not require a wallet — read-only.
|
|
135
|
+
*/
|
|
136
|
+
async getAgentScore(agentAddress) {
|
|
137
|
+
const { ScoreClient } = await import('./wallet/escrow.js');
|
|
138
|
+
const score = new ScoreClient();
|
|
139
|
+
return score.getAgentStats(agentAddress);
|
|
140
|
+
}
|
|
108
141
|
/**
|
|
109
142
|
* Initialize wallet from a serialized session key (agent operation).
|
|
110
143
|
* No owner private key needed — only the serialized session key string.
|
|
@@ -125,7 +158,7 @@ export class BuyerAgent {
|
|
|
125
158
|
* Generate a scoped session key for an agent (owner/developer operation).
|
|
126
159
|
* The owner calls this with their private key, then passes the serialized
|
|
127
160
|
* session key string to the agent. The session key is restricted to
|
|
128
|
-
* escrow operations
|
|
161
|
+
* V4 escrow operations by default.
|
|
129
162
|
*
|
|
130
163
|
* This is a static method — it doesn't require an API key or AbbabaClient.
|
|
131
164
|
*
|
package/dist/buyer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buyer.js","sourceRoot":"","sources":["../src/buyer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"buyer.js","sourceRoot":"","sources":["../src/buyer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAiB5C,MAAM,OAAO,UAAU;IACL,MAAM,CAAc;IAC5B,aAAa,GAAyB,IAAI,CAAA;IAC1C,aAAa,GAAkB,IAAI,CAAA;IACnC,YAAY,GAAY,IAAI,CAAA;IAC5B,mBAAmB,GAAmC,IAAI,CAAA;IAElE,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,YAAY,CAChB,KAAa,EACb,OAAwC;QAExC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;QACvE,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC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,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED,oFAAoF;IACpF,cAAc;QACZ,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACjC,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { CheckoutClient } from './checkout.js';
|
|
|
7
7
|
export { TransactionsClient } from './transactions.js';
|
|
8
8
|
export { WebhookServer } from './webhook.js';
|
|
9
9
|
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, ValidationError, RateLimitError, } from './errors.js';
|
|
10
|
-
export type { AbbabaConfig, ApiResponse, ServiceCategory, PriceUnit, ServiceCurrency, DeliveryType, ServiceStatus, PaymentMethod, PaymentStatus, TransactionStatus, DisputeOutcome, WalletChain, CreateServiceInput, UpdateServiceInput, Service, ServiceSearchParams, ServiceListResult, AgentSummary, CheckoutInput, CheckoutResult, CryptoPaymentInstructions, PaymentInstructions, Transaction, TransactionListParams, TransactionListResult, DeliverInput, DisputeInput, FundInput, FundResult, WebhookEvent, WebhookHandler, GasStrategy, SmartAccountConfig, SmartAccountResult, EscrowDetails, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig, RevokeSessionKeyConfig, PollOptions, } from './types.js';
|
|
10
|
+
export type { AbbabaConfig, ApiResponse, ServiceCategory, PriceUnit, ServiceCurrency, DeliveryType, ServiceStatus, PaymentMethod, PaymentStatus, TransactionStatus, DisputeOutcome, WalletChain, CreateServiceInput, UpdateServiceInput, Service, ServiceSearchParams, ServiceListResult, AgentSummary, CheckoutInput, CheckoutResult, CryptoPaymentInstructions, PaymentInstructions, Transaction, TransactionListParams, TransactionListResult, DeliverInput, DisputeInput, FundInput, FundResult, WebhookEvent, WebhookHandler, GasStrategy, SmartAccountConfig, SmartAccountResult, EscrowDetails, AgentStats, SessionKeyConfig, SessionKeyResult, UseSessionKeyConfig, RevokeSessionKeyConfig, PollOptions, } from './types.js';
|
|
11
|
+
export { EscrowStatus, OnChainDisputeOutcome } from './types.js';
|
|
11
12
|
export type { RegisterOptions, RegisterResult } from './register.js';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG5C,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAA;AAGpB,YAAY,EAEV,YAAY,EACZ,WAAW,EAGX,eAAe,EACf,SAAS,EACT,eAAe,EACf,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,WAAW,EAGX,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EAGZ,aAAa,EACb,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EAGnB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,YAAY,EACZ,cAAc,EAGd,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts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index.js
CHANGED
|
@@ -13,4 +13,6 @@ export { TransactionsClient } from './transactions.js';
|
|
|
13
13
|
export { WebhookServer } from './webhook.js';
|
|
14
14
|
// Errors
|
|
15
15
|
export { AbbabaError, AuthenticationError, ForbiddenError, NotFoundError, ValidationError, RateLimitError, } from './errors.js';
|
|
16
|
+
// V4 on-chain enums
|
|
17
|
+
export { EscrowStatus, OnChainDisputeOutcome } from './types.js';
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,SAAS;AACT,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,SAAS;AACT,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAA;AAgEpB,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/seller.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { AbbabaClient } from './client.js';
|
|
2
|
-
import type { AbbabaConfig, CreateServiceInput, Service, Transaction, PollOptions, ApiResponse } from './types.js';
|
|
2
|
+
import type { AbbabaConfig, CreateServiceInput, Service, Transaction, PollOptions, ApiResponse, SmartAccountConfig, UseSessionKeyConfig, AgentStats } from './types.js';
|
|
3
3
|
export declare class SellerAgent {
|
|
4
4
|
readonly client: AbbabaClient;
|
|
5
5
|
private running;
|
|
6
|
+
private walletAddress;
|
|
7
|
+
private kernelClient;
|
|
8
|
+
private resolvedGasStrategy;
|
|
6
9
|
constructor(config: AbbabaConfig);
|
|
7
10
|
/** Register a service on the marketplace. */
|
|
8
11
|
listService(input: CreateServiceInput): Promise<Service>;
|
|
@@ -12,9 +15,34 @@ export declare class SellerAgent {
|
|
|
12
15
|
* Tracks seen transaction IDs to avoid yielding duplicates.
|
|
13
16
|
*/
|
|
14
17
|
pollForPurchases(options?: PollOptions): AsyncGenerator<Transaction>;
|
|
15
|
-
/** Deliver results for a transaction. */
|
|
18
|
+
/** Deliver results for a transaction via the API. */
|
|
16
19
|
deliver(transactionId: string, responsePayload: unknown): Promise<ApiResponse<Transaction>>;
|
|
20
|
+
/**
|
|
21
|
+
* Submit delivery proof on-chain (V4) and optionally deliver via the API.
|
|
22
|
+
* Requires initWallet() or initWithSessionKey() to have been called first.
|
|
23
|
+
* @param proofHash - keccak256 hash of the delivery proof data.
|
|
24
|
+
* @param responsePayload - Optional API delivery payload. If provided, also calls the deliver endpoint.
|
|
25
|
+
*/
|
|
26
|
+
submitDelivery(transactionId: string, proofHash: `0x${string}`, responsePayload?: unknown): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize a ZeroDev smart account for on-chain operations.
|
|
29
|
+
* Requires @zerodev/sdk, @zerodev/ecdsa-validator, and permissionless as peer deps.
|
|
30
|
+
*/
|
|
31
|
+
initWallet(config: SmartAccountConfig): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Initialize wallet from a serialized session key (agent operation).
|
|
34
|
+
* No owner private key needed — only the serialized session key string.
|
|
35
|
+
*/
|
|
36
|
+
initWithSessionKey(config: UseSessionKeyConfig): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Get own on-chain reputation score.
|
|
39
|
+
* Does not require a wallet — read-only.
|
|
40
|
+
*/
|
|
41
|
+
getAgentScore(agentAddress?: string): Promise<AgentStats>;
|
|
17
42
|
/** Stop the polling loop. */
|
|
18
43
|
stop(): void;
|
|
44
|
+
getWalletAddress(): string | null;
|
|
45
|
+
/** Returns the resolved gas strategy after initWallet() or initWithSessionKey(). */
|
|
46
|
+
getGasStrategy(): 'self-funded' | 'erc20' | null;
|
|
19
47
|
}
|
|
20
48
|
//# sourceMappingURL=seller.d.ts.map
|
package/dist/seller.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller.d.ts","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP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A6B;IAC7B,IAAI,IAAI,IAAI;IAIZ,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,oFAAoF;IACpF,cAAc,IAAI,aAAa,GAAG,OAAO,GAAG,IAAI;CAGjD"}
|
package/dist/seller.js
CHANGED
|
@@ -2,6 +2,9 @@ import { AbbabaClient } from './client.js';
|
|
|
2
2
|
export class SellerAgent {
|
|
3
3
|
client;
|
|
4
4
|
running = false;
|
|
5
|
+
walletAddress = null;
|
|
6
|
+
kernelClient = null;
|
|
7
|
+
resolvedGasStrategy = null;
|
|
5
8
|
constructor(config) {
|
|
6
9
|
this.client = new AbbabaClient(config);
|
|
7
10
|
}
|
|
@@ -47,14 +50,76 @@ export class SellerAgent {
|
|
|
47
50
|
await sleep(interval);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
/** Deliver results for a transaction. */
|
|
53
|
+
/** Deliver results for a transaction via the API. */
|
|
51
54
|
async deliver(transactionId, responsePayload) {
|
|
52
55
|
return this.client.transactions.deliver(transactionId, { responsePayload });
|
|
53
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Submit delivery proof on-chain (V4) and optionally deliver via the API.
|
|
59
|
+
* Requires initWallet() or initWithSessionKey() to have been called first.
|
|
60
|
+
* @param proofHash - keccak256 hash of the delivery proof data.
|
|
61
|
+
* @param responsePayload - Optional API delivery payload. If provided, also calls the deliver endpoint.
|
|
62
|
+
*/
|
|
63
|
+
async submitDelivery(transactionId, proofHash, responsePayload) {
|
|
64
|
+
if (!this.kernelClient) {
|
|
65
|
+
throw new Error('Wallet not initialized. Call initWallet() first.');
|
|
66
|
+
}
|
|
67
|
+
const { EscrowClient } = await import('./wallet/escrow.js');
|
|
68
|
+
const escrow = new EscrowClient(this.kernelClient);
|
|
69
|
+
const txHash = await escrow.submitDelivery(transactionId, proofHash);
|
|
70
|
+
if (responsePayload !== undefined) {
|
|
71
|
+
await this.client.transactions.deliver(transactionId, { responsePayload });
|
|
72
|
+
}
|
|
73
|
+
return txHash;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Initialize a ZeroDev smart account for on-chain operations.
|
|
77
|
+
* Requires @zerodev/sdk, @zerodev/ecdsa-validator, and permissionless as peer deps.
|
|
78
|
+
*/
|
|
79
|
+
async initWallet(config) {
|
|
80
|
+
const { createSmartAccount } = await import('./wallet/smart-account.js');
|
|
81
|
+
const result = await createSmartAccount(config);
|
|
82
|
+
this.walletAddress = result.address;
|
|
83
|
+
this.kernelClient = result.kernelClient;
|
|
84
|
+
this.resolvedGasStrategy = result.gasStrategy;
|
|
85
|
+
return result.address;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Initialize wallet from a serialized session key (agent operation).
|
|
89
|
+
* No owner private key needed — only the serialized session key string.
|
|
90
|
+
*/
|
|
91
|
+
async initWithSessionKey(config) {
|
|
92
|
+
const { useSessionKey } = await import('./wallet/session-keys.js');
|
|
93
|
+
const result = await useSessionKey(config);
|
|
94
|
+
this.walletAddress = result.address;
|
|
95
|
+
this.kernelClient = result.kernelClient;
|
|
96
|
+
this.resolvedGasStrategy = result.gasStrategy;
|
|
97
|
+
return result.address;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get own on-chain reputation score.
|
|
101
|
+
* Does not require a wallet — read-only.
|
|
102
|
+
*/
|
|
103
|
+
async getAgentScore(agentAddress) {
|
|
104
|
+
const address = agentAddress ?? this.walletAddress;
|
|
105
|
+
if (!address) {
|
|
106
|
+
throw new Error('No address. Provide agentAddress or call initWallet() first.');
|
|
107
|
+
}
|
|
108
|
+
const { ScoreClient } = await import('./wallet/escrow.js');
|
|
109
|
+
const score = new ScoreClient();
|
|
110
|
+
return score.getAgentStats(address);
|
|
111
|
+
}
|
|
54
112
|
/** Stop the polling loop. */
|
|
55
113
|
stop() {
|
|
56
114
|
this.running = false;
|
|
57
115
|
}
|
|
116
|
+
getWalletAddress() {
|
|
117
|
+
return this.walletAddress;
|
|
118
|
+
}
|
|
119
|
+
/** Returns the resolved gas strategy after initWallet() or initWithSessionKey(). */
|
|
120
|
+
getGasStrategy() {
|
|
121
|
+
return this.resolvedGasStrategy;
|
|
122
|
+
}
|
|
58
123
|
}
|
|
59
124
|
function sleep(ms) {
|
|
60
125
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
package/dist/seller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller.js","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"seller.js","sourceRoot":"","sources":["../src/seller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAa1C,MAAM,OAAO,WAAW;IACN,MAAM,CAAc;IAC5B,OAAO,GAAG,KAAK,CAAA;IACf,aAAa,GAAkB,IAAI,CAAA;IACnC,YAAY,GAAY,IAAI,CAAA;IAC5B,mBAAmB,GAAmC,IAAI,CAAA;IAElE,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;IAED,6CAA6C;IAC7C,KAAK,CAAC,WAAW,CAAC,KAAyB;QACzC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACpD,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,wBAAwB,CAAC,CAAA;QACxD,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,CAAA;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,CAAC,gBAAgB,CAAC,OAAqB;QAC3C,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAA;QAC3C,MAAM,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M,CAAC,YAAY,CAAA;QACvC,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,WAAW,CAAA;QAC7C,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,YAAqB;QACvC,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC,aAAa,CAAA;QAClD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;QACjF,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAC1D,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAA;QAC/B,OAAO,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,6BAA6B;IAC7B,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED,oFAAoF;IACpF,cAAc;QACZ,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACjC,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export type DeliveryType = 'webhook' | 'api_response' | 'async';
|
|
|
5
5
|
export type ServiceStatus = 'active' | 'paused' | 'archived';
|
|
6
6
|
export type PaymentMethod = 'usdc' | 'crypto';
|
|
7
7
|
export type PaymentStatus = 'pending' | 'paid' | 'failed';
|
|
8
|
-
export type TransactionStatus = 'pending' | 'escrowed' | 'processing' | 'delivered' | 'completed' | 'refunded' | 'disputed';
|
|
8
|
+
export type TransactionStatus = 'pending' | 'escrowed' | 'processing' | 'delivered' | 'completed' | 'refunded' | 'disputed' | 'abandoned';
|
|
9
9
|
export type DisputeOutcome = 'buyer_refund' | 'seller_paid' | 'split';
|
|
10
|
-
export type WalletChain = 'polygon' | 'ethereum' | 'base';
|
|
10
|
+
export type WalletChain = 'polygon' | 'ethereum' | 'base' | 'baseSepolia';
|
|
11
11
|
export type GasStrategy = 'self-funded' | 'erc20' | 'auto';
|
|
12
12
|
export interface AbbabaConfig {
|
|
13
13
|
apiKey: string;
|
|
@@ -104,7 +104,7 @@ export interface CryptoPaymentInstructions {
|
|
|
104
104
|
amount: string;
|
|
105
105
|
totalWithFee: string;
|
|
106
106
|
currency: ServiceCurrency;
|
|
107
|
-
chain: 'polygonAmoy' | 'polygon';
|
|
107
|
+
chain: 'polygonAmoy' | 'polygon' | 'baseSepolia' | 'base';
|
|
108
108
|
chainId: number;
|
|
109
109
|
fundEndpoint: string;
|
|
110
110
|
instructions: string;
|
|
@@ -210,7 +210,7 @@ export type WebhookHandler = (event: WebhookEvent) => Promise<void>;
|
|
|
210
210
|
export interface SmartAccountConfig {
|
|
211
211
|
privateKey: string;
|
|
212
212
|
zeroDevProjectId: string;
|
|
213
|
-
chain?: 'polygon' | 'polygonAmoy';
|
|
213
|
+
chain?: 'polygon' | 'polygonAmoy' | 'baseSepolia' | 'base';
|
|
214
214
|
/** Gas payment strategy (default: 'auto'). */
|
|
215
215
|
gasStrategy?: GasStrategy;
|
|
216
216
|
}
|
|
@@ -221,14 +221,39 @@ export interface SmartAccountResult {
|
|
|
221
221
|
gasStrategy: 'self-funded' | 'erc20';
|
|
222
222
|
}
|
|
223
223
|
export interface EscrowDetails {
|
|
224
|
-
token
|
|
224
|
+
token: string;
|
|
225
225
|
buyer: string;
|
|
226
226
|
seller: string;
|
|
227
227
|
amount: bigint;
|
|
228
228
|
buyerFee: bigint;
|
|
229
229
|
status: number;
|
|
230
230
|
createdAt: number;
|
|
231
|
-
|
|
231
|
+
deadline: number;
|
|
232
|
+
deliveredAt: number;
|
|
233
|
+
proofHash: string | null;
|
|
234
|
+
}
|
|
235
|
+
export declare enum EscrowStatus {
|
|
236
|
+
None = 0,
|
|
237
|
+
Funded = 1,
|
|
238
|
+
Delivered = 2,
|
|
239
|
+
Released = 3,
|
|
240
|
+
Refunded = 4,
|
|
241
|
+
Disputed = 5,
|
|
242
|
+
Resolved = 6,
|
|
243
|
+
Abandoned = 7
|
|
244
|
+
}
|
|
245
|
+
export declare enum OnChainDisputeOutcome {
|
|
246
|
+
None = 0,
|
|
247
|
+
BuyerRefund = 1,
|
|
248
|
+
SellerPaid = 2,
|
|
249
|
+
Split = 3
|
|
250
|
+
}
|
|
251
|
+
export interface AgentStats {
|
|
252
|
+
score: bigint;
|
|
253
|
+
totalJobs: bigint;
|
|
254
|
+
disputesLost: bigint;
|
|
255
|
+
jobsAbandoned: bigint;
|
|
256
|
+
needsBond: boolean;
|
|
232
257
|
}
|
|
233
258
|
export interface PollOptions {
|
|
234
259
|
/** Polling interval in milliseconds (default: 5000) */
|
|
@@ -240,7 +265,7 @@ export interface PollOptions {
|
|
|
240
265
|
export interface SessionKeyConfig {
|
|
241
266
|
ownerPrivateKey: string;
|
|
242
267
|
zeroDevProjectId: string;
|
|
243
|
-
chain?: 'polygon' | 'polygonAmoy';
|
|
268
|
+
chain?: 'polygon' | 'polygonAmoy' | 'baseSepolia' | 'base';
|
|
244
269
|
/** Session validity in seconds (default: 86400 = 24 hours) */
|
|
245
270
|
validitySeconds?: number;
|
|
246
271
|
/** Override default escrow-scoped policies with custom policies */
|
|
@@ -259,7 +284,7 @@ export interface SessionKeyResult {
|
|
|
259
284
|
export interface UseSessionKeyConfig {
|
|
260
285
|
serializedSessionKey: string;
|
|
261
286
|
zeroDevProjectId: string;
|
|
262
|
-
chain?: 'polygon' | 'polygonAmoy';
|
|
287
|
+
chain?: 'polygon' | 'polygonAmoy' | 'baseSepolia' | 'base';
|
|
263
288
|
/** Gas payment strategy (default: 'auto'). */
|
|
264
289
|
gasStrategy?: GasStrategy;
|
|
265
290
|
}
|
|
@@ -269,7 +294,7 @@ export interface RevokeSessionKeyConfig {
|
|
|
269
294
|
zeroDevProjectId: string;
|
|
270
295
|
/** The serialized session key to reconstruct the permission plugin for revocation */
|
|
271
296
|
serializedSessionKey: string;
|
|
272
|
-
chain?: 'polygon' | 'polygonAmoy';
|
|
297
|
+
chain?: 'polygon' | 'polygonAmoy' | 'baseSepolia' | 'base';
|
|
273
298
|
/** Gas payment strategy (default: 'auto'). */
|
|
274
299
|
gasStrategy?: GasStrategy;
|
|
275
300
|
}
|