@dvmkit/dvm-cli 0.1.4 → 0.2.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 (60) hide show
  1. package/README.md +14 -0
  2. package/dist/{_esm-M2HUAA3B.js → _esm-MN4BUYV6.js} +56 -54
  3. package/dist/{accounts-S747UW3A.js → accounts-2WZE4N5F.js} +5 -5
  4. package/dist/actions-LR65XILR.js +244 -0
  5. package/dist/{ccip-XZ5F5J6R.js → ccip-JXYJSXTW.js} +3 -3
  6. package/dist/{chains-PINFXYUE.js → chains-LJ7XK6H3.js} +8 -8
  7. package/dist/{chunk-YZUBKHHA.js → chunk-2VVVWBQA.js} +471 -471
  8. package/dist/chunk-3SWX5BQP.js +66 -0
  9. package/dist/chunk-4JXFXP4Y.js +757 -0
  10. package/dist/{chunk-GIDSTROG.js → chunk-4NWEJTAW.js} +160 -158
  11. package/dist/{chunk-UXQCP26E.js → chunk-65EY7CT4.js} +2 -2
  12. package/dist/{chunk-6UGZAFIR.js → chunk-6CC6JGEU.js} +348 -18
  13. package/dist/{chunk-PHZHPRQE.js → chunk-6O27TEXD.js} +173 -173
  14. package/dist/{chunk-HPRIQEJS.js → chunk-7OK7MBT6.js} +19 -19
  15. package/dist/{chunk-7UPZZGC5.js → chunk-BECPI5H5.js} +193 -193
  16. package/dist/chunk-CJTE5TS3.js +1298 -0
  17. package/dist/{chunk-RWBYCM47.js → chunk-ECEM3ZAS.js} +10 -10
  18. package/dist/{chunk-ACNNU5RY.js → chunk-ECK465AY.js} +694 -565
  19. package/dist/{chunk-XGABM4H5.js → chunk-EGY4KDBW.js} +3822 -2012
  20. package/dist/{chunk-SLDVIXCS.js → chunk-EVQERRCP.js} +12 -12
  21. package/dist/{chunk-4AQ4G7L5.js → chunk-EZHT2RLJ.js} +383 -383
  22. package/dist/{chunk-IC6OXFYW.js → chunk-F55NNH2F.js} +63 -63
  23. package/dist/chunk-G5C6E6PJ.js +9063 -0
  24. package/dist/{chunk-6AJ7H2VX.js → chunk-GZWKCIYN.js} +213 -1281
  25. package/dist/{chunk-ZGXCK43G.js → chunk-LH3QPVN6.js} +8499 -8498
  26. package/dist/{chunk-MMJR6N3J.js → chunk-MLDUKBU3.js} +1368 -1368
  27. package/dist/chunk-N3UJT2NJ.js +3 -0
  28. package/dist/chunk-N7MGIK2U.js +61408 -0
  29. package/dist/{chunk-BZNZWRBB.js → chunk-OWJZYYMG.js} +11 -15
  30. package/dist/chunk-ZJYO7OLO.js +514 -0
  31. package/dist/{client-D3XFLWOK.js → client-OWIOFBKS.js} +18 -16
  32. package/dist/{dist-7MMV3EZA.js → dist-2G3QBGID.js} +11 -10
  33. package/dist/dvm.js +27046 -4414
  34. package/dist/esm-RQLHAH2K.js +5183 -0
  35. package/dist/internal-JDG52DJH.js +1230 -0
  36. package/dist/payout-reporter-3UB5WRCV-XTVZFIAO.js +17 -0
  37. package/dist/{pocket-refill-GDYSTECR.js → pocket-refill-QJMMD6QN.js} +29 -30
  38. package/dist/revenue-reporter-JIKUPXOK-TYUBTF4P.js +11 -0
  39. package/dist/{secp256k1-4YWQEMGF.js → secp256k1-JLZEQ2H7.js} +2 -2
  40. package/dist/tempo-lifecycle-SQL3KLEZ-AATA2SKI.js +28 -0
  41. package/dist/{tempo-wallet-5FEOI4CF.js → tempo-wallet-QOLEIPCV-SWCXRBDS.js} +2 -4
  42. package/dist/{x402-VNFA3DBY.js → x402-FTG2GRAQ-UGAUMUL6.js} +13 -24
  43. package/package.json +2 -10
  44. package/skills/dvm/SKILL.md +2 -1
  45. package/dist/channel-store-GOV7TEDN.js +0 -62
  46. package/dist/chunk-3PPOU55E.js +0 -312
  47. package/dist/chunk-3TBULV3F.js +0 -551
  48. package/dist/chunk-5BUV73FO.js +0 -2351
  49. package/dist/chunk-EY5K4BM3.js +0 -1780
  50. package/dist/chunk-G3RLVJF5.js +0 -19
  51. package/dist/chunk-KC4UPK44.js +0 -113
  52. package/dist/chunk-MTBCEXJ6.js +0 -4602
  53. package/dist/chunk-ONQMRWY3.js +0 -83
  54. package/dist/chunk-TO47XRK7.js +0 -24890
  55. package/dist/chunk-U5TNSUYW.js +0 -1757
  56. package/dist/chunk-UU6QMSTQ.js +0 -171
  57. package/dist/chunk-ZELLQI7F.js +0 -248
  58. package/dist/lifecycle-5RLM5JMN.js +0 -29
  59. package/dist/tempo-lifecycle-DHZPQTSB.js +0 -31
  60. package/dist/wallet-G3VOUCL4.js +0 -30
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __dvmCreateRequire } from "node:module";
3
- const require = __dvmCreateRequire(import.meta.url);
4
-
5
- // src/lib/payment-rails/types.ts
6
- var RAIL_FLAGS = ["cashu", "tempo", "x402"];
7
- var ADVERTISED_AMOUNT_TOLERANCE_BPS = 1000n;
8
- function maxAdvertisedMicro(localMicro) {
9
- return localMicro * (10000n + ADVERTISED_AMOUNT_TOLERANCE_BPS) / 10000n;
10
- }
11
- function withinAdvertisedTolerance(advertisedMicro, localMicro) {
12
- return advertisedMicro * 10000n <= localMicro * (10000n + ADVERTISED_AMOUNT_TOLERANCE_BPS);
13
- }
14
-
15
- export {
16
- RAIL_FLAGS,
17
- maxAdvertisedMicro,
18
- withinAdvertisedTolerance
19
- };
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __dvmCreateRequire } from "node:module";
3
- const require = __dvmCreateRequire(import.meta.url);
4
- import {
5
- usdcToMsats
6
- } from "./chunk-ZELLQI7F.js";
7
- import {
8
- X402_DEFAULT_NETWORK,
9
- buildPaymentRequirements,
10
- callerLoggers,
11
- createX402FacilitatorAuthHeaders,
12
- decodePayment,
13
- encodeSettleResponseHeader,
14
- exactEvmAuthorization,
15
- settleWithFacilitator,
16
- verifyWithFacilitator
17
- } from "./chunk-EY5K4BM3.js";
18
- import {
19
- x402NetworkByCaip2
20
- } from "./chunk-MTBCEXJ6.js";
21
-
22
- // src/lib/x402/asset.ts
23
- function resolveX402Asset(network = X402_DEFAULT_NETWORK) {
24
- const spec = x402NetworkByCaip2(network);
25
- if (!spec) return null;
26
- return {
27
- address: spec.usdc,
28
- symbol: "USDC",
29
- // "native" is the load-bearing word: every contract in the table is
30
- // Circle's own USDC, and the dollars that read as zero here are the
31
- // bridged ones.
32
- label: "native USDC",
33
- unit: "USDC",
34
- networkLabel: spec.label,
35
- confusable: spec.confusable
36
- };
37
- }
38
- function x402WrongAssetHint(asset) {
39
- const wrongToken = asset.confusable ? `Another dollar on ${asset.networkLabel} \u2014 ${asset.confusable}, the legacy bridged dollar, or any other stablecoin \u2014 is a different contract and will never show up here, however much of it your wallet says you hold.` : `Another dollar on ${asset.networkLabel} is a different contract and will never show up here, however much of it your wallet says you hold.`;
40
- return `This rail reads only ${asset.label} (${asset.address}) on ${asset.networkLabel}. ${wrongToken} USDC on a different chain is invisible here too \u2014 this wallet reads ${asset.networkLabel} alone. If you funded the wrong one, swap it to ${asset.label} on ${asset.networkLabel}, or bridge the funds across to ${asset.networkLabel}; either way they land where this rail can spend them.`;
41
- }
42
-
43
- // src/lib/x402/verify.ts
44
- async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
45
- return callerLoggers.x402.span(
46
- "x402.verify_payment",
47
- {
48
- resource,
49
- required_usdc_micro: Number(requiredUsdcMicro),
50
- facilitator_url: config.facilitator
51
- },
52
- async () => {
53
- let payload;
54
- try {
55
- payload = decodePayment(paymentHeader);
56
- } catch {
57
- return { verified: false, amountMsats: 0, invalidReason: "decode_failed" };
58
- }
59
- if (payload.x402Version === 1 && !exactVersions.v1 || payload.x402Version === 2 && !exactVersions.v2) {
60
- return { verified: false, amountMsats: 0, invalidReason: "unsupported_version" };
61
- }
62
- const requirementOpts = { x402Config: config, requiredUsdcMicro, resource };
63
- const requirements = payload.x402Version === 1 ? buildPaymentRequirements({ ...requirementOpts, version: 1 }) : buildPaymentRequirements({ ...requirementOpts, version: 2 });
64
- const createAuthHeaders = createX402FacilitatorAuthHeaders(config);
65
- const verifyRes = await verifyWithFacilitator(
66
- payload,
67
- requirements,
68
- config,
69
- createAuthHeaders
70
- );
71
- if (!verifyRes.isValid) {
72
- return {
73
- verified: false,
74
- amountMsats: 0,
75
- invalidReason: verifyRes.invalidReason ?? "verify_failed"
76
- };
77
- }
78
- const settleRes = await settleWithFacilitator(
79
- payload,
80
- requirements,
81
- config,
82
- createAuthHeaders
83
- );
84
- if (!settleRes.success) {
85
- return {
86
- verified: false,
87
- amountMsats: 0,
88
- invalidReason: settleRes.errorReason ?? "settle_failed"
89
- };
90
- }
91
- const amountUsdcMicro = Number.parseInt(exactEvmAuthorization(payload).value, 10);
92
- const amountMsats = usdcToMsats(amountUsdcMicro / 1e6, btcUsdRate);
93
- callerLoggers.x402.info("x402.verify_payment.result", {
94
- verified: true,
95
- tx_hash: settleRes.transaction,
96
- amount_msats: amountMsats
97
- });
98
- return {
99
- verified: true,
100
- amountMsats,
101
- amountUsdcMicro,
102
- txHash: settleRes.transaction,
103
- settleResponseHeader: encodeSettleResponseHeader(settleRes)
104
- };
105
- }
106
- );
107
- }
108
-
109
- export {
110
- resolveX402Asset,
111
- x402WrongAssetHint,
112
- verifyX402Payment
113
- };