Send NFTs from NodeJS wallet

So the goal is to send NFTs from a wallet, which has been generated by the ethers.js library.
I want to use this method
But before that, I have to connect my ethers.js generated wallet with Moralis (or Moralis could generate a new one, which is also totally fine). I am using require('moralis/node');
However, I canโ€™t run

await Moralis.authenticate();
await Moralis.enableWeb3();


    if (!((_window = window) !== null && _window !== void 0 && _window.ethereum)) {
ReferenceError: window is not defined

Which makes sense, since there is now window on NodeJS.

So how do I proceed? Is there a way to send NFTs from the serverside wallet with Moralis or do I have to use another library?
take a look at this example,
by nodejs you mean you using html, js and css ? (just to clarify)

you will have to write your own code if you want to send NFTs with a hardcoded private key from nodejs server side

No, it is running on NodeJS, which only provides the serverside wallet:

let walletWithProvider = new ethers.Wallet(wallet.privateKey, provider);

And this wallet has a NFT and its task is to transfer the NFT to another wallet. I want to achieve this with Moralis if possible.

This isnโ€™t possible with Moralis or any other library? What about ethers.js? Do you know anything?

you can do it with ethers or web3, not with Moralis directly

1 Like