@meshsdk/wallet 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -71
- package/dist/index.cjs +5686 -21930
- package/dist/index.d.ts +1161 -9
- package/dist/index.js +6214 -21878
- package/package.json +25 -16
- package/dist/index.d.cts +0 -107
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { DataSignature, Extension as Extension$1, UTxO as UTxO$1, Asset, IFetcher, ISubmitter } from '@meshsdk/common';
|
|
2
|
+
import { Network, Signer, Psbt } from 'bitcoinjs-lib';
|
|
3
|
+
import { BIP32Interface } from 'bip32';
|
|
4
|
+
|
|
1
5
|
interface ISigner {
|
|
2
6
|
getPublicKey(): Promise<string>;
|
|
3
7
|
getPublicKeyHash(): Promise<string>;
|
|
@@ -11,13 +15,13 @@ interface ISecretManager {
|
|
|
11
15
|
getSigner(derivationPath: DerivationPath): Promise<ISigner>;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
declare class
|
|
18
|
+
declare class CardanoInMemoryBip32 implements ISecretManager {
|
|
15
19
|
private bip32PrivateKey;
|
|
16
20
|
private constructor();
|
|
17
|
-
static fromMnemonic(mnemonic: string[], password?: string): Promise<
|
|
18
|
-
static fromEntropy(entropy: string, password?: string): Promise<
|
|
19
|
-
static fromKeyHex(keyHex: string):
|
|
20
|
-
static fromBech32(bech32: string):
|
|
21
|
+
static fromMnemonic(mnemonic: string[], password?: string): Promise<CardanoInMemoryBip32>;
|
|
22
|
+
static fromEntropy(entropy: string, password?: string): Promise<CardanoInMemoryBip32>;
|
|
23
|
+
static fromKeyHex(keyHex: string): CardanoInMemoryBip32;
|
|
24
|
+
static fromBech32(bech32: string): CardanoInMemoryBip32;
|
|
21
25
|
/**
|
|
22
26
|
* Get the Bip32 public key in hex format.
|
|
23
27
|
* @returns {Promise<string>} A promise that resolves to the public key in hex format.
|
|
@@ -30,6 +34,21 @@ declare class InMemoryBip32 implements ISecretManager {
|
|
|
30
34
|
getSigner(derivationPath: DerivationPath): Promise<ISigner>;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
declare class BitcoinInMemoryBip32 {
|
|
38
|
+
private root;
|
|
39
|
+
private constructor();
|
|
40
|
+
static fromMnemonic(mnemonic: string[], password?: string): Promise<BitcoinInMemoryBip32>;
|
|
41
|
+
static fromEntropy(entropy: string, password?: string): Promise<BitcoinInMemoryBip32>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the private key (hex) for the provided derivation path.
|
|
44
|
+
*/
|
|
45
|
+
getPrivateKey(derivationPath: DerivationPath): string;
|
|
46
|
+
/**
|
|
47
|
+
* Get the public key (hex) for the provided derivation path.
|
|
48
|
+
*/
|
|
49
|
+
getPublicKey(derivationPath: DerivationPath): string;
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
/**
|
|
34
53
|
* BaseSigner provides functionalities to sign and verify data using Ed25519 keys.
|
|
35
54
|
* It supports construction from both extended and normal private key hex formats.
|
|
@@ -83,17 +102,17 @@ type Credential = {
|
|
|
83
102
|
type: CredentialType;
|
|
84
103
|
hash: string;
|
|
85
104
|
};
|
|
86
|
-
declare enum AddressType {
|
|
105
|
+
declare enum AddressType$1 {
|
|
87
106
|
Enterprise = 0,
|
|
88
107
|
Base = 1,
|
|
89
108
|
Reward = 2
|
|
90
109
|
}
|
|
91
110
|
declare class CardanoAddress {
|
|
92
|
-
addressType: AddressType;
|
|
111
|
+
addressType: AddressType$1;
|
|
93
112
|
networkId: number;
|
|
94
113
|
paymentCredential: Credential;
|
|
95
114
|
stakeCredential?: Credential;
|
|
96
|
-
constructor(addressType: AddressType, networkId: number, paymentCredential: Credential, stakeCredential?: Credential);
|
|
115
|
+
constructor(addressType: AddressType$1, networkId: number, paymentCredential: Credential, stakeCredential?: Credential);
|
|
97
116
|
getAddressBech32(): string;
|
|
98
117
|
getAddressHex(): string;
|
|
99
118
|
private getEnterpriseAddressBech32;
|
|
@@ -104,4 +123,1137 @@ declare class CardanoAddress {
|
|
|
104
123
|
private getRewardAddressHex;
|
|
105
124
|
}
|
|
106
125
|
|
|
107
|
-
|
|
126
|
+
interface ICardanoWallet {
|
|
127
|
+
getExtensions(): Promise<{
|
|
128
|
+
cip: number;
|
|
129
|
+
}[]>;
|
|
130
|
+
getNetworkId(): Promise<number>;
|
|
131
|
+
getUtxos(): Promise<string[]>;
|
|
132
|
+
getCollateral(): Promise<string[]>;
|
|
133
|
+
getBalance(): Promise<string>;
|
|
134
|
+
getUsedAddresses(): Promise<string[]>;
|
|
135
|
+
getUnusedAddresses(): Promise<string[]>;
|
|
136
|
+
getRewardAddresses(): Promise<string[]>;
|
|
137
|
+
getChangeAddress(): Promise<string>;
|
|
138
|
+
signTx(data: string, partialSign: boolean): Promise<string>;
|
|
139
|
+
signData(addressHex: string, data: string): Promise<DataSignature>;
|
|
140
|
+
submitTx(tx: string): Promise<string>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type Wallet = {
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
icon: string;
|
|
147
|
+
version: string;
|
|
148
|
+
};
|
|
149
|
+
type Cardano = {
|
|
150
|
+
[key: string]: {
|
|
151
|
+
name: string;
|
|
152
|
+
icon: string;
|
|
153
|
+
apiVersion: string;
|
|
154
|
+
enable: (extensions?: {
|
|
155
|
+
extensions: {
|
|
156
|
+
cip: number;
|
|
157
|
+
}[];
|
|
158
|
+
}) => Promise<ICardanoWallet>;
|
|
159
|
+
supportedExtensions?: {
|
|
160
|
+
cip: number;
|
|
161
|
+
}[];
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
type Extension = {
|
|
165
|
+
cip: number;
|
|
166
|
+
};
|
|
167
|
+
declare class CardanoBrowserWallet implements ICardanoWallet {
|
|
168
|
+
walletInstance: ICardanoWallet;
|
|
169
|
+
constructor(walletInstance: ICardanoWallet);
|
|
170
|
+
getExtensions(): Promise<{
|
|
171
|
+
cip: number;
|
|
172
|
+
}[]>;
|
|
173
|
+
getNetworkId(): Promise<number>;
|
|
174
|
+
getUtxos(): Promise<string[]>;
|
|
175
|
+
getCollateral(): Promise<string[]>;
|
|
176
|
+
getBalance(): Promise<string>;
|
|
177
|
+
getUsedAddresses(): Promise<string[]>;
|
|
178
|
+
getUnusedAddresses(): Promise<string[]>;
|
|
179
|
+
getRewardAddresses(): Promise<string[]>;
|
|
180
|
+
getChangeAddress(): Promise<string>;
|
|
181
|
+
signTx(data: string, partialSign: boolean): Promise<string>;
|
|
182
|
+
signData(addressBech32: string, data: string): Promise<DataSignature>;
|
|
183
|
+
submitTx(tx: string): Promise<string>;
|
|
184
|
+
/**
|
|
185
|
+
* Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
|
|
186
|
+
* - A name is provided to display wallet's name on the user interface.
|
|
187
|
+
* - A version is provided to display wallet's version on the user interface.
|
|
188
|
+
* - An icon is provided to display wallet's icon on the user interface.
|
|
189
|
+
*
|
|
190
|
+
* @returns a list of wallet names
|
|
191
|
+
*/
|
|
192
|
+
static getInstalledWallets(): Wallet[];
|
|
193
|
+
/**
|
|
194
|
+
* This is the entrypoint to start communication with the user's wallet. The wallet should request the user's permission to connect the web page to the user's wallet, and if permission has been granted, the wallet will be returned and exposing the full API for the app to use.
|
|
195
|
+
*
|
|
196
|
+
* Query BrowserWallet.getInstalledWallets() to get a list of available wallets, then provide the wallet name for which wallet the user would like to connect with.
|
|
197
|
+
*
|
|
198
|
+
* @param walletName - the name of the wallet to enable (e.g. "eternl", "begin")
|
|
199
|
+
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
200
|
+
* @returns WalletInstance
|
|
201
|
+
*/
|
|
202
|
+
static enable(walletName: string, extensions?: Extension[]): Promise<ICardanoWallet>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare class MeshCardanoBrowserWallet extends CardanoBrowserWallet {
|
|
206
|
+
constructor(walletInstance: ICardanoWallet);
|
|
207
|
+
static enable(walletName: string, extensions?: Extension$1[]): Promise<MeshCardanoBrowserWallet>;
|
|
208
|
+
getUtxosMesh(): Promise<UTxO$1[]>;
|
|
209
|
+
getCollateralMesh(): Promise<UTxO$1[]>;
|
|
210
|
+
getBalanceMesh(): Promise<Asset[]>;
|
|
211
|
+
getUsedAddressesBech32(): Promise<string[]>;
|
|
212
|
+
getUnusedAddressesBech32(): Promise<string[]>;
|
|
213
|
+
getChangeAddressBech32(): Promise<string>;
|
|
214
|
+
getRewardAddressesBech32(): Promise<string[]>;
|
|
215
|
+
signTxReturnFullTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
type CredentialSource = {
|
|
219
|
+
type: "signer";
|
|
220
|
+
signer: ISigner;
|
|
221
|
+
} | {
|
|
222
|
+
type: "scriptHash";
|
|
223
|
+
scriptHash: string;
|
|
224
|
+
};
|
|
225
|
+
interface AddressManagerConfig {
|
|
226
|
+
addressSource: AddressSource;
|
|
227
|
+
networkId: number;
|
|
228
|
+
}
|
|
229
|
+
type AddressSource = {
|
|
230
|
+
type: "secretManager";
|
|
231
|
+
secretManager: ISecretManager;
|
|
232
|
+
} | {
|
|
233
|
+
type: "credentials";
|
|
234
|
+
paymentCredential: CredentialSource;
|
|
235
|
+
stakeCredential?: CredentialSource;
|
|
236
|
+
drepCredential?: CredentialSource;
|
|
237
|
+
};
|
|
238
|
+
declare class AddressManager {
|
|
239
|
+
private readonly paymentCredential;
|
|
240
|
+
private readonly stakeCredential;
|
|
241
|
+
private readonly drepCredential;
|
|
242
|
+
private readonly paymentSigner;
|
|
243
|
+
private readonly stakeSigner?;
|
|
244
|
+
private readonly drepSigner?;
|
|
245
|
+
private readonly networkId;
|
|
246
|
+
static create(config: AddressManagerConfig): Promise<AddressManager>;
|
|
247
|
+
private constructor();
|
|
248
|
+
getNextAddress(addressType: AddressType$1): Promise<CardanoAddress>;
|
|
249
|
+
getChangeAddress(addressType: AddressType$1): Promise<CardanoAddress>;
|
|
250
|
+
getRewardAccount(): Promise<CardanoAddress>;
|
|
251
|
+
asyncGetAllUsedAddresses(): Promise<CardanoAddress[]>;
|
|
252
|
+
getCredentialsSigners(pubkeyHashes: Set<string>): Promise<Map<string, ISigner>>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
type WalletAddressType = AddressType$1.Base | AddressType$1.Enterprise;
|
|
256
|
+
/**
|
|
257
|
+
* Configuration for creating a CardanoHeadlessWallet instance.
|
|
258
|
+
*/
|
|
259
|
+
interface CardanoHeadlessWalletConfig {
|
|
260
|
+
/**
|
|
261
|
+
* The source for wallet's signing keys and addresses. Could either be a secret manager or explicit credentials.
|
|
262
|
+
*/
|
|
263
|
+
addressSource: AddressSource;
|
|
264
|
+
/**
|
|
265
|
+
* The network ID (0 for testnet, 1 for mainnet).
|
|
266
|
+
*/
|
|
267
|
+
networkId: number;
|
|
268
|
+
/**
|
|
269
|
+
* The type of wallet address to use (Base or Enterprise).
|
|
270
|
+
* Base addresses include staking capabilities, while Enterprise addresses do not.
|
|
271
|
+
*/
|
|
272
|
+
walletAddressType: WalletAddressType;
|
|
273
|
+
/**
|
|
274
|
+
* Optional fetcher instance for querying blockchain data (UTxOs, protocol parameters, etc.).
|
|
275
|
+
*/
|
|
276
|
+
fetcher?: IFetcher;
|
|
277
|
+
/**
|
|
278
|
+
* Optional submitter instance for submitting transactions to the blockchain.
|
|
279
|
+
*/
|
|
280
|
+
submitter?: ISubmitter;
|
|
281
|
+
}
|
|
282
|
+
declare class CardanoHeadlessWallet implements ICardanoWallet {
|
|
283
|
+
protected networkId: number;
|
|
284
|
+
protected addressManager: AddressManager;
|
|
285
|
+
protected fetcher?: IFetcher;
|
|
286
|
+
protected submitter?: ISubmitter;
|
|
287
|
+
protected walletAddressType: WalletAddressType;
|
|
288
|
+
protected constructor(networkId: number, addressManager: AddressManager, walletAddressType: WalletAddressType, fetcher?: IFetcher, submitter?: ISubmitter);
|
|
289
|
+
static create(config: CardanoHeadlessWalletConfig): Promise<CardanoHeadlessWallet>;
|
|
290
|
+
/**
|
|
291
|
+
* Create a CardanoHeadlessWallet instance from a Bip32 root in Bech32 format.
|
|
292
|
+
* @param config The configuration object
|
|
293
|
+
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
294
|
+
*/
|
|
295
|
+
static fromBip32Root(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
296
|
+
bech32: string;
|
|
297
|
+
}): Promise<CardanoHeadlessWallet>;
|
|
298
|
+
/**
|
|
299
|
+
* Create a CardanoHeadlessWallet instance from a Bip32 root in hex format.
|
|
300
|
+
* @param config The configuration object
|
|
301
|
+
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
302
|
+
*/
|
|
303
|
+
static fromBip32RootHex(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
304
|
+
hex: string;
|
|
305
|
+
}): Promise<CardanoHeadlessWallet>;
|
|
306
|
+
/**
|
|
307
|
+
* Create a CardanoHeadlessWallet instance from a mnemonic phrase.
|
|
308
|
+
* @param config The configuration object
|
|
309
|
+
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
310
|
+
*/
|
|
311
|
+
static fromMnemonic(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
312
|
+
mnemonic: string[];
|
|
313
|
+
password?: string;
|
|
314
|
+
}): Promise<CardanoHeadlessWallet>;
|
|
315
|
+
static fromCredentialSources(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
316
|
+
paymentCredentialSource: CredentialSource;
|
|
317
|
+
stakeCredentialSource?: CredentialSource;
|
|
318
|
+
drepCredentialSource?: CredentialSource;
|
|
319
|
+
}): Promise<CardanoHeadlessWallet>;
|
|
320
|
+
/**
|
|
321
|
+
* Submit a transaction to the network, using the submitter instance.
|
|
322
|
+
* @param tx The transaction in CBOR hex format
|
|
323
|
+
* @returns {Promise<string>} A promise that resolves to the transaction ID
|
|
324
|
+
*/
|
|
325
|
+
submitTx(tx: string): Promise<string>;
|
|
326
|
+
/**
|
|
327
|
+
* Get the list of extensions enabled for this wallet.
|
|
328
|
+
* @returns {Promise<{ cip: number }[]>} A promise that resolves to an array of enabled extensions
|
|
329
|
+
*/
|
|
330
|
+
getExtensions(): Promise<{
|
|
331
|
+
cip: number;
|
|
332
|
+
}[]>;
|
|
333
|
+
/**
|
|
334
|
+
* Get the network ID.
|
|
335
|
+
* @returns {number} The network ID
|
|
336
|
+
*/
|
|
337
|
+
getNetworkId(): Promise<number>;
|
|
338
|
+
/**
|
|
339
|
+
* Get the UTxOs for the wallet.
|
|
340
|
+
*
|
|
341
|
+
* NOTE: This method is only an approximation to CIP-30 getUtxos, as this wallet is completely
|
|
342
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
343
|
+
* will be overlap between getUtxos() and getCollateral() results. This can result in the collateral being
|
|
344
|
+
* spent between transactions.
|
|
345
|
+
*
|
|
346
|
+
* The method also does not perform pagination, nor is there a coin selection mechanism.
|
|
347
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of UTxOs in CBOR hex format
|
|
348
|
+
*/
|
|
349
|
+
getUtxos(): Promise<string[]>;
|
|
350
|
+
/**
|
|
351
|
+
* Get the collateral UTxOs for the wallet.
|
|
352
|
+
*
|
|
353
|
+
* NOTE: This method is only an approximation to CIP-30 getCollateral, as this wallet is completely
|
|
354
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
355
|
+
* will be overlap between getUtxos() and getCollateral() results.
|
|
356
|
+
*
|
|
357
|
+
* The basic strategy is to return the smallest pure ADA UTxO that is at least 5 ADA belonging to the wallet.
|
|
358
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of UTxOs in CBOR hex format
|
|
359
|
+
*/
|
|
360
|
+
getCollateral(): Promise<string[]>;
|
|
361
|
+
/**
|
|
362
|
+
* Get the balance of the wallet.
|
|
363
|
+
*
|
|
364
|
+
* NOTE: This method is only an approximation to CIP-30 getBalance, as this wallet is completely
|
|
365
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means the balance
|
|
366
|
+
* returned includes all UTxOs, including those that may be used as collateral.
|
|
367
|
+
* @returns {Promise<string>} A promise that resolves to the balance in CBOR hex format
|
|
368
|
+
*/
|
|
369
|
+
getBalance(): Promise<string>;
|
|
370
|
+
/**
|
|
371
|
+
* Get the used addresses for the wallet.
|
|
372
|
+
*
|
|
373
|
+
* NOTE: This method completely deviates from CIP-30 getUsedAddresses, as this wallet is stateless
|
|
374
|
+
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
375
|
+
*
|
|
376
|
+
* It will be effective to be used as a single address wallet.
|
|
377
|
+
*
|
|
378
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of used addresses in hex format
|
|
379
|
+
*/
|
|
380
|
+
getUsedAddresses(): Promise<string[]>;
|
|
381
|
+
/**
|
|
382
|
+
* Get the unused addresses for the wallet.
|
|
383
|
+
*
|
|
384
|
+
* NOTE: This method completely deviates from CIP-30 getUnusedAddresses, as this wallet is stateless
|
|
385
|
+
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
386
|
+
*
|
|
387
|
+
* It will be effective to be used as a single address wallet.
|
|
388
|
+
*
|
|
389
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of unused addresses in hex format
|
|
390
|
+
*/
|
|
391
|
+
getUnusedAddresses(): Promise<string[]>;
|
|
392
|
+
/**
|
|
393
|
+
* Get the change address for the wallet.
|
|
394
|
+
* NOTE: This method deviates from CIP-30 getChangeAddress, as this wallet is stateless
|
|
395
|
+
* it does not track which addresses has been previously used as change address. This method simply
|
|
396
|
+
* returns the wallet's main address.
|
|
397
|
+
*
|
|
398
|
+
* It will be effective to be used as a single address wallet.
|
|
399
|
+
*
|
|
400
|
+
* @returns {Promise<string>} A promise that resolves to the change address in hex format
|
|
401
|
+
*/
|
|
402
|
+
getChangeAddress(): Promise<string>;
|
|
403
|
+
/**
|
|
404
|
+
* Get the reward address for the wallet.
|
|
405
|
+
*
|
|
406
|
+
* @returns {Promise<string[]>} A promise that resolves an array of reward addresses in hex format
|
|
407
|
+
*/
|
|
408
|
+
getRewardAddresses(): Promise<string[]>;
|
|
409
|
+
/**
|
|
410
|
+
* Sign a transaction with the wallet.
|
|
411
|
+
*
|
|
412
|
+
* NOTE: This method requires a fetcher to resolve input UTxOs for determining required signers.
|
|
413
|
+
*
|
|
414
|
+
* It is also only an approximation to CIP-30 signTx, as this wallet is stateless and does not repeatedly
|
|
415
|
+
* derive keys, it is unable to sign for multiple derived key indexes.
|
|
416
|
+
*
|
|
417
|
+
* It will be effective to be used as a single address wallet.
|
|
418
|
+
*
|
|
419
|
+
* @param tx The transaction in CBOR hex format
|
|
420
|
+
* @returns A promise that resolves to a witness set with the signatures in CBOR hex format
|
|
421
|
+
*/
|
|
422
|
+
signTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
423
|
+
signData(addressBech32: string, data: string): Promise<DataSignature>;
|
|
424
|
+
fetchAccountUtxos(): Promise<UTxO$1[]>;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* MeshCardanoHeadlessWallet provides additional convenience methods on top of CardanoHeadlessWallet,
|
|
429
|
+
* such as returning results in Mesh-compatible formats and Bech32 addresses.
|
|
430
|
+
*/
|
|
431
|
+
declare class MeshCardanoHeadlessWallet extends CardanoHeadlessWallet {
|
|
432
|
+
static create(config: CardanoHeadlessWalletConfig): Promise<MeshCardanoHeadlessWallet>;
|
|
433
|
+
static fromMnemonic(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
434
|
+
mnemonic: string[];
|
|
435
|
+
password?: string;
|
|
436
|
+
}): Promise<MeshCardanoHeadlessWallet>;
|
|
437
|
+
static fromBip32Root(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
438
|
+
bech32: string;
|
|
439
|
+
}): Promise<MeshCardanoHeadlessWallet>;
|
|
440
|
+
static fromBip32RootHex(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
441
|
+
hex: string;
|
|
442
|
+
}): Promise<MeshCardanoHeadlessWallet>;
|
|
443
|
+
static fromCredentialSources(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
444
|
+
paymentCredentialSource: CredentialSource;
|
|
445
|
+
stakeCredentialSource?: CredentialSource;
|
|
446
|
+
drepCredentialSource?: CredentialSource;
|
|
447
|
+
}): Promise<MeshCardanoHeadlessWallet>;
|
|
448
|
+
/**
|
|
449
|
+
* Get the UTxOs for the wallet.
|
|
450
|
+
*
|
|
451
|
+
* NOTE: This method is only an approximation to CIP-30 getUtxos, as this wallet is completely
|
|
452
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
453
|
+
* will be overlap between getUtxos() and getCollateral() results. This can result in the collateral being
|
|
454
|
+
* spent between transactions.
|
|
455
|
+
*
|
|
456
|
+
* The method also does not perform pagination, nor is there a coin selection mechanism.
|
|
457
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of UTxOs in the Mesh UTxO format
|
|
458
|
+
*/
|
|
459
|
+
getUtxosMesh(): Promise<UTxO$1[]>;
|
|
460
|
+
/**
|
|
461
|
+
* Get the collateral UTxOs for the wallet.
|
|
462
|
+
*
|
|
463
|
+
* NOTE: This method is only an approximation to CIP-30 getCollateral, as this wallet is completely
|
|
464
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
465
|
+
* will be overlap between getUtxos() and getCollateral() results.
|
|
466
|
+
*
|
|
467
|
+
* The basic strategy is to return the smallest pure ADA UTxO that is at least 5 ADA belonging to the wallet.
|
|
468
|
+
* @returns {Promise<UTxO[]>} A promise that resolves to an array of UTxOs in the Mesh UTxO format
|
|
469
|
+
*/
|
|
470
|
+
getCollateralMesh(): Promise<UTxO$1[]>;
|
|
471
|
+
/**
|
|
472
|
+
* Get the balance of the wallet.
|
|
473
|
+
*
|
|
474
|
+
* NOTE: This method is only an approximation to CIP-30 getBalance, as this wallet is completely
|
|
475
|
+
* stateless and does not track which UTxOs are specifically set as collateral. Which means the balance
|
|
476
|
+
* returned includes all UTxOs, including those that may be used as collateral.
|
|
477
|
+
* @returns {Promise<Asset[]>} A promise that resolves to the balance in the Mesh Asset format
|
|
478
|
+
*/
|
|
479
|
+
getBalanceMesh(): Promise<Asset[]>;
|
|
480
|
+
/**
|
|
481
|
+
* Get the used addresses for the wallet.
|
|
482
|
+
*
|
|
483
|
+
* NOTE: This method completely deviates from CIP-30 getUsedAddresses, as this wallet is stateless
|
|
484
|
+
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
485
|
+
*
|
|
486
|
+
* It will be effective to be used as a single address wallet.
|
|
487
|
+
*
|
|
488
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of used addresses in Bech32 format
|
|
489
|
+
*/
|
|
490
|
+
getUsedAddressesBech32(): Promise<string[]>;
|
|
491
|
+
/**
|
|
492
|
+
* Get the unused addresses for the wallet.
|
|
493
|
+
*
|
|
494
|
+
* NOTE: This method completely deviates from CIP-30 getUnusedAddresses, as this wallet is stateless
|
|
495
|
+
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
496
|
+
*
|
|
497
|
+
* It will be effective to be used as a single address wallet.
|
|
498
|
+
*
|
|
499
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of unused addresses in Bech32 format
|
|
500
|
+
*/
|
|
501
|
+
getUnusedAddressesBech32(): Promise<string[]>;
|
|
502
|
+
/**
|
|
503
|
+
* Get the change address for the wallet.
|
|
504
|
+
* NOTE: This method deviates from CIP-30 getChangeAddress, as this wallet is stateless
|
|
505
|
+
* it does not track which addresses has been previously used as change address. This method simply
|
|
506
|
+
* returns the wallet's main address.
|
|
507
|
+
*
|
|
508
|
+
* It will be effective to be used as a single address wallet.
|
|
509
|
+
*
|
|
510
|
+
* @returns {Promise<string>} A promise that resolves to the change address in Bech32 format
|
|
511
|
+
*/
|
|
512
|
+
getChangeAddressBech32(): Promise<string>;
|
|
513
|
+
/**
|
|
514
|
+
* Get the reward address for the wallet.
|
|
515
|
+
* @returns {Promise<string[]>} A promise that resolves an array of reward addresses in Bech32 format
|
|
516
|
+
*/
|
|
517
|
+
getRewardAddressesBech32(): Promise<string[]>;
|
|
518
|
+
/**
|
|
519
|
+
* Sign a transaction with the wallet.
|
|
520
|
+
*
|
|
521
|
+
* NOTE: This method requires a fetcher to resolve input UTxOs for determining required signers.
|
|
522
|
+
*
|
|
523
|
+
* It is also only an approximation to CIP-30 signTx, as this wallet is stateless and does not repeatedly
|
|
524
|
+
* derive keys, it is unable to sign for multiple derived key indexes.
|
|
525
|
+
*
|
|
526
|
+
* It will be effective to be used as a single address wallet.
|
|
527
|
+
*
|
|
528
|
+
* @param tx The transaction in CBOR hex format
|
|
529
|
+
* @returns A promise that resolves to a full transaction with extra vkey witnesses added from the wallet
|
|
530
|
+
* to the witness set in CBOR hex format
|
|
531
|
+
*/
|
|
532
|
+
signTxReturnFullTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
type TransactionsStatus = {
|
|
536
|
+
confirmed: boolean;
|
|
537
|
+
block_height: number;
|
|
538
|
+
block_hash: string;
|
|
539
|
+
block_time: number;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
type TransactionsInfo = {
|
|
543
|
+
txid: string;
|
|
544
|
+
version: number;
|
|
545
|
+
locktime: number;
|
|
546
|
+
vin: {
|
|
547
|
+
txid: string;
|
|
548
|
+
vout: number;
|
|
549
|
+
prevout: {
|
|
550
|
+
scriptpubkey: string;
|
|
551
|
+
scriptpubkey_asm: string;
|
|
552
|
+
scriptpubkey_type: string;
|
|
553
|
+
scriptpubkey_address: string;
|
|
554
|
+
value: number;
|
|
555
|
+
};
|
|
556
|
+
scriptsig: string;
|
|
557
|
+
scriptsig_asm: string;
|
|
558
|
+
witness: string[];
|
|
559
|
+
is_coinbase: boolean;
|
|
560
|
+
sequence: number;
|
|
561
|
+
}[];
|
|
562
|
+
vout: {
|
|
563
|
+
scriptpubkey: string;
|
|
564
|
+
scriptpubkey_asm: string;
|
|
565
|
+
scriptpubkey_type: string;
|
|
566
|
+
scriptpubkey_address: string;
|
|
567
|
+
value: number;
|
|
568
|
+
}[];
|
|
569
|
+
size: number;
|
|
570
|
+
weight: number;
|
|
571
|
+
fee: number;
|
|
572
|
+
status: TransactionsStatus;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
type UTxO = {
|
|
576
|
+
status: {
|
|
577
|
+
block_hash: string;
|
|
578
|
+
block_height: number;
|
|
579
|
+
block_time: number;
|
|
580
|
+
confirmed: boolean;
|
|
581
|
+
};
|
|
582
|
+
txid: string;
|
|
583
|
+
value: number;
|
|
584
|
+
vout: number;
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
declare enum AddressPurpose {
|
|
588
|
+
Ordinals = "ordinals",
|
|
589
|
+
Payment = "payment",
|
|
590
|
+
Stacks = "stacks",
|
|
591
|
+
Starknet = "starknet",
|
|
592
|
+
Spark = "spark"
|
|
593
|
+
}
|
|
594
|
+
declare enum AddressType {
|
|
595
|
+
p2pkh = "p2pkh",
|
|
596
|
+
p2sh = "p2sh",
|
|
597
|
+
p2wpkh = "p2wpkh",
|
|
598
|
+
p2wsh = "p2wsh",
|
|
599
|
+
p2tr = "p2tr",
|
|
600
|
+
stacks = "stacks",
|
|
601
|
+
starknet = "starknet",
|
|
602
|
+
spark = "spark"
|
|
603
|
+
}
|
|
604
|
+
type BitcoinAddress = {
|
|
605
|
+
address: string;
|
|
606
|
+
publicKey: string;
|
|
607
|
+
purpose: AddressPurpose;
|
|
608
|
+
addressType: AddressType;
|
|
609
|
+
walletType: "software" | "ledger" | "keystone";
|
|
610
|
+
};
|
|
611
|
+
type BitcoinAccount = {
|
|
612
|
+
walletType: "software" | "ledger" | "keystone";
|
|
613
|
+
address: string;
|
|
614
|
+
publicKey: string;
|
|
615
|
+
purpose: AddressPurpose;
|
|
616
|
+
addressType: AddressType;
|
|
617
|
+
};
|
|
618
|
+
type BitcoinBalance = {
|
|
619
|
+
confirmed: string;
|
|
620
|
+
unconfirmed: string;
|
|
621
|
+
total: string;
|
|
622
|
+
};
|
|
623
|
+
declare enum MessageSigningProtocols {
|
|
624
|
+
ECDSA = "ECDSA",
|
|
625
|
+
BIP322 = "BIP322"
|
|
626
|
+
}
|
|
627
|
+
type BitcoinSignature = {
|
|
628
|
+
signature: string;
|
|
629
|
+
messageHash: string;
|
|
630
|
+
address: string;
|
|
631
|
+
protocol: MessageSigningProtocols;
|
|
632
|
+
};
|
|
633
|
+
type VerifyMessageResult = {
|
|
634
|
+
valid: boolean;
|
|
635
|
+
recoveredPublicKey?: string;
|
|
636
|
+
reason?: string;
|
|
637
|
+
};
|
|
638
|
+
interface IBitcoinWallet {
|
|
639
|
+
getNetwork(): Promise<"Mainnet" | "Testnet4">;
|
|
640
|
+
getAddresses(addressPurposes: AddressPurpose[]): Promise<BitcoinAddress[]>;
|
|
641
|
+
getAccounts(addressPurposes: AddressPurpose[]): Promise<BitcoinAccount[]>;
|
|
642
|
+
getBalance(): Promise<BitcoinBalance>;
|
|
643
|
+
signMessage(address: string, message: string, protocol?: MessageSigningProtocols): Promise<BitcoinSignature>;
|
|
644
|
+
verifyMessage(address: string, message: string, signature: string): Promise<VerifyMessageResult>;
|
|
645
|
+
signTransfer(recipients: {
|
|
646
|
+
address: string;
|
|
647
|
+
amount: number;
|
|
648
|
+
}[]): Promise<string>;
|
|
649
|
+
signPsbt(signConfig: {
|
|
650
|
+
psbt: string;
|
|
651
|
+
signInputs?: {
|
|
652
|
+
[x: string]: number[];
|
|
653
|
+
} | undefined;
|
|
654
|
+
broadcast?: boolean | undefined;
|
|
655
|
+
}): Promise<string>;
|
|
656
|
+
fetchUTXOs(purposes?: AddressPurpose[]): Promise<(UTxO & {
|
|
657
|
+
address: string;
|
|
658
|
+
purpose: AddressPurpose;
|
|
659
|
+
})[]>;
|
|
660
|
+
getTransactionHistory(options?: {
|
|
661
|
+
purposes?: AddressPurpose[];
|
|
662
|
+
lastSeenTxid?: string;
|
|
663
|
+
}): Promise<(TransactionsInfo & {
|
|
664
|
+
address: string;
|
|
665
|
+
purpose: AddressPurpose;
|
|
666
|
+
})[]>;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
type ChainStats = {
|
|
670
|
+
funded_txo_count: number;
|
|
671
|
+
funded_txo_sum: number;
|
|
672
|
+
spent_txo_count: number;
|
|
673
|
+
spent_txo_sum: number;
|
|
674
|
+
tx_count: number;
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
type MempoolStats = {
|
|
678
|
+
funded_txo_count: number;
|
|
679
|
+
funded_txo_sum: number;
|
|
680
|
+
spent_txo_count: number;
|
|
681
|
+
spent_txo_sum: number;
|
|
682
|
+
tx_count: number;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
type AddressInfo = {
|
|
686
|
+
address: string;
|
|
687
|
+
chain_stats: ChainStats;
|
|
688
|
+
mempool_stats: MempoolStats;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
type ScriptInfo = {
|
|
692
|
+
scripthash: string;
|
|
693
|
+
chain_stats: ChainStats;
|
|
694
|
+
mempool_stats: MempoolStats;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Read-only chain data queries for Bitcoin addresses and scripts.
|
|
699
|
+
* Mirrors the Mesh `IFetcher` interface shape for Cardano, adapted to Bitcoin.
|
|
700
|
+
* Only the methods relevant to Bitcoin are included; script variants are optional
|
|
701
|
+
* because P2SH/P2WSH usage is uncommon in most dApp workflows.
|
|
702
|
+
*/
|
|
703
|
+
interface IBitcoinFetcher {
|
|
704
|
+
fetchAddressInfo(address: string): Promise<AddressInfo>;
|
|
705
|
+
fetchAddressUTxOs(address: string): Promise<UTxO[]>;
|
|
706
|
+
fetchUTxO(txid: string, vout?: number): Promise<UTxO[]>;
|
|
707
|
+
fetchAddressTxs(address: string, lastSeenTxid?: string): Promise<TransactionsInfo[]>;
|
|
708
|
+
fetchTxInfo(txid: string): Promise<TransactionsStatus>;
|
|
709
|
+
fetchFeeEstimates(blocks: number): Promise<number>;
|
|
710
|
+
fetchScriptInfo?(hash: string): Promise<ScriptInfo>;
|
|
711
|
+
fetchScriptUTxOs?(hash: string): Promise<UTxO[]>;
|
|
712
|
+
fetchScriptTxs?(hash: string, lastSeenTxid?: string): Promise<TransactionsInfo[]>;
|
|
713
|
+
}
|
|
714
|
+
interface IBitcoinSubmitter {
|
|
715
|
+
submitTx(tx: string): Promise<string>;
|
|
716
|
+
}
|
|
717
|
+
interface IBitcoinProvider extends IBitcoinFetcher, IBitcoinSubmitter {
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
type RecoveryId = 0 | 1 | 2 | 3;
|
|
721
|
+
|
|
722
|
+
type BitcoinNetworkName = "Mainnet" | "Testnet4";
|
|
723
|
+
/**
|
|
724
|
+
* Map a friendly network name to a bitcoinjs `Network` object.
|
|
725
|
+
*
|
|
726
|
+
* NOTE: bitcoinjs-lib does not currently ship a dedicated Testnet4 network object.
|
|
727
|
+
* Testnet4 and Testnet3 use identical address encoding (`tb` bech32/bech32m, same
|
|
728
|
+
* version/HRP/script-hash formats), so reusing `bitcoin.networks.testnet` is safe
|
|
729
|
+
* for address derivation and PSBT construction. Chain state differs, but that is
|
|
730
|
+
* the provider's responsibility, not the encoder's.
|
|
731
|
+
*/
|
|
732
|
+
declare function networkFromName(name: BitcoinNetworkName): Network;
|
|
733
|
+
/**
|
|
734
|
+
* Drop the parity prefix byte of a compressed secp256k1 pubkey (33 bytes -> 32 bytes).
|
|
735
|
+
* Required for Taproot (BIP-340) which uses x-only public keys. Returns a copy so
|
|
736
|
+
* callers cannot accidentally mutate the source buffer.
|
|
737
|
+
*/
|
|
738
|
+
declare function toXOnly(pubkey: Buffer): Buffer;
|
|
739
|
+
/**
|
|
740
|
+
* Derive the P2WPKH (native SegWit) payment address from a compressed public key.
|
|
741
|
+
*/
|
|
742
|
+
declare function deriveP2wpkhAddress(publicKey: Buffer | Uint8Array, network: Network): {
|
|
743
|
+
address: string;
|
|
744
|
+
publicKey: string;
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* Derive the P2TR (Taproot, ordinals) address from a compressed public key.
|
|
748
|
+
* Uses the BIP-86 single-key spend path (no script tree).
|
|
749
|
+
*/
|
|
750
|
+
declare function deriveP2trAddress(publicKey: Buffer | Uint8Array, network: Network): {
|
|
751
|
+
address: string;
|
|
752
|
+
publicKey: string;
|
|
753
|
+
};
|
|
754
|
+
/**
|
|
755
|
+
* Internal derived-address record. Holds the public-facing fields plus the
|
|
756
|
+
* derivation path so the manager can request signing from the right child node.
|
|
757
|
+
* Public wallet methods convert this to plain `BitcoinAddress` / `BitcoinAccount`
|
|
758
|
+
* shapes defined on `IBitcoinWallet`.
|
|
759
|
+
*/
|
|
760
|
+
declare class DerivedBitcoinAddress {
|
|
761
|
+
readonly address: string;
|
|
762
|
+
readonly publicKey: string;
|
|
763
|
+
readonly purpose: AddressPurpose;
|
|
764
|
+
readonly addressType: AddressType;
|
|
765
|
+
readonly walletType: "software" | "ledger" | "keystone";
|
|
766
|
+
readonly derivationPath: string;
|
|
767
|
+
readonly change: number;
|
|
768
|
+
readonly index: number;
|
|
769
|
+
constructor(args: {
|
|
770
|
+
address: string;
|
|
771
|
+
publicKey: string;
|
|
772
|
+
purpose: AddressPurpose;
|
|
773
|
+
addressType: AddressType;
|
|
774
|
+
walletType?: "software" | "ledger" | "keystone";
|
|
775
|
+
derivationPath: string;
|
|
776
|
+
change: number;
|
|
777
|
+
index: number;
|
|
778
|
+
});
|
|
779
|
+
toBitcoinAddress(): BitcoinAddress;
|
|
780
|
+
toBitcoinAccount(): BitcoinAccount;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Standard BIP derivation paths used by the Mesh Bitcoin wallet:
|
|
785
|
+
* - BIP-84 native SegWit (P2WPKH) for the `payment` purpose
|
|
786
|
+
* - BIP-86 single-key Taproot (P2TR) for the `ordinals` purpose
|
|
787
|
+
*
|
|
788
|
+
* `coinType` is 0 for mainnet, 1 for any testnet (including Testnet4).
|
|
789
|
+
*/
|
|
790
|
+
declare function getCoinType(network: Network): 0 | 1;
|
|
791
|
+
declare function paymentPath(network: Network, account?: number, change?: number, index?: number): string;
|
|
792
|
+
declare function ordinalsPath(network: Network, account?: number, change?: number, index?: number): string;
|
|
793
|
+
interface BitcoinAddressManagerConfig {
|
|
794
|
+
network: Network;
|
|
795
|
+
/**
|
|
796
|
+
* BIP-32 root node (seed-derived). The manager owns derivation from this root.
|
|
797
|
+
* Optional when the manager is used in read-only mode (no key material available).
|
|
798
|
+
*/
|
|
799
|
+
root?: BIP32Interface;
|
|
800
|
+
/**
|
|
801
|
+
* Account index for hardened account derivation (defaults to 0).
|
|
802
|
+
*/
|
|
803
|
+
account?: number;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Centralises address derivation for the Bitcoin wallet across purposes.
|
|
807
|
+
* Mirrors the role of Cardano's `AddressManager` — single source of truth for
|
|
808
|
+
* which addresses correspond to which purposes.
|
|
809
|
+
*/
|
|
810
|
+
declare class BitcoinAddressManager {
|
|
811
|
+
private readonly network;
|
|
812
|
+
private readonly root?;
|
|
813
|
+
private readonly account;
|
|
814
|
+
constructor(config: BitcoinAddressManagerConfig);
|
|
815
|
+
static fromSeed(seed: Buffer, network: Network, account?: number): BitcoinAddressManager;
|
|
816
|
+
getNetwork(): Network;
|
|
817
|
+
private requireRoot;
|
|
818
|
+
/**
|
|
819
|
+
* Get the address for a single purpose, deriving fresh from the root.
|
|
820
|
+
*/
|
|
821
|
+
getAddress(purpose: AddressPurpose, change?: number, index?: number): DerivedBitcoinAddress;
|
|
822
|
+
/**
|
|
823
|
+
* Get addresses for an array of purposes (default: payment + ordinals).
|
|
824
|
+
* Skips unsupported purposes silently to remain forward-compatible with
|
|
825
|
+
* non-Bitcoin Sats Connect purposes (`stacks`, `starknet`, `spark`).
|
|
826
|
+
*/
|
|
827
|
+
getAddresses(purposes?: AddressPurpose[]): DerivedBitcoinAddress[];
|
|
828
|
+
/**
|
|
829
|
+
* Get the BIP-32 child node for a purpose — needed for signing.
|
|
830
|
+
*/
|
|
831
|
+
getChild(purpose: AddressPurpose, change?: number, index?: number): BIP32Interface;
|
|
832
|
+
/**
|
|
833
|
+
* Derive a contiguous range of addresses for a single purpose/change level.
|
|
834
|
+
* Useful for gap-limit scanning: call with `start=0, count=20` to get the
|
|
835
|
+
* first gap-limit window (BIP-84 / BIP-86), then advance `start` if any are used.
|
|
836
|
+
*
|
|
837
|
+
* @param purpose Payment (BIP-84 P2WPKH) or Ordinals (BIP-86 P2TR).
|
|
838
|
+
* @param start First index in the range (default 0).
|
|
839
|
+
* @param count How many addresses to derive (default 20).
|
|
840
|
+
* @param change Change chain: 0 = external/receive, 1 = internal/change.
|
|
841
|
+
*/
|
|
842
|
+
getAddressesByPurpose(purpose: AddressPurpose, start?: number, count?: number, change?: number): DerivedBitcoinAddress[];
|
|
843
|
+
/**
|
|
844
|
+
* Scan the derivation path for `address` up to `maxGap` indices, returning
|
|
845
|
+
* the matching `DerivedBitcoinAddress` (with correct `change` and `index`)
|
|
846
|
+
* or `undefined` if not found. Checks both the external (0) and internal (1)
|
|
847
|
+
* change chains.
|
|
848
|
+
*
|
|
849
|
+
* BIP-32 recommends a gap limit of 20; use a higher value if you know the
|
|
850
|
+
* wallet has been used extensively.
|
|
851
|
+
*/
|
|
852
|
+
findAddress(address: string, purpose: AddressPurpose, maxGap?: number): DerivedBitcoinAddress | undefined;
|
|
853
|
+
/**
|
|
854
|
+
* Return the BIP-32 account node (hardened, public-key-only) for the given
|
|
855
|
+
* purpose. This is the xpub you would share with a watch-only wallet.
|
|
856
|
+
*
|
|
857
|
+
* BIP-84: m/84'/coin_type'/account'
|
|
858
|
+
* BIP-86: m/86'/coin_type'/account'
|
|
859
|
+
*/
|
|
860
|
+
private getAccountNode;
|
|
861
|
+
/**
|
|
862
|
+
* Export the BIP-84 (P2WPKH) account public key as a standard base58 xpub
|
|
863
|
+
* (mainnet) or tpub (testnet).
|
|
864
|
+
*
|
|
865
|
+
* Example: `xpub6CQdKacu...`
|
|
866
|
+
*/
|
|
867
|
+
getAccountXpub(): string;
|
|
868
|
+
/**
|
|
869
|
+
* Export the BIP-86 (P2TR / Taproot) account public key as a standard
|
|
870
|
+
* base58 xpub (mainnet) or tpub (testnet).
|
|
871
|
+
*
|
|
872
|
+
* Example: `xpub6D5r3aJk...`
|
|
873
|
+
*/
|
|
874
|
+
getTaprootXpub(): string;
|
|
875
|
+
/**
|
|
876
|
+
* Export the BIP-84 account public key with the **zpub** (mainnet) or
|
|
877
|
+
* **vpub** (testnet) version prefix, as expected by wallet software that
|
|
878
|
+
* distinguishes BIP-84 SegWit accounts from BIP-44/49 accounts by the
|
|
879
|
+
* key prefix rather than the derivation path.
|
|
880
|
+
*
|
|
881
|
+
* Conversion: decode the xpub/tpub base58check bytes, replace the first
|
|
882
|
+
* 4 version bytes, and re-encode. The 74 payload bytes are unchanged.
|
|
883
|
+
*/
|
|
884
|
+
getAccountZpub(): string;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
interface BitcoinHeadlessWalletConfig {
|
|
888
|
+
network: BitcoinNetworkName;
|
|
889
|
+
provider?: IBitcoinProvider;
|
|
890
|
+
password?: string;
|
|
891
|
+
account?: number;
|
|
892
|
+
}
|
|
893
|
+
interface InternalConfig {
|
|
894
|
+
network: BitcoinNetworkName;
|
|
895
|
+
bitcoinNetwork: Network;
|
|
896
|
+
root: BIP32Interface;
|
|
897
|
+
manager: BitcoinAddressManager;
|
|
898
|
+
provider?: IBitcoinProvider;
|
|
899
|
+
account: number;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Internal signer extension. Carries the optional BIP-341 internal x-only
|
|
903
|
+
* pubkey alongside the standard `Signer` surface so `signSingleInput` can
|
|
904
|
+
* populate `input.tapInternalKey` when signing Taproot inputs. ECDSA signers
|
|
905
|
+
* (P2WPKH) simply omit `internalPubkey`.
|
|
906
|
+
*/
|
|
907
|
+
type TaprootCapableSigner = Signer & {
|
|
908
|
+
internalPubkey?: Buffer;
|
|
909
|
+
};
|
|
910
|
+
declare class BitcoinHeadlessWallet implements IBitcoinWallet {
|
|
911
|
+
protected readonly networkName: BitcoinNetworkName;
|
|
912
|
+
protected readonly bitcoinNetwork: Network;
|
|
913
|
+
protected readonly root: BIP32Interface;
|
|
914
|
+
protected readonly manager: BitcoinAddressManager;
|
|
915
|
+
protected readonly provider?: IBitcoinProvider;
|
|
916
|
+
protected readonly account: number;
|
|
917
|
+
protected constructor(cfg: InternalConfig);
|
|
918
|
+
/**
|
|
919
|
+
* Create a headless wallet from an existing BIP-32 root and configuration.
|
|
920
|
+
*/
|
|
921
|
+
static create(config: BitcoinHeadlessWalletConfig & {
|
|
922
|
+
root: BIP32Interface;
|
|
923
|
+
}): Promise<BitcoinHeadlessWallet>;
|
|
924
|
+
/**
|
|
925
|
+
* Create a headless wallet from a BIP-39 mnemonic phrase.
|
|
926
|
+
*/
|
|
927
|
+
static fromMnemonic(config: BitcoinHeadlessWalletConfig & {
|
|
928
|
+
mnemonic: string[];
|
|
929
|
+
}): Promise<BitcoinHeadlessWallet>;
|
|
930
|
+
/**
|
|
931
|
+
* Create a headless wallet from BIP-39 entropy (hex string).
|
|
932
|
+
*/
|
|
933
|
+
static fromEntropy(config: BitcoinHeadlessWalletConfig & {
|
|
934
|
+
entropy: string;
|
|
935
|
+
}): Promise<BitcoinHeadlessWallet>;
|
|
936
|
+
static fromPrivateKey(config: BitcoinHeadlessWalletConfig & {
|
|
937
|
+
privateKey: string;
|
|
938
|
+
}): Promise<BitcoinHeadlessWallet>;
|
|
939
|
+
getNetwork(): Promise<BitcoinNetworkName>;
|
|
940
|
+
getAddresses(addressPurposes: AddressPurpose[]): Promise<BitcoinAddress[]>;
|
|
941
|
+
getAccounts(addressPurposes: AddressPurpose[]): Promise<BitcoinAccount[]>;
|
|
942
|
+
getBalance(): Promise<BitcoinBalance>;
|
|
943
|
+
/**
|
|
944
|
+
* Derive a contiguous range of addresses for a single purpose / change level.
|
|
945
|
+
* Delegates to `BitcoinAddressManager.getAddressesByPurpose`.
|
|
946
|
+
*/
|
|
947
|
+
getAddressesByPurpose(purpose: AddressPurpose, start?: number, count?: number, change?: number): DerivedBitcoinAddress[];
|
|
948
|
+
/**
|
|
949
|
+
* Scan the derivation path for `address` up to `maxGap` indices across both
|
|
950
|
+
* external and internal (change) chains. Returns the matching
|
|
951
|
+
* `DerivedBitcoinAddress` (with correct `change` and `index`) or `undefined`.
|
|
952
|
+
* Delegates to `BitcoinAddressManager.findAddress`.
|
|
953
|
+
*/
|
|
954
|
+
findManagedAddress(address: string, purpose: AddressPurpose, maxGap?: number): DerivedBitcoinAddress | undefined;
|
|
955
|
+
/**
|
|
956
|
+
* Export the BIP-84 (P2WPKH) account public key as xpub (mainnet) / tpub (testnet).
|
|
957
|
+
* Delegates to `BitcoinAddressManager.getAccountXpub`.
|
|
958
|
+
*/
|
|
959
|
+
getAccountXpub(): string;
|
|
960
|
+
/**
|
|
961
|
+
* Export the BIP-86 (P2TR / Taproot) account public key as xpub (mainnet) / tpub (testnet).
|
|
962
|
+
* Delegates to `BitcoinAddressManager.getTaprootXpub`.
|
|
963
|
+
*/
|
|
964
|
+
getTaprootXpub(): string;
|
|
965
|
+
/**
|
|
966
|
+
* Export the BIP-84 account public key with the zpub (mainnet) / vpub (testnet)
|
|
967
|
+
* version prefix. Delegates to `BitcoinAddressManager.getAccountZpub`.
|
|
968
|
+
*/
|
|
969
|
+
getAccountZpub(): string;
|
|
970
|
+
/**
|
|
971
|
+
* Fetch unspent transaction outputs (UTXOs) for one or both managed addresses.
|
|
972
|
+
*
|
|
973
|
+
* @param purposes - Which address(es) to query. Defaults to both Payment and
|
|
974
|
+
* Ordinals so callers get a unified view. Pass `[AddressPurpose.Payment]`
|
|
975
|
+
* to restrict to the P2WPKH address only (e.g. when building a send tx).
|
|
976
|
+
* @returns Flat array of UTXOs across all requested addresses, each annotated
|
|
977
|
+
* with the `address` and `purpose` it belongs to so callers can route
|
|
978
|
+
* inputs correctly (P2WPKH vs P2TR signing).
|
|
979
|
+
*/
|
|
980
|
+
fetchUTXOs(purposes?: AddressPurpose[]): Promise<(UTxO & {
|
|
981
|
+
address: string;
|
|
982
|
+
purpose: AddressPurpose;
|
|
983
|
+
})[]>;
|
|
984
|
+
/**
|
|
985
|
+
* Fetch confirmed and mempool transaction history for one or both managed
|
|
986
|
+
* addresses, with optional pagination via `lastSeenTxid`.
|
|
987
|
+
*
|
|
988
|
+
* @param options.purposes - Which address(es) to query (default: both).
|
|
989
|
+
* @param options.lastSeenTxid - Cursor for page-based pagination: pass the
|
|
990
|
+
* last `txid` from a previous page to fetch the next batch (Esplora API
|
|
991
|
+
* returns at most 25 txs per page).
|
|
992
|
+
* @returns Transactions in reverse-chronological order (newest first),
|
|
993
|
+
* each annotated with `address` and `purpose` for easy filtering.
|
|
994
|
+
* If both addresses are queried the two lists are merged and re-sorted by
|
|
995
|
+
* block height descending (unconfirmed txs sort to the top).
|
|
996
|
+
*/
|
|
997
|
+
getTransactionHistory(options?: {
|
|
998
|
+
purposes?: AddressPurpose[];
|
|
999
|
+
lastSeenTxid?: string;
|
|
1000
|
+
}): Promise<(TransactionsInfo & {
|
|
1001
|
+
address: string;
|
|
1002
|
+
purpose: AddressPurpose;
|
|
1003
|
+
})[]>;
|
|
1004
|
+
signMessage(address: string, message: string, protocol?: MessageSigningProtocols): Promise<BitcoinSignature>;
|
|
1005
|
+
verifyMessage(address: string, message: string, signature: string): Promise<VerifyMessageResult>;
|
|
1006
|
+
signTransfer(recipients: {
|
|
1007
|
+
address: string;
|
|
1008
|
+
amount: number;
|
|
1009
|
+
}[]): Promise<string>;
|
|
1010
|
+
signPsbt(signConfig: {
|
|
1011
|
+
psbt: string;
|
|
1012
|
+
signInputs?: {
|
|
1013
|
+
[x: string]: number[];
|
|
1014
|
+
} | undefined;
|
|
1015
|
+
broadcast?: boolean | undefined;
|
|
1016
|
+
}): Promise<string>;
|
|
1017
|
+
protected findDerivedByAddress(address: string): DerivedBitcoinAddress;
|
|
1018
|
+
protected signerForPurpose(purpose: AddressPurpose, change?: number, index?: number): TaprootCapableSigner;
|
|
1019
|
+
protected signSingleInput(psbt: Psbt, index: number, entry: {
|
|
1020
|
+
signer: TaprootCapableSigner;
|
|
1021
|
+
purpose: AddressPurpose;
|
|
1022
|
+
}): void;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Verify a Bitcoin signed-message (BIP-137 style, 65-byte compact recoverable ECDSA, base64).
|
|
1026
|
+
*
|
|
1027
|
+
* Cross-type acceptance: recovers the pubkey from the signature and matches against
|
|
1028
|
+
* P2PKH / P2SH-P2WPKH / P2WPKH / P2TR (BIP-86) addresses derived from that pubkey.
|
|
1029
|
+
* The header byte selects compression + recoveryId per BIP-137 but does not constrain
|
|
1030
|
+
* which address type the caller may verify against — matches how Sparrow/Leather behave.
|
|
1031
|
+
*/
|
|
1032
|
+
declare function verifyBitcoinMessage(address: string, message: string, signature: string, network: Network): VerifyMessageResult;
|
|
1033
|
+
|
|
1034
|
+
type InstalledBitcoinWallet = {
|
|
1035
|
+
id: string;
|
|
1036
|
+
name: string;
|
|
1037
|
+
icon?: string;
|
|
1038
|
+
};
|
|
1039
|
+
/**
|
|
1040
|
+
* BitcoinBrowserWallet wraps an `IBitcoinWallet`-compatible browser provider
|
|
1041
|
+
* (e.g., Xverse). Mirrors `CardanoBrowserWallet` for the Bitcoin chain.
|
|
1042
|
+
*
|
|
1043
|
+
* Typical usage:
|
|
1044
|
+
* const wallets = BitcoinBrowserWallet.getInstalledWallets();
|
|
1045
|
+
* const wallet = await BitcoinBrowserWallet.enable("xverse", { persist: true });
|
|
1046
|
+
* const balance = await wallet.getBalance();
|
|
1047
|
+
*
|
|
1048
|
+
* To reconnect after a page reload without prompting the user again:
|
|
1049
|
+
* const wallet = await BitcoinBrowserWallet.restore();
|
|
1050
|
+
*/
|
|
1051
|
+
declare class BitcoinBrowserWallet implements IBitcoinWallet {
|
|
1052
|
+
walletInstance: IBitcoinWallet;
|
|
1053
|
+
/** Lowercase registry key of the connected wallet (e.g. `"xverse"`). */
|
|
1054
|
+
readonly walletName: string;
|
|
1055
|
+
constructor(walletInstance: IBitcoinWallet, walletName?: string);
|
|
1056
|
+
getNetwork(): Promise<"Mainnet" | "Testnet4">;
|
|
1057
|
+
getAddresses(addressPurposes: AddressPurpose[]): Promise<BitcoinAddress[]>;
|
|
1058
|
+
getAccounts(addressPurposes: AddressPurpose[]): Promise<BitcoinAccount[]>;
|
|
1059
|
+
getBalance(): Promise<BitcoinBalance>;
|
|
1060
|
+
signMessage(address: string, message: string, protocol?: MessageSigningProtocols): Promise<BitcoinSignature>;
|
|
1061
|
+
verifyMessage(address: string, message: string, signature: string): Promise<VerifyMessageResult>;
|
|
1062
|
+
signTransfer(recipients: {
|
|
1063
|
+
address: string;
|
|
1064
|
+
amount: number;
|
|
1065
|
+
}[]): Promise<string>;
|
|
1066
|
+
signPsbt(signConfig: {
|
|
1067
|
+
psbt: string;
|
|
1068
|
+
signInputs?: {
|
|
1069
|
+
[x: string]: number[];
|
|
1070
|
+
} | undefined;
|
|
1071
|
+
broadcast?: boolean | undefined;
|
|
1072
|
+
}): Promise<string>;
|
|
1073
|
+
fetchUTXOs(purposes?: AddressPurpose[]): Promise<(UTxO & {
|
|
1074
|
+
address: string;
|
|
1075
|
+
purpose: AddressPurpose;
|
|
1076
|
+
})[]>;
|
|
1077
|
+
getTransactionHistory(options?: {
|
|
1078
|
+
purposes?: AddressPurpose[];
|
|
1079
|
+
lastSeenTxid?: string;
|
|
1080
|
+
}): Promise<(TransactionsInfo & {
|
|
1081
|
+
address: string;
|
|
1082
|
+
purpose: AddressPurpose;
|
|
1083
|
+
})[]>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Removes the persisted wallet selection so `restore()` returns `null` on
|
|
1086
|
+
* the next page load. Call this on an explicit user-initiated disconnect.
|
|
1087
|
+
*/
|
|
1088
|
+
disconnect(): void;
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns a list of Bitcoin wallets the user has installed in the browser.
|
|
1091
|
+
* Throws when called outside a browser (SSR).
|
|
1092
|
+
*/
|
|
1093
|
+
static getInstalledWallets(): InstalledBitcoinWallet[];
|
|
1094
|
+
/**
|
|
1095
|
+
* Returns `true` when a wallet session has been persisted and `restore()`
|
|
1096
|
+
* (or `enable()` with `persist: true`) can reconnect it silently.
|
|
1097
|
+
*/
|
|
1098
|
+
static hasPersistedSession(): boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* Connect to a wallet, returning a wrapped `BitcoinBrowserWallet`.
|
|
1101
|
+
*
|
|
1102
|
+
* When `options.persist` is `true` the behaviour differs depending on
|
|
1103
|
+
* whether a prior session exists:
|
|
1104
|
+
*
|
|
1105
|
+
* • **No existing session** — runs the normal connect flow (may show the
|
|
1106
|
+
* wallet's approval popup)
|
|
1107
|
+
* • **Existing session for the same wallet** — silently reconnects without showing any popup.
|
|
1108
|
+
*
|
|
1109
|
+
* @param walletName Registry key of the wallet (e.g. `"xverse"`).
|
|
1110
|
+
* @param options.persist Opt-in to silent restore on subsequent page loads.
|
|
1111
|
+
*/
|
|
1112
|
+
static enable(walletName: string, options?: {
|
|
1113
|
+
persist?: boolean;
|
|
1114
|
+
}): Promise<BitcoinBrowserWallet>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Silently reconnects using the wallet name saved by a previous
|
|
1117
|
+
* `enable({ persist: true })` call.
|
|
1118
|
+
*
|
|
1119
|
+
* Returns `null` if nothing was persisted or the saved wallet is no longer
|
|
1120
|
+
* available (extension uninstalled / access revoked). The stale entry is
|
|
1121
|
+
* cleared automatically in the latter case.
|
|
1122
|
+
*/
|
|
1123
|
+
static restore(): Promise<BitcoinBrowserWallet | null>;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Shape of the Xverse `BitcoinProvider` reachable via `window.XverseProviders.BitcoinProvider`.
|
|
1128
|
+
* We only depend on the `request(method, params)` JSON-RPC-style surface, which is the public
|
|
1129
|
+
* Sats Connect protocol — no SDK dependency required.
|
|
1130
|
+
*
|
|
1131
|
+
* See: https://docs.xverse.app/sats-connect (`getAddresses`, `getAccounts`, `getBalance`,
|
|
1132
|
+
* `signMessage`, `sendTransfer`, `signPsbt`, `getNetwork`).
|
|
1133
|
+
*/
|
|
1134
|
+
interface XverseBitcoinProvider {
|
|
1135
|
+
request<T = unknown>(method: string, params?: Record<string, unknown> | null): Promise<XverseResponse<T>>;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* The Xverse provider's `request()` returns one of two envelopes, depending on
|
|
1139
|
+
* whether the dApp went through the sats-connect-core library (which normalises
|
|
1140
|
+
* the wire format) or hit `window.XverseProviders.BitcoinProvider` directly
|
|
1141
|
+
* (raw JSON-RPC 2.0). We accept both so the adapter works either way.
|
|
1142
|
+
*/
|
|
1143
|
+
type XverseResponse<T> = {
|
|
1144
|
+
status: "success";
|
|
1145
|
+
result: T;
|
|
1146
|
+
} | {
|
|
1147
|
+
status: "error";
|
|
1148
|
+
error: {
|
|
1149
|
+
code: number;
|
|
1150
|
+
message: string;
|
|
1151
|
+
};
|
|
1152
|
+
} | {
|
|
1153
|
+
jsonrpc: "2.0";
|
|
1154
|
+
result: T;
|
|
1155
|
+
id?: string | number | null;
|
|
1156
|
+
} | {
|
|
1157
|
+
jsonrpc: "2.0";
|
|
1158
|
+
error: {
|
|
1159
|
+
code: number;
|
|
1160
|
+
message: string;
|
|
1161
|
+
};
|
|
1162
|
+
id?: string | number | null;
|
|
1163
|
+
};
|
|
1164
|
+
/**
|
|
1165
|
+
* Typed error preserving the RPC error code so callers can distinguish
|
|
1166
|
+
* `USER_REJECTION` (-32000) from `ACCESS_DENIED` (-32002), etc.
|
|
1167
|
+
*/
|
|
1168
|
+
/** Sats Connect `RpcErrorCode.ACCESS_DENIED` — app has not connected yet. */
|
|
1169
|
+
declare const XVERSE_ACCESS_DENIED = -32002;
|
|
1170
|
+
declare class XverseRpcError extends Error {
|
|
1171
|
+
readonly code: number;
|
|
1172
|
+
readonly method: string;
|
|
1173
|
+
constructor(method: string, code: number, message: string);
|
|
1174
|
+
}
|
|
1175
|
+
declare global {
|
|
1176
|
+
interface Window {
|
|
1177
|
+
XverseProviders?: {
|
|
1178
|
+
BitcoinProvider?: XverseBitcoinProvider;
|
|
1179
|
+
};
|
|
1180
|
+
BitcoinProvider?: XverseBitcoinProvider;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
declare function isXverseInstalled(): boolean;
|
|
1184
|
+
/**
|
|
1185
|
+
* Adapter that implements `IBitcoinWallet` against the Xverse / Sats Connect surface.
|
|
1186
|
+
* Created on `enable()` after the user authorizes the dApp.
|
|
1187
|
+
*/
|
|
1188
|
+
declare class XverseAdapter implements IBitcoinWallet {
|
|
1189
|
+
private connected;
|
|
1190
|
+
private cachedAddresses;
|
|
1191
|
+
private constructor();
|
|
1192
|
+
static enable(): Promise<XverseAdapter>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Establish a dApp connection per Sats Connect: `wallet_connect` grants read
|
|
1195
|
+
* permission and returns addresses. Older Xverse builds fall back to
|
|
1196
|
+
* `wallet_requestPermissions` + `getAddresses`.
|
|
1197
|
+
*/
|
|
1198
|
+
private connect;
|
|
1199
|
+
private connectViaWalletConnect;
|
|
1200
|
+
private connectViaPermissions;
|
|
1201
|
+
private requestPermissions;
|
|
1202
|
+
private requestAddresses;
|
|
1203
|
+
private fetchAddresses;
|
|
1204
|
+
getNetwork(): Promise<"Mainnet" | "Testnet4">;
|
|
1205
|
+
getAddresses(addressPurposes: AddressPurpose[]): Promise<BitcoinAddress[]>;
|
|
1206
|
+
getAccounts(addressPurposes: AddressPurpose[]): Promise<BitcoinAccount[]>;
|
|
1207
|
+
getBalance(): Promise<BitcoinBalance>;
|
|
1208
|
+
signMessage(address: string, message: string, protocol?: MessageSigningProtocols): Promise<BitcoinSignature>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Verify a Bitcoin signed-message locally. Trustless — does not call the extension.
|
|
1211
|
+
* Supports the ECDSA 65-byte BIP-137 compact format. Non-ECDSA signatures (e.g. the
|
|
1212
|
+
* BIP-322 format Xverse produces for Taproot addresses) return `{ valid: false }` rather
|
|
1213
|
+
* than throwing, so callers can safely check `result.valid`.
|
|
1214
|
+
*/
|
|
1215
|
+
verifyMessage(address: string, message: string, signature: string): Promise<VerifyMessageResult>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Xverse's Sats Connect exposes `sendTransfer` which prompts the user to sign
|
|
1218
|
+
* AND broadcast in one step — there is no "sign-only" variant.
|
|
1219
|
+
* Returns the broadcast txid, satisfying the `IBitcoinWallet.signTransfer` contract.
|
|
1220
|
+
*/
|
|
1221
|
+
signTransfer(recipients: {
|
|
1222
|
+
address: string;
|
|
1223
|
+
amount: number;
|
|
1224
|
+
}[]): Promise<string>;
|
|
1225
|
+
signPsbt(signConfig: {
|
|
1226
|
+
psbt: string;
|
|
1227
|
+
signInputs?: {
|
|
1228
|
+
[x: string]: number[];
|
|
1229
|
+
} | undefined;
|
|
1230
|
+
broadcast?: boolean | undefined;
|
|
1231
|
+
}): Promise<string>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Fetch UTXOs for the connected wallet via Sats Connect.
|
|
1234
|
+
* Xverse exposes `wallet_getUtxos` on newer builds; for older builds that
|
|
1235
|
+
* don't support it this will throw a clear METHOD_NOT_FOUND error.
|
|
1236
|
+
*/
|
|
1237
|
+
fetchUTXOs(purposes?: AddressPurpose[]): Promise<(UTxO & {
|
|
1238
|
+
address: string;
|
|
1239
|
+
purpose: AddressPurpose;
|
|
1240
|
+
})[]>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Fetch transaction history for the connected wallet via Sats Connect.
|
|
1243
|
+
* Xverse exposes `wallet_getTransactions` on newer builds.
|
|
1244
|
+
*/
|
|
1245
|
+
getTransactionHistory(options?: {
|
|
1246
|
+
purposes?: AddressPurpose[];
|
|
1247
|
+
lastSeenTxid?: string;
|
|
1248
|
+
}): Promise<(TransactionsInfo & {
|
|
1249
|
+
address: string;
|
|
1250
|
+
purpose: AddressPurpose;
|
|
1251
|
+
})[]>;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
interface IMultiChainWallet {
|
|
1255
|
+
cardanoWallet: ICardanoWallet;
|
|
1256
|
+
bitcoinWallet: IBitcoinWallet;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
export { type AddressInfo, AddressPurpose, AddressType$1 as AddressType, BaseSigner, type BitcoinAccount, type BitcoinAddress, BitcoinAddressManager, type BitcoinAddressManagerConfig, AddressType as BitcoinAddressType, type BitcoinBalance, BitcoinBrowserWallet, BitcoinHeadlessWallet, type BitcoinHeadlessWalletConfig, BitcoinInMemoryBip32, type BitcoinNetworkName, type BitcoinSignature, type Cardano, CardanoAddress, CardanoBrowserWallet, CardanoHeadlessWallet, type CardanoHeadlessWalletConfig, CardanoInMemoryBip32, type ChainStats, type Credential, type CredentialSource, CredentialType, DerivedBitcoinAddress, type IBitcoinFetcher, type IBitcoinProvider, type IBitcoinSubmitter, type IBitcoinWallet, type ICardanoWallet, type IMultiChainWallet, type InstalledBitcoinWallet, type MempoolStats, MeshCardanoBrowserWallet, MeshCardanoHeadlessWallet, MessageSigningProtocols, type RecoveryId, type ScriptInfo, type TransactionsInfo, type TransactionsStatus, type UTxO, type VerifyMessageResult, type WalletAddressType, XVERSE_ACCESS_DENIED, XverseAdapter, type XverseBitcoinProvider, type XverseResponse, XverseRpcError, deriveP2trAddress, deriveP2wpkhAddress, getCoinType, isXverseInstalled, networkFromName, ordinalsPath, paymentPath, toXOnly, verifyBitcoinMessage };
|