@moonbeam-foundation/sdk 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +378 -0
  3. package/bin/moonbeam.mjs +56 -0
  4. package/dist/acp/coverage.d.ts +36 -0
  5. package/dist/acp/coverage.d.ts.map +1 -0
  6. package/dist/acp/coverage.js +51 -0
  7. package/dist/acp/coverage.js.map +1 -0
  8. package/dist/acp/events.d.ts +201 -0
  9. package/dist/acp/events.d.ts.map +1 -0
  10. package/dist/acp/events.js +201 -0
  11. package/dist/acp/events.js.map +1 -0
  12. package/dist/acp/hex.d.ts +29 -0
  13. package/dist/acp/hex.d.ts.map +1 -0
  14. package/dist/acp/hex.js +51 -0
  15. package/dist/acp/hex.js.map +1 -0
  16. package/dist/acp/lifecycle-types.d.ts +11 -0
  17. package/dist/acp/lifecycle-types.d.ts.map +1 -0
  18. package/dist/acp/lifecycle-types.js +8 -0
  19. package/dist/acp/lifecycle-types.js.map +1 -0
  20. package/dist/acp/lifecycle.d.ts +78 -0
  21. package/dist/acp/lifecycle.d.ts.map +1 -0
  22. package/dist/acp/lifecycle.js +224 -0
  23. package/dist/acp/lifecycle.js.map +1 -0
  24. package/dist/acp/outcome.d.ts +45 -0
  25. package/dist/acp/outcome.d.ts.map +1 -0
  26. package/dist/acp/outcome.js +104 -0
  27. package/dist/acp/outcome.js.map +1 -0
  28. package/dist/acp/pipeline.d.ts +30 -0
  29. package/dist/acp/pipeline.d.ts.map +1 -0
  30. package/dist/acp/pipeline.js +25 -0
  31. package/dist/acp/pipeline.js.map +1 -0
  32. package/dist/acp/recourse.d.ts +74 -0
  33. package/dist/acp/recourse.d.ts.map +1 -0
  34. package/dist/acp/recourse.js +234 -0
  35. package/dist/acp/recourse.js.map +1 -0
  36. package/dist/acp/registry.d.ts +62 -0
  37. package/dist/acp/registry.d.ts.map +1 -0
  38. package/dist/acp/registry.js +86 -0
  39. package/dist/acp/registry.js.map +1 -0
  40. package/dist/acp/transitions.d.ts +82 -0
  41. package/dist/acp/transitions.d.ts.map +1 -0
  42. package/dist/acp/transitions.js +106 -0
  43. package/dist/acp/transitions.js.map +1 -0
  44. package/dist/actors/index.d.ts +84 -0
  45. package/dist/actors/index.d.ts.map +1 -0
  46. package/dist/actors/index.js +133 -0
  47. package/dist/actors/index.js.map +1 -0
  48. package/dist/actors/track-record.d.ts +79 -0
  49. package/dist/actors/track-record.d.ts.map +1 -0
  50. package/dist/actors/track-record.js +105 -0
  51. package/dist/actors/track-record.js.map +1 -0
  52. package/dist/adapters/acp.d.ts +48 -0
  53. package/dist/adapters/acp.d.ts.map +1 -0
  54. package/dist/adapters/acp.js +74 -0
  55. package/dist/adapters/acp.js.map +1 -0
  56. package/dist/adapters/port.d.ts +53 -0
  57. package/dist/adapters/port.d.ts.map +1 -0
  58. package/dist/adapters/port.js +2 -0
  59. package/dist/adapters/port.js.map +1 -0
  60. package/dist/adapters/stamp.d.ts +57 -0
  61. package/dist/adapters/stamp.d.ts.map +1 -0
  62. package/dist/adapters/stamp.js +114 -0
  63. package/dist/adapters/stamp.js.map +1 -0
  64. package/dist/client/index.d.ts +123 -0
  65. package/dist/client/index.d.ts.map +1 -0
  66. package/dist/client/index.js +78 -0
  67. package/dist/client/index.js.map +1 -0
  68. package/dist/connect/attestation.d.ts +64 -0
  69. package/dist/connect/attestation.d.ts.map +1 -0
  70. package/dist/connect/attestation.js +62 -0
  71. package/dist/connect/attestation.js.map +1 -0
  72. package/dist/connect/http.d.ts +36 -0
  73. package/dist/connect/http.d.ts.map +1 -0
  74. package/dist/connect/http.js +51 -0
  75. package/dist/connect/http.js.map +1 -0
  76. package/dist/connect/logs.d.ts +53 -0
  77. package/dist/connect/logs.d.ts.map +1 -0
  78. package/dist/connect/logs.js +42 -0
  79. package/dist/connect/logs.js.map +1 -0
  80. package/dist/connect/result.d.ts +49 -0
  81. package/dist/connect/result.d.ts.map +1 -0
  82. package/dist/connect/result.js +41 -0
  83. package/dist/connect/result.js.map +1 -0
  84. package/dist/core/actors.d.ts +13 -0
  85. package/dist/core/actors.d.ts.map +1 -0
  86. package/dist/core/actors.js +57 -0
  87. package/dist/core/actors.js.map +1 -0
  88. package/dist/core/clock.d.ts +55 -0
  89. package/dist/core/clock.d.ts.map +1 -0
  90. package/dist/core/clock.js +36 -0
  91. package/dist/core/clock.js.map +1 -0
  92. package/dist/core/money.d.ts +32 -0
  93. package/dist/core/money.d.ts.map +1 -0
  94. package/dist/core/money.js +57 -0
  95. package/dist/core/money.js.map +1 -0
  96. package/dist/core/pool.d.ts +71 -0
  97. package/dist/core/pool.d.ts.map +1 -0
  98. package/dist/core/pool.js +98 -0
  99. package/dist/core/pool.js.map +1 -0
  100. package/dist/core/settle.d.ts +50 -0
  101. package/dist/core/settle.d.ts.map +1 -0
  102. package/dist/core/settle.js +175 -0
  103. package/dist/core/settle.js.map +1 -0
  104. package/dist/core/types.d.ts +109 -0
  105. package/dist/core/types.d.ts.map +1 -0
  106. package/dist/core/types.js +6 -0
  107. package/dist/core/types.js.map +1 -0
  108. package/dist/erc8004/index.d.ts +94 -0
  109. package/dist/erc8004/index.d.ts.map +1 -0
  110. package/dist/erc8004/index.js +118 -0
  111. package/dist/erc8004/index.js.map +1 -0
  112. package/dist/erc8004/registry.generated.d.ts +17 -0
  113. package/dist/erc8004/registry.generated.d.ts.map +1 -0
  114. package/dist/erc8004/registry.generated.js +20 -0
  115. package/dist/erc8004/registry.generated.js.map +1 -0
  116. package/dist/erc8183/index.d.ts +114 -0
  117. package/dist/erc8183/index.d.ts.map +1 -0
  118. package/dist/erc8183/index.js +109 -0
  119. package/dist/erc8183/index.js.map +1 -0
  120. package/dist/index.d.ts +81 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +73 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/judge/index.d.ts +64 -0
  125. package/dist/judge/index.d.ts.map +1 -0
  126. package/dist/judge/index.js +64 -0
  127. package/dist/judge/index.js.map +1 -0
  128. package/dist/launcher/index.d.ts +109 -0
  129. package/dist/launcher/index.d.ts.map +1 -0
  130. package/dist/launcher/index.js +144 -0
  131. package/dist/launcher/index.js.map +1 -0
  132. package/dist/negotiate/index.d.ts +166 -0
  133. package/dist/negotiate/index.d.ts.map +1 -0
  134. package/dist/negotiate/index.js +150 -0
  135. package/dist/negotiate/index.js.map +1 -0
  136. package/dist/onboard/index.d.ts +533 -0
  137. package/dist/onboard/index.d.ts.map +1 -0
  138. package/dist/onboard/index.js +509 -0
  139. package/dist/onboard/index.js.map +1 -0
  140. package/dist/onboarding/index.d.ts +177 -0
  141. package/dist/onboarding/index.d.ts.map +1 -0
  142. package/dist/onboarding/index.js +390 -0
  143. package/dist/onboarding/index.js.map +1 -0
  144. package/dist/pools/index.d.ts +191 -0
  145. package/dist/pools/index.d.ts.map +1 -0
  146. package/dist/pools/index.js +244 -0
  147. package/dist/pools/index.js.map +1 -0
  148. package/docs/demo.gif +0 -0
  149. package/docs/demo.tape +14 -0
  150. package/examples/01-settle-a-covered-job.mjs +18 -0
  151. package/examples/02-negotiate-a-hire.mjs +21 -0
  152. package/examples/03-end-to-end-offline.mjs +27 -0
  153. package/examples/10-grade-evidence.mjs +12 -0
  154. package/examples/11-grade-facts.mjs +10 -0
  155. package/examples/12-grade-answers.mjs +8 -0
  156. package/examples/13-grade-verdict.mjs +10 -0
  157. package/examples/14-grade-record.mjs +11 -0
  158. package/examples/15-grade-end-the-job.mjs +11 -0
  159. package/examples/16-grade-verify.mjs +9 -0
  160. package/examples/17-grade-live.mjs +14 -0
  161. package/examples/20-onboard-client.mjs +8 -0
  162. package/examples/21-onboard-provider.mjs +9 -0
  163. package/examples/22-onboard-evaluator.mjs +7 -0
  164. package/examples/23-onboard-backer.mjs +8 -0
  165. package/examples/30-read-a-real-job.mjs +19 -0
  166. package/examples/31-read-the-ending.mjs +15 -0
  167. package/examples/32-read-live-from-base.mjs +33 -0
  168. package/examples/33-read-many-jobs.mjs +12 -0
  169. package/examples/40-the-article.mjs +78 -0
  170. package/examples/README.md +93 -0
  171. package/examples/data/answers.mjs +8 -0
  172. package/examples/data/base-grade.recorded.json +72 -0
  173. package/examples/data/pilot-grade.recorded.json +78 -0
  174. package/examples/data/pilot-hire.json +35 -0
  175. package/examples/data/terms.mjs +11 -0
  176. package/examples/data/virtuals-job-74926.json +74 -0
  177. package/examples/data/virtuals-job-rejected.json +74 -0
  178. package/package.json +124 -0
  179. package/skills/moonbeam-acp-decoding/SKILL.md +80 -0
  180. package/skills/moonbeam-actor-backer/SKILL.md +81 -0
  181. package/skills/moonbeam-actor-challenger/SKILL.md +62 -0
  182. package/skills/moonbeam-actor-client/SKILL.md +67 -0
  183. package/skills/moonbeam-actor-doubter/SKILL.md +55 -0
  184. package/skills/moonbeam-actor-evaluator/SKILL.md +67 -0
  185. package/skills/moonbeam-actor-provider/SKILL.md +63 -0
  186. package/skills/moonbeam-assurance/SKILL.md +58 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * ERC-8004, Trustless Agents: the identity, reputation and validation
3
+ * registries.
4
+ *
5
+ * The job standard (ERC-8183) says what happened to a piece of work. It says
6
+ * nothing about who did it. That is this standard's job, across three separate
7
+ * registries, and a decoder that reads jobs without reading identity can tell
8
+ * you a job settled but not who settled it.
9
+ *
10
+ * Every topic0 below was re-derived from its signature rather than copied:
11
+ * `EVENT_SIGNATURES` is the source of truth, the tests hash each one and
12
+ * assert it matches, so a mistyped constant fails the build instead of
13
+ * silently never matching a live log.
14
+ *
15
+ * Deliberately address-agnostic, like the 8183 module. The canonical
16
+ * identity and reputation registries live at the same addresses on Base and
17
+ * Arc (no validation registry is recorded on either), but decoding keys on
18
+ * topic0 alone, so a fork or a redeployment reads the same. The addresses
19
+ * come from `registry.generated.ts`, which is generated from the address
20
+ * registry and never hand-edited.
21
+ *
22
+ * One caution this module encodes rather than hides: these registries are
23
+ * upgradeable and owned by a single EOA. Reading them is useful; treating them
24
+ * as ground truth is not, which is why nothing here returns a verdict.
25
+ */
26
+ import { ERC8004_CANONICAL, ERC8004_DEPLOYMENTS } from './registry.generated.js';
27
+ export { ERC8004_DEPLOYMENTS, ERC8004_CANONICAL } from './registry.generated.js';
28
+ /**
29
+ * Canonical deployments, identical on Base (8453) and Arc (5042). Only the
30
+ * registries actually deployed are present: there is no canonical validation
31
+ * registry, so `REGISTRY_ADDRESSES.validation` is undefined.
32
+ */
33
+ export const REGISTRY_ADDRESSES = ERC8004_CANONICAL;
34
+ /** The address of one registry on one chain, or undefined when none is recorded there. */
35
+ export function registryAddress(chainId, registry) {
36
+ return ERC8004_DEPLOYMENTS[chainId]?.[registry];
37
+ }
38
+ /**
39
+ * The event signatures, exactly as the contracts declare them. The topic
40
+ * hashes are derived from these strings; see the test that proves it.
41
+ */
42
+ export const EVENT_SIGNATURES = {
43
+ Registered: 'Registered(uint256,string,address)',
44
+ URIUpdated: 'URIUpdated(uint256,string,address)',
45
+ MetadataSet: 'MetadataSet(uint256,string,string,bytes)',
46
+ Transfer: 'Transfer(address,address,uint256)',
47
+ NewFeedback: 'NewFeedback(uint256,address,uint64,int128,uint8,string,string,string,string,string,bytes32)',
48
+ FeedbackRevoked: 'FeedbackRevoked(uint256,address,uint64)',
49
+ ResponseAppended: 'ResponseAppended(uint256,address,uint64,address,string,bytes32)',
50
+ ValidationRequest: 'ValidationRequest(address,uint256,string,bytes32)',
51
+ ValidationResponse: 'ValidationResponse(address,uint256,bytes32,uint8,string,bytes32,string)',
52
+ };
53
+ /** topic0 per event, keccak256 of the signature above. Verified in tests. */
54
+ export const EVENT_TOPICS = Object.freeze({
55
+ Registered: '0xca52e62c367d81bb2e328eb795f7c7ba24afb478408a26c0e201d155c449bc4a',
56
+ URIUpdated: '0x3a2c7fffc2cba7582c690e3b82c453ea02a308326a98a3ad7576c606336409fb',
57
+ MetadataSet: '0x2c149ed548c6d2993cd73efe187df6eccabe4538091b33adbd25fafdb8a1468b',
58
+ Transfer: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
59
+ NewFeedback: '0x6a4a61743519c9d648a14e6493f47dbe3ff1aa29e7785c96c8326a205e58febc',
60
+ FeedbackRevoked: '0x25156fd3288212246d8b008d5921fde376c71ed14ac2e072a506eb06fde6d09d',
61
+ ResponseAppended: '0xb1c6be0b5b8aef6539e2fac0fd131a2faa7b49edf8e505b5eb0ad487d56051d4',
62
+ ValidationRequest: '0x530436c3634a98e1e626b0898be2f1e9980cc1bd2a78c07a0aba52d0a48a5059',
63
+ ValidationResponse: '0xafddf629e874ccc3963b6a888c477bd464a6c8525024fc88759ea3b2326349ae',
64
+ });
65
+ /** Which registry emits each event. */
66
+ export const EVENT_REGISTRY = Object.freeze({
67
+ Registered: 'identity',
68
+ URIUpdated: 'identity',
69
+ MetadataSet: 'identity',
70
+ Transfer: 'identity',
71
+ NewFeedback: 'reputation',
72
+ FeedbackRevoked: 'reputation',
73
+ ResponseAppended: 'reputation',
74
+ ValidationRequest: 'validation',
75
+ ValidationResponse: 'validation',
76
+ });
77
+ /** Reverse lookup: what does this topic0 mean? Unknown topics return undefined. */
78
+ export function eventForTopic(topic0) {
79
+ const t = topic0.toLowerCase();
80
+ return Object.keys(EVENT_TOPICS).find((k) => EVENT_TOPICS[k].toLowerCase() === t);
81
+ }
82
+ /** Which registry a topic belongs to, or undefined if we do not read it. */
83
+ export function registryForTopic(topic0) {
84
+ const e = eventForTopic(topic0);
85
+ return e ? EVENT_REGISTRY[e] : undefined;
86
+ }
87
+ /** Every topic this module decodes, for an indexer's watch list. */
88
+ export function watchedTopics() {
89
+ return Object.freeze(Object.values(EVENT_TOPICS));
90
+ }
91
+ export function identityChangeOf(event) {
92
+ switch (event) {
93
+ case 'Registered': return 'minted';
94
+ case 'URIUpdated': return 'uri-changed';
95
+ case 'MetadataSet': return 'metadata-set';
96
+ case 'Transfer': return 'owner-changed';
97
+ default: return undefined;
98
+ }
99
+ }
100
+ /**
101
+ * Reputation, in the standard's own terms.
102
+ *
103
+ * Feedback here is signed by whoever left it and can be revoked by them. That
104
+ * makes it an assertion, not a verdict: useful as a signal, never as the basis
105
+ * for paying out a guarantee. `isRevocable` states which way each event cuts,
106
+ * so a caller cannot accidentally treat a retractable claim as settled fact.
107
+ */
108
+ export function isRevocable(event) {
109
+ return event === 'NewFeedback' || event === 'ResponseAppended';
110
+ }
111
+ export function validationStageOf(event) {
112
+ if (event === 'ValidationRequest')
113
+ return 'requested';
114
+ if (event === 'ValidationResponse')
115
+ return 'answered';
116
+ return undefined;
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/erc8004/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAKjF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuD,iBAAiB,CAAC;AAExG,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,QAAyB;IACxE,OAAO,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU,EAAE,oCAAoC;IAChD,UAAU,EAAE,oCAAoC;IAChD,WAAW,EAAE,0CAA0C;IACvD,QAAQ,EAAE,mCAAmC;IAC7C,WAAW,EACT,6FAA6F;IAC/F,eAAe,EAAE,yCAAyC;IAC1D,gBAAgB,EAAE,iEAAiE;IACnF,iBAAiB,EAAE,mDAAmD;IACtE,kBAAkB,EAAE,yEAAyE;CACrF,CAAC;AAIX,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAA2C,MAAM,CAAC,MAAM,CAAC;IAChF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U,gBAAgB,CAAC,KAAmB;IAClD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,YAAY,CAAC,CAAC,OAAO,QAAQ,CAAC;QACnC,KAAK,YAAY,CAAC,CAAC,OAAO,aAAa,CAAC;QACxC,KAAK,aAAa,CAAC,CAAC,OAAO,cAAc,CAAC;QAC1C,KAAK,UAAU,CAAC,CAAC,OAAO,eAAe,CAAC;QACxC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,OAAO,KAAK,KAAK,aAAa,IAAI,KAAK,KAAK,kBAAkB,CAAC;AACjE,CAAC;AAYD,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACnD,IAAI,KAAK,KAAK,mBAAmB;QAAE,OAAO,WAAW,CAAC;IACtD,IAAI,KAAK,KAAK,oBAAoB;QAAE,OAAO,UAAU,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Registry roles recorded per chain. A missing key means no deployment is recorded. */
2
+ export interface Erc8004ChainDeployment {
3
+ readonly name: string;
4
+ readonly status: 'live' | 'devnet-only' | string;
5
+ readonly identity?: string;
6
+ readonly reputation?: string;
7
+ readonly validation?: string;
8
+ }
9
+ /** Every ERC-8004 deployment the registry records, by chain id. */
10
+ export declare const ERC8004_DEPLOYMENTS: Readonly<Record<number, Erc8004ChainDeployment>>;
11
+ /** The canonical addresses, shared by every live chain above (Base 8453, Arc 5042). */
12
+ export declare const ERC8004_CANONICAL: Readonly<{
13
+ identity?: string;
14
+ reputation?: string;
15
+ validation?: string;
16
+ }>;
17
+ //# sourceMappingURL=registry.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.generated.d.ts","sourceRoot":"","sources":["../../src/erc8004/registry.generated.ts"],"names":[],"mappings":"AASA,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,CAAC;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,mEAAmE;AACnE,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAI/E,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAGtG,CAAC"}
@@ -0,0 +1,20 @@
1
+ /* GENERATED FILE, DO NOT EDIT BY HAND.
2
+ *
3
+ * Generated by scripts/gen-erc8004.mjs from an address registry
4
+ * (addresses.json), system `standards-erc8004`, registry version 1, updated 2026-09-28.
5
+ * To change an address, change the registry and re-run the generator.
6
+ *
7
+ * A registry the source does not record on a chain is absent here, never guessed.
8
+ */
9
+ /** Every ERC-8004 deployment the registry records, by chain id. */
10
+ export const ERC8004_DEPLOYMENTS = Object.freeze({
11
+ 5042: Object.freeze({ name: 'Arc', status: 'live', identity: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', reputation: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63' }),
12
+ 8453: Object.freeze({ name: 'Base', status: 'live', identity: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', reputation: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63' }),
13
+ 36927: Object.freeze({ name: 'Taifoon devnet', status: 'devnet-only', identity: '0xCCB18A50e8D29F9B73eAbFc7E38DEA5e03a3f061', reputation: '0x6E868D9af3689af28E9f80010b7f37787ea2a1b4' }),
14
+ });
15
+ /** The canonical addresses, shared by every live chain above (Base 8453, Arc 5042). */
16
+ export const ERC8004_CANONICAL = Object.freeze({
17
+ identity: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
18
+ reputation: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
19
+ });
20
+ //# sourceMappingURL=registry.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.generated.js","sourceRoot":"","sources":["../../src/erc8004/registry.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAqD,MAAM,CAAC,MAAM,CAAC;IACjG,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,4CAA4C,EAAE,UAAU,EAAE,4CAA4C,EAAE,CAAC;IACtK,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,4CAA4C,EAAE,UAAU,EAAE,4CAA4C,EAAE,CAAC;IACvK,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,4CAA4C,EAAE,UAAU,EAAE,4CAA4C,EAAE,CAAC;CAC1L,CAAC,CAAC;AAEH,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAA8E,MAAM,CAAC,MAAM,CAAC;IACxH,QAAQ,EAAE,4CAA4C;IACtD,UAAU,EAAE,4CAA4C;CACzD,CAAC,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * ERC-8183 (Agentic Commerce) — the standard this floor implements.
3
+ *
4
+ * The draft ERC defines a job with escrowed budget, six states
5
+ * (Open → Funded → Submitted → Completed | Rejected | Expired), three roles
6
+ * (client, provider, evaluator), and an optional hook interface (IACPHook)
7
+ * called before and after every core function. This module pins the
8
+ * standard's vocabulary so the rest of the SDK can speak it natively:
9
+ * event topics verified against live ledgers (the Base ACP ledger and the
10
+ * Arc testnet reference deployment emit these exact signatures), the state
11
+ * machine, and the mapping between the standard's states and this
12
+ * protocol's four endings.
13
+ *
14
+ * Where the standard ends and this protocol begins, in one sentence: 8183
15
+ * settles when the evaluator says so; here the deposit outweighs the job,
16
+ * the verdict is computed from evidence, and the premium pays the capital
17
+ * that stood behind the work — all designed to ride the standard's own
18
+ * hook, so a job on this floor is a standard job that happens to be
19
+ * guaranteed.
20
+ *
21
+ * Pure by construction, like the rest of the SDK: constants and total
22
+ * functions, no I/O.
23
+ */
24
+ export type Erc8183State = 'Open' | 'Funded' | 'Submitted' | 'Completed' | 'Rejected' | 'Expired';
25
+ export declare const TERMINAL_STATES: readonly Erc8183State[];
26
+ /** The transitions the draft allows, by role. Anything not listed reverts. */
27
+ export declare const TRANSITIONS: readonly {
28
+ readonly from: Erc8183State;
29
+ readonly to: Erc8183State;
30
+ readonly by: 'client' | 'provider' | 'evaluator' | 'anyone';
31
+ readonly call: string;
32
+ }[];
33
+ /**
34
+ * topic0 for each standard event, confirmed by a signature census over raw
35
+ * logs of the Base ACP ledger and the Arc testnet reference deployment
36
+ * (2026-09-07). If a ledger emits these, our decoder reads it unchanged.
37
+ */
38
+ export declare const EVENT_TOPICS: {
39
+ readonly JobCreated: "0xb0f0239bfdd96453e24733e18bfc24b70d8fadf123dd977473518dd577ee79b9";
40
+ readonly BudgetSet: "0x869e2577b006bf47ee981cf6fec2e25583548081c14b98deab587f77b5068038";
41
+ readonly JobFunded: "0xe3fbcc1ea1bdc559ec7f0347efde7655e58b5f45a30b0e4470a583c3ef5496b3";
42
+ readonly ProviderSet: "0x9a87df076ea1725aba8ba29d32517ce37c9597d88cbf16ec6707892cc330ab69";
43
+ readonly JobSubmitted: "0x80c17db79857f338a6a6df68a6883ecc0ce78e2202fe61ed979733573f40538e";
44
+ readonly JobCompleted: "0x0fd54bd364fa9e67f17b091aefe930932c09fe7651cf5ad02c71a418f3341444";
45
+ readonly JobRejected: "0xae7362b1af91f4492868987b9c73990d780060811551b58728fbe96fd1bab275";
46
+ readonly JobExpired: "0x97237956f8810192811e2c3f273fd02c5d6295206fdd9c62e6fe2bfc19ba9232";
47
+ readonly PaymentReleased: "0x21d71db5be59bb9fa133895586b7404307dd33fb93b16db09dc6f1d9d7d231b0";
48
+ readonly Refunded: "0x7ca5472b7ea78c2c0141c5a12ee6d170cf4ce8ed06be3d22c8252ddfc7a6a2c4";
49
+ readonly EvaluatorFeePaid: "0x253dd534010ac976fa263caa123bae79b9c50292adf7ce67bdc5ec309f784e61";
50
+ };
51
+ export type Erc8183Event = keyof typeof EVENT_TOPICS;
52
+ /** Reverse lookup: what does this topic0 mean? Unknown topics return undefined. */
53
+ export declare function eventForTopic(topic0: string): Erc8183Event | undefined;
54
+ /** Fold a lifecycle event into the state it evidences. Non-transition events return undefined. */
55
+ export declare function stateAfter(event: Erc8183Event): Erc8183State | undefined;
56
+ export type Ending = 'done-right' | 'bad-work' | 'void' | 'cheat';
57
+ /**
58
+ * Every ending of this floor lands in a standard terminal state; the
59
+ * assurance semantics (premium routing, deposit claims, computed verdicts)
60
+ * are the hook's business, never a new state. That is the whole
61
+ * compatibility claim, stated as a total function.
62
+ */
63
+ export declare function standardStateFor(ending: Ending): Erc8183State;
64
+ /**
65
+ * The standard settles a job when the evaluator attests; this floor can also
66
+ * settle by computed verdict through the hook. BOTH stay intact, by design:
67
+ *
68
+ * - ATTESTED: the vanilla ERC-8183 path. The evaluator (who may be the
69
+ * client itself) marks Completed or Rejected. No premium, no deposit
70
+ * requirement, no cover. This is how the coordination layer settles today,
71
+ * and jobs settled this way remain fully readable, decodable, and valid
72
+ * here forever.
73
+ * - ASSURED: the same lifecycle with the assurance hook attached: deposit
74
+ * outweighs the job, the buyer paid the premium, and completion/rejection
75
+ * is bound to a verdict recomputed from sealed evidence. The hook refuses
76
+ * settlements the evidence contradicts; it never invents new states.
77
+ *
78
+ * Nothing about ASSURED invalidates ATTESTED: an attested job and an
79
+ * assured job emit the same events and land in the same terminal states.
80
+ * The difference is what stands behind the ending, and receipts say which.
81
+ */
82
+ export type SettlementMode = 'ATTESTED' | 'ASSURED';
83
+ export interface SettlementShape {
84
+ /** Hook contract bound to the job, if any. */
85
+ readonly hook?: string;
86
+ /** Deposit locked by the provider, in job-money units. */
87
+ readonly deposit?: bigint;
88
+ /** Premium the client paid for cover, in job-money units. */
89
+ readonly premium?: bigint;
90
+ }
91
+ /** Refusals, in the SDK's usual register: named, not thrown strings. */
92
+ export type ModeRefusal = {
93
+ readonly ok: true;
94
+ readonly mode: SettlementMode;
95
+ } | {
96
+ readonly ok: false;
97
+ readonly code: 'ASSURED_WITHOUT_DEPOSIT' | 'ASSURED_WITHOUT_PREMIUM';
98
+ readonly reason: string;
99
+ };
100
+ /**
101
+ * Classify a job's settlement mode from its shape. A job with no hook is
102
+ * ATTESTED (the standard default, always valid). A job with a hook must
103
+ * carry both the deposit and the premium, or it is refused by name: an
104
+ * assurance hook without money behind it would be a costume, not cover.
105
+ */
106
+ export declare function settlementModeOf(shape: SettlementShape): ModeRefusal;
107
+ /**
108
+ * The standard's extension point: IACPHook, called before/after each core
109
+ * function. The assurance layer binds here. This constant names the
110
+ * functions the draft marks hookable, so the future hook implementation and
111
+ * its tests share one source of truth with the docs.
112
+ */
113
+ export declare const HOOKABLE_CALLS: readonly ["fund", "submit", "complete", "reject"];
114
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/erc8183/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,QAAQ,GACR,WAAW,GACX,WAAW,GACX,UAAU,GACV,SAAS,CAAC;AAEd,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY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AAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,GAAG,yBAAyB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1H;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CAOpE;AAID;;;;;GAKG;AACH,eAAO,MAAM,cAAc,mDAAoD,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * ERC-8183 (Agentic Commerce) — the standard this floor implements.
3
+ *
4
+ * The draft ERC defines a job with escrowed budget, six states
5
+ * (Open → Funded → Submitted → Completed | Rejected | Expired), three roles
6
+ * (client, provider, evaluator), and an optional hook interface (IACPHook)
7
+ * called before and after every core function. This module pins the
8
+ * standard's vocabulary so the rest of the SDK can speak it natively:
9
+ * event topics verified against live ledgers (the Base ACP ledger and the
10
+ * Arc testnet reference deployment emit these exact signatures), the state
11
+ * machine, and the mapping between the standard's states and this
12
+ * protocol's four endings.
13
+ *
14
+ * Where the standard ends and this protocol begins, in one sentence: 8183
15
+ * settles when the evaluator says so; here the deposit outweighs the job,
16
+ * the verdict is computed from evidence, and the premium pays the capital
17
+ * that stood behind the work — all designed to ride the standard's own
18
+ * hook, so a job on this floor is a standard job that happens to be
19
+ * guaranteed.
20
+ *
21
+ * Pure by construction, like the rest of the SDK: constants and total
22
+ * functions, no I/O.
23
+ */
24
+ export const TERMINAL_STATES = ['Completed', 'Rejected', 'Expired'];
25
+ /** The transitions the draft allows, by role. Anything not listed reverts. */
26
+ export const TRANSITIONS = [
27
+ { from: 'Open', to: 'Funded', by: 'client', call: 'fund' },
28
+ { from: 'Open', to: 'Rejected', by: 'client', call: 'reject' },
29
+ { from: 'Funded', to: 'Submitted', by: 'provider', call: 'submit' },
30
+ { from: 'Funded', to: 'Rejected', by: 'evaluator', call: 'reject' },
31
+ { from: 'Funded', to: 'Expired', by: 'anyone', call: 'expire (after expiredAt)' },
32
+ { from: 'Submitted', to: 'Completed', by: 'evaluator', call: 'complete' },
33
+ { from: 'Submitted', to: 'Rejected', by: 'evaluator', call: 'reject' },
34
+ { from: 'Submitted', to: 'Expired', by: 'anyone', call: 'expire (after expiredAt)' },
35
+ ];
36
+ /* ── Event topics, verified against live ledgers ────────────────────────── */
37
+ /**
38
+ * topic0 for each standard event, confirmed by a signature census over raw
39
+ * logs of the Base ACP ledger and the Arc testnet reference deployment
40
+ * (2026-09-07). If a ledger emits these, our decoder reads it unchanged.
41
+ */
42
+ export const EVENT_TOPICS = {
43
+ JobCreated: '0xb0f0239bfdd96453e24733e18bfc24b70d8fadf123dd977473518dd577ee79b9',
44
+ BudgetSet: '0x869e2577b006bf47ee981cf6fec2e25583548081c14b98deab587f77b5068038',
45
+ JobFunded: '0xe3fbcc1ea1bdc559ec7f0347efde7655e58b5f45a30b0e4470a583c3ef5496b3',
46
+ ProviderSet: '0x9a87df076ea1725aba8ba29d32517ce37c9597d88cbf16ec6707892cc330ab69',
47
+ JobSubmitted: '0x80c17db79857f338a6a6df68a6883ecc0ce78e2202fe61ed979733573f40538e',
48
+ JobCompleted: '0x0fd54bd364fa9e67f17b091aefe930932c09fe7651cf5ad02c71a418f3341444',
49
+ JobRejected: '0xae7362b1af91f4492868987b9c73990d780060811551b58728fbe96fd1bab275',
50
+ JobExpired: '0x97237956f8810192811e2c3f273fd02c5d6295206fdd9c62e6fe2bfc19ba9232',
51
+ PaymentReleased: '0x21d71db5be59bb9fa133895586b7404307dd33fb93b16db09dc6f1d9d7d231b0',
52
+ Refunded: '0x7ca5472b7ea78c2c0141c5a12ee6d170cf4ce8ed06be3d22c8252ddfc7a6a2c4',
53
+ EvaluatorFeePaid: '0x253dd534010ac976fa263caa123bae79b9c50292adf7ce67bdc5ec309f784e61',
54
+ };
55
+ /** Reverse lookup: what does this topic0 mean? Unknown topics return undefined. */
56
+ export function eventForTopic(topic0) {
57
+ const t = topic0.toLowerCase();
58
+ return Object.keys(EVENT_TOPICS).find((k) => EVENT_TOPICS[k].toLowerCase() === t);
59
+ }
60
+ /** Fold a lifecycle event into the state it evidences. Non-transition events return undefined. */
61
+ export function stateAfter(event) {
62
+ switch (event) {
63
+ case 'JobCreated': return 'Open';
64
+ case 'JobFunded': return 'Funded';
65
+ case 'JobSubmitted': return 'Submitted';
66
+ case 'JobCompleted': return 'Completed';
67
+ case 'JobRejected': return 'Rejected';
68
+ case 'JobExpired': return 'Expired';
69
+ default: return undefined;
70
+ }
71
+ }
72
+ /**
73
+ * Every ending of this floor lands in a standard terminal state; the
74
+ * assurance semantics (premium routing, deposit claims, computed verdicts)
75
+ * are the hook's business, never a new state. That is the whole
76
+ * compatibility claim, stated as a total function.
77
+ */
78
+ export function standardStateFor(ending) {
79
+ switch (ending) {
80
+ case 'done-right': return 'Completed';
81
+ case 'bad-work': return 'Rejected';
82
+ case 'void': return 'Expired';
83
+ case 'cheat': return 'Rejected'; // + deposit claim via the hook
84
+ }
85
+ }
86
+ /**
87
+ * Classify a job's settlement mode from its shape. A job with no hook is
88
+ * ATTESTED (the standard default, always valid). A job with a hook must
89
+ * carry both the deposit and the premium, or it is refused by name: an
90
+ * assurance hook without money behind it would be a costume, not cover.
91
+ */
92
+ export function settlementModeOf(shape) {
93
+ if (!shape.hook)
94
+ return { ok: true, mode: 'ATTESTED' };
95
+ if (!shape.deposit || shape.deposit <= 0n)
96
+ return { ok: false, code: 'ASSURED_WITHOUT_DEPOSIT', reason: 'a hook-bound job must lock a provider deposit' };
97
+ if (!shape.premium || shape.premium <= 0n)
98
+ return { ok: false, code: 'ASSURED_WITHOUT_PREMIUM', reason: 'a hook-bound job must carry the buyer-paid premium' };
99
+ return { ok: true, mode: 'ASSURED' };
100
+ }
101
+ /* ── The hook seam ──────────────────────────────────────────────────────── */
102
+ /**
103
+ * The standard's extension point: IACPHook, called before/after each core
104
+ * function. The assurance layer binds here. This constant names the
105
+ * functions the draft marks hookable, so the future hook implementation and
106
+ * its tests share one source of truth with the docs.
107
+ */
108
+ export const HO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QACtC,KAAK,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC;QACnC,KAAK,MAAM,CAAC,CAAC,OAAO,SAAS,CAAC;QAC9B,KAAK,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,+BAA+B;IAClE,CAAC;AACH,CAAC;AAsCD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,+CAA+C,EAAE,CAAC;IACjH,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC;IACtH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC;AAED,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @moonbeam-foundation/sdk
3
+ *
4
+ * Assurance for agent work. Wrap a job in a price, a judge and a deadline, and
5
+ * settle it against proof rather than against a status report.
6
+ *
7
+ * The core is pure: `settle()` takes terms and a verdict and returns every
8
+ * actor's net position. No clock, no chain, no I/O — so the economic
9
+ * invariants (value is conserved, cheating pays the victim, doubt is capped by
10
+ * bonded capital) are properties you can test rather than claims you have to
11
+ * trust.
12
+ *
13
+ * Nothing here is an offer or a promise of yield, and every figure in the
14
+ * docs and tests is illustrative.
15
+ */
16
+ export { parseUnits, formatUnits, applyBps, min, clampToZero, sum, USDC_DECIMALS, ZERO, } from './core/money.js';
17
+ export type { Money, Bps } from './core/money.js';
18
+ export type { Role, Participant, Obligation, ActorSpec, JobTerms, Verdict, DoubtPosition, ChallengePosition, SettlementInput, Ledger, Settlement, } from './core/types.js';
19
+ /**
20
+ * `Participant` names everyone who can act on a job; `Role` names only those
21
+ * who hold a position in the settlement ledger. The arbitrator is the
22
+ * difference: it resolves states nobody else can but takes no share of escrow.
23
+ * These are exported because `recourseFor`, `waitingOn` and `Recourse.blockedOn`
24
+ * all speak `Participant` — a caller could not previously name the type of an
25
+ * argument they were required to pass.
26
+ */
27
+ export { ARBITRATOR, holdsPosition } from './core/types.js';
28
+ export { settle, lockedValue, maxDoubtPayout, poolLossPerFailure, ledgerTotal, conservesValue, } from './core/settle.js';
29
+ export { ACTORS, actorsBy } from './core/actors.js';
30
+ export { runSeason, breakEvenFailureRate, impliedFailureRate, clearingFeeIsCoherent, } from './core/pool.js';
31
+ export type { SeasonInput, SeasonResult } from './core/pool.js';
32
+ export { localClock, chainClock, attestedClock, isFresh, expiryOf } from './core/clock.js';
33
+ export type { Clock, ClockSource, Seconds, FinalityAttestation, Expiry } from './core/clock.js';
34
+ export { decodeAcpLog, decodeAcpLogs, attributeDispute, ACP_TOPIC0, ACP_SIGNATURES, VIRTUALS_ACP_ADDRESS, VIRTUALS_ACP_CHAIN_ID, } from './acp/events.js';
35
+ export type { RawLog, AcpEvent, CloseReason } from './acp/events.js';
36
+ export { foldTask, foldTasks, groupByJob, findSelfGraded, independentShare, phaseOf } from './acp/lifecycle.js';
37
+ export type { TaskState, EscrowStatus, WorkStatus, VerificationClass } from './acp/lifecycle.js';
38
+ export { ESCROW_RANK, WORK_RANK, ESCROW_TERMINALS, WORK_TERMINALS, isEscrowTerminal, isWorkTerminal, escrowConflicts, workConflicts, resolveEscrow, resolveWork, resolveGrade, } from './acp/transitions.js';
39
+ export type { Phase, Resolution } from './acp/transitions.js';
40
+ export { toOutcome, isSettled } from './acp/outcome.js';
41
+ export type { AcpOutcome, SettledOutcome, PendingOutcome, OutcomeBasis, PendingReason } from './acp/outcome.js';
42
+ export { availableActions, recourseFor, livenessOf, waitingOn, isParty } from './acp/recourse.js';
43
+ export type { Action, ActionId, Recourse, LivenessReport } from './acp/recourse.js';
44
+ export { measureCoverage, assertFullCoverage } from './acp/coverage.js';
45
+ export type { CoverageReport } from './acp/coverage.js';
46
+ export { WATCHED_EVENTS, LEDGERS, watchedTopics, terminalTopics, watchManifest } from './acp/registry.js';
47
+ export type { WatchedEvent, LedgerId, LedgerSpec } from './acp/registry.js';
48
+ export { prepareSettlement } from './acp/pipeline.js';
49
+ export type { Prepared, PrepareOptions } from './acp/pipeline.js';
50
+ export { sameAddress, ZERO_ADDRESS } from './acp/hex.js';
51
+ export type { Hex, Address, Hex32 } from './acp/hex.js';
52
+ export { positionUnder, positionsByVerdict, worstCase, bestCase, coverGap, recoveryFor, capitalRequired, canAccept, proofRequiredFor, bondAtRisk, poolExposure, solventUnder, doubtQuote, sizeWithinCap, challengeQuote, worthChallenging, } from './actors/index.js';
53
+ export type { Decision, Exposure, DoubtQuote, ChallengeQuote } from './actors/index.js';
54
+ export { trackRecordFor, trackRecords, concentrationOf, MIN_JOBS_FOR_A_RECORD, DOMINANCE_THRESHOLD, WILSON_Z, wilsonScore, } from './actors/track-record.js';
55
+ export type { TrackRecord, ConcentrationReport } from './actors/track-record.js';
56
+ export { ok, err, valueOr, meansAbsent, describeError } from './connect/result.js';
57
+ export type { Result, LookupError } from './connect/result.js';
58
+ export { verifyAttestation, isSignedByTrusted, clockFromAttestation, parseAttestation, } from './connect/attestation.js';
59
+ export type { Ecrecover, AttestationSource, Verification } from './connect/attestation.js';
60
+ export { createAttestationSource, createProofSource, formatEventRef } from './connect/http.js';
61
+ export type { Fetch, HttpSourceOptions, EventRef, ProofSource } from './connect/http.js';
62
+ export { splitRange, fetchLogRange, MAX_BLOCK_SPAN } from './connect/logs.js';
63
+ export type { LogQuery, LogSource, FetchLogsOptions } from './connect/logs.js';
64
+ export { createAssuranceClient, assertSupportedChain, asProofBlob, UnsupportedChainError, SELECTOR, SUPPORTED_CHAIN_IDS, } from './client/index.js';
65
+ export type { CallRequest, ChainConfig, AssuranceClient, EscrowCalls, EvaluatorCalls, ProofBlob, } from './client/index.js';
66
+ export { readinessForClient, readinessForProvider, readinessForEvaluator, readinessForBacker, readinessForDoubter, readinessForChallenger, blockers, summarise, OBSERVED_NON_DELIVERY_RANGE, OBSERVED_REJECTION_RANGE, OBSERVED_PROVIDER_CONCENTRATION, } from './onboarding/index.js';
67
+ export type { Severity, Finding, Readiness, ClientIntent, ProviderIntent, EvaluatorIntent, BackerIntent, DoubterIntent, ChallengerIntent, } from './onboarding/index.js';
68
+ export { open, bid, checkBid, accept, bestBid, expire, coverSplit, lockedByBuyer, } from './negotiate/index.js';
69
+ export type { Intent, Bid, CoverQuote, Negotiation, NegotiationPhase, Refusal, RefusalCode, } from './negotiate/index.js';
70
+ export type { AssuranceAdapter, CoveragePolicy } from './adapters/port.js';
71
+ export { acpAdapter, isInsurable, DEFAULT_ACP_POLICY, } from './adapters/acp.js';
72
+ export type { AcpJob, AcpEvaluation, AcpPhase } from './adapters/acp.js';
73
+ export * as erc8183 from './erc8183/index.js';
74
+ export * as erc8004 from './erc8004/index.js';
75
+ export { STAMP_VERDICTS, STAMP_VERDICT_CODE, STAMP_MODE, GRADE_STAMP_REGISTRY, ERC8004_REPUTATION_REGISTRY, canonicalGrade, gradeDigest, subjectOf, encodeStamp, encodeErc8004Feedback, verifyStamp, } from './adapters/stamp.js';
76
+ export type { Grade, StampVerdict, StampMode, UnsignedCall } from './adapters/stamp.js';
77
+ export { PHASES, LAUNCH_ROLES, PHASE_MEANING, ROLE_STEPS, launchFor, ENDINGS, endingFromTrail, compare, GRADE_BAR, ENDING_EFFECT, caseFor, summarise as summariseCases, } from './launcher/index.js';
78
+ export type { Phase as LaunchPhase, LaunchRole, LaunchIntent, LaunchPlan, TrailEvent, Ending as TrailEnding, Decision as TrailDecision, GradeAnswer, Comparison, CaseKind, LaunchCase } from './launcher/index.js';
79
+ export { BASE_JOB_CONTRACT, BASE_USDC, BASE_ASSURANCE_HOOK, BASE_POOL_FACTORY, ERC8004_IDENTITY_REGISTRY, JEV_OPTIONS, DEFAULT_GUARD, DEPOSIT_FACTOR, JEV_BAR, QUOTA_FREE, QUOTA_BURST_PER_MINUTE, QUOTA_BLOCK, RECORD_MIN_N, RECORD_MAX_WIDTH, depositFor, checkDeposit, wilson, isCalibrated, admit, blocksFor, priceOfBlocks, attestationState, decisionEnding, endingOf as onboardEndingOf, ENDING_MONEY, hireable, fundCalls, submitCalls, settleCalls, jobIdOf, correlatorOf, keccak256, keccakHex, selector, SIGNATURES, discover, attest, quote, judge, record, assess, OnboardError, } from './onboard/index.js';
80
+ export type { BaseAgentCandidate, Attestation, HireTerms, UnsignedCall as OnboardUnsignedCall, Delivery, JevGuard, JevDecision, JevOption, Ending as OnboardEnding, Settlement as OnboardSettlement, SellerRecord, Hireable, OnboardTransport, QuotaStanding, } from './onboard/index.js';
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,GAAG,EACH,WAAW,EACX,GAAG,EACH,aAAa,EACb,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAElD,YAAY,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH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,UAAU,EAAE,UAAU,EAAE,MAAM,IAAI,WAAW,EAAE,QAAQ,IAAI,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKnN,OAAO,EACL,iBAAiB,EAAE,SAAS,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,yBAAyB,EAC/F,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EACpI,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,IAAI,eAAe,EAAE,YAAY,EAC5J,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAChH,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAC7D,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,IAAI,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,IAAI,aAAa,EAAE,UAAU,IAAI,iBAAiB,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,GAC/O,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @moonbeam-foundation/sdk
3
+ *
4
+ * Assurance for agent work. Wrap a job in a price, a judge and a deadline, and
5
+ * settle it against proof rather than against a status report.
6
+ *
7
+ * The core is pure: `settle()` takes terms and a verdict and returns every
8
+ * actor's net position. No clock, no chain, no I/O — so the economic
9
+ * invariants (value is conserved, cheating pays the victim, doubt is capped by
10
+ * bonded capital) are properties you can test rather than claims you have to
11
+ * trust.
12
+ *
13
+ * Nothing here is an offer or a promise of yield, and every figure in the
14
+ * docs and tests is illustrative.
15
+ */
16
+ export { parseUnits, formatUnits, applyBps, min, clampToZero, sum, USDC_DECIMALS, ZERO, } from './core/money.js';
17
+ /**
18
+ * `Participant` names everyone who can act on a job; `Role` names only those
19
+ * who hold a position in the settlement ledger. The arbitrator is the
20
+ * difference: it resolves states nobody else can but takes no share of escrow.
21
+ * These are exported because `recourseFor`, `waitingOn` and `Recourse.blockedOn`
22
+ * all speak `Participant` — a caller could not previously name the type of an
23
+ * argument they were required to pass.
24
+ */
25
+ export { ARBITRATOR, holdsPosition } from './core/types.js';
26
+ export { settle, lockedValue, maxDoubtPayout, poolLossPerFailure, ledgerTotal, conservesValue, } from './core/settle.js';
27
+ export { ACTORS, actorsBy } from './core/actors.js';
28
+ export { runSeason, breakEvenFailureRate, impliedFailureRate, clearingFeeIsCoherent, } from './core/pool.js';
29
+ export { localClock, chainClock, attestedClock, isFresh, expiryOf } from './core/clock.js';
30
+ // ── ACP decoding and the job state machine ──
31
+ export { decodeAcpLog, decodeAcpLogs, attributeDispute, ACP_TOPIC0, ACP_SIGNATURES, VIRTUALS_ACP_ADDRESS, VIRTUALS_ACP_CHAIN_ID, } from './acp/events.js';
32
+ export { foldTask, foldTasks, groupByJob, findSelfGraded, independentShare, phaseOf } from './acp/lifecycle.js';
33
+ // ── The transition table: what may follow what, and what may coexist ──
34
+ export { ESCROW_RANK, WORK_RANK, ESCROW_TERMINALS, WORK_TERMINALS, isEscrowTerminal, isWorkTerminal, escrowConflicts, workConflicts, resolveEscrow, resolveWork, resolveGrade, } from './acp/transitions.js';
35
+ export { toOutcome, isSettled } from './acp/outcome.js';
36
+ export { availableActions, recourseFor, livenessOf, waitingOn, isParty } from './acp/recourse.js';
37
+ // ── Decode coverage: proof that nothing in live traffic is being missed ──
38
+ export { measureCoverage, assertFullCoverage } from './acp/coverage.js';
39
+ // ── The watch list, for a proof layer indexing the same events ──
40
+ export { WATCHED_EVENTS, LEDGERS, watchedTopics, terminalTopics, watchManifest } from './acp/registry.js';
41
+ export { prepareSettlement } from './acp/pipeline.js';
42
+ export { sameAddress, ZERO_ADDRESS } from './acp/hex.js';
43
+ // ── Per-actor arithmetic ──
44
+ export { positionUnder, positionsByVerdict, worstCase, bestCase, coverGap, recoveryFor, capitalRequired, canAccept, proofRequiredFor, bondAtRisk, poolExposure, solventUnder, doubtQuote, sizeWithinCap, challengeQuote, worthChallenging, } from './actors/index.js';
45
+ // ── Per-worker records: the unit that actually carries information ──
46
+ export { trackRecordFor, trackRecords, concentrationOf, MIN_JOBS_FOR_A_RECORD, DOMINANCE_THRESHOLD, WILSON_Z, wilsonScore, } from './actors/track-record.js';
47
+ // ── Connectors: IO at the edge, injectable, never inside settlement ──
48
+ export { ok, err, valueOr, meansAbsent, describeError } from './connect/result.js';
49
+ export { verifyAttestation, isSignedByTrusted, clockFromAttestation, parseAttestation, } from './connect/attestation.js';
50
+ export { createAttestationSource, createProofSource, formatEventRef } from './connect/http.js';
51
+ export { splitRange, fetchLogRange, MAX_BLOCK_SPAN } from './connect/logs.js';
52
+ // ── Transaction building: builds calls, never signs or sends ──
53
+ export { createAssuranceClient, assertSupportedChain, asProofBlob, UnsupportedChainError, SELECTOR, SUPPORTED_CHAIN_IDS, } from './client/index.js';
54
+ // ── Safe onboarding: the checks that run before capital is committed ──
55
+ export { readinessForClient, readinessForProvider, readinessForEvaluator, readinessForBacker, readinessForDoubter, readinessForChallenger, blockers, summarise, OBSERVED_NON_DELIVERY_RANGE, OBSERVED_REJECTION_RANGE, OBSERVED_PROVIDER_CONCENTRATION, } from './onboarding/index.js';
56
+ // ── Negotiation: how terms are reached before settlement prices them ──
57
+ export { open, bid, checkBid, accept, bestBid, expire, coverSplit, lockedByBuyer, } from './negotiate/index.js';
58
+ export { acpAdapter, isInsurable, DEFAULT_ACP_POLICY, } from './adapters/acp.js';
59
+ export * as erc8183 from './erc8183/index.js';
60
+ // ── ERC-8004: who the parties are ──────────────────────────────────────────
61
+ // The job standard says what happened; this one says who did it. Identity,
62
+ // reputation and validation registries, decoded from their own topic hashes.
63
+ export * as erc8004 from './erc8004/index.js';
64
+ // A grade, stamped on chain, that anyone recomputes: the GradeStampRegistry (immutable, append-only)
65
+ // and ERC-8004 reputation feedback. Pure encoders; nothing here signs.
66
+ export { STAMP_VERDICTS, STAMP_VERDICT_CODE, STAMP_MODE, GRADE_STAMP_REGISTRY, ERC8004_REPUTATION_REGISTRY, canonicalGrade, gradeDigest, subjectOf, encodeStamp, encodeErc8004Feedback, verifyStamp, } from './adapters/stamp.js';
67
+ // ── The launcher: one insured job, phase by phase, for every party ──
68
+ export { PHASES, LAUNCH_ROLES, PHASE_MEANING, ROLE_STEPS, launchFor, ENDINGS, endingFromTrail, compare, GRADE_BAR, ENDING_EFFECT, caseFor, summarise as summariseCases, } from './launcher/index.js';
69
+ // ── Onboard: how a Base agent becomes hireable, with the judge standing guard ──
70
+ // The full module is at './onboard'; the root re-exports the shapes and the pure rules only,
71
+ // so a consumer that never fetches pays for nothing it does not use.
72
+ export { BASE_JOB_CONTRACT, BASE_USDC, BASE_ASSURANCE_HOOK, BASE_POOL_FACTORY, ERC8004_IDENTITY_REGISTRY, JEV_OPTIONS, DEFAULT_GUARD, DEPOSIT_FACTOR, JEV_BAR, QUOTA_FREE, QUOTA_BURST_PER_MINUTE, QUOTA_BLOCK, RECORD_MIN_N, RECORD_MAX_WIDTH, depositFor, checkDeposit, wilson, isCalibrated, admit, blocksFor, priceOfBlocks, attestationState, decisionEnding, endingOf as onboardEndingOf, ENDING_MONEY, hireable, fundCalls, submitCalls, settleCalls, jobIdOf, correlatorOf, keccak256, keccakHex, selector, SIGNATURES, discover, attest, quote, judge, record, assess, OnboardError, } from './onboard/index.js';
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names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