Stablecoin Chaincode Methods

The stablecoin chaincode includes all TypeScript methods that are available in the generic Token Taxonomy Framework chaincode and additional TypeScript methods that are specific to the stablecoin scenario.

Stablecoin Asset Methods

The stablecoin asset is based on the extended Token Taxonomy Framework standard, and supports all of the generic methods for that standard. For more information about the generic Token Taxonomy Framework methods, see Scaffolded TypeScript Project for Token Taxonomy Framework in Blockchain App Builder for Oracle Blockchain Platform.

Note:

In the stablecoin chaincode, the executeHoldTokens method behaves differently from the generic version. The stablecoin version of the method always completes the full hold amount, and does not support partial transfers.

Account Policy Check Methods

createAccountPolicyCheck
This method creates a policy for a specified account. This method can be called only by a Token Admin or Org Admin of the specified organization.
createAccountPolicyCheck(asset: AccountPolicyCheck)
Parameters:
  • asset: AccountPolicyCheck class – A class that defines account policy parameters, which includes the following fields:
    • accountPolicyId – The system generates this ID from the specified orgId and userId fields. You do not provide this field manually.
    • orgId – The membership service provider (MSP) ID of the user to create the policy for.
    • userId – The user name or email ID of the user to create the policy for.
    • kycCompliance – A Boolean value that indicates whether the account satisfies KYC (Know Your Customer) requirements.
    • amlCompliance – A Boolean value that indicates whether the account satisfies AML (Anti-Money Laundering) requirements.
    • riskScore – The risk score associated with the account, which is used for compliance evaluation.
    • restrictionFlag – A Boolean value that indicates whether the account is subject to restricted transfers. If set to true, only transfers within the lowest approval-policy threshold are allowed.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "02875ca9c6a7408da3f81156214228b91b09c4bb2b8026d7a5733b53598c6635",
        "payload": {
            "assetType": "AccountPolicyCheck",
            "accountPolicyId": "APID~CentralBank~cb__creator_demo",
            "orgId": "CentralBank",
            "userId": "cb__creator_demo",
            "kycCompliance": "true",
            "amlCompliance": "true",
            "riskScore": 1000,
            "restrictionFlag": "false"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 272
    }
}
getAccountPolicyCheckById
This method gets the account policy details for a specified policy ID. This method can be called only by a Token Admin or Token Auditor, or an Org Admin or Org Auditor of the specified organization.
getAccountPolicyCheckById(id: string)
Parameters:
  • id: string – The unique account policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "02875ca9c6a7408da3f81156214228b91b09c4bb2b8026d7a5733b53598c6635",
        "payload": {
            "assetType": "AccountPolicyCheck",
            "accountPolicyId": "APID~CentralBank~cb__creator_demo",
            "orgId": "CentralBank",
            "userId": "cb__creator_demo",
            "kycCompliance": "true",
            "amlCompliance": "true",
            "riskScore": 1000,
            "restrictionFlag": "false"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 272
    }
}
updateAccountPolicyCheck
This method updates the policy for a specified account. This method can be called only by a Token Admin or Org Admin of the specified organization.
updateAccountPolicyCheck(asset: AccountPolicyCheck)
Parameters:
  • asset: AccountPolicyCheck class – A class that defines account policy parameters, which includes the following fields:
    • accountPolicyId – The unique account policy ID.
    • orgId – The membership service provider (MSP) ID of the user to create the policy for.
    • userId – The user name or email ID of the user to create the policy for.
    • kycCompliance – A Boolean value that indicates whether the account satisfies KYC (Know Your Customer) requirements.
    • amlCompliance – A Boolean value that indicates whether the account satisfies AML (Anti-Money Laundering) requirements.
    • riskScore – The risk score associated with the account, which is used for compliance evaluation.
    • restrictionFlag – A Boolean value that indicates whether the account is subject to restricted transfers. If set to true, only transfers within the lowest approval-policy threshold are allowed.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "02875ca9c6a7408da3f81156214228b91b09c4bb2b8026d7a5733b53598c6635",
        "payload": {
            "assetType": "AccountPolicyCheck",
            "accountPolicyId": "APID~CentralBank~cb__creator_demo",
            "orgId": "CentralBank",
            "userId": "cb__creator_demo",
            "kycCompliance": "true",
            "amlCompliance": "true",
            "riskScore": 1000,
            "restrictionFlag": "true"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 272
    }
}
deleteAccountPolicyCheck
This method deletes the policy for a specified policy ID. This method can be called only by a Token Admin or Org Admin of the specified organization.
deleteAccountPolicyCheck(id: string)
Parameters:
  • id: string – The unique account policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "5499f49ae8595facbcbf56835bed9e6606875c0f54fd3cacb31a4104b56d3579",
        "payload": {
            "isValid": true,
            "message": "Successfully deleted asset with ID [APID~CentralBank~cb__creator_demo] from ledger"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 273
    }
}
getAccountPolicyCheckHistoryById
This method gets the complete account policy history for a specified policy ID. This method can be called only by a Token Admin or Token Auditor, or an Org Admin or Org Auditor of the specified organization.
getAccountPolicyCheckHistoryById(id: string)
Parameters:
  • id: string – The unique account policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "trxId": "dbfd34199bc5ea7224ca6c9976e30166dc859923ab044e595d0d42ad842eb471",
                "timeStamp": "2025-11-20T21:36:29.000Z",
                "value": {
                    "assetType": "AccountPolicyCheck",
                    "accountPolicyId": "APID~CentralBank~cb__creator_demo",
                    "orgId": "CentralBank",
                    "userId": "cb__creator_demo",
                    "kycCompliance": "true",
                    "amlCompliance": "true",
                    "riskScore": 1000,
                    "restrictionFlag": "true"
                }
            },
            {
                "trxId": "8b6951a4093f3bb79a489397878f9025ce4384c8973a0c4d0ec9c618667e8935",
                "timeStamp": "2025-11-20T21:35:34.000Z",
                "value": {
                    "assetType": "AccountPolicyCheck",
                    "accountPolicyId": "APID~CentralBank~cb__creator_demo",
                    "orgId": "CentralBank",
                    "userId": "cb__creator_demo",
                    "kycCompliance": "true",
                    "amlCompliance": "true",
                    "riskScore": 1000,
                    "restrictionFlag": "false"
                }
            },
            {
                "trxId": "5499f49ae8595facbcbf56835bed9e6606875c0f54fd3cacb31a4104b56d3579",
                "timeStamp": "2025-11-20T21:34:03.000Z",
                "value": "KEY DELETED"
            },
            {
                "trxId": "02875ca9c6a7408da3f81156214228b91b09c4bb2b8026d7a5733b53598c6635",
                "timeStamp": "2025-11-20T21:33:24.000Z",
                "value": {
                    "assetType": "AccountPolicyCheck",
                    "accountPolicyId": "APID~CentralBank~cb__creator_demo",
                    "orgId": "CentralBank",
                    "userId": "cb__creator_demo",
                    "kycCompliance": "true",
                    "amlCompliance": "true",
                    "riskScore": 1000,
                    "restrictionFlag": "false"
                }
            }
        ],
        "encode": "JSON"
    }
}
getAccountPolicyCheckByRange
This method gets all policy history for a specified range of policy IDs. This method can be called only by a Token Admin or Org Admin of the specified organization.
getAccountPolicyCheckByRange(startId: string, endId: string)
Parameters:
  • startId: string – The starting account policy ID of the range (inclusive).
  • endId: string – The ending account policy ID of the range (exclusive).
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "assetType": "AccountPolicyCheck",
                "accountPolicyId": "APID~CentralBank~cb__creator_demo",
                "orgId": "CentralBank",
                "userId": "cb__creator_demo",
                "kycCompliance": "true",
                "amlCompliance": "true",
                "riskScore": 1000,
                "restrictionFlag": "true"
            },
            {
                "assetType": "AccountPolicyCheck",
                "accountPolicyId": "APID~CentralBank~cb_issuer_demo",
                "orgId": "CentralBank",
                "userId": "cb_issuer_demo",
                "kycCompliance": "true",
                "amlCompliance": "true",
                "riskScore": 1000,
                "restrictionFlag": "false"
            }
        ],
        "encode": "JSON"
    }
}

Approval Policy Check Methods

createApprovalPolicyCheck
This method creates an approval policy. This method can be called only by a Token Admin.
createApprovalPolicyCheck(asset: ApprovalPolicyCheck)
Parameters:
  • asset: ApprovalPolicyCheck class – A class that defines approval rules for a transaction, which includes the following fields:
    • approvalPolicyId – The system generates this ID. You do not provide this field manually.
    • transactionLowerLimit – The minimum transaction amount the approval policy applies to.
    • transactionUpperLimit – The maximum transaction amount the approval policy applies to.
    • numberOfApprovalsRequired – The total number of approvals needed before the transaction can be completed.
    • approverDetails – A list of approvers along with their assigned approval sequence, which defines the mandatory order for approvals.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "3a5701ca90ffb98832421c7d5377eb9c0df9fdab30a0a3ce06216808bdea098e",
        "payload": {
            "status": "active",
            "assetType": "ApprovalPolicyCheck",
            "approvalPolicyId": "GPID~500~1000",
            "transactionLowerLimit": "500",
            "transactionUpperLimit": "1000",
            "numberOfApprovalsRequired": 2,
            "approverDetails": [
                {
                    "approverOrgId": "CentralBank",
                    "approverUserId": "manager",
                    "approvalSequence": 1
                },
                {
                    "approverOrgId": "CentralBank",
                    "approverUserId": "creator",
                    "approvalSequence": 2
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 284
    }
}
getApprovalPolicyCheckById
This method gets the approval policy details for a specified policy ID. This method can be called only by a Token Admin or Org Admin of the specified organization.
getApprovalPolicyCheckById(id: string)
Parameters:
  • id: string – The unique approval policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "assetType": "ApprovalPolicyCheck",
            "approvalPolicyId": "GPID~0~100",
            "transactionLowerLimit": "0",
            "transactionUpperLimit": "100",
            "numberOfApprovalsRequired": 0,
            "approverDetails": []
        },
        "encode": "JSON"
    }
}
updateApprovalPolicyCheck
This method updates the approval policy. This method can be called only by a Token Admin.
updateApprovalPolicyCheck(asset: ApprovalPolicyCheck)
Parameters:
  • asset: ApprovalPolicyCheck class – A class that defines approval rules for a transaction, which includes the following fields:
    • approvalPolicyId – The unique approval policy ID.
    • transactionLowerLimit – The minimum transaction amount the approval policy applies to.
    • transactionUpperLimit – The maximum transaction amount the approval policy applies to.
    • numberOfApprovalsRequired – The total number of approvals needed before the transaction can be completed.
    • approverDetails – A list of approvers along with their assigned approval sequence, which defines the mandatory order for approvals.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "ed1e1950fe02dbab74fa3aa7630b8dc6096e30aae5c81bab0dd22d5232c44fc9",
        "payload": {
            "status": "active",
            "assetType": "ApprovalPolicyCheck",
            "approvalPolicyId": "GPID~500~1000",
            "transactionLowerLimit": "500",
            "transactionUpperLimit": "1000",
            "numberOfApprovalsRequired": 1,
            "approverDetails": [
                {
                    "approverOrgId": "CentralBank",
                    "approverUserId": "manager",
                    "approvalSequence": 1
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20009",
        "blockNumber": 285
    }
}
deleteApprovalPolicyCheck
This method deletes the approval policy for a specified policy ID. This method can be called only by a Token Admin.
deleteApprovalPolicyCheck(id: string)
Parameters:
  • id: string – The unique approval policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "5ac54d3279a183022a00495aee3c25c2893388ff9aaaecd5c3b594edfa49ad8f",
        "payload": {
            "isValid": true,
            "message": "Successfully deleted asset with ID [GPID~500~1000] from ledger"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20009",
        "blockNumber": 286
    }
}
getApprovalPolicyCheckHistoryById
This method gets the complete approval policy history for a specified policy ID. This method can be called only by a Token Admin or Org Admin of the specified organization.
getApprovalPolicyCheckHistoryById(id: string)
Parameters:
  • id: string – The unique approval policy ID.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "trxId": "48f196c18869e871dc92ab880933ccc1c4dc402b9753ae6270e223646c177090",
                "timeStamp": "2025-11-21T09:30:04.000Z",
                "value": {
                    "assetType": "ApprovalPolicyCheck",
                    "approvalPolicyId": "GPID~0~100",
                    "transactionLowerLimit": "0",
                    "transactionUpperLimit": "100",
                    "numberOfApprovalsRequired": 0,
                    "approverDetails": []
                }
            }
        ],
        "encode": "JSON"
    }
}
getApprovalPolicyCheckByRange
This method gets all approval policy history for a specified range of policy IDs. This method can be called only by a Token Admin or Org Admin of the specified organization.
getApprovalPolicyCheckByRange(startId: string, endId: string)
Parameters:
  • startId: string – The starting approval policy ID of the range (inclusive).
  • endId: string – The ending approval policy ID of the range (exclusive).
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "assetType": "ApprovalPolicyCheck",
                "approvalPolicyId": "GPID~0~100",
                "transactionLowerLimit": "0",
                "transactionUpperLimit": "100",
                "numberOfApprovalsRequired": 0,
                "approverDetails": []
            },
            {
                "status": "active",
                "assetType": "ApprovalPolicyCheck",
                "approvalPolicyId": "GPID~500~1000",
                "transactionLowerLimit": "500",
                "transactionUpperLimit": "1000",
                "numberOfApprovalsRequired": 2,
                "approverDetails": [
                    {
                        "approverOrgId": "CentralBank",
                        "approverUserId": "manager",
                        "approvalSequence": 1
                    },
                    {
                        "approverOrgId": "CentralBank",
                        "approverUserId": "creator",
                        "approvalSequence": 2
                    }
                ]
            }
        ],
        "encode": "JSON"
    }
}

Approval Transactions Methods

getApprovalTransactionById
This method gets the approval transaction for a specified transaction ID. This method can be called only by a Token Admin or Org Admin of the specified organization.
getApprovalTransactionsById(id: string)
Parameters:
  • id: string – The system-generated ID of the approval transaction.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "assetType": "ApprovalTransactions",
            "approvalTransactionId": "hold1~oaccount~1cf5d40c7ea7b9dceedfc66292ab843c1583564c3ecaf9f5ceb11f834018b02f",
            "approvalOperationId": "hold1",
            "fromAccountId": "oaccount~374e4e762940fc185c7cd5b6528c7f94985b6c56acf46abb746de6381589edd2",
            "toAccountId": "oaccount~79c427e614530eacad6fb07cff6048f6b96283e65019301320c9684932846f64",
            "approverAccountId": "oaccount~1cf5d40c7ea7b9dceedfc66292ab843c1583564c3ecaf9f5ceb11f834018b02f",
            "totalApprovals": 1,
            "timestamp": "2025-11-21T12:32:43.000Z"
        },
        "encode": "JSON"
    }
}

Custom Methods

getApproverDetailsByTransferAmount
This method gets the approver details that are required for a given transfer amount. This method can be called only by a Token Admin or Token Auditor.
getApproverDetailsByTransferAmount(Amount: number)
Parameters:
  • amount: number – The transfer amount.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "5874105c14abd67e68cb4dacf82f2a2dca6cc9da4f5b27fcc91c83a60b7249e1",
        "payload": {
            "approverDetails": [
                {
                    "approverOrgId": "CentralBank",
                    "approverUserId": "manager",
                    "approvalSequence": 1
                },
                {
                    "approverOrgId": "CentralBank",
                    "approverUserId": "creator",
                    "approvalSequence": 2
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 292
    }
}
approveTransaction
An approver can use this method to approve a hold transaction.
approveTransaction(token_id: string, operation_id: string, quantity: number)
Parameters:
  • token_id: string – The ID of the token.
  • operation_id: string – A unique ID to identify the hold operation. Typically this ID is passed by the client application.
  • quantity: number – The number of on-hold tokens to approve for transfer.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "44685b0ff1b0ee72d57cb62900aae30638d65c82f264d5de7b28375732171702",
        "payload": {
            "assetType": "ApprovalTransactions",
            "approvalTransactionId": "hold1~oaccount~1cf5d40c7ea7b9dceedfc66292ab843c1583564c3ecaf9f5ceb11f834018b02f",
            "approvalOperationId": "hold1",
            "fromAccountId": "oaccount~374e4e762940fc185c7cd5b6528c7f94985b6c56acf46abb746de6381589edd2",
            "toAccountId": "oaccount~79c427e614530eacad6fb07cff6048f6b96283e65019301320c9684932846f64",
            "approverAccountId": "oaccount~1cf5d40c7ea7b9dceedfc66292ab843c1583564c3ecaf9f5ceb11f834018b02f",
            "totalApprovals": 1,
            "timestamp": "2025-11-21T12:32:43.000Z"
        },
        "encode": "JSON",
        "sourceURL": "centralbank-oabcs1-nrt.blockchain.ocp.example.com:20010",
        "blockNumber": 289
    }
}