mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
All pair names were upper-cased
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.18.29",
|
"version": "0.18.30-rc0",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const orderbookElementSchema = z.object({
|
|||||||
price: z.number(),
|
price: z.number(),
|
||||||
amount: z.number(),
|
amount: z.number(),
|
||||||
path: z.array(z.object({
|
path: z.array(z.object({
|
||||||
assetPair: z.string(),
|
assetPair: z.string().toUpperCase(),
|
||||||
action: z.enum(['BUY', 'SELL']),
|
action: z.enum(['BUY', 'SELL']),
|
||||||
})),
|
})),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const atomicSwapHistorySchema = z.array(z.object({
|
|||||||
sender: z.string(),
|
sender: z.string(),
|
||||||
lockOrder: z.object({
|
lockOrder: z.object({
|
||||||
sender: z.string(),
|
sender: z.string(),
|
||||||
asset: z.string(),
|
asset: z.string().toUpperCase(),
|
||||||
amount: z.number(),
|
amount: z.number(),
|
||||||
expiration: z.number(),
|
expiration: z.number(),
|
||||||
secretHash: z.string(),
|
secretHash: z.string(),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const tradeInfoSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const baseOrderSchema = z.object({
|
const baseOrderSchema = z.object({
|
||||||
assetPair: z.string(),
|
assetPair: z.string().toUpperCase(),
|
||||||
side: z.enum(['BUY', 'SELL']),
|
side: z.enum(['BUY', 'SELL']),
|
||||||
amount: z.number().nonnegative(),
|
amount: z.number().nonnegative(),
|
||||||
remainingAmount: z.number().nonnegative(),
|
remainingAmount: z.number().nonnegative(),
|
||||||
@@ -99,7 +99,7 @@ const orderSchema = z.object({
|
|||||||
message: `order.id must be a hex string, got ${value}`,
|
message: `order.id must be a hex string, got ${value}`,
|
||||||
})),
|
})),
|
||||||
fee: z.number().nonnegative(),
|
fee: z.number().nonnegative(),
|
||||||
feeAsset: z.string(),
|
feeAsset: z.string().toUpperCase(),
|
||||||
creationTime: z.number(),
|
creationTime: z.number(),
|
||||||
blockchainOrder: blockchainOrderSchema,
|
blockchainOrder: blockchainOrderSchema,
|
||||||
subOrders: z.record(subOrderSchema),
|
subOrders: z.record(subOrderSchema),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const pairConfigSchema = z.object({
|
|||||||
maxQty: z.number(),
|
maxQty: z.number(),
|
||||||
minPrice: z.number(),
|
minPrice: z.number(),
|
||||||
minQty: z.number(),
|
minQty: z.number(),
|
||||||
name: z.string(),
|
name: z.string().toUpperCase(),
|
||||||
pricePrecision: z.number().int(),
|
pricePrecision: z.number().int(),
|
||||||
qtyPrecision: z.number().int(),
|
qtyPrecision: z.number().int(),
|
||||||
// quoteAssetPrecision: z.number().int(), // Deprecated. DO NOT USE
|
// quoteAssetPrecision: z.number().int(), // Deprecated. DO NOT USE
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|||||||
const placeAtomicSwapSchema = z.object({
|
const placeAtomicSwapSchema = z.object({
|
||||||
redeemOrder: z.object({
|
redeemOrder: z.object({
|
||||||
amount: z.number(),
|
amount: z.number(),
|
||||||
asset: z.string(),
|
asset: z.string().toUpperCase(),
|
||||||
expiration: z.number(),
|
expiration: z.number(),
|
||||||
receiver: z.string(),
|
receiver: z.string(),
|
||||||
secretHash: z.string(),
|
secretHash: z.string(),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const redeemOrderSchema = z.object({
|
const redeemOrderSchema = z.object({
|
||||||
asset: z.string(),
|
asset: z.string().toUpperCase(),
|
||||||
amount: z.number(),
|
amount: z.number(),
|
||||||
secretHash: z.string(),
|
secretHash: z.string(),
|
||||||
sender: z.string(),
|
sender: z.string(),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|||||||
import { exchanges } from '../../../constants/index.js';
|
import { exchanges } from '../../../constants/index.js';
|
||||||
|
|
||||||
const orderInfoSchema = z.object({
|
const orderInfoSchema = z.object({
|
||||||
assetPair: z.string(),
|
assetPair: z.string().toUpperCase(),
|
||||||
side: z.enum(['BUY', 'SELL']),
|
side: z.enum(['BUY', 'SELL']),
|
||||||
amount: z.number(),
|
amount: z.number(),
|
||||||
safePrice: z.number(),
|
safePrice: z.number(),
|
||||||
@@ -12,8 +12,8 @@ const swapInfoBase = z.object({
|
|||||||
id: z.string(),
|
id: z.string(),
|
||||||
amountIn: z.number(),
|
amountIn: z.number(),
|
||||||
amountOut: z.number(),
|
amountOut: z.number(),
|
||||||
assetIn: z.string(),
|
assetIn: z.string().toUpperCase(),
|
||||||
assetOut: z.string(),
|
assetOut: z.string().toUpperCase(),
|
||||||
path: z.array(z.string()),
|
path: z.array(z.string()),
|
||||||
// isThroughPoolOptimal: z.boolean(), // deprecated
|
// isThroughPoolOptimal: z.boolean(), // deprecated
|
||||||
executionInfo: z.string(),
|
executionInfo: z.string(),
|
||||||
@@ -27,7 +27,7 @@ const swapInfoBase = z.object({
|
|||||||
exchanges: z.array(z.enum(exchanges)),
|
exchanges: z.array(z.enum(exchanges)),
|
||||||
path: z.object({
|
path: z.object({
|
||||||
units: z.object({
|
units: z.object({
|
||||||
assetPair: z.string(),
|
assetPair: z.string().toUpperCase(),
|
||||||
action: z.string(),
|
action: z.string(),
|
||||||
}).array(),
|
}).array(),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const subOrderSchema = z.object({
|
|||||||
i: z.number(), // id
|
i: z.number(), // id
|
||||||
I: z.string(), // parent order id
|
I: z.string(), // parent order id
|
||||||
O: z.string(), // sender (owner)
|
O: z.string(), // sender (owner)
|
||||||
P: z.string(), // asset pair
|
P: z.string().toUpperCase(), // asset pair
|
||||||
s: z.enum(['BUY', 'SELL']), // side
|
s: z.enum(['BUY', 'SELL']), // side
|
||||||
a: z.number(), // amount
|
a: z.number(), // amount
|
||||||
A: z.number(), // settled amount
|
A: z.number(), // settled amount
|
||||||
@@ -66,12 +66,12 @@ export const orderUpdateSchema = z.object({
|
|||||||
export const fullOrderSchema = z.object({
|
export const fullOrderSchema = z.object({
|
||||||
I: z.string(), // id
|
I: z.string(), // id
|
||||||
O: z.string(), // sender (owner)
|
O: z.string(), // sender (owner)
|
||||||
P: z.string(), // asset pair
|
P: z.string().toUpperCase(), // asset pair
|
||||||
s: z.enum(['BUY', 'SELL']), // side
|
s: z.enum(['BUY', 'SELL']), // side
|
||||||
a: z.number(), // amount
|
a: z.number(), // amount
|
||||||
A: z.number(), // settled amount
|
A: z.number(), // settled amount
|
||||||
p: z.number(), // price
|
p: z.number(), // price
|
||||||
F: z.string(), // fee asset
|
F: z.string().toUpperCase(), // fee asset
|
||||||
f: z.number(), // fee
|
f: z.number(), // fee
|
||||||
l: z.boolean().optional(), // is liquidation order
|
l: z.boolean().optional(), // is liquidation order
|
||||||
L: z.number().optional(), // stop limit price,
|
L: z.number().optional(), // stop limit price,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const assetPairConfigSchema = baseMessageSchema.extend({
|
|||||||
T: z.literal(MessageType.ASSET_PAIR_CONFIG_UPDATE),
|
T: z.literal(MessageType.ASSET_PAIR_CONFIG_UPDATE),
|
||||||
k: z.enum(['i', 'u']),
|
k: z.enum(['i', 'u']),
|
||||||
u: z.tuple([
|
u: z.tuple([
|
||||||
z.string(), // pairName
|
z.string().toUpperCase(), // pairName
|
||||||
z.number(), // minQty
|
z.number(), // minQty
|
||||||
z.number().int(), // pricePrecision
|
z.number().int(), // pricePrecision
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const assetPairsConfigSchema = baseMessageSchema.extend({
|
|||||||
k: z.enum(['i', 'u']),
|
k: z.enum(['i', 'u']),
|
||||||
u: z.array(
|
u: z.array(
|
||||||
z.tuple([
|
z.tuple([
|
||||||
z.string(), // pairName
|
z.string().toUpperCase(), // pairName
|
||||||
z.number(), // minQty
|
z.number(), // minQty
|
||||||
z.number().int(), // pricePrecision
|
z.number().int(), // pricePrecision
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|||||||
import { makePartial } from '../../../../utils/index.js';
|
import { makePartial } from '../../../../utils/index.js';
|
||||||
|
|
||||||
const balancesSchema = z.record( // changed balances in format
|
const balancesSchema = z.record( // changed balances in format
|
||||||
z.string(), // asset
|
z.string().toUpperCase(), // asset
|
||||||
z.tuple([
|
z.tuple([
|
||||||
z.string(), // tradable balance
|
z.string(), // tradable balance
|
||||||
z.string(), // reserved balance
|
z.string(), // reserved balance
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const brokerMessageSchema = baseMessageSchema.extend({
|
|||||||
T: z.literal(MessageType.BROKER_TRADABLE_ATOMIC_SWAP_ASSETS_BALANCE_UPDATE),
|
T: z.literal(MessageType.BROKER_TRADABLE_ATOMIC_SWAP_ASSETS_BALANCE_UPDATE),
|
||||||
bb: z.array(
|
bb: z.array(
|
||||||
z.tuple([
|
z.tuple([
|
||||||
z.string(), // Asset name
|
z.string().toUpperCase(), // Asset name
|
||||||
z.number(), // limit
|
z.number(), // limit
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const orderBookItemSchema = z.tuple([
|
|||||||
), // exchanges
|
), // exchanges
|
||||||
z.array(z.tuple([
|
z.array(z.tuple([
|
||||||
z.enum(['SELL', 'BUY']), // side
|
z.enum(['SELL', 'BUY']), // side
|
||||||
z.string(), // pairname
|
z.string().toUpperCase(), // pairname
|
||||||
])),
|
])),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ const alternativeSchema = z.object({ // execution alternatives
|
|||||||
const swapInfoSchemaBase = baseMessageSchema.extend({
|
const swapInfoSchemaBase = baseMessageSchema.extend({
|
||||||
T: z.literal(MessageType.SWAP_INFO),
|
T: z.literal(MessageType.SWAP_INFO),
|
||||||
S: z.string(), // swap request id
|
S: z.string(), // swap request id
|
||||||
ai: z.string(), // asset in,
|
ai: z.string().toUpperCase(), // asset in,
|
||||||
ao: z.string(), // asset out
|
ao: z.string().toUpperCase(), // asset out
|
||||||
a: z.number(), // amount in
|
a: z.number(), // amount in
|
||||||
o: z.number(), // amount out
|
o: z.number(), // amount out
|
||||||
ma: z.number(), // min amount in
|
ma: z.number(), // min amount in
|
||||||
@@ -27,7 +27,7 @@ const swapInfoSchemaBase = baseMessageSchema.extend({
|
|||||||
p: z.number().optional(), // price
|
p: z.number().optional(), // price
|
||||||
mp: z.number().optional(), // market price
|
mp: z.number().optional(), // market price
|
||||||
oi: z.object({ // info about order equivalent to this swap
|
oi: z.object({ // info about order equivalent to this swap
|
||||||
p: z.string(), // asset pair
|
p: z.string().toUpperCase(), // asset pair
|
||||||
s: z.enum(['SELL', 'BUY']), // side
|
s: z.enum(['SELL', 'BUY']), // side
|
||||||
a: z.number(), // amount
|
a: z.number(), // amount
|
||||||
sp: z.number(), // safe price (with safe deviation but without slippage)
|
sp: z.number(), // safe price (with safe deviation but without slippage)
|
||||||
|
|||||||
Reference in New Issue
Block a user