Operator

operator.setSigner

Set signer for write operation. For some secnarios, like frontend, we are not able to get the private key of the user, so we need to set signer for write operation.

Input:

NameTypeDescriptionrequired

signer

ethers.Signer

ethers.Signer object

true

Example:

communitiesidSDK.operator.setSigner(signer)

operator.getMintUserDIDPrice

Get the price of minting a user DID

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

options

object

mint options

false

options.brandDID

object

the brand DID object from searchBrandDID, if not pass it, the method will call searchBrandDID itself

false

Example:

const res = await operator.getMintUserDIDPrice('test.did')
const brandDID = await collector.searchBrandDID('did')
const res = await operator.getMintUserDIDPrice('test.did', { brandDID })

operator.mintUserDID

Mint a user DID (This is a write method, the generateSigner function of the chain which this user DID on is required)

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

mintTo

string

The address that you want mint this user DID to

true

options

MintUserDIDOptions

mint options

false

options.signature

string

The signature to mint user DID

false

options.owner

string

The owner in signature

false

options.mintPrice

BigNumber | number | string

The price to mint this brand DID, if you do not pass this, this function will get the price by itself

false

options.refundRecipient

string

If you passed higher value than mint price, the excees part will transfer to this wallet, default is address of signer

false

options.brandDID

BrandDID

The brand DID that this user DID belongs to, if you do not pass this, this function will get the brand DID by itself

false

options.txConfig

Object

The config for sending transaction

false

options.onTransactionCreated

(transaction: object) => any

The callback function when the transaction is created

false

Example:

const res = await operator.mintUserDID('test.did', '0x123456')

operator.getRenewUserDIDPrice

Get the price of renew a user DID

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

options

object

mint options

false

options.userDID

object

the user DID object from searchuserDID, if not pass it, the method will call searchuserDID itself

false

Example:

const res = await operator.getRenewUserDIDPrice('test.did')
const userDID = await collector.searchUserDID('test.did')
const res = await operator.getRenewUserDIDPrice('test.did', { userDID })

operator.renewUserDID

Mint a user DID (This is a write method, the generateSigner function of the chain which this user DID on is required)

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

options

RenewUserDIDOptions

renew options

false

options.mintPrice

BigNumber | number | string

The price to mint this brand DID, if you do not pass this, this function will get the price by itself

false

options.brandDID

BrandDID

The brand DID that this user DID belongs to, if you do not pass this, this function will get the brand DID by itself

false

options.userDID

UserDID

The user DID object that you want to renew, if you do not pass this, this function will get the brand DID by itself

false

options.refundRecipient

string

If you passed higher value than mint price, the excees part will transfer to this wallet, default is address of signer

false

options.txConfig

Object

The config for sending transaction

false

options.onTransactionCreated

(transaction: object) => any

The callback function when the transaction is created

false

Example:

const res = await operator.renewUserDID('test.did')

operator.burnUserDID

Burn a user DID (This is a write method, the generateSigner function of the chain which this user DID on is required)

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

options

BurnUserDIDOptions

burn options

false

options.brandDID

BrandDID

The brand DID that this user DID belongs to, if you do not pass this, this function will get the brand DID by itself

false

options.txConfig

Object

The config for sending transaction

false

options.onTransactionCreated

(transaction: object) => any

The callback function when the transaction is created

false

Example:

const res = await operator.burnUserDID('test.did')

operator.setAsPrimary

Set a user DID as primary (This is a write method, the generateSigner function of the chain which this user DID on is required)

Input:

NameTypeDescriptionrequired

name

string

The name of the user DID

true

options

object

setAsPrimary options

false

options.txConfig

Object

The config for sending transaction

false

options.onTransactionCreated

(transaction: object) => any

The callback function when the transaction is created

false

Example:

const res = await operator.setAsPrimary('test.did')

Last updated