Open
Description
isLe = false
should be isLe = 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
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.
console.log(`${key.toHex()},${value.toHex()}`);
Metadata
Metadata
Assignees
Type
Projects
Status
P3 - Low