.paymentInfo never mutates the existing signature (#5659)
This commit is contained in:
@@ -160,9 +160,11 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHas
|
||||
// setup our options (same way as in signAndSend)
|
||||
const eraOptions = makeEraOptions(api, this.registry, allOptions, signingInfo);
|
||||
const signOptions = makeSignOptions(api, eraOptions, {});
|
||||
const u8a = this.isSigned
|
||||
? api.tx(this).signFake(address, signOptions).toU8a()
|
||||
: this.signFake(address, signOptions).toU8a();
|
||||
|
||||
// 1. Don't use the internal objects inside the new tx (hence toU8a)
|
||||
// 2. Don't override the data from existing signed extrinsics
|
||||
// 3. Ensure that this object stays intact, with no new sign after operation
|
||||
const u8a = api.tx(this.toU8a()).signFake(address, signOptions).toU8a();
|
||||
|
||||
return api.call.transactionPaymentApi.queryInfo(u8a, u8a.length);
|
||||
})
|
||||
|
||||
@@ -35,8 +35,8 @@ export class GenericExtrinsicV4 extends Struct implements IExtrinsicImpl {
|
||||
public static decodeExtrinsic (registry: Registry, value?: Call | Uint8Array | ExtrinsicValueV4, isSigned = false): ExtrinsicValueV4 {
|
||||
if (value instanceof GenericExtrinsicV4) {
|
||||
return value;
|
||||
} else if (value instanceof registry.createClassUnsafe('Call')) {
|
||||
return { method: value as Call };
|
||||
} else if (value instanceof registry.createClassUnsafe<Call>('Call')) {
|
||||
return { method: value };
|
||||
} else if (isU8a(value)) {
|
||||
// here we decode manually since we need to pull through the version information
|
||||
const signature = registry.createTypeUnsafe<ExtrinsicSignatureV4>('ExtrinsicSignatureV4', [value, { isSigned }]);
|
||||
|
||||
Reference in New Issue
Block a user