@leofcoin/endpoint-clients 0.2.3 → 0.2.5
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/http.js +11 -2
- package/exports/types/http.d.ts +9 -1
- package/exports/types/ws.d.ts +8 -0
- package/exports/ws.js +9 -0
- package/package.json +15 -3
- package/src/http.ts +14 -1
- package/src/ws.ts +11 -0
package/exports/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Client {
|
|
2
2
|
url;
|
|
3
3
|
networkVersion;
|
|
4
4
|
get isHttpClient() {
|
|
@@ -103,6 +103,15 @@ class http {
|
|
|
103
103
|
deployContract(code, params) {
|
|
104
104
|
return this._fetch('deployContract', { code, params });
|
|
105
105
|
}
|
|
106
|
+
network() {
|
|
107
|
+
return this._fetch('network');
|
|
108
|
+
}
|
|
109
|
+
networkStats() {
|
|
110
|
+
return this._fetch('networkStats');
|
|
111
|
+
}
|
|
112
|
+
getNonce(address) {
|
|
113
|
+
return this._fetchNumber('getNonce', { address });
|
|
114
|
+
}
|
|
106
115
|
}
|
|
107
116
|
|
|
108
|
-
export {
|
|
117
|
+
export { Client as default };
|
package/exports/types/http.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type responseType = 'json' | 'text' | 'arrayBuffer' | 'clone' | 'formData' | 'blob';
|
|
2
2
|
type networkVersion = 'peach' | string;
|
|
3
|
-
export default class {
|
|
3
|
+
export default class Client {
|
|
4
4
|
url: URL;
|
|
5
5
|
networkVersion: networkVersion;
|
|
6
6
|
get isHttpClient(): boolean;
|
|
@@ -36,5 +36,13 @@ export default class {
|
|
|
36
36
|
participate(address: any): Promise<any>;
|
|
37
37
|
createContractAddress(owner: any, code: any, params: any): Promise<any>;
|
|
38
38
|
deployContract(code: any, params: any): Promise<any>;
|
|
39
|
+
network(): Promise<any>;
|
|
40
|
+
networkStats(): Promise<{
|
|
41
|
+
version: string;
|
|
42
|
+
peers: {}[];
|
|
43
|
+
accounts: number;
|
|
44
|
+
accountsHolding: number;
|
|
45
|
+
}>;
|
|
46
|
+
getNonce(address: string): Promise<number>;
|
|
39
47
|
}
|
|
40
48
|
export {};
|
package/exports/types/ws.d.ts
CHANGED
|
@@ -37,4 +37,12 @@ export default class Client {
|
|
|
37
37
|
participate(address: string): {};
|
|
38
38
|
createContractAddress(owner: string, code: string, params: {}): {};
|
|
39
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;
|
|
40
48
|
}
|
package/exports/ws.js
CHANGED
|
@@ -101,6 +101,15 @@ class Client {
|
|
|
101
101
|
deployContract(code, params) {
|
|
102
102
|
return this.request('deployContract', { code, params });
|
|
103
103
|
}
|
|
104
|
+
network() {
|
|
105
|
+
return this.request('network');
|
|
106
|
+
}
|
|
107
|
+
networkStats() {
|
|
108
|
+
return this.request('networkStats');
|
|
109
|
+
}
|
|
110
|
+
getNonce(address) {
|
|
111
|
+
return this.request('getNonce', { address });
|
|
112
|
+
}
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
export { Client as default };
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/endpoint-clients",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
|
-
"
|
|
7
|
-
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./exports/index.js",
|
|
8
|
+
"types": "./exports/types/index.d.ts"
|
|
9
|
+
},
|
|
10
|
+
"./ws": {
|
|
11
|
+
"import": "./exports/ws.js",
|
|
12
|
+
"types": "./exports/types/ws.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./http": {
|
|
15
|
+
"import": "./exports/http.js",
|
|
16
|
+
"types": "./exports/types/http.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./ws.js": "./exports/ws.js",
|
|
19
|
+
"./http.js": "./exports/http.js"
|
|
8
20
|
},
|
|
9
21
|
"types": "./exports/types/index.d.ts",
|
|
10
22
|
"type": "module",
|
package/src/http.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
type responseType = 'json' | 'text' | 'arrayBuffer' | 'clone' | 'formData' | 'blob';
|
|
4
4
|
type networkVersion = 'peach' | string;
|
|
5
5
|
|
|
6
|
-
export default class {
|
|
6
|
+
export default class Client {
|
|
7
7
|
url: URL;
|
|
8
8
|
networkVersion: networkVersion;
|
|
9
9
|
get isHttpClient() {
|
|
@@ -120,7 +120,20 @@ export default class {
|
|
|
120
120
|
createContractAddress(owner, code, params) {
|
|
121
121
|
return this._fetch('createContractAddress', { owner, code, params })
|
|
122
122
|
}
|
|
123
|
+
|
|
123
124
|
deployContract(code, params) {
|
|
124
125
|
return this._fetch('deployContract', { code, params })
|
|
125
126
|
}
|
|
127
|
+
|
|
128
|
+
network() {
|
|
129
|
+
return this._fetch('network')
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
networkStats(): Promise<{ version: string; peers: {}[]; accounts: number; accountsHolding: number; }> {
|
|
133
|
+
return this._fetch('networkStats')
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getNonce(address: string) {
|
|
137
|
+
return this._fetchNumber('getNonce', { address })
|
|
138
|
+
}
|
|
126
139
|
}
|
package/src/ws.ts
CHANGED
|
@@ -114,4 +114,15 @@ export default class Client {
|
|
|
114
114
|
deployContract(code: string, params: {}): {} {
|
|
115
115
|
return this.request('deployContract', { code, params })
|
|
116
116
|
}
|
|
117
|
+
network() {
|
|
118
|
+
return this.request('network')
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
networkStats(): { version: string; peers: {}[]; accounts: number; accountsHolding: number } {
|
|
122
|
+
return this.request('networkStats')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getNonce(address: string) {
|
|
126
|
+
return this.request('getNonce', { address })
|
|
127
|
+
}
|
|
117
128
|
}
|