@leofcoin/chain 1.10.1 → 1.10.2
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/exports/browser/{browser-Dx3X9MHO-DjR7iqyW.js → browser-BOiH47em-CNA0837Q.js} +1 -1
- package/exports/browser/{browser-BKlRwB0A-CKYDFr2l.js → browser-BuaFyOQj-BCgu_5S8.js} +1 -1
- package/exports/browser/{client-eYBPUrVq-CukSyZyC.js → client-B2wkkpij-CXdxWu9W.js} +3 -3
- package/exports/browser/{index-B91mcwxm-D4wHXLVh.js → index-s61gSKAd-DUkaInec.js} +1 -1
- package/exports/browser/{messages-D0Goitr6-BWN8uKkb.js → messages-CZ-3jxiD-BQAqB9Vv.js} +1 -1
- package/exports/browser/{node-browser-JBfPNMJs.js → node-browser-Cveo6mdM.js} +36 -14
- package/exports/browser/node-browser.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-
|
|
1
|
+
import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-Cveo6mdM.js';
|
|
2
2
|
import 'crypto';
|
|
3
3
|
import './constants-CUoFxEp2.js';
|
|
4
4
|
|
|
@@ -231,7 +231,7 @@ class SocketRequestClient {
|
|
|
231
231
|
const init = async () => {
|
|
232
232
|
// @ts-ignore
|
|
233
233
|
if (!globalThis.WebSocket && !this.#experimentalWebsocket)
|
|
234
|
-
globalThis.WebSocket = (await import('./browser-
|
|
234
|
+
globalThis.WebSocket = (await import('./browser-BuaFyOQj-BCgu_5S8.js').then(function (n) { return n.b; })).default.w3cwebsocket;
|
|
235
235
|
const client = new WebSocket(this.#url, this.#protocol);
|
|
236
236
|
if (this.#experimentalWebsocket) {
|
|
237
237
|
client.addEventListener('error', this.onerror);
|
|
@@ -1302,7 +1302,7 @@ class Client {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
async #loadNodeWebrtcImplementation() {
|
|
1305
|
-
const koushWrtcModule = await import('./browser-
|
|
1305
|
+
const koushWrtcModule = await import('./browser-BOiH47em-CNA0837Q.js').then(function (n) { return n.b; });
|
|
1306
1306
|
const koushWrtc = koushWrtcModule.default;
|
|
1307
1307
|
if (!isWrtcImplementation(koushWrtc)) {
|
|
1308
1308
|
throw new Error('@koush/wrtc does not match required wrtc contract');
|
|
@@ -8312,6 +8312,38 @@ function requireBrowser () {
|
|
|
8312
8312
|
var browserExports = requireBrowser();
|
|
8313
8313
|
var qrcode = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
|
8314
8314
|
|
|
8315
|
+
const accountDerivationSchemes = [
|
|
8316
|
+
{
|
|
8317
|
+
name: 'current',
|
|
8318
|
+
accountIndex: (index) => index + 1,
|
|
8319
|
+
addressIndex: 1
|
|
8320
|
+
},
|
|
8321
|
+
{
|
|
8322
|
+
name: 'legacy-v1',
|
|
8323
|
+
accountIndex: (index) => index,
|
|
8324
|
+
addressIndex: 0
|
|
8325
|
+
}
|
|
8326
|
+
];
|
|
8327
|
+
const resolveAccountWallets = async (wallet, accounts) => {
|
|
8328
|
+
for (const scheme of accountDerivationSchemes) {
|
|
8329
|
+
const wallets = new Map();
|
|
8330
|
+
let matches = true;
|
|
8331
|
+
for (const [index, [, externalAddress, internalAddress]] of accounts.entries()) {
|
|
8332
|
+
const account = wallet.account(scheme.accountIndex(index));
|
|
8333
|
+
const external = (await account.external(scheme.addressIndex));
|
|
8334
|
+
const internal = (await account.internal(scheme.addressIndex));
|
|
8335
|
+
if ((await external.address) !== externalAddress || (await internal.address) !== internalAddress) {
|
|
8336
|
+
matches = false;
|
|
8337
|
+
break;
|
|
8338
|
+
}
|
|
8339
|
+
wallets.set(externalAddress, external);
|
|
8340
|
+
wallets.set(internalAddress, internal);
|
|
8341
|
+
}
|
|
8342
|
+
if (matches)
|
|
8343
|
+
return wallets;
|
|
8344
|
+
}
|
|
8345
|
+
throw new Error('stored accounts do not match this identity under a supported derivation scheme');
|
|
8346
|
+
};
|
|
8315
8347
|
class Identity {
|
|
8316
8348
|
#wallet;
|
|
8317
8349
|
#accountWallets = new Map();
|
|
@@ -8352,7 +8384,7 @@ class Identity {
|
|
|
8352
8384
|
this.selectedAccount = new TextDecoder().decode(selected);
|
|
8353
8385
|
}
|
|
8354
8386
|
else {
|
|
8355
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
8387
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-s61gSKAd-DUkaInec.js');
|
|
8356
8388
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
8357
8389
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
8358
8390
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -8369,18 +8401,8 @@ class Identity {
|
|
|
8369
8401
|
await this.#loadAccountWallets();
|
|
8370
8402
|
}
|
|
8371
8403
|
async #loadAccountWallets() {
|
|
8372
|
-
this.#accountWallets.clear();
|
|
8373
8404
|
const accounts = await this.getAccounts();
|
|
8374
|
-
|
|
8375
|
-
const account = this.#wallet.account(index + 1);
|
|
8376
|
-
const external = (await account.external(1));
|
|
8377
|
-
const internal = (await account.internal(1));
|
|
8378
|
-
if ((await external.address) !== externalAddress || (await internal.address) !== internalAddress) {
|
|
8379
|
-
throw new Error(`stored account ${index + 1} does not match this identity`);
|
|
8380
|
-
}
|
|
8381
|
-
this.#accountWallets.set(externalAddress, external);
|
|
8382
|
-
this.#accountWallets.set(internalAddress, internal);
|
|
8383
|
-
}
|
|
8405
|
+
this.#accountWallets = await resolveAccountWallets(this.#wallet, accounts);
|
|
8384
8406
|
if (!this.#accountWallets.has(this.selectedAccount)) {
|
|
8385
8407
|
throw new Error(`selected account ${this.selectedAccount} is not part of this identity`);
|
|
8386
8408
|
}
|
|
@@ -17107,7 +17129,7 @@ class Peernet {
|
|
|
17107
17129
|
await getAddress();
|
|
17108
17130
|
this.storePrefix = options.storePrefix;
|
|
17109
17131
|
this.root = options.root;
|
|
17110
|
-
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-
|
|
17132
|
+
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-CZ-3jxiD-BQAqB9Vv.js');
|
|
17111
17133
|
/**
|
|
17112
17134
|
* proto Object containing protos
|
|
17113
17135
|
* @type {Object}
|
|
@@ -17154,7 +17176,7 @@ class Peernet {
|
|
|
17154
17176
|
if (this.#starting || this.#started)
|
|
17155
17177
|
return;
|
|
17156
17178
|
this.#starting = true;
|
|
17157
|
-
const importee = await import('./client-
|
|
17179
|
+
const importee = await import('./client-B2wkkpij-CXdxWu9W.js');
|
|
17158
17180
|
/**
|
|
17159
17181
|
* @access public
|
|
17160
17182
|
* @type {PeernetClient}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@leofcoin/messages": "^1.6.0",
|
|
72
72
|
"@leofcoin/multi-wallet": "^3.1.9",
|
|
73
73
|
"@leofcoin/networks": "^1.1.29",
|
|
74
|
-
"@leofcoin/peernet": "^1.2.
|
|
74
|
+
"@leofcoin/peernet": "^1.2.24",
|
|
75
75
|
"@leofcoin/storage": "^3.5.38",
|
|
76
76
|
"@leofcoin/utils": "^1.1.43",
|
|
77
77
|
"@leofcoin/workers": "^1.5.31",
|