@moonbeam-foundation/sdk 0.11.0 → 0.13.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 +79 -70
- package/bin/moonbeam.mjs +18 -1
- package/dist/actors/track-record.d.ts +1 -1
- package/dist/actors/track-record.js +1 -1
- package/dist/arbitration/index.d.ts +10 -4
- package/dist/arbitration/index.d.ts.map +1 -1
- package/dist/arbitration/index.js +14 -2
- package/dist/arbitration/index.js.map +1 -1
- package/dist/assurance/assurance-shared.d.ts +85 -132
- package/dist/assurance/assurance-shared.js +46 -90
- package/dist/cover/index.d.ts +3 -3
- package/dist/cover/index.d.ts.map +1 -1
- package/dist/devnet/index.d.ts +3 -3
- package/dist/devnet/index.d.ts.map +1 -1
- package/dist/devnet/index.js +4 -4
- package/dist/devnet/index.js.map +1 -1
- package/dist/devnet/profile.d.ts +1 -1
- package/dist/devnet/profile.d.ts.map +1 -1
- package/dist/erc8183/index.d.ts +1 -1
- package/dist/errors/index.d.ts +5 -5
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +3 -3
- package/dist/jobs/index.d.ts +4 -4
- package/dist/jobs/index.d.ts.map +1 -1
- package/dist/jobs/index.js +1 -1
- package/dist/jobs/index.js.map +1 -1
- package/dist/market/cohorts.d.ts +106 -0
- package/dist/market/cohorts.d.ts.map +1 -0
- package/dist/market/cohorts.js +70 -0
- package/dist/market/cohorts.js.map +1 -0
- package/dist/market/http.d.ts +13 -0
- package/dist/market/http.d.ts.map +1 -0
- package/dist/market/http.js +29 -0
- package/dist/market/http.js.map +1 -0
- package/dist/market/index.d.ts +43 -20
- package/dist/market/index.d.ts.map +1 -1
- package/dist/market/index.js +19 -36
- package/dist/market/index.js.map +1 -1
- package/dist/market/journey.d.ts +174 -0
- package/dist/market/journey.d.ts.map +1 -0
- package/dist/market/journey.js +179 -0
- package/dist/market/journey.js.map +1 -0
- package/dist/market/listed.d.ts +228 -0
- package/dist/market/listed.d.ts.map +1 -0
- package/dist/market/listed.js +168 -0
- package/dist/market/listed.js.map +1 -0
- package/dist/market/sale-stops.d.ts +29 -0
- package/dist/market/sale-stops.d.ts.map +1 -0
- package/dist/market/sale-stops.js +29 -0
- package/dist/market/sale-stops.js.map +1 -0
- package/dist/market/sale.d.ts +98 -0
- package/dist/market/sale.d.ts.map +1 -0
- package/dist/market/sale.js +64 -0
- package/dist/market/sale.js.map +1 -0
- package/dist/market/venues-data.d.ts +3 -0
- package/dist/market/venues-data.d.ts.map +1 -0
- package/dist/market/venues-data.js +1035 -0
- package/dist/market/venues-data.js.map +1 -0
- package/dist/market/venues.d.ts +143 -0
- package/dist/market/venues.d.ts.map +1 -0
- package/dist/market/venues.js +123 -0
- package/dist/market/venues.js.map +1 -0
- package/dist/onboard/index.d.ts +214 -33
- package/dist/onboard/index.d.ts.map +1 -1
- package/dist/onboard/index.js +340 -31
- package/dist/onboard/index.js.map +1 -1
- package/dist/onboard/send.d.ts +43 -0
- package/dist/onboard/send.d.ts.map +1 -0
- package/dist/onboard/send.js +65 -0
- package/dist/onboard/send.js.map +1 -0
- package/dist/pools/index.d.ts +18 -7
- package/dist/pools/index.d.ts.map +1 -1
- package/dist/pools/index.js +31 -9
- package/dist/pools/index.js.map +1 -1
- package/dist/proof/index.d.ts +5 -5
- package/dist/proof/index.d.ts.map +1 -1
- package/dist/proof/index.js +1 -1
- package/dist/resale/index.d.ts +13 -13
- package/dist/resale/index.d.ts.map +1 -1
- package/dist/resale/index.js +17 -17
- package/dist/resale/index.js.map +1 -1
- package/dist/resale/payment-scheme.d.mts +2 -5
- package/dist/resale/payment-scheme.mjs +16 -116
- package/dist/resale/payment-scheme.pin.json +1 -2
- package/dist/resale/settle-rule.d.ts +3 -3
- package/dist/resale/settle-rule.d.ts.map +1 -1
- package/dist/resale/settle-rule.js +3 -3
- package/dist/resale/settle-rule.js.map +1 -1
- package/dist/rpc/index.js +1 -1
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/steps.d.ts +4 -4
- package/dist/workflows/steps.d.ts.map +1 -1
- package/dist/workflows/steps.js +4 -4
- package/dist/workflows/steps.js.map +1 -1
- package/dist/workflows/types.d.ts +1 -1
- package/dist/x402/index.d.ts +2 -2
- package/dist/x402/index.d.ts.map +1 -1
- package/dist/x402/index.js +2 -2
- package/dist/x402/index.js.map +1 -1
- package/docs/REFERENCE.md +52 -19
- package/docs/VENUES.md +209 -0
- package/docs/WORKFLOWS.md +3 -3
- package/examples/24-resell-on-base.mjs +1 -1
- package/examples/51-read-a-proof.mjs +2 -2
- package/examples/70-every-venue.mjs +19 -0
- package/examples/README.md +2 -1
- package/examples/data/cross-list.recorded.json +1 -1
- package/package.json +7 -3
- package/dist/assurance/assurance-shared.d.ts.map +0 -1
- package/dist/assurance/assurance-shared.js.map +0 -1
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* automatch/payment-scheme.mjs — _ONE_PAYMENT_SCHEME_v1_ (2026-10-12; the owner, on learning that the memo router charges 20 %,
|
|
3
|
-
* ERC-8183 5 % + 5 %, BitAgent nothing, and that those fees were recorded differently per venue: "this must be always the same
|
|
4
|
-
* payment scheme to any-to-any agents and reseller"). ONE scheme for every sale the layer makes as seller of record, whatever the
|
|
5
|
-
* venue the buyer buys on (venue_in) and the venue the seller is hired on (venue_out):
|
|
6
|
-
*
|
|
7
|
-
* price_to_buyer = seller_price + our_fee + venue_fee(in) + venue_fee(out) [+ reseller_markup]
|
|
8
|
-
*
|
|
9
|
-
* The buyer pays coord once. What it paid leaves again as named legs, in whole units, and the legs sum to the payment exactly:
|
|
10
|
-
* our_fee coord's fee, by the rule of the door the buyer bought through (OUR_FEE.rules); on the wire and in the ledger: `fee`
|
|
11
|
-
* venue_fee what a VENUE itself takes, on the buying side (in) and on the selling side (out): the venue's own basis points on
|
|
12
|
-
* its own base, rounded as its contract rounds. Its own leg and its own ledger account; never part of our fee or
|
|
13
|
-
* of a reseller's markup
|
|
14
|
-
* seller_share what the doer receives: exactly its price on a paid ending
|
|
15
|
-
* reseller_markup a reseller tenant's leg, when its child bought
|
|
16
|
-
* provider · graders · ecosystem a metered call: the split of the wholesale (the site’s lib/usage-settle), unchanged
|
|
17
|
-
* A venue that takes its fee out of the money on its own side (`taken: at_source`) is grossed up for: the amount that enters it is
|
|
18
|
-
* the smallest one whose net is the price wanted, so the doer still receives its price and our fee does not move with the venue.
|
|
19
|
-
*
|
|
20
|
-
* The per-venue facts (VENUE_FEES) are typed HERE, once, each with the contract read it rests on; schemas/transitions.json
|
|
21
|
-
* `seller_coord_buyer.payment_scheme` is generated from this module (schemas/scripts/seller-coord-buyer.src.mjs), and every caller
|
|
22
|
-
* (redirect.mjs, escrow-job.mjs, olas-out.mjs, doer-pay.mjs, pipeline/reseller/fold.mjs; the site’s lib/acp-sales, venue-targets)
|
|
23
|
-
* computes through the functions below. Pure and self-contained: no import, no I/O. The site keeps a byte-identical copy at
|
|
24
|
-
* src/lib/payment-scheme.mjs (sha256 pinned on both sides).
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
1
|
export const RULE = 'ONE_PAYMENT_SCHEME_v1';
|
|
28
2
|
export const SCHEME_ID = 'taifoon.payment.scheme.v1';
|
|
29
3
|
export const FORMULA = 'price_to_buyer = seller_price + our_fee + venue_fee(in) + venue_fee(out) [+ reseller_markup]';
|
|
30
4
|
export const BPS = 10_000n;
|
|
31
|
-
|
|
32
|
-
* test network, a sale nobody opened. Nothing is taken there. */
|
|
5
|
+
|
|
33
6
|
export const OWN_VENUES = Object.freeze(['coord', 'grid', 'reseller', 'devnet', 'unknown']);
|
|
34
7
|
|
|
35
|
-
/** The legs of the scheme, in the order they are written. `ledger_leg` is the leg's name in the ledger, the events and the metric
|
|
36
|
-
* coord_sale_units_total{leg}; `account` is where the ledger credits it. */
|
|
37
8
|
export const LEGS = Object.freeze([
|
|
38
9
|
Object.freeze({ id: 'our_fee', ledger_leg: 'fee', account: 'fee:coord', to: 'coord', what: 'coord’s fee on the sale, by the rule of the door the buyer bought through; it does not depend on the venue' }),
|
|
39
10
|
Object.freeze({ id: 'venue_fee', ledger_leg: 'venue_fee', account: 'fee:venue:<venue> (its platform part) · fee:venue:<venue>-evaluator (its evaluator part)', to: 'the venue', sides: Object.freeze(['in', 'out']), what: 'what the venue itself takes: on the buying side (in) and on the selling side (out); its own basis points on its own base, never part of our fee or of a reseller’s markup' }),
|
|
@@ -43,18 +14,9 @@ export const LEGS = Object.freeze([
|
|
|
43
14
|
Object.freeze({ id: 'graders', ledger_leg: 'graders', account: 'pool:graders', to: 'the graders’ pool', what: 'a metered call: the graders’ part of the wholesale' }),
|
|
44
15
|
Object.freeze({ id: 'ecosystem', ledger_leg: 'ecosystem', account: 'pool:ecosystem', to: 'coord', what: 'a metered call: the ecosystem’s part of the wholesale' }),
|
|
45
16
|
]);
|
|
46
|
-
|
|
17
|
+
|
|
47
18
|
export const ENDING_LEGS = Object.freeze(['refund', 'loss']);
|
|
48
19
|
|
|
49
|
-
/**
|
|
50
|
-
* Our fee, by the door the buyer bought through. These are the rules that already ran; none is new.
|
|
51
|
-
* wall a class wall (an x402 payment, a venue job that names a wall, an MCP wall tool): max(20 %, 0.002 USDC) of the wall's list
|
|
52
|
-
* price, rounded up, never above the price. The list price is seller_price + our_fee: what the buyer pays where no venue
|
|
53
|
-
* takes anything
|
|
54
|
-
* job_quote a job settled on the assurance hook: the answer of GET /v1/fees/quote (the site’s lib/job-fee: max(bps of the price,
|
|
55
|
-
* our gas + margin), at most the hook's 10 %), escrowed on top of the price. It needs live gas, so it comes in as units
|
|
56
|
-
* metered a metered call (RPC, GPU, TEE, forecast): no fee leg; the wholesale is split provider · graders · ecosystem
|
|
57
|
-
*/
|
|
58
20
|
export const OUR_FEE = Object.freeze({
|
|
59
21
|
rules: Object.freeze({
|
|
60
22
|
wall: Object.freeze({ id: 'wall', door: 'a class wall: an x402 payment, a venue job that names a wall, an MCP wall tool', bps: 2000, min_units: 2000, min_units_of: 'a token of 6 decimals (USDC): 0.002', rounding: 'ceil', base: 'the list price (seller_price + our_fee): what the buyer pays where no venue takes anything', never_above: 'the list price',
|
|
@@ -66,13 +28,9 @@ export const OUR_FEE = Object.freeze({
|
|
|
66
28
|
}),
|
|
67
29
|
});
|
|
68
30
|
|
|
69
|
-
// ── the per-venue facts ─────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
70
31
|
const ON_REFUND_ESCROW = Object.freeze({ venue_ending: 'returned', venue_ending_why: 'the venue takes its fee only on the paid ending: on a reject or an expiry the whole budget goes back to the client, no fee was taken', after_paid_ending: 'lost', after_paid_ending_why: 'a paid ending is final on the venue: a refund coord makes afterwards comes from coord’s own money, the venue keeps its fee' });
|
|
71
32
|
const ON_REFUND_NONE = Object.freeze({ venue_ending: 'none', venue_ending_why: 'the venue takes no fee and has no refund of its own', after_paid_ending: 'none', after_paid_ending_why: 'no venue fee was taken: nothing of it is lost or returned' });
|
|
72
|
-
|
|
73
|
-
// literal here: the registry is the one place a contract address lives, and whoever needs the address resolves the reference
|
|
74
|
-
// (schemeBlock(facts, { addressOf })). A venue's own treasury is no registry contract: it is the third party's account, as its contract
|
|
75
|
-
// reads it (platformTreasury()), and the fork proof holds it to the chain on every run.
|
|
33
|
+
|
|
76
34
|
const E = 'standards-erc8183';
|
|
77
35
|
const ref = (chain, name) => Object.freeze({ system: E, chain, name });
|
|
78
36
|
const V3 = (chain) => ref(chain, 'Virtuals ACP v3 (ERC-8183)');
|
|
@@ -99,11 +57,6 @@ const X402_NONE = (network) => Object.freeze({ status: 'none', taken: null, roun
|
|
|
99
57
|
const WIRE_NONE = Object.freeze({ status: 'none', taken: null, rounding: 'floor', base: 'none', parts: Object.freeze([]), on_refund: ON_REFUND_NONE,
|
|
100
58
|
evidence: Object.freeze({ contract: null, chain: null, name: 'no payment step', reads: Object.freeze([]), block: null, read_at: '2026-10-12', how: 'the protocol has no payment step: a purchase through it is paid on one of the layer’s own doors (a class wall’s x402 payment, the assurance hook), named in the adapter’s settle.doors' }) });
|
|
101
59
|
|
|
102
|
-
/**
|
|
103
|
-
* What each venue of the standard takes, as read on its chain on 2026-10-12. `status`: read (a contract states it) · none (the venue has
|
|
104
|
-
* no fee step). `taken`: at_source (out of the money on the venue's own side, before the payee is paid) · from_payment (coord pays it
|
|
105
|
-
* out of what it received) · null (nothing is taken). `parts[].when`: evaluator_set = only for a job that names an evaluator.
|
|
106
|
-
*/
|
|
107
60
|
export const VENUE_FEES = Object.freeze({
|
|
108
61
|
'x402-base': X402_NONE('eip155:8453'), 'x402-solana': X402_NONE('solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'), 'x402-arbitrum': X402_NONE('eip155:42161'), 'x402-robinhood': X402_NONE('eip155:4663'), 'x402-monad': X402_NONE('eip155:143'),
|
|
109
62
|
'erc8183-base': escrow({ contract: V3(8453), chain: 8453, block: 52515498, platform: 500, evaluator: 500, treasury: V3_TREASURY, name: 'Virtuals ACP v3 (ERC-8183)',
|
|
@@ -116,16 +69,14 @@ export const VENUE_FEES = Object.freeze({
|
|
|
116
69
|
'olas-polygon': olas({ chain: 137, block: 95410212 }),
|
|
117
70
|
'olas-base': olas({ chain: 8453, block: 52515630 }),
|
|
118
71
|
mcp: WIRE_NONE, a2a: WIRE_NONE, erc8004: WIRE_NONE, n8n: WIRE_NONE,
|
|
119
|
-
|
|
120
|
-
// jobs are booked by the same scheme; it becomes an adapter's entry when the standard gains the adapter ──────────────────────────────
|
|
72
|
+
|
|
121
73
|
'aqueous-monad': Object.freeze({ status: 'none', adapter: false, taken: null, rounding: 'floor', base: 'the amount the buyer settles', parts: Object.freeze([]),
|
|
122
74
|
on_refund: Object.freeze({ ...ON_REFUND_NONE, venue_ending_why: 'the escrow takes nothing: the buyer settles what it accepts and the rest is returned in the same transaction; an undelivered job is refunded whole after its deadline' }),
|
|
123
75
|
evidence: Object.freeze({ contract: null, chain: 143, name: 'Aqueous escrow on Monad (an outside developer’s contract; its address is automatch/escrow-sig.venues.json aqueous-monad.escrow, not in the address registry yet)', reads: Object.freeze([]), block: 112798206, read_at: '2026-10-12',
|
|
124
76
|
how: 'settleMetered pays the agent units × pricePerUnit and returns the rest, with no fee: on a fork of Monad at block 112798206 a job of 10000 paid the agent 10000 and returned 0 (automatch/fixtures/escrow-sig-fork-proof-2026-10-12.json, scenario metered.pass); automatch/escrow-sig.fork.mjs asserts it on every run. FORK-ONLY: nothing of ours was sent on Monad. Not an adapter of the standard: the signed-escrow sibling of the escrow-job family (automatch/escrow-sig.mjs), job.out only' }) }),
|
|
125
77
|
});
|
|
126
78
|
|
|
127
|
-
|
|
128
|
-
const whole = (v) => { try { if (typeof v === 'bigint') return v >= 0n ? v : null; if (typeof v === 'number') return Number.isSafeInteger(v) && v >= 0 ? BigInt(v) : null; if (typeof v === 'string' && /^\d{1,78}$/.test(v)) return BigInt(v); } catch { /* not a whole amount */ } return null; };
|
|
79
|
+
const whole = (v) => { try { if (typeof v === 'bigint') return v >= 0n ? v : null; if (typeof v === 'number') return Number.isSafeInteger(v) && v >= 0 ? BigInt(v) : null; if (typeof v === 'string' && /^\d{1,78}$/.test(v)) return BigInt(v); } catch { } return null; };
|
|
129
80
|
const factsOf = (venue, facts = VENUE_FEES) => {
|
|
130
81
|
if (OWN_VENUES.includes(venue)) return null;
|
|
131
82
|
const f = facts[venue];
|
|
@@ -134,12 +85,6 @@ const factsOf = (venue, facts = VENUE_FEES) => {
|
|
|
134
85
|
};
|
|
135
86
|
const feeOfBps = (base, bps, rounding) => (rounding === 'ceil' ? (base * BigInt(bps) + (BPS - 1n)) / BPS : (base * BigInt(bps)) / BPS);
|
|
136
87
|
|
|
137
|
-
/**
|
|
138
|
-
* What a venue takes of `base` (the amount that enters it): { venue, base, total, net, parts: [{ part, bps, units, to, to_address }],
|
|
139
|
-
* taken, rounding }. `o.evaluator_set` false: the job names no evaluator, so no evaluator part. `o.as_read`: { platform_bps,
|
|
140
|
-
* evaluator_bps } as they were read for this one job (a venue may change its fees; the declared ones are the default). Throws on a
|
|
141
|
-
* venue with no entry and on fees that are not a share of the base. Pure.
|
|
142
|
-
*/
|
|
143
88
|
export function venueFeeOf(venue, base, o = {}) {
|
|
144
89
|
const B = whole(base); if (B === null) throw new Error(`the base of a venue fee is a whole amount, not ${String(base)}`);
|
|
145
90
|
const f = factsOf(venue, o.facts);
|
|
@@ -148,9 +93,9 @@ export function venueFeeOf(venue, base, o = {}) {
|
|
|
148
93
|
for (const p of f.parts) {
|
|
149
94
|
if (p.when === 'evaluator_set' && o.evaluator_set === false) continue;
|
|
150
95
|
const read = o.as_read ? o.as_read[`${p.part}_bps`] : undefined;
|
|
151
|
-
const bps = read === undefined || read === null ? p.bps : typeof read === 'number' ? read : typeof read === 'bigint' || (typeof read === 'string' && /^\d{1,5}$/.test(read)) ? Number(read) : NaN;
|
|
96
|
+
const bps = read === undefined || read === null ? p.bps : typeof read === 'number' ? read : typeof read === 'bigint' || (typeof read === 'string' && /^\d{1,5}$/.test(read)) ? Number(read) : NaN;
|
|
152
97
|
if (!Number.isInteger(bps) || bps < 0 || bps > 10_000) throw new Error(`venue ${venue}: ${p.part} fee of ${String(read ?? p.bps)} bps is not a share of the base`);
|
|
153
|
-
if (bps === 0) continue;
|
|
98
|
+
if (bps === 0) continue;
|
|
154
99
|
parts.push({ part: p.part, bps, units: feeOfBps(B, bps, f.rounding).toString(), to: p.to, to_address: p.to_address, to_ref: p.to_ref });
|
|
155
100
|
}
|
|
156
101
|
const total = parts.reduce((a, p) => a + BigInt(p.units), 0n);
|
|
@@ -158,17 +103,13 @@ export function venueFeeOf(venue, base, o = {}) {
|
|
|
158
103
|
return { venue, base: B, total, net: B - total, parts, taken: parts.length ? f.taken : null, rounding: f.rounding };
|
|
159
104
|
}
|
|
160
105
|
|
|
161
|
-
/**
|
|
162
|
-
* The gross-up: the smallest amount that must enter `venue` so that `net` is left after the venue's fee (the doer still receives its
|
|
163
|
-
* price; a wall's list price still reaches us). { venue, net, gross, fee } with fee = venueFeeOf(venue, gross). Pure.
|
|
164
|
-
*/
|
|
165
106
|
export function grossUp(venue, net, o = {}) {
|
|
166
107
|
const N = whole(net); if (N === null) throw new Error(`a price is a whole amount, not ${String(net)}`);
|
|
167
108
|
const f = factsOf(venue, o.facts);
|
|
168
109
|
if (!f) return { venue, net: N, gross: N, fee: venueFeeOf(venue, N, o) };
|
|
169
110
|
const cut = BigInt(venueFeeOf(venue, BPS, o).parts.reduce((a, p) => a + p.bps, 0));
|
|
170
111
|
if (cut >= BPS) throw new Error(`venue ${venue}: its fees leave the payee nothing`);
|
|
171
|
-
|
|
112
|
+
|
|
172
113
|
let G = N > 2n ? ((N - 2n) * BPS) / (BPS - cut) : 0n;
|
|
173
114
|
if (G < N) G = N;
|
|
174
115
|
let fee = venueFeeOf(venue, G, o);
|
|
@@ -176,7 +117,6 @@ export function grossUp(venue, net, o = {}) {
|
|
|
176
117
|
return { venue, net: N, gross: G, fee };
|
|
177
118
|
}
|
|
178
119
|
|
|
179
|
-
/** Our fee by a rule of OUR_FEE on `base` (wall: the list price; job_quote: the quote's own units). Throws on a rule that is not one. Pure. */
|
|
180
120
|
export function ourFeeOf(fee, base) {
|
|
181
121
|
const B = whole(base); if (B === null) throw new Error(`the base of our fee is a whole amount, not ${String(base)}`);
|
|
182
122
|
const id = fee?.rule;
|
|
@@ -185,12 +125,12 @@ export function ourFeeOf(fee, base) {
|
|
|
185
125
|
if (id === 'metered' || id === 'none') return 0n;
|
|
186
126
|
throw new Error(`${String(id)} is not a fee rule of the scheme (${Object.keys(OUR_FEE.rules).join(' · ')})`);
|
|
187
127
|
}
|
|
188
|
-
|
|
128
|
+
|
|
189
129
|
export function listPriceOf(fee, sellerPrice) {
|
|
190
130
|
const S = whole(sellerPrice); if (S === null) throw new Error(`a seller price is a whole amount, not ${String(sellerPrice)}`);
|
|
191
131
|
if (fee?.rule !== 'wall') return S + ourFeeOf(fee, S);
|
|
192
132
|
const r = OUR_FEE.rules.wall; const min = BigInt(r.min_units);
|
|
193
|
-
|
|
133
|
+
|
|
194
134
|
let L = S + min; if (ourFeeOf(fee, L) <= min) return L;
|
|
195
135
|
L = (S * BPS) / (BPS - BigInt(r.bps)); if (L < S + min) L = S + min;
|
|
196
136
|
while (L - ourFeeOf(fee, L) < S) L += 1n;
|
|
@@ -200,23 +140,10 @@ export function listPriceOf(fee, sellerPrice) {
|
|
|
200
140
|
|
|
201
141
|
const mk = (leg, units, o = {}) => ({ leg, ledger_leg: leg === 'our_fee' ? 'fee' : leg, units: units.toString(), side: o.side ?? null, venue: o.venue ?? null, part: o.part ?? null, bps: o.bps ?? null, to: o.to ?? null, to_address: o.to_address ?? null, to_ref: o.to_ref ?? null, taken: o.taken ?? null });
|
|
202
142
|
const feeLegs = (side, f) => f.parts.map((p) => mk('venue_fee', BigInt(p.units), { side, venue: f.venue, part: p.part, bps: p.bps, to: p.to, to_address: p.to_address, to_ref: p.to_ref ?? null, taken: f.taken }));
|
|
203
|
-
|
|
143
|
+
|
|
204
144
|
export const sumOf = (legs) => (legs ?? []).reduce((a, l) => a + BigInt(l.units), 0n);
|
|
205
145
|
const markupOf = (reseller, list) => { if (!reseller) return 0n; if (reseller.markup_units !== undefined && reseller.markup_units !== null) { const u = whole(reseller.markup_units); if (u === null) throw new Error('a reseller’s markup is a whole amount'); return u; } const b = Number(reseller.markup_bps ?? 0); if (!Number.isInteger(b) || b < 0 || b > 10_000) throw new Error('a reseller’s markup is 0 to 10000 bps of the list price'); return (list * BigInt(b)) / BPS; };
|
|
206
146
|
|
|
207
|
-
/**
|
|
208
|
-
* THE QUOTE. What a buyer on `venue_in` pays for a seller on `venue_out` whose price is `seller_price` (whole units of the payment's
|
|
209
|
-
* token), and the legs that payment leaves as. One formula for every pair:
|
|
210
|
-
*
|
|
211
|
-
* list = seller_price + our_fee our fee by the door's rule, on the list price: it does not depend on a venue
|
|
212
|
-
* out = grossUp(venue_out, seller_price) what must enter the selling venue so the doer receives its price
|
|
213
|
-
* net_in = list + venue_fee(out) + reseller_markup what must reach coord
|
|
214
|
-
* price_to_buyer = grossUp(venue_in, net_in) what the buyer pays, the buying venue's fee on top
|
|
215
|
-
*
|
|
216
|
-
* `o`: { venue_in, venue_out, class, seller_price, reseller?: { tenant, markup_bps | markup_units }, our_fee?: { rule: 'wall' } |
|
|
217
|
-
* { rule: 'job_quote', units }, evaluator_set_in?, evaluator_set_out?, facts? }. Returns { ok, price_to_buyer, list_units, legs[] }
|
|
218
|
-
* or { ok: false, why }. Pure.
|
|
219
|
-
*/
|
|
220
147
|
export function quoteSale(o = {}) {
|
|
221
148
|
try {
|
|
222
149
|
const S = whole(o.seller_price); if (S === null) return { ok: false, why: 'the seller’s price is a whole, non-negative amount in the payment’s smallest unit' };
|
|
@@ -235,23 +162,6 @@ export function quoteSale(o = {}) {
|
|
|
235
162
|
} catch (e) { return { ok: false, why: String(e?.message ?? e) }; }
|
|
236
163
|
}
|
|
237
164
|
|
|
238
|
-
/**
|
|
239
|
-
* THE LEGS OF ONE PAYMENT. `p`:
|
|
240
|
-
* venue_in, venue_out where the buyer paid, where the seller was hired (a venue of the standard, or coord · grid · reseller · devnet)
|
|
241
|
-
* paid_units what the buyer put in: the wall's payment, the budget escrowed on the buying venue
|
|
242
|
-
* out_units what coord owes on the selling side, the selling venue's fee included (the wall's share, the budget coord
|
|
243
|
-
* funds, the doer's price a stand-in forwards); 0 when our own product served
|
|
244
|
-
* reseller { tenant, markup_units } when a reseller's child bought
|
|
245
|
-
* lost_units paid ahead to a seller whose answer then failed (ours to bear, inside the payment)
|
|
246
|
-
* ending paid (default) · venue_refund (the buying venue's own refund: everything goes back, no fee was taken) ·
|
|
247
|
-
* share_refund (a rejection before the share was sent: our fee stays, the share goes back)
|
|
248
|
-
* out_direct true when coord pays the doer itself (a transfer from the vault, a stand-in's forward): the money never
|
|
249
|
-
* enters the selling venue, so that venue takes nothing of it
|
|
250
|
-
* our_fee { rule } to check the fee against the rule (fee_rule_ok: reported, never enforced here); the fee itself is what is left
|
|
251
|
-
* observed { in | out: { provider, evaluator } } what the venue itself paid (the job's own events): it stands over the bps
|
|
252
|
-
* as_read_in/out { platform_bps, evaluator_bps } as read for this one job; evaluator_set_in/out
|
|
253
|
-
* Returns { ok, legs[], sum_ok, fee_rule_ok, net_in_units, fees_as } or { ok: false, why }. Σ legs = paid_units, to the unit. Pure.
|
|
254
|
-
*/
|
|
255
165
|
export function legsOfPayment(p = {}) {
|
|
256
166
|
try {
|
|
257
167
|
const P = whole(p.paid_units); const G = whole(p.out_units ?? 0); const lost = whole(p.lost_units ?? 0);
|
|
@@ -268,10 +178,9 @@ export function legsOfPayment(p = {}) {
|
|
|
268
178
|
const f = venueFeeOf(venue, base, { facts: p.facts, as_read, evaluator_set });
|
|
269
179
|
if (as_read) fees_as = 'the venue’s fees as read on chain';
|
|
270
180
|
const pv = whole(obs?.provider ?? null); const ev = whole(obs?.evaluator ?? 0) ?? 0n;
|
|
271
|
-
|
|
181
|
+
|
|
272
182
|
if (pv === null || OWN_VENUES.includes(venue) || pv + ev > base || !factsOf(venue, p.facts).parts.some((x) => x.part === 'platform')) return f;
|
|
273
|
-
|
|
274
|
-
// (a venue with no evaluator part keeps everything the payee did not receive as its one part)
|
|
183
|
+
|
|
275
184
|
const names = Object.fromEntries(factsOf(venue, p.facts).parts.map((x) => [x.part, x])); const evPart = names.evaluator ? ev : 0n;
|
|
276
185
|
const parts = [{ part: 'platform', units: (base - pv - evPart).toString() }, { part: 'evaluator', units: evPart.toString() }].filter((x) => names[x.part]).map((x) => ({ ...x, bps: null, to: names[x.part].to, to_address: names[x.part].to_address, to_ref: names[x.part].to_ref }));
|
|
277
186
|
fees_as = 'the amounts the venue paid (the job’s own events)';
|
|
@@ -287,42 +196,33 @@ export function legsOfPayment(p = {}) {
|
|
|
287
196
|
const legs = [mk('our_fee', ourFee, { to: 'coord' }), ...feeLegs('in', fin), ...feeLegs('out', fout),
|
|
288
197
|
ending === 'share_refund' ? mk('refund', G, { to: 'the buyer' }) : mk('seller_share', fout.net, { venue: p.venue_out, to: 'the doer' }),
|
|
289
198
|
mk('reseller_markup', markup, { to: p.reseller?.tenant ?? null }), mk('loss', lost, { to: 'sellers whose paid answer failed' })];
|
|
290
|
-
|
|
199
|
+
|
|
291
200
|
const fee_rule_ok = p.our_fee?.rule ? ourFee === ourFeeOf(p.our_fee, p.our_fee.rule === 'wall' ? ourFee + fout.net : fout.net) : null;
|
|
292
201
|
return { ok: true, rule: RULE, ending, venue_in: p.venue_in, venue_out: p.venue_out, paid_units: P.toString(), net_in_units: netIn.toString(), out_units: G.toString(), legs, sum_ok: sumOf(legs) === P, fee_rule_ok, fees_as,
|
|
293
202
|
venue_fee: { in: { venue: p.venue_in, units: fin.total.toString(), taken: fin.taken }, out: { venue: p.venue_out, units: fout.total.toString(), taken: fout.taken } } };
|
|
294
203
|
} catch (e) { return { ok: false, why: String(e?.message ?? e) }; }
|
|
295
204
|
}
|
|
296
205
|
|
|
297
|
-
/** The pairs the adapters of the standard declare possible: a venue whose job.in is LIVE (a buyer can buy there) × a venue whose
|
|
298
|
-
* job.out is LIVE (a seller is hired there), plus our own product as the selling side. `adapters` = seller_coord_buyer.adapters. Pure. */
|
|
299
206
|
export function pairsOf(adapters) {
|
|
300
207
|
const ins = (adapters ?? []).filter((a) => a.transforms?.['job.in']?.state === 'LIVE').map((a) => a.venue);
|
|
301
208
|
const outs = [...(adapters ?? []).filter((a) => a.transforms?.['job.out']?.state === 'LIVE').map((a) => a.venue), 'coord'];
|
|
302
209
|
return ins.flatMap((venue_in) => outs.map((venue_out) => ({ venue_in, venue_out })));
|
|
303
210
|
}
|
|
304
211
|
|
|
305
|
-
/** What the scheme lacks for a list of adapters: the venues with no entry, and the entries that are no adapter. An adapter of the
|
|
306
|
-
* standard without an entry fails the build of the standard and the conformance suite. Pure. */
|
|
307
212
|
export function schemeGaps(adapters, facts = VENUE_FEES) {
|
|
308
213
|
const venues = (adapters ?? []).map((a) => a.venue); const entries = Object.keys(facts);
|
|
309
|
-
|
|
214
|
+
|
|
310
215
|
return { missing: venues.filter((v) => !entries.includes(v)), extra: entries.filter((v) => !venues.includes(v) && facts[v].adapter !== false) };
|
|
311
216
|
}
|
|
312
217
|
|
|
313
|
-
/** The table of what each venue takes: one row per venue, derived from the facts (the master's and the stream's fee table). Pure. */
|
|
314
218
|
export function venueFeeTable(facts = VENUE_FEES, { addressOf = null } = {}) {
|
|
315
219
|
return Object.entries(facts).map(([venue, f]) => ({ venue, status: f.status, ...(f.adapter === false ? { adapter: false } : {}), platform_bps: f.parts.find((p) => p.part === 'platform')?.bps ?? 0, evaluator_bps: f.parts.find((p) => p.part === 'evaluator')?.bps ?? 0,
|
|
316
220
|
total_bps: f.parts.reduce((a, p) => a + p.bps, 0), taken: f.parts.some((p) => p.bps > 0) ? f.taken : null, rounding: f.rounding, to: f.parts.filter((p) => p.bps > 0).map((p) => `${p.part}: ${p.to}`).join('; ') || null,
|
|
317
221
|
on_refund: f.on_refund.venue_ending, after_paid_ending: f.on_refund.after_paid_ending, contract: f.evidence.contract && addressOf ? addressOf(f.evidence.contract) : null, contract_ref: f.evidence.contract, chain: f.evidence.chain, block: f.evidence.block,
|
|
318
|
-
|
|
222
|
+
|
|
319
223
|
net_of_10000: venueFeeOf(venue, 10_000n, { facts }).net.toString(), gross_for_10000: grossUp(venue, 10_000n, { facts }).gross.toString() }));
|
|
320
224
|
}
|
|
321
225
|
|
|
322
|
-
/** The ONE declared block (schemas/transitions.json seller_coord_buyer.payment_scheme): the legs, the formula, the fee rules, the
|
|
323
|
-
* per-venue facts with their evidence, the gross-up, what a refund does to a venue's fee, and the invariant. `addressOf(ref)` resolves
|
|
324
|
-
* a registry reference { system, chain, name } to its address (the generator passes the address registry's reader; without one the
|
|
325
|
-
* block carries the references alone). Deterministic. Pure. */
|
|
326
226
|
export function schemeBlock(facts = VENUE_FEES, { addressOf = null } = {}) {
|
|
327
227
|
const at = (r) => (r && addressOf ? addressOf(r) : null);
|
|
328
228
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"about": "
|
|
3
|
-
"source": "the coordination layer: packages/resale/core/payment-scheme.mjs",
|
|
2
|
+
"about": "Moonbeam’s one payment scheme (ONE_PAYMENT_SCHEME_v1), vendored: its source is pinned by this sha256; this published copy carries its code without comments",
|
|
4
3
|
"commit": "a6d2853a",
|
|
5
4
|
"sha256": "f34a6eb7830089d11c0b22850e4cbb299000b08e44e4eb0f4ad8df4456a08020"
|
|
6
5
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where a seller's leg settles:
|
|
2
|
+
* Where a seller's leg settles: Moonbeam's rule SETTLE_ON_SELLER_VENUE_v1, and its resolver, held to the rule's own vectors
|
|
3
3
|
* (test/fixtures/settle-rule.vectors.json).
|
|
4
4
|
*
|
|
5
5
|
* The buyer's payment is confirmed wherever it was made. A seller's leg is paid on the network, token and payTo of the offer
|
|
6
6
|
* it delivered on, in this order: (1) its x402 `accepts` entry for the class it delivered; (2) its venue's rail, the one chain
|
|
7
7
|
* of the venue it was hired on, to the payTo it registered; (3) a seller with no paid rail of its own (a free tool or agent
|
|
8
8
|
* admitted as a paid seller): Base USDC to the payTo it registered. A network the seller did not publish is never chosen for
|
|
9
|
-
* it: a rail
|
|
9
|
+
* it: a rail Moonbeam holds no pay token on is Held (network_not_served), another asset is Held (token_not_served), and no
|
|
10
10
|
* payTo is Held (no_payee). Nothing is bridged or swapped. Pure.
|
|
11
11
|
*/
|
|
12
12
|
export declare const SETTLE_RULE: 'SETTLE_ON_SELLER_VENUE_v1';
|
|
@@ -15,7 +15,7 @@ export type SettleToken = {
|
|
|
15
15
|
readonly address: string;
|
|
16
16
|
readonly decimals: number;
|
|
17
17
|
};
|
|
18
|
-
/** The dollar token
|
|
18
|
+
/** The dollar token Moonbeam pays a seller's leg in, per network (CAIP-2). A network missing here is not served. */
|
|
19
19
|
export declare const PAY_TOKENS: Readonly<Record<string, SettleToken>>;
|
|
20
20
|
/** x402 v1 network names, read as CAIP-2 */
|
|
21
21
|
export declare const SETTLE_NETWORK_ALIASES: Readonly<Record<string, string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settle-rule.d.ts","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAG,2BAAoC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAK3G,
|
|
1
|
+
{"version":3,"file":"settle-rule.d.ts","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAG,2BAAoC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAK3G,oHAAoH;AACpH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAO3D,CAAC;AACH,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlE,CAAC;AACH,uEAAuE;AACvE,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKvD,CAAC;AACH,0DAA0D;AAC1D,eAAO,MAAM,aAAa;;;EAA6D,CAAC;AAExF,iIAAiI;AACjI,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC3J,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,eAAe,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,IAAI,CAAC;CAChG,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,UAAU,CAavD"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where a seller's leg settles:
|
|
2
|
+
* Where a seller's leg settles: Moonbeam's rule SETTLE_ON_SELLER_VENUE_v1, and its resolver, held to the rule's own vectors
|
|
3
3
|
* (test/fixtures/settle-rule.vectors.json).
|
|
4
4
|
*
|
|
5
5
|
* The buyer's payment is confirmed wherever it was made. A seller's leg is paid on the network, token and payTo of the offer
|
|
6
6
|
* it delivered on, in this order: (1) its x402 `accepts` entry for the class it delivered; (2) its venue's rail, the one chain
|
|
7
7
|
* of the venue it was hired on, to the payTo it registered; (3) a seller with no paid rail of its own (a free tool or agent
|
|
8
8
|
* admitted as a paid seller): Base USDC to the payTo it registered. A network the seller did not publish is never chosen for
|
|
9
|
-
* it: a rail
|
|
9
|
+
* it: a rail Moonbeam holds no pay token on is Held (network_not_served), another asset is Held (token_not_served), and no
|
|
10
10
|
* payTo is Held (no_payee). Nothing is bridged or swapped. Pure.
|
|
11
11
|
*/
|
|
12
12
|
export const SETTLE_RULE = 'SETTLE_ON_SELLER_VENUE_v1';
|
|
13
13
|
const BASE = 'eip155:8453';
|
|
14
14
|
const SOLANA = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
|
|
15
|
-
/** The dollar token
|
|
15
|
+
/** The dollar token Moonbeam pays a seller's leg in, per network (CAIP-2). A network missing here is not served. */
|
|
16
16
|
export const PAY_TOKENS = Object.freeze({
|
|
17
17
|
'eip155:8453': Object.freeze({ symbol: 'USDC', address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6 }),
|
|
18
18
|
'eip155:42161': Object.freeze({ symbol: 'USDC', address: '0xaf88d065e77c8cc2239327c5edb3a432268e5831', decimals: 6 }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settle-rule.js","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,2BAAoC,CAAC;AAGhE,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,MAAM,GAAG,yCAAyC,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"settle-rule.js","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,2BAAoC,CAAC;AAGhE,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,MAAM,GAAG,yCAAyC,CAAC;AAEzD,oHAAoH;AACpH,MAAM,CAAC,MAAM,UAAU,GAA0C,MAAM,CAAC,MAAM,CAAC;IAC7E,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4CAA4C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACpH,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4CAA4C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACrH,aAAa,EA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AAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAClC,MAAM,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACxC,MAAM,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChH,MAAM,OAAO,GAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IACzI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7G,CAAC"}
|
package/dist/rpc/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @moonbeam-foundation/sdk/rpc: one injectable Base reader. By default it walks warmbed's measured rotation of Base
|
|
3
|
-
* endpoints (the same reader
|
|
3
|
+
* endpoints (the same reader the grader uses: warmbed first, then a static fallback list), so a rate-limited or
|
|
4
4
|
* range-capped public endpoint moves the call to the next one instead of failing it. A revert is an answer and is
|
|
5
5
|
* thrown at once. BASE_RPC (a comma list) or `urls` goes first. Reads only: nothing here signs or sends.
|
|
6
6
|
*/
|
package/dist/workflows/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @moonbeam-foundation/sdk/workflows: the Moonbeam Studio's agentic commerce workflows, as data.
|
|
3
3
|
*
|
|
4
4
|
* Each workflow is the canvas the Studio draws (nodes and edges, exported from the Studio's own templates), and every node
|
|
5
|
-
* that calls
|
|
5
|
+
* that calls Moonbeam names the SDK function that runs the same step (`STEP_CALLS`). The pictures in docs/workflows are
|
|
6
6
|
* those canvases, captured from the Studio.
|
|
7
7
|
*
|
|
8
8
|
* WORKFLOWS the seven workflows: publish · list-business · onboard · sell-edge · resell · hire-from-chat · onboard-batch
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What each node of a Moonbeam workflow is: its class, what it means, who may run it, the markets it applies to, and the SDK
|
|
3
|
-
* calls that run it on Base and on the test network. One table, keyed by the
|
|
3
|
+
* calls that run it on Base and on the test network. One table, keyed by the Moonbeam call the node makes; a test holds it complete
|
|
4
4
|
* against the Studio's workflows.
|
|
5
5
|
*/
|
|
6
6
|
/** The classes of a node, by what it does to the world. */
|
|
@@ -9,8 +9,8 @@ export declare const NODE_CLASSES: Readonly<{
|
|
|
9
9
|
readonly agent: 'the chat agent that decides which tool to call next';
|
|
10
10
|
readonly model: 'the language model the agent reasons with';
|
|
11
11
|
readonly memory: 'what the agent keeps between turns';
|
|
12
|
-
readonly knowledge: 'reads the graph
|
|
13
|
-
readonly check: 'asks a live agent, or
|
|
12
|
+
readonly knowledge: 'reads the graph Moonbeam keeps (sellers, buyers, markets, jobs, agents); nothing is written';
|
|
13
|
+
readonly check: 'asks a live agent, or Moonbeam, whether something holds; nothing is paid';
|
|
14
14
|
readonly transform: 'turns what was read into terms or a market\'s own format: a quote, a grade, a listing\'s export, a card';
|
|
15
15
|
readonly connector: 'hands work or a listing to a market in that market\'s own protocol';
|
|
16
16
|
readonly money: 'moves money: answers unsigned calls in order and names who signs each; nothing here signs';
|
|
@@ -18,7 +18,7 @@ export declare const NODE_CLASSES: Readonly<{
|
|
|
18
18
|
readonly output: 'what the run hands back';
|
|
19
19
|
}>;
|
|
20
20
|
export type NodeClass = keyof typeof NODE_CLASSES;
|
|
21
|
-
/** The markets a node can touch. `all` = every market
|
|
21
|
+
/** The markets a node can touch. `all` = every market Moonbeam reads. */
|
|
22
22
|
export type Market = 'all' | 'x402' | 'mcp' | 'a2a' | 'virtuals' | 'bitagent' | 'olas' | 'erc8004' | 'near' | 'moonbeam';
|
|
23
23
|
/** Who may run a node: anyone, a Moonbeam key, a key on a plan, or only on the test network. */
|
|
24
24
|
export type Access = 'public' | 'key' | 'plan' | 'testnet';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,eAAO,MAAM,YAAY;sBACd,sDAAsD;oBACxD,qDAAqD;oBACrD,2CAA2C;qBAC1C,oCAAoC;wBACjC,
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,eAAO,MAAM,YAAY;sBACd,sDAAsD;oBACxD,qDAAqD;oBACrD,2CAA2C;qBAC1C,oCAAoC;wBACjC,6FAA6F;oBACjG,0EAA0E;wBACtE,yGAAyG;wBACzG,oEAAoE;oBACxE,2FAA2F;qBAC1F,+EAA+E;qBAC/E,yBAAyB;EACxB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,YAAY,CAAC;AAElD,yEAAyE;AACzE,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AACzH,gGAAgG;AAChG,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAE3D,KAAK,EAAE,GAAG;IAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AACzF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,oFAAoF;IACpF,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;CAC3C,CAAC;AAKF,0EAA0E;AAC1E,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CA+BnD,CAAC;AAEH,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,CAIhF"}
|
package/dist/workflows/steps.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What each node of a Moonbeam workflow is: its class, what it means, who may run it, the markets it applies to, and the SDK
|
|
3
|
-
* calls that run it on Base and on the test network. One table, keyed by the
|
|
3
|
+
* calls that run it on Base and on the test network. One table, keyed by the Moonbeam call the node makes; a test holds it complete
|
|
4
4
|
* against the Studio's workflows.
|
|
5
5
|
*/
|
|
6
6
|
/** The classes of a node, by what it does to the world. */
|
|
@@ -9,8 +9,8 @@ export const NODE_CLASSES = Object.freeze({
|
|
|
9
9
|
agent: 'the chat agent that decides which tool to call next',
|
|
10
10
|
model: 'the language model the agent reasons with',
|
|
11
11
|
memory: 'what the agent keeps between turns',
|
|
12
|
-
knowledge: 'reads the graph
|
|
13
|
-
check: 'asks a live agent, or
|
|
12
|
+
knowledge: 'reads the graph Moonbeam keeps (sellers, buyers, markets, jobs, agents); nothing is written',
|
|
13
|
+
check: 'asks a live agent, or Moonbeam, whether something holds; nothing is paid',
|
|
14
14
|
transform: 'turns what was read into terms or a market\'s own format: a quote, a grade, a listing\'s export, a card',
|
|
15
15
|
connector: 'hands work or a listing to a market in that market\'s own protocol',
|
|
16
16
|
money: 'moves money: answers unsigned calls in order and names who signs each; nothing here signs',
|
|
@@ -44,7 +44,7 @@ export const STEPS = Object.freeze({
|
|
|
44
44
|
'pure:business.read': { class: 'studio', means: 'your own pages, read and confirmed in your words', access: 'public', markets: [], base: null },
|
|
45
45
|
'pure:business.claim': { class: 'studio', means: 'one line on your own host that proves the name is yours, read back', access: 'public', markets: [], base: null },
|
|
46
46
|
'pure:business.door': { class: 'check', means: 'your door answers a real call of its class, on your own key', access: 'key', markets: ['mcp', 'a2a'], base: m('testEndpoint') },
|
|
47
|
-
'pure:business.publish': { class: 'connector', means: 'one record on
|
|
47
|
+
'pure:business.publish': { class: 'connector', means: 'one record on Moonbeam, then one graded task per job: each job it passes is sold', access: 'key', markets: ['all'], base: m('publishListing') },
|
|
48
48
|
'pure:business.reach': { class: 'transform', means: 'the record in each market\'s own format: what x402, MCP, ERC-8004, NEAR and Olas each need', access: 'key', markets: ['x402', 'mcp', 'a2a', 'erc8004', 'near', 'olas'], base: m('readListing') },
|
|
49
49
|
'pure:business.pay': { class: 'knowledge', means: 'a sale and the seller\'s payout, read from the sale record', access: 'key', markets: ['all'], base: { module: 'resale', fn: 'readSale' } },
|
|
50
50
|
'pure:business.keep': { class: 'knowledge', means: 'rank, price and differences per market, until you publish again', access: 'key', markets: ['all'], base: m('readListing') },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,sDAAsD;IAC/D,KAAK,EAAE,qDAAqD;IAC5D,KAAK,EAAE,2CAA2C;IAClD,MAAM,EAAE,oCAAoC;IAC5C,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../src/workflows/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,sDAAsD;IAC/D,KAAK,EAAE,qDAAqD;IAC5D,KAAK,EAAE,2CAA2C;IAClD,MAAM,EAAE,oCAAoC;IAC5C,SAAS,EAAE,6FAA6F;IACxG,KAAK,EAAE,0EAA0E;IACjF,SAAS,EAAE,yGAAyG;IACpH,SAAS,EAAE,oEAAoE;IAC/E,KAAK,EAAE,2FAA2F;IAClG,MAAM,EAAE,+EAA+E;IACvF,MAAM,EAAE,yBAAyB;CACzB,CAAC,CAAC;AAqBZ,MAAM,CAAC,GAAG,CAAC,EAAU,EAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AACzD,MAAM,CAAC,GAAG,CAAC,EAAU,EAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AAEzD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,KAAK,GAAuC,MAAM,CAAC,MAAM,CAAC;IACrE,sBAAsB,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,kEAAkE,EAAE,MAAM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AAW,EAAE,KAAK,EAAE,uEAAuE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE;IACxL,oBAAoB,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,4CAA4C,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE;IACrJ,aAAa,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,0CAA0C,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CACjI,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,UAAU,OAAO,CAAC,CAA6C;IACnE,IAAI,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAE,CAAC,KAAK,CAAC;IACnD,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IACvB,OAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC;AACvG,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** One node of a Studio workflow: its role on the canvas, the
|
|
1
|
+
/** One node of a Studio workflow: its role on the canvas, the Moonbeam call it runs (null for the trigger, the model and the
|
|
2
2
|
* output), and what it does to the world. */
|
|
3
3
|
export type WorkflowNode = {
|
|
4
4
|
name: string;
|
package/dist/x402/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { subscribePlan } from '../resale/index.js';
|
|
|
24
24
|
import { type Refusal } from '../errors/index.js';
|
|
25
25
|
export declare const X402_BASE_NETWORK: 'eip155:8453';
|
|
26
26
|
export declare const X402_SOLANA_NETWORK: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
|
|
27
|
-
/** x402 v1 network names → CAIP-2 (
|
|
27
|
+
/** x402 v1 network names → CAIP-2 (Moonbeam's settle rule spells them the same way) */
|
|
28
28
|
export declare const NETWORK_ALIASES: Readonly<Record<string, string>>;
|
|
29
29
|
/** the header an x402 v2 payment travels in */
|
|
30
30
|
export declare const PAYMENT_HEADER: 'PAYMENT-SIGNATURE';
|
|
@@ -140,7 +140,7 @@ export declare function quoteWall(t: OnboardTransport, path: string, o?: {
|
|
|
140
140
|
accept: X402Accept;
|
|
141
141
|
body: X402Body;
|
|
142
142
|
}>;
|
|
143
|
-
/** POST /v1/access/subscribe with a subscribePlan():
|
|
143
|
+
/** POST /v1/access/subscribe with a subscribePlan(): Moonbeam answers with the top-up's x402 quote (a 402) */
|
|
144
144
|
export declare function subscribe(t: OnboardTransport, plan?: ReturnType<typeof subscribePlan>, o?: {
|
|
145
145
|
network?: string | readonly string[];
|
|
146
146
|
}): Promise<{
|
package/dist/x402/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/x402/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEjF,eAAO,MAAM,iBAAiB,EAAG,aAAsB,CAAC;AACxD,eAAO,MAAM,mBAAmB,EAAG,yCAAkD,CAAC;AACtF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/x402/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,GAAE;IAAE,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxK;AAYD,6HAA6H;AAC7H,wBAAsB,SAAS,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAMpL;AAED,8GAA8G;AAC9G,wBAAsB,SAAS,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,GAAE,UAAU,CAAC,OAAO,aAAa,CAAmB,EAAE,CAAC,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,CAAC,CAO/P;AACD,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/x402/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { subscribePlan } from '../resale/index.js';
|
|
|
3
3
|
import { CoordError, jsonOf, refusalOf } from '../errors/index.js';
|
|
4
4
|
export const X402_BASE_NETWORK = 'eip155:8453';
|
|
5
5
|
export const X402_SOLANA_NETWORK = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
|
|
6
|
-
/** x402 v1 network names → CAIP-2 (
|
|
6
|
+
/** x402 v1 network names → CAIP-2 (Moonbeam's settle rule spells them the same way) */
|
|
7
7
|
export const NETWORK_ALIASES = Object.freeze({
|
|
8
8
|
base: 'eip155:8453', 'base-sepolia': 'eip155:84532', arbitrum: 'eip155:42161', polygon: 'eip155:137', avalanche: 'eip155:43114',
|
|
9
9
|
monad: 'eip155:143', robinhood: 'eip155:4663', arc: 'eip155:5042', solana: X402_SOLANA_NETWORK,
|
|
@@ -129,7 +129,7 @@ export async function quoteWall(t, path, o = {}) {
|
|
|
129
129
|
const body = challengeOf(r, j);
|
|
130
130
|
return { status: r.status, accept: pickAccept(body, o), body };
|
|
131
131
|
}
|
|
132
|
-
/** POST /v1/access/subscribe with a subscribePlan():
|
|
132
|
+
/** POST /v1/access/subscribe with a subscribePlan(): Moonbeam answers with the top-up's x402 quote (a 402) */
|
|
133
133
|
export async function subscribe(t, plan = subscribePlan(), o = {}) {
|
|
134
134
|
const r = (await t.fetch(`${t.base}${plan.path}`, { method: plan.method, headers: { 'content-type': 'application/json', accept: 'application/json', ...(t.apiKey ? { 'x-api-key': t.apiKey } : {}) }, body: JSON.stringify(plan.body) }));
|
|
135
135
|
const body = await jsonOf(r);
|