Use MultiAddress as the default type (#3123)

* Use MultiAddress as the default type

* Update tests

* Update tests
This commit is contained in:
Jaco Greeff
2021-01-31 11:02:54 +01:00
committed by GitHub
parent 859679ce09
commit 23b5601eeb
13 changed files with 76 additions and 67 deletions
+12
View File
@@ -1,5 +1,17 @@
# CHANGELOG # CHANGELOG
## 3.7.x
Upgrade priority: Low. However recoemmended for current Substrate master, Polkadot and Rococo users and those wishing to support the upcoming Polkadot 28 runtime with the new `MultiAddress`.
- **Breaking change** As indicated in the 3.5.1 release notes, th Address/LookupSource default have now been adjusted for `MultiAddress` by default. This extensible format is mean to cater for all address types, removing a lot of discrepancies between chains.
Changes:
- Apply `MultiAddress` as a default
- Adds support for the upcoming Polkadot 28 and Kusama 2028 runtimes
## 3.6.1 Jan 24, 2020 ## 3.6.1 Jan 24, 2020
Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it. Upgrade priority: Medium if not already on at least 3.3.1. The next upgrade of Kusama/Polkadot requires it.
+35 -35
View File
@@ -14,7 +14,7 @@ import type { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/in
import type { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity'; import type { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
import type { Heartbeat } from '@polkadot/types/interfaces/imOnline'; import type { Heartbeat } from '@polkadot/types/interfaces/imOnline';
import type { ProxyType } from '@polkadot/types/interfaces/proxy'; import type { ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountId, AccountIndex, Address, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime'; import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
import type { Period, Priority } from '@polkadot/types/interfaces/scheduler'; import type { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import type { Keys } from '@polkadot/types/interfaces/session'; import type { Keys } from '@polkadot/types/interfaces/session';
import type { SocietyJudgement } from '@polkadot/types/interfaces/society'; import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
@@ -46,7 +46,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. * Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
**/ **/
burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>; burn: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/** /**
* Issue a new class of fungible assets from a public origin. * Issue a new class of fungible assets from a public origin.
* *
@@ -72,7 +72,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>; create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: TAssetBalance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, u32, TAssetBalance]>;
/** /**
* Destroy a class of fungible assets owned by the sender. * Destroy a class of fungible assets owned by the sender.
* *
@@ -109,7 +109,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>; forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<u32>, Compact<TAssetBalance>]>;
/** /**
* Destroy a class of fungible assets. * Destroy a class of fungible assets.
* *
@@ -144,7 +144,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status * Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
* of `source`; Account pre-existence of `dest`. * of `source`; Account pre-existence of `dest`.
**/ **/
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>; forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, Compact<TAssetBalance>]>;
/** /**
* Disallow further unprivileged transfers from an account. * Disallow further unprivileged transfers from an account.
* *
@@ -157,7 +157,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>; freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
/** /**
* Disallow further unprivileged transfers for the asset class. * Disallow further unprivileged transfers for the asset class.
* *
@@ -184,7 +184,7 @@ declare module '@polkadot/api/types/submittable' {
* Weight: `O(1)` * Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. * Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
**/ **/
mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>; mint: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/** /**
* Set the maximum number of zombie accounts for an asset. * Set the maximum number of zombie accounts for an asset.
* *
@@ -239,7 +239,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, issuer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, freezer: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>; setTeam: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, issuer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freezer: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, LookupSource, LookupSource]>;
/** /**
* Allow unprivileged transfers from an account again. * Allow unprivileged transfers from an account again.
* *
@@ -252,7 +252,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>; thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
/** /**
* Allow unprivileged transfers for the asset again. * Allow unprivileged transfers for the asset again.
* *
@@ -285,7 +285,7 @@ declare module '@polkadot/api/types/submittable' {
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status * Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`. * of sender; Account pre-existence of `target`.
**/ **/
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>; transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<TAssetBalance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource, Compact<TAssetBalance>]>;
/** /**
* Change the Owner of an asset. * Change the Owner of an asset.
* *
@@ -298,7 +298,7 @@ declare module '@polkadot/api/types/submittable' {
* *
* Weight: `O(1)` * Weight: `O(1)`
**/ **/
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>; transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<AssetId>, LookupSource]>;
}; };
authorship: { authorship: {
[key: string]: SubmittableExtrinsicFunction<ApiType>; [key: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -338,7 +338,7 @@ declare module '@polkadot/api/types/submittable' {
* not assumed to be in the overlay. * not assumed to be in the overlay.
* # </weight> * # </weight>
**/ **/
forceTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>; forceTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, Compact<Balance>]>;
/** /**
* Set the balances of a given account. * Set the balances of a given account.
* *
@@ -359,7 +359,7 @@ declare module '@polkadot/api/types/submittable' {
* - DB Weight: 1 Read, 1 Write to `who` * - DB Weight: 1 Read, 1 Write to `who`
* # </weight> * # </weight>
**/ **/
setBalance: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>; setBalance: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<Balance> | AnyNumber | Uint8Array, newReserved: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>, Compact<Balance>]>;
/** /**
* Transfer some liquid free balance to another account. * Transfer some liquid free balance to another account.
* *
@@ -389,7 +389,7 @@ declare module '@polkadot/api/types/submittable' {
* - Origin account is already in memory, so no DB operations for them. * - Origin account is already in memory, so no DB operations for them.
* # </weight> * # </weight>
**/ **/
transfer: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>; transfer: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
/** /**
* Same as the [`transfer`] call, but with a check that the transfer will not kill the * Same as the [`transfer`] call, but with a check that the transfer will not kill the
* origin account. * origin account.
@@ -403,7 +403,7 @@ declare module '@polkadot/api/types/submittable' {
* - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already) * - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
* #</weight> * #</weight>
**/ **/
transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>; transferKeepAlive: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<Balance>]>;
}; };
bounties: { bounties: {
[key: string]: SubmittableExtrinsicFunction<ApiType>; [key: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -441,7 +441,7 @@ declare module '@polkadot/api/types/submittable' {
* - O(1). * - O(1).
* # </weight> * # </weight>
**/ **/
awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>; awardBounty: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource]>;
/** /**
* Claim the payout from an awarded bounty after payout delay. * Claim the payout from an awarded bounty after payout delay.
* *
@@ -504,7 +504,7 @@ declare module '@polkadot/api/types/submittable' {
* - O(1). * - O(1).
* # </weight> * # </weight>
**/ **/
proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>; proposeCurator: AugmentedSubmittable<(bountyId: Compact<BountyIndex> | AnyNumber | Uint8Array, curator: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, fee: Compact<BalanceOf> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BountyIndex>, LookupSource, Compact<BalanceOf>]>;
/** /**
* Unassign curator from a bounty. * Unassign curator from a bounty.
* *
@@ -538,7 +538,7 @@ declare module '@polkadot/api/types/submittable' {
* * If no account exists and the call value is not less than `existential_deposit`, * * If no account exists and the call value is not less than `existential_deposit`,
* a regular account will be created and any value will be transferred. * a regular account will be created and any value will be transferred.
**/ **/
call: AugmentedSubmittable<(dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>; call: AugmentedSubmittable<(dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, Compact<Gas>, Bytes]>;
/** /**
* Allows block producers to claim a small reward for evicting a contract. If a block * Allows block producers to claim a small reward for evicting a contract. If a block
* producer fails to do so, a regular users will be allowed to claim the reward. * producer fails to do so, a regular users will be allowed to claim the reward.
@@ -1082,7 +1082,7 @@ declare module '@polkadot/api/types/submittable' {
* will go into phragmen, we assume full block for now. * will go into phragmen, we assume full block for now.
* # </weight> * # </weight>
**/ **/
removeMember: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>; removeMember: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, hasReplacement: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
/** /**
* Remove `origin` as a voter. * Remove `origin` as a voter.
* *
@@ -1215,7 +1215,7 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`. * sub identity of `sub`.
**/ **/
addSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>; addSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
/** /**
* Cancel a previous request. * Cancel a previous request.
* *
@@ -1278,7 +1278,7 @@ declare module '@polkadot/api/types/submittable' {
* - One event. * - One event.
* # </weight> * # </weight>
**/ **/
killIdentity: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>; killIdentity: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/** /**
* Provide a judgement for an account's identity. * Provide a judgement for an account's identity.
* *
@@ -1300,7 +1300,7 @@ declare module '@polkadot/api/types/submittable' {
* - One event. * - One event.
* # </weight> * # </weight>
**/ **/
provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>; provideJudgement: AugmentedSubmittable<(regIndex: Compact<RegistrarIndex> | AnyNumber | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, judgement: IdentityJudgement | { Unknown: any } | { FeePaid: any } | { Reasonable: any } | { KnownGood: any } | { OutOfDate: any } | { LowQuality: any } | { Erroneous: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<RegistrarIndex>, LookupSource, IdentityJudgement]>;
/** /**
* Remove the sender as a sub-account. * Remove the sender as a sub-account.
* *
@@ -1323,14 +1323,14 @@ declare module '@polkadot/api/types/submittable' {
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`. * sub identity of `sub`.
**/ **/
removeSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>; removeSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/** /**
* Alter the associated name of the given sub-account. * Alter the associated name of the given sub-account.
* *
* The dispatch origin for this call must be _Signed_ and the sender must have a registered * The dispatch origin for this call must be _Signed_ and the sender must have a registered
* sub identity of `sub`. * sub identity of `sub`.
**/ **/
renameSub: AugmentedSubmittable<(sub: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>; renameSub: AugmentedSubmittable<(sub: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, data: Data | { None: any } | { Raw: any } | { BlakeTwo256: any } | { Sha256: any } | { Keccak256: any } | { ShaThree256: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Data]>;
/** /**
* Request a judgement from a registrar. * Request a judgement from a registrar.
* *
@@ -2538,7 +2538,7 @@ declare module '@polkadot/api/types/submittable' {
* Total Complexity: O(M + logM + C) * Total Complexity: O(M + logM + C)
* # </weight> * # </weight>
**/ **/
vote: AugmentedSubmittable<(candidate: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>; vote: AugmentedSubmittable<(candidate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, bool]>;
/** /**
* As a member, vouch for someone to join society by placing a bid on their behalf. * As a member, vouch for someone to join society by placing a bid on their behalf.
* *
@@ -2613,7 +2613,7 @@ declare module '@polkadot/api/types/submittable' {
* - Write: Bonded, Payee, [Origin Account], Locks, Ledger * - Write: Bonded, Payee, [Origin Account], Locks, Ledger
* # </weight> * # </weight>
**/ **/
bond: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>; bond: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<BalanceOf> | AnyNumber | Uint8Array, payee: RewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Compact<BalanceOf>, RewardDestination]>;
/** /**
* Add some extra amount that have appeared in the stash `free_balance` into the balance up * Add some extra amount that have appeared in the stash `free_balance` into the balance up
* for staking. * for staking.
@@ -2748,7 +2748,7 @@ declare module '@polkadot/api/types/submittable' {
* Note: Making this call only makes sense if you first set the validator preferences to * Note: Making this call only makes sense if you first set the validator preferences to
* block any further nominations. * block any further nominations.
**/ **/
kick: AugmentedSubmittable<(who: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>; kick: AugmentedSubmittable<(who: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
/** /**
* Declare the desire to nominate `targets` for the origin controller. * Declare the desire to nominate `targets` for the origin controller.
* *
@@ -2770,7 +2770,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes: Validators, Nominators * - Writes: Validators, Nominators
* # </weight> * # </weight>
**/ **/
nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | Address | AccountId | AccountIndex | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>; nominate: AugmentedSubmittable<(targets: Vec<LookupSource> | (LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<LookupSource>]>;
/** /**
* Pay out all the stakers behind a single validator for a single era. * Pay out all the stakers behind a single validator for a single era.
* *
@@ -2865,7 +2865,7 @@ declare module '@polkadot/api/types/submittable' {
* - Write: Bonded, Ledger New Controller, Ledger Old Controller * - Write: Bonded, Ledger New Controller, Ledger Old Controller
* # </weight> * # </weight>
**/ **/
setController: AugmentedSubmittable<(controller: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>; setController: AugmentedSubmittable<(controller: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/** /**
* Set `HistoryDepth` value. This function will delete any history information * Set `HistoryDepth` value. This function will delete any history information
* when `HistoryDepth` is reduced. * when `HistoryDepth` is reduced.
@@ -3098,7 +3098,7 @@ declare module '@polkadot/api/types/submittable' {
* - One DB change. * - One DB change.
* # </weight> * # </weight>
**/ **/
setKey: AugmentedSubmittable<(updated: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>; setKey: AugmentedSubmittable<(updated: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/** /**
* Authenticates the sudo key and dispatches a function call with `Root` origin. * Authenticates the sudo key and dispatches a function call with `Root` origin.
* *
@@ -3125,7 +3125,7 @@ declare module '@polkadot/api/types/submittable' {
* - Weight of derivative `call` execution + 10,000. * - Weight of derivative `call` execution + 10,000.
* # </weight> * # </weight>
**/ **/
sudoAs: AugmentedSubmittable<(who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>; sudoAs: AugmentedSubmittable<(who: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, Call]>;
/** /**
* Authenticates the sudo key and dispatches a function call with `Root` origin. * Authenticates the sudo key and dispatches a function call with `Root` origin.
* This function does not check the weight of the call, and instead allows the * This function does not check the weight of the call, and instead allows the
@@ -3612,7 +3612,7 @@ declare module '@polkadot/api/types/submittable' {
* - DbWrites: `ProposalCount`, `Proposals`, `origin account` * - DbWrites: `ProposalCount`, `Proposals`, `origin account`
* # </weight> * # </weight>
**/ **/
proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>; proposeSpend: AugmentedSubmittable<(value: Compact<BalanceOf> | AnyNumber | Uint8Array, beneficiary: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<BalanceOf>, LookupSource]>;
/** /**
* Reject a proposed spend. The original deposit will be slashed. * Reject a proposed spend. The original deposit will be slashed.
* *
@@ -3703,7 +3703,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes: Vesting Storage, Balances Locks, Target Account, Source Account * - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
* # </weight> * # </weight>
**/ **/
forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>; forceVestedTransfer: AugmentedSubmittable<(source: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, LookupSource, VestingInfo]>;
/** /**
* Unlock any vested funds of the sender account. * Unlock any vested funds of the sender account.
* *
@@ -3737,7 +3737,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes: Vesting Storage, Balances Locks, Target Account * - Writes: Vesting Storage, Balances Locks, Target Account
* # </weight> * # </weight>
**/ **/
vestOther: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>; vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
/** /**
* Create a vested transfer. * Create a vested transfer.
* *
@@ -3756,7 +3756,7 @@ declare module '@polkadot/api/types/submittable' {
* - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account] * - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
* # </weight> * # </weight>
**/ **/
vestedTransfer: AugmentedSubmittable<(target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>; vestedTransfer: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
}; };
} }
+1 -1
View File
@@ -12,7 +12,7 @@ import { hexToU8a } from '@polkadot/util';
import { SingleAccountSigner } from '../../test/util'; import { SingleAccountSigner } from '../../test/util';
import { ApiPromise } from '.'; import { ApiPromise } from '.';
const TRANSFER_SIG = '0x7a10e5ed9a14284eca7bea53f81631981dddda5a3d2dee973b136475947264801465726e4829ae3994d9058df638d959d4e043c7f1924299546790dda1dea20a'; const TRANSFER_SIG = '0x54f39e43f32376a5ab6cdfd4d0ce57802aa9ff85514a7ffa9f2a949078f02beca16af87427c45fe60d54aa847fd241d127ed39e21b101806f6b1f50f7a82500b';
describe('ApiPromise', (): void => { describe('ApiPromise', (): void => {
const registry = new TypeRegistry(); const registry = new TypeRegistry();
@@ -15,6 +15,7 @@ const registry = new TypeRegistry();
const metadata = new Metadata(registry, metadataStatic); const metadata = new Metadata(registry, metadataStatic);
registry.setMetadata(metadata); registry.setMetadata(metadata);
registry.register({ Address: 'IndicesLookupSource', LookupSource: 'IndicesLookupSource' });
const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version); const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
+1 -9
View File
@@ -8,21 +8,13 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
// these are override types for Polkadot // these are override types for Polkadot
const versioned: OverrideVersionedType[] = [ const versioned: OverrideVersionedType[] = [
{ {
minmax: [0, 259], minmax: [0, 260],
types: { types: {
AccountInfo: 'AccountInfoWithRefCount', AccountInfo: 'AccountInfoWithRefCount',
Address: 'LookupSource', Address: 'LookupSource',
LookupSource: 'IndicesLookupSource' LookupSource: 'IndicesLookupSource'
} }
}, },
{
minmax: [260, 260],
types: {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'MultiAddress',
LookupSource: 'MultiAddress'
}
},
{ {
minmax: [261, undefined], minmax: [261, undefined],
types: { types: {
+1 -1
View File
@@ -389,7 +389,7 @@ describe('Enum', (): void => {
expect(test.toHex()).toEqual( expect(test.toHex()).toEqual(
'0x' + '0x' +
'00' + // index '00' + // index
'ff' + // Address indicating an embedded AccountId '00' + // MultiAddress indicating an embedded AccountId
'0001020304050607080910111213141516171819202122232425262728293031' // AccountId '0001020304050607080910111213141516171819202122232425262728293031' // AccountId
); );
}); });
@@ -20,7 +20,7 @@ describe('Extrinsic', (): void => {
'0x' + '0x' +
'5d02' + // length '5d02' + // length
'84' + // V4, signing bit set '84' + // V4, signing bit set
'ff' + // lookup, AccountId of sender follows '00' + // MultiAddress, AccountId of sender follows
'fcc4910cb536b4333db4bccb40e2cf6427b4766518e754b91e70c97e4a87dbb3' + // sender 'fcc4910cb536b4333db4bccb40e2cf6427b4766518e754b91e70c97e4a87dbb3' + // sender
'00' + // multisig, type ed25519 '00' + // multisig, type ed25519
'd99ffe3e610ad234e1414bda5831395a6df9098bf80b01561ce89a5065ae89d5' + // sig first 32 'd99ffe3e610ad234e1414bda5831395a6df9098bf80b01561ce89a5065ae89d5' + // sig first 32
@@ -29,7 +29,7 @@ describe('Extrinsic', (): void => {
'1101' + // nonce, compact 68 '1101' + // nonce, compact 68
'0700ac23fc06' + // tip, 0.03 KSM '0700ac23fc06' + // tip, 0.03 KSM
'0600' + // balances.transfer (on Kusama this was 0400, changed here to match metadata) '0600' + // balances.transfer (on Kusama this was 0400, changed here to match metadata)
'ff' + // lookup, AccountId of recipient follows '00' + // MultiAddress, AccountId of recipient follows
'495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718' + // recipient '495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718' + // recipient
'0bc01eb1fc185f' // value, 104.560 KSM '0bc01eb1fc185f' // value, 104.560 KSM
); );
@@ -38,7 +38,7 @@ describe('Extrinsic', (): void => {
expect(extrinsic.nonce.toNumber()).toEqual(68); expect(extrinsic.nonce.toNumber()).toEqual(68);
expect(extrinsic.tip.toHuman()).toEqual('30.0000 mUnit'); expect(extrinsic.tip.toHuman()).toEqual('30.0000 mUnit');
expect(extrinsic.callIndex).toEqual(new Uint8Array([6, 0])); expect(extrinsic.callIndex).toEqual(new Uint8Array([6, 0]));
expect(extrinsic.args[0].toHex()).toEqual('0xff495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718'); expect(extrinsic.args[0].toHex()).toEqual('0x00495e1e506f266418af07fa0c5c108dd436f2faa59fe7d9e54403779f5bbd7718');
expect(extrinsic.args[1].toHuman()).toEqual('104.5609 Unit'); expect(extrinsic.args[1].toHuman()).toEqual('104.5609 Unit');
}); });
}); });
@@ -19,7 +19,7 @@ describe('SignerPayload', (): void => {
blockNumber: '0x00231d30', blockNumber: '0x00231d30',
era: '0x0703', era: '0x0703',
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c', method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
nonce: '0x00001234', nonce: '0x00001234',
signedExtensions: ['CheckNonce', 'CheckWeight'], signedExtensions: ['CheckNonce', 'CheckWeight'],
specVersion: '0x00000006', specVersion: '0x00000006',
@@ -36,7 +36,7 @@ describe('SignerPayload', (): void => {
blockNumber: '0x231d30', blockNumber: '0x231d30',
era: registry.createType('ExtrinsicEra', { current: 2301232, period: 200 }), era: registry.createType('ExtrinsicEra', { current: 2301232, period: 200 }),
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'), method: registry.createType('Call', '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
nonce: 0x1234, nonce: 0x1234,
signedExtensions: ['CheckNonce'], signedExtensions: ['CheckNonce'],
tip: 0x5678, tip: 0x5678,
@@ -48,7 +48,7 @@ describe('SignerPayload', (): void => {
blockNumber: '0x00231d30', blockNumber: '0x00231d30',
era: '0x0703', era: '0x0703',
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b', genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c', method: '0x060000d7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
nonce: '0x00001234', nonce: '0x00001234',
signedExtensions: ['CheckNonce'], signedExtensions: ['CheckNonce'],
specVersion: '0x00000000', specVersion: '0x00000000',
@@ -32,7 +32,7 @@ describe('ExtrinsicSignatureV4', (): void => {
const u8a = new Uint8Array([ const u8a = new Uint8Array([
// signer as an AccountIndex // signer as an AccountIndex
0x09, 0x01, 0x08, // 4 << 2
// signature type // signature type
0x01, 0x01,
// signature // signature
@@ -65,7 +65,7 @@ describe('ExtrinsicSignatureV4', (): void => {
).toHex() ).toHex()
).toEqual( ).toEqual(
'0x' + '0x' +
'ff' + '00' + // MultiAddress
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + 'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
'01' + '01' +
'4242424242424242424242424242424242424242424242424242424242424242' + '4242424242424242424242424242424242424242424242424242424242424242' +
@@ -93,7 +93,7 @@ describe('ExtrinsicSignatureV4', (): void => {
).toEqual( ).toEqual(
'0x' + '0x' +
// Address = AccountId // Address = AccountId
// 'ff' + // '00' +
'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' + 'd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' +
// This is a prefix-less signature, anySignture as opposed to Multi above // This is a prefix-less signature, anySignture as opposed to Multi above
// '01' + // '01' +
+6 -2
View File
@@ -19,12 +19,16 @@ describe('Call', (): void => {
args: [], args: [],
callIndex: [6, 1] // balances.setBalance callIndex: [6, 1] // balances.setBalance
}).toU8a() }).toU8a()
).toEqual(new Uint8Array([6, 1, 0, 0, 0])); ).toEqual(
new Uint8Array([6, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
);
}); });
it('handles creation from a hex value properly', (): void => { it('handles creation from a hex value properly', (): void => {
expect( expect(
new Call(registry, '0x0601').toU8a() new Call(registry, '0x0601').toU8a()
).toEqual(new Uint8Array([6, 1, 0, 0, 0])); // balances.setBalance ).toEqual(
new Uint8Array([6, 1, 1, 110, 7, 17, 0, 0, 0])
); // balances.setBalance
}); });
}); });
@@ -9,7 +9,7 @@ describe('LookupSource', (): void => {
const testDecode = (type: string, input: LookupSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void => const testDecode = (type: string, input: LookupSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void =>
it(`can decode from ${type}`, (): void => { it(`can decode from ${type}`, (): void => {
const a = registry.createType('Address', input); const a = registry.createType('IndicesLookupSource', input);
expect(a.toString()).toBe(expected); expect(a.toString()).toBe(expected);
}); });
@@ -18,19 +18,19 @@ describe('LookupSource', (): void => {
it('equals on AccountId', (): void => { it('equals on AccountId', (): void => {
const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo'; const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo';
expect(registry.createType('LookupSource', addr).eq(addr)).toBe(true); expect(registry.createType('IndicesLookupSource', addr).eq(addr)).toBe(true);
}); });
it('equals on AccountIndex', (): void => { it('equals on AccountIndex', (): void => {
// see the test below - these are equivalent (with different prefix encoding) // see the test below - these are equivalent (with different prefix encoding)
expect(registry.createType('LookupSource', '2jpAFn').eq('25GUyv')).toBe(true); expect(registry.createType('IndicesLookupSource', '2jpAFn').eq('25GUyv')).toBe(true);
}); });
}); });
describe('decoding', (): void => { describe('decoding', (): void => {
testDecode( testDecode(
'Address', 'Address',
registry.createType('LookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'), registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'),
'5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'
); );
testDecode( testDecode(
@@ -40,7 +40,7 @@ describe('LookupSource', (): void => {
); );
testDecode( testDecode(
'AccountIndex (mixed prefixes)', 'AccountIndex (mixed prefixes)',
registry.createType('LookupSource', '2jpAFn'), registry.createType('IndicesLookupSource', '2jpAFn'),
// NOTE Expected adress here is encoded with prefix 42, input above with 68 // NOTE Expected adress here is encoded with prefix 42, input above with 68
'25GUyv' '25GUyv'
); );
@@ -95,7 +95,7 @@ describe('LookupSource', (): void => {
describe('encoding', (): void => { describe('encoding', (): void => {
const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array): void => const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array): void =>
it(`can encode ${to}`, (): void => { it(`can encode ${to}`, (): void => {
const a = registry.createType('Address', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); const a = registry.createType('IndicesLookupSource', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF');
expect(a[to]()).toEqual(expected); expect(a[to]()).toEqual(expected);
}); });
@@ -29,7 +29,7 @@ export default {
AccountId: 'GenericAccountId', AccountId: 'GenericAccountId',
AccountIdOf: 'AccountId', AccountIdOf: 'AccountId',
AccountIndex: 'GenericAccountIndex', AccountIndex: 'GenericAccountIndex',
Address: 'LookupSource', Address: 'MultiAddress',
AssetId: 'u32', AssetId: 'u32',
Balance: 'UInt<128, Balance>', Balance: 'UInt<128, Balance>',
BalanceOf: 'Balance', BalanceOf: 'Balance',
@@ -82,7 +82,7 @@ export default {
KeyValue: '(StorageKey, StorageData)', KeyValue: '(StorageKey, StorageData)',
KeyTypeId: 'u32', KeyTypeId: 'u32',
LockIdentifier: '[u8; 8]', LockIdentifier: '[u8; 8]',
LookupSource: 'IndicesLookupSource', LookupSource: 'MultiAddress',
LookupTarget: 'AccountId', LookupTarget: 'AccountId',
ModuleId: 'LockIdentifier', ModuleId: 'LockIdentifier',
MultiAddress: 'GenericMultiAddress', MultiAddress: 'GenericMultiAddress',
@@ -17,7 +17,7 @@ export interface AccountIdOf extends AccountId {}
export interface AccountIndex extends GenericAccountIndex {} export interface AccountIndex extends GenericAccountIndex {}
/** @name Address */ /** @name Address */
export interface Address extends LookupSource {} export interface Address extends MultiAddress {}
/** @name AssetId */ /** @name AssetId */
export interface AssetId extends u32 {} export interface AssetId extends u32 {}
@@ -157,7 +157,7 @@ export interface KeyValue extends ITuple<[StorageKey, StorageData]> {}
export interface LockIdentifier extends U8aFixed {} export interface LockIdentifier extends U8aFixed {}
/** @name LookupSource */ /** @name LookupSource */
export interface LookupSource extends IndicesLookupSource {} export interface LookupSource extends MultiAddress {}
/** @name LookupTarget */ /** @name LookupTarget */
export interface LookupTarget extends AccountId {} export interface LookupTarget extends AccountId {}