API Reference

All APIs take a callback function as a parameter and execute the callBackFunc after the corresponding method is successfully executed.

The callback function type that takes an optional parameter responseData and returns a Promise object. When the API call returns, the callback function is called with the responseData parameter, which is the data returned from the API call. The callback function can then process the data and handle any errors that occurred during the API call.

CallBackFunc

type CallBackFunc =  ( responseData?:any ) => Promise<any>;

Methods

Workflow API

Platform data API

connect

connect is used for handling login functionality for nulink web agent. It opens a new window for the user to complete the login process, and then executes the callBackFunc with the login data when the login is successful.

Parameters

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server.

Returns

Example

uploadData

uploadDataused for uploading data and executing a callback function after the upload is successful

Parameters

  • _uploadData: UploadData - The type UploadData is defined as an object with properties dataLabel of type string and fileBinaryArrayBuffer of type Blob

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server

Returns

Example

uploadDataBatch

uploadDataBatch allows batch uploading of data and executes a callback function after the upload is successful

Parameters

  • dataList: UploadData[] - an array of UploadData objects

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server

Returns

Example

uploadFile

uploadFile uploading file and executing a callback function after the upload is successful

Parameters

  • file : File - the file to be uploaded, of type File

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server

Returns

Example

uploadFileBatch

uploadFileBatch allows batch uploading of file and executes a callback function after the upload is successful

Parameters

  • files: File[] - the files to be uploaded, an array of File

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server

Returns

Example

apply

apply The apply function is used for applying for files, takes eight parameters: dataCreatorAddress,dataId,dataName,dataStorageUrl, dataHash,zkProof,usageDays and callBackFunc, which is the callback function to be executed after the application is successful.

Parameters

  • dataName : string - The data name

  • dataId : string - The data id

  • dataCreatorAddress : string - The data creator Address

  • dataUrl : string - The data storage url

  • dataHash : string - The data hash

  • zkProof : string - The data zkProof

  • usageDays : number - The number of days applied

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server.

The parameters in the apply API can be obtained from the response of the getFileList getFileDetail

Returns

Example

approve

approveis used for approving files, takes parameters: applyId, applyUserAddress, applyUserId, dataName, dataHash, dataUrl, days, backupNodeNum and callBackFunc.

Parameters

  • applyId : string - the application ID

  • applyUserId : string - the application user id

  • applyUserAddress : string - the application user address

  • dataName : string - The data name

  • dataUrl : string - The data storage url

  • dataHash : string - The data hash

  • days : string - the application days

  • backupNodeNum : number - number of nodes used for data backup, this number is the response of getUrsulaNumber API

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server.

Returns

Example

download

The dataDownload API provides the function of downloading files.

Parameters

  • dataId : string - The ID of the data to be downloaded

  • dataName : string - The name of the data to be downloaded

  • dataHash : string - The hash of the data to be downloaded

  • ownerAddress : string - The owner of the data

  • zkProof : string - The zk proof of the data

  • dataUrl : string - The data storage url

  • encryptedDataSize - The size of encrypted data

  • Promise : CallBackFunc - A callback function that will be called with the response data from the server.

Returns

Example

getFileList

Get the list of files belonging to other users.

Parameters

  • accountId : string - ID of the currently logged-in user

  • fileName : string - File name, supports fuzzy matching, can be empty.

  • include : boolean - If include=false, exclude the files belonging to the current account; otherwise, the files belonging to the current user will be placed at the beginning of the list.

  • format : string - the format of file,can be empty.

  • desc : boolean - Whether to sort in descending order by upload time

  • pageNum : number - page number (starting from 1)

  • pageSize : number - page size

Returns

Example

getFileDetail

get file details

Parameters

  • fileId : string - the file id

  • fileUserAccountId : string - The file user's account ID, which refers to the current user's account ID.

Returns

Example

getSendApplyFiles

Function to fetch send application files

Parameters

  • proposerId: string - Applicant's account ID

  • status: number - Application status 0:no distinction, 1: applying, 2: approved, 3: rejected, 4: in progress, 5: expired

  • pageNum: number - the page number

  • pageSize: number - the page size

Returns

Example

getIncomingApplyFiles

Function to fetch the received application files

Parameters

  • fileOwnerId: string - File owner's account ID

  • status: number - Application status 0:no distinction, 1: applying, 2: approved, 3: rejected, 4: in progress, 5: expired

  • pageNum: number - the page number

  • pageSize: number - the page size

Returns

Example

getUrsulaNumber

Function to fetch the backup nodes number of ursula

Parameters

Returns

Example

getNetWorkChainId

Function to get the network info

Parameters

None

Returns

Example

setNetWorkChainId

Function to get the network info

Parameters

Returns

None

Example

sendCustomTransaction

send custom transaction by agent website

Parameters

  • Promise: CallBackFunc - A callback function that will be called with the response data from the server.

  • toAddress: string - The recevier of the transaction.

  • rawTxData?: string - The call data of the transaction, can be empty for simple value transfers.

  • value?: string - The value of the transaction in wei.

  • gasPrice?: string - The gas price (wei) set by this transaction, if empty, it will use web3.eth.getGasPrice()

Returns

Example

Last updated

Was this helpful?