@leofcoin/chain 1.5.66 → 1.5.67

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.
Files changed (22) hide show
  1. package/exports/browser/{_polyfill-node.url-1q06MepH.js → _polyfill-node.url-Bp9XkJZf.js} +1 -1
  2. package/exports/browser/{browser-Ei0BXMlu-irDJ6Blw.js → browser-Ei0BXMlu-C1_XUL9Y.js} +2 -2
  3. package/exports/browser/browser-store.js +96 -15
  4. package/exports/browser/chain.js +38 -14
  5. package/exports/browser/{client-A009z8av-uBa1w1TW.js → client-A009z8av-DQfd3vOY.js} +5 -5
  6. package/exports/browser/{index-G74WLzL7-tmiSHjUc.js → index-G74WLzL7-Dt2dwaXq.js} +2 -2
  7. package/exports/browser/{index-YQrIDBUQ-OXiMI4eT.js → index-YQrIDBUQ-c7011Ab4.js} +2 -2
  8. package/exports/browser/{messages-lWRTai7t-Bc6ghkkt.js → messages-lWRTai7t-ClhClfC1.js} +2 -2
  9. package/exports/browser/{node-browser-TcXF8FDB.js → node-browser-DqIklEKv.js} +6 -6
  10. package/exports/browser/node-browser.js +2 -2
  11. package/exports/browser/workers/block-worker.js +1 -1
  12. package/exports/browser/workers/machine-worker.js +1 -1
  13. package/exports/chain.js +8 -1
  14. package/exports/workers/block-worker.js +1 -1
  15. package/exports/workers/machine-worker.js +1 -1
  16. package/package.json +1 -1
  17. /package/exports/browser/{_polyfill-node.child_process-rc1HO9Xs.js → _polyfill-node.child_process-BsjYmFff.js} +0 -0
  18. /package/exports/browser/{browser-AyxSBUXj-AyxSBUXj.js → browser-AyxSBUXj-pguCHlVu.js} +0 -0
  19. /package/exports/browser/{password-JCRBtU5A.js → password-oDixGC8h.js} +0 -0
  20. /package/exports/browser/{qr-scanner-worker.min-RaSiJc_R-RaSiJc_R.js → qr-scanner-worker.min-RaSiJc_R-Dy0qkKA4.js} +0 -0
  21. /package/exports/browser/workers/{worker-hbo9s9AT.js → worker-CltAyHf1.js} +0 -0
  22. /package/exports/workers/{worker-hbo9s9AT.js → worker-CltAyHf1.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { g as global } from './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { g as global } from './_polyfill-node.child_process-BsjYmFff.js';
2
2
 
3
3
  /*! https://mths.be/punycode v1.4.1 by @mathias */
4
4
 
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { g as getDefaultExportFromCjs } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
3
3
 
4
4
  var global;
5
5
  var hasRequiredGlobal;
@@ -70,23 +70,56 @@ class KeyValue {
70
70
  }
71
71
  }
72
72
 
73
+ if (!globalThis.DEBUG) {
74
+ let DEBUG = [];
75
+ if (globalThis.localStorage) {
76
+ DEBUG = globalThis.localStorage.getItem('DEBUG');
77
+ globalThis.DEBUG = DEBUG ? DEBUG.split(',') : [DEBUG];
78
+ }
79
+ }
80
+
81
+ const debug$1 = (target, text) => {
82
+ if (!globalThis.DEBUG && globalThis.DEBUG.length === 0) return;
83
+ if (
84
+ globalThis.DEBUG === 'true' ||
85
+ globalThis.DEBUG === true ||
86
+ globalThis.DEBUG?.indexOf(target) !== -1 ||
87
+ globalThis.DEBUG?.indexOf('*') !== -1 ||
88
+ globalThis.DEBUG?.indexOf(target.split('/')[0]) !== -1
89
+ )
90
+ if (text) console.log('\x1b[34m\x1b[1m%s', `${target}: ${text}`, '\x1b[0m');
91
+ else console.log('\x1b[34m\x1b[1m%s', `${target}`, '\x1b[0m');
92
+ };
93
+
94
+ if (!globalThis.debug) {
95
+ globalThis.debug = debug$1;
96
+
97
+ globalThis.createDebugger = (target) => (text) => debug$1(target, text);
98
+ }
99
+
100
+ const debug = globalThis.createDebugger('leofcoin/storage');
73
101
  const opfsRoot = await navigator.storage.getDirectory();
74
102
  class BrowerStore {
75
103
  db;
76
104
  name;
77
105
  root;
106
+ inWorker;
78
107
  version;
79
- async init(name = 'storage', root = '.leofcoin', version = '1') {
80
- console.log('init');
108
+ busy;
109
+ queue = [];
110
+ async init(name = 'storage', root = '.leofcoin', version = '1', inWorker = false) {
81
111
  this.version = version;
82
112
  this.name = name;
83
113
  this.root = opfsRoot;
84
- console.log(`${this.root}/${this.name}`);
114
+ this.inWorker = inWorker;
85
115
  let directoryHandle;
86
116
  try {
87
117
  directoryHandle = await opfsRoot.getDirectoryHandle(this.name, {
88
118
  create: true
89
119
  });
120
+ if (inWorker) {
121
+ directoryHandle = await directoryHandle.createSyncAccessHandle();
122
+ }
90
123
  }
91
124
  catch (error) {
92
125
  console.error(error);
@@ -105,6 +138,7 @@ class BrowerStore {
105
138
  return value.uint8Array;
106
139
  }
107
140
  async has(key) {
141
+ debug(`has ${this.toKeyPath(key)}`);
108
142
  try {
109
143
  await this.db.getFileHandle(this.toKeyPath(key));
110
144
  return true;
@@ -114,34 +148,81 @@ class BrowerStore {
114
148
  }
115
149
  }
116
150
  async get(key) {
117
- const handle = await this.db.getFileHandle(this.toKeyPath(key));
118
- const file = await handle.getFile();
119
- return new Uint8Array(await file.arrayBuffer());
151
+ debug(`get ${this.toKeyPath(key)}`);
152
+ let handle = await this.db.getFileHandle(this.toKeyPath(key));
153
+ let readBuffer;
154
+ if (this.inWorker) {
155
+ handle = await handle.createSyncAccessHandle();
156
+ const fileSize = handle.getSize();
157
+ // Read file content to a buffer.
158
+ const buffer = new DataView(new ArrayBuffer(fileSize));
159
+ readBuffer = handle.read(buffer, { at: 0 });
160
+ handle.close();
161
+ }
162
+ else {
163
+ const file = await handle.getFile();
164
+ readBuffer = await file.arrayBuffer();
165
+ }
166
+ return new Uint8Array(readBuffer);
120
167
  }
121
168
  async put(key, value) {
122
- const handle = await this.db.getFileHandle(this.toKeyPath(key), { create: true });
123
- const writeable = handle.createWritable();
124
- (await writeable).write(this.toKeyValue(value));
125
- (await writeable).close();
169
+ const promise = () => new Promise(async (resolve) => {
170
+ debug(`put ${this.toKeyPath(key)}`);
171
+ let handle = await this.db.getFileHandle(this.toKeyPath(key), { create: true });
172
+ let writeable;
173
+ if (this.inWorker) {
174
+ writeable = await handle.createSyncAccessHandle();
175
+ }
176
+ else {
177
+ writeable = await handle.createWritable();
178
+ }
179
+ (await writeable).write(this.toKeyValue(value));
180
+ (await writeable).close();
181
+ resolve(true);
182
+ if (this.queue.length > 0 && !this.busy) {
183
+ this.runQueue();
184
+ }
185
+ });
186
+ this.queue.push(promise);
187
+ this.runQueue();
188
+ return promise;
189
+ }
190
+ async runQueue() {
191
+ if (this.queue.length > 0) {
192
+ this.busy = true;
193
+ const next = this.queue.shift();
194
+ await next();
195
+ return this.runQueue();
196
+ }
197
+ else {
198
+ this.busy = false;
199
+ }
126
200
  }
127
201
  async delete(key) {
202
+ debug(`delete ${this.toKeyPath(key)}`);
128
203
  return this.db.removeEntry(this.toKeyPath(key));
129
204
  }
130
205
  async clear() {
206
+ debug(`clear ${this.toKeyPath(key)}`);
131
207
  for await (const key of this.db.keys()) {
132
208
  await this.db.removeEntry(key);
133
209
  }
134
210
  }
135
211
  async values(limit = -1) {
136
- const values = [];
212
+ debug(`values ${limit}`);
213
+ let values = [];
137
214
  for await (const cursor of this.db.values()) {
138
- values.push(cursor);
139
- if (limit && values.length === limit)
140
- return values;
215
+ values.push(cursor.getFile());
216
+ if (limit && values.length === limit) {
217
+ values = await Promise.all(values);
218
+ return Promise.all(values.map(async (file) => new Uint8Array(await file.arrayBuffer())));
219
+ }
141
220
  }
142
- return values;
221
+ values = await Promise.all(values);
222
+ return Promise.all(values.map(async (file) => new Uint8Array(await file.arrayBuffer())));
143
223
  }
144
224
  async keys(limit = -1) {
225
+ debug(`keys ${limit}`);
145
226
  const keys = [];
146
227
  for await (const cursor of this.db.keys()) {
147
228
  keys.push(cursor);
@@ -1,10 +1,12 @@
1
- import { c as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, d as arrayify, e as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, f as getDefaultExportFromCjs, B as BlockMessage, a as BWMessage, b as BWRequestMessage } from './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { c as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, d as arrayify, e as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, f as getDefaultExportFromCjs, B as BlockMessage, a as BWMessage, b as BWRequestMessage } from './_polyfill-node.child_process-BsjYmFff.js';
2
2
 
3
3
  if (!globalThis.DEBUG) {
4
4
  let DEBUG = [];
5
5
  if (globalThis.localStorage) {
6
6
  DEBUG = globalThis.localStorage.getItem('DEBUG');
7
- globalThis.DEBUG = DEBUG ? DEBUG.split(',') : [DEBUG];
7
+ globalThis.DEBUG = DEBUG.startsWith('[')
8
+ ? JSON.parse(DEBUG).split(',')
9
+ : [DEBUG];
8
10
  }
9
11
  }
10
12
 
@@ -21,10 +23,12 @@ const debug$5 = (target, text) => {
21
23
  else console.log('\x1b[34m\x1b[1m%s', `${target}`, '\x1b[0m');
22
24
  };
23
25
 
26
+ const createDebugger = (target) => (text) => debug$5(target, text);
27
+
24
28
  if (!globalThis.debug) {
25
29
  globalThis.debug = debug$5;
26
-
27
- globalThis.createDebugger = (target) => (text) => debug$5(target, text);
30
+ // todo: deprecate
31
+ globalThis.createDebugger = createDebugger;
28
32
  }
29
33
 
30
34
  const logger$1 = new Logger(version$1);
@@ -700,12 +704,17 @@ var debug_1 = debug$4;
700
704
 
701
705
  // Coercion.
702
706
  // Extract anything that could conceivably be a part of a valid semver
703
- createToken('COERCE', `${'(^|[^\\d])' +
707
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
704
708
  '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
705
709
  `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
706
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
710
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
711
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
712
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
713
+ `(?:${src[t.PRERELEASE]})?` +
714
+ `(?:${src[t.BUILD]})?` +
707
715
  `(?:$|[^\\d])`);
708
716
  createToken('COERCERTL', src[t.COERCE], true);
717
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
709
718
 
710
719
  // Tilde ranges.
711
720
  // Meaning is "reasonably at or greater than"
@@ -1367,35 +1376,43 @@ const coerce$1 = (version, options) => {
1367
1376
 
1368
1377
  let match = null;
1369
1378
  if (!options.rtl) {
1370
- match = version.match(re[t.COERCE]);
1379
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
1371
1380
  } else {
1372
1381
  // Find the right-most coercible string that does not share
1373
1382
  // a terminus with a more left-ward coercible string.
1374
1383
  // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
1384
+ // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
1375
1385
  //
1376
1386
  // Walk through the string checking with a /g regexp
1377
1387
  // Manually set the index so as to pick up overlapping matches.
1378
1388
  // Stop when we get a match that ends at the string end, since no
1379
1389
  // coercible string can be more right-ward without the same terminus.
1390
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
1380
1391
  let next;
1381
- while ((next = re[t.COERCERTL].exec(version)) &&
1392
+ while ((next = coerceRtlRegex.exec(version)) &&
1382
1393
  (!match || match.index + match[0].length !== version.length)
1383
1394
  ) {
1384
1395
  if (!match ||
1385
1396
  next.index + next[0].length !== match.index + match[0].length) {
1386
1397
  match = next;
1387
1398
  }
1388
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
1399
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1389
1400
  }
1390
1401
  // leave it in a clean state
1391
- re[t.COERCERTL].lastIndex = -1;
1402
+ coerceRtlRegex.lastIndex = -1;
1392
1403
  }
1393
1404
 
1394
1405
  if (match === null) {
1395
1406
  return null
1396
1407
  }
1397
1408
 
1398
- return parse$1(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
1409
+ const major = match[2];
1410
+ const minor = match[3] || '0';
1411
+ const patch = match[4] || '0';
1412
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
1413
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
1414
+
1415
+ return parse$1(`${major}.${minor}.${patch}${prerelease}${build}`, options)
1399
1416
  };
1400
1417
  var coerce_1 = coerce$1;
1401
1418
 
@@ -3805,7 +3822,7 @@ class EasyWorker {
3805
3822
  this.worker = new Worker(url, {...options});
3806
3823
  } else {
3807
3824
  return new Promise(async (resolve, reject) => {
3808
- const {fork} = await import('./_polyfill-node.child_process-rc1HO9Xs.js').then(function (n) { return n._; });
3825
+ const {fork} = await import('./_polyfill-node.child_process-BsjYmFff.js').then(function (n) { return n._; });
3809
3826
  this.worker = fork(url, ['easy-worker-child'], options);
3810
3827
  resolve(this);
3811
3828
  })
@@ -3906,7 +3923,14 @@ class Machine {
3906
3923
  case 'transactionLoaded': {
3907
3924
  const { from, nonce, hash } = data.result;
3908
3925
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
3909
- await accountsStore.put(from, nonce);
3926
+ try {
3927
+ const _nonce = await accountsStore.get(from);
3928
+ if (nonce > _nonce)
3929
+ await accountsStore.put(from, nonce);
3930
+ }
3931
+ catch (error) {
3932
+ await accountsStore.put(from, nonce);
3933
+ }
3910
3934
  break;
3911
3935
  }
3912
3936
  case 'contractError': {
@@ -3955,7 +3979,7 @@ class Machine {
3955
3979
  pubsub.subscribe('machine.ready', machineReady);
3956
3980
  let pre;
3957
3981
  try {
3958
- const importee = await import('./_polyfill-node.url-1q06MepH.js');
3982
+ const importee = await import('./_polyfill-node.url-Bp9XkJZf.js');
3959
3983
  const url = importee.default;
3960
3984
  if (url)
3961
3985
  pre = url.fileURLToPath(new URL('.', import.meta.url));
@@ -1,5 +1,5 @@
1
- import { L as LittlePubSub } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { L as LittlePubSub } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
3
3
 
4
4
  class Api {
5
5
  _pubsub;
@@ -206,7 +206,7 @@ class SocketRequestClient {
206
206
  const init = async () => {
207
207
  // @ts-ignore
208
208
  if (!globalThis.WebSocket)
209
- globalThis.WebSocket = (await import('./browser-Ei0BXMlu-irDJ6Blw.js').then(function (n) { return n.b; })).default.w3cwebsocket;
209
+ globalThis.WebSocket = (await import('./browser-Ei0BXMlu-C1_XUL9Y.js').then(function (n) { return n.b; })).default.w3cwebsocket;
210
210
  const client = new WebSocket(this.#url, this.#protocol);
211
211
  client.onmessage = this.onmessage;
212
212
  client.onerror = this.onerror;
@@ -280,7 +280,7 @@ const iceServers = [
280
280
  credential: 'openrelayproject'
281
281
  }
282
282
  ];
283
- const SimplePeer = (await import('./index-YQrIDBUQ-OXiMI4eT.js').then(function (n) { return n.i; })).default;
283
+ const SimplePeer = (await import('./index-YQrIDBUQ-c7011Ab4.js').then(function (n) { return n.i; })).default;
284
284
  class Peer extends SimplePeer {
285
285
  peerId;
286
286
  channelName;
@@ -408,7 +408,7 @@ class Client {
408
408
  async _init() {
409
409
  // reconnectJob()
410
410
  if (!globalThis.RTCPeerConnection)
411
- globalThis.wrtc = (await import('./browser-AyxSBUXj-AyxSBUXj.js').then(function (n) { return n.b; })).default;
411
+ globalThis.wrtc = (await import('./browser-AyxSBUXj-pguCHlVu.js').then(function (n) { return n.b; })).default;
412
412
  for (const star of this.starsConfig) {
413
413
  try {
414
414
  const client = new SocketRequestClient(star, this.networkVersion);
@@ -1,5 +1,5 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
3
3
 
4
4
  /**
5
5
  * @params {String} network
@@ -1,5 +1,5 @@
1
- import { i as inherits_browserExports, c as commonjsGlobal, g as getDefaultExportFromCjs, r as require$$3 } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { i as inherits_browserExports, c as commonjsGlobal, g as getDefaultExportFromCjs, r as require$$3 } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
3
3
 
4
4
  var browser$2 = {exports: {}};
5
5
 
@@ -1,5 +1,5 @@
1
- import { F as FormatInterface } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { F as FormatInterface } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
3
3
 
4
4
  var proto$b = {
5
5
  data: new Uint8Array(),
@@ -1,4 +1,4 @@
1
- import { C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ import { C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './_polyfill-node.child_process-BsjYmFff.js';
2
2
 
3
3
  var nodeConfig = async (config = {
4
4
  network: 'leofcoin:peach',
@@ -24224,7 +24224,7 @@ b||"returnDetailedScanResult"in b)?(m=b.scanRegion,c=b.qrEngine,d=b.canvas,f=b.d
24224
24224
  [d,k]=e._drawToCanvas(p,m,d,f);let q;if(c instanceof Worker){let g=c;b||e._postWorkerMessageSync(g,"inversionMode","both");q=await new Promise((l,v)=>{let w,u,r,y=-1;u=t=>{t.data.id===y&&(g.removeEventListener("message",u),g.removeEventListener("error",r),clearTimeout(w),null!==t.data.data?l({data:t.data.data,cornerPoints:e._convertPoints(t.data.cornerPoints,m)}):v(e.NO_QR_CODE_FOUND));};r=t=>{g.removeEventListener("message",u);g.removeEventListener("error",r);clearTimeout(w);v("Scanner error: "+(t?
24225
24225
  t.message||t:"Unknown Error"));};g.addEventListener("message",u);g.addEventListener("error",r);w=setTimeout(()=>r("timeout"),1E4);let x=k.getImageData(0,0,d.width,d.height);y=e._postWorkerMessageSync(g,"decode",x,[x.data.buffer]);});}else q=await Promise.race([new Promise((g,l)=>window.setTimeout(()=>l("Scanner error: timeout"),1E4)),(async()=>{try{var [g]=await c.detect(d);if(!g)throw e.NO_QR_CODE_FOUND;return {data:g.rawValue,cornerPoints:e._convertPoints(g.cornerPoints,m)}}catch(l){g=l.message||l;
24226
24226
  if(/not implemented|service unavailable/.test(g))return e._disableBarcodeDetector=!0,e.scanImage(a,{scanRegion:m,canvas:d,disallowCanvasResizing:f,alsoTryWithoutScanRegion:h});throw `Scanner error: ${g}`;}})()]);return n?q:q.data}catch(p){if(!m||!h)throw p;let k=await e.scanImage(a,{qrEngine:c,canvas:d,disallowCanvasResizing:f});return n?k:k.data}finally{b||e._postWorkerMessage(c,"close");}}setGrayscaleWeights(a,b,c,d=!0){e._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,
24227
- blue:c,useIntegerApproximation:d});}setInversionMode(a){e._postWorkerMessage(this._qrEnginePromise,"inversionMode",a);}static async createQrEngine(a){a&&console.warn("Specifying a worker path is not required and not supported anymore.");a=()=>import('./qr-scanner-worker.min-RaSiJc_R-RaSiJc_R.js').then(c=>c.createWorker());if(!(!e._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return a();let b=navigator.userAgentData;
24227
+ blue:c,useIntegerApproximation:d});}setInversionMode(a){e._postWorkerMessage(this._qrEnginePromise,"inversionMode",a);}static async createQrEngine(a){a&&console.warn("Specifying a worker path is not required and not supported anymore.");a=()=>import('./qr-scanner-worker.min-RaSiJc_R-Dy0qkKA4.js').then(c=>c.createWorker());if(!(!e._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return a();let b=navigator.userAgentData;
24228
24228
  return b&&b.brands.some(({brand:c})=>/Chromium/i.test(c))&&/mac ?OS/i.test(b.platform)&&await b.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:c,platformVersion:d})=>/arm/i.test(c||"arm")&&13<=parseInt(d||"13")).catch(()=>!0)?a():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._updateOverlay();this.$overlay&&(this.$overlay.style.display="");this._scanFrame();}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video);
24229
24229
  this._updateOverlay();}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start();}_calculateScanRegion(a){let b=Math.round(2/3*Math.min(a.videoWidth,a.videoHeight));return {x:Math.round((a.videoWidth-b)/2),y:Math.round((a.videoHeight-b)/2),width:b,height:b,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var a=this.$video,b=a.videoWidth,c=a.videoHeight,d=a.offsetWidth,f=a.offsetHeight,h=a.offsetLeft,
24230
24230
  m=a.offsetTop,n=window.getComputedStyle(a),p=n.objectFit,k=b/c,q=d/f;switch(p){case "none":var g=b;var l=c;break;case "fill":g=d;l=f;break;default:("cover"===p?k>q:k<q)?(l=f,g=l*k):(g=d,l=g/k),"scale-down"===p&&(g=Math.min(g,b),l=Math.min(l,c));}var [v,w]=n.objectPosition.split(" ").map((r,y)=>{const x=parseFloat(r);return r.endsWith("%")?(y?f-l:d-g)*x/100:x});n=this._scanRegion.width||b;q=this._scanRegion.height||c;p=this._scanRegion.x||0;var u=this._scanRegion.y||0;k=this.$overlay.style;k.width=
@@ -27187,7 +27187,7 @@ class Identity {
27187
27187
  }
27188
27188
  if (!password) {
27189
27189
  // @ts-ignore
27190
- const importee = await import('./password-JCRBtU5A.js');
27190
+ const importee = await import('./password-oDixGC8h.js');
27191
27191
  password = await importee.default();
27192
27192
  }
27193
27193
  const accountExists = await globalThis.accountStore.has('public');
@@ -27198,7 +27198,7 @@ class Identity {
27198
27198
  this.selectedAccount = new TextDecoder().decode(selected);
27199
27199
  }
27200
27200
  else {
27201
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-G74WLzL7-tmiSHjUc.js');
27201
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-G74WLzL7-Dt2dwaXq.js');
27202
27202
  const { identity, accounts } = await importee.default(password, this.network);
27203
27203
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
27204
27204
  await globalThis.walletStore.put('version', String(1));
@@ -27390,7 +27390,7 @@ class Peernet {
27390
27390
  this.root = options.root;
27391
27391
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
27392
27392
  // FolderMessageResponse
27393
- } = await import(/* webpackChunkName: "messages" */ './messages-lWRTai7t-Bc6ghkkt.js');
27393
+ } = await import(/* webpackChunkName: "messages" */ './messages-lWRTai7t-ClhClfC1.js');
27394
27394
  /**
27395
27395
  * proto Object containing protos
27396
27396
  * @type {Object}
@@ -27484,7 +27484,7 @@ class Peernet {
27484
27484
  if (this.#starting || this.#started)
27485
27485
  return;
27486
27486
  this.#starting = true;
27487
- const importee = await import('./client-A009z8av-uBa1w1TW.js');
27487
+ const importee = await import('./client-A009z8av-DQfd3vOY.js');
27488
27488
  /**
27489
27489
  * @access public
27490
27490
  * @type {PeernetClient}
@@ -1,2 +1,2 @@
1
- export { N as default } from './node-browser-TcXF8FDB.js';
2
- import './_polyfill-node.child_process-rc1HO9Xs.js';
1
+ export { N as default } from './node-browser-DqIklEKv.js';
2
+ import './_polyfill-node.child_process-BsjYmFff.js';
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage } from './worker-hbo9s9AT.js';
1
+ import { E as EasyWorker, B as BigNumber, a as BlockMessage } from './worker-CltAyHf1.js';
2
2
 
3
3
  const worker = new EasyWorker();
4
4
 
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, C as ContractMessage, T as TransactionMessage } from './worker-hbo9s9AT.js';
1
+ import { E as EasyWorker, B as BigNumber, C as ContractMessage, T as TransactionMessage } from './worker-CltAyHf1.js';
2
2
 
3
3
  const byteFormats = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
4
4
  const formatBytes = (bytes, decimals = 2) => {
package/exports/chain.js CHANGED
@@ -291,7 +291,14 @@ class Machine {
291
291
  case 'transactionLoaded': {
292
292
  const { from, nonce, hash } = data.result;
293
293
  (await transactionPoolStore.has(hash)) && (await transactionPoolStore.delete(hash));
294
- await accountsStore.put(from, nonce);
294
+ try {
295
+ const _nonce = await accountsStore.get(from);
296
+ if (nonce > _nonce)
297
+ await accountsStore.put(from, nonce);
298
+ }
299
+ catch (error) {
300
+ await accountsStore.put(from, nonce);
301
+ }
295
302
  break;
296
303
  }
297
304
  case 'contractError': {
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage } from './worker-hbo9s9AT.js';
1
+ import { E as EasyWorker, B as BigNumber, a as BlockMessage } from './worker-CltAyHf1.js';
2
2
 
3
3
  const worker = new EasyWorker();
4
4
 
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, C as ContractMessage, T as TransactionMessage } from './worker-hbo9s9AT.js';
1
+ import { E as EasyWorker, B as BigNumber, C as ContractMessage, T as TransactionMessage } from './worker-CltAyHf1.js';
2
2
 
3
3
  const byteFormats = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
4
4
  const formatBytes = (bytes, decimals = 2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.5.66",
3
+ "version": "1.5.67",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": {