difftreelog
feat add ApproveFrom eth mirror
in: master
26 files changed
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -746,6 +746,8 @@
ApprovedValueTooLow,
/// Tried to approve more than owned
CantApproveMoreThanOwned,
+ /// Only spending from eth mirror could be approved
+ AddressIsNotEthMirror,
/// Can't transfer tokens to ethereum zero address
AddressIsZero,
@@ -1797,6 +1799,9 @@
/// The price of setting the permission of the operation from another user.
fn approve() -> Weight;
+ /// The price of setting the permission of the operation from another user for eth mirror.
+ fn approve_from() -> Weight;
+
/// Transfer price from another user.
fn transfer_from() -> Weight;
@@ -2008,6 +2013,22 @@
amount: u128,
) -> DispatchResultWithPostInfo;
+ /// Grant access to another account to transfer parts of the token owned by the calling user's eth mirror via [Self::transfer_from].
+ ///
+ /// * `sender` - The user who grants access to the token.
+ /// * `from` - Spender's eth mirror.
+ /// * `to` - The user to whom the rights are granted.
+ /// * `token` - The token to which access is granted.
+ /// * `amount` - The amount of pieces that another user can dispose of.
+ fn approve_from(
+ &self,
+ sender: T::CrossAccountId,
+ from: T::CrossAccountId,
+ to: T::CrossAccountId,
+ token: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo;
+
/// Send parts of a token owned by another user.
///
/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -283,8 +283,8 @@
/// Ethereum representation of Optional value with CrossAddress.
struct OptionCrossAddress {
- /// TODO: field description
+ /// Whether or not this CrossAdress is valid and has meaning.
bool status;
- /// TODO: field description
+ /// The underlying CrossAddress value. If the status is false, can be set to whatever.
CrossAddress value;
}
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -82,6 +82,16 @@
<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}
+ approve_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+
+ };
+ let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+ <Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;
+ }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, 100)?}
+
transfer_from {
bench_init!{
owner: sub; collection: collection(owner);
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -87,6 +87,10 @@
<SelfWeightOf<T>>::approve()
}
+ fn approve_from() -> Weight {
+ <SelfWeightOf<T>>::approve_from()
+ }
+
fn transfer_from() -> Weight {
<SelfWeightOf<T>>::transfer_from()
}
@@ -254,6 +258,25 @@
)
}
+ fn approve_from(
+ &self,
+ sender: T::CrossAccountId,
+ from: T::CrossAccountId,
+ to: T::CrossAccountId,
+ token: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo {
+ ensure!(
+ token == TokenId::default(),
+ <Error<T>>::FungibleItemsHaveNoId
+ );
+
+ with_weight(
+ <Pallet<T>>::set_allowance_for(self, &sender, &from, &to, amount),
+ <CommonWeights<T>>::approve_from(),
+ )
+ }
+
fn transfer_from(
&self,
sender: T::CrossAccountId,
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -613,6 +613,45 @@
Ok(())
}
+ /// Set allowance for the spender to `transfer` or `burn` owner's tokens from eth mirror.
+ ///
+ /// - `collection`: Collection that contains the token
+ /// - `sender`: Owner of tokens that sets the allowance.
+ /// - `from`: Owner's eth mirror.
+ /// - `to`: Recipient of the allowance rights.
+ /// - `amount`: Amount of tokens the spender is allowed to `transfer` or `burn`.
+ pub fn set_allowance_for(
+ collection: &FungibleHandle<T>,
+ sender: &T::CrossAccountId,
+ from: &T::CrossAccountId,
+ to: &T::CrossAccountId,
+ amount: u128,
+ ) -> DispatchResult {
+ if collection.permissions.access() == AccessMode::AllowList {
+ collection.check_allowlist(sender)?;
+ collection.check_allowlist(from)?;
+ collection.check_allowlist(to)?;
+ }
+
+ ensure!(
+ *sender.as_eth() == *from.as_eth(),
+ <CommonError<T>>::AddressIsNotEthMirror
+ );
+
+ if <Balance<T>>::get((collection.id, from)) < amount {
+ ensure!(
+ collection.limits.owner_can_transfer()
+ && (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from)),
+ <CommonError<T>>::CantApproveMoreThanOwned
+ );
+ }
+
+ // =========
+
+ Self::set_allowance_unchecked(collection, from, to, amount);
+ Ok(())
+ }
+
/// Checks if a non-owner has (enough) allowance from the owner to perform operations on the tokens.
/// Returns the expected remaining allowance - it should be set manually if the transaction proceeds.
///
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -39,6 +39,7 @@
fn burn_item() -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
+ fn approve_from() -> Weight;
fn transfer_from() -> Weight;
fn burn_from() -> Weight;
}
@@ -84,6 +85,13 @@
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
+ // Storage: Fungible Balance (r:1 w:0)
+ // Storage: Fungible Allowance (r:0 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(19_817_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
// Storage: Fungible Allowance (r:1 w:1)
// Storage: Fungible Balance (r:2 w:2)
fn transfer_from() -> Weight {
@@ -141,6 +149,13 @@
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
+ // Storage: Fungible Balance (r:1 w:0)
+ // Storage: Fungible Allowance (r:0 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(19_817_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
// Storage: Fungible Allowance (r:1 w:1)
// Storage: Fungible Balance (r:2 w:2)
fn transfer_from() -> Weight {
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -134,6 +134,15 @@
let item = create_max_item(&collection, &owner, sender.clone())?;
}: {<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?}
+ approve_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+ };
+ let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+ let item = create_max_item(&collection, &owner, owner_eth.clone())?;
+ }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, item, Some(&spender))?}
+
transfer_from {
bench_init!{
owner: sub; collection: collection(owner);
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -102,6 +102,10 @@
<SelfWeightOf<T>>::approve()
}
+ fn approve_from() -> Weight {
+ <SelfWeightOf<T>>::approve_from()
+ }
+
fn transfer_from() -> Weight {
<SelfWeightOf<T>>::transfer_from()
}
@@ -353,6 +357,26 @@
)
}
+ fn approve_from(
+ &self,
+ sender: T::CrossAccountId,
+ from: T::CrossAccountId,
+ to: T::CrossAccountId,
+ token: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo {
+ ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
+
+ with_weight(
+ if amount == 1 {
+ <Pallet<T>>::set_allowance_for(self, &sender, &from, token, Some(&to))
+ } else {
+ <Pallet<T>>::set_allowance_for(self, &sender, &from, token, None)
+ },
+ <CommonWeights<T>>::approve_from(),
+ )
+ }
+
fn transfer_from(
&self,
sender: T::CrossAccountId,
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1171,6 +1171,51 @@
Ok(())
}
+ /// Set allowance for the spender to `transfer` or `burn` sender's token from eth mirror.
+ ///
+ /// - `from`: Address of sender's eth mirror.
+ /// - `to`: Adress of spender.
+ /// - `token`: Token the spender is allowed to `transfer` or `burn`.
+ pub fn set_allowance_for(
+ collection: &NonfungibleHandle<T>,
+ sender: &T::CrossAccountId,
+ from: &T::CrossAccountId,
+ token: TokenId,
+ to: Option<&T::CrossAccountId>,
+ ) -> DispatchResult {
+ if collection.permissions.access() == AccessMode::AllowList {
+ collection.check_allowlist(sender)?;
+ collection.check_allowlist(from)?;
+ if let Some(to) = to {
+ collection.check_allowlist(to)?;
+ }
+ }
+
+ if let Some(to) = to {
+ <PalletCommon<T>>::ensure_correct_receiver(to)?;
+ }
+
+ ensure!(
+ *sender.as_eth() == *from.as_eth(),
+ <CommonError<T>>::AddressIsNotEthMirror
+ );
+
+ let token_data =
+ <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
+ if token_data.owner != *from {
+ ensure!(
+ collection.limits.owner_can_transfer()
+ && (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from)),
+ <CommonError<T>>::CantApproveMoreThanOwned
+ );
+ }
+
+ // =========
+
+ Self::set_allowance_unchecked(collection, from, token, to, false);
+ Ok(())
+ }
+
/// Checks allowance for the spender to use the token.
fn check_allowed(
collection: &NonfungibleHandle<T>,
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -42,6 +42,7 @@
fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;
fn transfer() -> Weight;
fn approve() -> Weight;
+ fn approve_from() -> Weight;
fn transfer_from() -> Weight;
fn burn_from() -> Weight;
fn set_token_property_permissions(b: u32, ) -> Weight;
@@ -147,6 +148,13 @@
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible Allowance (r:1 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(18_965_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
// Storage: Nonfungible Allowance (r:1 w:1)
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
@@ -310,6 +318,13 @@
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
+ // Storage: Nonfungible TokenData (r:1 w:0)
+ // Storage: Nonfungible Allowance (r:1 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(18_965_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(2 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
// Storage: Nonfungible Allowance (r:1 w:1)
// Storage: Nonfungible TokenData (r:1 w:1)
// Storage: Nonfungible AccountBalance (r:2 w:2)
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -163,6 +163,15 @@
let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?}
+ approve_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+ };
+ let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+ let item = create_max_item(&collection, &owner, [(owner_eth.clone(), 200)])?;
+ }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, item, 100)?}
+
transfer_from_normal {
bench_init!{
owner: sub; collection: collection(owner);
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -127,6 +127,10 @@
<SelfWeightOf<T>>::approve()
}
+ fn approve_from() -> Weight {
+ <SelfWeightOf<T>>::approve_from()
+ }
+
fn transfer_from() -> Weight {
max_weight_of!(
transfer_from_normal(),
@@ -314,6 +318,20 @@
)
}
+ fn approve_from(
+ &self,
+ sender: T::CrossAccountId,
+ from: T::CrossAccountId,
+ to: T::CrossAccountId,
+ token_id: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo {
+ with_weight(
+ <Pallet<T>>::set_allowance_for(self, &sender, &from, &to, token_id, amount),
+ <CommonWeights<T>>::approve_from(),
+ )
+ }
+
fn transfer_from(
&self,
sender: T::CrossAccountId,
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -1102,6 +1102,47 @@
Ok(())
}
+ /// Set allowance to spend from sender's eth mirror
+ ///
+ /// - `from`: Address of sender's eth mirror.
+ /// - `to`: Adress of spender.
+ /// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.
+ pub fn set_allowance_for(
+ collection: &RefungibleHandle<T>,
+ sender: &T::CrossAccountId,
+ from: &T::CrossAccountId,
+ to: &T::CrossAccountId,
+ token_id: TokenId,
+ amount: u128,
+ ) -> DispatchResult {
+ if collection.permissions.access() == AccessMode::AllowList {
+ collection.check_allowlist(sender)?;
+ collection.check_allowlist(from)?;
+ collection.check_allowlist(to)?;
+ }
+
+ <PalletCommon<T>>::ensure_correct_receiver(to)?;
+
+ ensure!(
+ *sender.as_eth() == *from.as_eth(),
+ <CommonError<T>>::AddressIsNotEthMirror
+ );
+
+ if <Balance<T>>::get((collection.id, token_id, from)) < amount {
+ ensure!(
+ collection.limits.owner_can_transfer()
+ && (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from))
+ && Self::token_exists(collection, token_id),
+ <CommonError<T>>::CantApproveMoreThanOwned
+ );
+ }
+
+ // =========
+
+ Self::set_allowance_unchecked(collection, from, to, token_id, amount);
+ Ok(())
+ }
+
/// Returns allowance, which should be set after transaction
fn check_allowed(
collection: &RefungibleHandle<T>,
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -45,6 +45,7 @@
fn transfer_removing() -> Weight;
fn transfer_creating_removing() -> Weight;
fn approve() -> Weight;
+ fn approve_from() -> Weight;
fn transfer_from_normal() -> Weight;
fn transfer_from_creating() -> Weight;
fn transfer_from_removing() -> Weight;
@@ -175,6 +176,13 @@
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
+ // Storage: Refungible Balance (r:1 w:0)
+ // Storage: Refungible Allowance (r:0 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(20_649_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
// Storage: Refungible Allowance (r:1 w:1)
// Storage: Refungible CollectionAllowance (r:1 w:0)
// Storage: Refungible Balance (r:2 w:2)
@@ -400,6 +408,13 @@
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
+ // Storage: Refungible Balance (r:1 w:0)
+ // Storage: Refungible Allowance (r:0 w:1)
+ fn approve_from() -> Weight {
+ Weight::from_ref_time(20_649_000 as u64)
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64))
+ }
// Storage: Refungible Allowance (r:1 w:1)
// Storage: Refungible CollectionAllowance (r:1 w:0)
// Storage: Refungible Balance (r:2 w:2)
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -851,6 +851,29 @@
dispatch_tx::<T, _>(collection_id, |d| d.approve(sender, spender, item_id, amount))
}
+ /// Allow a non-permissioned address to transfer or burn an item from owner's eth mirror.
+ ///
+ /// # Permissions
+ ///
+ /// * Collection owner
+ /// * Collection admin
+ /// * Current item owner
+ ///
+ /// # Arguments
+ ///
+ /// * `from`: Owner's account eth mirror
+ /// * `to`: Account to be approved to make specific transactions on non-owned tokens.
+ /// * `collection_id`: ID of the collection the item belongs to.
+ /// * `item_id`: ID of the item transactions on which are now approved.
+ /// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
+ /// Set to 0 to revoke the approval.
+ #[weight = T::CommonWeightInfo::approve_from()]
+ pub fn approve_from(origin, from:T::CrossAccountId, to: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
+ let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+ dispatch_tx::<T, _>(collection_id, |d| d.approve_from(sender, from, to, item_id, amount))
+ }
+
/// Change ownership of an item on behalf of the owner as a non-owner account.
///
/// See the [`approve`][`Pallet::approve`] method for additional information.
runtime/common/identity.rsdiffbeforeafterboth--- a/runtime/common/identity.rs
+++ b/runtime/common/identity.rs
@@ -21,9 +21,7 @@
use sp_runtime::{
traits::{DispatchInfoOf, SignedExtension},
- transaction_validity::{
- TransactionValidity, ValidTransaction, InvalidTransaction, TransactionValidityError,
- },
+ transaction_validity::{TransactionValidity, ValidTransaction, TransactionValidityError},
};
#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
runtime/common/weights.rsdiffbeforeafterboth--- a/runtime/common/weights.rs
+++ b/runtime/common/weights.rs
@@ -101,6 +101,10 @@
dispatch_weight::<T>() + max_weight_of!(approve())
}
+ fn approve_from() -> Weight {
+ dispatch_weight::<T>() + max_weight_of!(approve_from())
+ }
+
fn transfer_from() -> Weight {
dispatch_weight::<T>() + max_weight_of!(transfer_from())
}
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -16,336 +16,521 @@
import {IKeyringPair} from '@polkadot/types/types';
import {expect, itSub, Pallets, usingPlaygrounds} from './util';
+import {CrossAccountId} from './util/playgrounds/unique';
+
-describe('Integration Test approve(spender, collection_id, item_id, amount):', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
+[
+ {method: 'approveToken', account: (account: IKeyringPair) => CrossAccountId.fromKeyring(account)},
+ {method: 'approveTokenFromEth', account: (account: IKeyringPair) => CrossAccountId.fromKeyring(account).toEthereum()},
+].map(testCase => {
+ describe(`Integration Test ${testCase.method}(spender, collection_id, item_id, amount):`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
});
- });
- itSub('[nft] Execute the extrinsic and check approvedList', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
- });
+ itSub('[nft] Execute the extrinsic and check approvedList', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+ await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+ });
+
+ itSub('[fungible] Execute the extrinsic and check approvedList', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amount).to.be.equal(BigInt(1));
+ });
+
+ itSub.ifWithPallets('[refungible] Execute the extrinsic and check approvedList', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+ await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amount).to.be.equal(BigInt(1));
+ });
+
+ itSub('[nft] Remove approval by using 0 amount', async ({helper}) => {
+ const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const collectionId = collection.collectionId;
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+ await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+ await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
+ });
- itSub('[fungible] Execute the extrinsic and check approvedList', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, {Substrate: alice.address});
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amount).to.be.equal(BigInt(1));
- });
+ itSub('[fungible] Remove approval by using 0 amount', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountBefore).to.be.equal(BigInt(1));
- itSub.ifWithPallets('[refungible] Execute the extrinsic and check approvedList', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amount).to.be.equal(BigInt(1));
- });
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountAfter).to.be.equal(BigInt(0));
+ });
- itSub('[nft] Remove approval by using 0 amount', async ({helper}) => {
- const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const collectionId = collection.collectionId;
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
- await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
- });
+ itSub.ifWithPallets('[refungible] Remove approval by using 0 amount', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+ await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountBefore).to.be.equal(BigInt(1));
- itSub('[fungible] Remove approval by using 0 amount', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, {Substrate: alice.address});
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountBefore).to.be.equal(BigInt(1));
+ await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountAfter).to.be.equal(BigInt(0));
+ });
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
- const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountAfter).to.be.equal(BigInt(0));
+ itSub('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ const result = (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: charlie.address});
+ await expect(result).to.be.rejected;
+ });
});
- itSub.ifWithPallets('[refungible] Remove approval by using 0 amount', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountBefore).to.be.equal(BigInt(1));
+ describe(`[${testCase.method}] Normal user can approve other users to transfer:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
- await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
- const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountAfter).to.be.equal(BigInt(0));
- });
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
- itSub('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const approveTokenTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
- await expect(approveTokenTx()).to.be.rejected;
- });
-});
+ itSub('NFT', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.true;
+ });
-describe('Normal user can approve other users to transfer:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
+ itSub('Fungible up to an approved amount', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, testCase.account(bob));
+ expect(amount).to.be.equal(BigInt(1));
+ });
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+ await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
+ const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, testCase.account(bob));
+ expect(amount).to.be.equal(BigInt(100n));
});
});
- itSub('NFT', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.true;
- });
+ describe(`[${testCase.method}] Approved users can transferFrom up to approved amount:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
- itSub('Fungible up to an approved amount', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});
- expect(amount).to.be.equal(BigInt(1));
- });
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
- itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
- await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
- const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});
- expect(amount).to.be.equal(BigInt(100n));
+ itSub('NFT', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+ const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
+ expect(owner.Substrate).to.be.equal(alice.address);
+ });
+
+ itSub('Fungible up to an approved amount', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+ await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+ const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+ expect(after - before).to.be.equal(BigInt(1));
+ });
+
+ itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+ await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+ await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+ const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+ expect(after - before).to.be.equal(BigInt(1));
+ });
});
-});
-describe('Approved users can transferFrom up to approved amount:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
+ describe(`[${testCase.method}] Approved users cannot use transferFrom to repeat transfers if approved amount was already transferred:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
+
+ itSub('NFT', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+ const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
+ expect(owner.Substrate).to.be.equal(alice.address);
+ const transferTokenFromTx = () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+ await expect(transferTokenFromTx()).to.be.rejected;
+ });
+
+ itSub('Fungible up to an approved amount', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+ await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+ const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+ expect(after - before).to.be.equal(BigInt(1));
+
+ const transferTokenFromTx = () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+ await expect(transferTokenFromTx()).to.be.rejected;
+ });
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+ await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
+ const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+ await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 100n);
+ const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+ expect(after - before).to.be.equal(BigInt(100));
+ const transferTokenFromTx = () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 100n);
+ await expect(transferTokenFromTx()).to.be.rejected;
});
});
- itSub('NFT', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
- expect(owner.Substrate).to.be.equal(alice.address);
+ describe(`[${testCase.method}] Approved amount decreases by the transferred amount:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+ let dave: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
+ });
+ });
+
+ itSub('If a user B is approved to transfer 10 Fungible tokens from user A, they can transfer 2 tokens to user C, which will result in decreasing approval from 10 to 8. Then user B can transfer 8 tokens to user D.', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
+
+ const charlieBefore = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
+ await helper.ft.transferTokenFrom(bob, collectionId, tokenId, testCase.account(alice), {Substrate: charlie.address}, 2n);
+ const charlieAfter = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
+ expect(charlieAfter - charlieBefore).to.be.equal(BigInt(2));
+
+ const daveBefore = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
+ await helper.ft.transferTokenFrom(bob, collectionId, tokenId, testCase.account(alice), {Substrate: dave.address}, 8n);
+ const daveAfter = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
+ expect(daveAfter - daveBefore).to.be.equal(BigInt(8));
+ });
});
- itSub('Fungible up to an approved amount', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
- await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
- const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
- expect(after - before).to.be.equal(BigInt(1));
+ describe(`[${testCase.method}] User may clear the approvals to approving for 0 amount:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
+
+ itSub('NFT', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+ await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+ await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
+ const transferTokenFromTx = () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
+ await expect(transferTokenFromTx()).to.be.rejected;
+ });
+
+ itSub('Fungible', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountBefore).to.be.equal(BigInt(1));
+
+ await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountAfter).to.be.equal(BigInt(0));
+
+ const transferTokenFromTx = () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
+ await expect(transferTokenFromTx()).to.be.rejected;
+ });
+
+ itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+ await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+ const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountBefore).to.be.equal(BigInt(1));
+
+ await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+ const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+ expect(amountAfter).to.be.equal(BigInt(0));
+
+ const transferTokenFromTx = () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
+ await expect(transferTokenFromTx()).to.be.rejected;
+ });
});
- itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
- await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
- await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
- const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
- expect(after - before).to.be.equal(BigInt(1));
+ describe(`[${testCase.method}] User cannot approve for the amount greater than they own:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
+
+ itSub('1 for NFT', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ const result = (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 2n);
+ await expect(result).to.be.rejected;
+ expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
+ });
+
+ itSub('Fungible', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ const result = (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
+ await expect(result).to.be.rejected;
+ });
+
+ itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+ const result = (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
+ await expect(result).to.be.rejected;
+ });
});
-});
-describe('Approved users cannot use transferFrom to repeat transfers if approved amount was already transferred:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
+ describe(`[${testCase.method}] Integration Test approve(spender, collection_id, item_id, amount) with collection admin permissions:`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ itSub('can be called by collection admin on non-owned item', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+ await helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
+ const result = (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+ await expect(result).to.be.rejected;
});
});
- itSub('NFT', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
- expect(owner.Substrate).to.be.equal(alice.address);
- const transferTokenFromTx = () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- await expect(transferTokenFromTx()).to.be.rejected;
- });
+ describe(`[${testCase.method}] Negative Integration Test approve(spender, collection_id, item_id, amount):`, () => {
+ let alice: IKeyringPair;
+ let bob: IKeyringPair;
+ let charlie: IKeyringPair;
- itSub('Fungible up to an approved amount', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
- await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
- const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
- expect(after - before).to.be.equal(BigInt(1));
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ const donor = await privateKey({filename: __filename});
+ [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ });
+ });
- const transferTokenFromTx = () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
- await expect(transferTokenFromTx()).to.be.rejected;
- });
+ itSub('[nft] Approve for a collection that does not exist', async ({helper}) => {
+ const collectionId = 1 << 32 - 1;
+ await expect((helper.nft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address})).to.be.rejected;
+ });
+
+ itSub('[fungible] Approve for a collection that does not exist', async ({helper}) => {
+ const collectionId = 1 << 32 - 1;
+ const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
- await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
- const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
- await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
- const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
- expect(after - before).to.be.equal(BigInt(100));
- const transferTokenFromTx = () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
- await expect(transferTokenFromTx()).to.be.rejected;
- });
-});
+ itSub.ifWithPallets('[refungible] Approve for a collection that does not exist', [Pallets.ReFungible], async ({helper}) => {
+ const collectionId = 1 << 32 - 1;
+ const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address});
+ await expect(approveTx()).to.be.rejected;
+ });
-describe('Approved amount decreases by the transferred amount:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
- let dave: IKeyringPair;
+ itSub('[nft] Approve for a collection that was destroyed', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ await helper.nft.burn(alice, collectionId);
+ const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
+ itSub('[fungible] Approve for a collection that was destroyed', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ await helper.ft.burn(alice, collectionId);
+ const approveTx = () => (helper.ft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+ await expect(approveTx()).to.be.rejected;
});
- });
- itSub('If a user B is approved to transfer 10 Fungible tokens from user A, they can transfer 2 tokens to user C, which will result in decreasing approval from 10 to 8. Then user B can transfer 8 tokens to user D.', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
+ itSub.ifWithPallets('[refungible] Approve for a collection that was destroyed', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ await helper.rft.burn(alice, collectionId);
+ const approveTx = () => (helper.rft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- const charlieBefore = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
- await helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: alice.address}, {Substrate: charlie.address}, 2n);
- const charlieAfter = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
- expect(charlieAfter - charlieBefore).to.be.equal(BigInt(2));
+ itSub('[nft] Approve transfer of a token that does not exist', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, 2, {Substrate: bob.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- const daveBefore = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
- await helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: alice.address}, {Substrate: dave.address}, 8n);
- const daveAfter = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
- expect(daveAfter - daveBefore).to.be.equal(BigInt(8));
- });
-});
+ itSub.ifWithPallets('[refungible] Approve transfer of a token that does not exist', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const approveTx = () => (helper.rft as any)[testCase.method](alice, collectionId, 2, {Substrate: bob.address});
+ await expect(approveTx()).to.be.rejected;
+ });
-describe('User may clear the approvals to approving for 0 amount:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
+ itSub('[nft] Approve using the address that does not own the approved token', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+ const approveTx = () => (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ itSub('[fungible] Approve using the address that does not own the approved token', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
+ const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+ await expect(approveTx()).to.be.rejected;
});
- });
- itSub('NFT', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
- await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
- const transferTokenFromTx = () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
- await expect(transferTokenFromTx()).to.be.rejected;
- });
+ itSub.ifWithPallets('[refungible] Approve using the address that does not own the approved token', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+ const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+ await expect(approveTx()).to.be.rejected;
+ });
- itSub('Fungible', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountBefore).to.be.equal(BigInt(1));
+ itSub.ifWithPallets('should fail if approved more ReFungibles than owned', [Pallets.ReFungible], async ({helper}) => {
+ const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
+ await helper.rft.transferToken(alice, collectionId, tokenId, testCase.account(bob), 100n);
+ await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 100n);
- await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
- const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountAfter).to.be.equal(BigInt(0));
+ const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
+ await expect(approveTx()).to.be.rejected;
+ });
- const transferTokenFromTx = () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
- await expect(transferTokenFromTx()).to.be.rejected;
- });
+ itSub('should fail if approved more Fungibles than owned', async ({helper}) => {
+ const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
+ const tokenId = await helper.ft.getLastTokenId(collectionId);
- itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
- const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountBefore).to.be.equal(BigInt(1));
+ await helper.ft.transferToken(alice, collectionId, tokenId, testCase.account(bob), 10n);
+ await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 10n);
+ const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
+ await expect(approveTx()).to.be.rejected;
+ });
- await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
- const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
- expect(amountAfter).to.be.equal(BigInt(0));
+ itSub('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
+ const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+ const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+ await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: false});
- const transferTokenFromTx = () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
- await expect(transferTokenFromTx()).to.be.rejected;
+ const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: charlie.address});
+ await expect(approveTx()).to.be.rejected;
+ });
});
});
-describe('User cannot approve for the amount greater than they own:', () => {
+describe('Normal user can approve other users to be wallet operator:', () => {
let alice: IKeyringPair;
let bob: IKeyringPair;
- let charlie: IKeyringPair;
before(async () => {
await usingPlaygrounds(async (helper, privateKey) => {
const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+ [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
});
});
- itSub('1 for NFT', async ({helper}) => {
+ itSub('[nft] Enable and disable approval', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const approveTx = () => helper.signTransaction(bob, helper.constructApiCall('api.tx.unique.approve', [{Substrate: charlie.address}, collectionId, tokenId, 2]));
- await expect(approveTx()).to.be.rejected;
- expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
- });
- itSub('Fungible', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- const approveTx = () => helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
- await expect(approveTx()).to.be.rejected;
+ const checkBeforeApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkBeforeApproval).to.be.false;
+
+ await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
+ const checkAfterApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkAfterApproval).to.be.true;
+
+ await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
+ const checkAfterDisapproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkAfterDisapproval).to.be.false;
});
- itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+ itSub.ifWithPallets('[rft] Enable and disable approval', [Pallets.ReFungible], async ({helper}) => {
const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- const approveTx = () => helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
- await expect(approveTx()).to.be.rejected;
+
+ const checkBeforeApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkBeforeApproval).to.be.false;
+
+ await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
+ const checkAfterApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkAfterApproval).to.be.true;
+
+ await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
+ const checkAfterDisapproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+ expect(checkAfterDisapproval).to.be.false;
});
});
@@ -464,184 +649,5 @@
await token.approve(dave, {Substrate: bob.address}, 50n);
await expect(token.approve(dave, {Substrate: charlie.address}, 51n))
.to.be.rejectedWith('this test would fail (since it is skipped), replace this expecting message with what would have been received');
- });
-});
-
-describe('Integration Test approve(spender, collection_id, item_id, amount) with collection admin permissions:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
- });
- });
-
- itSub('can be called by collection admin on non-owned item', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- await helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
- const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
- await expect(approveTx()).to.be.rejected;
- });
-});
-
-describe('Negative Integration Test approve(spender, collection_id, item_id, amount):', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
- let charlie: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
- });
- });
-
- itSub('[nft] Approve for a collection that does not exist', async ({helper}) => {
- const collectionId = 1 << 32 - 1;
- const approveTx = () => helper.nft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[fungible] Approve for a collection that does not exist', async ({helper}) => {
- const collectionId = 1 << 32 - 1;
- const approveTx = () => helper.ft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub.ifWithPallets('[refungible] Approve for a collection that does not exist', [Pallets.ReFungible], async ({helper}) => {
- const collectionId = 1 << 32 - 1;
- const approveTx = () => helper.rft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[nft] Approve for a collection that was destroyed', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- await helper.nft.burn(alice, collectionId);
- const approveTx = () => helper.nft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[fungible] Approve for a collection that was destroyed', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- await helper.ft.burn(alice, collectionId);
- const approveTx = () => helper.ft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub.ifWithPallets('[refungible] Approve for a collection that was destroyed', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- await helper.rft.burn(alice, collectionId);
- const approveTx = () => helper.rft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[nft] Approve transfer of a token that does not exist', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const approveTx = () => helper.nft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub.ifWithPallets('[refungible] Approve transfer of a token that does not exist', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const approveTx = () => helper.rft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[nft] Approve using the address that does not own the approved token', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('[fungible] Approve using the address that does not own the approved token', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
- const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub.ifWithPallets('[refungible] Approve using the address that does not own the approved token', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub.ifWithPallets('should fail if approved more ReFungibles than owned', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- await helper.rft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 100n);
- await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 100n);
-
- const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('should fail if approved more Fungibles than owned', async ({helper}) => {
- const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
- const tokenId = await helper.ft.getLastTokenId(collectionId);
-
- await helper.ft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
- await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 10n);
- const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
- await expect(approveTx()).to.be.rejected;
- });
-
- itSub('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: false});
-
- const approveTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
- await expect(approveTx()).to.be.rejected;
- });
-});
-
-describe('Normal user can approve other users to be wallet operator:', () => {
- let alice: IKeyringPair;
- let bob: IKeyringPair;
-
- before(async () => {
- await usingPlaygrounds(async (helper, privateKey) => {
- const donor = await privateKey({filename: __filename});
- [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
- });
- });
-
- itSub('[nft] Enable and disable approval', async ({helper}) => {
- const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-
- const checkBeforeApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkBeforeApproval).to.be.false;
-
- await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
- const checkAfterApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkAfterApproval).to.be.true;
-
- await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
- const checkAfterDisapproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkAfterDisapproval).to.be.false;
- });
-
- itSub.ifWithPallets('[rft] Enable and disable approval', [Pallets.ReFungible], async ({helper}) => {
- const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-
- const checkBeforeApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkBeforeApproval).to.be.false;
-
- await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
- const checkAfterApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkAfterApproval).to.be.true;
-
- await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
- const checkAfterDisapproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
- expect(checkAfterDisapproval).to.be.false;
});
});
tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -183,9 +183,9 @@
/// Ethereum representation of Optional value with CrossAddress.
struct OptionCrossAddress {
- /// TODO: field description
+ /// Whether or not this CrossAdress is valid and has meaning.
bool status;
- /// TODO: field description
+ /// The underlying CrossAddress value. If the status is false, can be set to whatever.
CrossAddress value;
}
tests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -85,6 +85,10 @@
**/
AccountTokenLimitExceeded: AugmentedError<ApiType>;
/**
+ * Only spending from eth mirror could be approved
+ **/
+ AddressIsNotEthMirror: AugmentedError<ApiType>;
+ /**
* Can't transfer tokens to ethereum zero address
**/
AddressIsZero: AugmentedError<ApiType>;
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit2/* eslint-disable */34// import type lookup before we augment - in some environments5// this is required to allow for ambient/previous definitions6import '@polkadot/api-base/types/submittable';78import type { ApiTypes, AugmentedSubmittable, SubmittableExtrinsic, SubmittableExtrinsicFunction } from '@polkadot/api-base/types';9import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';10import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';11import type { AccountId32, Call, H160, H256, MultiAddress, Permill } from '@polkadot/types/interfaces/runtime';12import type { CumulusPrimitivesParachainInherentParachainInherentData, EthereumLog, EthereumTransactionTransactionV2, OrmlVestingVestingSchedule, PalletConfigurationAppPromotionConfiguration, PalletEvmAccountBasicCrossAccountIdRepr, PalletForeignAssetsAssetIds, PalletForeignAssetsModuleAssetMetadata, RmrkTraitsNftAccountIdOrCollectionNftTuple, RmrkTraitsPartEquippableList, RmrkTraitsPartPartType, RmrkTraitsResourceBasicResource, RmrkTraitsResourceComposableResource, RmrkTraitsResourceResourceTypes, RmrkTraitsResourceSlotResource, RmrkTraitsTheme, SpWeightsWeightV2Weight, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionPermissions, UpDataStructsCreateCollectionData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsProperty, UpDataStructsPropertyKeyPermission, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';1314export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;15export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrinsic<ApiType>;16export type __SubmittableExtrinsicFunction<ApiType extends ApiTypes> = SubmittableExtrinsicFunction<ApiType>;1718declare module '@polkadot/api-base/types/submittable' {19 interface AugmentedSubmittables<ApiType extends ApiTypes> {20 appPromotion: {21 /**22 * Recalculates interest for the specified number of stakers.23 * If all stakers are not recalculated, the next call of the extrinsic24 * will continue the recalculation, from those stakers for whom this25 * was not perform in last call.26 * 27 * # Permissions28 * 29 * * Pallet admin30 * 31 * # Arguments32 * 33 * * `stakers_number`: the number of stakers for which recalculation will be performed34 **/35 payoutStakers: AugmentedSubmittable<(stakersNumber: Option<u8> | null | Uint8Array | u8 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u8>]>;36 /**37 * Sets an address as the the admin.38 * 39 * # Permissions40 * 41 * * Sudo42 * 43 * # Arguments44 * 45 * * `admin`: account of the new admin.46 **/47 setAdminAddress: AugmentedSubmittable<(admin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr]>;48 /**49 * Sets the pallet to be the sponsor for the collection.50 * 51 * # Permissions52 * 53 * * Pallet admin54 * 55 * # Arguments56 * 57 * * `collection_id`: ID of the collection that will be sponsored by `pallet_id`58 **/59 sponsorCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;60 /**61 * Sets the pallet to be the sponsor for the contract.62 * 63 * # Permissions64 * 65 * * Pallet admin66 * 67 * # Arguments68 * 69 * * `contract_id`: the contract address that will be sponsored by `pallet_id`70 **/71 sponsorContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;72 /**73 * Stakes the amount of native tokens.74 * Sets `amount` to the locked state.75 * The maximum number of stakes for a staker is 10.76 * 77 * # Arguments78 * 79 * * `amount`: in native tokens.80 **/81 stake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;82 /**83 * Removes the pallet as the sponsor for the collection.84 * Returns [`NoPermission`][`Error::NoPermission`]85 * if the pallet wasn't the sponsor.86 * 87 * # Permissions88 * 89 * * Pallet admin90 * 91 * # Arguments92 * 93 * * `collection_id`: ID of the collection that is sponsored by `pallet_id`94 **/95 stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;96 /**97 * Removes the pallet as the sponsor for the contract.98 * Returns [`NoPermission`][`Error::NoPermission`]99 * if the pallet wasn't the sponsor.100 * 101 * # Permissions102 * 103 * * Pallet admin104 * 105 * # Arguments106 * 107 * * `contract_id`: the contract address that is sponsored by `pallet_id`108 **/109 stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;110 /**111 * Unstakes all stakes.112 * Moves the sum of all stakes to the `reserved` state.113 * After the end of `PendingInterval` this sum becomes completely114 * free for further use.115 **/116 unstake: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;117 /**118 * Generic tx119 **/120 [key: string]: SubmittableExtrinsicFunction<ApiType>;121 };122 balances: {123 /**124 * Exactly as `transfer`, except the origin must be root and the source account may be125 * specified.126 * # <weight>127 * - Same as transfer, but additional read and write because the source account is not128 * assumed to be in the overlay.129 * # </weight>130 **/131 forceTransfer: AugmentedSubmittable<(source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, MultiAddress, Compact<u128>]>;132 /**133 * Unreserve some balance from a user by force.134 * 135 * Can only be called by ROOT.136 **/137 forceUnreserve: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, u128]>;138 /**139 * Set the balances of a given account.140 * 141 * This will alter `FreeBalance` and `ReservedBalance` in storage. it will142 * also alter the total issuance of the system (`TotalIssuance`) appropriately.143 * If the new free or reserved balance is below the existential deposit,144 * it will reset the account nonce (`frame_system::AccountNonce`).145 * 146 * The dispatch origin for this call is `root`.147 **/148 setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, Compact<u128>]>;149 /**150 * Transfer some liquid free balance to another account.151 * 152 * `transfer` will set the `FreeBalance` of the sender and receiver.153 * If the sender's account is below the existential deposit as a result154 * of the transfer, the account will be reaped.155 * 156 * The dispatch origin for this call must be `Signed` by the transactor.157 * 158 * # <weight>159 * - Dependent on arguments but not critical, given proper implementations for input config160 * types. See related functions below.161 * - It contains a limited number of reads and writes internally and no complex162 * computation.163 * 164 * Related functions:165 * 166 * - `ensure_can_withdraw` is always called internally but has a bounded complexity.167 * - Transferring balances to accounts that did not exist before will cause168 * `T::OnNewAccount::on_new_account` to be called.169 * - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.170 * - `transfer_keep_alive` works the same way as `transfer`, but has an additional check171 * that the transfer will not kill the origin account.172 * ---------------------------------173 * - Origin account is already in memory, so no DB operations for them.174 * # </weight>175 **/176 transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;177 /**178 * Transfer the entire transferable balance from the caller account.179 * 180 * NOTE: This function only attempts to transfer _transferable_ balances. This means that181 * any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be182 * transferred by this function. To ensure that this function results in a killed account,183 * you might need to prepare the account by removing any reference counters, storage184 * deposits, etc...185 * 186 * The dispatch origin of this call must be Signed.187 * 188 * - `dest`: The recipient of the transfer.189 * - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all190 * of the funds the account has, causing the sender account to be killed (false), or191 * transfer everything except at least the existential deposit, which will guarantee to192 * keep the sender account alive (true). # <weight>193 * - O(1). Just like transfer, but reading the user's transferable balance first.194 * #</weight>195 **/196 transferAll: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, bool]>;197 /**198 * Same as the [`transfer`] call, but with a check that the transfer will not kill the199 * origin account.200 * 201 * 99% of the time you want [`transfer`] instead.202 * 203 * [`transfer`]: struct.Pallet.html#method.transfer204 **/205 transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>]>;206 /**207 * Generic tx208 **/209 [key: string]: SubmittableExtrinsicFunction<ApiType>;210 };211 charging: {212 /**213 * Generic tx214 **/215 [key: string]: SubmittableExtrinsicFunction<ApiType>;216 };217 configuration: {218 setAppPromotionConfigurationOverride: AugmentedSubmittable<(configuration: PalletConfigurationAppPromotionConfiguration | { recalculationInterval?: any; pendingInterval?: any; intervalIncome?: any; maxStakersPerCalculation?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletConfigurationAppPromotionConfiguration]>;219 setCollatorSelectionDesiredCollators: AugmentedSubmittable<(max: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;220 setCollatorSelectionKickThreshold: AugmentedSubmittable<(threshold: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;221 setCollatorSelectionLicenseBond: AugmentedSubmittable<(amount: Option<u128> | null | Uint8Array | u128 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u128>]>;222 setMinGasPriceOverride: AugmentedSubmittable<(coeff: Option<u64> | null | Uint8Array | u64 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u64>]>;223 setWeightToFeeCoefficientOverride: AugmentedSubmittable<(coeff: Option<u64> | null | Uint8Array | u64 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u64>]>;224 setXcmAllowedLocations: AugmentedSubmittable<(locations: Option<Vec<XcmV1MultiLocation>> | null | Uint8Array | Vec<XcmV1MultiLocation> | (XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Option<Vec<XcmV1MultiLocation>>]>;225 /**226 * Generic tx227 **/228 [key: string]: SubmittableExtrinsicFunction<ApiType>;229 };230 cumulusXcm: {231 /**232 * Generic tx233 **/234 [key: string]: SubmittableExtrinsicFunction<ApiType>;235 };236 dmpQueue: {237 /**238 * Service a single overweight message.239 * 240 * - `origin`: Must pass `ExecuteOverweightOrigin`.241 * - `index`: The index of the overweight message to service.242 * - `weight_limit`: The amount of weight that message execution may take.243 * 244 * Errors:245 * - `Unknown`: Message of `index` is unknown.246 * - `OverLimit`: Message execution may use greater than `weight_limit`.247 * 248 * Events:249 * - `OverweightServiced`: On success.250 **/251 serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, u64]>;252 /**253 * Generic tx254 **/255 [key: string]: SubmittableExtrinsicFunction<ApiType>;256 };257 ethereum: {258 /**259 * Transact an Ethereum transaction.260 **/261 transact: AugmentedSubmittable<(transaction: EthereumTransactionTransactionV2 | { Legacy: any } | { EIP2930: any } | { EIP1559: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [EthereumTransactionTransactionV2]>;262 /**263 * Generic tx264 **/265 [key: string]: SubmittableExtrinsicFunction<ApiType>;266 };267 evm: {268 /**269 * Issue an EVM call operation. This is similar to a message call transaction in Ethereum.270 **/271 call: AugmentedSubmittable<(source: H160 | string | Uint8Array, target: H160 | string | Uint8Array, input: Bytes | string | Uint8Array, value: U256 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, maxFeePerGas: U256 | AnyNumber | Uint8Array, maxPriorityFeePerGas: Option<U256> | null | Uint8Array | U256 | AnyNumber, nonce: Option<U256> | null | Uint8Array | U256 | AnyNumber, accessList: Vec<ITuple<[H160, Vec<H256>]>> | ([H160 | string | Uint8Array, Vec<H256> | (H256 | string | Uint8Array)[]])[]) => SubmittableExtrinsic<ApiType>, [H160, H160, Bytes, U256, u64, U256, Option<U256>, Option<U256>, Vec<ITuple<[H160, Vec<H256>]>>]>;272 /**273 * Issue an EVM create operation. This is similar to a contract creation transaction in274 * Ethereum.275 **/276 create: AugmentedSubmittable<(source: H160 | string | Uint8Array, init: Bytes | string | Uint8Array, value: U256 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, maxFeePerGas: U256 | AnyNumber | Uint8Array, maxPriorityFeePerGas: Option<U256> | null | Uint8Array | U256 | AnyNumber, nonce: Option<U256> | null | Uint8Array | U256 | AnyNumber, accessList: Vec<ITuple<[H160, Vec<H256>]>> | ([H160 | string | Uint8Array, Vec<H256> | (H256 | string | Uint8Array)[]])[]) => SubmittableExtrinsic<ApiType>, [H160, Bytes, U256, u64, U256, Option<U256>, Option<U256>, Vec<ITuple<[H160, Vec<H256>]>>]>;277 /**278 * Issue an EVM create2 operation.279 **/280 create2: AugmentedSubmittable<(source: H160 | string | Uint8Array, init: Bytes | string | Uint8Array, salt: H256 | string | Uint8Array, value: U256 | AnyNumber | Uint8Array, gasLimit: u64 | AnyNumber | Uint8Array, maxFeePerGas: U256 | AnyNumber | Uint8Array, maxPriorityFeePerGas: Option<U256> | null | Uint8Array | U256 | AnyNumber, nonce: Option<U256> | null | Uint8Array | U256 | AnyNumber, accessList: Vec<ITuple<[H160, Vec<H256>]>> | ([H160 | string | Uint8Array, Vec<H256> | (H256 | string | Uint8Array)[]])[]) => SubmittableExtrinsic<ApiType>, [H160, Bytes, H256, U256, u64, U256, Option<U256>, Option<U256>, Vec<ITuple<[H160, Vec<H256>]>>]>;281 /**282 * Withdraw balance from EVM into currency/balances pallet.283 **/284 withdraw: AugmentedSubmittable<(address: H160 | string | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160, u128]>;285 /**286 * Generic tx287 **/288 [key: string]: SubmittableExtrinsicFunction<ApiType>;289 };290 evmMigration: {291 /**292 * Start contract migration, inserts contract stub at target address,293 * and marks account as pending, allowing to insert storage294 **/295 begin: AugmentedSubmittable<(address: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;296 /**297 * Finish contract migration, allows it to be called.298 * It is not possible to alter contract storage via [`Self::set_data`]299 * after this call.300 **/301 finish: AugmentedSubmittable<(address: H160 | string | Uint8Array, code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160, Bytes]>;302 /**303 * Create ethereum events attached to the fake transaction304 **/305 insertEthLogs: AugmentedSubmittable<(logs: Vec<EthereumLog> | (EthereumLog | { address?: any; topics?: any; data?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<EthereumLog>]>;306 /**307 * Create substrate events308 **/309 insertEvents: AugmentedSubmittable<(events: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>;310 /**311 * Insert items into contract storage, this method can be called312 * multiple times313 **/314 setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;315 /**316 * Generic tx317 **/318 [key: string]: SubmittableExtrinsicFunction<ApiType>;319 };320 foreignAssets: {321 registerForeignAsset: AugmentedSubmittable<(owner: AccountId32 | string | Uint8Array, location: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, metadata: PalletForeignAssetsModuleAssetMetadata | { name?: any; symbol?: any; decimals?: any; minimalBalance?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId32, XcmVersionedMultiLocation, PalletForeignAssetsModuleAssetMetadata]>;322 updateForeignAsset: AugmentedSubmittable<(foreignAssetId: u32 | AnyNumber | Uint8Array, location: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, metadata: PalletForeignAssetsModuleAssetMetadata | { name?: any; symbol?: any; decimals?: any; minimalBalance?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, XcmVersionedMultiLocation, PalletForeignAssetsModuleAssetMetadata]>;323 /**324 * Generic tx325 **/326 [key: string]: SubmittableExtrinsicFunction<ApiType>;327 };328 inflation: {329 /**330 * This method sets the inflation start date. Can be only called once.331 * Inflation start block can be backdated and will catch up. The method will create Treasury332 * account if it does not exist and perform the first inflation deposit.333 * 334 * # Permissions335 * 336 * * Root337 * 338 * # Arguments339 * 340 * * inflation_start_relay_block: The relay chain block at which inflation should start341 **/342 startInflation: AugmentedSubmittable<(inflationStartRelayBlock: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;343 /**344 * Generic tx345 **/346 [key: string]: SubmittableExtrinsicFunction<ApiType>;347 };348 maintenance: {349 disable: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;350 enable: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;351 /**352 * Generic tx353 **/354 [key: string]: SubmittableExtrinsicFunction<ApiType>;355 };356 parachainSystem: {357 authorizeUpgrade: AugmentedSubmittable<(codeHash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;358 enactAuthorizedUpgrade: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;359 /**360 * Set the current validation data.361 * 362 * This should be invoked exactly once per block. It will panic at the finalization363 * phase if the call was not invoked.364 * 365 * The dispatch origin for this call must be `Inherent`366 * 367 * As a side effect, this function upgrades the current validation function368 * if the appropriate time has come.369 **/370 setValidationData: AugmentedSubmittable<(data: CumulusPrimitivesParachainInherentParachainInherentData | { validationData?: any; relayChainState?: any; downwardMessages?: any; horizontalMessages?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [CumulusPrimitivesParachainInherentParachainInherentData]>;371 sudoSendUpwardMessage: AugmentedSubmittable<(message: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;372 /**373 * Generic tx374 **/375 [key: string]: SubmittableExtrinsicFunction<ApiType>;376 };377 polkadotXcm: {378 /**379 * Execute an XCM message from a local, signed, origin.380 * 381 * An event is deposited indicating whether `msg` could be executed completely or only382 * partially.383 * 384 * No more than `max_weight` will be used in its attempted execution. If this is less than the385 * maximum amount of weight that the message could take to be executed, then no execution386 * attempt will be made.387 * 388 * NOTE: A successful return to this does *not* imply that the `msg` was executed successfully389 * to completion; only that *some* of it was executed.390 **/391 execute: AugmentedSubmittable<(message: XcmVersionedXcm | { V0: any } | { V1: any } | { V2: any } | string | Uint8Array, maxWeight: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedXcm, u64]>;392 /**393 * Set a safe XCM version (the version that XCM should be encoded with if the most recent394 * version a destination can accept is unknown).395 * 396 * - `origin`: Must be Root.397 * - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.398 **/399 forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;400 /**401 * Ask a location to notify us regarding their XCM version and any changes to it.402 * 403 * - `origin`: Must be Root.404 * - `location`: The location to which we should subscribe for XCM version notifications.405 **/406 forceSubscribeVersionNotify: AugmentedSubmittable<(location: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation]>;407 /**408 * Require that a particular destination should no longer notify us regarding any XCM409 * version changes.410 * 411 * - `origin`: Must be Root.412 * - `location`: The location to which we are currently subscribed for XCM version413 * notifications which we no longer desire.414 **/415 forceUnsubscribeVersionNotify: AugmentedSubmittable<(location: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation]>;416 /**417 * Extoll that a particular destination can be communicated with through a particular418 * version of XCM.419 * 420 * - `origin`: Must be Root.421 * - `location`: The destination that is being described.422 * - `xcm_version`: The latest version of XCM that `location` supports.423 **/424 forceXcmVersion: AugmentedSubmittable<(location: XcmV1MultiLocation | { parents?: any; interior?: any } | string | Uint8Array, xcmVersion: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmV1MultiLocation, u32]>;425 /**426 * Transfer some assets from the local chain to the sovereign account of a destination427 * chain and forward a notification XCM.428 * 429 * Fee payment on the destination side is made from the asset in the `assets` vector of430 * index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight431 * is needed than `weight_limit`, then the operation will fail and the assets send may be432 * at risk.433 * 434 * - `origin`: Must be capable of withdrawing the `assets` and executing XCM.435 * - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send436 * from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.437 * - `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be438 * an `AccountId32` value.439 * - `assets`: The assets to be withdrawn. This should include the assets used to pay the fee on the440 * `dest` side.441 * - `fee_asset_item`: The index into `assets` of the item which should be used to pay442 * fees.443 * - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.444 **/445 limitedReserveTransferAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array, weightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32, XcmV2WeightLimit]>;446 /**447 * Teleport some assets from the local chain to some destination chain.448 * 449 * Fee payment on the destination side is made from the asset in the `assets` vector of450 * index `fee_asset_item`, up to enough to pay for `weight_limit` of weight. If more weight451 * is needed than `weight_limit`, then the operation will fail and the assets send may be452 * at risk.453 * 454 * - `origin`: Must be capable of withdrawing the `assets` and executing XCM.455 * - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send456 * from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.457 * - `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be458 * an `AccountId32` value.459 * - `assets`: The assets to be withdrawn. The first item should be the currency used to to pay the fee on the460 * `dest` side. May not be empty.461 * - `fee_asset_item`: The index into `assets` of the item which should be used to pay462 * fees.463 * - `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase.464 **/465 limitedTeleportAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array, weightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32, XcmV2WeightLimit]>;466 /**467 * Transfer some assets from the local chain to the sovereign account of a destination468 * chain and forward a notification XCM.469 * 470 * Fee payment on the destination side is made from the asset in the `assets` vector of471 * index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,472 * with all fees taken as needed from the asset.473 * 474 * - `origin`: Must be capable of withdrawing the `assets` and executing XCM.475 * - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send476 * from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.477 * - `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be478 * an `AccountId32` value.479 * - `assets`: The assets to be withdrawn. This should include the assets used to pay the fee on the480 * `dest` side.481 * - `fee_asset_item`: The index into `assets` of the item which should be used to pay482 * fees.483 **/484 reserveTransferAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32]>;485 send: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, message: XcmVersionedXcm | { V0: any } | { V1: any } | { V2: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedXcm]>;486 /**487 * Teleport some assets from the local chain to some destination chain.488 * 489 * Fee payment on the destination side is made from the asset in the `assets` vector of490 * index `fee_asset_item`. The weight limit for fees is not provided and thus is unlimited,491 * with all fees taken as needed from the asset.492 * 493 * - `origin`: Must be capable of withdrawing the `assets` and executing XCM.494 * - `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send495 * from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.496 * - `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be497 * an `AccountId32` value.498 * - `assets`: The assets to be withdrawn. The first item should be the currency used to to pay the fee on the499 * `dest` side. May not be empty.500 * - `fee_asset_item`: The index into `assets` of the item which should be used to pay501 * fees.502 **/503 teleportAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32]>;504 /**505 * Generic tx506 **/507 [key: string]: SubmittableExtrinsicFunction<ApiType>;508 };509 rmrkCore: {510 /**511 * Accept an NFT sent from another account to self or an owned NFT.512 * 513 * The NFT in question must be pending, and, thus, be [sent](`Pallet::send`) first.514 * 515 * # Permissions:516 * - Token-owner-to-be517 * 518 * # Arguments:519 * - `origin`: sender of the transaction520 * - `rmrk_collection_id`: RMRK collection ID of the NFT to be accepted.521 * - `rmrk_nft_id`: ID of the NFT to be accepted.522 * - `new_owner`: Either the sender's account ID or a sender-owned NFT,523 * whichever the accepted NFT was sent to.524 **/525 acceptNft: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array, newOwner: RmrkTraitsNftAccountIdOrCollectionNftTuple | { AccountId: any } | { CollectionAndNftTuple: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsNftAccountIdOrCollectionNftTuple]>;526 /**527 * Accept the addition of a newly created pending resource to an existing NFT.528 * 529 * This transaction is needed when a resource is created and assigned to an NFT530 * by a non-owner, i.e. the collection issuer, with one of the531 * [`add_...` transactions](Pallet::add_basic_resource).532 * 533 * # Permissions:534 * - Token owner535 * 536 * # Arguments:537 * - `origin`: sender of the transaction538 * - `rmrk_collection_id`: RMRK collection ID of the NFT.539 * - `rmrk_nft_id`: ID of the NFT with a pending resource to be accepted.540 * - `resource_id`: ID of the newly created pending resource.541 * accept the addition of a new resource to an existing NFT542 **/543 acceptResource: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array, resourceId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u32]>;544 /**545 * Accept the removal of a removal-pending resource from an NFT.546 * 547 * This transaction is needed when a non-owner, i.e. the collection issuer,548 * requests a [removal](`Pallet::remove_resource`) of a resource from an NFT.549 * 550 * # Permissions:551 * - Token owner552 * 553 * # Arguments:554 * - `origin`: sender of the transaction555 * - `rmrk_collection_id`: RMRK collection ID of the NFT.556 * - `rmrk_nft_id`: ID of the NFT with a resource to be removed.557 * - `resource_id`: ID of the removal-pending resource.558 **/559 acceptResourceRemoval: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array, resourceId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u32]>;560 /**561 * Create and set/propose a basic resource for an NFT.562 * 563 * A basic resource is the simplest, lacking a Base and anything that comes with it.564 * See RMRK docs for more information and examples.565 * 566 * # Permissions:567 * - Collection issuer - if not the token owner, adding the resource will warrant568 * the owner's [acceptance](Pallet::accept_resource).569 * 570 * # Arguments:571 * - `origin`: sender of the transaction572 * - `rmrk_collection_id`: RMRK collection ID of the NFT.573 * - `nft_id`: ID of the NFT to assign a resource to.574 * - `resource`: Data of the resource to be created.575 **/576 addBasicResource: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, nftId: u32 | AnyNumber | Uint8Array, resource: RmrkTraitsResourceBasicResource | { src?: any; metadata?: any; license?: any; thumb?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsResourceBasicResource]>;577 /**578 * Create and set/propose a composable resource for an NFT.579 * 580 * A composable resource links to a Base and has a subset of its Parts it is composed of.581 * See RMRK docs for more information and examples.582 * 583 * # Permissions:584 * - Collection issuer - if not the token owner, adding the resource will warrant585 * the owner's [acceptance](Pallet::accept_resource).586 * 587 * # Arguments:588 * - `origin`: sender of the transaction589 * - `rmrk_collection_id`: RMRK collection ID of the NFT.590 * - `nft_id`: ID of the NFT to assign a resource to.591 * - `resource`: Data of the resource to be created.592 **/593 addComposableResource: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, nftId: u32 | AnyNumber | Uint8Array, resource: RmrkTraitsResourceComposableResource | { parts?: any; base?: any; src?: any; metadata?: any; license?: any; thumb?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsResourceComposableResource]>;594 /**595 * Create and set/propose a slot resource for an NFT.596 * 597 * A slot resource links to a Base and a slot ID in it which it can fit into.598 * See RMRK docs for more information and examples.599 * 600 * # Permissions:601 * - Collection issuer - if not the token owner, adding the resource will warrant602 * the owner's [acceptance](Pallet::accept_resource).603 * 604 * # Arguments:605 * - `origin`: sender of the transaction606 * - `rmrk_collection_id`: RMRK collection ID of the NFT.607 * - `nft_id`: ID of the NFT to assign a resource to.608 * - `resource`: Data of the resource to be created.609 **/610 addSlotResource: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, nftId: u32 | AnyNumber | Uint8Array, resource: RmrkTraitsResourceSlotResource | { base?: any; src?: any; metadata?: any; slot?: any; license?: any; thumb?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsResourceSlotResource]>;611 /**612 * Burn an NFT, destroying it and its nested tokens up to the specified limit.613 * If the burning budget is exceeded, the transaction is reverted.614 * 615 * This is the way to burn a nested token as well.616 * 617 * For more information, see [`burn_recursively`](pallet_nonfungible::pallet::Pallet::burn_recursively).618 * 619 * # Permissions:620 * * Token owner621 * 622 * # Arguments:623 * - `origin`: sender of the transaction624 * - `collection_id`: RMRK ID of the collection in which the NFT to burn belongs to.625 * - `nft_id`: ID of the NFT to be destroyed.626 * - `max_burns`: Maximum number of tokens to burn, assuming nesting. The transaction627 * is reverted if there are more tokens to burn in the nesting tree than this number.628 * This is primarily a mechanism of transaction weight control.629 **/630 burnNft: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, nftId: u32 | AnyNumber | Uint8Array, maxBurns: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u32]>;631 /**632 * Change the issuer of a collection. Analogous to Unique's collection's [`owner`](up_data_structs::Collection).633 * 634 * # Permissions:635 * * Collection issuer636 * 637 * # Arguments:638 * - `origin`: sender of the transaction639 * - `collection_id`: RMRK collection ID to change the issuer of.640 * - `new_issuer`: Collection's new issuer.641 **/642 changeCollectionIssuer: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newIssuer: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, MultiAddress]>;643 /**644 * Create a new collection of NFTs.645 * 646 * # Permissions:647 * * Anyone - will be assigned as the issuer of the collection.648 * 649 * # Arguments:650 * - `origin`: sender of the transaction651 * - `metadata`: Metadata describing the collection, e.g. IPFS hash. Cannot be changed.652 * - `max`: Optional maximum number of tokens.653 * - `symbol`: UTF-8 string with token prefix, by which to represent the token in wallets and UIs.654 * Analogous to Unique's [`token_prefix`](up_data_structs::Collection). Cannot be changed.655 **/656 createCollection: AugmentedSubmittable<(metadata: Bytes | string | Uint8Array, max: Option<u32> | null | Uint8Array | u32 | AnyNumber, symbol: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, Option<u32>, Bytes]>;657 /**658 * Destroy a collection.659 * 660 * Only empty collections can be destroyed. If it has any tokens, they must be burned first.661 * 662 * # Permissions:663 * * Collection issuer664 * 665 * # Arguments:666 * - `origin`: sender of the transaction667 * - `collection_id`: RMRK ID of the collection to destroy.668 **/669 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;670 /**671 * "Lock" the collection and prevent new token creation. Cannot be undone.672 * 673 * # Permissions:674 * * Collection issuer675 * 676 * # Arguments:677 * - `origin`: sender of the transaction678 * - `collection_id`: RMRK ID of the collection to lock.679 **/680 lockCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;681 /**682 * Mint an NFT in a specified collection.683 * 684 * # Permissions:685 * * Collection issuer686 * 687 * # Arguments:688 * - `origin`: sender of the transaction689 * - `owner`: Owner account of the NFT. If set to None, defaults to the sender (collection issuer).690 * - `collection_id`: RMRK collection ID for the NFT to be minted within. Cannot be changed.691 * - `recipient`: Receiver account of the royalty. Has no effect if the `royalty_amount` is not set. Cannot be changed.692 * - `royalty_amount`: Optional permillage reward from each trade for the `recipient`. Cannot be changed.693 * - `metadata`: Arbitrary data about an NFT, e.g. IPFS hash. Cannot be changed.694 * - `transferable`: Can this NFT be transferred? Cannot be changed.695 * - `resources`: Resource data to be added to the NFT immediately after minting.696 **/697 mintNft: AugmentedSubmittable<(owner: Option<AccountId32> | null | Uint8Array | AccountId32 | string, collectionId: u32 | AnyNumber | Uint8Array, recipient: Option<AccountId32> | null | Uint8Array | AccountId32 | string, royaltyAmount: Option<Permill> | null | Uint8Array | Permill | AnyNumber, metadata: Bytes | string | Uint8Array, transferable: bool | boolean | Uint8Array, resources: Option<Vec<RmrkTraitsResourceResourceTypes>> | null | Uint8Array | Vec<RmrkTraitsResourceResourceTypes> | (RmrkTraitsResourceResourceTypes | { Basic: any } | { Composable: any } | { Slot: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Option<AccountId32>, u32, Option<AccountId32>, Option<Permill>, Bytes, bool, Option<Vec<RmrkTraitsResourceResourceTypes>>]>;698 /**699 * Reject an NFT sent from another account to self or owned NFT.700 * The NFT in question will not be sent back and burnt instead.701 * 702 * The NFT in question must be pending, and, thus, be [sent](`Pallet::send`) first.703 * 704 * # Permissions:705 * - Token-owner-to-be-not706 * 707 * # Arguments:708 * - `origin`: sender of the transaction709 * - `rmrk_collection_id`: RMRK ID of the NFT to be rejected.710 * - `rmrk_nft_id`: ID of the NFT to be rejected.711 **/712 rejectNft: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;713 /**714 * Remove and erase a resource from an NFT.715 * 716 * If the sender does not own the NFT, then it will be pending confirmation,717 * and will have to be [accepted](Pallet::accept_resource_removal) by the token owner.718 * 719 * # Permissions720 * - Collection issuer721 * 722 * # Arguments723 * - `origin`: sender of the transaction724 * - `rmrk_collection_id`: RMRK ID of a collection to which the NFT making use of the resource belongs to.725 * - `nft_id`: ID of the NFT with a resource to be removed.726 * - `resource_id`: ID of the resource to be removed.727 **/728 removeResource: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, nftId: u32 | AnyNumber | Uint8Array, resourceId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u32]>;729 /**730 * Transfer an NFT from an account/NFT A to another account/NFT B.731 * The token must be transferable. Nesting cannot occur deeper than the [`NESTING_BUDGET`].732 * 733 * If the target owner is an NFT owned by another account, then the NFT will enter734 * the pending state and will have to be accepted by the other account.735 * 736 * # Permissions:737 * - Token owner738 * 739 * # Arguments:740 * - `origin`: sender of the transaction741 * - `rmrk_collection_id`: RMRK ID of the collection of the NFT to be transferred.742 * - `rmrk_nft_id`: ID of the NFT to be transferred.743 * - `new_owner`: New owner of the nft which can be either an account or a NFT.744 **/745 send: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array, newOwner: RmrkTraitsNftAccountIdOrCollectionNftTuple | { AccountId: any } | { CollectionAndNftTuple: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsNftAccountIdOrCollectionNftTuple]>;746 /**747 * Set a different order of resource priorities for an NFT. Priorities can be used,748 * for example, for order of rendering.749 * 750 * Note that the priorities are not updated automatically, and are an empty vector751 * by default. There is no pre-set definition for the order to be particular,752 * it can be interpreted arbitrarily use-case by use-case.753 * 754 * # Permissions:755 * - Token owner756 * 757 * # Arguments:758 * - `origin`: sender of the transaction759 * - `rmrk_collection_id`: RMRK collection ID of the NFT.760 * - `rmrk_nft_id`: ID of the NFT to rearrange resource priorities for.761 * - `priorities`: Ordered vector of resource IDs.762 **/763 setPriority: AugmentedSubmittable<(rmrkCollectionId: u32 | AnyNumber | Uint8Array, rmrkNftId: u32 | AnyNumber | Uint8Array, priorities: Vec<u32> | (u32 | AnyNumber | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<u32>]>;764 /**765 * Add or edit a custom user property, a key-value pair, describing the metadata766 * of a token or a collection, on either one of these.767 * 768 * Note that in this proxy implementation many details regarding RMRK are stored769 * as scoped properties prefixed with "rmrk:", normally inaccessible770 * to external transactions and RPCs.771 * 772 * # Permissions:773 * - Collection issuer - in case of collection property774 * - Token owner - in case of NFT property775 * 776 * # Arguments:777 * - `origin`: sender of the transaction778 * - `rmrk_collection_id`: RMRK collection ID.779 * - `maybe_nft_id`: Optional ID of the NFT. If left empty, then the property is set for the collection.780 * - `key`: Key of the custom property to be referenced by.781 * - `value`: Value of the custom property to be stored.782 **/783 setProperty: AugmentedSubmittable<(rmrkCollectionId: Compact<u32> | AnyNumber | Uint8Array, maybeNftId: Option<u32> | null | Uint8Array | u32 | AnyNumber, key: Bytes | string | Uint8Array, value: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, Option<u32>, Bytes, Bytes]>;784 /**785 * Generic tx786 **/787 [key: string]: SubmittableExtrinsicFunction<ApiType>;788 };789 rmrkEquip: {790 /**791 * Create a new Base.792 * 793 * Modeled after the [Base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)794 * 795 * # Permissions796 * - Anyone - will be assigned as the issuer of the Base.797 * 798 * # Arguments:799 * - `origin`: Caller, will be assigned as the issuer of the Base800 * - `base_type`: Arbitrary media type, e.g. "svg".801 * - `symbol`: Arbitrary client-chosen symbol.802 * - `parts`: Array of Fixed and Slot Parts composing the Base,803 * confined in length by [`RmrkPartsLimit`](up_data_structs::RmrkPartsLimit).804 **/805 createBase: AugmentedSubmittable<(baseType: Bytes | string | Uint8Array, symbol: Bytes | string | Uint8Array, parts: Vec<RmrkTraitsPartPartType> | (RmrkTraitsPartPartType | { FixedPart: any } | { SlotPart: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Bytes, Bytes, Vec<RmrkTraitsPartPartType>]>;806 /**807 * Update the array of Collections allowed to be equipped to a Base's specified Slot Part.808 * 809 * Modeled after [equippable interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/equippable.md).810 * 811 * # Permissions:812 * - Base issuer813 * 814 * # Arguments:815 * - `origin`: sender of the transaction816 * - `base_id`: Base containing the Slot Part to be updated.817 * - `slot_id`: Slot Part whose Equippable List is being updated .818 * - `equippables`: List of equippables that will override the current Equippables list.819 **/820 equippable: AugmentedSubmittable<(baseId: u32 | AnyNumber | Uint8Array, slotId: u32 | AnyNumber | Uint8Array, equippables: RmrkTraitsPartEquippableList | { All: any } | { Empty: any } | { Custom: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, RmrkTraitsPartEquippableList]>;821 /**822 * Add a Theme to a Base.823 * A Theme named "default" is required prior to adding other Themes.824 * 825 * Modeled after [Themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md).826 * 827 * # Permissions:828 * - Base issuer829 * 830 * # Arguments:831 * - `origin`: sender of the transaction832 * - `base_id`: Base ID containing the Theme to be updated.833 * - `theme`: Theme to add to the Base. A Theme has a name and properties, which are an834 * array of [key, value, inherit].835 * - `key`: Arbitrary BoundedString, defined by client.836 * - `value`: Arbitrary BoundedString, defined by client.837 * - `inherit`: Optional bool.838 **/839 themeAdd: AugmentedSubmittable<(baseId: u32 | AnyNumber | Uint8Array, theme: RmrkTraitsTheme | { name?: any; properties?: any; inherit?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, RmrkTraitsTheme]>;840 /**841 * Generic tx842 **/843 [key: string]: SubmittableExtrinsicFunction<ApiType>;844 };845 structure: {846 /**847 * Generic tx848 **/849 [key: string]: SubmittableExtrinsicFunction<ApiType>;850 };851 sudo: {852 /**853 * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo854 * key.855 * 856 * The dispatch origin for this call must be _Signed_.857 * 858 * # <weight>859 * - O(1).860 * - Limited storage reads.861 * - One DB change.862 * # </weight>863 **/864 setKey: AugmentedSubmittable<(updated: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;865 /**866 * Authenticates the sudo key and dispatches a function call with `Root` origin.867 * 868 * The dispatch origin for this call must be _Signed_.869 * 870 * # <weight>871 * - O(1).872 * - Limited storage reads.873 * - One DB write (event).874 * - Weight of derivative `call` execution + 10,000.875 * # </weight>876 **/877 sudo: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;878 /**879 * Authenticates the sudo key and dispatches a function call with `Signed` origin from880 * a given account.881 * 882 * The dispatch origin for this call must be _Signed_.883 * 884 * # <weight>885 * - O(1).886 * - Limited storage reads.887 * - One DB write (event).888 * - Weight of derivative `call` execution + 10,000.889 * # </weight>890 **/891 sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;892 /**893 * Authenticates the sudo key and dispatches a function call with `Root` origin.894 * This function does not check the weight of the call, and instead allows the895 * Sudo user to specify the weight of the call.896 * 897 * The dispatch origin for this call must be _Signed_.898 * 899 * # <weight>900 * - O(1).901 * - The weight of this call is defined by the caller.902 * # </weight>903 **/904 sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: SpWeightsWeightV2Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, SpWeightsWeightV2Weight]>;905 /**906 * Generic tx907 **/908 [key: string]: SubmittableExtrinsicFunction<ApiType>;909 };910 system: {911 /**912 * Kill all storage items with a key that starts with the given prefix.913 * 914 * **NOTE:** We rely on the Root origin to provide us the number of subkeys under915 * the prefix we are removing to accurately calculate the weight of this function.916 **/917 killPrefix: AugmentedSubmittable<(prefix: Bytes | string | Uint8Array, subkeys: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, u32]>;918 /**919 * Kill some items from storage.920 **/921 killStorage: AugmentedSubmittable<(keys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Bytes>]>;922 /**923 * Make some on-chain remark.924 * 925 * # <weight>926 * - `O(1)`927 * # </weight>928 **/929 remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;930 /**931 * Make some on-chain remark and emit event.932 **/933 remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;934 /**935 * Set the new runtime code.936 * 937 * # <weight>938 * - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`939 * - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is940 * expensive).941 * - 1 storage write (codec `O(C)`).942 * - 1 digest item.943 * - 1 event.944 * The weight of this function is dependent on the runtime, but generally this is very945 * expensive. We will treat this as a full block.946 * # </weight>947 **/948 setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;949 /**950 * Set the new runtime code without doing any checks of the given `code`.951 * 952 * # <weight>953 * - `O(C)` where `C` length of `code`954 * - 1 storage write (codec `O(C)`).955 * - 1 digest item.956 * - 1 event.957 * The weight of this function is dependent on the runtime. We will treat this as a full958 * block. # </weight>959 **/960 setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;961 /**962 * Set the number of pages in the WebAssembly environment's heap.963 **/964 setHeapPages: AugmentedSubmittable<(pages: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;965 /**966 * Set some items of storage.967 **/968 setStorage: AugmentedSubmittable<(items: Vec<ITuple<[Bytes, Bytes]>> | ([Bytes | string | Uint8Array, Bytes | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[Bytes, Bytes]>>]>;969 /**970 * Generic tx971 **/972 [key: string]: SubmittableExtrinsicFunction<ApiType>;973 };974 testUtils: {975 batchAll: AugmentedSubmittable<(calls: Vec<Call> | (Call | IMethod | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<Call>]>;976 enable: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;977 incTestValue: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;978 justTakeFee: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;979 setTestValue: AugmentedSubmittable<(value: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;980 setTestValueAndRollback: AugmentedSubmittable<(value: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;981 /**982 * Generic tx983 **/984 [key: string]: SubmittableExtrinsicFunction<ApiType>;985 };986 timestamp: {987 /**988 * Set the current time.989 * 990 * This call should be invoked exactly once per block. It will panic at the finalization991 * phase, if this call hasn't been invoked by that time.992 * 993 * The timestamp should be greater than the previous one by the amount specified by994 * `MinimumPeriod`.995 * 996 * The dispatch origin for this call must be `Inherent`.997 * 998 * # <weight>999 * - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)1000 * - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in1001 * `on_finalize`)1002 * - 1 event handler `on_timestamp_set`. Must be `O(1)`.1003 * # </weight>1004 **/1005 set: AugmentedSubmittable<(now: Compact<u64> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u64>]>;1006 /**1007 * Generic tx1008 **/1009 [key: string]: SubmittableExtrinsicFunction<ApiType>;1010 };1011 tokens: {1012 /**1013 * Exactly as `transfer`, except the origin must be root and the source1014 * account may be specified.1015 * 1016 * The dispatch origin for this call must be _Root_.1017 * 1018 * - `source`: The sender of the transfer.1019 * - `dest`: The recipient of the transfer.1020 * - `currency_id`: currency type.1021 * - `amount`: free balance amount to tranfer.1022 **/1023 forceTransfer: AugmentedSubmittable<(source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, MultiAddress, PalletForeignAssetsAssetIds, Compact<u128>]>;1024 /**1025 * Set the balances of a given account.1026 * 1027 * This will alter `FreeBalance` and `ReservedBalance` in storage. it1028 * will also decrease the total issuance of the system1029 * (`TotalIssuance`). If the new free or reserved balance is below the1030 * existential deposit, it will reap the `AccountInfo`.1031 * 1032 * The dispatch origin for this call is `root`.1033 **/1034 setBalance: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, newFree: Compact<u128> | AnyNumber | Uint8Array, newReserved: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, PalletForeignAssetsAssetIds, Compact<u128>, Compact<u128>]>;1035 /**1036 * Transfer some liquid free balance to another account.1037 * 1038 * `transfer` will set the `FreeBalance` of the sender and receiver.1039 * It will decrease the total issuance of the system by the1040 * `TransferFee`. If the sender's account is below the existential1041 * deposit as a result of the transfer, the account will be reaped.1042 * 1043 * The dispatch origin for this call must be `Signed` by the1044 * transactor.1045 * 1046 * - `dest`: The recipient of the transfer.1047 * - `currency_id`: currency type.1048 * - `amount`: free balance amount to tranfer.1049 **/1050 transfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, PalletForeignAssetsAssetIds, Compact<u128>]>;1051 /**1052 * Transfer all remaining balance to the given account.1053 * 1054 * NOTE: This function only attempts to transfer _transferable_1055 * balances. This means that any locked, reserved, or existential1056 * deposits (when `keep_alive` is `true`), will not be transferred by1057 * this function. To ensure that this function results in a killed1058 * account, you might need to prepare the account by removing any1059 * reference counters, storage deposits, etc...1060 * 1061 * The dispatch origin for this call must be `Signed` by the1062 * transactor.1063 * 1064 * - `dest`: The recipient of the transfer.1065 * - `currency_id`: currency type.1066 * - `keep_alive`: A boolean to determine if the `transfer_all`1067 * operation should send all of the funds the account has, causing1068 * the sender account to be killed (false), or transfer everything1069 * except at least the existential deposit, which will guarantee to1070 * keep the sender account alive (true).1071 **/1072 transferAll: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, keepAlive: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, PalletForeignAssetsAssetIds, bool]>;1073 /**1074 * Same as the [`transfer`] call, but with a check that the transfer1075 * will not kill the origin account.1076 * 1077 * 99% of the time you want [`transfer`] instead.1078 * 1079 * The dispatch origin for this call must be `Signed` by the1080 * transactor.1081 * 1082 * - `dest`: The recipient of the transfer.1083 * - `currency_id`: currency type.1084 * - `amount`: free balance amount to tranfer.1085 **/1086 transferKeepAlive: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, PalletForeignAssetsAssetIds, Compact<u128>]>;1087 /**1088 * Generic tx1089 **/1090 [key: string]: SubmittableExtrinsicFunction<ApiType>;1091 };1092 treasury: {1093 /**1094 * Approve a proposal. At a later time, the proposal will be allocated to the beneficiary1095 * and the original deposit will be returned.1096 * 1097 * May only be called from `T::ApproveOrigin`.1098 * 1099 * # <weight>1100 * - Complexity: O(1).1101 * - DbReads: `Proposals`, `Approvals`1102 * - DbWrite: `Approvals`1103 * # </weight>1104 **/1105 approveProposal: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;1106 /**1107 * Put forward a suggestion for spending. A deposit proportional to the value1108 * is reserved and slashed if the proposal is rejected. It is returned once the1109 * proposal is awarded.1110 * 1111 * # <weight>1112 * - Complexity: O(1)1113 * - DbReads: `ProposalCount`, `origin account`1114 * - DbWrites: `ProposalCount`, `Proposals`, `origin account`1115 * # </weight>1116 **/1117 proposeSpend: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, MultiAddress]>;1118 /**1119 * Reject a proposed spend. The original deposit will be slashed.1120 * 1121 * May only be called from `T::RejectOrigin`.1122 * 1123 * # <weight>1124 * - Complexity: O(1)1125 * - DbReads: `Proposals`, `rejected proposer account`1126 * - DbWrites: `Proposals`, `rejected proposer account`1127 * # </weight>1128 **/1129 rejectProposal: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;1130 /**1131 * Force a previously approved proposal to be removed from the approval queue.1132 * The original deposit will no longer be returned.1133 * 1134 * May only be called from `T::RejectOrigin`.1135 * - `proposal_id`: The index of a proposal1136 * 1137 * # <weight>1138 * - Complexity: O(A) where `A` is the number of approvals1139 * - Db reads and writes: `Approvals`1140 * # </weight>1141 * 1142 * Errors:1143 * - `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,1144 * i.e., the proposal has not been approved. This could also mean the proposal does not1145 * exist altogether, thus there is no way it would have been approved in the first place.1146 **/1147 removeApproval: AugmentedSubmittable<(proposalId: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;1148 /**1149 * Propose and approve a spend of treasury funds.1150 * 1151 * - `origin`: Must be `SpendOrigin` with the `Success` value being at least `amount`.1152 * - `amount`: The amount to be transferred from the treasury to the `beneficiary`.1153 * - `beneficiary`: The destination account for the transfer.1154 * 1155 * NOTE: For record-keeping purposes, the proposer is deemed to be equivalent to the1156 * beneficiary.1157 **/1158 spend: AugmentedSubmittable<(amount: Compact<u128> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, MultiAddress]>;1159 /**1160 * Generic tx1161 **/1162 [key: string]: SubmittableExtrinsicFunction<ApiType>;1163 };1164 unique: {1165 /**1166 * Add an admin to a collection.1167 * 1168 * NFT Collection can be controlled by multiple admin addresses1169 * (some which can also be servers, for example). Admins can issue1170 * and burn NFTs, as well as add and remove other admins,1171 * but cannot change NFT or Collection ownership.1172 * 1173 * # Permissions1174 * 1175 * * Collection owner1176 * * Collection admin1177 * 1178 * # Arguments1179 * 1180 * * `collection_id`: ID of the Collection to add an admin for.1181 * * `new_admin`: Address of new admin to add.1182 **/1183 addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdminId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1184 /**1185 * Add an address to allow list.1186 * 1187 * # Permissions1188 * 1189 * * Collection owner1190 * * Collection admin1191 * 1192 * # Arguments1193 * 1194 * * `collection_id`: ID of the modified collection.1195 * * `address`: ID of the address to be added to the allowlist.1196 **/1197 addToAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1198 /**1199 * Allow a non-permissioned address to transfer or burn an item.1200 * 1201 * # Permissions1202 * 1203 * * Collection owner1204 * * Collection admin1205 * * Current item owner1206 * 1207 * # Arguments1208 * 1209 * * `spender`: Account to be approved to make specific transactions on non-owned tokens.1210 * * `collection_id`: ID of the collection the item belongs to.1211 * * `item_id`: ID of the item transactions on which are now approved.1212 * * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).1213 * Set to 0 to revoke the approval.1214 **/1215 approve: AugmentedSubmittable<(spender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;1216 /**1217 * Destroy a token on behalf of the owner as a non-owner account.1218 * 1219 * See also: [`approve`][`Pallet::approve`].1220 * 1221 * After this method executes, one approval is removed from the total so that1222 * the approved address will not be able to transfer this item again from this owner.1223 * 1224 * # Permissions1225 * 1226 * * Collection owner1227 * * Collection admin1228 * * Current token owner1229 * * Address approved by current item owner1230 * 1231 * # Arguments1232 * 1233 * * `from`: The owner of the burning item.1234 * * `collection_id`: ID of the collection to which the item belongs.1235 * * `item_id`: ID of item to burn.1236 * * `value`: Number of pieces to burn.1237 * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1238 * * Fungible Mode: The desired number of pieces to burn.1239 * * Re-Fungible Mode: The desired number of pieces to burn.1240 **/1241 burnFrom: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32, u128]>;1242 /**1243 * Destroy an item.1244 * 1245 * # Permissions1246 * 1247 * * Collection owner1248 * * Collection admin1249 * * Current item owner1250 * 1251 * # Arguments1252 * 1253 * * `collection_id`: ID of the collection to which the item belongs.1254 * * `item_id`: ID of item to burn.1255 * * `value`: Number of pieces of the item to destroy.1256 * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1257 * * Fungible Mode: The desired number of pieces to burn.1258 * * Re-Fungible Mode: The desired number of pieces to burn.1259 **/1260 burnItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;1261 /**1262 * Change the owner of the collection.1263 * 1264 * # Permissions1265 * 1266 * * Collection owner1267 * 1268 * # Arguments1269 * 1270 * * `collection_id`: ID of the modified collection.1271 * * `new_owner`: ID of the account that will become the owner.1272 **/1273 changeCollectionOwner: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newOwner: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;1274 /**1275 * Confirm own sponsorship of a collection, becoming the sponsor.1276 * 1277 * An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].1278 * Sponsor can pay the fees of a transaction instead of the sender,1279 * but only within specified limits.1280 * 1281 * # Permissions1282 * 1283 * * Sponsor-to-be1284 * 1285 * # Arguments1286 * 1287 * * `collection_id`: ID of the collection with the pending sponsor.1288 **/1289 confirmSponsorship: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1290 /**1291 * Create a collection of tokens.1292 * 1293 * Each Token may have multiple properties encoded as an array of bytes1294 * of certain length. The initial owner of the collection is set1295 * to the address that signed the transaction and can be changed later.1296 * 1297 * Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.1298 * 1299 * # Permissions1300 * 1301 * * Anyone - becomes the owner of the new collection.1302 * 1303 * # Arguments1304 * 1305 * * `collection_name`: Wide-character string with collection name1306 * (limit [`MAX_COLLECTION_NAME_LENGTH`]).1307 * * `collection_description`: Wide-character string with collection description1308 * (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).1309 * * `token_prefix`: Byte string containing the token prefix to mark a collection1310 * to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).1311 * * `mode`: Type of items stored in the collection and type dependent data.1312 **/1313 createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;1314 /**1315 * Create a collection with explicit parameters.1316 * 1317 * Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.1318 * 1319 * # Permissions1320 * 1321 * * Anyone - becomes the owner of the new collection.1322 * 1323 * # Arguments1324 * 1325 * * `data`: Explicit data of a collection used for its creation.1326 **/1327 createCollectionEx: AugmentedSubmittable<(data: UpDataStructsCreateCollectionData | { mode?: any; access?: any; name?: any; description?: any; tokenPrefix?: any; pendingSponsor?: any; limits?: any; permissions?: any; tokenPropertyPermissions?: any; properties?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [UpDataStructsCreateCollectionData]>;1328 /**1329 * Mint an item within a collection.1330 * 1331 * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].1332 * 1333 * # Permissions1334 * 1335 * * Collection owner1336 * * Collection admin1337 * * Anyone if1338 * * Allow List is enabled, and1339 * * Address is added to allow list, and1340 * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])1341 * 1342 * # Arguments1343 * 1344 * * `collection_id`: ID of the collection to which an item would belong.1345 * * `owner`: Address of the initial owner of the item.1346 * * `data`: Token data describing the item to store on chain.1347 **/1348 createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;1349 /**1350 * Create multiple items within a collection.1351 * 1352 * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].1353 * 1354 * # Permissions1355 * 1356 * * Collection owner1357 * * Collection admin1358 * * Anyone if1359 * * Allow List is enabled, and1360 * * Address is added to the allow list, and1361 * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])1362 * 1363 * # Arguments1364 * 1365 * * `collection_id`: ID of the collection to which the tokens would belong.1366 * * `owner`: Address of the initial owner of the tokens.1367 * * `items_data`: Vector of data describing each item to be created.1368 **/1369 createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;1370 /**1371 * Create multiple items within a collection with explicitly specified initial parameters.1372 * 1373 * # Permissions1374 * 1375 * * Collection owner1376 * * Collection admin1377 * * Anyone if1378 * * Allow List is enabled, and1379 * * Address is added to allow list, and1380 * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])1381 * 1382 * # Arguments1383 * 1384 * * `collection_id`: ID of the collection to which the tokens would belong.1385 * * `data`: Explicit item creation data.1386 **/1387 createMultipleItemsEx: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, data: UpDataStructsCreateItemExData | { NFT: any } | { Fungible: any } | { RefungibleMultipleItems: any } | { RefungibleMultipleOwners: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCreateItemExData]>;1388 /**1389 * Delete specified collection properties.1390 * 1391 * # Permissions1392 * 1393 * * Collection Owner1394 * * Collection Admin1395 * 1396 * # Arguments1397 * 1398 * * `collection_id`: ID of the modified collection.1399 * * `property_keys`: Vector of keys of the properties to be deleted.1400 * Keys support Latin letters, `-`, `_`, and `.` as symbols.1401 **/1402 deleteCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<Bytes>]>;1403 /**1404 * Delete specified token properties. Currently properties only work with NFTs.1405 * 1406 * # Permissions1407 * 1408 * * Depends on collection's token property permissions and specified property mutability:1409 * * Collection owner1410 * * Collection admin1411 * * Token owner1412 * 1413 * # Arguments1414 * 1415 * * `collection_id`: ID of the collection to which the token belongs.1416 * * `token_id`: ID of the modified token.1417 * * `property_keys`: Vector of keys of the properties to be deleted.1418 * Keys support Latin letters, `-`, `_`, and `.` as symbols.1419 **/1420 deleteTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<Bytes>]>;1421 /**1422 * Destroy a collection if no tokens exist within.1423 * 1424 * # Permissions1425 * 1426 * * Collection owner1427 * 1428 * # Arguments1429 * 1430 * * `collection_id`: Collection to destroy.1431 **/1432 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1433 /**1434 * Repairs a collection if the data was somehow corrupted.1435 * 1436 * # Arguments1437 * 1438 * * `collection_id`: ID of the collection to repair.1439 **/1440 forceRepairCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1441 /**1442 * Repairs a token if the data was somehow corrupted.1443 * 1444 * # Arguments1445 * 1446 * * `collection_id`: ID of the collection the item belongs to.1447 * * `item_id`: ID of the item.1448 **/1449 forceRepairItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;1450 /**1451 * Remove admin of a collection.1452 * 1453 * An admin address can remove itself. List of admins may become empty,1454 * in which case only Collection Owner will be able to add an Admin.1455 * 1456 * # Permissions1457 * 1458 * * Collection owner1459 * * Collection admin1460 * 1461 * # Arguments1462 * 1463 * * `collection_id`: ID of the collection to remove the admin for.1464 * * `account_id`: Address of the admin to remove.1465 **/1466 removeCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, accountId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1467 /**1468 * Remove a collection's a sponsor, making everyone pay for their own transactions.1469 * 1470 * # Permissions1471 * 1472 * * Collection owner1473 * 1474 * # Arguments1475 * 1476 * * `collection_id`: ID of the collection with the sponsor to remove.1477 **/1478 removeCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1479 /**1480 * Remove an address from allow list.1481 * 1482 * # Permissions1483 * 1484 * * Collection owner1485 * * Collection admin1486 * 1487 * # Arguments1488 * 1489 * * `collection_id`: ID of the modified collection.1490 * * `address`: ID of the address to be removed from the allowlist.1491 **/1492 removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;1493 /**1494 * Re-partition a refungible token, while owning all of its parts/pieces.1495 * 1496 * # Permissions1497 * 1498 * * Token owner (must own every part)1499 * 1500 * # Arguments1501 * 1502 * * `collection_id`: ID of the collection the RFT belongs to.1503 * * `token_id`: ID of the RFT.1504 * * `amount`: New number of parts/pieces into which the token shall be partitioned.1505 **/1506 repartition: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;1507 /**1508 * Sets or unsets the approval of a given operator.1509 * 1510 * The `operator` is allowed to transfer all tokens of the `owner` on their behalf.1511 * 1512 * # Arguments1513 * 1514 * * `owner`: Token owner1515 * * `operator`: Operator1516 * * `approve`: Should operator status be granted or revoked?1517 **/1518 setAllowanceForAll: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, operator: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, approve: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, bool]>;1519 /**1520 * Set specific limits of a collection. Empty, or None fields mean chain default.1521 * 1522 * # Permissions1523 * 1524 * * Collection owner1525 * * Collection admin1526 * 1527 * # Arguments1528 * 1529 * * `collection_id`: ID of the modified collection.1530 * * `new_limit`: New limits of the collection. Fields that are not set (None)1531 * will not overwrite the old ones.1532 **/1533 setCollectionLimits: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: UpDataStructsCollectionLimits | { accountTokenOwnershipLimit?: any; sponsoredDataSize?: any; sponsoredDataRateLimit?: any; tokenLimit?: any; sponsorTransferTimeout?: any; sponsorApproveTimeout?: any; ownerCanTransfer?: any; ownerCanDestroy?: any; transfersEnabled?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionLimits]>;1534 /**1535 * Set specific permissions of a collection. Empty, or None fields mean chain default.1536 * 1537 * # Permissions1538 * 1539 * * Collection owner1540 * * Collection admin1541 * 1542 * # Arguments1543 * 1544 * * `collection_id`: ID of the modified collection.1545 * * `new_permission`: New permissions of the collection. Fields that are not set (None)1546 * will not overwrite the old ones.1547 **/1548 setCollectionPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newPermission: UpDataStructsCollectionPermissions | { access?: any; mintMode?: any; nesting?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionPermissions]>;1549 /**1550 * Add or change collection properties.1551 * 1552 * # Permissions1553 * 1554 * * Collection owner1555 * * Collection admin1556 * 1557 * # Arguments1558 * 1559 * * `collection_id`: ID of the modified collection.1560 * * `properties`: Vector of key-value pairs stored as the collection's metadata.1561 * Keys support Latin letters, `-`, `_`, and `.` as symbols.1562 **/1563 setCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsProperty>]>;1564 /**1565 * Set (invite) a new collection sponsor.1566 * 1567 * If successful, confirmation from the sponsor-to-be will be pending.1568 * 1569 * # Permissions1570 * 1571 * * Collection owner1572 * * Collection admin1573 * 1574 * # Arguments1575 * 1576 * * `collection_id`: ID of the modified collection.1577 * * `new_sponsor`: ID of the account of the sponsor-to-be.1578 **/1579 setCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newSponsor: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;1580 /**1581 * Add or change token properties according to collection's permissions.1582 * Currently properties only work with NFTs.1583 * 1584 * # Permissions1585 * 1586 * * Depends on collection's token property permissions and specified property mutability:1587 * * Collection owner1588 * * Collection admin1589 * * Token owner1590 * 1591 * See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].1592 * 1593 * # Arguments1594 * 1595 * * `collection_id: ID of the collection to which the token belongs.1596 * * `token_id`: ID of the modified token.1597 * * `properties`: Vector of key-value pairs stored as the token's metadata.1598 * Keys support Latin letters, `-`, `_`, and `.` as symbols.1599 **/1600 setTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<UpDataStructsProperty>]>;1601 /**1602 * Add or change token property permissions of a collection.1603 * 1604 * Without a permission for a particular key, a property with that key1605 * cannot be created in a token.1606 * 1607 * # Permissions1608 * 1609 * * Collection owner1610 * * Collection admin1611 * 1612 * # Arguments1613 * 1614 * * `collection_id`: ID of the modified collection.1615 * * `property_permissions`: Vector of permissions for property keys.1616 * Keys support Latin letters, `-`, `_`, and `.` as symbols.1617 **/1618 setTokenPropertyPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyPermissions: Vec<UpDataStructsPropertyKeyPermission> | (UpDataStructsPropertyKeyPermission | { key?: any; permission?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsPropertyKeyPermission>]>;1619 /**1620 * Completely allow or disallow transfers for a particular collection.1621 * 1622 * # Permissions1623 * 1624 * * Collection owner1625 * 1626 * # Arguments1627 * 1628 * * `collection_id`: ID of the collection.1629 * * `value`: New value of the flag, are transfers allowed?1630 **/1631 setTransfersEnabledFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;1632 /**1633 * Change ownership of the token.1634 * 1635 * # Permissions1636 * 1637 * * Collection owner1638 * * Collection admin1639 * * Current token owner1640 * 1641 * # Arguments1642 * 1643 * * `recipient`: Address of token recipient.1644 * * `collection_id`: ID of the collection the item belongs to.1645 * * `item_id`: ID of the item.1646 * * Non-Fungible Mode: Required.1647 * * Fungible Mode: Ignored.1648 * * Re-Fungible Mode: Required.1649 * 1650 * * `value`: Amount to transfer.1651 * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1652 * * Fungible Mode: The desired number of pieces to transfer.1653 * * Re-Fungible Mode: The desired number of pieces to transfer.1654 **/1655 transfer: AugmentedSubmittable<(recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;1656 /**1657 * Change ownership of an item on behalf of the owner as a non-owner account.1658 * 1659 * See the [`approve`][`Pallet::approve`] method for additional information.1660 * 1661 * After this method executes, one approval is removed from the total so that1662 * the approved address will not be able to transfer this item again from this owner.1663 * 1664 * # Permissions1665 * 1666 * * Collection owner1667 * * Collection admin1668 * * Current item owner1669 * * Address approved by current item owner1670 * 1671 * # Arguments1672 * 1673 * * `from`: Address that currently owns the token.1674 * * `recipient`: Address of the new token-owner-to-be.1675 * * `collection_id`: ID of the collection the item.1676 * * `item_id`: ID of the item to be transferred.1677 * * `value`: Amount to transfer.1678 * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1679 * * Fungible Mode: The desired number of pieces to transfer.1680 * * Re-Fungible Mode: The desired number of pieces to transfer.1681 **/1682 transferFrom: AugmentedSubmittable<(from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;1683 /**1684 * Generic tx1685 **/1686 [key: string]: SubmittableExtrinsicFunction<ApiType>;1687 };1688 vesting: {1689 claim: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;1690 claimFor: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;1691 updateVestingSchedules: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, vestingSchedules: Vec<OrmlVestingVestingSchedule> | (OrmlVestingVestingSchedule | { start?: any; period?: any; periodCount?: any; perPeriod?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [MultiAddress, Vec<OrmlVestingVestingSchedule>]>;1692 vestedTransfer: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: OrmlVestingVestingSchedule | { start?: any; period?: any; periodCount?: any; perPeriod?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, OrmlVestingVestingSchedule]>;1693 /**1694 * Generic tx1695 **/1696 [key: string]: SubmittableExtrinsicFunction<ApiType>;1697 };1698 xcmpQueue: {1699 /**1700 * Resumes all XCM executions for the XCMP queue.1701 * 1702 * Note that this function doesn't change the status of the in/out bound channels.1703 * 1704 * - `origin`: Must pass `ControllerOrigin`.1705 **/1706 resumeXcmExecution: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;1707 /**1708 * Services a single overweight XCM.1709 * 1710 * - `origin`: Must pass `ExecuteOverweightOrigin`.1711 * - `index`: The index of the overweight XCM to service1712 * - `weight_limit`: The amount of weight that XCM execution may take.1713 * 1714 * Errors:1715 * - `BadOverweightIndex`: XCM under `index` is not found in the `Overweight` storage map.1716 * - `BadXcm`: XCM under `index` cannot be properly decoded into a valid XCM format.1717 * - `WeightOverLimit`: XCM execution may use greater `weight_limit`.1718 * 1719 * Events:1720 * - `OverweightServiced`: On success.1721 **/1722 serviceOverweight: AugmentedSubmittable<(index: u64 | AnyNumber | Uint8Array, weightLimit: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64, u64]>;1723 /**1724 * Suspends all XCM executions for the XCMP queue, regardless of the sender's origin.1725 * 1726 * - `origin`: Must pass `ControllerOrigin`.1727 **/1728 suspendXcmExecution: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;1729 /**1730 * Overwrites the number of pages of messages which must be in the queue after which we drop any further1731 * messages from the channel.1732 * 1733 * - `origin`: Must pass `Root`.1734 * - `new`: Desired value for `QueueConfigData.drop_threshold`1735 **/1736 updateDropThreshold: AugmentedSubmittable<(updated: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1737 /**1738 * Overwrites the number of pages of messages which the queue must be reduced to before it signals that1739 * message sending may recommence after it has been suspended.1740 * 1741 * - `origin`: Must pass `Root`.1742 * - `new`: Desired value for `QueueConfigData.resume_threshold`1743 **/1744 updateResumeThreshold: AugmentedSubmittable<(updated: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1745 /**1746 * Overwrites the number of pages of messages which must be in the queue for the other side to be told to1747 * suspend their sending.1748 * 1749 * - `origin`: Must pass `Root`.1750 * - `new`: Desired value for `QueueConfigData.suspend_value`1751 **/1752 updateSuspendThreshold: AugmentedSubmittable<(updated: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;1753 /**1754 * Overwrites the amount of remaining weight under which we stop processing messages.1755 * 1756 * - `origin`: Must pass `Root`.1757 * - `new`: Desired value for `QueueConfigData.threshold_weight`1758 **/1759 updateThresholdWeight: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;1760 /**1761 * Overwrites the speed to which the available weight approaches the maximum weight.1762 * A lower number results in a faster progression. A value of 1 makes the entire weight available initially.1763 * 1764 * - `origin`: Must pass `Root`.1765 * - `new`: Desired value for `QueueConfigData.weight_restrict_decay`.1766 **/1767 updateWeightRestrictDecay: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;1768 /**1769 * Overwrite the maximum amount of weight any individual message may consume.1770 * Messages above this weight go into the overweight queue and may only be serviced explicitly.1771 * 1772 * - `origin`: Must pass `Root`.1773 * - `new`: Desired value for `QueueConfigData.xcmp_max_individual_weight`.1774 **/1775 updateXcmpMaxIndividualWeight: AugmentedSubmittable<(updated: u64 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u64]>;1776 /**1777 * Generic tx1778 **/1779 [key: string]: SubmittableExtrinsicFunction<ApiType>;1780 };1781 xTokens: {1782 /**1783 * Transfer native currencies.1784 * 1785 * `dest_weight_limit` is the weight for XCM execution on the dest1786 * chain, and it would be charged from the transferred assets. If set1787 * below requirements, the execution may fail and assets wouldn't be1788 * received.1789 * 1790 * It's a no-op if any error on local XCM execution or message sending.1791 * Note sending assets out per se doesn't guarantee they would be1792 * received. Receiving depends on if the XCM message could be delivered1793 * by the network, and if the receiving chain would handle1794 * messages correctly.1795 **/1796 transfer: AugmentedSubmittable<(currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletForeignAssetsAssetIds, u128, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1797 /**1798 * Transfer `MultiAsset`.1799 * 1800 * `dest_weight_limit` is the weight for XCM execution on the dest1801 * chain, and it would be charged from the transferred assets. If set1802 * below requirements, the execution may fail and assets wouldn't be1803 * received.1804 * 1805 * It's a no-op if any error on local XCM execution or message sending.1806 * Note sending assets out per se doesn't guarantee they would be1807 * received. Receiving depends on if the XCM message could be delivered1808 * by the network, and if the receiving chain would handle1809 * messages correctly.1810 **/1811 transferMultiasset: AugmentedSubmittable<(asset: XcmVersionedMultiAsset | { V0: any } | { V1: any } | string | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiAsset, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1812 /**1813 * Transfer several `MultiAsset` specifying the item to be used as fee1814 * 1815 * `dest_weight_limit` is the weight for XCM execution on the dest1816 * chain, and it would be charged from the transferred assets. If set1817 * below requirements, the execution may fail and assets wouldn't be1818 * received.1819 * 1820 * `fee_item` is index of the MultiAssets that we want to use for1821 * payment1822 * 1823 * It's a no-op if any error on local XCM execution or message sending.1824 * Note sending assets out per se doesn't guarantee they would be1825 * received. Receiving depends on if the XCM message could be delivered1826 * by the network, and if the receiving chain would handle1827 * messages correctly.1828 **/1829 transferMultiassets: AugmentedSubmittable<(assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeItem: u32 | AnyNumber | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiAssets, u32, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1830 /**1831 * Transfer `MultiAsset` specifying the fee and amount as separate.1832 * 1833 * `dest_weight_limit` is the weight for XCM execution on the dest1834 * chain, and it would be charged from the transferred assets. If set1835 * below requirements, the execution may fail and assets wouldn't be1836 * received.1837 * 1838 * `fee` is the multiasset to be spent to pay for execution in1839 * destination chain. Both fee and amount will be subtracted form the1840 * callers balance For now we only accept fee and asset having the same1841 * `MultiLocation` id.1842 * 1843 * If `fee` is not high enough to cover for the execution costs in the1844 * destination chain, then the assets will be trapped in the1845 * destination chain1846 * 1847 * It's a no-op if any error on local XCM execution or message sending.1848 * Note sending assets out per se doesn't guarantee they would be1849 * received. Receiving depends on if the XCM message could be delivered1850 * by the network, and if the receiving chain would handle1851 * messages correctly.1852 **/1853 transferMultiassetWithFee: AugmentedSubmittable<(asset: XcmVersionedMultiAsset | { V0: any } | { V1: any } | string | Uint8Array, fee: XcmVersionedMultiAsset | { V0: any } | { V1: any } | string | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiAsset, XcmVersionedMultiAsset, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1854 /**1855 * Transfer several currencies specifying the item to be used as fee1856 * 1857 * `dest_weight_limit` is the weight for XCM execution on the dest1858 * chain, and it would be charged from the transferred assets. If set1859 * below requirements, the execution may fail and assets wouldn't be1860 * received.1861 * 1862 * `fee_item` is index of the currencies tuple that we want to use for1863 * payment1864 * 1865 * It's a no-op if any error on local XCM execution or message sending.1866 * Note sending assets out per se doesn't guarantee they would be1867 * received. Receiving depends on if the XCM message could be delivered1868 * by the network, and if the receiving chain would handle1869 * messages correctly.1870 **/1871 transferMulticurrencies: AugmentedSubmittable<(currencies: Vec<ITuple<[PalletForeignAssetsAssetIds, u128]>> | ([PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, u128 | AnyNumber | Uint8Array])[], feeItem: u32 | AnyNumber | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[PalletForeignAssetsAssetIds, u128]>>, u32, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1872 /**1873 * Transfer native currencies specifying the fee and amount as1874 * separate.1875 * 1876 * `dest_weight_limit` is the weight for XCM execution on the dest1877 * chain, and it would be charged from the transferred assets. If set1878 * below requirements, the execution may fail and assets wouldn't be1879 * received.1880 * 1881 * `fee` is the amount to be spent to pay for execution in destination1882 * chain. Both fee and amount will be subtracted form the callers1883 * balance.1884 * 1885 * If `fee` is not high enough to cover for the execution costs in the1886 * destination chain, then the assets will be trapped in the1887 * destination chain1888 * 1889 * It's a no-op if any error on local XCM execution or message sending.1890 * Note sending assets out per se doesn't guarantee they would be1891 * received. Receiving depends on if the XCM message could be delivered1892 * by the network, and if the receiving chain would handle1893 * messages correctly.1894 **/1895 transferWithFee: AugmentedSubmittable<(currencyId: PalletForeignAssetsAssetIds | { ForeignAssetId: any } | { NativeAssetId: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, fee: u128 | AnyNumber | Uint8Array, dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, destWeightLimit: XcmV2WeightLimit | { Unlimited: any } | { Limited: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletForeignAssetsAssetIds, u128, u128, XcmVersionedMultiLocation, XcmV2WeightLimit]>;1896 /**1897 * Generic tx1898 **/1899 [key: string]: SubmittableExtrinsicFunction<ApiType>;1900 };1901 } // AugmentedSubmittables1902} // declare moduletests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1216,6 +1216,7 @@
readonly isTokenValueTooLow: boolean;
readonly isApprovedValueTooLow: boolean;
readonly isCantApproveMoreThanOwned: boolean;
+ readonly isAddressIsNotEthMirror: boolean;
readonly isAddressIsZero: boolean;
readonly isUnsupportedOperation: boolean;
readonly isNotSufficientFounds: boolean;
@@ -1231,7 +1232,7 @@
readonly isCollectionIsInternal: boolean;
readonly isConfirmSponsorshipFail: boolean;
readonly isUserIsNotCollectionAdmin: boolean;
- readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
+ readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsNotEthMirror' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
}
/** @name PalletCommonEvent */
@@ -2306,6 +2307,14 @@
readonly itemId: u32;
readonly amount: u128;
} & Struct;
+ readonly isApproveFrom: boolean;
+ readonly asApproveFrom: {
+ readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly to: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly collectionId: u32;
+ readonly itemId: u32;
+ readonly amount: u128;
+ } & Struct;
readonly isTransferFrom: boolean;
readonly asTransferFrom: {
readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
@@ -2345,7 +2354,7 @@
readonly collectionId: u32;
readonly itemId: u32;
} & Struct;
- readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
+ readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'ApproveFrom' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
}
/** @name PalletUniqueError */
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -2264,6 +2264,13 @@
itemId: 'u32',
amount: 'u128',
},
+ approve_from: {
+ from: 'PalletEvmAccountBasicCrossAccountIdRepr',
+ to: 'PalletEvmAccountBasicCrossAccountIdRepr',
+ collectionId: 'u32',
+ itemId: 'u32',
+ amount: 'u128',
+ },
transfer_from: {
from: 'PalletEvmAccountBasicCrossAccountIdRepr',
recipient: 'PalletEvmAccountBasicCrossAccountIdRepr',
@@ -3280,7 +3287,7 @@
* Lookup423: pallet_common::pallet::Error<T>
**/
PalletCommonError: {
- _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'UserIsNotAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey', 'CollectionIsExternal', 'CollectionIsInternal', 'ConfirmSponsorshipFail', 'UserIsNotCollectionAdmin']
+ _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsNotEthMirror', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'UserIsNotAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey', 'CollectionIsExternal', 'CollectionIsInternal', 'ConfirmSponsorshipFail', 'UserIsNotCollectionAdmin']
},
/**
* Lookup425: pallet_fungible::pallet::Error<T>
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2493,6 +2493,14 @@
readonly itemId: u32;
readonly amount: u128;
} & Struct;
+ readonly isApproveFrom: boolean;
+ readonly asApproveFrom: {
+ readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly to: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly collectionId: u32;
+ readonly itemId: u32;
+ readonly amount: u128;
+ } & Struct;
readonly isTransferFrom: boolean;
readonly asTransferFrom: {
readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
@@ -2532,7 +2540,7 @@
readonly collectionId: u32;
readonly itemId: u32;
} & Struct;
- readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
+ readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'ApproveFrom' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
}
/** @name UpDataStructsCollectionMode (236) */
@@ -3564,6 +3572,7 @@
readonly isTokenValueTooLow: boolean;
readonly isApprovedValueTooLow: boolean;
readonly isCantApproveMoreThanOwned: boolean;
+ readonly isAddressIsNotEthMirror: boolean;
readonly isAddressIsZero: boolean;
readonly isUnsupportedOperation: boolean;
readonly isNotSufficientFounds: boolean;
@@ -3579,7 +3588,7 @@
readonly isCollectionIsInternal: boolean;
readonly isConfirmSponsorshipFail: boolean;
readonly isUserIsNotCollectionAdmin: boolean;
- readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
+ readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsNotEthMirror' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
}
/** @name PalletFungibleError (425) */
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -633,6 +633,10 @@
let call = this.getApi() as any;
for(const part of apiCall.slice(4).split('.')) {
call = call[part];
+ if (!call) {
+ const advice = part.includes('_') ? ' Looks like it needs to be converted to camel case.' : '';
+ throw Error(`Function ${part} of api call ${apiCall} not found.${advice}`);
+ }
}
return call(...params);
}
@@ -1259,6 +1263,42 @@
}
/**
+ * Set, change, or remove approved address to transfer the ownership of the NFT from eth mirror.
+ *
+ * @param signer keyring of signer
+ * @param collectionId ID of collection
+ * @param tokenId ID of token
+ * @param fromAddressObj Signer's Ethereum address containing her tokens
+ * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens
+ * @param amount amount of token to be approved. For NFT must be set to 1n
+ * @returns ```true``` if extrinsic success, otherwise ```false```
+ */
+ async approveTokenFrom(signer: IKeyringPair, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {
+ const approveResult = await this.helper.executeExtrinsic(
+ signer,
+ 'api.tx.unique.approveFrom', [fromAddressObj, toAddressObj, collectionId, tokenId, amount],
+ true, // `Unable to approve token for ${label}`,
+ );
+
+ return this.helper.util.findCollectionInEvents(approveResult.result.events, collectionId, 'common', 'Approved');
+ }
+
+ /**
+ * Set, change, or remove approved address to transfer the ownership of the NFT from eth mirror.
+ *
+ * @param signer keyring of signer
+ * @param collectionId ID of collection
+ * @param tokenId ID of token
+ * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens
+ * @param amount amount of token to be approved. For NFT must be set to 1n
+ * @returns ```true``` if extrinsic success, otherwise ```false```
+ */
+ async approveTokenFromEth(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
+ const ethMirror = CrossAccountId.fromKeyring(signer).toEthereum();
+ return await this.approveTokenFrom(signer, collectionId, tokenId, ethMirror, toAddressObj, amount);
+ }
+
+ /**
* Get the amount of token pieces approved to transfer or burn. Normally 0.
*
* @param collectionId ID of collection
@@ -1756,8 +1796,8 @@
* @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})
* @returns ```true``` if extrinsic success, otherwise ```false```
*/
- approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {
- return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);
+ approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
+ return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);
}
}