Provides a bridge library of ios and android metaplex native sdks.
Currently bridge for following methods from Android SDK have been implemented:
findByMint
findAllByOwner
metadata
-
Clone the repository
git clone https://github.com/metaplex-foundation/js-react-native
-
Import Metaplex Class from Metaplex.js
import Metaplex from './Metaplex.js';
-
Initialize Metaplex
constructor
method takes two arguments :-
environment
: It can take three values mainnet/testnet/devnet . Default value is mainnet -
ownerPublicKey
: It is the public key of owner wallet
const metaplex = new Metaplex(environment, ownerPublicKey);
Once the Metaplex class is created, you can use the methods present in Metaplex.js file
-
-
Run the react native app
-
Open the
android
folder in android studio and build the app. -
Make sure android
emulator
is running withandroid 12
(API 31) -
Open a terminal in the root of the project and run the metro bundler by using following command.
npm run start
-
Open another terminal in the root of the project and run the below command to run react-native app for android.
npm run android
-
Check out Metaplex.js
file for code samples of following methods
-
findByMint
findByMint method takes one argument and returns a promise :
mintKey
: It is the mint key for which nft is to be found
metaplex .findByMint(mintKey) .then(data => console.log(data)) .catch(error => console.log(error));
-
findAllByOwner
findAllByOwner method takes one argument and returns a promise :
ownerPublicKey
: It is the public key of the owner for whom all NFTs are returned
metaplex .findAllByOwner(ownerPublicKey) .then(data => console.log(data)) .catch(error => console.log(error));
-
metadata
metadata method takes one argument and returns a promise :
mintKey
: It is the mint key for which nft metadata is to be found
metaplex .metadata(mintKey) .then(data => console.log(data)) .catch(error => console.log(error));
As mentioned above, this SDK is still in very early stages. We plan to bridge the complete mobile SDK of Metaplex. Here’s a quick overview of what we plan to work on next.
- Bridge existing functionalities from android and ios native sdk