@leofcoin/chain 1.4.73 → 1.4.75

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.
@@ -1,40 +1,13 @@
1
- import { BlockMessage } from '@leofcoin/messages';
2
- import Contract from './contract.js';
3
1
  import { BigNumberish } from '@ethersproject/bignumber';
4
- declare type chainSyncState = 'syncing' | 'synced' | 'errored' | 'connectionless';
5
- export default class Chain extends Contract {
2
+ import State from './state.js';
3
+ export default class Chain extends State {
6
4
  #private;
7
- version: String;
8
5
  id: string;
9
6
  utils: {};
10
7
  constructor();
11
- get nativeMints(): number;
12
- get nativeBurns(): number;
13
- get nativeTransfers(): number;
14
- get totalTransactions(): number;
15
- get nativeCalls(): number;
16
- get totalSize(): number;
17
- get lib(): any;
18
- get lastBlock(): {
19
- index: number;
20
- hash: string;
21
- previousHash: string;
22
- };
23
8
  get nativeToken(): any;
24
9
  get validators(): any[];
25
- get blocks(): any[];
26
10
  hasTransactionToHandle(): Promise<boolean>;
27
- promiseRequests(promises: any): Promise<unknown>;
28
- getLatestBlock(): Promise<{
29
- index: number;
30
- hash: string;
31
- previousHash: string;
32
- }>;
33
- triggerSync(): Promise<chainSyncState>;
34
- syncChain(lastBlock: any): Promise<chainSyncState>;
35
- getAndPutBlock(hash: string): BlockMessage;
36
- resolveBlock(hash: any): any;
37
- resolveBlocks(): any;
38
11
  participate(address: any): Promise<void>;
39
12
  /**
40
13
  * every tx done is trough contracts so no need for amount
@@ -63,7 +36,7 @@ export default class Chain extends Contract {
63
36
  * @param {Array} parameters
64
37
  * @returns
65
38
  */
66
- internalCall(sender: any, contract: any, method: any, parameters: any): any;
39
+ internalCall(sender: any, contract: any, method: any, parameters: any): Promise<any>;
67
40
  /**
68
41
  *
69
42
  * @param {Address} contract
@@ -71,17 +44,17 @@ export default class Chain extends Contract {
71
44
  * @param {Array} parameters
72
45
  * @returns
73
46
  */
74
- call(contract: any, method: any, parameters: any): any;
75
- staticCall(contract: any, method: any, parameters?: any): any;
76
- delegate(contract: any, method: any, parameters: any): any;
47
+ call(contract: any, method: any, parameters: any): Promise<any>;
48
+ staticCall(contract: any, method: any, parameters?: any): Promise<any>;
49
+ delegate(contract: any, method: any, parameters: any): Promise<any>;
77
50
  staticDelegate(contract: Address, method: string, parameters: []): any;
78
- mint(to: string, amount: BigNumberish): any;
79
- transfer(from: string, to: string, amount: BigNumberish): any;
80
- get balances(): {
51
+ mint(to: string, amount: BigNumberish): Promise<any>;
52
+ transfer(from: string, to: string, amount: BigNumberish): Promise<any>;
53
+ get balances(): Promise<{
81
54
  address: BigNumberish;
82
- };
83
- get contracts(): any;
84
- deleteAll(): any;
55
+ }[]>;
56
+ get contracts(): Promise<any>;
57
+ deleteAll(): Promise<any>;
85
58
  /**
86
59
  * lookup an address for a registered name using the builtin nameService
87
60
  * @check nameService
@@ -91,9 +64,8 @@ export default class Chain extends Contract {
91
64
  *
92
65
  * @example chain.lookup('myCoolContractName') // qmqsfddfdgfg...
93
66
  */
94
- lookup(name: any): {
67
+ lookup(name: any): Promise<{
95
68
  owner: string;
96
69
  address: string;
97
- };
70
+ }>;
98
71
  }
99
- export {};
@@ -2,6 +2,7 @@
2
2
  * @extends {Transaction}
3
3
  */
4
4
  export default class Contract extends Transaction {
5
+ init(): Promise<void>;
5
6
  /**
6
7
  *
7
8
  * @param {Address} creator
@@ -0,0 +1,3 @@
1
+ export default class SyncJob {
2
+ constructor();
3
+ }
@@ -1,4 +1,5 @@
1
- export default class State {
1
+ export default class MachineState {
2
+ constructor();
2
3
  put(key: any, value: any, isCompressed?: boolean): Promise<void>;
3
4
  get(key: any, isCompressed?: boolean): Promise<any>;
4
5
  updateState(block: any): void;
@@ -3,6 +3,8 @@ export declare const transactionLimit = 1800;
3
3
  export declare const requestTimeout = 30000;
4
4
  export declare const syncTimeout = 30000;
5
5
  export declare class Protocol {
6
+ version: string;
7
+ resolveTimeout: EpochTimeStamp;
6
8
  get limit(): number;
7
9
  get transactionLimit(): number;
8
10
  get requestTimeout(): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.73",
3
+ "version": "1.4.75",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",
@@ -67,6 +67,7 @@
67
67
  "@vandeurenglenn/easy-worker": "^1.0.2",
68
68
  "@vandeurenglenn/queue": "^1.0.0",
69
69
  "chalk": "^4.0.0",
70
+ "p-queue": "^7.3.4",
70
71
  "p2pt": "^1.5.1",
71
72
  "pako": "^2.0.4",
72
73
  "simple-peer": "^9.11.1"