'How to sign and send transfer transaction using waves-transaction JS library?
Please help me understand https://testnodes.wavesnodes.com/api-docs/index.html I use this api and this library https://github.com/wavesplatform/waves-transactions I cannot send a transaction using the manual to the library or directly by POST request for api.
common mistakes:
Error: State check failed. Reason: Script doesn’t exist and proof
Error: State check failed. Reason: Transactions from non-scripted accounts must have exactly 1 proof
A POST request for url / addresses also gives an error. Provided API key is not correct. Here is my code:
const { transfer, broadcast } = require("@waves/waves-transactions");
const seed =
"ride flee tenant tuna share buyer work west amateur review time kick";
const signedTranserTx = transfer(
{
amount: 1,
recipient: "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8"
},
seed
);
const nodeUrl = "http://testnodes.wavesnodes.com";
broadcast(signedTranserTx , nodeUrl)
.then(resp => console.log(resp))
.catch(err => console.error(err));
Solution 1:[1]
[Update]
The above code working good. Just a quick update since I see the new testnet URI is below link:
https://nodes-testnet.wavesnodes.com
I mean I have replace from https://testnodes.wavesnodes.com to https://nodes-testnet.wavesnodes.com then it's working maybe because we created the account from the different place.
So this is the final code:
const { transfer, broadcast } = require("@waves/waves-transactions");
const seed =
"ride flee tenant tuna share buyer work west amateur review time kick";
const signedTranserTx = transfer(
{
amount: 100,
recipient: "3N3pJ8xAnbaSBFdAbnaKe4yu4ZXbYkatMcN"
},
seed
);
const nodeUrl = "https://nodes-testnet.wavesnodes.com";
broadcast({ ...signedTranserTx, chainId: "T" }, nodeUrl)
.then(resp => console.log(resp))
.catch(err => console.error(err));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ayoung |
