We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toHex
isLe = false should be isLe = true here. totalIssuance.toHex() returns big-endian encoding by default, which will differ from what u8aToHex returns.
isLe = false
isLe = true
totalIssuance.toHex()
api/packages/types-codec/src/abstract/Int.ts
Lines 188 to 195 in 25ab1d1
import '@polkadot/api-augment'; import { ApiPromise, WsProvider } from '@polkadot/api'; import { BN } from 'bn.js' import { u8aToHex } from '@polkadot/util'; import { TypeRegistry } from '@polkadot/types'; async function main() { const provider = new WsProvider('wss://polkadot-rpc.publicnode.com'); const api = await ApiPromise.create({ provider }); const totalIssuance = await api.query.balances.totalIssuance(); console.log(`totalIssuance Key: ${api.query.balances.totalIssuance.key()}, Value: ${totalIssuance.toString()}`); console.log(`totalIssuance HEX: ${totalIssuance.toHex(false)}`); console.log(`totalIssuance Hex(LE): ${totalIssuance.toHex(true)}`); console.log(`totalIssuance HEX(BE): ${totalIssuance.toHex(false)}`); console.log(`totalIssuance u8aToHex: ${u8aToHex(totalIssuance.toU8a())}`); await api.disconnect(); } main();
output:
totalIssuance Key: 0xc2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80, Value: 14871543992046148402 totalIssuance HEX: 0x0000000000000000ce625677cb815b32 totalIssuance Hex(LE): 0x325b81cb775662ce0000000000000000 totalIssuance HEX(BE): 0x0000000000000000ce625677cb815b32 totalIssuance u8aToHex: 0x325b81cb775662ce0000000000000000
If the storage is defined as eraReward(u32): u128, to the data by entriesPaged, it is not the real storage key and value.
eraReward(u32): u128
entriesPaged
console.log(`${key.toHex()},${value.toHex()}`);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
isLe = false
should beisLe = true
here.totalIssuance.toHex()
returns big-endian encoding by default, which will differ from what u8aToHex returns.api/packages/types-codec/src/abstract/Int.ts
Lines 188 to 195 in 25ab1d1
output:
If the storage is defined as
eraReward(u32): u128
, to the data byentriesPaged
, it is not the real storage key and value.The text was updated successfully, but these errors were encountered: