Bump metadata (#3607)

* Bump metadata

* Generate

* s/removeBounded/removeExtensions/
This commit is contained in:
Jaco
2021-06-02 08:38:17 +02:00
committed by GitHub
parent 2e6a59e2a0
commit 3df5b01375
13 changed files with 1757 additions and 47 deletions
+7
View File
@@ -1,5 +1,12 @@
# CHANGELOG
## master
Changes:
- Update static metadata to latest Substrate
## 4.12.1 May 30, 2021
Upgrade priority: Low. Internal adjustment only, no major external usage changes.
+2 -2
View File
@@ -28,8 +28,8 @@
"@babel/core": "^7.14.3",
"@babel/register": "^7.13.16",
"@babel/runtime": "^7.14.0",
"@polkadot/dev": "^0.62.25",
"@polkadot/ts": "^0.3.73",
"@polkadot/dev": "^0.62.28",
"@polkadot/ts": "^0.3.76",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^26.0.23",
"copyfiles": "^2.4.1"
+1 -1
View File
@@ -406,7 +406,7 @@ declare module '@polkadot/api/types/consts' {
/**
* The maximum amount of proxies allowed for a single account.
**/
maxProxies: u16 & AugmentedConst<ApiType>;
maxProxies: u32 & AugmentedConst<ApiType>;
/**
* The base amount of currency needed to reserve for creating a proxy.
*
+46
View File
@@ -1388,6 +1388,52 @@ declare module '@polkadot/api/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
uniques: {
/**
* The asset instance ID has already been used for an asset.
**/
AlreadyExists: AugmentedError<ApiType>;
/**
* Invalid witness data given.
**/
BadWitness: AugmentedError<ApiType>;
/**
* The asset instance or class is frozen.
**/
Frozen: AugmentedError<ApiType>;
/**
* The asset ID is already taken.
**/
InUse: AugmentedError<ApiType>;
/**
* There is no delegate approved.
**/
NoDelegate: AugmentedError<ApiType>;
/**
* The signing account has no permission to do the operation.
**/
NoPermission: AugmentedError<ApiType>;
/**
* No approval exists that would allow the transfer.
**/
Unapproved: AugmentedError<ApiType>;
/**
* The given asset ID is unknown.
**/
Unknown: AugmentedError<ApiType>;
/**
* The delegate turned out to be different to what was expected.
**/
WrongDelegate: AugmentedError<ApiType>;
/**
* The owner turned out to be different to what was expected.
**/
WrongOwner: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
vesting: {
/**
* Amount being transferred is too low to create a vesting schedule.
+103
View File
@@ -21,6 +21,7 @@ import type { IdentificationTuple, SessionIndex } from '@polkadot/types/interfac
import type { ElectionCompute, EraIndex } from '@polkadot/types/interfaces/staking';
import type { DispatchError, DispatchInfo, DispatchResult } from '@polkadot/types/interfaces/system';
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
import type { ClassId, InstanceId } from '@polkadot/types/interfaces/uniques';
import type { Timepoint } from '@polkadot/types/interfaces/utility';
import type { ApiTypes } from '@polkadot/api/types';
@@ -1030,6 +1031,108 @@ declare module '@polkadot/api/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
uniques: {
/**
* An approval for a `delegate` account to transfer the `instance` of an asset `class` was
* cancelled by its `owner`.
* \[ class, instance, owner, delegate \]
**/
ApprovalCancelled: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
/**
* An `instance` of an asset `class` has been approved by the `owner` for transfer by a
* `delegate`.
* \[ class, instance, owner, delegate \]
**/
ApprovedTransfer: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
/**
* An asset `class` has had its attributes changed by the `Force` origin.
* \[ class \]
**/
AssetStatusChanged: AugmentedEvent<ApiType, [ClassId]>;
/**
* Attribute metadata has been cleared for an asset class or instance.
* \[ class, maybe_instance, key, maybe_value \]
**/
AttributeCleared: AugmentedEvent<ApiType, [ClassId, Option<InstanceId>, Bytes]>;
/**
* New attribute metadata has been set for an asset class or instance.
* \[ class, maybe_instance, key, value \]
**/
AttributeSet: AugmentedEvent<ApiType, [ClassId, Option<InstanceId>, Bytes, Bytes]>;
/**
* An asset `instance` was destroyed. \[ class, instance, owner \]
**/
Burned: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId]>;
/**
* Some asset `class` was frozen. \[ class \]
**/
ClassFrozen: AugmentedEvent<ApiType, [ClassId]>;
/**
* Metadata has been cleared for an asset class. \[ class \]
**/
ClassMetadataCleared: AugmentedEvent<ApiType, [ClassId]>;
/**
* New metadata has been set for an asset class. \[ class, data, is_frozen \]
**/
ClassMetadataSet: AugmentedEvent<ApiType, [ClassId, Bytes, bool]>;
/**
* Some asset `class` was thawed. \[ class \]
**/
ClassThawed: AugmentedEvent<ApiType, [ClassId]>;
/**
* An asset class was created. \[ class, creator, owner \]
**/
Created: AugmentedEvent<ApiType, [ClassId, AccountId, AccountId]>;
/**
* An asset `class` was destroyed. \[ class \]
**/
Destroyed: AugmentedEvent<ApiType, [ClassId]>;
/**
* An asset class was force-created. \[ class, owner \]
**/
ForceCreated: AugmentedEvent<ApiType, [ClassId, AccountId]>;
/**
* Some asset `instance` was frozen. \[ class, instance \]
**/
Frozen: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
/**
* An asset `instace` was issued. \[ class, instance, owner \]
**/
Issued: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId]>;
/**
* Metadata has been cleared for an asset instance. \[ class, instance \]
**/
MetadataCleared: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
/**
* New metadata has been set for an asset instance.
* \[ class, instance, data, is_frozen \]
**/
MetadataSet: AugmentedEvent<ApiType, [ClassId, InstanceId, Bytes, bool]>;
/**
* The owner changed \[ class, new_owner \]
**/
OwnerChanged: AugmentedEvent<ApiType, [ClassId, AccountId]>;
/**
* Metadata has been cleared for an asset instance. \[ class, successful_instances \]
**/
Redeposited: AugmentedEvent<ApiType, [ClassId, Vec<InstanceId>]>;
/**
* The management team changed \[ class, issuer, admin, freezer \]
**/
TeamChanged: AugmentedEvent<ApiType, [ClassId, AccountId, AccountId, AccountId]>;
/**
* Some asset `instance` was thawed. \[ class, instance \]
**/
Thawed: AugmentedEvent<ApiType, [ClassId, InstanceId]>;
/**
* An asset `instace` was transferred. \[ class, instance, from, to \]
**/
Transferred: AugmentedEvent<ApiType, [ClassId, InstanceId, AccountId, AccountId]>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
utility: {
/**
* Batch of dispatches completed fully with no error.
+32
View File
@@ -28,6 +28,7 @@ import type { ActiveEraInfo, ElectionPhase, ElectionScore, EraIndex, EraRewardPo
import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system';
import type { Bounty, BountyIndex, OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
import type { ClassDetails, ClassId, ClassMetadata, DepositBalanceOf, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques';
import type { Multisig } from '@polkadot/types/interfaces/utility';
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
import type { ApiTypes } from '@polkadot/api/types';
@@ -1224,6 +1225,37 @@ declare module '@polkadot/api/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
uniques: {
/**
* The assets held by any given account; set out this way so that assets owned by a single
* account can be enumerated.
**/
account: AugmentedQuery<ApiType, (arg1: AccountId | string | Uint8Array, arg2: ClassId | AnyNumber | Uint8Array, arg3: InstanceId | AnyNumber | Uint8Array) => Observable<Option<ITuple<[]>>>, [AccountId, ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [AccountId, ClassId, InstanceId]>;
/**
* The assets in existence and their ownership details.
**/
asset: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: InstanceId | AnyNumber | Uint8Array) => Observable<Option<InstanceDetails>>, [ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [ClassId, InstanceId]>;
/**
* Metadata of an asset class.
**/
attribute: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: Option<InstanceId> | null | object | string | Uint8Array, arg3: Bytes | string | Uint8Array) => Observable<Option<ITuple<[Bytes, DepositBalanceOf]>>>, [ClassId, Option<InstanceId>, Bytes]> & QueryableStorageEntry<ApiType, [ClassId, Option<InstanceId>, Bytes]>;
/**
* Details of an asset class.
**/
class: AugmentedQuery<ApiType, (arg: ClassId | AnyNumber | Uint8Array) => Observable<Option<ClassDetails>>, [ClassId]> & QueryableStorageEntry<ApiType, [ClassId]>;
/**
* Metadata of an asset class.
**/
classMetadataOf: AugmentedQuery<ApiType, (arg: ClassId | AnyNumber | Uint8Array) => Observable<Option<ClassMetadata>>, [ClassId]> & QueryableStorageEntry<ApiType, [ClassId]>;
/**
* Metadata of an asset instance.
**/
instanceMetadataOf: AugmentedQuery<ApiType, (arg1: ClassId | AnyNumber | Uint8Array, arg2: InstanceId | AnyNumber | Uint8Array) => Observable<Option<InstanceMetadata>>, [ClassId, InstanceId]> & QueryableStorageEntry<ApiType, [ClassId, InstanceId]>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
vesting: {
/**
* Information regarding the vesting of a given account.
+380 -10
View File
@@ -22,6 +22,7 @@ import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
import type { ElectionScore, EraIndex, RawSolution, RewardDestination, SolutionOrSnapshotSize, ValidatorPrefs } from '@polkadot/types/interfaces/staking';
import type { Key } from '@polkadot/types/interfaces/system';
import type { BountyIndex } from '@polkadot/types/interfaces/treasury';
import type { ClassId, DestroyWitness, InstanceId } from '@polkadot/types/interfaces/uniques';
import type { Timepoint } from '@polkadot/types/interfaces/utility';
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
@@ -208,8 +209,6 @@ declare module '@polkadot/api/types/submittable' {
* - `owner`: The owner of this class of assets. The owner has full superuser permissions
* over this asset, but may later change and configure the permissions using `transfer_ownership`
* and `set_team`.
* - `max_zombies`: The total number of accounts which may hold assets in this class yet
* have no existential deposit.
* - `min_balance`: The minimum balance of this new asset that any single account must
* have. If an account's balance is reduced below this, then it collapses to zero.
*
@@ -253,8 +252,8 @@ declare module '@polkadot/api/types/submittable' {
* to zero.
*
* Weight: `O(1)`
* Modes: Pre-existence of `dest`; Post-existence of `source`; Prior & post zombie-status
* of `source`; Account pre-existence of `dest`.
* Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of
* `dest`.
**/
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>]>;
/**
@@ -291,7 +290,7 @@ declare module '@polkadot/api/types/submittable' {
* - `beneficiary`: The account to be credited with the minted assets.
* - `amount`: The amount of the asset to be minted.
*
* Emits `Destroyed` event when successful.
* Emits `Issued` event when successful.
*
* Weight: `O(1)`
* Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
@@ -349,7 +348,7 @@ declare module '@polkadot/api/types/submittable' {
*
* Origin must be Signed and the sender should be the Admin of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `id`: The identifier of the asset to be thawed.
*
* Emits `Thawed`.
*
@@ -373,8 +372,8 @@ declare module '@polkadot/api/types/submittable' {
* to zero.
*
* Weight: `O(1)`
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`.
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`.
**/
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>]>;
/**
@@ -415,8 +414,8 @@ declare module '@polkadot/api/types/submittable' {
* to zero.
*
* Weight: `O(1)`
* Modes: Pre-existence of `target`; Post-existence of sender; Prior & post zombie-status
* of sender; Account pre-existence of `target`.
* Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
* `target`.
**/
transferKeepAlive: 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>]>;
/**
@@ -3881,6 +3880,377 @@ declare module '@polkadot/api/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
uniques: {
/**
* Approve an instance to be transferred by a delegated third-party account.
*
* Origin must be Signed and must be the owner of the asset `instance`.
*
* - `class`: The class of the asset to be approved for delegated transfer.
* - `instance`: The instance of the asset to be approved for delegated transfer.
* - `delegate`: The account to delegate permission to transfer the asset.
*
* Emits `ApprovedTransfer` on success.
*
* Weight: `O(1)`
**/
approveTransfer: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, delegate: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, LookupSource]>;
/**
* Destroy a single asset instance.
*
* Origin must be Signed and the sender should be the Admin of the asset `class`.
*
* - `class`: The class of the asset to be burned.
* - `instance`: The instance of the asset to be burned.
* - `check_owner`: If `Some` then the operation will fail with `WrongOwner` unless the
* asset is owned by this value.
*
* Emits `Burned` with the actual amount burned.
*
* Weight: `O(1)`
* Modes: `check_owner.is_some()`.
**/
burn: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, checkOwner: Option<LookupSource> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, Option<LookupSource>]>;
/**
* Cancel the prior approval for the transfer of an asset by a delegate.
*
* Origin must be either:
* - the `Force` origin;
* - `Signed` with the signer being the Admin of the asset `class`;
* - `Signed` with the signer being the Owner of the asset `instance`;
*
* Arguments:
* - `class`: The class of the asset of whose approval will be cancelled.
* - `instance`: The instance of the asset of whose approval will be cancelled.
* - `maybe_check_delegate`: If `Some` will ensure that the given account is the one to
* which permission of transfer is delegated.
*
* Emits `ApprovalCancelled` on success.
*
* Weight: `O(1)`
**/
cancelApproval: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, maybeCheckDelegate: Option<LookupSource> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, Option<LookupSource>]>;
/**
* Set an attribute for an asset class or instance.
*
* Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the
* asset `class`.
*
* If the origin is Signed, then funds of signer are reserved according to the formula:
* `MetadataDepositBase + DepositPerByte * (key.len + value.len)` taking into
* account any already reserved funds.
*
* - `class`: The identifier of the asset class whose instance's metadata to set.
* - `instance`: The identifier of the asset instance whose metadata to set.
* - `key`: The key of the attribute.
* - `value`: The value to which to set the attribute.
*
* Emits `AttributeSet`.
*
* Weight: `O(1)`
**/
clearAttribute: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, maybeInstance: Option<InstanceId> | null | object | string | Uint8Array, key: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Option<InstanceId>, Bytes]>;
/**
* Clear the metadata for an asset class.
*
* Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of
* the asset `class`.
*
* Any deposit is freed for the asset class owner.
*
* - `class`: The identifier of the asset class whose metadata to clear.
*
* Emits `ClassMetadataCleared`.
*
* Weight: `O(1)`
**/
clearClassMetadata: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>]>;
/**
* Clear the metadata for an asset instance.
*
* Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the
* asset `instance`.
*
* Any deposit is freed for the asset class owner.
*
* - `class`: The identifier of the asset class whose instance's metadata to clear.
* - `instance`: The identifier of the asset instance whose metadata to clear.
*
* Emits `MetadataCleared`.
*
* Weight: `O(1)`
**/
clearMetadata: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>]>;
/**
* Issue a new class of non-fungible assets from a public origin.
*
* This new asset class has no assets initially and its owner is the origin.
*
* The origin must be Signed and the sender must have sufficient funds free.
*
* `AssetDeposit` funds of sender are reserved.
*
* Parameters:
* - `class`: The identifier of the new asset class. This must not be currently in use.
* - `admin`: The admin of this class of assets. The admin is the initial address of each
* member of the asset class's admin team.
*
* Emits `Created` event when successful.
*
* Weight: `O(1)`
**/
create: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, admin: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, LookupSource]>;
/**
* Destroy a class of fungible assets.
*
* The origin must conform to `ForceOrigin` or must be `Signed` and the sender must be the
* owner of the asset `class`.
*
* - `class`: The identifier of the asset class to be destroyed.
* - `witness`: Information on the instances minted in the asset class. This must be
* correct.
*
* Emits `Destroyed` event when successful.
*
* Weight: `O(n + m)` where:
* - `n = witness.instances`
* - `m = witness.instance_metdadatas`
* - `a = witness.attributes`
**/
destroy: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, witness: DestroyWitness | { instances?: any; instanceMetadatas?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, DestroyWitness]>;
/**
* Alter the attributes of a given asset.
*
* Origin must be `ForceOrigin`.
*
* - `class`: The identifier of the asset.
* - `owner`: The new Owner of this asset.
* - `issuer`: The new Issuer of this asset.
* - `admin`: The new Admin of this asset.
* - `freezer`: The new Freezer of this asset.
* - `free_holding`: Whether a deposit is taken for holding an instance of this asset
* class.
* - `is_frozen`: Whether this asset class is frozen except for permissioned/admin
* instructions.
*
* Emits `AssetStatusChanged` with the identity of the asset.
*
* Weight: `O(1)`
**/
forceAssetStatus: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | 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, freeHolding: bool | boolean | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, LookupSource, LookupSource, LookupSource, LookupSource, bool, bool]>;
/**
* Issue a new class of non-fungible assets from a privileged origin.
*
* This new asset class has no assets initially.
*
* The origin must conform to `ForceOrigin`.
*
* Unlike `create`, no funds are reserved.
*
* - `class`: The identifier of the new asset. This must not be currently in use.
* - `owner`: The owner of this class of assets. The owner has full superuser permissions
* over this asset, but may later change and configure the permissions using
* `transfer_ownership` and `set_team`.
*
* Emits `ForceCreated` event when successful.
*
* Weight: `O(1)`
**/
forceCreate: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, freeHolding: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, LookupSource, bool]>;
/**
* Disallow further unprivileged transfer of an asset instance.
*
* Origin must be Signed and the sender should be the Freezer of the asset `class`.
*
* - `class`: The class of the asset to be frozen.
* - `instance`: The instance of the asset to be frozen.
*
* Emits `Frozen`.
*
* Weight: `O(1)`
**/
freeze: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>]>;
/**
* Disallow further unprivileged transfers for a whole asset class.
*
* Origin must be Signed and the sender should be the Freezer of the asset `class`.
*
* - `class`: The asset class to be frozen.
*
* Emits `ClassFrozen`.
*
* Weight: `O(1)`
**/
freezeClass: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>]>;
/**
* Mint an asset instance of a particular class.
*
* The origin must be Signed and the sender must be the Issuer of the asset `class`.
*
* - `class`: The class of the asset to be minted.
* - `instance`: The instance value of the asset to be minted.
* - `beneficiary`: The initial owner of the minted asset.
*
* Emits `Issued` event when successful.
*
* Weight: `O(1)`
**/
mint: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, LookupSource]>;
/**
* Reevaluate the deposits on some assets.
*
* Origin must be Signed and the sender should be the Owner of the asset `class`.
*
* - `class`: The class of the asset to be frozen.
* - `instances`: The instances of the asset class whose deposits will be reevaluated.
*
* NOTE: This exists as a best-effort function. Any asset instances which are unknown or
* in the case that the owner account does not have reservable funds to pay for a
* deposit increase are ignored. Generally the owner isn't going to call this on instances
* whose existing deposit is less than the refreshed deposit as it would only cost them,
* so it's of little consequence.
*
* It will still return an error in the case that the class is unknown of the signer is
* not permitted to call it.
*
* Weight: `O(instances.len())`
**/
redeposit: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instances: Vec<InstanceId> | (InstanceId | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Vec<InstanceId>]>;
/**
* Set an attribute for an asset class or instance.
*
* Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the
* asset `class`.
*
* If the origin is Signed, then funds of signer are reserved according to the formula:
* `MetadataDepositBase + DepositPerByte * (key.len + value.len)` taking into
* account any already reserved funds.
*
* - `class`: The identifier of the asset class whose instance's metadata to set.
* - `maybe_instance`: The identifier of the asset instance whose metadata to set.
* - `key`: The key of the attribute.
* - `value`: The value to which to set the attribute.
*
* Emits `AttributeSet`.
*
* Weight: `O(1)`
**/
setAttribute: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, maybeInstance: Option<InstanceId> | null | object | string | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Option<InstanceId>, Bytes, Bytes]>;
/**
* Set the metadata for an asset class.
*
* Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of
* the asset `class`.
*
* If the origin is `Signed`, then funds of signer are reserved according to the formula:
* `MetadataDepositBase + DepositPerByte * data.len` taking into
* account any already reserved funds.
*
* - `class`: The identifier of the asset whose metadata to update.
* - `data`: The general information of this asset. Limited in length by `StringLimit`.
* - `is_frozen`: Whether the metadata should be frozen against further changes.
*
* Emits `ClassMetadataSet`.
*
* Weight: `O(1)`
**/
setClassMetadata: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Bytes, bool]>;
/**
* Set the metadata for an asset instance.
*
* Origin must be either `ForceOrigin` or Signed and the sender should be the Owner of the
* asset `class`.
*
* If the origin is Signed, then funds of signer are reserved according to the formula:
* `MetadataDepositBase + DepositPerByte * data.len` taking into
* account any already reserved funds.
*
* - `class`: The identifier of the asset class whose instance's metadata to set.
* - `instance`: The identifier of the asset instance whose metadata to set.
* - `data`: The general information of this asset. Limited in length by `StringLimit`.
* - `is_frozen`: Whether the metadata should be frozen against further changes.
*
* Emits `MetadataSet`.
*
* Weight: `O(1)`
**/
setMetadata: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array, isFrozen: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, Bytes, bool]>;
/**
* Change the Issuer, Admin and Freezer of an asset class.
*
* Origin must be Signed and the sender should be the Owner of the asset `class`.
*
* - `class`: The asset class whose team should be changed.
* - `issuer`: The new Issuer of this asset class.
* - `admin`: The new Admin of this asset class.
* - `freezer`: The new Freezer of this asset class.
*
* Emits `TeamChanged`.
*
* Weight: `O(1)`
**/
setTeam: AugmentedSubmittable<(clazz: Compact<ClassId> | 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<ClassId>, LookupSource, LookupSource, LookupSource]>;
/**
* Re-allow unprivileged transfer of an asset instance.
*
* Origin must be Signed and the sender should be the Freezer of the asset `class`.
*
* - `class`: The class of the asset to be thawed.
* - `instance`: The instance of the asset to be thawed.
*
* Emits `Thawed`.
*
* Weight: `O(1)`
**/
thaw: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>]>;
/**
* Re-allow unprivileged transfers for a whole asset class.
*
* Origin must be Signed and the sender should be the Admin of the asset `class`.
*
* - `class`: The class to be thawed.
*
* Emits `ClassThawed`.
*
* Weight: `O(1)`
**/
thawClass: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>]>;
/**
* Move an asset from the sender account to another.
*
* Origin must be Signed and the signing account must be either:
* - the Admin of the asset `class`;
* - the Owner of the asset `instance`;
* - the approved delegate for the asset `instance` (in this case, the approval is reset).
*
* Arguments:
* - `class`: The class of the asset to be transferred.
* - `instance`: The instance of the asset to be transferred.
* - `dest`: The account to receive ownership of the asset.
*
* Emits `Transferred`.
*
* Weight: `O(1)`
**/
transfer: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, instance: Compact<InstanceId> | AnyNumber | Uint8Array, dest: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, Compact<InstanceId>, LookupSource]>;
/**
* Change the Owner of an asset class.
*
* Origin must be Signed and the sender should be the Owner of the asset `class`.
*
* - `class`: The asset class whose owner should be changed.
* - `owner`: The new Owner of this asset class.
*
* Emits `OwnerChanged`.
*
* Weight: `O(1)`
**/
transferOwnership: AugmentedSubmittable<(clazz: Compact<ClassId> | AnyNumber | Uint8Array, owner: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<ClassId>, LookupSource]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
utility: {
/**
* Send a call through an indexed pseudonym of the sender.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1
View File
@@ -14,6 +14,7 @@ import { stringCamelCase } from '@polkadot/util';
import { compareName, createImports, formatType, getSimilarTypes, initMeta, readTemplate, setImports, writeFile } from '../util';
const MAPPED_NAMES: Record<string, string> = {
class: 'clazz',
new: 'updated'
};
+21 -3
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { alias, removeBounded, removeColons } from './sanitize';
import { alias, flattenSingleTuple, removeColons, removeExtensions } from './sanitize';
describe('sanitize', (): void => {
describe('alias', (): void => {
@@ -60,14 +60,32 @@ describe('sanitize', (): void => {
});
describe('bounded', (): void => {
const fn = removeBounded();
const fn = removeExtensions('Bounded', true);
it('correctly cleans up bounded values', (): void => {
expect(fn('BoundedVec<u32, 256>')).toEqual('Vec<u32>');
});
it('correctly cleans up nested bounded values', (): void => {
expect(fn('BoundedBTreeMap<BoundedVec<BoundedVec<u32, 1>, 2>, BoundedBTreeSet<u32, BoundedVec<u64, 3>, 4>, 5>')).toEqual('BTreeMap<Vec<Vec<u32>>, BTreeSet<u32, Vec<u64>>>');
expect(
fn('BoundedBTreeMap<BoundedVec<BoundedVec<u32, 1>, 2>, BoundedBTreeSet<u32, BoundedVec<u64, 3>, 4>, 5>')
).toEqual('BTreeMap<Vec<Vec<u32>>,BTreeSet<u32,Vec<u64>>>');
});
it('cleans up values with trailing commas', (): void => {
expect(
flattenSingleTuple()(
fn('(BoundedVec<Announcement<T::AccountId, CallHashOf<T>, T::BlockNumber>, T::MaxPending,>,BalanceOf<T>,)')
)
).toEqual('(Vec<Announcement<T::AccountId,CallHashOf<T>,T::BlockNumber>>,BalanceOf<T>)');
});
});
describe('weak', (): void => {
const fn = removeExtensions('Weak', false);
it('correctly cleans up weak values', (): void => {
expect(fn('WeakVec<u32>')).toEqual('Vec<u32>');
});
});
});
+20 -7
View File
@@ -18,7 +18,9 @@ const mappings: Mapper[] = [
// <T::Balance as HasCompact>
cleanupCompact(),
// Change BoundedVec<Type, Size> to Vec<Type>
removeBounded(),
removeExtensions('Bounded', true),
// Change WeakVec<Type> to Vec<Type>
removeExtensions('Weak', false),
// Remove all the trait prefixes
removeTraits(),
// remove PairOf<T> -> (T, T)
@@ -94,7 +96,11 @@ export function cleanupCompact (): Mapper {
export function flattenSingleTuple (): Mapper {
return (value: string) =>
value.replace(/\(([^,]+)\)/, '$1');
value
// tuples may have trailing commas, e.g. (u32, BlockNumber, )
.replace(/,\)/g, ')')
// change (u32) -> u32
.replace(/\(([^,]+)\)/, '$1');
}
function replaceTagWith (value: string, matcher: string, replacer: (inner: string) => string): string {
@@ -114,14 +120,21 @@ function replaceTagWith (value: string, matcher: string, replacer: (inner: strin
}
}
// remove the Bounded* wrappers
export function removeBounded (): Mapper {
// remove the Bounded* or Weak* wrappers
export function removeExtensions (type: string, isSized: boolean): Mapper {
return (value: string) =>
BOUNDED.reduce((value, tag) =>
replaceTagWith(value, `Bounded${tag}<`, (inner: string): string => {
const parts = inner.split(',');
replaceTagWith(value, `${type}${tag}<`, (inner: string): string => {
const parts = inner
.split(',')
.map((s) => s.trim())
.filter((s) => s);
return `${tag}<${parts.filter((_, i) => i !== parts.length - 1).join(',')}>`;
if (isSized) {
parts.pop();
}
return `${tag}<${parts.join(',')}>`;
}), value
);
}
+10 -10
View File
@@ -1894,9 +1894,9 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/dev@npm:^0.62.25":
version: 0.62.25
resolution: "@polkadot/dev@npm:0.62.25"
"@polkadot/dev@npm:^0.62.28":
version: 0.62.28
resolution: "@polkadot/dev@npm:0.62.28"
dependencies:
"@babel/cli": ^7.14.3
"@babel/core": ^7.14.3
@@ -1976,7 +1976,7 @@ __metadata:
polkadot-exec-prettier: scripts/polkadot-exec-prettier.cjs
polkadot-exec-tsc: scripts/polkadot-exec-tsc.cjs
polkadot-exec-webpack: scripts/polkadot-exec-webpack.cjs
checksum: 56b2f51cbd35b79765bbd343f179a719edb0530db46771255ac65d7fdb9cf3c4647694835238f848ee31660f4df78e4522e07ff64bddd39238bbb0e20e7395ab
checksum: 86b8a5217f0f853371fcd965f89df9e307ad2ced9cb9b5f9052038a2309383081788ea431640a152480428c2d2edfa718553f491a60441f618399fca8fa195d7
languageName: node
linkType: hard
@@ -2051,12 +2051,12 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/ts@npm:^0.3.73":
version: 0.3.73
resolution: "@polkadot/ts@npm:0.3.73"
"@polkadot/ts@npm:^0.3.76":
version: 0.3.76
resolution: "@polkadot/ts@npm:0.3.76"
dependencies:
"@types/chrome": ^0.0.143
checksum: e13194c9b509bde9a763a59126b08181d11763b6a6781315a5d5bae47eaea1447c864fb89bfa2f9a8b2fc43bcead61020d8c8e7d92b6b64885b2288a0a75769b
checksum: c8e876dbd304d9adad878cdf21cec5cf83f201ac04affd342f518c6701c28aafb5eec81c3f0ae50caccf98ac832e7aceca91a1639b26c423a8ed6a755bbe169b
languageName: node
linkType: hard
@@ -9531,8 +9531,8 @@ resolve@^2.0.0-next.3:
"@babel/core": ^7.14.3
"@babel/register": ^7.13.16
"@babel/runtime": ^7.14.0
"@polkadot/dev": ^0.62.25
"@polkadot/ts": ^0.3.73
"@polkadot/dev": ^0.62.28
"@polkadot/ts": ^0.3.76
"@polkadot/typegen": "workspace:packages/typegen"
"@types/jest": ^26.0.23
copyfiles: ^2.4.1