curl --request POST \
--url https://api.lamarge.trade/v1/transfers/{id}/grouped \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reissue": false
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reissue: false})
};
fetch('https://api.lamarge.trade/v1/transfers/{id}/grouped', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lamarge.trade/v1/transfers/{id}/grouped"
payload = { "reissue": False }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"route": {
"state": "prepared",
"second_transfer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"first_take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"second_take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"commit_by": "2023-11-07T05:31:56Z"
},
"first": {
"take": {
"minimum_received": {
"token": "<string>",
"amount": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_take_id": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"taker_fee": "<string>",
"fills": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "taker",
"order_id": "<string>",
"sequence": 123,
"quote_index": 1,
"swap_id": "<string>",
"hashlock": "<string>",
"secret": "<string>",
"from_venue": "<string>",
"to_venue": "<string>",
"amount_out": "<string>",
"amount_in": "<string>",
"taker_fee": "<string>",
"taker_fee_bps": 50,
"taker_fee_venue": "<string>",
"maker_out": "<string>",
"maker_in": "<string>",
"payer": "<string>",
"maker_owner": "<string>",
"maker_recipient": "<string>",
"taker_recipient": "<string>",
"destination": "venue",
"received": {
"token": "<string>",
"amount": "<string>",
"sender": "<string>"
},
"payment_leg": "NONE",
"payment_destination": "venue",
"maker_destination": "venue",
"maker_leg": "NONE",
"state": "PREPARED",
"reason": "<string>",
"pay_by": "2023-11-07T05:31:56Z",
"t1": "2023-11-07T05:31:56Z",
"t2": "2023-11-07T05:31:56Z",
"deliver_by": "2023-11-07T05:31:56Z",
"report_by": "2023-11-07T05:31:56Z",
"delivery_to": "<string>",
"delivery_hash": "<string>",
"delivery_fee": "<string>",
"maker_accept_by": "2023-11-07T05:31:56Z",
"maker_accepted_at": "2023-11-07T05:31:56Z",
"payment_verified_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"settled_at": "2023-11-07T05:31:56Z",
"transactions": [
{
"kind": "fund",
"chain_id": 123,
"hash": "<string>",
"status": "pending",
"error": "<string>",
"at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue",
"signed_at": "2023-11-07T05:31:56Z",
"payment_locked_at": "2023-11-07T05:31:56Z",
"maker_claimed_at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue"
},
"to_sign": [
{
"kind": "margin_move",
"signer": "<string>",
"typed_data": {
"types": {},
"primaryType": "<string>",
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"message": {}
},
"fill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attestation": {
"signature": "<string>",
"terms": {
"take": "<string>",
"from": "<string>",
"to": "<string>",
"recipient": "<string>",
"token": "<string>",
"amountOut": "<string>",
"payBy": 123
}
}
}
],
"aster_reissue": true
},
"second": {
"take": {
"minimum_received": {
"token": "<string>",
"amount": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_take_id": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"taker_fee": "<string>",
"fills": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "taker",
"order_id": "<string>",
"sequence": 123,
"quote_index": 1,
"swap_id": "<string>",
"hashlock": "<string>",
"secret": "<string>",
"from_venue": "<string>",
"to_venue": "<string>",
"amount_out": "<string>",
"amount_in": "<string>",
"taker_fee": "<string>",
"taker_fee_bps": 50,
"taker_fee_venue": "<string>",
"maker_out": "<string>",
"maker_in": "<string>",
"payer": "<string>",
"maker_owner": "<string>",
"maker_recipient": "<string>",
"taker_recipient": "<string>",
"destination": "venue",
"received": {
"token": "<string>",
"amount": "<string>",
"sender": "<string>"
},
"payment_leg": "NONE",
"payment_destination": "venue",
"maker_destination": "venue",
"maker_leg": "NONE",
"state": "PREPARED",
"reason": "<string>",
"pay_by": "2023-11-07T05:31:56Z",
"t1": "2023-11-07T05:31:56Z",
"t2": "2023-11-07T05:31:56Z",
"deliver_by": "2023-11-07T05:31:56Z",
"report_by": "2023-11-07T05:31:56Z",
"delivery_to": "<string>",
"delivery_hash": "<string>",
"delivery_fee": "<string>",
"maker_accept_by": "2023-11-07T05:31:56Z",
"maker_accepted_at": "2023-11-07T05:31:56Z",
"payment_verified_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"settled_at": "2023-11-07T05:31:56Z",
"transactions": [
{
"kind": "fund",
"chain_id": 123,
"hash": "<string>",
"status": "pending",
"error": "<string>",
"at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue",
"signed_at": "2023-11-07T05:31:56Z",
"payment_locked_at": "2023-11-07T05:31:56Z",
"maker_claimed_at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue"
},
"to_sign": [
{
"kind": "margin_move",
"signer": "<string>",
"typed_data": {
"types": {},
"primaryType": "<string>",
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"message": {}
},
"fill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attestation": {
"signature": "<string>",
"terms": {
"take": "<string>",
"from": "<string>",
"to": "<string>",
"recipient": "<string>",
"token": "<string>",
"amountOut": "<string>",
"payBy": 123
}
}
}
],
"aster_reissue": true
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}Prepare a grouped route
For a route’s first transfer whose take is prepared and unsigned, paid from Lighter or Aster through an escrow venue: creates the second transfer and prepares its take, reserving nothing, paid from the available balance the first delivers into, with no withdrawal (grouped routes). For Aster, the first take is signed by commit_by: with reissue, its request is left as is, to issue again right before signing it last; without it, its nonce is dated 20 seconds after commit_by and it is sent only from 55 seconds before that nonce. Idempotent while prepared: a repeat returns the same requests and deadline, whatever it asks. STATE_CONFLICT with reason grouped_unavailable: the route cannot be grouped now (not eligible, the book or the accounts on the intermediate venue do not carry it, too little time left, or aborted); with grouped_route: another request is preparing this route.
curl --request POST \
--url https://api.lamarge.trade/v1/transfers/{id}/grouped \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reissue": false
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reissue: false})
};
fetch('https://api.lamarge.trade/v1/transfers/{id}/grouped', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.lamarge.trade/v1/transfers/{id}/grouped"
payload = { "reissue": False }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"route": {
"state": "prepared",
"second_transfer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"first_take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"second_take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"commit_by": "2023-11-07T05:31:56Z"
},
"first": {
"take": {
"minimum_received": {
"token": "<string>",
"amount": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_take_id": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"taker_fee": "<string>",
"fills": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "taker",
"order_id": "<string>",
"sequence": 123,
"quote_index": 1,
"swap_id": "<string>",
"hashlock": "<string>",
"secret": "<string>",
"from_venue": "<string>",
"to_venue": "<string>",
"amount_out": "<string>",
"amount_in": "<string>",
"taker_fee": "<string>",
"taker_fee_bps": 50,
"taker_fee_venue": "<string>",
"maker_out": "<string>",
"maker_in": "<string>",
"payer": "<string>",
"maker_owner": "<string>",
"maker_recipient": "<string>",
"taker_recipient": "<string>",
"destination": "venue",
"received": {
"token": "<string>",
"amount": "<string>",
"sender": "<string>"
},
"payment_leg": "NONE",
"payment_destination": "venue",
"maker_destination": "venue",
"maker_leg": "NONE",
"state": "PREPARED",
"reason": "<string>",
"pay_by": "2023-11-07T05:31:56Z",
"t1": "2023-11-07T05:31:56Z",
"t2": "2023-11-07T05:31:56Z",
"deliver_by": "2023-11-07T05:31:56Z",
"report_by": "2023-11-07T05:31:56Z",
"delivery_to": "<string>",
"delivery_hash": "<string>",
"delivery_fee": "<string>",
"maker_accept_by": "2023-11-07T05:31:56Z",
"maker_accepted_at": "2023-11-07T05:31:56Z",
"payment_verified_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"settled_at": "2023-11-07T05:31:56Z",
"transactions": [
{
"kind": "fund",
"chain_id": 123,
"hash": "<string>",
"status": "pending",
"error": "<string>",
"at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue",
"signed_at": "2023-11-07T05:31:56Z",
"payment_locked_at": "2023-11-07T05:31:56Z",
"maker_claimed_at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue"
},
"to_sign": [
{
"kind": "margin_move",
"signer": "<string>",
"typed_data": {
"types": {},
"primaryType": "<string>",
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"message": {}
},
"fill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attestation": {
"signature": "<string>",
"terms": {
"take": "<string>",
"from": "<string>",
"to": "<string>",
"recipient": "<string>",
"token": "<string>",
"amountOut": "<string>",
"payBy": 123
}
}
}
],
"aster_reissue": true
},
"second": {
"take": {
"minimum_received": {
"token": "<string>",
"amount": "<string>"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"client_take_id": "<string>",
"amount_in": "<string>",
"amount_out": "<string>",
"taker_fee": "<string>",
"fills": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "taker",
"order_id": "<string>",
"sequence": 123,
"quote_index": 1,
"swap_id": "<string>",
"hashlock": "<string>",
"secret": "<string>",
"from_venue": "<string>",
"to_venue": "<string>",
"amount_out": "<string>",
"amount_in": "<string>",
"taker_fee": "<string>",
"taker_fee_bps": 50,
"taker_fee_venue": "<string>",
"maker_out": "<string>",
"maker_in": "<string>",
"payer": "<string>",
"maker_owner": "<string>",
"maker_recipient": "<string>",
"taker_recipient": "<string>",
"destination": "venue",
"received": {
"token": "<string>",
"amount": "<string>",
"sender": "<string>"
},
"payment_leg": "NONE",
"payment_destination": "venue",
"maker_destination": "venue",
"maker_leg": "NONE",
"state": "PREPARED",
"reason": "<string>",
"pay_by": "2023-11-07T05:31:56Z",
"t1": "2023-11-07T05:31:56Z",
"t2": "2023-11-07T05:31:56Z",
"deliver_by": "2023-11-07T05:31:56Z",
"report_by": "2023-11-07T05:31:56Z",
"delivery_to": "<string>",
"delivery_hash": "<string>",
"delivery_fee": "<string>",
"maker_accept_by": "2023-11-07T05:31:56Z",
"maker_accepted_at": "2023-11-07T05:31:56Z",
"payment_verified_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"settled_at": "2023-11-07T05:31:56Z",
"transactions": [
{
"kind": "fund",
"chain_id": 123,
"hash": "<string>",
"status": "pending",
"error": "<string>",
"at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue",
"signed_at": "2023-11-07T05:31:56Z",
"payment_locked_at": "2023-11-07T05:31:56Z",
"maker_claimed_at": "2023-11-07T05:31:56Z"
}
],
"funding": "venue"
},
"to_sign": [
{
"kind": "margin_move",
"signer": "<string>",
"typed_data": {
"types": {},
"primaryType": "<string>",
"domain": {
"name": "<string>",
"chainId": 123,
"verifyingContract": "<string>",
"version": "<string>"
},
"message": {}
},
"fill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attestation": {
"signature": "<string>",
"terms": {
"take": "<string>",
"from": "<string>",
"to": "<string>",
"recipient": "<string>",
"token": "<string>",
"amountOut": "<string>",
"payBy": 123
}
}
}
],
"aster_reissue": true
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"reason": "<string>",
"venue": "<string>",
"step": "permit"
}
}Authorizations
Body
Response
The route and its two takes.
A route signed at once (grouped routes). prepared: its takes hold no maker inventory; commit before commit_by. committed: the operator reserves both inventories just before the first payment, then runs the route. aborted: never committed, its second take released. closed: committed, and nothing of it can move any more; what is left continues from continuable.
Show child attributes
Show child attributes