Skip to content

Prepare a v2 market order for the Ethos Everywhere wallet to sign

POST
/wallets/privy/markets-v2/orders
curl --request POST \
--url https://api.ethos.network/api/v2/wallets/privy/markets-v2/orders \
--header 'Content-Type: application/json' \
--cookie ethos-access-token=<ethos-access-token> \
--data '{ "clientOrderId": "example", "isPositive": true, "marketOnchainId": 1, "minOut": "example", "paymentAmount": "example", "positionTokenAmount": "example", "type": "buy" }'

Quotes the order, applies echo’s floor and order limits, and answers an intent that expires after 10 minutes. A sale answers the closePosition transaction; a buy answers EIP-2612 permit typed data, whose signature goes to the permit route. Echo sends nothing and sponsors no gas. > ⚠️ Warning: This is a beta endpoint. It is not guaranteed to be stable and may change or break without notice.

Media typeapplication/json
object
clientOrderId
required

The caller’s own id for the order. A repeat answers the same intent.

string
>= 1 characters <= 64 characters
isPositive
required
boolean
marketOnchainId
required
integer
> 0 <= 9007199254740991
minOut
required

The least the order accepts, in wei: position tokens a buy mints, or WHUF a sale returns. It can raise echo’s floor, never lower it; 0 leaves echo’s floor.

string
/^\d+$/
paymentAmount

WHUF to pay, in wei. Required when type is buy; refused when type is sell.

string
/^\d+$/
positionTokenAmount

Position tokens to sell, in wei. Required when type is sell; refused when type is buy.

string
/^\d+$/
type
required
string
Allowed values: buy sell

Successful response

Media typeapplication/json
One of:
object
chainId
required
number
expiresAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
floor
required

The floor the transaction carries, in wei: least position tokens a buy mints, least WHUF a sale returns.

string
intentId
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
quotedOut
required

Echo’s quote, in wei: position tokens a buy mints, or WHUF a sale returns, at prepare time.

string
permit
required

The EIP-2612 permit for the Ethos Everywhere wallet to sign. Its signature goes to the permit route.

object
domain
required
object
chainId
required
number
name
required
string
verifyingContract
required

Ethereum address (0x-prefixed, 20 bytes)

string
version
required
string
message
required
object
deadline
required
string
nonce
required
string
owner
required

Ethereum address (0x-prefixed, 20 bytes)

string
spender
required

Ethereum address (0x-prefixed, 20 bytes)

string
value
required
string
primaryType
required
string
Allowed value: Permit
types
required
object
Permit
required
Array<object>
object
name
required
string
type
required
string
transaction
required
null
type
required
string
Allowed value: buy

Example

{
"permit": {
"primaryType": "Permit"
},
"type": "buy"
}

Invalid input data

Media typeapplication/json
Invalid input data error (400)

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}

Authorization not provided

Media typeapplication/json
Authorization not provided error (401)

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}

Insufficient access

Media typeapplication/json
Insufficient access error (403)

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}

Internal server error

Media typeapplication/json
Internal server error error (500)

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}