Skip to content
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: add support for realm faucet #180

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zivkovicmilos
Copy link
Member

Description

This PR adds support for the Realm fund method, outlined in #163

This PR is dependent on #163 being merged out and deployed.

@netlify
Copy link

netlify bot commented Sep 26, 2023

Deploy Preview for gnochess canceled.

Name Link
🔨 Latest commit df77543
🔍 Latest deploy log https://app.netlify.com/sites/gnochess/deploys/65134a21656a1f00085419e3

@netlify
Copy link

netlify bot commented Sep 26, 2023

Deploy Preview for gnochess-signup-form canceled.

Name Link
🔨 Latest commit df77543
🔍 Latest deploy log https://app.netlify.com/sites/gnochess-signup-form/deploys/65134a21a7419500089ced3f

@moul
Copy link
Member

moul commented Sep 26, 2023

Looks good, however, there is a question regarding the realm path.

I initially started adding the register in r/demo/chess/register, but @harry-hov made something different in #171; I think his proposal makes sense but implies updating some commands. From what I see, there is not breaking change, but just habit changes.

I'd like the team to consider the options before merging #163 and then your PR.

ToAddress: cfg.ToAddress,
Amount: cfg.SendAmount,
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that bank.MsgSend is already the default behavior of the faucet when no prepareTxFn is provided, I don't think it's required to fill prepareTxFn here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I've just looked at the faucet code, and if you provide a prepareTxFn=nil, it will probably panic when transferring funds.
The proper way is so to deal with a []faucet.Option rather than a prepareTxFn directly. When allowedTokens is not empty, you add the faucet.WithPrepareTxFn option, if it's empty you don't.

defer cancelFn()

// Fetch the token from Redis
token, err = redisClient.HGet(ctx, "GNO:"+cfg.ToAddress.String(), "token").Result()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token, err :=

if err != nil {
// Invalid token request, pass it
// to the Realm as an empty value
token = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants