-
Notifications
You must be signed in to change notification settings - Fork 3
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: query smart wallet auto-provision fee #97
Conversation
@samsiegart could you help me and other reviewers understand what tests have you done on this PR? |
Sure yea, just updated the PR description. Lmk if you'd like more clarification or want to walk through it together. We're pretty close to being able to set up an example dapp in this repo with e2e testing, which would make this type of thing easier to test. |
@@ -17,6 +17,7 @@ | |||
"@agoric/assert": "^0.6.0", | |||
"@agoric/cache": "^0.3.2", | |||
"@agoric/casting": "^0.4.3-u13.0", | |||
"@agoric/cosmic-proto": "0.3.0", |
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.
does it work with 0.4.0?
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.
Following up, looks like 0.4.0 isn't published, tried 0.4.1-dev-e2e36cc.0
but doesn't seem to have the correct interface, and best not to risk Agoric/dapp-inter#252. Will keep at 0.3.0 for now.
res(fee); | ||
} catch (e) { | ||
console.error('Error querying smart wallet provision fee', address); | ||
if (attempts >= MAX_ATTEMPTS_TO_WATCH_BANK) { |
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.
retry logic seems ripe for generalization. e.g. https://caolan.github.io/async/v2/retry.js.html
or this light package https://github.com/vercel/async-retry
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.
Ack, I do lean towards "Write Everything Twice", and there's one other place we do a fetch with retry here, but seems like something we can generalize without a package for next time.
refs #78
This queries the smart wallet auto-provision fee in the wallet connection component, and exposes it in the react
useAgoric
hook as well.Also fixed a bug where the purse notifier was updating every time the bank was polled, even if the balances didn't change. (cc @0xpatrickdev)
Testing
Tested on this branch of dapp-offer-up: https://github.com/Agoric/dapp-offer-up/compare/test-network-dropdown
Steps:
yarn && yarn workspaces run prepack
cd packages/react-components && yarn link
dapp-offer-up
and checkout this branch: https://github.com/Agoric/dapp-offer-up/compare/test-network-dropdowncd ui && yarn link @agoric/react-components
cd ui && yarn && yarn dev
const { smartWalletProvisionFee } = useAgoric()
For an e2e example with the provision dialog, see #99