difftreelog
test runtime upgrade helpers
in: master
3 files changed
tests/src/util/authorizeEnactUpgrade.tsdiffbeforeafterbothno changes
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth732 }732 }733 return result as any;733 return result as any;734 }734 }735 executeExtrinsicUncheckedWeight<736 E extends string,737 V extends (738 ...args: any) => any = ForceFunction<739 Get2<740 AugmentedSubmittables<'promise'>,741 E, (...args: any) => Invalid<'not found'>742 >743 >744 >(745 sender: TSigner,746 extrinsic: `api.tx.${E}`,747 params: Parameters<V>,748 expectSuccess = true,749 options: Partial<SignerOptions> | null = null,/*, failureMessage='expected success'*/750 ): Promise<ITransactionResult> {751 throw new Error('executeExtrinsicUncheckedWeight only supported in sudo');752 }735753736 async callRpc754 async callRpc737 // TODO: make it strongly typed, or use api.query/api.rpc directly755 // TODO: make it strongly typed, or use api.query/api.rpc directly4056 }4074 }4057 return result;4075 return result;4058 }4076 }4077 async executeExtrinsicUncheckedWeight(4078 sender: IKeyringPair,4079 extrinsic: string,4080 params: any[],4081 expectSuccess?: boolean,4082 options: Partial<SignerOptions> | null = null,4083 ): Promise<ITransactionResult> {4084 const call = this.constructApiCall(extrinsic, params);4085 const result = await super.executeExtrinsic(4086 sender,4087 'api.tx.sudo.sudoUncheckedWeight',4088 [call, {refTime: 0, proofSize: 0}],4089 expectSuccess,4090 options,4091 );40924093 if(result.status === 'Fail') return result;40944095 const data = (result.result.events.find(x => x.event.section == 'sudo' && x.event.method == 'Sudid')?.event.data as any).sudoResult;4096 if(data.isErr) {4097 if(data.asErr.isModule) {4098 const error = (result.result.events[1].event.data as any).sudoResult.asErr.asModule;4099 const metaError = super.getApi()?.registry.findMetaError(error);4100 throw new Error(`${metaError.section}.${metaError.name}`);4101 } else if(data.asErr.isToken) {4102 throw new Error(`Token: ${data.asErr.asToken}`);4103 }4104 // May be [object Object] in case of unhandled non-unit enum4105 throw new Error(`Misc: ${data.asErr.toHuman()}`);4106 }4107 return result;4108 }4059 };4109 };4060}4110}40614111tests/src/util/setCode.tsdiffbeforeafterbothno changes