Bump metadata (w/ AssetBalance, AssetDetails) (#2917)

* Bump metadata (w/ AssetBalance, AssetDetails)

* Bluperint for new-style with salt as default

* Use TBalance

* Easier overrides

* Balance

* Build types
This commit is contained in:
Jaco Greeff
2020-12-06 11:31:54 +01:00
committed by GitHub
parent 4e2ab3d11c
commit 8b4d3872d7
11 changed files with 1020 additions and 16 deletions
+2 -2
View File
@@ -92,9 +92,9 @@ export class Blueprint<ApiType extends ApiTypes> extends Base<ApiType> {
const withSalt = this.api.tx.contracts.instantiate.meta.args.length === 5;
const encoded = this.abi.findConstructor(constructorOrId).toU8a(params, withSalt ? EMPTY_SALT : encodedSalt);
const tx = withSalt
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore new style with salt included
? this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded, encodedSalt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old style with salt included
: this.api.tx.contracts.instantiate(value, gasLimit, this.codeHash, encoded);
return tx.withResultTransform((result: ISubmittableResult) =>
+13 -1
View File
@@ -3,6 +3,7 @@
import type { Bytes, Data, Option, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
import type { AssetBalance, AssetDetails } from '@polkadot/types/interfaces/assets';
import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe';
import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
@@ -17,7 +18,7 @@ import type { AuthIndex } from '@polkadot/types/interfaces/imOnline';
import type { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences';
import type { ProxyAnnouncement, ProxyDefinition } from '@polkadot/types/interfaces/proxy';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountIndex, AssetId, Balance, BalanceOf, BlockNumber, ExtrinsicsWeight, Hash, KeyTypeId, Moment, OpaqueCall, Perbill, Releases, ValidatorId } from '@polkadot/types/interfaces/runtime';
import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session';
import type { Bid, BidKind, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
@@ -31,6 +32,17 @@ import type { ApiTypes } from '@polkadot/api/types';
declare module '@polkadot/api/types/storage' {
export interface AugmentedQueries<ApiType> {
assets: {
[key: string]: QueryableStorageEntry<ApiType>;
/**
* The number of units of assets held by any given account.
**/
account: AugmentedQueryDoubleMap<ApiType, (key1: AssetId | AnyNumber | Uint8Array, key2: AccountId | string | Uint8Array) => Observable<AssetBalance>> & QueryableStorageEntry<ApiType>;
/**
* Details of an asset.
**/
asset: AugmentedQuery<ApiType, (arg: AssetId | AnyNumber | Uint8Array) => Observable<Option<AssetDetails>>> & QueryableStorageEntry<ApiType>;
};
authorship: {
[key: string]: QueryableStorageEntry<ApiType>;
/**
+219 -6
View File
@@ -13,7 +13,7 @@ import type { GrandpaEquivocationProof, KeyOwnerProof } from '@polkadot/types/in
import type { IdentityFields, IdentityInfo, IdentityJudgement, RegistrarIndex } from '@polkadot/types/interfaces/identity';
import type { Heartbeat } from '@polkadot/types/interfaces/imOnline';
import type { ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountId, AccountIndex, Address, Balance, BalanceOf, BlockNumber, Call, CallHashOf, ChangesTrieConfiguration, Hash, Header, KeyValue, LookupSource, Moment, OpaqueCall, Perbill, Percent, Weight } from '@polkadot/types/interfaces/runtime';
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 { Period, Priority } from '@polkadot/types/interfaces/scheduler';
import type { Keys } from '@polkadot/types/interfaces/session';
import type { SocietyJudgement } from '@polkadot/types/interfaces/society';
@@ -26,6 +26,216 @@ import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
declare module '@polkadot/api/types/submittable' {
export interface AugmentedSubmittables<ApiType> {
assets: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.
*
* Origin must be Signed and the sender should be the Manager of the asset `id`.
*
* Bails with `BalanceZero` if the `who` is already dead.
*
* - `id`: The identifier of the asset to have some amount burned.
* - `who`: The account to be debited from.
* - `amount`: The maximum amount by which `who`'s balance should be reduced.
*
* Emits `Burned` with the actual amount burned. If this takes the balance to below the
* minimum for the asset, then the amount burned is increased to take it to zero.
*
* Weight: `O(1)`
* 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<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Issue a new class of fungible assets from a public origin.
*
* This new asset class has no assets initially.
*
* The origin must be Signed and the sender must have sufficient funds free.
*
* Funds of sender are reserved according to the formula:
* `AssetDepositBase + AssetDepositPerZombie * max_zombies`.
*
* Parameters:
* - `id`: The identifier of the new asset. This must not be currently in use to identify
* an existing asset.
* - `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.
*
* Emits `Created` event when successful.
*
* Weight: `O(1)`
**/
create: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, admin: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: u32 | AnyNumber | Uint8Array, minBalance: Balance | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Destroy a class of fungible assets owned by the sender.
*
* The origin must be Signed and the sender must be the owner of the asset `id`.
*
* - `id`: The identifier of the asset to be destroyed. This must identify an existing
* asset.
*
* Emits `Destroyed` event when successful.
*
* Weight: `O(z)` where `z` is the number of zombie accounts.
**/
destroy: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, zombiesWitness: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Issue a new class of 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.
*
* - `id`: The identifier of the new asset. This must not be currently in use to identify
* an existing asset.
* - `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.
*
* Emits `ForceCreated` event when successful.
*
* Weight: `O(1)`
**/
forceCreate: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array, minBalance: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Destroy a class of fungible assets.
*
* The origin must conform to `ForceOrigin`.
*
* - `id`: The identifier of the asset to be destroyed. This must identify an existing
* asset.
*
* Emits `Destroyed` event when successful.
*
* Weight: `O(1)`
**/
forceDestroy: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, zombiesWitness: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Move some assets from one account to another.
*
* Origin must be Signed and the sender should be the Admin of the asset `id`.
*
* - `id`: The identifier of the asset to have some amount transferred.
* - `source`: The account to be debited.
* - `dest`: The account to be credited.
* - `amount`: The amount by which the `source`'s balance of assets should be reduced and
* `dest`'s balance increased. The amount actually transferred may be slightly greater in
* the case that the transfer would otherwise take the `source` balance above zero but
* below the minimum balance. Must be greater than zero.
*
* Emits `Transferred` with the actual amount transferred. If this takes the source balance
* to below the minimum for the asset, then the amount transferred is increased to take it
* 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`.
**/
forceTransfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, source: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, dest: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Disallow further unprivileged transfers from an account.
*
* Origin must be Signed and the sender should be the Freezer of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `who`: The account to be frozen.
*
* Emits `Frozen`.
*
* Weight: `O(1)`
**/
freeze: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Mint assets of a particular class.
*
* The origin must be Signed and the sender must be the Issuer of the asset `id`.
*
* - `id`: The identifier of the asset to have some amount minted.
* - `beneficiary`: The account to be credited with the minted assets.
* - `amount`: The amount of the asset to be minted.
*
* Emits `Destroyed` event when successful.
*
* Weight: `O(1)`
* 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<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
setMaxZombies: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, maxZombies: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Change the Issuer, Admin and Freezer of an asset.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `issuer`: The new Issuer of this asset.
* - `admin`: The new Admin of this asset.
* - `freezer`: The new Freezer of this asset.
*
* Emits `TeamChanged`.
*
* 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>>;
/**
* Allow unprivileged transfers from an account again.
*
* Origin must be Signed and the sender should be the Admin of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `who`: The account to be unfrozen.
*
* Emits `Thawed`.
*
* Weight: `O(1)`
**/
thaw: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, who: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Move some assets from the sender account to another.
*
* Origin must be Signed.
*
* - `id`: The identifier of the asset to have some amount transferred.
* - `target`: The account to be credited.
* - `amount`: The amount by which the sender's balance of assets should be reduced and
* `target`'s balance increased. The amount actually transferred may be slightly greater in
* the case that the transfer would otherwise take the sender balance above zero but below
* the minimum balance. Must be greater than zero.
*
* Emits `Transferred` with the actual amount transferred. If this takes the source balance
* to below the minimum for the asset, then the amount transferred is increased to take it
* 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`.
**/
transfer: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, target: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array, amount: Compact<Balance> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Change the Owner of an asset.
*
* Origin must be Signed and the sender should be the Owner of the asset `id`.
*
* - `id`: The identifier of the asset to be frozen.
* - `owner`: The new Owner of this asset.
*
* Emits `OwnerChanged`.
*
* Weight: `O(1)`
**/
transferOwnership: AugmentedSubmittable<(id: Compact<AssetId> | AnyNumber | Uint8Array, owner: LookupSource | Address | AccountId | AccountIndex | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
authorship: {
[key: string]: SubmittableExtrinsicFunction<ApiType>;
/**
@@ -152,18 +362,21 @@ declare module '@polkadot/api/types/submittable' {
**/
claimSurcharge: AugmentedSubmittable<(dest: AccountId | string | Uint8Array, auxSender: Option<AccountId> | null | object | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance.
* Instantiates a new contract from the `code_hash` generated by `put_code`,
* optionally transferring some balance.
*
* The supplied `salt` is used for contract address deriviation. See `fn contract_address`.
*
* Instantiation is executed as follows:
*
* - The destination address is computed based on the sender and hash of the code.
* - The destination address is computed based on the sender, code_hash and the salt.
* - The smart-contract account is created at the computed address.
* - The `ctor_code` is executed in the context of the newly-created account. Buffer returned
* after the execution is saved as the `code` of the account. That code will be invoked
* upon any call received by this account.
* - The contract is initialized.
**/
instantiate: AugmentedSubmittable<(endowment: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, codeHash: CodeHash | string | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
instantiate: AugmentedSubmittable<(endowment: Compact<BalanceOf> | AnyNumber | Uint8Array, gasLimit: Compact<Gas> | AnyNumber | Uint8Array, codeHash: CodeHash | string | Uint8Array, data: Bytes | string | Uint8Array, salt: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
/**
* Stores the given binary Wasm code into the chain's storage and returns its `codehash`.
* You can instantiate contracts only with stored code.
@@ -3339,7 +3552,7 @@ declare module '@polkadot/api/types/submittable' {
* - `calls`: The calls to be dispatched from the same origin.
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Trait::BaseCallFilter`).
* bypassing `frame_system::Config::BaseCallFilter`).
*
* # <weight>
* - Complexity: O(C) where C is the number of calls to be batched.
@@ -3361,7 +3574,7 @@ declare module '@polkadot/api/types/submittable' {
* - `calls`: The calls to be dispatched from the same origin.
*
* If origin is root then call are dispatch without checking origin filter. (This includes
* bypassing `frame_system::Trait::BaseCallFilter`).
* bypassing `frame_system::Config::BaseCallFilter`).
*
* # <weight>
* - Complexity: O(C) where C is the number of calls to be batched.
+698 -6
View File
@@ -561,7 +561,7 @@
" - `calls`: The calls to be dispatched from the same origin.",
"",
" If origin is root then call are dispatch without checking origin filter. (This includes",
" bypassing `frame_system::Trait::BaseCallFilter`).",
" bypassing `frame_system::Config::BaseCallFilter`).",
"",
" # <weight>",
" - Complexity: O(C) where C is the number of calls to be batched.",
@@ -619,7 +619,7 @@
" - `calls`: The calls to be dispatched from the same origin.",
"",
" If origin is root then call are dispatch without checking origin filter. (This includes",
" bypassing `frame_system::Trait::BaseCallFilter`).",
" bypassing `frame_system::Config::BaseCallFilter`).",
"",
" # <weight>",
" - Complexity: O(C) where C is the number of calls to be batched.",
@@ -5971,6 +5971,26 @@
" `EmptyTerm`."
]
},
{
"name": "CandidateSlashed",
"args": [
"AccountId",
"Balance"
],
"documentation": [
" A candidate was slashed due to failing to obtain a seat as member or runner-up"
]
},
{
"name": "SeatHolderSlashed",
"args": [
"AccountId",
"Balance"
],
"documentation": [
" A seat holder (member or runner-up) was slashed due to failing to retaining their position."
]
},
{
"name": "MemberRenounced",
"args": [
@@ -7501,7 +7521,7 @@
"type": {
"Plain": "Schedule"
},
"fallback": "0x000000000004000000000200000001000080000000100000000010000000010000200000000000080075060000c26c020057790300461700003b1d0000730b0000f0170000fb29000053000000c36b0100ce0003000408000067070000e9070000720700007f190000bc2800006508000035b684088f080000ca080000100b00007b0800003c0800005008000081080000de090000cd090000a30900008209000090090000810900009d0900008d090000c6090000fc070000dc0900007209000071090000c41f0000ee1b00009a1f0000a81b0000330900008a090000540900007e0900009909000081090000bd090000b8090000c0a3370000000000a0be37000000000088183700000000001ae0780000000000743637000000000062d9370000000000765737000000000078b27f00000000006a04370000000000603137000000000098065c000000000014251c0000000000e8457200000000000d0100000000000000ea5600000000009302000000000000f812082900000000889b3524000000000ed7ac0900000000b8618b0000000000b8d7c90000000000c2dee307000000005009000000000000160d9600000000000a51491000000000cc07000000000000e23d760a0000000020e41c02000000009a05000000000000c4df050b0000000010bac407000000002eded90a000000000c02000000000000cf020000000000002a346b1d00000000f605000000000000d802000000000000c6d13000000000001710000000000000c0ee320000000000c10c0000000000001a9e2e0000000000c50500000000000024802e0000000000c705000000000000",
"fallback": "0x00000000000400000000020000000100008000000010000000001000000001000020000000000008002a0600001d620200846b03008b180000671d0000610a00001d180000cc2a00005c000000a17001003e020300f307000046070000e807000001080000f4190000db280000a908000013249208f8080000d0080000060b000007090000ad080000520800009c0800006f0a0000e7090000020a0000f30900002b0a0000f8090000d10900001b0a0000390a0000270a0000560f0000dc070000260a000036200000381c0000ec1f0000d51c0000780a0000bc0a00005f0a0000e40900003e0a0000330a0000470a0000270a00006cf1380000000000a0f938000000000040ff3800000000008ca77b00000000001a6c3800000000008876380000000000b481380000000000d4f981000000000028543800000000008a4c380000000000c87d5f00000000008a9f1c0000000000c8e57400000000000b01000000000000983c530000000000a90200000000000050de382a0000000038476124000000006467b209000000002418910000000000b2dfd100000000001a6fe7070000000039090000000000004e86990000000000dad35a1000000000cd07000000000000eaaf830a00000000a01f2a0200000000ae0500000000000008f7270b000000003675e30700000000f4753c09000000000102000000000000d20200000000000008efb81d000000000802000000000000e602000000000000b90a000000000000c25731000000000026100000000000007a8e330000000000d80c00000000000040c22f0000000000d305000000000000067f2f0000000000d705000000000000",
"documentation": [
" Current cost schedule for contracts."
]
@@ -7645,14 +7665,21 @@
{
"name": "data",
"type": "Bytes"
},
{
"name": "salt",
"type": "Bytes"
}
],
"documentation": [
" Instantiates a new contract from the `codehash` generated by `put_code`, optionally transferring some balance.",
" Instantiates a new contract from the `code_hash` generated by `put_code`,",
" optionally transferring some balance.",
"",
" The supplied `salt` is used for contract address deriviation. See `fn contract_address`.",
"",
" Instantiation is executed as follows:",
"",
" - The destination address is computed based on the sender and hash of the code.",
" - The destination address is computed based on the sender, code_hash and the salt.",
" - The smart-contract account is created at the computed address.",
" - The `ctor_code` is executed in the context of the newly-created account. Buffer returned",
" after the execution is saved as the `code` of the account. That code will be invoked",
@@ -7963,6 +7990,14 @@
"documentation": [
" The size defined in `T::MaxValueSize` was exceeded."
]
},
{
"name": "ReentranceDenied",
"documentation": [
" The action performed is not allowed while the contract performing it is already",
" on the call stack. Those actions are contract self destruction and restoration",
" of a tombstone."
]
}
],
"index": 17
@@ -8101,7 +8136,7 @@
{
"name": "SudoAsDone",
"args": [
"bool"
"DispatchResult"
],
"documentation": [
" A sudo just took place. \\[result\\]"
@@ -12088,6 +12123,663 @@
}
],
"index": 30
},
{
"name": "Assets",
"storage": {
"prefix": "Assets",
"items": [
{
"name": "Asset",
"modifier": "Optional",
"type": {
"Map": {
"hasher": "Blake2_128Concat",
"key": "AssetId",
"value": "AssetDetails",
"linked": false
}
},
"fallback": "0x00",
"documentation": [
" Details of an asset."
]
},
{
"name": "Account",
"modifier": "Default",
"type": {
"DoubleMap": {
"hasher": "Blake2_128Concat",
"key1": "AssetId",
"key2": "AccountId",
"value": "AssetBalance",
"key2Hasher": "Blake2_128Concat"
}
},
"fallback": "0x00000000000000000000",
"documentation": [
" The number of units of assets held by any given account."
]
}
]
},
"calls": [
{
"name": "create",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "admin",
"type": "LookupSource"
},
{
"name": "max_zombies",
"type": "u32"
},
{
"name": "min_balance",
"type": "Balance"
}
],
"documentation": [
" Issue a new class of fungible assets from a public origin.",
"",
" This new asset class has no assets initially.",
"",
" The origin must be Signed and the sender must have sufficient funds free.",
"",
" Funds of sender are reserved according to the formula:",
" `AssetDepositBase + AssetDepositPerZombie * max_zombies`.",
"",
" Parameters:",
" - `id`: The identifier of the new asset. This must not be currently in use to identify",
" an existing asset.",
" - `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.",
"",
" Emits `Created` event when successful.",
"",
" Weight: `O(1)`"
]
},
{
"name": "force_create",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "owner",
"type": "LookupSource"
},
{
"name": "max_zombies",
"type": "Compact<u32>"
},
{
"name": "min_balance",
"type": "Compact<Balance>"
}
],
"documentation": [
" Issue a new class of 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.",
"",
" - `id`: The identifier of the new asset. This must not be currently in use to identify",
" an existing asset.",
" - `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.",
"",
" Emits `ForceCreated` event when successful.",
"",
" Weight: `O(1)`"
]
},
{
"name": "destroy",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "zombies_witness",
"type": "Compact<u32>"
}
],
"documentation": [
" Destroy a class of fungible assets owned by the sender.",
"",
" The origin must be Signed and the sender must be the owner of the asset `id`.",
"",
" - `id`: The identifier of the asset to be destroyed. This must identify an existing",
" asset.",
"",
" Emits `Destroyed` event when successful.",
"",
" Weight: `O(z)` where `z` is the number of zombie accounts."
]
},
{
"name": "force_destroy",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "zombies_witness",
"type": "Compact<u32>"
}
],
"documentation": [
" Destroy a class of fungible assets.",
"",
" The origin must conform to `ForceOrigin`.",
"",
" - `id`: The identifier of the asset to be destroyed. This must identify an existing",
" asset.",
"",
" Emits `Destroyed` event when successful.",
"",
" Weight: `O(1)`"
]
},
{
"name": "mint",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "beneficiary",
"type": "LookupSource"
},
{
"name": "amount",
"type": "Compact<Balance>"
}
],
"documentation": [
" Mint assets of a particular class.",
"",
" The origin must be Signed and the sender must be the Issuer of the asset `id`.",
"",
" - `id`: The identifier of the asset to have some amount minted.",
" - `beneficiary`: The account to be credited with the minted assets.",
" - `amount`: The amount of the asset to be minted.",
"",
" Emits `Destroyed` event when successful.",
"",
" Weight: `O(1)`",
" Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`."
]
},
{
"name": "burn",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "who",
"type": "LookupSource"
},
{
"name": "amount",
"type": "Compact<Balance>"
}
],
"documentation": [
" Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.",
"",
" Origin must be Signed and the sender should be the Manager of the asset `id`.",
"",
" Bails with `BalanceZero` if the `who` is already dead.",
"",
" - `id`: The identifier of the asset to have some amount burned.",
" - `who`: The account to be debited from.",
" - `amount`: The maximum amount by which `who`'s balance should be reduced.",
"",
" Emits `Burned` with the actual amount burned. If this takes the balance to below the",
" minimum for the asset, then the amount burned is increased to take it to zero.",
"",
" Weight: `O(1)`",
" Modes: Post-existence of `who`; Pre & post Zombie-status of `who`."
]
},
{
"name": "transfer",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "target",
"type": "LookupSource"
},
{
"name": "amount",
"type": "Compact<Balance>"
}
],
"documentation": [
" Move some assets from the sender account to another.",
"",
" Origin must be Signed.",
"",
" - `id`: The identifier of the asset to have some amount transferred.",
" - `target`: The account to be credited.",
" - `amount`: The amount by which the sender's balance of assets should be reduced and",
" `target`'s balance increased. The amount actually transferred may be slightly greater in",
" the case that the transfer would otherwise take the sender balance above zero but below",
" the minimum balance. Must be greater than zero.",
"",
" Emits `Transferred` with the actual amount transferred. If this takes the source balance",
" to below the minimum for the asset, then the amount transferred is increased to take it",
" 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`."
]
},
{
"name": "force_transfer",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "source",
"type": "LookupSource"
},
{
"name": "dest",
"type": "LookupSource"
},
{
"name": "amount",
"type": "Compact<Balance>"
}
],
"documentation": [
" Move some assets from one account to another.",
"",
" Origin must be Signed and the sender should be the Admin of the asset `id`.",
"",
" - `id`: The identifier of the asset to have some amount transferred.",
" - `source`: The account to be debited.",
" - `dest`: The account to be credited.",
" - `amount`: The amount by which the `source`'s balance of assets should be reduced and",
" `dest`'s balance increased. The amount actually transferred may be slightly greater in",
" the case that the transfer would otherwise take the `source` balance above zero but",
" below the minimum balance. Must be greater than zero.",
"",
" Emits `Transferred` with the actual amount transferred. If this takes the source balance",
" to below the minimum for the asset, then the amount transferred is increased to take it",
" 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`."
]
},
{
"name": "freeze",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "who",
"type": "LookupSource"
}
],
"documentation": [
" Disallow further unprivileged transfers from an account.",
"",
" Origin must be Signed and the sender should be the Freezer of the asset `id`.",
"",
" - `id`: The identifier of the asset to be frozen.",
" - `who`: The account to be frozen.",
"",
" Emits `Frozen`.",
"",
" Weight: `O(1)`"
]
},
{
"name": "thaw",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "who",
"type": "LookupSource"
}
],
"documentation": [
" Allow unprivileged transfers from an account again.",
"",
" Origin must be Signed and the sender should be the Admin of the asset `id`.",
"",
" - `id`: The identifier of the asset to be frozen.",
" - `who`: The account to be unfrozen.",
"",
" Emits `Thawed`.",
"",
" Weight: `O(1)`"
]
},
{
"name": "transfer_ownership",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "owner",
"type": "LookupSource"
}
],
"documentation": [
" Change the Owner of an asset.",
"",
" Origin must be Signed and the sender should be the Owner of the asset `id`.",
"",
" - `id`: The identifier of the asset to be frozen.",
" - `owner`: The new Owner of this asset.",
"",
" Emits `OwnerChanged`.",
"",
" Weight: `O(1)`"
]
},
{
"name": "set_team",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "issuer",
"type": "LookupSource"
},
{
"name": "admin",
"type": "LookupSource"
},
{
"name": "freezer",
"type": "LookupSource"
}
],
"documentation": [
" Change the Issuer, Admin and Freezer of an asset.",
"",
" Origin must be Signed and the sender should be the Owner of the asset `id`.",
"",
" - `id`: The identifier of the asset to be frozen.",
" - `issuer`: The new Issuer of this asset.",
" - `admin`: The new Admin of this asset.",
" - `freezer`: The new Freezer of this asset.",
"",
" Emits `TeamChanged`.",
"",
" Weight: `O(1)`"
]
},
{
"name": "set_max_zombies",
"args": [
{
"name": "id",
"type": "Compact<AssetId>"
},
{
"name": "max_zombies",
"type": "Compact<u32>"
}
],
"documentation": []
}
],
"events": [
{
"name": "Created",
"args": [
"AssetId",
"AccountId",
"AccountId"
],
"documentation": [
" Some asset class was created. \\[asset_id, creator, owner\\]"
]
},
{
"name": "Issued",
"args": [
"AssetId",
"AccountId",
"Balance"
],
"documentation": [
" Some assets were issued. \\[asset_id, owner, total_supply\\]"
]
},
{
"name": "Transferred",
"args": [
"AssetId",
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" Some assets were transferred. \\[asset_id, from, to, amount\\]"
]
},
{
"name": "Burned",
"args": [
"AssetId",
"AccountId",
"Balance"
],
"documentation": [
" Some assets were destroyed. \\[asset_id, owner, balance\\]"
]
},
{
"name": "TeamChanged",
"args": [
"AssetId",
"AccountId",
"AccountId",
"AccountId"
],
"documentation": [
" The management team changed \\[asset_id, issuer, admin, freezer\\]"
]
},
{
"name": "OwnerChanged",
"args": [
"AssetId",
"AccountId"
],
"documentation": [
" The owner changed \\[asset_id, owner\\]"
]
},
{
"name": "ForceTransferred",
"args": [
"AssetId",
"AccountId",
"AccountId",
"Balance"
],
"documentation": [
" Some assets was transferred by an admin. \\[asset_id, from, to, amount\\]"
]
},
{
"name": "Frozen",
"args": [
"AssetId",
"AccountId"
],
"documentation": [
" Some account `who` was frozen. \\[asset_id, who\\]"
]
},
{
"name": "Thawed",
"args": [
"AssetId",
"AccountId"
],
"documentation": [
" Some account `who` was thawed. \\[asset_id, who\\]"
]
},
{
"name": "Destroyed",
"args": [
"AssetId"
],
"documentation": [
" An asset class was destroyed."
]
},
{
"name": "ForceCreated",
"args": [
"AssetId",
"AccountId"
],
"documentation": [
" Some asset class was force-created. \\[asset_id, owner\\]"
]
},
{
"name": "MaxZombiesChanged",
"args": [
"AssetId",
"u32"
],
"documentation": [
" The maximum amount of zombies allowed has changed. \\[asset_id, max_zombies\\]"
]
}
],
"constants": [],
"errors": [
{
"name": "AmountZero",
"documentation": [
" Transfer amount should be non-zero."
]
},
{
"name": "BalanceLow",
"documentation": [
" Account balance must be greater than or equal to the transfer amount."
]
},
{
"name": "BalanceZero",
"documentation": [
" Balance should be non-zero."
]
},
{
"name": "NoPermission",
"documentation": [
" The signing account has no permission to do the operation."
]
},
{
"name": "Unknown",
"documentation": [
" The given asset ID is unknown."
]
},
{
"name": "Frozen",
"documentation": [
" The origin account is frozen."
]
},
{
"name": "InUse",
"documentation": [
" The asset ID is already taken."
]
},
{
"name": "TooManyZombies",
"documentation": [
" Too many zombie accounts in use."
]
},
{
"name": "RefsLeft",
"documentation": [
" Attempt to destroy an asset class when non-zombie, reference-bearing accounts exist."
]
},
{
"name": "BadWitness",
"documentation": [
" Invalid witness data given."
]
},
{
"name": "MinBalanceZero",
"documentation": [
" Minimum balance should be non-zero."
]
},
{
"name": "Overflow",
"documentation": [
" A mint operation lead to an overflow."
]
}
],
"index": 31
}
],
"extrinsic": {
File diff suppressed because one or more lines are too long
+15
View File
@@ -2,6 +2,7 @@
/* eslint-disable */
import type { BitVec, Bool, Bytes, Compact, Data, DoNotConstruct, I128, I16, I256, I32, I64, I8, Json, Null, Option, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, Vec, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';
import type { AssetBalance, AssetDetails, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import type { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
@@ -396,6 +397,20 @@ declare module '@polkadot/types/types/registry' {
Consensus: Consensus;
'Option<Consensus>': Option<Consensus>;
'Vec<Consensus>': Vec<Consensus>;
AssetBalance: AssetBalance;
'Option<AssetBalance>': Option<AssetBalance>;
'Vec<AssetBalance>': Vec<AssetBalance>;
AssetDetails: AssetDetails;
'Option<AssetDetails>': Option<AssetDetails>;
'Vec<AssetDetails>': Vec<AssetDetails>;
TAssetBalance: TAssetBalance;
'Compact<TAssetBalance>': Compact<TAssetBalance>;
'Option<TAssetBalance>': Option<TAssetBalance>;
'Vec<TAssetBalance>': Vec<TAssetBalance>;
TAssetDepositBalance: TAssetDepositBalance;
'Compact<TAssetDepositBalance>': Compact<TAssetDepositBalance>;
'Option<TAssetDepositBalance>': Option<TAssetDepositBalance>;
'Vec<TAssetDepositBalance>': Vec<TAssetDepositBalance>;
UncleEntryItem: UncleEntryItem;
'Option<UncleEntryItem>': Option<UncleEntryItem>;
'Vec<UncleEntryItem>': Vec<UncleEntryItem>;
@@ -0,0 +1,32 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { Definitions } from '../../types';
export default {
rpc: {},
types: {
AssetBalance: {
balance: 'TAssetBalance',
isFrozen: 'bool',
isZombie: 'bool'
},
AssetDetails: {
owner: 'AccountId',
issuer: 'AccountId',
admin: 'AccountId',
freezer: 'AccountId',
supply: 'TAssetBalance',
deposit: 'TAssetDepositBalance',
maxZombies: 'u32',
minBalance: 'TAssetBalance',
zombies: 'u32',
accounts: 'u32'
},
TAssetBalance: 'Balance',
TAssetDepositBalance: 'BalanceOf'
}
} as Definitions;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types';
@@ -0,0 +1,34 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Struct, bool, u32 } from '@polkadot/types';
import type { AccountId, Balance, BalanceOf } from '@polkadot/types/interfaces/runtime';
/** @name AssetBalance */
export interface AssetBalance extends Struct {
readonly balance: TAssetBalance;
readonly isFrozen: bool;
readonly isZombie: bool;
}
/** @name AssetDetails */
export interface AssetDetails extends Struct {
readonly owner: AccountId;
readonly issuer: AccountId;
readonly admin: AccountId;
readonly freezer: AccountId;
readonly supply: TAssetBalance;
readonly deposit: TAssetDepositBalance;
readonly maxZombies: u32;
readonly minBalance: TAssetBalance;
readonly zombies: u32;
readonly accounts: u32;
}
/** @name TAssetBalance */
export interface TAssetBalance extends Balance {}
/** @name TAssetDepositBalance */
export interface TAssetDepositBalance extends BalanceOf {}
export type PHANTOM_ASSETS = 'assets';
@@ -5,6 +5,7 @@
export { default as runtime } from './runtime/definitions';
// substrate types
export { default as assets } from './assets/definitions';
export { default as authorship } from './authorship/definitions';
export { default as aura } from './aura/definitions';
export { default as babe } from './babe/definitions';
+1
View File
@@ -2,6 +2,7 @@
/* eslint-disable */
export * from './runtime/types';
export * from './assets/types';
export * from './authorship/types';
export * from './aura/types';
export * from './babe/types';