How to use the @polkadot/extrinsics/codec/encode/extrinsic 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 / Queue.tsx View on Github external
queueExtrinsic = ({ extrinsic, nonce, publicKey, values }: QueueTx$Extrinsic): QueueTx$Id => {
    const { apiSupport } = this.props;
    const params = Object.values(extrinsic.params);
    const isValid = values.length === params.length &&
      params.reduce((isValid, param, index) =>
        isValid && !isUndefined(values[index]),
        true
      );
    const encoded = isValid && extrinsic.params
      ? encode(extrinsic, values, apiSupport)
      : new Uint8Array([]);

    return this.queueAdd({
      isValid,
      nonce: nonce || new BN(0),
      publicKey,
      rpc,
      values: [encoded]
    });
  }
}