https://docs.vwbl-protocol.org
yarn add vwbl-sdk
new VWBL({
signer,
contractAddress: '0x...',
manageKeyType: ManageKeyType.VWBL_NETWORK_SERVER,
uploadContentType: UploadContentType.S3,
uploadMetadataType: UploadMetadataType.S3,
vwblNetworkUrl: 'https://vwbl.network',
awsConfig: {
region: 'ap-northeast-1',
idPoolId: 'ap-northeast-1:...',
cloudFrontUrl: 'https://xxx.cloudfront.net',
bucketName: {
metadata: 'vwbl-metadata',
content: 'vwbl-content',
},
},
})
Constructor Options
name | required | type | description |
---|---|---|---|
signer | true | WalletClient | web3 instance |
contractAddress | true | string | VWBL nft's contract address |
vwblNetworkUrl | true | string | VWBL network's url |
manageKeyType | false | ManageKeyType | how to manage key, you can choose from VWBL_NETWORK_SERVER VWBL_NETWORK_CONSORTIUM(not implemented yet) MY_SERVER(not implemented yet). |
uploadContentType | flase | UploadContentType | where to upload content, you can choose from S3 IPFS CUSTOM |
uploadMetadataType | flase | UploadMetadataType | where to upload content, you can choose from S3 IPFS CUSTOM |
awsConfig | true if you choose to upload content or metadata to S3 | AWSConfig | AWSConfig *1 |
ipfsNftStorageKey | true if you choose to upload content or metadata to IPFS | string | api key that given by nftstorage |
AWSConfig
name | required | type | description |
---|---|---|---|
region | true | string | AWS region |
idPoolId | true | string | idPoolId which has granted S3-put-object |
cloudFrontUrl | true | string | cloudFront url connect to s3 which is uploaded content |
bucketName | true | {content: string, metadata: string} | bucketName of metadata and content, it's ok they are same |
Signing is necessary before creating token or viewing contents.
await vwbl.sign()
await vwbl.managedCreateToken(
name,
description,
fileContent,
thumbnailContent,
0, // royaltiesPercentage
)
Arguments
name | required | type | description |
---|---|---|---|
name | true | string | ERC721 metadata name |
description | true | string | ERC721 metadata description |
plainFile | true | File | File[] | The data that only NFT owner can view |
thumbnailImage | true | File | ERC721 metadata image |
royaltiesPercentage | true | number | If the marketplace supports EIP2981, this percentage of the sale price will be paid to the NFT creator every time the NFT is sold or re-sold |
encryptLogic | false (default="base64") | EncryptLogic | "base64" or "binary". Selection criteria: "base64" -> sutable for small data. "binary" -> sutable for large data. |
uploadEncryptedFileCallback | true if uploadContentType is CUSTOM | UploadEncryptedFile | you can custom upload function |
uploadThumbnailCallback | true if uploadContentType is CUSTOM | UploadThumbnail | you can custom upload function |
uploadMetadataCallback | true if uploadMetadataType is CUSTOM | UploadMetadata | you can custom upload function |
gasSettings | false | GasSettings | you can custom gas settings |
const token = await vwbl.getTokenById(tokenId)