mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
Initial commit
This commit is contained in:
58
src/config/chains.json
Normal file
58
src/config/chains.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"0x1": {
|
||||
"chainId": "0x1",
|
||||
"explorer": "https://etherscan.io/",
|
||||
"label": "Ethereum",
|
||||
"code": "eth",
|
||||
"rpc": "https://trade.orionprotocol.io/rpc",
|
||||
"baseCurrencyName": "ETH"
|
||||
},
|
||||
"0x38": {
|
||||
"chainId": "0x38",
|
||||
"explorer": "https://bscscan.com/",
|
||||
"label": "Binance Smart Chain",
|
||||
"code": "bsc",
|
||||
"rpc": "https://bsc-dataseed.binance.org/",
|
||||
"baseCurrencyName": "BNB"
|
||||
},
|
||||
"0x61": {
|
||||
"chainId": "0x61",
|
||||
"explorer": "https://testnet.bscscan.com/",
|
||||
"label": "Binance Smart Chain Testnet",
|
||||
"code": "bsc",
|
||||
"rpc": "https://bsc-stage.node.orionprotocol.io/",
|
||||
"baseCurrencyName": "BNB"
|
||||
},
|
||||
"0x3": {
|
||||
"chainId": "0x3",
|
||||
"explorer": "https://ropsten.etherscan.io/",
|
||||
"label": "Ropsten",
|
||||
"code": "eth",
|
||||
"rpc": "https://testing.orionprotocol.io/eth-ropsten/rpc",
|
||||
"baseCurrencyName": "ETH"
|
||||
},
|
||||
"0xfa2": {
|
||||
"chainId": "0xfa2",
|
||||
"explorer": "https://testnet.ftmscan.com/",
|
||||
"label": "Fantom Testnet",
|
||||
"code": "ftm",
|
||||
"rpc": "https://testing.orionprotocol.io/ftm-testnet/rpc",
|
||||
"baseCurrencyName": "FTM"
|
||||
},
|
||||
"0xfa": {
|
||||
"chainId": "0xfa",
|
||||
"explorer": "https://ftmscan.com/",
|
||||
"label": "Fantom",
|
||||
"code": "ftm",
|
||||
"rpc": "https://rpcapi.fantom.network/",
|
||||
"baseCurrencyName": "FTM"
|
||||
},
|
||||
"0x0": {
|
||||
"chainId": "0x0",
|
||||
"explorer": "https://brokenscan.io/",
|
||||
"label": "BrokenChain",
|
||||
"code": "bkn",
|
||||
"rpc": "https://brokenscan.io/rpc",
|
||||
"baseCurrencyName": "BKN"
|
||||
}
|
||||
}
|
||||
5
src/config/eip712DomainData.json
Normal file
5
src/config/eip712DomainData.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Orion Exchange",
|
||||
"version": "1",
|
||||
"salt": "0xf2d857f4a3edcb9b78b4d503bfe733db1e3f6cdc2b7971ee739626c97e86a557"
|
||||
}
|
||||
69
src/config/envs.json
Normal file
69
src/config/envs.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"production": {
|
||||
"networks": {
|
||||
"0x1": {
|
||||
"api": "trade.orionprotocol.io",
|
||||
"liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A"
|
||||
},
|
||||
"0x38": {
|
||||
"api": "trade-exp.orionprotocol.io"
|
||||
}
|
||||
}
|
||||
},
|
||||
"testing": {
|
||||
"networks": {
|
||||
"0x61": {
|
||||
"api": "testing.orionprotocol.io/bsc-testnet",
|
||||
"liquidityMigratorAddress": "0x01b10dd12478C88A5E18e2707E729906bC25CfF6"
|
||||
},
|
||||
"0x3": {
|
||||
"api": "testing.orionprotocol.io/eth-ropsten",
|
||||
"liquidityMigratorAddress": "0x36969a25622AE31bA9946e0c8151f0dc08b3A1c8"
|
||||
},
|
||||
"0xfa2": {
|
||||
"api": "testing.orionprotocol.io/ftm-testnet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"staging": {
|
||||
"networks": {
|
||||
"0x1": {
|
||||
"api": "staging.orionprotocol.io"
|
||||
},
|
||||
"0x38": {
|
||||
"api": "staging-bsc.orionprotocol.io"
|
||||
},
|
||||
"0xfa": {
|
||||
"api": "staging-ftm.orionprotocol.io"
|
||||
}
|
||||
}
|
||||
},
|
||||
"broken": {
|
||||
"networks": {
|
||||
"0x0": {
|
||||
"api": "broken0.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
},
|
||||
"0x61": {
|
||||
"api": "broken1.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
}
|
||||
}
|
||||
},
|
||||
"partially-broken": {
|
||||
"networks": {
|
||||
"0x61": {
|
||||
"api": "testing.orionprotocol.io/bsc-testnet",
|
||||
"liquidityMigratorAddress": "0x01b10dd12478C88A5E18e2707E729906bC25CfF6"
|
||||
},
|
||||
"0x3": {
|
||||
"api": "testing.orionprotocol.io/eth-ropsten",
|
||||
"liquidityMigratorAddress": "0x36969a25622AE31bA9946e0c8151f0dc08b3A1c8"
|
||||
},
|
||||
"0xfa2": {
|
||||
"api": "testing.orionprotocol.io/ftm-testnet"
|
||||
},
|
||||
"0x0": {
|
||||
"api": "broken.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/config/index.ts
Normal file
13
src/config/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import jsonChains from './chains.json';
|
||||
import jsonEnvs from './envs.json';
|
||||
import { pureEnvSchema, pureChainInfoSchema } from './schemas';
|
||||
|
||||
const chains = pureChainInfoSchema.parse(jsonChains);
|
||||
const envs = pureEnvSchema.parse(jsonEnvs);
|
||||
|
||||
export {
|
||||
chains,
|
||||
envs,
|
||||
};
|
||||
|
||||
export * as schemas from './schemas';
|
||||
16
src/config/schemas/eip712DomainSchema.ts
Normal file
16
src/config/schemas/eip712DomainSchema.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const eip712DomainSchema = z.object({
|
||||
name: z.string(),
|
||||
version: z.string(),
|
||||
chainId: z.string(),
|
||||
verifyingContract: z.string(),
|
||||
salt: z.string(),
|
||||
})
|
||||
.partial()
|
||||
.refine(
|
||||
(data) => Object.keys(data).length > 0,
|
||||
'At least one property should be filled in.',
|
||||
);
|
||||
|
||||
export default eip712DomainSchema;
|
||||
3
src/config/schemas/index.ts
Normal file
3
src/config/schemas/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as eip712DomainSchema } from './eip712DomainSchema';
|
||||
export * from './pureEnvSchema';
|
||||
export * from './pureChainSchema';
|
||||
16
src/config/schemas/pureChainSchema.ts
Normal file
16
src/config/schemas/pureChainSchema.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod';
|
||||
import { SupportedChainId } from '../../types';
|
||||
|
||||
export const pureChainInfoPayloadSchema = z.object({
|
||||
chainId: z.nativeEnum(SupportedChainId),
|
||||
label: z.string(),
|
||||
code: z.string(),
|
||||
explorer: z.string(),
|
||||
rpc: z.string(),
|
||||
baseCurrencyName: z.string(),
|
||||
});
|
||||
|
||||
export const pureChainInfoSchema = z.record(
|
||||
z.nativeEnum(SupportedChainId),
|
||||
pureChainInfoPayloadSchema,
|
||||
);
|
||||
18
src/config/schemas/pureEnvSchema.ts
Normal file
18
src/config/schemas/pureEnvSchema.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { z } from 'zod';
|
||||
import { SupportedChainId } from '../../types';
|
||||
|
||||
export const pureEnvPayloadSchema = z.object({
|
||||
networks: z.record(
|
||||
z.nativeEnum(SupportedChainId),
|
||||
z.object({
|
||||
api: z.string(),
|
||||
rpc: z.string().optional(),
|
||||
liquidityMigratorAddress: z.string().optional(),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
export const pureEnvSchema = z.record(
|
||||
z.string(),
|
||||
pureEnvPayloadSchema,
|
||||
);
|
||||
Reference in New Issue
Block a user