Optimize Compact decoding in Uint8Array streams (#4808)
* Optimize Compact decoding in Uint8Array streams * Adjust test * Adjust
This commit is contained in:
@@ -16,7 +16,7 @@ export function createUnchecked (registry: Registry, section: string, callIndex:
|
||||
const expectedArgs = callMetadata.fields;
|
||||
const funcName = stringCamelCase(callMetadata.name);
|
||||
|
||||
const extrinsicFn = (...args: any[]): Call => {
|
||||
const extrinsicFn = (...args: unknown[]): Call => {
|
||||
assert(expectedArgs.length === args.length, () => `Extrinsic ${section}.${funcName} expects ${expectedArgs.length} arguments, got ${args.length}.`);
|
||||
|
||||
return registry.createTypeUnsafe('Call', [{ args, callIndex }, callMetadata]);
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('decorateExtrinsics', (): void => {
|
||||
|
||||
it('should return properly-encoded transactions', (): void => {
|
||||
expect(
|
||||
registry.createType('Extrinsic', extrinsics.timestamp.set([10101])).toU8a()
|
||||
registry.createType('Extrinsic', extrinsics.timestamp.set(32)).toU8a()
|
||||
).toEqual(
|
||||
new Uint8Array([
|
||||
// length (encoded)
|
||||
@@ -74,7 +74,7 @@ describe('decorateExtrinsics', (): void => {
|
||||
// index
|
||||
3, 0,
|
||||
// values, Compact<Moment>
|
||||
116
|
||||
32 << 2
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('Decorated', () => {
|
||||
const tx = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
|
||||
|
||||
expect(
|
||||
registry.createType('Extrinsic', tx.timestamp.set([10101])).toU8a()
|
||||
registry.createType('Extrinsic', tx.timestamp.set(63)).toU8a()
|
||||
).toEqual(
|
||||
new Uint8Array([
|
||||
// length (encoded)
|
||||
@@ -41,7 +41,7 @@ describe('Decorated', () => {
|
||||
// index
|
||||
3, 0,
|
||||
// values, Compact<Moment>
|
||||
116
|
||||
63 << 2
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user