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

Question: how to create an account_update transaction? #3

Open
combustpizza opened this issue Mar 7, 2019 · 1 comment
Open

Question: how to create an account_update transaction? #3

combustpizza opened this issue Mar 7, 2019 · 1 comment

Comments

@combustpizza
Copy link

I don't quite understand how to create an account_update transaction, I tried adding the operation like so:

    const tx = new TransactionBuilder();

    tx.add_type_operation('account_update', {
        fee: {
            amount: 0, 
            asset_id: '1.3.1'
        },
        account: user.id,
        owner: {
            weight_threshold: 1,
            account_auths: [],
            key_auths: [ PublicKey.fromPublicKeyString('GXC76CWcEHaLnyWbcWmEiMRnMn9LfcTQQ5sDypx29Ei4Yp3BtxgzV'), 1 ],
            address_auths: []
        },
        active: {
            weight_threshold: 1,
            account_auths: [],
            key_auths: [ PublicKey.fromPublicKeyString('GXC76CWcEHaLnyWbcWmEiMRnMn9LfcTQQ5sDypx29Ei4Yp3BtxgzV'), 1 ],
            address_auths: []
        },
        new_options: {
            memo_key: PublicKey.fromPublicKeyString('GXC76CWcEHaLnyWbcWmEiMRnMn9LfcTQQ5sDypx29Ei4Yp3BtxgzV'),
            voting_account: '1.2.5',
            num_witness: 0,
            num_committee: 0,
            votes: [],
            extensions: []
        },
        extensions: []
    });

And this results in:

account_update.owner	 cause: authority.key_auths	 cause: value required  undefined 
 stack: Error: value required  undefined
    at Object.required (/home/user/NodeJS/test/node_modules/gxbjs/dist/serializer/src/SerializerValidation.js:39:19)

I also tried to pass the keys as strings, but would get this error:

Expecting key to begin with GXC, instead got G.

I'm not sure what I'm doing wrong here...

@xzshinan
Copy link

@combustpizza try it like this:
key_auths: [[ 'GXC76CWcEHaLnyWbcWmEiMRnMn9LfcTQQ5sDypx29Ei4Yp3BtxgzV', 1 ]],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants