Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Build types
  • Loading branch information
jacogr committed Dec 6, 2020
commit d586f421cfac4af42d5d2b159dc87c70d67eedaf
14 changes: 13 additions & 1 deletion packages/api/src/augment/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand All @@ -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>;
/**
Expand Down
225 changes: 219 additions & 6 deletions packages/api/src/augment/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>;
/**
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
15 changes: 15 additions & 0 deletions packages/types/src/augment/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>;
Expand Down
4 changes: 4 additions & 0 deletions packages/types/src/interfaces/assets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */

export * from './types';
Loading