@leofcoin/endpoint-clients 0.3.7 → 0.3.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.
- package/.prettierrc +7 -0
- package/LICENSE +20 -20
- package/README.md +208 -208
- package/package.json +52 -52
- package/rollup.config.js +14 -14
- package/src/direct.ts +185 -177
- package/src/http.ts +159 -160
- package/src/index.ts +3 -3
- package/src/ws.ts +156 -151
- package/test/index.js +16 -16
- package/test/spec.js +44 -44
- package/tsconfig.json +15 -15
- package/exports/direct.js +0 -157
- package/exports/http.js +0 -135
- package/exports/index.js +0 -5
- package/exports/types/direct.d.ts +0 -53
- package/exports/types/http.d.ts +0 -54
- package/exports/types/index.d.ts +0 -3
- package/exports/types/ws.d.ts +0 -54
- package/exports/ws.js +0 -134
package/test/spec.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
export const implementations = [
|
|
2
|
-
'accounts',
|
|
3
|
-
'balanceOf',
|
|
4
|
-
'balances',
|
|
5
|
-
'blocks',
|
|
6
|
-
'contracts',
|
|
7
|
-
'createContractAddress',
|
|
8
|
-
'createTransactionFrom',
|
|
9
|
-
'deployContract',
|
|
10
|
-
'getBlock',
|
|
11
|
-
'hasTransactionToHandle',
|
|
12
|
-
'lookup',
|
|
13
|
-
'nativeBurns',
|
|
14
|
-
'nativeCalls',
|
|
15
|
-
'nativeMints',
|
|
16
|
-
'nativeToken',
|
|
17
|
-
'nativeTransfers',
|
|
18
|
-
'participate',
|
|
19
|
-
'participating',
|
|
20
|
-
'peerId',
|
|
21
|
-
'peers',
|
|
22
|
-
'pubsub',
|
|
23
|
-
'selectAccount',
|
|
24
|
-
'selectedAccount',
|
|
25
|
-
'staticCall',
|
|
26
|
-
'totalBlocks',
|
|
27
|
-
'totalSize',
|
|
28
|
-
'totalTransactions',
|
|
29
|
-
'validators',
|
|
30
|
-
'lastBlock'
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
export const needsImplementations = (client) => {
|
|
34
|
-
const needs = []
|
|
35
|
-
for (const key of implementations) {
|
|
36
|
-
try {
|
|
37
|
-
if (!client[key] && key === 'pubsub' && !client.isHttpClient) needs.push(key)
|
|
38
|
-
} catch (error) {
|
|
39
|
-
if (error.message !== "Cannot read properties of undefined (reading 'pubsub')") throw new Error(error)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
console.log(needs);
|
|
44
|
-
return needs
|
|
1
|
+
export const implementations = [
|
|
2
|
+
'accounts',
|
|
3
|
+
'balanceOf',
|
|
4
|
+
'balances',
|
|
5
|
+
'blocks',
|
|
6
|
+
'contracts',
|
|
7
|
+
'createContractAddress',
|
|
8
|
+
'createTransactionFrom',
|
|
9
|
+
'deployContract',
|
|
10
|
+
'getBlock',
|
|
11
|
+
'hasTransactionToHandle',
|
|
12
|
+
'lookup',
|
|
13
|
+
'nativeBurns',
|
|
14
|
+
'nativeCalls',
|
|
15
|
+
'nativeMints',
|
|
16
|
+
'nativeToken',
|
|
17
|
+
'nativeTransfers',
|
|
18
|
+
'participate',
|
|
19
|
+
'participating',
|
|
20
|
+
'peerId',
|
|
21
|
+
'peers',
|
|
22
|
+
'pubsub',
|
|
23
|
+
'selectAccount',
|
|
24
|
+
'selectedAccount',
|
|
25
|
+
'staticCall',
|
|
26
|
+
'totalBlocks',
|
|
27
|
+
'totalSize',
|
|
28
|
+
'totalTransactions',
|
|
29
|
+
'validators',
|
|
30
|
+
'lastBlock'
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
export const needsImplementations = (client) => {
|
|
34
|
+
const needs = []
|
|
35
|
+
for (const key of implementations) {
|
|
36
|
+
try {
|
|
37
|
+
if (!client[key] && key === 'pubsub' && !client.isHttpClient) needs.push(key)
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error.message !== "Cannot read properties of undefined (reading 'pubsub')") throw new Error(error)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
console.log(needs);
|
|
44
|
+
return needs
|
|
45
45
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "NodeNext",
|
|
4
|
-
"target": "es2022",
|
|
5
|
-
"outDir": "./exports",
|
|
6
|
-
"moduleResolution":"NodeNext",
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./exports/types",
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"resolveJsonModule": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"./src/**/*"
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "NodeNext",
|
|
4
|
+
"target": "es2022",
|
|
5
|
+
"outDir": "./exports",
|
|
6
|
+
"moduleResolution":"NodeNext",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./exports/types",
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"resolveJsonModule": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"./src/**/*"
|
|
15
|
+
]
|
|
16
16
|
}
|
package/exports/direct.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { formatUnits, BigNumber } from '@leofcoin/utils';
|
|
2
|
-
|
|
3
|
-
class Client {
|
|
4
|
-
url;
|
|
5
|
-
networkVersion;
|
|
6
|
-
client;
|
|
7
|
-
constructor(url = 'ws://localhost:4040', networkVersion = 'leofcoin-peach') {
|
|
8
|
-
this.url = url;
|
|
9
|
-
this.networkVersion = networkVersion;
|
|
10
|
-
}
|
|
11
|
-
get pubsub() {
|
|
12
|
-
return {
|
|
13
|
-
publish: globalThis.pubsub.publish,
|
|
14
|
-
subscribe: globalThis.pubsub.subscribe
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
balances() {
|
|
18
|
-
return chain.balances;
|
|
19
|
-
}
|
|
20
|
-
async balanceOf(address, format) {
|
|
21
|
-
const balances = await chain.balances;
|
|
22
|
-
const balance = balances[address];
|
|
23
|
-
return format ? formatUnits(balance) : balance;
|
|
24
|
-
}
|
|
25
|
-
selectedAccount() {
|
|
26
|
-
return peernet.selectedAccount;
|
|
27
|
-
}
|
|
28
|
-
async selectAccount(address) {
|
|
29
|
-
try {
|
|
30
|
-
await globalThis.walletStore.put('selected-account', address);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
throw new Error(`couldn't set selected account`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
accounts() {
|
|
37
|
-
return chain.accounts;
|
|
38
|
-
}
|
|
39
|
-
hasTransactionToHandle() {
|
|
40
|
-
return chain.hasTransactionToHandle();
|
|
41
|
-
}
|
|
42
|
-
getBlock(index) {
|
|
43
|
-
return chain.blocks[index - 1];
|
|
44
|
-
}
|
|
45
|
-
blocks(amount) {
|
|
46
|
-
return chain.blocks.slice(amount);
|
|
47
|
-
}
|
|
48
|
-
sendTransaction(transaction) {
|
|
49
|
-
return chain.sendTransaction(transaction);
|
|
50
|
-
}
|
|
51
|
-
peerId() {
|
|
52
|
-
return peernet.peerId;
|
|
53
|
-
}
|
|
54
|
-
peers() {
|
|
55
|
-
return peernet.peers;
|
|
56
|
-
}
|
|
57
|
-
validators() {
|
|
58
|
-
return chain.validators;
|
|
59
|
-
}
|
|
60
|
-
lookup(name) {
|
|
61
|
-
return chain.lookup(name);
|
|
62
|
-
}
|
|
63
|
-
staticCall(contract, method, params) {
|
|
64
|
-
return chain.staticCall(contract, method, params);
|
|
65
|
-
}
|
|
66
|
-
nativeBurns() {
|
|
67
|
-
return chain.nativeBurns;
|
|
68
|
-
}
|
|
69
|
-
contracts() {
|
|
70
|
-
return chain.contracts;
|
|
71
|
-
}
|
|
72
|
-
nativeMints() {
|
|
73
|
-
return chain.nativeMints;
|
|
74
|
-
}
|
|
75
|
-
nativeToken() {
|
|
76
|
-
return chain.nativeToken;
|
|
77
|
-
}
|
|
78
|
-
nativeTransfers() {
|
|
79
|
-
return chain.nativeTransfers;
|
|
80
|
-
}
|
|
81
|
-
totalSize() {
|
|
82
|
-
return chain.totalSize;
|
|
83
|
-
}
|
|
84
|
-
totalTransactions() {
|
|
85
|
-
return chain.totalTransactions;
|
|
86
|
-
}
|
|
87
|
-
poolTransactions() {
|
|
88
|
-
return transactionPoolStore.get();
|
|
89
|
-
}
|
|
90
|
-
transactionsInPool() {
|
|
91
|
-
return transactionPoolStore.length();
|
|
92
|
-
}
|
|
93
|
-
transactionPoolSize() {
|
|
94
|
-
return transactionPoolStore.size();
|
|
95
|
-
}
|
|
96
|
-
totalBlocks() {
|
|
97
|
-
return chain.blocks.length;
|
|
98
|
-
}
|
|
99
|
-
nativeCalls() {
|
|
100
|
-
return chain.nativeCalls;
|
|
101
|
-
}
|
|
102
|
-
participating() {
|
|
103
|
-
return chain.participating;
|
|
104
|
-
}
|
|
105
|
-
participate(address) {
|
|
106
|
-
return chain.participate(address);
|
|
107
|
-
}
|
|
108
|
-
createContractAddress(owner, code, params) {
|
|
109
|
-
return chain.createContractAddress(owner, code, params);
|
|
110
|
-
}
|
|
111
|
-
deployContract(code, params) {
|
|
112
|
-
return chain.deployContract(code, params);
|
|
113
|
-
}
|
|
114
|
-
network() {
|
|
115
|
-
return chain.network;
|
|
116
|
-
}
|
|
117
|
-
async networkStats() {
|
|
118
|
-
let accountsHolding = 0;
|
|
119
|
-
let accountsHoldingAmount = BigNumber.from(0);
|
|
120
|
-
let topHolders = [];
|
|
121
|
-
const balances = Object.entries(await chain.balances)
|
|
122
|
-
.map(([holder, amount]) => {
|
|
123
|
-
amount = BigNumber.from(amount);
|
|
124
|
-
return { holder, amount };
|
|
125
|
-
})
|
|
126
|
-
.sort((a, b) => formatUnits(b.amount.sub(a.amount)));
|
|
127
|
-
for (let { holder, amount } of balances) {
|
|
128
|
-
if (amount.gt(0)) {
|
|
129
|
-
accountsHoldingAmount = accountsHoldingAmount.add(amount);
|
|
130
|
-
accountsHolding += 1;
|
|
131
|
-
topHolders.length < 100 && topHolders.push({ holder, amount: formatUnits(amount) });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
version: peernet.networkVersion,
|
|
136
|
-
peers: peernet.peers.map(([id, peer]) => id),
|
|
137
|
-
accounts: await accountsStore.length(),
|
|
138
|
-
accountsHolding,
|
|
139
|
-
accountsHoldingAmount: formatUnits(accountsHoldingAmount).toString(),
|
|
140
|
-
topHolders
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
getNonce(address) {
|
|
144
|
-
return chain.getNonce(address);
|
|
145
|
-
}
|
|
146
|
-
lastBlock() {
|
|
147
|
-
return chain.lastBlock;
|
|
148
|
-
}
|
|
149
|
-
blockHashMap() {
|
|
150
|
-
return chain.blockHashMap;
|
|
151
|
-
}
|
|
152
|
-
bootstrap() {
|
|
153
|
-
return chain.blockHashMap;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export { Client as default };
|
package/exports/http.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
class Client {
|
|
2
|
-
url;
|
|
3
|
-
networkVersion;
|
|
4
|
-
get isHttpClient() {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
constructor(url, networkVersion) {
|
|
8
|
-
this.url = url;
|
|
9
|
-
this.networkVersion = networkVersion;
|
|
10
|
-
}
|
|
11
|
-
async _fetch(method, params, type = 'json') {
|
|
12
|
-
params = new URLSearchParams(params).toString();
|
|
13
|
-
const response = await fetch(`${this.url}/${method}?${params}`);
|
|
14
|
-
return response[type]();
|
|
15
|
-
}
|
|
16
|
-
async _fetchString(method, params) {
|
|
17
|
-
return String(await this._fetch(method, params, 'text'));
|
|
18
|
-
}
|
|
19
|
-
async _fetchNumber(method, params) {
|
|
20
|
-
return Number(await this._fetchString(method, params));
|
|
21
|
-
}
|
|
22
|
-
async _fetchBoolean(method, params) {
|
|
23
|
-
return Boolean((await this._fetchString(method, params)) === 'true');
|
|
24
|
-
}
|
|
25
|
-
balances() {
|
|
26
|
-
return this._fetch('balances');
|
|
27
|
-
}
|
|
28
|
-
balanceOf(address, format) {
|
|
29
|
-
return this._fetch(`balanceOf`, { address, format });
|
|
30
|
-
}
|
|
31
|
-
selectedAccount() {
|
|
32
|
-
return this._fetchString('selectedAccount');
|
|
33
|
-
}
|
|
34
|
-
selectAccount(address) {
|
|
35
|
-
return this._fetch('selectAccount', { address });
|
|
36
|
-
}
|
|
37
|
-
accounts() {
|
|
38
|
-
return this._fetch('accounts');
|
|
39
|
-
}
|
|
40
|
-
hasTransactionToHandle() {
|
|
41
|
-
return this._fetchBoolean('hasTransactionToHandle');
|
|
42
|
-
}
|
|
43
|
-
getBlock(index) {
|
|
44
|
-
return this._fetch('getBlock', { index });
|
|
45
|
-
}
|
|
46
|
-
blocks(amount) {
|
|
47
|
-
return this._fetch('blocks', { amount });
|
|
48
|
-
}
|
|
49
|
-
sendTransaction(transaction) {
|
|
50
|
-
return this._fetch('sendTransaction', transaction);
|
|
51
|
-
}
|
|
52
|
-
peerId() {
|
|
53
|
-
return this._fetchString('peerId');
|
|
54
|
-
}
|
|
55
|
-
peers() {
|
|
56
|
-
return this._fetch('peers');
|
|
57
|
-
}
|
|
58
|
-
validators() {
|
|
59
|
-
return this._fetch('validators');
|
|
60
|
-
}
|
|
61
|
-
lookup(name) {
|
|
62
|
-
return this._fetch('lookup', { name });
|
|
63
|
-
}
|
|
64
|
-
staticCall(contract, method, params) {
|
|
65
|
-
return this._fetch('staticCall', { contract, method, params });
|
|
66
|
-
}
|
|
67
|
-
nativeBurns() {
|
|
68
|
-
return this._fetchNumber('nativeBurns');
|
|
69
|
-
}
|
|
70
|
-
contracts() {
|
|
71
|
-
return this._fetch('contracts');
|
|
72
|
-
}
|
|
73
|
-
nativeMints() {
|
|
74
|
-
return this._fetchNumber('nativeMints');
|
|
75
|
-
}
|
|
76
|
-
nativeToken() {
|
|
77
|
-
return this._fetchString('nativeToken');
|
|
78
|
-
}
|
|
79
|
-
nativeTransfers() {
|
|
80
|
-
return this._fetchNumber('nativeTransfers');
|
|
81
|
-
}
|
|
82
|
-
totalSize() {
|
|
83
|
-
return this._fetchNumber('totalSize');
|
|
84
|
-
}
|
|
85
|
-
totalTransactions() {
|
|
86
|
-
return this._fetchNumber('totalTransactions');
|
|
87
|
-
}
|
|
88
|
-
poolTransactions() {
|
|
89
|
-
return this._fetch('poolTransactions');
|
|
90
|
-
}
|
|
91
|
-
transactionsInPool() {
|
|
92
|
-
return this._fetchNumber('transactionsInPool');
|
|
93
|
-
}
|
|
94
|
-
transactionPoolSize() {
|
|
95
|
-
return this._fetchNumber('transactionPoolSize');
|
|
96
|
-
}
|
|
97
|
-
totalBlocks() {
|
|
98
|
-
return this._fetchNumber('totalBlocks');
|
|
99
|
-
}
|
|
100
|
-
nativeCalls() {
|
|
101
|
-
return this._fetchNumber('nativeCalls');
|
|
102
|
-
}
|
|
103
|
-
participating() {
|
|
104
|
-
return this._fetchBoolean('participating');
|
|
105
|
-
}
|
|
106
|
-
participate(address) {
|
|
107
|
-
return this._fetch('participate', { address });
|
|
108
|
-
}
|
|
109
|
-
createContractAddress(owner, code, params) {
|
|
110
|
-
return this._fetch('createContractAddress', { owner, code, params });
|
|
111
|
-
}
|
|
112
|
-
deployContract(code, params) {
|
|
113
|
-
return this._fetch('deployContract', { code, params });
|
|
114
|
-
}
|
|
115
|
-
network() {
|
|
116
|
-
return this._fetch('network');
|
|
117
|
-
}
|
|
118
|
-
networkStats() {
|
|
119
|
-
return this._fetch('networkStats');
|
|
120
|
-
}
|
|
121
|
-
getNonce(address) {
|
|
122
|
-
return this._fetchNumber('getNonce', { address });
|
|
123
|
-
}
|
|
124
|
-
lastBlock() {
|
|
125
|
-
return this._fetch('lastBlock');
|
|
126
|
-
}
|
|
127
|
-
blockHashMap() {
|
|
128
|
-
return this._fetch('blockHashMap');
|
|
129
|
-
}
|
|
130
|
-
bootstrap() {
|
|
131
|
-
return this._fetch('blockHashMap');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export { Client as default };
|
package/exports/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export default class Client {
|
|
2
|
-
url: string;
|
|
3
|
-
networkVersion: string;
|
|
4
|
-
client: any;
|
|
5
|
-
constructor(url?: string, networkVersion?: string);
|
|
6
|
-
get pubsub(): {
|
|
7
|
-
publish: any;
|
|
8
|
-
subscribe: any;
|
|
9
|
-
};
|
|
10
|
-
balances(): any;
|
|
11
|
-
balanceOf(address: string, format: boolean): Promise<any>;
|
|
12
|
-
selectedAccount(): any;
|
|
13
|
-
selectAccount(address: any): Promise<void>;
|
|
14
|
-
accounts(): any;
|
|
15
|
-
hasTransactionToHandle(): any;
|
|
16
|
-
getBlock(index: number): any;
|
|
17
|
-
blocks(amount: number): any;
|
|
18
|
-
sendTransaction(transaction: any): any;
|
|
19
|
-
peerId(): any;
|
|
20
|
-
peers(): any;
|
|
21
|
-
validators(): any;
|
|
22
|
-
lookup(name: string): any;
|
|
23
|
-
staticCall(contract: string, method: string, params: {}): any;
|
|
24
|
-
nativeBurns(): number;
|
|
25
|
-
contracts(): number;
|
|
26
|
-
nativeMints(): number;
|
|
27
|
-
nativeToken(): string;
|
|
28
|
-
nativeTransfers(): number;
|
|
29
|
-
totalSize(): number;
|
|
30
|
-
totalTransactions(): number;
|
|
31
|
-
poolTransactions(): any;
|
|
32
|
-
transactionsInPool(): any;
|
|
33
|
-
transactionPoolSize(): any;
|
|
34
|
-
totalBlocks(): number;
|
|
35
|
-
nativeCalls(): number;
|
|
36
|
-
participating(): boolean;
|
|
37
|
-
participate(address: string): {};
|
|
38
|
-
createContractAddress(owner: string, code: string, params: {}): {};
|
|
39
|
-
deployContract(code: string, params: {}): {};
|
|
40
|
-
network(): any;
|
|
41
|
-
networkStats(): Promise<{
|
|
42
|
-
version: string;
|
|
43
|
-
peers: {}[];
|
|
44
|
-
accounts: number;
|
|
45
|
-
accountsHolding: number;
|
|
46
|
-
accountsHoldingAmount: number;
|
|
47
|
-
topHolders: any[];
|
|
48
|
-
}>;
|
|
49
|
-
getNonce(address: string): any;
|
|
50
|
-
lastBlock(): any;
|
|
51
|
-
blockHashMap(): any;
|
|
52
|
-
bootstrap(): any;
|
|
53
|
-
}
|
package/exports/types/http.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
type responseType = 'json' | 'text' | 'arrayBuffer' | 'clone' | 'formData' | 'blob';
|
|
2
|
-
type networkVersion = 'peach' | string;
|
|
3
|
-
export default class Client {
|
|
4
|
-
url: string;
|
|
5
|
-
networkVersion: networkVersion;
|
|
6
|
-
get isHttpClient(): boolean;
|
|
7
|
-
constructor(url: any, networkVersion: any);
|
|
8
|
-
_fetch(method: string, params?: any, type?: responseType): Promise<any>;
|
|
9
|
-
_fetchString(method: string, params?: any): Promise<string>;
|
|
10
|
-
_fetchNumber(method: string, params?: any): Promise<number>;
|
|
11
|
-
_fetchBoolean(method: string, params?: any): Promise<boolean>;
|
|
12
|
-
balances(): Promise<any>;
|
|
13
|
-
balanceOf(address: any, format: any): Promise<any>;
|
|
14
|
-
selectedAccount(): Promise<string>;
|
|
15
|
-
selectAccount(address: any): Promise<any>;
|
|
16
|
-
accounts(): Promise<any>;
|
|
17
|
-
hasTransactionToHandle(): Promise<boolean>;
|
|
18
|
-
getBlock(index: any): Promise<any>;
|
|
19
|
-
blocks(amount: any): Promise<any>;
|
|
20
|
-
sendTransaction(transaction: any): Promise<any>;
|
|
21
|
-
peerId(): Promise<string>;
|
|
22
|
-
peers(): Promise<any>;
|
|
23
|
-
validators(): Promise<any>;
|
|
24
|
-
lookup(name: any): Promise<any>;
|
|
25
|
-
staticCall(contract: any, method: any, params: any): Promise<any>;
|
|
26
|
-
nativeBurns(): Promise<number>;
|
|
27
|
-
contracts(): Promise<any>;
|
|
28
|
-
nativeMints(): Promise<number>;
|
|
29
|
-
nativeToken(): Promise<string>;
|
|
30
|
-
nativeTransfers(): Promise<number>;
|
|
31
|
-
totalSize(): Promise<number>;
|
|
32
|
-
totalTransactions(): Promise<number>;
|
|
33
|
-
poolTransactions(): Promise<any>;
|
|
34
|
-
transactionsInPool(): Promise<number>;
|
|
35
|
-
transactionPoolSize(): Promise<number>;
|
|
36
|
-
totalBlocks(): Promise<number>;
|
|
37
|
-
nativeCalls(): Promise<number>;
|
|
38
|
-
participating(): Promise<boolean>;
|
|
39
|
-
participate(address: any): Promise<any>;
|
|
40
|
-
createContractAddress(owner: any, code: any, params: any): Promise<any>;
|
|
41
|
-
deployContract(code: any, params: any): Promise<any>;
|
|
42
|
-
network(): Promise<any>;
|
|
43
|
-
networkStats(): Promise<{
|
|
44
|
-
version: string;
|
|
45
|
-
peers: {}[];
|
|
46
|
-
accounts: number;
|
|
47
|
-
accountsHolding: number;
|
|
48
|
-
}>;
|
|
49
|
-
getNonce(address: string): Promise<number>;
|
|
50
|
-
lastBlock(): Promise<any>;
|
|
51
|
-
blockHashMap(): Promise<any>;
|
|
52
|
-
bootstrap(): Promise<any>;
|
|
53
|
-
}
|
|
54
|
-
export {};
|
package/exports/types/index.d.ts
DELETED
package/exports/types/ws.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import ClientConnection from 'socket-request-client/connection';
|
|
2
|
-
export default class Client {
|
|
3
|
-
url: string;
|
|
4
|
-
networkVersion: string;
|
|
5
|
-
client: ClientConnection;
|
|
6
|
-
constructor(url?: string, networkVersion?: string);
|
|
7
|
-
init(): Promise<void>;
|
|
8
|
-
get pubsub(): {
|
|
9
|
-
publish: (topic: string, value: any) => Promise<any>;
|
|
10
|
-
subscribe: (topic: string, cb: any) => Promise<any>;
|
|
11
|
-
};
|
|
12
|
-
request(url: string, params?: {}): Promise<any>;
|
|
13
|
-
balances(): Promise<any>;
|
|
14
|
-
balanceOf(address: string, format: boolean): Promise<any>;
|
|
15
|
-
selectedAccount(): Promise<any>;
|
|
16
|
-
selectAccount(address: any): Promise<any>;
|
|
17
|
-
accounts(): Promise<any>;
|
|
18
|
-
hasTransactionToHandle(): Promise<any>;
|
|
19
|
-
getBlock(index: number): Promise<any>;
|
|
20
|
-
blocks(amount: number): Promise<any>;
|
|
21
|
-
sendTransaction(transaction: any): Promise<any>;
|
|
22
|
-
peerId(): Promise<any>;
|
|
23
|
-
peers(): Promise<any>;
|
|
24
|
-
validators(): Promise<any>;
|
|
25
|
-
lookup(name: string): Promise<any>;
|
|
26
|
-
staticCall(contract: string, method: string, params: {}): Promise<any>;
|
|
27
|
-
nativeBurns(): Promise<number>;
|
|
28
|
-
contracts(): Promise<number>;
|
|
29
|
-
nativeMints(): Promise<number>;
|
|
30
|
-
nativeToken(): Promise<string>;
|
|
31
|
-
nativeTransfers(): Promise<number>;
|
|
32
|
-
totalSize(): Promise<number>;
|
|
33
|
-
totalTransactions(): Promise<number>;
|
|
34
|
-
poolTransactions(): Promise<any>;
|
|
35
|
-
transactionsInPool(): Promise<any>;
|
|
36
|
-
transactionPoolSize(): Promise<any>;
|
|
37
|
-
totalBlocks(): Promise<number>;
|
|
38
|
-
nativeCalls(): Promise<number>;
|
|
39
|
-
participating(): Promise<boolean>;
|
|
40
|
-
participate(address: string): {};
|
|
41
|
-
createContractAddress(owner: string, code: string, params: {}): {};
|
|
42
|
-
deployContract(code: string, params: {}): {};
|
|
43
|
-
network(): Promise<any>;
|
|
44
|
-
networkStats(): Promise<{
|
|
45
|
-
version: string;
|
|
46
|
-
peers: {}[];
|
|
47
|
-
accounts: number;
|
|
48
|
-
accountsHolding: number;
|
|
49
|
-
}>;
|
|
50
|
-
getNonce(address: string): Promise<any>;
|
|
51
|
-
lastBlock(): Promise<any>;
|
|
52
|
-
blockHashMap(): Promise<any>;
|
|
53
|
-
bootstrap(): Promise<any>;
|
|
54
|
-
}
|