Skip to content

Commit

Permalink
fix: network (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
JP authored Apr 24, 2024
1 parent 51b19de commit 8873ccf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tinlake-ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import contractAbiPoolRegistry from '@centrifuge/tinlake-js/src/abi/PoolRegistry
import BN from 'bn.js'
import { ethers } from 'ethers'
import * as yup from 'yup'
import { networkUrlToName } from './utils/networkNameResolver'

interface SecuritizeData {
issuerId: string
Expand Down Expand Up @@ -128,6 +129,7 @@ interface Config {
transactionTimeout: number
tinlakeDataBackendUrl: string
isDemo: boolean
network: 'Mainnet' | 'Kovan' | 'Goerli'
portisApiKey: string
onfinalityKey: string
gasLimit: number
Expand Down Expand Up @@ -347,6 +349,11 @@ const config: Config = {
.url()
.validateSync(process.env.NEXT_PUBLIC_TINLAKE_DATA_BACKEND_URL),
isDemo: yup.string().required('NEXT_PUBLIC_ENV is required').validateSync(process.env.NEXT_PUBLIC_ENV) === 'demo',
network: yup
.mixed<'Mainnet' | 'Kovan' | 'Goerli'>()
.required('NEXT_PUBLIC_RPC_URL is required')
.oneOf(['Mainnet', 'Kovan', 'Goerli'])
.validateSync(networkUrlToName(process.env.NEXT_PUBLIC_RPC_URL || '')),
portisApiKey: yup
.string()
.required('NEXT_PUBLIC_PORTIS_KEY is required')
Expand Down
2 changes: 1 addition & 1 deletion tinlake-ui/utils/networkNameResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function networkNameToId(name: string) {
}

export function networkUrlToName(url: string) {
if (url.indexOf('mainnet') > -1) return 'Mainnet'
if (url.indexOf('eth.') > -1) return 'Mainnet'
if (url.indexOf('morden') > -1) return 'Morden'
if (url.indexOf('ropsten') > -1) return 'Ropsten;'
if (url.indexOf('rinkeby') > -1) return 'Rinkeby'
Expand Down

2 comments on commit 8873ccf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.