git.delta.rocks / unique-network / refs/commits / ee40b79d7e69

difftreelog

Merge pull request #241 from UniqueNetwork/feature/unique-brand

str-mv2021-11-24parents: #bf917ac #05ae8ba.patch.diff
in: master
unique brand

129 files changed

modified.envdiffbeforeafterboth
1RUST_TOOLCHAIN=nightly-2021-06-281RUST_TOOLCHAIN=nightly-2021-06-28
2RUST_C=1.55.0-nightly2RUST_C=1.55.0-nightly
3POLKA_VERSION=v0.9.123POLKA_VERSION=v0.9.12
4NFT_BRANCH=develop4UNIQUE_BRANCH=develop
5USER=***5USER=***
6PASS=***6PASS=***
77
modifiedDockerfile-parachaindiffbeforeafterboth
5ARG RUST_TOOLCHAIN=nightly-2021-06-285ARG RUST_TOOLCHAIN=nightly-2021-06-28
6#ARG RUST_C=1.55.0-nightly6#ARG RUST_C=1.55.0-nightly
7ARG POLKA_VERSION=v0.9.127ARG POLKA_VERSION=v0.9.12
8ARG NFT_BRANCH=develop8ARG UNIQUE_BRANCH=develop
99
10#ARG USER=***10#ARG USER=***
11#ARG PASS=***11#ARG PASS=***
14ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN14ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN
15#ENV RUST_C $RUST_C15#ENV RUST_C $RUST_C
16ENV POLKA_VERSION $POLKA_VERSION16ENV POLKA_VERSION $POLKA_VERSION
17ENV NFT_BRANCH $NFT_BRANCH17ENV UNIQUE_BRANCH $UNIQUE_BRANCH
1818
1919
20#RUN echo $RUST_TOOLCHAIN20#RUN echo $RUST_TOOLCHAIN
21#RUN echo $RUST_C21#RUN echo $RUST_C
22#RUN echo $POLKA_VERSION22#RUN echo $POLKA_VERSION
23#RUN echo $NFT_BRANCH23#RUN echo $UNIQUE_BRANCH
2424
25ENV CARGO_HOME="/cargo-home"25ENV CARGO_HOME="/cargo-home"
26ENV PATH="/cargo-home/bin:$PATH"26ENV PATH="/cargo-home/bin:$PATH"
4040
41RUN cargo install cargo-chef41RUN cargo install cargo-chef
4242
43RUN mkdir nft_parachain43RUN mkdir unique_parachain
44WORKDIR /nft_parachain44WORKDIR /unique_parachain
4545
46# ===== Chef =====46# ===== Chef =====
47FROM rust-builder as chef47FROM rust-builder as chef
52# ===== BUILD ======52# ===== BUILD ======
53FROM rust-builder as builder53FROM rust-builder as builder
5454
55RUN mkdir nft_parachain55RUN mkdir unique_parachain
56WORKDIR /nft_parachain56WORKDIR /unique_parachain
5757
58COPY --from=chef /nft_parachain/recipe.json recipe.json58COPY --from=chef /unique_parachain/recipe.json recipe.json
59ARG PROFILE=release59ARG PROFILE=release
60RUN cargo chef cook "--$PROFILE" --recipe-path recipe.json60RUN cargo chef cook "--$PROFILE" --recipe-path recipe.json
6161
67# ===== BUILD POLKADOT =====67# ===== BUILD POLKADOT =====
68FROM rust-builder as builder-polkadot68FROM rust-builder as builder-polkadot
6969
70RUN mkdir nft_parachain70RUN mkdir unique_parachain
71WORKDIR /nft_parachain71WORKDIR /unique_parachain
7272
73RUN git clone -b $POLKA_VERSION --depth 1 https://github.com/paritytech/polkadot.git && \73RUN git clone -b $POLKA_VERSION --depth 1 https://github.com/paritytech/polkadot.git && \
74 cd polkadot && \74 cd polkadot && \
98 npm install --global yarn && \98 npm install --global yarn && \
99 yarn99 yarn
100100
101COPY --from=builder /nft_parachain/target/$PROFILE/nft /unique-chain/target/$PROFILE/101COPY --from=builder /unique_parachain/target/$PROFILE/unique-collator /unique-chain/target/$PROFILE/
102COPY --from=builder-polkadot /nft_parachain/polkadot/target/$PROFILE/polkadot /polkadot/target/$PROFILE/102COPY --from=builder-polkadot /unique_parachain/polkadot/target/$PROFILE/polkadot /polkadot/target/$PROFILE/
103103
104CMD export NVM_DIR="$HOME/.nvm" && \104CMD export NVM_DIR="$HOME/.nvm" && \
105 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \105 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
modifiedMakefilediffbeforeafterboth
4 @echo "evm_stubs - recompile contract stubs"4 @echo "evm_stubs - recompile contract stubs"
5 @echo "bench - run frame-benchmarking"5 @echo "bench - run frame-benchmarking"
6 @echo " bench-evm-migration"6 @echo " bench-evm-migration"
7 @echo " bench-nft"7 @echo " bench-unique"
88
9.PHONY: regenerate_solidity9.PHONY: regenerate_solidity
10regenerate_solidity:10regenerate_solidity:
41bench-evm-migration:41bench-evm-migration:
42 make _bench PALLET=evm-migration42 make _bench PALLET=evm-migration
4343
44.PHONY: bench-nft44.PHONY: bench-unique
45bench-nft:45bench-unique:
46 make _bench PALLET=nft46 make _bench PALLET=unique
4747
48.PHONY: bench-fungible48.PHONY: bench-fungible
49bench-fungible:49bench-fungible:
58 make _bench PALLET=nonfungible58 make _bench PALLET=nonfungible
5959
60.PHONY: bench60.PHONY: bench
61bench: bench-evm-migration bench-nft bench-fungible bench-refungible bench-nonfungible61bench: bench-evm-migration bench-unique bench-fungible bench-refungible bench-nonfungible
6262
modifiedREADME.mddiffbeforeafterboth
1![Docker build](https://github.com/usetech-llc/nft_parachain/workflows/Docker%20build/badge.svg)1![Docker build](https://github.com/usetech-llc/nft_parachain/workflows/Docker%20build/badge.svg)
22
3# NFT Parachain3# Unique Parachain
44
5## Project Description5## Project Description
66
7The NFT Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the7The Unique Pallet is the core of NFT functionality. Like ERC-721 standard in Ethereum ecosystem, this pallet provides the
8basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of8basement for creating collections of unique non-divisible things, also called Non Fungible Tokens (NFTs), minting NFT of
9a given Collection, and managing their ownership.9a given Collection, and managing their ownership.
1010
11The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a11The pallet also enables storing NFT properties. Though (according to ERC-721) NFT properties belong to logic of a
12concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge12concrete application that operates a Collection, so purposefully the NFT Tracking Module does not have any knowledge
13about properties except their byte size leaving application logic out to be controlled by Smart Contracts.13about properties except their byte size leaving application logic out to be controlled by Smart Contracts.
1414
15The NFT Chain also provides:15The Unique Chain also provides:
1616
17- Smart Contracts Pallet and example smart contract that interacts with NFT Runtime17- Smart Contracts Pallet and example smart contract that interacts with Unique Runtime
18- ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split18- ERC-1155 Functionality (currently PoC as Re-Fungible tokens, i.e. items that are still unique, but that can be split
19 between multiple users)19 between multiple users)
20- Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract20- Variety of economic options for dapp producers to choose from to create freemium games and other ways to attract
21 users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection21 users. As a step one, we implemented an economic model when a collection sponsor can be set to pay for collection
22 Transfer transactions.22 Transfer transactions.
2323
24Wider NFT Ecosystem (most of it was developed during Hackusama):24Wider Unique Ecosystem (most of it was developed during Hackusama):
2525
26- [SubstraPunks Game hosted on IPFS](https://github.com/usetech-llc/substrapunks)26- [SubstraPunks Game hosted on IPFS](https://github.com/usetech-llc/substrapunks)
27- [NFT Wallet and UI](https://uniqueapps.usetech.com/#/nft)27- [Unique Wallet and UI](https://uniqueapps.usetech.com/#/nft)
28- [NFT Asset for Unity Framework](https://github.com/usetech-llc/nft_unity)28- [NFT Asset for Unity Framework](https://github.com/usetech-llc/nft_unity)
2929
30Please see our [walk-thorugh instructions](doc/hackusama_walk_through.md) to try everything out!30Please see our [walk-thorugh instructions](doc/hackusama_walk_through.md) to try everything out!
34During the Kusama Hackaphon the following changes were made:34During the Kusama Hackaphon the following changes were made:
3535
36- Enabled Smart Contracts Pallet36- Enabled Smart Contracts Pallet
37- Enabled integration between Smart Contracts and NFT Pallet (required special edition of RC4 Substrate version)37- Enabled integration between Smart Contracts and Unique Pallet (required special edition of RC4 Substrate version)
38- Fixed misc. bugs in NFT Pallet38- Fixed misc. bugs in Unique Pallet
39- Deployed NFT TestNet. Public node available at wss://unique.usetech.com, custom UI types - see below in this README.39- Deployed Unique TestNet. Public node available at wss://unique.usetech.com, custom UI types - see below in this README.
40- New Features:40- New Features:
41 - Re-Fungible Token Mode41 - Re-Fungible Token Mode
42 - Off-Chain Schema to store token image URLs42 - Off-Chain Schema to store token image URLs
43 - Alternative economic model43 - Alternative economic model
44 - Allow Lists and Public Mint Permission44 - Allow Lists and Public Mint Permission
45- Use example: [SubstraPunks Game](https://github.com/usetech-llc/substrapunks), fully hosted on IPFS and NFT Testnet45- Use example: [SubstraPunks Game](https://github.com/usetech-llc/substrapunks), fully hosted on IPFS and Unique Testnet
46 Blockchain.46 Blockchain.
4747
48## Application Development48## Application Development
5151
52## Building52## Building
5353
54Building NFT chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything54Building Unique chain requires special versions of Rust and toolchain. We don't use the most recent versions of everything
55so that we can keep the builds stable.55so that we can keep the builds stable.
5656
571. Install Rust:571. Install Rust:
168168
169```169```
170170
1713. Export genesis state and runtime wasm from NFT parachain:1713. Export genesis state and runtime wasm from Unique parachain:
172172
173Run from this project root:173Run from this project root:
174```174```
175./target/release/nft export-genesis-state --parachain-id 2000 > ./resources/para-2000-genesis175./target/release/unique-collator export-genesis-state --parachain-id 2000 > ./resources/para-2000-genesis
176./target/release/nft export-genesis-wasm > ./resources/para-2000-wasm176./target/release/unique-collator export-genesis-wasm > ./resources/para-2000-wasm
177```177```
178178
1794. Run two parachain nodes:1794. Run two parachain nodes:
182182
183Run from this project root:183Run from this project root:
184```184```
185./target/release/nft --alice --collator --force-authoring --base-path ./tmp/parachain-alice --parachain-id 2000 --port 40333 --ws-port 9844 -- --execution wasm --chain ../polkadot/rococo-custom-4.json --port 30343 --ws-port 9977185./target/release/unique-collator --alice --collator --force-authoring --base-path ./tmp/parachain-alice --parachain-id 2000 --port 40333 --ws-port 9844 -- --execution wasm --chain ../polkadot/rococo-custom-4.json --port 30343 --ws-port 9977
186./target/release/nft --bob --collator --force-authoring --parachain-id 2000 --base-path ./tmp/parachain/bob --port 40334 --ws-port 9845 -- --execution wasm --chain ../polkadot/rococo-custom-4.json --port 30344 --ws-port 9978 --bootnodes /ip4/127.0.0.1/tcp/50556/p2p/12D3KooWN1ah2bFQSysEFnwZqcmcVpDDR8UedXyo6xfzV1zDNMNg186./target/release/unique-collator --bob --collator --force-authoring --parachain-id 2000 --base-path ./tmp/parachain/bob --port 40334 --ws-port 9845 -- --execution wasm --chain ../polkadot/rococo-custom-4.json --port 30344 --ws-port 9978 --bootnodes /ip4/127.0.0.1/tcp/50556/p2p/12D3KooWN1ah2bFQSysEFnwZqcmcVpDDR8UedXyo6xfzV1zDNMNg
187```187```
188188
1894. Reserve parachain ID as described here: https://substrate.dev/cumulus-workshop/#/en/2-relay-chain/2-reserve1894. Reserve parachain ID as described here: https://substrate.dev/cumulus-workshop/#/en/2-relay-chain/2-reserve
218218
219Run benchmark219Run benchmark
220```bash220```bash
221target/release/nft benchmark --chain dev --pallet "pallet_nft" --extrinsic "*" --repeat 1221target/release/unique-collator benchmark --chain dev --pallet "pallet_unique" --extrinsic "*" --repeat 1
222```222```
223223
224## UI custom types224## UI custom types
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
55
6[dependencies]6[dependencies]
7pallet-common = { default-features = false, path = '../../pallets/common' }7pallet-common = { default-features = false, path = '../../pallets/common' }
8nft-data-structs = { default-features = false, path = '../../primitives/nft' }8up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
9up-rpc = { path = "../../primitives/rpc" }9up-rpc = { path = "../../primitives/rpc" }
10codec = { package = "parity-scale-codec", version = "2.0.0" }10codec = { package = "parity-scale-codec", version = "2.0.0" }
11jsonrpc-core = "18.0.0"11jsonrpc-core = "18.0.0"
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
3use codec::Decode;3use codec::Decode;
4use jsonrpc_core::{Error as RpcError, ErrorCode, Result};4use jsonrpc_core::{Error as RpcError, ErrorCode, Result};
5use jsonrpc_derive::rpc;5use jsonrpc_derive::rpc;
6use nft_data_structs::{Collection, CollectionId, CollectionStats, TokenId};6use up_data_structs::{Collection, CollectionId, CollectionStats, TokenId};
7use sp_api::{BlockId, BlockT, ProvideRuntimeApi};7use sp_api::{BlockId, BlockT, ProvideRuntimeApi};
8use sp_blockchain::HeaderBackend;8use sp_blockchain::HeaderBackend;
9use up_rpc::NftApi as NftRuntimeApi;9use up_rpc::UniqueApi as UniqueRuntimeApi;
1010
11#[rpc]11#[rpc]
12pub trait NftApi<BlockHash, CrossAccountId, AccountId> {12pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {
13 #[rpc(name = "nft_accountTokens")]13 #[rpc(name = "unique_accountTokens")]
14 fn account_tokens(14 fn account_tokens(
15 &self,15 &self,
16 collection: CollectionId,16 collection: CollectionId,
17 account: CrossAccountId,17 account: CrossAccountId,
18 at: Option<BlockHash>,18 at: Option<BlockHash>,
19 ) -> Result<Vec<TokenId>>;19 ) -> Result<Vec<TokenId>>;
20 #[rpc(name = "nft_tokenExists")]20 #[rpc(name = "unique_tokenExists")]
21 fn token_exists(21 fn token_exists(
22 &self,22 &self,
23 collection: CollectionId,23 collection: CollectionId,
24 token: TokenId,24 token: TokenId,
25 at: Option<BlockHash>,25 at: Option<BlockHash>,
26 ) -> Result<bool>;26 ) -> Result<bool>;
2727
28 #[rpc(name = "nft_tokenOwner")]28 #[rpc(name = "unique_tokenOwner")]
29 fn token_owner(29 fn token_owner(
30 &self,30 &self,
31 collection: CollectionId,31 collection: CollectionId,
32 token: TokenId,32 token: TokenId,
33 at: Option<BlockHash>,33 at: Option<BlockHash>,
34 ) -> Result<CrossAccountId>;34 ) -> Result<CrossAccountId>;
35 #[rpc(name = "nft_constMetadata")]35 #[rpc(name = "unique_constMetadata")]
36 fn const_metadata(36 fn const_metadata(
37 &self,37 &self,
38 collection: CollectionId,38 collection: CollectionId,
39 token: TokenId,39 token: TokenId,
40 at: Option<BlockHash>,40 at: Option<BlockHash>,
41 ) -> Result<Vec<u8>>;41 ) -> Result<Vec<u8>>;
42 #[rpc(name = "nft_variableMetadata")]42 #[rpc(name = "unique_variableMetadata")]
43 fn variable_metadata(43 fn variable_metadata(
44 &self,44 &self,
45 collection: CollectionId,45 collection: CollectionId,
46 token: TokenId,46 token: TokenId,
47 at: Option<BlockHash>,47 at: Option<BlockHash>,
48 ) -> Result<Vec<u8>>;48 ) -> Result<Vec<u8>>;
4949
50 #[rpc(name = "nft_collectionTokens")]50 #[rpc(name = "unique_collectionTokens")]
51 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;51 fn collection_tokens(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;
52 #[rpc(name = "nft_accountBalance")]52 #[rpc(name = "unique_accountBalance")]
53 fn account_balance(53 fn account_balance(
54 &self,54 &self,
55 collection: CollectionId,55 collection: CollectionId,
56 account: CrossAccountId,56 account: CrossAccountId,
57 at: Option<BlockHash>,57 at: Option<BlockHash>,
58 ) -> Result<u32>;58 ) -> Result<u32>;
59 #[rpc(name = "nft_balance")]59 #[rpc(name = "unique_balance")]
60 fn balance(60 fn balance(
61 &self,61 &self,
62 collection: CollectionId,62 collection: CollectionId,
63 account: CrossAccountId,63 account: CrossAccountId,
64 token: TokenId,64 token: TokenId,
65 at: Option<BlockHash>,65 at: Option<BlockHash>,
66 ) -> Result<String>;66 ) -> Result<String>;
67 #[rpc(name = "nft_allowance")]67 #[rpc(name = "unique_allowance")]
68 fn allowance(68 fn allowance(
69 &self,69 &self,
70 collection: CollectionId,70 collection: CollectionId,
74 at: Option<BlockHash>,74 at: Option<BlockHash>,
75 ) -> Result<String>;75 ) -> Result<String>;
7676
77 #[rpc(name = "nft_adminlist")]77 #[rpc(name = "unique_adminlist")]
78 fn adminlist(78 fn adminlist(
79 &self,79 &self,
80 collection: CollectionId,80 collection: CollectionId,
81 at: Option<BlockHash>,81 at: Option<BlockHash>,
82 ) -> Result<Vec<CrossAccountId>>;82 ) -> Result<Vec<CrossAccountId>>;
83 #[rpc(name = "nft_allowlist")]83 #[rpc(name = "unique_allowlist")]
84 fn allowlist(84 fn allowlist(
85 &self,85 &self,
86 collection: CollectionId,86 collection: CollectionId,
87 at: Option<BlockHash>,87 at: Option<BlockHash>,
88 ) -> Result<Vec<CrossAccountId>>;88 ) -> Result<Vec<CrossAccountId>>;
89 #[rpc(name = "nft_allowed")]89 #[rpc(name = "unique_allowed")]
90 fn allowed(90 fn allowed(
91 &self,91 &self,
92 collection: CollectionId,92 collection: CollectionId,
93 user: CrossAccountId,93 user: CrossAccountId,
94 at: Option<BlockHash>,94 at: Option<BlockHash>,
95 ) -> Result<bool>;95 ) -> Result<bool>;
96 #[rpc(name = "nft_lastTokenId")]96 #[rpc(name = "unique_lastTokenId")]
97 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;97 fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
98 #[rpc(name = "nft_collectionById")]98 #[rpc(name = "unique_collectionById")]
99 fn collection_by_id(99 fn collection_by_id(
100 &self,100 &self,
101 collection: CollectionId,101 collection: CollectionId,
102 at: Option<BlockHash>,102 at: Option<BlockHash>,
103 ) -> Result<Option<Collection<AccountId>>>;103 ) -> Result<Option<Collection<AccountId>>>;
104 #[rpc(name = "nft_collectionStats")]104 #[rpc(name = "unique_collectionStats")]
105 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;105 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
106}106}
107107
108pub struct Nft<C, P> {108pub struct Unique<C, P> {
109 client: Arc<C>,109 client: Arc<C>,
110 _marker: std::marker::PhantomData<P>,110 _marker: std::marker::PhantomData<P>,
111}111}
112112
113impl<C, P> Nft<C, P> {113impl<C, P> Unique<C, P> {
114 pub fn new(client: Arc<C>) -> Self {114 pub fn new(client: Arc<C>) -> Self {
115 Self {115 Self {
116 client,116 client,
154 };154 };
155}155}
156156
157impl<C, Block, CrossAccountId, AccountId> NftApi<<Block as BlockT>::Hash, CrossAccountId, AccountId>157impl<C, Block, CrossAccountId, AccountId>
158 for Nft<C, Block>158 UniqueApi<<Block as BlockT>::Hash, CrossAccountId, AccountId> for Unique<C, Block>
159where159where
160 Block: BlockT,160 Block: BlockT,
161 AccountId: Decode,161 AccountId: Decode,
162 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,162 C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
163 C::Api: NftRuntimeApi<Block, CrossAccountId, AccountId>,163 C::Api: UniqueRuntimeApi<Block, CrossAccountId, AccountId>,
164 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,164 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,
165{165{
166 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);166 pass_method!(account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId>);
modifieddocker-compose-tests-parachain.ymldiffbeforeafterboth
9 - RUST_TOOLCHAIN=${RUST_TOOLCHAIN:?err}9 - RUST_TOOLCHAIN=${RUST_TOOLCHAIN:?err}
10 - RUST_C=${RUST_C:?err}10 - RUST_C=${RUST_C:?err}
11 - POLKA_VERSION=${POLKA_VERSION:?err}11 - POLKA_VERSION=${POLKA_VERSION:?err}
12 - NFT_BRANCH=${NFT_BRANCH:?err}12 - UNIQUE_BRANCH=${UNIQUE_BRANCH:?err}
13 volumes:13 volumes:
14 - ./launch-config.json:/polkadot-launch/launch-config.json14 - ./launch-config.json:/polkadot-launch/launch-config.json
15 env_file:15 env_file:
22 environment:22 environment:
23 RPC_URL: http://blockchain_nodes:9933/23 RPC_URL: http://blockchain_nodes:9933/
24 volumes:24 volumes:
25 - ./tests/src/config_docker.ts:/nft_parachain/src/config.ts25 - ./tests/src/config_docker.ts:/unique_parachain/src/config.ts
26 - /home/ubuntu/mochawesome-report:/nft_parachain/mochawesome-report26 - /home/ubuntu/mochawesome-report:/unique_parachain/mochawesome-report
27 depends_on:27 depends_on:
28 - blockchain_nodes28 - blockchain_nodes
2929
modifiedlaunch-config.jsondiffbeforeafterboth
55 },55 },
56 "parachains": [56 "parachains": [
57 {57 {
58 "bin": "../unique-chain/target/release/nft",58 "bin": "../unique-chain/target/release/unique-collator",
59 "id": "2000",59 "id": "2000",
60 "balance": "1000000000000000000000",60 "balance": "1000000000000000000000",
61 "nodes": [61 "nodes": [
modifiednode/cli/Cargo.tomldiffbeforeafterboth
231################################################################################231################################################################################
232# Local dependencies232# Local dependencies
233233
234[dependencies.nft-runtime]234[dependencies.unique-runtime]
235path = '../../runtime'235path = '../../runtime'
236version = '0.9.12'
237236
238[dependencies.nft-data-structs]237[dependencies.up-data-structs]
239path = "../../primitives/nft"238path = "../../primitives/data-structs"
240default-features = false239default-features = false
241240
242################################################################################241################################################################################
245[package]244[package]
246authors = ['Unique Network <support@uniquenetwork.io>']245authors = ['Unique Network <support@uniquenetwork.io>']
247build = 'build.rs'246build = 'build.rs'
248description = 'Substrate node nft'247description = 'Unique Node'
249edition = '2018'248edition = '2018'
250homepage = 'https://unique.network'249homepage = 'https://unique.network'
251license = 'All Rights Reserved'250license = 'All Rights Reserved'
252name = 'nft'251name = 'unique-node'
253repository = 'https://github.com/usetech-llc/nft_private/'252repository = 'https://github.com/UniqueNetwork/unique-chain'
254version = '0.9.12'253version = '0.9.12'
255254
256[[bin]]255[[bin]]
257name = 'nft'256name = 'unique-collator'
257path = "src/main.rs"
258258
259[package.metadata.docs.rs]259[package.metadata.docs.rs]
260targets = ['x86_64-unknown-linux-gnu']260targets = ['x86_64-unknown-linux-gnu']
276fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }276fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
277pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }277pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
278278
279nft-rpc = { path = "../rpc" }279unique-rpc = { path = "../rpc" }
280280
281[features]281[features]
282default = []282default = []
283runtime-benchmarks = [283runtime-benchmarks = [
284 'nft-runtime/runtime-benchmarks',284 'unique-runtime/runtime-benchmarks',
285 'polkadot-service/runtime-benchmarks',285 'polkadot-service/runtime-benchmarks',
286]286]
287287
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
4//4//
55
6use cumulus_primitives_core::ParaId;6use cumulus_primitives_core::ParaId;
7use nft_runtime::*;7use unique_runtime::*;
8use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};8use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
9use sc_service::ChainType;9use sc_service::ChainType;
10use sp_core::{sr25519, Pair, Public};10use sp_core::{sr25519, Pair, Public};
15use serde_json::map::Map;15use serde_json::map::Map;
1616
17/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.17/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
18pub type ChainSpec = sc_service::GenericChainSpec<nft_runtime::GenesisConfig, Extensions>;18pub type ChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;
1919
20/// Helper function to generate a crypto pair from seed20/// Helper function to generate a crypto pair from seed
21pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {21pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
151 id: ParaId,151 id: ParaId,
152) -> GenesisConfig {152) -> GenesisConfig {
153 GenesisConfig {153 GenesisConfig {
154 system: nft_runtime::SystemConfig {154 system: unique_runtime::SystemConfig {
155 code: nft_runtime::WASM_BINARY155 code: unique_runtime::WASM_BINARY
156 .expect("WASM binary was not build, please build it!")156 .expect("WASM binary was not build, please build it!")
157 .to_vec(),157 .to_vec(),
158 changes_trie_config: Default::default(),158 changes_trie_config: Default::default(),
167 treasury: Default::default(),167 treasury: Default::default(),
168 sudo: SudoConfig { key: root_key },168 sudo: SudoConfig { key: root_key },
169 vesting: VestingConfig { vesting: vec![] },169 vesting: VestingConfig { vesting: vec![] },
170 parachain_info: nft_runtime::ParachainInfoConfig { parachain_id: id },170 parachain_info: unique_runtime::ParachainInfoConfig { parachain_id: id },
171 aura: nft_runtime::AuraConfig {171 aura: unique_runtime::AuraConfig {
172 authorities: initial_authorities,172 authorities: initial_authorities,
173 },173 },
174 aura_ext: Default::default(),174 aura_ext: Default::default(),
modifiednode/cli/src/command.rsdiffbeforeafterboth
24use cumulus_primitives_core::ParaId;24use cumulus_primitives_core::ParaId;
25use cumulus_client_service::genesis::generate_genesis_block;25use cumulus_client_service::genesis::generate_genesis_block;
26use log::info;26use log::info;
27use nft_runtime::Block;27use unique_runtime::Block;
28use polkadot_parachain::primitives::AccountIdConversion;28use polkadot_parachain::primitives::AccountIdConversion;
29use sc_cli::{29use sc_cli::{
30 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,30 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
88 }88 }
8989
90 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {90 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
91 &nft_runtime::VERSION91 &unique_runtime::VERSION
92 }92 }
93}93}
9494
modifiednode/cli/src/service.rsdiffbeforeafterboth
13use futures::StreamExt;13use futures::StreamExt;
1414
15// Local Runtime Types15// Local Runtime Types
16use nft_runtime::RuntimeApi;16use unique_runtime::RuntimeApi;
1717
18// Cumulus Imports18// Cumulus Imports
19use cumulus_client_consensus_aura::{build_aura_consensus, BuildAuraConsensusParams, SlotProportion};19use cumulus_client_consensus_aura::{build_aura_consensus, BuildAuraConsensusParams, SlotProportion};
54 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;54 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
5555
56 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {56 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
57 nft_runtime::api::dispatch(method, data)57 unique_runtime::api::dispatch(method, data)
58 }58 }
5959
60 fn native_version() -> sc_executor::NativeVersion {60 fn native_version() -> sc_executor::NativeVersion {
61 nft_runtime::native_version()61 unique_runtime::native_version()
62 }62 }
63}63}
6464
68 .as_ref()68 .as_ref()
69 .map(|base_path| base_path.config_dir(config.chain_spec.id()))69 .map(|base_path| base_path.config_dir(config.chain_spec.id()))
70 .unwrap_or_else(|| {70 .unwrap_or_else(|| {
71 BasePath::from_project("", "", "nft").config_dir(config.chain_spec.id())71 BasePath::from_project("", "", "unique").config_dir(config.chain_spec.id())
72 });72 });
73 let database_dir = config_dir.join("frontier").join("db");73 let database_dir = config_dir.join("frontier").join("db");
7474
291291
292 let rpc_frontier_backend = frontier_backend.clone();292 let rpc_frontier_backend = frontier_backend.clone();
293 let rpc_extensions_builder = Box::new(move |deny_unsafe, _| {293 let rpc_extensions_builder = Box::new(move |deny_unsafe, _| {
294 let full_deps = nft_rpc::FullDeps {294 let full_deps = unique_rpc::FullDeps {
295 backend: rpc_frontier_backend.clone(),295 backend: rpc_frontier_backend.clone(),
296 deny_unsafe,296 deny_unsafe,
297 client: rpc_client.clone(),297 client: rpc_client.clone(),
307 max_past_logs: 10000,307 max_past_logs: 10000,
308 };308 };
309309
310 Ok(nft_rpc::create_full::<_, _, _, _, RuntimeApi, _>(310 Ok(unique_rpc::create_full::<_, _, _, _, RuntimeApi, _>(
311 full_deps,311 full_deps,
312 subscription_executor.clone(),312 subscription_executor.clone(),
313 ))313 ))
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "nft-rpc"2name = "unique-rpc"
3version = "3.3.1"3version = "0.1.0"
4authors = ['Unique Network <support@uniquenetwork.io>']4authors = ['Unique Network <support@uniquenetwork.io>']
5license = 'All Rights Reserved'5license = 'All Rights Reserved'
6edition = "2018"6edition = "2018"
48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }48fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }49fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
5050
51pallet-nft = { path = "../../pallets/nft" }51pallet-unique = { path = "../../pallets/unique" }
52uc-rpc = { path = "../../client/rpc" }52uc-rpc = { path = "../../client/rpc" }
53up-rpc = { path = "../../primitives/rpc" }53up-rpc = { path = "../../primitives/rpc" }
54nft-runtime = { path = "../../runtime" }54unique-runtime = { path = "../../runtime" }
5555
56[features]56[features]
57std = []57std = []
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
1use nft_runtime::{Hash, AccountId, CrossAccountId, Index, opaque::Block, BlockNumber, Balance};1use unique_runtime::{Hash, AccountId, CrossAccountId, Index, opaque::Block, BlockNumber, Balance};
2use fc_rpc::{2use fc_rpc::{
3 EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, StorageOverride,3 EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, StorageOverride,
4};4};
100where100where
101 Block: sp_api::BlockT,101 Block: sp_api::BlockT,
102 C: ProvideRuntimeApi<Block>,102 C: ProvideRuntimeApi<Block>,
103 C::Api: up_rpc::NftApi<Block, CrossAccountId, AccountId>,103 C::Api: up_rpc::UniqueApi<Block, CrossAccountId, AccountId>,
104{104{
105 fn code(&self, block: &sp_api::BlockId<Block>, account: sp_core::H160) -> Option<Vec<u8>> {105 fn code(&self, block: &sp_api::BlockId<Block>, account: sp_core::H160) -> Option<Vec<u8>> {
106 use up_rpc::NftApi;106 use up_rpc::UniqueApi;
107 self.client107 self.client
108 .runtime_api()108 .runtime_api()
109 .eth_contract_code(block, account)109 .eth_contract_code(block, account)
127 // C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,127 // C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
128 C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,128 C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
129 C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,129 C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,
130 C::Api: up_rpc::NftApi<Block, CrossAccountId, AccountId>,130 C::Api: up_rpc::UniqueApi<Block, CrossAccountId, AccountId>,
131 B: sc_client_api::Backend<Block> + Send + Sync + 'static,131 B: sc_client_api::Backend<Block> + Send + Sync + 'static,
132 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,132 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
133 SC: SelectChain<Block> + 'static,133 SC: SelectChain<Block> + 'static,
139 EthPubSubApiServer, EthSigner, HexEncodedIdProvider, NetApi, NetApiServer, Web3Api,139 EthPubSubApiServer, EthSigner, HexEncodedIdProvider, NetApi, NetApiServer, Web3Api,
140 Web3ApiServer,140 Web3ApiServer,
141 };141 };
142 use uc_rpc::{NftApi, Nft};142 use uc_rpc::{UniqueApi, Unique};
143 // use pallet_contracts_rpc::{Contracts, ContractsApi};143 // use pallet_contracts_rpc::{Contracts, ContractsApi};
144 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};144 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
145 use substrate_frame_rpc_system::{FullSystem, SystemApi};145 use substrate_frame_rpc_system::{FullSystem, SystemApi};
195 client.clone(),195 client.clone(),
196 pool.clone(),196 pool.clone(),
197 graph,197 graph,
198 nft_runtime::TransactionConverter,198 unique_runtime::TransactionConverter,
199 network.clone(),199 network.clone(),
200 signers,200 signers,
201 overrides.clone(),201 overrides.clone(),
204 max_past_logs,204 max_past_logs,
205 block_data_cache.clone(),205 block_data_cache.clone(),
206 )));206 )));
207 io.extend_with(NftApi::to_delegate(Nft::new(client.clone())));207 io.extend_with(UniqueApi::to_delegate(Unique::new(client.clone())));
208208
209 if let Some(filter_pool) = filter_pool {209 if let Some(filter_pool) = filter_pool {
210 io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(210 io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
18up-evm-mapping = { default-features = false, path = '../../primitives/evm-mapping' }18up-evm-mapping = { default-features = false, path = '../../primitives/evm-mapping' }
19nft-data-structs = { default-features = false, path = '../../primitives/nft' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
20pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }20pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
21evm-coder = { default-features = false, path = '../../crates/evm-coder' }21evm-coder = { default-features = false, path = '../../crates/evm-coder' }
22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
33 "sp-runtime/std",33 "sp-runtime/std",
34 "sp-std/std",34 "sp-std/std",
35 "up-evm-mapping/std",35 "up-evm-mapping/std",
36 "nft-data-structs/std",36 "up-data-structs/std",
37 "pallet-evm/std",37 "pallet-evm/std",
38]38]
39runtime-benchmarks = []39runtime-benchmarks = []
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
1use sp_std::vec::Vec;1use sp_std::vec::Vec;
2use crate::{Config, CollectionHandle};2use crate::{Config, CollectionHandle};
3use nft_data_structs::{3use up_data_structs::{
4 CollectionMode, Collection, CollectionId, MAX_COLLECTION_NAME_LENGTH,4 CollectionMode, Collection, CollectionId, MAX_COLLECTION_NAME_LENGTH,
5 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, OFFCHAIN_SCHEMA_LIMIT,5 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH, OFFCHAIN_SCHEMA_LIMIT,
6 VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT,6 VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT,
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
1use nft_data_structs::{CollectionId, TokenId};1use up_data_structs::{CollectionId, TokenId};
2use sp_core::H160;2use sp_core::H160;
33
4// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 14// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 1
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
8 ensure, fail,8 ensure, fail,
9 traits::{Imbalance, Get, Currency},9 traits::{Imbalance, Get, Currency},
10};10};
11use nft_data_structs::{11use up_data_structs::{
12 COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,12 COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,
13 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,13 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
14 COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, Pays, PostDispatchInfo, TokenId, Weight,14 COLLECTION_ADMINS_LIMIT, MetaUpdatePermission, Pays, PostDispatchInfo, TokenId, Weight,
143 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key};143 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key};
144 use account::CrossAccountId;144 use account::CrossAccountId;
145 use frame_support::traits::Currency;145 use frame_support::traits::Currency;
146 use nft_data_structs::TokenId;146 use up_data_structs::TokenId;
147 use scale_info::TypeInfo;147 use scale_info::TypeInfo;
148148
149 #[pallet::config]149 #[pallet::config]
modifiedpallets/evm-migration/src/weights.rsdiffbeforeafterboth
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1287//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
88
9// Executed Command:9// Executed Command:
10// target/release/nft10// target/release/unique-collator
11// benchmark11// benchmark
12// --pallet12// --pallet
13// pallet-evm-migration13// pallet-evm-migration
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
18pallet-common = { default-features = false, path = '../common' }18pallet-common = { default-features = false, path = '../common' }
19nft-data-structs = { default-features = false, path = '../../primitives/nft' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }
21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
32 "frame-system/std",32 "frame-system/std",
33 "sp-runtime/std",33 "sp-runtime/std",
34 "sp-std/std",34 "sp-std/std",
35 "nft-data-structs/std",35 "up-data-structs/std",
36 "pallet-common/std",36 "pallet-common/std",
37 "evm-coder/std",37 "evm-coder/std",
38 "ethereum/std",38 "ethereum/std",
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
4use sp_std::prelude::*;4use sp_std::prelude::*;
5use pallet_common::benchmarking::create_collection_raw;5use pallet_common::benchmarking::create_collection_raw;
6use frame_benchmarking::{benchmarks, account};6use frame_benchmarking::{benchmarks, account};
7use nft_data_structs::{CollectionMode};7use up_data_structs::{CollectionMode};
8use pallet_common::bench_init;8use pallet_common::bench_init;
99
10const SEED: u32 = 1;10const SEED: u32 = 1;
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
1use core::marker::PhantomData;1use core::marker::PhantomData;
22
3use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};3use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
4use nft_data_structs::TokenId;4use up_data_structs::TokenId;
5use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};5use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
6use sp_runtime::ArithmeticError;6use sp_runtime::ArithmeticError;
7use sp_std::{vec::Vec, vec};7use sp_std::{vec::Vec, vec};
51 &self,51 &self,
52 sender: T::CrossAccountId,52 sender: T::CrossAccountId,
53 to: T::CrossAccountId,53 to: T::CrossAccountId,
54 data: nft_data_structs::CreateItemData,54 data: up_data_structs::CreateItemData,
55 ) -> DispatchResultWithPostInfo {55 ) -> DispatchResultWithPostInfo {
56 match data {56 match data {
57 nft_data_structs::CreateItemData::Fungible(data) => with_weight(57 up_data_structs::CreateItemData::Fungible(data) => with_weight(
58 <Pallet<T>>::create_item(self, &sender, (to, data.value)),58 <Pallet<T>>::create_item(self, &sender, (to, data.value)),
59 <CommonWeights<T>>::create_item(),59 <CommonWeights<T>>::create_item(),
60 ),60 ),
66 &self,66 &self,
67 sender: T::CrossAccountId,67 sender: T::CrossAccountId,
68 to: T::CrossAccountId,68 to: T::CrossAccountId,
69 data: Vec<nft_data_structs::CreateItemData>,69 data: Vec<up_data_structs::CreateItemData>,
70 ) -> DispatchResultWithPostInfo {70 ) -> DispatchResultWithPostInfo {
71 let mut sum: u128 = 0;71 let mut sum: u128 = 0;
72 for data in data {72 for data in data {
73 match data {73 match data {
74 nft_data_structs::CreateItemData::Fungible(data) => {74 up_data_structs::CreateItemData::Fungible(data) => {
75 sum = sum75 sum = sum
76 .checked_add(data.value)76 .checked_add(data.value)
77 .ok_or(ArithmeticError::Overflow)?;77 .ok_or(ArithmeticError::Overflow)?;
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
1use core::char::{REPLACEMENT_CHARACTER, decode_utf16};1use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
2use core::convert::TryInto;2use core::convert::TryInto;
3use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*};3use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*};
4use nft_data_structs::CollectionMode;4use up_data_structs::CollectionMode;
5use pallet_common::erc::CommonEvmHandler;5use pallet_common::erc::CommonEvmHandler;
6use sp_core::{H160, U256};6use sp_core::{H160, U256};
7use sp_std::vec::Vec;7use sp_std::vec::Vec;
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
22
3use core::ops::Deref;3use core::ops::Deref;
4use frame_support::{ensure};4use frame_support::{ensure};
5use nft_data_structs::{AccessMode, Collection, CollectionId, TokenId};5use up_data_structs::{AccessMode, Collection, CollectionId, TokenId};
6use pallet_common::{6use pallet_common::{
7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,
8};8};
25#[frame_support::pallet]25#[frame_support::pallet]
26pub mod pallet {26pub mod pallet {
27 use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};27 use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};
28 use nft_data_structs::CollectionId;28 use up_data_structs::CollectionId;
29 use super::weights::WeightInfo;29 use super::weights::WeightInfo;
3030
31 #[pallet::error]31 #[pallet::error]
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1287//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
88
9// Executed Command:9// Executed Command:
10// target/release/nft10// target/release/unique-collator
11// benchmark11// benchmark
12// --pallet12// --pallet
13// pallet-fungible13// pallet-fungible
modifiedpallets/inflation/Cargo.tomldiffbeforeafterboth
33
4[package]4[package]
5authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']
6description = 'Substrate node nft'6description = 'Unique Inflation Pallet'
7edition = '2018'7edition = '2018'
8homepage = 'https://unique.network'8homepage = 'https://unique.network'
9license = 'All Rights Reserved'9license = 'All Rights Reserved'
10name = 'pallet-inflation'10name = 'pallet-inflation'
11repository = 'https://github.com/usetech-llc/nft_private/'11repository = 'https://github.com/UniqueNetwork/unique-chain'
12version = '3.0.0'12version = '0.1.0'
1313
14[package.metadata.docs.rs]14[package.metadata.docs.rs]
15targets = ['x86_64-unknown-linux-gnu']15targets = ['x86_64-unknown-linux-gnu']
deletedpallets/nft/Cargo.tomldiffbeforeafterboth

no changes

deletedpallets/nft/src/benchmarking.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/common.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/dispatch.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/eth/mod.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/lib.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/mock.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/sponsorship.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/tests.rsdiffbeforeafterboth

no changes

deletedpallets/nft/src/weights.rsdiffbeforeafterboth

no changes

modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
18pallet-common = { default-features = false, path = '../common' }18pallet-common = { default-features = false, path = '../common' }
19nft-data-structs = { default-features = false, path = '../../primitives/nft' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
20evm-coder = { default-features = false, path = '../../crates/evm-coder' }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }
21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }21pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }22ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
32 "frame-system/std",32 "frame-system/std",
33 "sp-runtime/std",33 "sp-runtime/std",
34 "sp-std/std",34 "sp-std/std",
35 "nft-data-structs/std",35 "up-data-structs/std",
36 "pallet-common/std",36 "pallet-common/std",
37 "evm-coder/std",37 "evm-coder/std",
38 "ethereum/std",38 "ethereum/std",
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
4use sp_std::prelude::*;4use sp_std::prelude::*;
5use pallet_common::benchmarking::{create_collection_raw, create_data};5use pallet_common::benchmarking::{create_collection_raw, create_data};
6use frame_benchmarking::{benchmarks, account};6use frame_benchmarking::{benchmarks, account};
7use nft_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH};7use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH};
8use pallet_common::bench_init;8use pallet_common::bench_init;
9use core::convert::TryInto;9use core::convert::TryInto;
1010
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
1use core::marker::PhantomData;1use core::marker::PhantomData;
22
3use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};3use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};
4use nft_data_structs::TokenId;4use up_data_structs::TokenId;
5use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};5use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
6use sp_runtime::DispatchError;6use sp_runtime::DispatchError;
7use sp_std::vec::Vec;7use sp_std::vec::Vec;
47}47}
4848
49fn map_create_data<T: Config>(49fn map_create_data<T: Config>(
50 data: nft_data_structs::CreateItemData,50 data: up_data_structs::CreateItemData,
51 to: &T::CrossAccountId,51 to: &T::CrossAccountId,
52) -> Result<CreateItemData<T>, DispatchError> {52) -> Result<CreateItemData<T>, DispatchError> {
53 match data {53 match data {
54 nft_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData {54 up_data_structs::CreateItemData::NFT(data) => Ok(CreateItemData {
55 const_data: data.const_data,55 const_data: data.const_data,
56 variable_data: data.variable_data,56 variable_data: data.variable_data,
57 owner: to.clone(),57 owner: to.clone(),
65 &self,65 &self,
66 sender: T::CrossAccountId,66 sender: T::CrossAccountId,
67 to: T::CrossAccountId,67 to: T::CrossAccountId,
68 data: nft_data_structs::CreateItemData,68 data: up_data_structs::CreateItemData,
69 ) -> DispatchResultWithPostInfo {69 ) -> DispatchResultWithPostInfo {
70 with_weight(70 with_weight(
71 <Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),71 <Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),
77 &self,77 &self,
78 sender: T::CrossAccountId,78 sender: T::CrossAccountId,
79 to: T::CrossAccountId,79 to: T::CrossAccountId,
80 data: Vec<nft_data_structs::CreateItemData>,80 data: Vec<up_data_structs::CreateItemData>,
81 ) -> DispatchResultWithPostInfo {81 ) -> DispatchResultWithPostInfo {
82 let data = data82 let data = data
83 .into_iter()83 .into_iter()
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
4};4};
5use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*};5use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*};
6use frame_support::BoundedVec;6use frame_support::BoundedVec;
7use nft_data_structs::TokenId;7use up_data_structs::TokenId;
8use pallet_evm_coder_substrate::dispatch_to_evm;8use pallet_evm_coder_substrate::dispatch_to_evm;
9use sp_core::{H160, U256};9use sp_core::{H160, U256};
10use sp_std::{vec::Vec, vec};10use sp_std::{vec::Vec, vec};
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
22
3use erc::ERC721Events;3use erc::ERC721Events;
4use frame_support::{BoundedVec, ensure};4use frame_support::{BoundedVec, ensure};
5use nft_data_structs::{5use up_data_structs::{
6 AccessMode, CUSTOM_DATA_LIMIT, Collection, CollectionId, CustomDataLimit, TokenId,6 AccessMode, CUSTOM_DATA_LIMIT, Collection, CollectionId, CustomDataLimit, TokenId,
7};7};
8use pallet_common::{8use pallet_common::{
41pub mod pallet {41pub mod pallet {
42 use super::*;42 use super::*;
43 use frame_support::{Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};43 use frame_support::{Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};
44 use nft_data_structs::{CollectionId, TokenId};44 use up_data_structs::{CollectionId, TokenId};
45 use super::weights::WeightInfo;45 use super::weights::WeightInfo;
4646
47 #[pallet::error]47 #[pallet::error]
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1287//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
88
9// Executed Command:9// Executed Command:
10// target/release/nft10// target/release/unique-collator
11// benchmark11// benchmark
12// --pallet12// --pallet
13// pallet-nonfungible13// pallet-nonfungible
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }16sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }17sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
18pallet-common = { default-features = false, path = '../common' }18pallet-common = { default-features = false, path = '../common' }
19nft-data-structs = { default-features = false, path = '../../primitives/nft' }19up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
20frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }20frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
21scale-info = { version = "1.0.0", default-features = false, features = [21scale-info = { version = "1.0.0", default-features = false, features = [
22 "derive",22 "derive",
29 "frame-system/std",29 "frame-system/std",
30 "sp-runtime/std",30 "sp-runtime/std",
31 "sp-std/std",31 "sp-std/std",
32 "nft-data-structs/std",32 "up-data-structs/std",
33 "pallet-common/std",33 "pallet-common/std",
34 'frame-benchmarking/std',34 'frame-benchmarking/std',
35]35]
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
4use sp_std::prelude::*;4use sp_std::prelude::*;
5use pallet_common::benchmarking::{create_collection_raw, create_data};5use pallet_common::benchmarking::{create_collection_raw, create_data};
6use frame_benchmarking::{benchmarks, account};6use frame_benchmarking::{benchmarks, account};
7use nft_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH};7use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH};
8use pallet_common::bench_init;8use pallet_common::bench_init;
9use core::convert::TryInto;9use core::convert::TryInto;
10use core::iter::IntoIterator;10use core::iter::IntoIterator;
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
22
3use sp_std::collections::btree_map::BTreeMap;3use sp_std::collections::btree_map::BTreeMap;
4use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};4use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};
5use nft_data_structs::TokenId;5use up_data_structs::TokenId;
6use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};6use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
7use sp_runtime::DispatchError;7use sp_runtime::DispatchError;
8use sp_std::vec::Vec;8use sp_std::vec::Vec;
67}67}
6868
69fn map_create_data<T: Config>(69fn map_create_data<T: Config>(
70 data: nft_data_structs::CreateItemData,70 data: up_data_structs::CreateItemData,
71 to: &T::CrossAccountId,71 to: &T::CrossAccountId,
72) -> Result<CreateItemData<T>, DispatchError> {72) -> Result<CreateItemData<T>, DispatchError> {
73 match data {73 match data {
74 nft_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData {74 up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData {
75 const_data: data.const_data,75 const_data: data.const_data,
76 variable_data: data.variable_data,76 variable_data: data.variable_data,
77 users: {77 users: {
89 &self,89 &self,
90 sender: T::CrossAccountId,90 sender: T::CrossAccountId,
91 to: T::CrossAccountId,91 to: T::CrossAccountId,
92 data: nft_data_structs::CreateItemData,92 data: up_data_structs::CreateItemData,
93 ) -> DispatchResultWithPostInfo {93 ) -> DispatchResultWithPostInfo {
94 with_weight(94 with_weight(
95 <Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),95 <Pallet<T>>::create_item(self, &sender, map_create_data(data, &to)?),
101 &self,101 &self,
102 sender: T::CrossAccountId,102 sender: T::CrossAccountId,
103 to: T::CrossAccountId,103 to: T::CrossAccountId,
104 data: Vec<nft_data_structs::CreateItemData>,104 data: Vec<up_data_structs::CreateItemData>,
105 ) -> DispatchResultWithPostInfo {105 ) -> DispatchResultWithPostInfo {
106 let data = data106 let data = data
107 .into_iter()107 .into_iter()
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
1use nft_data_structs::TokenId;1use up_data_structs::TokenId;
2use pallet_common::erc::CommonEvmHandler;2use pallet_common::erc::CommonEvmHandler;
33
4use crate::{Config, RefungibleHandle};4use crate::{Config, RefungibleHandle};
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
1#![cfg_attr(not(feature = "std"), no_std)]1#![cfg_attr(not(feature = "std"), no_std)]
22
3use frame_support::{ensure, BoundedVec};3use frame_support::{ensure, BoundedVec};
4use nft_data_structs::{4use up_data_structs::{
5 AccessMode, CUSTOM_DATA_LIMIT, Collection, CollectionId, CustomDataLimit,5 AccessMode, CUSTOM_DATA_LIMIT, Collection, CollectionId, CustomDataLimit,
6 MAX_REFUNGIBLE_PIECES, TokenId,6 MAX_REFUNGIBLE_PIECES, TokenId,
7};7};
37pub mod pallet {37pub mod pallet {
38 use super::*;38 use super::*;
39 use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};39 use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};
40 use nft_data_structs::{CollectionId, TokenId};40 use up_data_structs::{CollectionId, TokenId};
41 use super::weights::WeightInfo;41 use super::weights::WeightInfo;
4242
43 #[pallet::error]43 #[pallet::error]
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1287//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
88
9// Executed Command:9// Executed Command:
10// target/release/nft10// target/release/unique-collator
11// benchmark11// benchmark
12// --pallet12// --pallet
13// pallet-refungible13// pallet-refungible
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-unq-scheduler"2name = "pallet-unq-scheduler"
3version = "3.0.0"3version = "0.1.0"
4authors = ["Parity Technologies <admin@parity.io>"]4authors = ["Unique Network <support@uniquenetwork.io>"]
5edition = "2018"5edition = "2018"
6license = "Unlicense"6license = "All Rights Reserved"
7homepage = "https://substrate.dev"7homepage = "https://unique.network"
8repository = "https://github.com/paritytech/substrate/"8repository = "https://github.com/UniqueNetwork/unique-chain"
9description = "FRAME example pallet"9description = "Unique Scheduler pallet"
10readme = "README.md"10readme = "README.md"
1111
12[dependencies]12[dependencies]
addedpallets/unique/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/unique/src/benchmarking.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/common.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/dispatch.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/eth/mod.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/mock.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/sponsorship.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/tests.rsdiffbeforeafterboth

no changes

addedpallets/unique/src/weights.rsdiffbeforeafterboth

no changes

addedprimitives/data-structs/Cargo.tomldiffbeforeafterboth

no changes

addedprimitives/data-structs/src/lib.rsdiffbeforeafterboth

no changes

deletedprimitives/nft/Cargo.tomldiffbeforeafterboth

no changes

deletedprimitives/nft/src/lib.rsdiffbeforeafterboth

no changes

modifiedprimitives/rpc/Cargo.tomldiffbeforeafterboth
55
6[dependencies]6[dependencies]
7pallet-common = { default-features = false, path = '../../pallets/common' }7pallet-common = { default-features = false, path = '../../pallets/common' }
8nft-data-structs = { default-features = false, path = '../nft' }8up-data-structs = { default-features = false, path = '../data-structs' }
9codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [9codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [
10 "derive",10 "derive",
11] }11] }
23 "sp-api/std",23 "sp-api/std",
24 "sp-runtime/std",24 "sp-runtime/std",
25 "pallet-common/std",25 "pallet-common/std",
26 "nft-data-structs/std",26 "up-data-structs/std",
27]27]
2828
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
1#![cfg_attr(not(feature = "std"), no_std)]1#![cfg_attr(not(feature = "std"), no_std)]
22
3use nft_data_structs::{CollectionId, TokenId, Collection, CollectionStats};3use up_data_structs::{CollectionId, TokenId, Collection, CollectionStats};
4use sp_std::vec::Vec;4use sp_std::vec::Vec;
5use sp_core::H160;5use sp_core::H160;
6use codec::Decode;6use codec::Decode;
77
8sp_api::decl_runtime_apis! {8sp_api::decl_runtime_apis! {
9 pub trait NftApi<CrossAccountId, AccountId> where9 pub trait UniqueApi<CrossAccountId, AccountId> where
10 AccountId: Decode,10 AccountId: Decode,
11 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,11 CrossAccountId: pallet_common::account::CrossAccountId<AccountId>,
12 {12 {
modifiedruntime/Cargo.tomldiffbeforeafterboth
4[package]4[package]
5authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']
6build = 'build.rs'6build = 'build.rs'
7description = 'Substrate node nft'7description = 'Unique Runtime'
8edition = '2018'8edition = '2018'
9homepage = 'https://unique.network'9homepage = 'https://unique.network'
10license = 'All Rights Reserved'10license = 'All Rights Reserved'
11name = 'nft-runtime'11name = 'unique-runtime'
12repository = 'https://github.com/usetech-llc/nft_private/'12repository = 'https://github.com/UniqueNetwork/unique-chain'
13version = '0.9.12'13version = '0.9.12'
1414
15[package.metadata.docs.rs]15[package.metadata.docs.rs]
30 'pallet-fungible/runtime-benchmarks',30 'pallet-fungible/runtime-benchmarks',
31 'pallet-refungible/runtime-benchmarks',31 'pallet-refungible/runtime-benchmarks',
32 'pallet-nonfungible/runtime-benchmarks',32 'pallet-nonfungible/runtime-benchmarks',
33 'pallet-nft/runtime-benchmarks',33 'pallet-unique/runtime-benchmarks',
34 'pallet-inflation/runtime-benchmarks',34 'pallet-inflation/runtime-benchmarks',
35 'pallet-xcm/runtime-benchmarks',35 'pallet-xcm/runtime-benchmarks',
36 'sp-runtime/runtime-benchmarks',36 'sp-runtime/runtime-benchmarks',
78 'pallet-fungible/std',78 'pallet-fungible/std',
79 'pallet-refungible/std',79 'pallet-refungible/std',
80 'pallet-nonfungible/std',80 'pallet-nonfungible/std',
81 'pallet-nft/std',81 'pallet-unique/std',
82 'pallet-unq-scheduler/std',82 'pallet-unq-scheduler/std',
83 'pallet-nft-charge-transaction/std',83 'pallet-charge-transaction/std',
84 'nft-data-structs/std',84 'up-data-structs/std',
85 'sp-api/std',85 'sp-api/std',
86 'sp-block-builder/std',86 'sp-block-builder/std',
87 "sp-consensus-aura/std",87 "sp-consensus-aura/std",
100100
101 "orml-vesting/std",101 "orml-vesting/std",
102]102]
103limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']103limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
104104
105################################################################################105################################################################################
106# Substrate Dependencies106# Substrate Dependencies
374 "derive",374 "derive",
375] }375] }
376derivative = "2.2.0"376derivative = "2.2.0"
377pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }377pallet-unique = { path = '../pallets/unique', default-features = false }
378up-rpc = { path = "../primitives/rpc", default-features = false }378up-rpc = { path = "../primitives/rpc", default-features = false }
379up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }379up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }
380pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }380pallet-inflation = { path = '../pallets/inflation', default-features = false }
381nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }381up-data-structs = { path = '../primitives/data-structs', default-features = false }
382pallet-common = { default-features = false, path = "../pallets/common" }382pallet-common = { default-features = false, path = "../pallets/common" }
383pallet-fungible = { default-features = false, path = "../pallets/fungible" }383pallet-fungible = { default-features = false, path = "../pallets/fungible" }
384pallet-refungible = { default-features = false, path = "../pallets/refungible" }384pallet-refungible = { default-features = false, path = "../pallets/refungible" }
385pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }385pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }
386pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false, version = '3.0.0' }386pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }
387# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }387# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
388pallet-nft-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }388pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
389pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }389pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }
390pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }390pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }
391pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }391pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }
modifiedruntime/src/lib.rsdiffbeforeafterboth
53 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,53 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
54 },54 },
55};55};
56use nft_data_structs::*;56use up_data_structs::*;
57// use pallet_contracts::weights::WeightInfo;57// use pallet_contracts::weights::WeightInfo;
58// #[cfg(any(feature = "std", test))]58// #[cfg(any(feature = "std", test))]
59use frame_system::{59use frame_system::{
259 type Event = Event;259 type Event = Event;
260 type OnMethodCall = (260 type OnMethodCall = (
261 pallet_evm_migration::OnMethodCall<Self>,261 pallet_evm_migration::OnMethodCall<Self>,
262 pallet_nft::NftErcSupport<Self>,262 pallet_unique::UniqueErcSupport<Self>,
263 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,263 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
264 );264 );
265 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;265 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
755 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;755 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
756}756}
757757
758/// Used for the pallet nft in `./nft.rs`
759impl pallet_nft::Config for Runtime {758impl pallet_unique::Config for Runtime {
760 type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;759 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
761}760}
762761
763parameter_types! {762parameter_types! {
778// }777// }
779778
780type EvmSponsorshipHandler = (779type EvmSponsorshipHandler = (
781 pallet_nft::NftEthSponsorshipHandler<Runtime>,780 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
782 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,781 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
783);782);
784type SponsorshipHandler = (783type SponsorshipHandler = (
785 pallet_nft::NftSponsorshipHandler<Runtime>,784 pallet_unique::UniqueSponsorshipHandler<Runtime>,
786 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,785 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
787 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,786 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
788);787);
806 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;805 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
807}806}
808807
809impl pallet_nft_charge_transaction::Config for Runtime {808impl pallet_charge_transaction::Config for Runtime {
810 type SponsorshipHandler = SponsorshipHandler;809 type SponsorshipHandler = SponsorshipHandler;
811}810}
812811
857856
858 // Unique Pallets857 // Unique Pallets
859 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,858 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
860 Nft: pallet_nft::{Pallet, Call, Storage} = 61,859 Unique: pallet_unique::{Pallet, Call, Storage} = 61,
861 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,860 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
862 // free = 63861 // free = 63
863 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,862 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
864 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,863 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
865 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,864 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
866 Fungible: pallet_fungible::{Pallet, Storage} = 67,865 Fungible: pallet_fungible::{Pallet, Storage} = 67,
920 system::CheckEra<Runtime>,919 system::CheckEra<Runtime>,
921 system::CheckNonce<Runtime>,920 system::CheckNonce<Runtime>,
922 system::CheckWeight<Runtime>,921 system::CheckWeight<Runtime>,
923 pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,922 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,
924 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,923 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,
925);924);
926/// Unchecked extrinsic type as expected by this runtime.925/// Unchecked extrinsic type as expected by this runtime.
990 }989 }
991}990}
992991
993macro_rules! dispatch_nft_runtime {992macro_rules! dispatch_unique_runtime {
994 ($collection:ident.$method:ident($($name:ident),*)) => {{993 ($collection:ident.$method:ident($($name:ident),*)) => {{
995 use pallet_nft::dispatch::Dispatched;994 use pallet_unique::dispatch::Dispatched;
996995
997 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());996 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());
998 let dispatch = collection.as_dyn();997 let dispatch = collection.as_dyn();
1001 }};1000 }};
1002}1001}
1003impl_runtime_apis! {1002impl_runtime_apis! {
1004 impl up_rpc::NftApi<Block, CrossAccountId, AccountId>1003 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>
1005 for Runtime1004 for Runtime
1006 {1005 {
1007 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {1006 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {
1008 dispatch_nft_runtime!(collection.account_tokens(account))1007 dispatch_unique_runtime!(collection.account_tokens(account))
1009 }1008 }
1010 fn token_exists(collection: CollectionId, token: TokenId) -> bool {1009 fn token_exists(collection: CollectionId, token: TokenId) -> bool {
1011 dispatch_nft_runtime!(collection.token_exists(token))1010 dispatch_unique_runtime!(collection.token_exists(token))
1012 }1011 }
10131012
1014 fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {1013 fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {
1015 dispatch_nft_runtime!(collection.token_owner(token))1014 dispatch_unique_runtime!(collection.token_owner(token))
1016 }1015 }
1017 fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1016 fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {
1018 dispatch_nft_runtime!(collection.const_metadata(token))1017 dispatch_unique_runtime!(collection.const_metadata(token))
1019 }1018 }
1020 fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1019 fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {
1021 dispatch_nft_runtime!(collection.variable_metadata(token))1020 dispatch_unique_runtime!(collection.variable_metadata(token))
1022 }1021 }
10231022
1024 fn collection_tokens(collection: CollectionId) -> u32 {1023 fn collection_tokens(collection: CollectionId) -> u32 {
1025 dispatch_nft_runtime!(collection.collection_tokens())1024 dispatch_unique_runtime!(collection.collection_tokens())
1026 }1025 }
1027 fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {1026 fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {
1028 dispatch_nft_runtime!(collection.account_balance(account))1027 dispatch_unique_runtime!(collection.account_balance(account))
1029 }1028 }
1030 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {1029 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {
1031 dispatch_nft_runtime!(collection.balance(account, token))1030 dispatch_unique_runtime!(collection.balance(account, token))
1032 }1031 }
1033 fn allowance(1032 fn allowance(
1034 collection: CollectionId,1033 collection: CollectionId,
1035 sender: CrossAccountId,1034 sender: CrossAccountId,
1036 spender: CrossAccountId,1035 spender: CrossAccountId,
1037 token: TokenId,1036 token: TokenId,
1038 ) -> u128 {1037 ) -> u128 {
1039 dispatch_nft_runtime!(collection.allowance(sender, spender, token))1038 dispatch_unique_runtime!(collection.allowance(sender, spender, token))
1040 }1039 }
10411040
1042 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1041 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {
1043 <pallet_nft::NftErcSupport<Runtime>>::get_code(&account)1042 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)
1044 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1043 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))
1045 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1044 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))
1046 }1045 }
1054 <pallet_common::Pallet<Runtime>>::allowed(collection, user)1053 <pallet_common::Pallet<Runtime>>::allowed(collection, user)
1055 }1054 }
1056 fn last_token_id(collection: CollectionId) -> TokenId {1055 fn last_token_id(collection: CollectionId) -> TokenId {
1057 dispatch_nft_runtime!(collection.last_token_id())1056 dispatch_unique_runtime!(collection.last_token_id())
1058 }1057 }
1059 fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>> {1058 fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>> {
1060 <pallet_common::CollectionById<Runtime>>::get(collection)1059 <pallet_common::CollectionById<Runtime>>::get(collection)
1338 let mut list = Vec::<BenchmarkList>::new();1337 let mut list = Vec::<BenchmarkList>::new();
13391338
1340 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1339 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
1341 list_benchmark!(list, extra, pallet_nft, Nft);1340 list_benchmark!(list, extra, pallet_unique, Unique);
1342 list_benchmark!(list, extra, pallet_inflation, Inflation);1341 list_benchmark!(list, extra, pallet_inflation, Inflation);
1343 list_benchmark!(list, extra, pallet_fungible, Fungible);1342 list_benchmark!(list, extra, pallet_fungible, Fungible);
1344 list_benchmark!(list, extra, pallet_refungible, Refungible);1343 list_benchmark!(list, extra, pallet_refungible, Refungible);
1371 let params = (&config, &allowlist);1370 let params = (&config, &allowlist);
13721371
1373 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1372 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
1374 add_benchmark!(params, batches, pallet_nft, Nft);1373 add_benchmark!(params, batches, pallet_unique, Unique);
1375 add_benchmark!(params, batches, pallet_inflation, Inflation);1374 add_benchmark!(params, batches, pallet_inflation, Inflation);
1376 add_benchmark!(params, batches, pallet_fungible, Fungible);1375 add_benchmark!(params, batches, pallet_fungible, Fungible);
1377 add_benchmark!(params, batches, pallet_refungible, Refungible);1376 add_benchmark!(params, batches, pallet_refungible, Refungible);
modifiedtests/Dockerfile-testsdiffbeforeafterboth
7RUN apt -y update; apt -y upgrade; apt -y install curl7RUN apt -y update; apt -y upgrade; apt -y install curl
88
99
10RUN mkdir nft_parachain10RUN mkdir unique_parachain
11WORKDIR /nft_parachain11WORKDIR /unique_parachain
1212
13RUN apt-get -y update && \13RUN apt-get -y update && \
14 apt-get -y upgrade && \14 apt-get -y upgrade && \
modifiedtests/README.mddiffbeforeafterboth
51. Checkout polkadot in sibling folder with this project51. Checkout polkadot in sibling folder with this project
6```bash6```bash
7git clone https://github.com/paritytech/polkadot.git && cd polkadot7git clone https://github.com/paritytech/polkadot.git && cd polkadot
8git checkout release-v0.9.98git checkout release-v0.9.12
9```9```
1010
112. Build with nightly-2021-06-28112. Build with nightly-2021-06-28
modifiedtests/package.jsondiffbeforeafterboth
1{1{
2 "name": "nfttests",2 "name": "unique-tests",
3 "version": "1.0.0",3 "version": "1.0.0",
4 "description": "Substrate Nft tests",4 "description": "Unique Chain Tests",
5 "main": "",5 "main": "",
6 "devDependencies": {6 "devDependencies": {
7 "@polkadot/dev": "0.63.18",7 "@polkadot/dev": "0.63.18",
modifiedtests/src/addCollectionAdmin.test.tsdiffbeforeafterboth
23 const collection = await queryCollectionExpectSuccess(api, collectionId);23 const collection = await queryCollectionExpectSuccess(api, collectionId);
24 expect(collection.owner.toString()).to.be.equal(alice.address);24 expect(collection.owner.toString()).to.be.equal(alice.address);
2525
26 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));26 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
27 await submitTransactionAsync(alice, changeAdminTx);27 await submitTransactionAsync(alice, changeAdminTx);
2828
29 const adminListAfterAddAdmin = await getAdminList(api, collectionId);29 const adminListAfterAddAdmin = await getAdminList(api, collectionId);
41 const collection = await queryCollectionExpectSuccess(api, collectionId);41 const collection = await queryCollectionExpectSuccess(api, collectionId);
42 expect(collection.owner.toString()).to.be.equal(alice.address);42 expect(collection.owner.toString()).to.be.equal(alice.address);
4343
44 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));44 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
45 await submitTransactionAsync(alice, changeAdminTx);45 await submitTransactionAsync(alice, changeAdminTx);
4646
47 const adminListAfterAddAdmin = await getAdminList(api, collectionId);47 const adminListAfterAddAdmin = await getAdminList(api, collectionId);
48 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));48 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
4949
50 const changeAdminTxCharlie = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));50 const changeAdminTxCharlie = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));
51 await submitTransactionAsync(bob, changeAdminTxCharlie);51 await submitTransactionAsync(bob, changeAdminTxCharlie);
52 const adminListAfterAddNewAdmin = await getAdminList(api, collectionId);52 const adminListAfterAddNewAdmin = await getAdminList(api, collectionId);
53 expect(adminListAfterAddNewAdmin).to.be.deep.contains(normalizeAccountId(bob.address));53 expect(adminListAfterAddNewAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
63 const alice = privateKey('//Alice');63 const alice = privateKey('//Alice');
64 const nonOwner = privateKey('//Bob_stash');64 const nonOwner = privateKey('//Bob_stash');
6565
66 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(alice.address));66 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(alice.address));
67 await expect(submitTransactionExpectFailAsync(nonOwner, changeAdminTx)).to.be.rejected;67 await expect(submitTransactionExpectFailAsync(nonOwner, changeAdminTx)).to.be.rejected;
6868
69 const adminListAfterAddAdmin = await getAdminList(api, collectionId);69 const adminListAfterAddAdmin = await getAdminList(api, collectionId);
80 const alice = privateKey('//Alice');80 const alice = privateKey('//Alice');
81 const bob = privateKey('//Bob');81 const bob = privateKey('//Bob');
8282
83 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));83 const changeOwnerTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
84 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;84 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;
8585
86 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)86 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
94 const alice = privateKey('//Alice');94 const alice = privateKey('//Alice');
95 const bob = privateKey('//Bob');95 const bob = privateKey('//Bob');
96 await destroyCollectionExpectSuccess(collectionId);96 await destroyCollectionExpectSuccess(collectionId);
97 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));97 const changeOwnerTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
98 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;98 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;
9999
100 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)100 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
125 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(accounts[i]));125 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(accounts[i]));
126 }126 }
127127
128 const tx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(accounts[chainAdminLimit]));128 const tx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(accounts[chainAdminLimit]));
129 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;129 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
130 });130 });
131 });131 });
modifiedtests/src/addToAllowList.test.tsdiffbeforeafterboth
59 const collectionId = await getCreatedCollectionCount(api) + 1;59 const collectionId = await getCreatedCollectionCount(api) + 1;
60 const bob = privateKey('//Bob');60 const bob = privateKey('//Bob');
6161
62 const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(bob.address));62 const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(bob.address));
63 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;63 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
64 });64 });
65 });65 });
71 // tslint:disable-next-line: no-bitwise71 // tslint:disable-next-line: no-bitwise
72 const collectionId = await createCollectionExpectSuccess();72 const collectionId = await createCollectionExpectSuccess();
73 await destroyCollectionExpectSuccess(collectionId);73 await destroyCollectionExpectSuccess(collectionId);
74 const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(bob.address));74 const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(bob.address));
75 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;75 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
76 });76 });
77 });77 });
83 const collectionId = await createCollectionExpectSuccess();83 const collectionId = await createCollectionExpectSuccess();
84 await enableAllowListExpectSuccess(alice, collectionId);84 await enableAllowListExpectSuccess(alice, collectionId);
85 await enablePublicMintingExpectSuccess(alice, collectionId);85 await enablePublicMintingExpectSuccess(alice, collectionId);
86 const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(ferdie.address), 'NFT');86 const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(ferdie.address), 'NFT');
87 await expect(submitTransactionExpectFailAsync(ferdie, tx)).to.be.rejected;87 await expect(submitTransactionExpectFailAsync(ferdie, tx)).to.be.rejected;
88 });88 });
89 });89 });
modifiedtests/src/addToContractAllowList.test.tsdiffbeforeafterboth
24 const bob = privateKey('//Bob');24 const bob = privateKey('//Bob');
25 const [contract, deployer] = await deployFlipper(api);25 const [contract, deployer] = await deployFlipper(api);
2626
27 const allowListedBefore = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();27 const allowListedBefore = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
28 const addTx = api.tx.nft.addToContractAllowList(contract.address, bob.address);28 const addTx = api.tx.unique.addToContractAllowList(contract.address, bob.address);
29 const addEvents = await submitTransactionAsync(deployer, addTx);29 const addEvents = await submitTransactionAsync(deployer, addTx);
30 const allowListedAfter = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();30 const allowListedAfter = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
3131
32 expect(getGenericResult(addEvents).success).to.be.true;32 expect(getGenericResult(addEvents).success).to.be.true;
33 expect(allowListedBefore).to.be.false;33 expect(allowListedBefore).to.be.false;
40 const bob = privateKey('//Bob');40 const bob = privateKey('//Bob');
41 const [contract, deployer] = await deployFlipper(api);41 const [contract, deployer] = await deployFlipper(api);
4242
43 const allowListedBefore = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();43 const allowListedBefore = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
44 const addTx = api.tx.nft.addToContractAllowList(contract.address, bob.address);44 const addTx = api.tx.unique.addToContractAllowList(contract.address, bob.address);
45 const addEvents = await submitTransactionAsync(deployer, addTx);45 const addEvents = await submitTransactionAsync(deployer, addTx);
46 const allowListedAfter = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();46 const allowListedAfter = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
47 const addAgainEvents = await submitTransactionAsync(deployer, addTx);47 const addAgainEvents = await submitTransactionAsync(deployer, addTx);
48 const allowListedAgainAfter = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();48 const allowListedAgainAfter = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
4949
50 expect(getGenericResult(addEvents).success).to.be.true;50 expect(getGenericResult(addEvents).success).to.be.true;
51 expect(allowListedBefore).to.be.false;51 expect(allowListedBefore).to.be.false;
64 const bob = privateKey('//Bob');64 const bob = privateKey('//Bob');
65 const charlieGuineaPig = privateKey('//Charlie');65 const charlieGuineaPig = privateKey('//Charlie');
6666
67 const allowListedBefore = (await api.query.nft.contractAllowList(charlieGuineaPig.address, bob.address)).toJSON();67 const allowListedBefore = (await api.query.unique.contractAllowList(charlieGuineaPig.address, bob.address)).toJSON();
68 const addTx = api.tx.nft.addToContractAllowList(charlieGuineaPig.address, bob.address);68 const addTx = api.tx.unique.addToContractAllowList(charlieGuineaPig.address, bob.address);
69 await expect(submitTransactionExpectFailAsync(alice, addTx)).to.be.rejected;69 await expect(submitTransactionExpectFailAsync(alice, addTx)).to.be.rejected;
70 const allowListedAfter = (await api.query.nft.contractAllowList(charlieGuineaPig.address, bob.address)).toJSON();70 const allowListedAfter = (await api.query.unique.contractAllowList(charlieGuineaPig.address, bob.address)).toJSON();
7171
72 expect(allowListedBefore).to.be.false;72 expect(allowListedBefore).to.be.false;
73 expect(allowListedAfter).to.be.false;73 expect(allowListedAfter).to.be.false;
79 const bob = privateKey('//Bob');79 const bob = privateKey('//Bob');
80 const [contract] = await deployFlipper(api);80 const [contract] = await deployFlipper(api);
8181
82 const allowListedBefore = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();82 const allowListedBefore = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
83 const addTx = api.tx.nft.addToContractAllowList(contract.address, bob.address);83 const addTx = api.tx.unique.addToContractAllowList(contract.address, bob.address);
84 await expect(submitTransactionExpectFailAsync(bob, addTx)).to.be.rejected;84 await expect(submitTransactionExpectFailAsync(bob, addTx)).to.be.rejected;
85 const allowListedAfter = (await api.query.nft.contractAllowList(contract.address, bob.address)).toJSON();85 const allowListedAfter = (await api.query.unique.contractAllowList(contract.address, bob.address)).toJSON();
8686
87 expect(allowListedBefore).to.be.false;87 expect(allowListedBefore).to.be.false;
88 expect(allowListedAfter).to.be.false;88 expect(allowListedAfter).to.be.false;
modifiedtests/src/allowLists.test.tsdiffbeforeafterboth
189 await enableAllowListExpectSuccess(alice, collectionId);189 await enableAllowListExpectSuccess(alice, collectionId);
190190
191 await usingApi(async (api) => {191 await usingApi(async (api) => {
192 const tx = api.tx.nft.burnItem(collectionId, itemId, /*normalizeAccountId(Alice.address),*/ 11);192 const tx = api.tx.unique.burnItem(collectionId, itemId, /*normalizeAccountId(Alice.address),*/ 11);
193 const badTransaction = async function () {193 const badTransaction = async function () {
194 await submitTransactionExpectFailAsync(alice, tx);194 await submitTransactionExpectFailAsync(alice, tx);
195 };195 };
modifiedtests/src/approve.test.tsdiffbeforeafterboth

no syntactic changes

modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
40 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);40 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
4141
42 await usingApi(async (api) => {42 await usingApi(async (api) => {
43 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);43 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
44 const events = await submitTransactionAsync(alice, tx);44 const events = await submitTransactionAsync(alice, tx);
45 const result = getGenericResult(events);45 const result = getGenericResult(events);
4646
5858
59 await usingApi(async (api) => {59 await usingApi(async (api) => {
60 // Destroy 1 of 1060 // Destroy 1 of 10
61 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);61 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
62 const events = await submitTransactionAsync(alice, tx);62 const events = await submitTransactionAsync(alice, tx);
63 const result = getGenericResult(events);63 const result = getGenericResult(events);
6464
77 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);77 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
7878
79 await usingApi(async (api) => {79 await usingApi(async (api) => {
80 const tx = api.tx.nft.burnItem(collectionId, tokenId, 100);80 const tx = api.tx.unique.burnItem(collectionId, tokenId, 100);
81 const events = await submitTransactionAsync(alice, tx);81 const events = await submitTransactionAsync(alice, tx);
82 const result = getGenericResult(events);82 const result = getGenericResult(events);
8383
9797
98 await usingApi(async (api) => {98 await usingApi(async (api) => {
99 // Transfer 1/100 of the token to Bob99 // Transfer 1/100 of the token to Bob
100 const transfertx = api.tx.nft.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);100 const transfertx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);
101 const events1 = await submitTransactionAsync(alice, transfertx);101 const events1 = await submitTransactionAsync(alice, transfertx);
102 const result1 = getGenericResult(events1);102 const result1 = getGenericResult(events1);
103103
106 const aliceBalanceBefore = await getBalance(api, collectionId, alice.address, tokenId);106 const aliceBalanceBefore = await getBalance(api, collectionId, alice.address, tokenId);
107107
108 // Bob burns his portion108 // Bob burns his portion
109 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);109 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
110 const events2 = await submitTransactionAsync(bob, tx);110 const events2 = await submitTransactionAsync(bob, tx);
111 const result2 = getGenericResult(events2);111 const result2 = getGenericResult(events2);
112112
146 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);146 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
147147
148 await usingApi(async (api) => {148 await usingApi(async (api) => {
149 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);149 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
150 const events = await submitTransactionAsync(bob, tx);150 const events = await submitTransactionAsync(bob, tx);
151 const result = getGenericResult(events);151 const result = getGenericResult(events);
152152
165165
166 await usingApi(async (api) => {166 await usingApi(async (api) => {
167 // Destroy 1 of 10167 // Destroy 1 of 10
168 const tx = api.tx.nft.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 1);168 const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 1);
169 const events = await submitTransactionAsync(bob, tx);169 const events = await submitTransactionAsync(bob, tx);
170 const result = getGenericResult(events);170 const result = getGenericResult(events);
171171
186 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);186 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
187187
188 await usingApi(async (api) => {188 await usingApi(async (api) => {
189 const tx = api.tx.nft.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 100);189 const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 100);
190 const events = await submitTransactionAsync(bob, tx);190 const events = await submitTransactionAsync(bob, tx);
191 const result = getGenericResult(events);191 const result = getGenericResult(events);
192 // Get alice balance192 // Get alice balance
213 await destroyCollectionExpectSuccess(collectionId);213 await destroyCollectionExpectSuccess(collectionId);
214214
215 await usingApi(async (api) => {215 await usingApi(async (api) => {
216 const tx = api.tx.nft.burnItem(collectionId, tokenId, 0);216 const tx = api.tx.unique.burnItem(collectionId, tokenId, 0);
217 const badTransaction = async function () {217 const badTransaction = async function () {
218 await submitTransactionExpectFailAsync(alice, tx);218 await submitTransactionExpectFailAsync(alice, tx);
219 };219 };
228 const tokenId = 10;228 const tokenId = 10;
229229
230 await usingApi(async (api) => {230 await usingApi(async (api) => {
231 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);231 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
232 const badTransaction = async function () {232 const badTransaction = async function () {
233 await submitTransactionExpectFailAsync(alice, tx);233 await submitTransactionExpectFailAsync(alice, tx);
234 };234 };
243 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);243 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
244244
245 await usingApi(async (api) => {245 await usingApi(async (api) => {
246 const tx = api.tx.nft.burnItem(collectionId, tokenId, 1);246 const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);
247 const badTransaction = async function () {247 const badTransaction = async function () {
248 await submitTransactionExpectFailAsync(bob, tx);248 await submitTransactionExpectFailAsync(bob, tx);
249 };249 };
259259
260 await usingApi(async (api) => {260 await usingApi(async (api) => {
261261
262 const burntx = api.tx.nft.burnItem(collectionId, tokenId, 1);262 const burntx = api.tx.unique.burnItem(collectionId, tokenId, 1);
263 const events1 = await submitTransactionAsync(alice, burntx);263 const events1 = await submitTransactionAsync(alice, burntx);
264 const result1 = getGenericResult(events1);264 const result1 = getGenericResult(events1);
265 expect(result1.success).to.be.true;265 expect(result1.success).to.be.true;
266266
267 const tx = api.tx.nft.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);267 const tx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);
268 const badTransaction = async function () {268 const badTransaction = async function () {
269 await submitTransactionExpectFailAsync(alice, tx);269 await submitTransactionExpectFailAsync(alice, tx);
270 };270 };
282282
283 await usingApi(async (api) => {283 await usingApi(async (api) => {
284 // Destroy 11 of 10284 // Destroy 11 of 10
285 const tx = api.tx.nft.burnItem(collectionId, tokenId, 11);285 const tx = api.tx.unique.burnItem(collectionId, tokenId, 11);
286 const badTransaction = async function () {286 const badTransaction = async function () {
287 await submitTransactionExpectFailAsync(alice, tx);287 await submitTransactionExpectFailAsync(alice, tx);
288 };288 };
modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
38 const collection =await queryCollectionExpectSuccess(api, collectionId);38 const collection =await queryCollectionExpectSuccess(api, collectionId);
39 expect(collection.owner.toString()).to.be.deep.eq(alice.address);39 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
4040
41 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);41 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
42 await submitTransactionAsync(alice, changeOwnerTx);42 await submitTransactionAsync(alice, changeOwnerTx);
4343
44 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);44 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
57 const collection = await queryCollectionExpectSuccess(api, collectionId);57 const collection = await queryCollectionExpectSuccess(api, collectionId);
58 expect(collection.owner.toString()).to.be.deep.eq(alice.address);58 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
5959
60 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);60 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
61 await submitTransactionAsync(alice, changeOwnerTx);61 await submitTransactionAsync(alice, changeOwnerTx);
6262
63 const badChangeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, alice.address);63 const badChangeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, alice.address);
64 await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;64 await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;
6565
66 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);66 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
78 const collection = await queryCollectionExpectSuccess(api, collectionId);78 const collection = await queryCollectionExpectSuccess(api, collectionId);
79 expect(collection.owner.toString()).to.be.deep.eq(alice.address);79 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
8080
81 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);81 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
82 await submitTransactionAsync(alice, changeOwnerTx);82 await submitTransactionAsync(alice, changeOwnerTx);
8383
84 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);84 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
99 ownerCanTransfer: true,99 ownerCanTransfer: true,
100 ownerCanDestroy: true,100 ownerCanDestroy: true,
101 };101 };
102 const tx1 = api.tx.nft.setCollectionLimits(102 const tx1 = api.tx.unique.setCollectionLimits(
103 collectionId,103 collectionId,
104 collectionLimits,104 collectionLimits,
105 );105 );
122 const collection = await queryCollectionExpectSuccess(api, collectionId);122 const collection = await queryCollectionExpectSuccess(api, collectionId);
123 expect(collection.owner.toString()).to.be.deep.eq(alice.address);123 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
124124
125 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);125 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
126 await submitTransactionAsync(alice, changeOwnerTx);126 await submitTransactionAsync(alice, changeOwnerTx);
127127
128 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);128 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
129 expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);129 expect(collectionAfterOwnerChange.owner.toString()).to.be.deep.eq(bob.address);
130130
131 const changeOwnerTx2 = api.tx.nft.changeCollectionOwner(collectionId, charlie.address);131 const changeOwnerTx2 = api.tx.unique.changeCollectionOwner(collectionId, charlie.address);
132 await submitTransactionAsync(bob, changeOwnerTx2);132 await submitTransactionAsync(bob, changeOwnerTx2);
133133
134 // ownership lost134 // ownership lost
145 const alice = privateKey('//Alice');145 const alice = privateKey('//Alice');
146 const bob = privateKey('//Bob');146 const bob = privateKey('//Bob');
147147
148 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);148 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
149 await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;149 await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;
150150
151 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);151 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
164164
165 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);165 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
166166
167 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);167 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
168 await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;168 await expect(submitTransactionExpectFailAsync(bob, changeOwnerTx)).to.be.rejected;
169169
170 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);170 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
181 const alice = privateKey('//Alice');181 const alice = privateKey('//Alice');
182 const bob = privateKey('//Bob');182 const bob = privateKey('//Bob');
183183
184 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);184 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
185 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;185 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;
186186
187 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)187 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
199 const collection = await queryCollectionExpectSuccess(api, collectionId);199 const collection = await queryCollectionExpectSuccess(api, collectionId);
200 expect(collection.owner.toString()).to.be.deep.eq(alice.address);200 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
201201
202 const changeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, bob.address);202 const changeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, bob.address);
203 await submitTransactionAsync(alice, changeOwnerTx);203 await submitTransactionAsync(alice, changeOwnerTx);
204204
205 const badChangeOwnerTx = api.tx.nft.changeCollectionOwner(collectionId, alice.address);205 const badChangeOwnerTx = api.tx.unique.changeCollectionOwner(collectionId, alice.address);
206 await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;206 await expect(submitTransactionExpectFailAsync(alice, badChangeOwnerTx)).to.be.rejected;
207207
208 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);208 const collectionAfterOwnerChange = await queryCollectionExpectSuccess(api, collectionId);
220 ownerCanTransfer: true,220 ownerCanTransfer: true,
221 ownerCanDestroy: true,221 ownerCanDestroy: true,
222 };222 };
223 const tx1 = api.tx.nft.setCollectionLimits(223 const tx1 = api.tx.unique.setCollectionLimits(
224 collectionId,224 collectionId,
225 collectionLimits,225 collectionLimits,
226 );226 );
modifiedtests/src/check-event/burnItemEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage} from '../util/helpers';13import {createCollectionExpectSuccess, createItemExpectSuccess, uniqueEventMessage} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {
30 const collectionID = await createCollectionExpectSuccess();30 const collectionID = await createCollectionExpectSuccess();
31 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');31 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');
32 const burnItem = api.tx.nft.burnItem(collectionID, itemID, 1);32 const burnItem = api.tx.unique.burnItem(collectionID, itemID, 1);
33 const events = await submitTransactionAsync(alice, burnItem);33 const events = await submitTransactionAsync(alice, burnItem);
34 const msg = JSON.stringify(nftEventMessage(events));34 const msg = JSON.stringify(uniqueEventMessage(events));
35 expect(msg).to.be.contain(checkSection);35 expect(msg).to.be.contain(checkSection);
36 expect(msg).to.be.contain(checkTreasury);36 expect(msg).to.be.contain(checkTreasury);
37 expect(msg).to.be.contain(checkSystem);37 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/check-event/createCollectionEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {nftEventMessage} from '../util/helpers';13import {uniqueEventMessage} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
27 });27 });
28 it('Check event from createCollection(): ', async () => {28 it('Check event from createCollection(): ', async () => {
29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {
30 const tx = api.tx.nft.createCollection([0x31], [0x32], '0x33', 'NFT');30 const tx = api.tx.unique.createCollection([0x31], [0x32], '0x33', 'NFT');
31 const events = await submitTransactionAsync(alice, tx);31 const events = await submitTransactionAsync(alice, tx);
32 const msg = JSON.stringify(nftEventMessage(events));32 const msg = JSON.stringify(uniqueEventMessage(events));
33 expect(msg).to.be.contain(checkSection);33 expect(msg).to.be.contain(checkSection);
34 expect(msg).to.be.contain(checkTreasury);34 expect(msg).to.be.contain(checkTreasury);
35 expect(msg).to.be.contain(checkSystem);35 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/check-event/createItemEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, nftEventMessage, normalizeAccountId} from '../util/helpers';13import {createCollectionExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
28 it('Check event from createItem(): ', async () => {28 it('Check event from createItem(): ', async () => {
29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {
30 const collectionID = await createCollectionExpectSuccess();30 const collectionID = await createCollectionExpectSuccess();
31 const createItem = api.tx.nft.createItem(collectionID, normalizeAccountId(alice.address), 'NFT');31 const createItem = api.tx.unique.createItem(collectionID, normalizeAccountId(alice.address), 'NFT');
32 const events = await submitTransactionAsync(alice, createItem);32 const events = await submitTransactionAsync(alice, createItem);
33 const msg = JSON.stringify(nftEventMessage(events));33 const msg = JSON.stringify(uniqueEventMessage(events));
34 expect(msg).to.be.contain(checkSection);34 expect(msg).to.be.contain(checkSection);
35 expect(msg).to.be.contain(checkTreasury);35 expect(msg).to.be.contain(checkTreasury);
36 expect(msg).to.be.contain(checkSystem);36 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, nftEventMessage, normalizeAccountId} from '../util/helpers';13import {createCollectionExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
29 await usingApi(async (api: ApiPromise) => {29 await usingApi(async (api: ApiPromise) => {
30 const collectionID = await createCollectionExpectSuccess();30 const collectionID = await createCollectionExpectSuccess();
31 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];31 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];
32 const createMultipleItems = api.tx.nft.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);32 const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);
33 const events = await submitTransactionAsync(alice, createMultipleItems);33 const events = await submitTransactionAsync(alice, createMultipleItems);
34 const msg = JSON.stringify(nftEventMessage(events));34 const msg = JSON.stringify(uniqueEventMessage(events));
35 expect(msg).to.be.contain(checkSection);35 expect(msg).to.be.contain(checkSection);
36 expect(msg).to.be.contain(checkTreasury);36 expect(msg).to.be.contain(checkTreasury);
37 expect(msg).to.be.contain(checkSystem);37 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/check-event/destroyCollectionEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, nftEventMessage} from '../util/helpers';13import {createCollectionExpectSuccess, uniqueEventMessage} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
27 it('Check event from destroyCollection(): ', async () => {27 it('Check event from destroyCollection(): ', async () => {
28 await usingApi(async (api: ApiPromise) => {28 await usingApi(async (api: ApiPromise) => {
29 const collectionID = await createCollectionExpectSuccess();29 const collectionID = await createCollectionExpectSuccess();
30 const destroyCollection = api.tx.nft.destroyCollection(collectionID);30 const destroyCollection = api.tx.unique.destroyCollection(collectionID);
31 const events = await submitTransactionAsync(alice, destroyCollection);31 const events = await submitTransactionAsync(alice, destroyCollection);
32 const msg = JSON.stringify(nftEventMessage(events));32 const msg = JSON.stringify(uniqueEventMessage(events));
33 expect(msg).to.be.contain(checkTreasury);33 expect(msg).to.be.contain(checkTreasury);
34 expect(msg).to.be.contain(checkSystem);34 expect(msg).to.be.contain(checkSystem);
35 });35 });
modifiedtests/src/check-event/transferEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage, normalizeAccountId} from '../util/helpers';13import {createCollectionExpectSuccess, createItemExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
31 await usingApi(async (api: ApiPromise) => {31 await usingApi(async (api: ApiPromise) => {
32 const collectionID = await createCollectionExpectSuccess();32 const collectionID = await createCollectionExpectSuccess();
33 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');33 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');
34 const transfer = api.tx.nft.transfer(normalizeAccountId(bob.address), collectionID, itemID, 1);34 const transfer = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionID, itemID, 1);
35 const events = await submitTransactionAsync(alice, transfer);35 const events = await submitTransactionAsync(alice, transfer);
36 const msg = JSON.stringify(nftEventMessage(events));36 const msg = JSON.stringify(uniqueEventMessage(events));
37 expect(msg).to.be.contain(checkSection);37 expect(msg).to.be.contain(checkSection);
38 expect(msg).to.be.contain(checkTreasury);38 expect(msg).to.be.contain(checkTreasury);
39 expect(msg).to.be.contain(checkSystem);39 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/check-event/transferFromEvent.test.tsdiffbeforeafterboth
10import chaiAsPromised from 'chai-as-promised';10import chaiAsPromised from 'chai-as-promised';
11import privateKey from '../substrate/privateKey';11import privateKey from '../substrate/privateKey';
12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';
13import {createCollectionExpectSuccess, createItemExpectSuccess, nftEventMessage, normalizeAccountId} from '../util/helpers';13import {createCollectionExpectSuccess, createItemExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';
1414
15chai.use(chaiAsPromised);15chai.use(chaiAsPromised);
16const expect = chai.expect;16const expect = chai.expect;
31 await usingApi(async (api: ApiPromise) => {31 await usingApi(async (api: ApiPromise) => {
32 const collectionID = await createCollectionExpectSuccess();32 const collectionID = await createCollectionExpectSuccess();
33 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');33 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');
34 const transferFrom = api.tx.nft.transferFrom(normalizeAccountId(alice.address), normalizeAccountId(bob.address), collectionID, itemID, 1);34 const transferFrom = api.tx.unique.transferFrom(normalizeAccountId(alice.address), normalizeAccountId(bob.address), collectionID, itemID, 1);
35 const events = await submitTransactionAsync(alice, transferFrom);35 const events = await submitTransactionAsync(alice, transferFrom);
36 const msg = JSON.stringify(nftEventMessage(events));36 const msg = JSON.stringify(uniqueEventMessage(events));
37 expect(msg).to.be.contain(checkSection);37 expect(msg).to.be.contain(checkSection);
38 expect(msg).to.be.contain(checkTreasury);38 expect(msg).to.be.contain(checkTreasury);
39 expect(msg).to.be.contain(checkSystem);39 expect(msg).to.be.contain(checkSystem);
modifiedtests/src/collision-tests/admVsOwnerChanges.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 createItemExpectSuccess,12 createItemExpectSuccess,
13 normalizeAccountId,13 normalizeAccountId,
14 waitNewBlocks,14 waitNewBlocks,
15} from '../util/helpers';15} from '../util/helpers';
1616
17chai.use(chaiAsPromised);17chai.use(chaiAsPromised);
18const expect = chai.expect;18const expect = chai.expect;
19let Alice: IKeyringPair;19let Alice: IKeyringPair;
20let Bob: IKeyringPair;20let Bob: IKeyringPair;
21let Ferdie: IKeyringPair;21let Ferdie: IKeyringPair;
2222
23before(async () => {23before(async () => {
24 await usingApi(async () => {24 await usingApi(async () => {
25 Alice = privateKey('//Alice');25 Alice = privateKey('//Alice');
26 Bob = privateKey('//Bob');26 Bob = privateKey('//Bob');
27 Ferdie = privateKey('//Ferdie');27 Ferdie = privateKey('//Ferdie');
28 });28 });
29});29});
3030
31describe('Admin vs Owner changes token: ', () => {31describe('Admin vs Owner changes token: ', () => {
32 // tslint:disable-next-line: max-line-length32 // tslint:disable-next-line: max-line-length
33 it('The collection admin changes the owner of the token and in the same block the current owner transfers the token to another address ', async () => {33 it('The collection admin changes the owner of the token and in the same block the current owner transfers the token to another address ', async () => {
3434
35 await usingApi(async (api) => {35 await usingApi(async (api) => {
36 const collectionId = await createCollectionExpectSuccess();36 const collectionId = await createCollectionExpectSuccess();
37 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));37 const changeAdminTxBob = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
38 await submitTransactionAsync(Alice, changeAdminTxBob);38 await submitTransactionAsync(Alice, changeAdminTxBob);
39 const changeAdminTxFerdie = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));39 const changeAdminTxFerdie = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));
40 await submitTransactionAsync(Bob, changeAdminTxFerdie);40 await submitTransactionAsync(Bob, changeAdminTxFerdie);
41 const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');41 const itemId = await createItemExpectSuccess(Ferdie, collectionId, 'NFT');
4242
43 const changeOwner = api.tx.nft.transferFrom(normalizeAccountId(Ferdie.address), normalizeAccountId(Bob.address), collectionId, itemId, 1);43 const changeOwner = api.tx.unique.transferFrom(normalizeAccountId(Ferdie.address), normalizeAccountId(Bob.address), collectionId, itemId, 1);
44 const approve = api.tx.nft.approve(normalizeAccountId(Bob.address), collectionId, itemId, 1);44 const approve = api.tx.unique.approve(normalizeAccountId(Bob.address), collectionId, itemId, 1);
45 const sendItem = api.tx.nft.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);45 const sendItem = api.tx.unique.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);
46 await Promise.all([46 await Promise.all([
47 changeOwner.signAndSend(Alice),47 changeOwner.signAndSend(Alice),
48 approve.signAndSend(Bob),48 approve.signAndSend(Bob),
49 sendItem.signAndSend(Ferdie),49 sendItem.signAndSend(Ferdie),
50 ]);50 ]);
51 const itemBefore: any = await api.query.nft.nftItemList(collectionId, itemId);51 const itemBefore: any = await api.query.unique.nftItemList(collectionId, itemId);
52 expect(itemBefore.owner).not.to.be.eq(Bob.address);52 expect(itemBefore.owner).not.to.be.eq(Bob.address);
53 await waitNewBlocks(2);53 await waitNewBlocks(2);
54 });54 });
55 });55 });
56});56});
57*/57*/
modifiedtests/src/collision-tests/admVsOwnerData.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 createItemExpectSuccess,12 createItemExpectSuccess,
13 normalizeAccountId,13 normalizeAccountId,
14 waitNewBlocks,14 waitNewBlocks,
15} from '../util/helpers';15} from '../util/helpers';
1616
17chai.use(chaiAsPromised);17chai.use(chaiAsPromised);
18const expect = chai.expect;18const expect = chai.expect;
19let Alice: IKeyringPair;19let Alice: IKeyringPair;
20let Bob: IKeyringPair;20let Bob: IKeyringPair;
2121
22before(async () => {22before(async () => {
23 await usingApi(async () => {23 await usingApi(async () => {
24 Alice = privateKey('//Alice');24 Alice = privateKey('//Alice');
25 Bob = privateKey('//Bob');25 Bob = privateKey('//Bob');
26 });26 });
27});27});
2828
29describe('Admin vs Owner changes the data in the token: ', () => {29describe('Admin vs Owner changes the data in the token: ', () => {
30 it('The collection admin changes the data in the token and in the same block the token owner also changes the data in it ', async () => {30 it('The collection admin changes the data in the token and in the same block the token owner also changes the data in it ', async () => {
31 await usingApi(async (api) => {31 await usingApi(async (api) => {
32 const AliceData = 1;32 const AliceData = 1;
33 const BobData = 2;33 const BobData = 2;
34 const collectionId = await createCollectionExpectSuccess();34 const collectionId = await createCollectionExpectSuccess();
35 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));35 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
36 await submitTransactionAsync(Alice, changeAdminTx);36 await submitTransactionAsync(Alice, changeAdminTx);
37 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');37 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
38 //38 //
39 // tslint:disable-next-line: max-line-length39 // tslint:disable-next-line: max-line-length
40 const AliceTx = api.tx.nft.setVariableMetaData(collectionId, itemId, AliceData.toString());40 const AliceTx = api.tx.unique.setVariableMetaData(collectionId, itemId, AliceData.toString());
41 // tslint:disable-next-line: max-line-length41 // tslint:disable-next-line: max-line-length
42 const BobTx = api.tx.nft.setVariableMetaData(collectionId, itemId, BobData.toString());42 const BobTx = api.tx.unique.setVariableMetaData(collectionId, itemId, BobData.toString());
43 await Promise.all([43 await Promise.all([
44 AliceTx.signAndSend(Alice),44 AliceTx.signAndSend(Alice),
45 BobTx.signAndSend(Bob),45 BobTx.signAndSend(Bob),
46 ]);46 ]);
47 const item: any = await api.query.nft.nftItemList(collectionId, itemId);47 const item: any = await api.query.unique.nftItemList(collectionId, itemId);
48 expect(item.variableData).not.to.be.eq(null); // Pseudo-random selection of one of two values48 expect(item.variableData).not.to.be.eq(null); // Pseudo-random selection of one of two values
49 await waitNewBlocks(2);49 await waitNewBlocks(2);
50 });50 });
51 });51 });
52});52});
53*/53*/
modifiedtests/src/collision-tests/admVsOwnerTake.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 createItemExpectSuccess,12 createItemExpectSuccess,
13 normalizeAccountId,13 normalizeAccountId,
14 waitNewBlocks,14 waitNewBlocks,
15} from '../util/helpers';15} from '../util/helpers';
1616
17chai.use(chaiAsPromised);17chai.use(chaiAsPromised);
18const expect = chai.expect;18const expect = chai.expect;
19let Alice: IKeyringPair;19let Alice: IKeyringPair;
20let Bob: IKeyringPair;20let Bob: IKeyringPair;
21let Ferdie: IKeyringPair;21let Ferdie: IKeyringPair;
2222
23before(async () => {23before(async () => {
24 await usingApi(async () => {24 await usingApi(async () => {
25 Alice = privateKey('//Alice');25 Alice = privateKey('//Alice');
26 Bob = privateKey('//Bob');26 Bob = privateKey('//Bob');
27 Ferdie = privateKey('//Ferdie');27 Ferdie = privateKey('//Ferdie');
28 });28 });
29});29});
3030
31describe('Admin vs Owner take token: ', () => {31describe('Admin vs Owner take token: ', () => {
32 // tslint:disable-next-line: max-line-length32 // tslint:disable-next-line: max-line-length
33 it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {33 it('The collection admin burns the token and in the same block the token owner performs a transaction on it ', async () => {
34 await usingApi(async (api) => {34 await usingApi(async (api) => {
35 const collectionId = await createCollectionExpectSuccess();35 const collectionId = await createCollectionExpectSuccess();
36 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));36 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
37 await submitTransactionAsync(Alice, changeAdminTx);37 await submitTransactionAsync(Alice, changeAdminTx);
38 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');38 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
39 //39 //
40 const sendItem = api.tx.nft.transfer(normalizeAccountId(Ferdie.address), collectionId, itemId, 1);40 const sendItem = api.tx.unique.transfer(normalizeAccountId(Ferdie.address), collectionId, itemId, 1);
41 const burnItem = api.tx.nft.burnItem(collectionId, itemId, 1);41 const burnItem = api.tx.unique.burnItem(collectionId, itemId, 1);
42 await Promise.all([42 await Promise.all([
43 sendItem.signAndSend(Bob),43 sendItem.signAndSend(Bob),
44 burnItem.signAndSend(Alice),44 burnItem.signAndSend(Alice),
45 ]);45 ]);
46 await waitNewBlocks(2);46 await waitNewBlocks(2);
47 let itemBurn = false;47 let itemBurn = false;
48 itemBurn = (await (api.query.nft.nftItemList(collectionId, itemId))).toJSON() as boolean;48 itemBurn = (await (api.query.unique.nftItemList(collectionId, itemId))).toJSON() as boolean;
49 // tslint:disable-next-line: no-unused-expression49 // tslint:disable-next-line: no-unused-expression
50 expect(itemBurn).to.be.null;50 expect(itemBurn).to.be.null;
51 await waitNewBlocks(2);51 await waitNewBlocks(2);
52 });52 });
53 });53 });
54});54});
55*/55*/
modifiedtests/src/collision-tests/adminDestroyCollection.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';9import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 normalizeAccountId,12 normalizeAccountId,
13 waitNewBlocks,13 waitNewBlocks,
14} from '../util/helpers';14} from '../util/helpers';
1515
16chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
17const expect = chai.expect;17const expect = chai.expect;
18let Alice: IKeyringPair;18let Alice: IKeyringPair;
19let Bob: IKeyringPair;19let Bob: IKeyringPair;
20let Ferdie: IKeyringPair;20let Ferdie: IKeyringPair;
2121
22before(async () => {22before(async () => {
23 await usingApi(async () => {23 await usingApi(async () => {
24 Alice = privateKey('//Alice');24 Alice = privateKey('//Alice');
25 Bob = privateKey('//Bob');25 Bob = privateKey('//Bob');
26 Ferdie = privateKey('//Ferdie');26 Ferdie = privateKey('//Ferdie');
27 });27 });
28});28});
2929
30describe('Deleting a collection while add address to allowlist: ', () => {30describe('Deleting a collection while add address to allowlist: ', () => {
31 // tslint:disable-next-line: max-line-length31 // tslint:disable-next-line: max-line-length
32 it('Adding an address to the collection allowlist in a block by the admin, and deleting the collection by the owner ', async () => {32 it('Adding an address to the collection allowlist in a block by the admin, and deleting the collection by the owner ', async () => {
33 await usingApi(async (api) => {33 await usingApi(async (api) => {
34 const collectionId = await createCollectionExpectSuccess();34 const collectionId = await createCollectionExpectSuccess();
35 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));35 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
36 await submitTransactionAsync(Alice, changeAdminTx);36 await submitTransactionAsync(Alice, changeAdminTx);
37 await waitNewBlocks(1);37 await waitNewBlocks(1);
38 //38 //
39 const addAllowlistAdm = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(Ferdie.address));39 const addAllowlistAdm = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(Ferdie.address));
40 const destroyCollection = api.tx.nft.destroyCollection(collectionId);40 const destroyCollection = api.tx.unique.destroyCollection(collectionId);
41 await Promise.all([41 await Promise.all([
42 addAllowlistAdm.signAndSend(Bob),42 addAllowlistAdm.signAndSend(Bob),
43 destroyCollection.signAndSend(Alice),43 destroyCollection.signAndSend(Alice),
44 ]);44 ]);
45 await waitNewBlocks(1);45 await waitNewBlocks(1);
46 let allowList = false;46 let allowList = false;
47 allowList = (await api.query.nft.allowList(collectionId, Ferdie.address)).toJSON() as boolean;47 allowList = (await api.query.unique.allowList(collectionId, Ferdie.address)).toJSON() as boolean;
48 // tslint:disable-next-line: no-unused-expression48 // tslint:disable-next-line: no-unused-expression
49 expect(allowList).to.be.false;49 expect(allowList).to.be.false;
50 await waitNewBlocks(2);50 await waitNewBlocks(2);
51 });51 });
52 });52 });
53});53});
54*/54*/
modifiedtests/src/collision-tests/adminLimitsOff.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';9import usingApi, { submitTransactionAsync, submitTransactionExpectFailAsync } from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 normalizeAccountId,12 normalizeAccountId,
13 waitNewBlocks,13 waitNewBlocks,
14} from '../util/helpers';14} from '../util/helpers';
1515
16chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
17const expect = chai.expect;17const expect = chai.expect;
18let Alice: IKeyringPair;18let Alice: IKeyringPair;
19let Bob: IKeyringPair;19let Bob: IKeyringPair;
20let Ferdie: IKeyringPair;20let Ferdie: IKeyringPair;
21let Charlie: IKeyringPair;21let Charlie: IKeyringPair;
22let Eve: IKeyringPair;22let Eve: IKeyringPair;
23let Dave: IKeyringPair;23let Dave: IKeyringPair;
2424
25before(async () => {25before(async () => {
26 await usingApi(async () => {26 await usingApi(async () => {
27 Alice = privateKey('//Alice');27 Alice = privateKey('//Alice');
28 Bob = privateKey('//Bob');28 Bob = privateKey('//Bob');
29 Ferdie = privateKey('//Ferdie');29 Ferdie = privateKey('//Ferdie');
30 Charlie = privateKey('//Charlie');30 Charlie = privateKey('//Charlie');
31 Eve = privateKey('//Eve');31 Eve = privateKey('//Eve');
32 Dave = privateKey('//Dave');32 Dave = privateKey('//Dave');
33 });33 });
34});34});
3535
36describe('Admin limit exceeded collection: ', () => {36describe('Admin limit exceeded collection: ', () => {
37 // tslint:disable-next-line: max-line-length37 // tslint:disable-next-line: max-line-length
38 it('In one block, the owner and admin add new admins to the collection more than the limit ', async () => {38 it('In one block, the owner and admin add new admins to the collection more than the limit ', async () => {
39 await usingApi(async (api) => {39 await usingApi(async (api) => {
40 const collectionId = await createCollectionExpectSuccess();40 const collectionId = await createCollectionExpectSuccess();
4141
42 const chainAdminLimit = (api.consts.nft.collectionAdminsLimit as any).toNumber();42 const chainAdminLimit = (api.consts.unique.collectionAdminsLimit as any).toNumber();
43 expect(chainAdminLimit).to.be.equal(5);43 expect(chainAdminLimit).to.be.equal(5);
4444
45 const changeAdminTx1 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Eve.address));45 const changeAdminTx1 = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Eve.address));
46 await submitTransactionAsync(Alice, changeAdminTx1);46 await submitTransactionAsync(Alice, changeAdminTx1);
47 const changeAdminTx2 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Dave.address));47 const changeAdminTx2 = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Dave.address));
48 await submitTransactionAsync(Alice, changeAdminTx2);48 await submitTransactionAsync(Alice, changeAdminTx2);
49 const changeAdminTx3 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));49 const changeAdminTx3 = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
50 await submitTransactionAsync(Alice, changeAdminTx3);50 await submitTransactionAsync(Alice, changeAdminTx3);
5151
52 const addAdmOne = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));52 const addAdmOne = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Ferdie.address));
53 const addAdmTwo = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Charlie.address));53 const addAdmTwo = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Charlie.address));
54 await Promise.all([54 await Promise.all([
55 addAdmOne.signAndSend(Bob),55 addAdmOne.signAndSend(Bob),
56 addAdmTwo.signAndSend(Alice),56 addAdmTwo.signAndSend(Alice),
57 ]);57 ]);
58 await waitNewBlocks(2);58 await waitNewBlocks(2);
59 const changeAdminTx4 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Alice.address));59 const changeAdminTx4 = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Alice.address));
60 await expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;60 await expect(submitTransactionExpectFailAsync(Alice, changeAdminTx4)).to.be.rejected;
6161
62 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));62 const adminListAfterAddAdmin: any = (await api.query.unique.adminList(collectionId));
63 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Eve.address));63 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Eve.address));
64 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Ferdie.address));64 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Ferdie.address));
65 expect(adminListAfterAddAdmin).not.to.be.contains(normalizeAccountId(Alice.address));65 expect(adminListAfterAddAdmin).not.to.be.contains(normalizeAccountId(Alice.address));
66 await waitNewBlocks(2);66 await waitNewBlocks(2);
67 });67 });
68 });68 });
69});69});
70*/70*/
modifiedtests/src/collision-tests/adminRightsOff.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import BN from 'bn.js';6import BN from 'bn.js';
7import chai from 'chai';7import chai from 'chai';
8import chaiAsPromised from 'chai-as-promised';8import chaiAsPromised from 'chai-as-promised';
9import privateKey from '../substrate/privateKey';9import privateKey from '../substrate/privateKey';
10import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';10import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
11import {11import {
12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,
13 normalizeAccountId,13 normalizeAccountId,
14 waitNewBlocks,14 waitNewBlocks,
15} from '../util/helpers';15} from '../util/helpers';
1616
17chai.use(chaiAsPromised);17chai.use(chaiAsPromised);
18const expect = chai.expect;18const expect = chai.expect;
19let Alice: IKeyringPair;19let Alice: IKeyringPair;
20let Bob: IKeyringPair;20let Bob: IKeyringPair;
2121
22before(async () => {22before(async () => {
23 await usingApi(async () => {23 await usingApi(async () => {
24 Alice = privateKey('//Alice');24 Alice = privateKey('//Alice');
25 Bob = privateKey('//Bob');25 Bob = privateKey('//Bob');
26 });26 });
27});27});
2828
29describe('Deprivation of admin rights: ', () => {29describe('Deprivation of admin rights: ', () => {
30 // tslint:disable-next-line: max-line-length30 // tslint:disable-next-line: max-line-length
31 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {31 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {
32 await usingApi(async (api) => {32 await usingApi(async (api) => {
33 const collectionId = await createCollectionExpectSuccess();33 const collectionId = await createCollectionExpectSuccess();
34 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));34 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
35 await submitTransactionAsync(Alice, changeAdminTx);35 await submitTransactionAsync(Alice, changeAdminTx);
36 await waitNewBlocks(1);36 await waitNewBlocks(1);
37 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];37 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
38 const addItemAdm = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);38 const addItemAdm = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);
39 const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));39 const removeAdm = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
40 await Promise.all([40 await Promise.all([
41 addItemAdm.signAndSend(Bob),41 addItemAdm.signAndSend(Bob),
42 removeAdm.signAndSend(Alice),42 removeAdm.signAndSend(Alice),
43 ]);43 ]);
44 await waitNewBlocks(2);44 await waitNewBlocks(2);
45 const itemsListIndex = await api.query.nft.itemListIndex(collectionId) as unknown as BN;45 const itemsListIndex = await api.query.unique.itemListIndex(collectionId) as unknown as BN;
46 expect(itemsListIndex.toNumber()).to.be.equal(0);46 expect(itemsListIndex.toNumber()).to.be.equal(0);
47 const adminList: any = (await api.query.nft.adminList(collectionId));47 const adminList: any = (await api.query.unique.adminList(collectionId));
48 expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));48 expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));
49 await waitNewBlocks(2);49 await waitNewBlocks(2);
50 });50 });
51 });51 });
52});52});
53*/53*/
modifiedtests/src/collision-tests/setSponsorNewOwner.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi from '../substrate/substrate-api';9import usingApi from '../substrate/substrate-api';
10import {10import {
11 createCollectionExpectSuccess,11 createCollectionExpectSuccess,
12 setCollectionSponsorExpectSuccess,12 setCollectionSponsorExpectSuccess,
13 waitNewBlocks,13 waitNewBlocks,
14} from '../util/helpers';14} from '../util/helpers';
1515
16chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
17const expect = chai.expect;17const expect = chai.expect;
18let Alice: IKeyringPair;18let Alice: IKeyringPair;
19let Bob: IKeyringPair;19let Bob: IKeyringPair;
20let Ferdie: IKeyringPair;20let Ferdie: IKeyringPair;
2121
22before(async () => {22before(async () => {
23 await usingApi(async () => {23 await usingApi(async () => {
24 Alice = privateKey('//Alice');24 Alice = privateKey('//Alice');
25 Bob = privateKey('//Bob');25 Bob = privateKey('//Bob');
26 Ferdie = privateKey('//Ferdie');26 Ferdie = privateKey('//Ferdie');
27 });27 });
28});28});
2929
30describe('Sponsored with new owner ', () => {30describe('Sponsored with new owner ', () => {
31 // tslint:disable-next-line: max-line-length31 // tslint:disable-next-line: max-line-length
32 it('Confirmation of sponsorship of a collection in a block with a change in the owner of the collection: ', async () => {32 it('Confirmation of sponsorship of a collection in a block with a change in the owner of the collection: ', async () => {
33 await usingApi(async (api) => {33 await usingApi(async (api) => {
34 const collectionId = await createCollectionExpectSuccess();34 const collectionId = await createCollectionExpectSuccess();
35 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);35 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);
36 await waitNewBlocks(2);36 await waitNewBlocks(2);
37 const confirmSponsorship = api.tx.nft.confirmSponsorship(collectionId);37 const confirmSponsorship = api.tx.unique.confirmSponsorship(collectionId);
38 const changeCollectionOwner = api.tx.nft.changeCollectionOwner(collectionId, Ferdie.address);38 const changeCollectionOwner = api.tx.unique.changeCollectionOwner(collectionId, Ferdie.address);
39 await Promise.all([39 await Promise.all([
40 confirmSponsorship.signAndSend(Bob),40 confirmSponsorship.signAndSend(Bob),
41 changeCollectionOwner.signAndSend(Alice),41 changeCollectionOwner.signAndSend(Alice),
42 ]);42 ]);
43 await waitNewBlocks(2);43 await waitNewBlocks(2);
44 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();44 const collection: any = (await api.query.unique.collectionById(collectionId)).toJSON();
45 expect(collection.sponsorship.confirmed).to.be.eq(Bob.address);45 expect(collection.sponsorship.confirmed).to.be.eq(Bob.address);
46 expect(collection.owner).to.be.eq(Ferdie.address);46 expect(collection.owner).to.be.eq(Ferdie.address);
47 await waitNewBlocks(2);47 await waitNewBlocks(2);
48 });48 });
49 });49 });
50});50});
51*/51*/
modifiedtests/src/collision-tests/sponsorPayments.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import { alicesPublicKey, bobsPublicKey } from '../accounts';8import { alicesPublicKey, bobsPublicKey } from '../accounts';
9import getBalance from '../substrate/get-balance';9import getBalance from '../substrate/get-balance';
10import privateKey from '../substrate/privateKey';10import privateKey from '../substrate/privateKey';
11import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';11import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
12import {12import {
13 confirmSponsorshipExpectSuccess,13 confirmSponsorshipExpectSuccess,
14 createCollectionExpectSuccess,14 createCollectionExpectSuccess,
15 createItemExpectSuccess,15 createItemExpectSuccess,
16 setCollectionSponsorExpectSuccess,16 setCollectionSponsorExpectSuccess,
17 normalizeAccountId,17 normalizeAccountId,
18 waitNewBlocks,18 waitNewBlocks,
19} from '../util/helpers';19} from '../util/helpers';
2020
21chai.use(chaiAsPromised);21chai.use(chaiAsPromised);
22const expect = chai.expect;22const expect = chai.expect;
23let Alice: IKeyringPair;23let Alice: IKeyringPair;
24let Bob: IKeyringPair;24let Bob: IKeyringPair;
2525
26before(async () => {26before(async () => {
27 await usingApi(async () => {27 await usingApi(async () => {
28 Alice = privateKey('//Alice');28 Alice = privateKey('//Alice');
29 Bob = privateKey('//Bob');29 Bob = privateKey('//Bob');
30 });30 });
31});31});
3232
33describe('Payment of commission if one block: ', () => {33describe('Payment of commission if one block: ', () => {
34 // tslint:disable-next-line: max-line-length34 // tslint:disable-next-line: max-line-length
35 it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {35 it('Payment of commission if one block contains transactions for payment from the sponsor\'s balance and his (sponsor\'s) exclusion from the collection ', async () => {
36 await usingApi(async (api) => {36 await usingApi(async (api) => {
37 const collectionId = await createCollectionExpectSuccess();37 const collectionId = await createCollectionExpectSuccess();
38 const changeAdminTxBob = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));38 const changeAdminTxBob = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
39 await submitTransactionAsync(Alice, changeAdminTxBob);39 await submitTransactionAsync(Alice, changeAdminTxBob);
40 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');40 const itemId = await createItemExpectSuccess(Bob, collectionId, 'NFT');
41 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);41 await setCollectionSponsorExpectSuccess(collectionId, Bob.address);
42 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');42 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
4343
44 const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);44 const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
45 const sendItem = api.tx.nft.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);45 const sendItem = api.tx.unique.transfer(normalizeAccountId(Alice.address), collectionId, itemId, 1);
46 const revokeSponsor = api.tx.nft.removeCollectionSponsor(collectionId);46 const revokeSponsor = api.tx.unique.removeCollectionSponsor(collectionId);
47 await Promise.all([47 await Promise.all([
48 sendItem.signAndSend(Bob),48 sendItem.signAndSend(Bob),
49 revokeSponsor.signAndSend(Alice),49 revokeSponsor.signAndSend(Alice),
50 ]);50 ]);
51 const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);51 const [alicesBalanceAfter, bobsBalanceAfter] = await getBalance(api, [alicesPublicKey, bobsPublicKey]);
52 // tslint:disable-next-line:no-unused-expression52 // tslint:disable-next-line:no-unused-expression
53 expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;53 expect(alicesBalanceAfter === alicesBalanceBefore).to.be.true;
54 // tslint:disable-next-line:no-unused-expression54 // tslint:disable-next-line:no-unused-expression
55 expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;55 expect(bobsBalanceAfter === bobsBalanceBefore).to.be.true;
56 await waitNewBlocks(2);56 await waitNewBlocks(2);
57 });57 });
58 });58 });
59});59});
60*/60*/
modifiedtests/src/collision-tests/tokenLimitsOff.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import BN from 'bn.js';6import BN from 'bn.js';
7import chai from 'chai';7import chai from 'chai';
8import chaiAsPromised from 'chai-as-promised';8import chaiAsPromised from 'chai-as-promised';
9import privateKey from '../substrate/privateKey';9import privateKey from '../substrate/privateKey';
10import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';10import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
11import {11import {
12 addToAllowListExpectSuccess,12 addToAllowListExpectSuccess,
13 createCollectionExpectSuccess,13 createCollectionExpectSuccess,
14 getCreateItemResult,14 getCreateItemResult,
15 setMintPermissionExpectSuccess,15 setMintPermissionExpectSuccess,
16 normalizeAccountId,16 normalizeAccountId,
17 waitNewBlocks,17 waitNewBlocks,
18} from '../util/helpers';18} from '../util/helpers';
1919
20chai.use(chaiAsPromised);20chai.use(chaiAsPromised);
21const expect = chai.expect;21const expect = chai.expect;
22let Alice: IKeyringPair;22let Alice: IKeyringPair;
23let Bob: IKeyringPair;23let Bob: IKeyringPair;
24let Ferdie: IKeyringPair;24let Ferdie: IKeyringPair;
2525
26const accountTokenOwnershipLimit = 4;26const accountTokenOwnershipLimit = 4;
27const sponsoredMintSize = 4294967295;27const sponsoredMintSize = 4294967295;
28const tokenLimit = 4;28const tokenLimit = 4;
29const sponsorTimeout = 14400;29const sponsorTimeout = 14400;
30const ownerCanTransfer = false;30const ownerCanTransfer = false;
31const ownerCanDestroy = false;31const ownerCanDestroy = false;
3232
33before(async () => {33before(async () => {
34 await usingApi(async () => {34 await usingApi(async () => {
35 Alice = privateKey('//Alice');35 Alice = privateKey('//Alice');
36 Bob = privateKey('//Bob');36 Bob = privateKey('//Bob');
37 Ferdie = privateKey('//Ferdie');37 Ferdie = privateKey('//Ferdie');
38 });38 });
39});39});
4040
41describe('Token limit exceeded collection: ', () => {41describe('Token limit exceeded collection: ', () => {
42 // tslint:disable-next-line: max-line-length42 // tslint:disable-next-line: max-line-length
43 it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {43 it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {
44 await usingApi(async (api) => {44 await usingApi(async (api) => {
45 const collectionId = await createCollectionExpectSuccess();45 const collectionId = await createCollectionExpectSuccess();
46 await setMintPermissionExpectSuccess(Alice, collectionId, true);46 await setMintPermissionExpectSuccess(Alice, collectionId, true);
47 await addToAllowListExpectSuccess(Alice, collectionId, Ferdie.address);47 await addToAllowListExpectSuccess(Alice, collectionId, Ferdie.address);
48 await addToAllowListExpectSuccess(Alice, collectionId, Bob.address);48 await addToAllowListExpectSuccess(Alice, collectionId, Bob.address);
49 const setCollectionLim = api.tx.nft.setCollectionLimits(49 const setCollectionLim = api.tx.unique.setCollectionLimits(
50 collectionId,50 collectionId,
51 {51 {
52 accountTokenOwnershipLimit,52 accountTokenOwnershipLimit,
53 sponsoredMintSize,53 sponsoredMintSize,
54 tokenLimit,54 tokenLimit,
55 // tslint:disable-next-line: object-literal-sort-keys55 // tslint:disable-next-line: object-literal-sort-keys
56 sponsorTimeout,56 sponsorTimeout,
57 ownerCanTransfer,57 ownerCanTransfer,
58 ownerCanDestroy,58 ownerCanDestroy,
59 },59 },
60 );60 );
61 const subTx = await submitTransactionAsync(Alice, setCollectionLim);61 const subTx = await submitTransactionAsync(Alice, setCollectionLim);
62 const subTxTesult = getCreateItemResult(subTx);62 const subTxTesult = getCreateItemResult(subTx);
63 // tslint:disable-next-line:no-unused-expression63 // tslint:disable-next-line:no-unused-expression
64 expect(subTxTesult.success).to.be.true;64 expect(subTxTesult.success).to.be.true;
65 await waitNewBlocks(2);65 await waitNewBlocks(2);
6666
67 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];67 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
68 const mintItemOne = api.tx.nft68 const mintItemOne = api.tx.unique
69 .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);69 .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);
70 const mintItemTwo = api.tx.nft70 const mintItemTwo = api.tx.unique
71 .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);71 .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);
72 await Promise.all([72 await Promise.all([
73 mintItemOne.signAndSend(Ferdie),73 mintItemOne.signAndSend(Ferdie),
74 mintItemTwo.signAndSend(Bob),74 mintItemTwo.signAndSend(Bob),
75 ]);75 ]);
76 await waitNewBlocks(2);76 await waitNewBlocks(2);
77 const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;77 const itemsListIndexAfter = await api.query.unique.itemListIndex(collectionId) as unknown as BN;
78 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);78 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);
79 // TokenLimit = 4. The first transaction is successful. The second should fail.79 // TokenLimit = 4. The first transaction is successful. The second should fail.
80 await waitNewBlocks(2);80 await waitNewBlocks(2);
81 });81 });
82 });82 });
83});83});
84*/84*/
8585
modifiedtests/src/collision-tests/turnsOffMinting.test.tsdiffbeforeafterboth
1/* broken by design1/* broken by design
2// substrate transactions are sequential, not parallel2// substrate transactions are sequential, not parallel
3// the order of execution is indeterminate3// the order of execution is indeterminate
44
5import { IKeyringPair } from '@polkadot/types/types';5import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';6import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from '../substrate/privateKey';8import privateKey from '../substrate/privateKey';
9import usingApi from '../substrate/substrate-api';9import usingApi from '../substrate/substrate-api';
10import {10import {
11 addToAllowListExpectSuccess,11 addToAllowListExpectSuccess,
12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,
13 setMintPermissionExpectSuccess,13 setMintPermissionExpectSuccess,
14 normalizeAccountId,14 normalizeAccountId,
15 waitNewBlocks,15 waitNewBlocks,
16} from '../util/helpers';16} from '../util/helpers';
1717
18chai.use(chaiAsPromised);18chai.use(chaiAsPromised);
19const expect = chai.expect;19const expect = chai.expect;
20let Alice: IKeyringPair;20let Alice: IKeyringPair;
21let Ferdie: IKeyringPair;21let Ferdie: IKeyringPair;
2222
23before(async () => {23before(async () => {
24 await usingApi(async () => {24 await usingApi(async () => {
25 Alice = privateKey('//Alice');25 Alice = privateKey('//Alice');
26 Ferdie = privateKey('//Ferdie');26 Ferdie = privateKey('//Ferdie');
27 });27 });
28});28});
2929
30describe('Turns off minting mode: ', () => {30describe('Turns off minting mode: ', () => {
31 // tslint:disable-next-line: max-line-length31 // tslint:disable-next-line: max-line-length
32 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {32 it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {
33 await usingApi(async (api) => {33 await usingApi(async (api) => {
34 const collectionId = await createCollectionExpectSuccess();34 const collectionId = await createCollectionExpectSuccess();
35 await setMintPermissionExpectSuccess(Alice, collectionId, true);35 await setMintPermissionExpectSuccess(Alice, collectionId, true);
36 await addToAllowListExpectSuccess(Alice, collectionId, Ferdie.address);36 await addToAllowListExpectSuccess(Alice, collectionId, Ferdie.address);
3737
38 const mintItem = api.tx.nft.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');38 const mintItem = api.tx.unique.createItem(collectionId, normalizeAccountId(Ferdie.address), 'NFT');
39 const offMinting = api.tx.nft.setMintPermission(collectionId, false);39 const offMinting = api.tx.unique.setMintPermission(collectionId, false);
40 await Promise.all([40 await Promise.all([
41 mintItem.signAndSend(Ferdie),41 mintItem.signAndSend(Ferdie),
42 offMinting.signAndSend(Alice),42 offMinting.signAndSend(Alice),
43 ]);43 ]);
44 let itemList = false;44 let itemList = false;
45 itemList = (await (api.query.nft.nftItemList(collectionId, mintItem))).toJSON() as boolean;45 itemList = (await (api.query.unique.nftItemList(collectionId, mintItem))).toJSON() as boolean;
46 // tslint:disable-next-line: no-unused-expression46 // tslint:disable-next-line: no-unused-expression
47 expect(itemList).to.be.null;47 expect(itemList).to.be.null;
48 await waitNewBlocks(2);48 await waitNewBlocks(2);
49 });49 });
50 });50 });
51});51});
52*/52*/
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
76 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', zeroBalance.address);76 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', zeroBalance.address);
7777
78 // Transfer this tokens from unused address to Alice78 // Transfer this tokens from unused address to Alice
79 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);79 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);
80 const events = await submitTransactionAsync(zeroBalance, zeroToAlice);80 const events = await submitTransactionAsync(zeroBalance, zeroToAlice);
81 const result = getGenericResult(events);81 const result = getGenericResult(events);
82 expect(result.success).to.be.true;82 expect(result.success).to.be.true;
103 const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);103 const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);
104104
105 // Transfer this tokens from unused address to Alice105 // Transfer this tokens from unused address to Alice
106 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);106 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
107 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);107 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
108 const result1 = getGenericResult(events1);108 const result1 = getGenericResult(events1);
109 expect(result1.success).to.be.true;109 expect(result1.success).to.be.true;
129 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);129 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);
130130
131 // Transfer this tokens from unused address to Alice131 // Transfer this tokens from unused address to Alice
132 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);132 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
133 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);133 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
134 const result1 = getGenericResult(events1);134 const result1 = getGenericResult(events1);
135135
184184
185 // Transfer this token from Alice to unused address and back185 // Transfer this token from Alice to unused address and back
186 // Alice to Zero gets sponsored186 // Alice to Zero gets sponsored
187 const aliceToZero = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);187 const aliceToZero = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);
188 const events1 = await submitTransactionAsync(alice, aliceToZero);188 const events1 = await submitTransactionAsync(alice, aliceToZero);
189 const result1 = getGenericResult(events1);189 const result1 = getGenericResult(events1);
190190
191 // Second transfer should fail191 // Second transfer should fail
192 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();192 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
193 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);193 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);
194 const badTransaction = async function () {194 const badTransaction = async function () {
195 await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);195 await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
196 };196 };
222 const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);222 const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);
223223
224 // Transfer this tokens in parts from unused address to Alice224 // Transfer this tokens in parts from unused address to Alice
225 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);225 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
226 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);226 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
227 const result1 = getGenericResult(events1);227 const result1 = getGenericResult(events1);
228 expect(result1.success).to.be.true;228 expect(result1.success).to.be.true;
254 // Mint token for alice254 // Mint token for alice
255 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);255 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);
256256
257 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(alice.address), collectionId, itemId, 1);257 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 1);
258258
259 // Zero to alice gets sponsored259 // Zero to alice gets sponsored
260 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);260 const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
modifiedtests/src/contracts.test.tsdiffbeforeafterboth
73 const collectionId = await createCollectionExpectSuccess();73 const collectionId = await createCollectionExpectSuccess();
74 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');74 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
75 const [contract] = await deployTransferContract(api);75 const [contract] = await deployTransferContract(api);
76 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, contract.address);76 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, contract.address);
77 await submitTransactionAsync(alice, changeAdminTx);77 await submitTransactionAsync(alice, changeAdminTx);
7878
79 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));79 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(normalizeAccountId(alice.address));
105 const result = getGenericResult(events);105 const result = getGenericResult(events);
106 expect(result.success).to.be.true;106 expect(result.success).to.be.true;
107107
108 const tokensAfter = (await api.query.nft.nftItemList.entries(collectionId)).map((kv: any) => kv[1].toJSON());108 const tokensAfter = (await api.query.unique.nftItemList.entries(collectionId)).map((kv: any) => kv[1].toJSON());
109 expect(tokensAfter).to.be.deep.equal([109 expect(tokensAfter).to.be.deep.equal([
110 {110 {
111 owner: bob.address,111 owner: bob.address,
137 const result = getGenericResult(events);137 const result = getGenericResult(events);
138 expect(result.success).to.be.true;138 expect(result.success).to.be.true;
139139
140 const tokensAfter: any = (await api.query.nft.nftItemList.entries(collectionId) as any)140 const tokensAfter: any = (await api.query.unique.nftItemList.entries(collectionId) as any)
141 .map((kv: any) => kv[1].toJSON())141 .map((kv: any) => kv[1].toJSON())
142 .sort((a: any, b: any) => a.constData.localeCompare(b.constData));142 .sort((a: any, b: any) => a.constData.localeCompare(b.constData));
143 expect(tokensAfter).to.be.deep.equal([143 expect(tokensAfter).to.be.deep.equal([
195 const result = getGenericResult(events);195 const result = getGenericResult(events);
196 expect(result.success).to.be.true;196 expect(result.success).to.be.true;
197197
198 const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();198 const token: any = (await api.query.unique.nftItemList(collectionId, tokenId) as any).unwrap();
199 expect(token.owner.toString()).to.be.equal(charlie.address);199 expect(token.owner.toString()).to.be.equal(charlie.address);
200 });200 });
201 });201 });
213 const result = getGenericResult(events);213 const result = getGenericResult(events);
214 expect(result.success).to.be.true;214 expect(result.success).to.be.true;
215215
216 const token: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();216 const token: any = (await api.query.unique.nftItemList(collectionId, tokenId) as any).unwrap();
217 expect(token.variableData.toString()).to.be.equal('0x121314');217 expect(token.variableData.toString()).to.be.equal('0x121314');
218 });218 });
219 });219 });
225225
226 const collectionId = await createCollectionExpectSuccess();226 const collectionId = await createCollectionExpectSuccess();
227 const [contract] = await deployTransferContract(api);227 const [contract] = await deployTransferContract(api);
228 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, contract.address);228 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, contract.address);
229 await submitTransactionAsync(alice, changeAdminTx);229 await submitTransactionAsync(alice, changeAdminTx);
230230
231 expect(await isAllowlisted(api, collectionId, bob.address)).to.be.false;231 expect(await isAllowlisted(api, collectionId, bob.address)).to.be.false;
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
34 expect(itemsListIndexBefore).to.be.equal(0);34 expect(itemsListIndexBefore).to.be.equal(0);
35 const alice = privateKey('//Alice');35 const alice = privateKey('//Alice');
36 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];36 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];
37 const createMultipleItemsTx = api.tx.nft37 const createMultipleItemsTx = api.tx.unique
38 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);38 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
39 await submitTransactionAsync(alice, createMultipleItemsTx);39 await submitTransactionAsync(alice, createMultipleItemsTx);
40 const itemsListIndexAfter = await getLastTokenId(api, collectionId);40 const itemsListIndexAfter = await getLastTokenId(api, collectionId);
65 {Fungible: {value: 2}},65 {Fungible: {value: 2}},
66 {Fungible: {value: 3}},66 {Fungible: {value: 3}},
67 ];67 ];
68 const createMultipleItemsTx = api.tx.nft68 const createMultipleItemsTx = api.tx.unique
69 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);69 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
70 await submitTransactionAsync(alice, createMultipleItemsTx);70 await submitTransactionAsync(alice, createMultipleItemsTx);
71 const token1Data = await getBalance(api, collectionId, alice.address, 0);71 const token1Data = await getBalance(api, collectionId, alice.address, 0);
85 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},85 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},
86 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},86 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},
87 ];87 ];
88 const createMultipleItemsTx = api.tx.nft88 const createMultipleItemsTx = api.tx.unique
89 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);89 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
90 await submitTransactionAsync(alice, createMultipleItemsTx);90 await submitTransactionAsync(alice, createMultipleItemsTx);
91 const itemsListIndexAfter = await getLastTokenId(api, collectionId);91 const itemsListIndexAfter = await getLastTokenId(api, collectionId);
117 {NFT: ['A', 'A']},117 {NFT: ['A', 'A']},
118 {NFT: ['B', 'B']},118 {NFT: ['B', 'B']},
119 ];119 ];
120 const createMultipleItemsTx = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);120 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
121 const events = await submitTransactionAsync(alice, createMultipleItemsTx);121 const events = await submitTransactionAsync(alice, createMultipleItemsTx);
122 const result = getGenericResult(events);122 const result = getGenericResult(events);
123 expect(result.success).to.be.true;123 expect(result.success).to.be.true;
144 expect(itemsListIndexBefore).to.be.equal(0);144 expect(itemsListIndexBefore).to.be.equal(0);
145 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);145 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
146 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];146 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];
147 const createMultipleItemsTx = api.tx.nft147 const createMultipleItemsTx = api.tx.unique
148 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);148 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);
149 await submitTransactionAsync(bob, createMultipleItemsTx);149 await submitTransactionAsync(bob, createMultipleItemsTx);
150 const itemsListIndexAfter = await getLastTokenId(api, collectionId);150 const itemsListIndexAfter = await getLastTokenId(api, collectionId);
175 {Fungible: {value: 2}},175 {Fungible: {value: 2}},
176 {Fungible: {value: 3}},176 {Fungible: {value: 3}},
177 ];177 ];
178 const createMultipleItemsTx = api.tx.nft178 const createMultipleItemsTx = api.tx.unique
179 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);179 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);
180 await submitTransactionAsync(bob, createMultipleItemsTx);180 await submitTransactionAsync(bob, createMultipleItemsTx);
181 const token1Data = await getBalance(api, collectionId, bob.address, 0);181 const token1Data = await getBalance(api, collectionId, bob.address, 0);
195 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},195 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},
196 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},196 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},
197 ];197 ];
198 const createMultipleItemsTx = api.tx.nft198 const createMultipleItemsTx = api.tx.unique
199 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);199 .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);
200 await submitTransactionAsync(bob, createMultipleItemsTx);200 await submitTransactionAsync(bob, createMultipleItemsTx);
201 const itemsListIndexAfter = await getLastTokenId(api, collectionId);201 const itemsListIndexAfter = await getLastTokenId(api, collectionId);
234 const itemsListIndexBefore = await getLastTokenId(api, collectionId);234 const itemsListIndexBefore = await getLastTokenId(api, collectionId);
235 expect(itemsListIndexBefore).to.be.equal(0);235 expect(itemsListIndexBefore).to.be.equal(0);
236 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];236 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];
237 const createMultipleItemsTx = api.tx.nft237 const createMultipleItemsTx = api.tx.unique
238 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);238 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
239 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;239 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;
240 });240 });
250 {Fungible: {value: 2}},250 {Fungible: {value: 2}},
251 {Fungible: {value: 3}},251 {Fungible: {value: 3}},
252 ];252 ];
253 const createMultipleItemsTx = api.tx.nft253 const createMultipleItemsTx = api.tx.unique
254 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);254 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
255 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;255 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;
256 });256 });
266 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},266 {ReFungible: {const_data: [0x32], variable_data: [0x32], pieces: 1}},
267 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},267 {ReFungible: {const_data: [0x33], variable_data: [0x33], pieces: 1}},
268 ];268 ];
269 const createMultipleItemsTx = api.tx.nft269 const createMultipleItemsTx = api.tx.unique
270 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);270 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
271 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;271 await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;
272 });272 });
275 it('Create token in not existing collection', async () => {275 it('Create token in not existing collection', async () => {
276 await usingApi(async (api: ApiPromise) => {276 await usingApi(async (api: ApiPromise) => {
277 const collectionId = await getCreatedCollectionCount(api) + 1;277 const collectionId = await getCreatedCollectionCount(api) + 1;
278 const createMultipleItemsTx = api.tx.nft278 const createMultipleItemsTx = api.tx.unique
279 .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);279 .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);
280 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;280 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
281 });281 });
291 {NFT: ['B'.repeat(2049), 'B'.repeat(2049)]},291 {NFT: ['B'.repeat(2049), 'B'.repeat(2049)]},
292 {NFT: ['C'.repeat(2049), 'C'.repeat(2049)]},292 {NFT: ['C'.repeat(2049), 'C'.repeat(2049)]},
293 ];293 ];
294 const createMultipleItemsTx = api.tx.nft294 const createMultipleItemsTx = api.tx.unique
295 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);295 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
296 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;296 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
297297
303 {ReFungible: ['2'.repeat(2049), '2'.repeat(2049), 10]},303 {ReFungible: ['2'.repeat(2049), '2'.repeat(2049), 10]},
304 {ReFungible: ['3'.repeat(2049), '3'.repeat(2049), 10]},304 {ReFungible: ['3'.repeat(2049), '3'.repeat(2049), 10]},
305 ];305 ];
306 const createMultipleItemsTxFungible = api.tx.nft306 const createMultipleItemsTxFungible = api.tx.unique
307 .createMultipleItems(collectionIdReFungible, normalizeAccountId(alice.address), argsReFungible);307 .createMultipleItems(collectionIdReFungible, normalizeAccountId(alice.address), argsReFungible);
308 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTxFungible)).to.be.rejected;308 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTxFungible)).to.be.rejected;
309 });309 });
312 it('Create tokens with different types', async () => {312 it('Create tokens with different types', async () => {
313 await usingApi(async (api: ApiPromise) => {313 await usingApi(async (api: ApiPromise) => {
314 const collectionId = await createCollectionExpectSuccess();314 const collectionId = await createCollectionExpectSuccess();
315 const createMultipleItemsTx = api.tx.nft315 const createMultipleItemsTx = api.tx.unique
316 .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'Fungible', 'ReFungible']);316 .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'Fungible', 'ReFungible']);
317 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;317 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
318 // garbage collection :-D318 // garbage collection :-D
328 {NFT: ['B', 'B'.repeat(2049)]},328 {NFT: ['B', 'B'.repeat(2049)]},
329 {NFT: ['C'.repeat(2049), 'C']},329 {NFT: ['C'.repeat(2049), 'C']},
330 ];330 ];
331 const createMultipleItemsTx = await api.tx.nft331 const createMultipleItemsTx = await api.tx.unique
332 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);332 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
333 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;333 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
334 });334 });
345 {NFT: ['A', 'A']},345 {NFT: ['A', 'A']},
346 {NFT: ['B', 'B']},346 {NFT: ['B', 'B']},
347 ];347 ];
348 const createMultipleItemsTx = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);348 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
349 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;349 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;
350 });350 });
351 });351 });
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
70 const alice = privateKey('//Alice');70 const alice = privateKey('//Alice');
7171
72 const caller = await createEthAccountWithBalance(api, web3);72 const caller = await createEthAccountWithBalance(api, web3);
73 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, {Ethereum: caller});73 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: caller});
74 await submitTransactionAsync(alice, changeAdminTx);74 await submitTransactionAsync(alice, changeAdminTx);
75 const receiver = createEthAccount(web3);75 const receiver = createEthAccount(web3);
7676
109 const alice = privateKey('//Alice');109 const alice = privateKey('//Alice');
110110
111 const caller = await createEthAccountWithBalance(api, web3);111 const caller = await createEthAccountWithBalance(api, web3);
112 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, {Ethereum: caller});112 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: caller});
113 await submitTransactionAsync(alice, changeAdminTx);113 await submitTransactionAsync(alice, changeAdminTx);
114 const receiver = createEthAccount(web3);114 const receiver = createEthAccount(web3);
115115
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
88 const address = collectionIdToAddress(collection);88 const address = collectionIdToAddress(collection);
89 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));89 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));
9090
91 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, {Ethereum: contract.options.address});91 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});
92 await submitTransactionAsync(alice, changeAdminTx);92 await submitTransactionAsync(alice, changeAdminTx);
9393
94 {94 {
127127
128 const address = collectionIdToAddress(collection);128 const address = collectionIdToAddress(collection);
129 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));129 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));
130 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, {Ethereum: contract.options.address});130 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});
131 await submitTransactionAsync(alice, changeAdminTx);131 await submitTransactionAsync(alice, changeAdminTx);
132132
133 {133 {
190 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));190 const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}));
191 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});191 const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});
192192
193 const changeAdminTx = api.tx.nft.addCollectionAdmin(collection, {Ethereum: contract.options.address});193 const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});
194 await submitTransactionAsync(alice, changeAdminTx);194 await submitTransactionAsync(alice, changeAdminTx);
195195
196 {196 {
modifiedtests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth
159 [key: string]: Codec;159 [key: string]: Codec;
160 };160 };
161 vesting: {161 vesting: {
162 maxVestingSchedules: u32 & AugmentedConst<ApiType>;
163 /**162 /**
164 * The minimum amount transferred to call `vested_transfer`.163 * The minimum amount transferred to call `vested_transfer`.
165 **/164 **/
modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
241 **/241 **/
242 [key: string]: AugmentedError<ApiType>;242 [key: string]: AugmentedError<ApiType>;
243 };243 };
244 nft: {
245 /**
246 * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
247 **/
248 CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;
249 /**
250 * Collection limit bounds per collection exceeded
251 **/
252 CollectionLimitBoundsExceeded: AugmentedError<ApiType>;
253 /**
254 * This address is not set as sponsor, use setCollectionSponsor first.
255 **/
256 ConfirmUnsetSponsorFail: AugmentedError<ApiType>;
257 /**
258 * Length of items properties must be greater than 0.
259 **/
260 EmptyArgument: AugmentedError<ApiType>;
261 /**
262 * Tried to enable permissions which are only permitted to be disabled
263 **/
264 OwnerPermissionsCantBeReverted: AugmentedError<ApiType>;
265 /**
266 * Generic error
267 **/
268 [key: string]: AugmentedError<ApiType>;
269 };
270 nonfungible: {244 nonfungible: {
271 /**245 /**
272 * Used amount > 1 with NFT246 * Used amount > 1 with NFT
395 **/369 **/
396 [key: string]: AugmentedError<ApiType>;370 [key: string]: AugmentedError<ApiType>;
397 };371 };
398 scheduler: {
399 /**
400 * Failed to schedule a call
401 **/
402 FailedToSchedule: AugmentedError<ApiType>;
403 /**
404 * Cannot find the scheduled call.
405 **/
406 NotFound: AugmentedError<ApiType>;
407 /**
408 * Reschedule failed because it does not change scheduled time.
409 **/
410 RescheduleNoChange: AugmentedError<ApiType>;
411 /**
412 * Given target block number is in the past.
413 **/
414 TargetBlockNumberInPast: AugmentedError<ApiType>;
415 /**
416 * Generic error
417 **/
418 [key: string]: AugmentedError<ApiType>;
419 };
420 sudo: {372 sudo: {
421 /**373 /**
422 * Sender must be the Sudo account374 * Sender must be the Sudo account
475 **/427 **/
476 [key: string]: AugmentedError<ApiType>;428 [key: string]: AugmentedError<ApiType>;
477 };429 };
430 unique: {
431 /**
432 * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
433 **/
434 CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;
435 /**
436 * Collection limit bounds per collection exceeded
437 **/
438 CollectionLimitBoundsExceeded: AugmentedError<ApiType>;
439 /**
440 * This address is not set as sponsor, use setCollectionSponsor first.
441 **/
442 ConfirmUnsetSponsorFail: AugmentedError<ApiType>;
443 /**
444 * Length of items properties must be greater than 0.
445 **/
446 EmptyArgument: AugmentedError<ApiType>;
447 /**
448 * Tried to enable permissions which are only permitted to be disabled
449 **/
450 OwnerPermissionsCantBeReverted: AugmentedError<ApiType>;
451 /**
452 * Generic error
453 **/
454 [key: string]: AugmentedError<ApiType>;
455 };
478 vesting: {456 vesting: {
479 /**457 /**
480 * Amount being transferred is too low to create a vesting schedule.458 * The vested transfer amount is too low
481 **/459 **/
482 AmountLow: AugmentedError<ApiType>;460 AmountLow: AugmentedError<ApiType>;
483 /**461 /**
484 * The account already has `MaxVestingSchedules` count of schedules and thus462 * Insufficient amount of balance to lock
485 * cannot add another one. Consider merging existing schedules in order to add another.463 **/
486 **/
487 AtMaxVestingSchedules: AugmentedError<ApiType>;464 InsufficientBalanceToLock: AugmentedError<ApiType>;
488 /**465 /**
489 * Failed to create a new schedule because some parameter was invalid.466 * Failed because the maximum vesting schedules was exceeded
490 **/467 **/
491 InvalidScheduleParams: AugmentedError<ApiType>;468 MaxVestingSchedulesExceeded: AugmentedError<ApiType>;
492 /**469 /**
493 * The account given is not vesting.470 * This account have too many vesting schedules
494 **/471 **/
472 TooManyVestingSchedules: AugmentedError<ApiType>;
473 /**
474 * Vesting period is zero
475 **/
495 NotVesting: AugmentedError<ApiType>;476 ZeroVestingPeriod: AugmentedError<ApiType>;
496 /**477 /**
497 * An index was out of bounds of the vesting schedules.478 * Number of vests is zero
498 **/479 **/
499 ScheduleIndexOutOfBounds: AugmentedError<ApiType>;480 ZeroVestingPeriodCount: AugmentedError<ApiType>;
500 /**481 /**
501 * Generic error482 * Generic error
502 **/483 **/
modifiedtests/src/interfaces/augment-api-events.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4import type { EthereumLog, EvmCoreErrorExitReason } from './ethereum';4import type { EthereumLog, EvmCoreErrorExitReason } from './ethereum';
5import type { PalletCommonAccountBasicCrossAccountIdRepr } from './nft';5import type { PalletCommonAccountBasicCrossAccountIdRepr } from './unique';
6import type { ApiTypes } from '@polkadot/api/types';6import type { ApiTypes } from '@polkadot/api/types';
7import type { Bytes, Null, Option, Result, U256, U8aFixed, u128, u32, u64, u8 } from '@polkadot/types';7import type { Null, Option, Result, U256, U8aFixed, u128, u32, u64, u8 } from '@polkadot/types';
8import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';8import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
9import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';9import type { FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchInfo, SpRuntimeDispatchError, XcmV1MultiLocation, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
10import type { ITuple } from '@polkadot/types/types';
1110
12declare module '@polkadot/api/types/events' {11declare module '@polkadot/api/types/events' {
13 export interface AugmentedEvents<ApiType> {12 export interface AugmentedEvents<ApiType> {
389 **/388 **/
390 [key: string]: AugmentedEvent<ApiType>;389 [key: string]: AugmentedEvent<ApiType>;
391 };390 };
392 scheduler: {
393 /**
394 * Canceled some task. \[when, index\]
395 **/
396 Canceled: AugmentedEvent<ApiType, [u32, u32]>;
397 /**
398 * Dispatched some task. \[task, id, result\]
399 **/
400 Dispatched: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, Result<Null, SpRuntimeDispatchError>]>;
401 /**
402 * Scheduled some task. \[when, index\]
403 **/
404 Scheduled: AugmentedEvent<ApiType, [u32, u32]>;
405 /**
406 * Generic event
407 **/
408 [key: string]: AugmentedEvent<ApiType>;
409 };
410 sudo: {391 sudo: {
411 /**392 /**
412 * The \[sudoer\] just switched identity; the old key is supplied.393 * The \[sudoer\] just switched identity; the old key is supplied.
491 [key: string]: AugmentedEvent<ApiType>;472 [key: string]: AugmentedEvent<ApiType>;
492 };473 };
493 vesting: {474 vesting: {
494 /**475 /**
495 * An \[account\] has become fully vested.476 * Claimed vesting. \[who, locked_amount\]
496 **/477 **/
497 VestingCompleted: AugmentedEvent<ApiType, [AccountId32]>;478 Claimed: AugmentedEvent<ApiType, [AccountId32, u128]>;
498 /**479 /**
499 * The amount vested has been updated. This could indicate a change in funds available.480 * Added new vesting schedule. \[from, to, vesting_schedule\]
500 * The balance given is the amount which is left unvested (and thus locked).481 **/
501 * \[account, unvested\]
502 **/
503 VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>;482 VestingScheduleAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, OrmlVestingVestingSchedule]>;
483 /**
484 * Updated vesting schedules. \[who\]
485 **/
486 VestingSchedulesUpdated: AugmentedEvent<ApiType, [AccountId32]>;
504 /**487 /**
505 * Generic event488 * Generic event
506 **/489 **/
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4import type { EthereumBlock, EthereumReceipt, EthereumTransactionLegacyTransaction, FpRpcTransactionStatus } from './ethereum';4import type { EthereumBlock, EthereumReceipt, EthereumTransactionLegacyTransaction, FpRpcTransactionStatus } from './ethereum';
5import type { NftDataStructsCollection, PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2 } from './nft';
6import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';5import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';
6import type { PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, UpDataStructsCollection, UpDataStructsCollectionStats } from './unique';
7import type { ApiTypes } from '@polkadot/api/types';7import type { ApiTypes } from '@polkadot/api/types';
8import type { BTreeMap, Bytes, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';8import type { BTreeMap, Bytes, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';
9import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';9import type { AccountId32, H160, H256 } from '@polkadot/types/interfaces/runtime';
10import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV1UpgradeRestriction, SpRuntimeGenericDigest } from '@polkadot/types/lookup';10import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletTransactionPaymentReleases, PalletTreasuryProposal, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV1UpgradeRestriction, SpRuntimeGenericDigest } from '@polkadot/types/lookup';
11import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';11import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
1212
13declare module '@polkadot/api/types/storage' {13declare module '@polkadot/api/types/storage' {
58 /**58 /**
59 * Collection info59 * Collection info
60 **/60 **/
61 collectionById: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<NftDataStructsCollection>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;61 collectionById: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<UpDataStructsCollection>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
62 createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;62 createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
63 destroyedCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;63 destroyedCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
64 /**
65 * Not used by code, exists only to provide some types to metadata
66 **/
67 dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32]>>>, []> & QueryableStorageEntry<ApiType, []>;
64 /**68 /**
65 * List of collection admins69 * List of collection admins
66 **/70 **/
171 **/175 **/
172 [key: string]: QueryableStorageEntry<ApiType>;176 [key: string]: QueryableStorageEntry<ApiType>;
173 };177 };
174 nft: {
175 /**
176 * Used for migrations
177 **/
178 chainVersion: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
179 /**
180 * (Collection id (controlled?2), who created (real))
181 * TODO: Off chain worker should remove from this map when collection gets removed
182 **/
183 createItemBasket: AugmentedQuery<ApiType, (arg: ITuple<[u32, AccountId32]> | [u32 | AnyNumber | Uint8Array, AccountId32 | string | Uint8Array]) => Observable<u32>, [ITuple<[u32, AccountId32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, AccountId32]>]>;
184 /**
185 * Collection id (controlled?2), owning user (real)
186 **/
187 fungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<u32>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
188 /**
189 * Collection id (controlled?2), token id (controlled?2)
190 **/
191 nftTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
192 /**
193 * Collection id (controlled?2), token id (controlled?2)
194 **/
195 reFungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
196 /**
197 * Variable metadata sponsoring
198 * Collection id (controlled?2), token id (controlled?2)
199 **/
200 variableMetaDataBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
201 /**
202 * Generic query
203 **/
204 [key: string]: QueryableStorageEntry<ApiType>;
205 };
206 nftPayment: {
207 /**
208 * Generic query
209 **/
210 [key: string]: QueryableStorageEntry<ApiType>;
211 };
212 nonfungible: {178 nonfungible: {
213 accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;179 accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
214 allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletCommonAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;180 allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletCommonAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
383 **/349 **/
384 [key: string]: QueryableStorageEntry<ApiType>;350 [key: string]: QueryableStorageEntry<ApiType>;
385 };351 };
386 scheduler: {
387 /**
388 * Items to be executed, indexed by the block number that they should be executed on.
389 **/
390 agenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletUnqSchedulerScheduledV2>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
391 /**
392 * Lookup from identity to the block number and index of the task.
393 **/
394 lookup: AugmentedQuery<ApiType, (arg: Bytes | string | Uint8Array) => Observable<Option<ITuple<[u32, u32]>>>, [Bytes]> & QueryableStorageEntry<ApiType, [Bytes]>;
395 specAgenda: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletUnqSchedulerCallSpec>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
396 /**
397 * Storage version of the pallet.
398 *
399 * New networks start with last version.
400 **/
401 storageVersion: AugmentedQuery<ApiType, () => Observable<PalletUnqSchedulerReleases>, []> & QueryableStorageEntry<ApiType, []>;
402 /**
403 * Generic query
404 **/
405 [key: string]: QueryableStorageEntry<ApiType>;
406 };
407 sudo: {352 sudo: {
408 /**353 /**
409 * The `AccountId` of the sudo key.354 * The `AccountId` of the sudo key.
537 **/482 **/
538 [key: string]: QueryableStorageEntry<ApiType>;483 [key: string]: QueryableStorageEntry<ApiType>;
539 };484 };
540 vesting: {485 unique: {
541 /**486 /**
542 * Storage version of the pallet.487 * Used for migrations
543 * 488 **/
544 * New networks start with latest version, as determined by the genesis build.
545 **/
546 storageVersion: AugmentedQuery<ApiType, () => Observable<PalletVestingReleases>, []> & QueryableStorageEntry<ApiType, []>;489 chainVersion: AugmentedQuery<ApiType, () => Observable<u64>, []> & QueryableStorageEntry<ApiType, []>;
547 /**490 /**
548 * Information regarding the vesting of a given account.491 * (Collection id (controlled?2), who created (real))
549 **/492 * TODO: Off chain worker should remove from this map when collection gets removed
493 **/
550 vesting: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<Vec<PalletVestingVestingInfo>>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;494 createItemBasket: AugmentedQuery<ApiType, (arg: ITuple<[u32, AccountId32]> | [u32 | AnyNumber | Uint8Array, AccountId32 | string | Uint8Array]) => Observable<Option<u32>>, [ITuple<[u32, AccountId32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, AccountId32]>]>;
495 fungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
496 /**
497 * Collection id (controlled?2), owning user (real)
498 **/
499 fungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
500 /**
501 * Approval sponsoring
502 **/
503 nftApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
504 /**
505 * Collection id (controlled?2), token id (controlled?2)
506 **/
507 nftTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
508 refungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
509 /**
510 * Collection id (controlled?2), token id (controlled?2)
511 **/
512 reFungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
513 /**
514 * Variable metadata sponsoring
515 * Collection id (controlled?2), token id (controlled?2)
516 **/
517 variableMetaDataBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
551 /**518 /**
552 * Generic query519 * Generic query
553 **/520 **/
554 [key: string]: QueryableStorageEntry<ApiType>;521 [key: string]: QueryableStorageEntry<ApiType>;
555 };522 };
523 vesting: {
524 /**
525 * Vesting schedules of an account.
526 *
527 * VestingSchedules: map AccountId => Vec<VestingSchedule>
528 **/
529 vestingSchedules: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Vec<OrmlVestingVestingSchedule>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
530 /**
531 * Generic query
532 **/
533 [key: string]: QueryableStorageEntry<ApiType>;
534 };
556 xcmpQueue: {535 xcmpQueue: {
557 /**536 /**
558 * Inbound aggregate XCMP messages. It can only be one per ParaId/block.537 * Inbound aggregate XCMP messages. It can only be one per ParaId/block.
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
2/* eslint-disable */2/* eslint-disable */
33
4import type { NftDataStructsCollection, NftDataStructsCollectionId, NftDataStructsCollectionStats, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr } from './nft';4import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsCollection, UpDataStructsCollectionId, UpDataStructsCollectionStats, UpDataStructsTokenId } from './unique';
5import type { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types';5import type { Bytes, HashMap, Json, Metadata, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types';
6import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';6import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
7import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';7import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
355 **/355 **/
356 version: AugmentedRpc<() => Observable<Text>>;356 version: AugmentedRpc<() => Observable<Text>>;
357 };357 };
358 nft: {
359 /**
360 * Get amount of different user tokens
361 **/
362 accountBalance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
363 /**
364 * Get tokens owned by account
365 **/
366 accountTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;
367 /**
368 * Get admin list
369 **/
370 adminlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;
371 /**
372 * Get allowed amount
373 **/
374 allowance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, sender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
375 /**
376 * Check if user is allowed to use collection
377 **/
378 allowed: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
379 /**
380 * Get allowlist
381 **/
382 allowlist: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;
383 /**
384 * Get amount of specific account token
385 **/
386 balance: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
387 /**
388 * Get collection by specified id
389 **/
390 collectionById: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<NftDataStructsCollection>>>;
391 /**
392 * Get collection stats
393 **/
394 collectionStats: AugmentedRpc<(at?: Hash | string | Uint8Array) => Observable<NftDataStructsCollectionStats>>;
395 /**
396 * Get tokens contained in collection
397 **/
398 collectionTokens: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<NftDataStructsTokenId>>>;
399 /**
400 * Get token constant metadata
401 **/
402 constMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;
403 /**
404 * Get last token id
405 **/
406 lastTokenId: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<NftDataStructsTokenId>>;
407 /**
408 * Check if token exists
409 **/
410 tokenExists: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
411 /**
412 * Get token owner
413 **/
414 tokenOwner: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletCommonAccountBasicCrossAccountIdRepr>>;
415 /**
416 * Get token variable metadata
417 **/
418 variableMetadata: AugmentedRpc<(collection: NftDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: NftDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;
419 };
420 offchain: {358 offchain: {
421 /**359 /**
422 * Get offchain local storage under given key and prefix360 * Get offchain local storage under given key and prefix
609 **/547 **/
610 version: AugmentedRpc<() => Observable<Text>>;548 version: AugmentedRpc<() => Observable<Text>>;
611 };549 };
550 unique: {
551 /**
552 * Get amount of different user tokens
553 **/
554 accountBalance: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
555 /**
556 * Get tokens owned by account
557 **/
558 accountTokens: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsTokenId>>>;
559 /**
560 * Get admin list
561 **/
562 adminlist: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;
563 /**
564 * Get allowed amount
565 **/
566 allowance: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, sender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
567 /**
568 * Check if user is allowed to use collection
569 **/
570 allowed: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
571 /**
572 * Get allowlist
573 **/
574 allowlist: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletCommonAccountBasicCrossAccountIdRepr>>>;
575 /**
576 * Get amount of specific account token
577 **/
578 balance: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, account: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
579 /**
580 * Get collection by specified id
581 **/
582 collectionById: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsCollection>>>;
583 /**
584 * Get collection stats
585 **/
586 collectionStats: AugmentedRpc<(at?: Hash | string | Uint8Array) => Observable<UpDataStructsCollectionStats>>;
587 /**
588 * Get tokens contained in collection
589 **/
590 collectionTokens: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsTokenId>>>;
591 /**
592 * Get token constant metadata
593 **/
594 constMetadata: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;
595 /**
596 * Get last token id
597 **/
598 lastTokenId: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<UpDataStructsTokenId>>;
599 /**
600 * Check if token exists
601 **/
602 tokenExists: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
603 /**
604 * Get token owner
605 **/
606 tokenOwner: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletCommonAccountBasicCrossAccountIdRepr>>;
607 /**
608 * Get token variable metadata
609 **/
610 variableMetadata: AugmentedRpc<(collection: UpDataStructsCollectionId | AnyNumber | Uint8Array, tokenId: UpDataStructsTokenId | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;
611 };
612 web3: {612 web3: {
613 /**613 /**
614 * Returns current client version.614 * Returns current client version.
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4import type { EthereumTransactionLegacyTransaction } from './ethereum';4import type { EthereumTransactionLegacyTransaction } from './ethereum';
5import type { NftDataStructsAccessMode, NftDataStructsCollectionLimits, NftDataStructsCollectionMode, NftDataStructsCreateItemData, NftDataStructsMetaUpdatePermission, NftDataStructsSchemaVersion, PalletCommonAccountBasicCrossAccountIdRepr } from './nft';5import type { CumulusPrimitivesParachainInherentParachainInherentData } from './polkadot';
6import type { CumulusPrimitivesParachainInherentParachainInherentData } from './polkadot';6import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsAccessMode, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion } from './unique';
7import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';7import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
8import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';8import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types';
9import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';9import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
10import type { AccountId32, Call, H160, H256, MultiAddress, Perbill } from '@polkadot/types/interfaces/runtime';10import type { AccountId32, Call, H160, H256, MultiAddress, Perbill } from '@polkadot/types/interfaces/runtime';
11import type { PalletVestingVestingInfo, SpCoreChangesTrieChangesTrieConfiguration, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';11import type { SpCoreChangesTrieChangesTrieConfiguration, XcmV1MultiLocation, XcmV2WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
12import type { AnyNumber, ITuple } from '@polkadot/types/types';12import type { AnyNumber, ITuple } from '@polkadot/types/types';
1313
14declare module '@polkadot/api/types/submittable' {14declare module '@polkadot/api/types/submittable' {
201 **/201 **/
202 [key: string]: SubmittableExtrinsicFunction<ApiType>;202 [key: string]: SubmittableExtrinsicFunction<ApiType>;
203 };203 };
204 nft: {
205 /**
206 * Adds an admin of the Collection.
207 * NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
208 *
209 * # Permissions
210 *
211 * * Collection Owner.
212 * * Collection Admin.
213 *
214 * # Arguments
215 *
216 * * collection_id: ID of the Collection to add admin for.
217 *
218 * * new_admin_id: Address of new admin to add.
219 **/
220 addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdminId: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
221 /**
222 * Add an address to allow list.
223 *
224 * # Permissions
225 *
226 * * Collection Owner
227 * * Collection Admin
228 *
229 * # Arguments
230 *
231 * * collection_id.
232 *
233 * * address.
234 **/
235 addToAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
236 /**
237 * Set, change, or remove approved address to transfer the ownership of the NFT.
238 *
239 * # Permissions
240 *
241 * * Collection Owner
242 * * Collection Admin
243 * * Current NFT owner
244 *
245 * # Arguments
246 *
247 * * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
248 *
249 * * collection_id.
250 *
251 * * item_id: ID of the item.
252 **/
253 approve: AugmentedSubmittable<(spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
254 /**
255 * Destroys a concrete instance of NFT on behalf of the owner
256 * See also: [`approve`]
257 *
258 * # Permissions
259 *
260 * * Collection Owner.
261 * * Collection Admin.
262 * * Current NFT Owner.
263 *
264 * # Arguments
265 *
266 * * collection_id: ID of the collection.
267 *
268 * * item_id: ID of NFT to burn.
269 *
270 * * from: owner of item
271 **/
272 burnFrom: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, from: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, u32, u128]>;
273 /**
274 * Destroys a concrete instance of NFT.
275 *
276 * # Permissions
277 *
278 * * Collection Owner.
279 * * Collection Admin.
280 * * Current NFT Owner.
281 *
282 * # Arguments
283 *
284 * * collection_id: ID of the collection.
285 *
286 * * item_id: ID of NFT to burn.
287 **/
288 burnItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
289 /**
290 * Change the owner of the collection.
291 *
292 * # Permissions
293 *
294 * * Collection Owner.
295 *
296 * # Arguments
297 *
298 * * collection_id.
299 *
300 * * new_owner.
301 **/
302 changeCollectionOwner: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newOwner: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
303 /**
304 * # Permissions
305 *
306 * * Sponsor.
307 *
308 * # Arguments
309 *
310 * * collection_id.
311 **/
312 confirmSponsorship: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
313 /**
314 * This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.
315 *
316 * # Permissions
317 *
318 * * Anyone.
319 *
320 * # Arguments
321 *
322 * * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
323 *
324 * * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
325 *
326 * * token_prefix: UTF-8 string with token prefix.
327 *
328 * * mode: [CollectionMode] collection type and type dependent data.
329 **/
330 createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: NftDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, NftDataStructsCollectionMode]>;
331 /**
332 * This method creates a concrete instance of NFT Collection created with CreateCollection method.
333 *
334 * # Permissions
335 *
336 * * Collection Owner.
337 * * Collection Admin.
338 * * Anyone if
339 * * Allow List is enabled, and
340 * * Address is added to allow list, and
341 * * MintPermission is enabled (see SetMintPermission method)
342 *
343 * # Arguments
344 *
345 * * collection_id: ID of the collection.
346 *
347 * * owner: Address, initial owner of the NFT.
348 *
349 * * data: Token data to store on chain.
350 **/
351 createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: NftDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, NftDataStructsCreateItemData]>;
352 /**
353 * This method creates multiple items in a collection created with CreateCollection method.
354 *
355 * # Permissions
356 *
357 * * Collection Owner.
358 * * Collection Admin.
359 * * Anyone if
360 * * Allow List is enabled, and
361 * * Address is added to allow list, and
362 * * MintPermission is enabled (see SetMintPermission method)
363 *
364 * # Arguments
365 *
366 * * collection_id: ID of the collection.
367 *
368 * * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
369 *
370 * * owner: Address, initial owner of the NFT.
371 **/
372 createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<NftDataStructsCreateItemData> | (NftDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, Vec<NftDataStructsCreateItemData>]>;
373 /**
374 * **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.
375 *
376 * # Permissions
377 *
378 * * Collection Owner.
379 *
380 * # Arguments
381 *
382 * * collection_id: collection to destroy.
383 **/
384 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
385 /**
386 * Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
387 *
388 * # Permissions
389 *
390 * * Collection Owner.
391 * * Collection Admin.
392 *
393 * # Arguments
394 *
395 * * collection_id: ID of the Collection to remove admin for.
396 *
397 * * account_id: Address of admin to remove.
398 **/
399 removeCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, accountId: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
400 /**
401 * Switch back to pay-per-own-transaction model.
402 *
403 * # Permissions
404 *
405 * * Collection owner.
406 *
407 * # Arguments
408 *
409 * * collection_id.
410 **/
411 removeCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
412 /**
413 * Remove an address from allow list.
414 *
415 * # Permissions
416 *
417 * * Collection Owner
418 * * Collection Admin
419 *
420 * # Arguments
421 *
422 * * collection_id.
423 *
424 * * address.
425 **/
426 removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
427 setCollectionLimits: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: NftDataStructsCollectionLimits | { accountTokenOwnershipLimit?: any; sponsoredDataSize?: any; sponsoredDataRateLimit?: any; tokenLimit?: any; sponsorTransferTimeout?: any; ownerCanTransfer?: any; ownerCanDestroy?: any; transfersEnabled?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, NftDataStructsCollectionLimits]>;
428 /**
429 * # Permissions
430 *
431 * * Collection Owner
432 *
433 * # Arguments
434 *
435 * * collection_id.
436 *
437 * * new_sponsor.
438 **/
439 setCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newSponsor: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
440 /**
441 * Set const on-chain data schema.
442 *
443 * # Permissions
444 *
445 * * Collection Owner
446 * * Collection Admin
447 *
448 * # Arguments
449 *
450 * * collection_id.
451 *
452 * * schema: String representing the const on-chain data schema.
453 **/
454 setConstOnChainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
455 /**
456 * Set meta_update_permission value for particular collection
457 *
458 * # Permissions
459 *
460 * * Collection Owner.
461 *
462 * # Arguments
463 *
464 * * collection_id: ID of the collection.
465 *
466 * * value: New flag value.
467 **/
468 setMetaUpdatePermissionFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: NftDataStructsMetaUpdatePermission | 'ItemOwner' | 'Admin' | 'None' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, NftDataStructsMetaUpdatePermission]>;
469 /**
470 * Allows Anyone to create tokens if:
471 * * Allow List is enabled, and
472 * * Address is added to allow list, and
473 * * This method was called with True parameter
474 *
475 * # Permissions
476 * * Collection Owner
477 *
478 * # Arguments
479 *
480 * * collection_id.
481 *
482 * * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
483 **/
484 setMintPermission: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, mintPermission: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
485 /**
486 * Set off-chain data schema.
487 *
488 * # Permissions
489 *
490 * * Collection Owner
491 * * Collection Admin
492 *
493 * # Arguments
494 *
495 * * collection_id.
496 *
497 * * schema: String representing the offchain data schema.
498 **/
499 setOffchainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
500 /**
501 * Toggle between normal and allow list access for the methods with access for `Anyone`.
502 *
503 * # Permissions
504 *
505 * * Collection Owner.
506 *
507 * # Arguments
508 *
509 * * collection_id.
510 *
511 * * mode: [AccessMode]
512 **/
513 setPublicAccessMode: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, mode: NftDataStructsAccessMode | 'Normal' | 'AllowList' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, NftDataStructsAccessMode]>;
514 /**
515 * Set schema standard
516 * ImageURL
517 * Unique
518 *
519 * # Permissions
520 *
521 * * Collection Owner
522 * * Collection Admin
523 *
524 * # Arguments
525 *
526 * * collection_id.
527 *
528 * * schema: SchemaVersion: enum
529 **/
530 setSchemaVersion: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, version: NftDataStructsSchemaVersion | 'ImageURL' | 'Unique' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, NftDataStructsSchemaVersion]>;
531 /**
532 * Set transfers_enabled value for particular collection
533 *
534 * # Permissions
535 *
536 * * Collection Owner.
537 *
538 * # Arguments
539 *
540 * * collection_id: ID of the collection.
541 *
542 * * value: New flag value.
543 **/
544 setTransfersEnabledFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
545 /**
546 * Set off-chain data schema.
547 *
548 * # Permissions
549 *
550 * * Collection Owner
551 * * Collection Admin
552 *
553 * # Arguments
554 *
555 * * collection_id.
556 *
557 * * schema: String representing the offchain data schema.
558 **/
559 setVariableMetaData: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Bytes]>;
560 /**
561 * Set variable on-chain data schema.
562 *
563 * # Permissions
564 *
565 * * Collection Owner
566 * * Collection Admin
567 *
568 * # Arguments
569 *
570 * * collection_id.
571 *
572 * * schema: String representing the variable on-chain data schema.
573 **/
574 setVariableOnChainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
575 /**
576 * Change ownership of the token.
577 *
578 * # Permissions
579 *
580 * * Collection Owner
581 * * Collection Admin
582 * * Current NFT owner
583 *
584 * # Arguments
585 *
586 * * recipient: Address of token recipient.
587 *
588 * * collection_id.
589 *
590 * * item_id: ID of the item
591 * * Non-Fungible Mode: Required.
592 * * Fungible Mode: Ignored.
593 * * Re-Fungible Mode: Required.
594 *
595 * * value: Amount to transfer.
596 * * Non-Fungible Mode: Ignored
597 * * Fungible Mode: Must specify transferred amount
598 * * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
599 **/
600 transfer: AugmentedSubmittable<(recipient: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
601 /**
602 * Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
603 *
604 * # Permissions
605 * * Collection Owner
606 * * Collection Admin
607 * * Current NFT owner
608 * * Address approved by current NFT owner
609 *
610 * # Arguments
611 *
612 * * from: Address that owns token.
613 *
614 * * recipient: Address of token recipient.
615 *
616 * * collection_id.
617 *
618 * * item_id: ID of the item.
619 *
620 * * value: Amount to transfer.
621 **/
622 transferFrom: AugmentedSubmittable<(from: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, recipient: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
623 /**
624 * Generic tx
625 **/
626 [key: string]: SubmittableExtrinsicFunction<ApiType>;
627 };
628 nftPayment: {
629 /**
630 * Generic tx
631 **/
632 [key: string]: SubmittableExtrinsicFunction<ApiType>;
633 };
634 parachainSystem: {204 parachainSystem: {
635 authorizeUpgrade: AugmentedSubmittable<(codeHash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;205 authorizeUpgrade: AugmentedSubmittable<(codeHash: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H256]>;
636 enactAuthorizedUpgrade: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;206 enactAuthorizedUpgrade: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
778 **/348 **/
779 [key: string]: SubmittableExtrinsicFunction<ApiType>;349 [key: string]: SubmittableExtrinsicFunction<ApiType>;
780 };350 };
781 scheduler: {
782 /**
783 * Cancel an anonymously scheduled task.
784 *
785 * # <weight>
786 * - S = Number of already scheduled calls
787 * - Base Weight: 22.15 + 2.869 * S µs
788 * - DB Weight:
789 * - Read: Agenda
790 * - Write: Agenda, Lookup
791 * - Will use base weight of 100 which should be good for up to 30 scheduled calls
792 * # </weight>
793 **/
794 cancel: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
795 /**
796 * Cancel a named scheduled task.
797 *
798 * # <weight>
799 * - S = Number of already scheduled calls
800 * - Base Weight: 24.91 + 2.907 * S µs
801 * - DB Weight:
802 * - Read: Agenda, Lookup
803 * - Write: Agenda, Lookup
804 * - Will use base weight of 100 which should be good for up to 30 scheduled calls
805 * # </weight>
806 **/
807 cancelNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
808 /**
809 * Anonymously schedule a task.
810 *
811 * # <weight>
812 * - S = Number of already scheduled calls
813 * - Base Weight: 22.29 + .126 * S µs
814 * - DB Weight:
815 * - Read: Agenda
816 * - Write: Agenda
817 * - Will use base weight of 25 which should be good for up to 30 scheduled calls
818 * # </weight>
819 **/
820 schedule: AugmentedSubmittable<(when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
821 /**
822 * Anonymously schedule a task after a delay.
823 *
824 * # <weight>
825 * Same as [`schedule`].
826 * # </weight>
827 **/
828 scheduleAfter: AugmentedSubmittable<(after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call) => SubmittableExtrinsic<ApiType>, [u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
829 /**
830 * Schedule a named task.
831 *
832 * # <weight>
833 * - S = Number of already scheduled calls
834 * - Base Weight: 29.6 + .159 * S µs
835 * - DB Weight:
836 * - Read: Agenda, Lookup
837 * - Write: Agenda, Lookup
838 * - Will use base weight of 35 which should be good for more than 30 scheduled calls
839 * # </weight>
840 **/
841 scheduleNamed: AugmentedSubmittable<(id: Bytes | string | Uint8Array, when: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
842 /**
843 * Schedule a named task after a delay.
844 *
845 * # <weight>
846 * Same as [`schedule_named`].
847 * # </weight>
848 **/
849 scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: u32 | AnyNumber | Uint8Array, maybePeriodic: Option<ITuple<[u32, u32]>> | null | object | string | Uint8Array, priority: u8 | AnyNumber | Uint8Array, call: Call) => SubmittableExtrinsic<ApiType>, [Bytes, u32, Option<ITuple<[u32, u32]>>, u8, Call]>;
850 /**
851 * Generic tx
852 **/
853 [key: string]: SubmittableExtrinsicFunction<ApiType>;
854 };
855 sudo: {351 sudo: {
856 /**352 /**
857 * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo353 * Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo
892 * - Weight of derivative `call` execution + 10,000.388 * - Weight of derivative `call` execution + 10,000.
893 * # </weight>389 * # </weight>
894 **/390 **/
895 sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;391 sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, ) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;
896 /**392 /**
897 * Authenticates the sudo key and dispatches a function call with `Root` origin.393 * Authenticates the sudo key and dispatches a function call with `Root` origin.
898 * This function does not check the weight of the call, and instead allows the394 * This function does not check the weight of the call, and instead allows the
1094 **/590 **/
1095 [key: string]: SubmittableExtrinsicFunction<ApiType>;591 [key: string]: SubmittableExtrinsicFunction<ApiType>;
1096 };592 };
593 unique: {
594 /**
595 * Adds an admin of the Collection.
596 * NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
597 *
598 * # Permissions
599 *
600 * * Collection Owner.
601 * * Collection Admin.
602 *
603 * # Arguments
604 *
605 * * collection_id: ID of the Collection to add admin for.
606 *
607 * * new_admin_id: Address of new admin to add.
608 **/
609 addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdminId: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
610 /**
611 * Add an address to allow list.
612 *
613 * # Permissions
614 *
615 * * Collection Owner
616 * * Collection Admin
617 *
618 * # Arguments
619 *
620 * * collection_id.
621 *
622 * * address.
623 **/
624 addToAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
625 /**
626 * Set, change, or remove approved address to transfer the ownership of the NFT.
627 *
628 * # Permissions
629 *
630 * * Collection Owner
631 * * Collection Admin
632 * * Current NFT owner
633 *
634 * # Arguments
635 *
636 * * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
637 *
638 * * collection_id.
639 *
640 * * item_id: ID of the item.
641 **/
642 approve: AugmentedSubmittable<(spender: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
643 /**
644 * Destroys a concrete instance of NFT on behalf of the owner
645 * See also: [`approve`]
646 *
647 * # Permissions
648 *
649 * * Collection Owner.
650 * * Collection Admin.
651 * * Current NFT Owner.
652 *
653 * # Arguments
654 *
655 * * collection_id: ID of the collection.
656 *
657 * * item_id: ID of NFT to burn.
658 *
659 * * from: owner of item
660 **/
661 burnFrom: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, from: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, u32, u128]>;
662 /**
663 * Destroys a concrete instance of NFT.
664 *
665 * # Permissions
666 *
667 * * Collection Owner.
668 * * Collection Admin.
669 * * Current NFT Owner.
670 *
671 * # Arguments
672 *
673 * * collection_id: ID of the collection.
674 *
675 * * item_id: ID of NFT to burn.
676 **/
677 burnItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
678 /**
679 * Change the owner of the collection.
680 *
681 * # Permissions
682 *
683 * * Collection Owner.
684 *
685 * # Arguments
686 *
687 * * collection_id.
688 *
689 * * new_owner.
690 **/
691 changeCollectionOwner: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newOwner: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
692 /**
693 * # Permissions
694 *
695 * * Sponsor.
696 *
697 * # Arguments
698 *
699 * * collection_id.
700 **/
701 confirmSponsorship: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
702 /**
703 * This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.
704 *
705 * # Permissions
706 *
707 * * Anyone.
708 *
709 * # Arguments
710 *
711 * * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
712 *
713 * * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
714 *
715 * * token_prefix: UTF-8 string with token prefix.
716 *
717 * * mode: [CollectionMode] collection type and type dependent data.
718 **/
719 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]>;
720 /**
721 * This method creates a concrete instance of NFT Collection created with CreateCollection method.
722 *
723 * # Permissions
724 *
725 * * Collection Owner.
726 * * Collection Admin.
727 * * Anyone if
728 * * Allow List is enabled, and
729 * * Address is added to allow list, and
730 * * MintPermission is enabled (see SetMintPermission method)
731 *
732 * # Arguments
733 *
734 * * collection_id: ID of the collection.
735 *
736 * * owner: Address, initial owner of the NFT.
737 *
738 * * data: Token data to store on chain.
739 **/
740 createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;
741 /**
742 * This method creates multiple items in a collection created with CreateCollection method.
743 *
744 * # Permissions
745 *
746 * * Collection Owner.
747 * * Collection Admin.
748 * * Anyone if
749 * * Allow List is enabled, and
750 * * Address is added to allow list, and
751 * * MintPermission is enabled (see SetMintPermission method)
752 *
753 * # Arguments
754 *
755 * * collection_id: ID of the collection.
756 *
757 * * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
758 *
759 * * owner: Address, initial owner of the NFT.
760 **/
761 createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;
762 /**
763 * **DANGEROUS**: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose real money.
764 *
765 * # Permissions
766 *
767 * * Collection Owner.
768 *
769 * # Arguments
770 *
771 * * collection_id: collection to destroy.
772 **/
773 destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
774 /**
775 * Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
776 *
777 * # Permissions
778 *
779 * * Collection Owner.
780 * * Collection Admin.
781 *
782 * # Arguments
783 *
784 * * collection_id: ID of the Collection to remove admin for.
785 *
786 * * account_id: Address of admin to remove.
787 **/
788 removeCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, accountId: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
789 /**
790 * Switch back to pay-per-own-transaction model.
791 *
792 * # Permissions
793 *
794 * * Collection owner.
795 *
796 * # Arguments
797 *
798 * * collection_id.
799 **/
800 removeCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
801 /**
802 * Remove an address from allow list.
803 *
804 * # Permissions
805 *
806 * * Collection Owner
807 * * Collection Admin
808 *
809 * # Arguments
810 *
811 * * collection_id.
812 *
813 * * address.
814 **/
815 removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletCommonAccountBasicCrossAccountIdRepr]>;
816 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]>;
817 /**
818 * # Permissions
819 *
820 * * Collection Owner
821 *
822 * # Arguments
823 *
824 * * collection_id.
825 *
826 * * new_sponsor.
827 **/
828 setCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newSponsor: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
829 /**
830 * Set const on-chain data schema.
831 *
832 * # Permissions
833 *
834 * * Collection Owner
835 * * Collection Admin
836 *
837 * # Arguments
838 *
839 * * collection_id.
840 *
841 * * schema: String representing the const on-chain data schema.
842 **/
843 setConstOnChainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
844 /**
845 * Set meta_update_permission value for particular collection
846 *
847 * # Permissions
848 *
849 * * Collection Owner.
850 *
851 * # Arguments
852 *
853 * * collection_id: ID of the collection.
854 *
855 * * value: New flag value.
856 **/
857 setMetaUpdatePermissionFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: UpDataStructsMetaUpdatePermission | 'ItemOwner' | 'Admin' | 'None' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsMetaUpdatePermission]>;
858 /**
859 * Allows Anyone to create tokens if:
860 * * Allow List is enabled, and
861 * * Address is added to allow list, and
862 * * This method was called with True parameter
863 *
864 * # Permissions
865 * * Collection Owner
866 *
867 * # Arguments
868 *
869 * * collection_id.
870 *
871 * * mint_permission: Boolean parameter. If True, allows minting to Anyone with conditions above.
872 **/
873 setMintPermission: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, mintPermission: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
874 /**
875 * Set off-chain data schema.
876 *
877 * # Permissions
878 *
879 * * Collection Owner
880 * * Collection Admin
881 *
882 * # Arguments
883 *
884 * * collection_id.
885 *
886 * * schema: String representing the offchain data schema.
887 **/
888 setOffchainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
889 /**
890 * Toggle between normal and allow list access for the methods with access for `Anyone`.
891 *
892 * # Permissions
893 *
894 * * Collection Owner.
895 *
896 * # Arguments
897 *
898 * * collection_id.
899 *
900 * * mode: [AccessMode]
901 **/
902 setPublicAccessMode: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, mode: UpDataStructsAccessMode | 'Normal' | 'AllowList' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsAccessMode]>;
903 /**
904 * Set schema standard
905 * ImageURL
906 * Unique
907 *
908 * # Permissions
909 *
910 * * Collection Owner
911 * * Collection Admin
912 *
913 * # Arguments
914 *
915 * * collection_id.
916 *
917 * * schema: SchemaVersion: enum
918 **/
919 setSchemaVersion: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, version: UpDataStructsSchemaVersion | 'ImageURL' | 'Unique' | number | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsSchemaVersion]>;
920 /**
921 * Set transfers_enabled value for particular collection
922 *
923 * # Permissions
924 *
925 * * Collection Owner.
926 *
927 * # Arguments
928 *
929 * * collection_id: ID of the collection.
930 *
931 * * value: New flag value.
932 **/
933 setTransfersEnabledFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
934 /**
935 * Set off-chain data schema.
936 *
937 * # Permissions
938 *
939 * * Collection Owner
940 * * Collection Admin
941 *
942 * # Arguments
943 *
944 * * collection_id.
945 *
946 * * schema: String representing the offchain data schema.
947 **/
948 setVariableMetaData: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, data: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, Bytes]>;
949 /**
950 * Set variable on-chain data schema.
951 *
952 * # Permissions
953 *
954 * * Collection Owner
955 * * Collection Admin
956 *
957 * # Arguments
958 *
959 * * collection_id.
960 *
961 * * schema: String representing the variable on-chain data schema.
962 **/
963 setVariableOnChainSchema: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, schema: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, Bytes]>;
964 /**
965 * Change ownership of the token.
966 *
967 * # Permissions
968 *
969 * * Collection Owner
970 * * Collection Admin
971 * * Current NFT owner
972 *
973 * # Arguments
974 *
975 * * recipient: Address of token recipient.
976 *
977 * * collection_id.
978 *
979 * * item_id: ID of the item
980 * * Non-Fungible Mode: Required.
981 * * Fungible Mode: Ignored.
982 * * Re-Fungible Mode: Required.
983 *
984 * * value: Amount to transfer.
985 * * Non-Fungible Mode: Ignored
986 * * Fungible Mode: Must specify transferred amount
987 * * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
988 **/
989 transfer: AugmentedSubmittable<(recipient: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
990 /**
991 * Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
992 *
993 * # Permissions
994 * * Collection Owner
995 * * Collection Admin
996 * * Current NFT owner
997 * * Address approved by current NFT owner
998 *
999 * # Arguments
1000 *
1001 * * from: Address that owns token.
1002 *
1003 * * recipient: Address of token recipient.
1004 *
1005 * * collection_id.
1006 *
1007 * * item_id: ID of the item.
1008 *
1009 * * value: Amount to transfer.
1010 **/
1011 transferFrom: AugmentedSubmittable<(from: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, recipient: PalletCommonAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletCommonAccountBasicCrossAccountIdRepr, PalletCommonAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
1012 /**
1013 * Generic tx
1014 **/
1015 [key: string]: SubmittableExtrinsicFunction<ApiType>;
1016 };
1097 vesting: {1017 vesting: {
1098 /**1018 claim: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
1099 * Force a vested transfer.
1100 *
1101 * The dispatch origin for this call must be _Root_.
1102 *
1103 * - `source`: The account whose funds should be transferred.
1104 * - `target`: The account that should be transferred the vested funds.
1105 * - `schedule`: The vesting schedule attached to the transfer.
1106 *
1107 * Emits `VestingCreated`.
1108 *
1109 * NOTE: This will unlock all schedules through the current block.
1110 *
1111 * # <weight>
1112 * - `O(1)`.
1113 * - DbWeight: 4 Reads, 4 Writes
1114 * - Reads: Vesting Storage, Balances Locks, Target Account, Source Account
1115 * - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
1116 * # </weight>
1117 **/
1118 forceVestedTransfer: AugmentedSubmittable<(source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: PalletVestingVestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, MultiAddress, PalletVestingVestingInfo]>;1019 claimFor: AugmentedSubmittable<(dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;
1119 /**
1120 * Merge two vesting schedules together, creating a new vesting schedule that unlocks over
1121 * the highest possible start and end blocks. If both schedules have already started the
1122 * current block will be used as the schedule start; with the caveat that if one schedule
1123 * is finished by the current block, the other will be treated as the new merged schedule,
1124 * unmodified.
1125 *
1126 * NOTE: If `schedule1_index == schedule2_index` this is a no-op.
1127 * NOTE: This will unlock all schedules through the current block prior to merging.
1128 * NOTE: If both schedules have ended by the current block, no new schedule will be created
1129 * and both will be removed.
1130 *
1131 * Merged schedule attributes:
1132 * - `starting_block`: `MAX(schedule1.starting_block, scheduled2.starting_block,
1133 * current_block)`.
1134 * - `ending_block`: `MAX(schedule1.ending_block, schedule2.ending_block)`.
1135 * - `locked`: `schedule1.locked_at(current_block) + schedule2.locked_at(current_block)`.
1136 *
1137 * The dispatch origin for this call must be _Signed_.
1138 *
1139 * - `schedule1_index`: index of the first schedule to merge.
1140 * - `schedule2_index`: index of the second schedule to merge.
1141 **/
1142 mergeSchedules: AugmentedSubmittable<(schedule1Index: u32 | AnyNumber | Uint8Array, schedule2Index: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32]>;
1143 /**
1144 * Unlock any vested funds of the sender account.
1145 *
1146 * The dispatch origin for this call must be _Signed_ and the sender must have funds still
1147 * locked under this pallet.
1148 *
1149 * Emits either `VestingCompleted` or `VestingUpdated`.
1150 *
1151 * # <weight>
1152 * - `O(1)`.
1153 * - DbWeight: 2 Reads, 2 Writes
1154 * - Reads: Vesting Storage, Balances Locks, [Sender Account]
1155 * - Writes: Vesting Storage, Balances Locks, [Sender Account]
1156 * # </weight>
1157 **/
1158 vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
1159 /**
1160 * Create a vested transfer.
1161 *
1162 * The dispatch origin for this call must be _Signed_.
1163 *
1164 * - `target`: The account receiving the vested funds.
1165 * - `schedule`: The vesting schedule attached to the transfer.
1166 *
1167 * Emits `VestingCreated`.
1168 *
1169 * NOTE: This will unlock all schedules through the current block.
1170 *
1171 * # <weight>
1172 * - `O(1)`.
1173 * - DbWeight: 3 Reads, 3 Writes
1174 * - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]
1175 * - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
1176 * # </weight>
1177 **/
1178 vestedTransfer: AugmentedSubmittable<(target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: PalletVestingVestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, PalletVestingVestingInfo]>;1020 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>]>;
1179 /**
1180 * Unlock any vested funds of a `target` account.
1181 *
1182 * The dispatch origin for this call must be _Signed_.
1183 *
1184 * - `target`: The account whose vested funds should be unlocked. Must have funds still
1185 * locked under this pallet.
1186 *
1187 * Emits either `VestingCompleted` or `VestingUpdated`.
1188 *
1189 * # <weight>
1190 * - `O(1)`.
1191 * - DbWeight: 3 Reads, 3 Writes
1192 * - Reads: Vesting Storage, Balances Locks, Target Account
1193 * - Writes: Vesting Storage, Balances Locks, Target Account
1194 * # </weight>
1195 **/
1196 vestOther: AugmentedSubmittable<(target: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;1021 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]>;
1197 /**1022 /**
1198 * Generic tx1023 * Generic tx
1199 **/1024 **/
modifiedtests/src/interfaces/augment-types.tsdiffbeforeafterboth
2/* eslint-disable */2/* eslint-disable */
33
4import type { EthereumBlock, EthereumLog, EthereumReceipt, EthereumTransactionLegacyTransaction, EvmCoreErrorExitReason, FpRpcTransactionStatus } from './ethereum';4import type { EthereumBlock, EthereumLog, EthereumReceipt, EthereumTransactionLegacyTransaction, EvmCoreErrorExitReason, FpRpcTransactionStatus } from './ethereum';
5import type { NftDataStructsAccessMode, NftDataStructsCollection, NftDataStructsCollectionId, NftDataStructsCollectionLimits, NftDataStructsCollectionMode, NftDataStructsCollectionStats, NftDataStructsCreateItemData, NftDataStructsMetaUpdatePermission, NftDataStructsSchemaVersion, NftDataStructsSponsorshipState, NftDataStructsTokenId, PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2 } from './nft';
6import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';5import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundStatus, CumulusPalletXcmpQueueOutboundStatus, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1PersistedValidationData } from './polkadot';
6import type { PalletCommonAccountBasicCrossAccountIdRepr, PalletNonfungibleItemData, PalletRefungibleItemData, PalletUnqSchedulerCallSpec, PalletUnqSchedulerReleases, PalletUnqSchedulerScheduledV2, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionId, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateItemData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion, UpDataStructsSponsorshipState, UpDataStructsTokenId } from './unique';
7import type { BitVec, Bool, Bytes, Data, I128, I16, I256, I32, I64, I8, Json, Null, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';7import type { BitVec, Bool, Bytes, Data, I128, I16, I256, I32, I64, I8, Json, Null, Raw, StorageKey, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types';
8import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';8import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
9import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';9import type { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
622 NextAuthority: NextAuthority;622 NextAuthority: NextAuthority;
623 NextConfigDescriptor: NextConfigDescriptor;623 NextConfigDescriptor: NextConfigDescriptor;
624 NextConfigDescriptorV1: NextConfigDescriptorV1;624 NextConfigDescriptorV1: NextConfigDescriptorV1;
625 NftDataStructsAccessMode: NftDataStructsAccessMode;
626 NftDataStructsCollection: NftDataStructsCollection;
627 NftDataStructsCollectionId: NftDataStructsCollectionId;
628 NftDataStructsCollectionLimits: NftDataStructsCollectionLimits;
629 NftDataStructsCollectionMode: NftDataStructsCollectionMode;
630 NftDataStructsCollectionStats: NftDataStructsCollectionStats;
631 NftDataStructsCreateItemData: NftDataStructsCreateItemData;
632 NftDataStructsMetaUpdatePermission: NftDataStructsMetaUpdatePermission;
633 NftDataStructsSchemaVersion: NftDataStructsSchemaVersion;
634 NftDataStructsSponsorshipState: NftDataStructsSponsorshipState;
635 NftDataStructsTokenId: NftDataStructsTokenId;
636 NodeRole: NodeRole;625 NodeRole: NodeRole;
637 Nominations: Nominations;626 Nominations: Nominations;
638 NominatorIndex: NominatorIndex;627 NominatorIndex: NominatorIndex;
1026 UnlockChunk: UnlockChunk;1015 UnlockChunk: UnlockChunk;
1027 UnrewardedRelayer: UnrewardedRelayer;1016 UnrewardedRelayer: UnrewardedRelayer;
1028 UnrewardedRelayersState: UnrewardedRelayersState;1017 UnrewardedRelayersState: UnrewardedRelayersState;
1018 UpDataStructsAccessMode: UpDataStructsAccessMode;
1019 UpDataStructsCollection: UpDataStructsCollection;
1020 UpDataStructsCollectionId: UpDataStructsCollectionId;
1021 UpDataStructsCollectionLimits: UpDataStructsCollectionLimits;
1022 UpDataStructsCollectionMode: UpDataStructsCollectionMode;
1023 UpDataStructsCollectionStats: UpDataStructsCollectionStats;
1024 UpDataStructsCreateItemData: UpDataStructsCreateItemData;
1025 UpDataStructsMetaUpdatePermission: UpDataStructsMetaUpdatePermission;
1026 UpDataStructsSchemaVersion: UpDataStructsSchemaVersion;
1027 UpDataStructsSponsorshipState: UpDataStructsSponsorshipState;
1028 UpDataStructsTokenId: UpDataStructsTokenId;
1029 UpgradeGoAhead: UpgradeGoAhead;1029 UpgradeGoAhead: UpgradeGoAhead;
1030 UpgradeRestriction: UpgradeRestriction;1030 UpgradeRestriction: UpgradeRestriction;
1031 UpwardMessage: UpwardMessage;1031 UpwardMessage: UpwardMessage;
modifiedtests/src/interfaces/definitions.tsdiffbeforeafterboth
1export {default as nft} from './nft/definitions';1export {default as unique} from './unique/definitions';
2export {default as ethereum} from './ethereum/definitions';2export {default as ethereum} from './ethereum/definitions';
3export {default as polkadot} from './polkadot/definitions';3export {default as polkadot} from './polkadot/definitions';
44
deletedtests/src/interfaces/nft/definitions.tsdiffbeforeafterboth

no changes

deletedtests/src/interfaces/nft/index.tsdiffbeforeafterboth

no changes

deletedtests/src/interfaces/nft/types.tsdiffbeforeafterboth

no changes

modifiedtests/src/interfaces/types.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
2/* eslint-disable */2/* eslint-disable */
33
4export * from './nft/types';4export * from './unique/types';
5export * from './ethereum/types';5export * from './ethereum/types';
6export * from './polkadot/types';6export * from './polkadot/types';
77
addedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth

no changes

addedtests/src/interfaces/unique/index.tsdiffbeforeafterboth

no changes

addedtests/src/interfaces/unique/types.tsdiffbeforeafterboth

no changes

modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
35 'cumulusxcm',35 'cumulusxcm',
36 'dmpqueue',36 'dmpqueue',
37 'inflation',37 'inflation',
38 'nft',38 'unique',
39 'nonfungible',39 'nonfungible',
40 'refungible',40 'refungible',
41 'scheduler',41 //'scheduler',
42 'charging',42 'charging',
43];43];
4444
modifiedtests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth
22 const collection = await queryCollectionExpectSuccess(api, collectionId);22 const collection = await queryCollectionExpectSuccess(api, collectionId);
23 expect(collection.owner.toString()).to.be.deep.eq(alice.address);23 expect(collection.owner.toString()).to.be.deep.eq(alice.address);
24 // first - add collection admin Bob24 // first - add collection admin Bob
25 const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));25 const addAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
26 await submitTransactionAsync(alice, addAdminTx);26 await submitTransactionAsync(alice, addAdminTx);
2727
28 const adminListAfterAddAdmin = await getAdminList(api, collectionId);28 const adminListAfterAddAdmin = await getAdminList(api, collectionId);
29 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));29 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
3030
31 // then remove bob from admins of collection31 // then remove bob from admins of collection
32 const removeAdminTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));32 const removeAdminTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
33 await submitTransactionAsync(alice, removeAdminTx);33 await submitTransactionAsync(alice, removeAdminTx);
3434
35 const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);35 const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);
46 const collection = await queryCollectionExpectSuccess(api, collectionId);46 const collection = await queryCollectionExpectSuccess(api, collectionId);
47 expect(collection.owner.toString()).to.be.eq(alice.address);47 expect(collection.owner.toString()).to.be.eq(alice.address);
48 // first - add collection admin Bob48 // first - add collection admin Bob
49 const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));49 const addAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
50 await submitTransactionAsync(alice, addAdminTx);50 await submitTransactionAsync(alice, addAdminTx);
5151
52 const addAdminTx2 = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));52 const addAdminTx2 = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));
53 await submitTransactionAsync(alice, addAdminTx2);53 await submitTransactionAsync(alice, addAdminTx2);
5454
55 const adminListAfterAddAdmin = await getAdminList(api, collectionId);55 const adminListAfterAddAdmin = await getAdminList(api, collectionId);
56 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));56 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
5757
58 // then remove bob from admins of collection58 // then remove bob from admins of collection
59 const removeAdminTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));59 const removeAdminTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
60 await submitTransactionAsync(charlie, removeAdminTx);60 await submitTransactionAsync(charlie, removeAdminTx);
6161
62 const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);62 const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);
72 const adminListBeforeAddAdmin = await getAdminList(api, collectionId);72 const adminListBeforeAddAdmin = await getAdminList(api, collectionId);
73 expect(adminListBeforeAddAdmin).to.have.lengthOf(0);73 expect(adminListBeforeAddAdmin).to.have.lengthOf(0);
7474
75 const tx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(alice.address));75 const tx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(alice.address));
76 await submitTransactionAsync(alice, tx);76 await submitTransactionAsync(alice, tx);
77 });77 });
78 });78 });
86 const alice = privateKey('//Alice');86 const alice = privateKey('//Alice');
87 const bob = privateKey('//Bob');87 const bob = privateKey('//Bob');
8888
89 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));89 const changeOwnerTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
90 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;90 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;
9191
92 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)92 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
103103
104 await destroyCollectionExpectSuccess(collectionId);104 await destroyCollectionExpectSuccess(collectionId);
105105
106 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));106 const changeOwnerTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
107 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;107 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;
108108
109 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)109 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
118 const bob = privateKey('//Bob');118 const bob = privateKey('//Bob');
119 const charlie = privateKey('//Charlie');119 const charlie = privateKey('//Charlie');
120120
121 const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));121 const addAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
122 await submitTransactionAsync(alice, addAdminTx);122 await submitTransactionAsync(alice, addAdminTx);
123123
124 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));124 const changeOwnerTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
125 await expect(submitTransactionExpectFailAsync(charlie, changeOwnerTx)).to.be.rejected;125 await expect(submitTransactionExpectFailAsync(charlie, changeOwnerTx)).to.be.rejected;
126126
127 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)127 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)
modifiedtests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth
5454
55 // Transfer this tokens from unused address to Alice - should fail55 // Transfer this tokens from unused address to Alice - should fail
56 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();56 const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
57 const zeroToAlice = api.tx.nft.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);57 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);
58 const badTransaction = async function () {58 const badTransaction = async function () {
59 await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);59 await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
60 };60 };
modifiedtests/src/scheduler.test.tsdiffbeforeafterboth
1717
18chai.use(chaiAsPromised);18chai.use(chaiAsPromised);
1919
20describe('Integration Test scheduler base transaction', () => {20describe.skip('Integration Test scheduler base transaction', () => {
21 it('User can transfer owned token with delay (scheduler)', async () => {21 it('User can transfer owned token with delay (scheduler)', async () => {
22 await usingApi(async () => {22 await usingApi(async () => {
23 const alice = privateKey('//Alice');23 const alice = privateKey('//Alice');
modifiedtests/src/setCollectionLimits.test.tsdiffbeforeafterboth
41 });41 });
42 it('execute setCollectionLimits with predefined params ', async () => {42 it('execute setCollectionLimits with predefined params ', async () => {
43 await usingApi(async (api: ApiPromise) => {43 await usingApi(async (api: ApiPromise) => {
44 tx = api.tx.nft.setCollectionLimits(44 tx = api.tx.unique.setCollectionLimits(
45 collectionIdForTesting,45 collectionIdForTesting,
46 {46 {
47 accountTokenOwnershipLimit: accountTokenOwnershipLimit,47 accountTokenOwnershipLimit: accountTokenOwnershipLimit,
82 };82 };
8383
84 // The first time84 // The first time
85 const tx1 = api.tx.nft.setCollectionLimits(85 const tx1 = api.tx.unique.setCollectionLimits(
86 collectionIdForTesting,86 collectionIdForTesting,
87 collectionLimits,87 collectionLimits,
88 );88 );
93 expect(collectionInfo1.limits.tokenLimit.unwrap().toNumber()).to.be.equal(tokenLimit);93 expect(collectionInfo1.limits.tokenLimit.unwrap().toNumber()).to.be.equal(tokenLimit);
9494
95 // The second time95 // The second time
96 const tx2 = api.tx.nft.setCollectionLimits(96 const tx2 = api.tx.unique.setCollectionLimits(
97 collectionIdForTesting,97 collectionIdForTesting,
98 collectionLimits,98 collectionLimits,
99 );99 );
121 await usingApi(async (api: ApiPromise) => {121 await usingApi(async (api: ApiPromise) => {
122 const collectionCount = await getCreatedCollectionCount(api);122 const collectionCount = await getCreatedCollectionCount(api);
123 const nonExistedCollectionId = collectionCount + 1;123 const nonExistedCollectionId = collectionCount + 1;
124 tx = api.tx.nft.setCollectionLimits(124 tx = api.tx.unique.setCollectionLimits(
125 nonExistedCollectionId,125 nonExistedCollectionId,
126 {126 {
127 accountTokenOwnershipLimit,127 accountTokenOwnershipLimit,
135 });135 });
136 it('execute setCollectionLimits from user who is not owner of this collection', async () => {136 it('execute setCollectionLimits from user who is not owner of this collection', async () => {
137 await usingApi(async (api: ApiPromise) => {137 await usingApi(async (api: ApiPromise) => {
138 tx = api.tx.nft.setCollectionLimits(138 tx = api.tx.unique.setCollectionLimits(
139 collectionIdForTesting,139 collectionIdForTesting,
140 {140 {
141 accountTokenOwnershipLimit,141 accountTokenOwnershipLimit,
150 it('execute setCollectionLimits from admin collection', async () => {150 it('execute setCollectionLimits from admin collection', async () => {
151 await addCollectionAdminExpectSuccess(alice, collectionIdForTesting, bob.address);151 await addCollectionAdminExpectSuccess(alice, collectionIdForTesting, bob.address);
152 await usingApi(async (api: ApiPromise) => {152 await usingApi(async (api: ApiPromise) => {
153 tx = api.tx.nft.setCollectionLimits(153 tx = api.tx.unique.setCollectionLimits(
154 collectionIdForTesting,154 collectionIdForTesting,
155 {155 {
156 accountTokenOwnershipLimit,156 accountTokenOwnershipLimit,
modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
41 const collectionId = await createCollectionExpectSuccess();41 const collectionId = await createCollectionExpectSuccess();
42 const collection = await queryCollectionExpectSuccess(api, collectionId);42 const collection = await queryCollectionExpectSuccess(api, collectionId);
43 expect(collection.owner.toString()).to.be.eq(alice.address);43 expect(collection.owner.toString()).to.be.eq(alice.address);
44 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);44 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
45 await submitTransactionAsync(alice, setShema);45 await submitTransactionAsync(alice, setShema);
46 });46 });
47 });47 });
52 const collection = await queryCollectionExpectSuccess(api, collectionId);52 const collection = await queryCollectionExpectSuccess(api, collectionId);
53 expect(collection.owner.toString()).to.be.eq(alice.address);53 expect(collection.owner.toString()).to.be.eq(alice.address);
54 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);54 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
55 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);55 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
56 await submitTransactionAsync(bob, setShema);56 await submitTransactionAsync(bob, setShema);
57 });57 });
58 });58 });
5959
60 it('Checking collection data using the ConstOnChainSchema parameter', async () => {60 it('Checking collection data using the ConstOnChainSchema parameter', async () => {
61 await usingApi(async (api) => {61 await usingApi(async (api) => {
62 const collectionId = await createCollectionExpectSuccess();62 const collectionId = await createCollectionExpectSuccess();
63 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);63 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
64 await submitTransactionAsync(alice, setShema);64 await submitTransactionAsync(alice, setShema);
65 const collection = await queryCollectionExpectSuccess(api, collectionId);65 const collection = await queryCollectionExpectSuccess(api, collectionId);
66 expect(collection.constOnChainSchema.toString()).to.be.eq(shema);66 expect(collection.constOnChainSchema.toString()).to.be.eq(shema);
74 await usingApi(async (api) => {74 await usingApi(async (api) => {
75 // tslint:disable-next-line: radix75 // tslint:disable-next-line: radix
76 const collectionId = await getCreatedCollectionCount(api) + 1;76 const collectionId = await getCreatedCollectionCount(api) + 1;
77 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);77 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
78 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;78 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;
79 });79 });
80 });80 });
83 await usingApi(async (api) => {83 await usingApi(async (api) => {
84 const collectionId = await createCollectionExpectSuccess();84 const collectionId = await createCollectionExpectSuccess();
85 await destroyCollectionExpectSuccess(collectionId);85 await destroyCollectionExpectSuccess(collectionId);
86 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);86 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
87 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;87 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;
88 });88 });
89 });89 });
9090
91 it('Set invalid data in schema (size too large:> 1024b)', async () => {91 it('Set invalid data in schema (size too large:> 1024b)', async () => {
92 await usingApi(async (api) => {92 await usingApi(async (api) => {
93 const collectionId = await createCollectionExpectSuccess();93 const collectionId = await createCollectionExpectSuccess();
94 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, largeShema);94 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, largeShema);
95 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;95 await expect(submitTransactionExpectFailAsync(alice, setShema)).to.be.rejected;
96 });96 });
97 });97 });
101 const collectionId = await createCollectionExpectSuccess();101 const collectionId = await createCollectionExpectSuccess();
102 const collection = await queryCollectionExpectSuccess(api, collectionId);102 const collection = await queryCollectionExpectSuccess(api, collectionId);
103 expect(collection.owner.toString()).to.be.eq(alice.address);103 expect(collection.owner.toString()).to.be.eq(alice.address);
104 const setShema = api.tx.nft.setConstOnChainSchema(collectionId, shema);104 const setShema = api.tx.unique.setConstOnChainSchema(collectionId, shema);
105 await expect(submitTransactionExpectFailAsync(bob, setShema)).to.be.rejected;105 await expect(submitTransactionExpectFailAsync(bob, setShema)).to.be.rejected;
106 });106 });
107 });107 });
modifiedtests/src/setPublicAccessMode.test.tsdiffbeforeafterboth
51 const collectionId = await createCollectionExpectSuccess();51 const collectionId = await createCollectionExpectSuccess();
52 await enableAllowListExpectSuccess(alice, collectionId);52 await enableAllowListExpectSuccess(alice, collectionId);
53 await enablePublicMintingExpectSuccess(alice, collectionId);53 await enablePublicMintingExpectSuccess(alice, collectionId);
54 const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(bob.address), 'NFT');54 const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(bob.address), 'NFT');
55 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;55 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;
56 });56 });
57 });57 });
62 await usingApi(async (api: ApiPromise) => {62 await usingApi(async (api: ApiPromise) => {
63 // tslint:disable-next-line: radix63 // tslint:disable-next-line: radix
64 const collectionId = await getCreatedCollectionCount(api) + 1;64 const collectionId = await getCreatedCollectionCount(api) + 1;
65 const tx = api.tx.nft.setPublicAccessMode(collectionId, 'AllowList');65 const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');
66 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;66 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
67 });67 });
68 });68 });
72 // tslint:disable-next-line: no-bitwise72 // tslint:disable-next-line: no-bitwise
73 const collectionId = await createCollectionExpectSuccess();73 const collectionId = await createCollectionExpectSuccess();
74 await destroyCollectionExpectSuccess(collectionId);74 await destroyCollectionExpectSuccess(collectionId);
75 const tx = api.tx.nft.setPublicAccessMode(collectionId, 'AllowList');75 const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');
76 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;76 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
77 });77 });
78 });78 });
89 await usingApi(async (api: ApiPromise) => {89 await usingApi(async (api: ApiPromise) => {
90 // tslint:disable-next-line: no-bitwise90 // tslint:disable-next-line: no-bitwise
91 const collectionId = await createCollectionExpectSuccess();91 const collectionId = await createCollectionExpectSuccess();
92 const tx = api.tx.nft.setPublicAccessMode(collectionId, 'AllowList');92 const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');
93 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;93 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;
94 });94 });
95 });95 });
107 // tslint:disable-next-line: no-bitwise107 // tslint:disable-next-line: no-bitwise
108 const collectionId = await createCollectionExpectSuccess();108 const collectionId = await createCollectionExpectSuccess();
109 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);109 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
110 const tx = api.tx.nft.setPublicAccessMode(collectionId, 'AllowList');110 const tx = api.tx.unique.setPublicAccessMode(collectionId, 'AllowList');
111 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;111 await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;
112 });112 });
113 });113 });
modifiedtests/src/setSchemaVersion.test.tsdiffbeforeafterboth
41 it('execute setSchemaVersion with image url and unique ', async () => {41 it('execute setSchemaVersion with image url and unique ', async () => {
42 await usingApi(async (api: ApiPromise) => {42 await usingApi(async (api: ApiPromise) => {
43 const collectionIdForTesting = await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'NFT'}});43 const collectionIdForTesting = await createCollectionExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'NFT'}});
44 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'Unique');44 tx = api.tx.unique.setSchemaVersion(collectionIdForTesting, 'Unique');
45 const events = await submitTransactionAsync(alice, tx);45 const events = await submitTransactionAsync(alice, tx);
46 const result = getCreateItemResult(events);46 const result = getCreateItemResult(events);
47 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);47 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);
70 });70 });
71 it('execute setSchemaVersion with image url and unique ', async () => {71 it('execute setSchemaVersion with image url and unique ', async () => {
72 await usingApi(async (api: ApiPromise) => {72 await usingApi(async (api: ApiPromise) => {
73 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'Unique');73 tx = api.tx.unique.setSchemaVersion(collectionIdForTesting, 'Unique');
74 const events = await submitTransactionAsync(bob, tx);74 const events = await submitTransactionAsync(bob, tx);
75 const result = getCreateItemResult(events);75 const result = getCreateItemResult(events);
76 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);76 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);
8585
86 it('validate schema version with just entered data', async () => {86 it('validate schema version with just entered data', async () => {
87 await usingApi(async (api: ApiPromise) => {87 await usingApi(async (api: ApiPromise) => {
88 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');88 tx = api.tx.unique.setSchemaVersion(collectionIdForTesting, 'ImageURL');
89 const events = await submitTransactionAsync(bob, tx);89 const events = await submitTransactionAsync(bob, tx);
90 const result = getCreateItemResult(events);90 const result = getCreateItemResult(events);
91 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);91 const collectionInfo = await getDetailedCollectionInfo(api, collectionIdForTesting);
114 await usingApi(async (api: ApiPromise) => {114 await usingApi(async (api: ApiPromise) => {
115 const collectionCount = await getCreatedCollectionCount(api);115 const collectionCount = await getCreatedCollectionCount(api);
116 const nonExistedCollectionId = collectionCount + 1;116 const nonExistedCollectionId = collectionCount + 1;
117 tx = api.tx.nft.setSchemaVersion(nonExistedCollectionId, 'ImageURL');117 tx = api.tx.unique.setSchemaVersion(nonExistedCollectionId, 'ImageURL');
118 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;118 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
119 });119 });
120 });120 });
121 it('execute setSchemaVersion for deleted collection', async () => {121 it('execute setSchemaVersion for deleted collection', async () => {
122 await usingApi(async (api: ApiPromise) => {122 await usingApi(async (api: ApiPromise) => {
123 await destroyCollectionExpectSuccess(collectionIdForTesting);123 await destroyCollectionExpectSuccess(collectionIdForTesting);
124 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');124 tx = api.tx.unique.setSchemaVersion(collectionIdForTesting, 'ImageURL');
125 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;125 await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
126 });126 });
127 });127 });
128 it('Regular user can`t execute setSchemaVersion with image url and unique ', async () => {128 it('Regular user can`t execute setSchemaVersion with image url and unique ', async () => {
129 await usingApi(async (api: ApiPromise) => {129 await usingApi(async (api: ApiPromise) => {
130 tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'Unique');130 tx = api.tx.unique.setSchemaVersion(collectionIdForTesting, 'Unique');
131 await expect(submitTransactionAsync(charlie, tx)).to.be.rejected;131 await expect(submitTransactionAsync(charlie, tx)).to.be.rejected;
132 });132 });
133 });133 });
modifiedtests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth
41 const collectionId = await createCollectionExpectSuccess();41 const collectionId = await createCollectionExpectSuccess();
42 const collection = await queryCollectionExpectSuccess(api, collectionId);42 const collection = await queryCollectionExpectSuccess(api, collectionId);
43 expect(collection.owner.toString()).to.be.eq(alice.address);43 expect(collection.owner.toString()).to.be.eq(alice.address);
44 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);44 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
45 await submitTransactionAsync(alice, setSchema);45 await submitTransactionAsync(alice, setSchema);
46 });46 });
47 });47 });
4848
49 it('Checking collection data using the setVariableOnChainSchema parameter', async () => {49 it('Checking collection data using the setVariableOnChainSchema parameter', async () => {
50 await usingApi(async (api) => {50 await usingApi(async (api) => {
51 const collectionId = await createCollectionExpectSuccess();51 const collectionId = await createCollectionExpectSuccess();
52 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);52 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
53 await submitTransactionAsync(alice, setSchema);53 await submitTransactionAsync(alice, setSchema);
54 const collection = await queryCollectionExpectSuccess(api, collectionId);54 const collection = await queryCollectionExpectSuccess(api, collectionId);
55 expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);55 expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);
66 const collection = await queryCollectionExpectSuccess(api, collectionId);66 const collection = await queryCollectionExpectSuccess(api, collectionId);
67 expect(collection.owner.toString()).to.be.eq(alice.address);67 expect(collection.owner.toString()).to.be.eq(alice.address);
68 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);68 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
69 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);69 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
70 await submitTransactionAsync(bob, setSchema);70 await submitTransactionAsync(bob, setSchema);
71 });71 });
72 });72 });
75 await usingApi(async (api) => {75 await usingApi(async (api) => {
76 const collectionId = await createCollectionExpectSuccess();76 const collectionId = await createCollectionExpectSuccess();
77 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);77 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
78 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);78 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
79 await submitTransactionAsync(bob, setSchema);79 await submitTransactionAsync(bob, setSchema);
80 const collection = await queryCollectionExpectSuccess(api, collectionId);80 const collection = await queryCollectionExpectSuccess(api, collectionId);
81 expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);81 expect(collection.variableOnChainSchema.toString()).to.be.eq(schema);
90 await usingApi(async (api) => {90 await usingApi(async (api) => {
91 // tslint:disable-next-line: radix91 // tslint:disable-next-line: radix
92 const collectionId = await getCreatedCollectionCount(api) + 1;92 const collectionId = await getCreatedCollectionCount(api) + 1;
93 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);93 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
94 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;94 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
95 });95 });
96 });96 });
99 await usingApi(async (api) => {99 await usingApi(async (api) => {
100 const collectionId = await createCollectionExpectSuccess();100 const collectionId = await createCollectionExpectSuccess();
101 await destroyCollectionExpectSuccess(collectionId);101 await destroyCollectionExpectSuccess(collectionId);
102 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);102 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
103 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;103 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
104 });104 });
105 });105 });
106106
107 it('Set invalid data in schema (size too large:> 1024b)', async () => {107 it('Set invalid data in schema (size too large:> 1024b)', async () => {
108 await usingApi(async (api) => {108 await usingApi(async (api) => {
109 const collectionId = await createCollectionExpectSuccess();109 const collectionId = await createCollectionExpectSuccess();
110 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, largeSchema);110 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, largeSchema);
111 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;111 await expect(submitTransactionExpectFailAsync(alice, setSchema)).to.be.rejected;
112 });112 });
113 });113 });
117 const collectionId = await createCollectionExpectSuccess();117 const collectionId = await createCollectionExpectSuccess();
118 const collection = await queryCollectionExpectSuccess(api, collectionId);118 const collection = await queryCollectionExpectSuccess(api, collectionId);
119 expect(collection.owner.toString()).to.be.eq(alice.address);119 expect(collection.owner.toString()).to.be.eq(alice.address);
120 const setSchema = api.tx.nft.setVariableOnChainSchema(collectionId, schema);120 const setSchema = api.tx.unique.setVariableOnChainSchema(collectionId, schema);
121 await expect(submitTransactionExpectFailAsync(bob, setSchema)).to.be.rejected;121 await expect(submitTransactionExpectFailAsync(bob, setSchema)).to.be.rejected;
122 });122 });
123 });123 });
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth
24 },24 },
25 },25 },
26 rpc: {26 rpc: {
27 nft: defs.nft.rpc,27 unique: defs.unique.rpc,
28 },28 },
29 };29 };
30}30}
modifiedtests/src/toggleContractAllowList.test.tsdiffbeforeafterboth
27 await usingApi(async api => {27 await usingApi(async api => {
28 const [contract, deployer] = await deployFlipper(api);28 const [contract, deployer] = await deployFlipper(api);
2929
30 const enabledBefore = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();30 const enabledBefore = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
31 const enableAllowListTx = api.tx.nft.toggleContractAllowList(contract.address, true);31 const enableAllowListTx = api.tx.unique.toggleContractAllowList(contract.address, true);
32 const enableEvents = await submitTransactionAsync(deployer, enableAllowListTx);32 const enableEvents = await submitTransactionAsync(deployer, enableAllowListTx);
33 const enabled = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();33 const enabled = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
3434
35 expect(getGenericResult(enableEvents).success).to.be.true;35 expect(getGenericResult(enableEvents).success).to.be.true;
36 expect(enabledBefore).to.be.false;36 expect(enabledBefore).to.be.false;
60 await deployerCanFlip();60 await deployerCanFlip();
6161
62 flipValueBefore = await getFlipValue(contract, deployer);62 flipValueBefore = await getFlipValue(contract, deployer);
63 const enableAllowListTx = api.tx.nft.toggleContractAllowList(contract.address, true);63 const enableAllowListTx = api.tx.unique.toggleContractAllowList(contract.address, true);
64 await submitTransactionAsync(deployer, enableAllowListTx);64 await submitTransactionAsync(deployer, enableAllowListTx);
65 const flipWithEnabledAllowList = contract.tx.flip(value, gasLimit);65 const flipWithEnabledAllowList = contract.tx.flip(value, gasLimit);
66 await expect(submitTransactionExpectFailAsync(bob, flipWithEnabledAllowList)).to.be.rejected;66 await expect(submitTransactionExpectFailAsync(bob, flipWithEnabledAllowList)).to.be.rejected;
70 await deployerCanFlip();70 await deployerCanFlip();
7171
72 flipValueBefore = await getFlipValue(contract, deployer);72 flipValueBefore = await getFlipValue(contract, deployer);
73 const addBobToAllowListTx = api.tx.nft.addToContractAllowList(contract.address, bob.address);73 const addBobToAllowListTx = api.tx.unique.addToContractAllowList(contract.address, bob.address);
74 await submitTransactionAsync(deployer, addBobToAllowListTx);74 await submitTransactionAsync(deployer, addBobToAllowListTx);
75 const flipWithAllowlistedBob = contract.tx.flip(value, gasLimit);75 const flipWithAllowlistedBob = contract.tx.flip(value, gasLimit);
76 await submitTransactionAsync(bob, flipWithAllowlistedBob);76 await submitTransactionAsync(bob, flipWithAllowlistedBob);
80 await deployerCanFlip();80 await deployerCanFlip();
8181
82 flipValueBefore = await getFlipValue(contract, deployer);82 flipValueBefore = await getFlipValue(contract, deployer);
83 const removeBobFromAllowListTx = api.tx.nft.removeFromContractAllowList(contract.address, bob.address);83 const removeBobFromAllowListTx = api.tx.unique.removeFromContractAllowList(contract.address, bob.address);
84 await submitTransactionAsync(deployer, removeBobFromAllowListTx);84 await submitTransactionAsync(deployer, removeBobFromAllowListTx);
85 const bobRemoved = contract.tx.flip(value, gasLimit);85 const bobRemoved = contract.tx.flip(value, gasLimit);
86 await expect(submitTransactionExpectFailAsync(bob, bobRemoved)).to.be.rejected;86 await expect(submitTransactionExpectFailAsync(bob, bobRemoved)).to.be.rejected;
90 await deployerCanFlip();90 await deployerCanFlip();
9191
92 flipValueBefore = await getFlipValue(contract, deployer);92 flipValueBefore = await getFlipValue(contract, deployer);
93 const disableAllowListTx = api.tx.nft.toggleContractAllowList(contract.address, false);93 const disableAllowListTx = api.tx.unique.toggleContractAllowList(contract.address, false);
94 await submitTransactionAsync(deployer, disableAllowListTx);94 await submitTransactionAsync(deployer, disableAllowListTx);
95 const allowListDisabledFlip = contract.tx.flip(value, gasLimit);95 const allowListDisabledFlip = contract.tx.flip(value, gasLimit);
96 await submitTransactionAsync(bob, allowListDisabledFlip);96 await submitTransactionAsync(bob, allowListDisabledFlip);
104 await usingApi(async api => {104 await usingApi(async api => {
105 const [contract, deployer] = await deployFlipper(api);105 const [contract, deployer] = await deployFlipper(api);
106106
107 const enabledBefore = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();107 const enabledBefore = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
108 const enableAllowListTx = api.tx.nft.toggleContractAllowList(contract.address, true);108 const enableAllowListTx = api.tx.unique.toggleContractAllowList(contract.address, true);
109 const enableEvents = await submitTransactionAsync(deployer, enableAllowListTx);109 const enableEvents = await submitTransactionAsync(deployer, enableAllowListTx);
110 const enabled = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();110 const enabled = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
111 const enableAgainEvents = await submitTransactionAsync(deployer, enableAllowListTx);111 const enableAgainEvents = await submitTransactionAsync(deployer, enableAllowListTx);
112 const enabledAgain = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();112 const enabledAgain = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
113113
114 expect(getGenericResult(enableEvents).success).to.be.true;114 expect(getGenericResult(enableEvents).success).to.be.true;
115 expect(enabledBefore).to.be.false;115 expect(enabledBefore).to.be.false;
128 const alice = privateKey('//Alice');128 const alice = privateKey('//Alice');
129 const bobGuineaPig = privateKey('//Bob');129 const bobGuineaPig = privateKey('//Bob');
130130
131 const enabledBefore = (await api.query.nft.contractAllowListEnabled(bobGuineaPig.address)).toJSON();131 const enabledBefore = (await api.query.unique.contractAllowListEnabled(bobGuineaPig.address)).toJSON();
132 const enableAllowListTx = api.tx.nft.toggleContractAllowList(bobGuineaPig.address, true);132 const enableAllowListTx = api.tx.unique.toggleContractAllowList(bobGuineaPig.address, true);
133 await expect(submitTransactionExpectFailAsync(alice, enableAllowListTx)).to.be.rejected;133 await expect(submitTransactionExpectFailAsync(alice, enableAllowListTx)).to.be.rejected;
134 const enabled = (await api.query.nft.contractAllowListEnabled(bobGuineaPig.address)).toJSON();134 const enabled = (await api.query.unique.contractAllowListEnabled(bobGuineaPig.address)).toJSON();
135135
136 expect(enabledBefore).to.be.false;136 expect(enabledBefore).to.be.false;
137 expect(enabled).to.be.false;137 expect(enabled).to.be.false;
143 const bob = privateKey('//Bob');143 const bob = privateKey('//Bob');
144 const [contract] = await deployFlipper(api);144 const [contract] = await deployFlipper(api);
145145
146 const enabledBefore = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();146 const enabledBefore = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
147 const enableAllowListTx = api.tx.nft.toggleContractAllowList(contract.address, true);147 const enableAllowListTx = api.tx.unique.toggleContractAllowList(contract.address, true);
148 await expect(submitTransactionExpectFailAsync(bob, enableAllowListTx)).to.be.rejected;148 await expect(submitTransactionExpectFailAsync(bob, enableAllowListTx)).to.be.rejected;
149 const enabled = (await api.query.nft.contractAllowListEnabled(contract.address)).toJSON();149 const enabled = (await api.query.unique.contractAllowListEnabled(contract.address)).toJSON();
150150
151 expect(enabledBefore).to.be.false;151 expect(enabledBefore).to.be.false;
152 expect(enabled).to.be.false;152 expect(enabled).to.be.false;
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
249 const nftCollectionId = await createCollectionExpectSuccess();249 const nftCollectionId = await createCollectionExpectSuccess();
250 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');250 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');
251251
252 const transferTx = api.tx.nft.transfer(normalizeAccountId(bob), nftCollectionId, newNftTokenId, 0);252 const transferTx = api.tx.unique.transfer(normalizeAccountId(bob), nftCollectionId, newNftTokenId, 0);
253 await submitTransactionAsync(alice, transferTx);253 await submitTransactionAsync(alice, transferTx);
254 const address = normalizeAccountId(await getTokenOwner(api, nftCollectionId, newNftTokenId));254 const address = normalizeAccountId(await getTokenOwner(api, nftCollectionId, newNftTokenId));
255255
264 const balanceBeforeAlice = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(alice), newReFungibleTokenId);264 const balanceBeforeAlice = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(alice), newReFungibleTokenId);
265 const balanceBeforeBob = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(bob), newReFungibleTokenId);265 const balanceBeforeBob = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(bob), newReFungibleTokenId);
266266
267 const transferTx = api.tx.nft.transfer(normalizeAccountId(bob), reFungibleCollectionId, newReFungibleTokenId, 0);267 const transferTx = api.tx.unique.transfer(normalizeAccountId(bob), reFungibleCollectionId, newReFungibleTokenId, 0);
268 await submitTransactionAsync(alice, transferTx);268 await submitTransactionAsync(alice, transferTx);
269269
270 const balanceAfterAlice = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(alice), newReFungibleTokenId);270 const balanceAfterAlice = await getTokenBalance(api, reFungibleCollectionId, normalizeAccountId(alice), newReFungibleTokenId);
282 const balanceBeforeAlice = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(alice), newFungibleTokenId);282 const balanceBeforeAlice = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(alice), newFungibleTokenId);
283 const balanceBeforeBob = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(bob), newFungibleTokenId);283 const balanceBeforeBob = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(bob), newFungibleTokenId);
284284
285 const transferTx = api.tx.nft.transfer(normalizeAccountId(bob), fungibleCollectionId, newFungibleTokenId, 0);285 const transferTx = api.tx.unique.transfer(normalizeAccountId(bob), fungibleCollectionId, newFungibleTokenId, 0);
286 await submitTransactionAsync(alice, transferTx);286 await submitTransactionAsync(alice, transferTx);
287287
288 const balanceAfterAlice = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(alice), newFungibleTokenId);288 const balanceAfterAlice = await getTokenBalance(api, fungibleCollectionId, normalizeAccountId(alice), newFungibleTokenId);
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
11import chai from 'chai';11import chai from 'chai';
12import chaiAsPromised from 'chai-as-promised';12import chaiAsPromised from 'chai-as-promised';
13import {alicesPublicKey} from '../accounts';13import {alicesPublicKey} from '../accounts';
14import {NftDataStructsCollection} from '../interfaces';14import {UpDataStructsCollection} from '../interfaces';
15import privateKey from '../substrate/privateKey';15import privateKey from '../substrate/privateKey';
16import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from '../substrate/substrate-api';16import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from '../substrate/substrate-api';
17import {hexToStr, strToUTF16, utf16ToStr} from './util';17import {hexToStr, strToUTF16, utf16ToStr} from './util';
105}105}
106106
107interface IGetMessage {107interface IGetMessage {
108 checkMsgNftMethod: string;108 checkMsgUnqMethod: string;
109 checkMsgTrsMethod: string;109 checkMsgTrsMethod: string;
110 checkMsgSysMethod: string;110 checkMsgSysMethod: string;
111}111}
133 variableData: number[];133 variableData: number[];
134}134}
135135
136export function nftEventMessage(events: EventRecord[]): IGetMessage {136export function uniqueEventMessage(events: EventRecord[]): IGetMessage {
137 let checkMsgNftMethod = '';137 let checkMsgUnqMethod = '';
138 let checkMsgTrsMethod = '';138 let checkMsgTrsMethod = '';
139 let checkMsgSysMethod = '';139 let checkMsgSysMethod = '';
140 events.forEach(({event: {method, section}}) => {140 events.forEach(({event: {method, section}}) => {
141 if (section === 'common') {141 if (section === 'common') {
142 checkMsgNftMethod = method;142 checkMsgUnqMethod = method;
143 } else if (section === 'treasury') {143 } else if (section === 'treasury') {
144 checkMsgTrsMethod = method;144 checkMsgTrsMethod = method;
145 } else if (section === 'system') {145 } else if (section === 'system') {
146 checkMsgSysMethod = method;146 checkMsgSysMethod = method;
147 } else { return null; }147 } else { return null; }
148 });148 });
149 const result: IGetMessage = {149 const result: IGetMessage = {
150 checkMsgNftMethod,150 checkMsgUnqMethod,
151 checkMsgTrsMethod,151 checkMsgTrsMethod,
152 checkMsgSysMethod,152 checkMsgSysMethod,
153 };153 };
283 modeprm = {refungible: null};283 modeprm = {refungible: null};
284 }284 }
285285
286 const tx = api.tx.nft.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);286 const tx = api.tx.unique.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);
287 const events = await submitTransactionAsync(alicePrivateKey, tx);287 const events = await submitTransactionAsync(alicePrivateKey, tx);
288 const result = getCreateCollectionResult(events);288 const result = getCreateCollectionResult(events);
289289
329329
330 // Run the CreateCollection transaction330 // Run the CreateCollection transaction
331 const alicePrivateKey = privateKey('//Alice');331 const alicePrivateKey = privateKey('//Alice');
332 const tx = api.tx.nft.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);332 const tx = api.tx.unique.createCollection(strToUTF16(name), strToUTF16(description), strToUTF16(tokenPrefix), modeprm as any);
333 const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;333 const events = await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
334 const result = getCreateCollectionResult(events);334 const result = getCreateCollectionResult(events);
335335
356}356}
357357
358export async function getAllowance(api: ApiPromise, collectionId: number, owner: CrossAccountId | string, approved: CrossAccountId | string, tokenId: number) {358export async function getAllowance(api: ApiPromise, collectionId: number, owner: CrossAccountId | string, approved: CrossAccountId | string, tokenId: number) {
359 return (await api.rpc.nft.allowance(collectionId, normalizeAccountId(owner), normalizeAccountId(approved), tokenId)).toBigInt();359 return (await api.rpc.unique.allowance(collectionId, normalizeAccountId(owner), normalizeAccountId(approved), tokenId)).toBigInt();
360}360}
361361
362export function findUnusedAddresses(api: ApiPromise, amount: number): Promise<IKeyringPair[]> {362export function findUnusedAddresses(api: ApiPromise, amount: number): Promise<IKeyringPair[]> {
383 await usingApi(async (api) => {383 await usingApi(async (api) => {
384 // Run the DestroyCollection transaction384 // Run the DestroyCollection transaction
385 const alicePrivateKey = privateKey(senderSeed);385 const alicePrivateKey = privateKey(senderSeed);
386 const tx = api.tx.nft.destroyCollection(collectionId);386 const tx = api.tx.unique.destroyCollection(collectionId);
387 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;387 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
388 });388 });
389}389}
392 await usingApi(async (api) => {392 await usingApi(async (api) => {
393 // Run the DestroyCollection transaction393 // Run the DestroyCollection transaction
394 const alicePrivateKey = privateKey(senderSeed);394 const alicePrivateKey = privateKey(senderSeed);
395 const tx = api.tx.nft.destroyCollection(collectionId);395 const tx = api.tx.unique.destroyCollection(collectionId);
396 const events = await submitTransactionAsync(alicePrivateKey, tx);396 const events = await submitTransactionAsync(alicePrivateKey, tx);
397 const result = getDestroyResult(events);397 const result = getDestroyResult(events);
398 expect(result).to.be.true;398 expect(result).to.be.true;
404404
405export async function setCollectionLimitsExpectSuccess(sender: IKeyringPair, collectionId: number, limits: any) {405export async function setCollectionLimitsExpectSuccess(sender: IKeyringPair, collectionId: number, limits: any) {
406 await usingApi(async (api) => {406 await usingApi(async (api) => {
407 const tx = api.tx.nft.setCollectionLimits(collectionId, limits);407 const tx = api.tx.unique.setCollectionLimits(collectionId, limits);
408 const events = await submitTransactionAsync(sender, tx);408 const events = await submitTransactionAsync(sender, tx);
409 const result = getGenericResult(events);409 const result = getGenericResult(events);
410410
414414
415export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {415export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {
416 await usingApi(async (api) => {416 await usingApi(async (api) => {
417 const tx = api.tx.nft.setCollectionLimits(collectionId, limits);417 const tx = api.tx.unique.setCollectionLimits(collectionId, limits);
418 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;418 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
419 const result = getGenericResult(events);419 const result = getGenericResult(events);
420420
427427
428 // Run the transaction428 // Run the transaction
429 const senderPrivateKey = privateKey(sender);429 const senderPrivateKey = privateKey(sender);
430 const tx = api.tx.nft.setCollectionSponsor(collectionId, sponsor);430 const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);
431 const events = await submitTransactionAsync(senderPrivateKey, tx);431 const events = await submitTransactionAsync(senderPrivateKey, tx);
432 const result = getGenericResult(events);432 const result = getGenericResult(events);
433433
447447
448 // Run the transaction448 // Run the transaction
449 const alicePrivateKey = privateKey(sender);449 const alicePrivateKey = privateKey(sender);
450 const tx = api.tx.nft.removeCollectionSponsor(collectionId);450 const tx = api.tx.unique.removeCollectionSponsor(collectionId);
451 const events = await submitTransactionAsync(alicePrivateKey, tx);451 const events = await submitTransactionAsync(alicePrivateKey, tx);
452 const result = getGenericResult(events);452 const result = getGenericResult(events);
453453
465465
466 // Run the transaction466 // Run the transaction
467 const alicePrivateKey = privateKey(senderSeed);467 const alicePrivateKey = privateKey(senderSeed);
468 const tx = api.tx.nft.removeCollectionSponsor(collectionId);468 const tx = api.tx.unique.removeCollectionSponsor(collectionId);
469 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;469 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
470 });470 });
471}471}
475475
476 // Run the transaction476 // Run the transaction
477 const alicePrivateKey = privateKey(senderSeed);477 const alicePrivateKey = privateKey(senderSeed);
478 const tx = api.tx.nft.setCollectionSponsor(collectionId, sponsor);478 const tx = api.tx.unique.setCollectionSponsor(collectionId, sponsor);
479 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;479 await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected;
480 });480 });
481}481}
485485
486 // Run the transaction486 // Run the transaction
487 const sender = privateKey(senderSeed);487 const sender = privateKey(senderSeed);
488 const tx = api.tx.nft.confirmSponsorship(collectionId);488 const tx = api.tx.unique.confirmSponsorship(collectionId);
489 const events = await submitTransactionAsync(sender, tx);489 const events = await submitTransactionAsync(sender, tx);
490 const result = getGenericResult(events);490 const result = getGenericResult(events);
491491
506506
507 // Run the transaction507 // Run the transaction
508 const sender = privateKey(senderSeed);508 const sender = privateKey(senderSeed);
509 const tx = api.tx.nft.confirmSponsorship(collectionId);509 const tx = api.tx.unique.confirmSponsorship(collectionId);
510 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;510 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
511 });511 });
512}512}
513513
514export async function setMetadataUpdatePermissionFlagExpectSuccess(sender: IKeyringPair, collectionId: number, flag: string) {514export async function setMetadataUpdatePermissionFlagExpectSuccess(sender: IKeyringPair, collectionId: number, flag: string) {
515515
516 await usingApi(async (api) => {516 await usingApi(async (api) => {
517 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag as any);517 const tx = api.tx.unique.setMetaUpdatePermissionFlag(collectionId, flag as any);
518 const events = await submitTransactionAsync(sender, tx);518 const events = await submitTransactionAsync(sender, tx);
519 const result = getGenericResult(events);519 const result = getGenericResult(events);
520520
525export async function setMetadataUpdatePermissionFlagExpectFailure(sender: IKeyringPair, collectionId: number, flag: string) {525export async function setMetadataUpdatePermissionFlagExpectFailure(sender: IKeyringPair, collectionId: number, flag: string) {
526526
527 await usingApi(async (api) => {527 await usingApi(async (api) => {
528 const tx = api.tx.nft.setMetaUpdatePermissionFlag(collectionId, flag as any);528 const tx = api.tx.unique.setMetaUpdatePermissionFlag(collectionId, flag as any);
529 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;529 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
530 const result = getGenericResult(events);530 const result = getGenericResult(events);
531531
535535
536export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {536export async function enableContractSponsoringExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {
537 await usingApi(async (api) => {537 await usingApi(async (api) => {
538 const tx = api.tx.nft.enableContractSponsoring(contractAddress, enable);538 const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);
539 const events = await submitTransactionAsync(sender, tx);539 const events = await submitTransactionAsync(sender, tx);
540 const result = getGenericResult(events);540 const result = getGenericResult(events);
541541
545545
546export async function enableContractSponsoringExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {546export async function enableContractSponsoringExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, enable: boolean) {
547 await usingApi(async (api) => {547 await usingApi(async (api) => {
548 const tx = api.tx.nft.enableContractSponsoring(contractAddress, enable);548 const tx = api.tx.unique.enableContractSponsoring(contractAddress, enable);
549 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;549 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
550 const result = getGenericResult(events);550 const result = getGenericResult(events);
551551
557557
558 await usingApi(async (api) => {558 await usingApi(async (api) => {
559559
560 const tx = api.tx.nft.setTransfersEnabledFlag (collectionId, enabled);560 const tx = api.tx.unique.setTransfersEnabledFlag (collectionId, enabled);
561 const events = await submitTransactionAsync(sender, tx);561 const events = await submitTransactionAsync(sender, tx);
562 const result = getGenericResult(events);562 const result = getGenericResult(events);
563563
569569
570 await usingApi(async (api) => {570 await usingApi(async (api) => {
571571
572 const tx = api.tx.nft.setTransfersEnabledFlag (collectionId, enabled);572 const tx = api.tx.unique.setTransfersEnabledFlag (collectionId, enabled);
573 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;573 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
574 const result = getGenericResult(events);574 const result = getGenericResult(events);
575575
579579
580export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {580export async function setContractSponsoringRateLimitExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {
581 await usingApi(async (api) => {581 await usingApi(async (api) => {
582 const tx = api.tx.nft.setContractSponsoringRateLimit(contractAddress, rateLimit);582 const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);
583 const events = await submitTransactionAsync(sender, tx);583 const events = await submitTransactionAsync(sender, tx);
584 const result = getGenericResult(events);584 const result = getGenericResult(events);
585585
589589
590export async function setContractSponsoringRateLimitExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {590export async function setContractSponsoringRateLimitExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, rateLimit: number) {
591 await usingApi(async (api) => {591 await usingApi(async (api) => {
592 const tx = api.tx.nft.setContractSponsoringRateLimit(contractAddress, rateLimit);592 const tx = api.tx.unique.setContractSponsoringRateLimit(contractAddress, rateLimit);
593 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;593 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
594 const result = getGenericResult(events);594 const result = getGenericResult(events);
595595
599599
600export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {600export async function toggleContractAllowlistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {
601 await usingApi(async (api) => {601 await usingApi(async (api) => {
602 const tx = api.tx.nft.toggleContractAllowList(contractAddress, value);602 const tx = api.tx.unique.toggleContractAllowList(contractAddress, value);
603 const events = await submitTransactionAsync(sender, tx);603 const events = await submitTransactionAsync(sender, tx);
604 const result = getGenericResult(events);604 const result = getGenericResult(events);
605605
610export async function isAllowlistedInContract(contractAddress: AccountId | string, user: string) {610export async function isAllowlistedInContract(contractAddress: AccountId | string, user: string) {
611 let allowlisted = false;611 let allowlisted = false;
612 await usingApi(async (api) => {612 await usingApi(async (api) => {
613 allowlisted = (await api.query.nft.contractAllowList(contractAddress, user)).toJSON() as boolean;613 allowlisted = (await api.query.unique.contractAllowList(contractAddress, user)).toJSON() as boolean;
614 });614 });
615 return allowlisted;615 return allowlisted;
616}616}
617617
618export async function addToContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {618export async function addToContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {
619 await usingApi(async (api) => {619 await usingApi(async (api) => {
620 const tx = api.tx.nft.addToContractAllowList(contractAddress.toString(), user.toString());620 const tx = api.tx.unique.addToContractAllowList(contractAddress.toString(), user.toString());
621 const events = await submitTransactionAsync(sender, tx);621 const events = await submitTransactionAsync(sender, tx);
622 const result = getGenericResult(events);622 const result = getGenericResult(events);
623623
627627
628export async function removeFromContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {628export async function removeFromContractAllowListExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {
629 await usingApi(async (api) => {629 await usingApi(async (api) => {
630 const tx = api.tx.nft.removeFromContractAllowList(contractAddress.toString(), user.toString());630 const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());
631 const events = await submitTransactionAsync(sender, tx);631 const events = await submitTransactionAsync(sender, tx);
632 const result = getGenericResult(events);632 const result = getGenericResult(events);
633633
637637
638export async function removeFromContractAllowListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {638export async function removeFromContractAllowListExpectFailure(sender: IKeyringPair, contractAddress: AccountId | string, user: AccountId | string) {
639 await usingApi(async (api) => {639 await usingApi(async (api) => {
640 const tx = api.tx.nft.removeFromContractAllowList(contractAddress.toString(), user.toString());640 const tx = api.tx.unique.removeFromContractAllowList(contractAddress.toString(), user.toString());
641 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;641 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
642 const result = getGenericResult(events);642 const result = getGenericResult(events);
643643
647647
648export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {648export async function setVariableMetaDataExpectSuccess(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {
649 await usingApi(async (api) => {649 await usingApi(async (api) => {
650 const tx = api.tx.nft.setVariableMetaData(collectionId, itemId, '0x' + Buffer.from(data).toString('hex'));650 const tx = api.tx.unique.setVariableMetaData(collectionId, itemId, '0x' + Buffer.from(data).toString('hex'));
651 const events = await submitTransactionAsync(sender, tx);651 const events = await submitTransactionAsync(sender, tx);
652 const result = getGenericResult(events);652 const result = getGenericResult(events);
653653
657657
658export async function setVariableMetaDataExpectFailure(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {658export async function setVariableMetaDataExpectFailure(sender: IKeyringPair, collectionId: number, itemId: number, data: number[]) {
659 await usingApi(async (api) => {659 await usingApi(async (api) => {
660 const tx = api.tx.nft.setVariableMetaData(collectionId, itemId, '0x' + Buffer.from(data).toString('hex'));660 const tx = api.tx.unique.setVariableMetaData(collectionId, itemId, '0x' + Buffer.from(data).toString('hex'));
661 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;661 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
662 });662 });
663}663}
664664
665export async function setOffchainSchemaExpectSuccess(sender: IKeyringPair, collectionId: number, data: number[]) {665export async function setOffchainSchemaExpectSuccess(sender: IKeyringPair, collectionId: number, data: number[]) {
666 await usingApi(async (api) => {666 await usingApi(async (api) => {
667 const tx = api.tx.nft.setOffchainSchema(collectionId, '0x' + Buffer.from(data).toString('hex'));667 const tx = api.tx.unique.setOffchainSchema(collectionId, '0x' + Buffer.from(data).toString('hex'));
668 const events = await submitTransactionAsync(sender, tx);668 const events = await submitTransactionAsync(sender, tx);
669 const result = getGenericResult(events);669 const result = getGenericResult(events);
670670
674674
675export async function setOffchainSchemaExpectFailure(sender: IKeyringPair, collectionId: number, data: number[]) {675export async function setOffchainSchemaExpectFailure(sender: IKeyringPair, collectionId: number, data: number[]) {
676 await usingApi(async (api) => {676 await usingApi(async (api) => {
677 const tx = api.tx.nft.setOffchainSchema(collectionId, '0x' + Buffer.from(data).toString('hex'));677 const tx = api.tx.unique.setOffchainSchema(collectionId, '0x' + Buffer.from(data).toString('hex'));
678 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;678 await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
679 });679 });
680}680}
700 // if burning token by admin - use adminButnItemExpectSuccess700 // if burning token by admin - use adminButnItemExpectSuccess
701 expect(balanceBefore >= BigInt(value)).to.be.true;701 expect(balanceBefore >= BigInt(value)).to.be.true;
702702
703 const tx = api.tx.nft.burnItem(collectionId, tokenId, value);703 const tx = api.tx.unique.burnItem(collectionId, tokenId, value);
704 const events = await submitTransactionAsync(sender, tx);704 const events = await submitTransactionAsync(sender, tx);
705 const result = getGenericResult(events);705 const result = getGenericResult(events);
706 expect(result.success).to.be.true;706 expect(result.success).to.be.true;
716 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,716 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,
717) {717) {
718 await usingApi(async (api: ApiPromise) => {718 await usingApi(async (api: ApiPromise) => {
719 const approveNftTx = api.tx.nft.approve(normalizeAccountId(approved), collectionId, tokenId, amount);719 const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);
720 const events = await submitTransactionAsync(owner, approveNftTx);720 const events = await submitTransactionAsync(owner, approveUniqueTx);
721 const result = getGenericResult(events);721 const result = getGenericResult(events);
722 expect(result.success).to.be.true;722 expect(result.success).to.be.true;
723723
730 tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,730 tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,
731) {731) {
732 await usingApi(async (api: ApiPromise) => {732 await usingApi(async (api: ApiPromise) => {
733 const approveNftTx = api.tx.nft.approve(normalizeAccountId(approved), collectionId, tokenId, amount);733 const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);
734 const events = await submitTransactionAsync(admin, approveNftTx);734 const events = await submitTransactionAsync(admin, approveUniqueTx);
735 const result = getGenericResult(events);735 const result = getGenericResult(events);
736 expect(result.success).to.be.true;736 expect(result.success).to.be.true;
737737
755 if (type === 'Fungible') {755 if (type === 'Fungible') {
756 balanceBefore = await getBalance(api, collectionId, to, tokenId);756 balanceBefore = await getBalance(api, collectionId, to, tokenId);
757 }757 }
758 const transferFromTx = api.tx.nft.transferFrom(normalizeAccountId(accountFrom), to, collectionId, tokenId, value);758 const transferFromTx = api.tx.unique.transferFrom(normalizeAccountId(accountFrom), to, collectionId, tokenId, value);
759 const events = await submitTransactionAsync(accountApproved, transferFromTx);759 const events = await submitTransactionAsync(accountApproved, transferFromTx);
760 const result = getCreateItemResult(events);760 const result = getCreateItemResult(events);
761 // tslint:disable-next-line:no-unused-expression761 // tslint:disable-next-line:no-unused-expression
783 value: number | bigint = 1,783 value: number | bigint = 1,
784) {784) {
785 await usingApi(async (api: ApiPromise) => {785 await usingApi(async (api: ApiPromise) => {
786 const transferFromTx = api.tx.nft.transferFrom(normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);786 const transferFromTx = api.tx.unique.transferFrom(normalizeAccountId(accountFrom.address), normalizeAccountId(accountTo.address), collectionId, tokenId, value);
787 const events = await expect(submitTransactionExpectFailAsync(accountApproved, transferFromTx)).to.be.rejected;787 const events = await expect(submitTransactionExpectFailAsync(accountApproved, transferFromTx)).to.be.rejected;
788 const result = getCreateCollectionResult(events);788 const result = getCreateCollectionResult(events);
789 // tslint:disable-next-line:no-unused-expression789 // tslint:disable-next-line:no-unused-expression
803803
804export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | CrossAccountId) {804export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | CrossAccountId) {
805 await usingApi(async (api) => {805 await usingApi(async (api) => {
806 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(address));806 const changeAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(address));
807 const events = await submitTransactionAsync(sender, changeAdminTx);807 const events = await submitTransactionAsync(sender, changeAdminTx);
808 const result = getCreateCollectionResult(events);808 const result = getCreateCollectionResult(events);
809 expect(result.success).to.be.true;809 expect(result.success).to.be.true;
835 const expectedBlockNumber = blockNumber + blockSchedule;835 const expectedBlockNumber = blockNumber + blockSchedule;
836836
837 expect(blockNumber).to.be.greaterThan(0);837 expect(blockNumber).to.be.greaterThan(0);
838 const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);838 const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);
839 const scheduleTx = api.tx.scheduler.schedule(expectedBlockNumber, null, 0, transferTx as any);839 const scheduleTx = api.tx.scheduler.schedule(expectedBlockNumber, null, 0, transferTx as any);
840840
841 await submitTransactionAsync(sender, scheduleTx);841 await submitTransactionAsync(sender, scheduleTx);
871 if (type === 'Fungible') {871 if (type === 'Fungible') {
872 balanceBefore = await getBalance(api, collectionId, to, tokenId);872 balanceBefore = await getBalance(api, collectionId, to, tokenId);
873 }873 }
874 const transferTx = api.tx.nft.transfer(to, collectionId, tokenId, value);874 const transferTx = api.tx.unique.transfer(to, collectionId, tokenId, value);
875 const events = await submitTransactionAsync(sender, transferTx);875 const events = await submitTransactionAsync(sender, transferTx);
876 const result = getTransferResult(events);876 const result = getTransferResult(events);
877 // tslint:disable-next-line:no-unused-expression877 // tslint:disable-next-line:no-unused-expression
903 value: number | bigint = 1,903 value: number | bigint = 1,
904) {904) {
905 await usingApi(async (api: ApiPromise) => {905 await usingApi(async (api: ApiPromise) => {
906 const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);906 const transferTx = api.tx.unique.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);
907 const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;907 const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;
908 const result = getGenericResult(events);908 const result = getGenericResult(events);
909 // if (events && Array.isArray(events)) {909 // if (events && Array.isArray(events)) {
920 tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1,920 tokenId: number, owner: IKeyringPair, approved: IKeyringPair, amount: number | bigint = 1,
921) {921) {
922 await usingApi(async (api: ApiPromise) => {922 await usingApi(async (api: ApiPromise) => {
923 const approveNftTx = api.tx.nft.approve(normalizeAccountId(approved.address), collectionId, tokenId, amount);923 const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved.address), collectionId, tokenId, amount);
924 const events = await expect(submitTransactionExpectFailAsync(owner, approveNftTx)).to.be.rejected;924 const events = await expect(submitTransactionExpectFailAsync(owner, approveUniqueTx)).to.be.rejected;
925 const result = getCreateCollectionResult(events);925 const result = getCreateCollectionResult(events);
926 // tslint:disable-next-line:no-unused-expression926 // tslint:disable-next-line:no-unused-expression
927 expect(result.success).to.be.false;927 expect(result.success).to.be.false;
934 owner: string | CrossAccountId,934 owner: string | CrossAccountId,
935 token: number,935 token: number,
936): Promise<bigint> {936): Promise<bigint> {
937 return (await api.rpc.nft.balance(collectionId, normalizeAccountId(owner), token)).toBigInt();937 return (await api.rpc.unique.balance(collectionId, normalizeAccountId(owner), token)).toBigInt();
938}938}
939export async function getTokenOwner(939export async function getTokenOwner(
940 api: ApiPromise,940 api: ApiPromise,
941 collectionId: number,941 collectionId: number,
942 token: number,942 token: number,
943): Promise<CrossAccountId> {943): Promise<CrossAccountId> {
944 return normalizeAccountId((await api.rpc.nft.tokenOwner(collectionId, token)).toJSON() as any);944 return normalizeAccountId((await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any);
945}945}
946export async function isTokenExists(946export async function isTokenExists(
947 api: ApiPromise,947 api: ApiPromise,
948 collectionId: number,948 collectionId: number,
949 token: number,949 token: number,
950): Promise<boolean> {950): Promise<boolean> {
951 return (await api.rpc.nft.tokenExists(collectionId, token)).toJSON();951 return (await api.rpc.unique.tokenExists(collectionId, token)).toJSON();
952}952}
953export async function getLastTokenId(953export async function getLastTokenId(
954 api: ApiPromise,954 api: ApiPromise,
955 collectionId: number,955 collectionId: number,
956): Promise<number> {956): Promise<number> {
957 return (await api.rpc.nft.lastTokenId(collectionId)).toJSON();957 return (await api.rpc.unique.lastTokenId(collectionId)).toJSON();
958}958}
959export async function getAdminList(959export async function getAdminList(
960 api: ApiPromise,960 api: ApiPromise,
961 collectionId: number,961 collectionId: number,
962): Promise<string[]> {962): Promise<string[]> {
963 return (await api.rpc.nft.adminlist(collectionId)).toHuman() as any;963 return (await api.rpc.unique.adminlist(collectionId)).toHuman() as any;
964}964}
965export async function getVariableMetadata(965export async function getVariableMetadata(
966 api: ApiPromise,966 api: ApiPromise,
967 collectionId: number,967 collectionId: number,
968 tokenId: number,968 tokenId: number,
969): Promise<number[]> {969): Promise<number[]> {
970 return [...(await api.rpc.nft.variableMetadata(collectionId, tokenId))];970 return [...(await api.rpc.unique.variableMetadata(collectionId, tokenId))];
971}971}
972export async function getConstMetadata(972export async function getConstMetadata(
973 api: ApiPromise,973 api: ApiPromise,
974 collectionId: number,974 collectionId: number,
975 tokenId: number,975 tokenId: number,
976): Promise<number[]> {976): Promise<number[]> {
977 return [...(await api.rpc.nft.constMetadata(collectionId, tokenId))];977 return [...(await api.rpc.unique.constMetadata(collectionId, tokenId))];
978}978}
979979
980export async function createFungibleItemExpectSuccess(980export async function createFungibleItemExpectSuccess(
984 owner: CrossAccountId | string = sender.address,984 owner: CrossAccountId | string = sender.address,
985) {985) {
986 return await usingApi(async (api) => {986 return await usingApi(async (api) => {
987 const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(owner), {Fungible: data});987 const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), {Fungible: data});
988988
989 const events = await submitTransactionAsync(sender, tx);989 const events = await submitTransactionAsync(sender, tx);
990 const result = getCreateItemResult(events);990 const result = getCreateItemResult(events);
1004 let tx;1004 let tx;
1005 if (createMode === 'Fungible') {1005 if (createMode === 'Fungible') {
1006 const createData = {fungible: {value: 10}};1006 const createData = {fungible: {value: 10}};
1007 tx = api.tx.nft.createItem(collectionId, to, createData as any);1007 tx = api.tx.unique.createItem(collectionId, to, createData as any);
1008 } else if (createMode === 'ReFungible') {1008 } else if (createMode === 'ReFungible') {
1009 const createData = {refungible: {const_data: [], variable_data: [], pieces: 100}};1009 const createData = {refungible: {const_data: [], variable_data: [], pieces: 100}};
1010 tx = api.tx.nft.createItem(collectionId, to, createData as any);1010 tx = api.tx.unique.createItem(collectionId, to, createData as any);
1011 } else {1011 } else {
1012 const createData = {nft: {const_data: [], variable_data: []}};1012 const createData = {nft: {const_data: [], variable_data: []}};
1013 tx = api.tx.nft.createItem(collectionId, to, createData as any);1013 tx = api.tx.unique.createItem(collectionId, to, createData as any);
1014 }1014 }
10151015
1016 const events = await submitTransactionAsync(sender, tx);1016 const events = await submitTransactionAsync(sender, tx);
10371037
1038export async function createItemExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, owner: string = sender.address) {1038export async function createItemExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, owner: string = sender.address) {
1039 await usingApi(async (api) => {1039 await usingApi(async (api) => {
1040 const tx = api.tx.nft.createItem(collectionId, normalizeAccountId(owner), createMode);1040 const tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);
10411041
1042 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1042 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1043 const result = getCreateItemResult(events);1043 const result = getCreateItemResult(events);
1053 await usingApi(async (api) => {1053 await usingApi(async (api) => {
10541054
1055 // Run the transaction1055 // Run the transaction
1056 const tx = api.tx.nft.setPublicAccessMode(collectionId, accessMode);1056 const tx = api.tx.unique.setPublicAccessMode(collectionId, accessMode);
1057 const events = await submitTransactionAsync(sender, tx);1057 const events = await submitTransactionAsync(sender, tx);
1058 const result = getGenericResult(events);1058 const result = getGenericResult(events);
10591059
1074 await usingApi(async (api) => {1074 await usingApi(async (api) => {
10751075
1076 // Run the transaction1076 // Run the transaction
1077 const tx = api.tx.nft.setPublicAccessMode(collectionId, accessMode);1077 const tx = api.tx.unique.setPublicAccessMode(collectionId, accessMode);
1078 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1078 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1079 const result = getGenericResult(events);1079 const result = getGenericResult(events);
10801080
1100 await usingApi(async (api) => {1100 await usingApi(async (api) => {
11011101
1102 // Run the transaction1102 // Run the transaction
1103 const tx = api.tx.nft.setMintPermission(collectionId, enabled);1103 const tx = api.tx.unique.setMintPermission(collectionId, enabled);
1104 const events = await submitTransactionAsync(sender, tx);1104 const events = await submitTransactionAsync(sender, tx);
1105 const result = getGenericResult(events);1105 const result = getGenericResult(events);
1106 expect(result.success).to.be.true;1106 expect(result.success).to.be.true;
1119export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {1119export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {
1120 await usingApi(async (api) => {1120 await usingApi(async (api) => {
1121 // Run the transaction1121 // Run the transaction
1122 const tx = api.tx.nft.setMintPermission(collectionId, enabled);1122 const tx = api.tx.unique.setMintPermission(collectionId, enabled);
1123 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1123 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1124 const result = getCreateCollectionResult(events);1124 const result = getCreateCollectionResult(events);
1125 // tslint:disable-next-line:no-unused-expression1125 // tslint:disable-next-line:no-unused-expression
1130export async function setChainLimitsExpectFailure(sender: IKeyringPair, limits: IChainLimits) {1130export async function setChainLimitsExpectFailure(sender: IKeyringPair, limits: IChainLimits) {
1131 await usingApi(async (api) => {1131 await usingApi(async (api) => {
1132 // Run the transaction1132 // Run the transaction
1133 const tx = api.tx.nft.setChainLimits(limits);1133 const tx = api.tx.unique.setChainLimits(limits);
1134 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1134 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1135 const result = getCreateCollectionResult(events);1135 const result = getCreateCollectionResult(events);
1136 // tslint:disable-next-line:no-unused-expression1136 // tslint:disable-next-line:no-unused-expression
1139}1139}
11401140
1141export async function isAllowlisted(api: ApiPromise, collectionId: number, address: string | CrossAccountId) {1141export async function isAllowlisted(api: ApiPromise, collectionId: number, address: string | CrossAccountId) {
1142 return (await api.rpc.nft.allowed(collectionId, normalizeAccountId(address))).toJSON();1142 return (await api.rpc.unique.allowed(collectionId, normalizeAccountId(address))).toJSON();
1143}1143}
11441144
1145export async function addToAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId | CrossAccountId) {1145export async function addToAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: string | AccountId | CrossAccountId) {
1146 await usingApi(async (api) => {1146 await usingApi(async (api) => {
1147 expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.false;1147 expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.false;
11481148
1149 // Run the transaction1149 // Run the transaction
1150 const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(address));1150 const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));
1151 const events = await submitTransactionAsync(sender, tx);1151 const events = await submitTransactionAsync(sender, tx);
1152 const result = getGenericResult(events);1152 const result = getGenericResult(events);
1153 expect(result.success).to.be.true;1153 expect(result.success).to.be.true;
1162 expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;1162 expect(await isAllowlisted(api, collectionId, normalizeAccountId(address))).to.be.true;
11631163
1164 // Run the transaction1164 // Run the transaction
1165 const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(address));1165 const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));
1166 const events = await submitTransactionAsync(sender, tx);1166 const events = await submitTransactionAsync(sender, tx);
1167 const result = getGenericResult(events);1167 const result = getGenericResult(events);
1168 expect(result.success).to.be.true;1168 expect(result.success).to.be.true;
1175 await usingApi(async (api) => {1175 await usingApi(async (api) => {
11761176
1177 // Run the transaction1177 // Run the transaction
1178 const tx = api.tx.nft.addToAllowList(collectionId, normalizeAccountId(address));1178 const tx = api.tx.unique.addToAllowList(collectionId, normalizeAccountId(address));
1179 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1179 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1180 const result = getGenericResult(events);1180 const result = getGenericResult(events);
11811181
1188export async function removeFromAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1188export async function removeFromAllowListExpectSuccess(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {
1189 await usingApi(async (api) => {1189 await usingApi(async (api) => {
1190 // Run the transaction1190 // Run the transaction
1191 const tx = api.tx.nft.removeFromAllowList(collectionId, normalizeAccountId(address));1191 const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));
1192 const events = await submitTransactionAsync(sender, tx);1192 const events = await submitTransactionAsync(sender, tx);
1193 const result = getGenericResult(events);1193 const result = getGenericResult(events);
11941194
1201export async function removeFromAllowListExpectFailure(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {1201export async function removeFromAllowListExpectFailure(sender: IKeyringPair, collectionId: number, address: CrossAccountId) {
1202 await usingApi(async (api) => {1202 await usingApi(async (api) => {
1203 // Run the transaction1203 // Run the transaction
1204 const tx = api.tx.nft.removeFromAllowList(collectionId, normalizeAccountId(address));1204 const tx = api.tx.unique.removeFromAllowList(collectionId, normalizeAccountId(address));
1205 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;1205 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
1206 const result = getGenericResult(events);1206 const result = getGenericResult(events);
12071207
1212}1212}
12131213
1214export const getDetailedCollectionInfo = async (api: ApiPromise, collectionId: number)1214export const getDetailedCollectionInfo = async (api: ApiPromise, collectionId: number)
1215 : Promise<NftDataStructsCollection | null> => {1215 : Promise<UpDataStructsCollection | null> => {
1216 return (await api.rpc.nft.collectionById(collectionId)).unwrapOr(null);1216 return (await api.rpc.unique.collectionById(collectionId)).unwrapOr(null);
1217};1217};
12181218
1219export const getCreatedCollectionCount = async (api: ApiPromise): Promise<number> => {1219export const getCreatedCollectionCount = async (api: ApiPromise): Promise<number> => {
1220 // set global object - collectionsCount1220 // set global object - collectionsCount
1221 return (await api.rpc.nft.collectionStats()).created.toNumber();1221 return (await api.rpc.unique.collectionStats()).created.toNumber();
1222};1222};
12231223
1224export async function queryCollectionExpectSuccess(api: ApiPromise, collectionId: number): Promise<NftDataStructsCollection> {1224export async function queryCollectionExpectSuccess(api: ApiPromise, collectionId: number): Promise<UpDataStructsCollection> {
1225 return (await api.rpc.nft.collectionById(collectionId)).unwrap();1225 return (await api.rpc.unique.collectionById(collectionId)).unwrap();
1226}1226}
12271227
1228export async function waitNewBlocks(blocksCount = 1): Promise<void> {1228export async function waitNewBlocks(blocksCount = 1): Promise<void> {