forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nfts attribute read interface (paritytech#13349)
* feat: add custom and system attributes to Inspect * feat: add nfts runtime api * fix: pass std feature to runtime api * fix: api copyright Co-authored-by: joe petrowski <[email protected]> --------- Co-authored-by: joe petrowski <[email protected]>
- Loading branch information
1 parent
0560254
commit 4c2a129
Showing
10 changed files
with
291 additions
and
30 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "pallet-nfts-runtime-api" | ||
version = "4.0.0-dev" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
homepage = "https://substrate.io" | ||
repository = "https://github.com/paritytech/substrate/" | ||
description = "Runtime API for the FRAME NFTs pallet." | ||
readme = "README.md" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] } | ||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" } | ||
pallet-nfts = { version = "4.0.0-dev", default-features = false, path = "../../nfts" } | ||
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"frame-support/std", | ||
"pallet-nfts/std", | ||
"sp-api/std", | ||
] |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RPC runtime API for the FRAME NFTs pallet. | ||
|
||
License: Apache-2.0 |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) 2023 Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Runtime API definition for the FRAME NFTs pallet. | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
use codec::{Decode, Encode}; | ||
use frame_support::dispatch::Vec; | ||
|
||
sp_api::decl_runtime_apis! { | ||
pub trait NftsApi<AccountId, CollectionId, ItemId> | ||
where | ||
AccountId: Encode + Decode, | ||
CollectionId: Encode, | ||
ItemId: Encode, | ||
{ | ||
fn owner(collection: CollectionId, item: ItemId) -> Option<AccountId>; | ||
|
||
fn collection_owner(collection: CollectionId) -> Option<AccountId>; | ||
|
||
fn attribute( | ||
collection: CollectionId, | ||
item: ItemId, | ||
key: Vec<u8>, | ||
) -> Option<Vec<u8>>; | ||
|
||
fn custom_attribute( | ||
account: AccountId, | ||
collection: CollectionId, | ||
item: ItemId, | ||
key: Vec<u8>, | ||
) -> Option<Vec<u8>>; | ||
|
||
fn system_attribute( | ||
collection: CollectionId, | ||
item: ItemId, | ||
key: Vec<u8>, | ||
) -> Option<Vec<u8>>; | ||
|
||
fn collection_attribute(collection: CollectionId, key: Vec<u8>) -> Option<Vec<u8>>; | ||
} | ||
} |
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.