@leofcoin/chain 1.9.6 → 1.9.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.
- package/exports/browser/chain.js +3932 -4500
- package/exports/browser/{constants-M3qbPwZp.js → constants-BCaq9RBn.js} +408 -426
- package/exports/browser/node-browser.js +50 -57
- package/exports/chain.js +3185 -3567
- package/exports/constants-C83ZCYKa.js +12 -0
- package/exports/node.js +19 -24
- package/package.json +2 -1
- package/exports/chain.d.ts +0 -73
- package/exports/config/config.d.ts +0 -1
- package/exports/config/main.d.ts +0 -5
- package/exports/config/protocol.d.ts +0 -6
- package/exports/connection-monitor.d.ts +0 -14
- package/exports/consensus/consensus.d.ts +0 -1
- package/exports/consensus/helpers/sort-transactions.d.ts +0 -1
- package/exports/constants-eo0U5-D_.js +0 -12
- package/exports/constants.d.ts +0 -15
- package/exports/contract-registry.d.ts +0 -106
- package/exports/contract-utils.d.ts +0 -49
- package/exports/contract.d.ts +0 -90
- package/exports/examples/contract-inheritance-example.d.ts +0 -58
- package/exports/examples/hash-based-contracts.d.ts +0 -82
- package/exports/fee/config.d.ts +0 -4
- package/exports/helpers/contract.d.ts +0 -4
- package/exports/jobs/jobber.d.ts +0 -7
- package/exports/machine-state.d.ts +0 -6
- package/exports/machine.d.ts +0 -64
- package/exports/node-browser.d.ts +0 -6
- package/exports/node.d.ts +0 -8
- package/exports/protocol.d.ts +0 -15
- package/exports/simplifiers/state.d.ts +0 -3
- package/exports/state.d.ts +0 -66
- package/exports/sync-controller.d.ts +0 -14
- package/exports/transaction.d.ts +0 -41
- package/exports/types.d.ts +0 -24
- package/exports/version-control.d.ts +0 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import networks from '@leofcoin/networks';
|
|
2
|
+
|
|
3
|
+
const PROTOCOL_VERSION = "0.1.1";
|
|
4
|
+
const REACHED_ONE_ZERO_ZERO = false;
|
|
5
|
+
const DEFAULT_NODE_OPTIONS = {
|
|
6
|
+
network: "leofcoin:peach",
|
|
7
|
+
networkVersion: "peach",
|
|
8
|
+
version: PROTOCOL_VERSION,
|
|
9
|
+
stars: networks.leofcoin.peach.stars
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { DEFAULT_NODE_OPTIONS as D, PROTOCOL_VERSION as P, REACHED_ONE_ZERO_ZERO as R };
|
package/exports/node.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
import Peernet from '@leofcoin/peernet';
|
|
2
2
|
import nodeConfig from '@leofcoin/lib/node-config';
|
|
3
|
-
import { D as DEFAULT_NODE_OPTIONS } from './constants-
|
|
3
|
+
import { D as DEFAULT_NODE_OPTIONS } from './constants-C83ZCYKa.js';
|
|
4
4
|
import '@leofcoin/networks';
|
|
5
5
|
|
|
6
|
-
// import config from './config/config'
|
|
7
6
|
class Node {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
return this;
|
|
28
|
-
// this.config = await config()
|
|
29
|
-
}
|
|
7
|
+
#node;
|
|
8
|
+
constructor(config, password) {
|
|
9
|
+
this.ready = this._init(config, password);
|
|
10
|
+
}
|
|
11
|
+
async _init(config = {
|
|
12
|
+
autoStart: false
|
|
13
|
+
}, password) {
|
|
14
|
+
config = { ...DEFAULT_NODE_OPTIONS, ...config };
|
|
15
|
+
this.#node = globalThis.Peernet ? await new globalThis.Peernet(config, password) : await new Peernet(config, password);
|
|
16
|
+
await nodeConfig(config);
|
|
17
|
+
globalThis.pubsub.subscribe("chain:ready", async () => {
|
|
18
|
+
if (!this.#node.autoStart) {
|
|
19
|
+
await this.#node.start();
|
|
20
|
+
pubsub.publish("node:ready", true);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
export { Node as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@types/semver": "^7.7.1",
|
|
57
57
|
"@vandeurenglenn/debug": "^1.4.0",
|
|
58
58
|
"rollup": "^4.60.1",
|
|
59
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
59
60
|
"rollup-plugin-modify": "^3.0.0",
|
|
60
61
|
"tape": "^5.9.0",
|
|
61
62
|
"tslib": "^2.8.1"
|
package/exports/chain.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { VersionControl } from './version-control.js';
|
|
2
|
-
export default class Chain extends VersionControl {
|
|
3
|
-
#private;
|
|
4
|
-
id: any;
|
|
5
|
-
utils: {};
|
|
6
|
-
readyResolve: (value: boolean | PromiseLike<boolean>) => void;
|
|
7
|
-
ready: Promise<boolean>;
|
|
8
|
-
constructor(config: any);
|
|
9
|
-
get nativeToken(): string;
|
|
10
|
-
get validators(): any[];
|
|
11
|
-
hasTransactionToHandle(): Promise<boolean>;
|
|
12
|
-
getPeerTransactionPool(peer: any): Promise<any[]>;
|
|
13
|
-
participate(address: any): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* every tx done is trough contracts so no need for amount
|
|
16
|
-
* data is undefined when nothing is returned
|
|
17
|
-
* error is thrown on error so undefined data doesn't mean there is an error...
|
|
18
|
-
**/
|
|
19
|
-
sendTransaction(transaction: any): Promise<{
|
|
20
|
-
hash: any;
|
|
21
|
-
data: any;
|
|
22
|
-
fee: string | bigint | 0;
|
|
23
|
-
wait: Promise<unknown>;
|
|
24
|
-
message: any;
|
|
25
|
-
}>;
|
|
26
|
-
addContract(transaction: any, contractMessage: any): Promise<{
|
|
27
|
-
hash: any;
|
|
28
|
-
data: any;
|
|
29
|
-
fee: string | bigint | 0;
|
|
30
|
-
wait: Promise<unknown>;
|
|
31
|
-
message: any;
|
|
32
|
-
}>;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {Address} sender
|
|
36
|
-
* @param {Address} contract
|
|
37
|
-
* @param {String} method
|
|
38
|
-
* @param {Array} parameters
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
internalCall(sender: Address, contract: Address, method: string, parameters?: any[]): Promise<any>;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param {Address} contract
|
|
45
|
-
* @param {String} method
|
|
46
|
-
* @param {Array} parameters
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
call(contract: Address, method: string, parameters?: any[]): Promise<any>;
|
|
50
|
-
staticCall(contract: Address, method: string, parameters?: any[]): Promise<any>;
|
|
51
|
-
mint(to: Address, amount: bigint): Promise<any>;
|
|
52
|
-
transfer(from: Address, to: Address, amount: bigint): Promise<any>;
|
|
53
|
-
balanceOf(address: Address): Promise<bigint>;
|
|
54
|
-
get balance(): Promise<bigint>;
|
|
55
|
-
get balances(): Promise<{
|
|
56
|
-
[index: string]: bigint;
|
|
57
|
-
}>;
|
|
58
|
-
get contracts(): Promise<any>;
|
|
59
|
-
deleteAll(): Promise<any[]>;
|
|
60
|
-
/**
|
|
61
|
-
* lookup an address for a registered name using the builtin nameService
|
|
62
|
-
* @check nameService
|
|
63
|
-
*
|
|
64
|
-
* @param {String} - contractName
|
|
65
|
-
* @returns {String} - address
|
|
66
|
-
*
|
|
67
|
-
* @example chain.lookup('myCoolContractName') // qmqsfddfdgfg...
|
|
68
|
-
*/
|
|
69
|
-
lookup(name: any): Promise<{
|
|
70
|
-
owner: any;
|
|
71
|
-
address: any;
|
|
72
|
-
}>;
|
|
73
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/exports/config/main.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Peer from '@netpeer/swarm/peer';
|
|
2
|
-
/**
|
|
3
|
-
* Connection Monitor - Monitors peer connections and handles reconnection logic
|
|
4
|
-
*/
|
|
5
|
-
export default class ConnectionMonitor {
|
|
6
|
-
#private;
|
|
7
|
-
get isMonitoring(): boolean;
|
|
8
|
-
get connectedPeers(): Peer[];
|
|
9
|
-
get compatiblePeers(): Peer[];
|
|
10
|
-
get disconnectedPeers(): Peer[];
|
|
11
|
-
start(version: any): void;
|
|
12
|
-
stop(): void;
|
|
13
|
-
waitForPeers(timeoutMs?: number): Promise<boolean>;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import networks from '@leofcoin/networks';
|
|
2
|
-
|
|
3
|
-
const PROTOCOL_VERSION = '0.1.1';
|
|
4
|
-
const REACHED_ONE_ZERO_ZERO = false; // set to true when protocol reaches v1.0.0
|
|
5
|
-
const DEFAULT_NODE_OPTIONS = {
|
|
6
|
-
network: 'leofcoin:peach',
|
|
7
|
-
networkVersion: 'peach',
|
|
8
|
-
version: PROTOCOL_VERSION,
|
|
9
|
-
stars: networks.leofcoin.peach.stars
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { DEFAULT_NODE_OPTIONS as D, PROTOCOL_VERSION as P, REACHED_ONE_ZERO_ZERO as R };
|
package/exports/constants.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const PROTOCOL_VERSION = "0.1.1";
|
|
2
|
-
export declare const MACHINE_STATE_VERSION = "1";
|
|
3
|
-
export declare const REACHED_ONE_ZERO_ZERO = false;
|
|
4
|
-
export type NodeOptions = {
|
|
5
|
-
network?: string;
|
|
6
|
-
networkVersion?: string;
|
|
7
|
-
version?: string;
|
|
8
|
-
stars?: string[];
|
|
9
|
-
};
|
|
10
|
-
export declare const DEFAULT_NODE_OPTIONS: {
|
|
11
|
-
network: string;
|
|
12
|
-
networkVersion: string;
|
|
13
|
-
version: string;
|
|
14
|
-
stars: string[];
|
|
15
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { ContractMessage } from '@leofcoin/messages';
|
|
2
|
-
/**
|
|
3
|
-
* Registry for managing base contracts and contract inheritance
|
|
4
|
-
*/
|
|
5
|
-
export declare class ContractRegistry {
|
|
6
|
-
private baseContracts;
|
|
7
|
-
private contractNames;
|
|
8
|
-
private contractDependencies;
|
|
9
|
-
/**
|
|
10
|
-
* Register a base contract that can be reused
|
|
11
|
-
* Uses the contract code hash as the identifier and registers the name in nameService
|
|
12
|
-
* @param name The name to register in nameService
|
|
13
|
-
* @param message The contract message
|
|
14
|
-
* @returns The contract hash
|
|
15
|
-
*/
|
|
16
|
-
registerBaseContract(name: string, message: ContractMessage): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Register a name for a contract hash in the nameService
|
|
19
|
-
* @param name The name to register
|
|
20
|
-
* @param hash The contract hash
|
|
21
|
-
* @param chain The chain instance (for making transactions)
|
|
22
|
-
* @param signer The wallet to sign the transaction
|
|
23
|
-
*/
|
|
24
|
-
registerNameInNameService(name: string, hash: string, chain: any, signer: any): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Get a base contract by name
|
|
27
|
-
* First checks local registry, then queries nameService if available
|
|
28
|
-
* @param name The name of the base contract
|
|
29
|
-
* @returns The contract message or undefined
|
|
30
|
-
*/
|
|
31
|
-
getBaseContract(name: string): ContractMessage | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Get a base contract by hash
|
|
34
|
-
* @param hash The hash of the contract
|
|
35
|
-
* @returns The contract message or undefined
|
|
36
|
-
*/
|
|
37
|
-
getBaseContractByHash(hash: string): ContractMessage | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Resolve a name to a hash (first local, then nameService)
|
|
40
|
-
* @param name The contract name
|
|
41
|
-
* @returns The contract hash or undefined
|
|
42
|
-
*/
|
|
43
|
-
resolveNameToHash(name: string): string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Register contract dependencies (inheritance chain)
|
|
46
|
-
* @param contractHash The hash of the contract
|
|
47
|
-
* @param dependencies Array of base contract hashes this contract depends on
|
|
48
|
-
*/
|
|
49
|
-
registerDependencies(contractHash: string, dependencies: string[]): void;
|
|
50
|
-
/**
|
|
51
|
-
* Get all dependencies for a contract
|
|
52
|
-
* @param contractHash The hash of the contract
|
|
53
|
-
* @returns Array of dependency hashes
|
|
54
|
-
*/
|
|
55
|
-
getDependencies(contractHash: string): string[];
|
|
56
|
-
/**
|
|
57
|
-
* Check if all dependencies for a contract are available
|
|
58
|
-
* @param contractHash The hash of the contract
|
|
59
|
-
* @returns true if all dependencies are available
|
|
60
|
-
*/
|
|
61
|
-
areDependenciesAvailable(contractHash: string): Promise<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* Get all registered contract hashes
|
|
64
|
-
* @returns Array of contract hashes
|
|
65
|
-
*/
|
|
66
|
-
getBaseContractHashes(): string[];
|
|
67
|
-
/**
|
|
68
|
-
* Get hash for a registered name
|
|
69
|
-
* @param name The contract name
|
|
70
|
-
* @returns The hash or undefined
|
|
71
|
-
*/
|
|
72
|
-
getHashForName(name: string): string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Analyze contract code and extract inheritance information
|
|
75
|
-
* @param contractCode The contract code to analyze
|
|
76
|
-
* @returns Inheritance information
|
|
77
|
-
*/
|
|
78
|
-
analyzeContract(contractCode: string): {
|
|
79
|
-
className: string | null;
|
|
80
|
-
baseClass: string | null;
|
|
81
|
-
hasInheritance: boolean;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Build a complete contract by combining base contracts
|
|
85
|
-
* @param contractCode The derived contract code
|
|
86
|
-
* @param baseContractIdentifiers Names or hashes of base contracts to include
|
|
87
|
-
* @returns Combined contract code
|
|
88
|
-
*/
|
|
89
|
-
buildContract(contractCode: string, baseContractIdentifiers?: string[]): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* Clear all registered contracts
|
|
92
|
-
*/
|
|
93
|
-
clear(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Get all registered base contract names
|
|
96
|
-
* @returns Array of base contract names
|
|
97
|
-
*/
|
|
98
|
-
getBaseContractNames(): string[];
|
|
99
|
-
/**
|
|
100
|
-
* Get name for a hash if registered
|
|
101
|
-
* @param hash The contract hash
|
|
102
|
-
* @returns The name or undefined
|
|
103
|
-
*/
|
|
104
|
-
getNameForHash(hash: string): string | undefined;
|
|
105
|
-
}
|
|
106
|
-
export declare const contractRegistry: ContractRegistry;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a hash from contract code using ContractMessage's hash method
|
|
3
|
-
* For base contracts, omit constructorParameters to hash only the code
|
|
4
|
-
* @param creator The creator address
|
|
5
|
-
* @param contractCode The contract code to hash
|
|
6
|
-
* @param constructorParameters Constructor parameters (omit for base contracts)
|
|
7
|
-
* @returns Promise<string> The hash of the contract
|
|
8
|
-
*/
|
|
9
|
-
export declare const hashContractCode: (creator: string, contractCode: string, constructorParameters?: any[]) => Promise<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Check if a class is derived from another class
|
|
12
|
-
* @param derivedClass The class to check
|
|
13
|
-
* @param baseClass The potential base class
|
|
14
|
-
* @returns true if derivedClass extends baseClass
|
|
15
|
-
*/
|
|
16
|
-
export declare const isDerivedFrom: (derivedClass: any, baseClass: any) => boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Check if a class instance is derived from another class
|
|
19
|
-
* @param instance The instance to check
|
|
20
|
-
* @param baseClass The potential base class
|
|
21
|
-
* @returns true if instance's class extends baseClass
|
|
22
|
-
*/
|
|
23
|
-
export declare const isInstanceOf: (instance: any, baseClass: any) => boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Get the inheritance chain of a class
|
|
26
|
-
* @param classConstructor The class to get the inheritance chain for
|
|
27
|
-
* @returns Array of class names in the inheritance chain
|
|
28
|
-
*/
|
|
29
|
-
export declare const getInheritanceChain: (classConstructor: any) => string[];
|
|
30
|
-
/**
|
|
31
|
-
* Extract base contract code from a contract
|
|
32
|
-
* Useful for separating reusable code into base contracts
|
|
33
|
-
* @param contractCode The contract code to analyze
|
|
34
|
-
* @returns Object with base contract and derived contract code
|
|
35
|
-
*/
|
|
36
|
-
export declare const extractBaseContract: (contractCode: string) => {
|
|
37
|
-
baseCode: string;
|
|
38
|
-
derivedCode: string;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Parse contract inheritance information from contract code
|
|
42
|
-
* @param contractCode The contract code to parse
|
|
43
|
-
* @returns Information about the contract's inheritance
|
|
44
|
-
*/
|
|
45
|
-
export declare const parseContractInheritance: (contractCode: string) => {
|
|
46
|
-
className: string | null;
|
|
47
|
-
baseClass: string | null;
|
|
48
|
-
hasInheritance: boolean;
|
|
49
|
-
};
|
package/exports/contract.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import Transaction from './transaction.js';
|
|
2
|
-
import type MultiWallet from '@leofcoin/multi-wallet';
|
|
3
|
-
/**
|
|
4
|
-
* @extends {Transaction}
|
|
5
|
-
*/
|
|
6
|
-
export default class Contract extends Transaction {
|
|
7
|
-
constructor(config: any);
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {Address} creator
|
|
11
|
-
* @param {String} contract
|
|
12
|
-
* @param {Array} constructorParameters
|
|
13
|
-
* @returns lib.createContractMessage
|
|
14
|
-
*/
|
|
15
|
-
createContractMessage(creator: any, contract: any, constructorParameters?: any[]): Promise<import("@leofcoin/messages").ContractMessage>;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {Address} creator
|
|
19
|
-
* @param {String} contract
|
|
20
|
-
* @param {Array} constructorParameters
|
|
21
|
-
* @returns {Address}
|
|
22
|
-
*/
|
|
23
|
-
createContractAddress(creator: any, contract: any, constructorParameters?: any[]): Promise<any>;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {String} contract
|
|
27
|
-
* @param {Array} parameters
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
deployContract(signer: MultiWallet, contract: any, constructorParameters?: any[]): Promise<{
|
|
31
|
-
hash: any;
|
|
32
|
-
data: any;
|
|
33
|
-
fee: string | bigint | 0;
|
|
34
|
-
wait: Promise<unknown>;
|
|
35
|
-
message: any;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* Register a base contract for reuse by other contracts
|
|
39
|
-
* The contract is stored by its hash, enabling inheritance and code reuse
|
|
40
|
-
* @param {String} name The name to register for this contract
|
|
41
|
-
* @param {String} contract The contract code
|
|
42
|
-
* @param {Array} constructorParameters Constructor parameters
|
|
43
|
-
* @returns {Promise<string>} The contract hash
|
|
44
|
-
*/
|
|
45
|
-
registerBaseContract(name: string, contract: string, constructorParameters?: any[]): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* Deploy a contract with optional base contracts for inheritance
|
|
48
|
-
* @param {MultiWallet} signer The wallet to sign with
|
|
49
|
-
* @param {String} contract The contract code
|
|
50
|
-
* @param {Array} constructorParameters Constructor parameters
|
|
51
|
-
* @param {Array<string>} baseContracts Optional array of base contract names or hashes
|
|
52
|
-
* @returns Transaction result
|
|
53
|
-
*/
|
|
54
|
-
deployDerivedContract(signer: MultiWallet, contract: string, baseContractIdentifier?: string, constructorParameters?: any[]): Promise<{
|
|
55
|
-
hash: any;
|
|
56
|
-
data: any;
|
|
57
|
-
fee: string | bigint | 0;
|
|
58
|
-
wait: Promise<unknown>;
|
|
59
|
-
message: any;
|
|
60
|
-
}>;
|
|
61
|
-
deployContractMessage(signer: any, message: any): Promise<{
|
|
62
|
-
hash: any;
|
|
63
|
-
data: any;
|
|
64
|
-
fee: string | bigint | 0;
|
|
65
|
-
wait: Promise<unknown>;
|
|
66
|
-
message: any;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Check if a class is derived from another class
|
|
70
|
-
* @param derivedClass The class to check
|
|
71
|
-
* @param baseClass The potential base class
|
|
72
|
-
* @returns true if derivedClass extends baseClass
|
|
73
|
-
*/
|
|
74
|
-
isDerivedFrom(derivedClass: any, baseClass: any): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Parse contract code to extract inheritance information
|
|
77
|
-
* @param contractCode The contract code to parse
|
|
78
|
-
* @returns Inheritance information
|
|
79
|
-
*/
|
|
80
|
-
parseContractInheritance(contractCode: string): {
|
|
81
|
-
className: string | null;
|
|
82
|
-
baseClass: string | null;
|
|
83
|
-
hasInheritance: boolean;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Get the contract registry instance
|
|
87
|
-
* @returns {ContractRegistry} The contract registry
|
|
88
|
-
*/
|
|
89
|
-
getRegistry(): import("./contract-registry.js").ContractRegistry;
|
|
90
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Using Contract Inheritance and Base Contracts
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates how to:
|
|
5
|
-
* 1. Check if a class is derived from another class
|
|
6
|
-
* 2. Register reusable base contracts
|
|
7
|
-
* 3. Deploy derived contracts that extend base contracts
|
|
8
|
-
*/
|
|
9
|
-
import Contract from '../contract.js';
|
|
10
|
-
import type MultiWallet from '@leofcoin/multi-wallet';
|
|
11
|
-
/**
|
|
12
|
-
* Example usage of the contract system
|
|
13
|
-
*/
|
|
14
|
-
export declare function exampleContractDeployment(contractInstance: Contract, signer: MultiWallet): Promise<{
|
|
15
|
-
baseHash: string;
|
|
16
|
-
deployResult: {
|
|
17
|
-
hash: any;
|
|
18
|
-
data: any;
|
|
19
|
-
fee: string | bigint | 0;
|
|
20
|
-
wait: Promise<unknown>;
|
|
21
|
-
message: any;
|
|
22
|
-
};
|
|
23
|
-
altDeployResult: {
|
|
24
|
-
hash: any;
|
|
25
|
-
data: any;
|
|
26
|
-
fee: string | bigint | 0;
|
|
27
|
-
wait: Promise<unknown>;
|
|
28
|
-
message: any;
|
|
29
|
-
};
|
|
30
|
-
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Example: Creating a modular contract system
|
|
33
|
-
*/
|
|
34
|
-
export declare function exampleModularContracts(contractInstance: Contract, signer: MultiWallet): Promise<{
|
|
35
|
-
hash: any;
|
|
36
|
-
data: any;
|
|
37
|
-
fee: string | bigint | 0;
|
|
38
|
-
wait: Promise<unknown>;
|
|
39
|
-
message: any;
|
|
40
|
-
}>;
|
|
41
|
-
/**
|
|
42
|
-
* Example: Best practices for contract organization
|
|
43
|
-
*/
|
|
44
|
-
export declare const contractBestPractices: {
|
|
45
|
-
baseContracts: string[];
|
|
46
|
-
derivedContracts: string[];
|
|
47
|
-
benefits: string[];
|
|
48
|
-
};
|
|
49
|
-
declare const _default: {
|
|
50
|
-
exampleContractDeployment: typeof exampleContractDeployment;
|
|
51
|
-
exampleModularContracts: typeof exampleModularContracts;
|
|
52
|
-
contractBestPractices: {
|
|
53
|
-
baseContracts: string[];
|
|
54
|
-
derivedContracts: string[];
|
|
55
|
-
benefits: string[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export default _default;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Hash-Based Contract Registry with NameService Integration
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates:
|
|
5
|
-
* 1. Hashing contract code for content-addressed storage
|
|
6
|
-
* 2. Registering contracts by hash with name mappings
|
|
7
|
-
* 3. Using nameService for on-chain name resolution
|
|
8
|
-
* 4. Deploying contracts by name or hash
|
|
9
|
-
*/
|
|
10
|
-
import Contract from '../contract.js';
|
|
11
|
-
import type MultiWallet from '@leofcoin/multi-wallet';
|
|
12
|
-
export declare function exampleHashBasedRegistration(contract: Contract, signer: MultiWallet): Promise<{
|
|
13
|
-
codeHash: string;
|
|
14
|
-
registeredHash: string;
|
|
15
|
-
result: {
|
|
16
|
-
hash: any;
|
|
17
|
-
data: any;
|
|
18
|
-
fee: string | bigint | 0;
|
|
19
|
-
wait: Promise<unknown>;
|
|
20
|
-
message: any;
|
|
21
|
-
};
|
|
22
|
-
}>;
|
|
23
|
-
export declare function exampleNameServiceIntegration(contract: Contract, signer: MultiWallet): Promise<{
|
|
24
|
-
hash: string;
|
|
25
|
-
}>;
|
|
26
|
-
export declare function exampleContractAliases(contract: Contract): Promise<{
|
|
27
|
-
hash1: string;
|
|
28
|
-
hash2: string;
|
|
29
|
-
}>;
|
|
30
|
-
export declare function exampleVersionedContracts(contract: Contract, signer: MultiWallet): Promise<{
|
|
31
|
-
v1Hash: string;
|
|
32
|
-
v2Hash: string;
|
|
33
|
-
result: {
|
|
34
|
-
hash: any;
|
|
35
|
-
data: any;
|
|
36
|
-
fee: string | bigint | 0;
|
|
37
|
-
wait: Promise<unknown>;
|
|
38
|
-
message: any;
|
|
39
|
-
};
|
|
40
|
-
}>;
|
|
41
|
-
export declare function exampleDeployByHash(contract: Contract, signer: MultiWallet): Promise<{
|
|
42
|
-
baseHash: string;
|
|
43
|
-
result: {
|
|
44
|
-
hash: any;
|
|
45
|
-
data: any;
|
|
46
|
-
fee: string | bigint | 0;
|
|
47
|
-
wait: Promise<unknown>;
|
|
48
|
-
message: any;
|
|
49
|
-
};
|
|
50
|
-
}>;
|
|
51
|
-
export declare function exampleVerifyContract(contract: Contract): Promise<{
|
|
52
|
-
registeredHash: string;
|
|
53
|
-
computedHash: string;
|
|
54
|
-
}>;
|
|
55
|
-
export declare function exampleContractDiscovery(contract: Contract): Promise<{
|
|
56
|
-
names: string[];
|
|
57
|
-
hashes: string[];
|
|
58
|
-
nameToHash: {};
|
|
59
|
-
hashToName: {};
|
|
60
|
-
}>;
|
|
61
|
-
export declare function exampleDependencyResolution(contract: Contract, signer: MultiWallet): Promise<{
|
|
62
|
-
storageHash: string;
|
|
63
|
-
validationHash: string;
|
|
64
|
-
result: {
|
|
65
|
-
hash: any;
|
|
66
|
-
data: any;
|
|
67
|
-
fee: string | bigint | 0;
|
|
68
|
-
wait: Promise<unknown>;
|
|
69
|
-
message: any;
|
|
70
|
-
};
|
|
71
|
-
}>;
|
|
72
|
-
declare const _default: {
|
|
73
|
-
exampleHashBasedRegistration: typeof exampleHashBasedRegistration;
|
|
74
|
-
exampleNameServiceIntegration: typeof exampleNameServiceIntegration;
|
|
75
|
-
exampleContractAliases: typeof exampleContractAliases;
|
|
76
|
-
exampleVersionedContracts: typeof exampleVersionedContracts;
|
|
77
|
-
exampleDeployByHash: typeof exampleDeployByHash;
|
|
78
|
-
exampleVerifyContract: typeof exampleVerifyContract;
|
|
79
|
-
exampleContractDiscovery: typeof exampleContractDiscovery;
|
|
80
|
-
exampleDependencyResolution: typeof exampleDependencyResolution;
|
|
81
|
-
};
|
|
82
|
-
export default _default;
|
package/exports/fee/config.d.ts
DELETED
package/exports/jobs/jobber.d.ts
DELETED