@dvmkit/dvm-cli 0.6.0 → 0.7.0-rc.1

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 (51) hide show
  1. package/dist/{_esm-MN4BUYV6.js → _esm-KJAA4KAJ.js} +7 -7
  2. package/dist/{actions-LR65XILR.js → actions-J7VGYDBF.js} +4 -4
  3. package/dist/{ccip-JXYJSXTW.js → ccip-CJFG4PLA.js} +1 -1
  4. package/dist/{chains-LJ7XK6H3.js → chains-J6VIUNUB.js} +4 -4
  5. package/dist/{chunk-QICJRKB7.js → chunk-32AOWN2U.js} +11032 -12469
  6. package/dist/chunk-3E4LW5R5.js +77 -0
  7. package/dist/chunk-5RVUW52C.js +122 -0
  8. package/dist/{chunk-MJ4X4BEW.js → chunk-6LP4EGKA.js} +61 -61
  9. package/dist/chunk-6PVFVHS5.js +5460 -0
  10. package/dist/{chunk-BECPI5H5.js → chunk-B4WHUMZM.js} +36 -36
  11. package/dist/{chunk-CJTE5TS3.js → chunk-ESOJUXVY.js} +5 -5
  12. package/dist/{chunk-F55NNH2F.js → chunk-FOWQ7R7S.js} +16 -16
  13. package/dist/{chunk-ID5G54HJ.js → chunk-FPWP4S5S.js} +5 -3
  14. package/dist/{chunk-EE2MREOM.js → chunk-IQV4KG63.js} +5 -3
  15. package/dist/{chunk-R55XNXAR.js → chunk-IUTVV6N5.js} +3 -3
  16. package/dist/{chunk-Z4CZUMUT.js → chunk-JBU7RKQ3.js} +15 -15
  17. package/dist/{chunk-SHZMNEXE.js → chunk-JTMBSEZO.js} +2770 -926
  18. package/dist/{chunk-ERJFRCJO.js → chunk-KDNFUDOG.js} +5 -5
  19. package/dist/chunk-MWWZX7OQ.js +262 -0
  20. package/dist/chunk-PATIATFK.js +765 -0
  21. package/dist/{chunk-WTM2EICO.js → chunk-PUOXBKY2.js} +3 -3
  22. package/dist/{chunk-GZWKCIYN.js → chunk-QXMKABL7.js} +3 -3
  23. package/dist/chunk-R2DSAZBO.js +87 -0
  24. package/dist/chunk-SNSJAOR3.js +43 -0
  25. package/dist/{chunk-FL2ICZW5.js → chunk-SYFKO6BA.js} +3 -3
  26. package/dist/{chunk-LH3QPVN6.js → chunk-TAZWRWM4.js} +8060 -8058
  27. package/dist/chunk-VIRAAIDU.js +409 -0
  28. package/dist/{chunk-TZWZTS37.js → chunk-WN5R367B.js} +57 -83
  29. package/dist/{chunk-EZHT2RLJ.js → chunk-X7SEGALJ.js} +3 -3
  30. package/dist/{chunk-XHOFQ3OS.js → chunk-Y3SQD37C.js} +9 -9
  31. package/dist/{client-RYDA62DU.js → client-6IHIUB6J.js} +10 -10
  32. package/dist/client-VHGN7ZFZ.js +36 -0
  33. package/dist/{dist-GKCEIY2A.js → dist-23E7OOCA.js} +9 -9
  34. package/dist/dvm.js +2428 -568
  35. package/dist/{internal-INUTGTXQ.js → internal-7RZYJLLG.js} +325 -508
  36. package/dist/lifecycle-Z7YUOTR5.js +36 -0
  37. package/dist/{payout-reporter-3Y2U55ZX-CMKACKA3.js → payout-reporter-WT7XYW42-U2QPDIYC.js} +3 -2
  38. package/dist/{pocket-refill-K5T4LZF6.js → pocket-refill-CCWF3G4N.js} +33 -30
  39. package/dist/{revenue-reporter-MAERPYGK-CCPZXGFA.js → revenue-reporter-7UR3W2SD-C5OMRGK3.js} +3 -2
  40. package/dist/{tempo-AXTE4ZEA.js → tempo-ORFVGUKP.js} +10 -10
  41. package/dist/tempo-lifecycle-OT75TYVA.js +38 -0
  42. package/dist/tempo-wallet-SGYOEWVY.js +43 -0
  43. package/dist/wallet-BRXTQ4BB.js +45 -0
  44. package/dist/{x402-R6HPBY5D-VMSW7Z32.js → x402-ZU4GML7Z-RYEACIIT.js} +4 -19
  45. package/package.json +4 -2
  46. package/dist/chunk-3YE43JJR.js +0 -215
  47. package/dist/chunk-4KINCBHL.js +0 -5153
  48. package/dist/chunk-FSYEZERJ.js +0 -1667
  49. package/dist/chunk-VOO5IAK7.js +0 -2318
  50. package/dist/tempo-lifecycle-ZBBLFBMH-HWI4PLYP.js +0 -32
  51. package/dist/tempo-wallet-B5XXV3YH-SRQBMYFV.js +0 -41
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __dvmCreateRequire } from "node:module";
3
+ const require = __dvmCreateRequire(import.meta.url);
4
+ import {
5
+ loadConfig,
6
+ updateConfig
7
+ } from "./chunk-PATIATFK.js";
8
+ import {
9
+ tempoAccountFromConfig,
10
+ tryResolveTempoAsset
11
+ } from "./chunk-32AOWN2U.js";
12
+ import {
13
+ DvmError
14
+ } from "./chunk-JTMBSEZO.js";
15
+
16
+ // src/lib/payment-rails/tempo-wallet.ts
17
+ function tempoBalanceCheckHint(token) {
18
+ const configured = tryResolveTempoAsset();
19
+ if (configured?.address.toLowerCase() === token.toLowerCase()) {
20
+ return "This channel's token is the rail's configured settlement asset, so 'dvm wallet balance' reads it.";
21
+ }
22
+ return `'dvm wallet balance' reads the rail's configured settlement asset (${configured?.address ?? "unresolvable in this environment"}) rather than this channel's token (${token}), so query that contract directly for the balance that matters here.`;
23
+ }
24
+ function tempoWrongAssetHint(asset) {
25
+ return `This rail settles only in ${asset.label} (${asset.address}) on Tempo. Another Tempo dollar \u2014 USDT0 or any other stablecoin \u2014 is a different contract and will never show up here, however much of it your wallet says you hold. If you funded with the wrong one, swap it to ${asset.label} on Tempo (an on-chain swap, fees are sub-cent) or send ${asset.label} to this address.`;
26
+ }
27
+ async function connectedTempoAccount() {
28
+ const config = loadConfig();
29
+ return tempoAccountFromConfig(config);
30
+ }
31
+ async function generateTempoKey(opts = {}) {
32
+ const config = loadConfig();
33
+ if (!config) {
34
+ throw new DvmError(
35
+ "no_config",
36
+ "No config found.",
37
+ "Run `dvm init` before generating a Tempo wallet."
38
+ );
39
+ }
40
+ const existing = await tempoAccountFromConfig(config);
41
+ if (existing && !opts.force) {
42
+ throw new DvmError(
43
+ "tempo_wallet_exists",
44
+ `Tempo wallet already configured (address ${existing.address}).`,
45
+ "Pass `--force` to replace, or run `dvm wallet tempo-disconnect` to clear it first."
46
+ );
47
+ }
48
+ if (existing && opts.force) {
49
+ const { assertTempoWalletIdle } = await import("./tempo-lifecycle-OT75TYVA.js");
50
+ await assertTempoWalletIdle("replace");
51
+ }
52
+ const { privateKeyToAccount, generatePrivateKey } = await import("./accounts-2WZE4N5F.js");
53
+ const privateKey = generatePrivateKey();
54
+ const account = privateKeyToAccount(privateKey);
55
+ const generated = {
56
+ privateKey,
57
+ address: account.address.toLowerCase(),
58
+ network: opts.network ?? "mainnet"
59
+ };
60
+ await opts.beforePersist?.(generated);
61
+ await updateConfig({
62
+ reason: "tempo_wallet_generate",
63
+ patch: () => ({
64
+ set: {
65
+ tempo: { method: "tempo", apiKey: privateKey, network: generated.network }
66
+ }
67
+ })
68
+ });
69
+ return generated;
70
+ }
71
+
72
+ export {
73
+ tempoBalanceCheckHint,
74
+ tempoWrongAssetHint,
75
+ connectedTempoAccount,
76
+ generateTempoKey
77
+ };
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __dvmCreateRequire } from "node:module";
3
+ const require = __dvmCreateRequire(import.meta.url);
4
+ import {
5
+ authorizeProtectedRemoval,
6
+ loadConfig,
7
+ updateConfig
8
+ } from "./chunk-PATIATFK.js";
9
+ import {
10
+ withX402ChannelLock,
11
+ x402WalletFromConfig
12
+ } from "./chunk-32AOWN2U.js";
13
+ import {
14
+ DvmError,
15
+ X402_DEFAULT_NETWORK,
16
+ X402_NETWORKS,
17
+ ensureAddress,
18
+ isValidEvmPrivateKey,
19
+ x402NetworkByCaip2
20
+ } from "./chunk-JTMBSEZO.js";
21
+
22
+ // src/lib/x402/networks.ts
23
+ function x402NetworkLabel(network) {
24
+ const spec = x402NetworkByCaip2(network);
25
+ return spec ? `${spec.label} (${network})` : network;
26
+ }
27
+ function x402NetworkListForCopy() {
28
+ return X402_NETWORKS.map((n) => `${n.caip2} (${n.label})`).join(", ");
29
+ }
30
+ function assertSupportedX402Network(network) {
31
+ if (x402NetworkByCaip2(network)) return;
32
+ throw new DvmError(
33
+ "unsupported_network",
34
+ `Unsupported x402 network: ${network}.`,
35
+ `${x402SupportedNetworksHint()} If a wallet is connected, run 'dvm wallet x402-network <caip2>'. For a first connection, pass --network to 'dvm wallet x402-connect'.`
36
+ );
37
+ }
38
+ function x402SupportedNetworksHint() {
39
+ return `This rail settles native USDC on: ${x402NetworkListForCopy()}.`;
40
+ }
41
+
42
+ // src/lib/x402/wallet.ts
43
+ function loadX402Wallet() {
44
+ return x402WalletFromConfig(loadConfig());
45
+ }
46
+ async function connectedX402Payer() {
47
+ const wallet = loadX402Wallet();
48
+ if (!wallet) return null;
49
+ return (await ensureAddress(wallet)).address;
50
+ }
51
+ async function repinX402WalletNetwork(network) {
52
+ assertSupportedX402Network(network);
53
+ return withX402ChannelLock(async () => {
54
+ const { previous } = await updateConfig({
55
+ reason: "x402_wallet_repin",
56
+ patch: (current) => {
57
+ if (!current) throw new DvmError("no_config", "No config found.", "Run: dvm init");
58
+ const privateKey = current.x402?.privateKey;
59
+ if (privateKey === void 0) throw x402WalletMissingError();
60
+ if (!isValidEvmPrivateKey(privateKey)) throw invalidX402PrivateKey();
61
+ return { set: { x402: { privateKey, network } } };
62
+ }
63
+ });
64
+ const stored = previous?.x402;
65
+ if (stored === void 0) throw x402WalletMissingError();
66
+ if (!isValidEvmPrivateKey(stored.privateKey)) throw invalidX402PrivateKey();
67
+ const { privateKeyToAccount } = await import("./accounts-2WZE4N5F.js");
68
+ return {
69
+ address: privateKeyToAccount(stored.privateKey).address,
70
+ previousNetwork: stored.network ?? X402_DEFAULT_NETWORK,
71
+ network
72
+ };
73
+ });
74
+ }
75
+ async function saveX402Wallet(privateKey, network) {
76
+ if (network !== void 0) assertSupportedX402Network(network);
77
+ if (!isValidEvmPrivateKey(privateKey)) throw invalidX402PrivateKey();
78
+ const { privateKeyToAccount } = await import("./accounts-2WZE4N5F.js");
79
+ const account = privateKeyToAccount(privateKey);
80
+ let resolved;
81
+ await updateConfig({
82
+ reason: "x402_wallet_connect",
83
+ patch: (current) => {
84
+ resolved = network ?? current?.x402?.network;
85
+ return {
86
+ set: { x402: resolved === void 0 ? { privateKey } : { privateKey, network: resolved } }
87
+ };
88
+ }
89
+ });
90
+ return { address: account.address, network: resolved ?? X402_DEFAULT_NETWORK };
91
+ }
92
+ async function removeX402Wallet() {
93
+ await updateConfig({
94
+ reason: "x402_wallet_disconnect",
95
+ authorize: authorizeProtectedRemoval("x402"),
96
+ patch: () => ({ unset: ["x402"] })
97
+ });
98
+ }
99
+ function invalidX402PrivateKey() {
100
+ return new DvmError(
101
+ "invalid_key",
102
+ "Invalid secp256k1 private key.",
103
+ "Reconnect with `dvm wallet x402-connect --key-file <path>`, set DVM_X402_KEY, or pipe a valid 0x-prefixed 32-byte secp256k1 private key through stdin."
104
+ );
105
+ }
106
+ function x402WalletMissingError() {
107
+ return new DvmError(
108
+ "x402_wallet_missing",
109
+ "No x402 wallet is connected.",
110
+ "Run 'dvm wallet x402-connect' to create one, or add --key-file <path> to import a key you already hold."
111
+ );
112
+ }
113
+
114
+ export {
115
+ x402NetworkLabel,
116
+ assertSupportedX402Network,
117
+ loadX402Wallet,
118
+ connectedX402Payer,
119
+ repinX402WalletNetwork,
120
+ saveX402Wallet,
121
+ removeX402Wallet
122
+ };
@@ -1,6 +1,61 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __dvmCreateRequire } from "node:module";
3
3
  const require = __dvmCreateRequire(import.meta.url);
4
+ import {
5
+ BadRequestError,
6
+ ChannelClosedError,
7
+ Headers as Headers2,
8
+ Intents,
9
+ MethodDetailKeys,
10
+ Methods,
11
+ PaymentRequirementsSchema,
12
+ Schema,
13
+ SessionProtocols,
14
+ VerificationFailedError,
15
+ _enum,
16
+ _maxLength,
17
+ _minLength,
18
+ _regex,
19
+ address,
20
+ amount,
21
+ array,
22
+ assert as assert2,
23
+ bigint,
24
+ boolean,
25
+ createJson,
26
+ credentialMetaKey,
27
+ custom as custom2,
28
+ datetimeInput,
29
+ decodePaymentRequiredEnvelope,
30
+ deserialize as deserialize2,
31
+ discriminatedUnion,
32
+ exactIntent,
33
+ from as from4,
34
+ from3 as from5,
35
+ fromResponseList,
36
+ getMethodDetail,
37
+ hash,
38
+ literal,
39
+ number,
40
+ object,
41
+ optional,
42
+ paymentMethod,
43
+ paymentRequiredCode,
44
+ paymentRequiredHeader,
45
+ paymentRequiredMetaKey,
46
+ paymentResponseHeader,
47
+ paymentSignatureHeader,
48
+ pipe,
49
+ refine,
50
+ serialize2 as serialize,
51
+ serialize3 as serialize2,
52
+ signature,
53
+ string,
54
+ syntheticChallengeIdPrefix,
55
+ toClient,
56
+ transform,
57
+ union
58
+ } from "./chunk-PUOXBKY2.js";
4
59
  import {
5
60
  Abis_exports,
6
61
  Account_exports,
@@ -60,71 +115,16 @@ import {
60
115
  validator,
61
116
  validatorConfig,
62
117
  zoneOutbox
63
- } from "./chunk-BECPI5H5.js";
64
- import {
65
- BadRequestError,
66
- ChannelClosedError,
67
- Headers as Headers2,
68
- Intents,
69
- MethodDetailKeys,
70
- Methods,
71
- PaymentRequirementsSchema,
72
- Schema,
73
- SessionProtocols,
74
- VerificationFailedError,
75
- _enum,
76
- _maxLength,
77
- _minLength,
78
- _regex,
79
- address,
80
- amount,
81
- array,
82
- assert as assert2,
83
- bigint,
84
- boolean,
85
- createJson,
86
- credentialMetaKey,
87
- custom as custom2,
88
- datetimeInput,
89
- decodePaymentRequiredEnvelope,
90
- deserialize as deserialize2,
91
- discriminatedUnion,
92
- exactIntent,
93
- from as from4,
94
- from3 as from5,
95
- fromResponseList,
96
- getMethodDetail,
97
- hash,
98
- literal,
99
- number,
100
- object,
101
- optional,
102
- paymentMethod,
103
- paymentRequiredCode,
104
- paymentRequiredHeader,
105
- paymentRequiredMetaKey,
106
- paymentResponseHeader,
107
- paymentSignatureHeader,
108
- pipe,
109
- refine,
110
- serialize2 as serialize,
111
- serialize3 as serialize2,
112
- signature,
113
- string,
114
- syntheticChallengeIdPrefix,
115
- toClient,
116
- transform,
117
- union
118
- } from "./chunk-WTM2EICO.js";
118
+ } from "./chunk-B4WHUMZM.js";
119
119
  import {
120
120
  Base64_exports
121
- } from "./chunk-EZHT2RLJ.js";
121
+ } from "./chunk-X7SEGALJ.js";
122
122
  import {
123
123
  createClient,
124
124
  createTransport,
125
125
  custom,
126
126
  http
127
- } from "./chunk-CJTE5TS3.js";
127
+ } from "./chunk-ESOJUXVY.js";
128
128
  import {
129
129
  estimateContractGas,
130
130
  multicall,
@@ -136,7 +136,7 @@ import {
136
136
  toAmount,
137
137
  toBaseUnits,
138
138
  zeroAddress
139
- } from "./chunk-GZWKCIYN.js";
139
+ } from "./chunk-QXMKABL7.js";
140
140
  import {
141
141
  AbiItem_exports,
142
142
  AbiParameters_exports,
@@ -173,7 +173,7 @@ import {
173
173
  writeContract,
174
174
  writeContractSync,
175
175
  zeroHash
176
- } from "./chunk-LH3QPVN6.js";
176
+ } from "./chunk-TAZWRWM4.js";
177
177
  import {
178
178
  hashTypedData
179
179
  } from "./chunk-6O27TEXD.js";
@@ -207,7 +207,7 @@ import {
207
207
  toNumber2 as toNumber,
208
208
  toRpc,
209
209
  withResolvers
210
- } from "./chunk-F55NNH2F.js";
210
+ } from "./chunk-FOWQ7R7S.js";
211
211
  import {
212
212
  AbiDecodingZeroDataError,
213
213
  BaseError,