-
Notifications
You must be signed in to change notification settings - Fork 15
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
[Proxy Colonies] Feat: Proxy colony balance validation #4253
base: feat/M3-proxy-colonies
Are you sure you want to change the base?
[Proxy Colonies] Feat: Proxy colony balance validation #4253
Conversation
const proxyChainTokens = tokens.filter( | ||
(token) => token.token.chainMetadata.chainId === proxyChainId, | ||
); | ||
|
||
proxyChainTokens.map(async ({ token }) => { |
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.
Don't bother mapping through tokens that don't exist on this chain where the balances will definitely be 0.
e99564e
to
3ae3485
Compare
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.
Good to go
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.
Really nice work @iamsamgibbs 🎉 the amount field is validated based on the available funds on each chain
Description
This PR adds validation for balances on a proxy chain to the simple payment action (and should work for other actions once those forms have been updated).
It also fixes an issue with the
fetchTokenFromChain
lambda which was returning a malformed token due to the fragment changes.Testing
In your terminal, run
node scripts/deploy-token-to-chain.js
Please use the following values for the input
foreignChainId
265669101
foreignChainRpcUrl
http://localhost:8546
colonyAddress
<COLONY_ADDRESS_HERE>
Then we must mint some tokens to generate our incoming funds. Copy the token address that was printed to the console and paste it somewhere to access later.
Run
node scripts/unlock-mint-tokens-on-chain.js
Please use the following values for the input
foreignChainRpcUrl
http://localhost:8546
colonyAddress
<COLONY_ADDRESS_HERE>
tokenAddress
<TOKEN_ADDRESS_YOU_COPIED_FROM_THE_CONSOLE>
tokenAmount
100
Then we need to add this as an approved token, otherwise it won't show in the incoming funds list. The "manage tokens" action has yet to be updated to support this, so we must manually add it to the database. In GraphiQL, run this query:
Diffs
New stuff ✨
Changes 🏗
fetchTokenByChain
lambdaResolves #4193