-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
This line of code in the JS SDK:
https://github.com/harmony-one/sdk/blob/0ff928bc623ef7560c38c02c7ca34387653cafe5/packages/harmony-transaction/src/transactionBase.ts#L220
Potentially related to:
harmony-one/harmony#2079
Produces undefined for blockNumber in 2 scenarios:
A regular ONE token transfer
.on('receipt', ...)
const tx = hmy.transactions.newTx({
to: address,
value: new hmy.utils.Unit(amount).asEther().toWei(),
gasLimit: '210000',
shardID: 0,
toShardID: 0,
gasPrice: new hmy.utils.Unit('10').asGwei().toWei(),
});
const signedTX = await hmy.wallet.signTransaction(tx);
signedTX.observed().on('transactionHash', (txHash) => {
console.log('--- txHash ---', txHash);
})
.on('receipt', (receipt) => {
console.log('--- receipt ---', receipt);
const { active } = getState().harmonyReducer
dispatch(getBalances(active))
dispatch(updateProcessing(false))
}).on('error', console.error)
And a smart contract method call
.on('receipt', ...)
const tx = contract.methods.purchase(active.address, index).send({
from: active.address,
value: new hmy.utils.Unit(1).asEther().toWei(),
gasLimit: '1000000',
gasPrice: new hmy.utils.Unit('10').asGwei().toWei(),
}).on('transactionHash', function (hash) {
console.log('hash', hash)
}).on('receipt', function (receipt) {
console.log('receipt', receipt)
}).on('confirmation', async (confirmationNumber, receipt) => {
console.log('confirmationNumber', confirmationNumber, receipt)
dispatch(getInventory())
dispatch(updateProcessing(false))
}).on('error', console.error)
My fix so far is:
blockNumber = this.messenger.chainPrefix === 'hmy'
? data.params.result.Header.number
: data.params.result.number;
console.log(data.params.result.Header)
if (!blockNumber) {
blockNumber = '0x0'
}
But this doesn't explain why a header would come back with no blockNumber???
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels