Skip to content

Commit

Permalink
fix(core): update algosdk import to resolve CommonJS module issue (#259)
Browse files Browse the repository at this point in the history
This commit changes the import of `Algodv2` from `algosdk` to use the default import syntax. This resolves a SyntaxError in consuming apps that use CommonJS modules.

Closes #216
  • Loading branch information
drichar authored Sep 12, 2024
1 parent 8743101 commit daf738a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/use-wallet/src/store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Algodv2 } from 'algosdk'
import algosdk from 'algosdk'
import { NetworkId, isValidNetworkId } from 'src/network'
import { WalletId, type WalletAccount } from 'src/wallets'
import type { Store } from '@tanstack/store'
Expand All @@ -14,14 +14,14 @@ export interface State {
wallets: WalletStateMap
activeWallet: WalletId | null
activeNetwork: NetworkId
algodClient: Algodv2
algodClient: algosdk.Algodv2
}

export const defaultState: State = {
wallets: {},
activeWallet: null,
activeNetwork: NetworkId.TESTNET,
algodClient: new Algodv2('', 'https://testnet-api.4160.nodely.dev/')
algodClient: new algosdk.Algodv2('', 'https://testnet-api.4160.nodely.dev/')
}

export const LOCAL_STORAGE_KEY = '@txnlab/use-wallet:v3'
Expand Down Expand Up @@ -145,7 +145,7 @@ export function setAccounts(

export function setActiveNetwork(
store: Store<State>,
{ networkId, algodClient }: { networkId: NetworkId; algodClient: Algodv2 }
{ networkId, algodClient }: { networkId: NetworkId; algodClient: algosdk.Algodv2 }
) {
store.setState((state) => ({
...state,
Expand Down

0 comments on commit daf738a

Please sign in to comment.