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