Skip to content

Stellar contract invoke command incorrectly displays __constructor as invokable function #2179

@leighmcculloch

Description

@leighmcculloch

The stellar contract invoke command currently displays __constructor as an available function to invoke, but this is misleading because:

  • The __constructor function is automatically called during contract deployment
  • It should not be listed as an available function for the invoke command
  • Users may attempt to invoke it manually, which would fail or be confusing

This creates confusion for users who might think they can manually invoke the constructor after deployment, when in fact it's only called once during the deploy process. The invoke command should filter out constructor functions to avoid this confusion.

Steps to reproduce

  1. Deploy a contract with a constructor
  2. Run stellar contract invoke --id <contract_id> --list or similar
  3. Observe that __constructor appears in the list of invokable functions

Expected behavior

The __constructor function should not appear in the list of functions available for invocation.

Example

$ stellar contract invoke --id testc
Usage: stellar contract invoke --id testc -- [COMMAND]

Commands:
  __constructor
  name
  symbol
  decimals
  total_supply
  balance_of
  transfer
  transfer_from
  approve
  allowance
  mint
  burn
  help           Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions