-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix: In MsgSend, use Coin. Add expo API function makeSendTx #191
Merged
Conversation
This file contains 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
…e PR. Signed-off-by: Jeff Thompson <[email protected]>
…of Coin. See the PR. Signed-off-by: Jeff Thompson <[email protected]>
Signed-off-by: Jeff Thompson <[email protected]>
… be optional. Should have been fixed in gnolang#184 . Signed-off-by: Jeff Thompson <[email protected]>
D4ryl00
approved these changes
Oct 25, 2024
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.
LGTM
🎉 This PR is included in version 3.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
jefft0
added a commit
that referenced
this pull request
Oct 30, 2024
The gnoclient API uses `MsgCall` where the send amount is an [array of `Coin`](https://github.com/gnolang/gno/blob/287c22ec830a1408f1d3de6319602640d841c7cc/gno.land/pkg/sdk/vm/msgs.go#L87). A `Coin` is a struct with [separate fields for Denom and Amount.](https://github.com/gnolang/gno/blob/287c22ec830a1408f1d3de6319602640d841c7cc/tm2/pkg/std/coin.go#L19) However, the Gno Native Kit API uses a string such as "1000ugnot" (from the original version of gnoclient). Similar to PR #191 for `MsgSend`, we want to track the current gnoclient API. This PR has three commits: 1. Update go.mod to use the latest gnokey-mobile. This allows gnonative to compile after updating to the latest gnolang/gno. 2. Change the Protobuf `MsgCall` to use an array of `Coin` for the Send amount. (The Protobuf `Coin` type was already defined.) Run `make regenerate` to make the native interfaces. Update `gnoNativeService.convertCallRequest` to use the `Coin` struct, similar to the previous change to [convertSendRequest](https://github.com/gnolang/gnonative/blob/c0f18fd181ae3bc2159090c5199f4725216f9800/service/api.go#L591-L594). Run `npm install @gnolang/gnonative` to install the new API on buf.build. 3. In expo, update package.json to use the updated bufbuild_es types. Update `call` and `makeCallTx` to take an array of `Coin`. BREAKING CHANGE: The only code which currently uses the Send amount in MsgCall is where [gnokey-mobile calls "Register"](https://github.com/gnolang/gnokey-mobile/blob/f1dc64684f110f71c0465c6a815b2f1b745800e9/mobile/redux/features/signupSlice.ts#L218). After we merge this PR, we will update gnokey-mobile. --------- Signed-off-by: Jeff Thompson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The gnoclient API uses
MsgSend
where the amount is an array ofCoin
. ACoin
is a struct with separate fields for Denom and Amount. However, the Gno Native Kit API uses a string such as "1000ugnot" (from the original version of gnoclient). We want to track the current gnoclient API. This PR has four commits:MsgSend
to use an array ofCoin
for the Amount. (The ProtobufCoin
type was already defined.) Runmake regenerate
to make the native interfaces. UpdategnoNativeService.Send
to use theCoin
struct. Runnpm install @gnolang/gnonative
to install the new API on buf.build.send
to take an array ofCoin
.makeCallTx
. AddmakeSendTx
.makeCallTx
andmakeSendTx
, the callerAddress should not be optional. (This should have been fixed formakeCallTx
in PR fix: Remove deprecated API methods. Require caller address. #184 .)This was tested by making a local expo NPM package and installing locally in Gnokey Mobile. The following test code sends 100 ugnot to an address.