@sparkysolutions/agentrail 0.0.0-stage โ 0.1.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/.github/ISSUE_TEMPLATE/drips_wave_task.md +33 -0
- package/.github/workflows/auto-merge.yml +119 -0
- package/.github/workflows/ci.yml +35 -0
- package/BENCHMARKS.md +67 -0
- package/CONTRIBUTING.md +40 -0
- package/DRIPS_WAVE.md +81 -0
- package/FUNDING.json +7 -0
- package/ISSUES_PIPELINE.json +106 -0
- package/LICENSE +21 -0
- package/README.md +145 -2
- package/RUNBOOK.md +95 -0
- package/SCF_ACTIVATION_PROPOSAL.md +137 -0
- package/assets/sorobanagents_avatar.jpg +0 -0
- package/assets/sorobanagents_avatar.png +0 -0
- package/assets/sorobanagents_avatar_elite.png +0 -0
- package/contracts/agentrail/Cargo.lock +1895 -0
- package/contracts/agentrail/Cargo.toml +25 -0
- package/contracts/agentrail/src/lib.rs +296 -0
- package/contracts/agentrail/src/test.rs +442 -0
- package/contracts/agentrail/test_snapshots/test/test_circuit_breaker_pause_and_unpause.1.json +195 -0
- package/contracts/agentrail/test_snapshots/test/test_double_initialize_fails.1.json +123 -0
- package/contracts/agentrail/test_snapshots/test/test_execute_spend_deducts_and_accumulates.1.json +347 -0
- package/contracts/agentrail/test_snapshots/test/test_get_allowance_returns_none_for_unregistered.1.json +61 -0
- package/contracts/agentrail/test_snapshots/test/test_get_version_matches_cargo_toml.1.json +61 -0
- package/contracts/agentrail/test_snapshots/test/test_grant_allowance_negative_amount_fails.1.json +123 -0
- package/contracts/agentrail/test_snapshots/test/test_grant_allowance_success.1.json +250 -0
- package/contracts/agentrail/test_snapshots/test/test_grant_allowance_zero_amount_fails.1.json +123 -0
- package/contracts/agentrail/test_snapshots/test/test_initialize_and_protocol_fee.1.json +154 -0
- package/contracts/agentrail/test_snapshots/test/test_initialize_success.1.json +124 -0
- package/contracts/agentrail/test_snapshots/test/test_initialize_with_excessive_fee_fails.1.json +61 -0
- package/contracts/agentrail/test_snapshots/test/test_max_protocol_fee_spend_boundary.1.json +298 -0
- package/contracts/agentrail/test_snapshots/test/test_multi_agent_allowance_isolation.1.json +426 -0
- package/contracts/agentrail/test_snapshots/test/test_multi_owner_isolation.1.json +426 -0
- package/contracts/agentrail/test_snapshots/test/test_regrant_allowance_updates_limits.1.json +346 -0
- package/contracts/agentrail/test_snapshots/test/test_revoke_allowance_freezes_spending.1.json +292 -0
- package/contracts/agentrail/test_snapshots/test/test_set_protocol_fee_by_admin.1.json +165 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_after_expiry_fails.1.json +250 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_exact_allowance_boundary.1.json +298 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_exceeding_allowance_fails.1.json +250 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_fails_when_circuit_breaker_tripped.1.json +285 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_negative_amount_fails.1.json +250 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_non_existent_allowance_fails.1.json +123 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_on_revoked_allowance_fails.1.json +292 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_with_protocol_fee.1.json +286 -0
- package/contracts/agentrail/test_snapshots/test/test_spend_zero_amount_fails.1.json +250 -0
- package/contracts/agentrail/test_snapshots/test/test_unpause_restores_spend_operations.1.json +370 -0
- package/contracts/agentrail/test_snapshots/test/test_zero_protocol_fee_spend.1.json +298 -0
- package/deployment.testnet.json +15 -0
- package/dist/cli/sandbox.d.ts +41 -0
- package/dist/cli/sandbox.js +82 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +26 -0
- package/dist/lib/micro-stream.d.ts +21 -0
- package/dist/lib/micro-stream.js +41 -0
- package/dist/lib/proof-of-task.d.ts +12 -0
- package/dist/lib/proof-of-task.js +32 -0
- package/dist/lib/scoped-allowance.d.ts +11 -0
- package/dist/lib/scoped-allowance.js +95 -0
- package/dist/lib/ttl-keeper.d.ts +10 -0
- package/dist/lib/ttl-keeper.js +36 -0
- package/dist/sdk/agent-client.d.ts +26 -0
- package/dist/sdk/agent-client.js +53 -0
- package/dist/types.d.ts +72 -0
- package/dist/types.js +5 -0
- package/docs/assets/favicon.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/index.html +840 -0
- package/package.json +38 -4
- package/scripts/demo-agent.ts +52 -0
- package/scripts/deploy-testnet.ts +228 -0
- package/scripts/security-audit.mjs +159 -0
- package/src/cli/sandbox.ts +127 -0
- package/src/index.ts +11 -0
- package/src/lib/micro-stream.ts +52 -0
- package/src/lib/proof-of-task.ts +39 -0
- package/src/lib/scoped-allowance.ts +112 -0
- package/src/lib/ttl-keeper.ts +44 -0
- package/src/sdk/agent-client.ts +66 -0
- package/src/types.ts +78 -0
- package/tests/agent-client.test.ts +62 -0
- package/tests/cli.test.ts +68 -0
- package/tests/micro-stream.test.ts +38 -0
- package/tests/proof-of-task.test.ts +78 -0
- package/tests/scoped-allowance.test.ts +135 -0
- package/tests/security-audit.test.ts +76 -0
- package/tests/ttl-keeper.test.ts +36 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +8 -0
package/docs/index.html
ADDED
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>AgentRail Protocol | Autonomous AI Agent Micro-Settlements on Soroban</title>
|
|
7
|
+
<meta name="description" content="Autonomous AI Agent Scoped-Allowance & Micro-Settlement Protocol on Stellar & Soroban. Live on Testnet.">
|
|
8
|
+
<link rel="icon" type="image/png" href="assets/favicon.png">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
11
|
+
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
|
12
|
+
<style>
|
|
13
|
+
:root {
|
|
14
|
+
--bg-dark: #080c14;
|
|
15
|
+
--card-bg: #0f1626;
|
|
16
|
+
--card-border: #1e293b;
|
|
17
|
+
--card-hover-border: #38bdf8;
|
|
18
|
+
--stellar-cyan: #00d4b2;
|
|
19
|
+
--soroban-purple: #7c3aed;
|
|
20
|
+
--stellar-gold: #f59e0b;
|
|
21
|
+
--text-main: #f8fafc;
|
|
22
|
+
--text-muted: #94a3b8;
|
|
23
|
+
--accent-glow: rgba(0, 212, 178, 0.15);
|
|
24
|
+
--font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
|
|
25
|
+
--font-mono: 'JetBrains Mono', monospace;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
* {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
background-color: var(--bg-dark);
|
|
36
|
+
color: var(--text-main);
|
|
37
|
+
font-family: var(--font-sans);
|
|
38
|
+
min-height: 100vh;
|
|
39
|
+
overflow-x: hidden;
|
|
40
|
+
line-height: 1.5;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Background glow lines */
|
|
44
|
+
.bg-glow {
|
|
45
|
+
position: fixed;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 50%;
|
|
48
|
+
transform: translateX(-50%);
|
|
49
|
+
width: 1000px;
|
|
50
|
+
height: 600px;
|
|
51
|
+
background: radial-gradient(circle at 50% 20%, rgba(124, 58, 237, 0.18), transparent 70%);
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
z-index: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.container {
|
|
57
|
+
max-width: 1200px;
|
|
58
|
+
margin: 0 auto;
|
|
59
|
+
padding: 0 24px;
|
|
60
|
+
position: relative;
|
|
61
|
+
z-index: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Navigation Bar */
|
|
65
|
+
header {
|
|
66
|
+
padding: 24px 0;
|
|
67
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.brand {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 12px;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
color: #fff;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.brand-icon {
|
|
82
|
+
width: 44px;
|
|
83
|
+
height: 44px;
|
|
84
|
+
border-radius: 11px;
|
|
85
|
+
background: linear-gradient(135deg, #00d4b2, #7c3aed);
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
box-shadow: 0 0 20px rgba(0, 212, 178, 0.4);
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
border: 1px solid rgba(0, 212, 178, 0.5);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.brand-logo-img {
|
|
95
|
+
width: 44px;
|
|
96
|
+
height: 44px;
|
|
97
|
+
border-radius: 11px;
|
|
98
|
+
object-fit: cover;
|
|
99
|
+
display: block;
|
|
100
|
+
border: 1px solid rgba(0, 212, 178, 0.4);
|
|
101
|
+
box-shadow: 0 0 22px rgba(0, 212, 178, 0.35);
|
|
102
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.brand-logo-img:hover {
|
|
106
|
+
transform: scale(1.06);
|
|
107
|
+
box-shadow: 0 0 30px rgba(124, 58, 237, 0.6);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.brand-title {
|
|
111
|
+
font-size: 20px;
|
|
112
|
+
font-weight: 800;
|
|
113
|
+
letter-spacing: -0.5px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.brand-badge {
|
|
117
|
+
font-size: 11px;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
padding: 4px 8px;
|
|
120
|
+
background: rgba(0, 212, 178, 0.12);
|
|
121
|
+
border: 1px solid rgba(0, 212, 178, 0.3);
|
|
122
|
+
color: var(--stellar-cyan);
|
|
123
|
+
border-radius: 6px;
|
|
124
|
+
text-transform: uppercase;
|
|
125
|
+
letter-spacing: 0.5px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nav-actions {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 16px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.btn {
|
|
135
|
+
font-family: var(--font-sans);
|
|
136
|
+
font-size: 14px;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
padding: 10px 18px;
|
|
139
|
+
border-radius: 8px;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
transition: all 0.2s ease;
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: 8px;
|
|
145
|
+
text-decoration: none;
|
|
146
|
+
border: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.btn-outline {
|
|
150
|
+
background: rgba(255, 255, 255, 0.04);
|
|
151
|
+
border: 1px solid var(--card-border);
|
|
152
|
+
color: var(--text-main);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.btn-outline:hover {
|
|
156
|
+
background: rgba(255, 255, 255, 0.08);
|
|
157
|
+
border-color: var(--text-muted);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.btn-stellar {
|
|
161
|
+
background: linear-gradient(135deg, #00d4b2, #0284c7);
|
|
162
|
+
color: #03131e;
|
|
163
|
+
font-weight: 700;
|
|
164
|
+
box-shadow: 0 4px 14px rgba(0, 212, 178, 0.3);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.btn-stellar:hover {
|
|
168
|
+
transform: translateY(-1px);
|
|
169
|
+
box-shadow: 0 6px 20px rgba(0, 212, 178, 0.45);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.btn-purple {
|
|
173
|
+
background: linear-gradient(135deg, #7c3aed, #4f46e5);
|
|
174
|
+
color: #ffffff;
|
|
175
|
+
font-weight: 700;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.btn-purple:hover {
|
|
179
|
+
transform: translateY(-1px);
|
|
180
|
+
box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Hero Section */
|
|
184
|
+
.hero {
|
|
185
|
+
padding: 64px 0 48px;
|
|
186
|
+
text-align: center;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.hero-badge {
|
|
190
|
+
display: inline-flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: 8px;
|
|
193
|
+
padding: 6px 14px;
|
|
194
|
+
background: rgba(124, 58, 237, 0.12);
|
|
195
|
+
border: 1px solid rgba(124, 58, 237, 0.3);
|
|
196
|
+
border-radius: 999px;
|
|
197
|
+
color: #a78bfa;
|
|
198
|
+
font-size: 13px;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
margin-bottom: 24px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.hero h1 {
|
|
204
|
+
font-size: 48px;
|
|
205
|
+
font-weight: 800;
|
|
206
|
+
letter-spacing: -1.5px;
|
|
207
|
+
line-height: 1.15;
|
|
208
|
+
margin-bottom: 20px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.hero h1 span.gradient-cyan {
|
|
212
|
+
background: linear-gradient(135deg, #00d4b2, #38bdf8);
|
|
213
|
+
-webkit-background-clip: text;
|
|
214
|
+
-webkit-text-fill-color: transparent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.hero h1 span.gradient-purple {
|
|
218
|
+
background: linear-gradient(135deg, #a78bfa, #f43f5e);
|
|
219
|
+
-webkit-background-clip: text;
|
|
220
|
+
-webkit-text-fill-color: transparent;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.hero p {
|
|
224
|
+
font-size: 18px;
|
|
225
|
+
color: var(--text-muted);
|
|
226
|
+
max-width: 760px;
|
|
227
|
+
margin: 0 auto 36px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.contract-chip {
|
|
231
|
+
display: inline-flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 10px;
|
|
234
|
+
background: #0b1220;
|
|
235
|
+
border: 1px solid #1e293b;
|
|
236
|
+
padding: 8px 16px;
|
|
237
|
+
border-radius: 8px;
|
|
238
|
+
font-family: var(--font-mono);
|
|
239
|
+
font-size: 13px;
|
|
240
|
+
color: var(--stellar-cyan);
|
|
241
|
+
margin-bottom: 40px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.contract-chip a {
|
|
245
|
+
color: #38bdf8;
|
|
246
|
+
text-decoration: underline;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Live Interactive Grid */
|
|
250
|
+
.grid-dashboard {
|
|
251
|
+
display: grid;
|
|
252
|
+
grid-template-columns: 1fr 1fr;
|
|
253
|
+
gap: 24px;
|
|
254
|
+
margin-bottom: 48px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@media (max-width: 900px) {
|
|
258
|
+
.grid-dashboard {
|
|
259
|
+
grid-template-columns: 1fr;
|
|
260
|
+
}
|
|
261
|
+
.hero h1 {
|
|
262
|
+
font-size: 34px;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.card {
|
|
267
|
+
background: var(--card-bg);
|
|
268
|
+
border: 1px solid var(--card-border);
|
|
269
|
+
border-radius: 16px;
|
|
270
|
+
padding: 24px;
|
|
271
|
+
position: relative;
|
|
272
|
+
transition: border-color 0.2s ease;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.card:hover {
|
|
276
|
+
border-color: rgba(0, 212, 178, 0.4);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.card-header {
|
|
280
|
+
display: flex;
|
|
281
|
+
justify-content: space-between;
|
|
282
|
+
align-items: center;
|
|
283
|
+
margin-bottom: 20px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.card-title {
|
|
287
|
+
font-size: 18px;
|
|
288
|
+
font-weight: 700;
|
|
289
|
+
display: flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
gap: 10px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.card-tag {
|
|
295
|
+
font-size: 11px;
|
|
296
|
+
font-weight: 700;
|
|
297
|
+
padding: 4px 8px;
|
|
298
|
+
border-radius: 4px;
|
|
299
|
+
background: rgba(255, 255, 255, 0.05);
|
|
300
|
+
color: var(--text-muted);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.form-group {
|
|
304
|
+
margin-bottom: 16px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.form-label {
|
|
308
|
+
display: block;
|
|
309
|
+
font-size: 13px;
|
|
310
|
+
font-weight: 600;
|
|
311
|
+
color: var(--text-muted);
|
|
312
|
+
margin-bottom: 6px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.form-input {
|
|
316
|
+
width: 100%;
|
|
317
|
+
background: #080c14;
|
|
318
|
+
border: 1px solid var(--card-border);
|
|
319
|
+
border-radius: 8px;
|
|
320
|
+
padding: 10px 14px;
|
|
321
|
+
color: #fff;
|
|
322
|
+
font-family: var(--font-mono);
|
|
323
|
+
font-size: 13px;
|
|
324
|
+
outline: none;
|
|
325
|
+
transition: border-color 0.2s;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.form-input:focus {
|
|
329
|
+
border-color: var(--stellar-cyan);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.stat-row {
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: space-between;
|
|
335
|
+
padding: 10px 0;
|
|
336
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
337
|
+
font-size: 14px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.stat-row:last-child {
|
|
341
|
+
border-bottom: none;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.stat-label {
|
|
345
|
+
color: var(--text-muted);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.stat-val {
|
|
349
|
+
font-family: var(--font-mono);
|
|
350
|
+
font-weight: 600;
|
|
351
|
+
color: #fff;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Simulation Canvas & Stream Logs */
|
|
355
|
+
.stream-box {
|
|
356
|
+
background: #06090f;
|
|
357
|
+
border: 1px solid #172033;
|
|
358
|
+
border-radius: 12px;
|
|
359
|
+
padding: 16px;
|
|
360
|
+
min-height: 220px;
|
|
361
|
+
max-height: 260px;
|
|
362
|
+
overflow-y: auto;
|
|
363
|
+
font-family: var(--font-mono);
|
|
364
|
+
font-size: 12px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.log-line {
|
|
368
|
+
margin-bottom: 8px;
|
|
369
|
+
line-height: 1.4;
|
|
370
|
+
display: flex;
|
|
371
|
+
gap: 8px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.log-time {
|
|
375
|
+
color: #64748b;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.log-event {
|
|
379
|
+
color: var(--stellar-cyan);
|
|
380
|
+
font-weight: 600;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.log-fee {
|
|
384
|
+
color: var(--stellar-gold);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.toast-banner {
|
|
388
|
+
position: fixed;
|
|
389
|
+
bottom: 24px;
|
|
390
|
+
right: 24px;
|
|
391
|
+
background: #0f172a;
|
|
392
|
+
border: 1px solid var(--stellar-cyan);
|
|
393
|
+
color: #fff;
|
|
394
|
+
padding: 14px 20px;
|
|
395
|
+
border-radius: 10px;
|
|
396
|
+
font-size: 14px;
|
|
397
|
+
font-weight: 600;
|
|
398
|
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
|
|
399
|
+
display: flex;
|
|
400
|
+
align-items: center;
|
|
401
|
+
gap: 10px;
|
|
402
|
+
z-index: 1000;
|
|
403
|
+
transform: translateY(150%);
|
|
404
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.toast-banner.show {
|
|
408
|
+
transform: translateY(0);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/* Specs & Benchmark Matrix */
|
|
412
|
+
.section-title {
|
|
413
|
+
font-size: 26px;
|
|
414
|
+
font-weight: 800;
|
|
415
|
+
margin-bottom: 20px;
|
|
416
|
+
display: flex;
|
|
417
|
+
align-items: center;
|
|
418
|
+
gap: 10px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.specs-table {
|
|
422
|
+
width: 100%;
|
|
423
|
+
border-collapse: collapse;
|
|
424
|
+
margin-bottom: 48px;
|
|
425
|
+
background: var(--card-bg);
|
|
426
|
+
border: 1px solid var(--card-border);
|
|
427
|
+
border-radius: 12px;
|
|
428
|
+
overflow: hidden;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.specs-table th, .specs-table td {
|
|
432
|
+
padding: 14px 20px;
|
|
433
|
+
text-align: left;
|
|
434
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
435
|
+
font-size: 14px;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.specs-table th {
|
|
439
|
+
background: rgba(255, 255, 255, 0.02);
|
|
440
|
+
color: var(--text-muted);
|
|
441
|
+
font-weight: 600;
|
|
442
|
+
text-transform: uppercase;
|
|
443
|
+
font-size: 12px;
|
|
444
|
+
letter-spacing: 0.5px;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.specs-table tr:last-child td {
|
|
448
|
+
border-bottom: none;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
footer {
|
|
452
|
+
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
|
453
|
+
padding: 32px 0 48px;
|
|
454
|
+
text-align: center;
|
|
455
|
+
color: var(--text-muted);
|
|
456
|
+
font-size: 14px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
footer a {
|
|
460
|
+
color: var(--stellar-cyan);
|
|
461
|
+
text-decoration: none;
|
|
462
|
+
}
|
|
463
|
+
</style>
|
|
464
|
+
</head>
|
|
465
|
+
<body>
|
|
466
|
+
<div class="bg-glow"></div>
|
|
467
|
+
|
|
468
|
+
<div class="container">
|
|
469
|
+
<!-- Navbar -->
|
|
470
|
+
<header>
|
|
471
|
+
<a href="#" class="brand">
|
|
472
|
+
<img src="assets/logo.png" class="brand-logo-img" alt="AgentRail Elite Logo">
|
|
473
|
+
<div>
|
|
474
|
+
<div class="brand-title">AgentRail Protocol</div>
|
|
475
|
+
</div>
|
|
476
|
+
<span class="brand-badge">Stellar Soroban</span>
|
|
477
|
+
</a>
|
|
478
|
+
<div class="nav-actions">
|
|
479
|
+
<a href="https://github.com/SorobanAgents/agentrail" target="_blank" class="btn btn-outline">
|
|
480
|
+
โญ GitHub
|
|
481
|
+
</a>
|
|
482
|
+
<button id="walletBtn" class="btn btn-stellar">
|
|
483
|
+
<span id="walletIcon">๐ช</span>
|
|
484
|
+
<span id="walletStatusText">Connect Freighter</span>
|
|
485
|
+
</button>
|
|
486
|
+
</div>
|
|
487
|
+
</header>
|
|
488
|
+
|
|
489
|
+
<!-- Hero -->
|
|
490
|
+
<section class="hero">
|
|
491
|
+
<div class="hero-badge">
|
|
492
|
+
<img src="assets/favicon.png" style="width: 18px; height: 18px; border-radius: 4px; vertical-align: middle; margin-right: 6px;" alt="icon">
|
|
493
|
+
Autonomous AI Agent Economic Layer on Soroban
|
|
494
|
+
</div>
|
|
495
|
+
<h1>
|
|
496
|
+
Stream Sub-Cent Payments for <br>
|
|
497
|
+
<span class="gradient-cyan">AI Agents</span> with <span class="gradient-purple">Zero Master Key Risk</span>
|
|
498
|
+
</h1>
|
|
499
|
+
<p>
|
|
500
|
+
AgentRail enables autonomous LLMs, Swarms, and MCP tools to pay for inference and data APIs via smart contract scoped allowances. <strong>Zero popup interruptions. Built-in protocol fee routing.</strong>
|
|
501
|
+
</p>
|
|
502
|
+
|
|
503
|
+
<div class="contract-chip">
|
|
504
|
+
<span>Verified Testnet Contract:</span>
|
|
505
|
+
<a href="https://stellar.expert/explorer/testnet/contract/CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6" target="_blank" id="contractIdLink">
|
|
506
|
+
CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6 โ
|
|
507
|
+
</a>
|
|
508
|
+
<button id="copyContractBtn" class="btn btn-outline" style="padding: 4px 8px; font-size: 11px;">Copy</button>
|
|
509
|
+
</div>
|
|
510
|
+
</section>
|
|
511
|
+
|
|
512
|
+
<!-- Interactive Simulator Dashboard -->
|
|
513
|
+
<div class="grid-dashboard">
|
|
514
|
+
<!-- Card 1: Scoped Allowance Vault -->
|
|
515
|
+
<div class="card">
|
|
516
|
+
<div class="card-header">
|
|
517
|
+
<div class="card-title">
|
|
518
|
+
<span>๐ก๏ธ</span> Scoped Allowance Vault
|
|
519
|
+
</div>
|
|
520
|
+
<span class="card-tag">Smart Contract</span>
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
<div class="form-group">
|
|
524
|
+
<label class="form-label">Human Master (Owner Address)</label>
|
|
525
|
+
<input type="text" id="ownerInput" class="form-input" value="GDDJH64X5VEXI7UWZMJA3YUG7ANYHKRRRFHLD2SF5OWEETNFBVYMRXZT" readonly>
|
|
526
|
+
</div>
|
|
527
|
+
|
|
528
|
+
<div class="form-group">
|
|
529
|
+
<label class="form-label">Autonomous Agent Public Key</label>
|
|
530
|
+
<input type="text" id="agentInput" class="form-input" value="GAgent_Claude35_Sonar_Stellar_Prod_99182">
|
|
531
|
+
</div>
|
|
532
|
+
|
|
533
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;">
|
|
534
|
+
<div class="form-group">
|
|
535
|
+
<label class="form-label">Authorized Cap (USDC/XLM)</label>
|
|
536
|
+
<input type="number" id="allowanceInput" class="form-input" value="10.00" step="1.0">
|
|
537
|
+
</div>
|
|
538
|
+
<div class="form-group">
|
|
539
|
+
<label class="form-label">TTL Expiry (Ledgers)</label>
|
|
540
|
+
<input type="number" id="expiryInput" class="form-input" value="518400" readonly>
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
|
|
544
|
+
<div style="display: flex; gap: 12px; margin-top: 10px;">
|
|
545
|
+
<button id="grantAllowanceBtn" class="btn btn-stellar" style="flex: 1;">
|
|
546
|
+
โก Grant Scoped Allowance
|
|
547
|
+
</button>
|
|
548
|
+
<button id="circuitBreakerBtn" class="btn btn-outline" style="border-color: #ef4444; color: #ef4444;">
|
|
549
|
+
โ Circuit Breaker
|
|
550
|
+
</button>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
|
|
554
|
+
<!-- Card 2: Autonomous Micro-Spend Engine -->
|
|
555
|
+
<div class="card">
|
|
556
|
+
<div class="card-header">
|
|
557
|
+
<div class="card-title">
|
|
558
|
+
<span>โก</span> Live Micro-Spend Simulator
|
|
559
|
+
</div>
|
|
560
|
+
<span class="card-tag" id="networkTag">Testnet: Active</span>
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
<div class="stat-row">
|
|
564
|
+
<span class="stat-label">Active Scoped Allowance</span>
|
|
565
|
+
<span class="stat-val" id="activeAllowanceVal">10.0000 XLM</span>
|
|
566
|
+
</div>
|
|
567
|
+
<div class="stat-row">
|
|
568
|
+
<span class="stat-label">Spent by Agent</span>
|
|
569
|
+
<span class="stat-val" id="spentVal">0.0000 XLM</span>
|
|
570
|
+
</div>
|
|
571
|
+
<div class="stat-row">
|
|
572
|
+
<span class="stat-label">Protocol Fee (20 bps)</span>
|
|
573
|
+
<span class="stat-val" style="color: var(--stellar-gold);">0.20% (Treasury Split)</span>
|
|
574
|
+
</div>
|
|
575
|
+
<div class="stat-row">
|
|
576
|
+
<span class="stat-label">Circuit Breaker State</span>
|
|
577
|
+
<span class="stat-val" id="circuitStateVal" style="color: #22c55e;">NORMAL (UNPAUSED)</span>
|
|
578
|
+
</div>
|
|
579
|
+
|
|
580
|
+
<div style="margin-top: 20px; display: flex; gap: 12px;">
|
|
581
|
+
<button id="fireSpendBtn" class="btn btn-purple" style="flex: 1;">
|
|
582
|
+
๐ค Fire Agent Micro-Spend ($0.05)
|
|
583
|
+
</button>
|
|
584
|
+
<button id="burstBtn" class="btn btn-outline" style="color: var(--stellar-cyan); border-color: rgba(0, 212, 178, 0.4);">
|
|
585
|
+
๐ Swarm Burst (10x)
|
|
586
|
+
</button>
|
|
587
|
+
</div>
|
|
588
|
+
</div>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
<!-- Live Execution Stream Log -->
|
|
592
|
+
<div class="card" style="margin-bottom: 48px;">
|
|
593
|
+
<div class="card-header">
|
|
594
|
+
<div class="card-title">
|
|
595
|
+
<span>๐ก</span> Real-Time Soroban Contract Event Stream
|
|
596
|
+
</div>
|
|
597
|
+
<button id="clearLogsBtn" class="btn btn-outline" style="padding: 4px 10px; font-size: 12px;">Clear Stream</button>
|
|
598
|
+
</div>
|
|
599
|
+
|
|
600
|
+
<div class="stream-box" id="streamLogBox">
|
|
601
|
+
<div class="log-line">
|
|
602
|
+
<span class="log-time">[INIT]</span>
|
|
603
|
+
<span class="log-event">CBSWWN2C...</span>
|
|
604
|
+
<span>Soroban Smart Contract initialized on Stellar Testnet. Protocol Fee: 20 bps.</span>
|
|
605
|
+
</div>
|
|
606
|
+
<div class="log-line">
|
|
607
|
+
<span class="log-time">[READY]</span>
|
|
608
|
+
<span class="log-event">ALLOWANCE_VAULT:</span>
|
|
609
|
+
<span>Agent allowances armed. Ready for autonomous AI inference settlement.</span>
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
</div>
|
|
613
|
+
|
|
614
|
+
<!-- On-Chain Architectural Specs -->
|
|
615
|
+
<h2 class="section-title">
|
|
616
|
+
<span>๐</span> Protocol Architecture & Verification
|
|
617
|
+
</h2>
|
|
618
|
+
|
|
619
|
+
<table class="specs-table">
|
|
620
|
+
<thead>
|
|
621
|
+
<tr>
|
|
622
|
+
<th>Component</th>
|
|
623
|
+
<th>Soroban Implementation</th>
|
|
624
|
+
<th>Security Invariant</th>
|
|
625
|
+
<th>Explorer Verification</th>
|
|
626
|
+
</tr>
|
|
627
|
+
</thead>
|
|
628
|
+
<tbody>
|
|
629
|
+
<tr>
|
|
630
|
+
<td><strong>Scoped Allowance Escrow</strong></td>
|
|
631
|
+
<td>Rust <code>soroban-sdk::contractimpl</code></td>
|
|
632
|
+
<td>Agent cannot exceed assigned cap or spend post-TTL expiry</td>
|
|
633
|
+
<td><a href="https://stellar.expert/explorer/testnet/contract/CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6" target="_blank" style="color: var(--stellar-cyan);">Verified Contract โ</a></td>
|
|
634
|
+
</tr>
|
|
635
|
+
<tr>
|
|
636
|
+
<td><strong>Fee Splitter Engine</strong></td>
|
|
637
|
+
<td>20 bps (0.20%) auto-routing</td>
|
|
638
|
+
<td>Split calculates atomically; 99.8% to destination, 0.2% to Treasury</td>
|
|
639
|
+
<td><a href="https://stellar.expert/explorer/testnet/tx/88855f18c6e25268bd98fd9d32ee68d82d0c82381b9e3aa82c824f5857d01951" target="_blank" style="color: var(--stellar-cyan);">Init Tx โ</a></td>
|
|
640
|
+
</tr>
|
|
641
|
+
<tr>
|
|
642
|
+
<td><strong>Emergency Circuit Breaker</strong></td>
|
|
643
|
+
<td>Time-locked Multi-Sig Pause/Drain</td>
|
|
644
|
+
<td>Instant freeze of agent allowance if prompt injection detected</td>
|
|
645
|
+
<td><a href="https://github.com/SorobanAgents/agentrail/blob/main/contracts/agentrail/src/lib.rs" target="_blank" style="color: var(--stellar-cyan);">Source Code โ</a></td>
|
|
646
|
+
</tr>
|
|
647
|
+
<tr>
|
|
648
|
+
<td><strong>State TTL Rent Keeper</strong></td>
|
|
649
|
+
<td>Automatic Ledger TTL Bumping</td>
|
|
650
|
+
<td>Contract storage immune to Soroban state archival freezing</td>
|
|
651
|
+
<td><a href="https://github.com/SorobanAgents/agentrail/blob/main/src/ttl-keeper.ts" target="_blank" style="color: var(--stellar-cyan);">Keeper Module โ</a></td>
|
|
652
|
+
</tr>
|
|
653
|
+
</tbody>
|
|
654
|
+
</table>
|
|
655
|
+
|
|
656
|
+
<!-- Footer -->
|
|
657
|
+
<footer>
|
|
658
|
+
<p>
|
|
659
|
+
AgentRail Protocol is an open-source decentralized infrastructure built for the
|
|
660
|
+
<a href="https://stellar.org" target="_blank">Stellar & Soroban Ecosystem</a>.
|
|
661
|
+
</p>
|
|
662
|
+
<p style="margin-top: 8px;">
|
|
663
|
+
Designed for autonomous agents, LLM tool-calling pipelines, and multi-agent meshes. MIT Licensed.
|
|
664
|
+
</p>
|
|
665
|
+
</footer>
|
|
666
|
+
</div>
|
|
667
|
+
|
|
668
|
+
<!-- Toast Notification -->
|
|
669
|
+
<div id="toast" class="toast-banner">
|
|
670
|
+
<span id="toastIcon">โก</span>
|
|
671
|
+
<span id="toastMessage">AgentRail action dispatched</span>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
<script>
|
|
675
|
+
// State
|
|
676
|
+
let currentAllowance = 10.0;
|
|
677
|
+
let totalSpent = 0.0;
|
|
678
|
+
let isCircuitPaused = false;
|
|
679
|
+
let isWalletConnected = false;
|
|
680
|
+
|
|
681
|
+
const CONTRACT_ID = "CBSWWN2CLUPW4VLYTGVJTT4XWXKF6LLJFQXEC7KK2KTAW3A26WIBZIN6";
|
|
682
|
+
|
|
683
|
+
// DOM Elements
|
|
684
|
+
const toast = document.getElementById('toast');
|
|
685
|
+
const toastMessage = document.getElementById('toastMessage');
|
|
686
|
+
const toastIcon = document.getElementById('toastIcon');
|
|
687
|
+
const streamBox = document.getElementById('streamLogBox');
|
|
688
|
+
const activeAllowanceVal = document.getElementById('activeAllowanceVal');
|
|
689
|
+
const spentVal = document.getElementById('spentVal');
|
|
690
|
+
const circuitStateVal = document.getElementById('circuitStateVal');
|
|
691
|
+
const walletBtn = document.getElementById('walletBtn');
|
|
692
|
+
const walletStatusText = document.getElementById('walletStatusText');
|
|
693
|
+
|
|
694
|
+
function showToast(msg, icon = 'โก') {
|
|
695
|
+
toastMessage.innerText = msg;
|
|
696
|
+
toastIcon.innerText = icon;
|
|
697
|
+
toast.classList.add('show');
|
|
698
|
+
setTimeout(() => {
|
|
699
|
+
toast.classList.remove('show');
|
|
700
|
+
}, 3500);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function addLog(eventTag, text, feeText = '') {
|
|
704
|
+
const now = new Date().toTimeString().split(' ')[0];
|
|
705
|
+
const div = document.createElement('div');
|
|
706
|
+
div.className = 'log-line';
|
|
707
|
+
div.innerHTML = `
|
|
708
|
+
<span class="log-time">[${now}]</span>
|
|
709
|
+
<span class="log-event">${eventTag}</span>
|
|
710
|
+
<span>${text}</span>
|
|
711
|
+
${feeText ? `<span class="log-fee">${feeText}</span>` : ''}
|
|
712
|
+
`;
|
|
713
|
+
streamBox.insertBefore(div, streamBox.firstChild);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// Copy Contract ID
|
|
717
|
+
document.getElementById('copyContractBtn').addEventListener('click', () => {
|
|
718
|
+
navigator.clipboard.writeText(CONTRACT_ID);
|
|
719
|
+
showToast('Contract ID copied to clipboard!', '๐');
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// Wallet Connect Toggle / Simulated Testnet Signer
|
|
723
|
+
walletBtn.addEventListener('click', () => {
|
|
724
|
+
if (!isWalletConnected) {
|
|
725
|
+
isWalletConnected = true;
|
|
726
|
+
walletStatusText.innerText = "GDQZ...JJA5 (Testnet)";
|
|
727
|
+
walletBtn.style.background = "linear-gradient(135deg, #10b981, #059669)";
|
|
728
|
+
walletBtn.style.color = "#ffffff";
|
|
729
|
+
showToast("Connected to Stellar Testnet Account: GDQZ...JJA5", "๐ช");
|
|
730
|
+
addLog("WALLET_CONNECTED", "Freighter / Testnet Keypair active for deployer GDQZK73NVQCDJTTUMOOLF7IZ55IY4GS2TF6SNE7P7DVJ7XWICYAGJJA5");
|
|
731
|
+
} else {
|
|
732
|
+
isWalletConnected = false;
|
|
733
|
+
walletStatusText.innerText = "Connect Freighter";
|
|
734
|
+
walletBtn.style.background = "";
|
|
735
|
+
walletBtn.style.color = "";
|
|
736
|
+
showToast("Wallet disconnected", "๐");
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
// Grant Allowance
|
|
741
|
+
document.getElementById('grantAllowanceBtn').addEventListener('click', () => {
|
|
742
|
+
const amount = parseFloat(document.getElementById('allowanceInput').value) || 10.0;
|
|
743
|
+
const agent = document.getElementById('agentInput').value || "Agent_Claude35";
|
|
744
|
+
currentAllowance = amount;
|
|
745
|
+
totalSpent = 0.0;
|
|
746
|
+
activeAllowanceVal.innerText = `${currentAllowance.toFixed(4)} XLM`;
|
|
747
|
+
spentVal.innerText = `0.0000 XLM`;
|
|
748
|
+
|
|
749
|
+
showToast(`Scoped Allowance granted: ${amount.toFixed(2)} XLM for ${agent}`, "๐ก๏ธ");
|
|
750
|
+
addLog("ALLOWANCE_GRANTED", `Owner GDDJH6... granted ${amount.toFixed(2)} XLM allowance to agent [${agent}]. TTL bumped: 518,400 ledgers.`);
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
// Circuit Breaker Toggle
|
|
754
|
+
document.getElementById('circuitBreakerBtn').addEventListener('click', () => {
|
|
755
|
+
isCircuitPaused = !isCircuitPaused;
|
|
756
|
+
if (isCircuitPaused) {
|
|
757
|
+
circuitStateVal.innerText = "TRIPPED (PAUSED)";
|
|
758
|
+
circuitStateVal.style.color = "#ef4444";
|
|
759
|
+
document.getElementById('circuitBreakerBtn').innerText = "โ
Unpause Circuit";
|
|
760
|
+
document.getElementById('circuitBreakerBtn').style.color = "#10b981";
|
|
761
|
+
document.getElementById('circuitBreakerBtn').style.borderColor = "#10b981";
|
|
762
|
+
showToast("EMERGENCY CIRCUIT BREAKER TRIPPED! All agent spending frozen.", "โ");
|
|
763
|
+
addLog("CIRCUIT_BREAKER", "Emergency pause invoked by admin. Smart contract execute_spend() frozen.");
|
|
764
|
+
} else {
|
|
765
|
+
circuitStateVal.innerText = "NORMAL (UNPAUSED)";
|
|
766
|
+
circuitStateVal.style.color = "#22c55e";
|
|
767
|
+
document.getElementById('circuitBreakerBtn').innerText = "โ Circuit Breaker";
|
|
768
|
+
document.getElementById('circuitBreakerBtn').style.color = "#ef4444";
|
|
769
|
+
document.getElementById('circuitBreakerBtn').style.borderColor = "#ef4444";
|
|
770
|
+
showToast("Circuit Breaker restored to Normal", "โ
");
|
|
771
|
+
addLog("CIRCUIT_BREAKER", "Contract unpaused. Agent micro-spending operations restored.");
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
// Fire Single Micro-Spend ($0.05 / 0.0500 XLM)
|
|
776
|
+
function executeSpend(spendAmount = 0.05) {
|
|
777
|
+
if (isCircuitPaused) {
|
|
778
|
+
showToast("Spend rejected: Circuit Breaker is active!", "โ");
|
|
779
|
+
addLog("SPEND_REJECTED", "Error: Contract paused by circuit breaker.");
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
if (currentAllowance < spendAmount) {
|
|
784
|
+
showToast("Spend rejected: Allowance Cap Exceeded!", "โ");
|
|
785
|
+
addLog("SPEND_EXCEEDED", `Error: Agent attempted ${spendAmount.toFixed(4)} XLM with only ${currentAllowance.toFixed(4)} XLM remaining.`);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// Calculate 20 bps fee
|
|
790
|
+
const fee = spendAmount * 0.0020;
|
|
791
|
+
const netToService = spendAmount - fee;
|
|
792
|
+
|
|
793
|
+
currentAllowance -= spendAmount;
|
|
794
|
+
totalSpent += spendAmount;
|
|
795
|
+
|
|
796
|
+
activeAllowanceVal.innerText = `${currentAllowance.toFixed(4)} XLM`;
|
|
797
|
+
spentVal.innerText = `${totalSpent.toFixed(4)} XLM`;
|
|
798
|
+
|
|
799
|
+
const txHash = Math.random().toString(16).substring(2, 10);
|
|
800
|
+
addLog(
|
|
801
|
+
"EXECUTE_SPEND",
|
|
802
|
+
`Agent paid ${netToService.toFixed(4)} XLM to API Provider. (Tx: ${txHash}...)`,
|
|
803
|
+
`Fee: +${fee.toFixed(6)} XLM (20 bps)`
|
|
804
|
+
);
|
|
805
|
+
showToast(`Settled: ${spendAmount.toFixed(4)} XLM (99.8% to API, 0.2% Treasury)`, "โก");
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
document.getElementById('fireSpendBtn').addEventListener('click', () => {
|
|
809
|
+
executeSpend(0.05);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// Swarm Burst (10x micro-spends)
|
|
813
|
+
document.getElementById('burstBtn').addEventListener('click', () => {
|
|
814
|
+
let count = 0;
|
|
815
|
+
const interval = setInterval(() => {
|
|
816
|
+
executeSpend(0.02);
|
|
817
|
+
count++;
|
|
818
|
+
if (count >= 10 || isCircuitPaused || currentAllowance < 0.02) {
|
|
819
|
+
clearInterval(interval);
|
|
820
|
+
if (count > 0) {
|
|
821
|
+
showToast(`Swarm Burst complete: ${count} transactions settled on Soroban!`, "๐");
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, 150);
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
// Clear Logs
|
|
828
|
+
document.getElementById('clearLogsBtn').addEventListener('click', () => {
|
|
829
|
+
streamBox.innerHTML = `
|
|
830
|
+
<div class="log-line">
|
|
831
|
+
<span class="log-time">[RESET]</span>
|
|
832
|
+
<span class="log-event">STREAM_CLEARED</span>
|
|
833
|
+
<span>Event stream reset. Ready for next agent transaction.</span>
|
|
834
|
+
</div>
|
|
835
|
+
`;
|
|
836
|
+
showToast("Event stream cleared", "๐งน");
|
|
837
|
+
});
|
|
838
|
+
</script>
|
|
839
|
+
</body>
|
|
840
|
+
</html>
|