mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
swapInfo usd
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.23",
|
"version": "0.20.24",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.23",
|
"version": "0.20.24",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.23",
|
"version": "0.20.24-rc1",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ const swapInfoBase = z.object({
|
|||||||
isThroughPoolOrCurve: z.boolean(),
|
isThroughPoolOrCurve: z.boolean(),
|
||||||
}).array(),
|
}).array(),
|
||||||
assetNameMapping: z.record(z.string()).optional(), // address to ERC20 names
|
assetNameMapping: z.record(z.string()).optional(), // address to ERC20 names
|
||||||
|
usd: z.object({ // USD info of this swap, nullable
|
||||||
|
aa: z.number(), // available amount in, USD
|
||||||
|
aao: z.number().optional(), // available amount out, USD
|
||||||
|
mo: z.number(), // market amount out, USD
|
||||||
|
mi: z.number().optional(), // market amount in, USD
|
||||||
|
d: z.number().optional(), // difference in available amount in/out (USD) and market amount out/in (USD) in percentage
|
||||||
|
}).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const swapInfoByAmountIn = swapInfoBase.extend({
|
const swapInfoByAmountIn = swapInfoBase.extend({
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ const swapInfoSchemaBase = baseMessageSchema.extend({
|
|||||||
ai: z.string().toUpperCase(), // asset in
|
ai: z.string().toUpperCase(), // asset in
|
||||||
ao: z.string().toUpperCase(), // asset out
|
ao: z.string().toUpperCase(), // asset out
|
||||||
f: factorySchema, // factory
|
f: factorySchema, // factory
|
||||||
}))
|
})),
|
||||||
|
usd: z.object({ // USD info of this swap, nullable
|
||||||
|
aa: z.number(), // available amount in, USD
|
||||||
|
aao: z.number().optional(), // available amount out, USD
|
||||||
|
mo: z.number(), // market amount out, USD
|
||||||
|
mi: z.number().optional(), // market amount in, USD
|
||||||
|
d: z.number().optional(), // difference in available amount in/out (USD) and market amount out/in (USD) in percentage
|
||||||
|
}).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const swapInfoSchemaByAmountIn = swapInfoSchemaBase.extend({
|
const swapInfoSchemaByAmountIn = swapInfoSchemaBase.extend({
|
||||||
|
|||||||
@@ -197,6 +197,13 @@ export type SwapInfoBase = {
|
|||||||
} | undefined
|
} | undefined
|
||||||
alternatives: SwapInfoAlternative[]
|
alternatives: SwapInfoAlternative[]
|
||||||
assetsNameMapping?: Partial<Record<string, string>> | undefined
|
assetsNameMapping?: Partial<Record<string, string>> | undefined
|
||||||
|
usdInfo?: {
|
||||||
|
availableAmountIn: number
|
||||||
|
availableAmountOut?: number
|
||||||
|
marketAmountIn: number
|
||||||
|
marketAmountOut?: number
|
||||||
|
difference: number
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SwapInfoByAmountIn = SwapInfoBase & {
|
export type SwapInfoByAmountIn = SwapInfoBase & {
|
||||||
|
|||||||
Reference in New Issue
Block a user