@edge-protocol/sdk 0.1.0 → 0.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 +239 -0
- package/package.json +14 -3
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
◎ EDGE · built on Sui
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
# Edge — Programmable Trust for Autonomous Systems
|
|
8
|
+
|
|
9
|
+
[](https://sui.io)
|
|
10
|
+
[](https://walrus.xyz)
|
|
11
|
+
[](https://npmjs.com/package/@edge-protocol/sdk)
|
|
12
|
+
[](#testing)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
[](https://overflow.sui.io)
|
|
15
|
+
|
|
16
|
+
**[Live Demo](https://edge-web-git-main-fluturecodes-projects.vercel.app) · [Sui Overflow 2026](https://overflow.sui.io)**
|
|
17
|
+
|
|
18
|
+
*Users set the course. Edge handles the journey safely.*
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## The Problem
|
|
25
|
+
|
|
26
|
+
AI agents cannot transact autonomously on behalf of users without either constant wallet interruptions or unlimited fund access. There is no programmable trust boundary between the two.
|
|
27
|
+
|
|
28
|
+
**Edge fixes this.**
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## What is Edge?
|
|
33
|
+
|
|
34
|
+
Edge is a **trust delegation primitive** for autonomous onchain systems. Users define boundaries once — budget, merchants, thresholds, expiry. Apps and agents execute freely within them. Unsafe actions escalate automatically.
|
|
35
|
+
|
|
36
|
+
The atomic unit is the **EdgePass** — a Sui Move object encoding a complete trust policy:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
budget: $300 · auto-approve: < $50 · escalate: > $100 · merchants: [...] · expiry: 48h
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## SDK Quickstart
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install @edge-protocol/sdk
|
|
48
|
+
# or
|
|
49
|
+
yarn add @edge-protocol/sdk
|
|
50
|
+
# or
|
|
51
|
+
pnpm add @edge-protocol/sdk
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { EdgePass, MIST_PER_SUI } from '@edge-protocol/sdk';
|
|
56
|
+
|
|
57
|
+
const sdk = new EdgePass({ network: 'testnet', enokiApiKey: '...' });
|
|
58
|
+
|
|
59
|
+
// 1. Create a trust boundary
|
|
60
|
+
const pass = await sdk.create({
|
|
61
|
+
budget: 300n * MIST_PER_SUI,
|
|
62
|
+
autoThreshold: 50n * MIST_PER_SUI,
|
|
63
|
+
escalateThreshold: 100n * MIST_PER_SUI,
|
|
64
|
+
approvedMerchants: ['Shuttle Express', 'Hydra Bar'],
|
|
65
|
+
expiryMs: 48 * 60 * 60 * 1000,
|
|
66
|
+
owner: userAddress,
|
|
67
|
+
}, signer);
|
|
68
|
+
|
|
69
|
+
// 2. Execute autonomously — policy enforced on every call
|
|
70
|
+
const outcome = await sdk.execute(pass, {
|
|
71
|
+
merchant: 'Shuttle Express',
|
|
72
|
+
amount: 18_500_000_000n,
|
|
73
|
+
}, signer);
|
|
74
|
+
|
|
75
|
+
// outcome.status → 'approved' | 'escalated' | 'blocked'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## How It Works
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
User creates EdgePass (once)
|
|
84
|
+
│
|
|
85
|
+
▼
|
|
86
|
+
Agent calls sdk.execute() (many times)
|
|
87
|
+
│
|
|
88
|
+
├── PolicyEngine validates (pure TS, no network)
|
|
89
|
+
│ ├── active? expired? merchant approved? budget remaining?
|
|
90
|
+
│ ├── amount > escalateThreshold? → ⚠️ escalate to user
|
|
91
|
+
│ └── amount ≤ autoThreshold? → ✅ auto-approve
|
|
92
|
+
│
|
|
93
|
+
├── ExecutionEngine builds PTB (atomic)
|
|
94
|
+
│ validate → execute → update spent → emit event
|
|
95
|
+
│
|
|
96
|
+
└── Walrus writes immutable audit log
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Festival Mode Demo
|
|
102
|
+
|
|
103
|
+
| Merchant | Amount | Outcome |
|
|
104
|
+
|----------|--------|---------|
|
|
105
|
+
| 🚌 Shuttle Express | $18.50 | ✅ Auto-approved · on-chain tx confirmed |
|
|
106
|
+
| 🍹 Hydra Bar | $32.00 | ✅ Auto-approved · on-chain tx confirmed |
|
|
107
|
+
| 🎟 Stage Access VIP | $75.00 | ✅ Auto-approved · on-chain tx confirmed |
|
|
108
|
+
| ☠️ ShadyTokens.xyz | $0.01 | 🚫 Blocked — not in allowlist |
|
|
109
|
+
| 🎤 Artist Meet & Greet | $149.00 | ⚠️ Escalated — exceeds $100 threshold |
|
|
110
|
+
|
|
111
|
+
**3 auto-approved · 1 blocked · 1 escalated · 0 wallet popups**
|
|
112
|
+
|
|
113
|
+
All approved transactions confirmed on Sui testnet with real digests.
|
|
114
|
+
Audit log live on Walrus: [view blob](https://walruscan.com/testnet/blob/aMp7SskBz83OJLg-2RwxPf-8psdURdoVyyDhtYMujT4)
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Sui Primitives Used
|
|
119
|
+
|
|
120
|
+
| Primitive | Role |
|
|
121
|
+
|-----------|------|
|
|
122
|
+
| 🔐 **zkLogin** | Google login → invisible Sui wallet, no seed phrase, real ZK proof |
|
|
123
|
+
| ⛽ **Enoki** | Gas sponsorship — users never pay transaction fees |
|
|
124
|
+
| 🧱 **PTBs** | Atomic: validate → execute → update → log in one transaction |
|
|
125
|
+
| 📦 **Move Objects** | EdgePass as owned, programmable on-chain state |
|
|
126
|
+
| 🗂 **Walrus** | Immutable, decentralized audit logs with real tx digests |
|
|
127
|
+
| 🔒 **Seal** | Encrypted trust policies (Phase 3) |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Move Contract
|
|
132
|
+
|
|
133
|
+
**Deployed to Sui testnet:**
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Package ID: 0x9f4065009494aa5acd92a5c72a6c22ce80939b2bddae3b34345459bc98d2501d
|
|
137
|
+
Deploy Tx: 64fovgDj7P5DX9mNDTEEmEwVU2cxxJhQvnZq2eos1s84
|
|
138
|
+
First Pass: 2wstpGwQgb8v6CDKdAmVjJBAHZ873MPFNMBNfvQutFKF
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
[View on Sui Explorer →](https://suiscan.xyz/testnet/object/0x9f4065009494aa5acd92a5c72a6c22ce80939b2bddae3b34345459bc98d2501d)
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Local Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git clone https://github.com/fluturecode/edge.git
|
|
149
|
+
cd edge && pnpm install
|
|
150
|
+
|
|
151
|
+
# Set env vars
|
|
152
|
+
cp apps/web/.env.example apps/web/.env.local
|
|
153
|
+
# Add NEXT_PUBLIC_ENOKI_API_KEY, ENOKI_SECRET_KEY, NEXT_PUBLIC_GOOGLE_CLIENT_ID
|
|
154
|
+
|
|
155
|
+
# Run
|
|
156
|
+
cd apps/web && pnpm dev # → localhost:3000
|
|
157
|
+
|
|
158
|
+
# Test SDK
|
|
159
|
+
cd packages/sdk && pnpm test
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
✓ auto-approves under $50
|
|
164
|
+
✓ escalates above $100
|
|
165
|
+
✓ blocks unlisted merchant
|
|
166
|
+
✓ blocks when budget exceeded
|
|
167
|
+
✓ blocks when expired
|
|
168
|
+
✓ blocks when inactive
|
|
169
|
+
6/6 passing ✅
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Confirmed On-Chain Activity
|
|
175
|
+
|
|
176
|
+
| Action | Tx Digest | Status |
|
|
177
|
+
|--------|-----------|--------|
|
|
178
|
+
| EdgePass created | [2wstpGwQ...](https://suiscan.xyz/testnet/tx/2wstpGwQgb8v6CDKdAmVjJBAHZ873MPFNMBNfvQutFKF) | ✅ Confirmed |
|
|
179
|
+
| Shuttle Express $18.50 | on-chain | ✅ Confirmed |
|
|
180
|
+
| Hydra Bar $32.00 | on-chain | ✅ Confirmed |
|
|
181
|
+
| Stage Access VIP $75.00 | on-chain | ✅ Confirmed |
|
|
182
|
+
| Walrus audit log | [Tly_O_M8...](https://walruscan.com/testnet/blob/Tly_O_M8YpJw-AZqWJ1JRv9xlgZ_W11Er3xoD4BtZlw) | ✅ Live |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Repo Structure
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
edge/
|
|
190
|
+
├── apps/web/ # Next.js 16 demo app
|
|
191
|
+
│ ├── app/api/
|
|
192
|
+
│ │ ├── sponsor/ # Enoki sponsorship (server-side)
|
|
193
|
+
│ │ └── sign/ # zkLogin signing + Sui RPC
|
|
194
|
+
│ └── lib/
|
|
195
|
+
│ ├── zklogin.ts # ZK proof via Enoki
|
|
196
|
+
│ ├── signer.ts # buildSigner
|
|
197
|
+
│ └── walrus.ts # Audit log storage
|
|
198
|
+
├── packages/sdk/ # @edge-protocol/sdk
|
|
199
|
+
│ └── src/core/
|
|
200
|
+
│ ├── EdgePass.ts # Main API
|
|
201
|
+
│ ├── PolicyEngine.ts # Validation logic
|
|
202
|
+
│ └── ExecutionEngine.ts # PTB builder
|
|
203
|
+
└── contracts/navis/ # Move contract
|
|
204
|
+
└── sources/edge_pass.move
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Roadmap
|
|
210
|
+
|
|
211
|
+
- [x] zkLogin onboarding — real ZK proof via Enoki
|
|
212
|
+
- [x] EdgePass creation — real on-chain Move object
|
|
213
|
+
- [x] PolicyEngine — 6/6 tests passing
|
|
214
|
+
- [x] Festival Mode — real on-chain execution
|
|
215
|
+
- [x] Walrus audit logs — live on testnet with real digests
|
|
216
|
+
- [x] Move contract — testnet deployed
|
|
217
|
+
- [x] GitHub Actions CI/CD pipeline
|
|
218
|
+
- [ ] AI agent demo
|
|
219
|
+
- [ ] `@edge-protocol/sdk` on npm
|
|
220
|
+
- [ ] Mainnet deployment
|
|
221
|
+
- [ ] Seal full encryption
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Why It Matters
|
|
226
|
+
|
|
227
|
+
The agentic web needs programmable trust. Without it, agents either interrupt users constantly or operate with no guardrails. Edge is the missing primitive — open SDK, on-chain policy, zero UX friction.
|
|
228
|
+
|
|
229
|
+
> *The best infrastructure is invisible.*
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
<div align="center">
|
|
234
|
+
|
|
235
|
+
Built by [@fluturecode](https://github.com/fluturecode) for [Sui Overflow 2026](https://overflow.sui.io) — Agentic Web track.
|
|
236
|
+
|
|
237
|
+
MIT License
|
|
238
|
+
|
|
239
|
+
</div>
|
package/package.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-protocol/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Trust delegation primitive for autonomous onchain systems on Sui",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "tsc",
|
|
10
12
|
"dev": "tsc --watch",
|
|
11
13
|
"test": "ts-node --compiler-options '{\"module\":\"CommonJS\"}' src/test.ts",
|
|
12
14
|
"prepublishOnly": "pnpm build"
|
|
13
15
|
},
|
|
14
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"sui",
|
|
18
|
+
"zklogin",
|
|
19
|
+
"autonomous",
|
|
20
|
+
"trust",
|
|
21
|
+
"delegation",
|
|
22
|
+
"agent",
|
|
23
|
+
"web3",
|
|
24
|
+
"move"
|
|
25
|
+
],
|
|
15
26
|
"author": "fluturecode",
|
|
16
27
|
"license": "MIT",
|
|
17
28
|
"repository": {
|