@ton-agent-kit/plugin-escrow 1.1.0 → 1.1.1
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 +61 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @ton-agent-kit/plugin-escrow
|
|
2
|
+
|
|
3
|
+
Escrow plugin for on-chain escrow with self-selecting arbiters, staking, and dispute-resolution voting on TON. Manages the full lifecycle of escrow deals from creation through settlement.
|
|
4
|
+
|
|
5
|
+
Part of [TON Agent Kit](https://github.com/Andy00L/ton-agent-kit).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ton-agent-kit/plugin-escrow @ton-agent-kit/core zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { TonAgentKit, KeypairWallet } from "@ton-agent-kit/core";
|
|
17
|
+
import EscrowPlugin from "@ton-agent-kit/plugin-escrow";
|
|
18
|
+
|
|
19
|
+
const agent = new TonAgentKit(wallet).use(EscrowPlugin);
|
|
20
|
+
|
|
21
|
+
// Create an escrow deal
|
|
22
|
+
const escrow = await agent.runAction("create_escrow", {
|
|
23
|
+
beneficiary: "EQBx...",
|
|
24
|
+
amount: "1.5",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Release funds after delivery
|
|
28
|
+
await agent.runAction("release_escrow", { escrowId: escrow.id });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Actions
|
|
32
|
+
|
|
33
|
+
| Action | Description |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `create_escrow` | Create a new escrow deal (arbiters self-select during disputes). |
|
|
36
|
+
| `deposit_to_escrow` | Fund an escrow with TON. |
|
|
37
|
+
| `release_escrow` | Release funds to beneficiary (depositor only, non-dispute). |
|
|
38
|
+
| `refund_escrow` | Refund funds to depositor. |
|
|
39
|
+
| `get_escrow_info` | Get escrow details or list all escrows. |
|
|
40
|
+
| `confirm_delivery` | Confirm service delivery on-chain (buyer only). |
|
|
41
|
+
| `auto_release_escrow` | Release after deadline (requires delivery confirmation). |
|
|
42
|
+
| `open_dispute` | Open a dispute, freezing the escrow for arbiter voting. |
|
|
43
|
+
| `join_dispute` | Stake TON to join as an arbiter in a dispute. |
|
|
44
|
+
| `vote_release` | Arbiter votes to release funds during a dispute. |
|
|
45
|
+
| `vote_refund` | Arbiter votes to refund funds during a dispute. |
|
|
46
|
+
| `claim_reward` | Claim arbiter reward after settlement. |
|
|
47
|
+
| `fallback_settle` | Settle after the 72h voting deadline expires. |
|
|
48
|
+
| `seller_stake_escrow` | Seller stakes TON to signal commitment to the deal. |
|
|
49
|
+
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
See [docs/escrow-system.md](https://github.com/Andy00L/ton-agent-kit/blob/main/docs/escrow-system.md) for the full escrow system design.
|
|
53
|
+
|
|
54
|
+
## Links
|
|
55
|
+
|
|
56
|
+
- [GitHub](https://github.com/Andy00L/ton-agent-kit)
|
|
57
|
+
- [npm](https://www.npmjs.com/package/@ton-agent-kit/plugin-escrow)
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/package.json
CHANGED