@leofcoin/endpoint-clients 0.2.6 → 0.2.7
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/direct.js +116 -0
- package/exports/types/direct.d.ts +48 -0
- package/package.json +7 -2
- package/rollup.config.js +1 -1
- package/src/direct.ts +130 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
class Client {
|
|
2
|
+
url;
|
|
3
|
+
networkVersion;
|
|
4
|
+
client;
|
|
5
|
+
constructor(url = 'ws://localhost:4040', networkVersion = 'leofcoin-peach') {
|
|
6
|
+
this.url = url;
|
|
7
|
+
this.networkVersion = networkVersion;
|
|
8
|
+
}
|
|
9
|
+
get pubsub() {
|
|
10
|
+
return {
|
|
11
|
+
publish: peernet.pubsub.publish,
|
|
12
|
+
subscribe: peernet.pubsub.subscribe
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
balances() {
|
|
16
|
+
return chain.balances;
|
|
17
|
+
}
|
|
18
|
+
balanceOf(address, format) {
|
|
19
|
+
return chain.balanceOf(address, format);
|
|
20
|
+
}
|
|
21
|
+
selectedAccount() {
|
|
22
|
+
return chain.selectedAccount;
|
|
23
|
+
}
|
|
24
|
+
selectAccount(address) {
|
|
25
|
+
return chain.selectAccount({ address });
|
|
26
|
+
}
|
|
27
|
+
accounts() {
|
|
28
|
+
return chain.accounts;
|
|
29
|
+
}
|
|
30
|
+
hasTransactionToHandle() {
|
|
31
|
+
return chain.hasTransactionToHandle;
|
|
32
|
+
}
|
|
33
|
+
getBlock(index) {
|
|
34
|
+
return chain.getBlock(index);
|
|
35
|
+
}
|
|
36
|
+
blocks(amount) {
|
|
37
|
+
return chain.blocks(amount);
|
|
38
|
+
}
|
|
39
|
+
sendTransaction(transaction) {
|
|
40
|
+
return chain.sendTransaction(transaction);
|
|
41
|
+
}
|
|
42
|
+
peerId() {
|
|
43
|
+
return chain.peerId;
|
|
44
|
+
}
|
|
45
|
+
peers() {
|
|
46
|
+
return chain.peers;
|
|
47
|
+
}
|
|
48
|
+
validators() {
|
|
49
|
+
return chain.validators;
|
|
50
|
+
}
|
|
51
|
+
lookup(name) {
|
|
52
|
+
return chain.lookup(name);
|
|
53
|
+
}
|
|
54
|
+
staticCall(contract, method, params) {
|
|
55
|
+
return chain.staticCall(contract, method, params);
|
|
56
|
+
}
|
|
57
|
+
nativeBurns() {
|
|
58
|
+
return chain.nativeBurns;
|
|
59
|
+
}
|
|
60
|
+
contracts() {
|
|
61
|
+
return chain.contracts;
|
|
62
|
+
}
|
|
63
|
+
nativeMints() {
|
|
64
|
+
return chain.nativeMints;
|
|
65
|
+
}
|
|
66
|
+
nativeToken() {
|
|
67
|
+
return chain.nativeToken;
|
|
68
|
+
}
|
|
69
|
+
nativeTransfers() {
|
|
70
|
+
return chain.nativeTransfers;
|
|
71
|
+
}
|
|
72
|
+
totalSize() {
|
|
73
|
+
return chain.totalSize;
|
|
74
|
+
}
|
|
75
|
+
totalTransactions() {
|
|
76
|
+
return chain.totalTransactions;
|
|
77
|
+
}
|
|
78
|
+
poolTransactions() {
|
|
79
|
+
return chain.poolTransactions;
|
|
80
|
+
}
|
|
81
|
+
transactionsInPool() {
|
|
82
|
+
return chain.transactionsInPool;
|
|
83
|
+
}
|
|
84
|
+
transactionPoolSize() {
|
|
85
|
+
return chain.transactionPoolSize;
|
|
86
|
+
}
|
|
87
|
+
totalBlocks() {
|
|
88
|
+
return chain.totalBlocks;
|
|
89
|
+
}
|
|
90
|
+
nativeCalls() {
|
|
91
|
+
return chain.nativeCalls;
|
|
92
|
+
}
|
|
93
|
+
participating() {
|
|
94
|
+
return chain.participating;
|
|
95
|
+
}
|
|
96
|
+
participate(address) {
|
|
97
|
+
return chain.participate(address);
|
|
98
|
+
}
|
|
99
|
+
createContractAddress(owner, code, params) {
|
|
100
|
+
return chain.createContractAddress(owner, code, params);
|
|
101
|
+
}
|
|
102
|
+
deployContract(code, params) {
|
|
103
|
+
return chain.deployContract(code, params);
|
|
104
|
+
}
|
|
105
|
+
network() {
|
|
106
|
+
return chain.network;
|
|
107
|
+
}
|
|
108
|
+
networkStats() {
|
|
109
|
+
return chain.networkStats;
|
|
110
|
+
}
|
|
111
|
+
getNonce(address) {
|
|
112
|
+
return chain.getNonce(address);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { Client as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
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): any;
|
|
12
|
+
selectedAccount(): any;
|
|
13
|
+
selectAccount(address: any): any;
|
|
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(): number;
|
|
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(): {
|
|
42
|
+
version: string;
|
|
43
|
+
peers: {}[];
|
|
44
|
+
accounts: number;
|
|
45
|
+
accountsHolding: number;
|
|
46
|
+
};
|
|
47
|
+
getNonce(address: string): any;
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/endpoint-clients",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -15,8 +15,13 @@
|
|
|
15
15
|
"import": "./exports/http.js",
|
|
16
16
|
"types": "./exports/types/http.d.ts"
|
|
17
17
|
},
|
|
18
|
+
"./direct": {
|
|
19
|
+
"import": "./exports/direct.js",
|
|
20
|
+
"types": "./exports/types/direct.d.ts"
|
|
21
|
+
},
|
|
18
22
|
"./ws.js": "./exports/ws.js",
|
|
19
|
-
"./http.js": "./exports/http.js"
|
|
23
|
+
"./http.js": "./exports/http.js",
|
|
24
|
+
"./direct.js": "./exports/direct.js"
|
|
20
25
|
},
|
|
21
26
|
"types": "./exports/types/index.d.ts",
|
|
22
27
|
"type": "module",
|
package/rollup.config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import typescript from '@rollup/plugin-typescript'
|
|
2
2
|
import tsConfig from './tsconfig.json' assert { type: 'json'}
|
|
3
3
|
export default [{
|
|
4
|
-
input: ['./src/index.ts', './src/http.ts', './src/ws.ts'],
|
|
4
|
+
input: ['./src/index.ts', './src/http.ts', './src/ws.ts', './src/direct.ts'],
|
|
5
5
|
output: {
|
|
6
6
|
dir: './exports',
|
|
7
7
|
format: 'es'
|
package/src/direct.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
declare var chain
|
|
2
|
+
declare var peernet
|
|
3
|
+
|
|
4
|
+
export default class Client {
|
|
5
|
+
url: string
|
|
6
|
+
networkVersion: string
|
|
7
|
+
client;
|
|
8
|
+
|
|
9
|
+
constructor(url = 'ws://localhost:4040', networkVersion = 'leofcoin-peach') {
|
|
10
|
+
this.url = url
|
|
11
|
+
this.networkVersion = networkVersion
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get pubsub() {
|
|
15
|
+
return {
|
|
16
|
+
publish: peernet.pubsub.publish,
|
|
17
|
+
subscribe: peernet.pubsub.subscribe
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
balances() {
|
|
22
|
+
return chain.balances
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
balanceOf(address: string, format: boolean) {
|
|
26
|
+
return chain.balanceOf(address, format)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
selectedAccount() {
|
|
30
|
+
return chain.selectedAccount
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
selectAccount(address: any) {
|
|
34
|
+
return chain.selectAccount({address})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
accounts() {
|
|
38
|
+
return chain.accounts
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
hasTransactionToHandle() {
|
|
42
|
+
return chain.hasTransactionToHandle
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getBlock(index: number) {
|
|
46
|
+
return chain.getBlock(index)
|
|
47
|
+
}
|
|
48
|
+
blocks(amount: number) {
|
|
49
|
+
return chain.blocks(amount)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
sendTransaction(transaction) {
|
|
53
|
+
return chain.sendTransaction(transaction)
|
|
54
|
+
}
|
|
55
|
+
peerId() {
|
|
56
|
+
return chain.peerId
|
|
57
|
+
}
|
|
58
|
+
peers() {
|
|
59
|
+
return chain.peers
|
|
60
|
+
}
|
|
61
|
+
validators() {
|
|
62
|
+
return chain.validators
|
|
63
|
+
}
|
|
64
|
+
lookup(name: string) {
|
|
65
|
+
return chain.lookup(name)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
staticCall(contract: string, method: string, params: {}) {
|
|
69
|
+
return chain.staticCall(contract, method, params)
|
|
70
|
+
}
|
|
71
|
+
nativeBurns(): number {
|
|
72
|
+
return chain.nativeBurns
|
|
73
|
+
}
|
|
74
|
+
contracts(): number {
|
|
75
|
+
return chain.contracts
|
|
76
|
+
}
|
|
77
|
+
nativeMints(): number {
|
|
78
|
+
return chain.nativeMints
|
|
79
|
+
}
|
|
80
|
+
nativeToken(): number {
|
|
81
|
+
return chain.nativeToken
|
|
82
|
+
}
|
|
83
|
+
nativeTransfers(): number {
|
|
84
|
+
return chain.nativeTransfers
|
|
85
|
+
}
|
|
86
|
+
totalSize(): number {
|
|
87
|
+
return chain.totalSize
|
|
88
|
+
}
|
|
89
|
+
totalTransactions(): number {
|
|
90
|
+
return chain.totalTransactions
|
|
91
|
+
}
|
|
92
|
+
poolTransactions() {
|
|
93
|
+
return chain.poolTransactions
|
|
94
|
+
}
|
|
95
|
+
transactionsInPool() {
|
|
96
|
+
return chain.transactionsInPool
|
|
97
|
+
}
|
|
98
|
+
transactionPoolSize() {
|
|
99
|
+
return chain.transactionPoolSize
|
|
100
|
+
}
|
|
101
|
+
totalBlocks(): number {
|
|
102
|
+
return chain.totalBlocks
|
|
103
|
+
}
|
|
104
|
+
nativeCalls(): number {
|
|
105
|
+
return chain.nativeCalls
|
|
106
|
+
}
|
|
107
|
+
participating(): boolean {
|
|
108
|
+
return chain.participating
|
|
109
|
+
}
|
|
110
|
+
participate(address: string): {} {
|
|
111
|
+
return chain.participate(address)
|
|
112
|
+
}
|
|
113
|
+
createContractAddress(owner: string, code: string, params: {}): {} {
|
|
114
|
+
return chain.createContractAddress(owner, code, params)
|
|
115
|
+
}
|
|
116
|
+
deployContract(code: string, params: {}): {} {
|
|
117
|
+
return chain.deployContract(code, params)
|
|
118
|
+
}
|
|
119
|
+
network() {
|
|
120
|
+
return chain.network
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
networkStats(): { version: string; peers: {}[]; accounts: number; accountsHolding: number } {
|
|
124
|
+
return chain.networkStats
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
getNonce(address: string) {
|
|
128
|
+
return chain.getNonce(address)
|
|
129
|
+
}
|
|
130
|
+
}
|