-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pop-api): further implementation of nfts api (#21)
* fix: restore missing ink contract attribute * feat(pop-api): further implementation of nfts api * feat(pop-api): add support to query nft state in extension * feat(pop-api): continue support for nft state queries * fix: add missing import * fix: increase visibility * fix: add missing derives * feat(pop-api): add relay_chain_block_number function * refactor(nfts): group functions as per pallet * chore: address clippy warnings --------- Co-authored-by: Peter White <petras9789@gmail.com>
- Loading branch information
1 parent
cd57408
commit a87e19d
Showing
11 changed files
with
819 additions
and
135 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
#![cfg_attr(not(feature = "std"), no_std, no_main)] | ||
|
||
pub use bounded_collections::{BoundedBTreeMap, BoundedBTreeSet, BoundedVec, ConstU32}; | ||
//use scale::{Decode, Encode, MaxEncodedLen}; | ||
|
||
pub mod storage_keys; | ||
|
||
// /// Some way of identifying an account on the chain. | ||
// #[derive(Encode, Decode, Debug, MaxEncodedLen)] | ||
// pub struct AccountId([u8; 32]); | ||
// Id used for identifying non-fungible collections. | ||
pub type CollectionId = u32; | ||
// Id used for identifying non-fungible items. | ||
pub type ItemId = u32; | ||
/// The maximum length of an attribute key. | ||
pub type KeyLimit = ConstU32<64>; | ||
/// The maximum approvals an item could have. | ||
pub type ApprovalsLimit = ConstU32<20>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
use super::*; | ||
use scale::{Decode, Encode, MaxEncodedLen}; | ||
|
||
#[derive(Encode, Decode, Debug, MaxEncodedLen)] | ||
pub enum RuntimeStateKeys { | ||
Nfts(NftsKeys), | ||
ParachainSystem(ParachainSystemKeys), | ||
} | ||
|
||
#[derive(Encode, Decode, Debug, MaxEncodedLen)] | ||
pub enum ParachainSystemKeys { | ||
LastRelayChainBlockNumber, | ||
} | ||
|
||
// https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/nfts/src/impl_nonfungibles.rs | ||
#[derive(Encode, Decode, Debug, MaxEncodedLen)] | ||
pub enum NftsKeys { | ||
// Get the details of a collection. | ||
Collection(CollectionId), | ||
/// Get the owner of the collection, if the collection exists. | ||
CollectionOwner(CollectionId), | ||
// Get the details of an item. | ||
Item(CollectionId, ItemId), | ||
/// Get the owner of the item, if the item exists. | ||
Owner(CollectionId, ItemId), | ||
/// Get the attribute value of `item` of `collection` corresponding to `key`. | ||
Attribute(CollectionId, ItemId, BoundedVec<u8, KeyLimit>), | ||
// /// Get the custom attribute value of `item` of `collection` corresponding to `key`. | ||
// CustomAttribute(AccountId, CollectionId, ItemId, BoundedVec<u8, KeyLimit>), | ||
/// Get the system attribute value of `item` of `collection` corresponding to `key` | ||
SystemAttribute(CollectionId, Option<ItemId>, BoundedVec<u8, KeyLimit>), | ||
/// Get the attribute value of `item` of `collection` corresponding to `key`. | ||
CollectionAttribute(CollectionId, BoundedVec<u8, KeyLimit>), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.