Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorigam committed Dec 24, 2024
1 parent 554208a commit f2c9306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ProviderInternalBaseWallet,
signerUtils,
} from '@vechain/sdk-network';
import { SimpleAccountABI, SimpleAccountFactoryABI } from '../assets/abi';
import { SimpleAccountABI, SimpleAccountFactoryABI } from '../assets';
import {
ExecuteWithAuthorizationSignData,
randomTransactionUser,
Expand Down Expand Up @@ -199,7 +199,7 @@ export const SmartAccountProvider = ({

/**
* Send a transaction on vechain by asking the privy wallet to sign a typed data content
* that will allow us the execute the action with his smart account trough the executeWithAuthorization
* that will allow us the execute the action with his smart account through the executeWithAuthorization
* function of the smart account.
*/
const sendTransaction = async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { useState, useEffect } from 'react';
import { useConnex } from '@vechain/dapp-kit-react';

/**
* Poll the chain for a transaction receipt until it is found (or timeout after 3 blocks)
* Poll the chain for a transaction receipt until it is found (or timeout after 5 blocks)
* @param thor Thor instance
* @param id Transaction id
* @param blocksTimeout Number of blocks to wait before timeout
* @param blocksTimeout Number of blocks to wait for the receipt
* @returns Transaction receipt
*/
export const pollForReceipt = async (
Expand All @@ -19,8 +20,7 @@ export const pollForReceipt = async (
const transaction = thor.transaction(id);
let receipt;

//Query the transaction until it has a receipt
//Timeout after 3 blocks
// Query the transaction until it has a receipt
for (let i = 0; i < blocksTimeout; i++) {
receipt = await transaction.getReceipt();
if (receipt) {
Expand All @@ -41,10 +41,10 @@ export const pollForReceipt = async (
};

/**
* Get the tx receipt of a tx id with a block timeout to wait for the receipt
* @param txId the tx id to get the receipt
* @param blocksTimeout the blocks to wait for the receipt
* @returns the tx receipt
* Get the tx receipt of a tx id with a block timeout to wait for the receipt
* @param txId The tx id to get the receipt
* @param blockTimeout The block timeout to wait for the receipt
* @returns The tx receipt
*/
export const useTxReceipt = (txId?: string, blockTimeout?: number) => {
const { thor } = useConnex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const useWallet = (): UseWalletReturnType => {
if (isConnectedWithDappKit) {
dappKitDisconnect();
} else {
logout();
await logout();
}
};

Expand Down

0 comments on commit f2c9306

Please sign in to comment.