0.1.16 • Published 2 months ago

vwbl-sdk v0.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

VWBL SDK

npm version npm download License: MIT

official document

https://docs.vwbl-protocol.org

install

yarn add vwbl-sdk

api document

create instance

new VWBL({
  web3,
  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

namerequiredtypedescription
web3trueWeb3web3 instance
contractAddresstruestringVWBL nft's contract address
vwblNetworkUrltruestringVWBL network's url
manageKeyTypefalseManageKeyTypehow to manage key, you can choose from VWBL_NETWORK_SERVER VWBL_NETWORK_CONSORTIUM(not implemented yet) MY_SERVER(not implemented yet).
uploadContentTypeflaseUploadContentTypewhere to upload content, you can choose from S3 IPFS CUSTOM
uploadMetadataTypeflaseUploadMetadataTypewhere to upload content, you can choose from S3 IPFS CUSTOM
awsConfigtrue if you choose to upload content or metadata to S3AWSConfigAWSConfig *1
ipfsNftStorageKeytrue if you choose to upload content or metadata to IPFSstringapi key that given by nftstorage

AWSConfig

namerequiredtypedescription
regiontruestringAWS region
idPoolIdtruestringidPoolId which has granted S3-put-object
cloudFrontUrltruestringcloudFront url connect to s3 which is uploaded content
bucketNametrue{content: string, metadata: string}bucketName of metadata and content, it's ok they are same

sign to server

Signing is necessary before creating token or viewing contents.

await vwbl.sign();

create token

await vwbl.managedCreateToken(
  name,
  description,
  fileContent,
  thumbnailContent,
  0 // royaltiesPercentage
);

Arguments

namerequiredtypedescription
nametruestringERC721 metadata name
descriptiontruestringERC721 metadata description
plainFiletrueFile | File[]The data that only NFT owner can view
thumbnailImagetrueFileERC721 metadata image
royaltiesPercentagetruenumberIf 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
encryptLogicfalse (default="base64")EncryptLogic"base64" or "binary". Selection criteria: "base64" -> sutable for small data. "binary" -> sutable for large data.
uploadEncryptedFileCallbacktrue if uploadContentType is CUSTOMUploadEncryptedFileyou can custom upload function
uploadThumbnailCallbacktrue if uploadContentType is CUSTOMUploadThumbnailyou can custom upload function
uploadMetadataCallbacktrue if uploadMetadataType is CUSTOMUploadMetadatayou can custom upload function
gasSettingsfalseGasSettingsyou can custom gas settings

view contents ( get NFT metadata from given tokenId)

const token = await vwbl.getTokenById(tokenId);
0.1.16

2 months ago

0.1.15

2 months ago

0.1.14

2 months ago

0.1.13

2 months ago

0.1.12

5 months ago

0.1.11

6 months ago

0.1.10

8 months ago

0.1.8

12 months ago

0.1.9

11 months ago

0.1.7

12 months ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago