From ee71c42067bc44dc879faadfb8dec45a57dc2c44 Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Mon, 4 Dec 2023 18:23:09 -0500 Subject: [PATCH] Corrected typings for npm publish --- src/interfaces/augment-api-consts.ts | 249 ----------- src/interfaces/augment-api-events.ts | 398 ------------------ src/interfaces/augment-api-query.ts | 421 ------------------- src/interfaces/augment-api-tx.ts | 601 --------------------------- src/interfaces/index.ts | 2 +- src/protocols/chain-api.ts | 20 +- 6 files changed, 12 insertions(+), 1679 deletions(-) delete mode 100644 src/interfaces/augment-api-consts.ts delete mode 100644 src/interfaces/augment-api-events.ts delete mode 100644 src/interfaces/augment-api-query.ts delete mode 100644 src/interfaces/augment-api-tx.ts diff --git a/src/interfaces/augment-api-consts.ts b/src/interfaces/augment-api-consts.ts deleted file mode 100644 index ddaa946..0000000 --- a/src/interfaces/augment-api-consts.ts +++ /dev/null @@ -1,249 +0,0 @@ -// Auto-generated via `yarn polkadot-types-from-chain`, do not edit -/* eslint-disable */ - -// import type lookup before we augment - in some environments -// this is required to allow for ambient/previous definitions -import '@polkadot/api-base/types/consts'; - -import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types'; -import type { u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; -import type { Codec } from '@polkadot/types-codec/types'; - -export type __AugmentedConst = AugmentedConst; - -declare module '@polkadot/api-base/types/consts' { - interface AugmentedConsts { - asset: { - /** - * The minimum balance to create class - **/ - createAssetClassDeposit: u128 & AugmentedConst; - maxAssetMetadata: u32 & AugmentedConst; - maxClassMetadata: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - bag: { - /** - * The minimum balance to create bag - **/ - createBagDeposit: u128 & AugmentedConst; - /** - * Max number of owners - **/ - maxOwners: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - balances: { - /** - * The minimum amount required to keep an account open. MUST BE GREATER THAN ZERO! - * - * If you *really* need it to be zero, you can enable the feature `insecure_zero_ed` for - * this pallet. However, you do so at your own risk: this will open up a major DoS vector. - * In case you have multiple sources of provider references, you may also get unexpected - * behaviour if you set this to zero. - * - * Bottom line: Do yourself a favour and make it at least one! - **/ - existentialDeposit: u128 & AugmentedConst; - /** - * The maximum number of individual freeze locks that can exist on an account at any time. - **/ - maxFreezes: u32 & AugmentedConst; - /** - * The maximum number of holds that can exist on an account at any time. - **/ - maxHolds: u32 & AugmentedConst; - /** - * The maximum number of locks that should exist on an account. - * Not strictly enforced, but used for weight estimation. - **/ - maxLocks: u32 & AugmentedConst; - /** - * The maximum number of named reserves that can exist on an account. - **/ - maxReserves: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - bundle: { - /** - * Max number of asset classes and per asset_id in a bundle - **/ - maxAssets: u32 & AugmentedConst; - palletId: FrameSupportPalletId & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - council: { - /** - * The maximum weight of a dispatch call that can be proposed and executed. - **/ - maxProposalWeight: SpWeightsWeightV2Weight & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - fula: { - maxManifestMetadata: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - grandpa: { - /** - * Max Authorities in use - **/ - maxAuthorities: u32 & AugmentedConst; - /** - * The maximum number of entries to keep in the set id to session index mapping. - * - * Since the `SetIdSession` map is only used for validating equivocations this - * value should relate to the bonding duration of whatever staking system is - * being used (if any). If equivocation handling is not enabled then this value - * can be zero. - **/ - maxSetIdSessionEntries: u64 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - market: { - /** - * Max metadata size - **/ - maxMetadata: u32 & AugmentedConst; - /** - * Max number of rates per market_rate - **/ - maxRates: u32 & AugmentedConst; - palletId: FrameSupportPalletId & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - pool: { - /** - * The maximum number of pool participants. We are aiming at `u8::MAX`. - **/ - maxPoolParticipants: u32 & AugmentedConst; - /** - * The maximum length of a name or symbol stored on-chain. See if this can be limited to - * `u8::MAX`. - **/ - stringLimit: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - scheduler: { - /** - * The maximum weight that may be scheduled per block for any dispatchables. - **/ - maximumWeight: SpWeightsWeightV2Weight & AugmentedConst; - /** - * The maximum number of scheduled calls in the queue for a single block. - * - * NOTE: - * + Dependent pallets' benchmarks might require a higher limit for the setting. Set a - * higher limit under `runtime-benchmarks` feature. - **/ - maxScheduledPerBlock: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - system: { - /** - * Maximum number of block number to block hash mappings to keep (oldest pruned first). - **/ - blockHashCount: u32 & AugmentedConst; - /** - * The maximum length of a block (in bytes). - **/ - blockLength: FrameSystemLimitsBlockLength & AugmentedConst; - /** - * Block & extrinsics weights: base values and limits. - **/ - blockWeights: FrameSystemLimitsBlockWeights & AugmentedConst; - /** - * The weight of runtime database operations the runtime can invoke. - **/ - dbWeight: SpWeightsRuntimeDbWeight & AugmentedConst; - /** - * The designated SS58 prefix of this chain. - * - * This replaces the "ss58Format" property declared in the chain spec. Reason is - * that the runtime should know about the prefix in order to make use of it as - * an identifier of the chain. - **/ - ss58Prefix: u16 & AugmentedConst; - /** - * Get the chain's current version. - **/ - version: SpVersionRuntimeVersion & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - timestamp: { - /** - * The minimum period between blocks. Beware that this is different to the *expected* - * period that the block production apparatus provides. Your chosen consensus system will - * generally work with this to determine a sensible block time. e.g. For Aura, it will be - * double this period on default settings. - **/ - minimumPeriod: u64 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - transactionPayment: { - /** - * A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their - * `priority` - * - * This value is multipled by the `final_fee` to obtain a "virtual tip" that is later - * added to a tip component in regular `priority` calculations. - * It means that a `Normal` transaction can front-run a similarly-sized `Operational` - * extrinsic (with no tip), by including a tip value greater than the virtual tip. - * - * ```rust,ignore - * // For `Normal` - * let priority = priority_calc(tip); - * - * // For `Operational` - * let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier; - * let priority = priority_calc(tip + virtual_tip); - * ``` - * - * Note that since we use `final_fee` the multiplier applies also to the regular `tip` - * sent with the transaction. So, not only does the transaction get a priority bump based - * on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational` - * transactions. - **/ - operationalFeeMultiplier: u8 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - } // AugmentedConsts -} // declare module diff --git a/src/interfaces/augment-api-events.ts b/src/interfaces/augment-api-events.ts deleted file mode 100644 index 4a93988..0000000 --- a/src/interfaces/augment-api-events.ts +++ /dev/null @@ -1,398 +0,0 @@ -// Auto-generated via `yarn polkadot-types-from-chain`, do not edit -/* eslint-disable */ - -// import type lookup before we augment - in some environments -// this is required to allow for ambient/previous definitions -import '@polkadot/api-base/types/events'; - -import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types'; -import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, i32, u128, u16, u32, u64 } from '@polkadot/types-codec'; -import type { ITuple } from '@polkadot/types-codec/types'; -import type { AccountId32, H256 } from '@polkadot/types/interfaces/runtime'; - -export type __AugmentedEvent = AugmentedEvent; - -declare module '@polkadot/api-base/types/events' { - interface AugmentedEvents { - asset: { - AssetCreated: AugmentedEvent; - AssetMetadataUpdated: AugmentedEvent; - BatchBurn: AugmentedEvent, amounts: Vec], { who: AccountId32, from: AccountId32, classId: u64, assetIds: Vec, amounts: Vec }>; - BatchMint: AugmentedEvent, amounts: Vec], { who: AccountId32, to: AccountId32, classId: u64, assetIds: Vec, amounts: Vec }>; - BatchTransferred: AugmentedEvent, amounts: Vec], { who: AccountId32, from: AccountId32, to: AccountId32, classId: u64, assetIds: Vec, amounts: Vec }>; - Burn: AugmentedEvent; - ClassCreated: AugmentedEvent; - Mint: AugmentedEvent; - OperatorApprovalForAll: AugmentedEvent; - Transferred: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - bag: { - Created: AugmentedEvent], { bag: AccountId32, who: AccountId32, classId: u64, assetId: u64, owners: Vec }>; - Deposit: AugmentedEvent; - Register: AugmentedEvent; - Sweep: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - balances: { - /** - * A balance was set by root. - **/ - BalanceSet: AugmentedEvent; - /** - * Some amount was burned from an account. - **/ - Burned: AugmentedEvent; - /** - * Some amount was deposited (e.g. for transaction fees). - **/ - Deposit: AugmentedEvent; - /** - * An account was removed whose balance was non-zero but below ExistentialDeposit, - * resulting in an outright loss. - **/ - DustLost: AugmentedEvent; - /** - * An account was created with some free balance. - **/ - Endowed: AugmentedEvent; - /** - * Some balance was frozen. - **/ - Frozen: AugmentedEvent; - /** - * Total issuance was increased by `amount`, creating a credit to be balanced. - **/ - Issued: AugmentedEvent; - /** - * Some balance was locked. - **/ - Locked: AugmentedEvent; - /** - * Some amount was minted into an account. - **/ - Minted: AugmentedEvent; - /** - * Total issuance was decreased by `amount`, creating a debt to be balanced. - **/ - Rescinded: AugmentedEvent; - /** - * Some balance was reserved (moved from free to reserved). - **/ - Reserved: AugmentedEvent; - /** - * Some balance was moved from the reserve of the first account to the second account. - * Final argument indicates the destination balance type. - **/ - ReserveRepatriated: AugmentedEvent; - /** - * Some amount was restored into an account. - **/ - Restored: AugmentedEvent; - /** - * Some amount was removed from the account (e.g. for misbehavior). - **/ - Slashed: AugmentedEvent; - /** - * Some amount was suspended from an account (it can be restored later). - **/ - Suspended: AugmentedEvent; - /** - * Some balance was thawed. - **/ - Thawed: AugmentedEvent; - /** - * Transfer succeeded. - **/ - Transfer: AugmentedEvent; - /** - * Some balance was unlocked. - **/ - Unlocked: AugmentedEvent; - /** - * Some balance was unreserved (moved from reserved to free). - **/ - Unreserved: AugmentedEvent; - /** - * An account was upgraded. - **/ - Upgraded: AugmentedEvent; - /** - * Some amount was withdrawn from the account (e.g. for transaction fees). - **/ - Withdraw: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - bundle: { - Burn: AugmentedEvent; - Mint: AugmentedEvent; - Register: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - council: { - /** - * A motion was approved by the required threshold. - **/ - Approved: AugmentedEvent; - /** - * A proposal was closed because its threshold was reached or after its duration was up. - **/ - Closed: AugmentedEvent; - /** - * A motion was not approved by the required threshold. - **/ - Disapproved: AugmentedEvent; - /** - * A motion was executed; result will be `Ok` if it returned without error. - **/ - Executed: AugmentedEvent], { proposalHash: H256, result: Result }>; - /** - * A single member did some action; result will be `Ok` if it returned without error. - **/ - MemberExecuted: AugmentedEvent], { proposalHash: H256, result: Result }>; - /** - * A motion (given hash) has been proposed (by given account) with a threshold (given - * `MemberCount`). - **/ - Proposed: AugmentedEvent; - /** - * A motion (given hash) has been voted on by given account, leaving - * a tally (yes votes and no votes given respectively as `MemberCount`). - **/ - Voted: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - dao: { - /** - * Event documentation should end with an array that provides descriptive names for event - * parameters. [something, who] - **/ - SomethingStored: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - exgine: { - /** - * Event documentation should end with an array that provides descriptive names for event - * parameters. [something, who] - **/ - SomethingStored: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - fula: { - BatchManifestOutput: AugmentedEvent, manifests: Vec], { uploader: AccountId32, poolIds: Vec, manifests: Vec }>; - BatchManifestRemoved: AugmentedEvent, cids: Vec], { uploader: AccountId32, poolIds: Vec, cids: Vec }>; - BatchRemoveStorerOutput: AugmentedEvent], { storer: AccountId32, poolId: u32, cids: Vec }>; - BatchStorageManifestOutput: AugmentedEvent], { storer: AccountId32, poolId: u32, cids: Vec }>; - Challenge: AugmentedEvent; - GetAvailableManifests: AugmentedEvent], { manifests: Vec }>; - GetManifests: AugmentedEvent], { manifests: Vec }>; - GetManifestsStorerData: AugmentedEvent], { manifests: Vec }>; - ManifestOutput: AugmentedEvent, poolId: u32, manifest: Bytes], { uploader: AccountId32, storer: Vec, poolId: u32, manifest: Bytes }>; - ManifestRemoved: AugmentedEvent; - ManifestStorageUpdated: AugmentedEvent; - MintedLaborTokens: AugmentedEvent; - RemoveStorerOutput: AugmentedEvent, poolId: u32, cid: Bytes], { storer: Option, poolId: u32, cid: Bytes }>; - StorageManifestOutput: AugmentedEvent; - UpdateFileSizeOutput: AugmentedEvent; - UpdateFileSizesOutput: AugmentedEvent, sizes: Vec], { account: AccountId32, poolId: u32, cids: Vec, sizes: Vec }>; - VerifiedChallenges: AugmentedEvent, failed: Vec], { challenged: AccountId32, successful: Vec, failed: Vec }>; - VerifiedStorerManifests: AugmentedEvent, invalidCids: Vec], { storer: AccountId32, validCids: Vec, invalidCids: Vec }>; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - grandpa: { - /** - * New authority set has been applied. - **/ - NewAuthorities: AugmentedEvent>], { authoritySet: Vec> }>; - /** - * Current authority set has been paused. - **/ - Paused: AugmentedEvent; - /** - * Current authority set has been resumed. - **/ - Resumed: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - market: { - Created: AugmentedEvent; - Deposit: AugmentedEvent, success: bool], { who: AccountId32, marketId: u64, marketRateId: u64, amount: u128, balances: Vec, success: bool }>; - Exchanged: AugmentedEvent, success: bool], { buyer: AccountId32, marketId: u64, marketRateId: u64, amount: u128, balances: Vec, success: bool }>; - LiquidityAdded: AugmentedEvent, assetIds: Vec>, amounts: Vec>], { who: AccountId32, marketId: u64, marketRateId: u64, classIds: Vec, assetIds: Vec>, amounts: Vec> }>; - LiquidityRemoved: AugmentedEvent, assetIds: Vec>, amounts: Vec>], { who: AccountId32, marketId: u64, marketRateId: u64, classIds: Vec, assetIds: Vec>, amounts: Vec> }>; - RateCreated: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - pool: { - /** - * Pool's capacity has been reached, - **/ - CapacityReached: AugmentedEvent; - /** - * A user requested to join a pool. - **/ - JoinRequested: AugmentedEvent; - /** - * Pool participant left. - **/ - ParticipantLeft: AugmentedEvent; - /** - * A pool has been created. - **/ - PoolCreated: AugmentedEvent, poolId: u32], { owner: Option, poolId: u32 }>; - /** - * A user has withdrawn their request to join a pool. - **/ - RequestWithdrawn: AugmentedEvent; - VotingResult: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - scheduler: { - /** - * The call for the provided hash was not found so the task has been aborted. - **/ - CallUnavailable: AugmentedEvent, id: Option], { task: ITuple<[u32, u32]>, id: Option }>; - /** - * Canceled some task. - **/ - Canceled: AugmentedEvent; - /** - * Dispatched some task. - **/ - Dispatched: AugmentedEvent, id: Option, result: Result], { task: ITuple<[u32, u32]>, id: Option, result: Result }>; - /** - * The given task was unable to be renewed since the agenda is full at that block. - **/ - PeriodicFailed: AugmentedEvent, id: Option], { task: ITuple<[u32, u32]>, id: Option }>; - /** - * The given task can never be executed since it is overweight. - **/ - PermanentlyOverweight: AugmentedEvent, id: Option], { task: ITuple<[u32, u32]>, id: Option }>; - /** - * Scheduled some task. - **/ - Scheduled: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - session: { - /** - * New session has happened. Note that the argument is the session index, not the - * block number as the type might suggest. - **/ - NewSession: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - sudo: { - /** - * The \[sudoer\] just switched identity; the old key is supplied if one existed. - **/ - KeyChanged: AugmentedEvent], { oldSudoer: Option }>; - /** - * A sudo just took place. \[result\] - **/ - Sudid: AugmentedEvent], { sudoResult: Result }>; - /** - * A sudo just took place. \[result\] - **/ - SudoAsDone: AugmentedEvent], { sudoResult: Result }>; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - system: { - /** - * `:code` was updated. - **/ - CodeUpdated: AugmentedEvent; - /** - * An extrinsic failed. - **/ - ExtrinsicFailed: AugmentedEvent; - /** - * An extrinsic completed successfully. - **/ - ExtrinsicSuccess: AugmentedEvent; - /** - * An account was reaped. - **/ - KilledAccount: AugmentedEvent; - /** - * A new account was created. - **/ - NewAccount: AugmentedEvent; - /** - * On on-chain remark happened. - **/ - Remarked: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - transactionPayment: { - /** - * A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee, - * has been paid by `who`. - **/ - TransactionFeePaid: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - validatorSet: { - /** - * New validator addition initiated. Effective in ~2 sessions. - **/ - ValidatorAdditionInitiated: AugmentedEvent; - /** - * Validator removal initiated. Effective in ~2 sessions. - **/ - ValidatorRemovalInitiated: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - } // AugmentedEvents -} // declare module diff --git a/src/interfaces/augment-api-query.ts b/src/interfaces/augment-api-query.ts deleted file mode 100644 index 6c0c728..0000000 --- a/src/interfaces/augment-api-query.ts +++ /dev/null @@ -1,421 +0,0 @@ -// Auto-generated via `yarn polkadot-types-from-chain`, do not edit -/* eslint-disable */ - -// import type lookup before we augment - in some environments -// this is required to allow for ambient/previous definitions -import '@polkadot/api-base/types/storage'; - -import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types'; -import type { Bytes, Option, U8aFixed, Vec, bool, u128, u32, u64 } from '@polkadot/types-codec'; -import type { AnyNumber, ITuple } from '@polkadot/types-codec/types'; -import type { AccountId32, Call, H256 } from '@polkadot/types/interfaces/runtime'; -import type { Observable } from '@polkadot/types/types'; - -export type __AugmentedQuery = AugmentedQuery unknown>; -export type __QueryableStorageEntry = QueryableStorageEntry; - -declare module '@polkadot/api-base/types/storage' { - interface AugmentedQueries { - asset: { - assetCount: AugmentedQuery Observable, [u64]> & QueryableStorageEntry; - assets: AugmentedQuery Observable>, [u64, u64]> & QueryableStorageEntry; - balances: AugmentedQuery Observable, [AccountId32, u64, u64]> & QueryableStorageEntry; - classes: AugmentedQuery Observable>, [u64]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - bag: { - bagClasses: AugmentedQuery Observable>, [u64]> & QueryableStorageEntry; - bags: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - nextBagId: AugmentedQuery Observable, [u64]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - balances: { - /** - * The Balances pallet example of storing the balance of an account. - * - * # Example - * - * ```nocompile - * impl pallet_balances::Config for Runtime { - * type AccountStore = StorageMapShim, frame_system::Provider, AccountId, Self::AccountData> - * } - * ``` - * - * You can also store the balance of an account in the `System` pallet. - * - * # Example - * - * ```nocompile - * impl pallet_balances::Config for Runtime { - * type AccountStore = System - * } - * ``` - * - * But this comes with tradeoffs, storing account balances in the system pallet stores - * `frame_system` data alongside the account data contrary to storing account balances in the - * `Balances` pallet, which uses a `StorageMap` to store balances data only. - * NOTE: This is only used in the case that this pallet is used to store balances. - **/ - account: AugmentedQuery Observable, [AccountId32]> & QueryableStorageEntry; - /** - * Freeze locks on account balances. - **/ - freezes: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * Holds on account balances. - **/ - holds: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * The total units of outstanding deactivated balance in the system. - **/ - inactiveIssuance: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Any liquidity locks on some account balances. - * NOTE: Should only be accessed when setting, changing and freeing a lock. - **/ - locks: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * Named reserves on some account balances. - **/ - reserves: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * The total units issued in the system. - **/ - totalIssuance: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - bundle: { - assetBundles: AugmentedQuery Observable>, [u64, u64]> & QueryableStorageEntry; - bundles: AugmentedQuery Observable>, [H256]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - council: { - /** - * The current members of the collective. This is stored sorted (just by value). - **/ - members: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * The prime member that helps determine the default vote behavior in case of absentations. - **/ - prime: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Proposals so far. - **/ - proposalCount: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Actual proposal for a given hash, if it's current. - **/ - proposalOf: AugmentedQuery Observable>, [H256]> & QueryableStorageEntry; - /** - * The hashes of the active proposals. - **/ - proposals: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Votes on a given proposal, if it is ongoing. - **/ - voting: AugmentedQuery Observable>, [H256]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - dao: { - something: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - exgine: { - something: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - fula: { - challengeRequests: AugmentedQuery Observable>, [AccountId32, Bytes]> & QueryableStorageEntry; - claims: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - manifests: AugmentedQuery Observable>, [u32, Bytes]> & QueryableStorageEntry; - manifestsStorerData: AugmentedQuery Observable>, [u32, AccountId32, Bytes]> & QueryableStorageEntry; - networkSize: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - grandpa: { - /** - * The number of changes (both in terms of keys and underlying economic responsibilities) - * in the "set" of Grandpa validators from genesis. - **/ - currentSetId: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * next block number where we can force a change. - **/ - nextForced: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Pending change: (signaled at, scheduled change). - **/ - pendingChange: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * A mapping from grandpa set ID to the index of the *most recent* session for which its - * members were responsible. - * - * This is only used for validating equivocation proofs. An equivocation proof must - * contains a key-ownership proof for a given session, therefore we need a way to tie - * together sessions and GRANDPA set ids, i.e. we need to validate that a validator - * was the owner of a given key on a given session, and what the active set ID was - * during that session. - * - * TWOX-NOTE: `SetId` is not under user control. - **/ - setIdSession: AugmentedQuery Observable>, [u64]> & QueryableStorageEntry; - /** - * `true` if we are currently stalled. - **/ - stalled: AugmentedQuery Observable>>, []> & QueryableStorageEntry; - /** - * State of the current authority set. - **/ - state: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - market: { - marketRates: AugmentedQuery Observable>>, [u64, u64]> & QueryableStorageEntry; - marketRatesMetadata: AugmentedQuery Observable>, [u64, u64]> & QueryableStorageEntry; - markets: AugmentedQuery Observable>, [u64]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - pool: { - /** - * An incremental value reflecting all pools created so far. - **/ - lastPoolId: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Maximum number of pools that can exist. If `None`, then an unbounded number of - * pools can exist. - **/ - maxPools: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * PoolRequests storage - **/ - poolRequests: AugmentedQuery Observable>, [u32, AccountId32]> & QueryableStorageEntry; - /** - * Pools storage - **/ - pools: AugmentedQuery Observable>, [u32]> & QueryableStorageEntry; - /** - * Users storage, useful in case a user wants to leave or join a pool. - **/ - users: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - scheduler: { - /** - * Items to be executed, indexed by the block number that they should be executed on. - **/ - agenda: AugmentedQuery Observable>>, [u32]> & QueryableStorageEntry; - incompleteSince: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Lookup from a name to the block number and index of the task. - * - * For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4 - * identities. - **/ - lookup: AugmentedQuery Observable>>, [U8aFixed]> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - session: { - /** - * Current index of the session. - **/ - currentIndex: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Indices of disabled validators. - * - * The vec is always kept sorted so that we can find whether a given validator is - * disabled using binary search. It gets cleared when `on_session_ending` returns - * a new set of identities. - **/ - disabledValidators: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * The owner of a key. The key is the `KeyTypeId` + the encoded key. - **/ - keyOwner: AugmentedQuery | [SpCoreCryptoKeyTypeId | string | Uint8Array, Bytes | string | Uint8Array]) => Observable>, [ITuple<[SpCoreCryptoKeyTypeId, Bytes]>]> & QueryableStorageEntry]>; - /** - * The next session keys for a validator. - **/ - nextKeys: AugmentedQuery Observable>, [AccountId32]> & QueryableStorageEntry; - /** - * True if the underlying economic identities or weighting behind the validators - * has changed in the queued validator set. - **/ - queuedChanged: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * The queued keys for the next session. When the next session begins, these keys - * will be used to determine the validator's session keys. - **/ - queuedKeys: AugmentedQuery Observable>>, []> & QueryableStorageEntry; - /** - * The current set of validators. - **/ - validators: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - sudo: { - /** - * The `AccountId` of the sudo key. - **/ - key: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - system: { - /** - * The full account information for a particular account ID. - **/ - account: AugmentedQuery Observable, [AccountId32]> & QueryableStorageEntry; - /** - * Total length (in bytes) for all extrinsics put together, for the current block. - **/ - allExtrinsicsLen: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Map of block numbers to block hashes. - **/ - blockHash: AugmentedQuery Observable, [u32]> & QueryableStorageEntry; - /** - * The current weight for the block. - **/ - blockWeight: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Digest of the current block, also part of the block header. - **/ - digest: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * The number of events in the `Events` list. - **/ - eventCount: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Events deposited for the current block. - * - * NOTE: The item is unbound and should therefore never be read on chain. - * It could otherwise inflate the PoV size of a block. - * - * Events have a large in-memory size. Box the events to not go out-of-memory - * just in case someone still reads them from within the runtime. - **/ - events: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Mapping between a topic (represented by T::Hash) and a vector of indexes - * of events in the `>` list. - * - * All topic vectors have deterministic storage locations depending on the topic. This - * allows light-clients to leverage the changes trie storage tracking mechanism and - * in case of changes fetch the list of events of interest. - * - * The value has the type `(T::BlockNumber, EventIndex)` because if we used only just - * the `EventIndex` then in case if the topic has the same contents on the next block - * no notification will be triggered thus the event might be lost. - **/ - eventTopics: AugmentedQuery Observable>>, [H256]> & QueryableStorageEntry; - /** - * The execution phase of the block. - **/ - executionPhase: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Total extrinsics count for the current block. - **/ - extrinsicCount: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Extrinsics data for the current block (maps an extrinsic's index to its data). - **/ - extrinsicData: AugmentedQuery Observable, [u32]> & QueryableStorageEntry; - /** - * Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened. - **/ - lastRuntimeUpgrade: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * The current block number being processed. Set by `execute_block`. - **/ - number: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Hash of the previous block. - **/ - parentHash: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * True if we have upgraded so that AccountInfo contains three types of `RefCount`. False - * (default) if not. - **/ - upgradedToTripleRefCount: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * True if we have upgraded so that `type RefCount` is `u32`. False (default) if not. - **/ - upgradedToU32RefCount: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - timestamp: { - /** - * Did the timestamp get updated in this block? - **/ - didUpdate: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Current time for the current block. - **/ - now: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - transactionPayment: { - nextFeeMultiplier: AugmentedQuery Observable, []> & QueryableStorageEntry; - storageVersion: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - validatorSet: { - approvedValidators: AugmentedQuery Observable>, []> & QueryableStorageEntry; - offlineValidators: AugmentedQuery Observable>, []> & QueryableStorageEntry; - validators: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - } // AugmentedQueries -} // declare module diff --git a/src/interfaces/augment-api-tx.ts b/src/interfaces/augment-api-tx.ts deleted file mode 100644 index 241a9fb..0000000 --- a/src/interfaces/augment-api-tx.ts +++ /dev/null @@ -1,601 +0,0 @@ -// Auto-generated via `yarn polkadot-types-from-chain`, do not edit -/* eslint-disable */ - -// import type lookup before we augment - in some environments -// this is required to allow for ambient/previous definitions -import '@polkadot/api-base/types/submittable'; - -import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types'; -import type { Bytes, Compact, Option, U8aFixed, Vec, bool, i32, u128, u16, u32, u64, u8 } from '@polkadot/types-codec'; -import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types'; -import type { AccountId32, Call, H256, MultiAddress } from '@polkadot/types/interfaces/runtime'; - -export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>; -export type __SubmittableExtrinsic = SubmittableExtrinsic; -export type __SubmittableExtrinsicFunction = SubmittableExtrinsicFunction; - -declare module '@polkadot/api-base/types/submittable' { - interface AugmentedSubmittables { - asset: { - batchBurn: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetIds: Vec | (u64 | AnyNumber | Uint8Array)[], amounts: Vec | (u128 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, u64, Vec, Vec]>; - batchMint: AugmentedSubmittable<(to: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetIds: Vec | (u64 | AnyNumber | Uint8Array)[], amounts: Vec | (u128 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, u64, Vec, Vec]>; - batchTransferFrom: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, to: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetIds: Vec | (u64 | AnyNumber | Uint8Array)[], amounts: Vec | (u128 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [AccountId32, AccountId32, u64, Vec, Vec]>; - burn: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64, u64, u128]>; - createAsset: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, u64, Bytes]>; - createClass: AugmentedSubmittable<(owner: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64, Bytes]>; - mint: AugmentedSubmittable<(to: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, u64, u64, u128]>; - transferFrom: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, to: AccountId32 | string | Uint8Array, classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32, u64, u64, u128]>; - updateAssetMetadata: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, u64, Bytes]>; - updateClassMetadata: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, Bytes]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - bag: { - create: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, owners: Vec | (AccountId32 | string | Uint8Array)[], shares: Vec | (u128 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [u64, Vec, Vec]>; - deposit: AugmentedSubmittable<(bag: AccountId32 | string | Uint8Array, classIds: Vec | (u64 | AnyNumber | Uint8Array)[], assetIds: Vec>, amounts: Vec>) => SubmittableExtrinsic, [AccountId32, Vec, Vec>, Vec>]>; - register: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, Bytes]>; - sweep: AugmentedSubmittable<(to: AccountId32 | string | Uint8Array, bag: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - balances: { - /** - * Set the regular balance of a given account. - * - * The dispatch origin for this call is `root`. - **/ - forceSetBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact]>; - /** - * Exactly as `transfer_allow_death`, except the origin must be root and the source account - * may be specified. - **/ - forceTransfer: AugmentedSubmittable<(source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, MultiAddress, Compact]>; - /** - * Unreserve some balance from a user by force. - * - * Can only be called by ROOT. - **/ - forceUnreserve: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, u128]>; - /** - * Set the regular balance of a given account; it also takes a reserved balance but this - * must be the same as the account's current reserved balance. - * - * The dispatch origin for this call is `root`. - * - * WARNING: This call is DEPRECATED! Use `force_set_balance` instead. - **/ - setBalanceDeprecated: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact | AnyNumber | Uint8Array, oldReserved: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact, Compact]>; - /** - * Alias for `transfer_allow_death`, provided only for name-wise compatibility. - * - * WARNING: DEPRECATED! Will be released in approximately 3 months. - **/ - transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact]>; - /** - * Transfer the entire transferable balance from the caller account. - * - * NOTE: This function only attempts to transfer _transferable_ balances. This means that - * any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be - * transferred by this function. To ensure that this function results in a killed account, - * you might need to prepare the account by removing any reference counters, storage - * deposits, etc... - * - * The dispatch origin of this call must be Signed. - * - * - `dest`: The recipient of the transfer. - * - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all - * of the funds the account has, causing the sender account to be killed (false), or - * transfer everything except at least the existential deposit, which will guarantee to - * keep the sender account alive (true). - **/ - transferAll: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic, [MultiAddress, bool]>; - /** - * Transfer some liquid free balance to another account. - * - * `transfer_allow_death` will set the `FreeBalance` of the sender and receiver. - * If the sender's account is below the existential deposit as a result - * of the transfer, the account will be reaped. - * - * The dispatch origin for this call must be `Signed` by the transactor. - **/ - transferAllowDeath: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact]>; - /** - * Same as the [`transfer_allow_death`] call, but with a check that the transfer will not - * kill the origin account. - * - * 99% of the time you want [`transfer_allow_death`] instead. - * - * [`transfer_allow_death`]: struct.Pallet.html#method.transfer - **/ - transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Compact]>; - /** - * Upgrade a specified account. - * - * - `origin`: Must be `Signed`. - * - `who`: The account to be upgraded. - * - * This will waive the transaction fee if at least all but 10% of the accounts needed to - * be upgraded. (We let some not have to be upgraded just in order to allow for the - * possibililty of churn). - **/ - upgradeAccounts: AugmentedSubmittable<(who: Vec | (AccountId32 | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - bundle: { - burnBundle: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, to: AccountId32 | string | Uint8Array, bundleId: H256 | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32, H256, u128]>; - mintBundle: AugmentedSubmittable<(from: AccountId32 | string | Uint8Array, to: AccountId32 | string | Uint8Array, bundleId: H256 | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [AccountId32, AccountId32, H256, u128]>; - registerBundle: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, bundleId: H256 | string | Uint8Array, schema: ITuple<[Vec, Vec>, Vec>]> | [Vec | (u64 | AnyNumber | Uint8Array)[], Vec>, Vec>], metadata: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u64, u64, H256, ITuple<[Vec, Vec>, Vec>]>, Bytes]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - council: { - /** - * Close a vote that is either approved, disapproved or whose voting period has ended. - * - * May be called by any signed account in order to finish voting and close the proposal. - * - * If called before the end of the voting period it will only close the vote if it is - * has enough votes to be approved or disapproved. - * - * If called after the end of the voting period abstentions are counted as rejections - * unless there is a prime member set and the prime member cast an approval. - * - * If the close operation completes successfully with disapproval, the transaction fee will - * be waived. Otherwise execution of the approved operation will be charged to the caller. - * - * + `proposal_weight_bound`: The maximum amount of weight consumed by executing the closed - * proposal. - * + `length_bound`: The upper bound for the length of the proposal in storage. Checked via - * `storage::read` so it is `size_of::() == 4` larger than the pure length. - * - * ## Complexity - * - `O(B + M + P1 + P2)` where: - * - `B` is `proposal` size in bytes (length-fee-bounded) - * - `M` is members-count (code- and governance-bounded) - * - `P1` is the complexity of `proposal` preimage. - * - `P2` is proposal-count (code-bounded) - **/ - close: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, proposalWeightBound: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array, lengthBound: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [H256, Compact, SpWeightsWeightV2Weight, Compact]>; - /** - * Disapprove a proposal, close, and remove it from the system, regardless of its current - * state. - * - * Must be called by the Root origin. - * - * Parameters: - * * `proposal_hash`: The hash of the proposal that should be disapproved. - * - * ## Complexity - * O(P) where P is the number of max proposals - **/ - disapproveProposal: AugmentedSubmittable<(proposalHash: H256 | string | Uint8Array) => SubmittableExtrinsic, [H256]>; - /** - * Dispatch a proposal from a member using the `Member` origin. - * - * Origin must be a member of the collective. - * - * ## Complexity: - * - `O(B + M + P)` where: - * - `B` is `proposal` size in bytes (length-fee-bounded) - * - `M` members-count (code-bounded) - * - `P` complexity of dispatching `proposal` - **/ - execute: AugmentedSubmittable<(proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Call, Compact]>; - /** - * Add a new proposal to either be voted on or executed directly. - * - * Requires the sender to be member. - * - * `threshold` determines whether `proposal` is executed directly (`threshold < 2`) - * or put up for voting. - * - * ## Complexity - * - `O(B + M + P1)` or `O(B + M + P2)` where: - * - `B` is `proposal` size in bytes (length-fee-bounded) - * - `M` is members-count (code- and governance-bounded) - * - branching is influenced by `threshold` where: - * - `P1` is proposal execution complexity (`threshold < 2`) - * - `P2` is proposals-count (code-bounded) (`threshold >= 2`) - **/ - propose: AugmentedSubmittable<(threshold: Compact | AnyNumber | Uint8Array, proposal: Call | IMethod | string | Uint8Array, lengthBound: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact, Call, Compact]>; - /** - * Set the collective's membership. - * - * - `new_members`: The new member list. Be nice to the chain and provide it sorted. - * - `prime`: The prime member whose vote sets the default. - * - `old_count`: The upper bound for the previous number of members in storage. Used for - * weight estimation. - * - * The dispatch of this call must be `SetMembersOrigin`. - * - * NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but - * the weight estimations rely on it to estimate dispatchable weight. - * - * # WARNING: - * - * The `pallet-collective` can also be managed by logic outside of the pallet through the - * implementation of the trait [`ChangeMembers`]. - * Any call to `set_members` must be careful that the member set doesn't get out of sync - * with other logic managing the member set. - * - * ## Complexity: - * - `O(MP + N)` where: - * - `M` old-members-count (code- and governance-bounded) - * - `N` new-members-count (code- and governance-bounded) - * - `P` proposals-count (code-bounded) - **/ - setMembers: AugmentedSubmittable<(newMembers: Vec | (AccountId32 | string | Uint8Array)[], prime: Option | null | Uint8Array | AccountId32 | string, oldCount: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, Option, u32]>; - /** - * Add an aye or nay vote for the sender to the given proposal. - * - * Requires the sender to be a member. - * - * Transaction fees will be waived if the member is voting on any particular proposal - * for the first time and the call is successful. Subsequent vote changes will charge a - * fee. - * ## Complexity - * - `O(M)` where `M` is members-count (code- and governance-bounded) - **/ - vote: AugmentedSubmittable<(proposal: H256 | string | Uint8Array, index: Compact | AnyNumber | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic, [H256, Compact, bool]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - dao: { - /** - * An example dispatchable that may throw a custom error. - **/ - causeError: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - /** - * An example dispatchable that takes a singles value as a parameter, writes the value to - * storage and emits an event. This function must be dispatched by a signed extrinsic. - **/ - doSomething: AugmentedSubmittable<(something: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - exgine: { - /** - * An example dispatchable that may throw a custom error. - **/ - causeError: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - /** - * An example dispatchable that takes a singles value as a parameter, writes the value to - * storage and emits an event. This function must be dispatched by a signed extrinsic. - **/ - doSomething: AugmentedSubmittable<(something: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - fula: { - batchRemoveManifest: AugmentedSubmittable<(cids: Vec | (Bytes | string | Uint8Array)[], poolIds: Vec | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [Vec, Vec]>; - batchRemoveStoredManifest: AugmentedSubmittable<(cids: Vec | (Bytes | string | Uint8Array)[], poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u32]>; - batchStorageManifest: AugmentedSubmittable<(cids: Vec | (Bytes | string | Uint8Array)[], poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Vec, u32]>; - batchUploadManifest: AugmentedSubmittable<(manifest: Vec | (Bytes | string | Uint8Array)[], cids: Vec | (Bytes | string | Uint8Array)[], poolId: Vec | (u32 | AnyNumber | Uint8Array)[], replicationFactor: Vec | (u16 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [Vec, Vec, Vec, Vec]>; - generateChallenge: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - getAvailableManifests: AugmentedSubmittable<(poolId: Option | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic, [Option]>; - getManifests: AugmentedSubmittable<(poolId: Option | null | Uint8Array | u32 | AnyNumber, uploader: Option | null | Uint8Array | AccountId32 | string, storer: Option | null | Uint8Array | AccountId32 | string) => SubmittableExtrinsic, [Option, Option, Option]>; - getManifestsStorerData: AugmentedSubmittable<(poolId: Option | null | Uint8Array | u32 | AnyNumber, storer: Option | null | Uint8Array | AccountId32 | string) => SubmittableExtrinsic, [Option, Option]>; - mintLaborTokens: AugmentedSubmittable<(classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, u64, u128]>; - removeManifest: AugmentedSubmittable<(cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32]>; - removeStoredManifest: AugmentedSubmittable<(cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32]>; - storageManifest: AugmentedSubmittable<(cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32]>; - updateFileSize: AugmentedSubmittable<(cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array, size: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32, u64]>; - updateFileSizes: AugmentedSubmittable<(cids: Vec | (Bytes | string | Uint8Array)[], poolId: u32 | AnyNumber | Uint8Array, sizes: Vec | (u64 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic, [Vec, u32, Vec]>; - /** - * Updates the values of the manifest storer data given the specific data - **/ - updateManifest: AugmentedSubmittable<(cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array, activeCycles: u16 | AnyNumber | Uint8Array, missedCycles: u16 | AnyNumber | Uint8Array, activeDays: i32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32, u16, u16, i32]>; - uploadManifest: AugmentedSubmittable<(manifest: Bytes | string | Uint8Array, cid: Bytes | string | Uint8Array, poolId: u32 | AnyNumber | Uint8Array, replicationFactor: u16 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, Bytes, u32, u16]>; - verifyChallenge: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, cids: Vec | (Bytes | string | Uint8Array)[], classId: u64 | AnyNumber | Uint8Array, assetId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, Vec, u64, u64]>; - verifyManifests: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - grandpa: { - /** - * Note that the current authority set of the GRANDPA finality gadget has stalled. - * - * This will trigger a forced authority set change at the beginning of the next session, to - * be enacted `delay` blocks after that. The `delay` should be high enough to safely assume - * that the block signalling the forced change will not be re-orged e.g. 1000 blocks. - * The block production rate (which may be slowed down because of finality lagging) should - * be taken into account when choosing the `delay`. The GRANDPA voters based on the new - * authority will start voting on top of `best_finalized_block_number` for new finalized - * blocks. `best_finalized_block_number` should be the highest of the latest finalized - * block of all validators of the new authority set. - * - * Only callable by root. - **/ - noteStalled: AugmentedSubmittable<(delay: u32 | AnyNumber | Uint8Array, bestFinalizedBlockNumber: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, u32]>; - /** - * Report voter equivocation/misbehavior. This method will verify the - * equivocation proof and validate the given key ownership proof - * against the extracted offender. If both are valid, the offence - * will be reported. - **/ - reportEquivocation: AugmentedSubmittable<(equivocationProof: SpConsensusGrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: SpCoreVoid | null) => SubmittableExtrinsic, [SpConsensusGrandpaEquivocationProof, SpCoreVoid]>; - /** - * Report voter equivocation/misbehavior. This method will verify the - * equivocation proof and validate the given key ownership proof - * against the extracted offender. If both are valid, the offence - * will be reported. - * - * This extrinsic must be called unsigned and it is expected that only - * block authors will call it (validated in `ValidateUnsigned`), as such - * if the block author is defined it will be defined as the equivocation - * reporter. - **/ - reportEquivocationUnsigned: AugmentedSubmittable<(equivocationProof: SpConsensusGrandpaEquivocationProof | { setId?: any; equivocation?: any } | string | Uint8Array, keyOwnerProof: SpCoreVoid | null) => SubmittableExtrinsic, [SpConsensusGrandpaEquivocationProof, SpCoreVoid]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - market: { - createMarket: AugmentedSubmittable<(marketId: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; - createMarketRate: AugmentedSubmittable<(marketId: u64 | AnyNumber | Uint8Array, marketRateId: u64 | AnyNumber | Uint8Array, rates: Vec | (SugarfungeMarketAssetRate | { classId?: any; assetId?: any; action?: any; from?: any; to?: any } | string | Uint8Array)[]) => SubmittableExtrinsic, [u64, u64, Vec]>; - deposit: AugmentedSubmittable<(marketId: u64 | AnyNumber | Uint8Array, marketRateId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, u64, u128]>; - exchangeAssets: AugmentedSubmittable<(marketId: u64 | AnyNumber | Uint8Array, marketRateId: u64 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64, u64, u128]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - pool: { - /** - * Cancel a `PoolRequest`, useful if a user decides to join another pool or they are stuck in - * the voting queue for too long. - **/ - cancelJoin: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - /** - * Creates a new pool. `peer_id` is a libp2p peerID validated on the client-side. - * - * TODO: Deposit; check the current pool number. Currently we check the PoolId to retrieve - * the pool number, but if we want to delete empty pools - then we need to retrieve the - * actual pool number from storage, for which a CountedMap should be used. - **/ - create: AugmentedSubmittable<(name: Bytes | string | Uint8Array, region: Bytes | string | Uint8Array, peerId: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes, Bytes, Bytes]>; - /** - * Open a `PoolRequest` to join the pool. - **/ - join: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, peerId: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u32, Bytes]>; - /** - * Allows for the user to leave a pool. - **/ - leavePool: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - /** - * Vote for a `PoolRequest`. If `positive` is set to `false` - that's voting against. - * This method also calculates votes each time it's called and takes action once the result - * is conclusive. - * TODO: Currently does not cover pool overflow scenario and simply fails then. - **/ - vote: AugmentedSubmittable<(poolId: u32 | AnyNumber | Uint8Array, account: AccountId32 | string | Uint8Array, positive: bool | boolean | Uint8Array, peerId: Bytes | string | Uint8Array) => SubmittableExtrinsic, [u32, AccountId32, bool, Bytes]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - scheduler: { - /** - * Cancel an anonymously scheduled task. - **/ - cancel: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32, u32]>; - /** - * Cancel a named scheduled task. - **/ - cancelNamed: AugmentedSubmittable<(id: U8aFixed | string | Uint8Array) => SubmittableExtrinsic, [U8aFixed]>; - /** - * Anonymously schedule a task. - **/ - schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [u32, Option>, u8, Call]>; - /** - * Anonymously schedule a task after a delay. - **/ - scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [u32, Option>, u8, Call]>; - /** - * Schedule a named task. - **/ - scheduleNamed: AugmentedSubmittable<(id: U8aFixed | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [U8aFixed, u32, Option>, u8, Call]>; - /** - * Schedule a named task after a delay. - **/ - scheduleNamedAfter: AugmentedSubmittable<(id: U8aFixed | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option> | null | Uint8Array | ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array], priority: u8 | AnyNumber | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [U8aFixed, u32, Option>, u8, Call]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - session: { - /** - * Removes any session key(s) of the function caller. - * - * This doesn't take effect until the next session. - * - * The dispatch origin of this function must be Signed and the account must be either be - * convertible to a validator ID using the chain's typical addressing system (this usually - * means being a controller account) or directly convertible into a validator ID (which - * usually means being a stash account). - * - * ## Complexity - * - `O(1)` in number of key types. Actual cost depends on the number of length of - * `T::Keys::key_ids()` which is fixed. - **/ - purgeKeys: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - /** - * Sets the session key(s) of the function caller to `keys`. - * Allows an account to set its session key prior to becoming a validator. - * This doesn't take effect until the next session. - * - * The dispatch origin of this function must be signed. - * - * ## Complexity - * - `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is - * fixed. - **/ - setKeys: AugmentedSubmittable<(keys: SugarfungeRuntimeOpaqueSessionKeys | { aura?: any; grandpa?: any } | string | Uint8Array, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic, [SugarfungeRuntimeOpaqueSessionKeys, Bytes]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - sudo: { - /** - * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo - * key. - * - * The dispatch origin for this call must be _Signed_. - * - * ## Complexity - * - O(1). - **/ - setKey: AugmentedSubmittable<(updated: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress]>; - /** - * Authenticates the sudo key and dispatches a function call with `Root` origin. - * - * The dispatch origin for this call must be _Signed_. - * - * ## Complexity - * - O(1). - **/ - sudo: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [Call]>; - /** - * Authenticates the sudo key and dispatches a function call with `Signed` origin from - * a given account. - * - * The dispatch origin for this call must be _Signed_. - * - * ## Complexity - * - O(1). - **/ - sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic, [MultiAddress, Call]>; - /** - * Authenticates the sudo key and dispatches a function call with `Root` origin. - * This function does not check the weight of the call, and instead allows the - * Sudo user to specify the weight of the call. - * - * The dispatch origin for this call must be _Signed_. - * - * ## Complexity - * - O(1). - **/ - sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => SubmittableExtrinsic, [Call, SpWeightsWeightV2Weight]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - system: { - /** - * Kill all storage items with a key that starts with the given prefix. - * - * **NOTE:** We rely on the Root origin to provide us the number of subkeys under - * the prefix we are removing to accurately calculate the weight of this function. - **/ - killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Bytes, u32]>; - /** - * Kill some items from storage. - **/ - killStorage: AugmentedSubmittable<(keys: Vec | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic, [Vec]>; - /** - * Make some on-chain remark. - * - * - `O(1)` - **/ - remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; - /** - * Make some on-chain remark and emit event. - **/ - remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; - /** - * Set the new runtime code. - **/ - setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; - /** - * Set the new runtime code without doing any checks of the given `code`. - **/ - setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic, [Bytes]>; - /** - * Set the number of pages in the WebAssembly environment's heap. - **/ - setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u64]>; - /** - * Set some items of storage. - **/ - setStorage: AugmentedSubmittable<(items: Vec> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic, [Vec>]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - timestamp: { - /** - * Set the current time. - * - * This call should be invoked exactly once per block. It will panic at the finalization - * phase, if this call hasn't been invoked by that time. - * - * The timestamp should be greater than the previous one by the amount specified by - * `MinimumPeriod`. - * - * The dispatch origin for this call must be `Inherent`. - * - * ## Complexity - * - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`) - * - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in - * `on_finalize`) - * - 1 event handler `on_timestamp_set`. Must be `O(1)`. - **/ - set: AugmentedSubmittable<(now: Compact | AnyNumber | Uint8Array) => SubmittableExtrinsic, [Compact]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - validatorSet: { - /** - * Add a new validator. - * - * New validator's session keys should be set in Session pallet before - * calling this. - * - * The origin can be configured using the `AddRemoveOrigin` type in the - * host runtime. Can also be set to sudo/root. - **/ - addValidator: AugmentedSubmittable<(validatorId: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; - /** - * Add an approved validator again when it comes back online. - * - * For this call, the dispatch origin must be the validator itself. - **/ - addValidatorAgain: AugmentedSubmittable<(validatorId: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; - /** - * Remove a validator. - * - * The origin can be configured using the `AddRemoveOrigin` type in the - * host runtime. Can also be set to sudo/root. - **/ - removeValidator: AugmentedSubmittable<(validatorId: AccountId32 | string | Uint8Array) => SubmittableExtrinsic, [AccountId32]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - } // AugmentedSubmittables -} // declare module diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 7f1de78..34587ac 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -1,4 +1,4 @@ // Auto-generated via `yarn polkadot-types-from-defs`, do not edit /* eslint-disable */ -export * from './types.js'; +//export * from './types.ts'; diff --git a/src/protocols/chain-api.ts b/src/protocols/chain-api.ts index 7358ec3..213c443 100644 --- a/src/protocols/chain-api.ts +++ b/src/protocols/chain-api.ts @@ -4,7 +4,6 @@ import { ApiPromise, WsProvider } from '@polkadot/api'; import { Keyring } from '@polkadot/keyring'; const { cryptoWaitReady } = require('@polkadot/util-crypto'); import type * as BType from '../types/blockchain'; -import { TextEncoder } from 'text-encoding'; const types = { FulaPoolPool: EventTypes.FulaPoolPool, @@ -25,9 +24,9 @@ export const disconnectApi = async (api: ApiPromise): Promise => { await api.disconnect(); }; -function addDoubleSlashToSeed(seed: string): string { +/*function addDoubleSlashToSeed(seed: string): string { return seed.startsWith('//') ? seed : '//' + seed; -} +}*/ /* createManifest: This function batch uploads manifests @@ -74,7 +73,6 @@ function createManifest( return batchUploadManifest; } - export const batchUploadManifest = async ( api: ApiPromise | undefined, seed: string, @@ -112,7 +110,7 @@ export const batchUploadManifest = async ( if (submitExtrinsic) { return new Promise<{ hash: string }>((resolve, reject) => { submitExtrinsic - .signAndSend(userKey, ({ status, events }) => { + .signAndSend(userKey, ({ status }) => { if (status.isInBlock || status.isFinalized) { if (unsub) { unsub(); // Call unsub before resolving the promise @@ -215,6 +213,9 @@ export const checkJoinRequest = async ( } }; +function isAccountInfo(obj: any): obj is { data: { free: any } } { + return 'data' in obj && 'free' in obj.data; +} /* checkAccountExsists: This function takes accountId and checks if the account exists */ @@ -231,10 +232,11 @@ export const checkAccountBalance = async ( if (!api?.query?.system?.account) { throw new Error('Failed to initialize api or api.query.account'); } - - let { - data: { free: balance }, - } = await api.query.system.account(accountId); + let balance: any; + let accountInfo = await api.query.system.account(accountId); + if (isAccountInfo(accountInfo)) { + balance = accountInfo.data.free; + } if (balance && balance !== '0' && balance > 0) { return Promise.resolve(balance.toHuman());