Skip to main content

9. Wallet Lock Interface

Wallet Lock Interface


Lock Wallet

POST chain_tvm (Lock wallet)

Wallet locking is a self-operated action by the wallet owner, committing that received tokens will be released according to the locking rules.
Cannot be locked repeatedly. If already locked, the lock button should be grayed out.

Parameters
nametypedata typedescription
numsrequiredintToken quantity
beginrequiredintStart date
daysrequiredintLocked days
typerequiredintLock type (0 - daily release, 1 - release at maturity)
slicenorequiredintMetaspace number
Responses
http codecontent-typeresponse
0application/json{"txhash":"..."}

Response Fields:

  • txhash - Transaction hash
Example cURL
{
"jsonrpc": "3.0",
"method": "chain_tvm",
"params": ["opcode=token&subcode=lock&nums=123&begin=12345678&days=1&type=0&sliceno=0", "encryp=none"],
"id": "aa80aa0c6bb0c7d81ac7e5b3"
}
Response Example
{
"jsonrpc": "3.0",
"id": "aa80aa0c6bb0c7d81ac7e5b3",
"result": {
"ret": "0",
"err": "",
"content": {
"txhash": "0x6885997ca51fa08ffded573088b0c5c294652ec842ac7f3182d32e30ce261025"
}
}
}

Query Lock Information

POST chain_queryInfo (Query wallet lock information)

Wallet locking is a self-operated action by the wallet owner, committing that received tokens will be released according to the locking rules.

Parameters
nametypedata typedescription
addrrequiredstringQuery lock information of corresponding address
slicenorequiredintMetaspace number
Responses
http codecontent-typeresponse
0application/jsonLock details
Example cURL
{
"jsonrpc": "3.0",
"method": "chain_queryInfo",
"params": ["pubChainQuery","op=querylock&addr=0x...&sliceno=0","encryp=none"],
"id": "1"
}
Response Example
{
"jsonrpc": "3.0",
"id": "1",
"result": {
"ret": "0",
"err": "",
"content": {
"Addr": "0x35f4646842fc5fe208b7d3fab125c8542be88324",
"Nums": 10000000000,
"Begin": 1711036800,
"Days": 48,
"LType": 0
}
}
}

Field Description:

  • Addr - Locked address
  • Nums - Quantity (divide by 9 zeros, keep 2 decimal places)
  • Begin - Start date
  • Days - Number of days (UI can calculate the end date)
  • LType - Type (0 - linear release, 1 - release at maturity)

Unlock

POST chain_tvm (Unlock wallet)

Unlock can only be performed after the deadline.
Before submitting unlock: must check if the deadline has passed, otherwise directly return unlock failure information.
If the deadline has not passed, the unlock button should be grayed out.

Parameters
nametypedata typedescription
NoneN/AN/ANo parameters required
Responses
http codecontent-typeresponse
0application/json{"txhash":"..."}

Response Fields:

  • txhash - Transaction hash
Example cURL
{
"jsonrpc": "3.0",
"method": "chain_tvm",
"params": ["opcode=token&subcode=unlock", "encryp=none"],
"id": "aa80aa0c6bb0c7d81ac7e5b3"
}
Response Example
{
"jsonrpc": "3.0",
"id": "aa80aa0c6bb0c7d81ac7e5b3",
"result": {
"ret": "0",
"err": "",
"content": {
"txhash": "0x6885997ca51fa08ffded573088b0c5c294652ec842ac7f3182d32e30ce261025"
}
}
}