@qntx/wallet-engine 0.11.0 → 0.12.0
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/connect.d.mts +1 -1
- package/dist/connect.mjs +1 -1
- package/dist/{errors-Bglz0VYn.d.mts → errors-DpkJneDe.d.mts} +28 -10
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +103 -61
- package/dist/index.mjs.map +1 -1
- package/dist/{webln-BGKm12wd.mjs → webln-DzsI7jVb.mjs} +15 -24
- package/dist/webln-DzsI7jVb.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/webln-BGKm12wd.mjs.map +0 -1
|
@@ -1660,8 +1660,7 @@ const isAccount = (value) => {
|
|
|
1660
1660
|
if (value["kind"] === "hd") return typeof value["walletId"] === "string" && typeof value["groupIndex"] === "number" && typeof value["template"] === "string";
|
|
1661
1661
|
if (value["kind"] === "imported") return typeof value["keyId"] === "string" && FAMILIES.has(value["family"]);
|
|
1662
1662
|
if (value["kind"] === "derived") return typeof value["walletId"] === "string" && typeof value["index"] === "number";
|
|
1663
|
-
|
|
1664
|
-
return value["kind"] === void 0 && typeof value["walletId"] === "string" && typeof value["groupIndex"] === "number" && typeof value["network"] === "string";
|
|
1663
|
+
return value["kind"] === void 0 && typeof value["walletId"] === "string" && typeof value["groupIndex"] === "number";
|
|
1665
1664
|
};
|
|
1666
1665
|
const isOrigin = (value) => isObject$2(value) && (value["kind"] === "internal" || value["kind"] === "browser" && typeof value["origin"] === "string");
|
|
1667
1666
|
const isEntry = (value) => isObject$2(value) && typeof value["id"] === "string" && typeof value["at"] === "number" && isOrigin(value["origin"]) && METHODS.has(value["method"]) && OUTCOMES.has(value["outcome"]) && isAccount(value["account"]);
|
|
@@ -2133,10 +2132,10 @@ var RequestController = class extends Controller {
|
|
|
2133
2132
|
};
|
|
2134
2133
|
}
|
|
2135
2134
|
if (input.method === "bitcoin-sign") {
|
|
2136
|
-
|
|
2137
|
-
|
|
2135
|
+
const { request, account } = input;
|
|
2136
|
+
if (request.kind !== "message" || !("address" in account)) throw new Error("unreachable bitcoin-sign request");
|
|
2138
2137
|
return {
|
|
2139
|
-
account
|
|
2138
|
+
account,
|
|
2140
2139
|
network: input.network,
|
|
2141
2140
|
display: {
|
|
2142
2141
|
kind: "bitcoin.sign",
|
|
@@ -2150,7 +2149,7 @@ var RequestController = class extends Controller {
|
|
|
2150
2149
|
run: {
|
|
2151
2150
|
factor: "required",
|
|
2152
2151
|
staleReason: () => void 0,
|
|
2153
|
-
submit: async (verify) => this.options.bitcoinSign(
|
|
2152
|
+
submit: async (verify) => this.options.bitcoinSign(account, input.network, request, verify),
|
|
2154
2153
|
release: () => void 0
|
|
2155
2154
|
}
|
|
2156
2155
|
};
|
|
@@ -2626,8 +2625,8 @@ var BitcoinWalletHandler = class {
|
|
|
2626
2625
|
}
|
|
2627
2626
|
/**
|
|
2628
2627
|
* Signs (and with `send` broadcasts) a batch of dApp PSBTs under one approval. Every account
|
|
2629
|
-
* named must be a session account of
|
|
2630
|
-
*
|
|
2628
|
+
* named must be a session account — inputs of both purposes may mix in one PSBT, each sign entry
|
|
2629
|
+
* carries its account's template — and `chain`, when given, must be the session's network.
|
|
2631
2630
|
*/
|
|
2632
2631
|
async signTransactions(checked, request, send) {
|
|
2633
2632
|
const network = this.options.bitcoinNetwork();
|
|
@@ -2637,36 +2636,28 @@ var BitcoinWalletHandler = class {
|
|
|
2637
2636
|
const inputs = transactionInputs(request.params);
|
|
2638
2637
|
if (send && inputs.some((input) => input.chain === void 0)) throw invalidParams("chain is required for bitcoin:signAndSendTransaction");
|
|
2639
2638
|
if (inputs.some((input) => input.chain !== void 0 && BITCOIN_CHAIN_IDS[input.chain] !== network)) throw invalidParams("chain is not the connected network");
|
|
2640
|
-
const
|
|
2641
|
-
for (const { address } of inputs.flatMap((input) => input.inputsToSign)) {
|
|
2639
|
+
const templateOf = (address) => {
|
|
2642
2640
|
const purpose = BITCOIN_PURPOSES.find((p) => accounts[p] === address);
|
|
2643
2641
|
if (purpose === void 0) throw new ProviderError(4100, "account is not a connected account");
|
|
2644
|
-
|
|
2645
|
-
}
|
|
2646
|
-
const [purpose, ...rest] = purposes;
|
|
2647
|
-
if (purpose === void 0) throw invalidParams("inputsToSign names no account");
|
|
2648
|
-
if (rest.length > 0) throw invalidParams("mixed payment and ordinals inputs are not supported yet");
|
|
2642
|
+
return TEMPLATES[purpose];
|
|
2643
|
+
};
|
|
2649
2644
|
const group = this.options.activeGroup();
|
|
2650
2645
|
if (group === void 0) throw new ProviderError(4100, "no account group is selected");
|
|
2651
|
-
const account = {
|
|
2652
|
-
...group,
|
|
2653
|
-
address: accounts[purpose],
|
|
2654
|
-
template: TEMPLATES[purpose]
|
|
2655
|
-
};
|
|
2656
2646
|
let outcome;
|
|
2657
2647
|
try {
|
|
2658
2648
|
const pending = await this.options.requests.prepare({
|
|
2659
2649
|
method: "bitcoin-sign",
|
|
2660
2650
|
origin: checked,
|
|
2661
|
-
account,
|
|
2651
|
+
account: group,
|
|
2662
2652
|
network,
|
|
2663
2653
|
request: {
|
|
2664
2654
|
kind: "psbt",
|
|
2665
2655
|
psbts: inputs.map(({ psbt, inputsToSign }) => ({
|
|
2666
2656
|
psbt,
|
|
2667
|
-
sign: inputsToSign.flatMap(({ signingIndexes, sigHash }) => signingIndexes.map((index) => ({
|
|
2657
|
+
sign: inputsToSign.flatMap(({ address, signingIndexes, sigHash }) => signingIndexes.map((index) => ({
|
|
2668
2658
|
index,
|
|
2669
|
-
sigHash
|
|
2659
|
+
sigHash,
|
|
2660
|
+
template: templateOf(address)
|
|
2670
2661
|
})))
|
|
2671
2662
|
})),
|
|
2672
2663
|
send
|
|
@@ -3635,4 +3626,4 @@ var WeblnHandler = class {
|
|
|
3635
3626
|
};
|
|
3636
3627
|
export { newId as A, normalizeAddress as B, exceedsNetworkCap as C, mergeSatPerByte as D, mergeEvmQuote as E, PaymentError as F, invalidParams as G, evmChainId as H, SparkControllerError as I, unsupportedMethod as J, unauthorized as K, categorize as L, submitTx as M, prepareZap as N, mergeSolanaQuote as O, withdrawLnurl as P, Controller as Q, safeDecimals as R, collectChecks as S, feesDiffer as T, ProviderError as U, ConnectionController as V, internalError as W, EngineStoreError as X, userRejectedRequest as Y, errorMessage as Z, boundedSimulation as _, Nip07Handler as a, feeTiers as b, SessionEvents as c, OriginBusyError as d, REQUEST_TTL_MS as f, SignInOriginError as g, RequestEndedError as h, SolanaWalletHandler as i, replacementStaleReason as j, failTx as k, BlindSigningDisabledError as l, RequestController as m, parsePayment as n, BITCOIN_CHAIN_IDS as o, RESIMULATE_AFTER_MS as p, unrecognizedChain as q, SOLANA_CHAIN_IDS as r, BitcoinWalletHandler as s, WeblnHandler as t, InvalidTokenError as u, BitcoinChainAdapter as v, feeReachesAmount as w, timeoutSignal as x, esplora as y, safeDisplayText as z };
|
|
3637
3628
|
|
|
3638
|
-
//# sourceMappingURL=webln-
|
|
3629
|
+
//# sourceMappingURL=webln-DzsI7jVb.mjs.map
|