@exodus/ethereum-api 6.3.5 → 6.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.6",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@exodus/models": "^8.10.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4c6c1a8ff3ddc408795d0042b2d0b089c6168f30"
|
|
38
38
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BN from 'bn.js'
|
|
1
2
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
2
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
3
4
|
import EventEmitter from 'events'
|
|
@@ -130,9 +131,16 @@ export default class ApiCoinNodesServer extends EventEmitter {
|
|
|
130
131
|
})
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
async balanceOf(
|
|
134
|
-
const request = this.balanceOfRequest(
|
|
135
|
-
|
|
134
|
+
async balanceOf(address, tokenAddress, tag = 'latest') {
|
|
135
|
+
const request = this.balanceOfRequest(address, tokenAddress, tag)
|
|
136
|
+
const result = await this.sendRequest(request)
|
|
137
|
+
const hex = result.startsWith('0x') ? result.slice(2) : result
|
|
138
|
+
const balance = new BN(hex, 'hex').toString()
|
|
139
|
+
return {
|
|
140
|
+
confirmed: {
|
|
141
|
+
[tokenAddress]: balance,
|
|
142
|
+
},
|
|
143
|
+
}
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
async getBalance(...params) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BN from 'bn.js'
|
|
1
2
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
2
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
3
4
|
import EventEmitter from 'events'
|
|
@@ -284,9 +285,16 @@ export default class ClarityServer extends EventEmitter {
|
|
|
284
285
|
return this.sendRequest(request)
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
async balanceOf(
|
|
288
|
-
const request = this.balanceOfRequest(
|
|
289
|
-
|
|
288
|
+
async balanceOf(address, tokenAddress, tag = 'latest') {
|
|
289
|
+
const request = this.balanceOfRequest(address, tokenAddress, tag)
|
|
290
|
+
const result = await this.sendRequest(request)
|
|
291
|
+
const hex = result.startsWith('0x') ? result.slice(2) : result
|
|
292
|
+
const balance = new BN(hex, 'hex').toString()
|
|
293
|
+
return {
|
|
294
|
+
confirmed: {
|
|
295
|
+
[tokenAddress]: balance,
|
|
296
|
+
},
|
|
297
|
+
}
|
|
290
298
|
}
|
|
291
299
|
|
|
292
300
|
async getBalance(...params) {
|