From e2098cce62f21a53478766e477161abe0cae8250 Mon Sep 17 00:00:00 2001 From: Doug Richar Date: Wed, 11 Sep 2024 22:49:38 -0400 Subject: [PATCH] fix(core): update algosdk import to resolve CommonJS module issue 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 --- packages/use-wallet/src/store.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/use-wallet/src/store.ts b/packages/use-wallet/src/store.ts index 13275f9c..1bc4d362 100644 --- a/packages/use-wallet/src/store.ts +++ b/packages/use-wallet/src/store.ts @@ -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' @@ -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' @@ -145,7 +145,7 @@ export function setAccounts( export function setActiveNetwork( store: Store, - { networkId, algodClient }: { networkId: NetworkId; algodClient: Algodv2 } + { networkId, algodClient }: { networkId: NetworkId; algodClient: algosdk.Algodv2 } ) { store.setState((state) => ({ ...state,