Skip to content

Commit

Permalink
feat: Add fnet to list of valid networks and update nodely urls to ne…
Browse files Browse the repository at this point in the history
…w 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)
  • Loading branch information
pbennett committed Sep 12, 2024
1 parent 4224d4e commit 8743101
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/use-wallet-solid/src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<State>(defaultState)
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('useWallet', () => {
</WalletProvider>
))

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)
Expand Down
2 changes: 1 addition & 1 deletion packages/use-wallet-vue/src/__tests__/useWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions packages/use-wallet/src/__tests__/manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/')
}
})

Expand Down Expand Up @@ -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/')
}
})

Expand Down
6 changes: 3 additions & 3 deletions packages/use-wallet/src/__tests__/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
})
Expand Down
8 changes: 5 additions & 3 deletions packages/use-wallet/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum NetworkId {
MAINNET = 'mainnet',
TESTNET = 'testnet',
BETANET = 'betanet',
FNET = 'fnet',
LOCALNET = 'localnet'
}

Expand Down Expand Up @@ -43,9 +44,10 @@ export function isNetworkConfigMap(config: NetworkConfig): config is NetworkConf
export type NetworkConfig = Partial<AlgodConfig> | Partial<Record<NetworkId, Partial<AlgodConfig>>>

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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/use-wallet/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 8743101

Please sign in to comment.