KOR Protocol Developer Docs
  • KOR Protocol: Introduction
    • Overview
    • Partners
  • Overview of KOR SDK
    • Notable Features
    • Merits of using KOR SDK
    • Use Cases
  • SDK Reference
    • Introduction
    • SDK Installation
    • SDK Initialization
    • Client Methods
      • Asset
      • NFT
      • On-Chain IP
      • On-Chain License
      • Royalty Distribution
      • Conflict Management
    • Tutorials
      • Pre-requisites
      • Mint and Register in Own Collection
      • Mint in KOR Collection and Register
      • Register Existing Minted Token as IP
      • Launch 100-Song Album via IPFS
      • Launch 5-Song Album via AWS S3
      • Register Asset as Derivative
      • Update License Terms of Existing IP
      • Raise, resolve and cancel conflicts
      • Create a copy NFT of an IP
    • Releases
    • Deployed Smart Contracts
  • Essential Business Flows
  • Architecture
    • Overview
    • Event Listener
    • Modules
      • Asset Module
      • NFT Module
      • On-Chain IP Module
      • On-Chain License Module
      • Royalty Distribution Module
      • Conflict Management Module
  • Key Definitions
  • Community
Powered by GitBook
On this page
  • AssetClient
  • Steps to configure your own pinata API keys:
  • Steps to configure filebase API keys:
  • Methods
  • uploadAssetToIpfs
  • uploadAssetToIpfs
  • uploadMetaDataToIpfs
  • uploadMetaDataToIpfs
  • createBucket (Filebase function)
  • pinFolderToFilebaseIpfs (Filebase function)
  • uploadAssetToURL
  1. SDK Reference
  2. Client Methods

Asset

PreviousClient MethodsNextNFT

Last updated 5 months ago

AssetClient

The AssetClient simplifies the process of managing and storing asset metadata for your projects by providing a set of methods to handle file uploads to IPFS (InterPlanetary File System) and create buckets using IPFS providers.

When initializing the KOR SDK, a demo API key is provided by default to allow developers to explore and test its functionalities. However, there are certain limitations when using this demo key:

Demo API Key Limitations

  • File Upload Limit: You can upload a maximum of 5 files using the demo API key.

  • File Size Restriction: The total size of all uploaded files is capped at 50 MB.

To bypass these restrictions for production-level use cases, you need to configure your own API keys for Pinata or Filebase.

Steps to configure your own pinata API keys:

Step 1: Create API Key

Step 2: Copy JWT (secret access token)

Step 3: Paste it in your profile dashboard

Steps to configure filebase API keys:

Step 1: Go to filebase console and then go to access keys Step 2: Copy Key and Secret

Step 3: Paste it in your profile dashboard

Methods

  • uploadAssetToIpfs

  • uploadMetaDataToIpfs

  • createBucket

  • pinFolderToFilebaseIpfs

  • uploadAssetToUrl

uploadAssetToIpfs

Uploads a file to IPFS and returns the CID (Content Identifier).

Method
Type

uploadAssetToIpfs

(file, provider, options) => Promise<UploadAssetResponse>

Parameters

Name
Type
Description

file

File

The file to be uploaded to IPFS

provider

'pinata' | 'filebase'

The ipfs service provider to upload and pin files

options

Object

Configuration for the bucket and folder name where the file will be upload (for filebase operations only) Eg: { folderName: 'my-folder', bucketName: 'my-bucket' }

Returns

Name
Type
Description

ipfsHash

string

The CID of the uploaded data

uploadAssetToIpfs

Uploads a folder containing multiple files to IPFS and returns the base CID.

Method
Type

uploadAssetToIpfs

(files, provider, options) => Promise<{ipfsHash: string}>

Parameters

Name
Type
Description

file

File

A list of files to be uploaded to IPFS.

provider

'pinata' | 'filebase'

The IPFS service provider to upload and pin files.

options

Object

Configuration for the bucket and folder name where the files will be uploaded. (for filebase operations only) Eg: { folderName: 'my-folder', bucketName: 'my-bucket' }

Returns

Name
Type
Description

ipfsHash

string

The CID of the uploaded data

uploadMetaDataToIpfs

Uploads a metadata JSON file to IPFS and returns the CID.

Method
Type

uploadMetaDataToIpfs

(metaData, provider, options) => Promise<{metaDataHash: string}>

Parameters

Name
Type
Description

metaData

Object

The metadata JSON to be uploaded to IPFS.

provider

'pinata' | 'filebase'

The IPFS service provider to upload and pin files.

options

Object

Configuration for the bucket and folder name where the files will be uploaded. (for filebase operations only)

Returns

Name
Type
Description

metaDataHash

string

The CID of the uploaded data

uploadMetaDataToIpfs

Uploads an array of metadata JSON files to IPFS and returns the base CID.

Method
Type

uploadMetaDataToIpfs

(metaData, provider, options) => Promise<{metaDataHash: string}>

Parameters

Name
Type
Description

metaData

Object

The metadata JSON to be uploaded to IPFS.

provider

'pinata' | 'filebase'

The IPFS service provider to upload and pin files.

options

Object

Configuration for the bucket and folder name where the files will be uploaded. (for filebase operations only)

Returns

Name
Type
Description

metaDataHash

string

The CID of the uploaded data

createBucket (Filebase function)

Creates a bucket on the Filebase IPFS provider.

Method
Type

createBucket

(bucketName: string) => Promise<void>

Parameters

Name
Type
Description

bucketName

string

The name of the bucket to be created.

pinFolderToFilebaseIpfs (Filebase function)

Generates an IPFS CID and pins all files inside a bucket as a folder to IPFS.

Method
Type

pinFolderToFilebaseIpfs

(bucketName: string) => Promise<{ipfsHash: string}>

Parameters

Name
Type
Description

bucketName

string

The name of the bucket for which to generate the CID.

Returns

Name
Type
Description

ipfsHash

string

The CID of the uploaded data

uploadAssetToURL

Upload asset to custom BE like S3

Method
Type

uploadAssetToURL

(file: File, url: string) => Promise<string>

Parameters

Name
Type
Description

file

File

The file object representing the uploaded file.

url

string

The destination URL for file upload, such as a presigned URL where the file can be directly uploaded.

  • file: File: The file object representing the uploaded file.

  • url: string: The destination URL for file upload, such as a presigned URL where the file can be directly uploaded.

Returns

Name
Type
Description

response

string

The url of the uploaded file