Skip to main content
BETA
HomeIntegration BuilderAPI ReferenceGuides
View Mirror World on Github
Join the Discord server

SDK Usage in Mirrors Jump

Mirrors Jump is a mini-game that fully utilizes the Mirror World Smart SDK and is dedicated to helping more developers understand the features of the Smart SDK. This game is developed in the unity engine and deployed on Solana.

In this game we have integrated Smart Auth, Smart Wallet, Smart Marketplace and Smart NFT Creation, all in just 30 minutes.

  • Download the Game
  • Github

How to integrate Smart Wallet into your Game

What is Smart Wallet?

We believe you also want to make it low cost, easy and seamless for more users to access your product and buy crypto and use crypto directly and securely in your product.

In response to these needs, we have developed the Smart Wallet with the following features:

  1. Multiple Social Login Options : Google, Discord, Twitter, Facebook and Email.

  2. Non-custodial Wallet (MPC-TSS) Generated: no need for users to store private keys.

  3. Fiat to Crypto Onramp : users in 200+ regions around the world can easily buy cryptocurrency

  4. Token Transfer : users can transfer assets freely

  5. User-side Transaction Approval : secondary confirmation of payment

Scenarios in Mirrors Jump

Smart Wallet integrated in Mirrors Jump

Integration Steps

  1. Download Unity SDK
  2. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  3. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
// ... Your code
_5
});

  1. Open user's wallet:

_6
// The action that user logout from wallet
_6
Action walletLogoutAction = ()=> {
_6
// ... Your code
_6
}
_6
_6
MirrorSDK.OpenWalletPage(walletLogoutAction);

How to mint NFTs in your Game?

What is an NFT?

NFT, or non-fungible token, is a type of cryptographic token that represents a unique digital asset. Unlike fungible tokens, which are interchangeable and have the same value, non-fungible tokens are unique and cannot be replaced or exchanged for other tokens. NFTs are often used to represent collectible items, digital art, and other digital assets that are unique and have value.

Why turn your game assets into NFT?

There are several reasons why game developers and players might want to turn their game assets into non-fungible tokens (NFTs). Some of the main benefits of using NFTs for game assets include:

  1. Ownership : NFTs allow players to own their game assets in a verifiable and transparent way. This can give players a sense of ownership and control over their assets, and it can prevent issues like theft or fraud.

  2. Trading : NFTs can be easily traded and exchanged, allowing players to buy and sell their game assets on various online marketplaces. This can create new opportunities for players to monetize their assets and make a profit.

  3. Scarcity : NFTs can be used to create scarcity around game assets, which can increase their value and appeal to players. For example, developers can create limited edition items or unique collectibles that can only be obtained through certain methods, such as special events or in-game challenges.

  4. Integration : NFTs can be easily integrated into existing game systems and platforms, allowing players to use their assets in different ways. For example, NFTs can be used as in-game currency, as items to be used in the game, or as part of the game's ecosystem.

Overall, turning game assets into NFTs can provide many benefits for both game developers and players, and it is likely to become an increasingly popular trend in the gaming industry.

Scenarios in Mirrors Jump

In Mirrors Jump, we have 5 different types of NFTs, mainly differentiated by the type of character:

screen-shotIn the design of Mirrors Jump, we give each player a free character, which can then be Minted into NFT. This is the process of turning a game asset into an NFT in Mirrors Jump.

Metadata

NFT metadata is information that is associated with a non-fungible token (NFT). This information is typically stored in the blockchain and is accessible to anyone who holds or has access to the NFT.

NFT metadata can include various types of information, such as the name and description of the asset, the date and time it was created, the creator's name and address, and any other relevant information. NFT metadata is important because it provides context and information about the NFT and the asset it represents. It can help users understand the value and significance of the NFT, and it can be used for various purposes, such as verifying the authenticity of the NFT or tracking its history and ownership.

For example, the NFT metadata information in Mirrors Jump:


_21
{
_21
"name": "Mirrors Jump #1",
_21
"symbol": "MJNFT",
_21
"description": "Mirrors Jump is our tribute to Doodle Jump, powered by Mirror World SDK. We hope that this game will help players to better understand the fun aspects of Web3 games and help developers to better understand how to use the Mirror World SDK.",
_21
"image": "http://metadata-assets.mirrorworld.fun/mirror_jump/images/Rare_Pirate Captain.png",
_21
"seller_fee_basis_points": 425,
_21
"collection": {
_21
"name": "Mirrors Jump NFT",
_21
"family": "Mirrors Jump NFT"
_21
},
_21
"attributes": [
_21
{
_21
"trait_type": "Rarity",
_21
"value": "Rare"
_21
},
_21
{
_21
"trait_type": "Type",
_21
"value": "Pirate Captain"
_21
}
_21
]
_21
}

Integration Steps

  1. Download Unity SDK
  2. Create an NFT Collection. This can be found on the Developer dashboard at: Dashboard --> Project --> NFT Collections --> Create a Collection
  3. After creating your NFT collection, copy NFT Collection address. We shall use this later.
  4. Upload NFT Metadata text in JSON format to your server, and Get the NFT Metadata JSON URL.
  5. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  6. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
//todo
_5
});

  1. Mint NFT and transfer tokens with the following code

_45
_45
// STEP 1
_45
// Mint NFT
_45
_45
string collection = "You can get this collection address from your dashboard.";
_45
string name = "this string will not be displayed to the user, you can define it as you wish";
_45
string symbol = "this string will not be displayed to the user, you can define it as you wish";
_45
string nftJsonUrl = "You need to upload your nft config and get this";
_45
_45
MirrorSDK.MintNFT(collection,name,symbol,nftJsonUrl,Confirmation.Confirmed,(result) =>
_45
{
_45
if (result.status == "success")
_45
{
_45
// Mint Success
_45
Debug.log("Mint Success!");
_45
}
_45
else
_45
{
_45
// Printing failure message
_45
Debug.log(result.message);
_45
}
_45
_45
});
_45
_45
// STEP 2
_45
// Transfer token (If you want the user mint NFT to be paid, then you need to execute the following code)
_45
_45
// transfer amount
_45
ulong amout = 100000000;
_45
string publicKey = "Your public key";
_45
_45
MirrorSDK.TransferSol(amout,publicKey,(result) =>
_45
{
_45
if (result.status == "success")
_45
{
_45
// transfer sol Success
_45
Debug.log("Mint Success!");
_45
}
_45
else
_45
{
_45
// Printing failure message
_45
Debug.log(result.message);
_45
}
_45
_45
});

How to transfer your NFTs from the game to your friend?

Scenarios in Mirrors Jump

screen-shotAs long as you have your friend's wallet address, you can easily give them NFT as a gift.

Integration Steps

  1. Download Unity SDK
  2. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  3. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
//todo
_5
});

  1. Get NFT Mint Address. This is the address that uniquely identifies an NFT on the blockchain. You will get tht NFT mint address whenever you mint an NFT.
  2. Transfer NFT with the following code

_16
string nftMintAddress = "mint address of your nft";
_16
string transferAddress = "the wallet address you want to transfer to";
_16
_16
MirrorSDK.TransferNFT(nftMintAddress,transferAddress,(result) =>
_16
{
_16
if (result.status == "success")
_16
{
_16
// Transfer Success
_16
Debug.log("Transfer Success!");
_16
}
_16
else
_16
{
_16
// Printing failure message
_16
Debug.log("Transfer failed! The message is:" + result.message);
_16
}
_16
});

How to build an in-game NFT backpack?

What is an NFT backpack?

An NFT backpack, or non-fungible token backpack, is a digital wallet or storage system that is specifically designed to hold and manage non-fungible tokens (NFTs). An NFT backpack is similar to a regular cryptocurrency wallet, but it is specifically designed to store and manage NFTs.

Scenarios in Mirrors Jump

In Mirrors Jump, you can view your own NFT in the NFT backpack.

Integration Steps

  1. Download Unity SDK
  2. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  3. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
//todo
_5
});

  1. Build an NFT backpack with the following code

_28
_28
string ownerAddress = "nft owner address";
_28
_28
List<string> owners = new List<string>();
_28
owners.Add(ownerAddress);
_28
_28
// Start index
_28
int offset = 0;
_28
_28
//Limit of length
_28
int limit = 100;
_28
_28
MirrorSDK.GetNFTsOwnedByAddress(owners, limit,offset,(Mutiple) =>
_28
{
_28
if (result.status == "success")
_28
{
_28
//Your NFT data entities
_28
List<SingleNFTResponseObj> nfts = Mutiple.data.nfts;
_28
_28
//Todo: show them in your ui
_28
_28
}
_28
else
_28
{
_28
// Printing failure message
_28
Debug.log("Get NFTs failed, the reason is:" + result.message);
_28
}
_28
});

How to sell your NFTs in the game?

Scenarios in Mirrors Jump

screen-shotYou can set a specified price and sell your NFTs on the marketplace.

Integration Steps

  1. Download Unity SDK
  2. Get your Marketplace's Auction House Address. You can retrieve this address form the Developer Dashboard at this path: Dashboard --> Project --> NFT Marketplace --> Create a Marketplace
  3. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  4. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
//todo
_5
});

  1. Sell NFT With the following code

_18
_18
string nftMintAddress = "mint address of your nft";
_18
float price = 99.99;
_18
string ActionHouse = "your actionHouse";
_18
_18
MirrorSDK.ListNFT(nftMintAddress,price,ActionHouse,(result) =>
_18
{
_18
if (result.status == "success")
_18
{
_18
// Printing success message
_18
Debug.log("List Success!");
_18
}
_18
else
_18
{
_18
// Printing failure message
_18
Debug.log("List Failed, the reason is:" + result.message);
_18
}
_18
});

How to build an in-game NFT marketplace?

What is the NFT Marketplace?

An NFT (non-fungible token) marketplace is a platform that allows users to buy, sell, and trade NFTs.

Why should you have your own NFT Marketplace?

There are a few reasons why you might want to have your own NFT marketplace:

  1. Control: Having your own NFT marketplace allows you to have full control over the platform, including the design, features, and policies.
  2. Branding: By creating your own NFT marketplace, you can establish your own brand and create a unique user experience that aligns with your values and vision. This can help you stand out in a crowded market and build a loyal customer base.
  3. Revenue: If your NFT marketplace becomes popular and attracts a lot of users, you may be able to generate significant revenue through transaction fees, advertising, and other sources.
  4. Community: An NFT marketplace can be a great way to build a community of like-minded people who are interested in your work or the types of NFTs you offer. This can help you foster relationships with fans and customers and create a sense of belonging and connection.

Scenarios in Mirrors Jump

screen-shotIn Mirrors Jump, you can open the NFT Marketplace directly in the game, browse other players' NFTs, and buy NFTs that are on sale.

Integration Steps

  1. Download Unity SDK
  2. Init your SDK with adding MirrorSDK prefab, you can follow the documentation here: InitWithPrefab
  3. Let users login with the following code:

_5
MirrorSDK.StartLogin((loginResponse)=>
_5
{
_5
UserResponse userInfo = loginResponse.user;
_5
// ... your code
_5
});

  1. Create your Marketplace: You can refer to Marketplace Storefront Deployment Guide - Mirror World
  2. Open it in SDK with the following code:

_2
string marketUrl = "Your deployed marketplace url";
_2
MirrorSDK.OpenMarketPage(marketUrl);

Edit this page on GitHub

Copyright © Mirror World, Inc. 2023
On this page

Home

Tutorials

Guides

API Reference