@meshsdk/wallet 1.7.3 → 1.7.4

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 CHANGED
@@ -982,6 +982,29 @@ var BrowserWallet = class _BrowserWallet {
982
982
  new Set(balance.map((v) => v.unit.slice(0, import_common2.POLICY_ID_LENGTH)))
983
983
  ).filter((p) => p !== "lovelace");
984
984
  }
985
+ /**
986
+ * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
987
+ * 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.
988
+ *
989
+ * @returns wallet account's public DRep Key
990
+ */
991
+ async getDRep() {
992
+ try {
993
+ if (this._walletInstance.cip95 === void 0) return void 0;
994
+ const dRepKey = await this._walletInstance.cip95.getPubDRepKey();
995
+ const { dRepIDHash } = await _BrowserWallet.dRepKeyToDRepID(dRepKey);
996
+ const csldRepIdKeyHash = import_core_csl.csl.PublicKey.from_hex(dRepKey).hash();
997
+ const dRepId = csldRepIdKeyHash.to_bech32("drep");
998
+ return {
999
+ publicKey: dRepKey,
1000
+ publicKeyHash: dRepIDHash,
1001
+ dRepIDCip105: dRepId
1002
+ };
1003
+ } catch (e) {
1004
+ console.error(e);
1005
+ return void 0;
1006
+ }
1007
+ }
985
1008
  /**
986
1009
  * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
987
1010
  * 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.
package/dist/index.d.cts CHANGED
@@ -280,6 +280,17 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
280
280
  * @returns a list of policy IDs
281
281
  */
282
282
  getPolicyIds(): Promise<string[]>;
283
+ /**
284
+ * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
285
+ * 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.
286
+ *
287
+ * @returns wallet account's public DRep Key
288
+ */
289
+ getDRep(): Promise<{
290
+ publicKey: string;
291
+ publicKeyHash: string;
292
+ dRepIDCip105: string;
293
+ } | undefined>;
283
294
  /**
284
295
  * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
285
296
  * 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.
package/dist/index.d.ts CHANGED
@@ -280,6 +280,17 @@ declare class BrowserWallet implements IInitiator, ISigner, ISubmitter {
280
280
  * @returns a list of policy IDs
281
281
  */
282
282
  getPolicyIds(): Promise<string[]>;
283
+ /**
284
+ * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
285
+ * 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.
286
+ *
287
+ * @returns wallet account's public DRep Key
288
+ */
289
+ getDRep(): Promise<{
290
+ publicKey: string;
291
+ publicKeyHash: string;
292
+ dRepIDCip105: string;
293
+ } | undefined>;
283
294
  /**
284
295
  * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
285
296
  * 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.
package/dist/index.js CHANGED
@@ -991,6 +991,29 @@ var BrowserWallet = class _BrowserWallet {
991
991
  new Set(balance.map((v) => v.unit.slice(0, POLICY_ID_LENGTH)))
992
992
  ).filter((p) => p !== "lovelace");
993
993
  }
994
+ /**
995
+ * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
996
+ * 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.
997
+ *
998
+ * @returns wallet account's public DRep Key
999
+ */
1000
+ async getDRep() {
1001
+ try {
1002
+ if (this._walletInstance.cip95 === void 0) return void 0;
1003
+ const dRepKey = await this._walletInstance.cip95.getPubDRepKey();
1004
+ const { dRepIDHash } = await _BrowserWallet.dRepKeyToDRepID(dRepKey);
1005
+ const csldRepIdKeyHash = csl.PublicKey.from_hex(dRepKey).hash();
1006
+ const dRepId = csldRepIdKeyHash.to_bech32("drep");
1007
+ return {
1008
+ publicKey: dRepKey,
1009
+ publicKeyHash: dRepIDHash,
1010
+ dRepIDCip105: dRepId
1011
+ };
1012
+ } catch (e) {
1013
+ console.error(e);
1014
+ return void 0;
1015
+ }
1016
+ }
994
1017
  /**
995
1018
  * The connected wallet account provides the account's public DRep Key, derivation as described in CIP-0105.
996
1019
  * 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/wallet",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -34,10 +34,10 @@
34
34
  "typescript": "^5.3.3"
35
35
  },
36
36
  "dependencies": {
37
- "@meshsdk/common": "1.7.3",
38
- "@meshsdk/core-csl": "1.7.3",
39
- "@meshsdk/core-cst": "1.7.3",
40
- "@meshsdk/transaction": "1.7.3",
37
+ "@meshsdk/common": "1.7.4",
38
+ "@meshsdk/core-csl": "1.7.4",
39
+ "@meshsdk/core-cst": "1.7.4",
40
+ "@meshsdk/transaction": "1.7.4",
41
41
  "@nufi/dapp-client-cardano": "^0.3.1",
42
42
  "@nufi/dapp-client-core": "^0.3.1"
43
43
  },