Skip to content

Commit

Permalink
fix(vue): ensure algodClient is a defined computed value
Browse files Browse the repository at this point in the history
  • Loading branch information
drichar committed Jun 18, 2024
1 parent 141f68c commit 155e2f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/nuxt/components/Connect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const sendTransaction = async (wallet: Wallet) => {
try {
const atc = new algosdk.AtomicTransactionComposer()
const suggestedParams = await algodClient.getTransactionParams().do()
const suggestedParams = await algodClient.value.getTransactionParams().do()
const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: wallet.activeAccount.address,
Expand All @@ -48,7 +48,7 @@ const sendTransaction = async (wallet: Wallet) => {
console.info(`[App] Sending transaction...`, transaction)
const result = await atc.execute(algodClient, 4)
const result = await atc.execute(algodClient.value, 4)
console.info(`[App] ✅ Successfully sent transaction!`, {
confirmedRound: result.confirmedRound,
Expand Down
4 changes: 2 additions & 2 deletions examples/vue-ts/src/components/Connect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const sendTransaction = async (wallet: Wallet) => {
try {
const atc = new algosdk.AtomicTransactionComposer()
const suggestedParams = await algodClient.getTransactionParams().do()
const suggestedParams = await algodClient.value.getTransactionParams().do()
const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
from: wallet.activeAccount.address,
Expand All @@ -47,7 +47,7 @@ const sendTransaction = async (wallet: Wallet) => {
console.info(`[App] Sending transaction...`, transaction)
const result = await atc.execute(algodClient, 4)
const result = await atc.execute(algodClient.value, 4)
console.info(`[App] ✅ Successfully sent transaction!`, {
confirmedRound: result.confirmedRound,
Expand Down
7 changes: 6 additions & 1 deletion packages/use-wallet-vue/src/useWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export function useWallet() {

return {
wallets,
algodClient,
algodClient: computed(() => {
if (!algodClient.value) {
throw new Error('Algod client is undefined')
}
return algodClient.value
}),
activeNetwork,
activeWallet,
activeWalletAccounts,
Expand Down

0 comments on commit 155e2f8

Please sign in to comment.