@moonbeam-foundation/sdk 0.5.3 → 0.10.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 +313 -39
- package/bin/moonbeam.mjs +15 -2
- package/dist/abi/index.d.ts +55 -0
- package/dist/abi/index.d.ts.map +1 -0
- package/dist/abi/index.js +227 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/acp/events.d.ts +38 -38
- package/dist/acp/events.d.ts.map +1 -1
- package/dist/acp/events.js.map +1 -1
- package/dist/acp/moonbeam-acp.generated.d.ts +55 -0
- package/dist/acp/moonbeam-acp.generated.d.ts.map +1 -0
- package/dist/acp/moonbeam-acp.generated.js +59 -0
- package/dist/acp/moonbeam-acp.generated.js.map +1 -0
- package/dist/acp/outcome.d.ts +5 -1
- package/dist/acp/outcome.d.ts.map +1 -1
- package/dist/acp/outcome.js +3 -2
- package/dist/acp/outcome.js.map +1 -1
- package/dist/acp/pipeline.js.map +1 -1
- package/dist/acp/registry.d.ts.map +1 -1
- package/dist/acp/registry.js +5 -3
- package/dist/acp/registry.js.map +1 -1
- package/dist/actors/track-record.js.map +1 -1
- package/dist/adapters/acp.js.map +1 -1
- package/dist/adapters/stamp.d.ts +2 -2
- package/dist/adapters/stamp.d.ts.map +1 -1
- package/dist/adapters/stamp.js +6 -6
- package/dist/adapters/stamp.js.map +1 -1
- package/dist/arbitration/index.d.ts +120 -0
- package/dist/arbitration/index.d.ts.map +1 -0
- package/dist/arbitration/index.js +116 -0
- package/dist/arbitration/index.js.map +1 -0
- package/dist/assurance/assurance-shared.d.ts +1924 -0
- package/dist/assurance/assurance-shared.d.ts.map +1 -0
- package/dist/assurance/assurance-shared.js +2227 -0
- package/dist/assurance/assurance-shared.js.map +1 -0
- package/dist/assurance/index.d.ts +57 -0
- package/dist/assurance/index.d.ts.map +1 -0
- package/dist/assurance/index.js +49 -0
- package/dist/assurance/index.js.map +1 -0
- package/dist/attest/index.d.ts +19 -0
- package/dist/attest/index.d.ts.map +1 -0
- package/dist/attest/index.js +17 -0
- package/dist/attest/index.js.map +1 -0
- package/dist/client/index.d.ts +16 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +21 -1
- package/dist/client/index.js.map +1 -1
- package/dist/connect/logs.js.map +1 -1
- package/dist/core/money.js.map +1 -1
- package/dist/core/settle.js.map +1 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/cover/index.d.ts +65 -0
- package/dist/cover/index.d.ts.map +1 -0
- package/dist/cover/index.js +61 -0
- package/dist/cover/index.js.map +1 -0
- package/dist/devnet/edge.d.ts +207 -0
- package/dist/devnet/edge.d.ts.map +1 -0
- package/dist/devnet/edge.js +209 -0
- package/dist/devnet/edge.js.map +1 -0
- package/dist/devnet/index.d.ts +403 -0
- package/dist/devnet/index.d.ts.map +1 -0
- package/dist/devnet/index.js +420 -0
- package/dist/devnet/index.js.map +1 -0
- package/dist/devnet/profile.d.ts +110 -0
- package/dist/devnet/profile.d.ts.map +1 -0
- package/dist/devnet/profile.js +145 -0
- package/dist/devnet/profile.js.map +1 -0
- package/dist/erc8004/index.d.ts +9 -9
- package/dist/erc8004/index.d.ts.map +1 -1
- package/dist/erc8004/index.js.map +1 -1
- package/dist/erc8004/registry.generated.d.ts.map +1 -1
- package/dist/erc8004/registry.generated.js +0 -1
- package/dist/erc8004/registry.generated.js.map +1 -1
- package/dist/erc8183/index.d.ts +12 -12
- package/dist/erc8183/index.d.ts.map +1 -1
- package/dist/erc8183/index.js.map +1 -1
- package/dist/errors/index.d.ts +51 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +63 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts +62 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +59 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/judge/index.d.ts +144 -4
- package/dist/judge/index.d.ts.map +1 -1
- package/dist/judge/index.js +138 -5
- package/dist/judge/index.js.map +1 -1
- package/dist/launcher/index.d.ts +3 -3
- package/dist/launcher/index.d.ts.map +1 -1
- package/dist/market/index.d.ts +162 -0
- package/dist/market/index.d.ts.map +1 -0
- package/dist/market/index.js +137 -0
- package/dist/market/index.js.map +1 -0
- package/dist/onboard/index.d.ts +66 -26
- package/dist/onboard/index.d.ts.map +1 -1
- package/dist/onboard/index.js +98 -29
- package/dist/onboard/index.js.map +1 -1
- package/dist/pools/index.d.ts +77 -11
- package/dist/pools/index.d.ts.map +1 -1
- package/dist/pools/index.js +58 -15
- package/dist/pools/index.js.map +1 -1
- package/dist/proof/index.d.ts +121 -0
- package/dist/proof/index.d.ts.map +1 -0
- package/dist/proof/index.js +84 -0
- package/dist/proof/index.js.map +1 -0
- package/dist/resale/index.d.ts +136 -0
- package/dist/resale/index.d.ts.map +1 -0
- package/dist/resale/index.js +131 -0
- package/dist/resale/index.js.map +1 -0
- package/dist/resale/payment-scheme.d.mts +46 -0
- package/dist/resale/payment-scheme.mjs +351 -0
- package/dist/resale/payment-scheme.pin.json +6 -0
- package/dist/resale/settle-rule.d.ts +49 -0
- package/dist/resale/settle-rule.d.ts.map +1 -0
- package/dist/resale/settle-rule.js +53 -0
- package/dist/resale/settle-rule.js.map +1 -0
- package/dist/rpc/index.d.ts +24 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +66 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/workflows/data.d.ts +3 -0
- package/dist/workflows/data.d.ts.map +1 -0
- package/dist/workflows/data.js +829 -0
- package/dist/workflows/data.js.map +1 -0
- package/dist/workflows/index.d.ts +31 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +104 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/types.d.ts +26 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +2 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/x402/index.d.ts +153 -0
- package/dist/x402/index.d.ts.map +1 -0
- package/dist/x402/index.js +143 -0
- package/dist/x402/index.js.map +1 -0
- package/docs/workflows/hire-from-chat.png +0 -0
- package/docs/workflows/list-business.png +0 -0
- package/docs/workflows/onboard-batch.png +0 -0
- package/docs/workflows/onboard.png +0 -0
- package/docs/workflows/publish.png +0 -0
- package/docs/workflows/resell.png +0 -0
- package/docs/workflows/sell-edge.png +0 -0
- package/examples/03-end-to-end-offline.mjs +2 -2
- package/examples/14-grade-record.mjs +6 -4
- package/examples/17-grade-live.mjs +1 -1
- package/examples/20-onboard-client.mjs +2 -2
- package/examples/24-resell-on-base.mjs +17 -0
- package/examples/{30-read-a-real-job.mjs → 30-read-a-job.mjs} +2 -2
- package/examples/32-read-live-from-base.mjs +8 -11
- package/examples/40-the-article.mjs +2 -2
- package/examples/50-x402-pay-a-wall.mjs +28 -0
- package/examples/51-read-a-proof.mjs +22 -0
- package/examples/52-arbitration-calls.mjs +13 -0
- package/examples/53-attested-by-default.mjs +19 -0
- package/examples/README.md +16 -7
- package/examples/data/proof-base-tx-52587000.json +116 -0
- package/examples/data/x402-wall-402.json +85 -0
- package/package.json +101 -20
- package/skills/moonbeam-actor-backer/SKILL.md +1 -1
- package/skills/moonbeam-actor-challenger/SKILL.md +1 -1
- package/skills/moonbeam-actor-doubter/SKILL.md +1 -1
- package/skills/moonbeam-assurance/SKILL.md +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Onboarding, buyer: before you fund a covered job, see what the cover
|
|
1
|
+
// Onboarding, buyer: before you fund a covered job, see what the cover pays and what it leaves uncovered.
|
|
2
2
|
// node examples/20-onboard-client.mjs
|
|
3
3
|
import { readinessForClient, blockers, summarise } from '@moonbeam-foundation/sdk';
|
|
4
4
|
import { TERMS, usdc, show } from './data/terms.mjs';
|
|
5
5
|
|
|
6
|
-
const r = readinessForClient({ terms: TERMS, trueLoss: usdc('500') }); // what a failure would
|
|
6
|
+
const r = readinessForClient({ terms: TERMS, trueLoss: usdc('500') }); // what a failure would cost you
|
|
7
7
|
show(r, summarise);
|
|
8
8
|
console.log('blockers:', blockers(r).length);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Reselling on Base: what a Moonbeam reseller's visitor pays for a job, where every unit of it goes, and the reseller's own leg.
|
|
2
|
+
// The numbers are the coordination layer's ONE payment scheme (a pinned copy); the venues are the five Base venues. Offline; no key.
|
|
3
|
+
// node examples/24-resell-on-base.mjs
|
|
4
|
+
import { quoteBase, legsByName, markupLeg, childKeyTerms, BASE_VENUES } from '@moonbeam-foundation/sdk/resale';
|
|
5
|
+
|
|
6
|
+
const sellerPrice = 8_000n; // the doer's own price: 0.008 USDC
|
|
7
|
+
const rows = [];
|
|
8
|
+
for (const venue_out of BASE_VENUES) {
|
|
9
|
+
const q = quoteBase({ venue_in: 'reseller', venue_out, seller_price: sellerPrice, reseller: { tenant: 'acct_moonbeam', markup_bps: 1000 } });
|
|
10
|
+
if (!q.ok) { console.log(`${venue_out}: refused: ${q.why}`); continue; }
|
|
11
|
+
const l = legsByName(q);
|
|
12
|
+
rows.push({ venue_out, buyer_pays: q.price_to_buyer, our_fee: l.our_fee.toString(), venue_fee: l.venue_fee.toString(), seller: l.seller_share.toString(), markup: markupLeg(q).units.toString() });
|
|
13
|
+
}
|
|
14
|
+
console.table(rows);
|
|
15
|
+
const first = rows[0];
|
|
16
|
+
console.log(`the doer keeps ${first.seller} on every venue; the reseller's leg is ${first.markup} (10 % of the list price); Σ legs = the price on every row`);
|
|
17
|
+
console.log(childKeyTerms({ '*': 1000 }).says[1]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Read a
|
|
1
|
+
// Read a job: decode agent jobs from their Base logs (Virtuals ACP, captured from mainnet) and fold each into one
|
|
2
2
|
// state: what happened, how it settles, and who judged it. Offline: the logs are in examples/data/.
|
|
3
|
-
// node examples/30-read-a-
|
|
3
|
+
// node examples/30-read-a-job.mjs
|
|
4
4
|
import { readFileSync } from 'node:fs';
|
|
5
5
|
import { decodeAcpLogs, foldTask, toOutcome, localClock } from '@moonbeam-foundation/sdk';
|
|
6
6
|
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
// Read live: one
|
|
1
|
+
// Read live: one job's events straight from Base, decode and fold them. Read only; no key.
|
|
2
|
+
// The reads go through the SDK's Base reader: warmbed's measured rotation of Base endpoints, so a rate-limited or
|
|
3
|
+
// range-capped endpoint moves the call to the next one.
|
|
2
4
|
// node examples/32-read-live-from-base.mjs Virtuals ACP job 74926 (the one captured in data/)
|
|
3
5
|
// JOB=12345 FROM_BLOCK=50000000 node examples/32-read-live-from-base.mjs
|
|
4
|
-
// BASE_RPC=https://your-rpc node examples/32-read-live-from-base.mjs
|
|
6
|
+
// BASE_RPC=https://your-rpc node examples/32-read-live-from-base.mjs (your endpoint goes first)
|
|
5
7
|
import { decodeAcpLogs, foldTask, toOutcome, localClock, VIRTUALS_ACP_ADDRESS, ACP_TOPIC0 } from '@moonbeam-foundation/sdk';
|
|
8
|
+
import { baseReader } from '@moonbeam-foundation/sdk/rpc';
|
|
6
9
|
|
|
7
|
-
const
|
|
10
|
+
const reader = baseReader();
|
|
8
11
|
const job = BigInt(process.env.JOB ?? 74926);
|
|
9
12
|
const from = Number(process.env.FROM_BLOCK ?? 50_427_200);
|
|
10
13
|
const SPAN = 500, WINDOWS = Number(process.env.WINDOWS ?? 4); // public RPCs cap the block range per call
|
|
11
|
-
|
|
12
|
-
async function rpc(method, params) {
|
|
13
|
-
const res = await fetch(RPC, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }) });
|
|
14
|
-
const body = await res.json();
|
|
15
|
-
if (body.error) throw new Error(`${method}: ${body.error.message}`);
|
|
16
|
-
return body.result;
|
|
17
|
-
}
|
|
14
|
+
const rpc = (method, params, need = 'call') => reader.call(method, params, need);
|
|
18
15
|
|
|
19
16
|
const virtuals = ['jobCreated', 'budgetSet', 'jobFunded', 'paymentReleased', 'jobRefunded', 'jobSubmitted', 'jobCompleted', 'jobRejected', 'jobExpired', 'evaluatorFeePaid'].map((k) => ACP_TOPIC0[k]);
|
|
20
17
|
const jobTopic = '0x' + job.toString(16).padStart(64, '0');
|
|
21
18
|
const logs = [];
|
|
22
19
|
for (let i = 0; i < WINDOWS; i++) {
|
|
23
20
|
const lo = from + i * SPAN, hi = lo + SPAN - 1;
|
|
24
|
-
logs.push(...(await rpc('eth_getLogs', [{ address: VIRTUALS_ACP_ADDRESS, topics: [virtuals, jobTopic], fromBlock: '0x' + lo.toString(16), toBlock: '0x' + hi.toString(16) }])));
|
|
21
|
+
logs.push(...(await rpc('eth_getLogs', [{ address: VIRTUALS_ACP_ADDRESS, topics: [virtuals, jobTopic], fromBlock: '0x' + lo.toString(16), toBlock: '0x' + hi.toString(16) }], 'logs')));
|
|
25
22
|
}
|
|
26
23
|
const events = decodeAcpLogs(logs);
|
|
27
24
|
console.log(`job ${job}, blocks ${from}–${from + WINDOWS * SPAN - 1}: ${events.length} events`);
|
|
@@ -19,7 +19,7 @@ const data = (f) => JSON.parse(readFileSync(new URL(`./data/${f}`, import.meta.u
|
|
|
19
19
|
title('"It reads the chain. It decodes ERC-8183 logs into one job state, says who can act next, and says which endings need a grader."');
|
|
20
20
|
{
|
|
21
21
|
const state = foldTask(decodeAcpLogs(data('virtuals-job-74926.json')));
|
|
22
|
-
check('decodes a
|
|
22
|
+
check('decodes a Base job\'s logs into one state', state.work === 'graded' || state.escrow !== 'none', `job ${state.id}: ${state.work}`);
|
|
23
23
|
const clock = localClock(Math.floor(Date.UTC(2026, 8, 1) / 1000));
|
|
24
24
|
const acts = availableActions(state, clock);
|
|
25
25
|
check('says who can act next', Array.isArray(acts), `${acts.length} action(s) open · waiting on ${waitingOn(state, clock) ?? 'nobody (ended)'}`);
|
|
@@ -50,7 +50,7 @@ title('"It runs the grader end to end. Evidence, facts, Jev\'s answers, the verd
|
|
|
50
50
|
const endC = endJob(PILOT_JOB, good), endR = endJob(PILOT_JOB, bad);
|
|
51
51
|
check('the ending call: complete, or reject with the decision\'s fingerprint', endC && endR && /^0x/.test(endC.data) && endR.data.toLowerCase().includes(bad.decision.digest.slice(2).toLowerCase()), `to ${endC?.to}`);
|
|
52
52
|
check('the ending call targets the job contract in the article', endC?.to?.toLowerCase() === '0xc0578657eda85e0a246771aa1839ce79b54ee80d');
|
|
53
|
-
const live = await gradeJob({ jobId: PILOT_JOB, evidence: 'x' }).then(() => 'answered', (e) => String(e?.message ?? e));
|
|
53
|
+
const live = await gradeJob({ jobId: PILOT_JOB, evidence: 'x', layer: false }).then(() => 'answered', (e) => String(e?.message ?? e));
|
|
54
54
|
check('Jev is called only with your own TypeSafe key', /TypeSafe key/i.test(live), live.slice(0, 80));
|
|
55
55
|
check('the input fingerprint is the SHA-256 of the text Jev read', (await verifyGrade(good, { chain: false })).checks.inputDigest === true);
|
|
56
56
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// x402: read a wall's 402 quote, pick the entry of the network you pay from, and build the payment your wallet signs
|
|
2
|
+
// (EIP-3009 transferWithAuthorization) and the PAYMENT-SIGNATURE header that carries it. Nothing is signed or paid here.
|
|
3
|
+
// node examples/50-x402-pay-a-wall.mjs the recorded quote (six networks, Solana included)
|
|
4
|
+
// MOONBEAM_API=<your coordination endpoint>/v1 node examples/50-x402-pay-a-wall.mjs the same, quoted live
|
|
5
|
+
// NETWORK=eip155:42161 node examples/50-x402-pay-a-wall.mjs pay from another network the wall offers
|
|
6
|
+
// test/fork/run-fork.mjs signs it and executes it on a Base fork
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
import { quoteWall, pickAccept, chainIdOf, transferAuthorization, paymentHeaders, subscribePlan } from '@moonbeam-foundation/sdk/x402';
|
|
9
|
+
import { quoteSale, sellerRailOf } from '@moonbeam-foundation/sdk/resale';
|
|
10
|
+
|
|
11
|
+
const network = process.env.NETWORK ?? 'eip155:8453';
|
|
12
|
+
const recorded = JSON.parse(readFileSync(new URL('./data/x402-wall-402.json', import.meta.url), 'utf8'));
|
|
13
|
+
const api = process.env.OFFLINE ? null : process.env.MOONBEAM_API ?? null;
|
|
14
|
+
const live = api ? await quoteWall({ base: api, fetch: (u, i) => fetch(u, i) }, '/x402/class/mcp.digest', { network }) : null;
|
|
15
|
+
const accept = live ? live.accept : pickAccept(recorded, { network });
|
|
16
|
+
console.log(`the wall offers ${(live ? live.body : recorded.x402).accepts.map((a) => a.network).join(', ')}; on ${accept.network} it asks ${accept.amount} units of ${accept.asset}, paid to ${accept.payTo}`);
|
|
17
|
+
const q = quoteSale({ venue_in: 'x402-base', venue_out: 'x402-base', seller_price: 9207n });
|
|
18
|
+
console.log(`quoteSale: the seller's 9207 → the buyer pays ${q.price_to_buyer} (the same scheme the wall prices with)`);
|
|
19
|
+
const rail = sellerRailOf({ accepts: { network: 'solana', asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', payTo: 'GQcEn5pLcweo7qaiy3rDdsiUPiygygmFBaixNtNqhQVD' } });
|
|
20
|
+
console.log(`a seller who published a Solana offer is paid there: ${rail.network} ${rail.token?.symbol} to ${rail.pay_to} (${rail.state})`);
|
|
21
|
+
if (chainIdOf(accept.network) === null) {
|
|
22
|
+
console.log(`${accept.network} is not an EIP-3009 network: your Solana wallet sends ${accept.amount} units of ${accept.asset} to ${accept.payTo} (fee payer ${accept.extra?.feePayer ?? 'yours'})`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
const typed = transferAuthorization(accept, { from: '0x000000000000000000000000000000000000dEaD' });
|
|
26
|
+
console.log(`your wallet signs ${typed.primaryType} under ${typed.domain.name} v${typed.domain.version} on chain ${typed.domain.chainId}: value ${typed.message.value}, valid before ${typed.message.validBefore}`);
|
|
27
|
+
const headers = paymentHeaders(accept, typed.message, `0x${'11'.repeat(65)}`);
|
|
28
|
+
console.log(`then the request carries ${Object.keys(headers).join(' + ')} (x402 v2: the accepted entry and the signed authorization); a top-up starts at`, JSON.stringify(subscribePlan({ usdc: 1 }).body));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// A proof that a Base transaction is inside the layer's superroot, and the V5 proof verifier on Base checking it.
|
|
2
|
+
// MOONBEAM_API=<your coordination endpoint>/v1 node examples/51-read-a-proof.mjs [txHash]
|
|
3
|
+
// read the proof live, then verify(blob) by eth_call on Base
|
|
4
|
+
// node examples/51-read-a-proof.mjs the recorded proof, and the call that Base answered true for
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { readProof, verifyCall, verifyOnBase } from '@moonbeam-foundation/sdk/proof';
|
|
7
|
+
import { baseReader } from '@moonbeam-foundation/sdk/rpc';
|
|
8
|
+
|
|
9
|
+
const tx = process.argv[2] ?? '0x48f87043df02dc8f97c3a70afb8c8748848d0efae865cb251c429cce57bc127f';
|
|
10
|
+
if (process.env.OFFLINE || !process.env.MOONBEAM_API) {
|
|
11
|
+
const p = JSON.parse(readFileSync(new URL('./data/proof-base-tx-52587000.json', import.meta.url), 'utf8'));
|
|
12
|
+
const c = verifyCall(p.blob);
|
|
13
|
+
console.log(`recorded proof of ${p.tx}: block ${p.block_number}, superroot 0x${p.super_root_hash}`);
|
|
14
|
+
console.log(`verify(blob) → ${c.to}, bound at block ${c.boundAt.blockNumber}, ${c.data.length / 2 - 1} bytes of calldata`);
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
const p = await readProof({ base: process.env.MOONBEAM_API, fetch: (u, i) => fetch(u, i) }, tx);
|
|
18
|
+
console.log(`proof of ${p.tx}: block ${p.block_number} · proven by the layer: ${p.proven} · ${p.ref}`);
|
|
19
|
+
if (p.blob) {
|
|
20
|
+
const c = await verifyOnBase(baseReader(), p.blob);
|
|
21
|
+
console.log(`verify(blob) on Base: ${c.verified}${c.error ? ` (${c.error})` : ''} · superroot anchored on chain: ${c.anchored} · block bound by: ${c.inclusion === 'served' ? 'the served inclusion path' : 'the header itself'}`);
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Arbitration: the three tiers of the ArbitratorRouter as unsigned calls, the verdict the second grader signs, and what
|
|
2
|
+
// a ruling writes into the seller's record. Offline.
|
|
3
|
+
// node examples/52-arbitration-calls.mjs
|
|
4
|
+
import { ARBITRATION_ON_BASE, resolveByCode, secondGraderTypedData, verdictDigest, councilApprove, resolveByCouncil, recordEffectOf } from '@moonbeam-foundation/sdk/arbitration';
|
|
5
|
+
|
|
6
|
+
console.log(ARBITRATION_ON_BASE.says);
|
|
7
|
+
const router = '0x00000000000000000000000000000000000000ab'; // pass the router's address once it is deployed
|
|
8
|
+
const jobId = '0x' + '11'.repeat(32);
|
|
9
|
+
console.log('tier 0, anyone:', resolveByCode(router, jobId).fn);
|
|
10
|
+
const v = { jobId, verdict: 'Cheated', loss: 10n ** 18n, decisionDigest: '0x' + '22'.repeat(32) };
|
|
11
|
+
console.log('tier 1, the second grader signs', secondGraderTypedData(router, v).primaryType, '→ digest', verdictDigest(router, v));
|
|
12
|
+
console.log('tier 2, the human seat:', councilApprove(router, jobId, 'Cheated', 10n ** 18n).fn, '· then anyone:', resolveByCouncil(router, jobId).fn);
|
|
13
|
+
console.log('a Cheated ruling:', recordEffectOf('Cheated').hook, '· seller record:', recordEffectOf('Cheated').sellerRecord);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Every step comes attested: a settle, a grade and a resale step each return their mark (a digest anyone recomputes)
|
|
2
|
+
// and the unsigned calls that put it on Base. Base has the decision log and the answer log; a stamp registry it does not
|
|
3
|
+
// have is listed as missing, not faked. networks: 'none' turns recording off. Offline.
|
|
4
|
+
// node examples/53-attested-by-default.mjs
|
|
5
|
+
import { settleAttested, hookQuote, readJob } from '@moonbeam-foundation/sdk/assurance';
|
|
6
|
+
import { gradeJob, recordGrade } from '@moonbeam-foundation/sdk/judge';
|
|
7
|
+
import { attestSale, quoteSale } from '@moonbeam-foundation/sdk/resale';
|
|
8
|
+
import { CLEAN, PILOT_JOB } from './data/answers.mjs';
|
|
9
|
+
|
|
10
|
+
const trail = readJob([1, 2, 3].map((hookState) => ({ name: 'hook', hookState })));
|
|
11
|
+
const s = settleAttested({ venue: 'moonbeam', ctx: { lane: 'hook', hook: 'V3' }, chainId: 8453, jobId: PILOT_JOB, buyer: '0x' + '0'.repeat(39) + '1', seller: '0x' + '0'.repeat(39) + '2', evaluator: null, terms: null, clock: {}, state: trail.state, path: trail.path },
|
|
12
|
+
hookQuote({ price: 10n * 10n ** 18n, premium: 10n ** 17n, deposit: 12n * 10n ** 18n, covered: true }));
|
|
13
|
+
const show = (label, a) => console.log(`${label}: mark ${a.mark.digest.slice(0, 18)}… → ${a.calls.map((c) => `${c.fn}@${c.chainId}`).join(', ')}${a.missing.length ? ` · missing: ${a.missing.map((m) => `${m.contract}@${m.chainId}`).join(', ')}` : ''}`);
|
|
14
|
+
show(`settle (${s.ending.id}), Base 8453`, s.attest);
|
|
15
|
+
const g = await recordGrade(await gradeJob({ jobId: PILOT_JOB, evidence: 'the report', answers: CLEAN, model: 'jev-1.13.0' }));
|
|
16
|
+
console.log(`grade: ${g.calls.map((c) => `${c.fn}@${c.chainId}`).join(', ')} · missing: ${g.missing.map((m) => `${m.contract}@${m.chainId}`).join(', ')}`);
|
|
17
|
+
const q = quoteSale({ venue_in: 'x402-base', venue_out: 'erc8183-base', seller_price: 1_000_000n });
|
|
18
|
+
show('resale quoted', attestSale({ saleKey: 'rs_example_0123456789', step: 'quoted', quote: q }));
|
|
19
|
+
console.log('opted out:', attestSale({ saleKey: 'rs_example_0123456789', step: 'quoted', quote: q }, { networks: 'none' }).status);
|
package/examples/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Examples
|
|
2
2
|
|
|
3
|
-
Every example is one file you run with `node`. All except
|
|
4
|
-
Base jobs captured into [`data/`](data).
|
|
3
|
+
Every example is one file you run with `node`. All except four run offline, with no key and no wallet; the jobs they use are
|
|
4
|
+
Base jobs captured into [`data/`](data). 17 and 32 read live; 50 and 51 read live and run offline with `OFFLINE=1`. `npm test`
|
|
5
|
+
runs every offline example and checks the line each one promises below. `test/fork/run-fork.mjs` sends the write paths on a
|
|
6
|
+
local fork of Base.
|
|
5
7
|
|
|
6
8
|
```sh
|
|
7
9
|
npm i @moonbeam-foundation/sdk
|
|
@@ -23,7 +25,7 @@ reading jobs that already ran ────────▶ 30, 31, 33, then 32 li
|
|
|
23
25
|
|
|
24
26
|
| # | File | Best for | You see |
|
|
25
27
|
|---|---|---|---|
|
|
26
|
-
| 03 | [end-to-end-offline](03-end-to-end-offline.mjs) | **Start here.** One
|
|
28
|
+
| 03 | [end-to-end-offline](03-end-to-end-offline.mjs) | **Start here.** One job from its Base trail to who ends up with what | `3 settle client -101 · provider +100 · pool +1 · sums to zero` |
|
|
27
29
|
| 01 | [settle-a-covered-job](01-settle-a-covered-job.mjs) | The four ways a covered job can end, in money | four ledgers, each `sums to zero: true` |
|
|
28
30
|
| 02 | [negotiate-a-hire](02-negotiate-a-hire.mjs) | A buyer posts, two agents bid, the thin bond is refused | `agent-b refused: DEPOSIT_BELOW_JOB` |
|
|
29
31
|
|
|
@@ -38,7 +40,7 @@ Stages 1–7 run offline on recorded answers; 17 runs the same thing live.
|
|
|
38
40
|
| 11 | [facts](11-grade-facts.mjs) | Code checks what code can check. A failed check rejects without asking a model | `checksOk: false` |
|
|
39
41
|
| 12 | [answers](12-grade-answers.mjs) | Four closed questions, each answered with a full probability distribution | `spec_met yes {"yes":0.95,"no":0.05}` |
|
|
40
42
|
| 13 | [verdict](13-grade-verdict.mjs) | complete, reject or needs_review, from published thresholds | `UNSURE → needs_review mid band: …` |
|
|
41
|
-
| 14 | [record](14-grade-record.mjs) |
|
|
43
|
+
| 14 | [record](14-grade-record.mjs) | The unsigned calls that put the grade on Base, built by default; `network: 'none'` turns them off | `network none → 0 calls` |
|
|
42
44
|
| 15 | [end the job](15-grade-end-the-job.mjs) | The one unsigned call that completes or rejects the job on the hook | `complete → complete(bytes32) to 0xc057…` |
|
|
43
45
|
| 16 | [verify](16-grade-verify.mjs) | Anyone can recompute a grade; a changed verdict is caught | `tampered: false` |
|
|
44
46
|
| 17 | [live](17-grade-live.mjs) | The same grade, answered live on your own key | a receipt, or how to get a key |
|
|
@@ -53,14 +55,15 @@ Each role gets a readiness report: what you put up, what you can lose, and anyth
|
|
|
53
55
|
| 21 | [onboard-provider](21-onboard-provider.mjs) | Doing the work | `[block] this job needs a 40 deposit and you have 30 free` |
|
|
54
56
|
| 22 | [onboard-evaluator](22-onboard-evaluator.mjs) | Judging the work | `[caution] without a verifiable proof you can reject but never approve` |
|
|
55
57
|
| 23 | [onboard-backer](23-onboard-backer.mjs) | Standing behind workers (pools are not open yet; this is the arithmetic) | `breaks even at 3.23%` |
|
|
58
|
+
| 24 | [resell-on-base](24-resell-on-base.mjs) | A Moonbeam reseller's quote on every Base venue: the one scheme, the doer keeps its price, the reseller's leg | `the doer keeps 8000 on every venue` |
|
|
56
59
|
|
|
57
60
|
## Reading jobs that already ran
|
|
58
61
|
|
|
59
62
|
| # | File | What it shows | You see |
|
|
60
63
|
|---|---|---|---|
|
|
61
|
-
| 30 | [read-a-
|
|
64
|
+
| 30 | [read-a-job](30-read-a-job.mjs) | Decode two Virtuals ACP jobs from their Base logs | `settles as: rejected (evaluatorRejected)` |
|
|
62
65
|
| 31 | [read-the-ending](31-read-the-ending.mjs) | Which endings the trail decides alone, and which need a grader | `cannot_determine (needs a grader)` |
|
|
63
|
-
| 32 | [read-live-from-base](32-read-live-from-base.mjs) | The same, straight from
|
|
66
|
+
| 32 | [read-live-from-base](32-read-live-from-base.mjs) | The same, straight from Base through the SDK's Base reader | `6 events` for job 74926 |
|
|
64
67
|
| 33 | [read-many-jobs](33-read-many-jobs.mjs) | Many jobs at once: how many were judged by someone other than the buyer | `2 jobs · self-judged: 2` |
|
|
65
68
|
|
|
66
69
|
## The article, claim by claim
|
|
@@ -68,15 +71,21 @@ Each role gets a readiness report: what you put up, what you can lose, and anyth
|
|
|
68
71
|
| # | File | What it shows | You see |
|
|
69
72
|
|---|---|---|---|
|
|
70
73
|
| 40 | [the-article](40-the-article.mjs) | Every claim the launch article makes about the SDK, checked. Live, it also finds the equation job's grade on Base (`OFFLINE=1` skips that) | `every claim holds` |
|
|
74
|
+
| 50 | [x402-pay-a-wall](50-x402-pay-a-wall.mjs) | A wall's 402 (six networks), the entry of your network, `quoteSale`'s price, where a seller on Solana is paid, the EIP-3009 typed data your wallet signs and the PAYMENT-SIGNATURE header | `signs TransferWithAuthorization under USD Coin v2 on chain 8453` |
|
|
75
|
+
| 51 | [read-a-proof](51-read-a-proof.mjs) | A Base transaction's proof from the layer, then `verify(blob)` on the V5 verifier on Base | `verify(blob) on Base: true` |
|
|
76
|
+
| 52 | [arbitration-calls](52-arbitration-calls.mjs) | The three tiers of the ArbitratorRouter as unsigned calls, and what a ruling writes into the record | `findCheated(jobId, loss)` |
|
|
77
|
+
| 53 | [attested-by-default](53-attested-by-default.mjs) | A settle, a grade and a resale step, each with its mark and its calls on Base; the stamp Base lacks said | `missing: GradeStampRegistry@8453` |
|
|
71
78
|
|
|
72
79
|
## Settings
|
|
73
80
|
|
|
74
|
-
Only the
|
|
81
|
+
Only the live examples read anything from the environment.
|
|
75
82
|
|
|
76
83
|
| Variable | Used by | Required | Default |
|
|
77
84
|
|---|---|---|---|
|
|
78
85
|
| `TYPESAFE_KEY` | 17 | yes, for 17 | none: 17 explains how to get one and stops. Your key is sent to TypeSafe only |
|
|
79
86
|
| `BASE_RPC` | 32 | no | `https://mainnet.base.org` |
|
|
87
|
+
| `MOONBEAM_API` | 50, 51 | no | none: they use their recorded answers. Set it to your coordination endpoint (`…/v1`) to read live |
|
|
88
|
+
| `NETWORK` | 50 | no | `eip155:8453` (any network the wall offers: `arbitrum`, `eip155:5042`, `solana`, …) |
|
|
80
89
|
| `JOB` | 32 | no | `74926` |
|
|
81
90
|
| `FROM_BLOCK`, `WINDOWS` | 32 | no | `50427200`, `4` windows of 500 blocks |
|
|
82
91
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ok": true,
|
|
3
|
+
"chain_id": 8453,
|
|
4
|
+
"tx": "0x48f87043df02dc8f97c3a70afb8c8748848d0efae865cb251c429cce57bc127f",
|
|
5
|
+
"block_number": 52587000,
|
|
6
|
+
"block_hash": "0xce0c4c585c9d88150cacfec796ab51a5acdb42b8b0570a0da2f90679ba74dbd3",
|
|
7
|
+
"is_finalized": true,
|
|
8
|
+
"proven": true,
|
|
9
|
+
"proof_state": "proven",
|
|
10
|
+
"super_root_hash": "af8134f8fc0de7a2ab4456adcbb847761102065a6e81da26cc5d957435628a04",
|
|
11
|
+
"batch_id": 1791967493,
|
|
12
|
+
"finality_block": 52588585,
|
|
13
|
+
"finalized_block_hash": "0x81a0d70ecfa2132d53e2759bd7b4e5639d43c559727e0d890f788aaf2d6776c1",
|
|
14
|
+
"verifiable_block": 52588585,
|
|
15
|
+
"checks": {
|
|
16
|
+
"receipt_found": true,
|
|
17
|
+
"tx_succeeded": true,
|
|
18
|
+
"proof_served": true,
|
|
19
|
+
"block_hash_matches": true,
|
|
20
|
+
"within_verifiable_range": true
|
|
21
|
+
},
|
|
22
|
+
"source": "receipt read from chain; block proof from the producer; block hash compared between the two",
|
|
23
|
+
"blob": {
|
|
24
|
+
"superroot": {
|
|
25
|
+
"superrootHash": "0xaf8134f8fc0de7a2ab4456adcbb847761102065a6e81da26cc5d957435628a04",
|
|
26
|
+
"batchId": 1791967493,
|
|
27
|
+
"chainCount": 76,
|
|
28
|
+
"totalTwigs": 15664981
|
|
29
|
+
},
|
|
30
|
+
"chainHeaders": [
|
|
31
|
+
{
|
|
32
|
+
"chainId": 8453,
|
|
33
|
+
"chainType": 0,
|
|
34
|
+
"blockNumber": 52587000,
|
|
35
|
+
"blockHash": "0xce0c4c585c9d88150cacfec796ab51a5acdb42b8b0570a0da2f90679ba74dbd3",
|
|
36
|
+
"miniMmrRoot": "0xa6b8213dd9ac171ad580db56a3eb7b640141d227f4b078d62f037f191140f24e",
|
|
37
|
+
"twigCount": 7316750,
|
|
38
|
+
"stateRoot": "0x24d77153e44b43a107b419502d81f114adb3826f02e804c5f51a08dc8de502de"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"superrootProof": {
|
|
42
|
+
"targetChainIndex": 4,
|
|
43
|
+
"siblings": [
|
|
44
|
+
"0x0fd49ee3e6a6fbbbd6b84b6f8eaedd1b95866c9bca6e8578acff0a2bd99ef862",
|
|
45
|
+
"0xbd92daadb001856b635ced48ab36e974c4d49591833ae7fda4b5de5acf33ab13",
|
|
46
|
+
"0x508428f519638d847366a67192c9395fde6ddeccc4efa3c7be4d07ac0f54c9d0",
|
|
47
|
+
"0x231add3099e2ad97acbebe11f1f5b09d090a65018f18c3a26b432676dabc2028",
|
|
48
|
+
"0x2ba3594dfe41c71b787e4fd18ef48e35acca24f2e85e5c2bb10cb6e7602a0849",
|
|
49
|
+
"0x5bb6ec61927fec1e96c7ee107f2355ff2ec8e190b0325d6237e68135eb0d2bea",
|
|
50
|
+
"0xa7a60abbcdf5183a8cc8310db3b4c0237639125c5ec3f7e940b4b27e847ace83"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"blockProof": {
|
|
54
|
+
"blockIndex": 52587000,
|
|
55
|
+
"siblings": [],
|
|
56
|
+
"l4Status": "block is bound by `inclusion`: its hash folds to miniMmrRoot at index = block number; `siblings` is left empty because the deployed v5.0 verifier folds the snapshot-tip header's hash, not this block's",
|
|
57
|
+
"inclusion": {
|
|
58
|
+
"blockNumber": 52587000,
|
|
59
|
+
"blockHash": "0xce0c4c585c9d88150cacfec796ab51a5acdb42b8b0570a0da2f90679ba74dbd3",
|
|
60
|
+
"index": 52587000,
|
|
61
|
+
"siblings": [
|
|
62
|
+
"0x043b28d01bbca81b36e04c4e7fd726e900e45e574db168ed13579f3a0d3e244f",
|
|
63
|
+
"0x100046450ce4770bae09f3a200cc2bd9ce3de122f090bbb187d3d1b987f73e54",
|
|
64
|
+
"0xe3618ea65f808242ffe9d3d7475dba837c2467554eb751c8efe1556e54f03bda",
|
|
65
|
+
"0xf76ff27d7bd09c305fdf7aa975b77ce0d1a8f3e197dcf6cf54d8c900d07fbf41",
|
|
66
|
+
"0x4d313f8ba598331677b797dea1a5cb1d551f72d10cbabf60b7ac61639246af30",
|
|
67
|
+
"0xe452f8df4808e6c3945417a8acfa6bc110041558b0b4b5570640f08e307464b4",
|
|
68
|
+
"0x8c6deaf63e1ad1f04ae481bcbb85a42aa6da7d9386a3b51bc9d1a56ca40815b6",
|
|
69
|
+
"0x96b5e1394de1d84aaccd42a7dae0ca697853fac22470952aad3d8916a51896fd",
|
|
70
|
+
"0x89b303cd5084be070a694010736650f52a28ba9f5030ca159e2edddc8f9a9f13",
|
|
71
|
+
"0x96c1e34609a7afdb4a4fb41f11a6e00b370e47b0eef7187c3984705f9862461d",
|
|
72
|
+
"0x7760cfe7149aecabfa7bfdf320fcdf140c3281af255143582bf54dd9dbd9aa94",
|
|
73
|
+
"0xbfe49b5957155850e6f748971be706595962973ad2bb635e2514458b3eb3eb4d",
|
|
74
|
+
"0x7765a9828a5f351e4585902b21419f09ef6ed395f8bda308f868267d8bc74921",
|
|
75
|
+
"0xc55a4d3f8b7d145f438028edec83bf2d7651e5f033434808d1d00f32bb1091c7",
|
|
76
|
+
"0x66cfa7c9b1a6bd60caaf2178736d803b8d8a58a7234a01cb0173ff7eb9708745",
|
|
77
|
+
"0xda7bce9f4e8618b6bd2f4132ce798cdc7a60e7e1460a7299e3c6342a579626d2",
|
|
78
|
+
"0x2733e50f526ec2fa19a22b31e8ed50f23cd1fdf94c9154ed3a7609a2f1ff981f",
|
|
79
|
+
"0xefc595b82ec8c78a5df2927bbe6bb5a096426f2cb78d20b367831d25a080c648",
|
|
80
|
+
"0x5a2dce0a8a7f68bb74560f8f71837c2c2ebbcbf7fffb42ae1896f13f7c7479a0",
|
|
81
|
+
"0xb46a28b6f55540f89444f63de0378e3d121be09e06cc9ded1c20e65876d36aa0",
|
|
82
|
+
"0xc65e9645644786b620e2dd2ad648ddfcbf4a7e5b1a3a4ecfe7f64667a3f0b7e2",
|
|
83
|
+
"0xb9565c463b5a2ce6e81d5eec6214a825a365276138419083c0e8aa57fc2a25b1",
|
|
84
|
+
"0x5a9c16dc00d6ef18b7933a6f8dc65ccb55667138776f7dea101070dc8796e377",
|
|
85
|
+
"0x4df84f40ae0c8229d0d6069e5c8f39a7c299677a09d367fc7b05e3bc380ee652",
|
|
86
|
+
"0xb863a0ce7902ee4f773f51c4e0606882d6890e17989bf7c06aa9227fa08546f4",
|
|
87
|
+
"0x0abf5ac974a1ed57f4050aa510dd9c74f508277b39d7973bb2dfccc5eeb0618d",
|
|
88
|
+
"0xb8cd74046ff337f0a7bf2c8e03e10f642c1886798d71806ab1e888d9e5ee87d0",
|
|
89
|
+
"0x838c5655cb21c6cb83313b5a631175dff4963772cce9108188b34ac87c81c41e",
|
|
90
|
+
"0x662ee4dd2dd7b2bc707961b1e646c4047669dcb6584f0d8d770daf5d7e7deb2e",
|
|
91
|
+
"0x388ab20e2573d171a88108e79d820e98f26c0b84aa8b2f4aa4968dbb818ea322",
|
|
92
|
+
"0x93237c50ba75ee485f4c22adf2f741400bdf8d6a9cc7df7ecae576221665d735",
|
|
93
|
+
"0x8448818bb4ae4562849e949e17ac16e0be16688e156b5cf15e098c627c0056a9"
|
|
94
|
+
],
|
|
95
|
+
"root": "0xa6b8213dd9ac171ad580db56a3eb7b640141d227f4b078d62f037f191140f24e",
|
|
96
|
+
"tipBlockNumber": 52588585,
|
|
97
|
+
"tipBlockHash": "0x81a0d70ecfa2132d53e2759bd7b4e5639d43c559727e0d890f788aaf2d6776c1",
|
|
98
|
+
"twigCount": 7316750,
|
|
99
|
+
"treeVersion": 84269
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"event": {
|
|
103
|
+
"chainType": 0,
|
|
104
|
+
"encoded": "0x"
|
|
105
|
+
},
|
|
106
|
+
"finality": {
|
|
107
|
+
"chainId": 8453,
|
|
108
|
+
"blockNumber": 52587000,
|
|
109
|
+
"finalityType": 12,
|
|
110
|
+
"proof": "0x000000000000000000000000b1d481571395a2f3e6672df8cfaa4331aafa2464c2091dcdd1299851b1321a8ee36ce19b3512a5aeff12b30f9a3409a98f287bec00000000000000000000000000000000000000000000000000000000031ea3680000000000000000000000000000000000000000000000000000000000000002",
|
|
111
|
+
"finalizedBlockNumber": 52588585,
|
|
112
|
+
"finalizedBlockHash": "0x81a0d70ecfa2132d53e2759bd7b4e5639d43c559727e0d890f788aaf2d6776c1"
|
|
113
|
+
},
|
|
114
|
+
"verifiableBlock": 52588585
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recorded": "POST /v1/x402/class/mcp.digest without a payment, 2026-10-21: the 402 (accepts trimmed of resource and description)",
|
|
3
|
+
"x402": {
|
|
4
|
+
"x402Version": 2,
|
|
5
|
+
"accepts": [
|
|
6
|
+
{
|
|
7
|
+
"scheme": "exact",
|
|
8
|
+
"network": "eip155:8453",
|
|
9
|
+
"amount": "5455",
|
|
10
|
+
"maxAmountRequired": "5455",
|
|
11
|
+
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
12
|
+
"payTo": "0x3574999dd4c96eB73Bd6e11D4177010C83E14f5b",
|
|
13
|
+
"maxTimeoutSeconds": 300,
|
|
14
|
+
"extra": {
|
|
15
|
+
"name": "USD Coin",
|
|
16
|
+
"version": "2"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"scheme": "exact",
|
|
21
|
+
"network": "eip155:42161",
|
|
22
|
+
"amount": "5455",
|
|
23
|
+
"maxAmountRequired": "5455",
|
|
24
|
+
"asset": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
25
|
+
"payTo": "0x3574999dd4c96eB73Bd6e11D4177010C83E14f5b",
|
|
26
|
+
"maxTimeoutSeconds": 300,
|
|
27
|
+
"extra": {
|
|
28
|
+
"name": "USD Coin",
|
|
29
|
+
"version": "2"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"scheme": "exact",
|
|
34
|
+
"network": "eip155:5042",
|
|
35
|
+
"amount": "5455",
|
|
36
|
+
"maxAmountRequired": "5455",
|
|
37
|
+
"asset": "0x3600000000000000000000000000000000000000",
|
|
38
|
+
"payTo": "0x3574999dd4c96eB73Bd6e11D4177010C83E14f5b",
|
|
39
|
+
"maxTimeoutSeconds": 300,
|
|
40
|
+
"extra": {
|
|
41
|
+
"name": "USDC",
|
|
42
|
+
"version": "2"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"scheme": "exact",
|
|
47
|
+
"network": "eip155:4663",
|
|
48
|
+
"amount": "5455",
|
|
49
|
+
"maxAmountRequired": "5455",
|
|
50
|
+
"asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
51
|
+
"payTo": "0x3574999dd4c96eB73Bd6e11D4177010C83E14f5b",
|
|
52
|
+
"maxTimeoutSeconds": 300,
|
|
53
|
+
"extra": {
|
|
54
|
+
"name": "Global Dollar",
|
|
55
|
+
"version": "1"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"scheme": "exact",
|
|
60
|
+
"network": "eip155:143",
|
|
61
|
+
"amount": "5455",
|
|
62
|
+
"maxAmountRequired": "5455",
|
|
63
|
+
"asset": "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
|
|
64
|
+
"payTo": "0x3574999dd4c96eB73Bd6e11D4177010C83E14f5b",
|
|
65
|
+
"maxTimeoutSeconds": 300,
|
|
66
|
+
"extra": {
|
|
67
|
+
"name": "USDC",
|
|
68
|
+
"version": "2"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"scheme": "exact",
|
|
73
|
+
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
74
|
+
"amount": "5455",
|
|
75
|
+
"maxAmountRequired": "5455",
|
|
76
|
+
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
77
|
+
"payTo": "GQcEn5pLcweo7qaiy3rDdsiUPiygygmFBaixNtNqhQVD",
|
|
78
|
+
"maxTimeoutSeconds": 300,
|
|
79
|
+
"extra": {
|
|
80
|
+
"feePayer": "F742C4VfFLQ9zRQyithoj5229ZgtX2WqKCSFKgH2EThq"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbeam-foundation/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Agentic commerce SDK for AI agents: buy and sell agent work on every market (x402, MCP, A2A, Virtuals ACP / ERC-8183, Olas, BitAgent, ERC-8004, NEAR), with graded jobs and assurance on Base. The Moonbeam Studio's workflows as code.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -52,6 +52,62 @@
|
|
|
52
52
|
"types": "./dist/judge/index.d.ts",
|
|
53
53
|
"import": "./dist/judge/index.js"
|
|
54
54
|
},
|
|
55
|
+
"./assurance": {
|
|
56
|
+
"types": "./dist/assurance/index.d.ts",
|
|
57
|
+
"import": "./dist/assurance/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./resale": {
|
|
60
|
+
"types": "./dist/resale/index.d.ts",
|
|
61
|
+
"import": "./dist/resale/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./x402": {
|
|
64
|
+
"types": "./dist/x402/index.d.ts",
|
|
65
|
+
"import": "./dist/x402/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./proof": {
|
|
68
|
+
"types": "./dist/proof/index.d.ts",
|
|
69
|
+
"import": "./dist/proof/index.js"
|
|
70
|
+
},
|
|
71
|
+
"./arbitration": {
|
|
72
|
+
"types": "./dist/arbitration/index.d.ts",
|
|
73
|
+
"import": "./dist/arbitration/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./rpc": {
|
|
76
|
+
"types": "./dist/rpc/index.d.ts",
|
|
77
|
+
"import": "./dist/rpc/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./attest": {
|
|
80
|
+
"types": "./dist/attest/index.d.ts",
|
|
81
|
+
"import": "./dist/attest/index.js"
|
|
82
|
+
},
|
|
83
|
+
"./abi": {
|
|
84
|
+
"types": "./dist/abi/index.d.ts",
|
|
85
|
+
"import": "./dist/abi/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./cover": {
|
|
88
|
+
"types": "./dist/cover/index.d.ts",
|
|
89
|
+
"import": "./dist/cover/index.js"
|
|
90
|
+
},
|
|
91
|
+
"./jobs": {
|
|
92
|
+
"types": "./dist/jobs/index.d.ts",
|
|
93
|
+
"import": "./dist/jobs/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./errors": {
|
|
96
|
+
"types": "./dist/errors/index.d.ts",
|
|
97
|
+
"import": "./dist/errors/index.js"
|
|
98
|
+
},
|
|
99
|
+
"./devnet": {
|
|
100
|
+
"types": "./dist/devnet/index.d.ts",
|
|
101
|
+
"import": "./dist/devnet/index.js"
|
|
102
|
+
},
|
|
103
|
+
"./market": {
|
|
104
|
+
"types": "./dist/market/index.d.ts",
|
|
105
|
+
"import": "./dist/market/index.js"
|
|
106
|
+
},
|
|
107
|
+
"./workflows": {
|
|
108
|
+
"types": "./dist/workflows/index.d.ts",
|
|
109
|
+
"import": "./dist/workflows/index.js"
|
|
110
|
+
},
|
|
55
111
|
"./package.json": "./package.json"
|
|
56
112
|
},
|
|
57
113
|
"files": [
|
|
@@ -74,35 +130,60 @@
|
|
|
74
130
|
"test:watch": "vitest",
|
|
75
131
|
"test:coverage": "vitest run --coverage",
|
|
76
132
|
"lint": "tsc --noEmit && vitest run --reporter=dot",
|
|
77
|
-
"prepublishOnly": "npm run
|
|
133
|
+
"prepublishOnly": "npm run check",
|
|
134
|
+
"postbuild": "node scripts/postbuild.mjs",
|
|
135
|
+
"gen:registry": "node scripts/gen-moonbeam-acp.mjs",
|
|
136
|
+
"check:registry": "node scripts/gen-moonbeam-acp.mjs --check",
|
|
137
|
+
"check:pins": "node scripts/check-pins.mjs",
|
|
138
|
+
"check": "npm run typecheck && npm run build && npm test && npm run check:pins && npm run check:workflows",
|
|
139
|
+
"sync": "node scripts/sync.mjs",
|
|
140
|
+
"check:sync": "node scripts/sync.mjs --check",
|
|
141
|
+
"test:fork": "node test/fork/run-fork.mjs",
|
|
142
|
+
"test:live": "LIVE=1 vitest run test/live.test.ts",
|
|
143
|
+
"e2e:devnet": "npm run build && node scripts/devnet-onboard.mjs",
|
|
144
|
+
"gen:workflows": "node scripts/gen-workflows.mjs",
|
|
145
|
+
"check:workflows": "node scripts/gen-workflows.mjs --check"
|
|
78
146
|
},
|
|
79
147
|
"keywords": [
|
|
80
148
|
"moonbeam",
|
|
81
|
-
"
|
|
82
|
-
"escrow",
|
|
149
|
+
"agentic-commerce",
|
|
83
150
|
"ai-agents",
|
|
151
|
+
"agent-marketplace",
|
|
152
|
+
"agent-payments",
|
|
153
|
+
"x402",
|
|
154
|
+
"mcp",
|
|
155
|
+
"a2a",
|
|
156
|
+
"erc-8183",
|
|
157
|
+
"erc-8004",
|
|
158
|
+
"virtuals",
|
|
159
|
+
"virtuals-acp",
|
|
84
160
|
"agent-commerce-protocol",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
161
|
+
"olas",
|
|
162
|
+
"bitagent",
|
|
163
|
+
"near-ai",
|
|
87
164
|
"base",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"ai-agent-
|
|
91
|
-
"
|
|
165
|
+
"usdc",
|
|
166
|
+
"glmr",
|
|
167
|
+
"ai-agent-sdk",
|
|
168
|
+
"autonomous-agents",
|
|
169
|
+
"agent-to-agent",
|
|
170
|
+
"agent-workflows",
|
|
171
|
+
"escrow",
|
|
172
|
+
"assurance",
|
|
173
|
+
"settlement",
|
|
92
174
|
"judge",
|
|
93
|
-
"
|
|
175
|
+
"jev"
|
|
94
176
|
],
|
|
95
177
|
"devDependencies": {
|
|
96
|
-
"@types/node": "^22.20.
|
|
97
|
-
"@vitest/coverage-v8": "^
|
|
98
|
-
"typescript": "^
|
|
99
|
-
"viem": "^2.
|
|
100
|
-
"vitest": "^
|
|
178
|
+
"@types/node": "^22.20.5",
|
|
179
|
+
"@vitest/coverage-v8": "^5.0.4",
|
|
180
|
+
"typescript": "^7.0.2",
|
|
181
|
+
"viem": "^2.57.6",
|
|
182
|
+
"vitest": "^5.0.4"
|
|
101
183
|
},
|
|
102
184
|
"dependencies": {
|
|
103
|
-
"@taifoon/jev": "^0.
|
|
104
|
-
"@taifoon/jev-wilson": "^0.
|
|
105
|
-
"@taifoon/n8n-nodes-typesafe": "^2.0.4"
|
|
185
|
+
"@taifoon/jev": "^0.3.0",
|
|
186
|
+
"@taifoon/jev-wilson": "^0.3.1"
|
|
106
187
|
},
|
|
107
188
|
"bin": {
|
|
108
189
|
"moonbeam": "bin/moonbeam.mjs"
|
|
@@ -11,7 +11,7 @@ Capital you put into a pool stands behind other people's work. When an adjudicat
|
|
|
11
11
|
provider cheated, the provider's deposit is consumed first and **your pool pays
|
|
12
12
|
whatever the deposit cannot**. That is the risk, and it is not optional once you
|
|
13
13
|
have backed a pool — the exposure *is* the yield. There is no passive tier, because
|
|
14
|
-
rewards come from
|
|
14
|
+
rewards come from fees paid rather than from newly minted tokens.
|
|
15
15
|
|
|
16
16
|
You are **not** charged when work is merely graded bad. A rejection refunds the
|
|
17
17
|
client and returns the deposit; the pool pays nothing.
|
|
@@ -37,7 +37,7 @@ import { foldTasks, findSelfGraded, independentShare, decodeAcpLogs } from '@moo
|
|
|
37
37
|
|
|
38
38
|
const states = foldTasks(decodeAcpLogs(logs));
|
|
39
39
|
findSelfGraded(states); // verification 'self' or 'none'
|
|
40
|
-
independentShare(states); // how much of the population had
|
|
40
|
+
independentShare(states); // how much of the population had an independent judge
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
On live agent-commerce traffic, independently graded jobs are a tiny fraction of
|