@gvnrdao/dh-mcp 0.5.4 → 0.5.6
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/boundary.js +344 -71
- package/dist/connector-embed.js +344 -71
- package/dist/connector.js +344 -71
- package/dist/index.js +344 -71
- package/package.json +2 -2
package/dist/boundary.js
CHANGED
|
@@ -14460,7 +14460,7 @@ var require_pkg_src = __commonJS({
|
|
|
14460
14460
|
description: "Production Btc Transaction Signer",
|
|
14461
14461
|
version: "1.1.1",
|
|
14462
14462
|
deployed: true,
|
|
14463
|
-
deployedAt:
|
|
14463
|
+
deployedAt: 1786465606156,
|
|
14464
14464
|
size: 67999,
|
|
14465
14465
|
hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
|
|
14466
14466
|
},
|
|
@@ -14473,7 +14473,7 @@ var require_pkg_src = __commonJS({
|
|
|
14473
14473
|
description: "Production Ucd Mint Validator",
|
|
14474
14474
|
version: "1.2.1",
|
|
14475
14475
|
deployed: true,
|
|
14476
|
-
deployedAt:
|
|
14476
|
+
deployedAt: 1786465627201,
|
|
14477
14477
|
size: 82739,
|
|
14478
14478
|
hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
|
|
14479
14479
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -14491,7 +14491,7 @@ var require_pkg_src = __commonJS({
|
|
|
14491
14491
|
description: "Production Process Payment Validator",
|
|
14492
14492
|
version: "1.2.1",
|
|
14493
14493
|
deployed: true,
|
|
14494
|
-
deployedAt:
|
|
14494
|
+
deployedAt: 1786465654796,
|
|
14495
14495
|
size: 78736,
|
|
14496
14496
|
hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
|
|
14497
14497
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -14509,7 +14509,7 @@ var require_pkg_src = __commonJS({
|
|
|
14509
14509
|
description: "Production Extend Position Validator",
|
|
14510
14510
|
version: "1.2.1",
|
|
14511
14511
|
deployed: true,
|
|
14512
|
-
deployedAt:
|
|
14512
|
+
deployedAt: 1786465681874,
|
|
14513
14513
|
size: 76515,
|
|
14514
14514
|
hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
|
|
14515
14515
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -14519,21 +14519,17 @@ var require_pkg_src = __commonJS({
|
|
|
14519
14519
|
}
|
|
14520
14520
|
},
|
|
14521
14521
|
btcWithdrawal: {
|
|
14522
|
-
cid: "
|
|
14522
|
+
cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
|
|
14523
14523
|
authorizedCidHex: cidToHex(
|
|
14524
|
-
"
|
|
14524
|
+
"QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
|
|
14525
14525
|
),
|
|
14526
14526
|
name: "Btc Withdrawal",
|
|
14527
14527
|
description: "Production Btc Withdrawal",
|
|
14528
|
-
|
|
14529
|
-
// stamped its cohort 1.2.1, but this action was already at 1.2.3 from the vout
|
|
14530
|
-
// canonicalization fix. Reusing the cohort stamp made a newer CID read as older
|
|
14531
|
-
// than the one it replaced, which a rotation ceremony would treat as a rollback.
|
|
14532
|
-
version: "1.2.4",
|
|
14528
|
+
version: "1.2.7",
|
|
14533
14529
|
deployed: true,
|
|
14534
|
-
deployedAt:
|
|
14535
|
-
size:
|
|
14536
|
-
hash: "
|
|
14530
|
+
deployedAt: 1786446046614,
|
|
14531
|
+
size: 97456,
|
|
14532
|
+
hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
|
|
14537
14533
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
14538
14534
|
pkp: {
|
|
14539
14535
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -14645,19 +14641,17 @@ var require_pkg_src = __commonJS({
|
|
|
14645
14641
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
14646
14642
|
},
|
|
14647
14643
|
agentModuleExecutor: {
|
|
14648
|
-
|
|
14649
|
-
// holds this action and no PKPs until an agent is minted into it. NOT yet
|
|
14650
|
-
// bound on mainnet — the Base `DH-Agent-Mainnet` group is created at rollout.
|
|
14651
|
-
cid: "QmVgjGXUuxoGf8XyddW8a7btaazT9yEotpKoBgb65oPvcF",
|
|
14644
|
+
cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
|
|
14652
14645
|
authorizedCidHex: cidToHex(
|
|
14653
|
-
"
|
|
14646
|
+
"QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
|
|
14654
14647
|
),
|
|
14655
14648
|
name: "Agent Module Executor",
|
|
14656
|
-
description: "
|
|
14657
|
-
version: "1.
|
|
14649
|
+
description: "Production Agent Module Executor",
|
|
14650
|
+
version: "1.1.1",
|
|
14658
14651
|
deployed: true,
|
|
14659
|
-
|
|
14660
|
-
|
|
14652
|
+
deployedAt: 1786446108348,
|
|
14653
|
+
size: 11655,
|
|
14654
|
+
hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
|
|
14661
14655
|
},
|
|
14662
14656
|
staleSpendRecoveryValidator: {
|
|
14663
14657
|
cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
|
|
@@ -14686,7 +14680,7 @@ var require_pkg_src = __commonJS({
|
|
|
14686
14680
|
description: "Production Btc Utxo Invalidator",
|
|
14687
14681
|
version: "1.0.0",
|
|
14688
14682
|
deployed: true,
|
|
14689
|
-
deployedAt:
|
|
14683
|
+
deployedAt: 1786465704240,
|
|
14690
14684
|
size: 62553,
|
|
14691
14685
|
hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
|
|
14692
14686
|
}
|
|
@@ -23452,6 +23446,7 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23452
23446
|
exports2.fetchLitActionCodeFromIpfs = fetchLitActionCodeFromIpfs;
|
|
23453
23447
|
var axios_1 = __importDefault(require_axios());
|
|
23454
23448
|
var ipfsCodeCache = /* @__PURE__ */ new Map();
|
|
23449
|
+
var GATEWAY_TIMEOUT_MS = 2e4;
|
|
23455
23450
|
var buildGatewayList = (cid, pinataJwt) => {
|
|
23456
23451
|
const gateways = [];
|
|
23457
23452
|
if (pinataJwt) {
|
|
@@ -23460,7 +23455,7 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23460
23455
|
headers: { Authorization: `Bearer ${pinataJwt}` }
|
|
23461
23456
|
});
|
|
23462
23457
|
}
|
|
23463
|
-
gateways.push({ url: `https://${cid}.ipfs.dweb.link/` }, { url: `https://dweb.link/ipfs/${cid}` }, { url: `https://ipfs.io/ipfs/${cid}` }, { url: `https://gateway.pinata.cloud/ipfs/${cid}` }
|
|
23458
|
+
gateways.push({ url: `https://${cid}.ipfs.dweb.link/` }, { url: `https://dweb.link/ipfs/${cid}` }, { url: `https://ipfs.io/ipfs/${cid}` }, { url: `https://gateway.pinata.cloud/ipfs/${cid}` });
|
|
23464
23459
|
return gateways;
|
|
23465
23460
|
};
|
|
23466
23461
|
async function fetchLitActionCodeFromIpfs(cid, options = {}) {
|
|
@@ -23474,13 +23469,14 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23474
23469
|
const pinataJwt = options.pinataJwt ?? process.env.PINATA_JWT;
|
|
23475
23470
|
const extraGateways = options.extraGateways?.map((t) => ({ url: t.replace("{cid}", cid) })) ?? [];
|
|
23476
23471
|
const gateways = [...extraGateways, ...buildGatewayList(cid, pinataJwt)];
|
|
23472
|
+
const failures = [];
|
|
23477
23473
|
for (const gateway of gateways) {
|
|
23478
23474
|
try {
|
|
23479
23475
|
if (options.debug) {
|
|
23480
23476
|
console.log(`\u{1F4E1} [fetchLitActionCodeFromIpfs] Trying ${gateway.url}...`);
|
|
23481
23477
|
}
|
|
23482
23478
|
const response = await axios_1.default.get(gateway.url, {
|
|
23483
|
-
timeout:
|
|
23479
|
+
timeout: GATEWAY_TIMEOUT_MS,
|
|
23484
23480
|
headers: {
|
|
23485
23481
|
Accept: "text/plain, application/javascript, text/javascript",
|
|
23486
23482
|
...gateway.headers
|
|
@@ -23493,13 +23489,17 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23493
23489
|
ipfsCodeCache.set(cid, response.data);
|
|
23494
23490
|
return response.data;
|
|
23495
23491
|
}
|
|
23492
|
+
failures.push(`${gateway.url}: HTTP ${response.status} returned ${typeof response.data}, expected string`);
|
|
23496
23493
|
} catch (error) {
|
|
23494
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23495
|
+
failures.push(`${gateway.url}: ${message}`);
|
|
23497
23496
|
if (options.debug) {
|
|
23498
|
-
console.log(`\u274C [fetchLitActionCodeFromIpfs] ${gateway.url}:`,
|
|
23497
|
+
console.log(`\u274C [fetchLitActionCodeFromIpfs] ${gateway.url}:`, message);
|
|
23499
23498
|
}
|
|
23500
23499
|
}
|
|
23501
23500
|
}
|
|
23502
|
-
throw new Error(`Failed to fetch LIT Action from IPFS CID: ${cid}
|
|
23501
|
+
throw new Error(`Failed to fetch LIT Action from IPFS CID: ${cid} \u2014 all ${gateways.length} gateway(s) failed:
|
|
23502
|
+
` + failures.map((f) => ` - ${f}`).join("\n"));
|
|
23503
23503
|
}
|
|
23504
23504
|
}
|
|
23505
23505
|
});
|
|
@@ -50794,6 +50794,14 @@ var init_deployment_addresses = __esm2({
|
|
|
50794
50794
|
reason: "2026-08 agent-stack release. The mainnet PositionManagerViews at 0x9225647a was deployed as a BARE implementation (EIP-1967 slot 0x00), so upgradeToAndCall reverts UUPSUnauthorizedCallContext \u2014 it could never be upgraded. PositionManager.setViews (added in the same Execute B batch) removed the repoint blocker, so Views was replaced behind a new proxy rather than upgraded. This makes the Pashov F3 renewal debt-ceiling check REACHABLE for the first time: ExceedsMaxLoan (0x499e7985) is present in 0xE68DC096 and absent from 0x9225647a. Views holds no protocol state (8 wiring slots + roles + pause), which is what made replacement safe. The old contract is ABANDONED, not decommissioned \u2014 it stays live and callable as the rollback target for setViews. NOTE: VERSION reads 1.1.1 on both sides; verify by address.",
|
|
50795
50795
|
executeTx: "0xf1f8d5fc13f45d7a3f932bf1a2d6e29381fdd41cd31298ad785bf7688df07fe6",
|
|
50796
50796
|
block: 25673200
|
|
50797
|
+
},
|
|
50798
|
+
AgentDelegationRegistry: {
|
|
50799
|
+
newImplementation: "0xa9fF405Edd4329fc3159a64F56B37EBD253e4928",
|
|
50800
|
+
upgradedAt: "2026-07-31T22:03:35.000Z",
|
|
50801
|
+
upgradedBy: "AdminModule/Safe audit-batch upgradeToAndCall; executed by 0xEba7BfAeB35ee18408b424Ee0BB45AdDf776589f in tx 0x8fed0ab7eee3aaaa3792a35b40b0ef74bd09cfb1a175934afd846bee546048d4 (block 25655710)",
|
|
50802
|
+
reason: "Reconciled from chain \u2014 mainnet audit rollout batch (cross-ref onchain-auth/.safe-batches/mainnet-audit-execute.json)",
|
|
50803
|
+
executeTx: "0x8fed0ab7eee3aaaa3792a35b40b0ef74bd09cfb1a175934afd846bee546048d4",
|
|
50804
|
+
block: 25655710
|
|
50797
50805
|
}
|
|
50798
50806
|
},
|
|
50799
50807
|
latestEnv: {
|
|
@@ -51609,7 +51617,7 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51609
51617
|
description: "Production Btc Transaction Signer",
|
|
51610
51618
|
version: "1.1.1",
|
|
51611
51619
|
deployed: true,
|
|
51612
|
-
deployedAt:
|
|
51620
|
+
deployedAt: 1786465606156,
|
|
51613
51621
|
size: 67999,
|
|
51614
51622
|
hash: "83f3644c68819215e05ba8db3225571354a009458fc1437f606df6cb9142d3f9"
|
|
51615
51623
|
},
|
|
@@ -51622,7 +51630,7 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51622
51630
|
description: "Production Ucd Mint Validator",
|
|
51623
51631
|
version: "1.2.1",
|
|
51624
51632
|
deployed: true,
|
|
51625
|
-
deployedAt:
|
|
51633
|
+
deployedAt: 1786465627201,
|
|
51626
51634
|
size: 82739,
|
|
51627
51635
|
hash: "2bdd9aebdaad58a43a4731d5b7284f2531b7a9caaf8caf5719d891c4ed33cb2e",
|
|
51628
51636
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -51640,7 +51648,7 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51640
51648
|
description: "Production Process Payment Validator",
|
|
51641
51649
|
version: "1.2.1",
|
|
51642
51650
|
deployed: true,
|
|
51643
|
-
deployedAt:
|
|
51651
|
+
deployedAt: 1786465654796,
|
|
51644
51652
|
size: 78736,
|
|
51645
51653
|
hash: "17191ecc9c009e0fa5ab52c876330beb2a9a75d30cccb92e7c0c04f169df088b",
|
|
51646
51654
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -51658,7 +51666,7 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51658
51666
|
description: "Production Extend Position Validator",
|
|
51659
51667
|
version: "1.2.1",
|
|
51660
51668
|
deployed: true,
|
|
51661
|
-
deployedAt:
|
|
51669
|
+
deployedAt: 1786465681874,
|
|
51662
51670
|
size: 76515,
|
|
51663
51671
|
hash: "1d4e085335af80f194a663a577876902c83015177e95906a0b461fa93bd5da08",
|
|
51664
51672
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
@@ -51668,21 +51676,17 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51668
51676
|
}
|
|
51669
51677
|
},
|
|
51670
51678
|
btcWithdrawal: {
|
|
51671
|
-
cid: "
|
|
51679
|
+
cid: "QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh",
|
|
51672
51680
|
authorizedCidHex: cidToHex(
|
|
51673
|
-
"
|
|
51681
|
+
"QmRYVoTTDxk2McvBqxSm9M7YcaBGdTqjnZGPX4Y191DaZh"
|
|
51674
51682
|
),
|
|
51675
51683
|
name: "Btc Withdrawal",
|
|
51676
51684
|
description: "Production Btc Withdrawal",
|
|
51677
|
-
|
|
51678
|
-
// stamped its cohort 1.2.1, but this action was already at 1.2.3 from the vout
|
|
51679
|
-
// canonicalization fix. Reusing the cohort stamp made a newer CID read as older
|
|
51680
|
-
// than the one it replaced, which a rotation ceremony would treat as a rollback.
|
|
51681
|
-
version: "1.2.4",
|
|
51685
|
+
version: "1.2.7",
|
|
51682
51686
|
deployed: true,
|
|
51683
|
-
deployedAt:
|
|
51684
|
-
size:
|
|
51685
|
-
hash: "
|
|
51687
|
+
deployedAt: 1786446046614,
|
|
51688
|
+
size: 97456,
|
|
51689
|
+
hash: "3cae8250861832f91ee3c573abeb50ff27b9acd34148176071cbfbabb359fc91",
|
|
51686
51690
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
51687
51691
|
pkp: {
|
|
51688
51692
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -51794,19 +51798,17 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51794
51798
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
51795
51799
|
},
|
|
51796
51800
|
agentModuleExecutor: {
|
|
51797
|
-
|
|
51798
|
-
// holds this action and no PKPs until an agent is minted into it. NOT yet
|
|
51799
|
-
// bound on mainnet — the Base `DH-Agent-Mainnet` group is created at rollout.
|
|
51800
|
-
cid: "QmVgjGXUuxoGf8XyddW8a7btaazT9yEotpKoBgb65oPvcF",
|
|
51801
|
+
cid: "QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ",
|
|
51801
51802
|
authorizedCidHex: cidToHex(
|
|
51802
|
-
"
|
|
51803
|
+
"QmdhC18wF7PFGMQ8aThdPsEVSpuDewA27dFvbA3bG6kVDQ"
|
|
51803
51804
|
),
|
|
51804
51805
|
name: "Agent Module Executor",
|
|
51805
|
-
description: "
|
|
51806
|
-
version: "1.
|
|
51806
|
+
description: "Production Agent Module Executor",
|
|
51807
|
+
version: "1.1.1",
|
|
51807
51808
|
deployed: true,
|
|
51808
|
-
|
|
51809
|
-
|
|
51809
|
+
deployedAt: 1786446108348,
|
|
51810
|
+
size: 11655,
|
|
51811
|
+
hash: "d4e2149f843d6c2699fc61114d54b268ba4ed2c46ebdaee1145e0f101ec2a1ec"
|
|
51810
51812
|
},
|
|
51811
51813
|
staleSpendRecoveryValidator: {
|
|
51812
51814
|
cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
|
|
@@ -51835,7 +51837,7 @@ var require_pkg_src2 = __commonJS2({
|
|
|
51835
51837
|
description: "Production Btc Utxo Invalidator",
|
|
51836
51838
|
version: "1.0.0",
|
|
51837
51839
|
deployed: true,
|
|
51838
|
-
deployedAt:
|
|
51840
|
+
deployedAt: 1786465704240,
|
|
51839
51841
|
size: 62553,
|
|
51840
51842
|
hash: "1dcea2b49e545c423195be22e072dc5e3039ed1c95a8490b23505956029f5b33"
|
|
51841
51843
|
}
|
|
@@ -62079,6 +62081,169 @@ function normalizePkpId2(pkpId) {
|
|
|
62079
62081
|
}
|
|
62080
62082
|
return pkpId;
|
|
62081
62083
|
}
|
|
62084
|
+
function hasLoanEventsFilter(filter2) {
|
|
62085
|
+
if (!filter2)
|
|
62086
|
+
return false;
|
|
62087
|
+
return filter2.eventTypes !== void 0 || filter2.fromTimestamp !== void 0 || filter2.toTimestamp !== void 0 || filter2.fromBlock !== void 0 || filter2.toBlock !== void 0 || filter2.limit !== void 0 || filter2.orderDirection !== void 0;
|
|
62088
|
+
}
|
|
62089
|
+
var WALLET_LOAN_EVENTS_QUERY = `
|
|
62090
|
+
query GetWalletLoanEvents($borrower: Bytes!, $first: Int!, $limit: Int!, $orderDirection: OrderDirection!) {
|
|
62091
|
+
positions(where: { borrower: $borrower }, first: $first, orderBy: id) {
|
|
62092
|
+
id
|
|
62093
|
+
payments(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62094
|
+
id
|
|
62095
|
+
payer { id }
|
|
62096
|
+
amount
|
|
62097
|
+
type
|
|
62098
|
+
transactionHash
|
|
62099
|
+
timestamp
|
|
62100
|
+
blockNumber
|
|
62101
|
+
logIndex
|
|
62102
|
+
newDebt
|
|
62103
|
+
newCollateralRatio
|
|
62104
|
+
}
|
|
62105
|
+
statusUpdates(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62106
|
+
id
|
|
62107
|
+
oldStatus
|
|
62108
|
+
newStatus
|
|
62109
|
+
reason
|
|
62110
|
+
timestamp
|
|
62111
|
+
blockNumber
|
|
62112
|
+
transactionHash
|
|
62113
|
+
}
|
|
62114
|
+
liquidation {
|
|
62115
|
+
id
|
|
62116
|
+
liquidator
|
|
62117
|
+
liquidatedAmount
|
|
62118
|
+
collateralSeized
|
|
62119
|
+
transactionHash
|
|
62120
|
+
timestamp
|
|
62121
|
+
blockNumber
|
|
62122
|
+
commitHash
|
|
62123
|
+
commitTimestamp
|
|
62124
|
+
revealDelay
|
|
62125
|
+
}
|
|
62126
|
+
withdrawals(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62127
|
+
id
|
|
62128
|
+
withdrawalAmount
|
|
62129
|
+
withdrawalAddress
|
|
62130
|
+
networkFee
|
|
62131
|
+
timestamp
|
|
62132
|
+
blockNumber
|
|
62133
|
+
transactionHash
|
|
62134
|
+
logIndex
|
|
62135
|
+
}
|
|
62136
|
+
renewals(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62137
|
+
id
|
|
62138
|
+
extensionTerm
|
|
62139
|
+
extensionFee
|
|
62140
|
+
newExpiryDate
|
|
62141
|
+
timestamp
|
|
62142
|
+
blockNumber
|
|
62143
|
+
transactionHash
|
|
62144
|
+
logIndex
|
|
62145
|
+
}
|
|
62146
|
+
operationFailures(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62147
|
+
id
|
|
62148
|
+
operationType
|
|
62149
|
+
reason
|
|
62150
|
+
errorCode
|
|
62151
|
+
amount
|
|
62152
|
+
timestamp
|
|
62153
|
+
blockNumber
|
|
62154
|
+
transactionHash
|
|
62155
|
+
logIndex
|
|
62156
|
+
}
|
|
62157
|
+
mintRequests(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62158
|
+
id
|
|
62159
|
+
pkpId
|
|
62160
|
+
borrower { id }
|
|
62161
|
+
mintAmount
|
|
62162
|
+
originationFee
|
|
62163
|
+
newDebt
|
|
62164
|
+
newCollateralRatio
|
|
62165
|
+
btcPrice
|
|
62166
|
+
quantumTimestamp
|
|
62167
|
+
opId
|
|
62168
|
+
timestamp
|
|
62169
|
+
blockNumber
|
|
62170
|
+
transactionHash
|
|
62171
|
+
logIndex
|
|
62172
|
+
}
|
|
62173
|
+
burnRequests(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62174
|
+
id
|
|
62175
|
+
pkpId
|
|
62176
|
+
borrower { id }
|
|
62177
|
+
burnAmount
|
|
62178
|
+
remainingDebt
|
|
62179
|
+
newCollateralRatio
|
|
62180
|
+
opId
|
|
62181
|
+
timestamp
|
|
62182
|
+
blockNumber
|
|
62183
|
+
transactionHash
|
|
62184
|
+
logIndex
|
|
62185
|
+
}
|
|
62186
|
+
mintingFees(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62187
|
+
id
|
|
62188
|
+
borrower { id }
|
|
62189
|
+
feeAmount
|
|
62190
|
+
mintAmount
|
|
62191
|
+
newDebt
|
|
62192
|
+
btcPrice
|
|
62193
|
+
quantumTimestamp
|
|
62194
|
+
timestamp
|
|
62195
|
+
blockNumber
|
|
62196
|
+
transactionHash
|
|
62197
|
+
logIndex
|
|
62198
|
+
}
|
|
62199
|
+
renewalFees(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62200
|
+
id
|
|
62201
|
+
borrower { id }
|
|
62202
|
+
feeAmount
|
|
62203
|
+
extensionTerm
|
|
62204
|
+
newExpiryDate
|
|
62205
|
+
timestamp
|
|
62206
|
+
blockNumber
|
|
62207
|
+
transactionHash
|
|
62208
|
+
logIndex
|
|
62209
|
+
}
|
|
62210
|
+
positionCreatedEvents(first: 1, orderBy: timestamp, orderDirection: asc) {
|
|
62211
|
+
id
|
|
62212
|
+
pkpId
|
|
62213
|
+
borrower { id }
|
|
62214
|
+
requestedCollateralRatio
|
|
62215
|
+
selectedTerm
|
|
62216
|
+
expiryAt
|
|
62217
|
+
timestamp
|
|
62218
|
+
blockNumber
|
|
62219
|
+
transactionHash
|
|
62220
|
+
}
|
|
62221
|
+
}
|
|
62222
|
+
ucdmintEvents(where: { position_: { borrower: $borrower } }, first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62223
|
+
id
|
|
62224
|
+
position { id }
|
|
62225
|
+
amount
|
|
62226
|
+
proof
|
|
62227
|
+
minter { id }
|
|
62228
|
+
isCommunityMint
|
|
62229
|
+
timestamp
|
|
62230
|
+
blockNumber
|
|
62231
|
+
transactionHash
|
|
62232
|
+
}
|
|
62233
|
+
collateralEvents(where: { position_: { borrower: $borrower } }, first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62234
|
+
id
|
|
62235
|
+
position { id }
|
|
62236
|
+
eventType
|
|
62237
|
+
networkFee
|
|
62238
|
+
remainingCollateral
|
|
62239
|
+
collateralRatio
|
|
62240
|
+
timestamp
|
|
62241
|
+
blockNumber
|
|
62242
|
+
transactionHash
|
|
62243
|
+
logIndex
|
|
62244
|
+
}
|
|
62245
|
+
}
|
|
62246
|
+
`;
|
|
62082
62247
|
var DiamondHandsGraph = class {
|
|
62083
62248
|
client;
|
|
62084
62249
|
defaultPageSize;
|
|
@@ -62184,7 +62349,7 @@ var DiamondHandsGraph = class {
|
|
|
62184
62349
|
/**
|
|
62185
62350
|
* Get user positions from subgraph
|
|
62186
62351
|
*/
|
|
62187
|
-
async
|
|
62352
|
+
async getUserPositionsOnly(userAddress, first, skip, orderBy, orderDirection) {
|
|
62188
62353
|
const query = `
|
|
62189
62354
|
query GetUserPositions($borrower: Bytes!, $first: Int, $skip: Int, $orderBy: Position_orderBy, $orderDirection: OrderDirection) {
|
|
62190
62355
|
user(id: $borrower) {
|
|
@@ -62225,17 +62390,28 @@ var DiamondHandsGraph = class {
|
|
|
62225
62390
|
query,
|
|
62226
62391
|
variables
|
|
62227
62392
|
);
|
|
62228
|
-
const total = await this.getTotalCountPaginated("{ borrower: $borrower }", {
|
|
62229
|
-
borrower: userAddress.toLowerCase()
|
|
62230
|
-
});
|
|
62231
62393
|
let positions = [];
|
|
62232
62394
|
if (result && result.user && Array.isArray(result.user.positions)) {
|
|
62233
62395
|
positions = result.user.positions.filter((p) => p != null).map((p) => this.transformGraphPositionToLoanData(p));
|
|
62234
62396
|
}
|
|
62235
|
-
return
|
|
62236
|
-
|
|
62237
|
-
|
|
62238
|
-
|
|
62397
|
+
return positions;
|
|
62398
|
+
}
|
|
62399
|
+
/**
|
|
62400
|
+
* Get user positions, plus an accurate total count.
|
|
62401
|
+
*
|
|
62402
|
+
* The count is a SECOND round trip (`getTotalCountPaginated`, which pages to handle
|
|
62403
|
+
* >1000 items). Callers that only need the rows should use `getUserPositionsOnly` and
|
|
62404
|
+
* skip it — the event paths did not, and paid for a count they immediately discarded on
|
|
62405
|
+
* every activity refresh.
|
|
62406
|
+
*/
|
|
62407
|
+
async getUserPositions(userAddress, first, skip, orderBy, orderDirection) {
|
|
62408
|
+
const [positions, total] = await Promise.all([
|
|
62409
|
+
this.getUserPositionsOnly(userAddress, first, skip, orderBy, orderDirection),
|
|
62410
|
+
this.getTotalCountPaginated("{ borrower: $borrower }", {
|
|
62411
|
+
borrower: userAddress.toLowerCase()
|
|
62412
|
+
})
|
|
62413
|
+
]);
|
|
62414
|
+
return { positions, total };
|
|
62239
62415
|
}
|
|
62240
62416
|
/**
|
|
62241
62417
|
* Get user positions with enriched Bitcoin balance data
|
|
@@ -63326,6 +63502,16 @@ var DiamondHandsGraph = class {
|
|
|
63326
63502
|
orderDirection
|
|
63327
63503
|
};
|
|
63328
63504
|
const result = await this.client.execute(query, variables);
|
|
63505
|
+
return this.assembleLoanEvents(positionId, result);
|
|
63506
|
+
}
|
|
63507
|
+
/**
|
|
63508
|
+
* Map one position's raw event payload into `LoanEvents`.
|
|
63509
|
+
*
|
|
63510
|
+
* Extracted verbatim from getLoanEvents so the wallet-collapsed path produces
|
|
63511
|
+
* byte-identical objects by construction rather than by a second implementation
|
|
63512
|
+
* that has to be kept in step by hand.
|
|
63513
|
+
*/
|
|
63514
|
+
assembleLoanEvents(positionId, result) {
|
|
63329
63515
|
const rawCreated = result.positionCreatedEvents?.[0];
|
|
63330
63516
|
const positionCreated = rawCreated ? {
|
|
63331
63517
|
id: rawCreated.id,
|
|
@@ -63530,7 +63716,22 @@ var DiamondHandsGraph = class {
|
|
|
63530
63716
|
* @returns One LoanEvents object per position; empty array if the wallet has none.
|
|
63531
63717
|
*/
|
|
63532
63718
|
async getWalletLoanEvents(userAddress, filter2) {
|
|
63533
|
-
|
|
63719
|
+
if (!hasLoanEventsFilter(filter2)) {
|
|
63720
|
+
return this.getWalletLoanEventsCollapsed(userAddress);
|
|
63721
|
+
}
|
|
63722
|
+
return this.getWalletLoanEventsFanout(userAddress, filter2);
|
|
63723
|
+
}
|
|
63724
|
+
/**
|
|
63725
|
+
* The per-position path: enumerate the wallet's positions, then one `GetLoanEvents` each.
|
|
63726
|
+
*
|
|
63727
|
+
* Used for filtered calls, and as the completeness fallback when the collapsed document
|
|
63728
|
+
* hits a page limit. Costs `1 + N` requests, which is exactly why it is not the default.
|
|
63729
|
+
*/
|
|
63730
|
+
async getWalletLoanEventsFanout(userAddress, filter2) {
|
|
63731
|
+
const positions = await this.getUserPositionsOnly(
|
|
63732
|
+
userAddress,
|
|
63733
|
+
THE_GRAPH_MAX_BATCH_SIZE
|
|
63734
|
+
);
|
|
63534
63735
|
const positionIds = positions.map((p) => p?.id != null ? String(p.id) : "").filter((id) => id.length > 0);
|
|
63535
63736
|
if (positionIds.length === 0)
|
|
63536
63737
|
return [];
|
|
@@ -63545,6 +63746,81 @@ var DiamondHandsGraph = class {
|
|
|
63545
63746
|
}
|
|
63546
63747
|
return results;
|
|
63547
63748
|
}
|
|
63749
|
+
/**
|
|
63750
|
+
* The whole wallet's event history in ONE request.
|
|
63751
|
+
*
|
|
63752
|
+
* Replaces `1 + N` round trips (one position enumeration plus one per position) with a
|
|
63753
|
+
* single document. Measured on Sepolia: a wallet holding 44 positions cost 46 requests
|
|
63754
|
+
* per activity refresh against a per-wallet budget of 30/min — this makes it 1.
|
|
63755
|
+
*
|
|
63756
|
+
* Three subgraph facts make it possible, all verified against the deployed schema rather
|
|
63757
|
+
* than assumed:
|
|
63758
|
+
* - ten event collections are `@derivedFrom` on Position, so they nest under a
|
|
63759
|
+
* borrower-filtered `positions(...)`;
|
|
63760
|
+
* - `positionCreatedEvents` is ALSO derived on Position — `getLoanEvents` queries it
|
|
63761
|
+
* top-level, which it never needed to;
|
|
63762
|
+
* - `ucdmintEvents` / `collateralEvents` are not derived and carry no `borrower`
|
|
63763
|
+
* field, but graph-node's nested `position_: { borrower }` filter reaches them.
|
|
63764
|
+
* Without that last one this would be two requests, not one.
|
|
63765
|
+
*/
|
|
63766
|
+
async getWalletLoanEventsCollapsed(userAddress) {
|
|
63767
|
+
const borrower = userAddress.toLowerCase();
|
|
63768
|
+
const pageSize = THE_GRAPH_MAX_BATCH_SIZE;
|
|
63769
|
+
const result = await this.client.execute(
|
|
63770
|
+
WALLET_LOAN_EVENTS_QUERY,
|
|
63771
|
+
{
|
|
63772
|
+
borrower,
|
|
63773
|
+
first: pageSize,
|
|
63774
|
+
limit: pageSize,
|
|
63775
|
+
orderDirection: "desc"
|
|
63776
|
+
}
|
|
63777
|
+
);
|
|
63778
|
+
const positions = result.positions || [];
|
|
63779
|
+
const ucdmintEvents = result.ucdmintEvents || [];
|
|
63780
|
+
const collateralEvents = result.collateralEvents || [];
|
|
63781
|
+
const truncated = positions.length >= pageSize || ucdmintEvents.length >= pageSize || collateralEvents.length >= pageSize;
|
|
63782
|
+
if (truncated) {
|
|
63783
|
+
log.warn(
|
|
63784
|
+
"[DiamondHandsGraph] wallet event page limit reached \u2014 falling back to the per-position path to avoid returning a partial history",
|
|
63785
|
+
{
|
|
63786
|
+
borrower,
|
|
63787
|
+
pageSize,
|
|
63788
|
+
positions: positions.length,
|
|
63789
|
+
ucdmintEvents: ucdmintEvents.length,
|
|
63790
|
+
collateralEvents: collateralEvents.length
|
|
63791
|
+
}
|
|
63792
|
+
);
|
|
63793
|
+
return this.getWalletLoanEventsFanout(userAddress);
|
|
63794
|
+
}
|
|
63795
|
+
if (positions.length === 0)
|
|
63796
|
+
return [];
|
|
63797
|
+
const mintsByPosition = /* @__PURE__ */ new Map();
|
|
63798
|
+
for (const m of result.ucdmintEvents || []) {
|
|
63799
|
+
const key = m.position?.id;
|
|
63800
|
+
if (!key)
|
|
63801
|
+
continue;
|
|
63802
|
+
const bucket = mintsByPosition.get(key) || [];
|
|
63803
|
+
bucket.push(m);
|
|
63804
|
+
mintsByPosition.set(key, bucket);
|
|
63805
|
+
}
|
|
63806
|
+
const collateralByPosition = /* @__PURE__ */ new Map();
|
|
63807
|
+
for (const c of result.collateralEvents || []) {
|
|
63808
|
+
const key = c.position?.id;
|
|
63809
|
+
if (!key)
|
|
63810
|
+
continue;
|
|
63811
|
+
const bucket = collateralByPosition.get(key) || [];
|
|
63812
|
+
bucket.push(c);
|
|
63813
|
+
collateralByPosition.set(key, bucket);
|
|
63814
|
+
}
|
|
63815
|
+
return positions.map(
|
|
63816
|
+
(p) => this.assembleLoanEvents(p.id, {
|
|
63817
|
+
position: p,
|
|
63818
|
+
positionCreatedEvents: p.positionCreatedEvents || [],
|
|
63819
|
+
ucdmintEvents: mintsByPosition.get(p.id) || [],
|
|
63820
|
+
collateralEvents: collateralByPosition.get(p.id) || []
|
|
63821
|
+
})
|
|
63822
|
+
);
|
|
63823
|
+
}
|
|
63548
63824
|
// ============================================================================
|
|
63549
63825
|
// Protocol-wide Events
|
|
63550
63826
|
// ============================================================================
|
|
@@ -68404,16 +68680,6 @@ function createMockTokenManager(config) {
|
|
|
68404
68680
|
}
|
|
68405
68681
|
}
|
|
68406
68682
|
var import_dh_lit_actions2 = __toESM2(require_pkg_src2());
|
|
68407
|
-
var TelegramBot = null;
|
|
68408
|
-
try {
|
|
68409
|
-
if (typeof window === "undefined" && typeof global !== "undefined") {
|
|
68410
|
-
TelegramBot = null /* stubbed post-build: dh-mcp never uses telegram (F-PUB-2) */;
|
|
68411
|
-
}
|
|
68412
|
-
} catch (error) {
|
|
68413
|
-
log.warn("Telegram bot API not available", {
|
|
68414
|
-
error: error instanceof Error ? error.message : String(error)
|
|
68415
|
-
});
|
|
68416
|
-
}
|
|
68417
68683
|
function formatMintMessage(mintAmount, loanId, txHash) {
|
|
68418
68684
|
return `\u2705 DH SDK: ${mintAmount} UCD was minted for loan id: ${loanId} Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
68419
68685
|
}
|
|
@@ -74430,6 +74696,13 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
74430
74696
|
error: "ethRpcUrl required for recoverStaleSpend \u2014 set DiamondHandsSDKConfig.ethRpcUrl or pass rpcUrl"
|
|
74431
74697
|
};
|
|
74432
74698
|
}
|
|
74699
|
+
if (!this.config.contractSigner) {
|
|
74700
|
+
return {
|
|
74701
|
+
success: false,
|
|
74702
|
+
failedStep: "config",
|
|
74703
|
+
error: "Contract signer not configured \u2014 recoverStaleSpend submits its own recovery transaction in direct mode. Set DiamondHandsSDKConfig.contractSigner, or use service mode, where the server relays and pays for it."
|
|
74704
|
+
};
|
|
74705
|
+
}
|
|
74433
74706
|
const sdkBitcoinProviderUrl = this.config.bitcoinProviders?.[0]?.url;
|
|
74434
74707
|
attRes = await this.litOps.requestStaleSpendRecoveryAttestation({
|
|
74435
74708
|
chainId,
|