kalidao / hooks Goto Github PK
View Code? Open in Web Editor NEWKali DAO React Hooks
License: MIT License
Kali DAO React Hooks
License: MIT License
Is your feature request related to a problem? Please describe.
When users are connected on one ETH chain they are allowed to submit an on-chain transactions in Kali UI to a Kali DAO that is hosted on a different chain. For example vote or propose tx. The transaction is accepted and the gas fee is paid, but the desired result is not achieved.
Describe the solution you'd like
This React Hook would allow UI pages with contract write transactions to ensure that the user is connected to the same chain where the DAO is hosted.
Describe alternatives you've considered
We discussed with @nerderlyne and @audssy the alternative to build visual React components, such as MUI buttons, that have built in chain guard functionality. However that would limit the ability of designers to experiment with different UI component libraries. Hence the decision to expose chain guard logic as a react hook that is independent of visualization libraries.
Additional context
Prior work on this topic here:
kalidao/kali-ui#252
Is your feature request related to a problem? Please describe.
When users navigate into pages that offer information and transactions in the context of a Kali DAO, they usually need to know the chain id and address of the DAO in order to fetch the correct underlying data and respectively submit contract write transactions correctly. This information is also used to make sure that the user is connected to the chain where the DAO is hosted before submitting a contract write transaction.
The hook can also offer a method to create a URL pre-populated with the DAO context parameters to be used in links to pages with a specific DAO context.
Describe the solution you'd like
Provide a react hook that extracts chain ID and address from router router correctly. Each app may provide its own configuration settings how the hook should map router params to values.
Describe alternatives you've considered
Currently each app handles its own way of parameterizing DAO context for pages, extract the context and create links. It makes it error prone and repetitive, especially when apps want to cross-link to each other's pages. For example when a SporosDAO app page (DAO projects) wants to link to a Kali DAO page (DAO registration page).
Is your feature request related to a problem? Please describe.
When users interact with on-chain data, they expect a friendly way to verify that it exists on-chain outside of the app UI. As a best practice, dapps provide a link to Etherscan web page with transaction data.
Describe the solution you'd like
A React Hook that takes as input chain ID, transaction hash or contract address and creates a populated URL to the correct chain explorer where the transaction or address are hosted.
Describe alternatives you've considered
Each app can use it's own ad hoc method for achieving this effect. I have not been able to find a common open source library with this functionality.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.