mirrorworld-sdk-rust

Overview

Usage

  1. Clone project code.
git clone [email protected]:mirrorworld-universe/mirrorworld-sdk-rust.git
cd mirrorworld-sdk-rust
  1. run.
cargo run 
  1. test.
cargo test

Quick Setup

Install

# /Cargo.toml
[dependencies]
mirrorworld-sdk-rust = "0.1.0"

Setup

authentication && wallet

use mirrorworld_sdk_rust::{
    fetch_user,
    get_nft_details,
    get_token,
    get_transactions,
    login,
    login_with_email,
    signup_email,
};
use mirrorworld_sdk_rust::{
    set_config,
    set_apikey,
};
# set global apikey
set_apikey("your apikey"); 
# Completes user signup with email
let res = login_with_email({
    LoginWithEmailParam {
        email: "your email",
        code: "your email code",
        password: "your password",
    }
});

let response = if let Ok(Some(response)) = res {
    response
} else {
    todo!()
};
# Completes user signup with email
signup_email("[email protected]");

set_config(
        "your token",
        "your apikey"
    );

# GETChecks whether is authenticated or not and returns the user object if true
fetch_user();

# Get wallet tokens.
get_token();

# Fetches the wallet transactions for a user
get_transactions();

# GET Fetch single NFT details
get_nft_details("nft address");


# wallet

# Transfer Token to another address
transfer_spltoken((
        "sol address",
        amount
        "sol address",
        amount
    ));

# Transfer SOL to another address.
transfer_sol((
    "sol address", 
    amount
));

marketplace

use mirrorworld_sdk_rust::{marketplace::Marketplace, NetEnv};
use mirrorworld_sdk_rust::marketplace::GeneralPayload;

let KEY: &str = "your api key";
let TOKEN: &str = "your access token";

// init marketplace object, 
let market =  Marketplace::new(KEY.to_string(), NetEnv::DEVNET, TOKEN.to_string());

// create a collection
let name: String = String::from("your collection name");
let symbol: String = String::from("your token symbol name");
let uri: String = String::from("you collection metadata uri")
let response = market.create_collection(name, symbol, uri).await.unwrap();
if response.is_none() {    
    // your code
} else {
    // your code
}

// create a sub collection
let name: String = String::from("your sub collection");
let symbol: String = String::from("you sub collection token symbol");
let uri: String = String::from("your sub collection metadata uri");
let parent_collection: String = String::from("your parent collection"); // you can got this from the above api
let response = market.create_sub_collection(name, symbol, uri, parent_collection).await.unwrap();

// mint an nft
let payload: GeneralPayload = GeneralPayload{
        name: String::from("your nft name"),
        symbol: "your symbol".to_string(),
        url: "your nft metadta uri".to_string(),
        collection_mint: "your collection".to_string()
    };
let response = market.solana_mint_nft(payload).await.unwrap();

// list an nft
let mint_address: String = String::from("your nft mint address");
let price: f64 = 0.5; // amount in SOL
let response = market.listing_nft(mint_address, price).await.unwrap();


// buy an nft
let mint_address: String = String::from("your nft mint address");
let price: f64 = 0.5; // amount in SOL 
let response = market.buy_nft(mint_address, price).await.unwrap();

// update nft listing price
let mint_address: String = String::from("your nft mint address");
let price: f64 = 0.5; // amount in SOL
let response = market.update_nft_listing(mint_address, price).await.unwrap();

// cancel listing
let mint_address: String = String::from("your nft mint address");
let price: f64 = 0.5; // amount in SOL
let response = market.cancel_nft_listing(mint_address, price).await.unwrap();

// transfer nft
let mint_address = String::from("your nft mint address");
let to_wallet_address = String::from("to wallet address");
let response = market.transfer_nft(mint_address, to_wallet_address).await.unwrap();

// fetch nfts by mint address
let mut addresses = Vec::new();
addresses.push("nft mint address".to_string());
let limit: usize = 10;
let offset: usize = 1;
let response = market.fetch_nfts_by_mint_address(addresses, limit, offset).await.unwrap();

// fetch nfts by creator address
let mut addresses = Vec::new();
addresses.push("creator address".to_string());
let limit: usize = 10;
let offset: usize = 1;
let response = market.fetch_nfts_by_creator_address(addresses, limit, offset).await.unwrap();

// fetch nfts by update authorities
let mut addresses = Vec::new();
addresses.push("update authorities address".to_string());
let limit: usize = 10;
let offset: usize = 1;
let response = market.fetch_nfts_by_update_authorities(addresses, limit, offset).await.unwrap();

// fetch nfts by owner address 
let mut addresses = Vec::new();
addresses.push("owner address".to_string());
let limit: usize = 10;
let offset: usize = 1;
let response = market.fetch_nfts_by_owner_addresses(addresses, limit, offset).await.unwrap();

// fetch nfts marketplace activity
let address = String::from("nft mint address");
let response = market.fetch_nft_marketplace_activity(address).await.unwrap();
You might also like...
An unofficial Rust SDK for Clerk.dev

An unofficial clerk.dev SDK for rust Note: This SDK is updated frequently to keep up with any changes to the actual Clerk API. If you see anything tha

Kryptokrona SDK in Rust for building decentralized private communication and payment systems.

Kryptokrona Rust SDK Kryptokrona is a decentralized blockchain from the Nordic based on CryptoNote, which forms the basis for Monero, among others. Cr

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Avalanche APIs/VM SDK in Rust

avalanche-rs ⚠️ avalanche-rs is alpha-level software and is not ready for production use. Do not use avalanche-rs to run production workloads. See the

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Rust bindings and SDK for the ELSTER Rich Client (ERiC)

Eric Rust bindings and SDK for the ELSTER Rich Client (ERiC) What is ELSTER? What is ERiC? Requirements Rust bindings Select bindings Generate binding

A Software Development Kit (SDK) for Zero-Knowledge Transactions

Aleo SDK The Aleo SDK is a developer framework to make it simple to create a new account, craft a transaction, and broadcast it to the network. Table

A Minimal Windows SDK.

Minimal Windows 10 SDK Installs only the necessary Windows 10 .lib files to save you having to download the full Visual Studio package. You can either

Helper library for interacting with Terra assets (SDK coins and CW20 tokens)

terra-asset Helpers for interacting with Terra assets, including native coins and CW20 tokens Usage This crate contains two struct types: AssetInfo st

Owner
Mirror World
Buidl Rapidly & Effectively on Web3
Mirror World
Pokémon TCG SDK - Rust

Pokémon TCG SDK - Rust This is the Pokémon TCG SDK Rust implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io. Usage Configurati

Pokémon TCG Developers 2 Dec 14, 2022
A template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it.

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

null 1 Mar 7, 2022
Smart Contract built in Rust to run inside Cosmos SDK module on all chains that enable it

CoinSwap is a Smart Contract that is built on the terra blockchain and can be used to swap cryptocurrencies such as LUNA, UST, TerraUSD, Anchor, Mirror Protocol, LUNI and other CW20 tokens. The Project also contains a smart contract which works as a analysis tool for the gas fees on the Terra Blockchain.

Prajjwal Chittori 9 Oct 11, 2022
Lazerpay SDK for Rust 🦀

?? Lazerpay Rust SDK This crate integrates the Lazerpay payment gateway for accepting cryptocurrency payments. Usage Add the following to your cargo d

Lord_Sarcastic 15 Sep 21, 2022
This crate reimplements Gelato's Relay SDK in Rust

Gelato Relay SDK This crate reimplements Gelato's Relay SDK in Rust. It simply wraps Gelato Relay requests and responses to/from Gelato endpoints with

Nomad 30 Oct 20, 2022
A universal SDK for FDU. Powered by Rust.

libfdu A universal SDK for FDU. Building You need Rust Nightly installed: $ rustup default nightly Build the library by running: $ cargo build or $ ca

旦夕开发组 6 Sep 11, 2022
Rust SDK for interacting with the Nile.

Nile API Rust Client This is a POC Rust client for the Nile API. Usage Source the Nile environment variables into your environment. export NILE_DEVELO

coredb-io 4 Jan 12, 2023
Rust for the DirectStorage SDK (unofficial)

Rust for the DirectStorage SDK (unofficial) This crate lets you call any DirectStorage SDK API using code generated from the metadata describing the A

Rafael Rivera 5 Jan 13, 2023
🦀 Hop server side SDK for Rust

hop-rs (wip) Hop's Rust library. Requires Rust 1.61+ Installation [dependencies] hop = "0.0.0" Usage Create a project token or personal access token.

Tom 17 Jan 31, 2023
Minimal flashloan borrower contracts with an extensible rust sdk to abstract wrapping generic onchain calls (similar to multicall3) with flashloans.

flashloan-rs • Minimal flashloan borrower contracts with an extensible rust sdk. Getting Started Flashloan-rs is published to crates.io as flashloan-r

White Noise 71 Apr 15, 2023