Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function encodeType (type: Param$Type, value: any, version: EncodingVersions): Uint8Array {
try {
switch (type) {
case 'AccountId':
return u8aConcat(
version === 'poc-1'
? addrPrefixes.none
: addrPrefixes.publicKey,
addressDecode(value)
);
case 'Balance':
return bnToU8a(value, sizes.Balance.get(version) || defaultSizes.Balance, true);
case 'BlockNumber':
case 'Gas':
case 'SessionKey':
case 'u64':
return bnToU8a(value, 64, true);
case 'bool':
return bnToU8a(value ? 1 : 0, 8, true);
export default function encodeType (type: Param$Type, value: any, version: EncodingVersions): Uint8Array {
try {
switch (type) {
case 'AccountId':
return u8aConcat(
version === 'poc-1'
? addrPrefixes.none
: addrPrefixes.publicKey,
addressDecode(value)
);
case 'Balance':
return bnToU8a(value, sizes.Balance.get(version) || defaultSizes.Balance, true);
case 'BlockNumber':
case 'Gas':
case 'SessionKey':
case 'u64':
return bnToU8a(value, 64, true);
case 'bool':
return bnToU8a(value ? 1 : 0, 8, true);