@dvmkit/dvm-cli 0.5.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.
- package/README.md +10 -0
- package/dist/{_esm-MN4BUYV6.js → _esm-KJAA4KAJ.js} +7 -7
- package/dist/{actions-LR65XILR.js → actions-J7VGYDBF.js} +4 -4
- package/dist/{ccip-JXYJSXTW.js → ccip-CJFG4PLA.js} +1 -1
- package/dist/{chains-LJ7XK6H3.js → chains-J6VIUNUB.js} +4 -4
- package/dist/{chunk-QICJRKB7.js → chunk-32AOWN2U.js} +11032 -12469
- package/dist/chunk-3E4LW5R5.js +77 -0
- package/dist/chunk-5RVUW52C.js +122 -0
- package/dist/{chunk-MJ4X4BEW.js → chunk-6LP4EGKA.js} +61 -61
- package/dist/chunk-6PVFVHS5.js +5460 -0
- package/dist/{chunk-BECPI5H5.js → chunk-B4WHUMZM.js} +36 -36
- package/dist/{chunk-CJTE5TS3.js → chunk-ESOJUXVY.js} +5 -5
- package/dist/{chunk-F55NNH2F.js → chunk-FOWQ7R7S.js} +16 -16
- package/dist/{chunk-ID5G54HJ.js → chunk-FPWP4S5S.js} +5 -3
- package/dist/{chunk-EE2MREOM.js → chunk-IQV4KG63.js} +5 -3
- package/dist/{chunk-R55XNXAR.js → chunk-IUTVV6N5.js} +3 -3
- package/dist/{chunk-Z4CZUMUT.js → chunk-JBU7RKQ3.js} +15 -15
- package/dist/{chunk-SHZMNEXE.js → chunk-JTMBSEZO.js} +2770 -926
- package/dist/{chunk-ERJFRCJO.js → chunk-KDNFUDOG.js} +5 -5
- package/dist/chunk-MWWZX7OQ.js +262 -0
- package/dist/chunk-PATIATFK.js +765 -0
- package/dist/{chunk-WTM2EICO.js → chunk-PUOXBKY2.js} +3 -3
- package/dist/{chunk-GZWKCIYN.js → chunk-QXMKABL7.js} +3 -3
- package/dist/chunk-R2DSAZBO.js +87 -0
- package/dist/chunk-SNSJAOR3.js +43 -0
- package/dist/{chunk-FL2ICZW5.js → chunk-SYFKO6BA.js} +3 -3
- package/dist/{chunk-LH3QPVN6.js → chunk-TAZWRWM4.js} +8060 -8058
- package/dist/chunk-VIRAAIDU.js +409 -0
- package/dist/{chunk-TZWZTS37.js → chunk-WN5R367B.js} +57 -83
- package/dist/{chunk-EZHT2RLJ.js → chunk-X7SEGALJ.js} +3 -3
- package/dist/{chunk-XHOFQ3OS.js → chunk-Y3SQD37C.js} +9 -9
- package/dist/{client-RYDA62DU.js → client-6IHIUB6J.js} +10 -10
- package/dist/client-VHGN7ZFZ.js +36 -0
- package/dist/{dist-GKCEIY2A.js → dist-23E7OOCA.js} +9 -9
- package/dist/dvm.js +2844 -623
- package/dist/{internal-INUTGTXQ.js → internal-7RZYJLLG.js} +325 -508
- package/dist/lifecycle-Z7YUOTR5.js +36 -0
- package/dist/{payout-reporter-3Y2U55ZX-CMKACKA3.js → payout-reporter-WT7XYW42-U2QPDIYC.js} +3 -2
- package/dist/{pocket-refill-K5T4LZF6.js → pocket-refill-CCWF3G4N.js} +33 -30
- package/dist/{revenue-reporter-MAERPYGK-CCPZXGFA.js → revenue-reporter-7UR3W2SD-C5OMRGK3.js} +3 -2
- package/dist/{tempo-AXTE4ZEA.js → tempo-ORFVGUKP.js} +10 -10
- package/dist/tempo-lifecycle-OT75TYVA.js +38 -0
- package/dist/tempo-wallet-SGYOEWVY.js +43 -0
- package/dist/wallet-BRXTQ4BB.js +45 -0
- package/dist/{x402-R6HPBY5D-VMSW7Z32.js → x402-ZU4GML7Z-RYEACIIT.js} +4 -19
- package/package.json +4 -2
- package/skills/dvm/credit.md +4 -0
- package/skills/dvm/wallets.md +4 -0
- package/dist/chunk-3YE43JJR.js +0 -215
- package/dist/chunk-4KINCBHL.js +0 -5153
- package/dist/chunk-FSYEZERJ.js +0 -1667
- package/dist/chunk-VOO5IAK7.js +0 -2318
- package/dist/tempo-lifecycle-ZBBLFBMH-HWI4PLYP.js +0 -32
- package/dist/tempo-wallet-B5XXV3YH-SRQBMYFV.js +0 -41
|
@@ -3,15 +3,15 @@ import { createRequire as __dvmCreateRequire } from "node:module";
|
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
Base64_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X7SEGALJ.js";
|
|
7
7
|
import {
|
|
8
8
|
Hash_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TAZWRWM4.js";
|
|
10
10
|
import {
|
|
11
11
|
Bytes_exports,
|
|
12
12
|
Hex_exports,
|
|
13
13
|
Json_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FOWQ7R7S.js";
|
|
15
15
|
import {
|
|
16
16
|
__export
|
|
17
17
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -37,11 +37,11 @@ import {
|
|
|
37
37
|
receiptStatuses,
|
|
38
38
|
sendTransaction,
|
|
39
39
|
uninstallFilter,
|
|
40
|
-
|
|
40
|
+
verifyHash,
|
|
41
41
|
withRetry,
|
|
42
42
|
writeContract,
|
|
43
43
|
writeContractSync
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-TAZWRWM4.js";
|
|
45
45
|
import {
|
|
46
46
|
getTransactionCount,
|
|
47
47
|
getTypesForEIP712Domain,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
universalResolverResolveAbi,
|
|
82
82
|
universalResolverReverseAbi,
|
|
83
83
|
withResolvers
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-FOWQ7R7S.js";
|
|
85
85
|
import {
|
|
86
86
|
AbiDecodingZeroDataError,
|
|
87
87
|
BaseError,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __dvmCreateRequire } from "node:module";
|
|
3
|
+
const require = __dvmCreateRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
// node_modules/@dvmkit/sdk/dist/chunk-COYKJRMM.js
|
|
6
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
7
|
+
var SDK_INIT_ADVISORY_LOCK = 17320927;
|
|
8
|
+
async function withSdkInitLock(db, fn) {
|
|
9
|
+
const context = activeInits.getStore();
|
|
10
|
+
if (context?.get(db)?.active) return fn();
|
|
11
|
+
assertPoolFitsLock(db);
|
|
12
|
+
let holder = holders.get(db);
|
|
13
|
+
if (holder) {
|
|
14
|
+
holder.refs += 1;
|
|
15
|
+
} else {
|
|
16
|
+
holder = { refs: 1, acquired: acquire(db), tail: Promise.resolve() };
|
|
17
|
+
holders.set(db, holder);
|
|
18
|
+
}
|
|
19
|
+
const predecessor = holder.tail;
|
|
20
|
+
let finishTurn;
|
|
21
|
+
holder.tail = new Promise((resolve) => {
|
|
22
|
+
finishTurn = resolve;
|
|
23
|
+
});
|
|
24
|
+
let guardedFailed = false;
|
|
25
|
+
try {
|
|
26
|
+
await holder.acquired;
|
|
27
|
+
await predecessor;
|
|
28
|
+
const token = { active: true };
|
|
29
|
+
const nextContext = new Map(context);
|
|
30
|
+
nextContext.set(db, token);
|
|
31
|
+
try {
|
|
32
|
+
return await activeInits.run(nextContext, fn);
|
|
33
|
+
} finally {
|
|
34
|
+
token.active = false;
|
|
35
|
+
}
|
|
36
|
+
} catch (err) {
|
|
37
|
+
guardedFailed = true;
|
|
38
|
+
throw err;
|
|
39
|
+
} finally {
|
|
40
|
+
try {
|
|
41
|
+
await releaseHolder(db, holder, guardedFailed);
|
|
42
|
+
} finally {
|
|
43
|
+
finishTurn();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var holders = /* @__PURE__ */ new WeakMap();
|
|
48
|
+
var activeInits = new AsyncLocalStorage();
|
|
49
|
+
function assertPoolFitsLock(db) {
|
|
50
|
+
const max = db.options?.max;
|
|
51
|
+
if (max === void 0 || max >= 2) return;
|
|
52
|
+
throw new Error(
|
|
53
|
+
`withSdkInitLock: the SDK boot lock needs a pool that allows at least 2 connections (got max=${max}). The lock is held on one pinned client while the guarded DDL runs on another, so boot would hang forever.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
async function acquire(db) {
|
|
57
|
+
const client = await db.connect();
|
|
58
|
+
try {
|
|
59
|
+
await client.query(`SELECT pg_advisory_lock(${SDK_INIT_ADVISORY_LOCK})`);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
client.release();
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
return client;
|
|
65
|
+
}
|
|
66
|
+
async function releaseHolder(db, holder, guardedFailed) {
|
|
67
|
+
holder.refs -= 1;
|
|
68
|
+
if (holder.refs > 0) return;
|
|
69
|
+
holders.delete(db);
|
|
70
|
+
let client;
|
|
71
|
+
try {
|
|
72
|
+
client = await holder.acquired;
|
|
73
|
+
} catch {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
await client.query(`SELECT pg_advisory_unlock(${SDK_INIT_ADVISORY_LOCK})`);
|
|
78
|
+
client.release();
|
|
79
|
+
} catch (err) {
|
|
80
|
+
client.release(err instanceof Error ? err : new Error(String(err)));
|
|
81
|
+
if (!guardedFailed) throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
withSdkInitLock
|
|
87
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __dvmCreateRequire } from "node:module";
|
|
3
|
+
const require = __dvmCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
formatUsdcMicrounits,
|
|
6
|
+
listX402Channels,
|
|
7
|
+
readX402ChannelGuardFacts
|
|
8
|
+
} from "./chunk-32AOWN2U.js";
|
|
9
|
+
import {
|
|
10
|
+
DvmError
|
|
11
|
+
} from "./chunk-JTMBSEZO.js";
|
|
12
|
+
|
|
13
|
+
// src/lib/x402/lifecycle.ts
|
|
14
|
+
async function assertX402WalletIdle(wallet, intent) {
|
|
15
|
+
const payerAddress = wallet.address;
|
|
16
|
+
const owned = listX402Channels({ payer: payerAddress });
|
|
17
|
+
const clients = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const channel of owned) {
|
|
19
|
+
const state = await readX402ChannelGuardFacts({ channel, configuredNetwork: wallet.network, clients });
|
|
20
|
+
if (state.balance === 0n && state.pendingWithdrawal === 0n) continue;
|
|
21
|
+
throw new DvmError(
|
|
22
|
+
"x402_wallet_in_use",
|
|
23
|
+
state.balance > 0n ? `The connected x402 wallet still holds ${formatUsdcMicrounits(state.balance)} USDC in an open channel with ${channel.endpoint}.` : `The connected x402 wallet has a timed withdrawal of ${formatUsdcMicrounits(state.pendingWithdrawal)} USDC still in flight on its channel with ${channel.endpoint}.`,
|
|
24
|
+
`Only this key can move those funds. Empty the channel first \u2014 'dvm credit drain' for the cooperative exit, or 'dvm wallet x402-withdraw-initiate --channel-id ${channel.channelId}' and then finalize after the delay \u2014 and ${intentClause(intent)}.`,
|
|
25
|
+
{
|
|
26
|
+
anchor: "x402_channel_live",
|
|
27
|
+
address: payerAddress,
|
|
28
|
+
channel_id: channel.channelId,
|
|
29
|
+
endpoint: channel.endpoint,
|
|
30
|
+
network: channel.network,
|
|
31
|
+
balance_micro: state.balance.toString(),
|
|
32
|
+
pending_withdrawal_micro: state.pendingWithdrawal.toString()
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function intentClause(intent) {
|
|
38
|
+
return intent === "replace" ? "retry the replacement" : "retry 'dvm wallet x402-disconnect'";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
assertX402WalletIdle
|
|
43
|
+
};
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
signature,
|
|
19
19
|
string,
|
|
20
20
|
transform
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PUOXBKY2.js";
|
|
22
22
|
import {
|
|
23
23
|
Hash_exports,
|
|
24
24
|
parseUnits
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TAZWRWM4.js";
|
|
26
26
|
import {
|
|
27
27
|
Bytes_exports
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-FOWQ7R7S.js";
|
|
29
29
|
import {
|
|
30
30
|
getAddress
|
|
31
31
|
} from "./chunk-MLDUKBU3.js";
|