Skip to main content
BETA
View Zag.js on Github
Join the Discord server

Android API Reference

Authentication Methods

StartLogin

Calling this api would popup a dialog, user can finish login flow on it. In which dialog, user can login with third method like google, twitter. Or he can login with his email which registered on our website.

MirrorSDK.getInstance().StartLogin(new LoginListener() { @Override public void onLoginSuccess() { } @Override public void onLoginFail() { } });

CheckAuthenticated

Checks whether the current user is logged in. You can use this function to judge whether a user needs to start login flow.

MirrorSDK.getInstance().CheckAuthenticated(new BoolListener() { @Override public void onBool(boolean boolValue) { Log.i("MyApp","This device's login state is:" + boolValue); } });

SetDebug

Set if use debug mode. In this mode, developer can see details in whole flow.

MirrorSDK.getInstance().SetDebug(true);

SetApiKey

Set the api key which the current app uses. You can find it when you create a project on our website.

String apiKey = "Your api key"; MirrorSDK.getInstance().SetAppID(apiKey);

Wallet Methods

OpenWallet

Open a webview which would show the wallet page.

MirrorSDK.getInstance().OpenWallet();

GetAccessToken

Get access token so that users can visit APIs.

Activity activity; MirrorSDK.getInstance().GetAccessToken(activityContext, new MirrorCallback() { @Override public void callback(String result) { Log.i("MyApp","Access token is:" + result); } });

QueryUser

Check user's info, then we can get user's base information such as wallet address and so on.

String email = "[email protected]"; MirrorSDK.getInstance().QueryUser(userEmail, new FetchUserListener() { @Override public void onUserFetched(UserResponse userResponse) { } @Override public void onFetchFailed(long code, String message) { } });

Marketplace Methods

FetchSingleNFT

Fetch the details of a NFT.

String mintAddress = "nft_mint_address"; MirrorSDK.getInstance().GetNFTDetails(mintAddress, new FetchSingleNFTListener() { @Override public void onFetchSuccess(SingleNFTResponse nftResponse) { } @Override public void onFetchFailed(long code, String message) { } });

MintNewNFTOnCollection

Mint a new NFT.

String collectionAddress = "collection_address"; String mintName = "NewNFT"; String mintSymbol = "Symbol"; String metaDataUri: "https://my-collection-metadata-uri/metadata.json"; MirrorSDK.getInstance().MirrorSDK.getInstance().MintNFT(collectionAddress, mintName, mintSymbol, metaDataUri, new MintNFTListener() { @Override public void onMintSuccess(MintResponse userResponse) { } @Override public void onMintFailed(long code, String message) { } });

CreateVerifiedCollection

Mint a parent NFT collection.

String mintName = "NewNFT"; String mintSymbol = "Symbol"; String metaDataUri: "https://my-collection-metadata-uri/metadata.json"; MirrorSDK.getInstance().CreateVerifiedCollection(mintName, mintSymbol, metaDataUri, new CreateTopCollectionListener() { @Override public void onCreateSuccess(MintResponse mintResponse) { } @Override public void onCreateFailed(long code, String message) { } });

CreateVerifiedSubCollection

Mint a child NFT collection.

String collectionAddress = "collection_address"; String mintName = "NewNFT"; String mintSymbol = "Symbol"; String metaDataUri: "https://my-collection-metadata-uri/metadata.json"; MirrorSDK.getInstance().CreateVerifiedSubCollection(collectionAddress,mintName, mintSymbol, metaDataUri, new CreateSubCollectionListener() { @Override public void onCreateSuccess(MintResponse userResponse) { } @Override public void onCreateFailed(long code, String message) { } });

TransferNFTToAnotherSolanaWallet

Transfer NFT to another Sol wallet.

String mintAddress = "mint_address"; String toWalletAddress = "wallet_address"; MirrorSDK.getInstance().TransferNFTToAnotherSolanaWallet(mintAddress,toWalletAddress, new TransferNFTListener() { @Override public void onTransferSuccess(ListingResponse listingResponse) { } @Override public void onTransferFailed(long code, String message) { } });

CancelNFTListing

Cancel listing of NFT.

String mintAddress = "mint_address"; Double price = 123.99; MirrorSDK.getInstance().CancelListingOfNFT(mintAddress,price, new CancelListListener() { @Override public void onCancelSuccess(ListingResponse listingResponse) { } @Override public void onCancelFailed(long code, String message) { } });

BuyNFT

Buy a NFT on market place.

String mintAddress = "mint_address"; Double price = 123.99; MirrorSDK.getInstance().BuyNFT(mintAddress,price, new BuyNFTListener() { @Override public void onBuySuccess(ListingResponse listingResponse) { holder.mResultView.setText(listingResponse.mint_address); } @Override public void onBuyFailed(long code, String message) { holder.mResultView.setText(message); } });

UpdateNFTListing

Update the list of NFTs.

String mintAddress = "mint_address"; Double price = 123.99; MirrorSDK.getInstance().UpdateNFTListing(mintAddress,price, new UpdateListListener() { @Override public void onUpdateSuccess(ListingResponse listingResponse) { holder.mResultView.setText("UpdateNFTListing success! New price:"+listingResponse.price); } @Override public void onUpdateFailed(long code, String message) { holder.mResultView.setText(MirrorStringUtils.GetFailedNotice("UpdateNFTListing",code,message)); } });

ListNFT

Get list of NFT on market place.

String mintAddress = "mint_address"; Double price = 123.99; MirrorSDK.getInstance().ListNFT(mintAddress,price, new ListNFTListener() { @Override public void onListSuccess(ListingResponse listingResponse) { } @Override public void onListFailed(long code, String message) { } });

FetchNFTsByUpdateAuthorities

Get a collection of NFT by authority addresses.

List<String> list = new ArrayList<>(); list.add("authority_address_1"); list.add("authority_address_2"); Double limit = 2; Double offset = "0.23"; MirrorSDK.getInstance().FetchNFTsByUpdateAuthorities(list,limit,offset, new MirrorCallback() { @Override public void callback(String result) { } });

FetchNFTsByCreatorAddresses

Get a collection of NFT by creator addresses.

List<String> list = new ArrayList<>(); list.add("authority_address_1"); list.add("authority_address_2"); Double limit = 2; Double offset = "0.23"; MirrorSDK.getInstance().FetchNFTsByCreatorAddresses(list,limit,offset, new MirrorCallback() { @Override public void callback(String result) { } });

FetchNFTsByOwnerAddresses

Get a collection of NFT by mint addresses.

List<String> list = new ArrayList<>(); list.add("mint_address_1"); list.add("mint_address_2"); MirrorSDK.getInstance().FetchNFTsByOwnerAddresses(list, new FetchByOwnerListener() { @Override public void onFetchSuccess(MultipleNFTsResponse multipleNFTsResponse) { holder.mResultView.setText(multipleNFTsResponse.nfts.size()); } @Override public void onFetchFailed(long code, String message) { holder.mResultView.setText(message); } });

Edit this page on GitHub

On this page