1

I'm trying to send a ballot operation with Taquito and Beacon SDK. Here's my code:

const currentProposal: string = (await Tezos.rpc.getCurrentProposal())?.toString() || "";
const branch: string = await Tezos.rpc.getBlockHash();
const period: number = (await Tezos.rpc.getCurrentPeriod()).voting_period.index;

const op = {
    "branch": branch,
    "contents": [
        {
            "kind": TezosOperationType.BALLOT,
            "source": userAddress,
            "period": period,
            "proposal": currentProposal,
            "ballot": ballotValue
        }
    ]
};

/*
Values I got:

        branch: 'BLrLfk6Z3vXx3EzNjkFz4dQEzNKZ1AZTUv5ecw4AADvPjWFHkTS',
        contents: [
            {
                kind: 'ballot',
                source: 'tz1...',
                period: 79,
                ballot: 'yay',
                proposal: 'PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg',
            },
*/

const hash = await wallet.sendOperations([
    op
]);

I'm getting the following error, it seems coming from beacon-sdk:

[PARAMETERS_INVALID_ERROR]:Some of the parameters you provided are invalid and the request could not be completed. Please check your inputs and try again.

The pkh I use as source is not a delegate, so I'm expecting an error. More likely something like "no keys for the source contract tz1..." as with tezos-client submit ballot, not a format error.

The target is to have to confirm the operation with connected Temple wallet. When I try it with a simple transaction operation, it's ok, so my wallet is well initialized.

Is my operation not correctly formated ? Are Taquito or Beacon SDK suitable with ballot operation ? Or maybe Beacon SDK checks if phk is a delegate and returns this error if not ?

I want to be sure of that before taking time necessary to create a private network to test delegates and votes.

1 Answer 1

1

Your operation itself is formatted well, but you should pass to the wallet just the contents, like this:

const hash = await wallet.sendOperations(op.contents);

And yes, as you have already mentioned, when injecting it you will receive HTTP 500 with the error message:

[
  {
    "kind": "temporary",
    "id": "failure",
    "msg": "Error while applying operation {hash}:\nError:\n  The provided public key (with hash {address}) is not registered as valid delegate key.\n"
  }
]
1
  • 1
    Thanks, it works now.
    – avl
    Sep 1, 2022 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.