Skip to content

Commit 5956d11

Browse files
author
Petr JelΓ­nek
committed
ALL-9581 - Fix missing decimals function in TRON
1 parent 1b0db9e commit 5956d11

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

β€Žsrc/constants.ts

+17
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,20 @@ export const ZERO_ADDRESS = {
274274
ZERO_ADDRESS_42_CHARS: '0x0000000000000000000000000000000000000000',
275275
ZERO_ADDRESS_58_CHARS: '0000000000000000000000000000000000000000000000000000000000',
276276
}
277+
278+
export const TRON_ABI = [
279+
{
280+
"constant": true,
281+
"inputs": [],
282+
"name": "decimals",
283+
"outputs": [
284+
{
285+
"name": "",
286+
"type": "uint8"
287+
}
288+
],
289+
"payable": false,
290+
"stateMutability": "View",
291+
"type": "Function"
292+
}
293+
];

β€Žsrc/transaction/tron.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios';
22
import BigNumber from 'bignumber.js';
33
import { tronBroadcast } from '../blockchain';
44
import { axios, validateBody } from '../connector/tatum';
5-
import { TATUM_API_URL } from '../constants';
5+
import { TATUM_API_URL, TRON_ABI } from '../constants'
66
import { listing } from '../contracts/marketplace';
77
import abi from '../contracts/trc20/token_abi';
88
import bytecode from '../contracts/trc20/token_bytecode';
@@ -324,7 +324,7 @@ export const getTronTrc20ContractDecimals = async (testnet: boolean, contractAdd
324324
}
325325
const tronWeb = prepareTronWeb(testnet, provider)
326326
tronWeb.setAddress(contractAddress)
327-
const contractInstance = await tronWeb.contract().at(contractAddress)
327+
const contractInstance = await tronWeb.contract(TRON_ABI, contractAddress);
328328
const decimalsBigNum = await contractInstance.decimals().call()
329329
return new BigNumber(decimalsBigNum).toNumber()
330330
}

0 commit comments

Comments
Β (0)