Hi everyone,
I am trying to manually create contract call transaction, sign it, and then broadcast. Issue appears in the final step (send signed tx). I’m using [email protected] (js) and [email protected]. This is the procedure:
- initialize client
let client = await Ae({
url: "http://localhost:3001/",
internalUrl: "http://localhost:3001/internal/",
keypair: wallets[0],
nativeMode: true,
networkId: 'ae_devnet',
compilerUrl: 'http://localhost:3080'
})
- Create transaction
let tx = await client.contractCallTx({
callerId :'ak_2mwRmUeYmfuW93ti9HMSUJzCk1EYcQEfikVSzgo6k2VghsWhgU',
contractId : 'ct_2CGgcDvUarBGf5KFDArvCkVh4Pnj3NgWCYB2LY6Aw8Km4WPhtc',
abiVersion : 1,
amount : 0,
gas : 10000000,
callData : 'cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACBBy0//B8qHRJKsGwguR3V9heRWcHkjlDwi4abi8PuBJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgdPWP66dSrgQm7L7joxQU2OazM11k7EFvPldOEGx+VBKGocxj'
})
Contract with given ID actually exists and is deployed on private network running locally (forgae node). Caller account matches the keypair provided when initializing client. Call data is encoded using local sophia_http compiler.
- Sign and send
let signedTx = await client.signTransaction(tx)
console.log("signed tx", signedTx)
let result = await client.sendTransaction(signedTx, { verifiy: true }).catch(console.log)
This is the error output after sendTransaction()
is called:
{ Error: While calling postTransaction (body), POST to http://localhost:3001/v2/transactions failed with 400: Invalid tx
at Object.<anonymous> (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:61641)
at w (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:140792)
at Generator._invoke (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:140580)
at Generator.e.(anonymous function) [as throw] (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:140971)
at n (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:2527)
at c (node_modules/@aeternity/aepp-sdk/dist/aepp-sdk.js:1:2773)
at processTicksAndRejections (internal/process/next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