@polkadot/types#GenericCall TypeScript Examples
The following examples show how to use
@polkadot/types#GenericCall.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Call.tsx From crust-apps with Apache License 2.0 | 6 votes |
function extractState (value: IExtrinsic | IMethod, withHash?: boolean, withSignature?: boolean): Extracted {
const params = GenericCall.filterOrigin(value.meta).map(({ name, type }): Param => ({
name: name.toString(),
type: getTypeDef(type.toString())
}));
const values = value.args.map((value): Value => ({
isValid: true,
value
}));
const hash = withHash
? value.hash.toHex()
: null;
let signature: string | null = null;
let signatureType: string | null = null;
if (withSignature && isExtrinsic(value) && value.isSigned) {
const raw = getRawSignature(value);
signature = value.signature.toHex();
signatureType = raw instanceof Enum
? raw.type
: null;
}
return { hash, params, signature, signatureType, values };
}
Example #2
Source File: Extrinsic.tsx From crust-apps with Apache License 2.0 | 5 votes |
function getParams ({ meta }: SubmittableExtrinsicFunction<'promise'>): { name: string; type: TypeDef }[] {
return GenericCall.filterOrigin(meta).map((arg): { name: string; type: TypeDef } => ({
name: arg.name.toString(),
type: getTypeDef(arg.type.toString())
}));
}