difftreelog
refactor use rpcs instead of api.query.common
in: master
33 files changed
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -3,7 +3,7 @@
use codec::Decode;
use jsonrpc_core::{Error as RpcError, ErrorCode, Result};
use jsonrpc_derive::rpc;
-use nft_data_structs::{CollectionId, TokenId};
+use nft_data_structs::{Collection, CollectionId, CollectionStats, TokenId};
use sp_api::{BlockId, BlockT, ProvideRuntimeApi};
use sp_blockchain::HeaderBackend;
use up_rpc::NftApi as NftRuntimeApi;
@@ -86,8 +86,23 @@
collection: CollectionId,
at: Option<BlockHash>,
) -> Result<Vec<CrossAccountId>>;
+ #[rpc(name = "nft_allowed")]
+ fn allowed(
+ &self,
+ collection: CollectionId,
+ user: CrossAccountId,
+ at: Option<BlockHash>,
+ ) -> Result<bool>;
#[rpc(name = "nft_lastTokenId")]
fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
+ #[rpc(name = "nft_collectionById")]
+ fn collection_by_id(
+ &self,
+ collection: CollectionId,
+ at: Option<BlockHash>,
+ ) -> Result<Option<Collection<AccountId>>>;
+ #[rpc(name = "nft_collectionStats")]
+ fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
}
pub struct Nft<C, P> {
@@ -160,5 +175,8 @@
pass_method!(adminlist(collection: CollectionId) -> Vec<CrossAccountId>);
pass_method!(allowlist(collection: CollectionId) -> Vec<CrossAccountId>);
+ pass_method!(allowed(collection: CollectionId, user: CrossAccountId) -> bool);
pass_method!(last_token_id(collection: CollectionId) -> TokenId);
+ pass_method!(collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>);
+ pass_method!(collection_stats() -> CollectionStats);
}
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -19,7 +19,7 @@
pub fn create_collection_raw<T: Config, R>(
owner: T::AccountId,
mode: CollectionMode,
- handler: impl FnOnce(Collection<T>) -> Result<CollectionId, DispatchError>,
+ handler: impl FnOnce(Collection<T::AccountId>) -> Result<CollectionId, DispatchError>,
cast: impl FnOnce(CollectionHandle<T>) -> R,
) -> Result<R, DispatchError> {
T::Currency::deposit_creating(&owner, T::CollectionCreationPrice::get());
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -12,7 +12,7 @@
COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,
MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, Pays, PostDispatchInfo, TokenId, Weight,
- WithdrawReasons,
+ WithdrawReasons, CollectionStats,
};
pub use pallet::*;
use sp_core::H160;
@@ -26,7 +26,7 @@
#[must_use = "Should call submit_logs or save, otherwise some data will be lost for evm side"]
pub struct CollectionHandle<T: Config> {
pub id: CollectionId,
- collection: Collection<T>,
+ collection: Collection<T::AccountId>,
pub recorder: pallet_evm_coder_substrate::SubstrateRecorder<T>,
}
impl<T: Config> CollectionHandle<T> {
@@ -78,7 +78,7 @@
}
}
impl<T: Config> Deref for CollectionHandle<T> {
- type Target = Collection<T>;
+ type Target = Collection<T::AccountId>;
fn deref(&self) -> &Self::Target {
&self.collection
@@ -311,7 +311,7 @@
pub type CollectionById<T> = StorageMap<
Hasher = Blake2_128Concat,
Key = CollectionId,
- Value = Collection<T>,
+ Value = Collection<<T as frame_system::Config>::AccountId>,
QueryKind = OptionQuery,
>;
@@ -344,6 +344,10 @@
Value = bool,
QueryKind = ValueQuery,
>;
+
+ /// Not used by code, exists only to provide some types to metadata
+ #[pallet::storage]
+ pub type DummyStorageValue<T> = StorageValue<Value = (CollectionStats, CollectionId, TokenId), QueryKind = OptionQuery>;
}
impl<T: Config> Pallet<T> {
@@ -355,10 +359,32 @@
);
Ok(())
}
+ pub fn adminlist(collection: CollectionId) -> Vec<T::CrossAccountId> {
+ <IsAdmin<T>>::iter_prefix((collection,))
+ .map(|(a, _)| a)
+ .collect()
+ }
+ pub fn allowlist(collection: CollectionId) -> Vec<T::CrossAccountId> {
+ <Allowlist<T>>::iter_prefix((collection,))
+ .map(|(a, _)| a)
+ .collect()
+ }
+ pub fn allowed(collection: CollectionId, user: T::CrossAccountId) -> bool {
+ <Allowlist<T>>::get((collection, user))
+ }
+ pub fn collection_stats() -> CollectionStats {
+ let created = <CreatedCollectionCount<T>>::get();
+ let destroyed = <DestroyedCollectionCount<T>>::get();
+ CollectionStats {
+ created: created.0,
+ destroyed: destroyed.0,
+ alive: created.0 - destroyed.0,
+ }
+ }
}
impl<T: Config> Pallet<T> {
- pub fn init_collection(data: Collection<T>) -> Result<CollectionId, DispatchError> {
+ pub fn init_collection(data: Collection<T::AccountId>) -> Result<CollectionId, DispatchError> {
{
ensure!(
data.name.len() <= MAX_COLLECTION_NAME_LENGTH,
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -91,8 +91,8 @@
}
impl<T: Config> Pallet<T> {
- pub fn init_collection(data: Collection<T>) -> Result<CollectionId, DispatchError> {
- PalletCommon::init_collection(data)
+ pub fn init_collection(data: Collection<T::AccountId>) -> Result<CollectionId, DispatchError> {
+ <PalletCommon<T>>::init_collection(data)
}
pub fn destroy_collection(
collection: FungibleHandle<T>,
pallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -25,7 +25,7 @@
fn try_sponsor<T: Config>(
caller: &H160,
collection_id: CollectionId,
- collection: &Collection<T>,
+ collection: &Collection<T::AccountId>,
call: &[u8],
) -> Result<(), AnyError> {
let (method_id, mut reader) = AbiReader::new_call(call).map_err(|_| AnyError)?;
@@ -109,7 +109,7 @@
if !collection.sponsorship.confirmed() {
return None;
}
- if try_sponsor(who, collection_id, &collection, &call.1).is_ok() {
+ if try_sponsor::<T>(who, collection_id, &collection, &call.1).is_ok() {
return collection
.sponsorship
.sponsor()
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -42,8 +42,8 @@
CollectionId, CollectionMode, TokenId, SchemaVersion, SponsorshipState, MetaUpdatePermission,
};
use pallet_common::{
- account::CrossAccountId, CollectionHandle, IsAdmin, Pallet as PalletCommon,
- Error as CommonError, CommonWeightInfo, Allowlist,
+ account::CrossAccountId, CollectionHandle, Pallet as PalletCommon, Error as CommonError,
+ CommonWeightInfo,
};
use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
@@ -190,7 +190,7 @@
let who = ensure_signed(origin)?;
// Create new collection
- let new_collection = Collection::<T> {
+ let new_collection = Collection {
owner: who.clone(),
name: collection_name,
mode: mode.clone(),
@@ -208,14 +208,14 @@
};
let _id = match mode {
- CollectionMode::NFT => {PalletNonfungible::init_collection(new_collection)?},
+ CollectionMode::NFT => {<PalletNonfungible<T>>::init_collection(new_collection)?},
CollectionMode::Fungible(decimal_points) => {
// check params
ensure!(decimal_points <= MAX_DECIMAL_POINTS, Error::<T>::CollectionDecimalPointLimitExceeded);
- PalletFungible::init_collection(new_collection)?
+ <PalletFungible<T>>::init_collection(new_collection)?
}
CollectionMode::ReFungible => {
- PalletRefungible::init_collection(new_collection)?
+ <PalletRefungible<T>>::init_collection(new_collection)?
}
};
@@ -936,19 +936,5 @@
target_collection.save()
}
- }
-}
-
-// TODO: limit returned entries?
-impl<T: Config> Pallet<T> {
- pub fn adminlist(collection: CollectionId) -> Vec<T::CrossAccountId> {
- <IsAdmin<T>>::iter_prefix((collection,))
- .map(|(a, _)| a)
- .collect()
- }
- pub fn allowlist(collection: CollectionId) -> Vec<T::CrossAccountId> {
- <Allowlist<T>>::iter_prefix((collection,))
- .map(|(a, _)| a)
- .collect()
}
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -133,8 +133,8 @@
// unchecked calls skips any permission checks
impl<T: Config> Pallet<T> {
- pub fn init_collection(data: Collection<T>) -> Result<CollectionId, DispatchError> {
- PalletCommon::init_collection(data)
+ pub fn init_collection(data: Collection<T::AccountId>) -> Result<CollectionId, DispatchError> {
+ <PalletCommon<T>>::init_collection(data)
}
pub fn destroy_collection(
collection: NonfungibleHandle<T>,
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -156,8 +156,8 @@
// unchecked calls skips any permission checks
impl<T: Config> Pallet<T> {
- pub fn init_collection(data: Collection<T>) -> Result<CollectionId, DispatchError> {
- PalletCommon::init_collection(data)
+ pub fn init_collection(data: Collection<T::AccountId>) -> Result<CollectionId, DispatchError> {
+ <PalletCommon<T>>::init_collection(data)
}
pub fn destroy_collection(
collection: RefungibleHandle<T>,
primitives/nft/src/lib.rsdiffbeforeafterboth--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -207,8 +207,8 @@
#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
-pub struct Collection<T: frame_system::Config> {
- pub owner: T::AccountId,
+pub struct Collection<AccountId> {
+ pub owner: AccountId,
pub mode: CollectionMode,
pub access: AccessMode,
pub name: Vec<u16>, // 64 include null escape char
@@ -217,7 +217,7 @@
pub mint_mode: bool,
pub offchain_schema: Vec<u8>,
pub schema_version: SchemaVersion,
- pub sponsorship: SponsorshipState<T::AccountId>,
+ pub sponsorship: SponsorshipState<AccountId>,
pub limits: CollectionLimits, // Collection private restrictions
pub variable_on_chain_schema: Vec<u8>, //
pub const_on_chain_schema: Vec<u8>, //
@@ -413,3 +413,11 @@
CreateItemData::Fungible(item)
}
}
+
+#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
+#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+pub struct CollectionStats {
+ pub created: u32,
+ pub destroyed: u32,
+ pub alive: u32,
+}
primitives/rpc/src/lib.rsdiffbeforeafterboth--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -1,6 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
-use nft_data_structs::{CollectionId, TokenId};
+use nft_data_structs::{CollectionId, TokenId, Collection, CollectionStats};
use sp_std::vec::Vec;
use sp_core::H160;
use codec::Decode;
@@ -32,6 +32,9 @@
fn adminlist(collection: CollectionId) -> Vec<CrossAccountId>;
fn allowlist(collection: CollectionId) -> Vec<CrossAccountId>;
+ fn allowed(collection: CollectionId, user: CrossAccountId) -> bool;
fn last_token_id(collection: CollectionId) -> TokenId;
+ fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>;
+ fn collection_stats() -> CollectionStats;
}
}
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -1040,14 +1040,23 @@
.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))
}
fn adminlist(collection: CollectionId) -> Vec<CrossAccountId> {
- <pallet_nft::Pallet<Runtime>>::adminlist(collection)
+ <pallet_common::Pallet<Runtime>>::adminlist(collection)
}
fn allowlist(collection: CollectionId) -> Vec<CrossAccountId> {
- <pallet_nft::Pallet<Runtime>>::allowlist(collection)
+ <pallet_common::Pallet<Runtime>>::allowlist(collection)
+ }
+ fn allowed(collection: CollectionId, user: CrossAccountId) -> bool {
+ <pallet_common::Pallet<Runtime>>::allowed(collection, user)
}
fn last_token_id(collection: CollectionId) -> TokenId {
dispatch_nft_runtime!(collection.last_token_id())
}
+ fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>> {
+ <pallet_common::CollectionById<Runtime>>::get(collection)
+ }
+ fn collection_stats() -> CollectionStats {
+ <pallet_common::Pallet<Runtime>>::collection_stats()
+ }
}
impl sp_api::Core<Block> for Runtime {
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -8,7 +8,7 @@
import chaiAsPromised from 'chai-as-promised';
import privateKey from './substrate/privateKey';
import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
-import {addCollectionAdminExpectSuccess, createCollectionExpectSuccess, destroyCollectionExpectSuccess, getAdminList, normalizeAccountId} from './util/helpers';
+import {addCollectionAdminExpectSuccess, createCollectionExpectSuccess, destroyCollectionExpectSuccess, getAdminList, normalizeAccountId, queryCollectionExpectSuccess} from './util/helpers';
chai.use(chaiAsPromised);
const expect = chai.expect;
@@ -20,7 +20,7 @@
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.equal(alice.address);
const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
@@ -38,7 +38,7 @@
const bob = privateKey('//Bob');
const charlie = privateKey('//CHARLIE');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.equal(alice.address);
const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
tests/src/addToAllowList.test.tsdiffbeforeafterboth--- a/tests/src/addToAllowList.test.ts
+++ b/tests/src/addToAllowList.test.ts
@@ -18,6 +18,7 @@
normalizeAccountId,
addCollectionAdminExpectSuccess,
addToAllowListExpectFail,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -55,7 +56,7 @@
it('Allow list an address in the collection that does not exist', async () => {
await usingApi(async (api) => {
// tslint:disable-next-line: no-bitwise
- const collectionId = ((await api.query.common.createdCollectionCount()).toNumber()) + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
const bob = privateKey('//Bob');
const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(bob.address));
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -18,6 +18,7 @@
transferExpectSuccess,
addCollectionAdminExpectSuccess,
adminApproveFromExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -94,13 +95,13 @@
it('Approve for a collection that does not exist', async () => {
await usingApi(async (api: ApiPromise) => {
// nft
- const nftCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const nftCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);
// fungible
- const fungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const fungibleCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);
// reFungible
- const reFungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const reFungibleCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);
});
});
tests/src/change-collection-owner.test.tsdiffbeforeafterboth--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -22,6 +22,7 @@
setMintPermissionExpectFailure,
destroyCollectionExpectFailure,
setPublicAccessModeExpectSuccess,
+ queryCollectionExpectSuccess,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -34,13 +35,13 @@
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection =await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
await submitTransactionAsync(alice, changeOwnerTx);
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
});
});
@@ -53,7 +54,7 @@
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
@@ -62,7 +63,7 @@
const badChangeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, alice.address);
await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
});
});
@@ -74,13 +75,13 @@
const bob = privateKey('//Bob');
const charlie = privateKey('//Charlie');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
await submitTransactionAsync(alice, changeOwnerTx);
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
// After changing the owner of the collection, all privileged methods are available to the new owner
@@ -118,20 +119,20 @@
const bob = privateKey('//Bob');
const charlie = privateKey('//Charlie');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
await submitTransactionAsync(alice, changeOwnerTx);
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
const changeOwnerTx2 = api.tx.nft.changeCollectionOwner(collectionId, charlie.address);
await submitTransactionAsync(bob, changeOwnerTx2);
// ownership lost
- const collectionAfterOwnerChange2 = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange2 = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange2.owner.toString()).to.be.deep.eq(charlie.address);
});
});
@@ -147,7 +148,7 @@
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(alice.address);
// Verifying that nothing bad happened (network is live, new collections can be created, etc.)
@@ -166,7 +167,7 @@
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(alice.address);
// Verifying that nothing bad happened (network is live, new collections can be created, etc.)
@@ -195,7 +196,7 @@
const bob = privateKey('//Bob');
const charlie = privateKey('//Charlie');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);
@@ -204,7 +205,7 @@
const badChangeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, alice.address);
await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;
- const collectionAfterOwnerChange = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
await setCollectionSponsorExpectFailure(collectionId, charlie.address, '//Alice');
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -20,6 +20,7 @@
addToAllowListExpectSuccess,
normalizeAccountId,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
import {Keyring} from '@polkadot/api';
import {IKeyringPair} from '@polkadot/types/types';
@@ -335,7 +336,7 @@
// Find the collection that never existed
let collectionId = 0;
await usingApi(async (api) => {
- collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ collectionId = await getCreatedCollectionCount(api) + 1;
});
await confirmSponsorshipExpectFailure(collectionId, '//Bob');
tests/src/contracts.test.tsdiffbeforeafterboth--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -228,7 +228,7 @@
const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, contract.address);
await submitTransactionAsync(alice, changeAdminTx);
- expect(await isAllowlisted(collectionId, bob.address)).to.be.false;
+ expect(await isAllowlisted(api, collectionId, bob.address)).to.be.false;
{
const transferTx = contract.tx.toggleAllowList(value, gasLimit, collectionId, bob.address, true);
@@ -236,7 +236,7 @@
const result = getGenericResult(events);
expect(result.success).to.be.true;
- expect(await isAllowlisted(collectionId, bob.address)).to.be.true;
+ expect(await isAllowlisted(api, collectionId, bob.address)).to.be.true;
}
{
const transferTx = contract.tx.toggleAllowList(value, gasLimit, collectionId, bob.address, false);
@@ -244,7 +244,7 @@
const result = getGenericResult(events);
expect(result.success).to.be.true;
- expect(await isAllowlisted(collectionId, bob.address)).to.be.false;
+ expect(await isAllowlisted(api, collectionId, bob.address)).to.be.false;
}
});
});
tests/src/createMultipleItems.test.tsdiffbeforeafterboth--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -20,6 +20,7 @@
getLastTokenId,
getVariableMetadata,
getConstMetadata,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -273,7 +274,7 @@
it('Create token in not existing collection', async () => {
await usingApi(async (api: ApiPromise) => {
- const collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
const createMultipleItemsTx = api.tx.nft
.createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);
await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
tests/src/destroyCollection.test.tsdiffbeforeafterboth--- a/tests/src/destroyCollection.test.ts
+++ b/tests/src/destroyCollection.test.ts
@@ -13,6 +13,7 @@
destroyCollectionExpectFailure,
setCollectionLimitsExpectSuccess,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -46,7 +47,7 @@
it('(!negative test!) Destroy a collection that never existed', async () => {
await usingApi(async (api) => {
// Find the collection that never existed
- const collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
await destroyCollectionExpectFailure(collectionId);
});
});
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit2/* eslint-disable */34import type { NftDataStructsCollectionId, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr } from './nft';5import type { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types';6import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';7import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';8import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';9import type { BlockHash } from '@polkadot/types/interfaces/chain';10import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';11import type { AuthorityId } from '@polkadot/types/interfaces/consensus';12import type { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';13import type { CreatedBlock } from '@polkadot/types/interfaces/engine';14import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';15import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';16import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';17import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';18import type { StorageKind } from '@polkadot/types/interfaces/offchain';19import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';20import type { RpcMethods } from '@polkadot/types/interfaces/rpc';21import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';22import type { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';23import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';24import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';2526declare module '@polkadot/rpc-core/types.jsonrpc' {27 export interface RpcInterface {28 author: {29 /**30 * Returns true if the keystore has private keys for the given public key and key type.31 **/32 hasKey: AugmentedRpc<(publicKey: Bytes | string | Uint8Array, keyType: Text | string) => Observable<bool>>;33 /**34 * Returns true if the keystore has private keys for the given session public keys.35 **/36 hasSessionKeys: AugmentedRpc<(sessionKeys: Bytes | string | Uint8Array) => Observable<bool>>;37 /**38 * Insert a key into the keystore.39 **/40 insertKey: AugmentedRpc<(keyType: Text | string, suri: Text | string, publicKey: Bytes | string | Uint8Array) => Observable<Bytes>>;41 /**42 * Returns all pending extrinsics, potentially grouped by sender43 **/44 pendingExtrinsics: AugmentedRpc<() => Observable<Vec<Extrinsic>>>;45 /**46 * Remove given extrinsic from the pool and temporarily ban it to prevent reimporting47 **/48 removeExtrinsic: AugmentedRpc<(bytesOrHash: Vec<ExtrinsicOrHash> | (ExtrinsicOrHash | { Hash: any } | { Extrinsic: any } | string | Uint8Array)[]) => Observable<Vec<Hash>>>;49 /**50 * Generate new session keys and returns the corresponding public keys51 **/52 rotateKeys: AugmentedRpc<() => Observable<Bytes>>;53 /**54 * Submit and subscribe to watch an extrinsic until unsubscribed55 **/56 submitAndWatchExtrinsic: AugmentedRpc<(extrinsic: IExtrinsic) => Observable<ExtrinsicStatus>>;57 /**58 * Submit a fully formatted extrinsic for block inclusion59 **/60 submitExtrinsic: AugmentedRpc<(extrinsic: IExtrinsic) => Observable<Hash>>;61 };62 babe: {63 /**64 * Returns data about which slots (primary or secondary) can be claimed in the current epoch with the keys in the keystore65 **/66 epochAuthorship: AugmentedRpc<() => Observable<HashMap<AuthorityId, EpochAuthorship>>>;67 };68 beefy: {69 /**70 * Returns the block most recently finalized by BEEFY, alongside side its justification.71 **/72 subscribeJustifications: AugmentedRpc<() => Observable<BeefySignedCommitment>>;73 };74 chain: {75 /**76 * Get header and body of a relay chain block77 **/78 getBlock: AugmentedRpc<(hash?: BlockHash | string | Uint8Array) => Observable<SignedBlock>>;79 /**80 * Get the block hash for a specific block81 **/82 getBlockHash: AugmentedRpc<(blockNumber?: BlockNumber | AnyNumber | Uint8Array) => Observable<BlockHash>>;83 /**84 * Get hash of the last finalized block in the canon chain85 **/86 getFinalizedHead: AugmentedRpc<() => Observable<BlockHash>>;87 /**88 * Retrieves the header for a specific block89 **/90 getHeader: AugmentedRpc<(hash?: BlockHash | string | Uint8Array) => Observable<Header>>;91 /**92 * Retrieves the newest header via subscription93 **/94 subscribeAllHeads: AugmentedRpc<() => Observable<Header>>;95 /**96 * Retrieves the best finalized header via subscription97 **/98 subscribeFinalizedHeads: AugmentedRpc<() => Observable<Header>>;99 /**100 * Retrieves the best header via subscription101 **/102 subscribeNewHeads: AugmentedRpc<() => Observable<Header>>;103 };104 childstate: {105 /**106 * Returns the keys with prefix from a child storage, leave empty to get all the keys107 **/108 getKeys: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;109 /**110 * Returns the keys with prefix from a child storage with pagination support111 **/112 getKeysPaged: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;113 /**114 * Returns a child storage entry at a specific block state115 **/116 getStorage: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<StorageData>>>;117 /**118 * Returns child storage entries for multiple keys at a specific block state119 **/120 getStorageEntries: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: Hash | string | Uint8Array) => Observable<Vec<Option<StorageData>>>>;121 /**122 * Returns the hash of a child storage entry at a block state123 **/124 getStorageHash: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<Hash>>>;125 /**126 * Returns the size of a child storage entry at a block state127 **/128 getStorageSize: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;129 };130 contracts: {131 /**132 * Executes a call to a contract133 **/134 call: AugmentedRpc<(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractExecResult>>;135 /**136 * Returns the value under a specified storage key in a contract137 **/138 getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<Bytes>>>;139 /**140 * Instantiate a new contract141 **/142 instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; endowment?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;143 /**144 * Returns the projected time a given contract will be able to sustain paying its rent145 **/146 rentProjection: AugmentedRpc<(address: AccountId | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<BlockNumber>>>;147 };148 engine: {149 /**150 * Instructs the manual-seal authorship task to create a new block151 **/152 createBlock: AugmentedRpc<(createEmpty: bool | boolean | Uint8Array, finalize: bool | boolean | Uint8Array, parentHash?: BlockHash | string | Uint8Array) => Observable<CreatedBlock>>;153 /**154 * Instructs the manual-seal authorship task to finalize a block155 **/156 finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification) => Observable<bool>>;157 };158 eth: {159 /**160 * Returns accounts list.161 **/162 accounts: AugmentedRpc<() => Observable<Vec<H160>>>;163 /**164 * Returns the blockNumber165 **/166 blockNumber: AugmentedRpc<() => Observable<U256>>;167 /**168 * Call contract, returning the output data.169 **/170 call: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;171 /**172 * Returns the chain ID used for transaction signing at the current best block. None is returned if not available.173 **/174 chainId: AugmentedRpc<() => Observable<U64>>;175 /**176 * Returns block author.177 **/178 coinbase: AugmentedRpc<() => Observable<H160>>;179 /**180 * Estimate gas needed for execution of given contract.181 **/182 estimateGas: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;183 /**184 * Returns current gas price.185 **/186 gasPrice: AugmentedRpc<() => Observable<U256>>;187 /**188 * Returns balance of the given account.189 **/190 getBalance: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;191 /**192 * Returns block with given hash.193 **/194 getBlockByHash: AugmentedRpc<(hash: H256 | string | Uint8Array, full: bool | boolean | Uint8Array) => Observable<Option<EthRichBlock>>>;195 /**196 * Returns block with given number.197 **/198 getBlockByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array, full: bool | boolean | Uint8Array) => Observable<Option<EthRichBlock>>>;199 /**200 * Returns the number of transactions in a block with given hash.201 **/202 getBlockTransactionCountByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<U256>>;203 /**204 * Returns the number of transactions in a block with given block number.205 **/206 getBlockTransactionCountByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;207 /**208 * Returns the code at given address at given time (block number).209 **/210 getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;211 /**212 * Returns filter changes since last poll.213 **/214 getFilterChanges: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<EthFilterChanges>>;215 /**216 * Returns all logs matching given filter (in a range 'from' - 'to').217 **/218 getFilterLogs: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<Vec<EthLog>>>;219 /**220 * Returns logs matching given filter object.221 **/222 getLogs: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<Vec<EthLog>>>;223 /**224 * Returns proof for account and storage.225 **/226 getProof: AugmentedRpc<(address: H160 | string | Uint8Array, storageKeys: Vec<H256> | (H256 | string | Uint8Array)[], number: BlockNumber | AnyNumber | Uint8Array) => Observable<EthAccount>>;227 /**228 * Returns content of the storage at given address.229 **/230 getStorageAt: AugmentedRpc<(address: H160 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<H256>>;231 /**232 * Returns transaction at given block hash and index.233 **/234 getTransactionByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthTransaction>>;235 /**236 * Returns transaction by given block number and index.237 **/238 getTransactionByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthTransaction>>;239 /**240 * Get transaction by its hash.241 **/242 getTransactionByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<EthTransaction>>;243 /**244 * Returns the number of transactions sent from given address at given time (block number).245 **/246 getTransactionCount: AugmentedRpc<(hash: H256 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;247 /**248 * Returns transaction receipt by transaction hash.249 **/250 getTransactionReceipt: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<EthReceipt>>;251 /**252 * Returns an uncles at given block and index.253 **/254 getUncleByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthRichBlock>>;255 /**256 * Returns an uncles at given block and index.257 **/258 getUncleByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthRichBlock>>;259 /**260 * Returns the number of uncles in a block with given hash.261 **/262 getUncleCountByBlockHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<U256>>;263 /**264 * Returns the number of uncles in a block with given block number.265 **/266 getUncleCountByBlockNumber: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;267 /**268 * Returns the hash of the current block, the seedHash, and the boundary condition to be met.269 **/270 getWork: AugmentedRpc<() => Observable<EthWork>>;271 /**272 * Returns the number of hashes per second that the node is mining with.273 **/274 hashrate: AugmentedRpc<() => Observable<U256>>;275 /**276 * Returns true if client is actively mining new blocks.277 **/278 mining: AugmentedRpc<() => Observable<bool>>;279 /**280 * Returns id of new block filter.281 **/282 newBlockFilter: AugmentedRpc<() => Observable<U256>>;283 /**284 * Returns id of new filter.285 **/286 newFilter: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<U256>>;287 /**288 * Returns id of new block filter.289 **/290 newPendingTransactionFilter: AugmentedRpc<() => Observable<U256>>;291 /**292 * Returns protocol version encoded as a string (quotes are necessary).293 **/294 protocolVersion: AugmentedRpc<() => Observable<u64>>;295 /**296 * Sends signed transaction, returning its hash.297 **/298 sendRawTransaction: AugmentedRpc<(bytes: Bytes | string | Uint8Array) => Observable<H256>>;299 /**300 * Sends transaction; will block waiting for signer to return the transaction hash301 **/302 sendTransaction: AugmentedRpc<(tx: EthTransactionRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array) => Observable<H256>>;303 /**304 * Used for submitting mining hashrate.305 **/306 submitHashrate: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array, hash: H256 | string | Uint8Array) => Observable<bool>>;307 /**308 * Used for submitting a proof-of-work solution.309 **/310 submitWork: AugmentedRpc<(nonce: H64 | string | Uint8Array, headerHash: H256 | string | Uint8Array, mixDigest: H256 | string | Uint8Array) => Observable<bool>>;311 /**312 * Subscribe to Eth subscription.313 **/314 subscribe: AugmentedRpc<(kind: EthSubKind | 'newHeads' | 'logs' | 'newPendingTransactions' | 'syncing' | number | Uint8Array, params?: EthSubParams | { None: any } | { Logs: any } | string | Uint8Array) => Observable<Null>>;315 /**316 * Returns an object with data about the sync status or false.317 **/318 syncing: AugmentedRpc<() => Observable<EthSyncStatus>>;319 /**320 * Uninstalls filter.321 **/322 uninstallFilter: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<bool>>;323 };324 grandpa: {325 /**326 * Prove finality for the range (begin; end] hash.327 **/328 proveFinality: AugmentedRpc<(begin: BlockHash | string | Uint8Array, end: BlockHash | string | Uint8Array, authoritiesSetId?: u64 | AnyNumber | Uint8Array) => Observable<Option<EncodedFinalityProofs>>>;329 /**330 * Returns the state of the current best round state as well as the ongoing background rounds331 **/332 roundState: AugmentedRpc<() => Observable<ReportedRoundStates>>;333 /**334 * Subscribes to grandpa justifications335 **/336 subscribeJustifications: AugmentedRpc<() => Observable<JustificationNotification>>;337 };338 mmr: {339 /**340 * Generate MMR proof for given leaf index.341 **/342 generateProof: AugmentedRpc<(leafIndex: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafProof>>;343 };344 net: {345 /**346 * Returns true if client is actively listening for network connections. Otherwise false.347 **/348 listening: AugmentedRpc<() => Observable<bool>>;349 /**350 * Returns number of peers connected to node.351 **/352 peerCount: AugmentedRpc<() => Observable<Text>>;353 /**354 * Returns protocol version.355 **/356 version: AugmentedRpc<() => Observable<Text>>;357 };358 nft: {359 /**360 * Get amount of different user tokens361 **/362 accountBalance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;363 /**364 * Get tokens owned by account365 **/366 accountTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;367 /**368 * Get admin list369 **/370 adminlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;371 /**372 * Get allowed amount373 **/374 allowance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, sender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;375 /**376 * Get allowlist377 **/378 allowlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;379 /**380 * Get amount of specific account token381 **/382 balance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;383 /**384 * Get tokens contained in collection385 **/386 collectionTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;387 /**388 * Get token constant metadata389 **/390 constMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;391 /**392 * Get last token id393 **/394 lastTokenId: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<NftDataStructsTokenId>>;395 /**396 * Check if token exists397 **/398 tokenExists: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;399 /**400 * Get token owner401 **/402 tokenOwner: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletCommonAccountBasicCrossAccountIdRepr>>;403 /**404 * Get token variable metadata405 **/406 variableMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;407 };408 offchain: {409 /**410 * Get offchain local storage under given key and prefix411 **/412 localStorageGet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;413 /**414 * Set offchain local storage under given key and prefix415 **/416 localStorageSet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;417 };418 payment: {419 /**420 * Query the detailed fee of a given encoded extrinsic421 **/422 queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;423 /**424 * Retrieves the fee information for an encoded extrinsic425 **/426 queryInfo: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<RuntimeDispatchInfo>>;427 };428 rpc: {429 /**430 * Retrieves the list of RPC methods that are exposed by the node431 **/432 methods: AugmentedRpc<() => Observable<RpcMethods>>;433 };434 state: {435 /**436 * Perform a call to a builtin on the chain437 **/438 call: AugmentedRpc<(method: Text | string, data: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Bytes>>;439 /**440 * Retrieves the keys with prefix of a specific child storage441 **/442 getChildKeys: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;443 /**444 * Returns proof of storage for child key entries at a specific block state.445 **/446 getChildReadProof: AugmentedRpc<(childStorageKey: PrefixedStorageKey | string | Uint8Array, keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;447 /**448 * Retrieves the child storage for a key449 **/450 getChildStorage: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<StorageData>>;451 /**452 * Retrieves the child storage hash453 **/454 getChildStorageHash: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Hash>>;455 /**456 * Retrieves the child storage size457 **/458 getChildStorageSize: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<u64>>;459 /**460 * Retrieves the keys with a certain prefix461 **/462 getKeys: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;463 /**464 * Returns the keys with prefix with pagination support.465 **/466 getKeysPaged: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;467 /**468 * Returns the runtime metadata469 **/470 getMetadata: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<Metadata>>;471 /**472 * Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)473 **/474 getPairs: AugmentedRpc<(prefix: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<KeyValue>>>;475 /**476 * Returns proof of storage entries at a specific block state477 **/478 getReadProof: AugmentedRpc<(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;479 /**480 * Get the runtime version481 **/482 getRuntimeVersion: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<RuntimeVersion>>;483 /**484 * Retrieves the storage for a key485 **/486 getStorage: AugmentedRpc<<T = Codec>(key: StorageKey | string | Uint8Array | any, block?: Hash | Uint8Array | string) => Observable<T>>;487 /**488 * Retrieves the storage hash489 **/490 getStorageHash: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Hash>>;491 /**492 * Retrieves the storage size493 **/494 getStorageSize: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<u64>>;495 /**496 * Query historical storage entries (by key) starting from a start block497 **/498 queryStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], fromBlock?: Hash | Uint8Array | string, toBlock?: Hash | Uint8Array | string) => Observable<[Hash, T][]>>;499 /**500 * Query storage entries (by key) starting at block hash given as the second parameter501 **/502 queryStorageAt: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: Hash | Uint8Array | string) => Observable<T>>;503 /**504 * Retrieves the runtime version via subscription505 **/506 subscribeRuntimeVersion: AugmentedRpc<() => Observable<RuntimeVersion>>;507 /**508 * Subscribes to storage changes for the provided keys509 **/510 subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;511 /**512 * Provides a way to trace the re-execution of a single block513 **/514 traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option<Text> | null | object | string | Uint8Array, storageKeys: Option<Text> | null | object | string | Uint8Array) => Observable<TraceBlockResponse>>;515 };516 syncstate: {517 /**518 * Returns the json-serialized chainspec running the node, with a sync state.519 **/520 genSyncSpec: AugmentedRpc<(raw: bool | boolean | Uint8Array) => Observable<Json>>;521 };522 system: {523 /**524 * Retrieves the next accountIndex as available on the node525 **/526 accountNextIndex: AugmentedRpc<(accountId: AccountId | string | Uint8Array) => Observable<Index>>;527 /**528 * Adds the supplied directives to the current log filter529 **/530 addLogFilter: AugmentedRpc<(directives: Text | string) => Observable<Null>>;531 /**532 * Adds a reserved peer533 **/534 addReservedPeer: AugmentedRpc<(peer: Text | string) => Observable<Text>>;535 /**536 * Retrieves the chain537 **/538 chain: AugmentedRpc<() => Observable<Text>>;539 /**540 * Retrieves the chain type541 **/542 chainType: AugmentedRpc<() => Observable<ChainType>>;543 /**544 * Dry run an extrinsic at a given block545 **/546 dryRun: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ApplyExtrinsicResult>>;547 /**548 * Return health status of the node549 **/550 health: AugmentedRpc<() => Observable<Health>>;551 /**552 * The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example553 **/554 localListenAddresses: AugmentedRpc<() => Observable<Vec<Text>>>;555 /**556 * Returns the base58-encoded PeerId of the node557 **/558 localPeerId: AugmentedRpc<() => Observable<Text>>;559 /**560 * Retrieves the node name561 **/562 name: AugmentedRpc<() => Observable<Text>>;563 /**564 * Returns current state of the network565 **/566 networkState: AugmentedRpc<() => Observable<NetworkState>>;567 /**568 * Returns the roles the node is running as569 **/570 nodeRoles: AugmentedRpc<() => Observable<Vec<NodeRole>>>;571 /**572 * Returns the currently connected peers573 **/574 peers: AugmentedRpc<() => Observable<Vec<PeerInfo>>>;575 /**576 * Get a custom set of properties as a JSON object, defined in the chain spec577 **/578 properties: AugmentedRpc<() => Observable<ChainProperties>>;579 /**580 * Remove a reserved peer581 **/582 removeReservedPeer: AugmentedRpc<(peerId: Text | string) => Observable<Text>>;583 /**584 * Returns the list of reserved peers585 **/586 reservedPeers: AugmentedRpc<() => Observable<Vec<Text>>>;587 /**588 * Resets the log filter to Substrate defaults589 **/590 resetLogFilter: AugmentedRpc<() => Observable<Null>>;591 /**592 * Returns the state of the syncing of the node593 **/594 syncState: AugmentedRpc<() => Observable<SyncState>>;595 /**596 * Retrieves the version of the node597 **/598 version: AugmentedRpc<() => Observable<Text>>;599 };600 web3: {601 /**602 * Returns current client version.603 **/604 clientVersion: AugmentedRpc<() => Observable<Text>>;605 /**606 * Returns sha3 of the given data607 **/608 sha3: AugmentedRpc<(data: Bytes | string | Uint8Array) => Observable<H256>>;609 };610 }611}1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit2/* eslint-disable */34import type { NftDataStructsCollection, NftDataStructsCollectionId, NftDataStructsCollectionStats, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr } from './nft';5import type { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types';6import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';7import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';8import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';9import type { BlockHash } from '@polkadot/types/interfaces/chain';10import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';11import type { AuthorityId } from '@polkadot/types/interfaces/consensus';12import type { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts';13import type { CreatedBlock } from '@polkadot/types/interfaces/engine';14import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth';15import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';16import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa';17import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';18import type { StorageKind } from '@polkadot/types/interfaces/offchain';19import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';20import type { RpcMethods } from '@polkadot/types/interfaces/rpc';21import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';22import type { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';23import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';24import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types';2526declare module '@polkadot/rpc-core/types.jsonrpc' {27 export interface RpcInterface {28 author: {29 /**30 * Returns true if the keystore has private keys for the given public key and key type.31 **/32 hasKey: AugmentedRpc<(publicKey: Bytes | string | Uint8Array, keyType: Text | string) => Observable<bool>>;33 /**34 * Returns true if the keystore has private keys for the given session public keys.35 **/36 hasSessionKeys: AugmentedRpc<(sessionKeys: Bytes | string | Uint8Array) => Observable<bool>>;37 /**38 * Insert a key into the keystore.39 **/40 insertKey: AugmentedRpc<(keyType: Text | string, suri: Text | string, publicKey: Bytes | string | Uint8Array) => Observable<Bytes>>;41 /**42 * Returns all pending extrinsics, potentially grouped by sender43 **/44 pendingExtrinsics: AugmentedRpc<() => Observable<Vec<Extrinsic>>>;45 /**46 * Remove given extrinsic from the pool and temporarily ban it to prevent reimporting47 **/48 removeExtrinsic: AugmentedRpc<(bytesOrHash: Vec<ExtrinsicOrHash> | (ExtrinsicOrHash | { Hash: any } | { Extrinsic: any } | string | Uint8Array)[]) => Observable<Vec<Hash>>>;49 /**50 * Generate new session keys and returns the corresponding public keys51 **/52 rotateKeys: AugmentedRpc<() => Observable<Bytes>>;53 /**54 * Submit and subscribe to watch an extrinsic until unsubscribed55 **/56 submitAndWatchExtrinsic: AugmentedRpc<(extrinsic: IExtrinsic) => Observable<ExtrinsicStatus>>;57 /**58 * Submit a fully formatted extrinsic for block inclusion59 **/60 submitExtrinsic: AugmentedRpc<(extrinsic: IExtrinsic) => Observable<Hash>>;61 };62 babe: {63 /**64 * Returns data about which slots (primary or secondary) can be claimed in the current epoch with the keys in the keystore65 **/66 epochAuthorship: AugmentedRpc<() => Observable<HashMap<AuthorityId, EpochAuthorship>>>;67 };68 beefy: {69 /**70 * Returns the block most recently finalized by BEEFY, alongside side its justification.71 **/72 subscribeJustifications: AugmentedRpc<() => Observable<BeefySignedCommitment>>;73 };74 chain: {75 /**76 * Get header and body of a relay chain block77 **/78 getBlock: AugmentedRpc<(hash?: BlockHash | string | Uint8Array) => Observable<SignedBlock>>;79 /**80 * Get the block hash for a specific block81 **/82 getBlockHash: AugmentedRpc<(blockNumber?: BlockNumber | AnyNumber | Uint8Array) => Observable<BlockHash>>;83 /**84 * Get hash of the last finalized block in the canon chain85 **/86 getFinalizedHead: AugmentedRpc<() => Observable<BlockHash>>;87 /**88 * Retrieves the header for a specific block89 **/90 getHeader: AugmentedRpc<(hash?: BlockHash | string | Uint8Array) => Observable<Header>>;91 /**92 * Retrieves the newest header via subscription93 **/94 subscribeAllHeads: AugmentedRpc<() => Observable<Header>>;95 /**96 * Retrieves the best finalized header via subscription97 **/98 subscribeFinalizedHeads: AugmentedRpc<() => Observable<Header>>;99 /**100 * Retrieves the best header via subscription101 **/102 subscribeNewHeads: AugmentedRpc<() => Observable<Header>>;103 };104 childstate: {105 /**106 * Returns the keys with prefix from a child storage, leave empty to get all the keys107 **/108 getKeys: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;109 /**110 * Returns the keys with prefix from a child storage with pagination support111 **/112 getKeysPaged: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, prefix: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Vec<StorageKey>>>;113 /**114 * Returns a child storage entry at a specific block state115 **/116 getStorage: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<StorageData>>>;117 /**118 * Returns child storage entries for multiple keys at a specific block state119 **/120 getStorageEntries: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: Hash | string | Uint8Array) => Observable<Vec<Option<StorageData>>>>;121 /**122 * Returns the hash of a child storage entry at a block state123 **/124 getStorageHash: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<Hash>>>;125 /**126 * Returns the size of a child storage entry at a block state127 **/128 getStorageSize: AugmentedRpc<(childKey: PrefixedStorageKey | string | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;129 };130 contracts: {131 /**132 * Executes a call to a contract133 **/134 call: AugmentedRpc<(callRequest: ContractCallRequest | { origin?: any; dest?: any; value?: any; gasLimit?: any; inputData?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractExecResult>>;135 /**136 * Returns the value under a specified storage key in a contract137 **/138 getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<Bytes>>>;139 /**140 * Instantiate a new contract141 **/142 instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; endowment?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ContractInstantiateResult>>;143 /**144 * Returns the projected time a given contract will be able to sustain paying its rent145 **/146 rentProjection: AugmentedRpc<(address: AccountId | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Option<BlockNumber>>>;147 };148 engine: {149 /**150 * Instructs the manual-seal authorship task to create a new block151 **/152 createBlock: AugmentedRpc<(createEmpty: bool | boolean | Uint8Array, finalize: bool | boolean | Uint8Array, parentHash?: BlockHash | string | Uint8Array) => Observable<CreatedBlock>>;153 /**154 * Instructs the manual-seal authorship task to finalize a block155 **/156 finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification) => Observable<bool>>;157 };158 eth: {159 /**160 * Returns accounts list.161 **/162 accounts: AugmentedRpc<() => Observable<Vec<H160>>>;163 /**164 * Returns the blockNumber165 **/166 blockNumber: AugmentedRpc<() => Observable<U256>>;167 /**168 * Call contract, returning the output data.169 **/170 call: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;171 /**172 * Returns the chain ID used for transaction signing at the current best block. None is returned if not available.173 **/174 chainId: AugmentedRpc<() => Observable<U64>>;175 /**176 * Returns block author.177 **/178 coinbase: AugmentedRpc<() => Observable<H160>>;179 /**180 * Estimate gas needed for execution of given contract.181 **/182 estimateGas: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;183 /**184 * Returns current gas price.185 **/186 gasPrice: AugmentedRpc<() => Observable<U256>>;187 /**188 * Returns balance of the given account.189 **/190 getBalance: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;191 /**192 * Returns block with given hash.193 **/194 getBlockByHash: AugmentedRpc<(hash: H256 | string | Uint8Array, full: bool | boolean | Uint8Array) => Observable<Option<EthRichBlock>>>;195 /**196 * Returns block with given number.197 **/198 getBlockByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array, full: bool | boolean | Uint8Array) => Observable<Option<EthRichBlock>>>;199 /**200 * Returns the number of transactions in a block with given hash.201 **/202 getBlockTransactionCountByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<U256>>;203 /**204 * Returns the number of transactions in a block with given block number.205 **/206 getBlockTransactionCountByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;207 /**208 * Returns the code at given address at given time (block number).209 **/210 getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<Bytes>>;211 /**212 * Returns filter changes since last poll.213 **/214 getFilterChanges: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<EthFilterChanges>>;215 /**216 * Returns all logs matching given filter (in a range 'from' - 'to').217 **/218 getFilterLogs: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<Vec<EthLog>>>;219 /**220 * Returns logs matching given filter object.221 **/222 getLogs: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<Vec<EthLog>>>;223 /**224 * Returns proof for account and storage.225 **/226 getProof: AugmentedRpc<(address: H160 | string | Uint8Array, storageKeys: Vec<H256> | (H256 | string | Uint8Array)[], number: BlockNumber | AnyNumber | Uint8Array) => Observable<EthAccount>>;227 /**228 * Returns content of the storage at given address.229 **/230 getStorageAt: AugmentedRpc<(address: H160 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<H256>>;231 /**232 * Returns transaction at given block hash and index.233 **/234 getTransactionByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthTransaction>>;235 /**236 * Returns transaction by given block number and index.237 **/238 getTransactionByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthTransaction>>;239 /**240 * Get transaction by its hash.241 **/242 getTransactionByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<EthTransaction>>;243 /**244 * Returns the number of transactions sent from given address at given time (block number).245 **/246 getTransactionCount: AugmentedRpc<(hash: H256 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;247 /**248 * Returns transaction receipt by transaction hash.249 **/250 getTransactionReceipt: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<EthReceipt>>;251 /**252 * Returns an uncles at given block and index.253 **/254 getUncleByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthRichBlock>>;255 /**256 * Returns an uncles at given block and index.257 **/258 getUncleByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable<EthRichBlock>>;259 /**260 * Returns the number of uncles in a block with given hash.261 **/262 getUncleCountByBlockHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable<U256>>;263 /**264 * Returns the number of uncles in a block with given block number.265 **/266 getUncleCountByBlockNumber: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;267 /**268 * Returns the hash of the current block, the seedHash, and the boundary condition to be met.269 **/270 getWork: AugmentedRpc<() => Observable<EthWork>>;271 /**272 * Returns the number of hashes per second that the node is mining with.273 **/274 hashrate: AugmentedRpc<() => Observable<U256>>;275 /**276 * Returns true if client is actively mining new blocks.277 **/278 mining: AugmentedRpc<() => Observable<bool>>;279 /**280 * Returns id of new block filter.281 **/282 newBlockFilter: AugmentedRpc<() => Observable<U256>>;283 /**284 * Returns id of new filter.285 **/286 newFilter: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable<U256>>;287 /**288 * Returns id of new block filter.289 **/290 newPendingTransactionFilter: AugmentedRpc<() => Observable<U256>>;291 /**292 * Returns protocol version encoded as a string (quotes are necessary).293 **/294 protocolVersion: AugmentedRpc<() => Observable<u64>>;295 /**296 * Sends signed transaction, returning its hash.297 **/298 sendRawTransaction: AugmentedRpc<(bytes: Bytes | string | Uint8Array) => Observable<H256>>;299 /**300 * Sends transaction; will block waiting for signer to return the transaction hash301 **/302 sendTransaction: AugmentedRpc<(tx: EthTransactionRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array) => Observable<H256>>;303 /**304 * Used for submitting mining hashrate.305 **/306 submitHashrate: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array, hash: H256 | string | Uint8Array) => Observable<bool>>;307 /**308 * Used for submitting a proof-of-work solution.309 **/310 submitWork: AugmentedRpc<(nonce: H64 | string | Uint8Array, headerHash: H256 | string | Uint8Array, mixDigest: H256 | string | Uint8Array) => Observable<bool>>;311 /**312 * Subscribe to Eth subscription.313 **/314 subscribe: AugmentedRpc<(kind: EthSubKind | 'newHeads' | 'logs' | 'newPendingTransactions' | 'syncing' | number | Uint8Array, params?: EthSubParams | { None: any } | { Logs: any } | string | Uint8Array) => Observable<Null>>;315 /**316 * Returns an object with data about the sync status or false.317 **/318 syncing: AugmentedRpc<() => Observable<EthSyncStatus>>;319 /**320 * Uninstalls filter.321 **/322 uninstallFilter: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array) => Observable<bool>>;323 };324 grandpa: {325 /**326 * Prove finality for the range (begin; end] hash.327 **/328 proveFinality: AugmentedRpc<(begin: BlockHash | string | Uint8Array, end: BlockHash | string | Uint8Array, authoritiesSetId?: u64 | AnyNumber | Uint8Array) => Observable<Option<EncodedFinalityProofs>>>;329 /**330 * Returns the state of the current best round state as well as the ongoing background rounds331 **/332 roundState: AugmentedRpc<() => Observable<ReportedRoundStates>>;333 /**334 * Subscribes to grandpa justifications335 **/336 subscribeJustifications: AugmentedRpc<() => Observable<JustificationNotification>>;337 };338 mmr: {339 /**340 * Generate MMR proof for given leaf index.341 **/342 generateProof: AugmentedRpc<(leafIndex: u64 | AnyNumber | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<MmrLeafProof>>;343 };344 net: {345 /**346 * Returns true if client is actively listening for network connections. Otherwise false.347 **/348 listening: AugmentedRpc<() => Observable<bool>>;349 /**350 * Returns number of peers connected to node.351 **/352 peerCount: AugmentedRpc<() => Observable<Text>>;353 /**354 * Returns protocol version.355 **/356 version: AugmentedRpc<() => Observable<Text>>;357 };358 nft: {359 /**360 * Get amount of different user tokens361 **/362 accountBalance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;363 /**364 * Get tokens owned by account365 **/366 accountTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;367 /**368 * Get admin list369 **/370 adminlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;371 /**372 * Get allowed amount373 **/374 allowance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, sender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;375 /**376 * Check if user is allowed to use collection377 **/378 allowed: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;379 /**380 * Get allowlist381 **/382 allowlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;383 /**384 * Get amount of specific account token385 **/386 balance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;387 /**388 * Get collection by specified id389 **/390 collectionById: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<NftDataStructsCollection>>>;391 /**392 * Get collection stats393 **/394 collectionStats: AugmentedRpc<(at?: Hash | string | Uint8Array) => Observable<NftDataStructsCollectionStats>>;395 /**396 * Get tokens contained in collection397 **/398 collectionTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;399 /**400 * Get token constant metadata401 **/402 constMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;403 /**404 * Get last token id405 **/406 lastTokenId: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<NftDataStructsTokenId>>;407 /**408 * Check if token exists409 **/410 tokenExists: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;411 /**412 * Get token owner413 **/414 tokenOwner: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletCommonAccountBasicCrossAccountIdRepr>>;415 /**416 * Get token variable metadata417 **/418 variableMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;419 };420 offchain: {421 /**422 * Get offchain local storage under given key and prefix423 **/424 localStorageGet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Option<Bytes>>>;425 /**426 * Set offchain local storage under given key and prefix427 **/428 localStorageSet: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => Observable<Null>>;429 };430 payment: {431 /**432 * Query the detailed fee of a given encoded extrinsic433 **/434 queryFeeDetails: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<FeeDetails>>;435 /**436 * Retrieves the fee information for an encoded extrinsic437 **/438 queryInfo: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<RuntimeDispatchInfo>>;439 };440 rpc: {441 /**442 * Retrieves the list of RPC methods that are exposed by the node443 **/444 methods: AugmentedRpc<() => Observable<RpcMethods>>;445 };446 state: {447 /**448 * Perform a call to a builtin on the chain449 **/450 call: AugmentedRpc<(method: Text | string, data: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<Bytes>>;451 /**452 * Retrieves the keys with prefix of a specific child storage453 **/454 getChildKeys: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;455 /**456 * Returns proof of storage for child key entries at a specific block state.457 **/458 getChildReadProof: AugmentedRpc<(childStorageKey: PrefixedStorageKey | string | Uint8Array, keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;459 /**460 * Retrieves the child storage for a key461 **/462 getChildStorage: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<StorageData>>;463 /**464 * Retrieves the child storage hash465 **/466 getChildStorageHash: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Hash>>;467 /**468 * Retrieves the child storage size469 **/470 getChildStorageSize: AugmentedRpc<(childStorageKey: StorageKey | string | Uint8Array | any, childDefinition: StorageKey | string | Uint8Array | any, childType: u32 | AnyNumber | Uint8Array, key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<u64>>;471 /**472 * Retrieves the keys with a certain prefix473 **/474 getKeys: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;475 /**476 * Returns the keys with prefix with pagination support.477 **/478 getKeysPaged: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, count: u32 | AnyNumber | Uint8Array, startKey?: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<StorageKey>>>;479 /**480 * Returns the runtime metadata481 **/482 getMetadata: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<Metadata>>;483 /**484 * Returns the keys with prefix, leave empty to get all the keys (deprecated: Use getKeysPaged)485 **/486 getPairs: AugmentedRpc<(prefix: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Vec<KeyValue>>>;487 /**488 * Returns proof of storage entries at a specific block state489 **/490 getReadProof: AugmentedRpc<(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: BlockHash | string | Uint8Array) => Observable<ReadProof>>;491 /**492 * Get the runtime version493 **/494 getRuntimeVersion: AugmentedRpc<(at?: BlockHash | string | Uint8Array) => Observable<RuntimeVersion>>;495 /**496 * Retrieves the storage for a key497 **/498 getStorage: AugmentedRpc<<T = Codec>(key: StorageKey | string | Uint8Array | any, block?: Hash | Uint8Array | string) => Observable<T>>;499 /**500 * Retrieves the storage hash501 **/502 getStorageHash: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<Hash>>;503 /**504 * Retrieves the storage size505 **/506 getStorageSize: AugmentedRpc<(key: StorageKey | string | Uint8Array | any, at?: BlockHash | string | Uint8Array) => Observable<u64>>;507 /**508 * Query historical storage entries (by key) starting from a start block509 **/510 queryStorage: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], fromBlock?: Hash | Uint8Array | string, toBlock?: Hash | Uint8Array | string) => Observable<[Hash, T][]>>;511 /**512 * Query storage entries (by key) starting at block hash given as the second parameter513 **/514 queryStorageAt: AugmentedRpc<<T = Codec[]>(keys: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[], at?: Hash | Uint8Array | string) => Observable<T>>;515 /**516 * Retrieves the runtime version via subscription517 **/518 subscribeRuntimeVersion: AugmentedRpc<() => Observable<RuntimeVersion>>;519 /**520 * Subscribes to storage changes for the provided keys521 **/522 subscribeStorage: AugmentedRpc<<T = Codec[]>(keys?: Vec<StorageKey> | (StorageKey | string | Uint8Array | any)[]) => Observable<T>>;523 /**524 * Provides a way to trace the re-execution of a single block525 **/526 traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option<Text> | null | object | string | Uint8Array, storageKeys: Option<Text> | null | object | string | Uint8Array) => Observable<TraceBlockResponse>>;527 };528 syncstate: {529 /**530 * Returns the json-serialized chainspec running the node, with a sync state.531 **/532 genSyncSpec: AugmentedRpc<(raw: bool | boolean | Uint8Array) => Observable<Json>>;533 };534 system: {535 /**536 * Retrieves the next accountIndex as available on the node537 **/538 accountNextIndex: AugmentedRpc<(accountId: AccountId | string | Uint8Array) => Observable<Index>>;539 /**540 * Adds the supplied directives to the current log filter541 **/542 addLogFilter: AugmentedRpc<(directives: Text | string) => Observable<Null>>;543 /**544 * Adds a reserved peer545 **/546 addReservedPeer: AugmentedRpc<(peer: Text | string) => Observable<Text>>;547 /**548 * Retrieves the chain549 **/550 chain: AugmentedRpc<() => Observable<Text>>;551 /**552 * Retrieves the chain type553 **/554 chainType: AugmentedRpc<() => Observable<ChainType>>;555 /**556 * Dry run an extrinsic at a given block557 **/558 dryRun: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<ApplyExtrinsicResult>>;559 /**560 * Return health status of the node561 **/562 health: AugmentedRpc<() => Observable<Health>>;563 /**564 * The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example565 **/566 localListenAddresses: AugmentedRpc<() => Observable<Vec<Text>>>;567 /**568 * Returns the base58-encoded PeerId of the node569 **/570 localPeerId: AugmentedRpc<() => Observable<Text>>;571 /**572 * Retrieves the node name573 **/574 name: AugmentedRpc<() => Observable<Text>>;575 /**576 * Returns current state of the network577 **/578 networkState: AugmentedRpc<() => Observable<NetworkState>>;579 /**580 * Returns the roles the node is running as581 **/582 nodeRoles: AugmentedRpc<() => Observable<Vec<NodeRole>>>;583 /**584 * Returns the currently connected peers585 **/586 peers: AugmentedRpc<() => Observable<Vec<PeerInfo>>>;587 /**588 * Get a custom set of properties as a JSON object, defined in the chain spec589 **/590 properties: AugmentedRpc<() => Observable<ChainProperties>>;591 /**592 * Remove a reserved peer593 **/594 removeReservedPeer: AugmentedRpc<(peerId: Text | string) => Observable<Text>>;595 /**596 * Returns the list of reserved peers597 **/598 reservedPeers: AugmentedRpc<() => Observable<Vec<Text>>>;599 /**600 * Resets the log filter to Substrate defaults601 **/602 resetLogFilter: AugmentedRpc<() => Observable<Null>>;603 /**604 * Returns the state of the syncing of the node605 **/606 syncState: AugmentedRpc<() => Observable<SyncState>>;607 /**608 * Retrieves the version of the node609 **/610 version: AugmentedRpc<() => Observable<Text>>;611 };612 web3: {613 /**614 * Returns current client version.615 **/616 clientVersion: AugmentedRpc<() => Observable<Text>>;617 /**618 * Returns sha3 of the given data619 **/620 sha3: AugmentedRpc<(data: Bytes | string | Uint8Array) => Observable<H256>>;621 };622 }623}tests/src/interfaces/augment-types.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-types.ts
+++ b/tests/src/interfaces/augment-types.ts
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { EthereumBlock, EthereumLog, EthereumReceipt, EthereumTransactionLegacyTransaction, EvmCoreErrorExitReason, FpRpcTransactionStatus } from './ethereum';
-import type { NftDataStructsAccessMode, NftDataStructsCollection, NftDataStructsCollectionId, NftDataStructsCollectionLimits, NftDataStructsCollectionMode, NftDataStructsCreateItemData, NftDataStructsMetaUpdatePermission, NftDataStructsSchemaVersion, NftDataStructsSponsorshipState, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2 } from './nft';
+import type { NftDataStructsAccessMode, NftDataStructsCollection, NftDataStructsCollectionId, NftDataStructsCollectionLimits, NftDataStructsCollectionMode, NftDataStructsCollectionStats, NftDataStructsCreateItemData, NftDataStructsMetaUpdatePermission, NftDataStructsSchemaVersion, NftDataStructsSponsorshipState, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2 } from './nft';
import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';
import type { BitVec, Bool, Bytes, Data, I128, I16, I256, I32, I64, I8, Json, Null, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
@@ -627,6 +627,7 @@
NftDataStructsCollectionId: NftDataStructsCollectionId;
NftDataStructsCollectionLimits: NftDataStructsCollectionLimits;
NftDataStructsCollectionMode: NftDataStructsCollectionMode;
+ NftDataStructsCollectionStats: NftDataStructsCollectionStats;
NftDataStructsCreateItemData: NftDataStructsCreateItemData;
NftDataStructsMetaUpdatePermission: NftDataStructsMetaUpdatePermission;
NftDataStructsSchemaVersion: NftDataStructsSchemaVersion;
tests/src/interfaces/nft/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/nft/definitions.ts
+++ b/tests/src/interfaces/nft/definitions.ts
@@ -40,6 +40,9 @@
constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
+ collectionById: fun('Get collection by specified id', [collectionParam], 'Option<NftDataStructsCollection>'),
+ collectionStats: fun('Get collection stats', [], 'NftDataStructsCollectionStats'),
+ allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
},
types: {
PalletCommonAccountBasicCrossAccountIdRepr: {
@@ -64,6 +67,11 @@
constOnChainSchema: 'Vec<u8>',
metaUpdatePermission: 'NftDataStructsMetaUpdatePermission',
},
+ NftDataStructsCollectionStats: {
+ created: 'u32',
+ destroyed: 'u32',
+ alive: 'u32',
+ },
NftDataStructsCollectionId: 'u32',
NftDataStructsTokenId: 'u32',
PalletNonfungibleItemData: mkDummy('NftItemData'),
tests/src/interfaces/nft/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/nft/types.ts
+++ b/tests/src/interfaces/nft/types.ts
@@ -48,6 +48,13 @@
readonly dummyCollectionMode: u32;
}
+/** @name NftDataStructsCollectionStats */
+export interface NftDataStructsCollectionStats extends Struct {
+ readonly created: u32;
+ readonly destroyed: u32;
+ readonly alive: u32;
+}
+
/** @name NftDataStructsCreateItemData */
export interface NftDataStructsCreateItemData extends Struct {
readonly dummyCreateItemData: u32;
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -8,7 +8,7 @@
import chaiAsPromised from 'chai-as-promised';
import privateKey from './substrate/privateKey';
import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
-import {createCollectionExpectSuccess, destroyCollectionExpectSuccess, getAdminList, normalizeAccountId} from './util/helpers';
+import {createCollectionExpectSuccess, destroyCollectionExpectSuccess, getAdminList, normalizeAccountId, queryCollectionExpectSuccess} from './util/helpers';
chai.use(chaiAsPromised);
const expect = chai.expect;
@@ -19,7 +19,7 @@
const collectionId = await createCollectionExpectSuccess();
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.deep.eq(alice.address);
// first - add collection admin Bob
const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
@@ -43,7 +43,7 @@
const alice = privateKey('//Alice');
const bob = privateKey('//Bob');
const charlie = privateKey('//Charlie');
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
// first - add collection admin Bob
const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
tests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -18,6 +18,7 @@
removeCollectionSponsorExpectFailure,
normalizeAccountId,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
import {Keyring} from '@polkadot/api';
import {IKeyringPair} from '@polkadot/types/types';
@@ -98,7 +99,7 @@
// Find the collection that never existed
let collectionId = 0;
await usingApi(async (api) => {
- collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ collectionId = await getCreatedCollectionCount(api) + 1;
});
await removeCollectionSponsorExpectFailure(collectionId);
tests/src/removeFromAllowList.test.tsdiffbeforeafterboth--- a/tests/src/removeFromAllowList.test.ts
+++ b/tests/src/removeFromAllowList.test.ts
@@ -37,13 +37,13 @@
});
it('ensure bob is not in allowlist after removal', async () => {
- await usingApi(async () => {
+ await usingApi(async api => {
const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
await enableAllowListExpectSuccess(alice, collectionId);
await addToAllowListExpectSuccess(alice, collectionId, bob.address);
await removeFromAllowListExpectSuccess(alice, collectionId, normalizeAccountId(bob.address));
- expect(await isAllowlisted(collectionId, bob.address)).to.be.false;
+ expect(await isAllowlisted(api, collectionId, bob.address)).to.be.false;
});
});
@@ -104,13 +104,13 @@
});
it('ensure address is not in allowlist after removal', async () => {
- await usingApi(async () => {
+ await usingApi(async api => {
const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
await enableAllowListExpectSuccess(alice, collectionId);
await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
await addToAllowListExpectSuccess(alice, collectionId, charlie.address);
await removeFromAllowListExpectSuccess(bob, collectionId, normalizeAccountId(charlie.address));
- expect(await isAllowlisted(collectionId, charlie.address)).to.be.false;
+ expect(await isAllowlisted(api, collectionId, charlie.address)).to.be.false;
});
});
tests/src/setCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionSponsor.test.ts
+++ b/tests/src/setCollectionSponsor.test.ts
@@ -11,6 +11,7 @@
destroyCollectionExpectSuccess,
setCollectionSponsorExpectFailure,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
import {Keyring} from '@polkadot/api';
import {IKeyringPair} from '@polkadot/types/types';
@@ -77,7 +78,7 @@
// Find the collection that never existed
let collectionId = 0;
await usingApi(async (api) => {
- collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ collectionId = await getCreatedCollectionCount(api) + 1;
});
await setCollectionSponsorExpectFailure(collectionId, bob.address);
tests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth--- a/tests/src/setConstOnChainSchema.test.ts
+++ b/tests/src/setConstOnChainSchema.test.ts
@@ -12,6 +12,8 @@
createCollectionExpectSuccess,
destroyCollectionExpectSuccess,
addCollectionAdminExpectSuccess,
+ queryCollectionExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -37,7 +39,7 @@
it('Run extrinsic with parameters of the collection id, set the scheme', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);
await submitTransactionAsync(alice, setShema);
@@ -47,7 +49,7 @@
it('Collection admin can set the scheme', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);
@@ -60,7 +62,7 @@
const collectionId = await createCollectionExpectSuccess();
const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);
await submitTransactionAsync(alice, setShema);
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.constOnChainSchema.toString()).to.be.eq(shema);
});
});
@@ -71,7 +73,7 @@
it('Set a non-existent collection', async () => {
await usingApi(async (api) => {
// tslint:disable-next-line: radix
- const collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);
await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;
});
@@ -97,7 +99,7 @@
it('Execute method not on behalf of the collection owner', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);
await expect(submitTransactionExpectFailAsync(bob, setShema)).to.be.rejected;
tests/src/setPublicAccessMode.test.tsdiffbeforeafterboth--- a/tests/src/setPublicAccessMode.test.ts
+++ b/tests/src/setPublicAccessMode.test.ts
@@ -19,6 +19,7 @@
enableAllowListExpectSuccess,
normalizeAccountId,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -60,7 +61,7 @@
it('Set a non-existent collection', async () => {
await usingApi(async (api: ApiPromise) => {
// tslint:disable-next-line: radix
- const collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
const tx = api.tx.nft.setPublicAccessMode(collectionId, 'AllowList');
await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
});
tests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth--- a/tests/src/setVariableOnChainSchema.test.ts
+++ b/tests/src/setVariableOnChainSchema.test.ts
@@ -12,6 +12,8 @@
createCollectionExpectSuccess,
destroyCollectionExpectSuccess,
addCollectionAdminExpectSuccess,
+ queryCollectionExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -37,7 +39,7 @@
it('Run extrinsic with parameters of the collection id, set the scheme', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
await submitTransactionAsync(alice, setSchema);
@@ -49,7 +51,7 @@
const collectionId = await createCollectionExpectSuccess();
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
await submitTransactionAsync(alice, setSchema);
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);
});
@@ -61,7 +63,7 @@
it('Run extrinsic with parameters of the collection id, set the scheme', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
@@ -75,7 +77,7 @@
await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
await submitTransactionAsync(bob, setSchema);
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);
});
@@ -87,7 +89,7 @@
it('Set a non-existent collection', async () => {
await usingApi(async (api) => {
// tslint:disable-next-line: radix
- const collectionId = (await api.query.common.createdCollectionCount()).toNumber() + 1;
+ const collectionId = await getCreatedCollectionCount(api) + 1;
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
});
@@ -113,7 +115,7 @@
it('Execute method not on behalf of the collection owner', async () => {
await usingApi(async (api) => {
const collectionId = await createCollectionExpectSuccess();
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.owner.toString()).to.be.eq(alice.address);
const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);
await expect(submitTransactionExpectFailAsync(bob, setSchema)).to.be.rejected;
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -19,6 +19,7 @@
transferExpectFailure,
transferExpectSuccess,
addCollectionAdminExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
let alice: IKeyringPair;
@@ -132,13 +133,13 @@
it('Transfer with not existed collection_id', async () => {
await usingApi(async (api) => {
// nft
- const nftCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const nftCollectionCount = await getCreatedCollectionCount(api);
await transferExpectFailure(nftCollectionCount + 1, 1, alice, bob, 1);
// fungible
- const fungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const fungibleCollectionCount = await getCreatedCollectionCount(api);
await transferExpectFailure(fungibleCollectionCount + 1, 0, alice, bob, 1);
// reFungible
- const reFungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const reFungibleCollectionCount = await getCreatedCollectionCount(api);
await transferExpectFailure(reFungibleCollectionCount + 1, 1, alice, bob, 1);
});
});
tests/src/transferFrom.test.tsdiffbeforeafterboth--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -19,6 +19,7 @@
transferFromExpectSuccess,
burnItemExpectSuccess,
setCollectionLimitsExpectSuccess,
+ getCreatedCollectionCount,
} from './util/helpers';
chai.use(chaiAsPromised);
@@ -109,18 +110,18 @@
it('transferFrom for a collection that does not exist', async () => {
await usingApi(async (api: ApiPromise) => {
// nft
- const nftCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const nftCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);
await transferFromExpectFail(nftCollectionCount + 1, 1, bob, alice, charlie, 1);
// fungible
- const fungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const fungibleCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);
await transferFromExpectFail(fungibleCollectionCount + 1, 0, bob, alice, charlie, 1);
// reFungible
- const reFungibleCollectionCount = (await api.query.common.createdCollectionCount()).toNumber();
+ const reFungibleCollectionCount = await getCreatedCollectionCount(api);
await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);
await transferFromExpectFail(reFungibleCollectionCount + 1, 1, bob, alice, charlie, 1);
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -269,7 +269,7 @@
let collectionId = 0;
await usingApi(async (api) => {
// Get number of collections before the transaction
- const collectionCountBefore = (await api.query.common.createdCollectionCount()).toNumber();
+ const collectionCountBefore = await getCreatedCollectionCount(api);
// Run the CreateCollection transaction
const alicePrivateKey = privateKey('//Alice');
@@ -288,10 +288,10 @@
const result = getCreateCollectionResult(events);
// Get number of collections after the transaction
- const collectionCountAfter = (await api.query.common.createdCollectionCount()).toNumber();
+ const collectionCountAfter = await getCreatedCollectionCount(api);
// Get the collection
- const collection = (await api.query.common.collectionById(result.collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, result.collectionId);
// What to expect
// tslint:disable-next-line:no-unused-expression
@@ -325,7 +325,7 @@
await usingApi(async (api) => {
// Get number of collections before the transaction
- const collectionCountBefore = (await api.query.common.createdCollectionCount()).toNumber();
+ const collectionCountBefore = await getCreatedCollectionCount(api);
// Run the CreateCollection transaction
const alicePrivateKey = privateKey('//Alice');
@@ -334,7 +334,7 @@
const result = getCreateCollectionResult(events);
// Get number of collections after the transaction
- const collectionCountAfter = (await api.query.common.createdCollectionCount()).toNumber();
+ const collectionCountAfter = await getCreatedCollectionCount(api);
// What to expect
// tslint:disable-next-line:no-unused-expression
@@ -364,7 +364,7 @@
}
export async function findNotExistingCollection(api: ApiPromise): Promise<number> {
- const totalNumber = (await api.query.common.createdCollectionCount()).toNumber();
+ const totalNumber = await getCreatedCollectionCount(api);
const newCollection: number = totalNumber + 1;
return newCollection;
}
@@ -398,7 +398,7 @@
expect(result).to.be.true;
// What to expect
- expect((await api.query.common.collectionById(collectionId)).isNone).to.be.true;
+ expect(await getDetailedCollectionInfo(api, collectionId)).to.be.null;
});
}
@@ -432,7 +432,7 @@
const result = getGenericResult(events);
// Get the collection
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
// What to expect
expect(result.success).to.be.true;
@@ -452,7 +452,7 @@
const result = getGenericResult(events);
// Get the collection
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
// What to expect
expect(result.success).to.be.true;
@@ -490,7 +490,7 @@
const result = getGenericResult(events);
// Get the collection
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
// What to expect
expect(result.success).to.be.true;
@@ -1057,7 +1057,7 @@
const result = getGenericResult(events);
// Get the collection
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
// What to expect
// tslint:disable-next-line:no-unused-expression
@@ -1105,7 +1105,7 @@
expect(result.success).to.be.true;
// Get the collection
- const collection = (await api.query.common.collectionById(collectionId)).unwrap();
+ const collection = await queryCollectionExpectSuccess(api, collectionId);
expect(collection.mintMode.toHuman()).to.be.equal(enabled);
});
@@ -1137,15 +1137,13 @@
});
}
-export async function isAllowlisted(collectionId: number, address: string | CrossAccountId) {
- return await usingApi(async (api) => {
- return (await api.query.common.allowlist(collectionId, normalizeAccountId(address))).toJSON();
- });
+export async function isAllowlisted(api: ApiPromise, collectionId: number, address: string | CrossAccountId) {
+ return (await api.rpc.nft.allowed(collectionId, normalizeAccountId(address))).toJSON();
}
export async function addToAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId | CrossAccountId) {
await usingApi(async (api) => {
- expect(await isAllowlisted(collectionId, normalizeAccountId(address))).to.be.false;
+ expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.false;
// Run the transaction
const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(address));
@@ -1153,14 +1151,14 @@
const result = getGenericResult(events);
expect(result.success).to.be.true;
- expect(await isAllowlisted(collectionId, normalizeAccountId(address))).to.be.true;
+ expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;
});
}
export async function addToAllowListAgainExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId) {
await usingApi(async (api) => {
- expect(await isAllowlisted(collectionId, normalizeAccountId(address))).to.be.true;
+ expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;
// Run the transaction
const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(address));
@@ -1168,7 +1166,7 @@
const result = getGenericResult(events);
expect(result.success).to.be.true;
- expect(await isAllowlisted(collectionId, normalizeAccountId(address))).to.be.true;
+ expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;
});
}
@@ -1214,16 +1212,16 @@
export const getDetailedCollectionInfo = async (api: ApiPromise, collectionId: number)
: Promise<NftDataStructsCollection | null> => {
- return (await api.query.common.collectionById(collectionId)).unwrapOr(null);
+ return (await api.rpc.nft.collectionById(collectionId)).unwrapOr(null);
};
export const getCreatedCollectionCount = async (api: ApiPromise): Promise<number> => {
// set global object - collectionsCount
- return (await api.query.common.createdCollectionCount()).toNumber();
+ return (await api.rpc.nft.collectionStats()).created.toNumber();
};
export async function queryCollectionExpectSuccess(api: ApiPromise, collectionId: number): Promise<NftDataStructsCollection> {
- return (await api.query.common.collectionById(collectionId)).unwrap();
+ return (await api.rpc.nft.collectionById(collectionId)).unwrap();
}
export async function waitNewBlocks(blocksCount = 1): Promise<void> {