-
Notifications
You must be signed in to change notification settings - Fork 8
chore: change proto generate script to apply compatibility patch #187
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
Merged
zivkovicmilos
merged 2 commits into
gnolang:main
from
jeronimoalbi:chore/amino-json-compatibility-patch
Aug 29, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
diff --git a/src/proto/gno/vm.ts b/src/proto/gno/vm.ts | ||
index 8fdde9e..781e570 100644 | ||
--- a/src/proto/gno/vm.ts | ||
+++ b/src/proto/gno/vm.ts | ||
@@ -27,7 +27,7 @@ export interface MsgCall { | ||
/** the function name being invoked */ | ||
func: string; | ||
/** the function arguments */ | ||
- args: string[]; | ||
+ args: string[] | null; | ||
} | ||
|
||
/** | ||
@@ -42,7 +42,7 @@ export interface MsgAddPackage { | ||
/** the amount of funds to be deposited at deployment, if any ("<amount><denomination>") */ | ||
send: string; | ||
/** the amount of funds to put down for the storage fee, if any ("<amount><denomination>") */ | ||
- max_deposit: string; | ||
+ max_deposit?: string; | ||
} | ||
|
||
/** | ||
@@ -72,9 +72,9 @@ export interface MemPackage { | ||
/** the associated package gno source */ | ||
files: MemFile[]; | ||
/** the (user defined) package type */ | ||
- type?: Any | undefined; | ||
+ type?: Any | null; | ||
/** the (user defined) extra information */ | ||
- info?: Any | undefined; | ||
+ info?: Any | null; | ||
} | ||
|
||
/** | ||
@@ -95,7 +95,7 @@ function createBaseMsgCall(): MsgCall { | ||
max_deposit: '', | ||
pkg_path: '', | ||
func: '', | ||
- args: [], | ||
+ args: null, | ||
}; | ||
} | ||
|
||
@@ -119,8 +119,10 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
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(50).string(v!); | ||
+ } | ||
} | ||
return writer; | ||
}, | ||
@@ -178,6 +180,10 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
break; | ||
} | ||
|
||
+ if (!message.args) { | ||
+ message.args = []; | ||
+ } | ||
+ | ||
message.args.push(reader.string()); | ||
continue; | ||
} | ||
@@ -203,7 +209,7 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
func: isSet(object.func) ? globalThis.String(object.func) : '', | ||
args: globalThis.Array.isArray(object?.args) | ||
? object.args.map((e: any) => globalThis.String(e)) | ||
- : [], | ||
+ : null, | ||
}; | ||
}, | ||
|
||
@@ -215,7 +221,7 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
if (message.send !== undefined) { | ||
obj.send = message.send; | ||
} | ||
- if (message.max_deposit !== undefined) { | ||
+ if (message.max_deposit !== undefined && message.max_deposit !== '') { | ||
obj.max_deposit = message.max_deposit; | ||
} | ||
if (message.pkg_path !== undefined) { | ||
@@ -226,6 +232,8 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
} | ||
if (message.args?.length) { | ||
obj.args = message.args; | ||
+ } else { | ||
+ obj.args = null; | ||
} | ||
return obj; | ||
}, | ||
@@ -240,13 +248,13 @@ export const MsgCall: MessageFns<MsgCall> = { | ||
message.max_deposit = object.max_deposit ?? ''; | ||
message.pkg_path = object.pkg_path ?? ''; | ||
message.func = object.func ?? ''; | ||
- message.args = object.args?.map((e) => e) || []; | ||
+ message.args = object.args?.map((e) => e) || null; | ||
return message; | ||
}, | ||
}; | ||
|
||
function createBaseMsgAddPackage(): MsgAddPackage { | ||
- return { creator: '', package: undefined, send: '', max_deposit: '' }; | ||
+ return { creator: '', package: undefined, send: '', max_deposit: undefined }; | ||
} | ||
|
||
export const MsgAddPackage: MessageFns<MsgAddPackage> = { | ||
@@ -263,7 +271,7 @@ export const MsgAddPackage: MessageFns<MsgAddPackage> = { | ||
if (message.send !== '') { | ||
writer.uint32(26).string(message.send); | ||
} | ||
- if (message.max_deposit !== '') { | ||
+ if (message.max_deposit !== '' && message.max_deposit !== undefined) { | ||
writer.uint32(34).string(message.max_deposit); | ||
} | ||
return writer; | ||
@@ -305,8 +313,10 @@ export const MsgAddPackage: MessageFns<MsgAddPackage> = { | ||
if (tag !== 34) { | ||
break; | ||
} | ||
- | ||
- message.max_deposit = reader.string(); | ||
+ const max_deposit = reader.string(); | ||
+ if (max_deposit !== '') { | ||
+ message.max_deposit = max_deposit; | ||
+ } | ||
continue; | ||
} | ||
} | ||
@@ -327,7 +337,7 @@ export const MsgAddPackage: MessageFns<MsgAddPackage> = { | ||
send: isSet(object.send) ? globalThis.String(object.send) : '', | ||
max_deposit: isSet(object.max_deposit) | ||
? globalThis.String(object.max_deposit) | ||
- : '', | ||
+ : undefined, | ||
}; | ||
}, | ||
|
||
@@ -363,7 +373,7 @@ export const MsgAddPackage: MessageFns<MsgAddPackage> = { | ||
? MemPackage.fromPartial(object.package) | ||
: undefined; | ||
message.send = object.send ?? ''; | ||
- message.max_deposit = object.max_deposit ?? ''; | ||
+ message.max_deposit = object.max_deposit ?? undefined; | ||
return message; | ||
}, | ||
}; | ||
@@ -488,7 +498,7 @@ export const MsgRun: MessageFns<MsgRun> = { | ||
}; | ||
|
||
function createBaseMemPackage(): MemPackage { | ||
- return { name: '', path: '', files: [], type: undefined, info: undefined }; | ||
+ return { name: '', path: '', files: [], type: null, info: null }; | ||
} | ||
|
||
export const MemPackage: MessageFns<MemPackage> = { | ||
@@ -505,10 +515,10 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
for (const v of message.files) { | ||
MemFile.encode(v!, writer.uint32(26).fork()).join(); | ||
} | ||
- if (message.type !== undefined) { | ||
+ if (message.type !== undefined && message.type !== null) { | ||
Any.encode(message.type, writer.uint32(34).fork()).join(); | ||
} | ||
- if (message.info !== undefined) { | ||
+ if (message.info !== undefined && message.info !== null) { | ||
Any.encode(message.info, writer.uint32(42).fork()).join(); | ||
} | ||
return writer; | ||
@@ -548,6 +558,7 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
} | ||
case 4: { | ||
if (tag !== 34) { | ||
+ message.type = null; | ||
break; | ||
} | ||
|
||
@@ -556,6 +567,7 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
} | ||
case 5: { | ||
if (tag !== 42) { | ||
+ message.info = null; | ||
break; | ||
} | ||
|
||
@@ -578,8 +590,8 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
files: globalThis.Array.isArray(object?.files) | ||
? object.files.map((e: any) => MemFile.fromJSON(e)) | ||
: [], | ||
- type: isSet(object.type) ? Any.fromJSON(object.type) : undefined, | ||
- info: isSet(object.info) ? Any.fromJSON(object.info) : undefined, | ||
+ type: isSet(object.type) ? Any.fromJSON(object.type) : null, | ||
+ info: isSet(object.info) ? Any.fromJSON(object.info) : null, | ||
}; | ||
}, | ||
|
||
@@ -594,11 +606,15 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
if (message.files?.length) { | ||
obj.files = message.files.map((e) => MemFile.toJSON(e)); | ||
} | ||
- if (message.type !== undefined) { | ||
+ if (message.type !== undefined && message.type !== null) { | ||
obj.type = Any.toJSON(message.type); | ||
+ } else { | ||
+ obj.type = null; | ||
} | ||
- if (message.info !== undefined) { | ||
+ if (message.info !== undefined && message.info !== null) { | ||
obj.info = Any.toJSON(message.info); | ||
+ } else { | ||
+ obj.info = null; | ||
} | ||
return obj; | ||
}, | ||
@@ -616,11 +632,11 @@ export const MemPackage: MessageFns<MemPackage> = { | ||
message.type = | ||
object.type !== undefined && object.type !== null | ||
? Any.fromPartial(object.type) | ||
- : undefined; | ||
+ : null; | ||
message.info = | ||
object.info !== undefined && object.info !== null | ||
? Any.fromPartial(object.info) | ||
- : undefined; | ||
+ : null; | ||
return message; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.