import { predefined } from "@ckb-lumos/config-manager";
const devdUrls = {
ckb_indexer_url: [
"https://testnet.ckb.dev",
"https://testnet.ckbapp.dev",
],
ckb_rpc_url: [
"https://testnet.ckb.dev",
"https://testnet.ckbapp.dev",
]
}
const prodUrls = {
ckb_indexer_url: [
"https://mainnet.ckb.dev",
"https://mainnet.ckbapp.dev",
],
ckb_rpc_url: [
"https://mainnet.ckb.dev",
"https://mainnet.ckbapp.dev",
]
}
const RPC_COUNT = 2;
const randomIndex = Math.floor(Math.random() * RPC_COUNT);
const prodConfig = {
APP: {
IS_MAINNET: true,
API_BASE_URL:"https://api.your-dapp-domain",
MAX_DECIMAL_PART_LENGTH: 8,
JOYID_BUY_CKB:"https://app.joy.id/exchange?token=ckb",
},
CKB: {
CKB_RPC_URL: prodUrls.ckb_rpc_url[randomIndex],
CKB_INDEXER_URL: prodUrls.ckb_indexer_url[randomIndex],
CKB_EXPLORER_URL: "https://explorer.nervos.org",
PREFIX: 'ckb',
SCRIPTS: predefined.LINA.SCRIPTS,
},
JOYID: {
SCRIPT: {
CODE_HASH: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323",
HASH_TYPE: "type",
TX_HASH: "0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493",
INDEX: "0x0",
DEP_TYPE: "depGroup"
},
APP_CONFIG: {
name: 'your app name',
logo: 'https://your-dapp-domain/your-logo.svg',
network: 'mainnet',
joyidAppURL: 'https://app.joy.id',
joyidServerURL: 'https://api.joy.id',
}
}
};
const devConfig = {
APP: {
IS_MAINNET: false,
API_BASE_URL:"https://test-api.your-dapp-domain",
MAX_DECIMAL_PART_LENGTH: 8,
JOYID_BUY_CKB:"https://testnet.joyid.dev/exchange?token=ckb",
},
CKB: {
CKB_RPC_URL: devdUrls.ckb_rpc_url[randomIndex],
CKB_INDEXER_URL: devdUrls.ckb_indexer_url[randomIndex],
CKB_EXPLORER_URL: "https://pudge.explorer.nervos.org",
PREFIX: 'ckt',
SCRIPTS: predefined.AGGRON4.SCRIPTS,
},
JOYID: {
SCRIPT: {
CODE_HASH: "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac",
HASH_TYPE: "type",
TX_HASH: "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263",
INDEX: "0x0",
DEP_TYPE: "depGroup"
},
APP_CONFIG: {
name: 'your app name',
logo: 'https://your-dapp-domain/your-logo.svg',
network: 'testnet',
joyidAppURL: 'https://testnet.joyid.dev',
joyidServerURL: "https://api.joyid.dev",
}
}
};
const env = process.env.REACT_APP_ENV;
let appConfig;
if (env === "production") {
appConfig = prodConfig;
} else if (env === "dev" || env === "staging") {
appConfig = devConfig;
} else {
appConfig = devConfig;
}
export default appConfig;