I send transaction from xdc3 (contract) library to xdcpay by mean xdc-connect library (using xinpay.js module and requirements), but occurre error. You have working example send transaction to xdcpay wallet in browser for signing from JavaScript context?
Example of my code:
let Web3 = require('web3');
let Xdc3 = require('xdc3');
import * as xinpay from './XinPay';
let web3 = new Web3('wss://ws.apothem.network/ws');
let xdc3 = new Xdc3("wss://ws.apothem.network/ws");
// Token Contract
const ERC20TransferABI = [...]
const TOKEN_ADDRESS = "xdc67a32d6D502Eac7Ce097DA3AcBDee6C15DDD01eb"
const eursToken = new xdc3.eth.Contract(ERC20TransferABI, TOKEN_ADDRESS)
// Multisig contract
const MULTISIGN_ADDRESS = "xdc14795A18238C49856c7513F2Bc72BF6f4b423Ddc"
const multisignWallet = new xdc3.eth.Contract(MultisignWalletABI, MULTISIGN_ADDRESS)
console.log('multisignWallet', multisignWallet)
const token_address = "xdc67a32d6D502Eac7Ce097DA3AcBDee6C15DDD01eb"
const senderAddress = "xdc14795A18238C49856c7513F2Bc72BF6f4b423Ddc"
const receiverAddress = "0xedf9197329646fb4b028b40c2850ac13a24258bd"
let nonce = xdc3.eth.getTransactionCount(Xdc3.utils.toChecksumAddress("xdcedf9197329646fb4b028b40c2850ac13a24258bd"))
let rawTransaction = {
"from": Xdc3.utils.toChecksumAddress(senderAddress),
"gasPrice": web3.utils.toHex(2 * 1e9),
"gasLimit": web3.utils.toHex(210000),
"to": Xdc3.utils.toChecksumAddress(receiverAddress),
"value": "0x0",
"data": eursToken.methods.transfer(receiverAddress, "1000"),
"nonce": nonce,
}
await xinpay.SendTransaction(rawTransaction).then((res) => {
console.log('SendTransaction', res);
});
Discussion (1)
Can you once try this and see if it solves your issue.
For websocket :
const Xdc3 = require("xdc3");
let provider = new Xdc3.providers.WebsocketProvider('wss://ws.apothem.network/ws');
let xdc3 = new Xdc3(provider);
const Web3 = require("web3");
let provider = new Web3.providers.WebsocketProvider('wss://ws.apothem.network/ws');
let web3 = new Web3(provider);
For Http RPC
const Xdc3 = require("xdc3");
let provider = new Xdc3.providers.HttpProvider('rpc.apothem.network');
let xdc3 = new Xdc3(provider);
const Web3 = require("web3");
let provider = new Web3.providers.HttpProvider('rpc.apothem.network');
let web3 = new Web3(provider);