Skip to content

Commit

Permalink
s/callId/callIndex/
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Oct 5, 2018
1 parent 947717c commit 5a57425
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/type-extrinsics/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FunctionMetadata } from '@polkadot/types/Metadata';

export interface ExtrinsicFunction {
(...args: any[]): UncheckedMortalExtrinsic,
callId: Uint8Array,
callIndex: Uint8Array,
meta: FunctionMetadata,
method: string;
section: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/type-extrinsics/src/utils/createUnchecked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function createDescriptor (
index: number,
meta: FunctionMetadata
): ExtrinsicFunction {
const callId = new Uint8Array([index, meta.id.toNumber()]);
const callIndex = new Uint8Array([index, meta.id.toNumber()]);
let extrinsicFn: any;

// If the extrinsic function has an argument of type `Origin`, we ignore it
Expand All @@ -33,12 +33,12 @@ export default function createDescriptor (
throw new Error(`Extrinsic ${section}.${method} expects ${expectedArgs.length.valueOf()} arguments, got ${args.length}.`);
}

const call = new Call(callId, meta, args);
const call = new Call(callIndex, meta, args);

return new UncheckedMortalExtrinsic(call);
};

extrinsicFn.callId = callId;
extrinsicFn.callIndex = callIndex;
extrinsicFn.meta = meta;
extrinsicFn.method = method;
extrinsicFn.section = section;
Expand Down
8 changes: 6 additions & 2 deletions packages/types/src/CallIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ export default class CallIndex extends U8aFixed {
super(value, 16);
}

get callIndex (): Uint8Array {
return this.raw;
}

get methodIndex (): number {
return this.raw[1];
return this.callIndex[1];
}

get sectionIndex (): number {
return this.raw[0];
return this.callIndex[0];
}
}
4 changes: 4 additions & 0 deletions packages/types/src/UncheckedMortalExtrinsic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export default class UncheckedMortalExtrinsic extends Extrinsic {
return this._call.meta;
}

get callIndex (): Uint8Array {
return this._call.callIndex;
}

get methodIndex (): number {
return this._call.methodIndex;
}
Expand Down

0 comments on commit 5a57425

Please sign in to comment.