mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
Initial commit
This commit is contained in:
8
src/constants/cancelOrderTypes.ts
Normal file
8
src/constants/cancelOrderTypes.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
const CANCEL_ORDER_TYPES = {
|
||||
DeleteOrder: [
|
||||
{ name: 'senderAddress', type: 'address' },
|
||||
{ name: 'id', type: 'string' },
|
||||
],
|
||||
};
|
||||
|
||||
export default CANCEL_ORDER_TYPES;
|
||||
4
src/constants/chains.ts
Normal file
4
src/constants/chains.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { SupportedChainId } from '../types';
|
||||
|
||||
export const developmentChains = [SupportedChainId.BSC_TESTNET, SupportedChainId.ROPSTEN, SupportedChainId.FANTOM_TESTNET];
|
||||
export const productionChains = [SupportedChainId.MAINNET, SupportedChainId.BSC, SupportedChainId.FANTOM_OPERA];
|
||||
30
src/constants/gasLimits.ts
Normal file
30
src/constants/gasLimits.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
export const DEPOSIT_ETH_GAS_LIMIT = 70000;
|
||||
export const DEPOSIT_ERC20_GAS_LIMIT = 150000;
|
||||
export const WITHDRAW_GAS_LIMIT = DEPOSIT_ERC20_GAS_LIMIT;
|
||||
export const APPROVE_ERC20_GAS_LIMIT = 70000;
|
||||
export const STAKE_ERC20_GAS_LIMIT = 150000;
|
||||
export const VOTE_ERC20_GAS_LIMIT = 150000;
|
||||
export const FILL_ORDERS_GAS_LIMIT = 220000;
|
||||
export const SWAP_THROUGH_ORION_POOL_GAS_LIMIT = 600000;
|
||||
export const ADD_LIQUIDITY_GAS_LIMIT = 600000;
|
||||
export const FARMING_STAKE_GAS_LIMIT = 350000;
|
||||
export const FARMING_CLAIM_GAS_LIMIT = 350000;
|
||||
export const FARMING_EXIT_GAS_LIMIT = 500000;
|
||||
export const FARMING_WITHDRAW_GAS_LIMIT = 350000;
|
||||
export const GOVERNANCE_GET_REWARD_GAS_LIMIT = 250000;
|
||||
export const GOVERNANCE_STAKE_GAS_LIMIT = 300000;
|
||||
export const GOVERNANCE_UNSTAKE_GAS_LIMIT = 250000;
|
||||
export const GOVERNANCE_VOTE_GAS_LIMIT = 200000;
|
||||
export const MIGRATE_GAS_LIMIT = 800000;
|
||||
export const LOCKATOMIC_GAS_LIMIT = 200000;
|
||||
export const REDEEMATOMIC_GAS_LIMIT = 200000;
|
||||
export const LIQUIDITY_MIGRATE_GAS_LIMIT = 600000;
|
||||
|
||||
export const DEFAULT_GAS_LIMIT = 700000;
|
||||
|
||||
export const TOKEN_EXCEPTIONS: Record<string, Record<string, number>> = {
|
||||
CUMMIES: {
|
||||
deposit: 300000,
|
||||
withdraw: 300000,
|
||||
},
|
||||
};
|
||||
8
src/constants/index.ts
Normal file
8
src/constants/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export { default as cancelOrderTypes } from './cancelOrderTypes';
|
||||
export { default as orderStatuses } from './orderStatuses';
|
||||
export { default as orderTypes } from './orderTypes';
|
||||
export { default as subOrderStatuses } from './subOrderStatuses';
|
||||
|
||||
export * from './chains';
|
||||
export * from './precisions';
|
||||
export * from './gasLimits';
|
||||
9
src/constants/orderStatuses.ts
Normal file
9
src/constants/orderStatuses.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import subOrderStatuses from './subOrderStatuses';
|
||||
|
||||
// https://github.com/orionprotocol/orion-aggregator/blob/develop/src/main/java/io/orionprotocol/aggregator/model/order/status/OrderStatus.java
|
||||
const orderStatuses = [
|
||||
...subOrderStatuses,
|
||||
'ROUTING', // order got sub orders, but not all of them have status ACCEPTED
|
||||
] as const;
|
||||
|
||||
export default orderStatuses;
|
||||
17
src/constants/orderTypes.ts
Normal file
17
src/constants/orderTypes.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
const ORDER_TYPES = {
|
||||
Order: [
|
||||
{ name: 'senderAddress', type: 'address' },
|
||||
{ name: 'matcherAddress', type: 'address' },
|
||||
{ name: 'baseAsset', type: 'address' },
|
||||
{ name: 'quoteAsset', type: 'address' },
|
||||
{ name: 'matcherFeeAsset', type: 'address' },
|
||||
{ name: 'amount', type: 'uint64' },
|
||||
{ name: 'price', type: 'uint64' },
|
||||
{ name: 'matcherFee', type: 'uint64' },
|
||||
{ name: 'nonce', type: 'uint64' },
|
||||
{ name: 'expiration', type: 'uint64' },
|
||||
{ name: 'buySide', type: 'uint8' },
|
||||
],
|
||||
};
|
||||
|
||||
export default ORDER_TYPES;
|
||||
2
src/constants/precisions.ts
Normal file
2
src/constants/precisions.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const INTERNAL_ORION_PRECISION = 8;
|
||||
export const NATIVE_CURRENCY_PRECISION = 18;
|
||||
15
src/constants/subOrderStatuses.ts
Normal file
15
src/constants/subOrderStatuses.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// https://github.com/orionprotocol/orion-aggregator/blob/develop/src/main/java/io/orionprotocol/aggregator/model/order/status/SubOrderStatus.java
|
||||
const subOrderStatuses = [
|
||||
'NEW', // created, wasn't added to IOB or wasn't accepted by the broker
|
||||
'ACCEPTED', // added to IOB or accepted by the broker
|
||||
'PARTIALLY_FILLED', // partially filled
|
||||
'FILLED', // fully filled
|
||||
'TX_PENDING', // sub order was filled and at least one of its trades is pending
|
||||
'CANCELED', // canceled by user or by expiration
|
||||
'REJECTED', // rejected by broker
|
||||
'FAILED', // at least one trade failed
|
||||
'SETTLED', // all trades successfully settled
|
||||
'NOT_FOUND', // broker not processed sub order yet
|
||||
] as const;
|
||||
|
||||
export default subOrderStatuses;
|
||||
Reference in New Issue
Block a user