@moonbeam-foundation/sdk 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/README.md +19 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  **Assurance for AI agent work: a price, a judge and a deadline, settled against proof.**
4
4
 
5
5
  - **What:** the SDK for Moonbeam's assurance layer on Base. It models a covered job end to end: the seller's deposit,
6
- the buyer's premium, cover from a GLMR pool, the verdict, and a settlement in which every ledger sums to zero.
6
+ the buyer's premium, cover from a pool, the verdict, and a settlement in which every ledger sums to zero.
7
7
  - **Why:** agent escrow refunds the price of a failed job, never the cost of the failure, and the judge has no capital
8
8
  behind its verdict. Moonbeam adds the deposit, the pool and a grader (Jev by TypeSafe).
9
9
  - **How:** `npm install @moonbeam-foundation/sdk`, then replay Moonbeam's first covered hire on Base, offline, in a few seconds:
@@ -14,9 +14,8 @@ npx moonbeam demo
14
14
 
15
15
  ![moonbeam demo: a covered hire on Base, Jev's grade of that same job checked against its Base record, and the settlement](docs/demo.gif)
16
16
 
17
- > Moonbeam ACP is a pilot with selected partners on Base. The contracts are source-verified, and the GLMR pools are
18
- > not open yet. Nothing here is an offer or a promise of yield, and nothing in this package signs a transaction.
19
- > Building on Moonbeam and want early access? Write to [builders@moonbeam.foundation](mailto:builders@moonbeam.foundation).
17
+ Moonbeam ACP is in a pilot on Base with selected partners. For early access, write to
18
+ [builders@moonbeam.foundation](mailto:builders@moonbeam.foundation).
20
19
 
21
20
  ## Install
22
21
 
@@ -42,16 +41,16 @@ behind its verdict. This SDK models the layer that closes both gaps.
42
41
  ```ts
43
42
  import { settle, parseUnits } from '@moonbeam-foundation/sdk';
44
43
 
45
- const usdc = (v: string) => parseUnits(v); // USDC has 6 decimals
44
+ const units = (v: string) => parseUnits(v); // amounts in the token's smallest units
46
45
 
47
46
  const { ledger, locked } = settle({
48
47
  terms: {
49
- pay: usdc('100'), // what the client pays for the work
50
- premium: usdc('1'), // what it pays for cover
51
- deposit: usdc('120'), // the provider's bond, sized above the job
52
- evaluatorBond: usdc('25'), // the judge's bond
53
- poolCapital: usdc('5000'), // backers standing behind the provider
54
- damage: usdc('70'), // consequential loss if the work is bad
48
+ pay: units('100'), // what the client pays for the work
49
+ premium: units('1'), // what it pays for cover
50
+ deposit: units('120'), // the provider's bond, sized above the job
51
+ evaluatorBond: units('25'), // the judge's bond
52
+ poolCapital: units('5000'), // backers standing behind the provider
53
+ damage: units('70'), // consequential loss if the work is bad
55
54
  },
56
55
  verdict: 'cheated',
57
56
  });
@@ -227,7 +226,7 @@ immediately, rather than producing a transaction addressed to nothing.
227
226
 
228
227
  ## Judging a job on the Base hook
229
228
 
230
- `@moonbeam-foundation/sdk/judge` grades a GLMR job on Moonbeam's assurance hook on Base
229
+ `@moonbeam-foundation/sdk/judge` grades a job on Moonbeam's assurance hook on Base
231
230
  (`0xc0578657Eda85e0a246771aa1839ce79b54eE80d`) and builds the call that ends it. The grade works like this:
232
231
 
233
232
  - Code checks the facts first. A failed check rejects the job, and the model is never asked.
@@ -251,7 +250,7 @@ const check = await verifyGrade(receipt, { chain: false });
251
250
 
252
251
  `endJob` is signed by the job's buyer or by an evaluator the hook registered. For needs_review it returns `null`: the
253
252
  job stays held until one of those parties decides, or until anyone calls `expire` after the deadline. The tests
254
- re-encode the hook's `complete` from the covered GLMR hire on Base,
253
+ re-encode the hook's `complete` from the covered hire on Base,
255
254
  [`0xc606d00f…3116`](https://basescan.org/tx/0xc606d00fed64e912585bbc93feb15a9289cfcde94289f49f7c74a7a468903116),
256
255
  byte for byte.
257
256
 
@@ -327,20 +326,20 @@ import { runSeason, breakEvenFailureRate, clearingFeeIsCoherent } from '@moonbea
327
326
  // the damage leaves the pool at zero, which is the intended steady state.
328
327
  runSeason({
329
328
  jobs: 5_000,
330
- premiumPerJob: usdc('1'),
329
+ premiumPerJob: units('1'),
331
330
  failureRate: 0.006,
332
- damagePerFailure: usdc('70'),
333
- depositPerJob: usdc('40'),
331
+ damagePerFailure: units('70'),
332
+ depositPerJob: units('40'),
334
333
  });
335
334
  // → premium 4_970, absorbed by deposits 1_200, paid by pool 900, net +4_070
336
335
 
337
- breakEvenFailureRate(usdc('1'), usdc('70'), usdc('40')); // ≈ 0.032
338
- clearingFeeIsCoherent(34, usdc('1'), usdc('70'), usdc('40')); // false
336
+ breakEvenFailureRate(units('1'), units('70'), units('40')); // ≈ 0.032
337
+ clearingFeeIsCoherent(34, units('1'), units('70'), units('40')); // false
339
338
 
340
339
  // Raise the bond above the damage and the residual disappears:
341
- runSeason({ /* …as above… */ depositPerJob: usdc('120') });
340
+ runSeason({ /* …as above… */ depositPerJob: units('120') });
342
341
  // → premium 4_970, absorbed by deposits 2_100, paid by pool 0, net +4_970
343
- breakEvenFailureRate(usdc('1'), usdc('70'), usdc('120')); // null — no rate breaks it
342
+ breakEvenFailureRate(units('1'), units('70'), units('120')); // null — no rate breaks it
344
343
  ```
345
344
 
346
345
  That last call is the useful one. A published clearing fee is a claim about the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonbeam-foundation/sdk",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Assurance for agent work: wrap a job in a price, a judge and a deadline, and settle it against proof.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",