@dvmkit/dvm-cli 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JHUMURHA.js → chunk-24VB7FR7.js} +44 -14
- package/dist/{chunk-XJN5ZDAL.js → chunk-R4MSO2GX.js} +3 -3
- package/dist/{chunk-EGY4KDBW.js → chunk-SKKZ4OAA.js} +9 -2
- package/dist/{chunk-6CC6JGEU.js → chunk-VY277ROG.js} +1 -1
- package/dist/{chunk-5GIU2LBJ.js → chunk-YLWATJ7F.js} +5 -5
- package/dist/{chunk-7FUTMGAW.js → chunk-Z75N4GTG.js} +398 -244
- package/dist/dvm.js +2424 -1661
- package/dist/{internal-URPZ64UG.js → internal-OBEYRHMV.js} +14 -6
- package/dist/{pocket-refill-DS6LOMFF.js → pocket-refill-NXTJIVB5.js} +6 -6
- package/dist/{tempo-lifecycle-SQL3KLEZ-YZ2XAOOS.js → tempo-lifecycle-DFIXQ54Q-LNXPKWK5.js} +4 -4
- package/dist/{tempo-wallet-QOLEIPCV-A6BUUBJS.js → tempo-wallet-4QKSV65O-J6ZZQAD7.js} +10 -2
- package/dist/{x402-T2C5MX3T-CMGC2CLF.js → x402-5H27DCBE-UEQQQ5UY.js} +3 -3
- package/package.json +2 -2
- package/skills/dvm/SKILL.md +5 -2
|
@@ -10,13 +10,29 @@ import {
|
|
|
10
10
|
resolveRpcHttpTransportOptions,
|
|
11
11
|
resolveRpcOverride,
|
|
12
12
|
updateConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SKKZ4OAA.js";
|
|
14
14
|
|
|
15
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
15
|
+
// node_modules/@dvmkit/sdk/dist/chunk-2UUXIIOC.js
|
|
16
16
|
var TEMPO_USDC_MAINNET = "0x20C000000000000000000000b9537d11c60E8b50";
|
|
17
17
|
var TEMPO_CHAIN_ID = 4217;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var TEMPO_MODERATO_CHAIN_ID = 42431;
|
|
19
|
+
var TEMPO_PATH_USD_MODERATO = "0x20c0000000000000000000000000000000000000";
|
|
20
|
+
var TEMPO_MODERATO_RPC = "https://rpc.moderato.tempo.xyz";
|
|
21
|
+
function resolveTempoNetwork(network = "mainnet") {
|
|
22
|
+
return network === "moderato" ? {
|
|
23
|
+
network,
|
|
24
|
+
chainId: TEMPO_MODERATO_CHAIN_ID,
|
|
25
|
+
rpcUrl: TEMPO_MODERATO_RPC,
|
|
26
|
+
defaultToken: TEMPO_PATH_USD_MODERATO
|
|
27
|
+
} : {
|
|
28
|
+
network,
|
|
29
|
+
chainId: TEMPO_CHAIN_ID,
|
|
30
|
+
rpcUrl: "https://rpc.tempo.xyz",
|
|
31
|
+
defaultToken: TEMPO_USDC_MAINNET
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function resolveTempoAsset(env = process.env, network = "mainnet") {
|
|
35
|
+
const address = env.DVM_TEMPO_CURRENCY ?? resolveTempoNetwork(network).defaultToken;
|
|
20
36
|
if (!HEX_ADDRESS_RE.test(address)) {
|
|
21
37
|
throw new DvmError(
|
|
22
38
|
"tempo_config_invalid",
|
|
@@ -57,7 +73,9 @@ function tempoWrongAssetHint(asset) {
|
|
|
57
73
|
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.`;
|
|
58
74
|
}
|
|
59
75
|
function tempoTokenSymbol(address) {
|
|
60
|
-
|
|
76
|
+
if (address.toLowerCase() === TEMPO_USDC_MAINNET.toLowerCase()) return "USDC.e";
|
|
77
|
+
if (address.toLowerCase() === TEMPO_PATH_USD_MODERATO.toLowerCase()) return "pathUSD";
|
|
78
|
+
return null;
|
|
61
79
|
}
|
|
62
80
|
var HEX_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
63
81
|
async function connectedTempoAccount() {
|
|
@@ -82,7 +100,7 @@ async function generateTempoKey(opts = {}) {
|
|
|
82
100
|
);
|
|
83
101
|
}
|
|
84
102
|
if (existing && opts.force) {
|
|
85
|
-
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-
|
|
103
|
+
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-DFIXQ54Q-LNXPKWK5.js");
|
|
86
104
|
await assertTempoWalletIdle("replace");
|
|
87
105
|
}
|
|
88
106
|
const { privateKeyToAccount, generatePrivateKey } = await import("./accounts-2WZE4N5F.js");
|
|
@@ -90,22 +108,30 @@ async function generateTempoKey(opts = {}) {
|
|
|
90
108
|
const account = privateKeyToAccount(privateKey);
|
|
91
109
|
const generated = {
|
|
92
110
|
privateKey,
|
|
93
|
-
address: account.address.toLowerCase()
|
|
111
|
+
address: account.address.toLowerCase(),
|
|
112
|
+
network: opts.network ?? "mainnet"
|
|
94
113
|
};
|
|
95
114
|
await opts.beforePersist?.(generated);
|
|
96
115
|
await updateConfig({
|
|
97
116
|
reason: "tempo_wallet_generate",
|
|
98
|
-
patch: () => ({
|
|
117
|
+
patch: () => ({
|
|
118
|
+
set: {
|
|
119
|
+
tempo: { method: "tempo", apiKey: privateKey, network: generated.network }
|
|
120
|
+
}
|
|
121
|
+
})
|
|
99
122
|
});
|
|
100
123
|
return generated;
|
|
101
124
|
}
|
|
102
125
|
async function getTempoUsdcBalance(account) {
|
|
103
|
-
const
|
|
126
|
+
const accountNetwork = account.network ?? "mainnet";
|
|
127
|
+
const network = resolveTempoNetwork(accountNetwork);
|
|
128
|
+
const tokenAddress = resolveTempoAsset(process.env, accountNetwork).address;
|
|
104
129
|
const { createPublicClient, http, erc20Abi } = await import("./_esm-MN4BUYV6.js");
|
|
105
|
-
const { tempo } = await import("./chains-LJ7XK6H3.js");
|
|
130
|
+
const { tempo, tempoModerato } = await import("./chains-LJ7XK6H3.js");
|
|
131
|
+
const chain = accountNetwork === "moderato" ? tempoModerato : tempo;
|
|
106
132
|
const { url: rpcUrl, source: rpcSource } = resolveRpcOverride(
|
|
107
133
|
process.env.DVM_TEMPO_RPC_URL,
|
|
108
|
-
|
|
134
|
+
network.rpcUrl
|
|
109
135
|
);
|
|
110
136
|
try {
|
|
111
137
|
const transportOptions = resolveRpcHttpTransportOptions(
|
|
@@ -113,7 +139,7 @@ async function getTempoUsdcBalance(account) {
|
|
|
113
139
|
process.env.DVM_TEMPO_RPC_HEADERS_JSON
|
|
114
140
|
);
|
|
115
141
|
const client = createPublicClient({
|
|
116
|
-
chain
|
|
142
|
+
chain,
|
|
117
143
|
transport: transportOptions ? http(rpcUrl, transportOptions) : http(rpcUrl)
|
|
118
144
|
});
|
|
119
145
|
const raw = await client.readContract({
|
|
@@ -127,7 +153,7 @@ async function getTempoUsdcBalance(account) {
|
|
|
127
153
|
rawBaseUnits: raw,
|
|
128
154
|
usdc: Number(raw) / 1e6,
|
|
129
155
|
tokenAddress,
|
|
130
|
-
chainId:
|
|
156
|
+
chainId: network.chainId,
|
|
131
157
|
// internal-review: redacted here rather than at a display surface, so the clear
|
|
132
158
|
// endpoint never leaves this function on the success path either.
|
|
133
159
|
rpcUrlRedacted: redactUrl(rpcUrl),
|
|
@@ -159,7 +185,7 @@ async function tempoAccountFromConfig(config) {
|
|
|
159
185
|
if (!apiKey || !isValidEvmPrivateKey(apiKey)) return null;
|
|
160
186
|
const privateKey = apiKey;
|
|
161
187
|
const address = await deriveTempoAddress(privateKey);
|
|
162
|
-
return { privateKey, address };
|
|
188
|
+
return { privateKey, address, network: config.tempo.network ?? "mainnet" };
|
|
163
189
|
}
|
|
164
190
|
function invalidTempoPrivateKey() {
|
|
165
191
|
return new DvmError(
|
|
@@ -172,6 +198,10 @@ function invalidTempoPrivateKey() {
|
|
|
172
198
|
export {
|
|
173
199
|
TEMPO_USDC_MAINNET,
|
|
174
200
|
TEMPO_CHAIN_ID,
|
|
201
|
+
TEMPO_MODERATO_CHAIN_ID,
|
|
202
|
+
TEMPO_PATH_USD_MODERATO,
|
|
203
|
+
TEMPO_MODERATO_RPC,
|
|
204
|
+
resolveTempoNetwork,
|
|
175
205
|
resolveTempoAsset,
|
|
176
206
|
tempoTokenLabel,
|
|
177
207
|
tempoTokenReference,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
msatsToUsdc,
|
|
15
15
|
usdcToMsats,
|
|
16
16
|
withinAdvertisedTolerance
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VY277ROG.js";
|
|
18
18
|
import {
|
|
19
19
|
DvmError,
|
|
20
20
|
X402_CHANNELS_FILE,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
resolveRpcHttpTransportOptions,
|
|
29
29
|
resolveRpcOverride,
|
|
30
30
|
updateConfig
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-SKKZ4OAA.js";
|
|
32
32
|
import {
|
|
33
33
|
__export,
|
|
34
34
|
__toESM
|
|
@@ -327,7 +327,7 @@ function isOptionalRecord(value) {
|
|
|
327
327
|
return value === void 0 || value === null || isRecord(value);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
330
|
+
// node_modules/@dvmkit/sdk/dist/chunk-BIP6G74V.js
|
|
331
331
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
332
332
|
import { AsyncLocalStorage } from "async_hooks";
|
|
333
333
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
@@ -4279,7 +4279,7 @@ var schnorr = /* @__PURE__ */ (() => {
|
|
|
4279
4279
|
};
|
|
4280
4280
|
})();
|
|
4281
4281
|
|
|
4282
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
4282
|
+
// node_modules/@dvmkit/sdk/dist/chunk-CGKZDODG.js
|
|
4283
4283
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
4284
4284
|
import {
|
|
4285
4285
|
appendFileSync,
|
|
@@ -4450,6 +4450,13 @@ function assertValidConfig(config, fields) {
|
|
|
4450
4450
|
const value = owner[leaf];
|
|
4451
4451
|
if (value === void 0 || !matchesKind(value, kind)) throw invalidFieldError(path, kind);
|
|
4452
4452
|
}
|
|
4453
|
+
if ((!scope || scope.has("tempo")) && isPlainObject(record.tempo) && record.tempo.network !== void 0 && record.tempo.network !== "mainnet" && record.tempo.network !== "moderato") {
|
|
4454
|
+
throw new DvmError(
|
|
4455
|
+
"config_invalid",
|
|
4456
|
+
`The caller configuration field 'tempo.network' must be 'mainnet' or 'moderato'.`,
|
|
4457
|
+
`Correct tempo.network in ${CONFIG_FILE}.${rollbackSuffix()}`
|
|
4458
|
+
);
|
|
4459
|
+
}
|
|
4453
4460
|
}
|
|
4454
4461
|
function readRawConfig() {
|
|
4455
4462
|
if (!existsSync(CONFIG_FILE)) return null;
|
|
@@ -4577,7 +4584,7 @@ var PROTECTED_FIELDS = {
|
|
|
4577
4584
|
var CONFIG_PATH_SHAPE = {
|
|
4578
4585
|
float: { statedBudget: {}, connectedAt: {}, alias: {}, methods: {} },
|
|
4579
4586
|
x402: { privateKey: {}, network: {} },
|
|
4580
|
-
tempo: { method: {}, accountId: {}, apiKey: {} },
|
|
4587
|
+
tempo: { method: {}, accountId: {}, apiKey: {}, network: {} },
|
|
4581
4588
|
credit: {
|
|
4582
4589
|
targetJobs: {},
|
|
4583
4590
|
posture: {},
|
|
@@ -117,12 +117,12 @@ import {
|
|
|
117
117
|
maxAdvertisedMicro,
|
|
118
118
|
normalizeCreditEndpoint,
|
|
119
119
|
withinAdvertisedTolerance
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-VY277ROG.js";
|
|
121
121
|
import {
|
|
122
122
|
connectedTempoAccount,
|
|
123
123
|
tempoBalanceCheckHint,
|
|
124
124
|
tempoTokenReference
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-24VB7FR7.js";
|
|
126
126
|
import {
|
|
127
127
|
DvmError,
|
|
128
128
|
IDENTITIES_FILE,
|
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
resolveRpcHttpTransportOptions,
|
|
135
135
|
resolveRpcOverride,
|
|
136
136
|
schnorr
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-SKKZ4OAA.js";
|
|
138
138
|
import {
|
|
139
139
|
privateKeyToAccount
|
|
140
140
|
} from "./chunk-EVQERRCP.js";
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
__toESM
|
|
170
170
|
} from "./chunk-IYHTITNZ.js";
|
|
171
171
|
|
|
172
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
172
|
+
// node_modules/@dvmkit/sdk/dist/chunk-TQWGQCNV.js
|
|
173
173
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
174
174
|
import { existsSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "fs";
|
|
175
175
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -4010,7 +4010,7 @@ async function charge3(store, channelId, amount) {
|
|
|
4010
4010
|
return chargeSessionChannel({ store, channelId, amount });
|
|
4011
4011
|
}
|
|
4012
4012
|
|
|
4013
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
4013
|
+
// node_modules/@dvmkit/sdk/dist/chunk-TQWGQCNV.js
|
|
4014
4014
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
4015
4015
|
var DEFAULT_LOCK_STALE_MS = 3e4;
|
|
4016
4016
|
var DEFAULT_LOCK_RETRIES = 30;
|