mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Migrate to decimal chainId
This commit is contained in:
@@ -21,7 +21,7 @@ import "dotenv/config";
|
||||
import { initOrionUnit } from "@orionprotocol/sdk";
|
||||
import { Wallet } from "ethers";
|
||||
|
||||
const chain = process.env.CHAINID; // 0x38
|
||||
const chain = process.env.CHAINID; // "56"
|
||||
const env = process.env.ENV; // production
|
||||
const privateKey = process.env.PRIVATE_KEY; // 0x...
|
||||
|
||||
@@ -42,7 +42,7 @@ import detectEthereumProvider from "@metamask/detect-provider";
|
||||
import { BaseProvider } from "@metamask/providers";
|
||||
import { providers } from "ethers";
|
||||
|
||||
const chain = "0x61"; // bsc-testnet
|
||||
const chain = "97"; // bsc-testnet
|
||||
const env = "testing";
|
||||
|
||||
const startApp = async (provider: BaseProvider) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -107,7 +107,7 @@ export default async function deposit({
|
||||
sources: ['wallet'],
|
||||
});
|
||||
|
||||
unsignedTx.chainId = parseInt(chainId, 16);
|
||||
unsignedTx.chainId = parseInt(chainId, 10);
|
||||
unsignedTx.gasPrice = ethers.BigNumber.from(gasPriceWei);
|
||||
unsignedTx.from = walletAddress;
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ export default async function swapMarket({
|
||||
type === 'exactSpend',
|
||||
);
|
||||
|
||||
unsignedSwapThroughOrionPoolTx.chainId = parseInt(chainId, 16);
|
||||
unsignedSwapThroughOrionPoolTx.chainId = parseInt(chainId, 10);
|
||||
unsignedSwapThroughOrionPoolTx.gasPrice = ethers.BigNumber.from(gasPriceWei);
|
||||
|
||||
unsignedSwapThroughOrionPoolTx.from = walletAddress;
|
||||
|
||||
@@ -98,7 +98,7 @@ export default async function withdraw({
|
||||
sources: ['wallet'],
|
||||
});
|
||||
|
||||
unsignedTx.chainId = parseInt(chainId, 16);
|
||||
unsignedTx.chainId = parseInt(chainId, 10);
|
||||
unsignedTx.gasPrice = ethers.BigNumber.from(gasPriceWei);
|
||||
unsignedTx.from = walletAddress;
|
||||
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
{
|
||||
"0x1": {
|
||||
"chainId": "0x1",
|
||||
"1": {
|
||||
"chainId": "1",
|
||||
"explorer": "https://etherscan.io/",
|
||||
"label": "Ethereum",
|
||||
"code": "eth",
|
||||
"rpc": "https://trade.orionprotocol.io/rpc",
|
||||
"baseCurrencyName": "ETH"
|
||||
},
|
||||
"0x38": {
|
||||
"chainId": "0x38",
|
||||
"56": {
|
||||
"chainId": "56",
|
||||
"explorer": "https://bscscan.com/",
|
||||
"label": "Binance Smart Chain",
|
||||
"code": "bsc",
|
||||
"rpc": "https://bsc-dataseed.binance.org/",
|
||||
"baseCurrencyName": "BNB"
|
||||
},
|
||||
"0x61": {
|
||||
"chainId": "0x61",
|
||||
"97": {
|
||||
"chainId": "97",
|
||||
"explorer": "https://testnet.bscscan.com/",
|
||||
"label": "Binance Smart Chain Testnet",
|
||||
"code": "bsc",
|
||||
"rpc": "https://bsc-stage.node.orionprotocol.io/",
|
||||
"baseCurrencyName": "BNB"
|
||||
},
|
||||
"0x3": {
|
||||
"chainId": "0x3",
|
||||
"3": {
|
||||
"chainId": "3",
|
||||
"explorer": "https://ropsten.etherscan.io/",
|
||||
"label": "Ropsten",
|
||||
"code": "eth",
|
||||
"rpc": "https://testing.orionprotocol.io/eth-ropsten/rpc",
|
||||
"baseCurrencyName": "ETH"
|
||||
},
|
||||
"0xfa2": {
|
||||
"chainId": "0xfa2",
|
||||
"4002": {
|
||||
"chainId": "4002",
|
||||
"explorer": "https://testnet.ftmscan.com/",
|
||||
"label": "Fantom Testnet",
|
||||
"code": "ftm",
|
||||
"rpc": "https://testing.orionprotocol.io/ftm-testnet/rpc",
|
||||
"baseCurrencyName": "FTM"
|
||||
},
|
||||
"0xfa": {
|
||||
"chainId": "0xfa",
|
||||
"250": {
|
||||
"chainId": "250",
|
||||
"explorer": "https://ftmscan.com/",
|
||||
"label": "Fantom",
|
||||
"code": "ftm",
|
||||
"rpc": "https://rpcapi.fantom.network/",
|
||||
"baseCurrencyName": "FTM"
|
||||
},
|
||||
"0x0": {
|
||||
"chainId": "0x0",
|
||||
"0": {
|
||||
"chainId": "0",
|
||||
"explorer": "https://brokenscan.io/",
|
||||
"label": "BrokenChain",
|
||||
"code": "bkn",
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
{
|
||||
"production": {
|
||||
"networks": {
|
||||
"0x1": {
|
||||
"1": {
|
||||
"api": "trade.orionprotocol.io",
|
||||
"liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A"
|
||||
},
|
||||
"0x38": {
|
||||
"56": {
|
||||
"api": "trade-exp.orionprotocol.io"
|
||||
}
|
||||
}
|
||||
},
|
||||
"testing": {
|
||||
"networks": {
|
||||
"0x61": {
|
||||
"97": {
|
||||
"api": "testing.orionprotocol.io/bsc-testnet",
|
||||
"liquidityMigratorAddress": "0x01b10dd12478C88A5E18e2707E729906bC25CfF6"
|
||||
"liquidityMigratorAddress": "0x01b10dds12478C88A5E18e2707E729906bC25CfF6"
|
||||
},
|
||||
"0x3": {
|
||||
"3": {
|
||||
"api": "testing.orionprotocol.io/eth-ropsten",
|
||||
"liquidityMigratorAddress": "0x36969a25622AE31bA9946e0c8151f0dc08b3A1c8"
|
||||
},
|
||||
"0xfa2": {
|
||||
"4002": {
|
||||
"api": "testing.orionprotocol.io/ftm-testnet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"staging": {
|
||||
"networks": {
|
||||
"0x1": {
|
||||
"1": {
|
||||
"api": "staging.orionprotocol.io"
|
||||
},
|
||||
"0x38": {
|
||||
"56": {
|
||||
"api": "staging-bsc.orionprotocol.io"
|
||||
},
|
||||
"0xfa": {
|
||||
"250": {
|
||||
"api": "staging-ftm.orionprotocol.io"
|
||||
}
|
||||
}
|
||||
},
|
||||
"broken": {
|
||||
"networks": {
|
||||
"0x0": {
|
||||
"0": {
|
||||
"api": "broken0.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
},
|
||||
"0x61": {
|
||||
"97": {
|
||||
"api": "broken1.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
}
|
||||
}
|
||||
},
|
||||
"partially-broken": {
|
||||
"networks": {
|
||||
"0x61": {
|
||||
"97": {
|
||||
"api": "testing.orionprotocol.io/bsc-testnet",
|
||||
"liquidityMigratorAddress": "0x01b10dd12478C88A5E18e2707E729906bC25CfF6"
|
||||
},
|
||||
"0x3": {
|
||||
"3": {
|
||||
"api": "testing.orionprotocol.io/eth-ropsten",
|
||||
"liquidityMigratorAddress": "0x36969a25622AE31bA9946e0c8151f0dc08b3A1c8"
|
||||
},
|
||||
"0xfa2": {
|
||||
"4002": {
|
||||
"api": "testing.orionprotocol.io/ftm-testnet"
|
||||
},
|
||||
"0x0": {
|
||||
"0": {
|
||||
"api": "broken.orionprotocol.io/everything-is-fine/this-url-was-created-for-tests-of-a-partially-broken-environment"
|
||||
}
|
||||
}
|
||||
|
||||
14
src/types.ts
14
src/types.ts
@@ -81,16 +81,16 @@ export type SwapInfoByAmountOut = SwapInfoBase & {
|
||||
export type SwapInfo = SwapInfoByAmountIn | SwapInfoByAmountOut;
|
||||
|
||||
export enum SupportedChainId {
|
||||
MAINNET = '0x1',
|
||||
ROPSTEN = '0x3',
|
||||
FANTOM_OPERA = '0xfa',
|
||||
MAINNET = '1',
|
||||
ROPSTEN = '3',
|
||||
FANTOM_OPERA = '250',
|
||||
|
||||
FANTOM_TESTNET = '0xfa2',
|
||||
BSC = '0x38',
|
||||
BSC_TESTNET = '0x61',
|
||||
FANTOM_TESTNET = '4002',
|
||||
BSC = '56',
|
||||
BSC_TESTNET = '97',
|
||||
|
||||
// For testing and debug purpose
|
||||
BROKEN = '0x0',
|
||||
BROKEN = '0',
|
||||
}
|
||||
|
||||
const balanceTypes = ['exchange', 'wallet'] as const;
|
||||
|
||||
Reference in New Issue
Block a user