@meshsdk/wallet 1.6.7 → 1.6.9
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 +12 -28
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +12 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -786,17 +786,6 @@ var BrowserWallet = class _BrowserWallet {
|
|
|
786
786
|
const usedAddresses = await this._walletInstance.getUsedAddresses();
|
|
787
787
|
return usedAddresses.map((usa) => (0, import_core_cst3.addressToBech32)((0, import_core_cst3.deserializeAddress)(usa)));
|
|
788
788
|
}
|
|
789
|
-
/**
|
|
790
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
791
|
-
*
|
|
792
|
-
* This is used in transaction building.
|
|
793
|
-
*
|
|
794
|
-
* @returns a list of UTXOs
|
|
795
|
-
*/
|
|
796
|
-
async getUsedCollateral(limit = import_common2.DEFAULT_PROTOCOL_PARAMETERS.maxCollateralInputs) {
|
|
797
|
-
const collateral = await this._walletInstance.experimental.getCollateral() ?? [];
|
|
798
|
-
return collateral.map((c) => (0, import_core_cst3.deserializeTxUnspentOutput)(c)).slice(0, limit);
|
|
799
|
-
}
|
|
800
789
|
/**
|
|
801
790
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
802
791
|
*
|
|
@@ -917,9 +906,18 @@ var BrowserWallet = class _BrowserWallet {
|
|
|
917
906
|
*
|
|
918
907
|
* @returns a list of UTXOs
|
|
919
908
|
*/
|
|
920
|
-
async getCollateralUnspentOutput() {
|
|
921
|
-
|
|
922
|
-
|
|
909
|
+
async getCollateralUnspentOutput(limit = import_common2.DEFAULT_PROTOCOL_PARAMETERS.maxCollateralInputs) {
|
|
910
|
+
let collateral = [];
|
|
911
|
+
try {
|
|
912
|
+
collateral = await this._walletInstance.getCollateral() ?? [];
|
|
913
|
+
} catch (e) {
|
|
914
|
+
try {
|
|
915
|
+
collateral = await this._walletInstance.experimental.getCollateral() ?? [];
|
|
916
|
+
} catch (e2) {
|
|
917
|
+
console.error(e2);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return collateral.map((c) => (0, import_core_cst3.deserializeTxUnspentOutput)(c)).slice(0, limit);
|
|
923
921
|
}
|
|
924
922
|
/**
|
|
925
923
|
* Get a list of UTXOs to be used for transaction building.
|
|
@@ -1255,20 +1253,6 @@ var MeshWallet = class {
|
|
|
1255
1253
|
getUsedAddresses() {
|
|
1256
1254
|
return [this.getChangeAddress()];
|
|
1257
1255
|
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
1260
|
-
*
|
|
1261
|
-
* This is used in transaction building.
|
|
1262
|
-
*
|
|
1263
|
-
* @returns a list of UTXOs
|
|
1264
|
-
*/
|
|
1265
|
-
async getUsedCollateral() {
|
|
1266
|
-
const collateralUtxo = await this.getCollateral();
|
|
1267
|
-
const unspentOutput = collateralUtxo.map((utxo) => {
|
|
1268
|
-
return (0, import_core_cst4.toTxUnspentOutput)(utxo);
|
|
1269
|
-
});
|
|
1270
|
-
return unspentOutput;
|
|
1271
|
-
}
|
|
1272
1256
|
/**
|
|
1273
1257
|
* Get a list of UTXOs to be used for transaction building.
|
|
1274
1258
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,7 @@ interface Cip30WalletApi {
|
|
|
27
27
|
getExtensions(): Promise<{
|
|
28
28
|
cip: number;
|
|
29
29
|
}[]>;
|
|
30
|
+
getCollateral(): Promise<string[] | undefined>;
|
|
30
31
|
getNetworkId(): Promise<number>;
|
|
31
32
|
getRewardAddresses(): Promise<string[]>;
|
|
32
33
|
getUnusedAddresses(): Promise<string[]>;
|
|
@@ -191,14 +192,6 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
191
192
|
* @returns a list of used addresses
|
|
192
193
|
*/
|
|
193
194
|
getUsedAddresses(): Promise<string[]>;
|
|
194
|
-
/**
|
|
195
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
196
|
-
*
|
|
197
|
-
* This is used in transaction building.
|
|
198
|
-
*
|
|
199
|
-
* @returns a list of UTXOs
|
|
200
|
-
*/
|
|
201
|
-
getUsedCollateral(limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
202
195
|
/**
|
|
203
196
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
204
197
|
*
|
|
@@ -253,7 +246,7 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
253
246
|
*
|
|
254
247
|
* @returns a list of UTXOs
|
|
255
248
|
*/
|
|
256
|
-
getCollateralUnspentOutput(): Promise<TransactionUnspentOutput[]>;
|
|
249
|
+
getCollateralUnspentOutput(limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
257
250
|
/**
|
|
258
251
|
* Get a list of UTXOs to be used for transaction building.
|
|
259
252
|
*
|
|
@@ -492,14 +485,6 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
492
485
|
* @returns a list of used addresses
|
|
493
486
|
*/
|
|
494
487
|
getUsedAddresses(): string[];
|
|
495
|
-
/**
|
|
496
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
497
|
-
*
|
|
498
|
-
* This is used in transaction building.
|
|
499
|
-
*
|
|
500
|
-
* @returns a list of UTXOs
|
|
501
|
-
*/
|
|
502
|
-
getUsedCollateral(): Promise<TransactionUnspentOutput[]>;
|
|
503
488
|
/**
|
|
504
489
|
* Get a list of UTXOs to be used for transaction building.
|
|
505
490
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ interface Cip30WalletApi {
|
|
|
27
27
|
getExtensions(): Promise<{
|
|
28
28
|
cip: number;
|
|
29
29
|
}[]>;
|
|
30
|
+
getCollateral(): Promise<string[] | undefined>;
|
|
30
31
|
getNetworkId(): Promise<number>;
|
|
31
32
|
getRewardAddresses(): Promise<string[]>;
|
|
32
33
|
getUnusedAddresses(): Promise<string[]>;
|
|
@@ -191,14 +192,6 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
191
192
|
* @returns a list of used addresses
|
|
192
193
|
*/
|
|
193
194
|
getUsedAddresses(): Promise<string[]>;
|
|
194
|
-
/**
|
|
195
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
196
|
-
*
|
|
197
|
-
* This is used in transaction building.
|
|
198
|
-
*
|
|
199
|
-
* @returns a list of UTXOs
|
|
200
|
-
*/
|
|
201
|
-
getUsedCollateral(limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
202
195
|
/**
|
|
203
196
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
204
197
|
*
|
|
@@ -253,7 +246,7 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
253
246
|
*
|
|
254
247
|
* @returns a list of UTXOs
|
|
255
248
|
*/
|
|
256
|
-
getCollateralUnspentOutput(): Promise<TransactionUnspentOutput[]>;
|
|
249
|
+
getCollateralUnspentOutput(limit?: number): Promise<TransactionUnspentOutput[]>;
|
|
257
250
|
/**
|
|
258
251
|
* Get a list of UTXOs to be used for transaction building.
|
|
259
252
|
*
|
|
@@ -492,14 +485,6 @@ declare class MeshWallet implements IInitiator, ISigner, ISubmitter {
|
|
|
492
485
|
* @returns a list of used addresses
|
|
493
486
|
*/
|
|
494
487
|
getUsedAddresses(): string[];
|
|
495
|
-
/**
|
|
496
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
497
|
-
*
|
|
498
|
-
* This is used in transaction building.
|
|
499
|
-
*
|
|
500
|
-
* @returns a list of UTXOs
|
|
501
|
-
*/
|
|
502
|
-
getUsedCollateral(): Promise<TransactionUnspentOutput[]>;
|
|
503
488
|
/**
|
|
504
489
|
* Get a list of UTXOs to be used for transaction building.
|
|
505
490
|
*
|
package/dist/index.js
CHANGED
|
@@ -796,17 +796,6 @@ var BrowserWallet = class _BrowserWallet {
|
|
|
796
796
|
const usedAddresses = await this._walletInstance.getUsedAddresses();
|
|
797
797
|
return usedAddresses.map((usa) => addressToBech32(deserializeAddress(usa)));
|
|
798
798
|
}
|
|
799
|
-
/**
|
|
800
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
801
|
-
*
|
|
802
|
-
* This is used in transaction building.
|
|
803
|
-
*
|
|
804
|
-
* @returns a list of UTXOs
|
|
805
|
-
*/
|
|
806
|
-
async getUsedCollateral(limit = DEFAULT_PROTOCOL_PARAMETERS.maxCollateralInputs) {
|
|
807
|
-
const collateral = await this._walletInstance.experimental.getCollateral() ?? [];
|
|
808
|
-
return collateral.map((c) => deserializeTxUnspentOutput(c)).slice(0, limit);
|
|
809
|
-
}
|
|
810
799
|
/**
|
|
811
800
|
* Return a list of all UTXOs (unspent transaction outputs) controlled by the wallet.
|
|
812
801
|
*
|
|
@@ -927,9 +916,18 @@ var BrowserWallet = class _BrowserWallet {
|
|
|
927
916
|
*
|
|
928
917
|
* @returns a list of UTXOs
|
|
929
918
|
*/
|
|
930
|
-
async getCollateralUnspentOutput() {
|
|
931
|
-
|
|
932
|
-
|
|
919
|
+
async getCollateralUnspentOutput(limit = DEFAULT_PROTOCOL_PARAMETERS.maxCollateralInputs) {
|
|
920
|
+
let collateral = [];
|
|
921
|
+
try {
|
|
922
|
+
collateral = await this._walletInstance.getCollateral() ?? [];
|
|
923
|
+
} catch (e) {
|
|
924
|
+
try {
|
|
925
|
+
collateral = await this._walletInstance.experimental.getCollateral() ?? [];
|
|
926
|
+
} catch (e2) {
|
|
927
|
+
console.error(e2);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return collateral.map((c) => deserializeTxUnspentOutput(c)).slice(0, limit);
|
|
933
931
|
}
|
|
934
932
|
/**
|
|
935
933
|
* Get a list of UTXOs to be used for transaction building.
|
|
@@ -1280,20 +1278,6 @@ var MeshWallet = class {
|
|
|
1280
1278
|
getUsedAddresses() {
|
|
1281
1279
|
return [this.getChangeAddress()];
|
|
1282
1280
|
}
|
|
1283
|
-
/**
|
|
1284
|
-
* Get a list of UTXOs to be used as collateral inputs for transactions with plutus script inputs.
|
|
1285
|
-
*
|
|
1286
|
-
* This is used in transaction building.
|
|
1287
|
-
*
|
|
1288
|
-
* @returns a list of UTXOs
|
|
1289
|
-
*/
|
|
1290
|
-
async getUsedCollateral() {
|
|
1291
|
-
const collateralUtxo = await this.getCollateral();
|
|
1292
|
-
const unspentOutput = collateralUtxo.map((utxo) => {
|
|
1293
|
-
return toTxUnspentOutput2(utxo);
|
|
1294
|
-
});
|
|
1295
|
-
return unspentOutput;
|
|
1296
|
-
}
|
|
1297
1281
|
/**
|
|
1298
1282
|
* Get a list of UTXOs to be used for transaction building.
|
|
1299
1283
|
*
|