Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Define and add handler for message noop #140

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions proto/gno/vm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@ message MemFile {
string name = 1;
// the content of the source gno file
string body = 2;
}

// MsgNoop is the message for sponsor service
// denoted as "m_noop"
message MsgNoop {
// the bech32 address of the caller
string caller = 1;
}
66 changes: 66 additions & 0 deletions src/proto/gno/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ export interface MemFile {
body: string;
}

/**
* MsgNoop is the message for sponsor service
* denoted as "m_noop"
*/
export interface MsgNoop {
/** the bech32 address of the caller */
caller: string;
}

function createBaseMsgCall(): MsgCall {
return { caller: '', send: '', pkg_path: '', func: '', args: null };
}
Expand Down Expand Up @@ -579,6 +588,63 @@ export const MemFile = {
},
};

function createBaseMsgNoop(): MsgNoop {
return { caller: '' };
}

export const MsgNoop = {
encode(message: MsgNoop, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.caller !== '') {
writer.uint32(10).string(message.caller);
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): MsgNoop {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgNoop();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.caller = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): MsgNoop {
return { caller: isSet(object.caller) ? globalThis.String(object.caller) : '' };
},

toJSON(message: MsgNoop): unknown {
const obj: any = {};
if (message.caller !== undefined) {
obj.caller = message.caller;
}
return obj;
},

create<I extends Exact<DeepPartial<MsgNoop>, I>>(base?: I): MsgNoop {
return MsgNoop.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgNoop>, I>>(object: I): MsgNoop {
const message = createBaseMsgNoop();
message.caller = object.caller ?? '';
return message;
},
};

type Builtin =
| Date
| Function
Expand Down
2 changes: 1 addition & 1 deletion src/proto/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { MsgSend } from './gno/bank';
export { MsgAddPackage, MsgCall, MemFile, MemPackage } from './gno/vm';
export { MsgAddPackage, MsgCall, MemFile, MemPackage, MsgNoop } from './gno/vm';
export { Any } from './google/protobuf/any';
1 change: 1 addition & 0 deletions src/wallet/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export enum MsgEndpoint {
MSG_ADD_PKG = '/vm.m_addpkg',
MSG_CALL = '/vm.m_call',
MSG_RUN = '/vm.m_run',
MSG_NOOP = '/vm.m_noop',
}