Skip to content

helpers for nested create Any objects #281

@pyramation

Description

@pyramation

https://github.com/cosmos/groups-ui/blob/master/src/shared-state/groups-store.ts#L363

  • fix type issue in comment below
  • fix the interface so developer doesn't have to encode decisionPolicy field
import Long from 'long';
const {
    createGroupWithPolicy
} = cosmos.group.v1.MessageComposer.withTypeUrl;

const {
    PercentageDecisionPolicy   
} = cosmos.group.v1;

const msg = createGroupWithPolicy({
    admin: 'a string',
    groupMetadata: 'string here',
    groupPolicyAsAdmin: true,
    groupPolicyMetadata: 'a string here too',
    members: [], // MemberRequest[],
    decisionPolicy: { // types here aren't exactly happy with the encode function for some reason...
        // WE CAN IMPROVE THIS....
        typeUrl: '/cosmos.group.v1.PercentageDecisionPolicy',
        value: PercentageDecisionPolicy.encode({
            percentage: 'a string',
            windows: {
                votingPeriod: {
                    nanos: 0,
                    seconds: Long.fromValue(100)
                },
                minExecutionPeriod: {
                    nanos: 0,
                    seconds: Long.fromValue(100)
                }
            }
        }).finish()
    }
})

Metadata

Metadata

Assignees

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