Skip to content

Instantly share code, notes, and snippets.

@pyramation
Created August 8, 2022 23:36
Show Gist options
  • Save pyramation/43320e8b952751a0bd5a77dbc5b601f4 to your computer and use it in GitHub Desktop.
Save pyramation/43320e8b952751a0bd5a77dbc5b601f4 to your computer and use it in GitHub Desktop.
/**
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { Coin } from "@cosmjs/amino";
import { MsgExecuteContractEncodeObject } from "cosmwasm";
import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx";
import { toUtf8 } from "@cosmjs/encoding";
import { InstantiateMsg, Member, ExecuteMsg, QueryMsg, QueryResponse, AdminResponse, TotalWeightResponse, MemberListResponse, MemberResponse, HooksResponse } from "./CW4Group.types";
export interface CW4GroupMessage {
contractAddress: string;
sender: string;
updateAdmin: ({
admin
}: {
admin?: string;
}, funds?: Coin[]) => MsgExecuteContractEncodeObject;
updateMembers: ({
add,
remove
}: {
add: Member[];
remove: string[];
}, funds?: Coin[]) => MsgExecuteContractEncodeObject;
addHook: ({
addr
}: {
addr: string;
}, funds?: Coin[]) => MsgExecuteContractEncodeObject;
removeHook: ({
addr
}: {
addr: string;
}, funds?: Coin[]) => MsgExecuteContractEncodeObject;
}
export class CW4GroupMessageComposer implements CW4GroupMessage {
sender: string;
contractAddress: string;
constructor(sender: string, contractAddress: string) {
this.sender = sender;
this.contractAddress = contractAddress;
this.updateAdmin = this.updateAdmin.bind(this);
this.updateMembers = this.updateMembers.bind(this);
this.addHook = this.addHook.bind(this);
this.removeHook = this.removeHook.bind(this);
}
updateAdmin = ({
admin
}: {
admin?: string;
}, funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(JSON.stringify({
update_admin: {
admin
}
})),
funds
})
};
};
updateMembers = ({
add,
remove
}: {
add: Member[];
remove: string[];
}, funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(JSON.stringify({
update_members: {
add,
remove
}
})),
funds
})
};
};
addHook = ({
addr
}: {
addr: string;
}, funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(JSON.stringify({
add_hook: {
addr
}
})),
funds
})
};
};
removeHook = ({
addr
}: {
addr: string;
}, funds?: Coin[]): MsgExecuteContractEncodeObject => {
return {
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
value: MsgExecuteContract.fromPartial({
sender: this.sender,
contract: this.contractAddress,
msg: toUtf8(JSON.stringify({
remove_hook: {
addr
}
})),
funds
})
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment