@meshsdk/wallet 1.9.0 → 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/dist/index.d.cts DELETED
@@ -1,802 +0,0 @@
1
- import { DataSignature, ISigner, ISubmitter, IFetcher, IWallet, Wallet, Extension, Asset, UTxO, AssetExtended } from '@meshsdk/common';
2
- import { Ed25519PublicKeyHex, TransactionUnspentOutput, Address, Ed25519PrivateKey, DRepID, Ed25519KeyHashHex, VkeyWitness } from '@meshsdk/core-cst';
3
- import * as _simplewebauthn_browser from '@simplewebauthn/browser';
4
-
5
- type Cardano = {
6
- [key: string]: {
7
- name: string;
8
- icon: string;
9
- apiVersion: string;
10
- enable: (extensions?: {
11
- extensions: {
12
- cip: number;
13
- }[];
14
- }) => Promise<WalletInstance>;
15
- supportedExtensions?: {
16
- cip: number;
17
- }[];
18
- };
19
- };
20
- type TransactionSignatureRequest = {
21
- cbor: string;
22
- partialSign: boolean;
23
- };
24
- interface Cip30WalletApi {
25
- experimental: ExperimentalFeatures;
26
- getBalance(): Promise<string>;
27
- getChangeAddress(): Promise<string>;
28
- getExtensions(): Promise<{
29
- cip: number;
30
- }[]>;
31
- getCollateral(): Promise<string[] | undefined>;
32
- getNetworkId(): Promise<number>;
33
- getRewardAddresses(): Promise<string[]>;
34
- getUnusedAddresses(): Promise<string[]>;
35
- getUsedAddresses(): Promise<string[]>;
36
- getUtxos(): Promise<string[] | undefined>;
37
- signData(address: string, payload: string): Promise<DataSignature>;
38
- signTx(tx: string, partialSign: boolean): Promise<string>;
39
- signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
40
- signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
41
- submitTx(tx: string): Promise<string>;
42
- cip95?: Cip95WalletApi;
43
- }
44
- interface Cip95WalletApi {
45
- getRegisteredPubStakeKeys: () => Promise<Ed25519PublicKeyHex[]>;
46
- getUnregisteredPubStakeKeys: () => Promise<Ed25519PublicKeyHex[]>;
47
- getPubDRepKey: () => Promise<Ed25519PublicKeyHex>;
48
- signData(address: string, payload: string): Promise<DataSignature>;
49
- }
50
- type WalletInstance = Cip30WalletApi & Cip95WalletApi;
51
- type ExperimentalFeatures = {
52
- getCollateral(): Promise<string[] | undefined>;
53
- signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
54
- signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
55
- };
56
- type GetAddressType = "enterprise" | "payment";
57
-
58
- type AppWalletKeyType = {
59
- type: "root";
60
- bech32: string;
61
- } | {
62
- type: "cli";
63
- payment: string;
64
- stake?: string;
65
- } | {
66
- type: "mnemonic";
67
- words: string[];
68
- };
69
- type CreateAppWalletOptions = {
70
- networkId: number;
71
- fetcher?: IFetcher;
72
- submitter?: ISubmitter;
73
- key: AppWalletKeyType;
74
- };
75
- declare class AppWallet implements ISigner, ISubmitter {
76
- private readonly _fetcher?;
77
- private readonly _submitter?;
78
- private readonly _wallet;
79
- constructor(options: CreateAppWalletOptions);
80
- /**
81
- * Initializes the wallet. This is a required call as fetching addresses from the wallet is an async operation.
82
- * @returns void
83
- */
84
- init(): Promise<void>;
85
- /**
86
- * Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
87
- *
88
- * This is used in transaction building.
89
- *
90
- * @returns a list of UTXOs
91
- */
92
- getCollateralUnspentOutput(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
93
- getEnterpriseAddress(accountIndex?: number, keyIndex?: number): string;
94
- getPaymentAddress(accountIndex?: number, keyIndex?: number): string;
95
- getRewardAddress(accountIndex?: number, keyIndex?: number): string;
96
- getNetworkId(): number;
97
- getUsedAddress(accountIndex?: number, keyIndex?: number, addressType?: GetAddressType): Address;
98
- getUnspentOutputs(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
99
- signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): Promise<DataSignature>;
100
- signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
101
- signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
102
- signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
103
- submitTx(tx: string): Promise<string>;
104
- static brew(strength?: number): string[];
105
- }
106
-
107
- declare global {
108
- interface Window {
109
- cardano: Cardano;
110
- }
111
- }
112
- /**
113
- * Browser Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
114
- *
115
- * These wallets APIs are in accordance to CIP-30, which defines the API for apps to communicate with the user's wallet. Additional utility functions provided for developers that are useful for building applications.
116
- * ```javascript
117
- * import { BrowserWallet } from '@meshsdk/core';
118
- *
119
- * const wallet = await BrowserWallet.enable('eternl');
120
- * ```
121
- */
122
- declare class BrowserWallet implements IWallet {
123
- readonly _walletInstance: WalletInstance;
124
- readonly _walletName: string;
125
- walletInstance: WalletInstance;
126
- private constructor();
127
- /**
128
- * Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
129
- * - A name is provided to display wallet's name on the user interface.
130
- * - A version is provided to display wallet's version on the user interface.
131
- * - An icon is provided to display wallet's icon on the user interface.
132
- *
133
- * @returns a list of wallet names
134
- */
135
- static getAvailableWallets({ injectFn, }?: {
136
- injectFn?: () => Promise<void>;
137
- }): Promise<Wallet[]>;
138
- /**
139
- * Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
140
- * - A name is provided to display wallet's name on the user interface.
141
- * - A version is provided to display wallet's version on the user interface.
142
- * - An icon is provided to display wallet's icon on the user interface.
143
- *
144
- * @returns a list of wallet names
145
- */
146
- static getInstalledWallets(): Wallet[];
147
- /**
148
- * 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.
149
- *
150
- * 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.
151
- *
152
- * @param walletName - the name of the wallet to enable (e.g. "eternl", "begin")
153
- * @param extensions - optional, a list of CIPs that the wallet should support
154
- * @returns WalletInstance
155
- */
156
- static enable(walletName: string, extensions?: Extension[]): Promise<BrowserWallet>;
157
- /**
158
- * Returns a list of assets in the wallet. This API will return every assets in the wallet. Each asset is an object with the following properties:
159
- * - A unit is provided to display asset's name on the user interface.
160
- * - A quantity is provided to display asset's quantity on the user interface.
161
- *
162
- * @returns a list of assets and their quantities
163
- */
164
- getBalance(): Promise<Asset[]>;
165
- /**
166
- * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet.
167
- *
168
- * @returns an address
169
- */
170
- getChangeAddress(): Promise<string>;
171
- /**
172
- * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
173
- *
174
- * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
175
- *
176
- * @param limit
177
- * @returns a list of UTXOs
178
- */
179
- getCollateral(): Promise<UTxO[]>;
180
- /**
181
- * Return a list of supported CIPs of the wallet.
182
- *
183
- * @returns a list of CIPs
184
- */
185
- getExtensions(): Promise<number[]>;
186
- /**
187
- * Returns the network ID of the currently connected account. 0 is testnet and 1 is mainnet but other networks can possibly be returned by wallets. Those other network ID values are not governed by CIP-30. This result will stay the same unless the connected account has changed.
188
- *
189
- * @returns network ID
190
- */
191
- getNetworkId(): Promise<number>;
192
- /**
193
- * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking, generally starts from `stake` prefix.
194
- *
195
- * @returns a list of reward addresses
196
- */
197
- getRewardAddresses(): Promise<string[]>;
198
- /**
199
- * Returns a list of unused addresses controlled by the wallet.
200
- *
201
- * @returns a list of unused addresses
202
- */
203
- getUnusedAddresses(): Promise<string[]>;
204
- /**
205
- * Returns a list of used addresses controlled by the wallet.
206
- *
207
- * @returns a list of used addresses
208
- */
209
- getUsedAddresses(): Promise<string[]>;
210
- /**
211
- * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
212
- *
213
- * @returns a list of UTXOs
214
- */
215
- getUtxos(): Promise<UTxO[]>;
216
- /**
217
- * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
218
- *
219
- * @param payload - the data to be signed
220
- * @param address - optional, if not provided, the first staking address will be used
221
- * @returns a signature
222
- */
223
- signData(payload: string, address?: string | undefined, convertFromUTF8?: boolean): Promise<DataSignature>;
224
- /**
225
- * Requests user to sign the provided transaction (tx). The wallet should ask the user for permission, and if given, try to sign the supplied body and return a signed transaction. partialSign should be true if the transaction provided requires multiple signatures.
226
- *
227
- * @param unsignedTx - a transaction in CBOR
228
- * @param partialSign - if the transaction is signed partially
229
- * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
230
- * @returns a signed transaction in CBOR
231
- */
232
- signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
233
- /**
234
- * Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
235
- *
236
- * @param unsignedTxs - array of unsigned transactions in CborHex string
237
- * @param partialSign - if the transactions are signed partially
238
- * @returns array of signed transactions CborHex string
239
- */
240
- signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
241
- /**
242
- * Submits the signed transaction to the blockchain network.
243
- *
244
- * As wallets should already have this ability to submit transaction, we allow apps to request that a transaction be sent through it. If the wallet accepts the transaction and tries to send it, it shall return the transaction ID for the app to track. The wallet can return error messages or failure if there was an error in sending it.
245
- *
246
- * @param tx
247
- * @returns a transaction hash
248
- */
249
- submitTx(tx: string): Promise<string>;
250
- /**
251
- * Get a used address of type Address from the wallet.
252
- *
253
- * This is used in transaction building.
254
- *
255
- * @returns an Address object
256
- */
257
- getUsedAddress(): Promise<Address>;
258
- /**
259
- * Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
260
- *
261
- * This is used in transaction building.
262
- *
263
- * @returns a list of UTXOs
264
- */
265
- getCollateralUnspentOutput(limit?: number): Promise<TransactionUnspentOutput[]>;
266
- /**
267
- * Get a list of UTXOs to be used for transaction building.
268
- *
269
- * This is used in transaction building.
270
- *
271
- * @returns a list of UTXOs
272
- */
273
- getUsedUTxOs(): Promise<TransactionUnspentOutput[]>;
274
- /**
275
- * A helper function to get the assets in the wallet.
276
- *
277
- * @returns a list of assets
278
- */
279
- getAssets(): Promise<AssetExtended[]>;
280
- /**
281
- * A helper function to get the lovelace balance in the wallet.
282
- *
283
- * @returns lovelace balance
284
- */
285
- getLovelace(): Promise<string>;
286
- /**
287
- * A helper function to get the assets of a specific policy ID in the wallet.
288
- *
289
- * @param policyId
290
- * @returns a list of assets
291
- */
292
- getPolicyIdAssets(policyId: string): Promise<AssetExtended[]>;
293
- /**
294
- * A helper function to get the policy IDs of all the assets in the wallet.
295
- *
296
- * @returns a list of policy IDs
297
- */
298
- getPolicyIds(): Promise<string[]>;
299
- /**
300
- * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
301
- * These are used by the client to identify the user's on-chain CIP-1694 interactions, i.e. if a user has registered to be a DRep.
302
- *
303
- * @returns DRep object
304
- */
305
- getDRep(): Promise<{
306
- publicKey: string;
307
- publicKeyHash: string;
308
- dRepIDCip105: string;
309
- } | undefined>;
310
- /**
311
- * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
312
- * These are used by the client to identify the user's on-chain CIP-1694 interactions, i.e. if a user has registered to be a DRep.
313
- *
314
- * @returns wallet account's public DRep Key
315
- */
316
- getPubDRepKey(): Promise<string | undefined>;
317
- getRegisteredPubStakeKeys(): Promise<{
318
- pubStakeKeys: string[];
319
- pubStakeKeyHashes: string[];
320
- } | undefined>;
321
- getUnregisteredPubStakeKeys(): Promise<{
322
- pubStakeKeys: string[];
323
- pubStakeKeyHashes: string[];
324
- } | undefined>;
325
- private static dRepKeyToDRepID;
326
- private static resolveInstance;
327
- static addBrowserWitnesses(unsignedTx: string, witnesses: string): any;
328
- static getSupportedExtensions(wallet: string): {
329
- cip: number;
330
- }[];
331
- }
332
-
333
- declare function connect({ username, password, serverUrl, }: {
334
- username: string;
335
- password: string;
336
- serverUrl: string;
337
- }): Promise<{
338
- success: boolean;
339
- wallet: {
340
- bech32PrivateKey: string;
341
- };
342
- error?: undefined;
343
- } | {
344
- success: boolean;
345
- error: any;
346
- wallet?: undefined;
347
- }>;
348
-
349
- declare function login({ serverUrl, username, }: {
350
- serverUrl: string;
351
- username: string;
352
- }): Promise<{
353
- success: boolean;
354
- error: any;
355
- errorCode: any;
356
- authJSON?: undefined;
357
- } | {
358
- success: boolean;
359
- error: any;
360
- errorCode?: undefined;
361
- authJSON?: undefined;
362
- } | {
363
- success: boolean;
364
- authJSON: _simplewebauthn_browser.AuthenticationResponseJSON;
365
- error?: undefined;
366
- errorCode?: undefined;
367
- }>;
368
-
369
- declare function register({ serverUrl, username, }: {
370
- serverUrl: string;
371
- username: string;
372
- }): Promise<{
373
- success: boolean;
374
- error: any;
375
- errorCode: any;
376
- } | {
377
- success: boolean;
378
- error?: undefined;
379
- errorCode?: undefined;
380
- }>;
381
-
382
- type AccountType = "payment" | "stake" | "drep";
383
- type Account = {
384
- baseAddress: Address;
385
- enterpriseAddress: Address;
386
- rewardAddress: Address;
387
- baseAddressBech32: string;
388
- enterpriseAddressBech32: string;
389
- rewardAddressBech32: string;
390
- paymentKey: Ed25519PrivateKey;
391
- stakeKey: Ed25519PrivateKey;
392
- paymentKeyHex: string;
393
- stakeKeyHex: string;
394
- drepKey?: Ed25519PrivateKey;
395
- pubDRepKey?: string;
396
- dRepIDBech32?: DRepID;
397
- dRepIDHash?: Ed25519KeyHashHex;
398
- dRepIDCip105?: string;
399
- };
400
- type EmbeddedWalletKeyType = {
401
- type: "root";
402
- bech32: string;
403
- } | {
404
- type: "cli";
405
- payment: string;
406
- stake?: string;
407
- } | {
408
- type: "mnemonic";
409
- words: string[];
410
- } | {
411
- type: "bip32Bytes";
412
- bip32Bytes: Uint8Array;
413
- };
414
- type CreateEmbeddedWalletOptions = {
415
- networkId: number;
416
- key: EmbeddedWalletKeyType;
417
- };
418
- declare class WalletStaticMethods {
419
- static privateKeyBech32ToPrivateKeyHex(_bech32: string): string;
420
- static mnemonicToPrivateKeyHex(words: string[]): string;
421
- static signingKeyToHexes(paymentKey: string, stakeKey: string): [string, string];
422
- static bip32BytesToPrivateKeyHex(bip32Bytes: Uint8Array): string;
423
- static getAddresses(paymentKey: Ed25519PrivateKey, stakingKey: Ed25519PrivateKey, networkId?: number): {
424
- baseAddress: Address;
425
- enterpriseAddress: Address;
426
- rewardAddress: Address;
427
- };
428
- static getDRepKey(dRepKey: Ed25519PrivateKey, networkId?: number): {
429
- pubDRepKey: string;
430
- dRepIDBech32: DRepID;
431
- dRepIDHash: Ed25519KeyHashHex;
432
- dRepIDCip105: string;
433
- };
434
- static generateMnemonic(strength?: number): string[];
435
- static addWitnessSets(txHex: string, witnesses: VkeyWitness[]): string;
436
- }
437
- declare class EmbeddedWallet extends WalletStaticMethods {
438
- private readonly _walletSecret?;
439
- private readonly _networkId;
440
- cryptoIsReady: boolean;
441
- constructor(options: CreateEmbeddedWalletOptions);
442
- init(): Promise<void>;
443
- getAccount(accountIndex?: number, keyIndex?: number): Account;
444
- /**
445
- * Get wallet network ID.
446
- *
447
- * @returns network ID
448
- */
449
- getNetworkId(): number;
450
- /**
451
- * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
452
- *
453
- * @param address - bech32 address to sign the data with
454
- * @param payload - the data to be signed
455
- * @param accountIndex account index (default: 0)
456
- * @returns a signature
457
- */
458
- signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): DataSignature;
459
- /**
460
- * This endpoints sign the provided transaction (unsignedTx) with the private key of the owner.
461
- *
462
- * @param unsignedTx - a transaction in CBOR
463
- * @param accountIndex account index (default: 0)
464
- * @param keyIndex key index (default: 0)
465
- * @param accountType - type of the account (default: payment)
466
- * @returns VkeyWitness
467
- */
468
- signTx(unsignedTx: string, accountIndex?: number, keyIndex?: number, accountType?: AccountType): VkeyWitness;
469
- }
470
-
471
- type CreateMeshWalletOptions = {
472
- networkId: 0 | 1;
473
- fetcher?: IFetcher;
474
- submitter?: ISubmitter;
475
- key: {
476
- type: "root";
477
- bech32: string;
478
- } | {
479
- type: "cli";
480
- payment: string;
481
- stake?: string;
482
- } | {
483
- type: "mnemonic";
484
- words: string[];
485
- } | {
486
- type: "bip32Bytes";
487
- bip32Bytes: Uint8Array;
488
- } | {
489
- type: "address";
490
- address: string;
491
- };
492
- accountIndex?: number;
493
- keyIndex?: number;
494
- accountType?: AccountType;
495
- };
496
- /**
497
- * Mesh Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
498
- *
499
- * There are 4 types of keys that can be used to create a wallet:
500
- * - root: A private key in bech32 format, generally starts with `xprv1`
501
- * - cli: CLI generated keys starts with `5820`. Payment key is required, and the stake key is optional.
502
- * - mnemonic: A list of 24 words
503
- * - address: A bech32 address that can be used to create a read-only wallet, generally starts with `addr` or `addr_test1`
504
- *
505
- * ```javascript
506
- * import { MeshWallet, BlockfrostProvider } from '@meshsdk/core';
507
- *
508
- * const provider = new BlockfrostProvider('<BLOCKFROST_API_KEY>');
509
- *
510
- * const wallet = new MeshWallet({
511
- * networkId: 0,
512
- * fetcher: provider,
513
- * submitter: provider,
514
- * key: {
515
- * type: 'mnemonic',
516
- * words: ["solution","solution","solution","solution","solution",","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution"],
517
- * },
518
- * });
519
- * ```
520
- *
521
- * Please call `await wallet.init()` after creating the wallet to fetch the addresses from the wallet.
522
- */
523
- declare class MeshWallet implements IWallet {
524
- private readonly _keyType;
525
- private readonly _accountType;
526
- private readonly _wallet;
527
- private readonly _accountIndex;
528
- private readonly _keyIndex;
529
- private readonly _fetcher?;
530
- private readonly _submitter?;
531
- private readonly _networkId;
532
- addresses: {
533
- baseAddress?: Address;
534
- enterpriseAddress?: Address;
535
- rewardAddress?: Address;
536
- baseAddressBech32?: string;
537
- enterpriseAddressBech32?: string;
538
- rewardAddressBech32?: string;
539
- pubDRepKey?: string;
540
- dRepIDBech32?: DRepID;
541
- dRepIDHash?: Ed25519KeyHashHex;
542
- dRepIDCip105?: string;
543
- };
544
- constructor(options: CreateMeshWalletOptions);
545
- /**
546
- * Initializes the wallet. This is a required call as fetching addresses from the wallet is an async operation.
547
- * @returns void
548
- */
549
- init(): Promise<void>;
550
- /**
551
- * Returns all derived addresses from the wallet.
552
- * @returns a list of addresses
553
- */
554
- getAddresses(): {
555
- baseAddress?: Address;
556
- enterpriseAddress?: Address;
557
- rewardAddress?: Address;
558
- baseAddressBech32?: string;
559
- enterpriseAddressBech32?: string;
560
- rewardAddressBech32?: string;
561
- pubDRepKey?: string;
562
- dRepIDBech32?: any;
563
- dRepIDHash?: Ed25519KeyHashHex;
564
- dRepIDCip105?: string;
565
- };
566
- /**
567
- * Returns a list of assets in the wallet. This API will return every assets in the wallet. Each asset is an object with the following properties:
568
- * - A unit is provided to display asset's name on the user interface.
569
- * - A quantity is provided to display asset's quantity on the user interface.
570
- *
571
- * @returns a list of assets and their quantities
572
- */
573
- getBalance(): Promise<Asset[]>;
574
- /**
575
- * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet.
576
- *
577
- * @returns an address
578
- */
579
- getChangeAddress(addressType?: GetAddressType): Promise<string>;
580
- /**
581
- * Returns an address owned by the wallet that should be used as a change address to return leftover assets during transaction creation back to the connected wallet in hex format.
582
- *
583
- * @returns an address in hex format
584
- */
585
- getChangeAddressHex(addressType?: GetAddressType): Promise<string>;
586
- /**
587
- * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
588
- *
589
- * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
590
- *
591
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
592
- * @returns a list of UTXOs
593
- */
594
- getCollateral(addressType?: GetAddressType): Promise<UTxO[]>;
595
- /**
596
- * This function shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only UTXOs).
597
- *
598
- * If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. NOTE: wallets are free to return UTXOs that add up to a greater total ADA value than requested in the amount parameter, but wallets must never return any result where UTXOs would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.
599
- *
600
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
601
- * @returns a list of UTXOs in hex format
602
- */
603
- getCollateralHex(addressType?: GetAddressType): Promise<string[]>;
604
- /**
605
- * Return a list of supported CIPs of the wallet.
606
- *
607
- * @returns a list of CIPs
608
- */
609
- getExtensions(): Promise<number[]>;
610
- /**
611
- * Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
612
- *
613
- * This is used in transaction building.
614
- *
615
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
616
- * @returns a list of UTXOs
617
- */
618
- getCollateralUnspentOutput(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
619
- /**
620
- * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
621
- * These are used by the client to identify the user's on-chain CIP-1694 interactions, i.e. if a user has registered to be a DRep.
622
- *
623
- * @returns DRep object
624
- */
625
- getDRep(): Promise<{
626
- publicKey: string;
627
- publicKeyHash: string;
628
- dRepIDCip105: string;
629
- } | undefined>;
630
- /**
631
- * Returns the network ID of the currently connected account. 0 is testnet and 1 is mainnet but other networks can possibly be returned by wallets. Those other network ID values are not governed by CIP-30. This result will stay the same unless the connected account has changed.
632
- *
633
- * @returns network ID
634
- */
635
- getNetworkId(): Promise<number>;
636
- /**
637
- * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking, generally starts from `stake` prefix.
638
- *
639
- * @returns a list of reward addresses
640
- */
641
- getRewardAddresses(): Promise<string[]>;
642
- /**
643
- * Returns a list of reward addresses owned by the wallet. A reward address is a stake address that is used to receive rewards from staking.
644
- * @returns a list of reward addresses in hex format
645
- */
646
- getRewardAddressesHex(): Promise<string[]>;
647
- /**
648
- * Returns a list of unused addresses controlled by the wallet.
649
- *
650
- * @returns a list of unused addresses
651
- */
652
- getUnusedAddresses(): Promise<string[]>;
653
- /**
654
- * Returns a list of unused addresses controlled by the wallet.
655
- *
656
- * @returns a list of unused addresses in hex format
657
- */
658
- getUnusedAddressesHex(): Promise<string[]>;
659
- /**
660
- * Returns a list of used addresses controlled by the wallet.
661
- *
662
- * @returns a list of used addresses
663
- */
664
- getUsedAddresses(): Promise<string[]>;
665
- /**
666
- * Returns a list of used addresses controlled by the wallet.
667
- *
668
- * @returns a list of used addresses in hex format
669
- */
670
- getUsedAddressesHex(): Promise<string[]>;
671
- /**
672
- * Get a list of UTXOs to be used for transaction building.
673
- *
674
- * This is used in transaction building.
675
- *
676
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
677
- * @returns a list of UTXOs
678
- */
679
- getUsedUTxOs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
680
- /**
681
- * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
682
- *
683
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
684
- * @returns a list of UTXOs
685
- */
686
- getUtxos(addressType?: GetAddressType): Promise<UTxO[]>;
687
- /**
688
- * Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
689
- *
690
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
691
- * @returns a list of UTXOs in hex format
692
- */
693
- getUtxosHex(addressType?: GetAddressType): Promise<string[]>;
694
- /**
695
- * This endpoint utilizes the [CIP-8 - Message Signing](https://cips.cardano.org/cips/cip8/) to sign arbitrary data, to verify the data was signed by the owner of the private key.
696
- *
697
- * @param payload - the payload to sign
698
- * @param address - the address to use for signing (optional)
699
- * @returns a signature
700
- */
701
- signData(payload: string, address?: string): Promise<DataSignature>;
702
- /**
703
- * Requests user to sign the provided transaction (tx). The wallet should ask the user for permission, and if given, try to sign the supplied body and return a signed transaction. partialSign should be true if the transaction provided requires multiple signatures.
704
- *
705
- * @param unsignedTx - a transaction in CBOR
706
- * @param partialSign - if the transaction is partially signed (default: false)
707
- * @param returnFullTx - if the full tx should be returned or only the witness set (default: true)
708
- * @returns a signed transaction in CBOR
709
- */
710
- signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
711
- /**
712
- * Experimental feature - sign multiple transactions at once.
713
- *
714
- * @param unsignedTxs - array of unsigned transactions in CborHex string
715
- * @param partialSign - if the transactions are signed partially
716
- * @returns array of signed transactions CborHex string
717
- */
718
- signTxs(unsignedTxs: string[], partialSign?: boolean, returnFullTx?: boolean): Promise<string[]>;
719
- /**
720
- * Submits the signed transaction to the blockchain network.
721
- *
722
- * As wallets should already have this ability to submit transaction, we allow apps to request that a transaction be sent through it. If the wallet accepts the transaction and tries to send it, it shall return the transaction ID for the app to track. The wallet can return error messages or failure if there was an error in sending it.
723
- *
724
- * @param tx - a signed transaction in CBOR
725
- * @returns a transaction hash
726
- */
727
- submitTx(tx: string): Promise<string>;
728
- /**
729
- * Get a used address of type Address from the wallet.
730
- *
731
- * This is used in transaction building.
732
- *
733
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
734
- * @returns an Address object
735
- */
736
- getUsedAddress(addressType?: GetAddressType): Address;
737
- /**
738
- * Get a list of UTXOs to be used for transaction building.
739
- *
740
- * This is used in transaction building.
741
- *
742
- * @param addressType - the type of address to fetch UTXOs from (default: payment)
743
- * @returns a list of UTXOs
744
- */
745
- getUnspentOutputs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
746
- /**
747
- * A helper function to get the assets in the wallet.
748
- *
749
- * @returns a list of assets
750
- */
751
- getAssets(): Promise<AssetExtended[]>;
752
- /**
753
- * A helper function to get the lovelace balance in the wallet.
754
- *
755
- * @returns lovelace balance
756
- */
757
- getLovelace(): Promise<string>;
758
- /**
759
- * A helper function to get the assets of a specific policy ID in the wallet.
760
- *
761
- * @param policyId
762
- * @returns a list of assets
763
- */
764
- getPolicyIdAssets(policyId: string): Promise<AssetExtended[]>;
765
- /**
766
- * A helper function to get the policy IDs of all the assets in the wallet.
767
- *
768
- * @returns a list of policy IDs
769
- */
770
- getPolicyIds(): Promise<string[]>;
771
- getRegisteredPubStakeKeys(): Promise<{
772
- pubStakeKeys: string[];
773
- pubStakeKeyHashes: string[];
774
- } | undefined>;
775
- getUnregisteredPubStakeKeys(): Promise<{
776
- pubStakeKeys: string[];
777
- pubStakeKeyHashes: string[];
778
- } | undefined>;
779
- /**
780
- * A helper function to create a collateral input for a transaction.
781
- *
782
- * @returns a transaction hash
783
- */
784
- createCollateral(): Promise<string>;
785
- getPubDRepKey(): {
786
- pubDRepKey: string | undefined;
787
- dRepIDBech32: string | undefined;
788
- dRepIDHash: string | undefined;
789
- dRepIDCip105: string | undefined;
790
- };
791
- /**
792
- * Generate mnemonic or private key
793
- *
794
- * @param privateKey return private key if true
795
- * @returns a transaction hash
796
- */
797
- static brew(privateKey?: boolean, strength?: number): string[] | string;
798
- private getAddressesFromWallet;
799
- private buildAddressFromBech32Address;
800
- }
801
-
802
- export { type Account, type AccountType, AppWallet, type AppWalletKeyType, BrowserWallet, type CreateAppWalletOptions, type CreateEmbeddedWalletOptions, type CreateMeshWalletOptions, EmbeddedWallet, type EmbeddedWalletKeyType, MeshWallet, WalletStaticMethods, connect, login, register };