How to use the @polkadot/extrinsics/codec/encode/call 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 / apps / packages / ui-signer / src / sign.ts View on Github external
export default function signMessage (publicKey: Uint8Array, nonce: BN | number, value: Uint8Array, apiSupport: EncodingVersions): Signed {
  const message = encodeCall(publicKey, nonce, value, apiSupport);
  const signature = keyring.getPair(publicKey).sign(message);
  const data = u8aConcat(
    prefixes.publicKey,
    message,
    signature
  );

  console.log(`signMessage (${apiSupport}) :   message :: ${u8aToHex(message)}`);
  console.log(`signMessage (${apiSupport}) : signature :: ${u8aToHex(signature)}`);
  console.log(`signMessage (${apiSupport}) :      data :: ${u8aToHex(data)}`);

  return {
    data: u8aConcat(
      bnToU8a(data.length, 32, true),
      data
    ),