@gvnrdao/dh-mcp 0.5.8 → 0.5.10
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 +45 -9
- package/dist/connector-embed.js +73 -13
- package/dist/connector.js +73 -13
- package/dist/index.js +48 -12
- package/package.json +2 -2
package/dist/boundary.js
CHANGED
|
@@ -42135,11 +42135,10 @@ var World = class {
|
|
|
42135
42135
|
const spend = BigInt(p.amountSats);
|
|
42136
42136
|
const fee = BigInt(p.networkFeeSats);
|
|
42137
42137
|
const available = this.availableSats(p.positionId);
|
|
42138
|
-
if (spend
|
|
42139
|
-
const maxSpend = available > fee ? available - fee : 0n;
|
|
42138
|
+
if (spend > available) {
|
|
42140
42139
|
return {
|
|
42141
42140
|
ok: false,
|
|
42142
|
-
reason: `withdrawal of ${spend.toString()} sats
|
|
42141
|
+
reason: `withdrawal of ${spend.toString()} sats exceeds the ${available.toString()} sats available (TargetExceedsInputValue) \u2014 max amountSats now is ${available.toString()} (destination then receives ${(available > fee ? available - fee : 0n).toString()} after the fee)`
|
|
42143
42142
|
};
|
|
42144
42143
|
}
|
|
42145
42144
|
const debt = BigInt(pos.debtUcdWei);
|
|
@@ -51311,9 +51310,9 @@ var init_deployment_addresses = __esm2({
|
|
|
51311
51310
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
51312
51311
|
},
|
|
51313
51312
|
BTCSpendAuthorizer: {
|
|
51314
|
-
previousImplementation: "
|
|
51315
|
-
newImplementation: "
|
|
51316
|
-
upgradedAt: "2026-
|
|
51313
|
+
previousImplementation: "0xdd3DFaEc50d6214d57eA64e8b76ff318b501607b",
|
|
51314
|
+
newImplementation: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51315
|
+
upgradedAt: "2026-09-06T15:03:13.627Z",
|
|
51317
51316
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51318
51317
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
51319
51318
|
},
|
|
@@ -51379,6 +51378,13 @@ var init_deployment_addresses = __esm2({
|
|
|
51379
51378
|
upgradedAt: "2026-07-07T16:56:49.844Z",
|
|
51380
51379
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51381
51380
|
reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
|
|
51381
|
+
},
|
|
51382
|
+
AgentDelegationRegistry: {
|
|
51383
|
+
previousImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
51384
|
+
newImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
51385
|
+
upgradedAt: "2026-09-06T15:06:02.814Z",
|
|
51386
|
+
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51387
|
+
reason: "Reconciled implementation from chain"
|
|
51382
51388
|
}
|
|
51383
51389
|
},
|
|
51384
51390
|
history: {
|
|
@@ -51464,7 +51470,7 @@ var init_deployment_addresses = __esm2({
|
|
|
51464
51470
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
51465
51471
|
LIQUIDATION_MANAGER_MODULE_IMPL: "0xCe7587C47094BBb3dCa13D7a2299Ec9beA6cd759",
|
|
51466
51472
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
51467
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
51473
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51468
51474
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
51469
51475
|
UPGRADE_VALIDATOR_IMPL: "0x9E70e1D07AB11ac9dD37B67AA091Efe97d7Ed84b",
|
|
51470
51476
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
@@ -57269,6 +57275,17 @@ var DEFAULT_LIT_NETWORK = DEFAULT_LIT_NETWORKS.CHIPOTLE;
|
|
|
57269
57275
|
var VALID_LIT_NETWORKS = [
|
|
57270
57276
|
DEFAULT_LIT_NETWORKS.CHIPOTLE
|
|
57271
57277
|
];
|
|
57278
|
+
var PROTOCOL_LICENSE_IDENTIFIER = "UNLICENSED";
|
|
57279
|
+
var PROTOCOL_LICENSE_URI = "ipfs://bafkreigunb4phugonefe66by524nhnrgrpol4233ytg7e7eg7qomhy3s3a";
|
|
57280
|
+
var PROTOCOL_LICENSE_TEXT = '(c) GVNR DAO LLC, 2026\n\nExcept as otherwise provided in the header of a specific source code\nfile in this repository: (a) all intellectual property (including all\nsource code, designs and protocols) contained in this repository has been\npublished for informational purposes only; (b) no license, right of\nreproduction or distribution or other right with respect thereto is\ngranted or implied; and (c) all moral, intellectual property and other\nrights are hereby reserved by the copyright holder.\n\nTHE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY\nIS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR\nINTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF\nSUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.';
|
|
57281
|
+
var PROTOCOL_LICENSE = Object.freeze({
|
|
57282
|
+
identifier: PROTOCOL_LICENSE_IDENTIFIER,
|
|
57283
|
+
uri: PROTOCOL_LICENSE_URI,
|
|
57284
|
+
text: PROTOCOL_LICENSE_TEXT
|
|
57285
|
+
});
|
|
57286
|
+
function getLicense() {
|
|
57287
|
+
return PROTOCOL_LICENSE;
|
|
57288
|
+
}
|
|
57272
57289
|
function assertSafeServiceEndpoint(endpoint) {
|
|
57273
57290
|
let url2;
|
|
57274
57291
|
try {
|
|
@@ -58571,12 +58588,12 @@ async function reconcileAuthorizedSpend(spend, esploraBaseUrl, httpGetJson = def
|
|
|
58571
58588
|
{ txid: spend.txid, vout: spend.vout }
|
|
58572
58589
|
);
|
|
58573
58590
|
}
|
|
58574
|
-
if (spend.targetAmount
|
|
58591
|
+
if (spend.targetAmount > spend.satoshis) {
|
|
58575
58592
|
return {
|
|
58576
58593
|
spend,
|
|
58577
58594
|
status: "CORRUPT",
|
|
58578
58595
|
onChainOutputValue,
|
|
58579
|
-
reason: `Authorized targetAmount ${spend.targetAmount} sats
|
|
58596
|
+
reason: `Authorized targetAmount ${spend.targetAmount} sats exceeds the ${spend.satoshis}-sat aggregate input value \u2014 the contract could never have authorized this`
|
|
58580
58597
|
};
|
|
58581
58598
|
}
|
|
58582
58599
|
const outspendRes = await httpGetJson(
|
|
@@ -77465,6 +77482,25 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
77465
77482
|
getConfig() {
|
|
77466
77483
|
return this.config;
|
|
77467
77484
|
}
|
|
77485
|
+
/**
|
|
77486
|
+
* Return the Diamond Hands protocol license.
|
|
77487
|
+
*
|
|
77488
|
+
* Same data as the standalone `getLicense()` export: the package `LICENSE`
|
|
77489
|
+
* file, which is the CIDv1 payload of `ContractVersionRegistry.LICENSE_URI`.
|
|
77490
|
+
* Does not fetch IPFS.
|
|
77491
|
+
*
|
|
77492
|
+
* @returns Identifier (`UNLICENSED`), IPFS URI, and full license text.
|
|
77493
|
+
*
|
|
77494
|
+
* @example
|
|
77495
|
+
* ```ts
|
|
77496
|
+
* const license = sdk.getLicense();
|
|
77497
|
+
* console.log(license.identifier); // "UNLICENSED"
|
|
77498
|
+
* console.log(license.uri); // "ipfs://bafkrei…"
|
|
77499
|
+
* ```
|
|
77500
|
+
*/
|
|
77501
|
+
getLicense() {
|
|
77502
|
+
return getLicense();
|
|
77503
|
+
}
|
|
77468
77504
|
/**
|
|
77469
77505
|
* Clear all caches
|
|
77470
77506
|
*/
|
package/dist/connector-embed.js
CHANGED
|
@@ -42775,11 +42775,10 @@ var World = class {
|
|
|
42775
42775
|
const spend = BigInt(p.amountSats);
|
|
42776
42776
|
const fee = BigInt(p.networkFeeSats);
|
|
42777
42777
|
const available = this.availableSats(p.positionId);
|
|
42778
|
-
if (spend
|
|
42779
|
-
const maxSpend = available > fee ? available - fee : 0n;
|
|
42778
|
+
if (spend > available) {
|
|
42780
42779
|
return {
|
|
42781
42780
|
ok: false,
|
|
42782
|
-
reason: `withdrawal of ${spend.toString()} sats
|
|
42781
|
+
reason: `withdrawal of ${spend.toString()} sats exceeds the ${available.toString()} sats available (TargetExceedsInputValue) \u2014 max amountSats now is ${available.toString()} (destination then receives ${(available > fee ? available - fee : 0n).toString()} after the fee)`
|
|
42783
42782
|
};
|
|
42784
42783
|
}
|
|
42785
42784
|
const debt = BigInt(pos.debtUcdWei);
|
|
@@ -51960,9 +51959,9 @@ var init_deployment_addresses = __esm2({
|
|
|
51960
51959
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
51961
51960
|
},
|
|
51962
51961
|
BTCSpendAuthorizer: {
|
|
51963
|
-
previousImplementation: "
|
|
51964
|
-
newImplementation: "
|
|
51965
|
-
upgradedAt: "2026-
|
|
51962
|
+
previousImplementation: "0xdd3DFaEc50d6214d57eA64e8b76ff318b501607b",
|
|
51963
|
+
newImplementation: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51964
|
+
upgradedAt: "2026-09-06T15:03:13.627Z",
|
|
51966
51965
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51967
51966
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
51968
51967
|
},
|
|
@@ -52028,6 +52027,13 @@ var init_deployment_addresses = __esm2({
|
|
|
52028
52027
|
upgradedAt: "2026-07-07T16:56:49.844Z",
|
|
52029
52028
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
52030
52029
|
reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
|
|
52030
|
+
},
|
|
52031
|
+
AgentDelegationRegistry: {
|
|
52032
|
+
previousImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
52033
|
+
newImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
52034
|
+
upgradedAt: "2026-09-06T15:06:02.814Z",
|
|
52035
|
+
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
52036
|
+
reason: "Reconciled implementation from chain"
|
|
52031
52037
|
}
|
|
52032
52038
|
},
|
|
52033
52039
|
history: {
|
|
@@ -52113,7 +52119,7 @@ var init_deployment_addresses = __esm2({
|
|
|
52113
52119
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
52114
52120
|
LIQUIDATION_MANAGER_MODULE_IMPL: "0xCe7587C47094BBb3dCa13D7a2299Ec9beA6cd759",
|
|
52115
52121
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
52116
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
52122
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
52117
52123
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
52118
52124
|
UPGRADE_VALIDATOR_IMPL: "0x9E70e1D07AB11ac9dD37B67AA091Efe97d7Ed84b",
|
|
52119
52125
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
@@ -57918,6 +57924,17 @@ var DEFAULT_LIT_NETWORK = DEFAULT_LIT_NETWORKS.CHIPOTLE;
|
|
|
57918
57924
|
var VALID_LIT_NETWORKS = [
|
|
57919
57925
|
DEFAULT_LIT_NETWORKS.CHIPOTLE
|
|
57920
57926
|
];
|
|
57927
|
+
var PROTOCOL_LICENSE_IDENTIFIER = "UNLICENSED";
|
|
57928
|
+
var PROTOCOL_LICENSE_URI = "ipfs://bafkreigunb4phugonefe66by524nhnrgrpol4233ytg7e7eg7qomhy3s3a";
|
|
57929
|
+
var PROTOCOL_LICENSE_TEXT = '(c) GVNR DAO LLC, 2026\n\nExcept as otherwise provided in the header of a specific source code\nfile in this repository: (a) all intellectual property (including all\nsource code, designs and protocols) contained in this repository has been\npublished for informational purposes only; (b) no license, right of\nreproduction or distribution or other right with respect thereto is\ngranted or implied; and (c) all moral, intellectual property and other\nrights are hereby reserved by the copyright holder.\n\nTHE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY\nIS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR\nINTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF\nSUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.';
|
|
57930
|
+
var PROTOCOL_LICENSE = Object.freeze({
|
|
57931
|
+
identifier: PROTOCOL_LICENSE_IDENTIFIER,
|
|
57932
|
+
uri: PROTOCOL_LICENSE_URI,
|
|
57933
|
+
text: PROTOCOL_LICENSE_TEXT
|
|
57934
|
+
});
|
|
57935
|
+
function getLicense() {
|
|
57936
|
+
return PROTOCOL_LICENSE;
|
|
57937
|
+
}
|
|
57921
57938
|
function assertSafeServiceEndpoint(endpoint) {
|
|
57922
57939
|
let url2;
|
|
57923
57940
|
try {
|
|
@@ -59220,12 +59237,12 @@ async function reconcileAuthorizedSpend(spend, esploraBaseUrl, httpGetJson = def
|
|
|
59220
59237
|
{ txid: spend.txid, vout: spend.vout }
|
|
59221
59238
|
);
|
|
59222
59239
|
}
|
|
59223
|
-
if (spend.targetAmount
|
|
59240
|
+
if (spend.targetAmount > spend.satoshis) {
|
|
59224
59241
|
return {
|
|
59225
59242
|
spend,
|
|
59226
59243
|
status: "CORRUPT",
|
|
59227
59244
|
onChainOutputValue,
|
|
59228
|
-
reason: `Authorized targetAmount ${spend.targetAmount} sats
|
|
59245
|
+
reason: `Authorized targetAmount ${spend.targetAmount} sats exceeds the ${spend.satoshis}-sat aggregate input value \u2014 the contract could never have authorized this`
|
|
59229
59246
|
};
|
|
59230
59247
|
}
|
|
59231
59248
|
const outspendRes = await httpGetJson(
|
|
@@ -78114,6 +78131,25 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
78114
78131
|
getConfig() {
|
|
78115
78132
|
return this.config;
|
|
78116
78133
|
}
|
|
78134
|
+
/**
|
|
78135
|
+
* Return the Diamond Hands protocol license.
|
|
78136
|
+
*
|
|
78137
|
+
* Same data as the standalone `getLicense()` export: the package `LICENSE`
|
|
78138
|
+
* file, which is the CIDv1 payload of `ContractVersionRegistry.LICENSE_URI`.
|
|
78139
|
+
* Does not fetch IPFS.
|
|
78140
|
+
*
|
|
78141
|
+
* @returns Identifier (`UNLICENSED`), IPFS URI, and full license text.
|
|
78142
|
+
*
|
|
78143
|
+
* @example
|
|
78144
|
+
* ```ts
|
|
78145
|
+
* const license = sdk.getLicense();
|
|
78146
|
+
* console.log(license.identifier); // "UNLICENSED"
|
|
78147
|
+
* console.log(license.uri); // "ipfs://bafkrei…"
|
|
78148
|
+
* ```
|
|
78149
|
+
*/
|
|
78150
|
+
getLicense() {
|
|
78151
|
+
return getLicense();
|
|
78152
|
+
}
|
|
78117
78153
|
/**
|
|
78118
78154
|
* Clear all caches
|
|
78119
78155
|
*/
|
|
@@ -82714,7 +82750,7 @@ function registerLoanTools(server, getB, adapter2 = "real") {
|
|
|
82714
82750
|
positionId: positionIdSchema,
|
|
82715
82751
|
btcAddress: import_zod.z.string().min(1).describe("Destination BTC address (must match the configured BTC network)"),
|
|
82716
82752
|
amountSats: import_zod.z.number().int().positive().describe(
|
|
82717
|
-
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats.
|
|
82753
|
+
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats. amountSats may be up to the whole available balance (a full sweep leaves 0 sats; anything above available reverts TargetExceedsInputValue). position_status.maxWithdrawableSats is a ready-to-use value that already leaves the default fee aside."
|
|
82718
82754
|
),
|
|
82719
82755
|
networkFeeSats: import_zod.z.number().int().positive().default(1e3).describe("BTC network fee in sats (declared default 1000); deducted FROM amountSats, not added on top"),
|
|
82720
82756
|
confirmed: confirmedSchema
|
|
@@ -83693,7 +83729,7 @@ Connections / Connected sites).`,
|
|
|
83693
83729
|
reduced by unused origination-fee credit from the current term.
|
|
83694
83730
|
6. **Withdraw BTC** \u2014 \`loan_withdraw {positionId, btcAddress, amountSats, confirmed:true}\`.
|
|
83695
83731
|
BTC sends are IRREVERSIBLE \u2014 read the address back to the user before confirming.
|
|
83696
|
-
|
|
83732
|
+
amountSats is gross (fee comes out of it) and may be the whole available balance.
|
|
83697
83733
|
7. **Watch it** \u2014 \`position_status\` (one), \`position_list\` (all),
|
|
83698
83734
|
\`position_events\` (history), \`btc_price\`, \`protocol_status\`.
|
|
83699
83735
|
|
|
@@ -84347,7 +84383,7 @@ function registerBoundaryInfoResource(server, getB) {
|
|
|
84347
84383
|
}
|
|
84348
84384
|
|
|
84349
84385
|
// src/server.ts
|
|
84350
|
-
var SERVER_VERSION = "0.5.
|
|
84386
|
+
var SERVER_VERSION = "0.5.9";
|
|
84351
84387
|
var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
|
|
84352
84388
|
var CONNECTOR_INSTRUCTIONS = SERVER_INSTRUCTIONS + " HOSTED CONNECTOR TIER: this server is the hosted claude.ai connector. Signer modes are external-wallet ONLY \u2014 keystore mode is ABSENT from this build (structurally, not disabled); the server never holds a key, and every fund-moving action needs a fresh signature from the user's own wallet. Each tenant's world is isolated by wallet identity; network_switch moves ONLY this tenant, within the networks this deployment serves (the refusal states the rollout truth). The login session lives in server memory only \u2014 a server restart or idle eviction means signing in again; that is the no-data-at-rest property, not a fault. Trust ledger and cadence: guide topic 'connector'.";
|
|
84353
84389
|
function createServer2(deps, instructions = SERVER_INSTRUCTIONS) {
|
|
@@ -84529,6 +84565,10 @@ function composeConnector(opts, publicOrigin) {
|
|
|
84529
84565
|
}
|
|
84530
84566
|
const tenant = await authImpl.tenant(req);
|
|
84531
84567
|
if (!tenant) {
|
|
84568
|
+
res.setHeader(
|
|
84569
|
+
"WWW-Authenticate",
|
|
84570
|
+
`Bearer resource_metadata="${publicOrigin}/.well-known/oauth-protected-resource"`
|
|
84571
|
+
);
|
|
84532
84572
|
deny(res, 401, "unauthorized \u2014 connect this MCP server through its authorization flow first");
|
|
84533
84573
|
return;
|
|
84534
84574
|
}
|
|
@@ -84653,7 +84693,27 @@ function composeConnector(opts, publicOrigin) {
|
|
|
84653
84693
|
const r = siwe.wcStatus(String(req.query["flowId"] ?? ""));
|
|
84654
84694
|
res.status(r.status).json(r.body);
|
|
84655
84695
|
});
|
|
84656
|
-
app.
|
|
84696
|
+
app.get("/.well-known/oauth-protected-resource", (_req, res) => {
|
|
84697
|
+
res.json({
|
|
84698
|
+
resource: `${publicOrigin}/mcp`,
|
|
84699
|
+
authorization_servers: [`${publicOrigin}/`],
|
|
84700
|
+
scopes_supported: [],
|
|
84701
|
+
bearer_methods_supported: ["header"],
|
|
84702
|
+
resource_name: "Diamond Hands",
|
|
84703
|
+
resource_documentation: `${publicOrigin}/auth.md`
|
|
84704
|
+
});
|
|
84705
|
+
});
|
|
84706
|
+
app.use(
|
|
84707
|
+
(0, import_router.mcpAuthRouter)({
|
|
84708
|
+
provider: siwe,
|
|
84709
|
+
issuerUrl: new URL(publicOrigin),
|
|
84710
|
+
// Keep the SDK's own fallback document in agreement with the one above
|
|
84711
|
+
// rather than contradicting it.
|
|
84712
|
+
resourceServerUrl: new URL(`${publicOrigin}/mcp`),
|
|
84713
|
+
scopesSupported: [],
|
|
84714
|
+
resourceName: "Diamond Hands"
|
|
84715
|
+
})
|
|
84716
|
+
);
|
|
84657
84717
|
authImpl = {
|
|
84658
84718
|
tenant(req) {
|
|
84659
84719
|
const header = req.headers.authorization;
|
package/dist/connector.js
CHANGED
|
@@ -42769,11 +42769,10 @@ var World = class {
|
|
|
42769
42769
|
const spend = BigInt(p.amountSats);
|
|
42770
42770
|
const fee = BigInt(p.networkFeeSats);
|
|
42771
42771
|
const available = this.availableSats(p.positionId);
|
|
42772
|
-
if (spend
|
|
42773
|
-
const maxSpend = available > fee ? available - fee : 0n;
|
|
42772
|
+
if (spend > available) {
|
|
42774
42773
|
return {
|
|
42775
42774
|
ok: false,
|
|
42776
|
-
reason: `withdrawal of ${spend.toString()} sats
|
|
42775
|
+
reason: `withdrawal of ${spend.toString()} sats exceeds the ${available.toString()} sats available (TargetExceedsInputValue) \u2014 max amountSats now is ${available.toString()} (destination then receives ${(available > fee ? available - fee : 0n).toString()} after the fee)`
|
|
42777
42776
|
};
|
|
42778
42777
|
}
|
|
42779
42778
|
const debt = BigInt(pos.debtUcdWei);
|
|
@@ -51954,9 +51953,9 @@ var init_deployment_addresses = __esm2({
|
|
|
51954
51953
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
51955
51954
|
},
|
|
51956
51955
|
BTCSpendAuthorizer: {
|
|
51957
|
-
previousImplementation: "
|
|
51958
|
-
newImplementation: "
|
|
51959
|
-
upgradedAt: "2026-
|
|
51956
|
+
previousImplementation: "0xdd3DFaEc50d6214d57eA64e8b76ff318b501607b",
|
|
51957
|
+
newImplementation: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51958
|
+
upgradedAt: "2026-09-06T15:03:13.627Z",
|
|
51960
51959
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51961
51960
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
51962
51961
|
},
|
|
@@ -52022,6 +52021,13 @@ var init_deployment_addresses = __esm2({
|
|
|
52022
52021
|
upgradedAt: "2026-07-07T16:56:49.844Z",
|
|
52023
52022
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
52024
52023
|
reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
|
|
52024
|
+
},
|
|
52025
|
+
AgentDelegationRegistry: {
|
|
52026
|
+
previousImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
52027
|
+
newImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
52028
|
+
upgradedAt: "2026-09-06T15:06:02.814Z",
|
|
52029
|
+
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
52030
|
+
reason: "Reconciled implementation from chain"
|
|
52025
52031
|
}
|
|
52026
52032
|
},
|
|
52027
52033
|
history: {
|
|
@@ -52107,7 +52113,7 @@ var init_deployment_addresses = __esm2({
|
|
|
52107
52113
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
52108
52114
|
LIQUIDATION_MANAGER_MODULE_IMPL: "0xCe7587C47094BBb3dCa13D7a2299Ec9beA6cd759",
|
|
52109
52115
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
52110
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
52116
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
52111
52117
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
52112
52118
|
UPGRADE_VALIDATOR_IMPL: "0x9E70e1D07AB11ac9dD37B67AA091Efe97d7Ed84b",
|
|
52113
52119
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
@@ -57912,6 +57918,17 @@ var DEFAULT_LIT_NETWORK = DEFAULT_LIT_NETWORKS.CHIPOTLE;
|
|
|
57912
57918
|
var VALID_LIT_NETWORKS = [
|
|
57913
57919
|
DEFAULT_LIT_NETWORKS.CHIPOTLE
|
|
57914
57920
|
];
|
|
57921
|
+
var PROTOCOL_LICENSE_IDENTIFIER = "UNLICENSED";
|
|
57922
|
+
var PROTOCOL_LICENSE_URI = "ipfs://bafkreigunb4phugonefe66by524nhnrgrpol4233ytg7e7eg7qomhy3s3a";
|
|
57923
|
+
var PROTOCOL_LICENSE_TEXT = '(c) GVNR DAO LLC, 2026\n\nExcept as otherwise provided in the header of a specific source code\nfile in this repository: (a) all intellectual property (including all\nsource code, designs and protocols) contained in this repository has been\npublished for informational purposes only; (b) no license, right of\nreproduction or distribution or other right with respect thereto is\ngranted or implied; and (c) all moral, intellectual property and other\nrights are hereby reserved by the copyright holder.\n\nTHE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY\nIS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR\nINTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF\nSUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.';
|
|
57924
|
+
var PROTOCOL_LICENSE = Object.freeze({
|
|
57925
|
+
identifier: PROTOCOL_LICENSE_IDENTIFIER,
|
|
57926
|
+
uri: PROTOCOL_LICENSE_URI,
|
|
57927
|
+
text: PROTOCOL_LICENSE_TEXT
|
|
57928
|
+
});
|
|
57929
|
+
function getLicense() {
|
|
57930
|
+
return PROTOCOL_LICENSE;
|
|
57931
|
+
}
|
|
57915
57932
|
function assertSafeServiceEndpoint(endpoint) {
|
|
57916
57933
|
let url2;
|
|
57917
57934
|
try {
|
|
@@ -59214,12 +59231,12 @@ async function reconcileAuthorizedSpend(spend, esploraBaseUrl, httpGetJson = def
|
|
|
59214
59231
|
{ txid: spend.txid, vout: spend.vout }
|
|
59215
59232
|
);
|
|
59216
59233
|
}
|
|
59217
|
-
if (spend.targetAmount
|
|
59234
|
+
if (spend.targetAmount > spend.satoshis) {
|
|
59218
59235
|
return {
|
|
59219
59236
|
spend,
|
|
59220
59237
|
status: "CORRUPT",
|
|
59221
59238
|
onChainOutputValue,
|
|
59222
|
-
reason: `Authorized targetAmount ${spend.targetAmount} sats
|
|
59239
|
+
reason: `Authorized targetAmount ${spend.targetAmount} sats exceeds the ${spend.satoshis}-sat aggregate input value \u2014 the contract could never have authorized this`
|
|
59223
59240
|
};
|
|
59224
59241
|
}
|
|
59225
59242
|
const outspendRes = await httpGetJson(
|
|
@@ -78108,6 +78125,25 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
78108
78125
|
getConfig() {
|
|
78109
78126
|
return this.config;
|
|
78110
78127
|
}
|
|
78128
|
+
/**
|
|
78129
|
+
* Return the Diamond Hands protocol license.
|
|
78130
|
+
*
|
|
78131
|
+
* Same data as the standalone `getLicense()` export: the package `LICENSE`
|
|
78132
|
+
* file, which is the CIDv1 payload of `ContractVersionRegistry.LICENSE_URI`.
|
|
78133
|
+
* Does not fetch IPFS.
|
|
78134
|
+
*
|
|
78135
|
+
* @returns Identifier (`UNLICENSED`), IPFS URI, and full license text.
|
|
78136
|
+
*
|
|
78137
|
+
* @example
|
|
78138
|
+
* ```ts
|
|
78139
|
+
* const license = sdk.getLicense();
|
|
78140
|
+
* console.log(license.identifier); // "UNLICENSED"
|
|
78141
|
+
* console.log(license.uri); // "ipfs://bafkrei…"
|
|
78142
|
+
* ```
|
|
78143
|
+
*/
|
|
78144
|
+
getLicense() {
|
|
78145
|
+
return getLicense();
|
|
78146
|
+
}
|
|
78111
78147
|
/**
|
|
78112
78148
|
* Clear all caches
|
|
78113
78149
|
*/
|
|
@@ -82708,7 +82744,7 @@ function registerLoanTools(server, getB, adapter2 = "real") {
|
|
|
82708
82744
|
positionId: positionIdSchema,
|
|
82709
82745
|
btcAddress: import_zod.z.string().min(1).describe("Destination BTC address (must match the configured BTC network)"),
|
|
82710
82746
|
amountSats: import_zod.z.number().int().positive().describe(
|
|
82711
|
-
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats.
|
|
82747
|
+
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats. amountSats may be up to the whole available balance (a full sweep leaves 0 sats; anything above available reverts TargetExceedsInputValue). position_status.maxWithdrawableSats is a ready-to-use value that already leaves the default fee aside."
|
|
82712
82748
|
),
|
|
82713
82749
|
networkFeeSats: import_zod.z.number().int().positive().default(1e3).describe("BTC network fee in sats (declared default 1000); deducted FROM amountSats, not added on top"),
|
|
82714
82750
|
confirmed: confirmedSchema
|
|
@@ -83687,7 +83723,7 @@ Connections / Connected sites).`,
|
|
|
83687
83723
|
reduced by unused origination-fee credit from the current term.
|
|
83688
83724
|
6. **Withdraw BTC** \u2014 \`loan_withdraw {positionId, btcAddress, amountSats, confirmed:true}\`.
|
|
83689
83725
|
BTC sends are IRREVERSIBLE \u2014 read the address back to the user before confirming.
|
|
83690
|
-
|
|
83726
|
+
amountSats is gross (fee comes out of it) and may be the whole available balance.
|
|
83691
83727
|
7. **Watch it** \u2014 \`position_status\` (one), \`position_list\` (all),
|
|
83692
83728
|
\`position_events\` (history), \`btc_price\`, \`protocol_status\`.
|
|
83693
83729
|
|
|
@@ -84341,7 +84377,7 @@ function registerBoundaryInfoResource(server, getB) {
|
|
|
84341
84377
|
}
|
|
84342
84378
|
|
|
84343
84379
|
// src/server.ts
|
|
84344
|
-
var SERVER_VERSION = "0.5.
|
|
84380
|
+
var SERVER_VERSION = "0.5.9";
|
|
84345
84381
|
var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
|
|
84346
84382
|
var CONNECTOR_INSTRUCTIONS = SERVER_INSTRUCTIONS + " HOSTED CONNECTOR TIER: this server is the hosted claude.ai connector. Signer modes are external-wallet ONLY \u2014 keystore mode is ABSENT from this build (structurally, not disabled); the server never holds a key, and every fund-moving action needs a fresh signature from the user's own wallet. Each tenant's world is isolated by wallet identity; network_switch moves ONLY this tenant, within the networks this deployment serves (the refusal states the rollout truth). The login session lives in server memory only \u2014 a server restart or idle eviction means signing in again; that is the no-data-at-rest property, not a fault. Trust ledger and cadence: guide topic 'connector'.";
|
|
84347
84383
|
function createServer2(deps, instructions = SERVER_INSTRUCTIONS) {
|
|
@@ -84523,6 +84559,10 @@ function composeConnector(opts, publicOrigin) {
|
|
|
84523
84559
|
}
|
|
84524
84560
|
const tenant = await authImpl.tenant(req);
|
|
84525
84561
|
if (!tenant) {
|
|
84562
|
+
res.setHeader(
|
|
84563
|
+
"WWW-Authenticate",
|
|
84564
|
+
`Bearer resource_metadata="${publicOrigin}/.well-known/oauth-protected-resource"`
|
|
84565
|
+
);
|
|
84526
84566
|
deny(res, 401, "unauthorized \u2014 connect this MCP server through its authorization flow first");
|
|
84527
84567
|
return;
|
|
84528
84568
|
}
|
|
@@ -84647,7 +84687,27 @@ function composeConnector(opts, publicOrigin) {
|
|
|
84647
84687
|
const r = siwe.wcStatus(String(req.query["flowId"] ?? ""));
|
|
84648
84688
|
res.status(r.status).json(r.body);
|
|
84649
84689
|
});
|
|
84650
|
-
app.
|
|
84690
|
+
app.get("/.well-known/oauth-protected-resource", (_req, res) => {
|
|
84691
|
+
res.json({
|
|
84692
|
+
resource: `${publicOrigin}/mcp`,
|
|
84693
|
+
authorization_servers: [`${publicOrigin}/`],
|
|
84694
|
+
scopes_supported: [],
|
|
84695
|
+
bearer_methods_supported: ["header"],
|
|
84696
|
+
resource_name: "Diamond Hands",
|
|
84697
|
+
resource_documentation: `${publicOrigin}/auth.md`
|
|
84698
|
+
});
|
|
84699
|
+
});
|
|
84700
|
+
app.use(
|
|
84701
|
+
(0, import_router.mcpAuthRouter)({
|
|
84702
|
+
provider: siwe,
|
|
84703
|
+
issuerUrl: new URL(publicOrigin),
|
|
84704
|
+
// Keep the SDK's own fallback document in agreement with the one above
|
|
84705
|
+
// rather than contradicting it.
|
|
84706
|
+
resourceServerUrl: new URL(`${publicOrigin}/mcp`),
|
|
84707
|
+
scopesSupported: [],
|
|
84708
|
+
resourceName: "Diamond Hands"
|
|
84709
|
+
})
|
|
84710
|
+
);
|
|
84651
84711
|
authImpl = {
|
|
84652
84712
|
tenant(req) {
|
|
84653
84713
|
const header = req.headers.authorization;
|
package/dist/index.js
CHANGED
|
@@ -42337,11 +42337,10 @@ var World = class {
|
|
|
42337
42337
|
const spend = BigInt(p.amountSats);
|
|
42338
42338
|
const fee = BigInt(p.networkFeeSats);
|
|
42339
42339
|
const available = this.availableSats(p.positionId);
|
|
42340
|
-
if (spend
|
|
42341
|
-
const maxSpend = available > fee ? available - fee : 0n;
|
|
42340
|
+
if (spend > available) {
|
|
42342
42341
|
return {
|
|
42343
42342
|
ok: false,
|
|
42344
|
-
reason: `withdrawal of ${spend.toString()} sats
|
|
42343
|
+
reason: `withdrawal of ${spend.toString()} sats exceeds the ${available.toString()} sats available (TargetExceedsInputValue) \u2014 max amountSats now is ${available.toString()} (destination then receives ${(available > fee ? available - fee : 0n).toString()} after the fee)`
|
|
42345
42344
|
};
|
|
42346
42345
|
}
|
|
42347
42346
|
const debt = BigInt(pos.debtUcdWei);
|
|
@@ -51513,9 +51512,9 @@ var init_deployment_addresses = __esm2({
|
|
|
51513
51512
|
reason: "Shared upgrade script: LiquidationManagerModule implementation update"
|
|
51514
51513
|
},
|
|
51515
51514
|
BTCSpendAuthorizer: {
|
|
51516
|
-
previousImplementation: "
|
|
51517
|
-
newImplementation: "
|
|
51518
|
-
upgradedAt: "2026-
|
|
51515
|
+
previousImplementation: "0xdd3DFaEc50d6214d57eA64e8b76ff318b501607b",
|
|
51516
|
+
newImplementation: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51517
|
+
upgradedAt: "2026-09-06T15:03:13.627Z",
|
|
51519
51518
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51520
51519
|
reason: "Shared upgrade script: BTCSpendAuthorizer implementation update"
|
|
51521
51520
|
},
|
|
@@ -51581,6 +51580,13 @@ var init_deployment_addresses = __esm2({
|
|
|
51581
51580
|
upgradedAt: "2026-07-07T16:56:49.844Z",
|
|
51582
51581
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51583
51582
|
reason: "Shared upgrade script: BitcoinWithdrawalAddressRegistry implementation update"
|
|
51583
|
+
},
|
|
51584
|
+
AgentDelegationRegistry: {
|
|
51585
|
+
previousImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
51586
|
+
newImplementation: "0xE931E4b9ceF2A48Ac7D57192da4B523756cFC310",
|
|
51587
|
+
upgradedAt: "2026-09-06T15:06:02.814Z",
|
|
51588
|
+
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
51589
|
+
reason: "Reconciled implementation from chain"
|
|
51584
51590
|
}
|
|
51585
51591
|
},
|
|
51586
51592
|
history: {
|
|
@@ -51666,7 +51672,7 @@ var init_deployment_addresses = __esm2({
|
|
|
51666
51672
|
LIQUIDATION_MANAGER_MODULE: "0xC4AB00f39e7ceD812F5C67058C9fa44e15d40e76",
|
|
51667
51673
|
LIQUIDATION_MANAGER_MODULE_IMPL: "0xCe7587C47094BBb3dCa13D7a2299Ec9beA6cd759",
|
|
51668
51674
|
BTC_SPEND_AUTHORIZER: "0xd7E9Eb5eE53f1d9ee55Dc162bBC7486bE437B6bD",
|
|
51669
|
-
BTC_SPEND_AUTHORIZER_IMPL: "
|
|
51675
|
+
BTC_SPEND_AUTHORIZER_IMPL: "0xf3282B5A1AE6428ee1b08cfaAF4EB4e198877484",
|
|
51670
51676
|
UPGRADE_VALIDATOR: "0x592e650edD9bA26ecc407989fdd6F9cdcDeC27A6",
|
|
51671
51677
|
UPGRADE_VALIDATOR_IMPL: "0x9E70e1D07AB11ac9dD37B67AA091Efe97d7Ed84b",
|
|
51672
51678
|
BITCOIN_PROVIDER_REGISTRY: "0xbfA0c48B070D0a9A9CD27469AeacFD2d4261cEE2",
|
|
@@ -57471,6 +57477,17 @@ var DEFAULT_LIT_NETWORK = DEFAULT_LIT_NETWORKS.CHIPOTLE;
|
|
|
57471
57477
|
var VALID_LIT_NETWORKS = [
|
|
57472
57478
|
DEFAULT_LIT_NETWORKS.CHIPOTLE
|
|
57473
57479
|
];
|
|
57480
|
+
var PROTOCOL_LICENSE_IDENTIFIER = "UNLICENSED";
|
|
57481
|
+
var PROTOCOL_LICENSE_URI = "ipfs://bafkreigunb4phugonefe66by524nhnrgrpol4233ytg7e7eg7qomhy3s3a";
|
|
57482
|
+
var PROTOCOL_LICENSE_TEXT = '(c) GVNR DAO LLC, 2026\n\nExcept as otherwise provided in the header of a specific source code\nfile in this repository: (a) all intellectual property (including all\nsource code, designs and protocols) contained in this repository has been\npublished for informational purposes only; (b) no license, right of\nreproduction or distribution or other right with respect thereto is\ngranted or implied; and (c) all moral, intellectual property and other\nrights are hereby reserved by the copyright holder.\n\nTHE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY\nIS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR\nINTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\nOF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF\nSUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE\nADVISED OF THE POSSIBILITY OF SUCH DAMAGE.';
|
|
57483
|
+
var PROTOCOL_LICENSE = Object.freeze({
|
|
57484
|
+
identifier: PROTOCOL_LICENSE_IDENTIFIER,
|
|
57485
|
+
uri: PROTOCOL_LICENSE_URI,
|
|
57486
|
+
text: PROTOCOL_LICENSE_TEXT
|
|
57487
|
+
});
|
|
57488
|
+
function getLicense() {
|
|
57489
|
+
return PROTOCOL_LICENSE;
|
|
57490
|
+
}
|
|
57474
57491
|
function assertSafeServiceEndpoint(endpoint) {
|
|
57475
57492
|
let url2;
|
|
57476
57493
|
try {
|
|
@@ -58773,12 +58790,12 @@ async function reconcileAuthorizedSpend(spend, esploraBaseUrl, httpGetJson = def
|
|
|
58773
58790
|
{ txid: spend.txid, vout: spend.vout }
|
|
58774
58791
|
);
|
|
58775
58792
|
}
|
|
58776
|
-
if (spend.targetAmount
|
|
58793
|
+
if (spend.targetAmount > spend.satoshis) {
|
|
58777
58794
|
return {
|
|
58778
58795
|
spend,
|
|
58779
58796
|
status: "CORRUPT",
|
|
58780
58797
|
onChainOutputValue,
|
|
58781
|
-
reason: `Authorized targetAmount ${spend.targetAmount} sats
|
|
58798
|
+
reason: `Authorized targetAmount ${spend.targetAmount} sats exceeds the ${spend.satoshis}-sat aggregate input value \u2014 the contract could never have authorized this`
|
|
58782
58799
|
};
|
|
58783
58800
|
}
|
|
58784
58801
|
const outspendRes = await httpGetJson(
|
|
@@ -77667,6 +77684,25 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
77667
77684
|
getConfig() {
|
|
77668
77685
|
return this.config;
|
|
77669
77686
|
}
|
|
77687
|
+
/**
|
|
77688
|
+
* Return the Diamond Hands protocol license.
|
|
77689
|
+
*
|
|
77690
|
+
* Same data as the standalone `getLicense()` export: the package `LICENSE`
|
|
77691
|
+
* file, which is the CIDv1 payload of `ContractVersionRegistry.LICENSE_URI`.
|
|
77692
|
+
* Does not fetch IPFS.
|
|
77693
|
+
*
|
|
77694
|
+
* @returns Identifier (`UNLICENSED`), IPFS URI, and full license text.
|
|
77695
|
+
*
|
|
77696
|
+
* @example
|
|
77697
|
+
* ```ts
|
|
77698
|
+
* const license = sdk.getLicense();
|
|
77699
|
+
* console.log(license.identifier); // "UNLICENSED"
|
|
77700
|
+
* console.log(license.uri); // "ipfs://bafkrei…"
|
|
77701
|
+
* ```
|
|
77702
|
+
*/
|
|
77703
|
+
getLicense() {
|
|
77704
|
+
return getLicense();
|
|
77705
|
+
}
|
|
77670
77706
|
/**
|
|
77671
77707
|
* Clear all caches
|
|
77672
77708
|
*/
|
|
@@ -82267,7 +82303,7 @@ function registerLoanTools(server, getB, adapter2 = "real") {
|
|
|
82267
82303
|
positionId: positionIdSchema,
|
|
82268
82304
|
btcAddress: import_zod.z.string().min(1).describe("Destination BTC address (must match the configured BTC network)"),
|
|
82269
82305
|
amountSats: import_zod.z.number().int().positive().describe(
|
|
82270
|
-
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats.
|
|
82306
|
+
"GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats \u2212 networkFeeSats; the vault's available drops by amountSats. amountSats may be up to the whole available balance (a full sweep leaves 0 sats; anything above available reverts TargetExceedsInputValue). position_status.maxWithdrawableSats is a ready-to-use value that already leaves the default fee aside."
|
|
82271
82307
|
),
|
|
82272
82308
|
networkFeeSats: import_zod.z.number().int().positive().default(1e3).describe("BTC network fee in sats (declared default 1000); deducted FROM amountSats, not added on top"),
|
|
82273
82309
|
confirmed: confirmedSchema
|
|
@@ -83246,7 +83282,7 @@ Connections / Connected sites).`,
|
|
|
83246
83282
|
reduced by unused origination-fee credit from the current term.
|
|
83247
83283
|
6. **Withdraw BTC** \u2014 \`loan_withdraw {positionId, btcAddress, amountSats, confirmed:true}\`.
|
|
83248
83284
|
BTC sends are IRREVERSIBLE \u2014 read the address back to the user before confirming.
|
|
83249
|
-
|
|
83285
|
+
amountSats is gross (fee comes out of it) and may be the whole available balance.
|
|
83250
83286
|
7. **Watch it** \u2014 \`position_status\` (one), \`position_list\` (all),
|
|
83251
83287
|
\`position_events\` (history), \`btc_price\`, \`protocol_status\`.
|
|
83252
83288
|
|
|
@@ -83900,7 +83936,7 @@ function registerBoundaryInfoResource(server, getB) {
|
|
|
83900
83936
|
}
|
|
83901
83937
|
|
|
83902
83938
|
// src/server.ts
|
|
83903
|
-
var SERVER_VERSION = "0.5.
|
|
83939
|
+
var SERVER_VERSION = "0.5.9";
|
|
83904
83940
|
var SERVER_INSTRUCTIONS = "Diamond Hands MCP \u2014 Bitcoin-collateralized borrowing. Before promising ANY flow, read the boundary://info resource and honor its `capabilities` block: it states which network this server is on, whether money is real (practiceWorld), whether writes are enabled (and the true reason when they are not), and which signer modes this build actually offers \u2014 never describe a flow outside it. State the network and whether funds are real when the user first acts. Authorization is chosen by conversation via the signer_setup tool (when listed); writes always require confirmed:true after showing the human-readable card. For walkthroughs consult the guide tool / guide:// resources instead of inventing steps; when a tool refuses, relay its stated reason and remedy \u2014 do not improvise alternatives. When a network_switch tool is listed, the network can change mid-session \u2014 after ANY switch, re-read boundary://info and state the new network and money reality to the user before doing anything else. When the user asks to disconnect / log out / sign out / forget or remove their wallet, call signer_setup action 'disconnect' (the full flush) \u2014 never treat 'reset-borrower' as a disconnect; it only swaps identity. READING DATA: a payload's fields and notes are authoritative \u2014 state what they say, never speculate past them, and when the data does not carry something, say 'the data does not carry X'. Field meanings live in guide topic 'reading-data'; `reading` notes inside a result are interpretation instructions for that exact payload \u2014 follow them over any prior assumption.";
|
|
83905
83941
|
var CONNECTOR_INSTRUCTIONS = SERVER_INSTRUCTIONS + " HOSTED CONNECTOR TIER: this server is the hosted claude.ai connector. Signer modes are external-wallet ONLY \u2014 keystore mode is ABSENT from this build (structurally, not disabled); the server never holds a key, and every fund-moving action needs a fresh signature from the user's own wallet. Each tenant's world is isolated by wallet identity; network_switch moves ONLY this tenant, within the networks this deployment serves (the refusal states the rollout truth). The login session lives in server memory only \u2014 a server restart or idle eviction means signing in again; that is the no-data-at-rest property, not a fault. Trust ledger and cadence: guide topic 'connector'.";
|
|
83906
83942
|
function createServer2(deps, instructions = SERVER_INSTRUCTIONS) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
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.336",
|
|
57
57
|
"@types/express": "5.0.3",
|
|
58
58
|
"@types/jest": "29.5.12",
|
|
59
59
|
"@types/node": "20.14.10",
|