@meshsdk/wallet 1.6.2 → 1.6.3
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 +1470 -1
- package/dist/index.d.cts +66 -32
- package/dist/index.d.ts +66 -32
- package/dist/index.js +1492 -1
- package/package.json +11 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { DataSignature, IFetcher, ISubmitter, ISigner, IInitiator, Wallet, Asset, UTxO, AssetExtended } from '@meshsdk/common';
|
|
2
|
-
import { TransactionUnspentOutput, Address,
|
|
2
|
+
import { TransactionUnspentOutput, Address, StricaPrivateKey, VkeyWitness } from '@meshsdk/core-cst';
|
|
3
3
|
|
|
4
4
|
type Cardano = {
|
|
5
5
|
[key: string]: {
|
|
6
6
|
name: string;
|
|
7
7
|
icon: string;
|
|
8
8
|
apiVersion: string;
|
|
9
|
-
enable: (
|
|
9
|
+
enable: (extensions?: {
|
|
10
|
+
extensions: {
|
|
11
|
+
cip: number;
|
|
12
|
+
}[];
|
|
13
|
+
}) => Promise<WalletInstance>;
|
|
14
|
+
supportedExtensions?: {
|
|
15
|
+
cip: number;
|
|
16
|
+
}[];
|
|
10
17
|
};
|
|
11
18
|
};
|
|
12
19
|
type TransactionSignatureRequest = {
|
|
@@ -17,6 +24,9 @@ type WalletInstance = {
|
|
|
17
24
|
experimental: ExperimentalFeatures;
|
|
18
25
|
getBalance(): Promise<string>;
|
|
19
26
|
getChangeAddress(): Promise<string>;
|
|
27
|
+
getExtensions(): Promise<{
|
|
28
|
+
cip: number;
|
|
29
|
+
}[]>;
|
|
20
30
|
getNetworkId(): Promise<number>;
|
|
21
31
|
getRewardAddresses(): Promise<string[]>;
|
|
22
32
|
getUnusedAddresses(): Promise<string[]>;
|
|
@@ -27,6 +37,11 @@ type WalletInstance = {
|
|
|
27
37
|
signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
|
|
28
38
|
signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
|
|
29
39
|
submitTx(tx: string): Promise<string>;
|
|
40
|
+
cip95?: WalletInstanceCip95;
|
|
41
|
+
};
|
|
42
|
+
type WalletInstanceCip95 = {
|
|
43
|
+
getPubDRepKey(): Promise<string>;
|
|
44
|
+
getRegisteredPubStakeKeys(): Promise<string[]>;
|
|
30
45
|
};
|
|
31
46
|
type ExperimentalFeatures = {
|
|
32
47
|
getCollateral(): Promise<string[] | undefined>;
|
|
@@ -97,7 +112,11 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
97
112
|
*
|
|
98
113
|
* @returns a list of wallet names
|
|
99
114
|
*/
|
|
100
|
-
static
|
|
115
|
+
static getAvailableWallets({ metamask, }?: {
|
|
116
|
+
metamask?: {
|
|
117
|
+
network: string;
|
|
118
|
+
};
|
|
119
|
+
}): Promise<Wallet[]>;
|
|
101
120
|
/**
|
|
102
121
|
* Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
|
|
103
122
|
* - A name is provided to display wallet's name on the user interface.
|
|
@@ -106,22 +125,17 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
106
125
|
*
|
|
107
126
|
* @returns a list of wallet names
|
|
108
127
|
*/
|
|
109
|
-
static
|
|
110
|
-
nufiNetwork?: string;
|
|
111
|
-
}): Promise<Wallet[]>;
|
|
128
|
+
static getInstalledWallets(): Wallet[];
|
|
112
129
|
/**
|
|
113
130
|
* 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 dApp to use.
|
|
114
131
|
*
|
|
115
132
|
* 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.
|
|
116
133
|
*
|
|
117
|
-
* @param walletName
|
|
134
|
+
* @param walletName - the name of the wallet to enable (e.g. "eternl", "begin", "nufiSnap")
|
|
135
|
+
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
118
136
|
* @returns WalletInstance
|
|
119
137
|
*/
|
|
120
|
-
static enable(walletName: string): Promise<BrowserWallet>;
|
|
121
|
-
/**
|
|
122
|
-
* Retrieves the total available balance of the wallet, encoded in CBOR.
|
|
123
|
-
* @returns {Promise<Value>} - The balance of the wallet.
|
|
124
|
-
*/
|
|
138
|
+
static enable(walletName: string, extensions?: number[]): Promise<BrowserWallet>;
|
|
125
139
|
/**
|
|
126
140
|
* 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:
|
|
127
141
|
* - A unit is provided to display asset's name on the user interface.
|
|
@@ -145,6 +159,12 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
145
159
|
* @returns a list of UTXOs
|
|
146
160
|
*/
|
|
147
161
|
getCollateral(): Promise<UTxO[]>;
|
|
162
|
+
/**
|
|
163
|
+
* Return a list of supported CIPs of the wallet.
|
|
164
|
+
*
|
|
165
|
+
* @returns a list of CIPs
|
|
166
|
+
*/
|
|
167
|
+
getExtensions(): Promise<number[]>;
|
|
148
168
|
/**
|
|
149
169
|
* 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.
|
|
150
170
|
*
|
|
@@ -184,20 +204,18 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
184
204
|
*/
|
|
185
205
|
getUtxos(): Promise<UTxO[]>;
|
|
186
206
|
/**
|
|
187
|
-
* This endpoint utilizes the [CIP-8 - Message Signing](https://
|
|
188
|
-
*
|
|
189
|
-
* Here, we get the first wallet's address with wallet.getUsedAddresses(), alternativelly you can use reward addresses (getRewardAddresses()) too. It's really up to you as the developer which address you want to use in your application.
|
|
207
|
+
* 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.
|
|
190
208
|
*
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
209
|
+
* @param payload - the data to be signed
|
|
210
|
+
* @param address - optional, if not provided, the first staking address will be used
|
|
193
211
|
* @returns a signature
|
|
194
212
|
*/
|
|
195
|
-
signData(
|
|
213
|
+
signData(payload: string, address?: string): Promise<DataSignature>;
|
|
196
214
|
/**
|
|
197
215
|
* 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.
|
|
198
216
|
*
|
|
199
|
-
* @param unsignedTx
|
|
200
|
-
* @param partialSign
|
|
217
|
+
* @param unsignedTx - a transaction in CBOR
|
|
218
|
+
* @param partialSign - if the transaction is signed partially
|
|
201
219
|
* @returns a signed transaction in CBOR
|
|
202
220
|
*/
|
|
203
221
|
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
@@ -267,8 +285,20 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
267
285
|
* @returns a list of policy IDs
|
|
268
286
|
*/
|
|
269
287
|
getPolicyIds(): Promise<string[]>;
|
|
288
|
+
getPubDRepKey(): Promise<{
|
|
289
|
+
pubDRepKey: string;
|
|
290
|
+
dRepIDHash: string;
|
|
291
|
+
dRepIDBech32: string;
|
|
292
|
+
} | undefined>;
|
|
293
|
+
getRegisteredPubStakeKeys(): Promise<{
|
|
294
|
+
pubStakeKeys: string[];
|
|
295
|
+
pubStakeKeyHashes: string[];
|
|
296
|
+
} | undefined>;
|
|
270
297
|
private static resolveInstance;
|
|
271
298
|
static addBrowserWitnesses(unsignedTx: string, witnesses: string): string;
|
|
299
|
+
static getSupportedExtensions(wallet: string): {
|
|
300
|
+
cip: number;
|
|
301
|
+
}[];
|
|
272
302
|
}
|
|
273
303
|
|
|
274
304
|
type Account = {
|
|
@@ -278,8 +308,8 @@ type Account = {
|
|
|
278
308
|
baseAddressBech32: string;
|
|
279
309
|
enterpriseAddressBech32: string;
|
|
280
310
|
rewardAddressBech32: string;
|
|
281
|
-
paymentKey:
|
|
282
|
-
stakeKey:
|
|
311
|
+
paymentKey: StricaPrivateKey;
|
|
312
|
+
stakeKey: StricaPrivateKey;
|
|
283
313
|
paymentKeyHex: string;
|
|
284
314
|
stakeKeyHex: string;
|
|
285
315
|
};
|
|
@@ -302,7 +332,7 @@ declare class WalletStaticMethods {
|
|
|
302
332
|
static privateKeyToEntropy(bech32: string): string;
|
|
303
333
|
static mnemonicToEntropy(words: string[]): string;
|
|
304
334
|
static signingKeyToEntropy(paymentKey: string, stakeKey: string): [string, string];
|
|
305
|
-
static getAddresses(paymentKey:
|
|
335
|
+
static getAddresses(paymentKey: StricaPrivateKey, stakingKey: StricaPrivateKey, networkId?: number): {
|
|
306
336
|
baseAddress: Address;
|
|
307
337
|
enterpriseAddress: Address;
|
|
308
338
|
rewardAddress: Address;
|
|
@@ -387,6 +417,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
387
417
|
*
|
|
388
418
|
* 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.
|
|
389
419
|
*
|
|
420
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
390
421
|
* @returns a list of UTXOs
|
|
391
422
|
*/
|
|
392
423
|
getCollateral(addressType?: GetAddressType): Promise<UTxO[]>;
|
|
@@ -395,6 +426,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
395
426
|
*
|
|
396
427
|
* This is used in transaction building.
|
|
397
428
|
*
|
|
429
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
398
430
|
* @returns a list of UTXOs
|
|
399
431
|
*/
|
|
400
432
|
getCollateralUnspentOutput(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
@@ -435,30 +467,30 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
435
467
|
*
|
|
436
468
|
* This is used in transaction building.
|
|
437
469
|
*
|
|
470
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
438
471
|
* @returns a list of UTXOs
|
|
439
472
|
*/
|
|
440
473
|
getUsedUTxOs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
441
474
|
/**
|
|
442
475
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
443
476
|
*
|
|
477
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
444
478
|
* @returns a list of UTXOs
|
|
445
479
|
*/
|
|
446
480
|
getUtxos(addressType?: GetAddressType): Promise<UTxO[]>;
|
|
447
481
|
/**
|
|
448
|
-
* This endpoint utilizes the [CIP-8 - Message Signing](https://
|
|
449
|
-
*
|
|
450
|
-
* Here, we get the first wallet's address with wallet.getUsedAddresses(), alternativelly you can use reward addresses (getRewardAddresses()) too. It's really up to you as the developer which address you want to use in your application.
|
|
482
|
+
* 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.
|
|
451
483
|
*
|
|
452
|
-
* @param
|
|
453
|
-
* @param
|
|
484
|
+
* @param payload - the payload to sign
|
|
485
|
+
* @param address - the address to use for signing (optional)
|
|
454
486
|
* @returns a signature
|
|
455
487
|
*/
|
|
456
|
-
signData(payload: string): DataSignature;
|
|
488
|
+
signData(payload: string, address?: string): DataSignature;
|
|
457
489
|
/**
|
|
458
490
|
* 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.
|
|
459
491
|
*
|
|
460
|
-
* @param unsignedTx
|
|
461
|
-
* @param partialSign
|
|
492
|
+
* @param unsignedTx - a transaction in CBOR
|
|
493
|
+
* @param partialSign - if the transaction is partially signed (default: false)
|
|
462
494
|
* @returns a signed transaction in CBOR
|
|
463
495
|
*/
|
|
464
496
|
signTx(unsignedTx: string, partialSign?: boolean): string;
|
|
@@ -475,7 +507,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
475
507
|
*
|
|
476
508
|
* As wallets should already have this ability to submit transaction, we allow dApps 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 dApp to track. The wallet can return error messages or failure if there was an error in sending it.
|
|
477
509
|
*
|
|
478
|
-
* @param tx
|
|
510
|
+
* @param tx - a signed transaction in CBOR
|
|
479
511
|
* @returns a transaction hash
|
|
480
512
|
*/
|
|
481
513
|
submitTx(tx: string): Promise<string>;
|
|
@@ -484,6 +516,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
484
516
|
*
|
|
485
517
|
* This is used in transaction building.
|
|
486
518
|
*
|
|
519
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
487
520
|
* @returns an Address object
|
|
488
521
|
*/
|
|
489
522
|
getUsedAddress(addressType?: GetAddressType): Address;
|
|
@@ -492,6 +525,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
492
525
|
*
|
|
493
526
|
* This is used in transaction building.
|
|
494
527
|
*
|
|
528
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
495
529
|
* @returns a list of UTXOs
|
|
496
530
|
*/
|
|
497
531
|
getUnspentOutputs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { DataSignature, IFetcher, ISubmitter, ISigner, IInitiator, Wallet, Asset, UTxO, AssetExtended } from '@meshsdk/common';
|
|
2
|
-
import { TransactionUnspentOutput, Address,
|
|
2
|
+
import { TransactionUnspentOutput, Address, StricaPrivateKey, VkeyWitness } from '@meshsdk/core-cst';
|
|
3
3
|
|
|
4
4
|
type Cardano = {
|
|
5
5
|
[key: string]: {
|
|
6
6
|
name: string;
|
|
7
7
|
icon: string;
|
|
8
8
|
apiVersion: string;
|
|
9
|
-
enable: (
|
|
9
|
+
enable: (extensions?: {
|
|
10
|
+
extensions: {
|
|
11
|
+
cip: number;
|
|
12
|
+
}[];
|
|
13
|
+
}) => Promise<WalletInstance>;
|
|
14
|
+
supportedExtensions?: {
|
|
15
|
+
cip: number;
|
|
16
|
+
}[];
|
|
10
17
|
};
|
|
11
18
|
};
|
|
12
19
|
type TransactionSignatureRequest = {
|
|
@@ -17,6 +24,9 @@ type WalletInstance = {
|
|
|
17
24
|
experimental: ExperimentalFeatures;
|
|
18
25
|
getBalance(): Promise<string>;
|
|
19
26
|
getChangeAddress(): Promise<string>;
|
|
27
|
+
getExtensions(): Promise<{
|
|
28
|
+
cip: number;
|
|
29
|
+
}[]>;
|
|
20
30
|
getNetworkId(): Promise<number>;
|
|
21
31
|
getRewardAddresses(): Promise<string[]>;
|
|
22
32
|
getUnusedAddresses(): Promise<string[]>;
|
|
@@ -27,6 +37,11 @@ type WalletInstance = {
|
|
|
27
37
|
signTxs?(txs: TransactionSignatureRequest[]): Promise<string[]>;
|
|
28
38
|
signTxs?(txs: string[], partialSign: boolean): Promise<string[]>;
|
|
29
39
|
submitTx(tx: string): Promise<string>;
|
|
40
|
+
cip95?: WalletInstanceCip95;
|
|
41
|
+
};
|
|
42
|
+
type WalletInstanceCip95 = {
|
|
43
|
+
getPubDRepKey(): Promise<string>;
|
|
44
|
+
getRegisteredPubStakeKeys(): Promise<string[]>;
|
|
30
45
|
};
|
|
31
46
|
type ExperimentalFeatures = {
|
|
32
47
|
getCollateral(): Promise<string[] | undefined>;
|
|
@@ -97,7 +112,11 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
97
112
|
*
|
|
98
113
|
* @returns a list of wallet names
|
|
99
114
|
*/
|
|
100
|
-
static
|
|
115
|
+
static getAvailableWallets({ metamask, }?: {
|
|
116
|
+
metamask?: {
|
|
117
|
+
network: string;
|
|
118
|
+
};
|
|
119
|
+
}): Promise<Wallet[]>;
|
|
101
120
|
/**
|
|
102
121
|
* Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
|
|
103
122
|
* - A name is provided to display wallet's name on the user interface.
|
|
@@ -106,22 +125,17 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
106
125
|
*
|
|
107
126
|
* @returns a list of wallet names
|
|
108
127
|
*/
|
|
109
|
-
static
|
|
110
|
-
nufiNetwork?: string;
|
|
111
|
-
}): Promise<Wallet[]>;
|
|
128
|
+
static getInstalledWallets(): Wallet[];
|
|
112
129
|
/**
|
|
113
130
|
* 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 dApp to use.
|
|
114
131
|
*
|
|
115
132
|
* 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.
|
|
116
133
|
*
|
|
117
|
-
* @param walletName
|
|
134
|
+
* @param walletName - the name of the wallet to enable (e.g. "eternl", "begin", "nufiSnap")
|
|
135
|
+
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
118
136
|
* @returns WalletInstance
|
|
119
137
|
*/
|
|
120
|
-
static enable(walletName: string): Promise<BrowserWallet>;
|
|
121
|
-
/**
|
|
122
|
-
* Retrieves the total available balance of the wallet, encoded in CBOR.
|
|
123
|
-
* @returns {Promise<Value>} - The balance of the wallet.
|
|
124
|
-
*/
|
|
138
|
+
static enable(walletName: string, extensions?: number[]): Promise<BrowserWallet>;
|
|
125
139
|
/**
|
|
126
140
|
* 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:
|
|
127
141
|
* - A unit is provided to display asset's name on the user interface.
|
|
@@ -145,6 +159,12 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
145
159
|
* @returns a list of UTXOs
|
|
146
160
|
*/
|
|
147
161
|
getCollateral(): Promise<UTxO[]>;
|
|
162
|
+
/**
|
|
163
|
+
* Return a list of supported CIPs of the wallet.
|
|
164
|
+
*
|
|
165
|
+
* @returns a list of CIPs
|
|
166
|
+
*/
|
|
167
|
+
getExtensions(): Promise<number[]>;
|
|
148
168
|
/**
|
|
149
169
|
* 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.
|
|
150
170
|
*
|
|
@@ -184,20 +204,18 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
184
204
|
*/
|
|
185
205
|
getUtxos(): Promise<UTxO[]>;
|
|
186
206
|
/**
|
|
187
|
-
* This endpoint utilizes the [CIP-8 - Message Signing](https://
|
|
188
|
-
*
|
|
189
|
-
* Here, we get the first wallet's address with wallet.getUsedAddresses(), alternativelly you can use reward addresses (getRewardAddresses()) too. It's really up to you as the developer which address you want to use in your application.
|
|
207
|
+
* 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.
|
|
190
208
|
*
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
209
|
+
* @param payload - the data to be signed
|
|
210
|
+
* @param address - optional, if not provided, the first staking address will be used
|
|
193
211
|
* @returns a signature
|
|
194
212
|
*/
|
|
195
|
-
signData(
|
|
213
|
+
signData(payload: string, address?: string): Promise<DataSignature>;
|
|
196
214
|
/**
|
|
197
215
|
* 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.
|
|
198
216
|
*
|
|
199
|
-
* @param unsignedTx
|
|
200
|
-
* @param partialSign
|
|
217
|
+
* @param unsignedTx - a transaction in CBOR
|
|
218
|
+
* @param partialSign - if the transaction is signed partially
|
|
201
219
|
* @returns a signed transaction in CBOR
|
|
202
220
|
*/
|
|
203
221
|
signTx(unsignedTx: string, partialSign?: boolean): Promise<string>;
|
|
@@ -267,8 +285,20 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
267
285
|
* @returns a list of policy IDs
|
|
268
286
|
*/
|
|
269
287
|
getPolicyIds(): Promise<string[]>;
|
|
288
|
+
getPubDRepKey(): Promise<{
|
|
289
|
+
pubDRepKey: string;
|
|
290
|
+
dRepIDHash: string;
|
|
291
|
+
dRepIDBech32: string;
|
|
292
|
+
} | undefined>;
|
|
293
|
+
getRegisteredPubStakeKeys(): Promise<{
|
|
294
|
+
pubStakeKeys: string[];
|
|
295
|
+
pubStakeKeyHashes: string[];
|
|
296
|
+
} | undefined>;
|
|
270
297
|
private static resolveInstance;
|
|
271
298
|
static addBrowserWitnesses(unsignedTx: string, witnesses: string): string;
|
|
299
|
+
static getSupportedExtensions(wallet: string): {
|
|
300
|
+
cip: number;
|
|
301
|
+
}[];
|
|
272
302
|
}
|
|
273
303
|
|
|
274
304
|
type Account = {
|
|
@@ -278,8 +308,8 @@ type Account = {
|
|
|
278
308
|
baseAddressBech32: string;
|
|
279
309
|
enterpriseAddressBech32: string;
|
|
280
310
|
rewardAddressBech32: string;
|
|
281
|
-
paymentKey:
|
|
282
|
-
stakeKey:
|
|
311
|
+
paymentKey: StricaPrivateKey;
|
|
312
|
+
stakeKey: StricaPrivateKey;
|
|
283
313
|
paymentKeyHex: string;
|
|
284
314
|
stakeKeyHex: string;
|
|
285
315
|
};
|
|
@@ -302,7 +332,7 @@ declare class WalletStaticMethods {
|
|
|
302
332
|
static privateKeyToEntropy(bech32: string): string;
|
|
303
333
|
static mnemonicToEntropy(words: string[]): string;
|
|
304
334
|
static signingKeyToEntropy(paymentKey: string, stakeKey: string): [string, string];
|
|
305
|
-
static getAddresses(paymentKey:
|
|
335
|
+
static getAddresses(paymentKey: StricaPrivateKey, stakingKey: StricaPrivateKey, networkId?: number): {
|
|
306
336
|
baseAddress: Address;
|
|
307
337
|
enterpriseAddress: Address;
|
|
308
338
|
rewardAddress: Address;
|
|
@@ -387,6 +417,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
387
417
|
*
|
|
388
418
|
* 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.
|
|
389
419
|
*
|
|
420
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
390
421
|
* @returns a list of UTXOs
|
|
391
422
|
*/
|
|
392
423
|
getCollateral(addressType?: GetAddressType): Promise<UTxO[]>;
|
|
@@ -395,6 +426,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
395
426
|
*
|
|
396
427
|
* This is used in transaction building.
|
|
397
428
|
*
|
|
429
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
398
430
|
* @returns a list of UTXOs
|
|
399
431
|
*/
|
|
400
432
|
getCollateralUnspentOutput(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
@@ -435,30 +467,30 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
435
467
|
*
|
|
436
468
|
* This is used in transaction building.
|
|
437
469
|
*
|
|
470
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
438
471
|
* @returns a list of UTXOs
|
|
439
472
|
*/
|
|
440
473
|
getUsedUTxOs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|
|
441
474
|
/**
|
|
442
475
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
443
476
|
*
|
|
477
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
444
478
|
* @returns a list of UTXOs
|
|
445
479
|
*/
|
|
446
480
|
getUtxos(addressType?: GetAddressType): Promise<UTxO[]>;
|
|
447
481
|
/**
|
|
448
|
-
* This endpoint utilizes the [CIP-8 - Message Signing](https://
|
|
449
|
-
*
|
|
450
|
-
* Here, we get the first wallet's address with wallet.getUsedAddresses(), alternativelly you can use reward addresses (getRewardAddresses()) too. It's really up to you as the developer which address you want to use in your application.
|
|
482
|
+
* 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.
|
|
451
483
|
*
|
|
452
|
-
* @param
|
|
453
|
-
* @param
|
|
484
|
+
* @param payload - the payload to sign
|
|
485
|
+
* @param address - the address to use for signing (optional)
|
|
454
486
|
* @returns a signature
|
|
455
487
|
*/
|
|
456
|
-
signData(payload: string): DataSignature;
|
|
488
|
+
signData(payload: string, address?: string): DataSignature;
|
|
457
489
|
/**
|
|
458
490
|
* 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.
|
|
459
491
|
*
|
|
460
|
-
* @param unsignedTx
|
|
461
|
-
* @param partialSign
|
|
492
|
+
* @param unsignedTx - a transaction in CBOR
|
|
493
|
+
* @param partialSign - if the transaction is partially signed (default: false)
|
|
462
494
|
* @returns a signed transaction in CBOR
|
|
463
495
|
*/
|
|
464
496
|
signTx(unsignedTx: string, partialSign?: boolean): string;
|
|
@@ -475,7 +507,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
475
507
|
*
|
|
476
508
|
* As wallets should already have this ability to submit transaction, we allow dApps 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 dApp to track. The wallet can return error messages or failure if there was an error in sending it.
|
|
477
509
|
*
|
|
478
|
-
* @param tx
|
|
510
|
+
* @param tx - a signed transaction in CBOR
|
|
479
511
|
* @returns a transaction hash
|
|
480
512
|
*/
|
|
481
513
|
submitTx(tx: string): Promise<string>;
|
|
@@ -484,6 +516,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
484
516
|
*
|
|
485
517
|
* This is used in transaction building.
|
|
486
518
|
*
|
|
519
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
487
520
|
* @returns an Address object
|
|
488
521
|
*/
|
|
489
522
|
getUsedAddress(addressType?: GetAddressType): Address;
|
|
@@ -492,6 +525,7 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
492
525
|
*
|
|
493
526
|
* This is used in transaction building.
|
|
494
527
|
*
|
|
528
|
+
* @param addressType - the type of address to fetch UTXOs from (default: payment)
|
|
495
529
|
* @returns a list of UTXOs
|
|
496
530
|
*/
|
|
497
531
|
getUnspentOutputs(addressType?: GetAddressType): Promise<TransactionUnspentOutput[]>;
|