@meshsdk/wallet 1.8.4 → 1.8.6

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
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,6 +30,266 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
30
  ));
28
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
32
 
33
+ // ../../node_modules/base32-encoding/index.js
34
+ var require_base32_encoding = __commonJS({
35
+ "../../node_modules/base32-encoding/index.js"(exports2) {
36
+ "use strict";
37
+ var std = "23456789abcdefghijkmnpqrstuvwxyz";
38
+ exports2.stringify = function(buf, alphabet2) {
39
+ if (alphabet2 == null) alphabet2 = std;
40
+ return from(base322(buf), (b) => alphabet2[b]).join("");
41
+ };
42
+ exports2.parse = function(str, alphabet2) {
43
+ if (alphabet2 == null) alphabet2 = std;
44
+ return base256(str.split("").map((s) => alphabet2.indexOf(s)));
45
+ };
46
+ function from(buf, map) {
47
+ var a = new Array(buf.length);
48
+ for (var i = 0; i < a.length; i++) {
49
+ a[i] = map(buf[i]);
50
+ }
51
+ return a;
52
+ }
53
+ exports2.encode = base322;
54
+ function base322(buf, arr, offset) {
55
+ exports2.encode.bytes = Math.ceil(buf.length * 8 / 5);
56
+ if (arr == null) arr = Buffer.alloc(exports2.encode.bytes);
57
+ if (offset == null) offset = 0;
58
+ for (var i = 0, j = offset; i + 5 <= buf.length; i += 5, j += 8) {
59
+ arr[j + 0] = (buf[i + 0] & 248) >>> 3;
60
+ arr[j + 1] = (buf[i + 0] & 7) << 2 | (buf[i + 1] & 192) >>> 6;
61
+ arr[j + 2] = (buf[i + 1] & 62) >>> 1;
62
+ arr[j + 3] = (buf[i + 1] & 1) << 4 | (buf[i + 2] & 240) >>> 4;
63
+ arr[j + 4] = (buf[i + 2] & 15) << 1 | (buf[i + 3] & 128) >>> 7;
64
+ arr[j + 5] = (buf[i + 3] & 124) >>> 2;
65
+ arr[j + 6] = (buf[i + 3] & 3) << 3 | (buf[i + 4] & 224) >>> 5;
66
+ arr[j + 7] = buf[i + 4] & 31;
67
+ }
68
+ switch (buf.length - i) {
69
+ // No need for 5 since we work in batches of 5 above
70
+ case 4:
71
+ arr[j + 4] |= (buf[i + 3] & 128) >>> 7;
72
+ arr[j + 5] |= (buf[i + 3] & 124) >>> 2;
73
+ arr[j + 6] |= (buf[i + 3] & 3) << 3;
74
+ case 3:
75
+ arr[j + 3] |= (buf[i + 2] & 240) >>> 4;
76
+ arr[j + 4] |= (buf[i + 2] & 15) << 1;
77
+ case 2:
78
+ arr[j + 1] |= (buf[i + 1] & 192) >>> 6;
79
+ arr[j + 2] |= (buf[i + 1] & 62) >>> 1;
80
+ arr[j + 3] |= (buf[i + 1] & 1) << 4;
81
+ case 1:
82
+ arr[j + 0] |= (buf[i + 0] & 248) >>> 3;
83
+ arr[j + 1] |= (buf[i + 0] & 7) << 2;
84
+ }
85
+ return arr;
86
+ }
87
+ exports2.decode = base256;
88
+ function base256(buf, arr, offset) {
89
+ exports2.decode.bytes = Math.floor(buf.length * 5 / 8);
90
+ if (arr == null) arr = Buffer.alloc(exports2.decode.bytes);
91
+ if (offset == null) offset = 0;
92
+ for (var i = 0, j = offset; i + 8 <= buf.length; i += 8, j += 5) {
93
+ arr[j + 0] = buf[i + 0] << 3 & 255 | buf[i + 1] >>> 2 & 255;
94
+ arr[j + 1] = buf[i + 1] << 6 & 255 | buf[i + 2] << 1 & 255 | buf[i + 3] >>> 4 & 255;
95
+ arr[j + 2] = buf[i + 3] << 4 & 255 | buf[i + 4] >>> 1 & 255;
96
+ arr[j + 3] = buf[i + 4] << 7 & 255 | buf[i + 5] << 2 & 255 | buf[i + 6] >> 3 & 255;
97
+ arr[j + 4] = buf[i + 6] << 5 & 255 | buf[i + 7] & 255;
98
+ }
99
+ switch (buf.length - i) {
100
+ case 7:
101
+ arr[j + 3] |= buf[i + 6] >> 3 & 255;
102
+ arr[j + 4] |= buf[i + 6] << 5 & 255;
103
+ case 6:
104
+ arr[j + 3] |= buf[i + 5] << 2 & 255;
105
+ case 5:
106
+ arr[j + 2] |= buf[i + 4] >>> 1 & 255;
107
+ arr[j + 3] |= buf[i + 4] << 7 & 255;
108
+ case 4:
109
+ arr[j + 1] |= buf[i + 3] >>> 4 & 255;
110
+ arr[j + 2] |= buf[i + 3] << 4 & 255;
111
+ case 3:
112
+ arr[j + 1] |= buf[i + 2] << 1 & 255;
113
+ case 2:
114
+ arr[j + 0] |= buf[i + 1] >>> 2 & 255;
115
+ arr[j + 1] |= buf[i + 1] << 6 & 255;
116
+ case 1:
117
+ arr[j + 0] |= buf[i + 0] << 3 & 255;
118
+ }
119
+ return arr;
120
+ }
121
+ exports2.encodingLength = function(buf) {
122
+ return Math.ceil(buf.length * 8 / 5);
123
+ };
124
+ }
125
+ });
126
+
127
+ // ../../node_modules/bech32/dist/index.js
128
+ var require_dist = __commonJS({
129
+ "../../node_modules/bech32/dist/index.js"(exports2) {
130
+ "use strict";
131
+ Object.defineProperty(exports2, "__esModule", { value: true });
132
+ exports2.bech32m = exports2.bech32 = void 0;
133
+ var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
134
+ var ALPHABET_MAP = {};
135
+ for (let z = 0; z < ALPHABET.length; z++) {
136
+ const x = ALPHABET.charAt(z);
137
+ ALPHABET_MAP[x] = z;
138
+ }
139
+ function polymodStep(pre) {
140
+ const b = pre >> 25;
141
+ return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
142
+ }
143
+ function prefixChk(prefix) {
144
+ let chk = 1;
145
+ for (let i = 0; i < prefix.length; ++i) {
146
+ const c = prefix.charCodeAt(i);
147
+ if (c < 33 || c > 126)
148
+ return "Invalid prefix (" + prefix + ")";
149
+ chk = polymodStep(chk) ^ c >> 5;
150
+ }
151
+ chk = polymodStep(chk);
152
+ for (let i = 0; i < prefix.length; ++i) {
153
+ const v = prefix.charCodeAt(i);
154
+ chk = polymodStep(chk) ^ v & 31;
155
+ }
156
+ return chk;
157
+ }
158
+ function convert(data, inBits, outBits, pad) {
159
+ let value = 0;
160
+ let bits = 0;
161
+ const maxV = (1 << outBits) - 1;
162
+ const result = [];
163
+ for (let i = 0; i < data.length; ++i) {
164
+ value = value << inBits | data[i];
165
+ bits += inBits;
166
+ while (bits >= outBits) {
167
+ bits -= outBits;
168
+ result.push(value >> bits & maxV);
169
+ }
170
+ }
171
+ if (pad) {
172
+ if (bits > 0) {
173
+ result.push(value << outBits - bits & maxV);
174
+ }
175
+ } else {
176
+ if (bits >= inBits)
177
+ return "Excess padding";
178
+ if (value << outBits - bits & maxV)
179
+ return "Non-zero padding";
180
+ }
181
+ return result;
182
+ }
183
+ function toWords(bytes) {
184
+ return convert(bytes, 8, 5, true);
185
+ }
186
+ function fromWordsUnsafe(words) {
187
+ const res = convert(words, 5, 8, false);
188
+ if (Array.isArray(res))
189
+ return res;
190
+ }
191
+ function fromWords(words) {
192
+ const res = convert(words, 5, 8, false);
193
+ if (Array.isArray(res))
194
+ return res;
195
+ throw new Error(res);
196
+ }
197
+ function getLibraryFromEncoding(encoding) {
198
+ let ENCODING_CONST;
199
+ if (encoding === "bech32") {
200
+ ENCODING_CONST = 1;
201
+ } else {
202
+ ENCODING_CONST = 734539939;
203
+ }
204
+ function encode(prefix, words, LIMIT) {
205
+ LIMIT = LIMIT || 90;
206
+ if (prefix.length + 7 + words.length > LIMIT)
207
+ throw new TypeError("Exceeds length limit");
208
+ prefix = prefix.toLowerCase();
209
+ let chk = prefixChk(prefix);
210
+ if (typeof chk === "string")
211
+ throw new Error(chk);
212
+ let result = prefix + "1";
213
+ for (let i = 0; i < words.length; ++i) {
214
+ const x = words[i];
215
+ if (x >> 5 !== 0)
216
+ throw new Error("Non 5-bit word");
217
+ chk = polymodStep(chk) ^ x;
218
+ result += ALPHABET.charAt(x);
219
+ }
220
+ for (let i = 0; i < 6; ++i) {
221
+ chk = polymodStep(chk);
222
+ }
223
+ chk ^= ENCODING_CONST;
224
+ for (let i = 0; i < 6; ++i) {
225
+ const v = chk >> (5 - i) * 5 & 31;
226
+ result += ALPHABET.charAt(v);
227
+ }
228
+ return result;
229
+ }
230
+ function __decode(str, LIMIT) {
231
+ LIMIT = LIMIT || 90;
232
+ if (str.length < 8)
233
+ return str + " too short";
234
+ if (str.length > LIMIT)
235
+ return "Exceeds length limit";
236
+ const lowered = str.toLowerCase();
237
+ const uppered = str.toUpperCase();
238
+ if (str !== lowered && str !== uppered)
239
+ return "Mixed-case string " + str;
240
+ str = lowered;
241
+ const split = str.lastIndexOf("1");
242
+ if (split === -1)
243
+ return "No separator character for " + str;
244
+ if (split === 0)
245
+ return "Missing prefix for " + str;
246
+ const prefix = str.slice(0, split);
247
+ const wordChars = str.slice(split + 1);
248
+ if (wordChars.length < 6)
249
+ return "Data too short";
250
+ let chk = prefixChk(prefix);
251
+ if (typeof chk === "string")
252
+ return chk;
253
+ const words = [];
254
+ for (let i = 0; i < wordChars.length; ++i) {
255
+ const c = wordChars.charAt(i);
256
+ const v = ALPHABET_MAP[c];
257
+ if (v === void 0)
258
+ return "Unknown character " + c;
259
+ chk = polymodStep(chk) ^ v;
260
+ if (i + 6 >= wordChars.length)
261
+ continue;
262
+ words.push(v);
263
+ }
264
+ if (chk !== ENCODING_CONST)
265
+ return "Invalid checksum for " + str;
266
+ return { prefix, words };
267
+ }
268
+ function decodeUnsafe(str, LIMIT) {
269
+ const res = __decode(str, LIMIT);
270
+ if (typeof res === "object")
271
+ return res;
272
+ }
273
+ function decode(str, LIMIT) {
274
+ const res = __decode(str, LIMIT);
275
+ if (typeof res === "object")
276
+ return res;
277
+ throw new Error(res);
278
+ }
279
+ return {
280
+ decodeUnsafe,
281
+ decode,
282
+ encode,
283
+ toWords,
284
+ fromWordsUnsafe,
285
+ fromWords
286
+ };
287
+ }
288
+ exports2.bech32 = getLibraryFromEncoding("bech32");
289
+ exports2.bech32m = getLibraryFromEncoding("bech32m");
290
+ }
291
+ });
292
+
30
293
  // src/index.ts
31
294
  var index_exports = {};
32
295
  __export(index_exports, {
@@ -34,7 +297,10 @@ __export(index_exports, {
34
297
  BrowserWallet: () => BrowserWallet,
35
298
  EmbeddedWallet: () => EmbeddedWallet,
36
299
  MeshWallet: () => MeshWallet,
37
- WalletStaticMethods: () => WalletStaticMethods
300
+ WalletStaticMethods: () => WalletStaticMethods,
301
+ connect: () => connect,
302
+ login: () => login,
303
+ register: () => register
38
304
  });
39
305
  module.exports = __toCommonJS(index_exports);
40
306
 
@@ -303,8 +569,8 @@ var bech32 = /* @__PURE__ */ genBech32("bech32");
303
569
  var import_common = require("@meshsdk/common");
304
570
  var import_core_cst = require("@meshsdk/core-cst");
305
571
  var WalletStaticMethods = class {
306
- static privateKeyToEntropy(bech322) {
307
- const bech32DecodedBytes = bech32.decodeToBytes(bech322).bytes;
572
+ static privateKeyToEntropy(_bech32) {
573
+ const bech32DecodedBytes = bech32.decodeToBytes(_bech32).bytes;
308
574
  const bip32PrivateKey = import_core_cst.Bip32PrivateKey.fromBytes(bech32DecodedBytes);
309
575
  return (0, import_common.bytesToHex)(bip32PrivateKey.bytes());
310
576
  }
@@ -319,6 +585,10 @@ var WalletStaticMethods = class {
319
585
  stakeKey.startsWith("5820") ? stakeKey.slice(4) : stakeKey
320
586
  ];
321
587
  }
588
+ static bip32BytesToEntropy(bip32Bytes) {
589
+ const bip32PrivateKey = import_core_cst.Bip32PrivateKey.fromBytes(bip32Bytes);
590
+ return (0, import_common.bytesToHex)(bip32PrivateKey.bytes());
591
+ }
322
592
  static getAddresses(paymentKey, stakingKey, networkId = 0) {
323
593
  const baseAddress = (0, import_core_cst.buildBaseAddress)(
324
594
  networkId,
@@ -405,6 +675,11 @@ var EmbeddedWallet = class extends WalletStaticMethods {
405
675
  options.key.stake ?? "f0".repeat(32)
406
676
  );
407
677
  break;
678
+ case "bip32Bytes":
679
+ this._entropy = WalletStaticMethods.bip32BytesToEntropy(
680
+ options.key.bip32Bytes
681
+ );
682
+ break;
408
683
  }
409
684
  }
410
685
  getAccount(accountIndex = 0, keyIndex = 0) {
@@ -622,7 +897,7 @@ var AppWallet = class {
622
897
  }
623
898
  };
624
899
 
625
- // src/browser/index.ts
900
+ // src/browser/browser-wallet.ts
626
901
  var import_common2 = require("@meshsdk/common");
627
902
  var import_core_csl = require("@meshsdk/core-csl");
628
903
  var import_core_cst3 = require("@meshsdk/core-cst");
@@ -665,7 +940,7 @@ async function checkIfMetamaskInstalled(network = "preprod") {
665
940
  }
666
941
  }
667
942
 
668
- // src/browser/index.ts
943
+ // src/browser/browser-wallet.ts
669
944
  var BrowserWallet = class _BrowserWallet {
670
945
  constructor(_walletInstance, _walletName) {
671
946
  this._walletInstance = _walletInstance;
@@ -1158,10 +1433,170 @@ var BrowserWallet = class _BrowserWallet {
1158
1433
  }
1159
1434
  };
1160
1435
 
1436
+ // src/browser/webauthn/cardano/build-wallet-from-passkey.ts
1437
+ var import_base32_encoding = __toESM(require_base32_encoding(), 1);
1438
+ var import_bech32 = __toESM(require_dist(), 1);
1439
+ var import_core_cst4 = require("@meshsdk/core-cst");
1440
+ async function buildWalletFromPasskey(rawId, password, appSalt = "appSalt") {
1441
+ const entropy = await createEntropy(rawId, appSalt);
1442
+ return buildKey(Buffer.from(entropy), password);
1443
+ }
1444
+ function buildKey(entropy, password) {
1445
+ const bip32Key = import_core_cst4.Crypto.Bip32PrivateKey.fromBip39Entropy(entropy, password);
1446
+ const bytes = import_base32_encoding.default.encode(bip32Key.bytes());
1447
+ const bech32PrivateKey = import_bech32.bech32.encode("xprv", bytes, 1023);
1448
+ return {
1449
+ bech32PrivateKey
1450
+ };
1451
+ }
1452
+ async function createEntropy(rawId, appSalt) {
1453
+ const rawIdBytes = new Uint8Array(new TextEncoder().encode(rawId));
1454
+ const saltBytes = new TextEncoder().encode(appSalt);
1455
+ const entropyBuffer = new Uint8Array([...rawIdBytes, ...saltBytes]);
1456
+ const entropy = await crypto.subtle.digest("SHA-256", entropyBuffer);
1457
+ return entropy;
1458
+ }
1459
+
1460
+ // src/browser/webauthn/common/error-codes/index.ts
1461
+ var ERRORCODES = {
1462
+ USEREXISTS: 1
1463
+ };
1464
+
1465
+ // src/browser/webauthn/auth/login.ts
1466
+ var import_browser = require("@simplewebauthn/browser");
1467
+ async function login({
1468
+ serverUrl,
1469
+ username
1470
+ }) {
1471
+ const initAuthRes = await fetch(`${serverUrl}/init-auth`, {
1472
+ credentials: "include",
1473
+ method: "POST",
1474
+ headers: {
1475
+ "Content-Type": "application/json"
1476
+ },
1477
+ body: JSON.stringify({
1478
+ username
1479
+ })
1480
+ });
1481
+ const initAuth = await initAuthRes.json();
1482
+ if (!initAuth.success) {
1483
+ return {
1484
+ success: false,
1485
+ error: initAuth.error,
1486
+ errorCode: initAuth.errorCode
1487
+ };
1488
+ }
1489
+ const optionsJSON = initAuth.optionsJSON;
1490
+ const authJSON = await (0, import_browser.startAuthentication)({ optionsJSON });
1491
+ const verifyAuthRes = await fetch(`${serverUrl}/verify-auth`, {
1492
+ credentials: "include",
1493
+ method: "POST",
1494
+ headers: {
1495
+ "Content-Type": "application/json"
1496
+ },
1497
+ body: JSON.stringify(authJSON)
1498
+ });
1499
+ const verifyAuth = await verifyAuthRes.json();
1500
+ if (!verifyAuthRes.ok) {
1501
+ return { success: false, error: verifyAuth.error };
1502
+ }
1503
+ if (verifyAuth.verified) {
1504
+ return { success: true, authJSON };
1505
+ } else {
1506
+ return { success: false, error: "Failed to log in" };
1507
+ }
1508
+ }
1509
+
1510
+ // src/browser/webauthn/auth/register.ts
1511
+ var import_browser2 = require("@simplewebauthn/browser");
1512
+ async function register({
1513
+ serverUrl,
1514
+ username
1515
+ }) {
1516
+ const initRegisterRes = await fetch(`${serverUrl}/init-register`, {
1517
+ credentials: "include",
1518
+ method: "POST",
1519
+ headers: {
1520
+ "Content-Type": "application/json"
1521
+ },
1522
+ body: JSON.stringify({
1523
+ username
1524
+ })
1525
+ });
1526
+ const initRegister = await initRegisterRes.json();
1527
+ if (!initRegister.success) {
1528
+ return {
1529
+ success: false,
1530
+ error: initRegister.error,
1531
+ errorCode: initRegister.errorCode
1532
+ };
1533
+ }
1534
+ const optionsJSON = initRegister.optionsJSON;
1535
+ const registrationJSON = await (0, import_browser2.startRegistration)({ optionsJSON });
1536
+ const verifyResponse = await fetch(`${serverUrl}/verify-register`, {
1537
+ credentials: "include",
1538
+ method: "POST",
1539
+ headers: {
1540
+ "Content-Type": "application/json"
1541
+ },
1542
+ body: JSON.stringify(registrationJSON)
1543
+ });
1544
+ const verifyData = await verifyResponse.json();
1545
+ if (!verifyResponse.ok) {
1546
+ console.error(verifyData.error);
1547
+ return {
1548
+ success: false,
1549
+ error: verifyData.error,
1550
+ errorCode: verifyData.errorCode
1551
+ };
1552
+ }
1553
+ if (verifyData.verified) {
1554
+ console.log(`Successfully registered ${username}`);
1555
+ return { success: true };
1556
+ } else {
1557
+ console.error(`Failed to register`);
1558
+ return { success: false, error: "Failed to register", errorCode: 1 };
1559
+ }
1560
+ }
1561
+
1562
+ // src/browser/webauthn/auth/connect.ts
1563
+ async function connect({
1564
+ username,
1565
+ password,
1566
+ serverUrl
1567
+ }) {
1568
+ const responseRegister = await register({ serverUrl, username });
1569
+ if (responseRegister.success || responseRegister.errorCode == ERRORCODES.USEREXISTS) {
1570
+ const loginRes = await handleLogin({ serverUrl, username });
1571
+ if (loginRes.success && loginRes.authJSON) {
1572
+ const wallet = await buildWalletFromPasskey(
1573
+ loginRes.authJSON.rawId,
1574
+ password
1575
+ );
1576
+ return { success: true, wallet };
1577
+ }
1578
+ } else {
1579
+ return { success: false, error: responseRegister.error };
1580
+ }
1581
+ return { success: false, error: "Fail to connect" };
1582
+ }
1583
+ async function handleLogin({
1584
+ serverUrl,
1585
+ username
1586
+ }) {
1587
+ const responseLogin = await login({ serverUrl, username });
1588
+ if (responseLogin.success && responseLogin.authJSON) {
1589
+ const authJSON = responseLogin.authJSON;
1590
+ return { success: true, authJSON };
1591
+ } else {
1592
+ return { success: false, error: responseLogin.error };
1593
+ }
1594
+ }
1595
+
1161
1596
  // src/mesh/index.ts
1162
- var import_common3 = require("@meshsdk/common");
1597
+ var import_common4 = require("@meshsdk/common");
1163
1598
  var import_core_csl2 = require("@meshsdk/core-csl");
1164
- var import_core_cst4 = require("@meshsdk/core-cst");
1599
+ var import_core_cst5 = require("@meshsdk/core-cst");
1165
1600
  var import_transaction = require("@meshsdk/transaction");
1166
1601
  var MeshWallet = class {
1167
1602
  _wallet;
@@ -1209,12 +1644,29 @@ var MeshWallet = class {
1209
1644
  });
1210
1645
  this.getAddressesFromWallet(this._wallet);
1211
1646
  break;
1647
+ case "bip32Bytes":
1648
+ this._wallet = new EmbeddedWallet({
1649
+ networkId: options.networkId,
1650
+ key: {
1651
+ type: "bip32Bytes",
1652
+ bip32Bytes: options.key.bip32Bytes
1653
+ }
1654
+ });
1655
+ this.getAddressesFromWallet(this._wallet);
1656
+ break;
1212
1657
  case "address":
1213
1658
  this._wallet = null;
1214
1659
  this.buildAddressFromBech32Address(options.key.address);
1215
1660
  break;
1216
1661
  }
1217
1662
  }
1663
+ /**
1664
+ * Returns all derived addresses from the wallet.
1665
+ * @returns a list of addresses
1666
+ */
1667
+ getAddresses() {
1668
+ return this.addresses;
1669
+ }
1218
1670
  /**
1219
1671
  * 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:
1220
1672
  * - A unit is provided to display asset's name on the user interface.
@@ -1226,7 +1678,7 @@ var MeshWallet = class {
1226
1678
  const utxos = await this.getUnspentOutputs();
1227
1679
  const assets = /* @__PURE__ */ new Map();
1228
1680
  utxos.map((utxo) => {
1229
- const _utxo = (0, import_core_cst4.fromTxUnspentOutput)(utxo);
1681
+ const _utxo = (0, import_core_cst5.fromTxUnspentOutput)(utxo);
1230
1682
  _utxo.output.amount.map((asset) => {
1231
1683
  const assetId = asset.unit;
1232
1684
  const amount = Number(asset.quantity);
@@ -1263,7 +1715,7 @@ var MeshWallet = class {
1263
1715
  async getCollateral(addressType = "payment") {
1264
1716
  const utxos = await this.getCollateralUnspentOutput(addressType);
1265
1717
  return utxos.map((utxo, i) => {
1266
- return (0, import_core_cst4.fromTxUnspentOutput)(utxo);
1718
+ return (0, import_core_cst5.fromTxUnspentOutput)(utxo);
1267
1719
  });
1268
1720
  }
1269
1721
  /**
@@ -1358,7 +1810,7 @@ var MeshWallet = class {
1358
1810
  */
1359
1811
  async getUtxos(addressType = "payment") {
1360
1812
  const utxos = await this.getUsedUTxOs(addressType);
1361
- return utxos.map((c) => (0, import_core_cst4.fromTxUnspentOutput)(c));
1813
+ return utxos.map((c) => (0, import_core_cst5.fromTxUnspentOutput)(c));
1362
1814
  }
1363
1815
  /**
1364
1816
  * 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.
@@ -1396,7 +1848,7 @@ var MeshWallet = class {
1396
1848
  "[MeshWallet] Read only wallet does not support signing data."
1397
1849
  );
1398
1850
  }
1399
- const tx = (0, import_core_cst4.deserializeTx)(unsignedTx);
1851
+ const tx = (0, import_core_cst5.deserializeTx)(unsignedTx);
1400
1852
  if (!partialSign && tx.witnessSet().vkeys() !== void 0 && tx.witnessSet().vkeys().size() !== 0)
1401
1853
  throw new Error(
1402
1854
  "Signatures already exist in the transaction in a non partial sign call"
@@ -1455,9 +1907,9 @@ var MeshWallet = class {
1455
1907
  */
1456
1908
  getUsedAddress(addressType = "payment") {
1457
1909
  if (this.addresses.baseAddressBech32 && addressType === "payment") {
1458
- return (0, import_core_cst4.toAddress)(this.addresses.baseAddressBech32);
1910
+ return (0, import_core_cst5.toAddress)(this.addresses.baseAddressBech32);
1459
1911
  } else {
1460
- return (0, import_core_cst4.toAddress)(this.addresses.enterpriseAddressBech32);
1912
+ return (0, import_core_cst5.toAddress)(this.addresses.enterpriseAddressBech32);
1461
1913
  }
1462
1914
  }
1463
1915
  /**
@@ -1477,7 +1929,7 @@ var MeshWallet = class {
1477
1929
  const utxos = await this._fetcher.fetchAddressUTxOs(
1478
1930
  this.addresses.baseAddressBech32 && addressType == "payment" ? this.addresses.baseAddressBech32 : this.addresses.enterpriseAddressBech32
1479
1931
  );
1480
- return utxos.map((utxo) => (0, import_core_cst4.toTxUnspentOutput)(utxo));
1932
+ return utxos.map((utxo) => (0, import_core_cst5.toTxUnspentOutput)(utxo));
1481
1933
  }
1482
1934
  /**
1483
1935
  * A helper function to get the assets in the wallet.
@@ -1487,13 +1939,13 @@ var MeshWallet = class {
1487
1939
  async getAssets() {
1488
1940
  const balance = await this.getBalance();
1489
1941
  return balance.filter((v) => v.unit !== "lovelace").map((v) => {
1490
- const policyId = v.unit.slice(0, import_common3.POLICY_ID_LENGTH);
1491
- const assetName = v.unit.slice(import_common3.POLICY_ID_LENGTH);
1492
- const fingerprint = (0, import_common3.resolveFingerprint)(policyId, assetName);
1942
+ const policyId = v.unit.slice(0, import_common4.POLICY_ID_LENGTH);
1943
+ const assetName = v.unit.slice(import_common4.POLICY_ID_LENGTH);
1944
+ const fingerprint = (0, import_common4.resolveFingerprint)(policyId, assetName);
1493
1945
  return {
1494
1946
  unit: v.unit,
1495
1947
  policyId,
1496
- assetName: (0, import_common3.toUTF8)(assetName),
1948
+ assetName: (0, import_common4.toUTF8)(assetName),
1497
1949
  fingerprint,
1498
1950
  quantity: v.quantity
1499
1951
  };
@@ -1527,7 +1979,7 @@ var MeshWallet = class {
1527
1979
  async getPolicyIds() {
1528
1980
  const balance = await this.getBalance();
1529
1981
  return Array.from(
1530
- new Set(balance.map((v) => v.unit.slice(0, import_common3.POLICY_ID_LENGTH)))
1982
+ new Set(balance.map((v) => v.unit.slice(0, import_common4.POLICY_ID_LENGTH)))
1531
1983
  ).filter((p) => p !== "lovelace");
1532
1984
  }
1533
1985
  async getRegisteredPubStakeKeys() {
@@ -1588,40 +2040,40 @@ var MeshWallet = class {
1588
2040
  buildAddressFromBech32Address(address) {
1589
2041
  let pubKeyHash = void 0;
1590
2042
  let stakeKeyHash = void 0;
1591
- const baseAddress = import_core_cst4.Address.fromBech32(address).asBase();
2043
+ const baseAddress = import_core_cst5.Address.fromBech32(address).asBase();
1592
2044
  if (baseAddress) {
1593
2045
  pubKeyHash = baseAddress.getPaymentCredential().hash;
1594
2046
  stakeKeyHash = baseAddress.getStakeCredential().hash;
1595
2047
  }
1596
- const enterpriseAddress = import_core_cst4.Address.fromBech32(address).asEnterprise();
2048
+ const enterpriseAddress = import_core_cst5.Address.fromBech32(address).asEnterprise();
1597
2049
  if (enterpriseAddress) {
1598
2050
  pubKeyHash = enterpriseAddress.getPaymentCredential().hash;
1599
2051
  }
1600
- const rewardAddress = import_core_cst4.Address.fromBech32(address).asReward();
2052
+ const rewardAddress = import_core_cst5.Address.fromBech32(address).asReward();
1601
2053
  if (rewardAddress) {
1602
2054
  stakeKeyHash = rewardAddress.getPaymentCredential().hash;
1603
2055
  }
1604
2056
  if (pubKeyHash && stakeKeyHash) {
1605
- this.addresses.baseAddress = (0, import_core_cst4.buildBaseAddress)(
2057
+ this.addresses.baseAddress = (0, import_core_cst5.buildBaseAddress)(
1606
2058
  this._networkId,
1607
- import_core_cst4.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst4.Ed25519KeyHashHex)(pubKeyHash)),
1608
- import_core_cst4.Hash28ByteBase16.fromEd25519KeyHashHex(
1609
- (0, import_core_cst4.Ed25519KeyHashHex)((0, import_core_cst4.Ed25519KeyHashHex)(stakeKeyHash))
2059
+ import_core_cst5.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst5.Ed25519KeyHashHex)(pubKeyHash)),
2060
+ import_core_cst5.Hash28ByteBase16.fromEd25519KeyHashHex(
2061
+ (0, import_core_cst5.Ed25519KeyHashHex)((0, import_core_cst5.Ed25519KeyHashHex)(stakeKeyHash))
1610
2062
  )
1611
2063
  ).toAddress();
1612
2064
  this.addresses.baseAddressBech32 = this.addresses.baseAddress.toBech32();
1613
2065
  }
1614
2066
  if (pubKeyHash) {
1615
- this.addresses.enterpriseAddress = (0, import_core_cst4.buildEnterpriseAddress)(
2067
+ this.addresses.enterpriseAddress = (0, import_core_cst5.buildEnterpriseAddress)(
1616
2068
  this._networkId,
1617
- import_core_cst4.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst4.Ed25519KeyHashHex)(pubKeyHash))
2069
+ import_core_cst5.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst5.Ed25519KeyHashHex)(pubKeyHash))
1618
2070
  ).toAddress();
1619
2071
  this.addresses.enterpriseAddressBech32 = this.addresses.enterpriseAddress.toBech32();
1620
2072
  }
1621
2073
  if (stakeKeyHash) {
1622
- this.addresses.rewardAddress = (0, import_core_cst4.buildRewardAddress)(
2074
+ this.addresses.rewardAddress = (0, import_core_cst5.buildRewardAddress)(
1623
2075
  this._networkId,
1624
- import_core_cst4.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst4.Ed25519KeyHashHex)(stakeKeyHash))
2076
+ import_core_cst5.Hash28ByteBase16.fromEd25519KeyHashHex((0, import_core_cst5.Ed25519KeyHashHex)(stakeKeyHash))
1625
2077
  ).toAddress();
1626
2078
  this.addresses.rewardAddressBech32 = this.addresses.rewardAddress.toBech32();
1627
2079
  }
@@ -1633,7 +2085,10 @@ var MeshWallet = class {
1633
2085
  BrowserWallet,
1634
2086
  EmbeddedWallet,
1635
2087
  MeshWallet,
1636
- WalletStaticMethods
2088
+ WalletStaticMethods,
2089
+ connect,
2090
+ login,
2091
+ register
1637
2092
  });
1638
2093
  /*! Bundled license information:
1639
2094