@leofcoin/chain 1.6.8 → 1.6.9

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.
@@ -118,6 +118,8 @@ class BrowerStore {
118
118
  create: true
119
119
  });
120
120
  if (inWorker) {
121
+ // it's in a worker so that's why typings invalid?
122
+ // @ts-ignore
121
123
  directoryHandle = await directoryHandle.createSyncAccessHandle();
122
124
  }
123
125
  }
@@ -152,11 +154,16 @@ class BrowerStore {
152
154
  let handle = await this.db.getFileHandle(this.toKeyPath(key));
153
155
  let readBuffer;
154
156
  if (this.inWorker) {
157
+ // it's in a worker so that's why typings invalid?
158
+ // @ts-ignore
155
159
  handle = await handle.createSyncAccessHandle();
160
+ // @ts-ignore
156
161
  const fileSize = handle.getSize();
157
162
  // Read file content to a buffer.
158
163
  const buffer = new DataView(new ArrayBuffer(fileSize));
164
+ // @ts-ignore
159
165
  readBuffer = handle.read(buffer, { at: 0 });
166
+ // @ts-ignore
160
167
  handle.close();
161
168
  }
162
169
  else {
@@ -171,6 +178,8 @@ class BrowerStore {
171
178
  let handle = await this.db.getFileHandle(this.toKeyPath(key), { create: true });
172
179
  let writeable;
173
180
  if (this.inWorker) {
181
+ // it's in a worker so that's why typings invalid?
182
+ // @ts-ignore
174
183
  writeable = await handle.createSyncAccessHandle();
175
184
  }
176
185
  else {
@@ -203,31 +212,25 @@ class BrowerStore {
203
212
  return this.db.removeEntry(this.toKeyPath(key));
204
213
  }
205
214
  async clear() {
206
- debug(`clear ${this.toKeyPath(key)}`);
207
215
  for await (const key of this.db.keys()) {
216
+ debug(`clear ${this.toKeyPath(key)}`);
208
217
  await this.db.removeEntry(key);
209
218
  }
210
219
  }
211
- async values(limit = -1) {
212
- debug(`values ${limit}`);
220
+ async values() {
213
221
  let values = [];
214
222
  for await (const cursor of this.db.values()) {
223
+ // huh? Outdated typings?
224
+ // @ts-ignore
215
225
  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
- }
220
226
  }
221
227
  values = await Promise.all(values);
222
228
  return Promise.all(values.map(async (file) => new Uint8Array(await file.arrayBuffer())));
223
229
  }
224
- async keys(limit = -1) {
225
- debug(`keys ${limit}`);
230
+ async keys() {
226
231
  const keys = [];
227
232
  for await (const cursor of this.db.keys()) {
228
233
  keys.push(cursor);
229
- if (limit && keys.length === limit)
230
- return keys;
231
234
  }
232
235
  return keys;
233
236
  }
@@ -19,8 +19,9 @@ const debug$5 = (target, text) => {
19
19
  globalThis.DEBUG?.indexOf('*') !== -1 ||
20
20
  globalThis.DEBUG?.indexOf(target.split('/')[0]) !== -1
21
21
  )
22
- if (text) console.log('\x1b[34m\x1b[1m%s', `${target}: ${text}`, '\x1b[0m');
23
- else console.log('\x1b[34m\x1b[1m%s', `${target}`, '\x1b[0m');
22
+ if (text)
23
+ console.trace('\x1b[34m\x1b[1m%s', `${target}: ${text}`, '\x1b[0m');
24
+ else console.trace('\x1b[34m\x1b[1m%s', `${target}`, '\x1b[0m');
24
25
  };
25
26
 
26
27
  const createDebugger = (target) => (text) => debug$5(target, text);
@@ -3540,11 +3541,11 @@ var semver$1 = /*@__PURE__*/getDefaultExportFromCjs(semver);
3540
3541
 
3541
3542
  const limit = 1800;
3542
3543
  const transactionLimit = 1000;
3543
- const requestTimeout = 30000;
3544
- const syncTimeout = 30000;
3544
+ const requestTimeout = 30_000;
3545
+ const syncTimeout = 30_000;
3545
3546
  class Protocol {
3546
3547
  constructor(config) {
3547
- this.resolveTimeout = 10000;
3548
+ this.resolveTimeout = 10_000;
3548
3549
  if (config?.resolveTimeout)
3549
3550
  this.resolveTimeout = config.resolveTimeout;
3550
3551
  }
@@ -3721,7 +3722,7 @@ class Transaction extends Protocol {
3721
3722
  result.status === 'fulfilled' ? resolve(result.hash) : reject({ hash: result.hash, error: result.error });
3722
3723
  setTimeout(async () => {
3723
3724
  pubsub.unsubscribe(`transaction.completed.${hash}`, completed);
3724
- }, 10000);
3725
+ }, 10_000);
3725
3726
  };
3726
3727
  pubsub.subscribe(`transaction.completed.${hash}`, completed);
3727
3728
  }
@@ -1,4 +1,5 @@
1
1
  import '@vandeurenglenn/debug';
2
+ import { BigNumber } from '@leofcoin/utils';
2
3
  import { BigNumberish } from '@ethersproject/bignumber';
3
4
  import { Address } from './types.js';
4
5
  import { VersionControl } from './version-control.js';
@@ -20,14 +21,14 @@ export default class Chain extends VersionControl {
20
21
  sendTransaction(transaction: any): Promise<{
21
22
  hash: any;
22
23
  data: any;
23
- fee: any;
24
+ fee: string | number | BigNumber;
24
25
  wait: Promise<unknown>;
25
26
  message: any;
26
27
  }>;
27
28
  addContract(transaction: any, contractMessage: any): Promise<{
28
29
  hash: any;
29
30
  data: any;
30
- fee: any;
31
+ fee: string | number | BigNumber;
31
32
  wait: Promise<unknown>;
32
33
  message: any;
33
34
  }>;
package/exports/chain.js CHANGED
@@ -10,11 +10,11 @@ import { ContractDeploymentError, ExecutionError, isResolveError, ResolveError,
10
10
 
11
11
  const limit = 1800;
12
12
  const transactionLimit = 1000;
13
- const requestTimeout = 30000;
14
- const syncTimeout = 30000;
13
+ const requestTimeout = 30_000;
14
+ const syncTimeout = 30_000;
15
15
  class Protocol {
16
16
  constructor(config) {
17
- this.resolveTimeout = 10000;
17
+ this.resolveTimeout = 10_000;
18
18
  if (config?.resolveTimeout)
19
19
  this.resolveTimeout = config.resolveTimeout;
20
20
  }
@@ -191,7 +191,7 @@ class Transaction extends Protocol {
191
191
  result.status === 'fulfilled' ? resolve(result.hash) : reject({ hash: result.hash, error: result.error });
192
192
  setTimeout(async () => {
193
193
  pubsub.unsubscribe(`transaction.completed.${hash}`, completed);
194
- }, 10000);
194
+ }, 10_000);
195
195
  };
196
196
  pubsub.subscribe(`transaction.completed.${hash}`, completed);
197
197
  }
@@ -13,7 +13,7 @@ export default class Contract extends Transaction {
13
13
  * @param {Array} constructorParameters
14
14
  * @returns lib.createContractMessage
15
15
  */
16
- createContractMessage(creator: any, contract: any, constructorParameters?: any[]): Promise<any>;
16
+ createContractMessage(creator: any, contract: any, constructorParameters?: any[]): Promise<import("@leofcoin/messages").ContractMessage>;
17
17
  /**
18
18
  *
19
19
  * @param {Address} creator
@@ -31,14 +31,14 @@ export default class Contract extends Transaction {
31
31
  deployContract(signer: MultiWallet, contract: any, constructorParameters?: any[]): Promise<{
32
32
  hash: any;
33
33
  data: any;
34
- fee: any;
34
+ fee: string | number | import("@ethersproject/bignumber").BigNumber;
35
35
  wait: Promise<unknown>;
36
36
  message: any;
37
37
  }>;
38
38
  deployContractMessage(signer: any, message: any): Promise<{
39
39
  hash: any;
40
40
  data: any;
41
- fee: any;
41
+ fee: string | number | import("@ethersproject/bignumber").BigNumber;
42
42
  wait: Promise<unknown>;
43
43
  message: any;
44
44
  }>;
@@ -34,7 +34,7 @@ export default class Transaction extends Protocol {
34
34
  sendTransaction(message: any): Promise<{
35
35
  hash: any;
36
36
  data: any;
37
- fee: any;
37
+ fee: string | number | import("@leofcoin/utils").BigNumber;
38
38
  wait: Promise<unknown>;
39
39
  message: any;
40
40
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {