Skip to content

Commit daf738a

Browse files
authored
fix(core): update algosdk import to resolve CommonJS module issue (#259)
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
1 parent 8743101 commit daf738a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/use-wallet/src/store.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Algodv2 } from 'algosdk'
1+
import algosdk from 'algosdk'
22
import { NetworkId, isValidNetworkId } from 'src/network'
33
import { WalletId, type WalletAccount } from 'src/wallets'
44
import type { Store } from '@tanstack/store'
@@ -14,14 +14,14 @@ export interface State {
1414
wallets: WalletStateMap
1515
activeWallet: WalletId | null
1616
activeNetwork: NetworkId
17-
algodClient: Algodv2
17+
algodClient: algosdk.Algodv2
1818
}
1919

2020
export const defaultState: State = {
2121
wallets: {},
2222
activeWallet: null,
2323
activeNetwork: NetworkId.TESTNET,
24-
algodClient: new Algodv2('', 'https://testnet-api.4160.nodely.dev/')
24+
algodClient: new algosdk.Algodv2('', 'https://testnet-api.4160.nodely.dev/')
2525
}
2626

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

146146
export function setActiveNetwork(
147147
store: Store<State>,
148-
{ networkId, algodClient }: { networkId: NetworkId; algodClient: Algodv2 }
148+
{ networkId, algodClient }: { networkId: NetworkId; algodClient: algosdk.Algodv2 }
149149
) {
150150
store.setState((state) => ({
151151
...state,

0 commit comments

Comments
 (0)