From 08dcf9337c3fdd9a63d6e5a4a1c153662b2c1657 Mon Sep 17 00:00:00 2001 From: jinoosss <112360739+jinoosss@users.noreply.github.com> Date: Sat, 26 Jul 2025 02:31:02 +0900 Subject: [PATCH 1/2] fix: fix a order of columns in proto --- proto/gno/vm.proto | 16 ++++----- src/proto/gno/vm.ts | 82 +++++++++++++++++++++------------------------ 2 files changed, 46 insertions(+), 52 deletions(-) diff --git a/proto/gno/vm.proto b/proto/gno/vm.proto index b54a1af..1b12732 100644 --- a/proto/gno/vm.proto +++ b/proto/gno/vm.proto @@ -11,14 +11,14 @@ message MsgCall { string caller = 1; // the amount of funds to be deposited to the package, if any ("") string send = 2; + // the amount of funds to lock for the storage, if any ("") + string max_deposit = 3; // the gno package path - string pkg_path = 3; + string pkg_path = 4; // the function name being invoked - string func = 4; + string func = 5; // the function arguments - repeated string args = 5; // null | string[] - // the amount of funds to lock for the storage, if any ("") - string max_deposit = 6; + repeated string args = 6; // null | string[] } // MsgAddPackage is the package deployment tx message, @@ -41,10 +41,10 @@ message MsgRun { string caller = 1; // the amount of funds to be deposited to the package, if any ("") string send = 2; - // the package being executed - MemPackage package = 3; // the amount of funds to put down for the storage fee, if any ("") - string max_deposit = 4; + string max_deposit = 3; + // the package being executed + MemPackage package = 4; } // MemPackage is the metadata information tied to diff --git a/src/proto/gno/vm.ts b/src/proto/gno/vm.ts index eb562b3..0a00d73 100644 --- a/src/proto/gno/vm.ts +++ b/src/proto/gno/vm.ts @@ -20,14 +20,14 @@ export interface MsgCall { caller: string; /** the amount of funds to be deposited to the package, if any ("") */ send: string; + /** the amount of funds to lock for the storage, if any ("") */ + max_deposit: string; /** the gno package path */ pkg_path: string; /** the function name being invoked */ func: string; /** the function arguments */ args: string[] | null; - /** the amount of funds to lock for the storage, if any ("") */ - max_deposit: string; } /** @@ -54,10 +54,10 @@ export interface MsgRun { caller: string; /** the amount of funds to be deposited to the package, if any ("") */ send: string; - /** the package being executed */ - package?: MemPackage | undefined; /** the amount of funds to put down for the storage fee, if any ("") */ max_deposit: string; + /** the package being executed */ + package?: MemPackage | undefined; } /** @@ -92,10 +92,10 @@ function createBaseMsgCall(): MsgCall { return { caller: '', send: '', + max_deposit: '', pkg_path: '', func: '', args: null, - max_deposit: '', }; } @@ -110,19 +110,17 @@ export const MsgCall: MessageFns = { if (message.send !== '') { writer.uint32(18).string(message.send); } + if (message.max_deposit !== '') { + writer.uint32(26).string(message.max_deposit); + } if (message.pkg_path !== '') { - writer.uint32(26).string(message.pkg_path); + writer.uint32(34).string(message.pkg_path); } if (message.func !== '') { - writer.uint32(34).string(message.func); + writer.uint32(42).string(message.func); } - if (message.args) { - for (const v of message.args) { - writer.uint32(42).string(v!); - } - } - if (message.max_deposit !== '') { - writer.uint32(50).string(message.max_deposit); + for (const v of message.args) { + writer.uint32(50).string(v!); } return writer; }, @@ -156,7 +154,7 @@ export const MsgCall: MessageFns = { break; } - message.pkg_path = reader.string(); + message.max_deposit = reader.string(); continue; } case 4: { @@ -164,7 +162,7 @@ export const MsgCall: MessageFns = { break; } - message.func = reader.string(); + message.pkg_path = reader.string(); continue; } case 5: { @@ -172,11 +170,7 @@ export const MsgCall: MessageFns = { break; } - if (!message.args) { - message.args = []; - } - - message.args.push(reader.string()); + message.func = reader.string(); continue; } case 6: { @@ -184,7 +178,7 @@ export const MsgCall: MessageFns = { break; } - message.max_deposit = reader.string(); + message.args.push(reader.string()); continue; } } @@ -200,16 +194,16 @@ export const MsgCall: MessageFns = { return { caller: isSet(object.caller) ? globalThis.String(object.caller) : '', send: isSet(object.send) ? globalThis.String(object.send) : '', + max_deposit: isSet(object.max_deposit) + ? globalThis.String(object.max_deposit) + : '', pkg_path: isSet(object.pkg_path) ? globalThis.String(object.pkg_path) : '', func: isSet(object.func) ? globalThis.String(object.func) : '', args: globalThis.Array.isArray(object?.args) ? object.args.map((e: any) => globalThis.String(e)) - : null, - max_deposit: isSet(object.max_deposit) - ? globalThis.String(object.max_deposit) - : '', + : [], }; }, @@ -221,6 +215,9 @@ export const MsgCall: MessageFns = { if (message.send !== undefined) { obj.send = message.send; } + if (message.max_deposit !== undefined) { + obj.max_deposit = message.max_deposit; + } if (message.pkg_path !== undefined) { obj.pkg_path = message.pkg_path; } @@ -232,9 +229,6 @@ export const MsgCall: MessageFns = { } else { obj.args = null; } - if (message.max_deposit !== undefined) { - obj.max_deposit = message.max_deposit; - } return obj; }, @@ -245,10 +239,10 @@ export const MsgCall: MessageFns = { const message = createBaseMsgCall(); message.caller = object.caller ?? ''; message.send = object.send ?? ''; + message.max_deposit = object.max_deposit ?? ''; message.pkg_path = object.pkg_path ?? ''; message.func = object.func ?? ''; message.args = object.args?.map((e) => e) || []; - message.max_deposit = object.max_deposit ?? ''; return message; }, }; @@ -377,7 +371,7 @@ export const MsgAddPackage: MessageFns = { }; function createBaseMsgRun(): MsgRun { - return { caller: '', send: '', package: undefined, max_deposit: '' }; + return { caller: '', send: '', max_deposit: '', package: undefined }; } export const MsgRun: MessageFns = { @@ -391,11 +385,11 @@ export const MsgRun: MessageFns = { if (message.send !== '') { writer.uint32(18).string(message.send); } - if (message.package !== undefined) { - MemPackage.encode(message.package, writer.uint32(26).fork()).join(); - } if (message.max_deposit !== '') { - writer.uint32(34).string(message.max_deposit); + writer.uint32(26).string(message.max_deposit); + } + if (message.package !== undefined) { + MemPackage.encode(message.package, writer.uint32(34).fork()).join(); } return writer; }, @@ -429,7 +423,7 @@ export const MsgRun: MessageFns = { break; } - message.package = MemPackage.decode(reader, reader.uint32()); + message.max_deposit = reader.string(); continue; } case 4: { @@ -437,7 +431,7 @@ export const MsgRun: MessageFns = { break; } - message.max_deposit = reader.string(); + message.package = MemPackage.decode(reader, reader.uint32()); continue; } } @@ -453,12 +447,12 @@ export const MsgRun: MessageFns = { return { caller: isSet(object.caller) ? globalThis.String(object.caller) : '', send: isSet(object.send) ? globalThis.String(object.send) : '', - package: isSet(object.package) - ? MemPackage.fromJSON(object.package) - : undefined, max_deposit: isSet(object.max_deposit) ? globalThis.String(object.max_deposit) : '', + package: isSet(object.package) + ? MemPackage.fromJSON(object.package) + : undefined, }; }, @@ -470,12 +464,12 @@ export const MsgRun: MessageFns = { if (message.send !== undefined) { obj.send = message.send; } - if (message.package !== undefined) { - obj.package = MemPackage.toJSON(message.package); - } if (message.max_deposit !== undefined) { obj.max_deposit = message.max_deposit; } + if (message.package !== undefined) { + obj.package = MemPackage.toJSON(message.package); + } return obj; }, @@ -486,11 +480,11 @@ export const MsgRun: MessageFns = { const message = createBaseMsgRun(); message.caller = object.caller ?? ''; message.send = object.send ?? ''; + message.max_deposit = object.max_deposit ?? ''; message.package = object.package !== undefined && object.package !== null ? MemPackage.fromPartial(object.package) : undefined; - message.max_deposit = object.max_deposit ?? ''; return message; }, }; From 99457352d1dde7725f0a53aaa0f8d6b4234468fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20=C5=BDivkovi=C4=87?= Date: Fri, 25 Jul 2025 19:58:58 +0200 Subject: [PATCH 2/2] Custom handle args, so it's Amino compatible --- src/proto/gno/vm.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/proto/gno/vm.ts b/src/proto/gno/vm.ts index 0a00d73..79f24a4 100644 --- a/src/proto/gno/vm.ts +++ b/src/proto/gno/vm.ts @@ -119,8 +119,10 @@ export const MsgCall: MessageFns = { if (message.func !== '') { writer.uint32(42).string(message.func); } - for (const v of message.args) { - writer.uint32(50).string(v!); + if (message.args) { + for (const v of message.args) { + writer.uint32(42).string(v!); + } } return writer; }, @@ -178,6 +180,10 @@ export const MsgCall: MessageFns = { break; } + if (!message.args) { + message.args = []; + } + message.args.push(reader.string()); continue; }