@leofcoin/peernet 1.1.22 → 1.1.23
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/{client-91364a04.js → client-e3216b03.js} +1 -1
- package/exports/browser/{index-2c7d7136.js → index-2c2a9d47.js} +1 -1
- package/exports/browser/{messages-bcb7873b.js → messages-6cc87ed7.js} +1 -1
- package/exports/browser/{peernet-1256dbee.js → peernet-98e14e24.js} +14 -12
- package/exports/browser/peernet.js +1 -1
- package/package.json +1 -1
|
@@ -4785,12 +4785,13 @@ const isUint8Array$1 = (type) => type === 'uint8Array';
|
|
|
4785
4785
|
const isBigNumber = (type) => type === 'bigNumber';
|
|
4786
4786
|
const tokenize = (key, value) => {
|
|
4787
4787
|
const optional = key.endsWith('?');
|
|
4788
|
-
let type = value;
|
|
4789
|
-
|
|
4790
|
-
if (value instanceof Uint8Array)
|
|
4788
|
+
let type = value === undefined ? key : value;
|
|
4789
|
+
if (type instanceof Uint8Array)
|
|
4791
4790
|
type = 'uint8Array';
|
|
4792
|
-
else if (
|
|
4791
|
+
else if (type?._isBigNumber || type.isBigNumber)
|
|
4793
4792
|
type = 'bigNumber';
|
|
4793
|
+
else
|
|
4794
|
+
type = Array.isArray(type) ? 'array' : typeof type;
|
|
4794
4795
|
const parts = key.split('?');
|
|
4795
4796
|
const minimumLength = parts[2]?.includes('min') ? parts[2].split['min:'][1] : 0;
|
|
4796
4797
|
return { type, optional, key: parts[0], minimumLength };
|
|
@@ -4802,6 +4803,7 @@ const toType = (data) => {
|
|
|
4802
4803
|
// returns the ArrayBuffer as a UintArray
|
|
4803
4804
|
if (data instanceof ArrayBuffer)
|
|
4804
4805
|
return new Uint8Array(data);
|
|
4806
|
+
// returns the bigNumbers hex as a UintArray
|
|
4805
4807
|
if (data._isBigNumber)
|
|
4806
4808
|
return new TextEncoder().encode(data._hex || data.toHexString());
|
|
4807
4809
|
// returns the string as a UintArray
|
|
@@ -4815,11 +4817,11 @@ const toType = (data) => {
|
|
|
4815
4817
|
return new TextEncoder().encode(data.toString());
|
|
4816
4818
|
throw new Error(`unsuported type ${typeof data || data}`);
|
|
4817
4819
|
};
|
|
4818
|
-
const encode$3 = (proto, input) => {
|
|
4820
|
+
const encode$3 = (proto, input, compress) => {
|
|
4819
4821
|
const keys = Object.keys(proto);
|
|
4820
4822
|
const values = Object.values(proto);
|
|
4821
4823
|
const set = [];
|
|
4822
|
-
for (let i = 0; i <
|
|
4824
|
+
for (let i = 0; i < values.length; i++) {
|
|
4823
4825
|
const token = tokenize(keys[i], values[i]);
|
|
4824
4826
|
const data = input[token.key];
|
|
4825
4827
|
if (!token.optional && data === undefined)
|
|
@@ -4832,14 +4834,14 @@ const encode$3 = (proto, input) => {
|
|
|
4832
4834
|
}
|
|
4833
4835
|
return index$6(set);
|
|
4834
4836
|
};
|
|
4835
|
-
const decode$4 = (proto, uint8Array) => {
|
|
4837
|
+
const decode$4 = (proto, uint8Array, compressed) => {
|
|
4836
4838
|
let deconcated = index$5(uint8Array);
|
|
4837
4839
|
const output = {};
|
|
4838
4840
|
const keys = Object.keys(proto);
|
|
4839
4841
|
const values = Object.values(proto);
|
|
4840
4842
|
if (keys.length !== deconcated.length)
|
|
4841
4843
|
console.warn(`length mismatch: expected ${keys.length} got ${uint8Array.length}`);
|
|
4842
|
-
for (let i = 0; i <
|
|
4844
|
+
for (let i = 0; i < values.length; i++) {
|
|
4843
4845
|
const token = tokenize(keys[i], values[i]);
|
|
4844
4846
|
if (isUint8Array$1(token.type))
|
|
4845
4847
|
output[token.key] = deconcated[i];
|
|
@@ -5926,7 +5928,7 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface$1 {
|
|
|
5926
5928
|
this.fromUint8Array(buffer);
|
|
5927
5929
|
else if (buffer instanceof ArrayBuffer)
|
|
5928
5930
|
this.fromArrayBuffer(buffer);
|
|
5929
|
-
else if (buffer instanceof FormatInterface
|
|
5931
|
+
else if (buffer instanceof FormatInterface && buffer?.name === this.name)
|
|
5930
5932
|
return buffer;
|
|
5931
5933
|
else if (typeof buffer === 'string') {
|
|
5932
5934
|
if (this.isHex(buffer))
|
|
@@ -20180,7 +20182,7 @@ class Identity {
|
|
|
20180
20182
|
globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
|
|
20181
20183
|
}
|
|
20182
20184
|
else {
|
|
20183
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
20185
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-2c2a9d47.js');
|
|
20184
20186
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
20185
20187
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
20186
20188
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -20351,7 +20353,7 @@ class Peernet {
|
|
|
20351
20353
|
this.root = options.root;
|
|
20352
20354
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
20353
20355
|
// FolderMessageResponse
|
|
20354
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
20356
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-6cc87ed7.js');
|
|
20355
20357
|
/**
|
|
20356
20358
|
* proto Object containing protos
|
|
20357
20359
|
* @type {Object}
|
|
@@ -20423,7 +20425,7 @@ class Peernet {
|
|
|
20423
20425
|
if (this.#starting || this.#started)
|
|
20424
20426
|
return;
|
|
20425
20427
|
this.#starting = true;
|
|
20426
|
-
const importee = await import('./client-
|
|
20428
|
+
const importee = await import('./client-e3216b03.js');
|
|
20427
20429
|
/**
|
|
20428
20430
|
* @access public
|
|
20429
20431
|
* @type {PeernetClient}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as default } from './peernet-
|
|
1
|
+
export { P as default } from './peernet-98e14e24.js';
|
|
2
2
|
import './value-157ab062.js';
|