mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
OP-2818 [Swap] Show order route path and benefits in Swap UI
Updated SwapInfo schemas for WS and REST.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.15.21",
|
||||
"version": "0.15.22-rc.0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -20,6 +20,20 @@ const swapInfoBase = z.object({
|
||||
minAmountOut: z.number(),
|
||||
minAmountIn: z.number(),
|
||||
marketPrice: z.number().nullable(), // spending asset market price
|
||||
alternatives: z.object({ // execution alternatives
|
||||
exchanges: z.string().array(),
|
||||
path: z.object({
|
||||
units: z.object({
|
||||
assetPair: z.string(),
|
||||
action: z.string(),
|
||||
}).array(),
|
||||
}),
|
||||
marketAmountOut: z.number().nullable(),
|
||||
marketAmountIn: z.number().nullable(),
|
||||
marketPrice: z.number(),
|
||||
availableAmountIn: z.number().nullable(),
|
||||
availableAmountOut: z.number().nullable(),
|
||||
}).array(),
|
||||
});
|
||||
|
||||
const swapInfoByAmountIn = swapInfoBase.extend({
|
||||
|
||||
@@ -22,6 +22,15 @@ const swapInfoSchemaBase = baseMessageSchema.extend({
|
||||
a: z.number(), // amount
|
||||
sp: z.number(), // safe price (with safe deviation but without slippage)
|
||||
}).optional(),
|
||||
as: z.object({ // execution alternatives
|
||||
e: z.string().array(), // exchanges
|
||||
ps: z.string().array(), // path
|
||||
mo: z.number().nullable(), // market amount out
|
||||
mi: z.number().nullable(), // market amount in
|
||||
mp: z.number(), // market price
|
||||
aa: z.number().nullable(), // available amount in
|
||||
aao: z.number().nullable(), // available amount out
|
||||
}).array(),
|
||||
});
|
||||
|
||||
const swapInfoSchemaByAmountIn = swapInfoSchemaBase.extend({
|
||||
|
||||
Reference in New Issue
Block a user