From 8743101180b730b5fc809951b85df0c8e6c25f8c Mon Sep 17 00:00:00 2001 From: Patrick Bennett Date: Wed, 11 Sep 2024 22:41:51 -0400 Subject: [PATCH] feat: Add fnet to list of valid networks and update nodely urls to new versions. (#258) * feat: Add FNET to list of valid networks and update nodely URLs * chore: update nodely URLs in tests to match URL change in network settings * remove fnet from walletconnect related network list (fnet genesis hash will change periodically and walletconnect wallets won't support fnet anyway) --- packages/use-wallet-solid/src/__tests__/index.test.tsx | 4 ++-- packages/use-wallet-vue/src/__tests__/useWallet.test.ts | 2 +- packages/use-wallet/src/__tests__/manager.test.ts | 4 ++-- packages/use-wallet/src/__tests__/store.test.ts | 6 +++--- packages/use-wallet/src/network.ts | 8 +++++--- packages/use-wallet/src/store.ts | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/use-wallet-solid/src/__tests__/index.test.tsx b/packages/use-wallet-solid/src/__tests__/index.test.tsx index 8f178535..1acc9435 100644 --- a/packages/use-wallet-solid/src/__tests__/index.test.tsx +++ b/packages/use-wallet-solid/src/__tests__/index.test.tsx @@ -191,7 +191,7 @@ describe('useWallet', () => { wallets: {}, activeWallet: null, activeNetwork: NetworkId.TESTNET, - algodClient: new algosdk.Algodv2('', 'https://testnet-api.algonode.cloud/') + algodClient: new algosdk.Algodv2('', 'https://testnet-api.4160.nodely.dev/') } mockStore = new Store(defaultState) @@ -398,7 +398,7 @@ describe('useWallet', () => { )) - const newAlgodClient = new algosdk.Algodv2('', 'https://mainnet-api.algonode.cloud/', '') + const newAlgodClient = new algosdk.Algodv2('', 'https://mainnet-api.4160.nodely.dev/', '') mockWalletManager.setActiveNetwork = async (networkId: NetworkId) => { mockSetAlgodClient(newAlgodClient) diff --git a/packages/use-wallet-vue/src/__tests__/useWallet.test.ts b/packages/use-wallet-vue/src/__tests__/useWallet.test.ts index 00b3aa16..b8ef2f9e 100644 --- a/packages/use-wallet-vue/src/__tests__/useWallet.test.ts +++ b/packages/use-wallet-vue/src/__tests__/useWallet.test.ts @@ -295,7 +295,7 @@ describe('useWallet', () => { const newNetwork = NetworkId.MAINNET // Default mainnet algod config - const newAlgodClient = new algosdk.Algodv2('', 'https://mainnet-api.algonode.cloud/', '') + const newAlgodClient = new algosdk.Algodv2('', 'https://mainnet-api.4160.nodely.dev/', '') mockWalletManager.setActiveNetwork = async (networkId: NetworkId) => { mockSetAlgodClient(newAlgodClient) diff --git a/packages/use-wallet/src/__tests__/manager.test.ts b/packages/use-wallet/src/__tests__/manager.test.ts index ce371fd8..815f9774 100644 --- a/packages/use-wallet/src/__tests__/manager.test.ts +++ b/packages/use-wallet/src/__tests__/manager.test.ts @@ -258,7 +258,7 @@ describe('WalletManager', () => { }, activeWallet: WalletId.KIBISIS, activeNetwork: NetworkId.BETANET, - algodClient: new Algodv2('', 'https://betanet-api.algonode.cloud/') + algodClient: new Algodv2('', 'https://betanet-api.4160.nodely.dev/') } }) @@ -344,7 +344,7 @@ describe('WalletManager', () => { }, activeWallet: WalletId.KIBISIS, activeNetwork: NetworkId.BETANET, - algodClient: new Algodv2('', 'https://betanet-api.algonode.cloud/') + algodClient: new Algodv2('', 'https://betanet-api.4160.nodely.dev/') } }) diff --git a/packages/use-wallet/src/__tests__/store.test.ts b/packages/use-wallet/src/__tests__/store.test.ts index 5af83311..598fea83 100644 --- a/packages/use-wallet/src/__tests__/store.test.ts +++ b/packages/use-wallet/src/__tests__/store.test.ts @@ -426,7 +426,7 @@ describe('Mutations', () => { expect(store.state.activeNetwork).toBe(NetworkId.TESTNET) const networkId = NetworkId.MAINNET - const algodClient = new Algodv2('', 'https://mainnet-api.algonode.cloud/') + const algodClient = new Algodv2('', 'https://mainnet-api.4160.nodely.dev/') setActiveNetwork(store, { networkId, algodClient }) expect(store.state.activeNetwork).toBe(networkId) }) @@ -556,7 +556,7 @@ describe('Type Guards', () => { wallets: {}, activeWallet: null, activeNetwork: NetworkId.TESTNET, - algodClient: new Algodv2('', 'https://testnet-api.algonode.cloud/') + algodClient: new Algodv2('', 'https://testnet-api.4160.nodely.dev/') } expect(isValidState(defaultState)).toBe(true) @@ -593,7 +593,7 @@ describe('Type Guards', () => { }, activeWallet: WalletId.DEFLY, activeNetwork: NetworkId.TESTNET, - algodClient: new Algodv2('', 'https://testnet-api.algonode.cloud/') + algodClient: new Algodv2('', 'https://testnet-api.4160.nodely.dev/') } expect(isValidState(state)).toBe(true) }) diff --git a/packages/use-wallet/src/network.ts b/packages/use-wallet/src/network.ts index cbfa6e5c..14e9ff1e 100644 --- a/packages/use-wallet/src/network.ts +++ b/packages/use-wallet/src/network.ts @@ -4,6 +4,7 @@ export enum NetworkId { MAINNET = 'mainnet', TESTNET = 'testnet', BETANET = 'betanet', + FNET = 'fnet', LOCALNET = 'localnet' } @@ -43,9 +44,10 @@ export function isNetworkConfigMap(config: NetworkConfig): config is NetworkConf export type NetworkConfig = Partial | Partial>> export const nodeServerMap = { - [NetworkId.MAINNET]: 'https://mainnet-api.algonode.cloud', - [NetworkId.TESTNET]: 'https://testnet-api.algonode.cloud', - [NetworkId.BETANET]: 'https://betanet-api.algonode.cloud' + [NetworkId.MAINNET]: 'https://mainnet-api.4160.nodely.dev', + [NetworkId.TESTNET]: 'https://testnet-api.4160.nodely.dev', + [NetworkId.BETANET]: 'https://betanet-api.4160.nodely.dev', + [NetworkId.FNET]: 'https://fnet-api.4160.nodely.dev' } export function createDefaultNetworkConfig(): NetworkConfigMap { diff --git a/packages/use-wallet/src/store.ts b/packages/use-wallet/src/store.ts index 4d8e1a4d..13275f9c 100644 --- a/packages/use-wallet/src/store.ts +++ b/packages/use-wallet/src/store.ts @@ -21,7 +21,7 @@ export const defaultState: State = { wallets: {}, activeWallet: null, activeNetwork: NetworkId.TESTNET, - algodClient: new Algodv2('', 'https://testnet-api.algonode.cloud/') + algodClient: new Algodv2('', 'https://testnet-api.4160.nodely.dev/') } export const LOCAL_STORAGE_KEY = '@txnlab/use-wallet:v3'