Constructor
new Anchor(client, accessOptions)
Creates an instance of anchor api.
Parameters:
Name | Type | Description |
---|---|---|
client |
ApiClient | The Api client to use to connect with KAS. |
accessOptions |
AccessOptions | An instance of AccessOptions including |
Members
auth :string
Type:
- string
accessOptions :AccessOptions
Type:
accessKeyId :string
Type:
- string
secretAccessKey :string
Type:
- string
chainId :string
Type:
- string
apiInstances :object
Type:
- object
client :object
Type:
- object
anchorApi :DataAnchoringTransactionApi
Type:
operatorApi :OperatorApi
Type:
Methods
sendAnchoringData(operator, payload, callbackopt) → {AnchorBlockStatus}
Sends data to be anchored to the Klaytn blockchain platform.
POST /v1/anchor
Example
const data = { id: '891825', custom_field: 'This is test custom field for anchoring'}
const result = await caver.kas.anchor.sendAnchoringData('0xc8Aa073E2A924Fc469339Ff0cB2Ec4A7838888D0', data)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operator |
string | Operator address to send ChainDataAnchoring transaction. |
|
payload |
object | Data to be anchored to the Klaytn blockchain platform. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AnchorBlockStatus
getAnchoringTransactionList(operator, queryOptionsopt, callbackopt) → {AnchorTransactions}
Gets for anchoring transaction list generated by a specific operator.
GET /v1/operator/{operator-id}/tx
Example
const query = { fromTimestamp: 1501576981, toTimestamp: 1601876982, size: 3, cursor: '' }
const result = await caver.kas.anchor.getAnchoringTransactionList('0xc8Aa073E2A924Fc469339Ff0cB2Ec4A7838888D0', query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operator |
string | The address of the operator that anchored the data. |
|
queryOptions |
AnchorQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AnchorTransactions
getAnchoringTransactionByTxHash(operator, transactionHash, callbackopt) → {AnchorTransactionDetail}
Gets anchoring transaction generated by the transaction hash.
GET /v1/operator/{operator-id}/tx/{transaction-hash}
Example
const result = await caver.kas.anchor.getAnchoringTransactionByTxHash('0xc8Aa073E2A924Fc469339Ff0cB2Ec4A7838888D0', '0x9b67fb089d942af13db118932d62a605371978df754d1a97807df305d6a1a08f')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operator |
string | The address of the operator that anchored the data. |
|
transactionHash |
string | The transaction hash to query. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
getAnchoringTransactionByPayloadId(operator, payloadId, callbackopt) → {AnchorTransactionDetail}
Gets anchoring transaction generated by the payload id.
GET /v1/operator/{operator-id}/payload/{payload-id}
Example
const result = await caver.kas.anchor.getAnchoringTransactionByPayloadId('0xc8Aa073E2A924Fc469339Ff0cB2Ec4A7838888D0', '891825')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operator |
string | The address of the operator that anchored the data. |
|
payloadId |
string | The payload id to query. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
getOperatorList(queryOptionsopt, callbackopt) → {Operators}
Gets operator list.
GET /v1/operator
Example
const query = { fromTimestamp: 1501576981, toTimestamp: 1601876982, size: 3, cursor: 'eyJjcmV...' }
const result = await caver.kas.anchor.getOperatorList(query)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryOptions |
AnchorQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Operators
getOperator(operator, callbackopt) → {Operator}
Gets operator information.
GET /v1/operator/{operator-id}
Example
const result = await caver.kas.anchor.getOperator('0x371E04979132C23330eE777601C981453f7f542e')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operator |
string | The address of the operator. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Operator