Pass registry to all codec types (#1592)
* Pass registry to all codec types
* Pass through registry inside API (where the rubber meets the road)
* Small additions
* Derive w/ registry
* Types are more-or-less covered
* Some test adjustments (guided by linting)
* Rid the world of some ../injector
* Additional cleanups, merge injector into registry
* Cleanup extrinsics (always passing registry)
* Remove injector imports (not all replaced)
* Typ spec cleanups
* Phase 1 - types seem lint-free
* rpc-{core,provider} lint free
* Start working through metadata
* Small metadata additions
* Some e2e tests (out-of-order)
* Down to a handful
* Fixup tests for packages/types/src/codec/*.spec.ts
* packages/types/src/codec passes all tests
* packages/types ok (Convert storage with registry fn)
* progress (sort out injection, dreaded find-before msg)
* Down to 1 lint issue...
* Linting done... along with on-demand import
* Exposed ordering
* Remove global injects
* Cleanup comments
* Add CHANGELOG & UPGRADING
* Apply suggestions from code review
Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>
* Update Metadata description
This commit is contained in:
co-authored by
Amaury Martiny
parent
099992627b
commit
011e24bd49
@@ -4,20 +4,23 @@
|
||||
|
||||
import { Signer, SignerResult } from '@polkadot/api/types';
|
||||
import { KeyringPair } from '@polkadot/keyring/types';
|
||||
import { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types';
|
||||
import { hexToU8a, u8aToHex } from '@polkadot/util';
|
||||
import { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types';
|
||||
|
||||
let id = 0;
|
||||
|
||||
export class SingleAccountSigner implements Signer {
|
||||
private keyringPair: KeyringPair;
|
||||
|
||||
private registry: Registry;
|
||||
|
||||
private signDelay: number;
|
||||
|
||||
constructor (keyringPair: KeyringPair, signDelay = 0) {
|
||||
constructor (registry: Registry, keyringPair: KeyringPair, signDelay = 0) {
|
||||
this.keyringPair = keyringPair;
|
||||
this.registry = registry;
|
||||
this.signDelay = signDelay;
|
||||
}
|
||||
|
||||
@@ -28,7 +31,7 @@ export class SingleAccountSigner implements Signer {
|
||||
|
||||
return new Promise((resolve): void => {
|
||||
setTimeout((): void => {
|
||||
const signed = createType('ExtrinsicPayload', payload, { version: payload.version }).sign(this.keyringPair);
|
||||
const signed = createType(this.registry, 'ExtrinsicPayload', payload, { version: payload.version }).sign(this.keyringPair);
|
||||
|
||||
resolve({
|
||||
id: ++id,
|
||||
|
||||
Reference in New Issue
Block a user