diff --git a/.env.prod.template b/.env.prod.template index 6be62b0..290d9af 100644 --- a/.env.prod.template +++ b/.env.prod.template @@ -9,4 +9,5 @@ NEXT_PUBLIC_GLIF_URL= NEXTAUTH_SECRET= NEXTAUTH_URL= GITHUB_ID= -GITHUB_SECRET= \ No newline at end of file +GITHUB_SECRET= +NEXT_PUBLIC_IS_TESTNET= \ No newline at end of file diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 3d4b71f..ec2e45d 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -64,6 +64,7 @@ jobs: echo "NEXT_PUBLIC_NODE_TOKEN='${{ vars.NEXT_PUBLIC_NODE_TOKEN }}'" >> .env echo "NEXT_PUBLIC_DMOB_API_URL='${{ vars.NEXT_PUBLIC_DMOB_API_URL }}'" >> .env echo "NEXT_PUBLIC_GLIF_URL='${{ vars.NEXT_PUBLIC_GLIF_URL }}'" >> .env + echo "NEXT_PUBLIC_IS_TESTNET='${{ vars.NEXT_PUBLIC_IS_TESTNET }}'" >> .env echo "NEXTAUTH_URL='${{ vars.NEXTAUTH_URL }}'" >> .env echo "NEXTAUTH_SECRET='placeholder'" >> .env echo "GITHUB_ID='placeholder'" >> .env diff --git a/README.md b/README.md index 7ee8127..1980132 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ To get started with the Fil+ Registry Frontend, you can visit the live applicati GITHUB_ID GITHUB_SECRET NEXT_PUBLIC_MODE=development + NEXT_PUBLIC_IS_TESTNET ``` ## Support and Community diff --git a/src/config.ts b/src/config.ts index 8a87b75..6bb3cd1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -24,6 +24,7 @@ const localConfig = { dmobApiKey: process.env.NEXT_PUBLIC_DMOB_API_KEY ?? '', glifNodeUrl: process.env.NEXT_PUBLIC_GLIF_URL ?? 'https://api.node.glif.io/rpc/v1', + isTestnet: process.env.NEXT_PUBLIC_IS_TESTNET ?? 'true', } const prodConfig = { @@ -49,6 +50,7 @@ const prodConfig = { dmobApiUrl: process.env.NEXT_PUBLIC_DMOB_API_URL ?? '', dmobApiKey: process.env.NEXT_PUBLIC_DMOB_API_KEY ?? '', glifNodeUrl: process.env.NEXT_PUBLIC_GLIF_URL ?? '', + isTestnet: process.env.NEXT_PUBLIC_IS_TESTNET ?? 'false', } export const config = diff --git a/src/lib/wallet/BurnerWallet.ts b/src/lib/wallet/BurnerWallet.ts index 274fb4a..a09e5c0 100644 --- a/src/lib/wallet/BurnerWallet.ts +++ b/src/lib/wallet/BurnerWallet.ts @@ -37,11 +37,11 @@ export class BurnerWallet extends BaseWallet { : { token: async () => this.lotusNode?.token, } - + const isTestnet = config.isTestnet === 'true' this.api = new VerifyAPI( VerifyAPI.browserProvider(this.lotusNode.url, tokenProvider), { sign: this.sign, getAccounts: this.getAccounts }, - this.lotusNode.name !== 'Mainnet', + isTestnet, ) } catch (error) { console.error('Error loading wallet:', error) diff --git a/src/lib/wallet/LedgerWallet.ts b/src/lib/wallet/LedgerWallet.ts index 459f727..0f8be98 100644 --- a/src/lib/wallet/LedgerWallet.ts +++ b/src/lib/wallet/LedgerWallet.ts @@ -38,6 +38,7 @@ export class LedgerWallet extends BaseWallet { * @private */ private async initializeApi(): Promise { + const isTestnet = config.isTestnet === 'true' this.api = new VerifyAPI( VerifyAPI.browserProvider(this.lotusNode.url, { token: async () => this.lotusNode?.token, @@ -46,7 +47,7 @@ export class LedgerWallet extends BaseWallet { sign: this.sign, getAccounts: () => this.loadedAccounts, }, - process.env.NEXT_PUBLIC_MODE !== 'production', + isTestnet, ) }