@qntx/wallet-engine 0.11.0 → 0.13.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-CQnlTc1i.d.mts} +301 -19
- package/dist/gateway-contract.d.mts +247 -1
- package/dist/gateway-contract.mjs +146 -2
- package/dist/gateway-contract.mjs.map +1 -1
- package/dist/index.d.mts +162 -59
- package/dist/index.mjs +6325 -3997
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-Deo5WQe1.d.mts → registry-DwguKWvt.d.mts} +3 -1
- package/dist/{registry-wYrcuFNc.mjs → registry-oorLoGtz.mjs} +23 -2
- package/dist/registry-oorLoGtz.mjs.map +1 -0
- package/dist/{webln-BGKm12wd.mjs → webln-DKqCnqx1.mjs} +72 -33
- package/dist/webln-DKqCnqx1.mjs.map +1 -0
- package/package.json +10 -8
- package/dist/registry-wYrcuFNc.mjs.map +0 -1
- package/dist/webln-BGKm12wd.mjs.map +0 -1
package/dist/connect.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as NostrPolicy, S as ConnectionController, T as ConnectionSession, _ as BitcoinHandler, a as SolanaEvent, b as BitcoinWalletHandler, c as SolanaWalletAccount, d as Nip07Request, f as Eip1193Event, g as BitcoinEvent, h as BITCOIN_CHAIN_IDS, i as SOLANA_CHAIN_IDS, l as SolanaWalletHandler, m as Eip1193Request, n as WeblnHandler, o as SolanaHandler, p as Eip1193Handler, r as WeblnRequest, s as SolanaRequest, t as ProviderError, u as Nip07Handler, v as BitcoinRequest, y as BitcoinWalletAccount } from "./errors-
|
|
1
|
+
import { D as NostrPolicy, S as ConnectionController, T as ConnectionSession, _ as BitcoinHandler, a as SolanaEvent, b as BitcoinWalletHandler, c as SolanaWalletAccount, d as Nip07Request, f as Eip1193Event, g as BitcoinEvent, h as BITCOIN_CHAIN_IDS, i as SOLANA_CHAIN_IDS, l as SolanaWalletHandler, m as Eip1193Request, n as WeblnHandler, o as SolanaHandler, p as Eip1193Handler, r as WeblnRequest, s as SolanaRequest, t as ProviderError, u as Nip07Handler, v as BitcoinRequest, y as BitcoinWalletAccount } from "./errors-CQnlTc1i.mjs";
|
|
2
2
|
/** The EIP-6963 provider identity the host stamps into the injected script. */
|
|
3
3
|
export type ProviderInfo = {
|
|
4
4
|
/** UUIDv4 — the host generates or fixes one per install. */
|
package/dist/connect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as ProviderError, a as Nip07Handler, i as SolanaWalletHandler, o as BITCOIN_CHAIN_IDS, r as SOLANA_CHAIN_IDS, s as BitcoinWalletHandler, t as WeblnHandler } from "./webln-DKqCnqx1.mjs";
|
|
2
2
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
3
3
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
4
4
|
// src/connect/inject.generated.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as NetworkInfo } from "./registry-
|
|
1
|
+
import { r as NetworkInfo } from "./registry-DwguKWvt.mjs";
|
|
2
2
|
import { StoreApi } from "zustand/vanilla";
|
|
3
3
|
import { MessageContent, SignRequest } from "@qntx/wallet-chains";
|
|
4
4
|
import { NostrKeyRef, UnlockFactor, Wallet } from "@qntx/wallet";
|
|
@@ -8,9 +8,9 @@ import { CooperativeExitResult, LightningInvoice, LightningPayment, LightningSen
|
|
|
8
8
|
import { LnurlPayRequest, LnurlWithdrawRequest } from "@qntx/spark/lnurl";
|
|
9
9
|
import { Event, NostrSigner, UnsignedEvent } from "@qntx/nostr";
|
|
10
10
|
import { chains } from "@qntx/wallet/chains";
|
|
11
|
+
import { PublicClient } from "viem";
|
|
11
12
|
import { WalletSigner } from "@qntx/wallet/nostr";
|
|
12
13
|
import { SparkSigner } from "@qntx/wallet/spark";
|
|
13
|
-
import { PublicClient } from "viem";
|
|
14
14
|
import "@solana/kit";
|
|
15
15
|
import { SparkAccountRef, SparkApproveIntent } from "@qntx/wallet/protocol";
|
|
16
16
|
import "@scure/btc-signer/psbt.js";
|
|
@@ -626,9 +626,95 @@ declare class PhishingController extends Controller<PhishingState> {
|
|
|
626
626
|
private apply;
|
|
627
627
|
private persist;
|
|
628
628
|
}
|
|
629
|
+
type AcrossBridgeQuote = {
|
|
630
|
+
readonly provider: "across";
|
|
631
|
+
readonly inputToken: string;
|
|
632
|
+
readonly outputToken: string;
|
|
633
|
+
readonly inputAmount: bigint;
|
|
634
|
+
readonly outputAmount: bigint;
|
|
635
|
+
readonly destinationNetwork: string;
|
|
636
|
+
readonly quoteTimestamp: number;
|
|
637
|
+
readonly fillDeadline: number;
|
|
638
|
+
readonly exclusiveRelayer: string;
|
|
639
|
+
readonly exclusivityParameter: number;
|
|
640
|
+
readonly spokePool: string;
|
|
641
|
+
readonly taker: string;
|
|
642
|
+
readonly fetchedAt: number;
|
|
643
|
+
};
|
|
644
|
+
/** The deposit status Across reports for an origin transaction — display only. */
|
|
645
|
+
type AcrossBridgeStatus = {
|
|
646
|
+
readonly status: "pending" | "filled" | "expired" | "refunded" | "failed" | "unknown";
|
|
647
|
+
readonly fillTxHash?: string;
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* The terms a gateway swap quote commits to — `sell`/`buy` use the engine's own asset ids
|
|
651
|
+
* (`native`, `erc20:<addr>`) rather than the 0x sentinel.
|
|
652
|
+
*/
|
|
653
|
+
type SwapQuote = ZeroExSwapQuote | JupiterSwapQuote;
|
|
654
|
+
type ZeroExSwapQuote = {
|
|
655
|
+
readonly provider: "0x";
|
|
656
|
+
readonly network: string;
|
|
657
|
+
readonly taker: string;
|
|
658
|
+
readonly sell: string;
|
|
659
|
+
readonly buy: string;
|
|
660
|
+
readonly sellAmount: bigint;
|
|
661
|
+
readonly buyAmount: bigint;
|
|
662
|
+
readonly minBuyAmount: bigint;
|
|
663
|
+
readonly allowanceTarget: string | undefined;
|
|
664
|
+
readonly transaction: {
|
|
665
|
+
readonly to: string;
|
|
666
|
+
readonly data: string;
|
|
667
|
+
readonly value: bigint;
|
|
668
|
+
readonly gas: bigint | undefined;
|
|
669
|
+
};
|
|
670
|
+
readonly fees: {
|
|
671
|
+
readonly integrator: {
|
|
672
|
+
readonly token: string;
|
|
673
|
+
readonly amount: bigint;
|
|
674
|
+
} | undefined;
|
|
675
|
+
readonly zeroEx: {
|
|
676
|
+
readonly token: string;
|
|
677
|
+
readonly amount: bigint;
|
|
678
|
+
} | undefined;
|
|
679
|
+
};
|
|
680
|
+
readonly blockNumber: bigint;
|
|
681
|
+
readonly fetchedAt: number;
|
|
682
|
+
};
|
|
683
|
+
/** One instruction of a Jupiter `/build` set — wire accounts, raw base64-decoded data. */
|
|
684
|
+
type JupiterInstruction = {
|
|
685
|
+
readonly programId: string;
|
|
686
|
+
readonly accounts: ReadonlyArray<{
|
|
687
|
+
readonly address: string;
|
|
688
|
+
readonly signer: boolean;
|
|
689
|
+
readonly writable: boolean;
|
|
690
|
+
}>;
|
|
691
|
+
readonly data: Uint8Array;
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* A Jupiter build the engine verifies on-chain before signing — mints use the engine's asset ids
|
|
695
|
+
* (`lamports` for native SOL), amounts are base-unit bigints.
|
|
696
|
+
*/
|
|
697
|
+
type JupiterSwapQuote = {
|
|
698
|
+
readonly provider: "jupiter";
|
|
699
|
+
readonly network: string;
|
|
700
|
+
readonly taker: string;
|
|
701
|
+
readonly sell: string;
|
|
702
|
+
readonly buy: string;
|
|
703
|
+
readonly sellAmount: bigint;
|
|
704
|
+
readonly buyAmount: bigint;
|
|
705
|
+
readonly minBuyAmount: bigint;
|
|
706
|
+
readonly setup: ReadonlyArray<JupiterInstruction>;
|
|
707
|
+
readonly swap: JupiterInstruction;
|
|
708
|
+
readonly cleanup: JupiterInstruction | undefined;
|
|
709
|
+
/** Address lookup table addresses — contents are read from chain, never the gateway. */
|
|
710
|
+
readonly lookupTables: ReadonlyArray<string>;
|
|
711
|
+
readonly fetchedAt: number;
|
|
712
|
+
};
|
|
629
713
|
type ChainApis = ReturnType<typeof chains>;
|
|
630
714
|
type SignParams = Parameters<ChainApis["sign"]>[0];
|
|
631
|
-
type AccountRef = SignParams["request"]
|
|
715
|
+
type AccountRef = Exclude<SignParams["request"], {
|
|
716
|
+
kind: "bitcoin.psbt";
|
|
717
|
+
}>["account"];
|
|
632
718
|
type DisplayIntent = ReturnType<typeof decodeEvm>;
|
|
633
719
|
type TxState = "draft" | "signed" | "submitted" | "pending" | "confirmed" | "failed" | "rejected" | "dropped" | "replaced";
|
|
634
720
|
/** A bitcoin transaction that funds the wallet's own Spark account; it is claimed once confirmed. */
|
|
@@ -642,6 +728,7 @@ type TrackedTransaction = {
|
|
|
642
728
|
readonly id: string;
|
|
643
729
|
readonly family: "evm" | "solana" | "bitcoin";
|
|
644
730
|
readonly network: string;
|
|
731
|
+
/** The signer's identity label — `walletId` for HD accounts, `keyId` for imported keys. */
|
|
645
732
|
readonly account: string;
|
|
646
733
|
readonly hash: string | undefined;
|
|
647
734
|
readonly state: TxState;
|
|
@@ -658,7 +745,7 @@ type TrackedTransaction = {
|
|
|
658
745
|
/** EVM build record persisted at broadcast for rebroadcast, drop detection and replacement. */
|
|
659
746
|
readonly evm?: {
|
|
660
747
|
readonly from: string;
|
|
661
|
-
readonly
|
|
748
|
+
readonly account: AccountRef;
|
|
662
749
|
readonly raw: string;
|
|
663
750
|
};
|
|
664
751
|
/** Bitcoin build record persisted at send for RBF/CPFP rebuilds. */
|
|
@@ -694,7 +781,7 @@ type SendParams = {
|
|
|
694
781
|
readonly verify: SignParams["verify"];
|
|
695
782
|
};
|
|
696
783
|
type PrepareParams = Omit<SendParams, "verify">;
|
|
697
|
-
type ChainRequestMethod = "send" | "speed-up" | "cancel" | "cpfp";
|
|
784
|
+
type ChainRequestMethod = "send" | "speed-up" | "cancel" | "cpfp" | "evm-delegation" | "evm-batch" | "evm-approve" | "evm-swap" | "evm-bridge" | "evm-nft-send" | "solana-core-send" | "evm-lido" | "solana-stake" | "solana-swap";
|
|
698
785
|
/** What a request asks for; replacements and CPFP name the original transaction. */
|
|
699
786
|
type ChainRequestInput = ({
|
|
700
787
|
readonly method: "send";
|
|
@@ -705,6 +792,123 @@ type ChainRequestInput = ({
|
|
|
705
792
|
readonly method: "cpfp";
|
|
706
793
|
readonly txId: string;
|
|
707
794
|
readonly feeRate: number;
|
|
795
|
+
} | {
|
|
796
|
+
readonly method: "evm-delegation";
|
|
797
|
+
readonly account: AccountRef;
|
|
798
|
+
readonly network: string;
|
|
799
|
+
readonly action: "upgrade" | "revoke";
|
|
800
|
+
readonly fee: PrepareParams["fee"];
|
|
801
|
+
} | {
|
|
802
|
+
readonly method: "evm-batch";
|
|
803
|
+
readonly account: AccountRef;
|
|
804
|
+
readonly network: string;
|
|
805
|
+
readonly calls: ReadonlyArray<{
|
|
806
|
+
readonly to: string;
|
|
807
|
+
readonly value: bigint;
|
|
808
|
+
readonly data: string;
|
|
809
|
+
}>;
|
|
810
|
+
readonly fee: PrepareParams["fee"];
|
|
811
|
+
/** A page asking for the batch (`wallet_sendCalls`); absent means the wallet itself. */
|
|
812
|
+
readonly origin?: {
|
|
813
|
+
readonly kind: "browser";
|
|
814
|
+
readonly origin: string;
|
|
815
|
+
};
|
|
816
|
+
} | {
|
|
817
|
+
readonly method: "evm-approve";
|
|
818
|
+
readonly account: AccountRef;
|
|
819
|
+
readonly network: string;
|
|
820
|
+
readonly token: string;
|
|
821
|
+
readonly spender: string;
|
|
822
|
+
readonly amount: bigint;
|
|
823
|
+
readonly fee: PrepareParams["fee"];
|
|
824
|
+
} | {
|
|
825
|
+
readonly method: "evm-swap";
|
|
826
|
+
readonly account: AccountRef;
|
|
827
|
+
readonly network: string;
|
|
828
|
+
readonly quote: ZeroExSwapQuote;
|
|
829
|
+
readonly fee: PrepareParams["fee"];
|
|
830
|
+
} | {
|
|
831
|
+
readonly method: "evm-bridge";
|
|
832
|
+
readonly account: AccountRef;
|
|
833
|
+
readonly network: string;
|
|
834
|
+
readonly quote: AcrossBridgeQuote;
|
|
835
|
+
readonly fee: PrepareParams["fee"];
|
|
836
|
+
} | {
|
|
837
|
+
readonly method: "evm-nft-send";
|
|
838
|
+
readonly account: AccountRef;
|
|
839
|
+
readonly network: string;
|
|
840
|
+
/** The ERC-721 or ERC-1155 contract. */
|
|
841
|
+
readonly contract: string;
|
|
842
|
+
readonly tokenId: bigint;
|
|
843
|
+
readonly to: string;
|
|
844
|
+
/** ERC-1155 only — the units sent; ERC-721 ignores it. */
|
|
845
|
+
readonly amount?: bigint;
|
|
846
|
+
readonly fee: PrepareParams["fee"];
|
|
847
|
+
} | {
|
|
848
|
+
readonly method: "solana-core-send";
|
|
849
|
+
readonly account: AccountRef;
|
|
850
|
+
readonly network: string;
|
|
851
|
+
/** The Core asset account. */
|
|
852
|
+
readonly asset: string;
|
|
853
|
+
readonly to: string;
|
|
854
|
+
readonly fee: PrepareParams["fee"];
|
|
855
|
+
} | {
|
|
856
|
+
readonly method: "solana-swap";
|
|
857
|
+
readonly account: AccountRef;
|
|
858
|
+
readonly network: string;
|
|
859
|
+
readonly quote: JupiterSwapQuote;
|
|
860
|
+
readonly fee: PrepareParams["fee"];
|
|
861
|
+
} | {
|
|
862
|
+
readonly method: "evm-lido";
|
|
863
|
+
readonly account: AccountRef;
|
|
864
|
+
readonly network: string;
|
|
865
|
+
readonly action: {
|
|
866
|
+
readonly kind: "stake";
|
|
867
|
+
readonly amount: bigint;
|
|
868
|
+
} | {
|
|
869
|
+
readonly kind: "request";
|
|
870
|
+
readonly amount: bigint;
|
|
871
|
+
} | {
|
|
872
|
+
readonly kind: "claim";
|
|
873
|
+
readonly requestIds: ReadonlyArray<bigint>;
|
|
874
|
+
};
|
|
875
|
+
readonly fee: PrepareParams["fee"];
|
|
876
|
+
} | {
|
|
877
|
+
readonly method: "solana-stake";
|
|
878
|
+
readonly account: AccountRef;
|
|
879
|
+
readonly network: string;
|
|
880
|
+
readonly action: {
|
|
881
|
+
readonly kind: "delegate";
|
|
882
|
+
readonly lamports: bigint;
|
|
883
|
+
readonly vote: string;
|
|
884
|
+
} | {
|
|
885
|
+
readonly kind: "deactivate";
|
|
886
|
+
readonly stakeAccount: string;
|
|
887
|
+
} | {
|
|
888
|
+
readonly kind: "withdraw";
|
|
889
|
+
readonly stakeAccount: string;
|
|
890
|
+
readonly lamports: bigint;
|
|
891
|
+
};
|
|
892
|
+
readonly fee: PrepareParams["fee"];
|
|
893
|
+
};
|
|
894
|
+
/**
|
|
895
|
+
* One `wallet_sendCalls` bundle: the tracked transactions it produced so `wallet_getCallsStatus`
|
|
896
|
+
* can aggregate them, retained alongside those transactions.
|
|
897
|
+
*/
|
|
898
|
+
type BatchRecord = {
|
|
899
|
+
readonly origin: string;
|
|
900
|
+
readonly id: string;
|
|
901
|
+
readonly network: string;
|
|
902
|
+
readonly atomic: boolean;
|
|
903
|
+
readonly txIds: ReadonlyArray<string>;
|
|
904
|
+
readonly expected: number;
|
|
905
|
+
readonly createdAt: number;
|
|
906
|
+
};
|
|
907
|
+
/** The account's EIP-7702 delegation state: `supported` follows the registry hash entry. */
|
|
908
|
+
type DelegationStatus = {
|
|
909
|
+
readonly supported: boolean;
|
|
910
|
+
readonly state: "none" | "ours" | "other";
|
|
911
|
+
readonly address?: string;
|
|
708
912
|
};
|
|
709
913
|
/**
|
|
710
914
|
* A fully built, estimated and cross-checked send that has not been signed. The unsigned content
|
|
@@ -762,9 +966,16 @@ declare class TransactionController extends Controller<TransactionControllerStat
|
|
|
762
966
|
private evmRoute;
|
|
763
967
|
private bitcoinRoute;
|
|
764
968
|
private locked;
|
|
969
|
+
private readonly batches;
|
|
765
970
|
constructor(options: Options$2);
|
|
766
971
|
init(): Promise<void>;
|
|
767
972
|
destroy(): Promise<void>;
|
|
973
|
+
/** One `wallet_sendCalls` bundle the user approved; retained alongside the transactions it lists. */
|
|
974
|
+
recordBatch(record: BatchRecord): Promise<void>;
|
|
975
|
+
/** The bundle `origin` asked for, or `undefined` when it is not theirs (or is gone). */
|
|
976
|
+
batchById(origin: string, id: string): BatchRecord | undefined;
|
|
977
|
+
/** A tracked transaction by id — for `wallet_getCallsStatus`. */
|
|
978
|
+
txById(id: string): TrackedTransaction | undefined;
|
|
768
979
|
lock(): void;
|
|
769
980
|
private persist;
|
|
770
981
|
private transition;
|
|
@@ -789,9 +1000,31 @@ declare class TransactionController extends Controller<TransactionControllerStat
|
|
|
789
1000
|
* Internal entry for replacements and CPFP: builds, cross-checks and reserves what the
|
|
790
1001
|
* replacement needs without signing it. The original must be `submitted` or `pending`.
|
|
791
1002
|
*/
|
|
792
|
-
prepareReplacement(input:
|
|
793
|
-
method: "
|
|
1003
|
+
prepareReplacement(input: Extract<ChainRequestInput, {
|
|
1004
|
+
method: "speed-up" | "cancel" | "cpfp";
|
|
794
1005
|
}>, requestId: string): Promise<PreparedRequest>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Internal EVM requests (`evm-delegation`/`evm-batch`/`evm-approve`/`evm-swap`/`evm-lido`):
|
|
1008
|
+
* builds, estimates and cross-checks the self-transaction without signing it.
|
|
1009
|
+
*/
|
|
1010
|
+
prepareEvmInternal(input: Extract<ChainRequestInput, {
|
|
1011
|
+
method: "evm-delegation" | "evm-batch" | "evm-approve" | "evm-swap" | "evm-bridge" | "evm-nft-send" | "evm-lido";
|
|
1012
|
+
}>, _requestId: string): Promise<PreparedRequest>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Internal `solana-stake` requests: checks the delegation rules, then builds the stake
|
|
1015
|
+
* transaction through the same fee/simulation path as a SOL send without signing it.
|
|
1016
|
+
*/
|
|
1017
|
+
prepareSolanaStake(input: Extract<ChainRequestInput, {
|
|
1018
|
+
method: "solana-stake";
|
|
1019
|
+
}>, _requestId: string): Promise<PreparedRequest>;
|
|
1020
|
+
prepareSolanaSwap(input: Extract<ChainRequestInput, {
|
|
1021
|
+
method: "solana-swap";
|
|
1022
|
+
}>, _requestId: string): Promise<PreparedRequest>;
|
|
1023
|
+
prepareSolanaCoreSend(input: Extract<ChainRequestInput, {
|
|
1024
|
+
method: "solana-core-send";
|
|
1025
|
+
}>, _requestId: string): Promise<PreparedRequest>;
|
|
1026
|
+
/** The account's 7702 delegation state on `network` (primary endpoint only). */
|
|
1027
|
+
delegationState(account: AccountRef, network: string): Promise<DelegationStatus>;
|
|
795
1028
|
private track;
|
|
796
1029
|
}
|
|
797
1030
|
/**
|
|
@@ -801,7 +1034,7 @@ declare class TransactionController extends Controller<TransactionControllerStat
|
|
|
801
1034
|
* despite the phishing list is a `danger`; one that could not be checked is a `warning`.
|
|
802
1035
|
*/
|
|
803
1036
|
type RiskFinding = {
|
|
804
|
-
readonly code: "first-recipient" | "address-poisoning" | "phishing-origin" | "phishing-unchecked" | "token-impersonation" | "token-symbol-unicode" | "simulation-reverted" | "simulation-mismatch" | "collection-approval" | "unlimited-approval" | "sign-in-malformed" | "sign-in-domain-mismatch" | "sign-in-port-mismatch" | "sign-in-address-mismatch" | "sign-in-expired" | "sign-in-not-yet-valid" | "permit-approval" | "permit-unlimited" | "permit-long-lived" | "order-receives-nothing" | "order-offerer-mismatch" | "safe-delegatecall" | "safe-gas-refund" | "bitcoin-sighash-single" | "bitcoin-inscription-input" | "blind-signing";
|
|
1037
|
+
readonly code: "first-recipient" | "address-poisoning" | "phishing-origin" | "phishing-unchecked" | "token-impersonation" | "token-symbol-unicode" | "simulation-reverted" | "simulation-mismatch" | "collection-approval" | "unlimited-approval" | "sign-in-malformed" | "sign-in-domain-mismatch" | "sign-in-port-mismatch" | "sign-in-address-mismatch" | "sign-in-expired" | "sign-in-not-yet-valid" | "permit-approval" | "permit-unlimited" | "permit-long-lived" | "order-receives-nothing" | "order-offerer-mismatch" | "safe-delegatecall" | "safe-gas-refund" | "bitcoin-sighash-single" | "bitcoin-inscription-input" | "stake-authority" | "blind-signing";
|
|
805
1038
|
readonly level: "warning" | "danger";
|
|
806
1039
|
};
|
|
807
1040
|
/** A web page; `origin` is `scheme://host[:port]`, computed by the host from the top-level URL. */
|
|
@@ -812,7 +1045,7 @@ type BrowserOrigin = {
|
|
|
812
1045
|
type RequestOrigin = {
|
|
813
1046
|
readonly kind: "internal";
|
|
814
1047
|
} | BrowserOrigin;
|
|
815
|
-
type RequestMethod = ChainRequestMethod | "pay" | "zap" | "evm-sign" | "nostr-sign" | "webln-invoice" | "watch-asset" | "solana-sign" | "bitcoin-sign" | "spark-deposit" | "spark-exit";
|
|
1048
|
+
type RequestMethod = ChainRequestMethod | "pay" | "zap" | "evm-sign" | "evm-delegation" | "evm-batch" | "nostr-sign" | "webln-invoice" | "watch-asset" | "solana-sign" | "bitcoin-sign" | "spark-deposit" | "spark-exit";
|
|
816
1049
|
/** A Solana chain account the `solana-sign` request signs for. */
|
|
817
1050
|
type SolanaAccount = {
|
|
818
1051
|
readonly walletId: string;
|
|
@@ -827,6 +1060,14 @@ type BitcoinAccount = {
|
|
|
827
1060
|
/** `btc.bip84` for the `payment` purpose, `btc.bip86` for `ordinals`. */
|
|
828
1061
|
readonly template: "btc.bip84" | "btc.bip86";
|
|
829
1062
|
};
|
|
1063
|
+
/**
|
|
1064
|
+
* The wallet group a `bitcoin-sign` PSBT request signs for: inputs of several dApp-facing templates
|
|
1065
|
+
* of the same group may mix in one PSBT — each sign entry names its own template.
|
|
1066
|
+
*/
|
|
1067
|
+
type BitcoinGroup = {
|
|
1068
|
+
readonly walletId: string;
|
|
1069
|
+
readonly groupIndex: number;
|
|
1070
|
+
};
|
|
830
1071
|
/** The sighash a dApp asks for per input; anything else is refused before it reaches a request. */
|
|
831
1072
|
type BitcoinSigHash = "ALL" | "SINGLE|ANYONECANPAY";
|
|
832
1073
|
/** One dApp PSBT and the inputs it asks the wallet to sign. */
|
|
@@ -835,6 +1076,7 @@ type BitcoinPsbtInput = {
|
|
|
835
1076
|
readonly sign: ReadonlyArray<{
|
|
836
1077
|
readonly index: number;
|
|
837
1078
|
readonly sigHash: BitcoinSigHash;
|
|
1079
|
+
readonly template: BitcoinAccount["template"];
|
|
838
1080
|
}>;
|
|
839
1081
|
};
|
|
840
1082
|
/**
|
|
@@ -851,6 +1093,7 @@ type PreparedBitcoinPsbt = {
|
|
|
851
1093
|
readonly index: number;
|
|
852
1094
|
readonly value: number;
|
|
853
1095
|
readonly sigHash: BitcoinSigHash;
|
|
1096
|
+
readonly template: BitcoinAccount["template"];
|
|
854
1097
|
}>;
|
|
855
1098
|
};
|
|
856
1099
|
type SignLogOutcome = "submitted" | "rejected" | "failed" | "expired" | "invalidated";
|
|
@@ -859,7 +1102,7 @@ type SignLogEntry = {
|
|
|
859
1102
|
readonly at: number;
|
|
860
1103
|
readonly origin: RequestOrigin;
|
|
861
1104
|
readonly method: RequestMethod;
|
|
862
|
-
readonly account: AccountRef | SparkAccountRef | NostrKeyRef | SolanaAccount | BitcoinAccount;
|
|
1105
|
+
readonly account: AccountRef | SparkAccountRef | NostrKeyRef | SolanaAccount | BitcoinAccount | BitcoinGroup;
|
|
863
1106
|
readonly network: string;
|
|
864
1107
|
readonly summary: string;
|
|
865
1108
|
readonly verification: "verified" | "unverifiable";
|
|
@@ -977,7 +1220,13 @@ type BitcoinSignInput = {
|
|
|
977
1220
|
readonly request: {
|
|
978
1221
|
readonly kind: "message";
|
|
979
1222
|
readonly message: string;
|
|
980
|
-
}
|
|
1223
|
+
};
|
|
1224
|
+
} | {
|
|
1225
|
+
readonly method: "bitcoin-sign";
|
|
1226
|
+
readonly origin: BrowserOrigin;
|
|
1227
|
+
readonly account: BitcoinGroup;
|
|
1228
|
+
readonly network: string;
|
|
1229
|
+
readonly request: {
|
|
981
1230
|
readonly kind: "psbt";
|
|
982
1231
|
readonly psbts: ReadonlyArray<BitcoinPsbtInput>;
|
|
983
1232
|
readonly send: boolean;
|
|
@@ -1064,7 +1313,7 @@ type PendingRequest = {
|
|
|
1064
1313
|
readonly id: string;
|
|
1065
1314
|
readonly origin: RequestOrigin;
|
|
1066
1315
|
readonly method: RequestMethod;
|
|
1067
|
-
readonly account: AccountRef | SparkAccountRef | NostrKeyRef | SolanaAccount | BitcoinAccount;
|
|
1316
|
+
readonly account: AccountRef | SparkAccountRef | NostrKeyRef | SolanaAccount | BitcoinAccount | BitcoinGroup;
|
|
1068
1317
|
readonly network: string;
|
|
1069
1318
|
readonly stage: RequestStage;
|
|
1070
1319
|
/** Decoded locally from the exact content that will be signed; `family` tells the shapes apart. */
|
|
@@ -1129,10 +1378,10 @@ type RequestControllerOptions = {
|
|
|
1129
1378
|
readonly kind: "message";
|
|
1130
1379
|
readonly message: string;
|
|
1131
1380
|
}, verify: SendParams["verify"]) => Promise<BitcoinSignResult>;
|
|
1132
|
-
/** Adds the
|
|
1133
|
-
readonly bitcoinPrepare: (account:
|
|
1381
|
+
/** Adds the group's derivation data to a dApp's PSBTs; refuses inputs that are not its own. */
|
|
1382
|
+
readonly bitcoinPrepare: (account: BitcoinGroup, network: string, psbts: ReadonlyArray<BitcoinPsbtInput>) => Promise<ReadonlyArray<PreparedBitcoinPsbt>>;
|
|
1134
1383
|
/** Signs (and with `send` broadcasts) the prepared PSBTs. */
|
|
1135
|
-
readonly bitcoinSignPsbts: (account:
|
|
1384
|
+
readonly bitcoinSignPsbts: (account: BitcoinGroup, network: string, prepared: ReadonlyArray<PreparedBitcoinPsbt>, send: boolean, verify: SendParams["verify"]) => Promise<BitcoinSignResult>;
|
|
1136
1385
|
};
|
|
1137
1386
|
/** Requests expire this long after creation. */
|
|
1138
1387
|
declare const REQUEST_TTL_MS: number;
|
|
@@ -1476,8 +1725,8 @@ declare class BitcoinWalletHandler implements BitcoinHandler {
|
|
|
1476
1725
|
private signMessage;
|
|
1477
1726
|
/**
|
|
1478
1727
|
* Signs (and with `send` broadcasts) a batch of dApp PSBTs under one approval. Every account
|
|
1479
|
-
* named must be a session account of
|
|
1480
|
-
*
|
|
1728
|
+
* named must be a session account — inputs of both purposes may mix in one PSBT, each sign entry
|
|
1729
|
+
* carries its account's template — and `chain`, when given, must be the session's network.
|
|
1481
1730
|
*/
|
|
1482
1731
|
private signTransactions;
|
|
1483
1732
|
/** The `setActiveGroup` re-point: the bitcoin session's new accounts, `payment` then `ordinals`. */
|
|
@@ -1511,6 +1760,22 @@ type Eip1193HandlerOptions = {
|
|
|
1511
1760
|
readonly defaultNetwork: () => string;
|
|
1512
1761
|
/** Whether a token is already in the built-in table or the user's custom tokens. */
|
|
1513
1762
|
readonly isTracked: (network: string, address: string) => boolean;
|
|
1763
|
+
/** The account's EIP-7702 delegation state on `network`. */
|
|
1764
|
+
readonly delegationState: (account: AccountRef, network: string) => Promise<DelegationStatus>;
|
|
1765
|
+
/** `wallet_sendCalls` bundles, keyed by their id. */
|
|
1766
|
+
readonly batches: {
|
|
1767
|
+
readonly record: (record: BatchRecord) => Promise<void>;
|
|
1768
|
+
readonly get: (origin: string, id: string) => BatchRecord | undefined;
|
|
1769
|
+
};
|
|
1770
|
+
/** A tracked transaction by id — `wallet_getCallsStatus` aggregates them. */
|
|
1771
|
+
readonly txById: (id: string) => TrackedTransaction | undefined;
|
|
1772
|
+
/** The host shows a bundle's status page; `wallet_showCallsStatus` is the trigger. */
|
|
1773
|
+
readonly showCallsStatus: (request: {
|
|
1774
|
+
readonly origin: string;
|
|
1775
|
+
readonly txIds: ReadonlyArray<string>;
|
|
1776
|
+
}) => void;
|
|
1777
|
+
readonly now: () => number;
|
|
1778
|
+
readonly random: (length: number) => Uint8Array;
|
|
1514
1779
|
};
|
|
1515
1780
|
declare class Eip1193Handler {
|
|
1516
1781
|
private readonly options;
|
|
@@ -1533,8 +1798,25 @@ declare class Eip1193Handler {
|
|
|
1533
1798
|
private personalSign;
|
|
1534
1799
|
private typedData;
|
|
1535
1800
|
private sendTransaction;
|
|
1801
|
+
/** The eip1559 placeholder the pipeline re-fills; only to, value, data and gas survive. */
|
|
1802
|
+
private txSkeleton;
|
|
1536
1803
|
private signingSession;
|
|
1537
1804
|
private sign;
|
|
1805
|
+
private requiredSession;
|
|
1806
|
+
private accountFor;
|
|
1807
|
+
/**
|
|
1808
|
+
* EIP-5792 `wallet_getCapabilities`: `atomic` per chain the page asks about or its session
|
|
1809
|
+
* covers.
|
|
1810
|
+
*/
|
|
1811
|
+
private getCapabilities;
|
|
1812
|
+
/** `wallet_sendCalls` (EIP-5792 v2.0.0): atomic batch, sequential fallback or 5760. */
|
|
1813
|
+
private sendCalls;
|
|
1814
|
+
/** One call through the `evm-sign` transaction path — its own approval. */
|
|
1815
|
+
private submitCall;
|
|
1816
|
+
/** ≥2 calls through `evm-batch` with the page's origin. */
|
|
1817
|
+
private submitBatch;
|
|
1818
|
+
/** `wallet_getCallsStatus` / `wallet_showCallsStatus`: the record must belong to the origin. */
|
|
1819
|
+
private callsStatus;
|
|
1538
1820
|
private read;
|
|
1539
1821
|
}
|
|
1540
1822
|
/** A NIP-07 method call from the page. */
|
|
@@ -1674,5 +1956,5 @@ declare class ProviderError extends Error {
|
|
|
1674
1956
|
readonly code: number;
|
|
1675
1957
|
constructor(code: number, message: string);
|
|
1676
1958
|
}
|
|
1677
|
-
export {
|
|
1678
|
-
//# sourceMappingURL=errors-
|
|
1959
|
+
export { PHISHING_REFRESH_MS as $, PayInput as A, AddressBookController as At, SignLogEntry as B, createEventBus as Bt, ConnectionOrigin as C, SparkControllerState as Ct, NostrPolicy as D, RequestCheckCode as Dt, ConnectionState as E, SparkActivity as Et, RequestControllerState as F, EngineCollection as Ft, RiskFinding as G, BrowserOrigin as H, ControllerOptions as Ht, RequestInput as I, EngineStore as It, DelegationStatus as J, TransactionController as K, RequestStage as L, PublicStore as Lt, REQUEST_TTL_MS as M, AddressBookEntry as Mt, RESIMULATE_AFTER_MS as N, AddressBookRecord as Nt, PendingConnection as O, NetworkController as Ot, RequestController as P, AddressFamily as Pt, AcrossBridgeStatus as Q, SparkDepositInput as R, EngineLogger as Rt, ConnectionController as S, SparkControllerOptions as St, ConnectionSession as T, PaymentNote as Tt, RequestMethod as U, SignLogOutcome as V, Controller as Vt, RequestOrigin as W, SwapQuote as X, SignatureResult as Y, AcrossBridgeQuote as Z, BitcoinHandler as _, SparkDisplay as _t, SolanaEvent as a, PrepareZapParams as at, BitcoinWalletHandler as b, SparkClientFactory as bt, SolanaWalletAccount as c, prepareZap as ct, Nip07Request as d, ParseOptions as dt, PhishingController as et, Eip1193Event as f, PaymentOption as ft, BitcoinEvent as g, PreparedSparkAction as gt, BITCOIN_CHAIN_IDS as h, parsePayment as ht, SOLANA_CHAIN_IDS as i, PrepareZapContext as it, PendingRequest as j, AddressBookState as jt, EvmSignInput as k, Esplora as kt, SolanaWalletHandler as l, PayParams as lt, Eip1193Request as m, PaymentRequest as mt, WeblnHandler as n, PhishingState as nt, SolanaHandler as o, PreparedZap as ot, Eip1193Handler as p, PaymentParse as pt, AccountRef as q, WeblnRequest as r, PhishingStatus as rt, SolanaRequest as s, ZapRecipient as st, ProviderError as t, PhishingControllerOptions as tt, Nip07Handler as u, WithdrawLnurlParams as ut, BitcoinRequest as v, SparkResult as vt, ConnectionScope as w, sparkStore as wt, AccountGroup as x, SparkController as xt, BitcoinWalletAccount as y, SparkAccountState as yt, SparkExitInput as z, EventBus as zt };
|
|
1960
|
+
//# sourceMappingURL=errors-CQnlTc1i.d.mts.map
|