Kyraa SDK provides a developer friendly API for development on top of Meta Blocks protocol. The SDK is open-source.
Kyraa is a mono repo that consists of multiple utilities. The NFT upgradation SDK is a part of the kyraa/metablocks
package.
You can use yarn or npm to install kyraa/metablocks
in your project.
yarn add @kyraa/metablocks
This package also relies on some other packages that you need to install to your project
yarn add @metaplex-foundation/mpl-token-metadata @project-serum/anchor @solana/web3.js axios loglevel
Kyraa wraps the the Solana Wallet Adapter for easy usage with React JS. In order to use this wrapper, you can install the kyraa/solana
package.
yarn add @kyraa/solana
You can wrap any component with the provider to access Solana wallet. You can also wrap your entire app once to make the provider available to all components.
// import providers
import { provider } from "@kyraa/solana";
const {SolanaProvider} = provider
// wrap your component
function Root() {
return (<SolanaProvider network="devnet">
<App />
</SolanaProvider>)
}
The network
prop can be one of devnet
, testnet
or mainnet-beta
.
The kyraa/solana
package also exposes some hooks from the wallet adapter library.
// import hooks
import { hooks } from "@kyraa/solana";
const { useConnection, useWallet, useWalletModal } = hooks
// inside your component
function App() {
const { wallet, publicKey, connect, connected, connecting } = useWallet();
const { setVisible } = useWalletModal();
const { connection } = useConnection();
return (</>)
}
In order to show the modal to connect to the wallet, you can call the setVisible
function from the useWalletModal
hook
<button onClick={() => setVisible(true)}>Connect</button>
With Kyraa SDK installed, you can start interacting with the on-chain programs.