pay-lobster 3.2.0 → 4.0.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 +319 -125
- package/dist/client.d.ts +190 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +166 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +1075 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +309 -0
- package/dist/constants.js.map +1 -0
- package/dist/credit.d.ts +37 -0
- package/dist/credit.d.ts.map +1 -0
- package/dist/credit.js +101 -0
- package/dist/credit.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +83 -0
- package/dist/errors.js.map +1 -0
- package/dist/escrow.d.ts +58 -296
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +138 -812
- package/dist/escrow.js.map +1 -1
- package/dist/identity.d.ts +31 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +78 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +157 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +214 -90
- package/dist/index.js.map +1 -1
- package/dist/mandate.d.ts +47 -0
- package/dist/mandate.d.ts.map +1 -0
- package/dist/mandate.js +117 -0
- package/dist/mandate.js.map +1 -0
- package/dist/reputation.d.ts +42 -0
- package/dist/reputation.d.ts.map +1 -0
- package/dist/reputation.js +123 -0
- package/dist/reputation.js.map +1 -0
- package/dist/services.d.ts +54 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +194 -0
- package/dist/services.js.map +1 -0
- package/dist/types.d.ts +359 -113
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -5
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +35 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +192 -0
- package/dist/utils.js.map +1 -0
- package/package.json +19 -40
- package/src/client.ts +239 -0
- package/src/constants.ts +326 -0
- package/src/credit.ts +121 -0
- package/src/errors.ts +156 -0
- package/src/escrow.ts +234 -0
- package/src/identity.ts +87 -0
- package/src/index.ts +265 -0
- package/src/mandate.ts +141 -0
- package/src/reputation.ts +135 -0
- package/src/services.ts +260 -0
- package/src/types.ts +484 -0
- package/src/utils.ts +265 -0
- package/README.md.bak +0 -401
- package/dist/abis/IERC20.json +0 -185
- package/dist/abis/PayLobsterCredit.json +0 -952
- package/dist/abis/PayLobsterEscrowV3.json +0 -1069
- package/dist/abis/PayLobsterIdentity.json +0 -1001
- package/dist/abis/PayLobsterReputation.json +0 -707
- package/dist/agent-multichain.d.ts +0 -96
- package/dist/agent-multichain.d.ts.map +0 -1
- package/dist/agent-multichain.js +0 -195
- package/dist/agent-multichain.js.map +0 -1
- package/dist/agent.d.ts +0 -338
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -872
- package/dist/agent.js.map +0 -1
- package/dist/analytics.d.ts +0 -25
- package/dist/analytics.d.ts.map +0 -1
- package/dist/analytics.js +0 -111
- package/dist/analytics.js.map +0 -1
- package/dist/approvals.d.ts +0 -168
- package/dist/approvals.d.ts.map +0 -1
- package/dist/approvals.js +0 -406
- package/dist/approvals.js.map +0 -1
- package/dist/autonomous.d.ts +0 -132
- package/dist/autonomous.d.ts.map +0 -1
- package/dist/autonomous.js +0 -504
- package/dist/autonomous.js.map +0 -1
- package/dist/chains/base.d.ts +0 -32
- package/dist/chains/base.d.ts.map +0 -1
- package/dist/chains/base.js +0 -89
- package/dist/chains/base.js.map +0 -1
- package/dist/chains/index.d.ts +0 -44
- package/dist/chains/index.d.ts.map +0 -1
- package/dist/chains/index.js +0 -123
- package/dist/chains/index.js.map +0 -1
- package/dist/chains/solana.d.ts +0 -45
- package/dist/chains/solana.d.ts.map +0 -1
- package/dist/chains/solana.js +0 -173
- package/dist/chains/solana.js.map +0 -1
- package/dist/chains/types.d.ts +0 -66
- package/dist/chains/types.d.ts.map +0 -1
- package/dist/chains/types.js +0 -7
- package/dist/chains/types.js.map +0 -1
- package/dist/circle-client.d.ts +0 -152
- package/dist/circle-client.d.ts.map +0 -1
- package/dist/circle-client.js +0 -266
- package/dist/circle-client.js.map +0 -1
- package/dist/cli.d.ts +0 -7
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -1860
- package/dist/cli.js.map +0 -1
- package/dist/commission.d.ts +0 -191
- package/dist/commission.d.ts.map +0 -1
- package/dist/commission.js +0 -475
- package/dist/commission.js.map +0 -1
- package/dist/condition-builder.d.ts +0 -98
- package/dist/condition-builder.d.ts.map +0 -1
- package/dist/condition-builder.js +0 -193
- package/dist/condition-builder.js.map +0 -1
- package/dist/contacts.d.ts +0 -179
- package/dist/contacts.d.ts.map +0 -1
- package/dist/contacts.js +0 -445
- package/dist/contacts.js.map +0 -1
- package/dist/contracts-v3.d.ts +0 -260
- package/dist/contracts-v3.d.ts.map +0 -1
- package/dist/contracts-v3.js +0 -371
- package/dist/contracts-v3.js.map +0 -1
- package/dist/contracts.d.ts +0 -19
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -58
- package/dist/contracts.js.map +0 -1
- package/dist/easy.d.ts +0 -22
- package/dist/easy.d.ts.map +0 -1
- package/dist/easy.js +0 -40
- package/dist/easy.js.map +0 -1
- package/dist/erc8004/constants.d.ts +0 -152
- package/dist/erc8004/constants.d.ts.map +0 -1
- package/dist/erc8004/constants.js +0 -114
- package/dist/erc8004/constants.js.map +0 -1
- package/dist/erc8004/discovery.d.ts +0 -84
- package/dist/erc8004/discovery.d.ts.map +0 -1
- package/dist/erc8004/discovery.js +0 -217
- package/dist/erc8004/discovery.js.map +0 -1
- package/dist/erc8004/identity.d.ts +0 -91
- package/dist/erc8004/identity.d.ts.map +0 -1
- package/dist/erc8004/identity.js +0 -250
- package/dist/erc8004/identity.js.map +0 -1
- package/dist/erc8004/index.d.ts +0 -147
- package/dist/erc8004/index.d.ts.map +0 -1
- package/dist/erc8004/index.js +0 -225
- package/dist/erc8004/index.js.map +0 -1
- package/dist/erc8004/reputation.d.ts +0 -133
- package/dist/erc8004/reputation.d.ts.map +0 -1
- package/dist/erc8004/reputation.js +0 -277
- package/dist/erc8004/reputation.js.map +0 -1
- package/dist/escrow-templates.d.ts +0 -38
- package/dist/escrow-templates.d.ts.map +0 -1
- package/dist/escrow-templates.js +0 -419
- package/dist/escrow-templates.js.map +0 -1
- package/dist/gamification.d.ts +0 -83
- package/dist/gamification.d.ts.map +0 -1
- package/dist/gamification.js +0 -331
- package/dist/gamification.js.map +0 -1
- package/dist/invoices.d.ts +0 -90
- package/dist/invoices.d.ts.map +0 -1
- package/dist/invoices.js +0 -241
- package/dist/invoices.js.map +0 -1
- package/dist/notifications.d.ts +0 -141
- package/dist/notifications.d.ts.map +0 -1
- package/dist/notifications.js +0 -350
- package/dist/notifications.js.map +0 -1
- package/dist/onramp.d.ts +0 -123
- package/dist/onramp.d.ts.map +0 -1
- package/dist/onramp.js +0 -204
- package/dist/onramp.js.map +0 -1
- package/dist/splits.d.ts +0 -53
- package/dist/splits.d.ts.map +0 -1
- package/dist/splits.js +0 -208
- package/dist/splits.js.map +0 -1
- package/dist/stats.d.ts +0 -73
- package/dist/stats.d.ts.map +0 -1
- package/dist/stats.js +0 -229
- package/dist/stats.js.map +0 -1
- package/dist/subscriptions.d.ts +0 -96
- package/dist/subscriptions.d.ts.map +0 -1
- package/dist/subscriptions.js +0 -281
- package/dist/subscriptions.js.map +0 -1
- package/dist/swap.d.ts +0 -57
- package/dist/swap.d.ts.map +0 -1
- package/dist/swap.js +0 -151
- package/dist/swap.js.map +0 -1
- package/dist/tips.d.ts +0 -171
- package/dist/tips.d.ts.map +0 -1
- package/dist/tips.js +0 -390
- package/dist/tips.js.map +0 -1
- package/dist/usernames.d.ts +0 -35
- package/dist/usernames.d.ts.map +0 -1
- package/dist/usernames.js +0 -142
- package/dist/usernames.js.map +0 -1
- package/dist/x402-client.d.ts +0 -127
- package/dist/x402-client.d.ts.map +0 -1
- package/dist/x402-client.js +0 -350
- package/dist/x402-client.js.map +0 -1
- package/dist/x402-server.d.ts +0 -133
- package/dist/x402-server.d.ts.map +0 -1
- package/dist/x402-server.js +0 -330
- package/dist/x402-server.js.map +0 -1
- package/dist/x402.d.ts +0 -79
- package/dist/x402.d.ts.map +0 -1
- package/dist/x402.js +0 -171
- package/dist/x402.js.map +0 -1
- package/lib/abis/IERC20.json +0 -185
- package/lib/abis/PayLobsterCredit.json +0 -952
- package/lib/abis/PayLobsterEscrowV3.json +0 -1069
- package/lib/abis/PayLobsterIdentity.json +0 -1001
- package/lib/abis/PayLobsterReputation.json +0 -707
- package/lib/agent-multichain.ts +0 -265
- package/lib/agent.ts +0 -1019
- package/lib/agent.ts.multichain-backup +0 -965
- package/lib/analytics.ts +0 -136
- package/lib/analytics.ts.bak +0 -474
- package/lib/approvals.ts +0 -585
- package/lib/approvals.ts.bak +0 -585
- package/lib/autonomous.ts +0 -599
- package/lib/chains/base.ts +0 -107
- package/lib/chains/index.ts +0 -136
- package/lib/chains/solana.ts +0 -250
- package/lib/chains/types.ts +0 -76
- package/lib/circle-client.ts +0 -376
- package/lib/circle-client.ts.bak +0 -376
- package/lib/cli.ts +0 -2158
- package/lib/commission.ts +0 -680
- package/lib/commission.ts.bak +0 -680
- package/lib/condition-builder.ts +0 -223
- package/lib/condition-builder.ts.bak +0 -223
- package/lib/contacts.ts +0 -615
- package/lib/contacts.ts.bak +0 -615
- package/lib/contracts-v3.ts +0 -511
- package/lib/contracts.ts +0 -58
- package/lib/easy.ts +0 -46
- package/lib/easy.ts.bak +0 -352
- package/lib/erc8004/constants.ts +0 -175
- package/lib/erc8004/discovery.ts +0 -299
- package/lib/erc8004/identity.ts +0 -327
- package/lib/erc8004/index.ts +0 -285
- package/lib/erc8004/reputation.ts +0 -368
- package/lib/escrow-templates.ts +0 -462
- package/lib/escrow.ts +0 -1216
- package/lib/forge-std/.gitattributes +0 -1
- package/lib/forge-std/.github/CODEOWNERS +0 -1
- package/lib/forge-std/.github/dependabot.yml +0 -6
- package/lib/forge-std/.github/workflows/ci.yml +0 -125
- package/lib/forge-std/.github/workflows/sync.yml +0 -36
- package/lib/forge-std/CONTRIBUTING.md +0 -193
- package/lib/forge-std/LICENSE-APACHE +0 -203
- package/lib/forge-std/LICENSE-MIT +0 -25
- package/lib/forge-std/README.md +0 -268
- package/lib/forge-std/RELEASE_CHECKLIST.md +0 -12
- package/lib/forge-std/foundry.toml +0 -18
- package/lib/forge-std/package.json +0 -16
- package/lib/forge-std/scripts/vm.py +0 -636
- package/lib/forge-std/src/Base.sol +0 -48
- package/lib/forge-std/src/Config.sol +0 -60
- package/lib/forge-std/src/LibVariable.sol +0 -477
- package/lib/forge-std/src/Script.sol +0 -28
- package/lib/forge-std/src/StdAssertions.sol +0 -779
- package/lib/forge-std/src/StdChains.sol +0 -303
- package/lib/forge-std/src/StdCheats.sol +0 -825
- package/lib/forge-std/src/StdConfig.sol +0 -632
- package/lib/forge-std/src/StdConstants.sol +0 -30
- package/lib/forge-std/src/StdError.sol +0 -15
- package/lib/forge-std/src/StdInvariant.sol +0 -120
- package/lib/forge-std/src/StdJson.sol +0 -275
- package/lib/forge-std/src/StdMath.sol +0 -47
- package/lib/forge-std/src/StdStorage.sol +0 -475
- package/lib/forge-std/src/StdStyle.sol +0 -333
- package/lib/forge-std/src/StdToml.sol +0 -275
- package/lib/forge-std/src/StdUtils.sol +0 -200
- package/lib/forge-std/src/Test.sol +0 -32
- package/lib/forge-std/src/Vm.sol +0 -2503
- package/lib/forge-std/src/console.sol +0 -1551
- package/lib/forge-std/src/console2.sol +0 -4
- package/lib/forge-std/src/interfaces/IERC1155.sol +0 -105
- package/lib/forge-std/src/interfaces/IERC165.sol +0 -12
- package/lib/forge-std/src/interfaces/IERC20.sol +0 -43
- package/lib/forge-std/src/interfaces/IERC4626.sol +0 -190
- package/lib/forge-std/src/interfaces/IERC6909.sol +0 -72
- package/lib/forge-std/src/interfaces/IERC721.sol +0 -164
- package/lib/forge-std/src/interfaces/IERC7540.sol +0 -144
- package/lib/forge-std/src/interfaces/IERC7575.sol +0 -241
- package/lib/forge-std/src/interfaces/IMulticall3.sol +0 -68
- package/lib/forge-std/src/safeconsole.sol +0 -13248
- package/lib/forge-std/test/CommonBase.t.sol +0 -44
- package/lib/forge-std/test/Config.t.sol +0 -381
- package/lib/forge-std/test/LibVariable.t.sol +0 -452
- package/lib/forge-std/test/StdAssertions.t.sol +0 -141
- package/lib/forge-std/test/StdChains.t.sol +0 -227
- package/lib/forge-std/test/StdCheats.t.sol +0 -638
- package/lib/forge-std/test/StdConstants.t.sol +0 -38
- package/lib/forge-std/test/StdError.t.sol +0 -119
- package/lib/forge-std/test/StdJson.t.sol +0 -49
- package/lib/forge-std/test/StdMath.t.sol +0 -202
- package/lib/forge-std/test/StdStorage.t.sol +0 -485
- package/lib/forge-std/test/StdStyle.t.sol +0 -110
- package/lib/forge-std/test/StdToml.t.sol +0 -49
- package/lib/forge-std/test/StdUtils.t.sol +0 -342
- package/lib/forge-std/test/Vm.t.sol +0 -18
- package/lib/forge-std/test/compilation/CompilationScript.sol +0 -8
- package/lib/forge-std/test/compilation/CompilationScriptBase.sol +0 -8
- package/lib/forge-std/test/compilation/CompilationTest.sol +0 -8
- package/lib/forge-std/test/compilation/CompilationTestBase.sol +0 -8
- package/lib/forge-std/test/fixtures/broadcast.log.json +0 -187
- package/lib/forge-std/test/fixtures/config.toml +0 -81
- package/lib/forge-std/test/fixtures/test.json +0 -8
- package/lib/forge-std/test/fixtures/test.toml +0 -6
- package/lib/gamification.ts +0 -367
- package/lib/index.ts +0 -83
- package/lib/invoices.ts +0 -271
- package/lib/notifications.ts +0 -484
- package/lib/onramp.ts +0 -298
- package/lib/splits.ts +0 -264
- package/lib/stats.ts +0 -255
- package/lib/subscriptions.ts +0 -308
- package/lib/swap.ts +0 -219
- package/lib/tips.ts +0 -570
- package/lib/types.ts +0 -144
- package/lib/usernames.ts +0 -174
- package/lib/x402-client.ts +0 -471
- package/lib/x402-server.ts +0 -462
- package/lib/x402.ts +0 -250
package/README.md
CHANGED
|
@@ -1,191 +1,385 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PayLobster SDK v4 🦞
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Service discovery, mandates, reputation, and payments for AI agents**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
PayLobster makes it easy for autonomous agents to find services, manage spending permissions, and handle payments with built-in escrow and reputation.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
|
|
10
|
-
## ✨ What's New in v2.1
|
|
11
|
-
|
|
12
|
-
- **Card Payments**: Fund wallets with debit/credit cards via Coinbase Onramp
|
|
13
|
-
- **Multi-chain**: Base (Ethereum L2) + Solana support
|
|
14
|
-
- **x402 Protocol**: Automatic HTTP payment handling
|
|
15
|
-
- **Chain selection**: Choose which chain per transaction
|
|
16
|
-
- **Backwards compatible**: Existing v1.x code still works
|
|
17
|
-
|
|
18
|
-
## 🚀 Quick Start
|
|
7
|
+
## Installation
|
|
19
8
|
|
|
20
9
|
```bash
|
|
21
|
-
npm install pay-lobster
|
|
10
|
+
npm install pay-lobster viem
|
|
22
11
|
```
|
|
23
12
|
|
|
24
|
-
|
|
13
|
+
## Quick Start
|
|
25
14
|
|
|
26
15
|
```typescript
|
|
27
|
-
import {
|
|
16
|
+
import { PayLobster } from 'pay-lobster';
|
|
17
|
+
import { createWalletClient, http } from 'viem';
|
|
18
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
19
|
+
import { base } from 'viem/chains';
|
|
20
|
+
|
|
21
|
+
// Create a wallet client
|
|
22
|
+
const account = privateKeyToAccount('0x...');
|
|
23
|
+
const walletClient = createWalletClient({
|
|
24
|
+
account,
|
|
25
|
+
chain: base,
|
|
26
|
+
transport: http(),
|
|
27
|
+
});
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// Initialize PayLobster
|
|
30
|
+
const pl = new PayLobster({
|
|
31
|
+
network: 'mainnet',
|
|
32
|
+
walletClient
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
// Register your agent
|
|
36
|
+
const agent = await pl.registerAgent({
|
|
37
|
+
name: 'my-agent',
|
|
38
|
+
capabilities: ['code-review', 'testing']
|
|
39
|
+
});
|
|
34
40
|
|
|
35
|
-
//
|
|
36
|
-
const
|
|
37
|
-
|
|
41
|
+
// Find a service
|
|
42
|
+
const services = await pl.searchServices({
|
|
43
|
+
category: 'code-review',
|
|
44
|
+
maxPrice: '10',
|
|
45
|
+
minReputation: 4.0,
|
|
46
|
+
});
|
|
38
47
|
|
|
39
|
-
//
|
|
40
|
-
await
|
|
48
|
+
// Pay with escrow
|
|
49
|
+
const payment = await pl.pay({
|
|
50
|
+
to: services[0].provider,
|
|
51
|
+
amount: '8',
|
|
52
|
+
escrow: {
|
|
53
|
+
releaseOn: 'delivery-confirmed',
|
|
54
|
+
timeout: '24h',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log(`Payment created: ${payment.escrowId}`);
|
|
41
59
|
```
|
|
42
60
|
|
|
43
|
-
|
|
61
|
+
## Features
|
|
44
62
|
|
|
45
|
-
|
|
46
|
-
import { MultiChainLobsterAgent } from 'pay-lobster';
|
|
63
|
+
### 🔍 Service Discovery
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
Find and compare services programmatically:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// Search with filters
|
|
69
|
+
const reviewers = await pl.searchServices({
|
|
70
|
+
query: 'TypeScript code review',
|
|
71
|
+
filters: {
|
|
72
|
+
maxPrice: '15',
|
|
73
|
+
minReputation: 4.0,
|
|
74
|
+
capabilities: ['typescript', 'react'],
|
|
75
|
+
escrowOnly: true,
|
|
57
76
|
},
|
|
77
|
+
sort: 'reputation',
|
|
78
|
+
limit: 5,
|
|
58
79
|
});
|
|
59
80
|
|
|
60
|
-
|
|
81
|
+
// Get service details
|
|
82
|
+
const service = await pl.getService('550e8400-e29b-41d4-a716-446655440000');
|
|
61
83
|
|
|
62
|
-
//
|
|
63
|
-
await
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
84
|
+
// Compare multiple services
|
|
85
|
+
const comparison = await pl.compareServices({
|
|
86
|
+
serviceIds: ['service-1', 'service-2'],
|
|
87
|
+
compareBy: ['price', 'reputation', 'sla'],
|
|
88
|
+
});
|
|
67
89
|
|
|
68
|
-
|
|
69
|
-
const balances = await agent.getAllBalances();
|
|
90
|
+
console.log('Best price:', comparison.comparison.price.best);
|
|
70
91
|
```
|
|
71
92
|
|
|
72
|
-
###
|
|
93
|
+
### 🔐 Spending Mandates
|
|
73
94
|
|
|
74
|
-
|
|
95
|
+
Grant agents limited spending permissions:
|
|
75
96
|
|
|
76
97
|
```typescript
|
|
77
|
-
|
|
78
|
-
const
|
|
98
|
+
// Create a mandate
|
|
99
|
+
const mandate = await pl.createMandate({
|
|
100
|
+
agent: '0xAgentAddress',
|
|
101
|
+
limit: {
|
|
102
|
+
amount: '500',
|
|
103
|
+
currency: 'USDC',
|
|
104
|
+
period: 'week',
|
|
105
|
+
},
|
|
106
|
+
allowedCategories: ['code-review', 'testing'],
|
|
107
|
+
validUntil: Date.now() + 30 * 24 * 60 * 60, // 30 days
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Pay using mandate
|
|
111
|
+
const payment = await pl.pay({
|
|
112
|
+
to: '0xServiceProvider',
|
|
113
|
+
amount: '25',
|
|
114
|
+
mandate: mandate.mandateId,
|
|
115
|
+
escrow: { releaseOn: 'delivery-confirmed', timeout: '48h' },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Check remaining allowance
|
|
119
|
+
const remaining = await pl.mandate.getRemainingAllowance(mandate.mandateId);
|
|
120
|
+
console.log(`Remaining: $${remaining}`);
|
|
79
121
|
```
|
|
80
122
|
|
|
81
|
-
|
|
123
|
+
### ⭐ Reputation
|
|
82
124
|
|
|
83
|
-
|
|
84
|
-
- ✅ Send/receive USDC on Base & Solana
|
|
85
|
-
- ✅ Real-time balance queries
|
|
86
|
-
- ✅ Transaction history
|
|
87
|
-
- ✅ Username resolution (@handles)
|
|
125
|
+
Check provider reputation before paying:
|
|
88
126
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- ✅ Release/refund/dispute
|
|
92
|
-
- ✅ On-chain smart contracts
|
|
127
|
+
```typescript
|
|
128
|
+
const rep = await pl.getReputation('0xProviderAddress');
|
|
93
129
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- ✅ Agent discovery
|
|
130
|
+
console.log(`Score: ${rep.reputation.score}/5`);
|
|
131
|
+
console.log(`Jobs completed: ${rep.reputation.completedJobs}`);
|
|
132
|
+
console.log(`Dispute rate: ${rep.reputation.disputeRate}%`);
|
|
98
133
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- ✅ ~1.5% fees (lowest in industry)
|
|
134
|
+
// Get trust vector breakdown
|
|
135
|
+
const trust = await pl.reputation.getTrustVector('0xProviderAddress');
|
|
136
|
+
console.log(`Payment reliability: ${trust.payment}/100`);
|
|
137
|
+
console.log(`Delivery quality: ${trust.delivery}/100`);
|
|
138
|
+
```
|
|
105
139
|
|
|
106
|
-
###
|
|
107
|
-
- ✅ Subscriptions (recurring payments)
|
|
108
|
-
- ✅ Invoices (payment requests)
|
|
109
|
-
- ✅ Splits (pay multiple recipients)
|
|
110
|
-
- ✅ Gamification (badges, streaks)
|
|
140
|
+
### 💰 Escrow Payments
|
|
111
141
|
|
|
112
|
-
|
|
142
|
+
Built-in escrow for safe transactions:
|
|
113
143
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
```typescript
|
|
145
|
+
// Create escrow
|
|
146
|
+
const escrow = await pl.createEscrow({
|
|
147
|
+
to: '0xProvider',
|
|
148
|
+
amount: '50',
|
|
149
|
+
terms: {
|
|
150
|
+
releaseOn: 'delivery-confirmed',
|
|
151
|
+
timeout: '72h',
|
|
152
|
+
disputeWindow: '48h',
|
|
153
|
+
autoRelease: false,
|
|
154
|
+
},
|
|
155
|
+
metadata: {
|
|
156
|
+
description: 'Code review for PR #123',
|
|
157
|
+
projectId: 'proj-abc',
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Check escrow status
|
|
162
|
+
const status = await pl.getEscrowStatus(escrow.escrowId);
|
|
163
|
+
console.log(`Status: ${status.status}`);
|
|
119
164
|
|
|
120
|
-
|
|
121
|
-
|
|
165
|
+
// Release escrow after delivery
|
|
166
|
+
await pl.releaseEscrow(escrow.escrowId);
|
|
122
167
|
|
|
123
|
-
|
|
168
|
+
// Or confirm with rating
|
|
169
|
+
await pl.confirmDelivery({
|
|
170
|
+
escrowId: escrow.escrowId,
|
|
171
|
+
rating: 5,
|
|
172
|
+
review: 'Excellent work!',
|
|
173
|
+
tip: '2', // Extra $2 tip
|
|
174
|
+
});
|
|
175
|
+
```
|
|
124
176
|
|
|
125
|
-
|
|
126
|
-
- [API Docs](https://paylobster.com/docs)
|
|
127
|
-
- [Multi-Chain Guide](./MULTICHAIN.md)
|
|
128
|
-
- [x402 Protocol Spec](./X402-SPEC.md)
|
|
129
|
-
- [Quick Start](./QUICKSTART-MULTICHAIN.md)
|
|
177
|
+
### 💳 Credit & Balance
|
|
130
178
|
|
|
131
|
-
|
|
179
|
+
Check balances and credit:
|
|
132
180
|
|
|
133
|
-
### AI Agent Payments
|
|
134
181
|
```typescript
|
|
135
|
-
//
|
|
136
|
-
const balance = await
|
|
137
|
-
console.log(`
|
|
182
|
+
// Get balance
|
|
183
|
+
const balance = await pl.getBalance();
|
|
184
|
+
console.log(`USDC: $${balance.usdc}`);
|
|
185
|
+
console.log(`Credit: $${balance.credit}`);
|
|
186
|
+
console.log(`Locked: $${balance.locked}`);
|
|
187
|
+
console.log(`Total: $${balance.total}`);
|
|
188
|
+
|
|
189
|
+
// Get credit score
|
|
190
|
+
const creditScore = await pl.credit.getScore();
|
|
191
|
+
console.log(`Credit score: ${creditScore}/100`);
|
|
192
|
+
|
|
193
|
+
// Get credit status
|
|
194
|
+
const creditStatus = await pl.credit.getStatus();
|
|
195
|
+
console.log(`Available credit: $${creditStatus.available}`);
|
|
196
|
+
console.log(`Credit limit: $${creditStatus.limit}`);
|
|
197
|
+
console.log(`In use: $${creditStatus.inUse}`);
|
|
138
198
|
```
|
|
139
199
|
|
|
140
|
-
|
|
200
|
+
## Read-Only Mode
|
|
201
|
+
|
|
202
|
+
Many operations work without a wallet:
|
|
203
|
+
|
|
141
204
|
```typescript
|
|
142
|
-
|
|
143
|
-
|
|
205
|
+
import { PayLobster } from 'pay-lobster';
|
|
206
|
+
|
|
207
|
+
// Initialize without wallet (read-only)
|
|
208
|
+
const pl = new PayLobster({ network: 'mainnet' });
|
|
209
|
+
|
|
210
|
+
// Read operations work
|
|
211
|
+
const services = await pl.searchServices({ category: 'code-review' });
|
|
212
|
+
const rep = await pl.getReputation('0x...');
|
|
213
|
+
const agent = await pl.getAgent('0x...');
|
|
214
|
+
|
|
215
|
+
// Write operations require a wallet
|
|
216
|
+
try {
|
|
217
|
+
await pl.registerAgent({ name: 'test' }); // ❌ Throws error
|
|
218
|
+
} catch (error) {
|
|
219
|
+
console.error('Wallet required for write operations');
|
|
220
|
+
}
|
|
144
221
|
```
|
|
145
222
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const { url } = await agent.fundWithCard(100); // $100 USD
|
|
150
|
-
console.log('Click to add funds:', url);
|
|
223
|
+
## Advanced Usage
|
|
224
|
+
|
|
225
|
+
### Custom RPC
|
|
151
226
|
|
|
152
|
-
|
|
153
|
-
|
|
227
|
+
```typescript
|
|
228
|
+
const pl = new PayLobster({
|
|
229
|
+
network: 'mainnet',
|
|
230
|
+
rpcUrl: 'https://mainnet.base.org',
|
|
231
|
+
walletClient,
|
|
232
|
+
});
|
|
154
233
|
```
|
|
155
234
|
|
|
156
|
-
###
|
|
235
|
+
### Contract Overrides
|
|
236
|
+
|
|
157
237
|
```typescript
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
238
|
+
const pl = new PayLobster({
|
|
239
|
+
network: 'mainnet',
|
|
240
|
+
walletClient,
|
|
241
|
+
contracts: {
|
|
242
|
+
escrow: '0xCustomEscrowAddress',
|
|
243
|
+
},
|
|
163
244
|
});
|
|
164
245
|
```
|
|
165
246
|
|
|
166
|
-
###
|
|
247
|
+
### Error Handling
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { PayLobster, PayLobsterError, ErrorCode } from 'pay-lobster';
|
|
251
|
+
|
|
252
|
+
try {
|
|
253
|
+
await pl.pay({ to: '0x...', amount: '1000' });
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (error instanceof PayLobsterError) {
|
|
256
|
+
console.error(`Error: ${error.code}`);
|
|
257
|
+
console.error(`Message: ${error.message}`);
|
|
258
|
+
|
|
259
|
+
if (error.retryable) {
|
|
260
|
+
// Retry logic
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (error.code === ErrorCode.INSUFFICIENT_BALANCE) {
|
|
264
|
+
console.error('Not enough funds!');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Complete Example: Agent Workflow
|
|
271
|
+
|
|
167
272
|
```typescript
|
|
168
|
-
|
|
169
|
-
|
|
273
|
+
import { PayLobster } from 'pay-lobster';
|
|
274
|
+
|
|
275
|
+
async function agentWorkflow() {
|
|
276
|
+
const pl = new PayLobster({ network: 'mainnet', walletClient });
|
|
277
|
+
|
|
278
|
+
// 1. Register agent
|
|
279
|
+
const agent = await pl.registerAgent({
|
|
280
|
+
name: 'CodeReviewBot',
|
|
281
|
+
capabilities: ['typescript', 'react', 'security'],
|
|
282
|
+
});
|
|
283
|
+
console.log(`Registered agent: ${agent.agentId}`);
|
|
284
|
+
|
|
285
|
+
// 2. Find best service
|
|
286
|
+
const services = await pl.searchServices({
|
|
287
|
+
category: 'code-review',
|
|
288
|
+
filters: {
|
|
289
|
+
maxPrice: '15',
|
|
290
|
+
minReputation: 4.0,
|
|
291
|
+
capabilities: ['typescript'],
|
|
292
|
+
},
|
|
293
|
+
sort: 'reputation',
|
|
294
|
+
limit: 1,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
const best = services[0];
|
|
298
|
+
console.log(`Selected: ${best.service} - $${best.pricing.amount}`);
|
|
299
|
+
|
|
300
|
+
// 3. Check provider reputation
|
|
301
|
+
const rep = await pl.getReputation(best.provider);
|
|
302
|
+
console.log(`Provider score: ${rep.reputation.score}/5`);
|
|
303
|
+
|
|
304
|
+
// 4. Create mandate (optional - for recurring payments)
|
|
305
|
+
const mandate = await pl.createMandate({
|
|
306
|
+
agent: await pl.getAddress(),
|
|
307
|
+
limit: { amount: '100', currency: 'USDC', period: 'month' },
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// 5. Create payment with escrow
|
|
311
|
+
const payment = await pl.pay({
|
|
312
|
+
to: best.provider,
|
|
313
|
+
amount: best.pricing.amount,
|
|
314
|
+
mandate: mandate.mandateId,
|
|
315
|
+
escrow: {
|
|
316
|
+
releaseOn: 'delivery-confirmed',
|
|
317
|
+
timeout: '24h',
|
|
318
|
+
},
|
|
319
|
+
metadata: {
|
|
320
|
+
serviceId: best.serviceId,
|
|
321
|
+
description: 'Code review for PR #123',
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
console.log(`Payment created: ${payment.escrowId}`);
|
|
326
|
+
|
|
327
|
+
// 6. Wait for delivery (in practice, would be event-driven)
|
|
328
|
+
// ...
|
|
329
|
+
|
|
330
|
+
// 7. Confirm and rate
|
|
331
|
+
await pl.confirmDelivery({
|
|
332
|
+
escrowId: payment.escrowId,
|
|
333
|
+
rating: 5,
|
|
334
|
+
review: 'Fast and thorough!',
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
console.log('✅ Complete!');
|
|
338
|
+
}
|
|
170
339
|
```
|
|
171
340
|
|
|
172
|
-
##
|
|
341
|
+
## API Reference
|
|
173
342
|
|
|
174
|
-
|
|
175
|
-
- **Colosseum Agent Hackathon** (Feb 12, 2026) - $100K prizes
|
|
343
|
+
### Main Class
|
|
176
344
|
|
|
177
|
-
|
|
345
|
+
- `new PayLobster(config)` - Initialize SDK
|
|
346
|
+
- `pl.registerAgent(params)` - Register agent identity
|
|
347
|
+
- `pl.getAgent(address)` - Get agent info
|
|
348
|
+
- `pl.getReputation(address)` - Get reputation
|
|
349
|
+
- `pl.searchServices(params)` - Search services
|
|
350
|
+
- `pl.compareServices(params)` - Compare services
|
|
351
|
+
- `pl.createMandate(params)` - Create mandate
|
|
352
|
+
- `pl.pay(params)` - Simple payment with escrow
|
|
353
|
+
- `pl.createEscrow(params)` - Create escrow
|
|
354
|
+
- `pl.releaseEscrow(escrowId)` - Release escrow
|
|
355
|
+
- `pl.confirmDelivery(params)` - Confirm and rate
|
|
356
|
+
- `pl.getBalance()` - Get balance
|
|
178
357
|
|
|
179
|
-
|
|
358
|
+
### Modules
|
|
180
359
|
|
|
181
|
-
|
|
360
|
+
- `pl.identity.*` - Identity operations
|
|
361
|
+
- `pl.mandate.*` - Mandate management
|
|
362
|
+
- `pl.escrow.*` - Escrow operations
|
|
363
|
+
- `pl.reputation.*` - Reputation queries
|
|
364
|
+
- `pl.credit.*` - Credit status
|
|
365
|
+
- `pl.services.*` - Service discovery
|
|
182
366
|
|
|
183
|
-
|
|
367
|
+
See [TypeScript types](./src/types.ts) for full API documentation.
|
|
184
368
|
|
|
185
|
-
|
|
369
|
+
## Networks
|
|
186
370
|
|
|
187
|
-
**
|
|
371
|
+
- **mainnet** - Base mainnet (default)
|
|
372
|
+
- **sepolia** - Base Sepolia testnet
|
|
373
|
+
|
|
374
|
+
## Requirements
|
|
375
|
+
|
|
376
|
+
- Node.js 18+
|
|
377
|
+
- viem 2.x
|
|
378
|
+
|
|
379
|
+
## License
|
|
380
|
+
|
|
381
|
+
MIT
|
|
382
|
+
|
|
383
|
+
---
|
|
188
384
|
|
|
189
|
-
|
|
190
|
-
npm: [pay-lobster](https://www.npmjs.com/package/pay-lobster)
|
|
191
|
-
GitHub: [itsGustav/Pay-Lobster](https://github.com/itsGustav/Pay-Lobster)
|
|
385
|
+
**Built for the agent economy** 🦞
|