-
Notifications
You must be signed in to change notification settings - Fork 13
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
Handle withdraw from resources #1688
Conversation
f2251c8
to
2943c16
Compare
2943c16
to
52a7ddc
Compare
Didn't we say that the withdraw was a resource-based handler? so like that the api is simpler for users Just to clarify, am I correct with the workflow of this feature?
Am I right? Isn't it easier to have something like:
Or
|
There was 3 propositions:
Yep :)
I'm not sure if I follow. In above 3 types of withdraw-coins modules we need to pass the bullet you skiped |
The part to find the ownership is required for verification but the API might not need it.
|
I'll copy-paste talk with @NicolasMahe on discord.
Withdraw alone isn't related only to money.
Why we need resource_type for ownership/withdraw? it's not required here at all. So we need to choose some option (we have 3) and everyone wants to pick something else. Either someone will be out-voted or I'll just leaving it as it is, because we have functionality and we can change the api any time. |
Add runner to ownership + withdraw on deletion. need to find a way to use client in e2e tests (not lcd server). |
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.
How can we test it?
Please provide a description of how to test it in real conditions. Not only e2e. We need to test features manually to make sure that everything is working correctly. I think here there is some stuff missing, it looks like the CLI doesn't have the command and I'm not sure about the API.
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.
I fixed 2 little stuff and manually test and everything seems to work 👍
I have some issue testing it outside of the engine. TestCreate a service
Start the service
Create an execution:
Get the ownership hash
Convert this hash in base58
Import account on the CLIUse the same mnemonic than the one in the engine.
Withdraw
Result
Is there a bug or am I doing wrong? I'm the owner of this runner.
Edit: This issue came from the fact that the withdraw api didn't need the owner hash like initially but the resource hash directly. I was giving the wrong hash. Now everything is fine. |
"testing" | ||
|
||
"github.com/cosmos/cosmos-sdk/crypto/keys" | ||
"github.com/cosmos/cosmos-sdk/types/rest" | ||
"github.com/mesg-foundation/engine/app" |
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.
Need the payments
t.Run("withdraw from service", func(t *testing.T) { | ||
acc, err := cclient.GetAccount() | ||
require.NoError(t, err) | ||
coins := sdk.NewCoins(sdk.NewCoin("atto", sdk.NewInt(7000))) |
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.
Need coins
@@ -254,6 +256,32 @@ func testExecution(t *testing.T) { | |||
lcdGet(t, "bank/balances/"+execAddress.String(), &coins) | |||
require.True(t, coins.AmountOf("atto").Equal(sdk.NewInt(0))) | |||
}) | |||
|
|||
t.Run("withdraw from service", func(t *testing.T) { |
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.
Need to put on go 2bank
About test with cli:
keys.Keyring
and cosmos still uses old Kyebase which doesn't work togetherquery
subcommandsAbout test with rest:
Put that in e2e tests (under
"withdraw from service"
tests) so it will configure all process and then you can send it withYou can check balances with :
Hum, as now I can see this tx response is not processed by network... need to debug why. In logs it occurs as recived.