How to use the @polkadot/extrinsics/codec/encode/prefixes.none function in @polkadot/extrinsics

To help you get started, we’ve selected a few @polkadot/extrinsics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / common / packages / type-params / src / encode / type / index.ts View on Github external
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);
github polkadot-js / api / packages / type-params / src / encode / type / index.ts View on Github external
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);