@leofcoin/endpoint-clients 0.3.2 → 0.3.4
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 +2 -2
- package/exports/types/http.d.ts +2 -2
- package/package.json +1 -1
- package/rollup.config.js +1 -2
- package/src/direct.ts +2 -2
- package/src/http.ts +2 -2
- package/tsconfig.json +1 -1
package/exports/direct.js
CHANGED
|
@@ -23,11 +23,11 @@ class Client {
|
|
|
23
23
|
return format ? formatUnits(balance) : balance;
|
|
24
24
|
}
|
|
25
25
|
selectedAccount() {
|
|
26
|
-
return
|
|
26
|
+
return peernet.selectedAccount;
|
|
27
27
|
}
|
|
28
28
|
async selectAccount(address) {
|
|
29
29
|
try {
|
|
30
|
-
await walletStore.put('selected-account', address);
|
|
30
|
+
await globalThis.walletStore.put('selected-account', address);
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
throw new Error(`couldn't set selected account`);
|
package/exports/types/http.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
type responseType = 'json' | 'text' | 'arrayBuffer' | 'clone' | 'formData' | 'blob';
|
|
2
2
|
type networkVersion = 'peach' | string;
|
|
3
3
|
export default class Client {
|
|
4
|
-
url:
|
|
4
|
+
url: string;
|
|
5
5
|
networkVersion: networkVersion;
|
|
6
6
|
get isHttpClient(): boolean;
|
|
7
7
|
constructor(url: any, networkVersion: any);
|
|
8
|
-
_fetch(method:
|
|
8
|
+
_fetch(method: string, params?: any, type?: responseType): Promise<any>;
|
|
9
9
|
_fetchString(method: string, params?: any): Promise<string>;
|
|
10
10
|
_fetchNumber(method: string, params?: any): Promise<number>;
|
|
11
11
|
_fetchBoolean(method: string, params?: any): Promise<boolean>;
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import typescript from '@rollup/plugin-typescript'
|
|
2
|
-
import tsConfig from './tsconfig.json' assert { type: 'json'}
|
|
3
2
|
export default [{
|
|
4
3
|
input: ['./src/index.ts', './src/http.ts', './src/ws.ts', './src/direct.ts'],
|
|
5
4
|
output: {
|
|
@@ -7,7 +6,7 @@ export default [{
|
|
|
7
6
|
format: 'es'
|
|
8
7
|
},
|
|
9
8
|
plugins: [
|
|
10
|
-
typescript(
|
|
9
|
+
typescript()
|
|
11
10
|
],
|
|
12
11
|
external: [
|
|
13
12
|
'./identity.js'
|
package/src/direct.ts
CHANGED
|
@@ -33,12 +33,12 @@ export default class Client {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
selectedAccount() {
|
|
36
|
-
return
|
|
36
|
+
return peernet.selectedAccount
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async selectAccount(address: any) {
|
|
40
40
|
try {
|
|
41
|
-
await walletStore.put('selected-account', address)
|
|
41
|
+
await globalThis.walletStore.put('selected-account', address)
|
|
42
42
|
} catch (error) {
|
|
43
43
|
throw new Error(`couldn't set selected account`)
|
|
44
44
|
}
|
package/src/http.ts
CHANGED
|
@@ -4,7 +4,7 @@ type responseType = 'json' | 'text' | 'arrayBuffer' | 'clone' | 'formData' | 'bl
|
|
|
4
4
|
type networkVersion = 'peach' | string;
|
|
5
5
|
|
|
6
6
|
export default class Client {
|
|
7
|
-
url:
|
|
7
|
+
url: string;
|
|
8
8
|
networkVersion: networkVersion;
|
|
9
9
|
get isHttpClient() {
|
|
10
10
|
return true
|
|
@@ -15,7 +15,7 @@ export default class Client {
|
|
|
15
15
|
this.networkVersion = networkVersion
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async _fetch(method, params?, type: responseType = 'json') {
|
|
18
|
+
async _fetch(method: string, params?, type: responseType = 'json') {
|
|
19
19
|
params = new URLSearchParams(params).toString()
|
|
20
20
|
const response = await fetch(`${this.url}/${method}?${params}`)
|
|
21
21
|
return response[type]()
|