@gvnrdao/dh-mcp 0.5.22 → 0.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/boundary.js +258 -226
- package/dist/connector-embed.js +45 -13
- package/dist/connector.js +45 -13
- package/dist/index.js +45 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,7 +40,8 @@ sentence, or set `DH_NETWORK=sepolia`. Everything is overridable by environment
|
|
|
40
40
|
|---|---|---|
|
|
41
41
|
| `DH_ADAPTER` | `real` | `real` protocol, or `mock` (offline practice sandbox; needs `DH_MOCK_DB` + `DH_MOCK_LATENCY`) |
|
|
42
42
|
| `DH_NETWORK` | `mainnet` | `mainnet` (REAL money — reads and writes both work out of the box) or `sepolia` (practice) |
|
|
43
|
-
| `ETH_RPC_URL` | our RPC proxy per network (`api.gvnr.xyz/v1/proxy/rpc/<chainId>` — dRPC upstream, keys held server-side, no credential needed here) | your own RPC if preferred |
|
|
43
|
+
| `ETH_RPC_URL` | our RPC proxy per network (`api.gvnr.xyz/v1/proxy/rpc/<chainId>` — dRPC upstream, keys held server-side, no credential needed here) | your own RPC if preferred. URLs are cut to their host in every error this server renders |
|
|
44
|
+
| `DRPC_API_KEY` | unset | a dRPC key: the server uses dRPC directly for the active network, sending the key in the `Drpc-Key` header, never in the URL. Set this **or** `ETH_RPC_URL`, not both |
|
|
44
45
|
| `DH_SERVICE_ENDPOINT` | per network | Diamond Hands ops service |
|
|
45
46
|
| `DH_KEYSTORE_PATH` + `DH_KEYSTORE_PASSWORD` | unset | optional: encrypted keystore for automatic signing (both or neither) |
|
|
46
47
|
|
package/dist/boundary.js
CHANGED
|
@@ -27397,7 +27397,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27397
27397
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27398
27398
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27399
27399
|
if (this.config.debug) {
|
|
27400
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27400
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27401
27401
|
}
|
|
27402
27402
|
}
|
|
27403
27403
|
if (this.config.network === "chipotle") {
|
|
@@ -27573,7 +27573,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27573
27573
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27574
27574
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27575
27575
|
if (this.config.debug) {
|
|
27576
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27576
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27577
27577
|
}
|
|
27578
27578
|
}
|
|
27579
27579
|
if (this.config.network === "chipotle") {
|
|
@@ -27911,7 +27911,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27911
27911
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27912
27912
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27913
27913
|
if (this.config.debug) {
|
|
27914
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27914
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27915
27915
|
}
|
|
27916
27916
|
}
|
|
27917
27917
|
if (this.config.network === "chipotle") {
|
|
@@ -28127,7 +28127,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28127
28127
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28128
28128
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28129
28129
|
if (this.config.debug) {
|
|
28130
|
-
console.log(" EVM RPC URL override:", request.rpcUrl);
|
|
28130
|
+
console.log(" EVM RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28131
28131
|
}
|
|
28132
28132
|
}
|
|
28133
28133
|
if (this.config.debug) {
|
|
@@ -28257,7 +28257,12 @@ var require_lit_ops_module = __commonJS({
|
|
|
28257
28257
|
if (!moduleAddress || !provisionerPk || !baseRpc) {
|
|
28258
28258
|
throw new Error("LIT_VAULT_PROVISION_MODE=module requires LIT_ONCHAIN_VAULT_MODULE_ADDRESS, LIT_ONCHAIN_PROVISIONER_PRIVATE_KEY, BASE_RPC_URL");
|
|
28259
28259
|
}
|
|
28260
|
-
const
|
|
28260
|
+
const baseRequest = new ethers_1.FetchRequest(baseRpc);
|
|
28261
|
+
const drpcKey = process.env.DRPC_API_KEY;
|
|
28262
|
+
if (drpcKey && /(^|\.)drpc\.(org|live)$/.test(new URL(baseRpc).hostname)) {
|
|
28263
|
+
baseRequest.setHeader("Drpc-Key", drpcKey);
|
|
28264
|
+
}
|
|
28265
|
+
const provider = new ethers_1.JsonRpcProvider(baseRequest);
|
|
28261
28266
|
const signer = new ethers_1.Wallet(provisionerPk, provider);
|
|
28262
28267
|
const chainId = Number(process.env.BASE_CHAIN_ID || "8453");
|
|
28263
28268
|
const issuedAt = Math.floor(Date.now() / 1e3);
|
|
@@ -40941,6 +40946,231 @@ var os2 = __toESM(require("os"));
|
|
|
40941
40946
|
var path4 = __toESM(require("path"));
|
|
40942
40947
|
var import_ethers52 = require("ethers");
|
|
40943
40948
|
|
|
40949
|
+
// src/boundary/errors.ts
|
|
40950
|
+
function boundaryError(code, message, extra) {
|
|
40951
|
+
return { code, message, ...extra?.source && { source: extra.source }, ...extra?.details && { details: extra.details } };
|
|
40952
|
+
}
|
|
40953
|
+
|
|
40954
|
+
// src/boundary/config.ts
|
|
40955
|
+
var NETWORKS = { sepolia: 11155111, mainnet: 1 };
|
|
40956
|
+
var ADAPTERS = ["mock", "real"];
|
|
40957
|
+
var LATENCIES = ["zero", "realistic"];
|
|
40958
|
+
var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
40959
|
+
var WC_DISABLED = "off";
|
|
40960
|
+
function resolveWcProjectId(raw, problems) {
|
|
40961
|
+
if (raw === void 0 || raw === "" || raw === WC_DISABLED) return void 0;
|
|
40962
|
+
if (!/^[0-9a-f]{32}$/.test(raw)) {
|
|
40963
|
+
problems.push(`DH_WC_PROJECT_ID must be a 32-char hex WalletConnect project id, or '${WC_DISABLED}' to disable WalletConnect.`);
|
|
40964
|
+
return void 0;
|
|
40965
|
+
}
|
|
40966
|
+
return raw;
|
|
40967
|
+
}
|
|
40968
|
+
var RPC_PROXY_ORIGIN = "https://api.gvnr.xyz";
|
|
40969
|
+
var rpcProxy = (chainId) => `${RPC_PROXY_ORIGIN}/v1/proxy/rpc/${chainId}`;
|
|
40970
|
+
var publicRpcUrl = rpcProxy;
|
|
40971
|
+
var DRPC_ENDPOINT = {
|
|
40972
|
+
mainnet: "https://lb.drpc.live/ethereum",
|
|
40973
|
+
sepolia: "https://lb.drpc.live/sepolia"
|
|
40974
|
+
};
|
|
40975
|
+
var NETWORK_DEFAULTS = {
|
|
40976
|
+
sepolia: {
|
|
40977
|
+
rpcUrl: rpcProxy(11155111),
|
|
40978
|
+
serviceEndpoint: "https://ops-test.gvnr.xyz",
|
|
40979
|
+
litNetwork: "chipotle",
|
|
40980
|
+
validatorVersion: 3
|
|
40981
|
+
// on-chain validator generation, sepolia (2026-07-30)
|
|
40982
|
+
},
|
|
40983
|
+
mainnet: {
|
|
40984
|
+
rpcUrl: rpcProxy(1),
|
|
40985
|
+
// Cutover 2026-09-08 — see sdk/src/constants/chunks/network-configs.ts for the full
|
|
40986
|
+
// reasoning. Widening, not a rename: ops.gvnr.xyz serves the same broker and cannot be
|
|
40987
|
+
// retired while installed copies call it. The sepolia entry above deliberately stays on
|
|
40988
|
+
// ops-test.gvnr.xyz — there is no ops-test.diamondhands.credit twin (open decision 2).
|
|
40989
|
+
serviceEndpoint: "https://ops.diamondhands.credit",
|
|
40990
|
+
litNetwork: "chipotle",
|
|
40991
|
+
// On-chain PKPValidation generation, mainnet (validatorForVersion(3) is the ONLY
|
|
40992
|
+
// registered validator — verified live 2026-08-05). Without this the SDK defaults
|
|
40993
|
+
// to 1 and createPosition reverts ValidatorNotConfigured in wallet simulation.
|
|
40994
|
+
validatorVersion: 3
|
|
40995
|
+
}
|
|
40996
|
+
};
|
|
40997
|
+
function resolveBoundaryConfig(env) {
|
|
40998
|
+
const adapter2 = env["DH_ADAPTER"] === void 0 || env["DH_ADAPTER"] === "" ? "real" : env["DH_ADAPTER"];
|
|
40999
|
+
if (!ADAPTERS.includes(adapter2)) {
|
|
41000
|
+
return {
|
|
41001
|
+
ok: false,
|
|
41002
|
+
error: boundaryError(
|
|
41003
|
+
"CONFIG_MISSING",
|
|
41004
|
+
`DH_ADAPTER='${adapter2}' is not a valid adapter. Allowed: ${ADAPTERS.join(" | ")}.`,
|
|
41005
|
+
{ details: { invalid: ["DH_ADAPTER"] } }
|
|
41006
|
+
)
|
|
41007
|
+
};
|
|
41008
|
+
}
|
|
41009
|
+
if (adapter2 === "real") return resolveRealConfig(env);
|
|
41010
|
+
const problems = [];
|
|
41011
|
+
const missing = [];
|
|
41012
|
+
const mockDb = env["DH_MOCK_DB"];
|
|
41013
|
+
if (!mockDb) {
|
|
41014
|
+
missing.push("DH_MOCK_DB");
|
|
41015
|
+
problems.push("DH_MOCK_DB is not set (path of the mock world DB file).");
|
|
41016
|
+
}
|
|
41017
|
+
const latency = env["DH_MOCK_LATENCY"];
|
|
41018
|
+
if (!latency) {
|
|
41019
|
+
missing.push("DH_MOCK_LATENCY");
|
|
41020
|
+
problems.push(`DH_MOCK_LATENCY is not set. Allowed: ${LATENCIES.join(" | ")}.`);
|
|
41021
|
+
} else if (!LATENCIES.includes(latency)) {
|
|
41022
|
+
problems.push(`DH_MOCK_LATENCY='${latency}' is invalid. Allowed: ${LATENCIES.join(" | ")}.`);
|
|
41023
|
+
}
|
|
41024
|
+
const borrower = env["DH_MOCK_BORROWER"];
|
|
41025
|
+
if (borrower !== void 0 && borrower !== "" && !ADDRESS_RE.test(borrower)) {
|
|
41026
|
+
problems.push(`DH_MOCK_BORROWER='${borrower}' is not a valid 0x address.`);
|
|
41027
|
+
}
|
|
41028
|
+
const SIGNER_MODES = ["external", "keystore", "mock-simulated"];
|
|
41029
|
+
const signer = env["DH_SIGNER"];
|
|
41030
|
+
if (signer !== void 0 && signer !== "" && !SIGNER_MODES.includes(signer)) {
|
|
41031
|
+
problems.push(`DH_SIGNER='${signer}' is not supported for the mock adapter. Allowed: ${SIGNER_MODES.join(" | ")} (or unset).`);
|
|
41032
|
+
}
|
|
41033
|
+
let chainId;
|
|
41034
|
+
const chainRaw = env["DH_MOCK_CHAIN_ID"];
|
|
41035
|
+
if (chainRaw !== void 0 && chainRaw !== "") {
|
|
41036
|
+
const n = Number(chainRaw);
|
|
41037
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
41038
|
+
problems.push(`DH_MOCK_CHAIN_ID='${chainRaw}' must be a positive integer.`);
|
|
41039
|
+
} else {
|
|
41040
|
+
chainId = n;
|
|
41041
|
+
}
|
|
41042
|
+
}
|
|
41043
|
+
const sinkRpcUrl = env["DH_MOCK_SINK_RPC"];
|
|
41044
|
+
if (sinkRpcUrl !== void 0 && sinkRpcUrl !== "" && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?/.test(sinkRpcUrl)) {
|
|
41045
|
+
problems.push(`DH_MOCK_SINK_RPC='${sinkRpcUrl}' must be a loopback http:// URL (the sink chain never leaves this machine).`);
|
|
41046
|
+
}
|
|
41047
|
+
const bridgeUrlFile = env["DH_BRIDGE_URL_FILE"];
|
|
41048
|
+
const bridgeOpenRaw = env["DH_BRIDGE_OPEN"];
|
|
41049
|
+
const wcProjectId = resolveWcProjectId(env["DH_WC_PROJECT_ID"], problems);
|
|
41050
|
+
let bridgeOpenBrowser;
|
|
41051
|
+
if (bridgeOpenRaw !== void 0 && bridgeOpenRaw !== "") {
|
|
41052
|
+
if (bridgeOpenRaw !== "0" && bridgeOpenRaw !== "1") {
|
|
41053
|
+
problems.push(`DH_BRIDGE_OPEN='${bridgeOpenRaw}' must be 0 or 1.`);
|
|
41054
|
+
} else {
|
|
41055
|
+
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
41056
|
+
}
|
|
41057
|
+
}
|
|
41058
|
+
const keystorePath = env["DH_KEYSTORE_PATH"];
|
|
41059
|
+
const keystorePassword = env["DH_KEYSTORE_PASSWORD"];
|
|
41060
|
+
if (keystorePath && !keystorePassword || !keystorePath && keystorePassword) {
|
|
41061
|
+
problems.push("DH_KEYSTORE_PATH and DH_KEYSTORE_PASSWORD must be set together (or neither).");
|
|
41062
|
+
}
|
|
41063
|
+
if (problems.length > 0) {
|
|
41064
|
+
return {
|
|
41065
|
+
ok: false,
|
|
41066
|
+
error: boundaryError("CONFIG_MISSING", `Mock boundary configuration is incomplete:
|
|
41067
|
+
- ${problems.join("\n- ")}`, {
|
|
41068
|
+
details: { missing }
|
|
41069
|
+
})
|
|
41070
|
+
};
|
|
41071
|
+
}
|
|
41072
|
+
return {
|
|
41073
|
+
ok: true,
|
|
41074
|
+
config: {
|
|
41075
|
+
adapter: "mock",
|
|
41076
|
+
mockDb,
|
|
41077
|
+
latency,
|
|
41078
|
+
...borrower ? { borrower } : {},
|
|
41079
|
+
...signer ? { signer } : {},
|
|
41080
|
+
chainId: chainId ?? 1337,
|
|
41081
|
+
...sinkRpcUrl ? { sinkRpcUrl } : {},
|
|
41082
|
+
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
41083
|
+
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
41084
|
+
...wcProjectId ? { wcProjectId } : {},
|
|
41085
|
+
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {}
|
|
41086
|
+
}
|
|
41087
|
+
};
|
|
41088
|
+
}
|
|
41089
|
+
function resolveRealConfig(env) {
|
|
41090
|
+
const problems = [];
|
|
41091
|
+
const missing = [];
|
|
41092
|
+
const signer = env["DH_SIGNER"];
|
|
41093
|
+
if (signer !== void 0 && signer !== "") {
|
|
41094
|
+
if (signer === "mock-simulated") {
|
|
41095
|
+
problems.push(
|
|
41096
|
+
"DH_SIGNER='mock-simulated' is the test-world stand-in ceremony and cannot authorize real-protocol operations. On the real adapter use 'external' (your own wallet) or 'keystore', or DH_ADAPTER=mock."
|
|
41097
|
+
);
|
|
41098
|
+
} else if (signer !== "external" && signer !== "keystore") {
|
|
41099
|
+
problems.push(`DH_SIGNER='${signer}' is not supported for the real adapter. Allowed: external | keystore (or unset).`);
|
|
41100
|
+
}
|
|
41101
|
+
}
|
|
41102
|
+
const network = env["DH_NETWORK"] === void 0 || env["DH_NETWORK"] === "" ? "mainnet" : env["DH_NETWORK"];
|
|
41103
|
+
if (NETWORKS[network] === void 0) {
|
|
41104
|
+
problems.push(`DH_NETWORK='${network}' is not supported. Allowed: ${Object.keys(NETWORKS).join(" | ")}.`);
|
|
41105
|
+
}
|
|
41106
|
+
const defaults2 = NETWORK_DEFAULTS[network] ?? NETWORK_DEFAULTS.mainnet;
|
|
41107
|
+
const rpcDrpcKey = env["DRPC_API_KEY"] || void 0;
|
|
41108
|
+
if (rpcDrpcKey !== void 0 && env["ETH_RPC_URL"]) {
|
|
41109
|
+
problems.push("DRPC_API_KEY and ETH_RPC_URL are both set \u2014 set one: DRPC_API_KEY (dRPC, key sent as a header) or ETH_RPC_URL (your own endpoint).");
|
|
41110
|
+
}
|
|
41111
|
+
const rpcUrl = rpcDrpcKey !== void 0 ? DRPC_ENDPOINT[network] ?? DRPC_ENDPOINT.mainnet : env["ETH_RPC_URL"] || defaults2.rpcUrl;
|
|
41112
|
+
const serviceEndpoint = env["DH_SERVICE_ENDPOINT"] || defaults2.serviceEndpoint;
|
|
41113
|
+
if (!/^https:\/\//.test(serviceEndpoint) && !/^http:\/\/(localhost|127\.0\.0\.1)/.test(serviceEndpoint)) {
|
|
41114
|
+
problems.push(`DH_SERVICE_ENDPOINT='${serviceEndpoint}' must be https:// (or http:// on loopback).`);
|
|
41115
|
+
}
|
|
41116
|
+
const litNetwork = env["DH_LIT_NETWORK"] || defaults2.litNetwork;
|
|
41117
|
+
const keystorePath = env["DH_KEYSTORE_PATH"];
|
|
41118
|
+
const keystorePassword = env["DH_KEYSTORE_PASSWORD"];
|
|
41119
|
+
if (keystorePath && !keystorePassword || !keystorePath && keystorePassword) {
|
|
41120
|
+
problems.push("DH_KEYSTORE_PATH and DH_KEYSTORE_PASSWORD must be set together (or neither).");
|
|
41121
|
+
}
|
|
41122
|
+
const stateDir = env["DH_STATE_DIR"];
|
|
41123
|
+
const bridgeUrlFile = env["DH_BRIDGE_URL_FILE"];
|
|
41124
|
+
const bridgeOpenRaw = env["DH_BRIDGE_OPEN"];
|
|
41125
|
+
const wcProjectId = resolveWcProjectId(env["DH_WC_PROJECT_ID"], problems);
|
|
41126
|
+
let bridgeOpenBrowser;
|
|
41127
|
+
if (bridgeOpenRaw !== void 0 && bridgeOpenRaw !== "") {
|
|
41128
|
+
if (bridgeOpenRaw !== "0" && bridgeOpenRaw !== "1") {
|
|
41129
|
+
problems.push(`DH_BRIDGE_OPEN='${bridgeOpenRaw}' must be 0 or 1.`);
|
|
41130
|
+
} else {
|
|
41131
|
+
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
41132
|
+
}
|
|
41133
|
+
}
|
|
41134
|
+
const validatorRaw = env["DH_VALIDATOR_VERSION"];
|
|
41135
|
+
let validatorVersion = defaults2.validatorVersion;
|
|
41136
|
+
if (validatorRaw !== void 0 && validatorRaw !== "") {
|
|
41137
|
+
const n = Number(validatorRaw);
|
|
41138
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
41139
|
+
problems.push(`DH_VALIDATOR_VERSION='${validatorRaw}' must be a positive integer.`);
|
|
41140
|
+
} else {
|
|
41141
|
+
validatorVersion = n;
|
|
41142
|
+
}
|
|
41143
|
+
}
|
|
41144
|
+
if (problems.length > 0) {
|
|
41145
|
+
return {
|
|
41146
|
+
ok: false,
|
|
41147
|
+
error: boundaryError("CONFIG_MISSING", `Real boundary configuration is incomplete:
|
|
41148
|
+
- ${problems.join("\n- ")}`, {
|
|
41149
|
+
details: { missing }
|
|
41150
|
+
})
|
|
41151
|
+
};
|
|
41152
|
+
}
|
|
41153
|
+
return {
|
|
41154
|
+
ok: true,
|
|
41155
|
+
config: {
|
|
41156
|
+
adapter: "real",
|
|
41157
|
+
network,
|
|
41158
|
+
chainId: NETWORKS[network],
|
|
41159
|
+
rpcUrl,
|
|
41160
|
+
...rpcDrpcKey !== void 0 ? { rpcDrpcKey } : {},
|
|
41161
|
+
serviceEndpoint,
|
|
41162
|
+
litNetwork,
|
|
41163
|
+
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {},
|
|
41164
|
+
...signer === "external" || signer === "keystore" ? { signer } : {},
|
|
41165
|
+
...stateDir ? { stateDir } : {},
|
|
41166
|
+
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
41167
|
+
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
41168
|
+
...wcProjectId ? { wcProjectId } : {},
|
|
41169
|
+
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
41170
|
+
}
|
|
41171
|
+
};
|
|
41172
|
+
}
|
|
41173
|
+
|
|
40944
41174
|
// src/boundary/envelope.ts
|
|
40945
41175
|
function okEnvelope(data, source, warnings = []) {
|
|
40946
41176
|
return { ok: true, data, source, warnings };
|
|
@@ -40949,11 +41179,6 @@ function errEnvelope(error) {
|
|
|
40949
41179
|
return { ok: false, error };
|
|
40950
41180
|
}
|
|
40951
41181
|
|
|
40952
|
-
// src/boundary/errors.ts
|
|
40953
|
-
function boundaryError(code, message, extra) {
|
|
40954
|
-
return { code, message, ...extra?.source && { source: extra.source }, ...extra?.details && { details: extra.details } };
|
|
40955
|
-
}
|
|
40956
|
-
|
|
40957
41182
|
// src/boundary/reading-notes.ts
|
|
40958
41183
|
var STATE_FLOW_LINE = "PENDING_DEPOSIT \u2192 ACTIVE (after the first mint) \u2192 REPAID \u2192 CLOSED (after the collateral leaves). EXPIRED/LIQUIDATABLE exist for overdue/undercollateralized positions";
|
|
40959
41184
|
function positionReadingNotes(d) {
|
|
@@ -41003,6 +41228,16 @@ function checkBtcAddress(addr, expected) {
|
|
|
41003
41228
|
}
|
|
41004
41229
|
}
|
|
41005
41230
|
|
|
41231
|
+
// src/util/redact-url.ts
|
|
41232
|
+
var URL_PATTERN = /\b((?:https?|wss?):\/\/)([^\s/?#"'`<>\\]+)([^\s"'`<>\\]*)/gi;
|
|
41233
|
+
function redactUrls(text) {
|
|
41234
|
+
return text.replace(URL_PATTERN, (_whole, scheme, authority, rest) => {
|
|
41235
|
+
const host = authority.includes("@") ? authority.slice(authority.lastIndexOf("@") + 1) : authority;
|
|
41236
|
+
const cut = rest.length > 0 || host !== authority;
|
|
41237
|
+
return `${scheme}${host}${cut ? "/\u2026" : ""}`;
|
|
41238
|
+
});
|
|
41239
|
+
}
|
|
41240
|
+
|
|
41006
41241
|
// src/boundary/math.ts
|
|
41007
41242
|
function collateralValueUcdWei(sats, priceUsd8) {
|
|
41008
41243
|
return sats * priceUsd8 * 100n;
|
|
@@ -41035,10 +41270,11 @@ function stablecoinKindFor(network, stablecoinAddress) {
|
|
|
41035
41270
|
}
|
|
41036
41271
|
function failureToError(f) {
|
|
41037
41272
|
const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "unsupported" ? "NOT_IMPLEMENTED" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
|
|
41038
|
-
const
|
|
41273
|
+
const text = redactUrls(f.message);
|
|
41274
|
+
const message = f.kind === "malformed" ? `${text} (upstream response failed integrity checks)` : text;
|
|
41039
41275
|
return boundaryError(code, message, {
|
|
41040
41276
|
source: f.source,
|
|
41041
|
-
...f.raw ? { details: { upstreamMessage: f.raw } } : {}
|
|
41277
|
+
...f.raw ? { details: { upstreamMessage: redactUrls(f.raw) } } : {}
|
|
41042
41278
|
});
|
|
41043
41279
|
}
|
|
41044
41280
|
var BoundaryCore = class {
|
|
@@ -82372,7 +82608,9 @@ var MIN_CONFIRMATIONS = { mainnet: 6, sepolia: 1 };
|
|
|
82372
82608
|
var RealUpstreamPlugin = class {
|
|
82373
82609
|
constructor(config, wallet, runtime) {
|
|
82374
82610
|
this.config = config;
|
|
82375
|
-
|
|
82611
|
+
const rpc = new import_ethers49.ethers.FetchRequest(config.rpcUrl);
|
|
82612
|
+
if (config.rpcDrpcKey !== void 0) rpc.setHeader("Drpc-Key", config.rpcDrpcKey);
|
|
82613
|
+
this.provider = new import_ethers49.ethers.JsonRpcProvider(rpc, config.chainId);
|
|
82376
82614
|
this.wallet = wallet ?? null;
|
|
82377
82615
|
this.runtime = runtime ?? null;
|
|
82378
82616
|
this.session = wallet ? new LitOpsSession(wallet.connect(this.provider), config.serviceEndpoint, config.chainId) : null;
|
|
@@ -83313,8 +83551,9 @@ var RealUpstreamPlugin = class {
|
|
|
83313
83551
|
}
|
|
83314
83552
|
/** Chain read → mapped value, failures typed. F-PUB-5 (protocol 106): the SPECIFIC
|
|
83315
83553
|
* thrown cause is rendered — a blanket rewrite to a generic message masked the
|
|
83316
|
-
* deliberate `readPendingWithdrawals` gap as an RPC outage.
|
|
83317
|
-
* (
|
|
83554
|
+
* deliberate `readPendingWithdrawals` gap as an RPC outage. Provider errors DO carry
|
|
83555
|
+
* the request URL (ethers' `info.requestUrl`); the server's URL holds no key (it is in
|
|
83556
|
+
* the `Drpc-Key` header) and failureToError redacts every URL regardless. */
|
|
83318
83557
|
async chainRead(fn) {
|
|
83319
83558
|
try {
|
|
83320
83559
|
return upOk(await fn(), this.src("chain-rpc"));
|
|
@@ -85137,216 +85376,6 @@ data: ${JSON.stringify(payload)}
|
|
|
85137
85376
|
}
|
|
85138
85377
|
};
|
|
85139
85378
|
|
|
85140
|
-
// src/boundary/config.ts
|
|
85141
|
-
var NETWORKS = { sepolia: 11155111, mainnet: 1 };
|
|
85142
|
-
var ADAPTERS = ["mock", "real"];
|
|
85143
|
-
var LATENCIES = ["zero", "realistic"];
|
|
85144
|
-
var ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
|
|
85145
|
-
var WC_DISABLED = "off";
|
|
85146
|
-
function resolveWcProjectId(raw, problems) {
|
|
85147
|
-
if (raw === void 0 || raw === "" || raw === WC_DISABLED) return void 0;
|
|
85148
|
-
if (!/^[0-9a-f]{32}$/.test(raw)) {
|
|
85149
|
-
problems.push(`DH_WC_PROJECT_ID must be a 32-char hex WalletConnect project id, or '${WC_DISABLED}' to disable WalletConnect.`);
|
|
85150
|
-
return void 0;
|
|
85151
|
-
}
|
|
85152
|
-
return raw;
|
|
85153
|
-
}
|
|
85154
|
-
var RPC_PROXY_ORIGIN = "https://api.gvnr.xyz";
|
|
85155
|
-
var rpcProxy = (chainId) => `${RPC_PROXY_ORIGIN}/v1/proxy/rpc/${chainId}`;
|
|
85156
|
-
var NETWORK_DEFAULTS = {
|
|
85157
|
-
sepolia: {
|
|
85158
|
-
rpcUrl: rpcProxy(11155111),
|
|
85159
|
-
serviceEndpoint: "https://ops-test.gvnr.xyz",
|
|
85160
|
-
litNetwork: "chipotle",
|
|
85161
|
-
validatorVersion: 3
|
|
85162
|
-
// on-chain validator generation, sepolia (2026-07-30)
|
|
85163
|
-
},
|
|
85164
|
-
mainnet: {
|
|
85165
|
-
rpcUrl: rpcProxy(1),
|
|
85166
|
-
// Cutover 2026-09-08 — see sdk/src/constants/chunks/network-configs.ts for the full
|
|
85167
|
-
// reasoning. Widening, not a rename: ops.gvnr.xyz serves the same broker and cannot be
|
|
85168
|
-
// retired while installed copies call it. The sepolia entry above deliberately stays on
|
|
85169
|
-
// ops-test.gvnr.xyz — there is no ops-test.diamondhands.credit twin (open decision 2).
|
|
85170
|
-
serviceEndpoint: "https://ops.diamondhands.credit",
|
|
85171
|
-
litNetwork: "chipotle",
|
|
85172
|
-
// On-chain PKPValidation generation, mainnet (validatorForVersion(3) is the ONLY
|
|
85173
|
-
// registered validator — verified live 2026-08-05). Without this the SDK defaults
|
|
85174
|
-
// to 1 and createPosition reverts ValidatorNotConfigured in wallet simulation.
|
|
85175
|
-
validatorVersion: 3
|
|
85176
|
-
}
|
|
85177
|
-
};
|
|
85178
|
-
function resolveBoundaryConfig(env) {
|
|
85179
|
-
const adapter2 = env["DH_ADAPTER"] === void 0 || env["DH_ADAPTER"] === "" ? "real" : env["DH_ADAPTER"];
|
|
85180
|
-
if (!ADAPTERS.includes(adapter2)) {
|
|
85181
|
-
return {
|
|
85182
|
-
ok: false,
|
|
85183
|
-
error: boundaryError(
|
|
85184
|
-
"CONFIG_MISSING",
|
|
85185
|
-
`DH_ADAPTER='${adapter2}' is not a valid adapter. Allowed: ${ADAPTERS.join(" | ")}.`,
|
|
85186
|
-
{ details: { invalid: ["DH_ADAPTER"] } }
|
|
85187
|
-
)
|
|
85188
|
-
};
|
|
85189
|
-
}
|
|
85190
|
-
if (adapter2 === "real") return resolveRealConfig(env);
|
|
85191
|
-
const problems = [];
|
|
85192
|
-
const missing = [];
|
|
85193
|
-
const mockDb = env["DH_MOCK_DB"];
|
|
85194
|
-
if (!mockDb) {
|
|
85195
|
-
missing.push("DH_MOCK_DB");
|
|
85196
|
-
problems.push("DH_MOCK_DB is not set (path of the mock world DB file).");
|
|
85197
|
-
}
|
|
85198
|
-
const latency = env["DH_MOCK_LATENCY"];
|
|
85199
|
-
if (!latency) {
|
|
85200
|
-
missing.push("DH_MOCK_LATENCY");
|
|
85201
|
-
problems.push(`DH_MOCK_LATENCY is not set. Allowed: ${LATENCIES.join(" | ")}.`);
|
|
85202
|
-
} else if (!LATENCIES.includes(latency)) {
|
|
85203
|
-
problems.push(`DH_MOCK_LATENCY='${latency}' is invalid. Allowed: ${LATENCIES.join(" | ")}.`);
|
|
85204
|
-
}
|
|
85205
|
-
const borrower = env["DH_MOCK_BORROWER"];
|
|
85206
|
-
if (borrower !== void 0 && borrower !== "" && !ADDRESS_RE.test(borrower)) {
|
|
85207
|
-
problems.push(`DH_MOCK_BORROWER='${borrower}' is not a valid 0x address.`);
|
|
85208
|
-
}
|
|
85209
|
-
const SIGNER_MODES = ["external", "keystore", "mock-simulated"];
|
|
85210
|
-
const signer = env["DH_SIGNER"];
|
|
85211
|
-
if (signer !== void 0 && signer !== "" && !SIGNER_MODES.includes(signer)) {
|
|
85212
|
-
problems.push(`DH_SIGNER='${signer}' is not supported for the mock adapter. Allowed: ${SIGNER_MODES.join(" | ")} (or unset).`);
|
|
85213
|
-
}
|
|
85214
|
-
let chainId;
|
|
85215
|
-
const chainRaw = env["DH_MOCK_CHAIN_ID"];
|
|
85216
|
-
if (chainRaw !== void 0 && chainRaw !== "") {
|
|
85217
|
-
const n = Number(chainRaw);
|
|
85218
|
-
if (!Number.isInteger(n) || n <= 0) {
|
|
85219
|
-
problems.push(`DH_MOCK_CHAIN_ID='${chainRaw}' must be a positive integer.`);
|
|
85220
|
-
} else {
|
|
85221
|
-
chainId = n;
|
|
85222
|
-
}
|
|
85223
|
-
}
|
|
85224
|
-
const sinkRpcUrl = env["DH_MOCK_SINK_RPC"];
|
|
85225
|
-
if (sinkRpcUrl !== void 0 && sinkRpcUrl !== "" && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?/.test(sinkRpcUrl)) {
|
|
85226
|
-
problems.push(`DH_MOCK_SINK_RPC='${sinkRpcUrl}' must be a loopback http:// URL (the sink chain never leaves this machine).`);
|
|
85227
|
-
}
|
|
85228
|
-
const bridgeUrlFile = env["DH_BRIDGE_URL_FILE"];
|
|
85229
|
-
const bridgeOpenRaw = env["DH_BRIDGE_OPEN"];
|
|
85230
|
-
const wcProjectId = resolveWcProjectId(env["DH_WC_PROJECT_ID"], problems);
|
|
85231
|
-
let bridgeOpenBrowser;
|
|
85232
|
-
if (bridgeOpenRaw !== void 0 && bridgeOpenRaw !== "") {
|
|
85233
|
-
if (bridgeOpenRaw !== "0" && bridgeOpenRaw !== "1") {
|
|
85234
|
-
problems.push(`DH_BRIDGE_OPEN='${bridgeOpenRaw}' must be 0 or 1.`);
|
|
85235
|
-
} else {
|
|
85236
|
-
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
85237
|
-
}
|
|
85238
|
-
}
|
|
85239
|
-
const keystorePath = env["DH_KEYSTORE_PATH"];
|
|
85240
|
-
const keystorePassword = env["DH_KEYSTORE_PASSWORD"];
|
|
85241
|
-
if (keystorePath && !keystorePassword || !keystorePath && keystorePassword) {
|
|
85242
|
-
problems.push("DH_KEYSTORE_PATH and DH_KEYSTORE_PASSWORD must be set together (or neither).");
|
|
85243
|
-
}
|
|
85244
|
-
if (problems.length > 0) {
|
|
85245
|
-
return {
|
|
85246
|
-
ok: false,
|
|
85247
|
-
error: boundaryError("CONFIG_MISSING", `Mock boundary configuration is incomplete:
|
|
85248
|
-
- ${problems.join("\n- ")}`, {
|
|
85249
|
-
details: { missing }
|
|
85250
|
-
})
|
|
85251
|
-
};
|
|
85252
|
-
}
|
|
85253
|
-
return {
|
|
85254
|
-
ok: true,
|
|
85255
|
-
config: {
|
|
85256
|
-
adapter: "mock",
|
|
85257
|
-
mockDb,
|
|
85258
|
-
latency,
|
|
85259
|
-
...borrower ? { borrower } : {},
|
|
85260
|
-
...signer ? { signer } : {},
|
|
85261
|
-
chainId: chainId ?? 1337,
|
|
85262
|
-
...sinkRpcUrl ? { sinkRpcUrl } : {},
|
|
85263
|
-
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
85264
|
-
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
85265
|
-
...wcProjectId ? { wcProjectId } : {},
|
|
85266
|
-
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {}
|
|
85267
|
-
}
|
|
85268
|
-
};
|
|
85269
|
-
}
|
|
85270
|
-
function resolveRealConfig(env) {
|
|
85271
|
-
const problems = [];
|
|
85272
|
-
const missing = [];
|
|
85273
|
-
const signer = env["DH_SIGNER"];
|
|
85274
|
-
if (signer !== void 0 && signer !== "") {
|
|
85275
|
-
if (signer === "mock-simulated") {
|
|
85276
|
-
problems.push(
|
|
85277
|
-
"DH_SIGNER='mock-simulated' is the test-world stand-in ceremony and cannot authorize real-protocol operations. On the real adapter use 'external' (your own wallet) or 'keystore', or DH_ADAPTER=mock."
|
|
85278
|
-
);
|
|
85279
|
-
} else if (signer !== "external" && signer !== "keystore") {
|
|
85280
|
-
problems.push(`DH_SIGNER='${signer}' is not supported for the real adapter. Allowed: external | keystore (or unset).`);
|
|
85281
|
-
}
|
|
85282
|
-
}
|
|
85283
|
-
const network = env["DH_NETWORK"] === void 0 || env["DH_NETWORK"] === "" ? "mainnet" : env["DH_NETWORK"];
|
|
85284
|
-
if (NETWORKS[network] === void 0) {
|
|
85285
|
-
problems.push(`DH_NETWORK='${network}' is not supported. Allowed: ${Object.keys(NETWORKS).join(" | ")}.`);
|
|
85286
|
-
}
|
|
85287
|
-
const defaults2 = NETWORK_DEFAULTS[network] ?? NETWORK_DEFAULTS.mainnet;
|
|
85288
|
-
const rpcUrl = env["ETH_RPC_URL"] || defaults2.rpcUrl;
|
|
85289
|
-
const serviceEndpoint = env["DH_SERVICE_ENDPOINT"] || defaults2.serviceEndpoint;
|
|
85290
|
-
if (!/^https:\/\//.test(serviceEndpoint) && !/^http:\/\/(localhost|127\.0\.0\.1)/.test(serviceEndpoint)) {
|
|
85291
|
-
problems.push(`DH_SERVICE_ENDPOINT='${serviceEndpoint}' must be https:// (or http:// on loopback).`);
|
|
85292
|
-
}
|
|
85293
|
-
const litNetwork = env["DH_LIT_NETWORK"] || defaults2.litNetwork;
|
|
85294
|
-
const keystorePath = env["DH_KEYSTORE_PATH"];
|
|
85295
|
-
const keystorePassword = env["DH_KEYSTORE_PASSWORD"];
|
|
85296
|
-
if (keystorePath && !keystorePassword || !keystorePath && keystorePassword) {
|
|
85297
|
-
problems.push("DH_KEYSTORE_PATH and DH_KEYSTORE_PASSWORD must be set together (or neither).");
|
|
85298
|
-
}
|
|
85299
|
-
const stateDir = env["DH_STATE_DIR"];
|
|
85300
|
-
const bridgeUrlFile = env["DH_BRIDGE_URL_FILE"];
|
|
85301
|
-
const bridgeOpenRaw = env["DH_BRIDGE_OPEN"];
|
|
85302
|
-
const wcProjectId = resolveWcProjectId(env["DH_WC_PROJECT_ID"], problems);
|
|
85303
|
-
let bridgeOpenBrowser;
|
|
85304
|
-
if (bridgeOpenRaw !== void 0 && bridgeOpenRaw !== "") {
|
|
85305
|
-
if (bridgeOpenRaw !== "0" && bridgeOpenRaw !== "1") {
|
|
85306
|
-
problems.push(`DH_BRIDGE_OPEN='${bridgeOpenRaw}' must be 0 or 1.`);
|
|
85307
|
-
} else {
|
|
85308
|
-
bridgeOpenBrowser = bridgeOpenRaw === "1";
|
|
85309
|
-
}
|
|
85310
|
-
}
|
|
85311
|
-
const validatorRaw = env["DH_VALIDATOR_VERSION"];
|
|
85312
|
-
let validatorVersion = defaults2.validatorVersion;
|
|
85313
|
-
if (validatorRaw !== void 0 && validatorRaw !== "") {
|
|
85314
|
-
const n = Number(validatorRaw);
|
|
85315
|
-
if (!Number.isInteger(n) || n <= 0) {
|
|
85316
|
-
problems.push(`DH_VALIDATOR_VERSION='${validatorRaw}' must be a positive integer.`);
|
|
85317
|
-
} else {
|
|
85318
|
-
validatorVersion = n;
|
|
85319
|
-
}
|
|
85320
|
-
}
|
|
85321
|
-
if (problems.length > 0) {
|
|
85322
|
-
return {
|
|
85323
|
-
ok: false,
|
|
85324
|
-
error: boundaryError("CONFIG_MISSING", `Real boundary configuration is incomplete:
|
|
85325
|
-
- ${problems.join("\n- ")}`, {
|
|
85326
|
-
details: { missing }
|
|
85327
|
-
})
|
|
85328
|
-
};
|
|
85329
|
-
}
|
|
85330
|
-
return {
|
|
85331
|
-
ok: true,
|
|
85332
|
-
config: {
|
|
85333
|
-
adapter: "real",
|
|
85334
|
-
network,
|
|
85335
|
-
chainId: NETWORKS[network],
|
|
85336
|
-
rpcUrl,
|
|
85337
|
-
serviceEndpoint,
|
|
85338
|
-
litNetwork,
|
|
85339
|
-
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {},
|
|
85340
|
-
...signer === "external" || signer === "keystore" ? { signer } : {},
|
|
85341
|
-
...stateDir ? { stateDir } : {},
|
|
85342
|
-
...bridgeUrlFile ? { bridgeUrlFile } : {},
|
|
85343
|
-
...bridgeOpenBrowser !== void 0 ? { bridgeOpenBrowser } : {},
|
|
85344
|
-
...wcProjectId ? { wcProjectId } : {},
|
|
85345
|
-
...validatorVersion !== void 0 ? { validatorVersion } : {}
|
|
85346
|
-
}
|
|
85347
|
-
};
|
|
85348
|
-
}
|
|
85349
|
-
|
|
85350
85379
|
// src/boundary/index.ts
|
|
85351
85380
|
function fileSignerPersistence(filePath) {
|
|
85352
85381
|
return {
|
|
@@ -85504,7 +85533,10 @@ async function createRealBoundary(config, wallet, overrides) {
|
|
|
85504
85533
|
const chainName = config.network === "mainnet" ? "Ethereum Mainnet" : "Sepolia";
|
|
85505
85534
|
const bridge = new SignatureBridge({
|
|
85506
85535
|
...config.bridgeUrlFile ? { urlFile: config.bridgeUrlFile } : {},
|
|
85507
|
-
|
|
85536
|
+
// The page's wallet_addEthereumChain gets the PUBLIC proxy, never config.rpcUrl: the
|
|
85537
|
+
// server's endpoint is a server credential, and the page would save it into the
|
|
85538
|
+
// user's wallet.
|
|
85539
|
+
network: { chainId: config.chainId, chainName, rpcUrl: publicRpcUrl(config.chainId) },
|
|
85508
85540
|
...config.wcProjectId ? { wc: { projectId: config.wcProjectId, chainId: config.chainId } } : {},
|
|
85509
85541
|
// Plan 17 E2 (SVC-OPS-08): the HOSTED tier caps ceremonies at concurrent-1 per
|
|
85510
85542
|
// tenant — one bridge per tenant world, so the bridge cap IS the tenant cap. The
|
package/dist/connector-embed.js
CHANGED
|
@@ -27602,7 +27602,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27602
27602
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27603
27603
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27604
27604
|
if (this.config.debug) {
|
|
27605
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27605
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27606
27606
|
}
|
|
27607
27607
|
}
|
|
27608
27608
|
if (this.config.network === "chipotle") {
|
|
@@ -27778,7 +27778,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27778
27778
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27779
27779
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27780
27780
|
if (this.config.debug) {
|
|
27781
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27781
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27782
27782
|
}
|
|
27783
27783
|
}
|
|
27784
27784
|
if (this.config.network === "chipotle") {
|
|
@@ -28116,7 +28116,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28116
28116
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28117
28117
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28118
28118
|
if (this.config.debug) {
|
|
28119
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
28119
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28120
28120
|
}
|
|
28121
28121
|
}
|
|
28122
28122
|
if (this.config.network === "chipotle") {
|
|
@@ -28332,7 +28332,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28332
28332
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28333
28333
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28334
28334
|
if (this.config.debug) {
|
|
28335
|
-
console.log(" EVM RPC URL override:", request.rpcUrl);
|
|
28335
|
+
console.log(" EVM RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28336
28336
|
}
|
|
28337
28337
|
}
|
|
28338
28338
|
if (this.config.debug) {
|
|
@@ -28462,7 +28462,12 @@ var require_lit_ops_module = __commonJS({
|
|
|
28462
28462
|
if (!moduleAddress || !provisionerPk || !baseRpc) {
|
|
28463
28463
|
throw new Error("LIT_VAULT_PROVISION_MODE=module requires LIT_ONCHAIN_VAULT_MODULE_ADDRESS, LIT_ONCHAIN_PROVISIONER_PRIVATE_KEY, BASE_RPC_URL");
|
|
28464
28464
|
}
|
|
28465
|
-
const
|
|
28465
|
+
const baseRequest = new ethers_1.FetchRequest(baseRpc);
|
|
28466
|
+
const drpcKey = process.env.DRPC_API_KEY;
|
|
28467
|
+
if (drpcKey && /(^|\.)drpc\.(org|live)$/.test(new URL(baseRpc).hostname)) {
|
|
28468
|
+
baseRequest.setHeader("Drpc-Key", drpcKey);
|
|
28469
|
+
}
|
|
28470
|
+
const provider = new ethers_1.JsonRpcProvider(baseRequest);
|
|
28466
28471
|
const signer = new ethers_1.Wallet(provisionerPk, provider);
|
|
28467
28472
|
const chainId = Number(process.env.BASE_CHAIN_ID || "8453");
|
|
28468
28473
|
const issuedAt = Math.floor(Date.now() / 1e3);
|
|
@@ -41235,7 +41240,7 @@ function htmlPageSecurityHeaders(extra) {
|
|
|
41235
41240
|
}
|
|
41236
41241
|
|
|
41237
41242
|
// src/version.ts
|
|
41238
|
-
var SERVER_VERSION = "0.5.
|
|
41243
|
+
var SERVER_VERSION = "0.5.23";
|
|
41239
41244
|
|
|
41240
41245
|
// src/connector/siwe-oauth.ts
|
|
41241
41246
|
var import_node_crypto3 = require("crypto");
|
|
@@ -42080,6 +42085,11 @@ function resolveWcProjectId(raw, problems) {
|
|
|
42080
42085
|
}
|
|
42081
42086
|
var RPC_PROXY_ORIGIN = "https://api.gvnr.xyz";
|
|
42082
42087
|
var rpcProxy = (chainId) => `${RPC_PROXY_ORIGIN}/v1/proxy/rpc/${chainId}`;
|
|
42088
|
+
var publicRpcUrl = rpcProxy;
|
|
42089
|
+
var DRPC_ENDPOINT = {
|
|
42090
|
+
mainnet: "https://lb.drpc.live/ethereum",
|
|
42091
|
+
sepolia: "https://lb.drpc.live/sepolia"
|
|
42092
|
+
};
|
|
42083
42093
|
var NETWORK_DEFAULTS = {
|
|
42084
42094
|
sepolia: {
|
|
42085
42095
|
rpcUrl: rpcProxy(11155111),
|
|
@@ -42212,7 +42222,11 @@ function resolveRealConfig(env) {
|
|
|
42212
42222
|
problems.push(`DH_NETWORK='${network}' is not supported. Allowed: ${Object.keys(NETWORKS).join(" | ")}.`);
|
|
42213
42223
|
}
|
|
42214
42224
|
const defaults2 = NETWORK_DEFAULTS[network] ?? NETWORK_DEFAULTS.mainnet;
|
|
42215
|
-
const
|
|
42225
|
+
const rpcDrpcKey = env["DRPC_API_KEY"] || void 0;
|
|
42226
|
+
if (rpcDrpcKey !== void 0 && env["ETH_RPC_URL"]) {
|
|
42227
|
+
problems.push("DRPC_API_KEY and ETH_RPC_URL are both set \u2014 set one: DRPC_API_KEY (dRPC, key sent as a header) or ETH_RPC_URL (your own endpoint).");
|
|
42228
|
+
}
|
|
42229
|
+
const rpcUrl = rpcDrpcKey !== void 0 ? DRPC_ENDPOINT[network] ?? DRPC_ENDPOINT.mainnet : env["ETH_RPC_URL"] || defaults2.rpcUrl;
|
|
42216
42230
|
const serviceEndpoint = env["DH_SERVICE_ENDPOINT"] || defaults2.serviceEndpoint;
|
|
42217
42231
|
if (!/^https:\/\//.test(serviceEndpoint) && !/^http:\/\/(localhost|127\.0\.0\.1)/.test(serviceEndpoint)) {
|
|
42218
42232
|
problems.push(`DH_SERVICE_ENDPOINT='${serviceEndpoint}' must be https:// (or http:// on loopback).`);
|
|
@@ -42261,6 +42275,7 @@ function resolveRealConfig(env) {
|
|
|
42261
42275
|
network,
|
|
42262
42276
|
chainId: NETWORKS[network],
|
|
42263
42277
|
rpcUrl,
|
|
42278
|
+
...rpcDrpcKey !== void 0 ? { rpcDrpcKey } : {},
|
|
42264
42279
|
serviceEndpoint,
|
|
42265
42280
|
litNetwork,
|
|
42266
42281
|
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {},
|
|
@@ -42342,6 +42357,16 @@ function checkBtcAddress(addr, expected) {
|
|
|
42342
42357
|
}
|
|
42343
42358
|
}
|
|
42344
42359
|
|
|
42360
|
+
// src/util/redact-url.ts
|
|
42361
|
+
var URL_PATTERN = /\b((?:https?|wss?):\/\/)([^\s/?#"'`<>\\]+)([^\s"'`<>\\]*)/gi;
|
|
42362
|
+
function redactUrls(text) {
|
|
42363
|
+
return text.replace(URL_PATTERN, (_whole, scheme, authority, rest) => {
|
|
42364
|
+
const host = authority.includes("@") ? authority.slice(authority.lastIndexOf("@") + 1) : authority;
|
|
42365
|
+
const cut = rest.length > 0 || host !== authority;
|
|
42366
|
+
return `${scheme}${host}${cut ? "/\u2026" : ""}`;
|
|
42367
|
+
});
|
|
42368
|
+
}
|
|
42369
|
+
|
|
42345
42370
|
// src/boundary/math.ts
|
|
42346
42371
|
function collateralValueUcdWei(sats, priceUsd8) {
|
|
42347
42372
|
return sats * priceUsd8 * 100n;
|
|
@@ -42374,10 +42399,11 @@ function stablecoinKindFor(network, stablecoinAddress) {
|
|
|
42374
42399
|
}
|
|
42375
42400
|
function failureToError(f) {
|
|
42376
42401
|
const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "unsupported" ? "NOT_IMPLEMENTED" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
|
|
42377
|
-
const
|
|
42402
|
+
const text = redactUrls(f.message);
|
|
42403
|
+
const message = f.kind === "malformed" ? `${text} (upstream response failed integrity checks)` : text;
|
|
42378
42404
|
return boundaryError(code, message, {
|
|
42379
42405
|
source: f.source,
|
|
42380
|
-
...f.raw ? { details: { upstreamMessage: f.raw } } : {}
|
|
42406
|
+
...f.raw ? { details: { upstreamMessage: redactUrls(f.raw) } } : {}
|
|
42381
42407
|
});
|
|
42382
42408
|
}
|
|
42383
42409
|
var BoundaryCore = class {
|
|
@@ -83720,7 +83746,9 @@ var MIN_CONFIRMATIONS = { mainnet: 6, sepolia: 1 };
|
|
|
83720
83746
|
var RealUpstreamPlugin = class {
|
|
83721
83747
|
constructor(config, wallet, runtime) {
|
|
83722
83748
|
this.config = config;
|
|
83723
|
-
|
|
83749
|
+
const rpc = new import_ethers51.ethers.FetchRequest(config.rpcUrl);
|
|
83750
|
+
if (config.rpcDrpcKey !== void 0) rpc.setHeader("Drpc-Key", config.rpcDrpcKey);
|
|
83751
|
+
this.provider = new import_ethers51.ethers.JsonRpcProvider(rpc, config.chainId);
|
|
83724
83752
|
this.wallet = wallet ?? null;
|
|
83725
83753
|
this.runtime = runtime ?? null;
|
|
83726
83754
|
this.session = wallet ? new LitOpsSession(wallet.connect(this.provider), config.serviceEndpoint, config.chainId) : null;
|
|
@@ -84661,8 +84689,9 @@ var RealUpstreamPlugin = class {
|
|
|
84661
84689
|
}
|
|
84662
84690
|
/** Chain read → mapped value, failures typed. F-PUB-5 (protocol 106): the SPECIFIC
|
|
84663
84691
|
* thrown cause is rendered — a blanket rewrite to a generic message masked the
|
|
84664
|
-
* deliberate `readPendingWithdrawals` gap as an RPC outage.
|
|
84665
|
-
* (
|
|
84692
|
+
* deliberate `readPendingWithdrawals` gap as an RPC outage. Provider errors DO carry
|
|
84693
|
+
* the request URL (ethers' `info.requestUrl`); the server's URL holds no key (it is in
|
|
84694
|
+
* the `Drpc-Key` header) and failureToError redacts every URL regardless. */
|
|
84666
84695
|
async chainRead(fn) {
|
|
84667
84696
|
try {
|
|
84668
84697
|
return upOk(await fn(), this.src("chain-rpc"));
|
|
@@ -86540,7 +86569,10 @@ async function createRealBoundary(config, wallet, overrides) {
|
|
|
86540
86569
|
const chainName = config.network === "mainnet" ? "Ethereum Mainnet" : "Sepolia";
|
|
86541
86570
|
const bridge = new SignatureBridge({
|
|
86542
86571
|
...config.bridgeUrlFile ? { urlFile: config.bridgeUrlFile } : {},
|
|
86543
|
-
|
|
86572
|
+
// The page's wallet_addEthereumChain gets the PUBLIC proxy, never config.rpcUrl: the
|
|
86573
|
+
// server's endpoint is a server credential, and the page would save it into the
|
|
86574
|
+
// user's wallet.
|
|
86575
|
+
network: { chainId: config.chainId, chainName, rpcUrl: publicRpcUrl(config.chainId) },
|
|
86544
86576
|
...config.wcProjectId ? { wc: { projectId: config.wcProjectId, chainId: config.chainId } } : {},
|
|
86545
86577
|
// Plan 17 E2 (SVC-OPS-08): the HOSTED tier caps ceremonies at concurrent-1 per
|
|
86546
86578
|
// tenant — one bridge per tenant world, so the bridge cap IS the tenant cap. The
|
package/dist/connector.js
CHANGED
|
@@ -27602,7 +27602,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27602
27602
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27603
27603
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27604
27604
|
if (this.config.debug) {
|
|
27605
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27605
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27606
27606
|
}
|
|
27607
27607
|
}
|
|
27608
27608
|
if (this.config.network === "chipotle") {
|
|
@@ -27778,7 +27778,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27778
27778
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27779
27779
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27780
27780
|
if (this.config.debug) {
|
|
27781
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27781
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27782
27782
|
}
|
|
27783
27783
|
}
|
|
27784
27784
|
if (this.config.network === "chipotle") {
|
|
@@ -28116,7 +28116,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28116
28116
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28117
28117
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28118
28118
|
if (this.config.debug) {
|
|
28119
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
28119
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28120
28120
|
}
|
|
28121
28121
|
}
|
|
28122
28122
|
if (this.config.network === "chipotle") {
|
|
@@ -28332,7 +28332,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28332
28332
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28333
28333
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28334
28334
|
if (this.config.debug) {
|
|
28335
|
-
console.log(" EVM RPC URL override:", request.rpcUrl);
|
|
28335
|
+
console.log(" EVM RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28336
28336
|
}
|
|
28337
28337
|
}
|
|
28338
28338
|
if (this.config.debug) {
|
|
@@ -28462,7 +28462,12 @@ var require_lit_ops_module = __commonJS({
|
|
|
28462
28462
|
if (!moduleAddress || !provisionerPk || !baseRpc) {
|
|
28463
28463
|
throw new Error("LIT_VAULT_PROVISION_MODE=module requires LIT_ONCHAIN_VAULT_MODULE_ADDRESS, LIT_ONCHAIN_PROVISIONER_PRIVATE_KEY, BASE_RPC_URL");
|
|
28464
28464
|
}
|
|
28465
|
-
const
|
|
28465
|
+
const baseRequest = new ethers_1.FetchRequest(baseRpc);
|
|
28466
|
+
const drpcKey = process.env.DRPC_API_KEY;
|
|
28467
|
+
if (drpcKey && /(^|\.)drpc\.(org|live)$/.test(new URL(baseRpc).hostname)) {
|
|
28468
|
+
baseRequest.setHeader("Drpc-Key", drpcKey);
|
|
28469
|
+
}
|
|
28470
|
+
const provider = new ethers_1.JsonRpcProvider(baseRequest);
|
|
28466
28471
|
const signer = new ethers_1.Wallet(provisionerPk, provider);
|
|
28467
28472
|
const chainId = Number(process.env.BASE_CHAIN_ID || "8453");
|
|
28468
28473
|
const issuedAt = Math.floor(Date.now() / 1e3);
|
|
@@ -41229,7 +41234,7 @@ function htmlPageSecurityHeaders(extra) {
|
|
|
41229
41234
|
}
|
|
41230
41235
|
|
|
41231
41236
|
// src/version.ts
|
|
41232
|
-
var SERVER_VERSION = "0.5.
|
|
41237
|
+
var SERVER_VERSION = "0.5.23";
|
|
41233
41238
|
|
|
41234
41239
|
// src/connector/siwe-oauth.ts
|
|
41235
41240
|
var import_node_crypto3 = require("crypto");
|
|
@@ -42074,6 +42079,11 @@ function resolveWcProjectId(raw, problems) {
|
|
|
42074
42079
|
}
|
|
42075
42080
|
var RPC_PROXY_ORIGIN = "https://api.gvnr.xyz";
|
|
42076
42081
|
var rpcProxy = (chainId) => `${RPC_PROXY_ORIGIN}/v1/proxy/rpc/${chainId}`;
|
|
42082
|
+
var publicRpcUrl = rpcProxy;
|
|
42083
|
+
var DRPC_ENDPOINT = {
|
|
42084
|
+
mainnet: "https://lb.drpc.live/ethereum",
|
|
42085
|
+
sepolia: "https://lb.drpc.live/sepolia"
|
|
42086
|
+
};
|
|
42077
42087
|
var NETWORK_DEFAULTS = {
|
|
42078
42088
|
sepolia: {
|
|
42079
42089
|
rpcUrl: rpcProxy(11155111),
|
|
@@ -42206,7 +42216,11 @@ function resolveRealConfig(env) {
|
|
|
42206
42216
|
problems.push(`DH_NETWORK='${network}' is not supported. Allowed: ${Object.keys(NETWORKS).join(" | ")}.`);
|
|
42207
42217
|
}
|
|
42208
42218
|
const defaults2 = NETWORK_DEFAULTS[network] ?? NETWORK_DEFAULTS.mainnet;
|
|
42209
|
-
const
|
|
42219
|
+
const rpcDrpcKey = env["DRPC_API_KEY"] || void 0;
|
|
42220
|
+
if (rpcDrpcKey !== void 0 && env["ETH_RPC_URL"]) {
|
|
42221
|
+
problems.push("DRPC_API_KEY and ETH_RPC_URL are both set \u2014 set one: DRPC_API_KEY (dRPC, key sent as a header) or ETH_RPC_URL (your own endpoint).");
|
|
42222
|
+
}
|
|
42223
|
+
const rpcUrl = rpcDrpcKey !== void 0 ? DRPC_ENDPOINT[network] ?? DRPC_ENDPOINT.mainnet : env["ETH_RPC_URL"] || defaults2.rpcUrl;
|
|
42210
42224
|
const serviceEndpoint = env["DH_SERVICE_ENDPOINT"] || defaults2.serviceEndpoint;
|
|
42211
42225
|
if (!/^https:\/\//.test(serviceEndpoint) && !/^http:\/\/(localhost|127\.0\.0\.1)/.test(serviceEndpoint)) {
|
|
42212
42226
|
problems.push(`DH_SERVICE_ENDPOINT='${serviceEndpoint}' must be https:// (or http:// on loopback).`);
|
|
@@ -42255,6 +42269,7 @@ function resolveRealConfig(env) {
|
|
|
42255
42269
|
network,
|
|
42256
42270
|
chainId: NETWORKS[network],
|
|
42257
42271
|
rpcUrl,
|
|
42272
|
+
...rpcDrpcKey !== void 0 ? { rpcDrpcKey } : {},
|
|
42258
42273
|
serviceEndpoint,
|
|
42259
42274
|
litNetwork,
|
|
42260
42275
|
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {},
|
|
@@ -42336,6 +42351,16 @@ function checkBtcAddress(addr, expected) {
|
|
|
42336
42351
|
}
|
|
42337
42352
|
}
|
|
42338
42353
|
|
|
42354
|
+
// src/util/redact-url.ts
|
|
42355
|
+
var URL_PATTERN = /\b((?:https?|wss?):\/\/)([^\s/?#"'`<>\\]+)([^\s"'`<>\\]*)/gi;
|
|
42356
|
+
function redactUrls(text) {
|
|
42357
|
+
return text.replace(URL_PATTERN, (_whole, scheme, authority, rest) => {
|
|
42358
|
+
const host = authority.includes("@") ? authority.slice(authority.lastIndexOf("@") + 1) : authority;
|
|
42359
|
+
const cut = rest.length > 0 || host !== authority;
|
|
42360
|
+
return `${scheme}${host}${cut ? "/\u2026" : ""}`;
|
|
42361
|
+
});
|
|
42362
|
+
}
|
|
42363
|
+
|
|
42339
42364
|
// src/boundary/math.ts
|
|
42340
42365
|
function collateralValueUcdWei(sats, priceUsd8) {
|
|
42341
42366
|
return sats * priceUsd8 * 100n;
|
|
@@ -42368,10 +42393,11 @@ function stablecoinKindFor(network, stablecoinAddress) {
|
|
|
42368
42393
|
}
|
|
42369
42394
|
function failureToError(f) {
|
|
42370
42395
|
const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "unsupported" ? "NOT_IMPLEMENTED" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
|
|
42371
|
-
const
|
|
42396
|
+
const text = redactUrls(f.message);
|
|
42397
|
+
const message2 = f.kind === "malformed" ? `${text} (upstream response failed integrity checks)` : text;
|
|
42372
42398
|
return boundaryError(code, message2, {
|
|
42373
42399
|
source: f.source,
|
|
42374
|
-
...f.raw ? { details: { upstreamMessage: f.raw } } : {}
|
|
42400
|
+
...f.raw ? { details: { upstreamMessage: redactUrls(f.raw) } } : {}
|
|
42375
42401
|
});
|
|
42376
42402
|
}
|
|
42377
42403
|
var BoundaryCore = class {
|
|
@@ -83714,7 +83740,9 @@ var MIN_CONFIRMATIONS = { mainnet: 6, sepolia: 1 };
|
|
|
83714
83740
|
var RealUpstreamPlugin = class {
|
|
83715
83741
|
constructor(config, wallet, runtime) {
|
|
83716
83742
|
this.config = config;
|
|
83717
|
-
|
|
83743
|
+
const rpc = new import_ethers51.ethers.FetchRequest(config.rpcUrl);
|
|
83744
|
+
if (config.rpcDrpcKey !== void 0) rpc.setHeader("Drpc-Key", config.rpcDrpcKey);
|
|
83745
|
+
this.provider = new import_ethers51.ethers.JsonRpcProvider(rpc, config.chainId);
|
|
83718
83746
|
this.wallet = wallet ?? null;
|
|
83719
83747
|
this.runtime = runtime ?? null;
|
|
83720
83748
|
this.session = wallet ? new LitOpsSession(wallet.connect(this.provider), config.serviceEndpoint, config.chainId) : null;
|
|
@@ -84655,8 +84683,9 @@ var RealUpstreamPlugin = class {
|
|
|
84655
84683
|
}
|
|
84656
84684
|
/** Chain read → mapped value, failures typed. F-PUB-5 (protocol 106): the SPECIFIC
|
|
84657
84685
|
* thrown cause is rendered — a blanket rewrite to a generic message masked the
|
|
84658
|
-
* deliberate `readPendingWithdrawals` gap as an RPC outage.
|
|
84659
|
-
* (
|
|
84686
|
+
* deliberate `readPendingWithdrawals` gap as an RPC outage. Provider errors DO carry
|
|
84687
|
+
* the request URL (ethers' `info.requestUrl`); the server's URL holds no key (it is in
|
|
84688
|
+
* the `Drpc-Key` header) and failureToError redacts every URL regardless. */
|
|
84660
84689
|
async chainRead(fn) {
|
|
84661
84690
|
try {
|
|
84662
84691
|
return upOk(await fn(), this.src("chain-rpc"));
|
|
@@ -86534,7 +86563,10 @@ async function createRealBoundary(config, wallet, overrides) {
|
|
|
86534
86563
|
const chainName = config.network === "mainnet" ? "Ethereum Mainnet" : "Sepolia";
|
|
86535
86564
|
const bridge = new SignatureBridge({
|
|
86536
86565
|
...config.bridgeUrlFile ? { urlFile: config.bridgeUrlFile } : {},
|
|
86537
|
-
|
|
86566
|
+
// The page's wallet_addEthereumChain gets the PUBLIC proxy, never config.rpcUrl: the
|
|
86567
|
+
// server's endpoint is a server credential, and the page would save it into the
|
|
86568
|
+
// user's wallet.
|
|
86569
|
+
network: { chainId: config.chainId, chainName, rpcUrl: publicRpcUrl(config.chainId) },
|
|
86538
86570
|
...config.wcProjectId ? { wc: { projectId: config.wcProjectId, chainId: config.chainId } } : {},
|
|
86539
86571
|
// Plan 17 E2 (SVC-OPS-08): the HOSTED tier caps ceremonies at concurrent-1 per
|
|
86540
86572
|
// tenant — one bridge per tenant world, so the bridge cap IS the tenant cap. The
|
package/dist/index.js
CHANGED
|
@@ -27397,7 +27397,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27397
27397
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27398
27398
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27399
27399
|
if (this.config.debug) {
|
|
27400
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27400
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27401
27401
|
}
|
|
27402
27402
|
}
|
|
27403
27403
|
if (this.config.network === "chipotle") {
|
|
@@ -27573,7 +27573,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27573
27573
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27574
27574
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27575
27575
|
if (this.config.debug) {
|
|
27576
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27576
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27577
27577
|
}
|
|
27578
27578
|
}
|
|
27579
27579
|
if (this.config.network === "chipotle") {
|
|
@@ -27911,7 +27911,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
27911
27911
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
27912
27912
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
27913
27913
|
if (this.config.debug) {
|
|
27914
|
-
console.log(" RPC URL override:", request.rpcUrl);
|
|
27914
|
+
console.log(" RPC URL override host:", new URL(request.rpcUrl).host);
|
|
27915
27915
|
}
|
|
27916
27916
|
}
|
|
27917
27917
|
if (this.config.network === "chipotle") {
|
|
@@ -28127,7 +28127,7 @@ var require_lit_ops_module = __commonJS({
|
|
|
28127
28127
|
litActionParams.rpcUrl = request.rpcUrl;
|
|
28128
28128
|
litActionParams.customRpcUrl = request.rpcUrl;
|
|
28129
28129
|
if (this.config.debug) {
|
|
28130
|
-
console.log(" EVM RPC URL override:", request.rpcUrl);
|
|
28130
|
+
console.log(" EVM RPC URL override host:", new URL(request.rpcUrl).host);
|
|
28131
28131
|
}
|
|
28132
28132
|
}
|
|
28133
28133
|
if (this.config.debug) {
|
|
@@ -28257,7 +28257,12 @@ var require_lit_ops_module = __commonJS({
|
|
|
28257
28257
|
if (!moduleAddress || !provisionerPk || !baseRpc) {
|
|
28258
28258
|
throw new Error("LIT_VAULT_PROVISION_MODE=module requires LIT_ONCHAIN_VAULT_MODULE_ADDRESS, LIT_ONCHAIN_PROVISIONER_PRIVATE_KEY, BASE_RPC_URL");
|
|
28259
28259
|
}
|
|
28260
|
-
const
|
|
28260
|
+
const baseRequest = new ethers_1.FetchRequest(baseRpc);
|
|
28261
|
+
const drpcKey = process.env.DRPC_API_KEY;
|
|
28262
|
+
if (drpcKey && /(^|\.)drpc\.(org|live)$/.test(new URL(baseRpc).hostname)) {
|
|
28263
|
+
baseRequest.setHeader("Drpc-Key", drpcKey);
|
|
28264
|
+
}
|
|
28265
|
+
const provider = new ethers_1.JsonRpcProvider(baseRequest);
|
|
28261
28266
|
const signer = new ethers_1.Wallet(provisionerPk, provider);
|
|
28262
28267
|
const chainId = Number(process.env.BASE_CHAIN_ID || "8453");
|
|
28263
28268
|
const issuedAt = Math.floor(Date.now() / 1e3);
|
|
@@ -40964,6 +40969,11 @@ function resolveWcProjectId(raw, problems) {
|
|
|
40964
40969
|
}
|
|
40965
40970
|
var RPC_PROXY_ORIGIN = "https://api.gvnr.xyz";
|
|
40966
40971
|
var rpcProxy = (chainId) => `${RPC_PROXY_ORIGIN}/v1/proxy/rpc/${chainId}`;
|
|
40972
|
+
var publicRpcUrl = rpcProxy;
|
|
40973
|
+
var DRPC_ENDPOINT = {
|
|
40974
|
+
mainnet: "https://lb.drpc.live/ethereum",
|
|
40975
|
+
sepolia: "https://lb.drpc.live/sepolia"
|
|
40976
|
+
};
|
|
40967
40977
|
var NETWORK_DEFAULTS = {
|
|
40968
40978
|
sepolia: {
|
|
40969
40979
|
rpcUrl: rpcProxy(11155111),
|
|
@@ -41096,7 +41106,11 @@ function resolveRealConfig(env) {
|
|
|
41096
41106
|
problems.push(`DH_NETWORK='${network}' is not supported. Allowed: ${Object.keys(NETWORKS).join(" | ")}.`);
|
|
41097
41107
|
}
|
|
41098
41108
|
const defaults2 = NETWORK_DEFAULTS[network] ?? NETWORK_DEFAULTS.mainnet;
|
|
41099
|
-
const
|
|
41109
|
+
const rpcDrpcKey = env["DRPC_API_KEY"] || void 0;
|
|
41110
|
+
if (rpcDrpcKey !== void 0 && env["ETH_RPC_URL"]) {
|
|
41111
|
+
problems.push("DRPC_API_KEY and ETH_RPC_URL are both set \u2014 set one: DRPC_API_KEY (dRPC, key sent as a header) or ETH_RPC_URL (your own endpoint).");
|
|
41112
|
+
}
|
|
41113
|
+
const rpcUrl = rpcDrpcKey !== void 0 ? DRPC_ENDPOINT[network] ?? DRPC_ENDPOINT.mainnet : env["ETH_RPC_URL"] || defaults2.rpcUrl;
|
|
41100
41114
|
const serviceEndpoint = env["DH_SERVICE_ENDPOINT"] || defaults2.serviceEndpoint;
|
|
41101
41115
|
if (!/^https:\/\//.test(serviceEndpoint) && !/^http:\/\/(localhost|127\.0\.0\.1)/.test(serviceEndpoint)) {
|
|
41102
41116
|
problems.push(`DH_SERVICE_ENDPOINT='${serviceEndpoint}' must be https:// (or http:// on loopback).`);
|
|
@@ -41145,6 +41159,7 @@ function resolveRealConfig(env) {
|
|
|
41145
41159
|
network,
|
|
41146
41160
|
chainId: NETWORKS[network],
|
|
41147
41161
|
rpcUrl,
|
|
41162
|
+
...rpcDrpcKey !== void 0 ? { rpcDrpcKey } : {},
|
|
41148
41163
|
serviceEndpoint,
|
|
41149
41164
|
litNetwork,
|
|
41150
41165
|
...keystorePath && keystorePassword ? { keystorePath, keystorePassword } : {},
|
|
@@ -41226,6 +41241,16 @@ function checkBtcAddress(addr, expected) {
|
|
|
41226
41241
|
}
|
|
41227
41242
|
}
|
|
41228
41243
|
|
|
41244
|
+
// src/util/redact-url.ts
|
|
41245
|
+
var URL_PATTERN = /\b((?:https?|wss?):\/\/)([^\s/?#"'`<>\\]+)([^\s"'`<>\\]*)/gi;
|
|
41246
|
+
function redactUrls(text) {
|
|
41247
|
+
return text.replace(URL_PATTERN, (_whole, scheme, authority, rest) => {
|
|
41248
|
+
const host = authority.includes("@") ? authority.slice(authority.lastIndexOf("@") + 1) : authority;
|
|
41249
|
+
const cut = rest.length > 0 || host !== authority;
|
|
41250
|
+
return `${scheme}${host}${cut ? "/\u2026" : ""}`;
|
|
41251
|
+
});
|
|
41252
|
+
}
|
|
41253
|
+
|
|
41229
41254
|
// src/boundary/math.ts
|
|
41230
41255
|
function collateralValueUcdWei(sats, priceUsd8) {
|
|
41231
41256
|
return sats * priceUsd8 * 100n;
|
|
@@ -41258,10 +41283,11 @@ function stablecoinKindFor(network, stablecoinAddress) {
|
|
|
41258
41283
|
}
|
|
41259
41284
|
function failureToError(f) {
|
|
41260
41285
|
const code = f.kind === "signer-missing" ? "SIGNER_UNAVAILABLE" : f.kind === "unavailable" ? "UPSTREAM_UNAVAILABLE" : f.kind === "unsupported" ? "NOT_IMPLEMENTED" : f.kind === "not-found" ? "NOT_FOUND" : "UPSTREAM_REJECTED";
|
|
41261
|
-
const
|
|
41286
|
+
const text = redactUrls(f.message);
|
|
41287
|
+
const message = f.kind === "malformed" ? `${text} (upstream response failed integrity checks)` : text;
|
|
41262
41288
|
return boundaryError(code, message, {
|
|
41263
41289
|
source: f.source,
|
|
41264
|
-
...f.raw ? { details: { upstreamMessage: f.raw } } : {}
|
|
41290
|
+
...f.raw ? { details: { upstreamMessage: redactUrls(f.raw) } } : {}
|
|
41265
41291
|
});
|
|
41266
41292
|
}
|
|
41267
41293
|
var BoundaryCore = class {
|
|
@@ -82595,7 +82621,9 @@ var MIN_CONFIRMATIONS = { mainnet: 6, sepolia: 1 };
|
|
|
82595
82621
|
var RealUpstreamPlugin = class {
|
|
82596
82622
|
constructor(config, wallet, runtime) {
|
|
82597
82623
|
this.config = config;
|
|
82598
|
-
|
|
82624
|
+
const rpc = new import_ethers49.ethers.FetchRequest(config.rpcUrl);
|
|
82625
|
+
if (config.rpcDrpcKey !== void 0) rpc.setHeader("Drpc-Key", config.rpcDrpcKey);
|
|
82626
|
+
this.provider = new import_ethers49.ethers.JsonRpcProvider(rpc, config.chainId);
|
|
82599
82627
|
this.wallet = wallet ?? null;
|
|
82600
82628
|
this.runtime = runtime ?? null;
|
|
82601
82629
|
this.session = wallet ? new LitOpsSession(wallet.connect(this.provider), config.serviceEndpoint, config.chainId) : null;
|
|
@@ -83536,8 +83564,9 @@ var RealUpstreamPlugin = class {
|
|
|
83536
83564
|
}
|
|
83537
83565
|
/** Chain read → mapped value, failures typed. F-PUB-5 (protocol 106): the SPECIFIC
|
|
83538
83566
|
* thrown cause is rendered — a blanket rewrite to a generic message masked the
|
|
83539
|
-
* deliberate `readPendingWithdrawals` gap as an RPC outage.
|
|
83540
|
-
* (
|
|
83567
|
+
* deliberate `readPendingWithdrawals` gap as an RPC outage. Provider errors DO carry
|
|
83568
|
+
* the request URL (ethers' `info.requestUrl`); the server's URL holds no key (it is in
|
|
83569
|
+
* the `Drpc-Key` header) and failureToError redacts every URL regardless. */
|
|
83541
83570
|
async chainRead(fn) {
|
|
83542
83571
|
try {
|
|
83543
83572
|
return upOk(await fn(), this.src("chain-rpc"));
|
|
@@ -85517,7 +85546,10 @@ async function createRealBoundary(config, wallet, overrides) {
|
|
|
85517
85546
|
const chainName = config.network === "mainnet" ? "Ethereum Mainnet" : "Sepolia";
|
|
85518
85547
|
const bridge = new SignatureBridge({
|
|
85519
85548
|
...config.bridgeUrlFile ? { urlFile: config.bridgeUrlFile } : {},
|
|
85520
|
-
|
|
85549
|
+
// The page's wallet_addEthereumChain gets the PUBLIC proxy, never config.rpcUrl: the
|
|
85550
|
+
// server's endpoint is a server credential, and the page would save it into the
|
|
85551
|
+
// user's wallet.
|
|
85552
|
+
network: { chainId: config.chainId, chainName, rpcUrl: publicRpcUrl(config.chainId) },
|
|
85521
85553
|
...config.wcProjectId ? { wc: { projectId: config.wcProjectId, chainId: config.chainId } } : {},
|
|
85522
85554
|
// Plan 17 E2 (SVC-OPS-08): the HOSTED tier caps ceremonies at concurrent-1 per
|
|
85523
85555
|
// tenant — one bridge per tenant world, so the bridge cap IS the tenant cap. The
|
|
@@ -88065,7 +88097,7 @@ function registerBoundaryInfoResource(server, getB) {
|
|
|
88065
88097
|
}
|
|
88066
88098
|
|
|
88067
88099
|
// src/version.ts
|
|
88068
|
-
var SERVER_VERSION = "0.5.
|
|
88100
|
+
var SERVER_VERSION = "0.5.23";
|
|
88069
88101
|
|
|
88070
88102
|
// src/server.ts
|
|
88071
88103
|
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.";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gvnrdao/dh-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23",
|
|
4
4
|
"description": "MCP server for the Diamond Hands protocol",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@anthropic-ai/mcpb": "2.1.2",
|
|
57
57
|
"@google-cloud/firestore": "9.3.1",
|
|
58
|
-
"@gvnrdao/dh-sdk": "^0.0.
|
|
58
|
+
"@gvnrdao/dh-sdk": "^0.0.346",
|
|
59
59
|
"@types/express": "5.0.3",
|
|
60
60
|
"@types/jest": "29.5.12",
|
|
61
61
|
"@types/node": "20.14.10",
|