@gvnrdao/dh-mcp 0.5.5 → 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 +301 -23
- package/dist/connector-embed.js +301 -23
- package/dist/connector.js +301 -23
- package/dist/index.js +301 -23
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -23446,6 +23446,7 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23446
23446
|
exports2.fetchLitActionCodeFromIpfs = fetchLitActionCodeFromIpfs;
|
|
23447
23447
|
var axios_1 = __importDefault(require_axios());
|
|
23448
23448
|
var ipfsCodeCache = /* @__PURE__ */ new Map();
|
|
23449
|
+
var GATEWAY_TIMEOUT_MS = 2e4;
|
|
23449
23450
|
var buildGatewayList = (cid, pinataJwt) => {
|
|
23450
23451
|
const gateways = [];
|
|
23451
23452
|
if (pinataJwt) {
|
|
@@ -23454,7 +23455,7 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23454
23455
|
headers: { Authorization: `Bearer ${pinataJwt}` }
|
|
23455
23456
|
});
|
|
23456
23457
|
}
|
|
23457
|
-
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}` });
|
|
23458
23459
|
return gateways;
|
|
23459
23460
|
};
|
|
23460
23461
|
async function fetchLitActionCodeFromIpfs(cid, options = {}) {
|
|
@@ -23468,13 +23469,14 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23468
23469
|
const pinataJwt = options.pinataJwt ?? process.env.PINATA_JWT;
|
|
23469
23470
|
const extraGateways = options.extraGateways?.map((t) => ({ url: t.replace("{cid}", cid) })) ?? [];
|
|
23470
23471
|
const gateways = [...extraGateways, ...buildGatewayList(cid, pinataJwt)];
|
|
23472
|
+
const failures = [];
|
|
23471
23473
|
for (const gateway of gateways) {
|
|
23472
23474
|
try {
|
|
23473
23475
|
if (options.debug) {
|
|
23474
23476
|
console.log(`\u{1F4E1} [fetchLitActionCodeFromIpfs] Trying ${gateway.url}...`);
|
|
23475
23477
|
}
|
|
23476
23478
|
const response = await axios_1.default.get(gateway.url, {
|
|
23477
|
-
timeout:
|
|
23479
|
+
timeout: GATEWAY_TIMEOUT_MS,
|
|
23478
23480
|
headers: {
|
|
23479
23481
|
Accept: "text/plain, application/javascript, text/javascript",
|
|
23480
23482
|
...gateway.headers
|
|
@@ -23487,13 +23489,17 @@ var require_fetch_lit_action_from_ipfs = __commonJS({
|
|
|
23487
23489
|
ipfsCodeCache.set(cid, response.data);
|
|
23488
23490
|
return response.data;
|
|
23489
23491
|
}
|
|
23492
|
+
failures.push(`${gateway.url}: HTTP ${response.status} returned ${typeof response.data}, expected string`);
|
|
23490
23493
|
} catch (error) {
|
|
23494
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23495
|
+
failures.push(`${gateway.url}: ${message}`);
|
|
23491
23496
|
if (options.debug) {
|
|
23492
|
-
console.log(`\u274C [fetchLitActionCodeFromIpfs] ${gateway.url}:`,
|
|
23497
|
+
console.log(`\u274C [fetchLitActionCodeFromIpfs] ${gateway.url}:`, message);
|
|
23493
23498
|
}
|
|
23494
23499
|
}
|
|
23495
23500
|
}
|
|
23496
|
-
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"));
|
|
23497
23503
|
}
|
|
23498
23504
|
}
|
|
23499
23505
|
});
|
|
@@ -50990,6 +50996,14 @@ var init_deployment_addresses = __esm2({
|
|
|
50990
50996
|
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.",
|
|
50991
50997
|
executeTx: "0xf1f8d5fc13f45d7a3f932bf1a2d6e29381fdd41cd31298ad785bf7688df07fe6",
|
|
50992
50998
|
block: 25673200
|
|
50999
|
+
},
|
|
51000
|
+
AgentDelegationRegistry: {
|
|
51001
|
+
newImplementation: "0xa9fF405Edd4329fc3159a64F56B37EBD253e4928",
|
|
51002
|
+
upgradedAt: "2026-07-31T22:03:35.000Z",
|
|
51003
|
+
upgradedBy: "AdminModule/Safe audit-batch upgradeToAndCall; executed by 0xEba7BfAeB35ee18408b424Ee0BB45AdDf776589f in tx 0x8fed0ab7eee3aaaa3792a35b40b0ef74bd09cfb1a175934afd846bee546048d4 (block 25655710)",
|
|
51004
|
+
reason: "Reconciled from chain \u2014 mainnet audit rollout batch (cross-ref onchain-auth/.safe-batches/mainnet-audit-execute.json)",
|
|
51005
|
+
executeTx: "0x8fed0ab7eee3aaaa3792a35b40b0ef74bd09cfb1a175934afd846bee546048d4",
|
|
51006
|
+
block: 25655710
|
|
50993
51007
|
}
|
|
50994
51008
|
},
|
|
50995
51009
|
latestEnv: {
|
|
@@ -62269,6 +62283,169 @@ function normalizePkpId2(pkpId) {
|
|
|
62269
62283
|
}
|
|
62270
62284
|
return pkpId;
|
|
62271
62285
|
}
|
|
62286
|
+
function hasLoanEventsFilter(filter2) {
|
|
62287
|
+
if (!filter2)
|
|
62288
|
+
return false;
|
|
62289
|
+
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;
|
|
62290
|
+
}
|
|
62291
|
+
var WALLET_LOAN_EVENTS_QUERY = `
|
|
62292
|
+
query GetWalletLoanEvents($borrower: Bytes!, $first: Int!, $limit: Int!, $orderDirection: OrderDirection!) {
|
|
62293
|
+
positions(where: { borrower: $borrower }, first: $first, orderBy: id) {
|
|
62294
|
+
id
|
|
62295
|
+
payments(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62296
|
+
id
|
|
62297
|
+
payer { id }
|
|
62298
|
+
amount
|
|
62299
|
+
type
|
|
62300
|
+
transactionHash
|
|
62301
|
+
timestamp
|
|
62302
|
+
blockNumber
|
|
62303
|
+
logIndex
|
|
62304
|
+
newDebt
|
|
62305
|
+
newCollateralRatio
|
|
62306
|
+
}
|
|
62307
|
+
statusUpdates(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62308
|
+
id
|
|
62309
|
+
oldStatus
|
|
62310
|
+
newStatus
|
|
62311
|
+
reason
|
|
62312
|
+
timestamp
|
|
62313
|
+
blockNumber
|
|
62314
|
+
transactionHash
|
|
62315
|
+
}
|
|
62316
|
+
liquidation {
|
|
62317
|
+
id
|
|
62318
|
+
liquidator
|
|
62319
|
+
liquidatedAmount
|
|
62320
|
+
collateralSeized
|
|
62321
|
+
transactionHash
|
|
62322
|
+
timestamp
|
|
62323
|
+
blockNumber
|
|
62324
|
+
commitHash
|
|
62325
|
+
commitTimestamp
|
|
62326
|
+
revealDelay
|
|
62327
|
+
}
|
|
62328
|
+
withdrawals(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62329
|
+
id
|
|
62330
|
+
withdrawalAmount
|
|
62331
|
+
withdrawalAddress
|
|
62332
|
+
networkFee
|
|
62333
|
+
timestamp
|
|
62334
|
+
blockNumber
|
|
62335
|
+
transactionHash
|
|
62336
|
+
logIndex
|
|
62337
|
+
}
|
|
62338
|
+
renewals(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62339
|
+
id
|
|
62340
|
+
extensionTerm
|
|
62341
|
+
extensionFee
|
|
62342
|
+
newExpiryDate
|
|
62343
|
+
timestamp
|
|
62344
|
+
blockNumber
|
|
62345
|
+
transactionHash
|
|
62346
|
+
logIndex
|
|
62347
|
+
}
|
|
62348
|
+
operationFailures(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62349
|
+
id
|
|
62350
|
+
operationType
|
|
62351
|
+
reason
|
|
62352
|
+
errorCode
|
|
62353
|
+
amount
|
|
62354
|
+
timestamp
|
|
62355
|
+
blockNumber
|
|
62356
|
+
transactionHash
|
|
62357
|
+
logIndex
|
|
62358
|
+
}
|
|
62359
|
+
mintRequests(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62360
|
+
id
|
|
62361
|
+
pkpId
|
|
62362
|
+
borrower { id }
|
|
62363
|
+
mintAmount
|
|
62364
|
+
originationFee
|
|
62365
|
+
newDebt
|
|
62366
|
+
newCollateralRatio
|
|
62367
|
+
btcPrice
|
|
62368
|
+
quantumTimestamp
|
|
62369
|
+
opId
|
|
62370
|
+
timestamp
|
|
62371
|
+
blockNumber
|
|
62372
|
+
transactionHash
|
|
62373
|
+
logIndex
|
|
62374
|
+
}
|
|
62375
|
+
burnRequests(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62376
|
+
id
|
|
62377
|
+
pkpId
|
|
62378
|
+
borrower { id }
|
|
62379
|
+
burnAmount
|
|
62380
|
+
remainingDebt
|
|
62381
|
+
newCollateralRatio
|
|
62382
|
+
opId
|
|
62383
|
+
timestamp
|
|
62384
|
+
blockNumber
|
|
62385
|
+
transactionHash
|
|
62386
|
+
logIndex
|
|
62387
|
+
}
|
|
62388
|
+
mintingFees(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62389
|
+
id
|
|
62390
|
+
borrower { id }
|
|
62391
|
+
feeAmount
|
|
62392
|
+
mintAmount
|
|
62393
|
+
newDebt
|
|
62394
|
+
btcPrice
|
|
62395
|
+
quantumTimestamp
|
|
62396
|
+
timestamp
|
|
62397
|
+
blockNumber
|
|
62398
|
+
transactionHash
|
|
62399
|
+
logIndex
|
|
62400
|
+
}
|
|
62401
|
+
renewalFees(first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62402
|
+
id
|
|
62403
|
+
borrower { id }
|
|
62404
|
+
feeAmount
|
|
62405
|
+
extensionTerm
|
|
62406
|
+
newExpiryDate
|
|
62407
|
+
timestamp
|
|
62408
|
+
blockNumber
|
|
62409
|
+
transactionHash
|
|
62410
|
+
logIndex
|
|
62411
|
+
}
|
|
62412
|
+
positionCreatedEvents(first: 1, orderBy: timestamp, orderDirection: asc) {
|
|
62413
|
+
id
|
|
62414
|
+
pkpId
|
|
62415
|
+
borrower { id }
|
|
62416
|
+
requestedCollateralRatio
|
|
62417
|
+
selectedTerm
|
|
62418
|
+
expiryAt
|
|
62419
|
+
timestamp
|
|
62420
|
+
blockNumber
|
|
62421
|
+
transactionHash
|
|
62422
|
+
}
|
|
62423
|
+
}
|
|
62424
|
+
ucdmintEvents(where: { position_: { borrower: $borrower } }, first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62425
|
+
id
|
|
62426
|
+
position { id }
|
|
62427
|
+
amount
|
|
62428
|
+
proof
|
|
62429
|
+
minter { id }
|
|
62430
|
+
isCommunityMint
|
|
62431
|
+
timestamp
|
|
62432
|
+
blockNumber
|
|
62433
|
+
transactionHash
|
|
62434
|
+
}
|
|
62435
|
+
collateralEvents(where: { position_: { borrower: $borrower } }, first: $limit, orderBy: timestamp, orderDirection: $orderDirection) {
|
|
62436
|
+
id
|
|
62437
|
+
position { id }
|
|
62438
|
+
eventType
|
|
62439
|
+
networkFee
|
|
62440
|
+
remainingCollateral
|
|
62441
|
+
collateralRatio
|
|
62442
|
+
timestamp
|
|
62443
|
+
blockNumber
|
|
62444
|
+
transactionHash
|
|
62445
|
+
logIndex
|
|
62446
|
+
}
|
|
62447
|
+
}
|
|
62448
|
+
`;
|
|
62272
62449
|
var DiamondHandsGraph = class {
|
|
62273
62450
|
client;
|
|
62274
62451
|
defaultPageSize;
|
|
@@ -62374,7 +62551,7 @@ var DiamondHandsGraph = class {
|
|
|
62374
62551
|
/**
|
|
62375
62552
|
* Get user positions from subgraph
|
|
62376
62553
|
*/
|
|
62377
|
-
async
|
|
62554
|
+
async getUserPositionsOnly(userAddress, first, skip, orderBy, orderDirection) {
|
|
62378
62555
|
const query = `
|
|
62379
62556
|
query GetUserPositions($borrower: Bytes!, $first: Int, $skip: Int, $orderBy: Position_orderBy, $orderDirection: OrderDirection) {
|
|
62380
62557
|
user(id: $borrower) {
|
|
@@ -62415,17 +62592,28 @@ var DiamondHandsGraph = class {
|
|
|
62415
62592
|
query,
|
|
62416
62593
|
variables
|
|
62417
62594
|
);
|
|
62418
|
-
const total = await this.getTotalCountPaginated("{ borrower: $borrower }", {
|
|
62419
|
-
borrower: userAddress.toLowerCase()
|
|
62420
|
-
});
|
|
62421
62595
|
let positions = [];
|
|
62422
62596
|
if (result && result.user && Array.isArray(result.user.positions)) {
|
|
62423
62597
|
positions = result.user.positions.filter((p) => p != null).map((p) => this.transformGraphPositionToLoanData(p));
|
|
62424
62598
|
}
|
|
62425
|
-
return
|
|
62426
|
-
|
|
62427
|
-
|
|
62428
|
-
|
|
62599
|
+
return positions;
|
|
62600
|
+
}
|
|
62601
|
+
/**
|
|
62602
|
+
* Get user positions, plus an accurate total count.
|
|
62603
|
+
*
|
|
62604
|
+
* The count is a SECOND round trip (`getTotalCountPaginated`, which pages to handle
|
|
62605
|
+
* >1000 items). Callers that only need the rows should use `getUserPositionsOnly` and
|
|
62606
|
+
* skip it — the event paths did not, and paid for a count they immediately discarded on
|
|
62607
|
+
* every activity refresh.
|
|
62608
|
+
*/
|
|
62609
|
+
async getUserPositions(userAddress, first, skip, orderBy, orderDirection) {
|
|
62610
|
+
const [positions, total] = await Promise.all([
|
|
62611
|
+
this.getUserPositionsOnly(userAddress, first, skip, orderBy, orderDirection),
|
|
62612
|
+
this.getTotalCountPaginated("{ borrower: $borrower }", {
|
|
62613
|
+
borrower: userAddress.toLowerCase()
|
|
62614
|
+
})
|
|
62615
|
+
]);
|
|
62616
|
+
return { positions, total };
|
|
62429
62617
|
}
|
|
62430
62618
|
/**
|
|
62431
62619
|
* Get user positions with enriched Bitcoin balance data
|
|
@@ -63516,6 +63704,16 @@ var DiamondHandsGraph = class {
|
|
|
63516
63704
|
orderDirection
|
|
63517
63705
|
};
|
|
63518
63706
|
const result = await this.client.execute(query, variables);
|
|
63707
|
+
return this.assembleLoanEvents(positionId, result);
|
|
63708
|
+
}
|
|
63709
|
+
/**
|
|
63710
|
+
* Map one position's raw event payload into `LoanEvents`.
|
|
63711
|
+
*
|
|
63712
|
+
* Extracted verbatim from getLoanEvents so the wallet-collapsed path produces
|
|
63713
|
+
* byte-identical objects by construction rather than by a second implementation
|
|
63714
|
+
* that has to be kept in step by hand.
|
|
63715
|
+
*/
|
|
63716
|
+
assembleLoanEvents(positionId, result) {
|
|
63519
63717
|
const rawCreated = result.positionCreatedEvents?.[0];
|
|
63520
63718
|
const positionCreated = rawCreated ? {
|
|
63521
63719
|
id: rawCreated.id,
|
|
@@ -63720,7 +63918,22 @@ var DiamondHandsGraph = class {
|
|
|
63720
63918
|
* @returns One LoanEvents object per position; empty array if the wallet has none.
|
|
63721
63919
|
*/
|
|
63722
63920
|
async getWalletLoanEvents(userAddress, filter2) {
|
|
63723
|
-
|
|
63921
|
+
if (!hasLoanEventsFilter(filter2)) {
|
|
63922
|
+
return this.getWalletLoanEventsCollapsed(userAddress);
|
|
63923
|
+
}
|
|
63924
|
+
return this.getWalletLoanEventsFanout(userAddress, filter2);
|
|
63925
|
+
}
|
|
63926
|
+
/**
|
|
63927
|
+
* The per-position path: enumerate the wallet's positions, then one `GetLoanEvents` each.
|
|
63928
|
+
*
|
|
63929
|
+
* Used for filtered calls, and as the completeness fallback when the collapsed document
|
|
63930
|
+
* hits a page limit. Costs `1 + N` requests, which is exactly why it is not the default.
|
|
63931
|
+
*/
|
|
63932
|
+
async getWalletLoanEventsFanout(userAddress, filter2) {
|
|
63933
|
+
const positions = await this.getUserPositionsOnly(
|
|
63934
|
+
userAddress,
|
|
63935
|
+
THE_GRAPH_MAX_BATCH_SIZE
|
|
63936
|
+
);
|
|
63724
63937
|
const positionIds = positions.map((p) => p?.id != null ? String(p.id) : "").filter((id) => id.length > 0);
|
|
63725
63938
|
if (positionIds.length === 0)
|
|
63726
63939
|
return [];
|
|
@@ -63735,6 +63948,81 @@ var DiamondHandsGraph = class {
|
|
|
63735
63948
|
}
|
|
63736
63949
|
return results;
|
|
63737
63950
|
}
|
|
63951
|
+
/**
|
|
63952
|
+
* The whole wallet's event history in ONE request.
|
|
63953
|
+
*
|
|
63954
|
+
* Replaces `1 + N` round trips (one position enumeration plus one per position) with a
|
|
63955
|
+
* single document. Measured on Sepolia: a wallet holding 44 positions cost 46 requests
|
|
63956
|
+
* per activity refresh against a per-wallet budget of 30/min — this makes it 1.
|
|
63957
|
+
*
|
|
63958
|
+
* Three subgraph facts make it possible, all verified against the deployed schema rather
|
|
63959
|
+
* than assumed:
|
|
63960
|
+
* - ten event collections are `@derivedFrom` on Position, so they nest under a
|
|
63961
|
+
* borrower-filtered `positions(...)`;
|
|
63962
|
+
* - `positionCreatedEvents` is ALSO derived on Position — `getLoanEvents` queries it
|
|
63963
|
+
* top-level, which it never needed to;
|
|
63964
|
+
* - `ucdmintEvents` / `collateralEvents` are not derived and carry no `borrower`
|
|
63965
|
+
* field, but graph-node's nested `position_: { borrower }` filter reaches them.
|
|
63966
|
+
* Without that last one this would be two requests, not one.
|
|
63967
|
+
*/
|
|
63968
|
+
async getWalletLoanEventsCollapsed(userAddress) {
|
|
63969
|
+
const borrower = userAddress.toLowerCase();
|
|
63970
|
+
const pageSize = THE_GRAPH_MAX_BATCH_SIZE;
|
|
63971
|
+
const result = await this.client.execute(
|
|
63972
|
+
WALLET_LOAN_EVENTS_QUERY,
|
|
63973
|
+
{
|
|
63974
|
+
borrower,
|
|
63975
|
+
first: pageSize,
|
|
63976
|
+
limit: pageSize,
|
|
63977
|
+
orderDirection: "desc"
|
|
63978
|
+
}
|
|
63979
|
+
);
|
|
63980
|
+
const positions = result.positions || [];
|
|
63981
|
+
const ucdmintEvents = result.ucdmintEvents || [];
|
|
63982
|
+
const collateralEvents = result.collateralEvents || [];
|
|
63983
|
+
const truncated = positions.length >= pageSize || ucdmintEvents.length >= pageSize || collateralEvents.length >= pageSize;
|
|
63984
|
+
if (truncated) {
|
|
63985
|
+
log.warn(
|
|
63986
|
+
"[DiamondHandsGraph] wallet event page limit reached \u2014 falling back to the per-position path to avoid returning a partial history",
|
|
63987
|
+
{
|
|
63988
|
+
borrower,
|
|
63989
|
+
pageSize,
|
|
63990
|
+
positions: positions.length,
|
|
63991
|
+
ucdmintEvents: ucdmintEvents.length,
|
|
63992
|
+
collateralEvents: collateralEvents.length
|
|
63993
|
+
}
|
|
63994
|
+
);
|
|
63995
|
+
return this.getWalletLoanEventsFanout(userAddress);
|
|
63996
|
+
}
|
|
63997
|
+
if (positions.length === 0)
|
|
63998
|
+
return [];
|
|
63999
|
+
const mintsByPosition = /* @__PURE__ */ new Map();
|
|
64000
|
+
for (const m of result.ucdmintEvents || []) {
|
|
64001
|
+
const key = m.position?.id;
|
|
64002
|
+
if (!key)
|
|
64003
|
+
continue;
|
|
64004
|
+
const bucket = mintsByPosition.get(key) || [];
|
|
64005
|
+
bucket.push(m);
|
|
64006
|
+
mintsByPosition.set(key, bucket);
|
|
64007
|
+
}
|
|
64008
|
+
const collateralByPosition = /* @__PURE__ */ new Map();
|
|
64009
|
+
for (const c of result.collateralEvents || []) {
|
|
64010
|
+
const key = c.position?.id;
|
|
64011
|
+
if (!key)
|
|
64012
|
+
continue;
|
|
64013
|
+
const bucket = collateralByPosition.get(key) || [];
|
|
64014
|
+
bucket.push(c);
|
|
64015
|
+
collateralByPosition.set(key, bucket);
|
|
64016
|
+
}
|
|
64017
|
+
return positions.map(
|
|
64018
|
+
(p) => this.assembleLoanEvents(p.id, {
|
|
64019
|
+
position: p,
|
|
64020
|
+
positionCreatedEvents: p.positionCreatedEvents || [],
|
|
64021
|
+
ucdmintEvents: mintsByPosition.get(p.id) || [],
|
|
64022
|
+
collateralEvents: collateralByPosition.get(p.id) || []
|
|
64023
|
+
})
|
|
64024
|
+
);
|
|
64025
|
+
}
|
|
63738
64026
|
// ============================================================================
|
|
63739
64027
|
// Protocol-wide Events
|
|
63740
64028
|
// ============================================================================
|
|
@@ -68594,16 +68882,6 @@ function createMockTokenManager(config) {
|
|
|
68594
68882
|
}
|
|
68595
68883
|
}
|
|
68596
68884
|
var import_dh_lit_actions2 = __toESM2(require_pkg_src2());
|
|
68597
|
-
var TelegramBot = null;
|
|
68598
|
-
try {
|
|
68599
|
-
if (typeof window === "undefined" && typeof global !== "undefined") {
|
|
68600
|
-
TelegramBot = null /* stubbed post-build: dh-mcp never uses telegram (F-PUB-2) */;
|
|
68601
|
-
}
|
|
68602
|
-
} catch (error) {
|
|
68603
|
-
log.warn("Telegram bot API not available", {
|
|
68604
|
-
error: error instanceof Error ? error.message : String(error)
|
|
68605
|
-
});
|
|
68606
|
-
}
|
|
68607
68885
|
function formatMintMessage(mintAmount, loanId, txHash) {
|
|
68608
68886
|
return `\u2705 DH SDK: ${mintAmount} UCD was minted for loan id: ${loanId} Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
68609
68887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "MCP server for the Diamond Hands protocol — Bitcoin-collateralized UCD lending with human-approved signing (sepolia practice by default; mainnet fully enabled)",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@anthropic-ai/mcpb": "2.1.2",
|
|
56
|
-
"@gvnrdao/dh-sdk": "^0.0.
|
|
56
|
+
"@gvnrdao/dh-sdk": "^0.0.330",
|
|
57
57
|
"@types/express": "5.0.3",
|
|
58
58
|
"@types/jest": "29.5.12",
|
|
59
59
|
"@types/node": "20.14.10",
|