Venly API
Search
K

How to save a transaction or signature request and sign it later?

This guide explains how you can create transaction and signature requests and sign/execute them at a later stage. This can be used, for example, when you want to make the confirmation of the transaction/signature request details and the signing/execution a two-step process for the end user.

How to save and sign a signature request?

To do that, you can use the endpoint: POST /api/signatures

Endpoint

post
https://api-wallet.venly.io
/api/signatures
Requires Authority: sign:wallets

Request Body

Field
Type
Mandatory
Description
pincode
String
The PIN code of the wallet that needs to sign for this request.
status
String
The status of the request - SAVED or READY.
type
String
MESSAGE or EIP712
secretType
String
The blockchain network name.
walletId
String
The ID of the wallet you're creating the request for.
data
String
The data that is to be signed.
If you want to create and save a signature request that is going to be signed at a later stage, you have two options:
  • enter status = SAVED - this will create and save the signature request. At this point, it won’t have an expiration time. To later get the previously saved signature requests, you can use GET /api/signatures and filter by status = SAVED
  • enter status = READY - this will create and save the signature request but indicate that it should be signed soon. It will have an expiration time calculated (5 mins). To get the previously saved signature requests, you can:
    • use GET /api/signatures and filter by status = SAVED
    • use GET /api/signables - it will return all signature or transaction requests with status = READY
If you want to create a signature request and sign it immediately, you should enter status = READY AND provide a pincode. The signature request will be signed and the signature can be verified through POST /api/signatures/verification.
If you have created a signature request with status = SAVED, you need to first confirm it (change status to READY), if you want to sign it. Only READY signature requests can be signed. This can be done through POST /api/signatures/{id}/confirm
Once you make the call with a saved signature request, its status will automatically change to READY.
The last step is to sign the READY signature request. This can be done through POST /api/signatures/{id}/sign.
That's it! Now the request is signed and you can verify the signature through POST /api/signatures/verification.

How to save and execute a transaction?

To do that, you can use the endpoint: POST /api/transactions
post
https://api-wallet.venly.io
/api/transactions
Requires one of the Authorities: save:transaction, sign:wallets

Request Body

Field
Type
Mandatory
Description
pincode
String
The PIN code of the wallet that needs to sign for this request.
status
String
The status of the request - SAVED or READY.
type
String
The type of the transaction.
secretType
String
The blockchain network name.
walletId
String
The ID of the wallet you're creating the request for.
to
String
Destination Address (can be a blockchain address or email address)
value
String
No
The amount you want to transfer.
chainSpecificFields
Object
No
chainSpecificFields object
If you want to create and save a transaction request that is going to be executed at a later stage, you have two options:
  • enter status = SAVED - this will create and save the transaction request. At this point, it won’t have an expiration time. To later get the previously saved transaction requests, you can use GET /transactions.
  • enter status = READY - this will create and save the transaction request but indicate that it should be signed soon. It will have an expiration time and gas fees will be calculated, if not explicitly specified. To get the previously saved transaction requests with status = READY, you can:
    • use GET /transactions
    • use GET /signables - it will return all signature or transaction requests with status = READY
If you want to create a transaction request and sign it immediately, you should enter status = READY AND provide a pincode. The transaction request will be executed on-chain. If gas fees and nonce are not explicitly specified, they will be calculated automatically.
If you have created a transaction request with status = SAVED, you need to first confirm it (change status to READY), if you want to execute it. Only READY transaction requests can be executed. This can be done through POST /api/transactions/{id}/confirm
Once you make the call with a saved transaction request, its status will automatically change to READY.
The last step is to execute the READY transaction request. This can be done through POST /api/transactions/{id}/execute.
That's it! Now the request is submitted on-chain. You can track its status through GET /api/transactions/{id}.