@leofcoin/chain 1.9.5 → 1.9.8

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 (35) hide show
  1. package/exports/browser/chain.js +3932 -4500
  2. package/exports/browser/{constants-M3qbPwZp.js → constants-BCaq9RBn.js} +408 -426
  3. package/exports/browser/node-browser.js +50 -57
  4. package/exports/chain.js +3185 -3567
  5. package/exports/constants-C83ZCYKa.js +12 -0
  6. package/exports/node.js +19 -24
  7. package/package.json +11 -10
  8. package/exports/chain.d.ts +0 -73
  9. package/exports/config/config.d.ts +0 -1
  10. package/exports/config/main.d.ts +0 -5
  11. package/exports/config/protocol.d.ts +0 -6
  12. package/exports/connection-monitor.d.ts +0 -14
  13. package/exports/consensus/consensus.d.ts +0 -1
  14. package/exports/consensus/helpers/sort-transactions.d.ts +0 -1
  15. package/exports/constants-eo0U5-D_.js +0 -12
  16. package/exports/constants.d.ts +0 -15
  17. package/exports/contract-registry.d.ts +0 -106
  18. package/exports/contract-utils.d.ts +0 -49
  19. package/exports/contract.d.ts +0 -90
  20. package/exports/examples/contract-inheritance-example.d.ts +0 -58
  21. package/exports/examples/hash-based-contracts.d.ts +0 -82
  22. package/exports/fee/config.d.ts +0 -4
  23. package/exports/helpers/contract.d.ts +0 -4
  24. package/exports/jobs/jobber.d.ts +0 -7
  25. package/exports/machine-state.d.ts +0 -6
  26. package/exports/machine.d.ts +0 -64
  27. package/exports/node-browser.d.ts +0 -6
  28. package/exports/node.d.ts +0 -8
  29. package/exports/protocol.d.ts +0 -15
  30. package/exports/simplifiers/state.d.ts +0 -3
  31. package/exports/state.d.ts +0 -66
  32. package/exports/sync-controller.d.ts +0 -14
  33. package/exports/transaction.d.ts +0 -41
  34. package/exports/types.d.ts +0 -24
  35. package/exports/version-control.d.ts +0 -7
@@ -1,64 +0,0 @@
1
- import EasyWorker from '@vandeurenglenn/easy-worker';
2
- export default class Machine {
3
- #private;
4
- worker: EasyWorker;
5
- states: {
6
- states: {};
7
- lastBlock: {
8
- index: number;
9
- hash: string;
10
- };
11
- accounts: {};
12
- info: {
13
- nativeCalls: bigint;
14
- nativeMints: bigint;
15
- nativeBurns: bigint;
16
- nativeTransfers: bigint;
17
- totalBurnAmount: bigint;
18
- totalMintAmount: bigint;
19
- totalTransferAmount: bigint;
20
- totalTransactions: bigint;
21
- totalBlocks: bigint;
22
- };
23
- };
24
- wantList: string[];
25
- readyResolve: (value: Machine | PromiseLike<Machine>) => void;
26
- ready: Promise<Machine>;
27
- constructor(blocks?: any[]);
28
- init(blocks: any): Promise<Machine>;
29
- updateState(): Promise<void>;
30
- /**
31
- *
32
- * @param {Address} contract
33
- * @param {String} method
34
- * @param {Array} parameters
35
- * @returns Promise<message>
36
- */
37
- execute(contract: any, method: any, parameters: any): Promise<any>;
38
- get(contract: any, method: any, parameters?: any): Promise<any>;
39
- has(address: any): Promise<unknown>;
40
- get contracts(): Promise<any>;
41
- get totalContracts(): Promise<any>;
42
- get nativeCalls(): Promise<any>;
43
- get nativeMints(): Promise<any>;
44
- get nativeBurns(): Promise<any>;
45
- get nativeTransfers(): Promise<any>;
46
- get totalBurnAmount(): Promise<any>;
47
- get totalMintAmount(): Promise<any>;
48
- get totalTransferAmount(): Promise<any>;
49
- get totalTransactions(): Promise<any>;
50
- get totalBlocks(): Promise<any>;
51
- get blocks(): Promise<[]>;
52
- get lastBlock(): Promise<any>;
53
- get lastBlockHeight(): Promise<any>;
54
- getBlocks(from?: any, to?: any): Promise<[]>;
55
- getBlock(index: any): Promise<any>;
56
- addLoadedBlock(block: any): Promise<any>;
57
- latestTransactions(): Promise<any>;
58
- delete(hash: any): Promise<unknown>;
59
- /**
60
- *
61
- * @returns Promise
62
- */
63
- deleteAll(): Promise<any[]>;
64
- }
@@ -1,6 +0,0 @@
1
- import { NodeOptions } from './constants.js';
2
- export default class Node {
3
- #private;
4
- constructor(config: any, password: string);
5
- _init(config: NodeOptions, password: string): Promise<this>;
6
- }
package/exports/node.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export default class Node {
2
- #private;
3
- ready: Promise<this>;
4
- constructor(config: any, password: any);
5
- _init(config: {
6
- autoStart: boolean;
7
- }, password: any): Promise<this>;
8
- }
@@ -1,15 +0,0 @@
1
- import type { ChainConfig } from './types.js';
2
- export declare const limit = 1800;
3
- export declare const transactionLimit = 2500;
4
- export declare const requestTimeout = 30000;
5
- export declare const syncTimeout = 30000;
6
- export declare class Protocol {
7
- version: string;
8
- resolveTimeout: EpochTimeStamp;
9
- constructor(config: ChainConfig);
10
- get limit(): number;
11
- get transactionLimit(): number;
12
- get requestTimeout(): number;
13
- get syncTimeout(): number;
14
- }
15
- export { Protocol as default };
@@ -1,3 +0,0 @@
1
- export declare const shouldResolveBlocks: () => void;
2
- export declare const shouldLoadBlocks: () => void;
3
- export declare const shouldLoadFromState: () => void;
@@ -1,66 +0,0 @@
1
- import { BlockMessage } from '@leofcoin/messages';
2
- import Contract from './contract.js';
3
- import Machine from './machine.js';
4
- import Jobber from './jobs/jobber.js';
5
- import { BlockHash } from './types.js';
6
- declare type SyncState = 'syncing' | 'synced' | 'errored' | 'connectionless';
7
- declare type ChainState = 'loading' | 'loaded';
8
- export default class State extends Contract {
9
- #private;
10
- knownBlocks: BlockHash[];
11
- jobber: Jobber;
12
- _wantList: any[];
13
- /**
14
- * contains transactions we need before we can successfully load
15
- */
16
- get wantList(): string[];
17
- get state(): {
18
- sync: SyncState;
19
- chain: ChainState;
20
- };
21
- get blockHashMap(): MapIterator<[any, any]>;
22
- get loaded(): boolean;
23
- get resolving(): boolean;
24
- get contracts(): Promise<any>;
25
- get totalContracts(): Promise<any>;
26
- get nativeCalls(): Promise<any>;
27
- get nativeMints(): Promise<any>;
28
- get nativeBurns(): Promise<any>;
29
- get nativeTransfers(): Promise<any>;
30
- get totalBurnAmouint(): Promise<any>;
31
- get totalMintAmount(): Promise<any>;
32
- get totalTransferAmount(): Promise<any>;
33
- get totalTransactions(): Promise<any>;
34
- get totalBlocks(): Promise<any>;
35
- get blocks(): Promise<[]>;
36
- get lastBlock(): Promise<any> | {
37
- index: number;
38
- hash: string;
39
- previousHash: string;
40
- };
41
- get lastBlockHeight(): Promise<any> | 0;
42
- getBlock(index: any): Promise<any>;
43
- getBlocks(from?: any, to?: any): Promise<[]>;
44
- get totalSize(): number;
45
- get machine(): Machine;
46
- constructor(config: any);
47
- clearPool(): Promise<void>;
48
- /**
49
- * drastic measurement, removes everything!
50
- */
51
- clearAll(): Promise<void>;
52
- init(): Promise<void>;
53
- updateState(message: BlockMessage): Promise<void>;
54
- getLatestBlock(): Promise<BlockMessage['decoded']>;
55
- getAndPutBlock(hash: string): Promise<BlockMessage>;
56
- resolveBlock(hash: any): any;
57
- resolveBlocks(): Promise<any>;
58
- restoreChain(): any;
59
- syncChain(lastBlock?: any): Promise<SyncState>;
60
- promiseRequests(promises: any): Promise<unknown>;
61
- get canSync(): boolean;
62
- get shouldSync(): boolean;
63
- triggerSync(): Promise<SyncState>;
64
- triggerLoad(): Promise<void>;
65
- }
66
- export {};
@@ -1,14 +0,0 @@
1
- export default class SyncController {
2
- #private;
3
- get busy(): boolean;
4
- get loading(): boolean;
5
- get resolving(): boolean;
6
- get fullyResolved(): boolean;
7
- get fullyLoaded(): boolean;
8
- constructor();
9
- /**
10
- * Resolves/rejects a promise or rejects on timeout with retry logic
11
- */
12
- resolve(operation: () => Promise<any>, timeoutMs?: number): Promise<any>;
13
- stop(): void;
14
- }
@@ -1,41 +0,0 @@
1
- import Protocol from './protocol.js';
2
- import { TransactionMessage } from '@leofcoin/messages';
3
- export default class Transaction extends Protocol {
4
- #private;
5
- constructor(config: any);
6
- /**
7
- *
8
- * @param {Address[]} transactions
9
- * @returns transactions to include
10
- */
11
- getTransactions(transactions: any): Promise<unknown>;
12
- /**
13
- *
14
- * @param {Transaction[]} transactions An array containing Transactions
15
- * @returns {TransactionMessage}
16
- */
17
- promiseTransactions(transactions: any): Promise<TransactionMessage[]>;
18
- /**
19
- *
20
- * @param {Transaction[]} transactions An array containing Transactions
21
- * @returns {Object} {transaction.decoded, transaction.hash}
22
- */
23
- promiseTransactionsContent(transactions: any): Promise<any>;
24
- /**
25
- * Get amount of transactions by address
26
- * @param {Address} address The address to get the nonce for
27
- * @returns {Number} nonce
28
- */
29
- getNonce(address: any): Promise<number>;
30
- validateNonce(address: any, nonce: any): Promise<void>;
31
- isTransactionMessage(message: any): boolean;
32
- createTransactionMessage(transaction: any, signature: any): Promise<TransactionMessage>;
33
- createTransaction(transaction: any): Promise<any>;
34
- sendTransaction(message: any): Promise<{
35
- hash: any;
36
- data: any;
37
- fee: string | bigint | 0;
38
- wait: Promise<unknown>;
39
- message: any;
40
- }>;
41
- }
@@ -1,24 +0,0 @@
1
- import { base58String } from '@vandeurenglenn/base58';
2
- export type Address = base58String;
3
- export type BlockHash = base58String;
4
- export interface globalMessage {
5
- sender: Address;
6
- call: Function;
7
- staticCall: Function;
8
- delegate: Function;
9
- staticDelegate: Function;
10
- }
11
- export declare type BlockInMemory = {
12
- index: number;
13
- hash: string;
14
- transactions: string[];
15
- loaded?: boolean;
16
- };
17
- export declare type RawBlock = {
18
- index: number;
19
- hash: string;
20
- transactions: string[];
21
- };
22
- export declare type ChainConfig = {
23
- resolveTimeout?: number;
24
- };
@@ -1,7 +0,0 @@
1
- import State from './state.js';
2
- export declare class VersionControl extends State {
3
- #private;
4
- constructor(config: any);
5
- init(): Promise<void>;
6
- protected isVersionCompatible(peerVersion?: string): boolean;
7
- }