@moonbeam-foundation/sdk 0.11.0 → 0.12.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 +67 -74
- package/bin/moonbeam.mjs +15 -1
- 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 +21 -5
- package/dist/market/index.d.ts.map +1 -1
- package/dist/market/index.js +7 -28
- 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/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 +305 -0
- package/dist/market/venues-data.js.map +1 -0
- package/dist/market/venues.d.ts +100 -0
- package/dist/market/venues.d.ts.map +1 -0
- package/dist/market/venues.js +108 -0
- package/dist/market/venues.js.map +1 -0
- package/docs/VENUES.md +160 -0
- package/examples/70-every-venue.mjs +19 -0
- package/examples/README.md +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { OnboardTransport } from '../onboard/index.js';
|
|
2
|
+
import { type Listing, type ListingView, type PlannedCall } from './index.js';
|
|
3
|
+
/** The markets the list step lists on: the agent's ERC-8004 record on Base, the official MCP Registry and the A2A Registry. */
|
|
4
|
+
export declare const LIST_MARKETS: readonly ["erc8004", "mcp_registry", "a2a_registry"];
|
|
5
|
+
export type ListMarket = (typeof LIST_MARKETS)[number];
|
|
6
|
+
/** One market of a list step: queued (publishing, within about ten minutes), listed (with the market's own url), held or failed (with why). */
|
|
7
|
+
export type ListRow = {
|
|
8
|
+
state: 'queued' | 'listed' | 'held' | 'failed';
|
|
9
|
+
why: string | null;
|
|
10
|
+
url: string | null;
|
|
11
|
+
tx: string | null;
|
|
12
|
+
at?: string;
|
|
13
|
+
read_at?: string;
|
|
14
|
+
};
|
|
15
|
+
/** A list step as the layer keeps it. The layer's own fields ride along. */
|
|
16
|
+
export type ListView = {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
id: string;
|
|
19
|
+
agent: {
|
|
20
|
+
ref: string;
|
|
21
|
+
name: string;
|
|
22
|
+
class: string;
|
|
23
|
+
offer_usdc: string | null;
|
|
24
|
+
};
|
|
25
|
+
markets: Partial<Record<ListMarket, ListRow>>;
|
|
26
|
+
fee?: {
|
|
27
|
+
usdc: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/** The list step's id of an agent, derived the way the layer derives it: `lst_` + the first 16 hex of sha256("list:<ref>"). */
|
|
31
|
+
export declare function listIdOf(ref: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* List an agent on the markets where agents are found (`POST /list`): its ERC-8004 record on Base, the MCP Registry and the
|
|
34
|
+
* A2A Registry, all three unless named. Runs on a plan key and is part of the plan (no per-listing price is set). The layer serves the agent's MCP door and A2A
|
|
35
|
+
* card and publishes each market; asking again returns the same record, read anew. `ref` is the agent's ERC-8004 id on Base,
|
|
36
|
+
* whose card names the class it sells.
|
|
37
|
+
*/
|
|
38
|
+
export declare function listOn(t: OnboardTransport, ref: string, markets?: readonly ListMarket[]): Promise<ListView>;
|
|
39
|
+
/** Where an agent stands on each of the three markets (`GET /list/:id`), or null when it was never listed. Public. */
|
|
40
|
+
export declare function listStatus(t: OnboardTransport, ref: string): Promise<ListView | null>;
|
|
41
|
+
/** Pause a live listing (`POST /agent-listings/:id { status: paused }`): it is not sold until it goes live again. On its owner's key. */
|
|
42
|
+
export declare const pauseListing: (t: OnboardTransport, id: string) => Promise<{
|
|
43
|
+
listing: Listing;
|
|
44
|
+
body: Record<string, unknown>;
|
|
45
|
+
}>;
|
|
46
|
+
/** Go live again (`POST /agent-listings/:id/publish`): one graded task per job, each job it passes is sold again. On its owner's key. */
|
|
47
|
+
export declare const resumeListing: (t: OnboardTransport, id: string) => Promise<ListingView & {
|
|
48
|
+
probes: Record<string, unknown>[];
|
|
49
|
+
}>;
|
|
50
|
+
/** Delist for good (`POST /agent-listings/:id { status: archived }`): kept for the record, never sold again. `confirm` must repeat the id. */
|
|
51
|
+
export declare function delistListing(t: OnboardTransport, id: string, o: {
|
|
52
|
+
confirm: string;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
listing: Listing;
|
|
55
|
+
body: Record<string, unknown>;
|
|
56
|
+
}>;
|
|
57
|
+
/** The layer's register-8004 builder takes an agentURI of at most this many characters. */
|
|
58
|
+
export declare const MAX_INLINE_URI = 2048;
|
|
59
|
+
/** A listing's registration file as an inline `data:` URI (nothing is hosted), or why it cannot be. Pure. */
|
|
60
|
+
export declare function inlineRegistration(x: {
|
|
61
|
+
exportable?: boolean;
|
|
62
|
+
why?: string[];
|
|
63
|
+
registration?: Record<string, unknown> | null;
|
|
64
|
+
} | null | undefined): {
|
|
65
|
+
ok: true;
|
|
66
|
+
uri: string;
|
|
67
|
+
file: Record<string, unknown>;
|
|
68
|
+
} | {
|
|
69
|
+
ok: false;
|
|
70
|
+
why: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Your agent's own ERC-8004 id on Base, as unsigned calls: the listing's registration file (`export.erc8004` of
|
|
74
|
+
* `GET /agent-listings/:id`) inlined as a data: URI, and `register(agentURI)` built by the layer (`POST /assurance/call`).
|
|
75
|
+
* Your wallet signs and owns the id; the receipt's `Registered` event names it. Nothing is signed or sent here.
|
|
76
|
+
*/
|
|
77
|
+
export declare function register8004Calls(t: OnboardTransport, listingId: string): Promise<{
|
|
78
|
+
uri: string;
|
|
79
|
+
file: Record<string, unknown>;
|
|
80
|
+
calls: PlannedCall[];
|
|
81
|
+
signer: string;
|
|
82
|
+
sent: false;
|
|
83
|
+
}>;
|
|
84
|
+
/** What your key (or your whole tenant) used over a window (`GET /access/usage`): calls and spend per product family, by day and by key. Keyed. */
|
|
85
|
+
export declare function usage(t: OnboardTransport, o?: {
|
|
86
|
+
window?: '1d' | '7d' | '30d' | 'month';
|
|
87
|
+
scope?: 'key' | 'tenant';
|
|
88
|
+
}): Promise<{
|
|
89
|
+
window: string;
|
|
90
|
+
scope: string;
|
|
91
|
+
families: Record<string, Record<string, number>>;
|
|
92
|
+
total: Record<string, number> | null;
|
|
93
|
+
byDay: Record<string, unknown>[];
|
|
94
|
+
keys: Record<string, unknown>[];
|
|
95
|
+
body: Record<string, unknown>;
|
|
96
|
+
}>;
|
|
97
|
+
/** Your tenant's keys and the recent changes to them (`GET /tenant/keys`): who created, rotated or revoked a key, and when. Keyed. */
|
|
98
|
+
export declare function tenantKeys(t: OnboardTransport): Promise<{
|
|
99
|
+
keys: Record<string, unknown>[];
|
|
100
|
+
recentChanges: Record<string, unknown>[];
|
|
101
|
+
body: Record<string, unknown>;
|
|
102
|
+
}>;
|
|
103
|
+
export type PlanOffer = {
|
|
104
|
+
plan: string;
|
|
105
|
+
usdc: number;
|
|
106
|
+
includes_usdc: number | null;
|
|
107
|
+
per_minute: number | null;
|
|
108
|
+
days: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The plans and the top-up, as the layer's own 402 answer names them (`POST /access/subscribe` with no key and no payment):
|
|
112
|
+
* nothing is minted and nothing is paid. Buying one is the same POST with a payment, from your wallet.
|
|
113
|
+
*/
|
|
114
|
+
export declare function planOffers(t: OnboardTransport): Promise<{
|
|
115
|
+
topup: {
|
|
116
|
+
usdc: number;
|
|
117
|
+
units: string;
|
|
118
|
+
what: string | null;
|
|
119
|
+
} | null;
|
|
120
|
+
plans: PlanOffer[];
|
|
121
|
+
networks: string[];
|
|
122
|
+
}>;
|
|
123
|
+
export type Share = 'paid' | 'kept' | 'held' | 'owed' | 'refunded';
|
|
124
|
+
/** One sale through a class wall or to a seller: when, through which market, what the buyer paid and where the seller's share stands. */
|
|
125
|
+
export type SaleRow = {
|
|
126
|
+
at: string | null;
|
|
127
|
+
class: string | null;
|
|
128
|
+
seller: string | null;
|
|
129
|
+
venue_in: string | null;
|
|
130
|
+
venue_out: string | null;
|
|
131
|
+
network: string | null;
|
|
132
|
+
buyer_paid_units: string;
|
|
133
|
+
seller_share_units: string;
|
|
134
|
+
share: Share;
|
|
135
|
+
held_by: string | null;
|
|
136
|
+
tx: string;
|
|
137
|
+
};
|
|
138
|
+
/** One slice of the sale run: an agent's class wall (`class:<class>`) or a seller (`seller:<host>`), by day and buying market. Units are USDC × 10⁶. */
|
|
139
|
+
export type SaleSlice = {
|
|
140
|
+
key: string;
|
|
141
|
+
kind: 'class' | 'seller';
|
|
142
|
+
sales: number;
|
|
143
|
+
buyer_paid_units: string;
|
|
144
|
+
seller_share_units: string;
|
|
145
|
+
first_at: string | null;
|
|
146
|
+
last_at: string | null;
|
|
147
|
+
split: Record<Share, string>;
|
|
148
|
+
held_by: Record<string, number>;
|
|
149
|
+
venues: Record<string, number>;
|
|
150
|
+
days: {
|
|
151
|
+
day: string;
|
|
152
|
+
venue_in: string | null;
|
|
153
|
+
sales: number;
|
|
154
|
+
buyer_paid_units: string;
|
|
155
|
+
}[];
|
|
156
|
+
recent: SaleRow[];
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* What an agent sold, as the sale run counts it: the slice of its class wall or of its seller host, every sale by day and buying
|
|
160
|
+
* market, and where each seller share stands (paid, kept, held, owed, refunded). The sale run is a published file: pass its URL
|
|
161
|
+
* as `salesUrl` or set MOONBEAM_SALES_URL (it comes with your key). The layer's own seller hosts are said as `ours`.
|
|
162
|
+
* null when the agent has no sale.
|
|
163
|
+
*/
|
|
164
|
+
export declare function agentSales(t: OnboardTransport, ref: string, o?: {
|
|
165
|
+
salesUrl?: string;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
slice: SaleSlice;
|
|
168
|
+
days: string[];
|
|
169
|
+
readAt: string;
|
|
170
|
+
} | null>;
|
|
171
|
+
/** One Olas Mech request on Base as its evidence reads (`GET /judge/evidence/olas/:requestId`, the marketplace's 32-byte request id):
|
|
172
|
+
* the prompt, tool, mech, fee and response, its request and delivery transactions, and the grade call to make. Public. */
|
|
173
|
+
export declare function olasRequest(t: OnboardTransport, requestId: string): Promise<Record<string, unknown>>;
|
|
174
|
+
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/market/journey.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAyC,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAIrH,+HAA+H;AAC/H,eAAO,MAAM,YAAY,sDAAsE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,+IAA+I;AAC/I,MAAM,MAAM,OAAO,GAAG;IAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACnK,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,GA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MAAM,EAAE,CAAC,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAYtK;AAID;2HAC2H;AAC3H,wBAAsB,WAAW,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAI1G"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsonOf } from '../errors/index.js';
|
|
2
|
+
import { MarketError, call, needKey, query, seg } from './http.js';
|
|
3
|
+
import { jobCalls, publishListing, readListing } from './index.js';
|
|
4
|
+
// ── list ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
/** The markets the list step lists on: the agent's ERC-8004 record on Base, the official MCP Registry and the A2A Registry. */
|
|
6
|
+
export const LIST_MARKETS = Object.freeze(['erc8004', 'mcp_registry', 'a2a_registry']);
|
|
7
|
+
const AGENT_REF = /^8453:\d{1,12}$/;
|
|
8
|
+
const agentRef = (ref) => { const r = String(ref ?? '').trim(); if (!AGENT_REF.test(r))
|
|
9
|
+
throw new RangeError(`an agent is 8453:<its ERC-8004 id>: ${ref}`); return r; };
|
|
10
|
+
const listOf = (j, what) => {
|
|
11
|
+
if (!j.list || typeof j.list.id !== 'string' || !j.list.markets)
|
|
12
|
+
throw new MarketError(502, what, j);
|
|
13
|
+
return j.list;
|
|
14
|
+
};
|
|
15
|
+
/** The list step's id of an agent, derived the way the layer derives it: `lst_` + the first 16 hex of sha256("list:<ref>"). */
|
|
16
|
+
export async function listIdOf(ref) {
|
|
17
|
+
const d = await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(`list:${agentRef(ref)}`));
|
|
18
|
+
return `lst_${[...new Uint8Array(d)].map((b) => b.toString(16).padStart(2, '0')).join('').slice(0, 16)}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List an agent on the markets where agents are found (`POST /list`): its ERC-8004 record on Base, the MCP Registry and the
|
|
22
|
+
* A2A Registry, all three unless named. Runs on a plan key and is part of the plan (no per-listing price is set). The layer serves the agent's MCP door and A2A
|
|
23
|
+
* card and publishes each market; asking again returns the same record, read anew. `ref` is the agent's ERC-8004 id on Base,
|
|
24
|
+
* whose card names the class it sells.
|
|
25
|
+
*/
|
|
26
|
+
export async function listOn(t, ref, markets = LIST_MARKETS) {
|
|
27
|
+
const agent = agentRef(ref);
|
|
28
|
+
const bad = markets.filter((m) => !LIST_MARKETS.includes(m));
|
|
29
|
+
if (!markets.length || bad.length)
|
|
30
|
+
throw new RangeError(`the list step lists on ${LIST_MARKETS.join(', ')}${bad.length ? `, not ${bad.join(', ')}` : ''}`);
|
|
31
|
+
needKey(t, 'POST /list');
|
|
32
|
+
return listOf(await call(t, 'POST', '/list', { agent, markets: [...new Set(markets)] }), 'POST /list');
|
|
33
|
+
}
|
|
34
|
+
/** Where an agent stands on each of the three markets (`GET /list/:id`), or null when it was never listed. Public. */
|
|
35
|
+
export async function listStatus(t, ref) {
|
|
36
|
+
const id = await listIdOf(ref);
|
|
37
|
+
try {
|
|
38
|
+
return listOf(await call(t, 'GET', `/list/${seg(id)}`), 'GET /list/:id');
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
if (e instanceof MarketError && e.status === 404)
|
|
42
|
+
return null;
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// ── manage ────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
47
|
+
const AL = /^al_[0-9a-f]{16}$/;
|
|
48
|
+
const alId = (id) => { if (!AL.test(id))
|
|
49
|
+
throw new RangeError(`not an agent listing id (al_ and 16 hex): ${id}`); return id; };
|
|
50
|
+
const statusTo = async (t, id, status) => {
|
|
51
|
+
needKey(t, 'POST /agent-listings/:id');
|
|
52
|
+
const j = await call(t, 'POST', `/agent-listings/${alId(id)}`, { status });
|
|
53
|
+
if (!j.listing || typeof j.listing.id !== 'string')
|
|
54
|
+
throw new MarketError(502, 'POST /agent-listings/:id', j);
|
|
55
|
+
return { listing: j.listing, body: j };
|
|
56
|
+
};
|
|
57
|
+
/** Pause a live listing (`POST /agent-listings/:id { status: paused }`): it is not sold until it goes live again. On its owner's key. */
|
|
58
|
+
export const pauseListing = (t, id) => statusTo(t, id, 'paused');
|
|
59
|
+
/** Go live again (`POST /agent-listings/:id/publish`): one graded task per job, each job it passes is sold again. On its owner's key. */
|
|
60
|
+
export const resumeListing = (t, id) => publishListing(t, id);
|
|
61
|
+
/** Delist for good (`POST /agent-listings/:id { status: archived }`): kept for the record, never sold again. `confirm` must repeat the id. */
|
|
62
|
+
export async function delistListing(t, id, o) {
|
|
63
|
+
if (o?.confirm !== id)
|
|
64
|
+
throw new RangeError('delisting is for good: pass { confirm: <the listing id> }');
|
|
65
|
+
return statusTo(t, id, 'archived');
|
|
66
|
+
}
|
|
67
|
+
// ── register on ERC-8004 ──────────────────────────────────────────────────────────────────────────────────────────────
|
|
68
|
+
/** The layer's register-8004 builder takes an agentURI of at most this many characters. */
|
|
69
|
+
export const MAX_INLINE_URI = 2048;
|
|
70
|
+
const base64 = (s) => { let b = ''; for (const c of new TextEncoder().encode(s))
|
|
71
|
+
b += String.fromCharCode(c); return btoa(b); };
|
|
72
|
+
/** A listing's registration file as an inline `data:` URI (nothing is hosted), or why it cannot be. Pure. */
|
|
73
|
+
export function inlineRegistration(x) {
|
|
74
|
+
if (!x || !x.registration)
|
|
75
|
+
return { ok: false, why: 'the listing carries no registration file' };
|
|
76
|
+
if (!x.exportable)
|
|
77
|
+
return { ok: false, why: (x.why ?? []).join('; ') || 'this listing has no registration file yet' };
|
|
78
|
+
const uri = `data:application/json;base64,${base64(JSON.stringify(x.registration))}`;
|
|
79
|
+
if (uri.length > MAX_INLINE_URI)
|
|
80
|
+
return { ok: false, why: `its file is ${uri.length} characters inline, over ${MAX_INLINE_URI}: shorten its description, or host the file at an https URL and register that` };
|
|
81
|
+
return { ok: true, uri, file: x.registration };
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Your agent's own ERC-8004 id on Base, as unsigned calls: the listing's registration file (`export.erc8004` of
|
|
85
|
+
* `GET /agent-listings/:id`) inlined as a data: URI, and `register(agentURI)` built by the layer (`POST /assurance/call`).
|
|
86
|
+
* Your wallet signs and owns the id; the receipt's `Registered` event names it. Nothing is signed or sent here.
|
|
87
|
+
*/
|
|
88
|
+
export async function register8004Calls(t, listingId) {
|
|
89
|
+
const view = await readListing(t, listingId);
|
|
90
|
+
const x = view.export?.erc8004;
|
|
91
|
+
const f = inlineRegistration(x);
|
|
92
|
+
if (!f.ok)
|
|
93
|
+
throw new MarketError(422, 'register8004Calls', { ok: false, code: 'not_registrable', error: f.why });
|
|
94
|
+
const { calls } = await jobCalls(t, { chainId: 8453, action: { kind: 'register-8004', agentURI: f.uri } });
|
|
95
|
+
const reg = calls.filter((c) => c.action === undefined || c.action === 'register-8004');
|
|
96
|
+
if (!reg.length || !reg.every((c) => /^0x[0-9a-fA-F]{40}$/.test(String(c.to ?? '')) && /^0x[0-9a-fA-F]+$/.test(String(c.data ?? ''))))
|
|
97
|
+
throw new MarketError(502, 'POST /assurance/call', { ok: false, code: 'no_call', error: 'the register call could not be built' });
|
|
98
|
+
return { uri: f.uri, file: f.file, calls: reg, signer: 'your wallet: the account that will own the agent\'s ERC-8004 id', sent: false };
|
|
99
|
+
}
|
|
100
|
+
// ── measure ───────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
101
|
+
/** What your key (or your whole tenant) used over a window (`GET /access/usage`): calls and spend per product family, by day and by key. Keyed. */
|
|
102
|
+
export async function usage(t, o = {}) {
|
|
103
|
+
needKey(t, 'GET /access/usage');
|
|
104
|
+
const window = o.window ?? 'month';
|
|
105
|
+
const scope = o.scope ?? 'tenant';
|
|
106
|
+
const j = await call(t, 'GET', `/access/usage${query({ window, scope })}`);
|
|
107
|
+
return { window: j.window ?? window, scope: j.scope ?? scope, families: j.families ?? {}, total: j.total ?? null, byDay: j.by_day ?? [], keys: j.keys ?? [], body: j };
|
|
108
|
+
}
|
|
109
|
+
/** Your tenant's keys and the recent changes to them (`GET /tenant/keys`): who created, rotated or revoked a key, and when. Keyed. */
|
|
110
|
+
export async function tenantKeys(t) {
|
|
111
|
+
needKey(t, 'GET /tenant/keys');
|
|
112
|
+
const j = await call(t, 'GET', '/tenant/keys');
|
|
113
|
+
return { keys: j.keys ?? [], recentChanges: j.recent_changes ?? [], body: j };
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The plans and the top-up, as the layer's own 402 answer names them (`POST /access/subscribe` with no key and no payment):
|
|
117
|
+
* nothing is minted and nothing is paid. Buying one is the same POST with a payment, from your wallet.
|
|
118
|
+
*/
|
|
119
|
+
export async function planOffers(t) {
|
|
120
|
+
const what = 'POST /access/subscribe';
|
|
121
|
+
// no key and no create_key: the layer answers its terms with 402 and mints nothing
|
|
122
|
+
const r = await t.fetch(`${t.base}/access/subscribe`, { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' }, body: '{}' });
|
|
123
|
+
const j = (await jsonOf(r));
|
|
124
|
+
if (r.status !== 402 || !j || j.code !== 'payment_required')
|
|
125
|
+
throw new MarketError(r.status === 402 ? 502 : r.status, what, j);
|
|
126
|
+
const plans = (j.monthly?.plans ?? []).filter((p) => typeof p.plan === 'string' && typeof p.usdc === 'number')
|
|
127
|
+
.map((p) => ({ plan: p.plan, usdc: p.usdc, includes_usdc: p.includes_usdc ?? null, per_minute: p.per_minute ?? null, days: p.days ?? 30 }));
|
|
128
|
+
const o = j.offer;
|
|
129
|
+
return { topup: o && typeof o.usdc === 'number' ? { usdc: o.usdc, units: String(o.units ?? ''), what: o.what ?? null } : null, plans,
|
|
130
|
+
networks: [...new Set((j.accepts ?? []).map((a) => a.network).filter((n) => typeof n === 'string'))] };
|
|
131
|
+
}
|
|
132
|
+
const OWN_HOST = /taifoon|n8n|genie/i;
|
|
133
|
+
const OURS = 'ours';
|
|
134
|
+
const keyOfRef = (ref) => {
|
|
135
|
+
const r = String(ref ?? '').trim().toLowerCase();
|
|
136
|
+
if (/^(class|seller):[a-z0-9._-]{2,253}$/.test(r))
|
|
137
|
+
return r;
|
|
138
|
+
if (/^[a-z0-9_]+(\.[a-z0-9_]+){1,3}$/.test(r))
|
|
139
|
+
return `class:${r}`;
|
|
140
|
+
try {
|
|
141
|
+
const h = new URL(r).hostname;
|
|
142
|
+
if (h)
|
|
143
|
+
return `seller:${h}`;
|
|
144
|
+
}
|
|
145
|
+
catch { /* not a URL */ }
|
|
146
|
+
throw new RangeError(`an agent's sales are read by its class (mcp.digest), class:<class>, seller:<host> or its endpoint URL: ${ref}`);
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* What an agent sold, as the sale run counts it: the slice of its class wall or of its seller host, every sale by day and buying
|
|
150
|
+
* market, and where each seller share stands (paid, kept, held, owed, refunded). The sale run is a published file: pass its URL
|
|
151
|
+
* as `salesUrl` or set MOONBEAM_SALES_URL (it comes with your key). The layer's own seller hosts are said as `ours`.
|
|
152
|
+
* null when the agent has no sale.
|
|
153
|
+
*/
|
|
154
|
+
export async function agentSales(t, ref, o = {}) {
|
|
155
|
+
const key = keyOfRef(ref);
|
|
156
|
+
const url = (o.salesUrl ?? (typeof process !== 'undefined' ? process.env?.['MOONBEAM_SALES_URL'] : undefined) ?? '').trim();
|
|
157
|
+
if (!/^https:\/\//.test(url))
|
|
158
|
+
throw new RangeError('agentSales reads the sale run: pass { salesUrl } or set MOONBEAM_SALES_URL (https)');
|
|
159
|
+
const r = await t.fetch(url, { method: 'GET', headers: { accept: 'application/json' } });
|
|
160
|
+
const j = (await jsonOf(r));
|
|
161
|
+
const b = j?.by_agent;
|
|
162
|
+
if (!r.ok || !b || b.rule !== 'SALE_SLICES_v1' || !Array.isArray(b.slices))
|
|
163
|
+
throw new MarketError(r.ok ? 502 : r.status, 'GET sale run', j);
|
|
164
|
+
const scrub = (s) => ({ ...s, key: s.kind === 'seller' && OWN_HOST.test(s.key) ? `seller:${OURS}` : s.key, recent: (s.recent ?? []).map((x) => (x.seller && OWN_HOST.test(x.seller) ? { ...x, seller: OURS } : x)) });
|
|
165
|
+
const slice = b.slices.map(scrub).find((s) => s.key === key) ?? null;
|
|
166
|
+
if (!slice || !slice.sales)
|
|
167
|
+
return null;
|
|
168
|
+
return { slice, days: (b.days ?? []).filter((d) => typeof d === 'string'), readAt: j?.generated_at ?? new Date().toISOString() };
|
|
169
|
+
}
|
|
170
|
+
// ── a venue's own job ─────────────────────────────────────────────────────────────────────────────────────────────────
|
|
171
|
+
/** One Olas Mech request on Base as its evidence reads (`GET /judge/evidence/olas/:requestId`, the marketplace's 32-byte request id):
|
|
172
|
+
* the prompt, tool, mech, fee and response, its request and delivery transactions, and the grade call to make. Public. */
|
|
173
|
+
export async function olasRequest(t, requestId) {
|
|
174
|
+
const id = String(requestId ?? '').trim();
|
|
175
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(id))
|
|
176
|
+
throw new RangeError(`an Olas request id is 0x and 64 hex: ${requestId}`);
|
|
177
|
+
return call(t, 'GET', `/judge/evidence/olas/${seg(id)}`);
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=journey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/market/journey.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAoD,MAAM,YAAY,CAAC;AAErH,yHAAyH;AAEzH,+HAA+H;AAC/H,MAAM,CA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AmB,EAAE,SAAiB;IACtE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,wCAAwC,SAAS,EAAE,CAAC,CAAC;IAC/G,OAAO,IAAI,CAA0B,CAAC,EAAE,KAAK,EAAE,wBAAwB,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** What a stop's call needs: nothing (offline, in this package), the shared free rate (public; a key lifts it), or your key. */
|
|
2
|
+
export type StopNeeds = 'offline' | 'free' | 'key';
|
|
3
|
+
/** How the Studio's tour says a stop runs today, as its knowledge reads it (null where it says nothing). */
|
|
4
|
+
export type StopHop = 'live' | 'partial' | 'missing' | null;
|
|
5
|
+
export type SaleStop = {
|
|
6
|
+
/** the stop's id; the Studio's node is `tutorial-stop:<id>` */
|
|
7
|
+
id: string;
|
|
8
|
+
/** its place in the sale, 1 to 17 */
|
|
9
|
+
order: number;
|
|
10
|
+
/** the Studio's own label */
|
|
11
|
+
label: string;
|
|
12
|
+
/** the Studio command or the layer op the tour runs at this stop */
|
|
13
|
+
studio: string;
|
|
14
|
+
/** the one SDK call: `market.<fn>`, `resale.<fn>`, or the CLI line for the first stop */
|
|
15
|
+
call: string;
|
|
16
|
+
/** the module the call is exported from (`cli`: the `moonbeam` command of this package) */
|
|
17
|
+
module: 'market' | 'resale' | 'cli';
|
|
18
|
+
/** the export (or the CLI subcommand) */
|
|
19
|
+
fn: string;
|
|
20
|
+
/** the layer route the call uses, or null when it runs offline */
|
|
21
|
+
route: string | null;
|
|
22
|
+
needs: StopNeeds;
|
|
23
|
+
hop: StopHop;
|
|
24
|
+
};
|
|
25
|
+
/** The 17 stops of one sale, in order, each with its one SDK call. */
|
|
26
|
+
export declare const SALE_STOPS: readonly SaleStop[];
|
|
27
|
+
/** One stop by its id (`offer-in`) or the Studio's node id (`tutorial-stop:offer-in`). */
|
|
28
|
+
export declare const saleStop: (id: string) => SaleStop | null;
|
|
29
|
+
//# sourceMappingURL=sale-stops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sale-stops.d.ts","sourceRoot":"","sources":["../../src/market/sale-stops.ts"],"names":[],"mappings":"AAGA,gIAAgI;AAChI,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AACnD,4GAA4G;AAC5G,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG;IACrB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,2FAA2F;IAC3F,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;IACpC,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,kEAAkE;IAClE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAOF,sEAAsE;AACtE,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAkBxC,CAAC;AACH,0FAA0F;AAC1F,eAAO,MAAM,QAAQ,OAAQ,MAAM,KAAG,QAAQ,GAAG,IAAkF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// ONE SALE, STOP BY STOP: the Moonbeam Studio's sale tour (its 17 stops, `tutorial-stop:<id>`) paired 1:1 with the SDK. Each stop
|
|
2
|
+
// has exactly one SDK call that does or reads it. The Studio shows this table; its field names are stable.
|
|
3
|
+
const stop = (order, id, label, studio, call, route, needs, hop) => {
|
|
4
|
+
const [module, fn] = call.startsWith('npx moonbeam ') ? ['cli', call.slice('npx moonbeam '.length)] : call.split('.');
|
|
5
|
+
return Object.freeze({ id, order, label, studio, call, module: module, fn: fn, route, needs, hop });
|
|
6
|
+
};
|
|
7
|
+
/** The 17 stops of one sale, in order, each with its one SDK call. */
|
|
8
|
+
export const SALE_STOPS = Object.freeze([
|
|
9
|
+
stop(1, 'studio', 'The Studio', 'page /acp/studio', 'npx moonbeam workflows', null, 'offline', null),
|
|
10
|
+
stop(2, 'offer-in', 'A seller comes in', '/find 3', 'market.searchSellers', 'GET /match/search', 'free', 'live'),
|
|
11
|
+
stop(3, 'classify', 'Checked and classed', 'POST /v1/handshake', 'market.checkAgent', 'POST /onboard/diagnose', 'key', 'live'),
|
|
12
|
+
stop(4, 'listed', 'Listed', '/onboard 1', 'market.publishListing', 'POST /agent-listings/:id/publish', 'key', 'live'),
|
|
13
|
+
stop(5, 'quote', 'The terms', 'POST /v1/pools/quote', 'resale.quoteSale', null, 'offline', 'live'),
|
|
14
|
+
stop(6, 'edges', 'Your listings', '/edges', 'market.layerListings', 'GET /listings', 'free', 'live'),
|
|
15
|
+
stop(7, 'hired', 'Hired', 'POST /v1/exchanges/:edge_id/call', 'market.hirePlan', 'POST /settle', 'key', 'partial'),
|
|
16
|
+
stop(8, 'delivered', 'Delivered', '/sell', 'market.handOver', 'POST /handshake', 'key', 'live'),
|
|
17
|
+
stop(9, 'graded', 'Graded', 'assurance', 'market.composeGrade', 'POST /judge/compose', 'key', 'live'),
|
|
18
|
+
stop(10, 'settled', 'Settled', 'POST /v1/settle', 'market.jobRecord', 'GET /settle/:id', 'free', 'live'),
|
|
19
|
+
stop(11, 'legs', 'Who gets what', '/sell', 'resale.legsByName', null, 'offline', 'live'),
|
|
20
|
+
stop(12, 'accrued', 'Booked', 'GET /v1/resale', 'market.saleLedger', 'GET /resale', 'free', 'live'),
|
|
21
|
+
stop(13, 'split', 'Added up each week', 'GET /v1/pipe/queues', 'market.payoutQueues', 'GET /pipe/queues', 'free', 'partial'),
|
|
22
|
+
stop(14, 'vault', 'The vault', 'GET /v1/vault/policy', 'market.vaultPolicy', 'GET /vault/policy', 'free', 'missing'),
|
|
23
|
+
stop(15, 'paid', 'Paid', 'GET /v1/vault/policy', 'market.claimablePayouts', 'GET /pipe/claimable', 'free', 'missing'),
|
|
24
|
+
stop(16, 'recorded', 'Recorded', 'GET /v1/root', 'market.saleRecord', 'GET /root', 'free', 'live'),
|
|
25
|
+
stop(17, 'usage', 'What it cost', 'Settings → Usage', 'market.keyStanding', 'GET /access/key', 'key', null),
|
|
26
|
+
]);
|
|
27
|
+
/** One stop by its id (`offer-in`) or the Studio's node id (`tutorial-stop:offer-in`). */
|
|
28
|
+
export const saleStop = (id) => SALE_STOPS.find((s) => s.id === id.replace(/^tutorial-stop:/, '')) ?? null;
|
|
29
|
+
//# sourceMappingURL=sale-stops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sale-stops.js","sourceRoot":"","sources":["../../src/market/sale-stops.ts"],"names":[],"mappings":"AAAA,kIAAkI;AAClI,2GAA2G;AA2B3G,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAU,EAAE,KAAa,EAAE,MAAc,EAAE,IAAY,EAAE,KAAoB,EAAE,KAAgB,EAAE,GAAY,EAAY,EAAE;IACtJ,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC1I,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,M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O,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { OnboardTransport } from '../onboard/index.js';
|
|
2
|
+
type Obj = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Booked: the resale ledger's view (`GET /resale`). Its rule (a buyer pays once; every cut is a leg to a named party and the legs
|
|
5
|
+
* sum to the payment), the routes from a supply to a buying market with their legs, and the next field each route waits on.
|
|
6
|
+
*/
|
|
7
|
+
export declare function saleLedger(t: OnboardTransport): Promise<{
|
|
8
|
+
rule: string | null;
|
|
9
|
+
counts: Record<string, unknown>;
|
|
10
|
+
routes: Obj[];
|
|
11
|
+
next: Obj[];
|
|
12
|
+
body: Obj;
|
|
13
|
+
}>;
|
|
14
|
+
/** One queue of one chain: how many envelopes wait, the oldest one's age, and the same per venue. */
|
|
15
|
+
export type QueueDepth = {
|
|
16
|
+
depth: number;
|
|
17
|
+
oldest_s: number;
|
|
18
|
+
venues?: Record<string, {
|
|
19
|
+
depth: number;
|
|
20
|
+
oldest_s: number;
|
|
21
|
+
needs_signature?: number;
|
|
22
|
+
value_depth?: number;
|
|
23
|
+
value_oldest_s?: number;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Added up: the payout pipe's queues (`GET /pipe/queues`). One pipe seen four ways (read, sign, settle, ack), per chain as
|
|
28
|
+
* `eip155:<id>` (plus `offchain`), each queue with its depth and its oldest envelope's age in seconds.
|
|
29
|
+
*/
|
|
30
|
+
export declare function payoutQueues(t: OnboardTransport): Promise<{
|
|
31
|
+
at: number | null;
|
|
32
|
+
queues: {
|
|
33
|
+
name: string;
|
|
34
|
+
why: string;
|
|
35
|
+
}[];
|
|
36
|
+
chains: Record<string, Partial<Record<'read' | 'sign' | 'settle' | 'ack', QueueDepth>>>;
|
|
37
|
+
body: Obj;
|
|
38
|
+
}>;
|
|
39
|
+
/** The vault's rule for what an agent's calls may do: the actions allowed, on which chains, at what value and rate, and which need a person. */
|
|
40
|
+
export type VaultRule = {
|
|
41
|
+
allow: string[];
|
|
42
|
+
chains: number[];
|
|
43
|
+
maxValueWei: string;
|
|
44
|
+
perHour: number | null;
|
|
45
|
+
requiresHuman: string[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The vault: the account payouts come from and its limits (`GET /vault/policy`): the actions it allows, the chains, the value
|
|
49
|
+
* cap, the rate, which actions need a person; and the vaults it keeps, by id, kind, chains and assets (their addresses are
|
|
50
|
+
* not carried here).
|
|
51
|
+
*/
|
|
52
|
+
export declare function vaultPolicy(t: OnboardTransport): Promise<{
|
|
53
|
+
rule: VaultRule;
|
|
54
|
+
vaults: {
|
|
55
|
+
id: string;
|
|
56
|
+
kind: string | null;
|
|
57
|
+
chains: string[];
|
|
58
|
+
assets: string[];
|
|
59
|
+
}[];
|
|
60
|
+
note: string | null;
|
|
61
|
+
}>;
|
|
62
|
+
/** One payout envelope anyone may settle: its id, chain (`eip155:<id>`), venue, due time and the open steps a settler can take. */
|
|
63
|
+
export type ClaimablePayout = {
|
|
64
|
+
id: string;
|
|
65
|
+
chain: string;
|
|
66
|
+
kind: string;
|
|
67
|
+
venue: string | null;
|
|
68
|
+
due: number | null;
|
|
69
|
+
needs_signature: boolean;
|
|
70
|
+
open_steps: Obj[];
|
|
71
|
+
order_key: string | null;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Paid: the signed payout envelopes waiting to be settled (`GET /pipe/claimable`). Anyone may take an open step and report its
|
|
75
|
+
* transaction; the first valid inclusion on chain wins. Steps that are the operator's wait for its signer.
|
|
76
|
+
*/
|
|
77
|
+
export declare function claimablePayouts(t: OnboardTransport, o?: {
|
|
78
|
+
chain?: string;
|
|
79
|
+
limit?: number;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
at: number | null;
|
|
82
|
+
count: number;
|
|
83
|
+
payouts: ClaimablePayout[];
|
|
84
|
+
how: string | null;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Recorded: the signed root every step of every sale goes into (`GET /root`): the root, when it was made, how many leaves it
|
|
88
|
+
* holds and the chains it covers. Anyone can read it, and an agent's history is proven against it.
|
|
89
|
+
*/
|
|
90
|
+
export declare function saleRecord(t: OnboardTransport): Promise<{
|
|
91
|
+
root: string;
|
|
92
|
+
timestamp: number | null;
|
|
93
|
+
leafCount: number | null;
|
|
94
|
+
peakCount: number | null;
|
|
95
|
+
chains: number[];
|
|
96
|
+
}>;
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=sale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sale.d.ts","sourceRoot":"","sources":["../../src/market/sale.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGnC;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,GAAG,EAAE,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAAC,CAG9J;AAED,qGAAqG;AACrG,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CA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AM,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,GAAG,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC3L;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAMrM;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAK/K"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MarketError, call } from './http.js';
|
|
2
|
+
const rows = (v) => (Array.isArray(v) ? v.filter((x) => !!x && typeof x === 'object') : []);
|
|
3
|
+
/**
|
|
4
|
+
* Booked: the resale ledger's view (`GET /resale`). Its rule (a buyer pays once; every cut is a leg to a named party and the legs
|
|
5
|
+
* sum to the payment), the routes from a supply to a buying market with their legs, and the next field each route waits on.
|
|
6
|
+
*/
|
|
7
|
+
export async function saleLedger(t) {
|
|
8
|
+
const j = await call(t, 'GET', '/resale');
|
|
9
|
+
return { rule: typeof j['rule'] === 'string' ? j['rule'] : null, counts: j['counts'] ?? {}, routes: rows(j['routes']), next: rows(j['next']), body: j };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Added up: the payout pipe's queues (`GET /pipe/queues`). One pipe seen four ways (read, sign, settle, ack), per chain as
|
|
13
|
+
* `eip155:<id>` (plus `offchain`), each queue with its depth and its oldest envelope's age in seconds.
|
|
14
|
+
*/
|
|
15
|
+
export async function payoutQueues(t) {
|
|
16
|
+
const j = await call(t, 'GET', '/pipe/queues');
|
|
17
|
+
return {
|
|
18
|
+
at: typeof j['at'] === 'number' ? j['at'] : null,
|
|
19
|
+
queues: rows(j['queues']).map((q) => ({ name: String(q['name'] ?? ''), why: String(q['why'] ?? '') })),
|
|
20
|
+
chains: j['chains'] ?? {},
|
|
21
|
+
body: j,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The vault: the account payouts come from and its limits (`GET /vault/policy`): the actions it allows, the chains, the value
|
|
26
|
+
* cap, the rate, which actions need a person; and the vaults it keeps, by id, kind, chains and assets (their addresses are
|
|
27
|
+
* not carried here).
|
|
28
|
+
*/
|
|
29
|
+
export async function vaultPolicy(t) {
|
|
30
|
+
const j = await call(t, 'GET', '/vault/policy');
|
|
31
|
+
const p = (j['policy'] ?? {});
|
|
32
|
+
return {
|
|
33
|
+
rule: { allow: (p.allow ?? []).map(String), chains: (p.chains ?? []).map(Number), maxValueWei: String(p.maxValueWei ?? '0'), perHour: typeof p.perHour === 'number' ? p.perHour : null, requiresHuman: (p.requiresHuman ?? []).map(String) },
|
|
34
|
+
vaults: rows(j['registry']).map((v) => ({ id: String(v['id'] ?? ''), kind: typeof v['kind'] === 'string' ? v['kind'] : null, chains: Array.isArray(v['chains']) ? v['chains'].map(String) : [], assets: Array.isArray(v['assets']) ? v['assets'].map(String) : [] })),
|
|
35
|
+
note: typeof j['note'] === 'string' ? j['note'] : null,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Paid: the signed payout envelopes waiting to be settled (`GET /pipe/claimable`). Anyone may take an open step and report its
|
|
40
|
+
* transaction; the first valid inclusion on chain wins. Steps that are the operator's wait for its signer.
|
|
41
|
+
*/
|
|
42
|
+
export async function claimablePayouts(t, o = {}) {
|
|
43
|
+
const q = new URLSearchParams();
|
|
44
|
+
if (o.chain)
|
|
45
|
+
q.set('chain', o.chain);
|
|
46
|
+
if (o.limit)
|
|
47
|
+
q.set('limit', String(o.limit));
|
|
48
|
+
const j = await call(t, 'GET', `/pipe/claimable${q.size ? `?${q}` : ''}`);
|
|
49
|
+
const payouts = rows(j['envelopes']).map((e) => ({ id: String(e['id'] ?? ''), chain: String(e['chain'] ?? ''), kind: String(e['kind'] ?? ''), venue: typeof e['venue'] === 'string' ? e['venue'] : null,
|
|
50
|
+
due: typeof e['due'] === 'number' ? e['due'] : null, needs_signature: e['needs_signature'] === true, open_steps: rows(e['open_steps']), order_key: typeof e['order_key'] === 'string' ? e['order_key'] : null }));
|
|
51
|
+
return { at: typeof j['at'] === 'number' ? j['at'] : null, count: typeof j['count'] === 'number' ? j['count'] : payouts.length, payouts, how: typeof j['how'] === 'string' ? j['how'] : null };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Recorded: the signed root every step of every sale goes into (`GET /root`): the root, when it was made, how many leaves it
|
|
55
|
+
* holds and the chains it covers. Anyone can read it, and an agent's history is proven against it.
|
|
56
|
+
*/
|
|
57
|
+
export async function saleRecord(t) {
|
|
58
|
+
const j = await call(t, 'GET', '/root');
|
|
59
|
+
if (typeof j['root'] !== 'string')
|
|
60
|
+
throw new MarketError(502, 'GET /root', j);
|
|
61
|
+
return { root: j['root'], timestamp: typeof j['timestamp'] === 'number' ? j['timestamp'] : null, leafCount: typeof j['leaf_count'] === 'number' ? j['leaf_count'] : null,
|
|
62
|
+
peakCount: typeof j['peak_count'] === 'number' ? j['peak_count'] : null, chains: Array.isArray(j['chains_included']) ? j['chains_included'].map(Number) : [] };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=sale.js.map
|