@bestinslot/wallet-kit 0.14.3 → 0.15.0-rc.1

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.
Files changed (34) hide show
  1. package/README.md +3 -1
  2. package/dist/balances-CcnzsQly.js +10930 -0
  3. package/dist/browser.js +110 -95
  4. package/dist/core.js +40 -34
  5. package/dist/{mint-CSk_3TfL.js → helpers-BvhfqxFB.js} +28787 -28389
  6. package/dist/node.js +726 -1166
  7. package/dist/react.js +4 -4
  8. package/dist/register-browser-providers-DxplsCV5.js +810 -0
  9. package/dist/types/api/helpers.d.ts +3 -0
  10. package/dist/types/api/swap.d.ts +3 -3
  11. package/dist/types/api/wallet.d.ts +2 -2
  12. package/dist/types/core/bis-providers.d.ts +49 -0
  13. package/dist/types/core/bis.d.ts +2 -0
  14. package/dist/types/core/bis_swap.d.ts +32 -7
  15. package/dist/types/core/brc20-send.d.ts +2 -1
  16. package/dist/types/core/chain-providers.d.ts +133 -0
  17. package/dist/types/core/helpers.d.ts +48 -31
  18. package/dist/types/core/mint.d.ts +82 -8
  19. package/dist/types/core/providers.d.ts +11 -3
  20. package/dist/types/core/sign-progress.d.ts +3 -1
  21. package/dist/types/core/store-network.d.ts +8 -0
  22. package/dist/types/core.d.ts +2 -0
  23. package/dist/types/provider/api.d.ts +20 -0
  24. package/dist/types/provider/bitcoin-wallet.d.ts +45 -0
  25. package/dist/types/provider/metamask.d.ts +6 -0
  26. package/dist/types/provider/phantom.d.ts +2 -0
  27. package/dist/types/provider/wallet-standard.d.ts +14 -0
  28. package/dist/types/types/common.d.ts +1 -1
  29. package/dist/types/types/global.d.ts +3 -5
  30. package/dist/vue.js +3 -3
  31. package/package.json +29 -25
  32. package/dist/balances-DYYM7kpl.js +0 -10363
  33. package/dist/register-browser-providers-BdTwEVwB.js +0 -500
  34. package/dist/types/provider/leather.d.ts +0 -2
@@ -1,10 +1,13 @@
1
- import { APIOrdinalUtxoInfo, APIUtxoInfo } from '../core/helpers';
2
- import { SignFunction, SignResponse } from '../provider/api';
1
+ import { SignFunction, SignManyFunction, SignResponse } from '../provider/api';
3
2
  import { PaymentOpts } from '../types/common';
4
3
  import { InscribeFees, InscribeMultipleResult, InscribeResult, SendInscriptionResult, InscriptionDetails } from '../types/inscription';
4
+ import { Utxo } from './chain-providers';
5
+ import { OrdinalUtxoInfo } from './helpers';
5
6
  import { Buffer } from 'node:buffer';
6
7
  import { WalletInfo } from '../types/wallet';
7
8
  import * as bitcoinjs from 'bitcoinjs-lib';
9
+ /** Fee rates are sat/vB and may be fractional; every fee built from one is rounded up to whole sats. */
10
+ export declare function assertFeeRate(feeRate: number): void;
8
11
  export declare function getDustValue(wallet: WalletInfo): number;
9
12
  interface TapLeafScriptInfo {
10
13
  script: Buffer;
@@ -125,13 +128,82 @@ export declare function mintWithReclaimsAll(inscriptionDetails: InscriptionDetai
125
128
  postage: number;
126
129
  secret: string;
127
130
  }>;
131
+ /** One inscription of an `inscribeAllToOpReturn` package. */
132
+ export interface BatchedReveal {
133
+ revealTxId: string;
134
+ signedRevealTxHex: string;
135
+ inscriptionId: string;
136
+ secret: string;
137
+ }
138
+ /**
139
+ * How the send tx of `inscribeAllToOpReturn` moves its inscriptions into OP_RETURN outputs.
140
+ *
141
+ * - `single`: one OP_RETURN output worth `postage * (n - 1) + 1` sats, which covers the first sat
142
+ * of every inscription input. The postage of all but the last inscription is burned.
143
+ * - `interleaved`: a 1-sat OP_RETURN output per inscription, each followed by a payer output that
144
+ * takes back the rest of that inscription's postage (the last one merges into change). Only `n`
145
+ * sats are burned. Multiple OP_RETURN outputs relay from Bitcoin Core 30.
146
+ * - `auto`: whichever of the two costs the payer less at the fee rate.
147
+ *
148
+ * Either layout leaves one postage minus a sat after its last OP_RETURN. The send pays the fee
149
+ * from it, or adds a payer input and returns it as change when that costs less (low fee rates).
150
+ */
151
+ export type BatchedSendLayout = 'single' | 'interleaved' | 'auto';
152
+ export interface InscribeAllToOpReturnResult {
153
+ commitTxId: string;
154
+ signedCommitTxHex: string;
155
+ /** One reveal per inscription, in the order the inscriptions were given. */
156
+ reveals: BatchedReveal[];
157
+ sendTxId: string;
158
+ signedSendTxHex: string;
159
+ /** The send layout used; `auto` resolves to one of the other two. */
160
+ sendLayout: Exclude<BatchedSendLayout, 'auto'>;
161
+ /** Miner fees of the commit, the reveals and the send, plus the sats burned in OP_RETURN outputs. */
162
+ totalFee: number;
163
+ }
164
+ /**
165
+ * The fees an `inscribeAllToOpReturn` package with the same arguments would pay, built offline
166
+ * without signing: the commit, the reveals, and the send's miner fee plus the sats it burns in
167
+ * OP_RETURN outputs. The send is priced against `cardinals` (or a fresh fetch) as they stand
168
+ * before the commit, the way `inscribeAllToOpReturn` picks its send plan.
169
+ */
170
+ export declare function getInscribeAllToOpReturnFee(inscriptions: InscriptionDetails[], reclaimInputs: ReclaimInput[], opReturnWallet: WalletInfo, feeRate: number, sendLayout?: BatchedSendLayout, cardinals?: UtxoInfo[]): Promise<{
171
+ totalFee: number;
172
+ sendLayout: Exclude<BatchedSendLayout, 'auto'>;
173
+ }>;
174
+ /**
175
+ * `psbt`'s unsigned transaction with each input's scriptSig as signing will leave it, so its txid
176
+ * is the signed tx's; or null when a signature lands in a scriptSig. SegWit and taproot inputs
177
+ * sign in the witness and keep an empty scriptSig, and a P2SH-P2WPKH input's scriptSig is the push
178
+ * of its redeem script. Any other input, such as legacy P2PKH, makes it null.
179
+ */
180
+ export declare function unsignedTxOnceSigned(psbt: bitcoinjs.Psbt): bitcoinjs.Transaction | null;
181
+ /**
182
+ * Inscribes several inscriptions from one commit tx and sends them all to OP_RETURN outputs in
183
+ * one tx, so the wallet signs two transactions however many inscriptions there are. The signed
184
+ * package is validated with testmempoolaccept and returned for the caller to broadcast.
185
+ *
186
+ * Commit outputs: one self-send per reclaim input (same index and value as the input), then one
187
+ * taproot commit output per inscription, then payer change. Each inscription keeps its own reveal
188
+ * tx, because BRC-20 indexers only accept an inscription made in the first input of its reveal.
189
+ *
190
+ * The send tx spends the reveal outputs as inputs `0..n-1` in the given order, and its outputs
191
+ * follow `sendLayout`. Either way the first sat of every inscription input lands in an OP_RETURN
192
+ * output, in input order, so ord moves each inscription there and indexers process them in that
193
+ * order.
194
+ *
195
+ * With `signManyFunc`, the commit and the send are signed in one wallet prompt whenever the commit's
196
+ * txid is known before signing (see `unsignedTxOnceSigned`); the package is refused if the signed
197
+ * commit's txid differs. Otherwise `signFunc` signs the commit, then the send.
198
+ */
199
+ export declare function inscribeAllToOpReturn(inscriptions: InscriptionDetails[], reclaimInputs: ReclaimInput[], opReturnWallet: WalletInfo, feeRate: number, signFunc: SignFunction, sendLayout?: BatchedSendLayout, signManyFunc?: SignManyFunction | null): Promise<InscribeAllToOpReturnResult>;
128
200
  /**
129
201
  * Estimates the fees for a reclaim mint by building the unsigned reclaim
130
202
  * commit tx (Task 1) and a fee-sizing reveal tx offline, without signing or
131
203
  * broadcasting. Mirrors mintWithExtraInputInCommitFeeRate. `fetchedCardinalUtxos`, the
132
204
  * payer's `fetchCardinalUtxos` response, funds the commit in place of a new fetch.
133
205
  */
134
- export declare function mintWithReclaimsCheckFees(inscriptionDetails: InscriptionDetails, reclaimInputs: ReclaimInput[], feeRate: number, postage: number | null, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<{
206
+ export declare function mintWithReclaimsCheckFees(inscriptionDetails: InscriptionDetails, reclaimInputs: ReclaimInput[], feeRate: number, postage: number | null, fetchedCardinalUtxos?: Utxo[]): Promise<{
135
207
  unsigned_commit_tx_hex: string;
136
208
  signed_reveal_tx_hex: string;
137
209
  inscription_id: string;
@@ -161,10 +233,12 @@ export declare function resolveReclaimInputs(reclaimInscriptions: {
161
233
  * @param amounts - array of amounts to send to each output wallet (must be the same length as outputWallets)
162
234
  * @param changeWallet - the wallet to send the change to
163
235
  * @param feeRate - the fee rate in sat/vbyte
236
+ * @param fundingInput - add a payer UTXO even when `forceInUtxos` cover the outputs and the fee, so
237
+ * their surplus returns as change instead of going to the miner
164
238
  *
165
239
  * @returns an object containing the built transaction and the fee paid for the transaction
166
240
  */
167
- export declare function buildTransactionMultiOutput(utxoArray: UtxoInfo[], forceInUtxos: UtxoInfoWithWallet[], payerWallet: WalletInfo, outputWallets: WalletInfo[], amounts: number[], changeWallet: WalletInfo, feeRate: number): BuildTransactionResult;
241
+ export declare function buildTransactionMultiOutput(utxoArray: UtxoInfo[], forceInUtxos: UtxoInfoWithWallet[], payerWallet: WalletInfo, outputWallets: WalletInfo[], amounts: number[], changeWallet: WalletInfo, feeRate: number, fundingInput?: boolean): BuildTransactionResult;
168
242
  interface SendMultiInscriptionWithBufferResult {
169
243
  txid: string;
170
244
  signed_tx_hex: string;
@@ -199,7 +273,7 @@ export interface InscriptionUTXODetails {
199
273
  * Otherwise an inscription created by the saved extra transactions resolves from them
200
274
  * directly, and any other inscription is looked up in the backend's `ordinal_utxos` list.
201
275
  */
202
- export declare function getInscriptionDetails(inscriptionId: string, inscriptionAddr: string, ordinalUtxos?: APIOrdinalUtxoInfo[]): Promise<InscriptionUTXODetails | null>;
276
+ export declare function getInscriptionDetails(inscriptionId: string, inscriptionAddr: string, ordinalUtxos?: OrdinalUtxoInfo[]): Promise<InscriptionUTXODetails | null>;
203
277
  /**
204
278
  * Sends multiple inscriptions in one transaction with a buffer output and returns the fee paid for the transaction. This is used for batch minting or batch sending when the user wants to know the fee before actually sending the transaction.
205
279
  *
@@ -271,7 +345,7 @@ interface InscribeCheckFeesResult {
271
345
  *
272
346
  * @returns an object containing the estimated commit fee, reveal fee, total fee, unsigned commit transaction hex, signed reveal transaction hex, inscription ID, and postage used
273
347
  */
274
- export declare function mintAllCheckFees(inscriptionDetails: InscriptionDetails, feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<InscribeCheckFeesResult>;
348
+ export declare function mintAllCheckFees(inscriptionDetails: InscriptionDetails, feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null, fetchedCardinalUtxos?: Utxo[]): Promise<InscribeCheckFeesResult>;
275
349
  /**
276
350
  * Sends an inscription to a target address using an OP_RETURN output. This function builds a transaction that spends the inscription UTXO and creates an OP_RETURN output with the inscription data, along with a target output with the specified postage. It then signs and broadcasts the transaction. If dryRun is true, it returns the signed transaction hex without broadcasting.
277
351
  *
@@ -350,7 +424,7 @@ interface SendInscriptionFeeRateResult {
350
424
  *
351
425
  * @returns an object containing the transaction ID, unsigned transaction hex, and calculated transaction fee
352
426
  */
353
- export declare function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(inscriptionId: string, extraInputUtxos: UtxoInfoWithWallet[], targetWallet: WalletInfo, targetPostage: number, extraOutputUtxos: OutputUtxoInfo[], feeRate: number, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<SendInscriptionFeeRateResult>;
427
+ export declare function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(inscriptionId: string, extraInputUtxos: UtxoInfoWithWallet[], targetWallet: WalletInfo, targetPostage: number, extraOutputUtxos: OutputUtxoInfo[], feeRate: number, fetchedCardinalUtxos?: Utxo[]): Promise<SendInscriptionFeeRateResult>;
354
428
  /**
355
429
  * Mints an inscription with extra input UTXOs included in the commit transaction. This function builds and signs the commit and reveal transactions for minting an inscription, while allowing the user to include additional input UTXOs in the commit transaction. This can be useful in cases where the user wants to fund the commit transaction with specific UTXOs or needs to include additional inputs for other reasons. The function retrieves the connected wallets, builds and signs the transactions, validates them, and broadcasts them to the network. If dryRun is true, it returns the signed transaction hex without broadcasting.
356
430
  *
@@ -379,5 +453,5 @@ export declare function mintWithExtraInputInCommitAll(inscriptionDetails: Inscri
379
453
  *
380
454
  * @returns an object containing the estimated commit fee, reveal fee, total fee, unsigned commit transaction hex, signed reveal transaction hex, inscription ID, and postage used
381
455
  */
382
- export declare function mintWithExtraInputInCommitFeeRate(inscriptionDetails: InscriptionDetails, extraInputUtxos: UtxoInfoWithWallet[], feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<InscribeCheckFeesResult>;
456
+ export declare function mintWithExtraInputInCommitFeeRate(inscriptionDetails: InscriptionDetails, extraInputUtxos: UtxoInfoWithWallet[], feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null, fetchedCardinalUtxos?: Utxo[]): Promise<InscribeCheckFeesResult>;
383
457
  export {};
@@ -1,4 +1,4 @@
1
- import { BISProvider, SignFunction } from '../provider/api';
1
+ import { BISProvider, SignFunction, SignManyFunction } from '../provider/api';
2
2
  import { BISSession, BISWallet, BISWalletProvider, BISWalletPurpose } from '../types/common';
3
3
  /**
4
4
  * Thrown before signing when the account active in the wallet extension differs from the
@@ -78,8 +78,16 @@ export declare function getPaymentWallet(): BISWallet | undefined;
78
78
  */
79
79
  export declare function getSignFn(provider: BISWalletProvider): SignFunction;
80
80
  /**
81
- * Signs a message using the currently connected wallet provider, then verifies it
82
- * against the backend. Returns the signature, or throws if signing or verification fails.
81
+ * Returns the specified provider's function for signing several PSBTs in one wallet prompt, or
82
+ * null when the provider or its installed wallet has none.
83
+ *
84
+ * @param provider The wallet provider.
85
+ * @returns The provider's batch sign function, or null.
86
+ */
87
+ export declare function getSignManyFn(provider: BISWalletProvider): SignManyFunction | null;
88
+ /**
89
+ * Signs a message using the currently connected wallet provider, then verifies its BIP-322
90
+ * signature. Returns the signature, or throws if signing or verification fails.
83
91
  *
84
92
  * @param message The message to sign.
85
93
  * @param walletType The wallet purpose to sign with ('payment' | 'ordinals' | 'all').
@@ -1,4 +1,4 @@
1
- import { SignFunction } from '../provider/api';
1
+ import { SignFunction, SignManyFunction } from '../provider/api';
2
2
  /** A wallet prompt a multi-signature flow is about to raise. */
3
3
  export interface SignRequest {
4
4
  /** 1-based index of this prompt within the flow. */
@@ -27,4 +27,6 @@ export declare class SignProgress {
27
27
  constructor(options?: SignProgressOptions, total?: number);
28
28
  next(): void;
29
29
  wrap(signFn: SignFunction): SignFunction;
30
+ /** As `wrap`, for a function that signs several PSBTs in one prompt: each call counts once. */
31
+ wrapMany(signMany: SignManyFunction): SignManyFunction;
30
32
  }
@@ -51,6 +51,14 @@ export type EndpointsConfig = {
51
51
  * @throws {Error} If a key is unknown or a value is not an absolute http(s) URL.
52
52
  */
53
53
  export declare function setEndpoints(config: EndpointsConfig): void;
54
+ /**
55
+ * Checks that a value is an absolute http(s) URL.
56
+ *
57
+ * @param label The setting the value belongs to, used as the error prefix.
58
+ * @param value The URL to check.
59
+ * @throws {Error} If the value is not a valid URL or uses another protocol.
60
+ */
61
+ export declare function assertHttpUrl(label: string, value: string): void;
54
62
  /**
55
63
  * Returns the effective base URLs for a network: the defaults with any
56
64
  * {@link setEndpoints} overrides applied. Testnet has no `sequencerRead`,
@@ -6,6 +6,8 @@ export * as balances from './api/balances';
6
6
  export * from './api/helpers';
7
7
  export { getEndpoints, getNetwork, setEndpoints, setNetwork, subscribeToNetwork, } from './core/store-network';
8
8
  export type { Endpoints, EndpointsConfig } from './core/store-network';
9
+ export { getProviders, setProviders } from './core/chain-providers';
10
+ export type { NetworkProviders, ProvidersConfig } from './core/chain-providers';
9
11
  export type { PaymentOpts } from './types/common';
10
12
  export * as bitcoinjs from 'bitcoinjs-lib';
11
13
  export * as Buff from '@cmdcode/buff-utils';
@@ -32,6 +32,20 @@ export interface SignatureWithAddress {
32
32
  * @returns A promise that resolves to an object containing the signed PSBT as a hexadecimal string and optionally the transaction ID (txid) if the transaction was broadcasted. This allows developers to use the signed PSBT for further processing or to track the transaction on the blockchain. If there is an error in signing the PSBT, the promise will be rejected with a descriptive error message.
33
33
  */
34
34
  export type SignFunction = (unsignedPsbtHex: string, paymentAddr: string, ordAddr: string, ordAddrIdxes: number[], useTweakSignerIdxes?: number[], noSignIdxes?: number[]) => Promise<SignResponse>;
35
+ /** One PSBT of a `SignManyFunction` call, with the arguments a `SignFunction` takes for it. */
36
+ export interface SignPsbtRequest {
37
+ unsignedPsbtHex: string;
38
+ paymentAddr: string;
39
+ ordAddr: string;
40
+ ordAddrIdxes: number[];
41
+ useTweakSignerIdxes?: number[];
42
+ noSignIdxes?: number[];
43
+ }
44
+ /**
45
+ * Signs several PSBTs in one wallet prompt and returns one `SignResponse` per request, in order.
46
+ * The PSBTs may depend on each other (one spending another's outputs), so none is broadcast.
47
+ */
48
+ export type SignManyFunction = (requests: SignPsbtRequest[]) => Promise<SignResponse[]>;
35
49
  /**
36
50
  * Defines the interface for a BISProvider, which includes methods for retrieving wallets, signing messages, and sending Bitcoin. The BISProvider interface specifies the structure that any wallet provider must implement to be compatible with the BIS Wallet Kit. This includes methods for getting the list of wallets, signing messages in both standard and deterministic ways, sending Bitcoin transactions, and signing PSBTs (Partially Signed Bitcoin Transactions). By adhering to this interface, different wallet providers can be integrated into the BIS Wallet Kit while ensuring a consistent API for developers using the kit.
37
51
  */
@@ -110,4 +124,10 @@ export interface BISProvider {
110
124
  * @returns A promise that resolves to an object containing the signed PSBT as a hexadecimal string and optionally the transaction ID (txid) if the transaction was broadcasted. This allows developers to use the signed PSBT for further processing or to track the transaction on the blockchain. If there is an error in signing the PSBT, the promise will be rejected with a descriptive error message.
111
125
  */
112
126
  sign: SignFunction;
127
+ /**
128
+ * Returns a function that signs several PSBTs in one wallet prompt, or null when the wallet
129
+ * (or its installed version) has no such method. Implemented only by providers whose wallet
130
+ * offers batch signing.
131
+ */
132
+ getSignMany?: () => SignManyFunction | null;
113
133
  }
@@ -0,0 +1,45 @@
1
+ import { BISProvider } from './api';
2
+ /** A Bitcoin account a wallet exposes, with the use it is meant for. */
3
+ export interface BitcoinWalletAccount {
4
+ address: string;
5
+ /** Hex public key, or null when the wallet does not report a usable one. */
6
+ publicKey: string | null;
7
+ purpose: 'payment' | 'ordinals';
8
+ }
9
+ /** One PSBT to sign, with the input indexes each of the wallet's addresses signs. */
10
+ export interface BitcoinSignPsbtInput {
11
+ psbt: Uint8Array;
12
+ inputs: {
13
+ address: string;
14
+ signingIndexes: number[];
15
+ }[];
16
+ }
17
+ /**
18
+ * The calls a Bitcoin wallet offers, whatever API the wallet is reached through (the Wallet
19
+ * Standard or an injected provider). `signPsbts` returns the signed PSBTs in request order, unbroadcast.
20
+ */
21
+ export interface BitcoinWalletBackend {
22
+ connect: () => Promise<BitcoinWalletAccount[]>;
23
+ /** The addresses of the connected account, without prompting; empty when unknown. */
24
+ accounts: () => string[];
25
+ /** Subscribes to account switches; returns an unsubscribe function. */
26
+ onAccountsChanged: (handler: (addresses: string[]) => void) => () => void;
27
+ /** Signs `message` with `address`'s key and returns the signature bytes (BIP-322 or legacy). */
28
+ signMessage: (address: string, message: Uint8Array) => Promise<Uint8Array>;
29
+ signPsbts: (requests: BitcoinSignPsbtInput[]) => Promise<Uint8Array[]>;
30
+ /** Whether `signPsbts` hands every PSBT to the wallet in one request. */
31
+ signsManyAtOnce: boolean;
32
+ }
33
+ /**
34
+ * The public key behind `address`, read from a signature over `message`: a BIP-322 simple
35
+ * signature's witness carries it, and a legacy 65-byte signature lets it be recovered. Null when
36
+ * neither yields a key that pays `address`.
37
+ */
38
+ export declare function publicKeyFromSignature(message: string, signature: Uint8Array, address: string): string | null;
39
+ /**
40
+ * Builds a `BISProvider` for a Bitcoin wallet reached through `getBackend`, which returns null
41
+ * while the wallet is not installed. A wallet that gives only a payment account is used as a
42
+ * single-address wallet (`purpose: 'all'`), and an account without a usable public key gets one
43
+ * from a one-time message signature at connect.
44
+ */
45
+ export declare function createBitcoinWalletProvider(walletName: string, getBackend: () => BitcoinWalletBackend | null): BISProvider;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MetaMask's Bitcoin account, through the Bitcoin Wallet Standard. MetaMask gives one payment
3
+ * address and no public key, so it connects as a single-address wallet and its key is read from a
4
+ * message signature; its chains are mainnet, testnet, testnet4 and regtest, not signet.
5
+ */
6
+ export declare const METAMASK: import('./api').BISProvider;
@@ -0,0 +1,2 @@
1
+ /** Phantom, through the Bitcoin Wallet Standard, or its injected provider while it still ships one. */
2
+ export declare const PHANTOM: import('./api').BISProvider;
@@ -0,0 +1,14 @@
1
+ import { Wallet } from '@wallet-standard/base';
2
+ import { BitcoinWalletBackend } from './bitcoin-wallet';
3
+ /**
4
+ * The installed wallet whose name matches `name` and that registers the Bitcoin Wallet Standard
5
+ * features the kit signs with, or null. Wallets register as the page loads, so this is read at
6
+ * each use.
7
+ */
8
+ export declare function findBitcoinStandardWallet(name: RegExp): Wallet | null;
9
+ /**
10
+ * A `BitcoinWalletBackend` over a Bitcoin Wallet Standard wallet. `bitcoin:connect` returns the
11
+ * accounts in the order of the requested purposes; a wallet that returns only one account (as
12
+ * MetaMask does, payment only) is used as a single-address wallet.
13
+ */
14
+ export declare function standardWalletBackend(wallet: Wallet): BitcoinWalletBackend;
@@ -5,7 +5,7 @@ export interface ConnectCallbacks {
5
5
  onSelect: (session: BISSession) => void;
6
6
  onError: (error: Error) => void;
7
7
  }
8
- export type BISWalletProvider = 'okx' | 'unisat' | 'xverse' | 'leather' | 'local';
8
+ export type BISWalletProvider = 'okx' | 'unisat' | 'xverse' | 'phantom' | 'metamask' | 'local';
9
9
  export type BISWalletPurpose = 'ordinals' | 'payment' | 'all';
10
10
  export interface BISSession {
11
11
  provider: BISWalletProvider;
@@ -1,14 +1,10 @@
1
- import { ListenFn, RequestFn } from '@leather-wallet/types';
2
1
  declare global {
3
2
  interface Window {
4
3
  // Providers
5
4
  unisat?: UniSat
6
- LeatherProvider?: {
7
- request: RequestFn
8
- listen: ListenFn
9
- }
10
5
  okxwallet?: any
11
6
  XverseProviders?: any
7
+ phantom?: { bitcoin?: unknown }
12
8
  }
13
9
  }
14
10
 
@@ -21,6 +17,8 @@ interface UniSat {
21
17
  switchNetwork: (network: string) => Promise<void>
22
18
  signMessage: (message: string, type?: 'ecdsa' | 'bip322-simple') => Promise<string>
23
19
  signPsbt: (psbt: any, options?: any) => Promise<string>
20
+ /** Signs several PSBT hexes in one prompt; absent before UniSat added batch signing. */
21
+ signPsbts?: (psbts: string[], options?: any[]) => Promise<string[]>
24
22
  pushPsbt: (psbt: any) => Promise<string>
25
23
  getPublicKey: () => Promise<string>
26
24
  sendBitcoin: (toAddress: string, amountSats: number) => Promise<string>
package/dist/vue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ref as s, onScopeDispose as u, watch as i } from "vue";
2
- import { e as r, U as c, k as a } from "./mint-CSk_3TfL.js";
3
- function n() {
2
+ import { e as r, Y as c, l as a } from "./helpers-BvhfqxFB.js";
3
+ function w() {
4
4
  const o = s(r()), t = c((e) => {
5
5
  o.value !== e && (o.value = e);
6
6
  });
@@ -9,5 +9,5 @@ function n() {
9
9
  }), o;
10
10
  }
11
11
  export {
12
- n as useNetwork
12
+ w as useNetwork
13
13
  };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@bestinslot/wallet-kit",
3
3
  "type": "module",
4
- "version": "0.14.3",
4
+ "version": "0.15.0-rc.1",
5
5
  "private": false,
6
+ "packageManager": "pnpm@10.28.2",
6
7
  "description": "A lightweight JavaScript library for connecting Bitcoin wallets with a unified API.",
7
8
  "license": "MIT",
8
9
  "exports": {
@@ -46,6 +47,30 @@
46
47
  "files": [
47
48
  "dist"
48
49
  ],
50
+ "scripts": {
51
+ "dev": "vite",
52
+ "build": "vue-tsc -b && vite build",
53
+ "build:debug": "vue-tsc -b && vite build --minify=false",
54
+ "prepublishOnly": "vue-tsc -b && vite build && node scripts/verify-build-flavours.mjs",
55
+ "preview": "vite preview",
56
+ "prepare": "husky",
57
+ "lint": "eslint",
58
+ "lint:fix": "eslint --fix && prettier --write .",
59
+ "format": "prettier --write .",
60
+ "format:check": "prettier --check .",
61
+ "test": "vitest run",
62
+ "release": "node scripts/release.mjs",
63
+ "release:tag": "node scripts/release.mjs --tag",
64
+ "verify:bundles": "node scripts/verify-build-flavours.mjs",
65
+ "test:signet": "vitest run tests/signet/ --config vitest.signet.config.ts",
66
+ "test:mainnet": "vitest run tests/mainnet/ --config vitest.mainnet.config.ts",
67
+ "docs:api": "typedoc",
68
+ "examples:install": "pnpm install",
69
+ "examples:build": "pnpm build && pnpm -r --filter \"./examples/*\" build",
70
+ "example:react": "pnpm build && pnpm --filter example-react dev",
71
+ "example:vue": "pnpm build && pnpm --filter example-vue dev",
72
+ "example:vanilla": "pnpm build && pnpm --filter example-vanillajs dev"
73
+ },
49
74
  "peerDependencies": {
50
75
  "react": ">=18",
51
76
  "vue": "^3.5.13"
@@ -68,6 +93,8 @@
68
93
  "@noble/curves": "2.0.1",
69
94
  "@noble/hashes": "2.0.1",
70
95
  "@noble/secp256k1": "^3.0.0",
96
+ "@wallet-standard/app": "^1.1.1",
97
+ "@wallet-standard/base": "^1.1.1",
71
98
  "base64-arraybuffer": "^1.0.2",
72
99
  "bip322-js": "^3.0.0",
73
100
  "bitcoinjs-lib": "^6.1.7",
@@ -81,7 +108,6 @@
81
108
  },
82
109
  "devDependencies": {
83
110
  "@antfu/eslint-config": "^6.7.3",
84
- "@leather-wallet/types": "^0.2.1",
85
111
  "@tailwindcss/vite": "^4.1.18",
86
112
  "@testing-library/react": "^16.3.2",
87
113
  "@types/react": "^19.2.17",
@@ -117,27 +143,5 @@
117
143
  },
118
144
  "lint-staged": {
119
145
  "*": "prettier --write --ignore-unknown"
120
- },
121
- "scripts": {
122
- "dev": "vite",
123
- "build": "vue-tsc -b && vite build",
124
- "build:debug": "vue-tsc -b && vite build --minify=false",
125
- "preview": "vite preview",
126
- "lint": "eslint",
127
- "lint:fix": "eslint --fix && prettier --write .",
128
- "format": "prettier --write .",
129
- "format:check": "prettier --check .",
130
- "test": "vitest run",
131
- "release": "node scripts/release.mjs",
132
- "release:tag": "node scripts/release.mjs --tag",
133
- "verify:bundles": "node scripts/verify-build-flavours.mjs",
134
- "test:signet": "vitest run tests/signet/ --config vitest.signet.config.ts",
135
- "test:mainnet": "vitest run tests/mainnet/ --config vitest.mainnet.config.ts",
136
- "docs:api": "typedoc",
137
- "examples:install": "pnpm install",
138
- "examples:build": "pnpm build && pnpm -r --filter \"./examples/*\" build",
139
- "example:react": "pnpm build && pnpm --filter example-react dev",
140
- "example:vue": "pnpm build && pnpm --filter example-vue dev",
141
- "example:vanilla": "pnpm build && pnpm --filter example-vanillajs dev"
142
146
  }
143
- }
147
+ }