Is there a simple API to transfer ERC-1155(Polygon Mainnet) tokens to other users?

479 Views Asked by At

Sorry I am new to blockchain development, so pardon my silly basic question.

I have created a bunch of ERC-1155 using Polygon main net. I have all the address and ids of the token. Now I want to transfer them to other users from my backend(nodejs) api.

What I have tried till now:

Used opensea-js with following code but getting alchemy error.

import { OpenSeaPort, Network } from 'opensea-js'
import Web3  from "web3"
// This example provider won't let you make transactions, only read-only calls:
const provider = new Web3.providers.HttpProvider('https://polygon-mainnet.g.alchemy.com/v2/**************************')
const seaport = new OpenSeaPort(provider, {
  networkName: Network.Main,
})
const transactionHash = await seaport.transfer({
  asset: {
    tokenId: '**************************************',
    tokenAddress:'**********************************',
    schemaName: "ERC1155"
  },
  fromAddress: '***********************************', // Must own the asset
  toAddress: '*************************************',
  quantity: 1,
})
console.log(transactionHash);

Its giving error "Unsupported method: eth_sendTransaction"

I then searched about this error and alchemy has some complex solution for this. But I believe this is a very simple task and there must be a simpler solution which I could not find.

0

There are 0 best solutions below