Transaction Requests API
TransactionRequest
s are off-chain requests for all sorts of blockchain transactions before they are sent to the blockchain.
Typically, a transaction request is created when a user wants to perform a transaction on the blockchain. The transaction request will then be validated against the wallet's existing policies, and then sent to the wallet's approval quorum for approval. Once the transaction request is approved, the transaction needs to be signed by the wallet's final approver before it is sent to the blockchain.
Refer to the Transaction Request Workflow for more information on the transaction request status
es and its lifecycle.
Create
Native Token Transfer
You can create a transaction request to transfer a native token using the following GraphQL mutation with the CreateTransactionRequestInput
input. It requires the orgId
, walletId
and transactionData
as inputs. The walletId
is the walletId
of the wallet that you should have received using the CreateWallet
mutation.
mutation CreateTransactionRequest($input: CreateTransactionRequestInput!) {
createTransactionRequest(input: $input) {
requestId
walletId
networkAssetId
createdAt
updatedAt
summaryEvm {
data
value
}
asset {
identifier
name
decimals
isNative
}
initiator {
userId
user {
email
}
}
status
}
}
{
"variables": {
"input": {
"walletId": "8b7a9f2d-194b-4e9b-a0f5-d500b9a0201a",
"transactionData": {
"simpleMultiSig": {
"destination": "0x55debd6128bb2fde649b50752a60e1e3452b6304",
"value": "1000000000000000000",
"data": "0x",
"gasLimit": "21000"
}
}
}
}
}
{
"data": {
"createTransactionRequest": {
"requestId": "ef3e6424-abd4-479a-87f7-58f190042574",
"walletId": "8b7a9f2d-194b-4e9b-a0f5-d500b9a0201a",
"networkAssetId": null,
"createdAt": "2023-10-11T07:59:27.174Z",
"updatedAt": "2023-10-11T07:59:27.174Z",
"summaryEvm": {
"data": "0x",
"value": "1000000000000000000"
},
"asset": null,
"initiator": {
"userId": "456cdf24-155c-4ad3-b767-474879f2e2e8",
"user": {
"email": "[email protected]"
}
},
"status": "PENDING_APPROVALS"
}
}
}
ERC-20 Token Transfer
For ERC-20 token transfers on EVM-compatible blockchains, you have to first build the transaction using the buildTransaction
object with BuildTransactionInput
.
query BuildERC20Transaction($walletId: ID!, $input: BuildTransactionInput!) {
wallet(walletId: $walletId) {
buildTransaction(input: $input)
}
}
{
"walletId": "8b7a9f2d-194b-4e9b-a0f5-d500b9a0201a",
"input": {
"to": "0x411eF10562689735dE42b1c8287FFA1Bd59D40f6",
"asset": "caip19:eip155:5/erc20:0x65afadd39029741b3b8f0756952c74678c9cec93",
"amount": 10,
"feeLevel": "low"
}
}
{
"data": {
"wallet": {
"buildTransaction": {
"simpleMultiSig": {
"destination": "0x65afadd39029741b3b8f0756952c74678c9cec93",
"value": "0",
"data": "0xa9059cbb000000000000000000000000411ef10562689735de42b1c8287ffa1bd59d40f60000000000000000000000000000000000000000000000000000000000989680",
"gasLimit": "34546"
}
}
}
}
}
You must then use the buildTransaction
response to create a transaction request using the CreateTransactionRequest
mutation, similar to how you can create a native token transfer.
mutation CreateTransactionRequest($input: CreateTransactionRequestInput!) {
createTransactionRequest(input: $input) {
requestId
walletId
networkAssetId
createdAt
updatedAt
summaryEvm {
data
value
}
asset {
identifier
name
decimals
isNative
}
initiator {
userId
user {
email
}
}
status
}
}
{
"variables": {
"input": {
"walletId": "8b7a9f2d-194b-4e9b-a0f5-d500b9a0201a",
"transactionData": {
"simpleMultiSig": {
"destination": "0x65afadd39029741b3b8f0756952c74678c9cec93",
"value": "0",
"data": "0xa9059cbb000000000000000000000000411ef10562689735de42b1c8287ffa1bd59d40f60000000000000000000000000000000000000000000000000000000000989680",
"gasLimit": "34546"
}
}
}
}
}
{
"data": {
"createTransactionRequest": {
"requestId": "15119226-64e8-4475-ad7e-9d775e441997",
"walletId": "8b7a9f2d-194b-4e9b-a0f5-d500b9a0201a",
"networkAssetId": null,
"createdAt": "2023-10-11T08:02:35.475Z",
"updatedAt": "2023-10-11T08:02:35.475Z",
"summaryEvm": {
"data": "0xa9059cbb000000000000000000000000411ef10562689735de42b1c8287ffa1bd59d40f60000000000000000000000000000000000000000000000000000000000989680",
"value": "0"
},
"asset": null,
"initiator": {
"userId": "456cdf24-155c-4ad3-b767-474879f2e2e8",
"user": {
"email": "[email protected]"
}
},
"status": "PENDING_APPROVALS"
}
}
}
TRC-20 Token Transfers
We are currently working on the following feature. You will soon be able to easily create token transfers programmatically.
Retrieve
By Transaction Request ID
You can retrieve a transaction request using the following GraphQL query with the TransactionRequest
object. It requires the walletId
and transactionRequestId
as an input and returns details related to the specified transaction request.
query TransactionRequestById($walletId: ID!, $transactionRequestId: ID!) {
wallet(walletId: $walletId) {
transactionRequest(requestId: $transactionRequestId) {
requestId
transactionHash
summaryEvm {
data
value
}
asset {
name
decimals
isNative
}
initiator {
user {
email
firstName
lastName
}
}
approvals {
edges {
node {
actor {
user {
email
firstName
lastName
}
}
}
}
}
transactionSignature
transactionSigned
status
}
}
}
{
"variables": {
"walletId": "d628e653-becd-412d-bdef-dbab620631d9",
"transactionRequestId": "f33e01d2-25e9-4f63-9e61-788ae20df7c3"
}
}
{
"data": {
"wallet": {
"transactionRequest": {
"requestId": "f33e01d2-25e9-4f63-9e61-788ae20df7c3",
"transactionHash": "0x5c386f2c2cdc9d55d73ce96b9a5b929ea1693cddad4b5500b13a214a9c9b2b52",
"summaryEvm": {
"data": "0x",
"value": "150000000000000"
},
"asset": {
"name": "Sepolia Uniswap",
"decimals": 18,
"isNative": false
},
"initiator": {
"user": {
"email": "[email protected]",
"firstName": "API Initiator",
"lastName": "Service Account"
}
},
"approvals": {
"edges": [
{
"node": {
"actor": {
"user": {
"email": "[email protected]",
"firstName": "API Approver",
"lastName": "Service Account"
}
}
}
}
]
},
"transactionSignature": "0xad56808e1dae318db5e48c9efc85b913cb29ad8f1d9d5b3e32a5228d1df314c35f579924e8c5330ff531728121eadfc6cda5999f0e7aa77520886b8cdce25e531b5c42986377c38755633a7c2e61ae2363f5f9d72ae8e2ec931ed9c82dbfb6b9bb092421103538bb7d506d47c82b3cfe4113976612779c8b2257ae90ac39ddbcb91b",
"transactionSigned": "0x02f9021383aa36a7038459682f008459682f8e82f75d946886c0a002c3de06481330adb9e25e76d5bf2d2e80b901a460b4cda700000000000000000000000000000000000000000000000000000000000000c00000000000000000000000008d080e0d0ff69f5801dd3c4f628fb72f595a1bd00000000000000000000000000000000000000000000000000000886c98b760000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000a060029846886406d05bb5df82d417c4200ac90000000000000000000000000000000000000000000000000000000000000052080000000000000000000000000000000000000000000000000000000000000082ad56808e1dae318db5e48c9efc85b913cb29ad8f1d9d5b3e32a5228d1df314c35f579924e8c5330ff531728121eadfc6cda5999f0e7aa77520886b8cdce25e531b5c42986377c38755633a7c2e61ae2363f5f9d72ae8e2ec931ed9c82dbfb6b9bb092421103538bb7d506d47c82b3cfe4113976612779c8b2257ae90ac39ddbcb91b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c001a00c0d39743ee31ea6c9a1a792966dcbf263732ba563de891d22b3f6cf57e9492ea003dca15020c2337e55c4b3ead1ba91f867af7cc20fe0060a49e312d37db68ade",
"status": "SIGNED"
}
}
}
}