Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Turtus committed Nov 4, 2024
1 parent 1db3659 commit 6d7b936
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
14 changes: 11 additions & 3 deletions crypto/blockchains/eth/EthScannerProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class EthScannerProcessor extends EthBasic {
throw new Error(this._settings.currencyCode + ' EthScannerProcessor._get empty trezorServer')
}

if (!this._trezorServer) {
if (!this._trezorServer && this._trezorServerCode !== 'MATIC_TREZOR_SERVER') {
return false
}

Expand All @@ -95,10 +95,15 @@ export default class EthScannerProcessor extends EthBasic {
return CACHE[this._mainCurrencyCode][address]
}

let link = this._trezorServer + '/api/v2/address/' + address + '?details=txs'
let link = this._trezorServer + '/api/v2/address/' + address + '?details=txs&pageSize=40'
if (this._trezorServerCode === 'MATIC_TREZOR_SERVER') {
link = 'https://proxy.trustee.deals/matic/getTxs?address=' + address
}
let res = await BlocksoftAxios.getWithoutBraking(link)

if (!res || !res.data) {
if (this._trezorServerCode === 'MATIC_TREZOR_SERVER') {
return false
}
BlocksoftExternalSettings.setTrezorServerInvalid(this._trezorServerCode, this._trezorServer)
this._trezorServer = await BlocksoftExternalSettings.getTrezorServer(this._trezorServerCode, this._settings.currencyCode + ' ETH.Scanner._get')
if (typeof this._trezorServer === 'undefined') {
Expand All @@ -112,6 +117,9 @@ export default class EthScannerProcessor extends EthBasic {
return false
}
}
if (typeof res.data.data !== 'undefined') {
res.data = res.data.data
}

if (typeof res.data.balance === 'undefined') {
throw new Error(this._settings.currencyCode + ' EthScannerProcessor._get nothing loaded for address ' + link)
Expand Down
12 changes: 6 additions & 6 deletions crypto/blockchains/eth/basic/EthBasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ export default class EthBasic {
this._mainChainId = 16718 // 0x414e
} else if (settings.currencyCode === 'MATIC' || (typeof settings.tokenBlockchain !== 'undefined' && settings.tokenBlockchain === 'MATIC')) {

this._etherscanSuffix = ''
this._etherscanApiPath = `https://api.polygonscan.com/api?module=account&sort=desc&action=txlist&apikey=YourApiKeyToken`
this._etherscanApiPathInternal = `https://api.polygonscan.com/api?module=account&sort=desc&action=txlistinternal&apikey=YourApiKeyToken`
this._etherscanApiPathForFee = `https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice&apikey=YourApiKeyToken`
this._etherscanSuffix = false
this._etherscanApiPath = false
this._etherscanApiPathInternal = false
this._etherscanApiPathForFee = false

this._trezorServer = false
this._trezorServerCode = false
this._trezorServer = 'to_load'
this._trezorServerCode = 'MATIC_TREZOR_SERVER'

this._mainCurrencyCode = 'MATIC'
this._mainTokenType = 'MATIC_ERC_20'
Expand Down
1 change: 1 addition & 0 deletions crypto/common/BlocksoftExternalSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const CACHE = {
'MATIC_SERVER' : 'https://polygon-rpc.com',
'MATIC_PRICE' : 1000000000,
'MATIC_GAS_LIMIT' : 620000,
'MATIC_TREZOR_SERVER': ['https://pol1.trezor.io'],
'FTM_SERVER' : 'https://rpc.ftm.tools',
'FTM_PRICE' : 400000000000,
'FTM_GAS_LIMIT' : 620000,
Expand Down

0 comments on commit 6d7b936

Please sign in to comment.