@polkadot/types#i32 TypeScript Examples
The following examples show how to use
@polkadot/types#i32.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: transactionReceiptHelper.ts From bodhi.js with Apache License 2.0 | 4 votes |
getPartialTransactionReceipt = (event: FrameSystemEventRecord): PartialTransactionReceipt => {
// @TODO
const defaultValue = {
logsBloom: DUMMY_LOGS_BLOOM,
byzantium: false,
// @TODO EIP712
type: 0,
cumulativeGasUsed: BIGNUMBER_ZERO,
effectiveGasPrice: EFFECTIVE_GAS_PRICE
};
switch (event.event.method) {
case 'Created': {
const [source, evmAddress, logs, used_gas, _used_storage] = event.event.data as unknown as [
H160,
H160,
EvmLog[],
u64?,
i32?
];
return {
to: undefined,
from: source.toHex(),
contractAddress: evmAddress.toString(),
gasUsed: BigNumber.from(used_gas?.toString() || 0),
status: 1,
logs: getPartialLogs(logs),
...defaultValue
};
}
case 'Executed': {
const [source, evmAddress, logs, used_gas, _used_storage] = event.event.data as unknown as [
H160,
H160,
EvmLog[],
u64?,
i32?
];
return {
to: evmAddress.toString(),
from: source.toHex(),
contractAddress: undefined,
gasUsed: BigNumber.from(used_gas?.toString() || 0),
logs: getPartialLogs(logs),
status: 1,
...defaultValue
};
}
case 'CreatedFailed': {
const [source, evmAddress, _exitReason, logs, used_gas, _used_storage] = event.event.data as unknown as [
H160,
H160,
ExitReason,
EvmLog[],
u64?,
i32?
];
return {
to: undefined,
from: source.toHex(),
contractAddress: evmAddress.toString(),
gasUsed: BigNumber.from(used_gas?.toString() || 0),
logs: getPartialLogs(logs),
status: 0,
exitReason: _exitReason.toString(),
...defaultValue
};
}
case 'ExecutedFailed': {
const [source, evmAddress, _exitReason, _output, logs, used_gas, _used_storage] = event.event.data as unknown as [
H160,
H160,
ExitReason,
unknown,
EvmLog[],
u64?,
i32?
];
return {
to: evmAddress.toString(),
from: source.toHex(),
contractAddress: undefined,
gasUsed: BigNumber.from(used_gas?.toString() || 0),
status: 0,
exitReason: _exitReason.toString(),
logs: getPartialLogs(logs),
...defaultValue
};
}
}
return logger.throwError(`unsupported event: ${event.event.method}`);
}