@exodus/ethereum-api 6.3.5 → 6.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "6.3.5",
3
+ "version": "6.3.7",
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": "6954b09b1723c7eaf099da540ab39a50310bdd76"
37
+ "gitHead": "23add284852287667fdf24d1c891915f4caa58bc"
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(...params) {
134
- const request = this.balanceOfRequest(...params)
135
- return this.sendRequest(request)
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(...params) {
288
- const request = this.balanceOfRequest(...params)
289
- return this.sendRequest(request)
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) {
@@ -11,7 +11,7 @@ export const stakingProviderClientFactory = (defaultStakingUrl = DEFAULT_STAKING
11
11
  let stakingUrl = defaultStakingUrl
12
12
 
13
13
  const assetValidators = {
14
- polygon: '0xf30cf4ed712d3734161fdaab5b1dbb49fd2d0e5c',
14
+ polygon: '0x3f4ce357b9d61d3b904492b8b5abc69c6c693720',
15
15
  }
16
16
 
17
17
  const setStakingUrl = (newStakingUrl) => {