@moonbeam-foundation/sdk 0.5.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +313 -39
  2. package/bin/moonbeam.mjs +15 -2
  3. package/dist/abi/index.d.ts +55 -0
  4. package/dist/abi/index.d.ts.map +1 -0
  5. package/dist/abi/index.js +227 -0
  6. package/dist/abi/index.js.map +1 -0
  7. package/dist/acp/events.d.ts +38 -38
  8. package/dist/acp/events.d.ts.map +1 -1
  9. package/dist/acp/events.js.map +1 -1
  10. package/dist/acp/moonbeam-acp.generated.d.ts +55 -0
  11. package/dist/acp/moonbeam-acp.generated.d.ts.map +1 -0
  12. package/dist/acp/moonbeam-acp.generated.js +59 -0
  13. package/dist/acp/moonbeam-acp.generated.js.map +1 -0
  14. package/dist/acp/outcome.d.ts +5 -1
  15. package/dist/acp/outcome.d.ts.map +1 -1
  16. package/dist/acp/outcome.js +3 -2
  17. package/dist/acp/outcome.js.map +1 -1
  18. package/dist/acp/pipeline.js.map +1 -1
  19. package/dist/acp/registry.d.ts.map +1 -1
  20. package/dist/acp/registry.js +5 -3
  21. package/dist/acp/registry.js.map +1 -1
  22. package/dist/actors/track-record.js.map +1 -1
  23. package/dist/adapters/acp.js.map +1 -1
  24. package/dist/adapters/stamp.d.ts +2 -2
  25. package/dist/adapters/stamp.d.ts.map +1 -1
  26. package/dist/adapters/stamp.js +6 -6
  27. package/dist/adapters/stamp.js.map +1 -1
  28. package/dist/arbitration/index.d.ts +120 -0
  29. package/dist/arbitration/index.d.ts.map +1 -0
  30. package/dist/arbitration/index.js +116 -0
  31. package/dist/arbitration/index.js.map +1 -0
  32. package/dist/assurance/assurance-shared.d.ts +1924 -0
  33. package/dist/assurance/assurance-shared.d.ts.map +1 -0
  34. package/dist/assurance/assurance-shared.js +2227 -0
  35. package/dist/assurance/assurance-shared.js.map +1 -0
  36. package/dist/assurance/index.d.ts +57 -0
  37. package/dist/assurance/index.d.ts.map +1 -0
  38. package/dist/assurance/index.js +49 -0
  39. package/dist/assurance/index.js.map +1 -0
  40. package/dist/attest/index.d.ts +19 -0
  41. package/dist/attest/index.d.ts.map +1 -0
  42. package/dist/attest/index.js +17 -0
  43. package/dist/attest/index.js.map +1 -0
  44. package/dist/client/index.d.ts +16 -6
  45. package/dist/client/index.d.ts.map +1 -1
  46. package/dist/client/index.js +21 -1
  47. package/dist/client/index.js.map +1 -1
  48. package/dist/connect/logs.js.map +1 -1
  49. package/dist/core/money.js.map +1 -1
  50. package/dist/core/settle.js.map +1 -1
  51. package/dist/core/types.d.ts +1 -1
  52. package/dist/cover/index.d.ts +65 -0
  53. package/dist/cover/index.d.ts.map +1 -0
  54. package/dist/cover/index.js +61 -0
  55. package/dist/cover/index.js.map +1 -0
  56. package/dist/devnet/edge.d.ts +207 -0
  57. package/dist/devnet/edge.d.ts.map +1 -0
  58. package/dist/devnet/edge.js +209 -0
  59. package/dist/devnet/edge.js.map +1 -0
  60. package/dist/devnet/index.d.ts +403 -0
  61. package/dist/devnet/index.d.ts.map +1 -0
  62. package/dist/devnet/index.js +420 -0
  63. package/dist/devnet/index.js.map +1 -0
  64. package/dist/devnet/profile.d.ts +110 -0
  65. package/dist/devnet/profile.d.ts.map +1 -0
  66. package/dist/devnet/profile.js +145 -0
  67. package/dist/devnet/profile.js.map +1 -0
  68. package/dist/erc8004/index.d.ts +9 -9
  69. package/dist/erc8004/index.d.ts.map +1 -1
  70. package/dist/erc8004/index.js.map +1 -1
  71. package/dist/erc8004/registry.generated.d.ts.map +1 -1
  72. package/dist/erc8004/registry.generated.js +0 -1
  73. package/dist/erc8004/registry.generated.js.map +1 -1
  74. package/dist/erc8183/index.d.ts +12 -12
  75. package/dist/erc8183/index.d.ts.map +1 -1
  76. package/dist/erc8183/index.js.map +1 -1
  77. package/dist/errors/index.d.ts +51 -0
  78. package/dist/errors/index.d.ts.map +1 -0
  79. package/dist/errors/index.js +63 -0
  80. package/dist/errors/index.js.map +1 -0
  81. package/dist/index.d.ts +12 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +13 -0
  84. package/dist/index.js.map +1 -1
  85. package/dist/jobs/index.d.ts +62 -0
  86. package/dist/jobs/index.d.ts.map +1 -0
  87. package/dist/jobs/index.js +59 -0
  88. package/dist/jobs/index.js.map +1 -0
  89. package/dist/judge/index.d.ts +144 -4
  90. package/dist/judge/index.d.ts.map +1 -1
  91. package/dist/judge/index.js +138 -5
  92. package/dist/judge/index.js.map +1 -1
  93. package/dist/launcher/index.d.ts +3 -3
  94. package/dist/launcher/index.d.ts.map +1 -1
  95. package/dist/market/index.d.ts +162 -0
  96. package/dist/market/index.d.ts.map +1 -0
  97. package/dist/market/index.js +137 -0
  98. package/dist/market/index.js.map +1 -0
  99. package/dist/onboard/index.d.ts +66 -26
  100. package/dist/onboard/index.d.ts.map +1 -1
  101. package/dist/onboard/index.js +98 -29
  102. package/dist/onboard/index.js.map +1 -1
  103. package/dist/pools/index.d.ts +77 -11
  104. package/dist/pools/index.d.ts.map +1 -1
  105. package/dist/pools/index.js +58 -15
  106. package/dist/pools/index.js.map +1 -1
  107. package/dist/proof/index.d.ts +121 -0
  108. package/dist/proof/index.d.ts.map +1 -0
  109. package/dist/proof/index.js +84 -0
  110. package/dist/proof/index.js.map +1 -0
  111. package/dist/resale/index.d.ts +136 -0
  112. package/dist/resale/index.d.ts.map +1 -0
  113. package/dist/resale/index.js +131 -0
  114. package/dist/resale/index.js.map +1 -0
  115. package/dist/resale/payment-scheme.d.mts +46 -0
  116. package/dist/resale/payment-scheme.mjs +351 -0
  117. package/dist/resale/payment-scheme.pin.json +6 -0
  118. package/dist/resale/settle-rule.d.ts +49 -0
  119. package/dist/resale/settle-rule.d.ts.map +1 -0
  120. package/dist/resale/settle-rule.js +53 -0
  121. package/dist/resale/settle-rule.js.map +1 -0
  122. package/dist/rpc/index.d.ts +24 -0
  123. package/dist/rpc/index.d.ts.map +1 -0
  124. package/dist/rpc/index.js +66 -0
  125. package/dist/rpc/index.js.map +1 -0
  126. package/dist/workflows/data.d.ts +3 -0
  127. package/dist/workflows/data.d.ts.map +1 -0
  128. package/dist/workflows/data.js +829 -0
  129. package/dist/workflows/data.js.map +1 -0
  130. package/dist/workflows/index.d.ts +31 -0
  131. package/dist/workflows/index.d.ts.map +1 -0
  132. package/dist/workflows/index.js +104 -0
  133. package/dist/workflows/index.js.map +1 -0
  134. package/dist/workflows/types.d.ts +26 -0
  135. package/dist/workflows/types.d.ts.map +1 -0
  136. package/dist/workflows/types.js +2 -0
  137. package/dist/workflows/types.js.map +1 -0
  138. package/dist/x402/index.d.ts +153 -0
  139. package/dist/x402/index.d.ts.map +1 -0
  140. package/dist/x402/index.js +143 -0
  141. package/dist/x402/index.js.map +1 -0
  142. package/docs/workflows/hire-from-chat.png +0 -0
  143. package/docs/workflows/list-business.png +0 -0
  144. package/docs/workflows/onboard-batch.png +0 -0
  145. package/docs/workflows/onboard.png +0 -0
  146. package/docs/workflows/publish.png +0 -0
  147. package/docs/workflows/resell.png +0 -0
  148. package/docs/workflows/sell-edge.png +0 -0
  149. package/examples/03-end-to-end-offline.mjs +2 -2
  150. package/examples/14-grade-record.mjs +6 -4
  151. package/examples/17-grade-live.mjs +1 -1
  152. package/examples/20-onboard-client.mjs +2 -2
  153. package/examples/24-resell-on-base.mjs +17 -0
  154. package/examples/{30-read-a-real-job.mjs → 30-read-a-job.mjs} +2 -2
  155. package/examples/32-read-live-from-base.mjs +8 -11
  156. package/examples/40-the-article.mjs +2 -2
  157. package/examples/50-x402-pay-a-wall.mjs +28 -0
  158. package/examples/51-read-a-proof.mjs +22 -0
  159. package/examples/52-arbitration-calls.mjs +13 -0
  160. package/examples/53-attested-by-default.mjs +19 -0
  161. package/examples/README.md +16 -7
  162. package/examples/data/proof-base-tx-52587000.json +116 -0
  163. package/examples/data/x402-wall-402.json +85 -0
  164. package/package.json +101 -20
  165. package/skills/moonbeam-actor-backer/SKILL.md +1 -1
  166. package/skills/moonbeam-actor-challenger/SKILL.md +1 -1
  167. package/skills/moonbeam-actor-doubter/SKILL.md +1 -1
  168. package/skills/moonbeam-assurance/SKILL.md +1 -1
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Where a seller's leg settles: the layer's rule SETTLE_ON_SELLER_VENUE_v1, and its resolver, held to the rule's own vectors
3
+ * (test/fixtures/settle-rule.vectors.json).
4
+ *
5
+ * The buyer's payment is confirmed wherever it was made. A seller's leg is paid on the network, token and payTo of the offer
6
+ * it delivered on, in this order: (1) its x402 `accepts` entry for the class it delivered; (2) its venue's rail, the one chain
7
+ * of the venue it was hired on, to the payTo it registered; (3) a seller with no paid rail of its own (a free tool or agent
8
+ * admitted as a paid seller): Base USDC to the payTo it registered. A network the seller did not publish is never chosen for
9
+ * it: a rail the layer holds no pay token on is Held (network_not_served), another asset is Held (token_not_served), and no
10
+ * payTo is Held (no_payee). Nothing is bridged or swapped. Pure.
11
+ */
12
+ export declare const SETTLE_RULE: 'SETTLE_ON_SELLER_VENUE_v1';
13
+ export type SettleToken = {
14
+ readonly symbol: string;
15
+ readonly address: string;
16
+ readonly decimals: number;
17
+ };
18
+ /** The dollar token the layer pays a seller's leg in, per network (CAIP-2). A network missing here is not served. */
19
+ export declare const PAY_TOKENS: Readonly<Record<string, SettleToken>>;
20
+ /** x402 v1 network names, read as CAIP-2 */
21
+ export declare const SETTLE_NETWORK_ALIASES: Readonly<Record<string, string>>;
22
+ /** The one chain of each venue a seller can be hired on (its rail). */
23
+ export declare const VENUE_RAILS: Readonly<Record<string, string>>;
24
+ /** A seller with no paid rail of its own settles here. */
25
+ export declare const FREE_ENROLLED: Readonly<{
26
+ network: "eip155:8453";
27
+ token: SettleToken;
28
+ }>;
29
+ /** What a seller published or registered: its x402 accepts entry for the class it delivered, its venue, its registered payTo. */
30
+ export type SellerOffer = {
31
+ accepts?: {
32
+ network: string;
33
+ asset: string;
34
+ payTo: string;
35
+ } | null;
36
+ venue?: string | null;
37
+ registered_pay_to?: string | null;
38
+ };
39
+ export type SellerRail = {
40
+ source: 'x402_accepts' | 'venue_rail' | 'free_enrolled';
41
+ network: string;
42
+ token: SettleToken | null;
43
+ pay_to: string | null;
44
+ state: 'owed' | 'held';
45
+ held_by: 'no_payee' | 'network_not_served' | 'token_not_served' | null;
46
+ };
47
+ /** The rail a seller's leg settles on (SETTLE_ON_SELLER_VENUE_v1). Pure. */
48
+ export declare function sellerRailOf(o: SellerOffer): SellerRail;
49
+ //# sourceMappingURL=settle-rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settle-rule.d.ts","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAG,2BAAoC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAK3G,qHAAqH;AACrH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAO3D,CAAC;AACH,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlE,CAAC;AACH,uEAAuE;AACvE,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKvD,CAAC;AACH,0DAA0D;AAC1D,eAAO,MAAM,aAAa;;;EAA6D,CAAC;AAExF,iIAAiI;AACjI,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC3J,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,cAAc,GAAG,YAAY,GAAG,eAAe,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,IAAI,CAAC;CAChG,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,UAAU,CAavD"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Where a seller's leg settles: the layer's rule SETTLE_ON_SELLER_VENUE_v1, and its resolver, held to the rule's own vectors
3
+ * (test/fixtures/settle-rule.vectors.json).
4
+ *
5
+ * The buyer's payment is confirmed wherever it was made. A seller's leg is paid on the network, token and payTo of the offer
6
+ * it delivered on, in this order: (1) its x402 `accepts` entry for the class it delivered; (2) its venue's rail, the one chain
7
+ * of the venue it was hired on, to the payTo it registered; (3) a seller with no paid rail of its own (a free tool or agent
8
+ * admitted as a paid seller): Base USDC to the payTo it registered. A network the seller did not publish is never chosen for
9
+ * it: a rail the layer holds no pay token on is Held (network_not_served), another asset is Held (token_not_served), and no
10
+ * payTo is Held (no_payee). Nothing is bridged or swapped. Pure.
11
+ */
12
+ export const SETTLE_RULE = 'SETTLE_ON_SELLER_VENUE_v1';
13
+ const BASE = 'eip155:8453';
14
+ const SOLANA = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
15
+ /** The dollar token the layer pays a seller's leg in, per network (CAIP-2). A network missing here is not served. */
16
+ export const PAY_TOKENS = Object.freeze({
17
+ 'eip155:8453': Object.freeze({ symbol: 'USDC', address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6 }),
18
+ 'eip155:42161': Object.freeze({ symbol: 'USDC', address: '0xaf88d065e77c8cc2239327c5edb3a432268e5831', decimals: 6 }),
19
+ 'eip155:5042': Object.freeze({ symbol: 'USDC', address: '0x3600000000000000000000000000000000000000', decimals: 6 }),
20
+ 'eip155:4663': Object.freeze({ symbol: 'USDG', address: '0x5fc5360d0400a0fd4f2af552add042d716f1d168', decimals: 6 }),
21
+ 'eip155:143': Object.freeze({ symbol: 'USDC', address: '0x754704bc059f8c67012fed69bc8a327a5aafb603', decimals: 6 }),
22
+ [SOLANA]: Object.freeze({ symbol: 'USDC', address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', decimals: 6 }),
23
+ });
24
+ /** x402 v1 network names, read as CAIP-2 */
25
+ export const SETTLE_NETWORK_ALIASES = Object.freeze({
26
+ base: BASE, 'base-sepolia': 'eip155:84532', arbitrum: 'eip155:42161', polygon: 'eip155:137', avalanche: 'eip155:43114',
27
+ monad: 'eip155:143', robinhood: 'eip155:4663', arc: 'eip155:5042', solana: SOLANA,
28
+ });
29
+ /** The one chain of each venue a seller can be hired on (its rail). */
30
+ export const VENUE_RAILS = Object.freeze({
31
+ 'x402-base': BASE, 'x402-solana': SOLANA, 'x402-arbitrum': 'eip155:42161', 'x402-robinhood': 'eip155:4663', 'x402-monad': 'eip155:143',
32
+ 'erc8183-base': BASE, 'memoacp-base': BASE, 'acpv3-arc': 'eip155:5042', 'acpv3-robinhood': 'eip155:4663', 'bitagent-base': BASE,
33
+ 'olas-gnosis': 'eip155:100', 'olas-base': BASE, 'olas-polygon': 'eip155:137', 'moonbeam-acp': BASE, 'pons-robinhood': 'eip155:4663',
34
+ nosana: SOLANA,
35
+ });
36
+ /** A seller with no paid rail of its own settles here. */
37
+ export const FREE_ENROLLED = Object.freeze({ network: BASE, token: PAY_TOKENS[BASE] });
38
+ /** The rail a seller's leg settles on (SETTLE_ON_SELLER_VENUE_v1). Pure. */
39
+ export function sellerRailOf(o) {
40
+ const acc = o.accepts && o.accepts.network && o.accepts.asset && o.accepts.payTo ? o.accepts : null;
41
+ const reg = typeof o.registered_pay_to === 'string' && o.registered_pay_to ? o.registered_pay_to : null;
42
+ const rail = !acc && o.venue ? VENUE_RAILS[o.venue] ?? null : null;
43
+ const source = acc ? 'x402_accepts' : rail ? 'venue_rail' : 'free_enrolled';
44
+ const network = acc ? (SETTLE_NETWORK_ALIASES[acc.network] ?? acc.network) : rail ?? FREE_ENROLLED.network;
45
+ const evm = network.startsWith('eip155:');
46
+ const raw = acc ? acc.payTo : reg;
47
+ const pay_to = raw === null ? null : evm ? raw.toLowerCase() : raw;
48
+ const tok = PAY_TOKENS[network] ?? null;
49
+ const assetOk = acc && tok ? (evm ? acc.asset.toLowerCase() === tok.address : acc.asset === tok.address) : true;
50
+ const held_by = !tok ? 'network_not_served' : !assetOk ? 'token_not_served' : pay_to === null ? 'no_payee' : null;
51
+ return { source, network, token: assetOk ? tok : null, pay_to, state: held_by ? 'held' : 'owed', held_by };
52
+ }
53
+ //# sourceMappingURL=settle-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settle-rule.js","sourceRoot":"","sources":["../../src/resale/settle-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,2BAAoC,CAAC;AAGhE,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,MAAM,GAAG,yCAAyC,CAAC;AAEzD,qHAAqH;AACrH,MAAM,CAAC,MAAM,UAAU,GAA0C,MAAM,CAAC,MAAM,CAAC;IAC7E,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4CAA4C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACpH,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4CA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GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAClC,MAAM,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACnE,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IACxC,MAAM,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChH,MAAM,OAAO,GAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IACzI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7G,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const BASE_CHAIN_ID: 8453;
2
+ export type RpcNeed = 'call' | 'logs';
3
+ export interface BaseReader {
4
+ readonly chainId: typeof BASE_CHAIN_ID;
5
+ /** the endpoints this reader would try, best first */
6
+ urls(need?: RpcNeed): Promise<string[]>;
7
+ /** one JSON-RPC call; `need: 'logs'` picks endpoints proven to serve eth_getLogs windows */
8
+ call<T = unknown>(method: string, params: readonly unknown[], need?: RpcNeed): Promise<T>;
9
+ }
10
+ export declare class RpcReverted extends Error {
11
+ readonly data: string | null;
12
+ name: string;
13
+ constructor(message: string, data: string | null);
14
+ }
15
+ /** A Base reader over warmbed's rotation (default), or over the endpoints you name. */
16
+ export declare function baseReader(o?: {
17
+ urls?: readonly string[];
18
+ fetch?: typeof fetch;
19
+ timeoutMs?: number;
20
+ warmbed?: boolean;
21
+ }): BaseReader;
22
+ /** eth_call on Base: the return data, or RpcReverted with the revert data */
23
+ export declare const ethCall: (r: BaseReader, to: string, data: string, block?: string) => Promise<string>;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,EAAG,IAAa,CAAC;AAC3C,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AACtC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,aAAa,CAAC;IACvC,sDAAsD;IACtD,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,4FAA4F;IAC5F,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC3F;AACD,qBAAa,WAAY,SAAQ,KAAK;IAA+D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAA/E,IAAI,SAAiB;IAAC,YAAY,OAAO,EAAE,MAAM,EAAW,IAAI,EAAE,MAAM,GAAG,IAAI,EAAqB;CAAE;AAKxJ,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,CAAC,GAAE;IAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CA8BxI;AAED,6EAA6E;AAC7E,eAAO,MAAM,OAAO,MAAO,UAAU,MAAM,MAAM,QAAQ,MAAM,UAAS,MAAM,KAAc,OAAO,CAAC,MAAM,CAAsD,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @moonbeam-foundation/sdk/rpc: one injectable Base reader. By default it walks warmbed's measured rotation of Base
3
+ * endpoints (the same reader @taifoon/jev uses: warmbed first, then a static fallback list), so a rate-limited or
4
+ * range-capped public endpoint moves the call to the next one instead of failing it. A revert is an answer and is
5
+ * thrown at once. BASE_RPC (a comma list) or `urls` goes first. Reads only: nothing here signs or sends.
6
+ */
7
+ import { rpcRotation } from '@taifoon/jev';
8
+ export const BASE_CHAIN_ID = 8453;
9
+ export class RpcReverted extends Error {
10
+ data;
11
+ name = 'RpcReverted';
12
+ constructor(message, data) {
13
+ super(message);
14
+ this.data = data;
15
+ }
16
+ }
17
+ const REVERT = /revert|invalid opcode|out of gas/i;
18
+ const env = (k) => (typeof process !== 'undefined' ? process.env[k] : undefined);
19
+ /** A Base reader over warmbed's rotation (default), or over the endpoints you name. */
20
+ export function baseReader(o = {}) {
21
+ const f = o.fetch ?? fetch;
22
+ const pinned = [...(o.urls ?? []), ...String(env('BASE_RPC') ?? '').split(',').map((s) => s.trim()).filter(Boolean)];
23
+ const urls = async (need = 'call') => [...new Set([...pinned, ...(o.warmbed === false ? [] : await rpcRotation(BASE_CHAIN_ID, f, need))])];
24
+ return {
25
+ chainId: BASE_CHAIN_ID,
26
+ urls,
27
+ async call(method, params, need = 'call') {
28
+ const list = await urls(need);
29
+ if (!list.length)
30
+ throw new Error(`${method}: no Base endpoint (warmbed silent and none named)`);
31
+ let last = '';
32
+ for (const u of list) {
33
+ try {
34
+ const r = await f(u, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }), signal: AbortSignal.timeout(o.timeoutMs ?? 20_000) });
35
+ if (r.status >= 400) {
36
+ last = `${new URL(u).host}: http ${r.status}`;
37
+ continue;
38
+ }
39
+ const j = (await r.json());
40
+ if (j.error) {
41
+ const msg = String(j.error.message ?? j.error.code);
42
+ if (j.error.code === 3 || REVERT.test(msg))
43
+ throw new RpcReverted(`${method}: ${msg}`, typeof j.error.data === 'string' ? j.error.data : null);
44
+ last = `${new URL(u).host}: ${msg.slice(0, 160)}`;
45
+ continue;
46
+ }
47
+ return j.result;
48
+ }
49
+ catch (e) {
50
+ if (e instanceof RpcReverted)
51
+ throw e;
52
+ last = `${(() => { try {
53
+ return new URL(u).host;
54
+ }
55
+ catch {
56
+ return u;
57
+ } })()}: ${e.message.slice(0, 160)}`;
58
+ }
59
+ }
60
+ throw new Error(`${method}: every Base endpoint failed (last: ${last})`);
61
+ },
62
+ };
63
+ }
64
+ /** eth_call on Base: the return data, or RpcReverted with the revert data */
65
+ export const ethCall = (r, to, data, block = 'latest') => r.call('eth_call', [{ to, data }, block]);
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAAG,IAAa,CAAC;AAS3C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAAwE,IAAI;IAAhE,IAAI,GAAG,aAAa,CAAC;IAAC,YAAY,OAAe,EAAW,IAAmB;QAAI,KAAK,CAAC,OAAO,CAAC,CAAC;oBAAtC,IAAI;IAAmC,CAAC;CAAE;AAExJ,MAAM,MAAM,GAAG,mC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C,EAAE,GAAG,CAAC,EAAE,CAAC;wBAAC,SAAS;oBAC9D,CAAC;oBACD,OAAO,CAAC,CAAC,MAAW,CAAC;gBACvB,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,IAAI,CAAC,YAAY,WAAW;wBAAE,MAAM,CAAC,CAAC;oBACtC,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;wBAAC,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBAAC,CAAC;oBAAC,MAAM,CAAC;wBAAC,OAAO,CAAC,CAAC;oBAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAM,CAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;gBACvH,CAAC;YACH,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,uCAAuC,IAAI,GAAG,CAAC,CAAC;QAC3E,CAAC;KACF,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAa,EAAE,EAAU,EAAE,IAAY,EAAE,KAAK,GAAW,QAAQ,EAAmB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAS,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Workflow } from './types.js';
2
+ export declare const WORKFLOW_DATA: readonly Workflow[];
3
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/workflows/data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,SAAS,QAAQ,EA2zB5C,CAAC"}