Skip to content

Allow updating the generated program address #1

@stegaBOB

Description

@stegaBOB

Currently, the program address is generated as a const with a typed Address for the default key. There is no way to update this value. Some programs use separate addresses for local development/devnet vs mainnet. Currently those programs would need a copy of the generated clients for each cluster.

One potential solution could be to export let {program id} = "key" as Address and provide a setter to allow users to update the id. That would be a very simple change to the program template:

export let {{ programAddressConstant }} = '{{ program.publicKey }}' as Address;

export function {{ setProgramAddressFucntion }} (address: Address) {
  {{ programAddressConstant }} = address;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions