@meshsdk/wallet 1.9.0-beta.10 → 1.9.0-beta.101
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.cjs +180 -68
- package/dist/index.d.cts +74 -26
- package/dist/index.d.ts +74 -26
- package/dist/index.js +195 -78
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSignature,
|
|
1
|
+
import { DataSignature, ISigner, ISubmitter, IFetcher, IWallet, Wallet, Extension, Asset, UTxO, AssetExtended } from '@meshsdk/common';
|
|
2
2
|
import { Ed25519PublicKeyHex, TransactionUnspentOutput, Address, Ed25519PrivateKey, DRepID, Ed25519KeyHashHex, VkeyWitness } from '@meshsdk/core-cst';
|
|
3
3
|
import * as _simplewebauthn_browser from '@simplewebauthn/browser';
|
|
4
4
|
|
|
@@ -97,7 +97,7 @@ declare class AppWallet implements ISigner, ISubmitter {
|
|
|
97
97
|
getUsedAddress(accountIndex?: number, keyIndex?: number, addressType?: GetAddressType): Address;
|
|
98
98
|
getUnspentOutputs(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
99
99
|
signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): Promise<DataSignature>;
|
|
100
|
-
signTx(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
|
|
100
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
|
|
101
101
|
signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
|
|
102
102
|
signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
|
|
103
103
|
submitTx(tx: string): Promise<string>;
|
|
@@ -112,7 +112,7 @@ declare global {
|
|
|
112
112
|
/**
|
|
113
113
|
* Browser Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
|
|
114
114
|
*
|
|
115
|
-
* These wallets APIs are in accordance to CIP-30, which defines the API for
|
|
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
116
|
* ```javascript
|
|
117
117
|
* import { BrowserWallet } from '@meshsdk/core';
|
|
118
118
|
*
|
|
@@ -145,7 +145,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
145
145
|
*/
|
|
146
146
|
static getInstalledWallets(): Wallet[];
|
|
147
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
|
|
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
149
|
*
|
|
150
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
151
|
*
|
|
@@ -153,7 +153,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
153
153
|
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
154
154
|
* @returns WalletInstance
|
|
155
155
|
*/
|
|
156
|
-
static enable(walletName: string, extensions?:
|
|
156
|
+
static enable(walletName: string, extensions?: Extension[]): Promise<BrowserWallet>;
|
|
157
157
|
/**
|
|
158
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
159
|
* - A unit is provided to display asset's name on the user interface.
|
|
@@ -220,15 +220,16 @@ declare class BrowserWallet implements IWallet {
|
|
|
220
220
|
* @param address - optional, if not provided, the first staking address will be used
|
|
221
221
|
* @returns a signature
|
|
222
222
|
*/
|
|
223
|
-
signData(payload: string, address?: string): Promise<DataSignature>;
|
|
223
|
+
signData(payload: string, address?: string | undefined, convertFromUTF8?: boolean): Promise<DataSignature>;
|
|
224
224
|
/**
|
|
225
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
226
|
*
|
|
227
227
|
* @param unsignedTx - a transaction in CBOR
|
|
228
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)
|
|
229
230
|
* @returns a signed transaction in CBOR
|
|
230
231
|
*/
|
|
231
|
-
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
232
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
|
|
232
233
|
/**
|
|
233
234
|
* Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
|
|
234
235
|
*
|
|
@@ -240,7 +241,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
240
241
|
/**
|
|
241
242
|
* Submits the signed transaction to the blockchain network.
|
|
242
243
|
*
|
|
243
|
-
* As wallets should already have this ability to submit transaction, we allow
|
|
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.
|
|
244
245
|
*
|
|
245
246
|
* @param tx
|
|
246
247
|
* @returns a transaction hash
|
|
@@ -299,7 +300,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
299
300
|
* The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
|
|
300
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.
|
|
301
302
|
*
|
|
302
|
-
* @returns
|
|
303
|
+
* @returns DRep object
|
|
303
304
|
*/
|
|
304
305
|
getDRep(): Promise<{
|
|
305
306
|
publicKey: string;
|
|
@@ -312,11 +313,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
312
313
|
*
|
|
313
314
|
* @returns wallet account's public DRep Key
|
|
314
315
|
*/
|
|
315
|
-
getPubDRepKey(): Promise<
|
|
316
|
-
pubDRepKey: string;
|
|
317
|
-
dRepIDHash: string;
|
|
318
|
-
dRepIDBech32: string;
|
|
319
|
-
} | undefined>;
|
|
316
|
+
getPubDRepKey(): Promise<string | undefined>;
|
|
320
317
|
getRegisteredPubStakeKeys(): Promise<{
|
|
321
318
|
pubStakeKeys: string[];
|
|
322
319
|
pubStakeKeyHashes: string[];
|
|
@@ -327,7 +324,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
327
324
|
} | undefined>;
|
|
328
325
|
private static dRepKeyToDRepID;
|
|
329
326
|
private static resolveInstance;
|
|
330
|
-
static addBrowserWitnesses(unsignedTx: string, witnesses: string):
|
|
327
|
+
static addBrowserWitnesses(unsignedTx: string, witnesses: string): any;
|
|
331
328
|
static getSupportedExtensions(wallet: string): {
|
|
332
329
|
cip: number;
|
|
333
330
|
}[];
|
|
@@ -382,6 +379,7 @@ declare function register({ serverUrl, username, }: {
|
|
|
382
379
|
errorCode?: undefined;
|
|
383
380
|
}>;
|
|
384
381
|
|
|
382
|
+
type AccountType = "payment" | "stake" | "drep";
|
|
385
383
|
type Account = {
|
|
386
384
|
baseAddress: Address;
|
|
387
385
|
enterpriseAddress: Address;
|
|
@@ -393,9 +391,11 @@ type Account = {
|
|
|
393
391
|
stakeKey: Ed25519PrivateKey;
|
|
394
392
|
paymentKeyHex: string;
|
|
395
393
|
stakeKeyHex: string;
|
|
394
|
+
drepKey?: Ed25519PrivateKey;
|
|
396
395
|
pubDRepKey?: string;
|
|
397
396
|
dRepIDBech32?: DRepID;
|
|
398
397
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
398
|
+
dRepIDCip105?: string;
|
|
399
399
|
};
|
|
400
400
|
type EmbeddedWalletKeyType = {
|
|
401
401
|
type: "root";
|
|
@@ -429,6 +429,7 @@ declare class WalletStaticMethods {
|
|
|
429
429
|
pubDRepKey: string;
|
|
430
430
|
dRepIDBech32: DRepID;
|
|
431
431
|
dRepIDHash: Ed25519KeyHashHex;
|
|
432
|
+
dRepIDCip105: string;
|
|
432
433
|
};
|
|
433
434
|
static generateMnemonic(strength?: number): string[];
|
|
434
435
|
static addWitnessSets(txHex: string, witnesses: VkeyWitness[]): string;
|
|
@@ -436,6 +437,7 @@ declare class WalletStaticMethods {
|
|
|
436
437
|
declare class EmbeddedWallet extends WalletStaticMethods {
|
|
437
438
|
private readonly _walletSecret?;
|
|
438
439
|
private readonly _networkId;
|
|
440
|
+
cryptoIsReady: boolean;
|
|
439
441
|
constructor(options: CreateEmbeddedWalletOptions);
|
|
440
442
|
init(): Promise<void>;
|
|
441
443
|
getAccount(accountIndex?: number, keyIndex?: number): Account;
|
|
@@ -460,9 +462,10 @@ declare class EmbeddedWallet extends WalletStaticMethods {
|
|
|
460
462
|
* @param unsignedTx - a transaction in CBOR
|
|
461
463
|
* @param accountIndex account index (default: 0)
|
|
462
464
|
* @param keyIndex key index (default: 0)
|
|
465
|
+
* @param accountType - type of the account (default: payment)
|
|
463
466
|
* @returns VkeyWitness
|
|
464
467
|
*/
|
|
465
|
-
signTx(unsignedTx: string, accountIndex?: number, keyIndex?: number): VkeyWitness;
|
|
468
|
+
signTx(unsignedTx: string, accountIndex?: number, keyIndex?: number, accountType?: AccountType): VkeyWitness;
|
|
466
469
|
}
|
|
467
470
|
|
|
468
471
|
type CreateMeshWalletOptions = {
|
|
@@ -488,6 +491,7 @@ type CreateMeshWalletOptions = {
|
|
|
488
491
|
};
|
|
489
492
|
accountIndex?: number;
|
|
490
493
|
keyIndex?: number;
|
|
494
|
+
accountType?: AccountType;
|
|
491
495
|
};
|
|
492
496
|
/**
|
|
493
497
|
* Mesh Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
|
|
@@ -501,12 +505,12 @@ type CreateMeshWalletOptions = {
|
|
|
501
505
|
* ```javascript
|
|
502
506
|
* import { MeshWallet, BlockfrostProvider } from '@meshsdk/core';
|
|
503
507
|
*
|
|
504
|
-
* const
|
|
508
|
+
* const provider = new BlockfrostProvider('<BLOCKFROST_API_KEY>');
|
|
505
509
|
*
|
|
506
510
|
* const wallet = new MeshWallet({
|
|
507
511
|
* networkId: 0,
|
|
508
|
-
* fetcher:
|
|
509
|
-
* submitter:
|
|
512
|
+
* fetcher: provider,
|
|
513
|
+
* submitter: provider,
|
|
510
514
|
* key: {
|
|
511
515
|
* type: 'mnemonic',
|
|
512
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"],
|
|
@@ -518,6 +522,7 @@ type CreateMeshWalletOptions = {
|
|
|
518
522
|
*/
|
|
519
523
|
declare class MeshWallet implements IWallet {
|
|
520
524
|
private readonly _keyType;
|
|
525
|
+
private readonly _accountType;
|
|
521
526
|
private readonly _wallet;
|
|
522
527
|
private readonly _accountIndex;
|
|
523
528
|
private readonly _keyIndex;
|
|
@@ -534,6 +539,7 @@ declare class MeshWallet implements IWallet {
|
|
|
534
539
|
pubDRepKey?: string;
|
|
535
540
|
dRepIDBech32?: DRepID;
|
|
536
541
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
542
|
+
dRepIDCip105?: string;
|
|
537
543
|
};
|
|
538
544
|
constructor(options: CreateMeshWalletOptions);
|
|
539
545
|
/**
|
|
@@ -553,8 +559,9 @@ declare class MeshWallet implements IWallet {
|
|
|
553
559
|
enterpriseAddressBech32?: string;
|
|
554
560
|
rewardAddressBech32?: string;
|
|
555
561
|
pubDRepKey?: string;
|
|
556
|
-
dRepIDBech32?:
|
|
562
|
+
dRepIDBech32?: any;
|
|
557
563
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
564
|
+
dRepIDCip105?: string;
|
|
558
565
|
};
|
|
559
566
|
/**
|
|
560
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:
|
|
@@ -569,7 +576,13 @@ declare class MeshWallet implements IWallet {
|
|
|
569
576
|
*
|
|
570
577
|
* @returns an address
|
|
571
578
|
*/
|
|
572
|
-
getChangeAddress(): Promise<string>;
|
|
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>;
|
|
573
586
|
/**
|
|
574
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).
|
|
575
588
|
*
|
|
@@ -579,6 +592,15 @@ declare class MeshWallet implements IWallet {
|
|
|
579
592
|
* @returns a list of UTXOs
|
|
580
593
|
*/
|
|
581
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[]>;
|
|
582
604
|
/**
|
|
583
605
|
* Return a list of supported CIPs of the wallet.
|
|
584
606
|
*
|
|
@@ -598,7 +620,7 @@ declare class MeshWallet implements IWallet {
|
|
|
598
620
|
* The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
|
|
599
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.
|
|
600
622
|
*
|
|
601
|
-
* @returns
|
|
623
|
+
* @returns DRep object
|
|
602
624
|
*/
|
|
603
625
|
getDRep(): Promise<{
|
|
604
626
|
publicKey: string;
|
|
@@ -617,18 +639,35 @@ declare class MeshWallet implements IWallet {
|
|
|
617
639
|
* @returns a list of reward addresses
|
|
618
640
|
*/
|
|
619
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[]>;
|
|
620
647
|
/**
|
|
621
648
|
* Returns a list of unused addresses controlled by the wallet.
|
|
622
649
|
*
|
|
623
650
|
* @returns a list of unused addresses
|
|
624
651
|
*/
|
|
625
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[]>;
|
|
626
659
|
/**
|
|
627
660
|
* Returns a list of used addresses controlled by the wallet.
|
|
628
661
|
*
|
|
629
662
|
* @returns a list of used addresses
|
|
630
663
|
*/
|
|
631
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[]>;
|
|
632
671
|
/**
|
|
633
672
|
* Get a list of UTXOs to be used for transaction building.
|
|
634
673
|
*
|
|
@@ -645,6 +684,13 @@ declare class MeshWallet implements IWallet {
|
|
|
645
684
|
* @returns a list of UTXOs
|
|
646
685
|
*/
|
|
647
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[]>;
|
|
648
694
|
/**
|
|
649
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.
|
|
650
696
|
*
|
|
@@ -658,9 +704,10 @@ declare class MeshWallet implements IWallet {
|
|
|
658
704
|
*
|
|
659
705
|
* @param unsignedTx - a transaction in CBOR
|
|
660
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)
|
|
661
708
|
* @returns a signed transaction in CBOR
|
|
662
709
|
*/
|
|
663
|
-
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
710
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
|
|
664
711
|
/**
|
|
665
712
|
* Experimental feature - sign multiple transactions at once.
|
|
666
713
|
*
|
|
@@ -668,11 +715,11 @@ declare class MeshWallet implements IWallet {
|
|
|
668
715
|
* @param partialSign - if the transactions are signed partially
|
|
669
716
|
* @returns array of signed transactions CborHex string
|
|
670
717
|
*/
|
|
671
|
-
signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
|
|
718
|
+
signTxs(unsignedTxs: string[], partialSign?: boolean, returnFullTx?: boolean): Promise<string[]>;
|
|
672
719
|
/**
|
|
673
720
|
* Submits the signed transaction to the blockchain network.
|
|
674
721
|
*
|
|
675
|
-
* As wallets should already have this ability to submit transaction, we allow
|
|
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.
|
|
676
723
|
*
|
|
677
724
|
* @param tx - a signed transaction in CBOR
|
|
678
725
|
* @returns a transaction hash
|
|
@@ -739,6 +786,7 @@ declare class MeshWallet implements IWallet {
|
|
|
739
786
|
pubDRepKey: string | undefined;
|
|
740
787
|
dRepIDBech32: string | undefined;
|
|
741
788
|
dRepIDHash: string | undefined;
|
|
789
|
+
dRepIDCip105: string | undefined;
|
|
742
790
|
};
|
|
743
791
|
/**
|
|
744
792
|
* Generate mnemonic or private key
|
|
@@ -751,4 +799,4 @@ declare class MeshWallet implements IWallet {
|
|
|
751
799
|
private buildAddressFromBech32Address;
|
|
752
800
|
}
|
|
753
801
|
|
|
754
|
-
export { type Account, AppWallet, type AppWalletKeyType, BrowserWallet, type CreateAppWalletOptions, type CreateEmbeddedWalletOptions, type CreateMeshWalletOptions, EmbeddedWallet, type EmbeddedWalletKeyType, MeshWallet, WalletStaticMethods, connect, login, register };
|
|
802
|
+
export { type Account, type AccountType, AppWallet, type AppWalletKeyType, BrowserWallet, type CreateAppWalletOptions, type CreateEmbeddedWalletOptions, type CreateMeshWalletOptions, EmbeddedWallet, type EmbeddedWalletKeyType, MeshWallet, WalletStaticMethods, connect, login, register };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSignature,
|
|
1
|
+
import { DataSignature, ISigner, ISubmitter, IFetcher, IWallet, Wallet, Extension, Asset, UTxO, AssetExtended } from '@meshsdk/common';
|
|
2
2
|
import { Ed25519PublicKeyHex, TransactionUnspentOutput, Address, Ed25519PrivateKey, DRepID, Ed25519KeyHashHex, VkeyWitness } from '@meshsdk/core-cst';
|
|
3
3
|
import * as _simplewebauthn_browser from '@simplewebauthn/browser';
|
|
4
4
|
|
|
@@ -97,7 +97,7 @@ declare class AppWallet implements ISigner, ISubmitter {
|
|
|
97
97
|
getUsedAddress(accountIndex?: number, keyIndex?: number, addressType?: GetAddressType): Address;
|
|
98
98
|
getUnspentOutputs(accountIndex?: number, addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
99
99
|
signData(address: string, payload: string, accountIndex?: number, keyIndex?: number): Promise<DataSignature>;
|
|
100
|
-
signTx(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
|
|
100
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean, accountIndex?: number, keyIndex?: number): Promise<string>;
|
|
101
101
|
signTxSync(unsignedTx: string, partialSign?: boolean, accountIndex?: number, keyIndex?: number): string;
|
|
102
102
|
signTxs(unsignedTxs: string[], partialSign: boolean): Promise<string[]>;
|
|
103
103
|
submitTx(tx: string): Promise<string>;
|
|
@@ -112,7 +112,7 @@ declare global {
|
|
|
112
112
|
/**
|
|
113
113
|
* Browser Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
|
|
114
114
|
*
|
|
115
|
-
* These wallets APIs are in accordance to CIP-30, which defines the API for
|
|
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
116
|
* ```javascript
|
|
117
117
|
* import { BrowserWallet } from '@meshsdk/core';
|
|
118
118
|
*
|
|
@@ -145,7 +145,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
145
145
|
*/
|
|
146
146
|
static getInstalledWallets(): Wallet[];
|
|
147
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
|
|
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
149
|
*
|
|
150
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
151
|
*
|
|
@@ -153,7 +153,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
153
153
|
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
154
154
|
* @returns WalletInstance
|
|
155
155
|
*/
|
|
156
|
-
static enable(walletName: string, extensions?:
|
|
156
|
+
static enable(walletName: string, extensions?: Extension[]): Promise<BrowserWallet>;
|
|
157
157
|
/**
|
|
158
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
159
|
* - A unit is provided to display asset's name on the user interface.
|
|
@@ -220,15 +220,16 @@ declare class BrowserWallet implements IWallet {
|
|
|
220
220
|
* @param address - optional, if not provided, the first staking address will be used
|
|
221
221
|
* @returns a signature
|
|
222
222
|
*/
|
|
223
|
-
signData(payload: string, address?: string): Promise<DataSignature>;
|
|
223
|
+
signData(payload: string, address?: string | undefined, convertFromUTF8?: boolean): Promise<DataSignature>;
|
|
224
224
|
/**
|
|
225
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
226
|
*
|
|
227
227
|
* @param unsignedTx - a transaction in CBOR
|
|
228
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)
|
|
229
230
|
* @returns a signed transaction in CBOR
|
|
230
231
|
*/
|
|
231
|
-
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
232
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
|
|
232
233
|
/**
|
|
233
234
|
* Experimental feature - sign multiple transactions at once (Supported wallet(s): Typhon)
|
|
234
235
|
*
|
|
@@ -240,7 +241,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
240
241
|
/**
|
|
241
242
|
* Submits the signed transaction to the blockchain network.
|
|
242
243
|
*
|
|
243
|
-
* As wallets should already have this ability to submit transaction, we allow
|
|
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.
|
|
244
245
|
*
|
|
245
246
|
* @param tx
|
|
246
247
|
* @returns a transaction hash
|
|
@@ -299,7 +300,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
299
300
|
* The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
|
|
300
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.
|
|
301
302
|
*
|
|
302
|
-
* @returns
|
|
303
|
+
* @returns DRep object
|
|
303
304
|
*/
|
|
304
305
|
getDRep(): Promise<{
|
|
305
306
|
publicKey: string;
|
|
@@ -312,11 +313,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
312
313
|
*
|
|
313
314
|
* @returns wallet account's public DRep Key
|
|
314
315
|
*/
|
|
315
|
-
getPubDRepKey(): Promise<
|
|
316
|
-
pubDRepKey: string;
|
|
317
|
-
dRepIDHash: string;
|
|
318
|
-
dRepIDBech32: string;
|
|
319
|
-
} | undefined>;
|
|
316
|
+
getPubDRepKey(): Promise<string | undefined>;
|
|
320
317
|
getRegisteredPubStakeKeys(): Promise<{
|
|
321
318
|
pubStakeKeys: string[];
|
|
322
319
|
pubStakeKeyHashes: string[];
|
|
@@ -327,7 +324,7 @@ declare class BrowserWallet implements IWallet {
|
|
|
327
324
|
} | undefined>;
|
|
328
325
|
private static dRepKeyToDRepID;
|
|
329
326
|
private static resolveInstance;
|
|
330
|
-
static addBrowserWitnesses(unsignedTx: string, witnesses: string):
|
|
327
|
+
static addBrowserWitnesses(unsignedTx: string, witnesses: string): any;
|
|
331
328
|
static getSupportedExtensions(wallet: string): {
|
|
332
329
|
cip: number;
|
|
333
330
|
}[];
|
|
@@ -382,6 +379,7 @@ declare function register({ serverUrl, username, }: {
|
|
|
382
379
|
errorCode?: undefined;
|
|
383
380
|
}>;
|
|
384
381
|
|
|
382
|
+
type AccountType = "payment" | "stake" | "drep";
|
|
385
383
|
type Account = {
|
|
386
384
|
baseAddress: Address;
|
|
387
385
|
enterpriseAddress: Address;
|
|
@@ -393,9 +391,11 @@ type Account = {
|
|
|
393
391
|
stakeKey: Ed25519PrivateKey;
|
|
394
392
|
paymentKeyHex: string;
|
|
395
393
|
stakeKeyHex: string;
|
|
394
|
+
drepKey?: Ed25519PrivateKey;
|
|
396
395
|
pubDRepKey?: string;
|
|
397
396
|
dRepIDBech32?: DRepID;
|
|
398
397
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
398
|
+
dRepIDCip105?: string;
|
|
399
399
|
};
|
|
400
400
|
type EmbeddedWalletKeyType = {
|
|
401
401
|
type: "root";
|
|
@@ -429,6 +429,7 @@ declare class WalletStaticMethods {
|
|
|
429
429
|
pubDRepKey: string;
|
|
430
430
|
dRepIDBech32: DRepID;
|
|
431
431
|
dRepIDHash: Ed25519KeyHashHex;
|
|
432
|
+
dRepIDCip105: string;
|
|
432
433
|
};
|
|
433
434
|
static generateMnemonic(strength?: number): string[];
|
|
434
435
|
static addWitnessSets(txHex: string, witnesses: VkeyWitness[]): string;
|
|
@@ -436,6 +437,7 @@ declare class WalletStaticMethods {
|
|
|
436
437
|
declare class EmbeddedWallet extends WalletStaticMethods {
|
|
437
438
|
private readonly _walletSecret?;
|
|
438
439
|
private readonly _networkId;
|
|
440
|
+
cryptoIsReady: boolean;
|
|
439
441
|
constructor(options: CreateEmbeddedWalletOptions);
|
|
440
442
|
init(): Promise<void>;
|
|
441
443
|
getAccount(accountIndex?: number, keyIndex?: number): Account;
|
|
@@ -460,9 +462,10 @@ declare class EmbeddedWallet extends WalletStaticMethods {
|
|
|
460
462
|
* @param unsignedTx - a transaction in CBOR
|
|
461
463
|
* @param accountIndex account index (default: 0)
|
|
462
464
|
* @param keyIndex key index (default: 0)
|
|
465
|
+
* @param accountType - type of the account (default: payment)
|
|
463
466
|
* @returns VkeyWitness
|
|
464
467
|
*/
|
|
465
|
-
signTx(unsignedTx: string, accountIndex?: number, keyIndex?: number): VkeyWitness;
|
|
468
|
+
signTx(unsignedTx: string, accountIndex?: number, keyIndex?: number, accountType?: AccountType): VkeyWitness;
|
|
466
469
|
}
|
|
467
470
|
|
|
468
471
|
type CreateMeshWalletOptions = {
|
|
@@ -488,6 +491,7 @@ type CreateMeshWalletOptions = {
|
|
|
488
491
|
};
|
|
489
492
|
accountIndex?: number;
|
|
490
493
|
keyIndex?: number;
|
|
494
|
+
accountType?: AccountType;
|
|
491
495
|
};
|
|
492
496
|
/**
|
|
493
497
|
* Mesh Wallet provides a set of APIs to interact with the blockchain. This wallet is compatible with Mesh transaction builders.
|
|
@@ -501,12 +505,12 @@ type CreateMeshWalletOptions = {
|
|
|
501
505
|
* ```javascript
|
|
502
506
|
* import { MeshWallet, BlockfrostProvider } from '@meshsdk/core';
|
|
503
507
|
*
|
|
504
|
-
* const
|
|
508
|
+
* const provider = new BlockfrostProvider('<BLOCKFROST_API_KEY>');
|
|
505
509
|
*
|
|
506
510
|
* const wallet = new MeshWallet({
|
|
507
511
|
* networkId: 0,
|
|
508
|
-
* fetcher:
|
|
509
|
-
* submitter:
|
|
512
|
+
* fetcher: provider,
|
|
513
|
+
* submitter: provider,
|
|
510
514
|
* key: {
|
|
511
515
|
* type: 'mnemonic',
|
|
512
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"],
|
|
@@ -518,6 +522,7 @@ type CreateMeshWalletOptions = {
|
|
|
518
522
|
*/
|
|
519
523
|
declare class MeshWallet implements IWallet {
|
|
520
524
|
private readonly _keyType;
|
|
525
|
+
private readonly _accountType;
|
|
521
526
|
private readonly _wallet;
|
|
522
527
|
private readonly _accountIndex;
|
|
523
528
|
private readonly _keyIndex;
|
|
@@ -534,6 +539,7 @@ declare class MeshWallet implements IWallet {
|
|
|
534
539
|
pubDRepKey?: string;
|
|
535
540
|
dRepIDBech32?: DRepID;
|
|
536
541
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
542
|
+
dRepIDCip105?: string;
|
|
537
543
|
};
|
|
538
544
|
constructor(options: CreateMeshWalletOptions);
|
|
539
545
|
/**
|
|
@@ -553,8 +559,9 @@ declare class MeshWallet implements IWallet {
|
|
|
553
559
|
enterpriseAddressBech32?: string;
|
|
554
560
|
rewardAddressBech32?: string;
|
|
555
561
|
pubDRepKey?: string;
|
|
556
|
-
dRepIDBech32?:
|
|
562
|
+
dRepIDBech32?: any;
|
|
557
563
|
dRepIDHash?: Ed25519KeyHashHex;
|
|
564
|
+
dRepIDCip105?: string;
|
|
558
565
|
};
|
|
559
566
|
/**
|
|
560
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:
|
|
@@ -569,7 +576,13 @@ declare class MeshWallet implements IWallet {
|
|
|
569
576
|
*
|
|
570
577
|
* @returns an address
|
|
571
578
|
*/
|
|
572
|
-
getChangeAddress(): Promise<string>;
|
|
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>;
|
|
573
586
|
/**
|
|
574
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).
|
|
575
588
|
*
|
|
@@ -579,6 +592,15 @@ declare class MeshWallet implements IWallet {
|
|
|
579
592
|
* @returns a list of UTXOs
|
|
580
593
|
*/
|
|
581
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[]>;
|
|
582
604
|
/**
|
|
583
605
|
* Return a list of supported CIPs of the wallet.
|
|
584
606
|
*
|
|
@@ -598,7 +620,7 @@ declare class MeshWallet implements IWallet {
|
|
|
598
620
|
* The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
|
|
599
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.
|
|
600
622
|
*
|
|
601
|
-
* @returns
|
|
623
|
+
* @returns DRep object
|
|
602
624
|
*/
|
|
603
625
|
getDRep(): Promise<{
|
|
604
626
|
publicKey: string;
|
|
@@ -617,18 +639,35 @@ declare class MeshWallet implements IWallet {
|
|
|
617
639
|
* @returns a list of reward addresses
|
|
618
640
|
*/
|
|
619
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[]>;
|
|
620
647
|
/**
|
|
621
648
|
* Returns a list of unused addresses controlled by the wallet.
|
|
622
649
|
*
|
|
623
650
|
* @returns a list of unused addresses
|
|
624
651
|
*/
|
|
625
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[]>;
|
|
626
659
|
/**
|
|
627
660
|
* Returns a list of used addresses controlled by the wallet.
|
|
628
661
|
*
|
|
629
662
|
* @returns a list of used addresses
|
|
630
663
|
*/
|
|
631
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[]>;
|
|
632
671
|
/**
|
|
633
672
|
* Get a list of UTXOs to be used for transaction building.
|
|
634
673
|
*
|
|
@@ -645,6 +684,13 @@ declare class MeshWallet implements IWallet {
|
|
|
645
684
|
* @returns a list of UTXOs
|
|
646
685
|
*/
|
|
647
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[]>;
|
|
648
694
|
/**
|
|
649
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.
|
|
650
696
|
*
|
|
@@ -658,9 +704,10 @@ declare class MeshWallet implements IWallet {
|
|
|
658
704
|
*
|
|
659
705
|
* @param unsignedTx - a transaction in CBOR
|
|
660
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)
|
|
661
708
|
* @returns a signed transaction in CBOR
|
|
662
709
|
*/
|
|
663
|
-
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
710
|
+
signTx(unsignedTx: string, partialSign?: boolean, returnFullTx?: boolean): Promise<string>;
|
|
664
711
|
/**
|
|
665
712
|
* Experimental feature - sign multiple transactions at once.
|
|
666
713
|
*
|
|
@@ -668,11 +715,11 @@ declare class MeshWallet implements IWallet {
|
|
|
668
715
|
* @param partialSign - if the transactions are signed partially
|
|
669
716
|
* @returns array of signed transactions CborHex string
|
|
670
717
|
*/
|
|
671
|
-
signTxs(unsignedTxs: string[], partialSign?: boolean): Promise<string[]>;
|
|
718
|
+
signTxs(unsignedTxs: string[], partialSign?: boolean, returnFullTx?: boolean): Promise<string[]>;
|
|
672
719
|
/**
|
|
673
720
|
* Submits the signed transaction to the blockchain network.
|
|
674
721
|
*
|
|
675
|
-
* As wallets should already have this ability to submit transaction, we allow
|
|
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.
|
|
676
723
|
*
|
|
677
724
|
* @param tx - a signed transaction in CBOR
|
|
678
725
|
* @returns a transaction hash
|
|
@@ -739,6 +786,7 @@ declare class MeshWallet implements IWallet {
|
|
|
739
786
|
pubDRepKey: string | undefined;
|
|
740
787
|
dRepIDBech32: string | undefined;
|
|
741
788
|
dRepIDHash: string | undefined;
|
|
789
|
+
dRepIDCip105: string | undefined;
|
|
742
790
|
};
|
|
743
791
|
/**
|
|
744
792
|
* Generate mnemonic or private key
|
|
@@ -751,4 +799,4 @@ declare class MeshWallet implements IWallet {
|
|
|
751
799
|
private buildAddressFromBech32Address;
|
|
752
800
|
}
|
|
753
801
|
|
|
754
|
-
export { type Account, AppWallet, type AppWalletKeyType, BrowserWallet, type CreateAppWalletOptions, type CreateEmbeddedWalletOptions, type CreateMeshWalletOptions, EmbeddedWallet, type EmbeddedWalletKeyType, MeshWallet, WalletStaticMethods, connect, login, register };
|
|
802
|
+
export { type Account, type AccountType, AppWallet, type AppWalletKeyType, BrowserWallet, type CreateAppWalletOptions, type CreateEmbeddedWalletOptions, type CreateMeshWalletOptions, EmbeddedWallet, type EmbeddedWalletKeyType, MeshWallet, WalletStaticMethods, connect, login, register };
|