Skip to content

Tuple-like EntryPointMsg variants incorrenctly generated #101

@adairrr

Description

@adairrr

For tuple-like enum variants, the types are incorrectly generated.

Example:

enum ExecuteMsg {
  UpdateOwnership(::cw_ownable::Action),
}

should generate msg-composer:

export interface AnsHostMessage {
...
  updateOwnership: (funds?: Coin[]) => MsgExecuteContractEncodeObject
...
}

export class AnsHostMessageComposer implements AnsHostMessage {
...
updateOwnership = (action: Action, funds?: Coin[]): MsgExecuteContractEncodeObject => {  
  return {  
    typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',  
    value: MsgExecuteContract.fromPartial({  
      sender: this.sender,  
      contract: this.contractAddress,  
      msg: toUtf8(  
        JSON.stringify({  
          update_ownership: action,  
        })  
      ),  
      funds,  
    }),  
  }  
}
...
}

and msg-builder:

static updateOwnership = (action: Action): ExecuteMsg => {  
  return {  
    update_ownership: action,  
  }  
}

Technically it should generate the parameter as:

updateOwnership: (action: CamelCasedProperties<Action>, funds?: Coin[])

And the clients:

updateOwnership = async (  
action: Action,
  fee: number | StdFee | 'auto' = 'auto',  
  memo?: string,  
  funds?: Coin[]  
)

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