1

I have a bug I can't solve.

const {
    callbackRoute,
    transactions,
    error,
    sessionId,
    onAbort,
    hasTransactions
  } = useSignTransactions(); 

  const [, setTransactionSessionId] = useState(null);
  const transactionStatus = transactionServices.useTrackTransactionStatus({
    transactionId: sessionId
  });

Consider the code above, useSignTransactions() is imported in the header.

Then, I call SendTransactions function and expect a session id back, which is fine. But, using the mentioned code I want some more info such as hasTransactions, error and so on.

When logging I only get the sessionId corrent, the others are just objects.

const { sendTransactions } = transactionServices;
  
  const sendPingTransaction = async () => {
    const pingTransaction = {
      value: '1000000000000000000',
      data: 'ping',
      receiver: contractAddress
    };
    await refreshAccount();

    const {sessionId}  = await sendTransactions({
      transactions: pingTransaction,
      transactionsDisplayInfo: {
        processingMessage: 'Processing Ping transaction',
        errorMessage: 'An error has occured during Ping',
        successMessage: 'Ping transaction successful',
        transactionDuration: 10000
      }
    });

    if (sessionId != null) {
      setTransactionSessionId(sessionId);
      console.log('log sessionId: ' + sessionId);
      console.log('log sessionError: ' + error);
      console.log('log sessionIdHook: ' + sessionId)
      console.log('log sessionHasTxs: ' + hasTransactions);
      console.log('log sessionTxs: ' + transactions);
      console.log('log sessionOnAbort: ' + onAbort);
      console.log('log sessionTxStatus: ' + transactionStatus.isPending);
      console.log('log sessionOnAbort: ' + transactionStatus.status);
    }
  };

All these are wrapped in _app,js as follows:

<DappProvider
 networkConfig={{ network, walletConnectBridge, walletConnectDeepLink }}
>
    <DappCoreUIWrapper>
        <NotificationModal />
        <SignTransactionsModals />
        <Component {...pageProps} />
    </DappCoreUIWrapper>
</DappProvider>

I tried several things, in the end I'll monitor the tx separately if the above mentioned hooks don't get me the data I want.

4

0 回答 0