mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-04 03:58:00 +03:00
add getCrossChainAssetsByNetwork method
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.41",
|
||||
"version": "0.20.42-rc0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -6,9 +6,9 @@ import cancelOrderSchema from './schemas/cancelOrderSchema.js';
|
||||
import orderBenefitsSchema from './schemas/orderBenefitsSchema.js';
|
||||
import errorSchema from './schemas/errorSchema.js';
|
||||
import placeAtomicSwapSchema from './schemas/placeAtomicSwapSchema.js';
|
||||
import { AggregatorWS } from './ws/index.js';
|
||||
import { AggregatorWS } from './ws';
|
||||
import { atomicSwapHistorySchema } from './schemas/atomicSwapHistorySchema.js';
|
||||
import type { BasicAuthCredentials, SignedCancelOrderRequest, SignedOrder } from '../../types.js';
|
||||
import type { BasicAuthCredentials, SignedCancelOrderRequest, SignedOrder, SupportedChainShortNames } from '../../types.js';
|
||||
import {
|
||||
pairConfigSchema, aggregatedOrderbookSchema,
|
||||
exchangeOrderbookSchema, poolReservesSchema,
|
||||
@@ -51,6 +51,7 @@ class Aggregator {
|
||||
this.getPairConfigs = this.getPairConfigs.bind(this);
|
||||
this.getPairsList = this.getPairsList.bind(this);
|
||||
this.getSwapInfo = this.getSwapInfo.bind(this);
|
||||
this.getCrossChainAssetsByNetwork = this.getCrossChainAssetsByNetwork.bind(this);
|
||||
this.getTradeProfits = this.getTradeProfits.bind(this);
|
||||
this.placeAtomicSwap = this.placeAtomicSwap.bind(this);
|
||||
this.placeOrder = this.placeOrder.bind(this);
|
||||
@@ -290,6 +291,18 @@ class Aggregator {
|
||||
);
|
||||
};
|
||||
|
||||
getCrossChainAssetsByNetwork = (sourceChain: SupportedChainShortNames) => {
|
||||
const url = new URL(`${this.apiUrl}/api/v1/cross-chain/assets`);
|
||||
url.searchParams.append('sourceChain', sourceChain);
|
||||
|
||||
return fetchWithValidation(
|
||||
url.toString(),
|
||||
z.array(z.number()),
|
||||
{ headers: this.basicAuthHeaders },
|
||||
errorSchema,
|
||||
)
|
||||
}
|
||||
|
||||
getPrices = (assetPair: string, includePools: boolean) => {
|
||||
const url = new URL(`${this.apiUrl}/api/v1/prices/`);
|
||||
url.searchParams.append('assetPair', assetPair);
|
||||
|
||||
17
src/types.ts
17
src/types.ts
@@ -99,6 +99,23 @@ export enum SupportedChainId {
|
||||
// BROKEN = '0',
|
||||
}
|
||||
|
||||
export enum SupportedChainShortNames {
|
||||
MAINNET = 'ETH',
|
||||
ROPSTEN = 'ETH-Ropsten',
|
||||
GOERLI = 'ETH-Goerli',
|
||||
ARBITRUM_GOERLI = 'Arbitrum Goerli',
|
||||
FANTOM_OPERA = 'FTM',
|
||||
POLYGON = 'Polygon',
|
||||
OKC = 'OKC',
|
||||
|
||||
POLYGON_TESTNET = 'Polygon Mumbai',
|
||||
FANTOM_TESTNET = 'FTM-Testnet',
|
||||
BSC = 'BSC',
|
||||
BSC_TESTNET = 'BSC-Testnet',
|
||||
OKC_TESTNET = 'OKC-Testnet',
|
||||
DRIP_TESTNET = 'DRIP Chain',
|
||||
}
|
||||
|
||||
const balanceTypes = ['exchange', 'wallet'] as const;
|
||||
|
||||
export type Source = typeof balanceTypes[number];
|
||||
|
||||
Reference in New Issue
Block a user