@exodus/ethereum-api 3.3.6-alpha.0 → 3.5.0
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": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@exodus/asset-lib": "^3.7.1",
|
|
18
18
|
"@exodus/bip32": "^1.0.0",
|
|
19
19
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
20
|
-
"@exodus/ethereum-lib": "^2.
|
|
20
|
+
"@exodus/ethereum-lib": "^2.25.0",
|
|
21
21
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.6",
|
|
22
22
|
"@exodus/fetch": "^1.2.1",
|
|
23
23
|
"@exodus/key-utils": "^1.0.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@exodus/models": "^8.10.4"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "adb3bcb3d3c538706a0fd7fe3cf11ba89712905b"
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ export default class ClarityServer extends EventEmitter {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
createSocket(namespace) {
|
|
50
|
-
return io(`${this.uri}${namespace}
|
|
50
|
+
return io(`${this.uri}${namespace}`, { transports: ['websocket', 'polling'] })
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
disconnectTransactions(address) {
|
|
@@ -158,6 +158,11 @@ export default class ClarityServer extends EventEmitter {
|
|
|
158
158
|
return response.result
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
async isContract(address) {
|
|
162
|
+
const code = await this.getCode(address)
|
|
163
|
+
return code.length > 2
|
|
164
|
+
}
|
|
165
|
+
|
|
161
166
|
buildRequest({ method, params = [] }) {
|
|
162
167
|
return { jsonrpc: '2.0', id: this.id++, method, params }
|
|
163
168
|
}
|
|
@@ -235,6 +240,10 @@ export default class ClarityServer extends EventEmitter {
|
|
|
235
240
|
return this.sendRequest(request)
|
|
236
241
|
}
|
|
237
242
|
|
|
243
|
+
async getBalanceProxied(...params) {
|
|
244
|
+
return this.getBalance(...params)
|
|
245
|
+
}
|
|
246
|
+
|
|
238
247
|
async gasPrice(...params) {
|
|
239
248
|
const request = this.gasPriceRequest(...params)
|
|
240
249
|
return this.sendRequest(request)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
2
|
+
import { getServerByName } from '../exodus-eth-server'
|
|
3
|
+
|
|
4
|
+
const assetName = 'optimism'
|
|
5
|
+
|
|
6
|
+
export class OptimismFeeMonitor extends EthereumLikeFeeMonitor {
|
|
7
|
+
constructor({ updateFee, interval }) {
|
|
8
|
+
super({
|
|
9
|
+
updateFee,
|
|
10
|
+
assetName,
|
|
11
|
+
getGasPrice: async () => (await getServerByName(assetName).getFee())?.gasPrice,
|
|
12
|
+
interval,
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -36,7 +36,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
setServer(config) {
|
|
39
|
-
if (config.server === this.server.uri) {
|
|
39
|
+
if (!config?.server || config.server === this.server.uri) {
|
|
40
40
|
return
|
|
41
41
|
}
|
|
42
42
|
this.server.setURI(config.server)
|
|
@@ -156,16 +156,13 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
156
156
|
...derivedData,
|
|
157
157
|
})
|
|
158
158
|
|
|
159
|
-
const nextCursorBuff = response.cursor ? Buffer.from(response.cursor) : null
|
|
160
|
-
const nextCursorBase64 = nextCursorBuff?.toString?.('base64') || null
|
|
161
|
-
|
|
162
159
|
const accountState = await this.getNewAccountState({
|
|
163
160
|
tokens,
|
|
164
161
|
ourWalletAddress: derivedData.ourWalletAddress,
|
|
165
162
|
})
|
|
166
163
|
await this.updateAccountState({
|
|
167
164
|
walletAccount,
|
|
168
|
-
newData: {
|
|
165
|
+
newData: { clarityCursor: response.cursor, ...accountState },
|
|
169
166
|
})
|
|
170
167
|
|
|
171
168
|
await this.removeFromTxLog(txsToRemove)
|
|
@@ -315,8 +312,8 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
315
312
|
|
|
316
313
|
async getHistoryFromServer({ walletAccount, derivedData, refresh }) {
|
|
317
314
|
const address = derivedData.ourWalletAddress
|
|
318
|
-
const
|
|
319
|
-
const cursor =
|
|
315
|
+
const currentCursor = derivedData.currentAccountState?.clarityCursor
|
|
316
|
+
const cursor = currentCursor && !refresh ? currentCursor : null
|
|
320
317
|
return this.server.getAllTransactions({ walletAccount, address, cursor })
|
|
321
318
|
}
|
|
322
319
|
|