Refactor signing functions to use blake2AsU8a for hashing instead of registry.hash in conditional sign of extrinsic payload (#6183)
* fix: Refactor signing functions to use blake2AsU8a for hashing instead of registry.hash in conditional sign of extrinsic payload * fix: resolve lint error and discard unused hash * fix: resolve lint err
This commit is contained in:
@@ -5,10 +5,12 @@ import type { SignOptions } from '@polkadot/keyring/types';
|
||||
import type { Registry } from '@polkadot/types-codec/types';
|
||||
import type { IKeyringPair } from '../types/index.js';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
// a helper function for both types of payloads, Raw and metadata-known
|
||||
export function sign (registry: Registry, signerPair: IKeyringPair, u8a: Uint8Array, options?: SignOptions): Uint8Array {
|
||||
export function sign (_registry: Registry, signerPair: IKeyringPair, u8a: Uint8Array, options?: SignOptions): Uint8Array {
|
||||
const encoded = u8a.length > 256
|
||||
? registry.hash(u8a)
|
||||
? blake2AsU8a(u8a)
|
||||
: u8a;
|
||||
|
||||
return signerPair.sign(encoded, options);
|
||||
|
||||
Reference in New Issue
Block a user