@leofcoin/endpoint-clients 0.1.4 → 0.1.6

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 CHANGED
@@ -4,8 +4,9 @@ export default class {
4
4
  this.networkVersion = networkVersion
5
5
  }
6
6
 
7
- async _fetch(method) {
8
- const response = await fetch(`${this.url}/${method}`)
7
+ async _fetch(method, params) {
8
+ params = new URLSearchParams(params).toString()
9
+ const response = await fetch(`${this.url}/${method}?${params}`)
9
10
  return response.json()
10
11
  }
11
12
 
@@ -13,7 +14,90 @@ export default class {
13
14
  return this._fetch('balances')
14
15
  }
15
16
 
16
- balanceOf(address) {
17
- return this._fetch(`balanceOf?address=${address}`)
17
+ balanceOf(address, format) {
18
+ return this._fetch(`balanceOf`, {address, format})
19
+ }
20
+
21
+ selectedAccount() {
22
+ return this._fetch('selectedAccount')
23
+ }
24
+
25
+ selectAccount(address) {
26
+ return this._fetch('selectAccount', {address})
27
+ }
28
+
29
+ accounts() {
30
+ return this._fetch('accounts')
31
+ }
32
+
33
+ hasTransactionToHandle() {
34
+ return this._fetch('hasTransactionToHandle')
35
+ }
36
+
37
+ getBlock(index) {
38
+ return this._fetch('getBlock', { index })
39
+ }
40
+ blocks(amount) {
41
+ return this._fetch('blocks', {amount})
42
+ }
43
+
44
+ createTransactionFrom(from, to, method, parameters, nonce) {
45
+ return this._fetch('createTransactionFrom', {from, to, method, parameters, nonce})
46
+ }
47
+ peerId() {
48
+ return this._fetch('peerId')
49
+ }
50
+ peers() {
51
+ return this._fetch('peers')
52
+ }
53
+ validators() {
54
+ return this._fetch('validators')
55
+ }
56
+ lookup(name) {
57
+ return this._fetch('lookup', { name })
58
+ }
59
+
60
+ staticCall(contract, method, params) {
61
+ return this._fetch('staticCall', {contract, method, params})
62
+ }
63
+ nativeBurns() {
64
+ return this._fetch('nativeBurns')
65
+ }
66
+ contracts() {
67
+ return this._fetch('contracts')
68
+ }
69
+ nativeMints() {
70
+ return this._fetch('nativeMints')
71
+ }
72
+ nativeToken() {
73
+ return this._fetch('nativeToken')
74
+ }
75
+ nativeTransfers() {
76
+ return this._fetch('nativeTransfers')
77
+ }
78
+ totalSize() {
79
+ return this._fetch('totalSize')
80
+ }
81
+ totalTransactions() {
82
+ return this._fetch('totalTransactions')
83
+ }
84
+ totalBlocks() {
85
+ return this._fetch('totalBlocks')
86
+ }
87
+ nativeCalls() {
88
+ return this._fetch('nativeCalls')
89
+ }
90
+ participating() {
91
+ return this._fetch('participating')
92
+ }
93
+ participate(address) {
94
+ return this._fetch('participate', { address })
95
+ }
96
+
97
+ createContractAddress(owner, code, params) {
98
+ return this._fetch('createContractAddress', { owner, code, params })
99
+ }
100
+ deployContract(code, params) {
101
+ return this._fetch('deployContract', { code, params })
18
102
  }
19
103
  }
package/exports/ws.js CHANGED
@@ -105,8 +105,8 @@ export default class Client {
105
105
  participate(address) {
106
106
  return this.request('participate', { address })
107
107
  }
108
- createContractAddress(selectedAccount, code, params) {
109
- return this.request('createContractAddress', { selectedAccount, code, params })
108
+ createContractAddress(owner, code, params) {
109
+ return this.request('createContractAddress', { owner, code, params })
110
110
  }
111
111
  deployContract(code, params) {
112
112
  return this.request('deployContract', { code, params })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/endpoint-clients",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./ws": "./exports/ws.js",