Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlexandriaDAO/NFT
https://github.com/AlexandriaDAO/NFT
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/AlexandriaDAO/NFT
- Owner: AlexandriaDAO
- Created: 2024-05-08T15:53:57.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-25T17:01:24.000Z (4 months ago)
- Last Synced: 2024-10-20T09:44:40.188Z (18 days ago)
- Language: Rust
- Size: 3.39 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
- awesome-internet-computer - ICRC-7 Rust implementation
README
* Framework for ICRC7 NFT implementation for Internet Computer
** Simple NFT
*** add next to dependences in ~Cargo.toml~
#+BEGIN_SRC toml
uncensored-greats-dao = "0.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
candid = "0.10"
#+END_SRC*** to create NFT struct ~TestToken~ with symbol ~TT~ and name ~TestToken~ in ~src/lib.rs~ add
#+BEGIN_SRC rust
use serde::{Deserialize, Serialize};
use uncensored_greats_dao::{Icrc7, Metadata, Storage};
use candid::CandidType;#[derive(
CandidType, Clone, Hash, Default, Serialize, Deserialize,
)]
pub struct TestToken {
pub name: String,
pub description: Option,
}impl Metadata for TestToken {
fn metadata(&self) -> String {
serde_json::to_string(&serde_json::json!({
"name": self.name,
"description": self.description
}))
.unwrap_or_default()
}
}#[derive(Icrc7, Storage, Deserialize, Serialize, Default)]
#[icrc7(token_type = "TestToken")]
#[icrc7(symbol = "TT")]
#[icrc7(name = "Test Token")]
pub struct TokenCollections {}
#+END_SRC*** build and deploy to test network
#+BEGIN_SRC bash
rustup target add wasm32-unknown-unknown
cargo install candid-extractor
cargo build --release --target wasm32-unknown-unknown --package test_token
candid-extractor target/wasm32-unknown-unknown/release/test_token.wasm > test_token.diddfx start --clean --background
dfx deploy test_token
#+END_SRC*** creating token
#+BEGIN_SRC bash
dfx canister call test_token create_token \
"(record{
token=record {
name=\"test\";
description=opt\"test description\"
};
})"
#+END_SRC*** mint created token
#+BEGIN_SRC bash
dfx canister call test_token mint \
"(record{
token_id=1;
holders=vec{record{owner=principal\"$YOU\"}}
})"
#+END_SRCto check more methots please check ~examples/test_token~