Web
Here you'll find detailed info about the features of the Web SDK
Fetch NFTs
Fetch requested NFTs
How to import:
import { getRequestedNFTs } from '@style-protocol/sdk'How it looks like:
const getRequestedNFTs = async ({
cursor = 0,
amount = 100,
chainId = 5,
metaverseFilter = [],
typeFilter = [],
subtypeFilter = [],
})cursor: integer- Start index ofgetStakesprotocol`s function (as it uses pagination).amount: integer- Number of viewed indexes ofgetStakesprotocol`s function (as it uses pagination).chainId: integer- Chain Id to be able to use it cross-chain.metaverseFilter: string | string[]- Using for metaverse filter. Any alone strings are converted to[string]. Currently possible values are:decentranland,sandbox,somnium_space,cryptovoxels, fabwelt. Use empty array to get items from all metaverses.typeFilter: string | string[]- Using for asset type filter. Any alone strings are converted to[string]. Currently possible values are:AVATAR,WEARABLE,MISC. Use empty array to get items of all types.subtypeFilter: string | string[]- Using for asset subtype filter. Any alone strings are converted to[string]. Use empty array to get items of all types.
Return value:
If succeded:
If failed:
Buy NFTs
Approve ERC20 tokens to protocol
Web3.js
How to import:
How it looks like:
web3: Web3- Web3 object from web3 library (to use user's wallet).walletAddress: string- Wallet address to use it to sign transactions.NFT: dict- Object with NFT data (element of array taken from fetch functions).spender
: approve- Spender of allowance.
Return value:
If succeded:
If failed:
Ethers.js
How to import:
How it looks like:
signer: Signer- Signer object from ethers library (to use user's wallet).NFT: dict- Object with NFT data (element of array taken from fetch functions).spender
: approve- Spender of allowance.
Return value:
If succeded:
If failed:
Buy requested NFTs
Web3.js
How to import:
How it looks like:
web3: Web3- Web3 object from web3 library (to use user's wallet).walletAddress: string- Wallet address to use it to sign transactions.chainId: integer- Chain Id to be able to use it cross-chain.NFT: dict- Object with NFT data (element of array taken from fetch requested NFTs function).
Return value:
If succeded:
If failed:
Ethers.js
How to import:
How it looks like:
signer: Signer- Signer object from ethers library (to use user's wallet).chainId: integer- Chain Id to be able to use it cross-chain.NFT: dict- Object with NFT data (element of array taken from fetch requested NFTs function).
Return value:
If succeded:
If failed:
Fetch Models
Our protocol uses semi-decentralized storage architecture for models conneted with our NFTs, so that only the owner is able to see his NFT's model.
Get User Proof
Web3.js
How to import:
How it looks like:
web3: Web3- Web3 object from web3 library (to use user's wallet).walletAddress: string- Wallet address to use it to sign transactions.cached
: bool- If the userProof could be saved to the cache or not.
Return value:
If succeded:
If failed:
Ethers.js
How to import:
How it looks like:
signer: Signer- Signer object from ethers library (to use user's wallet).cached
: bool- If the User Proof could be saved to the cache or not.
Return value:
If succeded:
If failed:
Get an URL of the model
How to import:
How it looks like:
uri
: string- model_url from the NFT's metadata.userProof
: Dict- User Proof got using the section above.
Return value:
If succeded:
If failed:
Last updated