-
Notifications
You must be signed in to change notification settings - Fork 19
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 create new handler for new vm_noop
message type
#540
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { Any, PubKeySecp256k1, Tx, TxFee, TxSignature } from '@gnolang/tm2-js-client'; | ||
import { MsgCall, MsgAddPackage, MsgSend, MsgEndpoint } from '@gnolang/gno-js-client'; | ||
import { MsgCall, MsgAddPackage, MsgSend, MsgEndpoint, MsgNoop } from '@gnolang/gno-js-client'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a link to see what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I can guess from the modifications in the gno chain. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry for this lately response, it was in pending state, I did not commited the comments @jinoosss |
||
import { MemPackage, MemFile, MsgRun } from '@gnolang/gno-js-client/bin/proto/gno/vm'; | ||
import { fromBase64 } from '../encoding'; | ||
|
||
|
@@ -59,6 +59,14 @@ export const decodeTxMessages = (messages: Any[]): any[] => { | |
...messageJson, | ||
}; | ||
} | ||
case MsgEndpoint.MSG_NOOP: { | ||
const decodedMessage = MsgNoop.decode(m.value); | ||
const messageJson = MsgNoop.toJSON(decodedMessage) as any; | ||
return { | ||
'@type': m.typeUrl, | ||
...messageJson, | ||
}; | ||
} | ||
default: | ||
throw new Error(`unsupported message type ${m.typeUrl}`); | ||
} | ||
|
@@ -128,6 +136,16 @@ function encodeMessageValue(message: { type: string; value: any }) { | |
value: MsgRun.encode(msgRun).finish(), | ||
}); | ||
} | ||
case MsgEndpoint.MSG_NOOP: { | ||
const value = message.value; | ||
const result = MsgNoop.create({ | ||
caller: value.caller, | ||
}); | ||
return Any.create({ | ||
typeUrl: MsgEndpoint.MSG_NOOP, | ||
value: MsgNoop.encode(result).finish(), | ||
}); | ||
} | ||
default: { | ||
return Any.create({ | ||
typeUrl: MsgEndpoint.MSG_CALL, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to check for multi-messages.
Additionally, it would be nice to have a separate type-checking function for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we separate type-checking function and add condition to check for multi-messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes address at 764ad3e