tatumio / tatum-js

πŸš€ Tatum SDK: A πŸ’ͺ powerful, 🌟 feature-rich TypeScript/JavaScript πŸ“š library that streamlines the πŸ› οΈ development of 🌐 blockchain applications.
https://docs.tatum.io
MIT License
360 stars 110 forks source link

Cannot read properties of undefined (reading 'use') #1082

Closed WeMakeBest closed 5 months ago

WeMakeBest commented 5 months ago

This is my code to signAndBroadcast the transaction

import { TatumSDK, Network, BinanceSmartChain } from "@tatumio/tatum";
import { EvmWalletProvider } from "@tatumio/evm-wallet-provider";

async function bsc() {
    const tatumSdk = await TatumSDK.init < BinanceSmartChain > ({
        network: Network.BINANCE_SMART_CHAIN_TESTNET,
        apiKey: { v4: "!!!API_KEY!!!" },
        configureWalletProviders: [EvmWalletProvider],
    });

    const payload = {
        privateKey: "!!!PRIVATE_KEY!!!",
        to: "!!!TO!!!",
        value: "0.1",
        maxPriorityFeePerGas: "10",
        maxFeePerGas: "10",
    };

    console.log(tatumSdk.walletProvider);

    const txHash = await tatumSdk.walletProvider
        .use(EvmWalletProvider)
        .signAndBroadcast(payload);

    console.log(txHash);
    await tatumSdk.destroy();
}

bsc();

When I try to run this code I'm getting

Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'use')
    at bsc (e:\Work Software\XAMPP\xampp_php_8\htdocs\BitxeAPI\test.js:22:10)
    at <anonymous> (e:\Work Software\XAMPP\xampp_php_8\htdocs\BitxeAPI\test.js:29:1)
    at run (internal/modules/esm/module_job:218:25)

I'm using the latest Tatum SDK as per my debugging issue is with this line of code. .use(EvmWalletProvider)

I debugged the code and searched on google but didn't found any solution.

hehe100596 commented 5 months ago

Apologies for the inconvenience, this should now be fixed as mentioned here - https://github.com/tatumio/ecosystem-addons/pull/31#issuecomment-2024637501

I double checked just to be safe and it now works with the latest dependencies. Closing.

WeMakeBest commented 5 months ago

Can you tell me what packages I have to install to perform transactions?

WeMakeBest commented 5 months ago

image I'm still getting the same issue I have tried reinstalling the "@tatumio/tatum" and "@tatumio/evm-wallet-provider"