Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't add 2 UCO/token transfers to the same address ( libjs ) #17

Closed
herissondev opened this issue Jul 15, 2022 · 0 comments
Closed
Labels
Bug Bounty Issue retained in Bug Bounty Bug Something isn't working Campaign: Archethic Has reproducible steps The issue is ready to work on. p: archethic JS SDK p: archethic Node Passed triage Reproductible steps are present and the issue is not duplicate or invalid Resolved The issue has been resolved

Comments

@herissondev
Copy link

Description

When transferring UCOs using libjs, it is possible to add multiple transfers for 2 different addresses: for example sending 20 UCOs to address A and 15 to address B.
However, sending 2 transfers to the same address resolves as an invalid transaction.

I don't know if that is an expected behaviour or not. If it is, I think it should be explicitly said in the doc.

Here is the code I used :

const archethic = require('archethic')
const endpoint = "https://mainnet.archethic.net"
const seed = "myseed"
const seed_address = archethic.deriveAddress(seed, 0)
console.log("seed_adress : " ,seed_address)
async function main() {
    let tx = archethic.newTransactionBuilder("transfer")

    const address1 = archethic.deriveAddress('receiver1', 0)
    // const address2 = archethic.deriveAddress('receiver2', 0)
    
    tx = tx.addUCOTransfer(address1, 1.03)
    // tx = tx.addUCOTransfer(address2, 1.99). (WORKS !)
    tx = tx.addUCOTransfer(address1, 1.99)

    tx = tx.build(seed, await archethic.getTransactionIndex(seed_address, endpoint))
    
    const originPrivateKey = archethic.getOriginKey()
    tx = tx.originSign(originPrivateKey)

    
    console.log(tx.toJSON())
    const resp = await archethic.sendTransaction(tx, endpoint) 
    console.log(resp)

}
main()

Logs / Images

We get an invalid transaction response

Platform

MacOs

Version of Archethic apps

Using libjs 1.9.1

Fix

No response

@herissondev herissondev added the Bug Something isn't working label Jul 15, 2022
@Neylix Neylix added In triage Presently being triaged by the archethic team. p: archethic Node p: archethic JS SDK Has reproducible steps The issue is ready to work on. and removed In triage Presently being triaged by the archethic team. labels Jul 15, 2022
@ghost ghost added Passed triage Reproductible steps are present and the issue is not duplicate or invalid Bug Bounty Issue retained in Bug Bounty Resolved The issue has been resolved labels Aug 2, 2022
@ghost ghost closed this as completed Aug 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bounty Issue retained in Bug Bounty Bug Something isn't working Campaign: Archethic Has reproducible steps The issue is ready to work on. p: archethic JS SDK p: archethic Node Passed triage Reproductible steps are present and the issue is not duplicate or invalid Resolved The issue has been resolved
Projects
None yet
Development

No branches or pull requests

3 participants