@yarovoi_ivan

Как из транзакции Ethereum получить токены а не eth?

У меня есть контракт и токены и вот не могу взять историю транзакций
Вот код
var filter = web3.eth.filter({fromBlock:0, toBlock: 'latest', address: addr_contract });
filter.watch(function(error, result) {
var tx = web3.eth.getTransaction(result.transactionHash);
console.log(tx);
if (tx != null) {
console.log(" tx hash : " + tx.hash + "\n"
+ " nonce : " + tx.nonce + "\n"
+ " blockHash : " + tx.blockHash + "\n"
+ " blockNumber : " + tx.blockNumber + "\n"
+ " transactionIndex: " + tx.transactionIndex + "\n"
+ " from : " + tx.from + "\n"
+ " to : " + tx.to + "\n"
+ " value : " + tx.value + "\n"
+ " gasPrice : " + tx.gasPrice + "\n"
+ " gas : " + tx.gas + "\n"
+ " input : " + tx.input);
}
});

в переменной tx.value = 0 это эфиры а как токен взять ?

blockHash: '0xf6e8cfce4fe19c136ae7274f800235eeb8548554685d25759a041e892af68988',
blockNumber: 4170555,
from: '0x2ff2fecd517a88b9ccc04363071598feb7c1ebbc',
gas: 152079,
gasPrice: { [String: '20000000000'] s: 1, e: 10, c: [ 20000000000 ] },
hash: '0xae0dce3651f241012e49fe897e7f0e73dd1227a935595032304efb9780ea1fc4',
input: '0xa9059cbb0000000000000000000000006993142bdc69e851c822b9b03c58a64ee1b2325400000000000000000000000000000000000000000000000000000000000003ed',
nonce: 5,
to: '0x853577f9fe78abfcd7b98f10bfeb7532b25a0ff8',
transactionIndex: 37,
value: { [String: '0'] s: 1, e: 0, c: [ 0 ] },
v: '0x26',
r: '0x645715a2b381f10e718fd435ef8a46a1a9a472f7d8d28490eaf05caf53a28f4c',
s: '0x33b59973edf2f659441547ec220824932fd16f881f834e8a2d15478ceb8c7ea5' }
tx hash : 0xae0dce3651f241012e49fe897e7f0e73dd1227a935595032304efb9780ea1fc4
nonce : 5
blockHash : 0xf6e8cfce4fe19c136ae7274f800235eeb8548554685d25759a041e892af68988
blockNumber : 4170555
transactionIndex: 37
from : 0x2ff2fecd517a88b9ccc04363071598feb7c1ebbc
to : 0x853577f9fe78abfcd7b98f10bfeb7532b25a0ff8
value : 0
gasPrice : 20000000000
gas : 152079
input : 0xa9059cbb0000000000000000000000006993142bdc69e851c822b9b03c58a64ee1b2325400000000000000000000000000000000000000000000000000000000000003ed
  • Вопрос задан
  • 206 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы