1.0.8 • Published 3 years ago
refinable-nft-sdk-test v1.0.8
refinable-sdk
refinable-sdk
is a NPM package that can be added to the project to work with Refinable contracts.
The way to work with this SDK is extremely simple as you just need to initialize and use the methods that we have built.
//import detectEthereumProvider from "@metamask/detect-provider";
const token = localStorage.getItem("token") || "";
const provider: any = await detectEthereumProvider();
const refinable = new Refinable(provider, Network.BSCTest, token);
- Token is the token that authenticates to the API.
- Provider is the provider you want to initialize (I am using the metamask here).
- Network: you can choose BSCTest for testnet and BSC for mainnet
Or here is another way in case you use with private key.
const provider = new Web3.providers.HttpProvider(
"https://data-seed-prebsc-1-s1.binance.org:8545/"
);
const refinable = new Refinable(provider, Network.BSCTest, {
address: ACCOUNT_ADDRESS,
privateKey: PRIVATE_KEY,
});
By initializing an instant like above, you will already be able to use our method. This is a method that we have developed allowing you to approve ERC721 and ERC1155 tokens. You just need to fill in the parameter and it will do the rest which is approving the token for you.
refinable.approveNFT({
tokenId: nft.node.tokenId,
contractAddress: nft.node.contractAddress,
nftBillInfo: {
supply: Number(nft.supply),
amount: Number(nft.price),
currency: nft.currency,
},
});