Creating the Withdrawal
A withdrawal transaction is created using the Create transaction request endpoint.
Request Breakdown
The details to be sent in this request are detailed below:
Field | Description |
---|---|
assetPoolId | The unique identifier of the asset pool. |
asset | The type of cryptocurrency asset. |
network | The blockchain network where the asset is hosted. |
reference | A unique reference for the transaction. |
destinations[] | An array containing the destination details for the withdrawal. |
destinations.address | The crypto address where the funds will be sent. |
destinations.amount | The amount of cryptocurrency to be sent to the address. |
destinations.asset | The type of cryptocurrency asset to be sent to the address, matching the address type. |
Example Request
Here is how an example request might look:
curl --location 'https://api.sandbox.layer1.com/digital/v1/transaction-requests' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"assetPoolId": "2be1cc9c-a5af-47e2-9dba-b7b82317e600",
"asset": "ETH",
"network": "ETHEREUM",
"reference": "myUniqueRef333",
"destinations": [
{
"address": "0x84A4a239805d06c685219801B82BEA7c76702214",
"amount": "0.001",
"asset": "ETH"
}
]
}'
Example Response
Upon successfully submitting the transaction request, you would get the the following responsin in JSON format:
{
"requestId": "018fef0a-ab15-7afb-966b-7d20c89b5504",
"asset": "ETH",
"assetPoolId": "2be1cc9c-a5af-47e2-9dba-b7b82317e600",
"network": "ETHEREUM",
"reference": "myUniqueRef333",
"status": "CREATED",
"sources": [],
"destinations": [
{
"address": "0x84A4a239805d06c685219801B82BEA7c76702214",
"amount": "0.001"
}
],
"type": "WITHDRAWAL",
"createdAt": "2024-06-06T19:33:24.885Z"
}
The resulting fields in the response are given as:
Field | Description |
---|---|
requestId | The unique identifier of the request. |
asset | The type of cryptocurrency asset. |
assetPoolId | The unique identifier of the asset pool. |
network | The blockchain network where the asset is hosted. |
reference | A unique reference for the transaction. |
status | The current status of the transaction. |
sources | An array containing the source details for the withdrawal. |
destinations | An array containing the destination details for the withdrawal. |
destinations.address | The crypto address where the funds will be sent. |
destinations.amount | The amount of cryptocurrency to be sent to the address. |
type | The type of transaction. |
createdAt | The timestamp when the transaction was created in ISO 8601 format. |
The withdrawal has now been actioned and will move throughout the flow described previously. the requestId can be used along with the Get transaction request endpoint to poll the withdrawal at any point.
At this point, the layer1 platform will start sending out webhooks related to the withdrwal, which will be covered in the next section.
Updated 5 months ago