Basic Query API
Introduction
When creating a HyMatrix instance, you can optionally pass debug, accid, signer, privateKey, arJWK, or even choose not to pass any parameters at all, and still use the basic query API.
For example:
const hyMatrix = new HyMatrix()
hyMatrix.info().then(console.log)
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
const messageId = 'vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig'
hyMatrix.getResult(messageId).then(console.log)
info
Retrieve basic information related to the HyMatrix network, such as Protocol (name), Variant (version), and Node (default node).
Example
const hyMatrix = new HyMatrix()
hyMatrix.info().then(console.log)
Return
{
"Protocol": "hymx",
"Variant": "v0.1.1",
"Join-Network": true,
"Token": "fHQbzw6acg2nqmCqzdr2GFaeoGzcRd0paVTD2kMGyU4",
"Registry": "O-0_O4TgYYnA4VHw2EtHR6NafN_ZRRlX0uxkbUMto6g",
"Node": {
"Acc-Id": "0x18b4bA4c118279b3eB60a2DB1E794Bc41AFC1D37",
"Name": "testMainNode",
"Role": "main",
"Desc": "first test node",
"URL": "https://hymatrix.ai"
}
}
More messages, please visit /info
getResult
Retrieve the corresponding result using the known messageId, processId.
Parameters
| Field | Required | Description |
|---|---|---|
| processId | YES | processId: The process address |
| messageId | YES | messageId: The id obtained after initiating the transaction |
Example
const hyMatrix = new HyMatrix()
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
const messageId = 'vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig'
hyMatrix.getResult(messageId).then(console.log)
Return
{
"Nonce": "14",
"Timestamp": "1753857762472",
"Item-Id": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig",
"From-Process": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8",
"Pushed-For": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig",
"Messages": [
{
"Sequence": "10",
"Target": "0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716",
"Data": "\u001b[90mYou transferred \u001b[34m100\u001b[90m to \u001b[32m_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo\u001b[0m",
"Tags": [
{
"name": "Data-Protocol",
"value": "ao"
},
{
"name": "Variant",
"value": "ao.TN.1"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Reference",
"value": "10"
},
{
"name": "Action",
"value": "Debit-Notice"
},
{
"name": "Quantity",
"value": "100"
},
{
"name": "Recipient",
"value": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo"
}
]
},
{
"Sequence": "11",
"Target": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo",
"Data": "\u001b[90mYou received \u001b[34m100\u001b[90m from \u001b[32m0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716\u001b[0m",
"Tags": [
{
"name": "Data-Protocol",
"value": "ao"
},
{
"name": "Variant",
"value": "ao.TN.1"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Reference",
"value": "11"
},
{
"name": "Sender",
"value": "0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716"
},
{
"name": "Action",
"value": "Credit-Notice"
},
{
"name": "Quantity",
"value": "100"
}
]
}
],
"Spawns": [],
"Assignmengts": null,
"Output": {
"data": "",
"print": true,
"prompt": "\u001b[32m\u001b[90m@\u001b[34maos-2.0.1\u001b[90m[Inbox:\u001b[31m\u001b[90m]\u001b[0m> "
},
"Data": "",
"Error": ""
}
More messages, please visit /getResult
getResults
Retrieve the corresponding list of result information using the known processId.
Parameters
| Query Field | Required | Description |
|---|---|---|
| processId | YES | processId: The process address |
| limit | YES | Number of results to query |
Example
const hyMatrix = new HyMatrix()
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
hyMatrix.getResults(processId, 10).then(console.log)
Return
{
"edges": [
{
"cursor": "eyJ0aW1lc3RhbXAiOjE3NTQwMjE2MTY1NTYsIm9yZGluYXRlIjoxOCwiY3JvbiI6IjEtMTAtbWludXRlcyIsInNvcnQiOiJBU0MifQ",
"node": {
"Nonce": "18",
"Timestamp": "1754021616556",
"Item-Id": "0UmV2VvVkWQncmXa1R2CjEXePmZCNCcV83DBSsD63ps",
"From-Process": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8",
"Pushed-For": "0UmV2VvVkWQncmXa1R2CjEXePmZCNCcV83DBSsD63ps",
"Messages": [
{
"Sequence": "17",
"Target": "0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716",
"Data": "\u001b[90mYou transferred \u001b[34m100\u001b[90m to \u001b[32m_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo\u001b[0m",
"Tags": [
{
"name": "Data-Protocol",
"value": "ao"
},
{
"name": "Variant",
"value": "ao.TN.1"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Reference",
"value": "17"
},
{
"name": "Action",
"value": "Debit-Notice"
},
{
"name": "Quantity",
"value": "100"
},
{
"name": "Recipient",
"value": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo"
}
]
},
{
"Sequence": "18",
"Target": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo",
"Data": "\u001b[90mYou received \u001b[34m100\u001b[90m from \u001b[32m0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716\u001b[0m",
"Tags": [
{
"name": "Data-Protocol",
"value": "ao"
},
{
"name": "Variant",
"value": "ao.TN.1"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Reference",
"value": "18"
},
{
"name": "Sender",
"value": "0xfc65E09Ef6674DdB4D8a6f3b6a6c8D9d55d67716"
},
{
"name": "Action",
"value": "Credit-Notice"
},
{
"name": "Quantity",
"value": "100"
}
]
}
],
"Spawns": [],
"Assignmengts": null,
"Output": {
"data": "",
"print": true,
"prompt": "\u001b[32m\u001b[90m@\u001b[34maos-2.0.1\u001b[90m[Inbox:\u001b[31m\u001b[90m]\u001b[0m> "
},
"Data": "",
"Error": ""
}
},
// ...
]
}
More messages, please visit /getResults
getMessage
Retrieve the corresponding Messages information using the known messageId.
Parameters
| Field | Required | Description |
|---|---|---|
| messageId | YES | messageId: The id obtained after initiating the transaction |
Example
const hyMatrix = new HyMatrix()
const messageId = 'vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig'
hyMatrix.getMessage(messageId).then(console.log)
Return
{
"signatureType": 3,
"signature": "ad21YuS8X3iZXcAyGJoFr0X6-FuHvR391LlxrY47J6sxCWeUtABfzuwWf4uRmhAVw-rbcZqyjo28ZPWe_9B9CRw",
"owner": "BBTIm0IztpJRvpiRLfiSxckjR-1e5BRfqFXcFdIs5uekXvJu7v5CME1ahX6uAXKJvYrMbIEVJ-LDnIYcwAe1aW4",
"target": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8",
"anchor": "",
"tags": [
{
"name": "SDK-Timestamp",
"value": "1753857761734"
},
{
"name": "Data-Protocol",
"value": "hymx"
},
{
"name": "Variant",
"value": "v0.1.0"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Action",
"value": "Transfer"
},
{
"name": "Recipient",
"value": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo"
},
{
"name": "Quantity",
"value": "100"
}
],
"data": "",
"id": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig",
"tagsBy": "DhpTREstVGltZXN0YW1wGjE3NTM4NTc3NjE3MzQaRGF0YS1Qcm90b2NvbAhoeW14DlZhcmlhbnQMdjAuMS4wCFR5cGUOTWVzc2FnZQxBY3Rpb24QVHJhbnNmZXISUmVjaXBpZW50Vl9xcmhwNF9jLWpsMUl3TEtjd2xER01DcXMzQng3M2VKZXB0QWhZTjl3Tm8QUXVhbnRpdHkGMTAwAA"
}
More messages, please visit /getMessage
getMessageByNonce
Retrieve the corresponding Messages information using the known processId and nonce.
Parameters
| Field | Required | Description |
|---|---|---|
| processId | YES | processId: The process address |
| nonce | YES | Random number from the transaction |
Example
const hyMatrix = new HyMatrix()
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
const nonce = 14
hyMatrix.getMessageByNonce(processId, nonce).then(console.log)
Return
{
"signatureType": 3,
"signature": "ad21YuS8X3iZXcAyGJoFr0X6-FuHvR391LlxrY47J6sxCWeUtABfzuwWf4uRmhAVw-rbcZqyjo28ZPWe_9B9CRw",
"owner": "BBTIm0IztpJRvpiRLfiSxckjR-1e5BRfqFXcFdIs5uekXvJu7v5CME1ahX6uAXKJvYrMbIEVJ-LDnIYcwAe1aW4",
"target": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8",
"anchor": "",
"tags": [
{
"name": "SDK-Timestamp",
"value": "1753857761734"
},
{
"name": "Data-Protocol",
"value": "hymx"
},
{
"name": "Variant",
"value": "v0.1.0"
},
{
"name": "Type",
"value": "Message"
},
{
"name": "Action",
"value": "Transfer"
},
{
"name": "Recipient",
"value": "_qrhp4_c-jl1IwLKcwlDGMCqs3Bx73eJeptAhYN9wNo"
},
{
"name": "Quantity",
"value": "100"
}
],
"data": "",
"id": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig",
"tagsBy": "DhpTREstVGltZXN0YW1wGjE3NTM4NTc3NjE3MzQaRGF0YS1Qcm90b2NvbAhoeW14DlZhcmlhbnQMdjAuMS4wCFR5cGUOTWVzc2FnZQxBY3Rpb24QVHJhbnNmZXISUmVjaXBpZW50Vl9xcmhwNF9jLWpsMUl3TEtjd2xER01DcXMzQng3M2VKZXB0QWhZTjl3Tm8QUXVhbnRpdHkGMTAwAA"
}
More messages, please visit /getMessageByNonce
getAssignByNonce
Retrieve the corresponding Assign list information using the known processId and nonce.
Parameters
| Field | Required | Description |
|---|---|---|
| processId | YES | processId: The process address |
| nonce | YES | Random number from the transaction |
Example
const hyMatrix = new HyMatrix()
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
const nonce = 14
hyMatrix.getAssignByNonce(processId, nonce).then(console.log)
Return
{
"signatureType": 3,
"signature": "6Jo8HM8mqv8YVb-lcFWf_W4_dUxFAYrf0f-P5Vsjqlp8Ie7Abh1D-bCxY0j6VwjmLtxGKMkNc_BpX2MPwEtvohs",
"owner": "BKhc8fzcrT9QVrWp4i6RTpke9C5vNb5XjJX18LgrnRzCYGDZcIXztIrR-0hBb_mzF3pjqfl4tMyJ_bGzAWKrqFs",
"target": "",
"anchor": "",
"tags": [
{
"name": "Data-Protocol",
"value": "hymx"
},
{
"name": "Variant",
"value": "v0.1.0"
},
{
"name": "Type",
"value": "Assignment"
},
{
"name": "Process",
"value": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8"
},
{
"name": "Message",
"value": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig"
},
{
"name": "Nonce",
"value": "14"
},
{
"name": "Timestamp",
"value": "1753857762468"
}
],
"data": "",
"id": "igsAKUQ0uGkm6f8o9hEAnQ2-fpEr1b3WpGXWtIwoFUM",
"tagsBy": "DhpEYXRhLVByb3RvY29sCGh5bXgOVmFyaWFudAx2MC4xLjAIVHlwZRRBc3NpZ25tZW50DlByb2Nlc3NWR3V1SDF3Q09CYXRHLUpvS3U0Mk5rSk1DN0N4LXJqRDhGNUVFSUNMVE5QOA5NZXNzYWdlVnZERG93RTNOck5LZkF5WnRmRUdhVExya09ocjNEREIyRF8tVnMyMlo4aWcKTm9uY2UEMTQSVGltZXN0YW1wGjE3NTM4NTc3NjI0NjgA"
}
More messages, please visit /getAssignByNonce
getAssignByMessage
Retrieve the corresponding Assign information using the known messageId.
Parameters
| Field | Required | Description |
|---|---|---|
| messageId | YES | messageId: The id obtained after initiating the transaction |
Example
const hyMatrix = new HyMatrix()
const messageId = 'vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig'
hyMatrix.getAssignByMessage(messageId).then(console.log)
Return
{
"signatureType": 3,
"signature": "6Jo8HM8mqv8YVb-lcFWf_W4_dUxFAYrf0f-P5Vsjqlp8Ie7Abh1D-bCxY0j6VwjmLtxGKMkNc_BpX2MPwEtvohs",
"owner": "BKhc8fzcrT9QVrWp4i6RTpke9C5vNb5XjJX18LgrnRzCYGDZcIXztIrR-0hBb_mzF3pjqfl4tMyJ_bGzAWKrqFs",
"target": "",
"anchor": "",
"tags": [
{
"name": "Data-Protocol",
"value": "hymx"
},
{
"name": "Variant",
"value": "v0.1.0"
},
{
"name": "Type",
"value": "Assignment"
},
{
"name": "Process",
"value": "GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8"
},
{
"name": "Message",
"value": "vDDowE3NrNKfAyZtfEGaTLrkOhr3DDB2D_-Vs22Z8ig"
},
{
"name": "Nonce",
"value": "14"
},
{
"name": "Timestamp",
"value": "1753857762468"
}
],
"data": "",
"id": "igsAKUQ0uGkm6f8o9hEAnQ2-fpEr1b3WpGXWtIwoFUM",
"tagsBy": "DhpEYXRhLVByb3RvY29sCGh5bXgOVmFyaWFudAx2MC4xLjAIVHlwZRRBc3NpZ25tZW50DlByb2Nlc3NWR3V1SDF3Q09CYXRHLUpvS3U0Mk5rSk1DN0N4LXJqRDhGNUVFSUNMVE5QOA5NZXNzYWdlVnZERG93RTNOck5LZkF5WnRmRUdhVExya09ocjNEREIyRF8tVnMyMlo4aWcKTm9uY2UEMTQSVGltZXN0YW1wGjE3NTM4NTc3NjI0NjgA"
}
More messages, please visit /getAssignByMessage
getNode
Query node information under an account.
Parameters
| Field | Required | Description |
|---|---|---|
| accid | NO | accid: User address |
Example
const accid = ''
const hyMatrix = new HyMatrix({
accid: accid,
debug: true
})
hyMatrix.getNode().then(console.log)
hyMatrix.getNode(accid).then(console.log)
Return
{
"Acc-Id": "0xCD1Ef67a57a7c03BFB05F175Be10e3eC79821138",
"Name": "permadao",
"Role": "follower",
"Desc": "permadao test node",
"URL": "https://hymx.permadao.io"
}
More messages, please visit /getNode
getNodes
Retrieve information of all nodes.
Example
const hyMatrix = new HyMatrix()
hyMatrix.getNodes().then(console.log)
Return
{
"0x18b4bA4c118279b3eB60a2DB1E794Bc41AFC1D37": {
"Acc-Id": "0x18b4bA4c118279b3eB60a2DB1E794Bc41AFC1D37",
"Name": "TestGenesisNode",
"Role": "main",
"Desc": "Test network genesis node",
"URL": "https://hymatrix.ai"
},
"0x1dc6e69897A650D28190a28C945B140455315acf": {
"Acc-Id": "0x1dc6e69897A650D28190a28C945B140455315acf",
"Name": "Arecotest",
"Role": "follower",
"Desc": "first test node",
"URL": "https://152.42.221.139:8080"
},
//...
}
More messages, please visit /getNodes
getNodesByProcess
Query node information for a specific process.
Parameters
| Field | Required | Description |
|---|---|---|
| processId | YES | processId: The process address |
Example
const hyMatrix = new HyMatrix()
const processId = 'GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8'
hyMatrix.getNodesByProcess(processId).then(console.log)
Return
[
{
"Acc-Id": "0xCD1Ef67a57a7c03BFB05F175Be10e3eC79821138",
"Name": "permadao",
"Role": "follower",
"Desc": "permadao test node",
"URL": "https://hymx.permadao.io"
},
//...
]
More messages, please visit /getNodesByProcess
getProcesses
Query all processes created under an account.
Parameters
| Query Field | Required | Description |
|---|---|---|
| accid | NO | accid: User address |
Example
const accid = ''
const hyMatrix = new HyMatrix({
accid: accid,
debug: true
})
hyMatrix.getProcesses().then(console.log)
hyMatrix.getProcesses(accid).then(console.log)
Return
[
"GuuH1wCOBatG-JoKu42NkJMC7Cx-rjD8F5EEICLTNP8",
//...
]
More messages, please visit /getProcesses
balanceOf
Query the balance under an account.
Parameters
| Field | Required | Description |
|---|---|---|
| accid | NO | accid: User address |
Example
const accid = ''
const hyMatrix = new HyMatrix({
accid: accid,
debug: true
})
hyMatrix.balanceOf().then(console.log)
hyMatrix.balanceOf(accid).then(console.log)
Return
"0"
More messages, please visit /balanceOf
stakeOf
Query the staked amount under an account.
Parameters
| Field | Required | Description |
|---|---|---|
| accid | NO | accid: User address |
Example
const accid = ''
const hyMatrix = new HyMatrix({
accid: accid,
debug: true
})
hyMatrix.stakeOf().then(console.log)
hyMatrix.stakeOf(accid).then(console.log)
Return
"0"