我通过以下方式连接到 BSC websocket:
let options = {
filter: {
value: [],
},
fromBlock: 0
};
myContract.events.Transfer(options)
.on('data', event => console.log(event))
.on('changed', changed => console.log(changed))
.on('error', err => throw err)
.on('connected', str => console.log(str))
作为对“转移”事件的回应,我得到了
data {
address: 'xxxxx',
blockNumber: xxx,
transactionHash: 'xxxx',
transactionIndex: 17,
blockHash: 'xxx',
logIndex: 35,
removed: false,
id: 'xx',
returnValues: Result {
'0': 'xx',
'1': 'xx',
'2': '800000000000000000',
from: 'xx',
to: 'xxx',
value: '800000000000000000'
},
event: 'Transfer',
signature: 'xxx',
raw: {
data: 'xxx',
topics: [
'xxx',
'xx',
'xxx'
]
}
}
我想确定 SELL/BUY 交易。我怎么知道这是卖还是买??
还有什么题目??