Hi there,
I'm using
"@cityofzion/neon-js": "^3.1.0",
node -v v8.9.4
tryin to sing & send sweep transactions with this code as described here ;
const filledBalance = await api.getBalanceFrom({address:addr,net:"TestNet"}, api.neonDB)
if( filledBalance.balance.assets.NEO.balance.toNumber() > 0 ){
addresser.getAddress(addr).then(async function (dbAddres) {
let tx = Neon.create.tx({type: 128, version:2})
// Now let us add an intention to send 1 NEO to someone
tx .addOutput('NEO', filledBalance.balance.assets.NEO.balance.toNumber(),"ANTZ7qbbXFWxZaBLKUtjsPDa9B1uHMJRMv")
tx .addRemark('I am sending 1 NEO to someAddress') // Add an remark
tx .calculate(filledBalance.balance) // Now we add in the balance we retrieve from an external API and calculate the required inputs.
tx .sign(dbAddres.privatekey) // Sign with the private key of the balance
const hash = tx.hash
const serializedTx = tx.serialize(true);
const url = await api.neonDB.getRPCEndpoint("TestNet");
neonjs.rpc.Query.sendRawTransaction(serializedTx)
.execute(url)
.then(function (data) {
})
.catch(function (err) {
})
})
}
always returning an error with message (One of the identified items was in an invalid format.)
my dbAddr object is
{"address":"AKrwhvR6k4qkzGAXcyzmAnvkA8YW98qB7m","privatekey":"a56c53d70072f142cd15abf10cbe63a5ba67ff0f2207f3bfe5382788cb7212b1"}
I'm getting value for variables like this
hash:5f7ce9f4433e7b6fbb422cf84975d0e35b9625169f1a47b4bd45429a56b6927a
and
serializedTx:800201f0214920616d2073656e64696e672031204e454f20746f20736f6d65416464726573730166971150b4ef4909857161ef1a42bece9a33ccef290a3ded0975900ee4bcd4d10000019b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500c2eb0b000000004951ed1fc0cf48165ff05ce45d0b8bdb9d37ae73014140207b62d9584ab8f04168233cab5fad5dddb3acfe7559fe73fbb374789f8aee1d273e50d6b89e4eb8aeb952b432499f1a72f95153906bcc1d5f536d27c2b6b4022321022100bac1b9fd93575befb2f7c2fa27b9128922c9f074f38ed78c6b92f9ac053dac
What am I doing wrong ? Which item was this ? What is the proper way to prepare & sing and send a tx ?
Hi there, I'm using "@cityofzion/neon-js": "^3.1.0", node -v v8.9.4 tryin to sing & send sweep transactions with this code as described here ;
always returning an error with message (One of the identified items was in an invalid format.) my dbAddr object is
{"address":"AKrwhvR6k4qkzGAXcyzmAnvkA8YW98qB7m","privatekey":"a56c53d70072f142cd15abf10cbe63a5ba67ff0f2207f3bfe5382788cb7212b1"}
I'm getting value for variables like thishash:5f7ce9f4433e7b6fbb422cf84975d0e35b9625169f1a47b4bd45429a56b6927a
andserializedTx:800201f0214920616d2073656e64696e672031204e454f20746f20736f6d65416464726573730166971150b4ef4909857161ef1a42bece9a33ccef290a3ded0975900ee4bcd4d10000019b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500c2eb0b000000004951ed1fc0cf48165ff05ce45d0b8bdb9d37ae73014140207b62d9584ab8f04168233cab5fad5dddb3acfe7559fe73fbb374789f8aee1d273e50d6b89e4eb8aeb952b432499f1a72f95153906bcc1d5f536d27c2b6b4022321022100bac1b9fd93575befb2f7c2fa27b9128922c9f074f38ed78c6b92f9ac053dac
What am I doing wrong ? Which item was this ? What is the proper way to prepare & sing and send a tx ?