Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

transfer_combine fails on staking operations #60

Description

@roman-kashitsyn

transfer_combine call fails if the transaction contains staking operations.
For example, when I try to execute the following transaction:

    const payloads = await session.payloads({
        network_identifier: net_id,
        operations: [
            {
                operation_identifier: { index: 0 },
                type: "TRANSACTION",
                account: account.account_identifier,
                amount: {
                    value: `${-stakeAmount}`,
                    currency: {symbol: "ICP", decimals: 8}
                }
            },
            {
                operation_identifier: { index: 1 },
                type: "TRANSACTION",
                account: neuronAccount.account_identifier,
                amount: {
                    value: `${stakeAmount}`,
                    currency: {symbol: "ICP", decimals: 8}
                }
            },
            {
                operation_identifier: { index: 2 },
                type: "FEE",
                account: account.account_identifier,
                amount: {
                    value: "-10000",
                    currency: {symbol: "ICP", decimals: 8}
                }
            },
            {
                operation_identifier: { index: 3 },
                type: "STAKE",
                account: account.account_identifier,
                metadata: { neuron_identifier: 1}
            },
            {
                operation_identifier: { index: 4 },
                type: "SET_DISSOLVE_TIMESTAMP",
                account: account.account_identifier,
                metadata: {
                    neuron_identifier: 1,
                    dissolve_time_utc_seconds: 1879939507
                }
            },
            {
                operation_identifier: { index: 5 },
                type: "START_DISSOLVE",
                account: account.account_identifier,
                metadata: { neuron_identifier: 1}
            }
        ],
        public_keys: [{hex_bytes: pub_key, curve_type: "edwards25519"}]
    });

    const combined = transfer_combine(private_key, payloads);

The client fails with the following assertion error:

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  assert(
    req.signatures.length === unsigned_transaction.ingress_expiries.length * 2
  )

    at combine (/Users/lifted/Projects/rosetta-client/lib/construction_combine.js:52:3)
    at transfer_combine (/Users/lifted/Projects/rosetta-client/lib/construction_combine.js:15:10)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions