Add missing types -> types-known dep (#4252)

* Add missing types -> types-known dep

* Run install :)
This commit is contained in:
Jaco
2021-11-23 09:59:53 +02:00
committed by GitHub
parent ca172c9a53
commit 6e496d5a3c
4 changed files with 22 additions and 17 deletions
+1
View File
@@ -24,6 +24,7 @@
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.16.3",
"@polkadot/types-known": "6.9.3-1",
"@polkadot/util": "^7.9.2",
"@polkadot/util-crypto": "^7.9.2",
"rxjs": "^7.4.0"
@@ -10,16 +10,17 @@ import { shell } from './shell';
import { statemint } from './statemint';
import { substrate } from './substrate';
// A mapping of the known signed extensions to the extra fields that they contain. Unlike in the actual extensions,
// we define the extra fields not as a Tuple, but rather as a struct so they can be named. These will be expanded
// into the various fields when added to the payload (we only support V4 onwards with these, V3 and earlier are
// deemed fixed and non-changeable)
// A mapping of the known signed extensions to the extra fields that they
// contain. Unlike in the actual extensions, we define the extra fields not
// as a Tuple, but rather as a struct so they can be named. These will be
// expanded into the various fields when added to the payload (we only
// support V4 onwards with these, V3 and earlier are deemed fixed))
export const allExtensions: ExtDef = objectSpread({}, substrate, polkadot, shell, statemint);
// the v4 signed extensions prior to the point of exposing these to the metadata.
// This may not match 100% with the current defaults and are used when not specified
// in the metadata (which is for very old chains). The order is important here, as
// applied by default
// the v4 signed extensions prior to the point of exposing these to the
// metadata. This may not match 100% with the current defaults and are used
// when not specified in the metadata (which is for very old chains). The
// order is important here, as applied by default
export const fallbackExtensions = [
'CheckVersion',
'CheckGenesis',
@@ -39,7 +40,7 @@ export function findUnknownExtensions (extensions: string[], userExtensions: Ext
export function expandExtensionTypes (extensions: string[], type: keyof ExtInfo, userExtensions: ExtDef = {}): ExtTypes {
return extensions
// Always allow user extensions first - these should provide overrides
.map((key) => userExtensions[key] || allExtensions[key])
.map((k) => userExtensions[k] || allExtensions[k])
.filter((info): info is ExtInfo => !!info)
.reduce((result, info): ExtTypes => objectSpread(result, info[type]), {});
}
@@ -20,8 +20,8 @@ import { sign } from '../util';
/**
* @name GenericExtrinsicPayloadV4
* @description
* A signing payload for an [[Extrinsic]]. For the final encoding, it is variable length based
* on the contents included
* A signing payload for an [[Extrinsic]]. For the final encoding, it is
* variable length based on the contents included
*/
export class GenericExtrinsicPayloadV4 extends Struct {
#signOptions: SignOptions;
@@ -33,8 +33,9 @@ export class GenericExtrinsicPayloadV4 extends Struct {
registry.getSignedExtensionExtra()
), value);
// Do detection for the type of extrinsic, in the case of MultiSignature this is an
// enum, in the case of AnySignature, this is a Hash only (may be 64 or 65 bytes)
// Do detection for the type of extrinsic, in the case of MultiSignature
// this is an enum, in the case of AnySignature, this is a Hash only
// (which may be 64 or 65 bytes)
this.#signOptions = {
withType: registry.createType('ExtrinsicSignature') instanceof Enum
};
@@ -108,10 +109,11 @@ export class GenericExtrinsicPayloadV4 extends Struct {
* @description Sign the payload with the keypair
*/
public sign (signerPair: IKeyringPair): Uint8Array {
// NOTE The `toU8a({ method: true })` argument is absolutely critical - we don't want the method (Bytes)
// to have the length prefix included. This means that the data-as-signed is un-decodable,
// but is also doesn't need the extra information, only the pure data (and is not decoded)
// ... The same applies to V1..V3, if we have a V5, carry move this comment to latest
// NOTE The `toU8a({ method: true })` argument is absolutely critical, we
// don't want the method (Bytes) to have the length prefix included. This
// means that the data-as-signed is un-decodable, but is also doesn't need
// the extra information, only the pure data (and is not decoded) ...
// The same applies to V1..V3, if we have a V5, carrythis comment
return sign(this.registry, signerPair, this.toU8a({ method: true }), this.#signOptions);
}
}
+1
View File
@@ -2092,6 +2092,7 @@ __metadata:
dependencies:
"@babel/runtime": ^7.16.3
"@polkadot/keyring": ^7.9.2
"@polkadot/types-known": 6.9.3-1
"@polkadot/types-support": 6.9.3-1
"@polkadot/util": ^7.9.2
"@polkadot/util-crypto": ^7.9.2