-
Notifications
You must be signed in to change notification settings - Fork 21
docs: Documented need of solana kit with framework-kit #82
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
base: main
Are you sure you want to change the base?
docs: Documented need of solana kit with framework-kit #82
Conversation
README.md
Outdated
|
|
||
| ### Why this architecture? | ||
|
|
||
| We want to avoid the "wrapper confusion" often seen in earlier libraries (like Gill), where it was unclear whether developers should use the framework's version of a type or the native version. |
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.
Even if i put something like this in the issue, i think we don't have to be explicit about it or name other libraries in there.
I like the separation of concerns bullet points bellow! I think the intro text should simply state the approach maybe a bit like this
| We want to avoid the "wrapper confusion" often seen in earlier libraries (like Gill), where it was unclear whether developers should use the framework's version of a type or the native version. | |
| Framework-kit is built on top of `@solana/kit`. As such, types from Kit are compatible with Framework-kit. |
| ```typescript | ||
| // 1. Import standard primitives directly from @solana/kit | ||
| import { address, type Address } from "@solana/kit"; | ||
|
|
||
| // 2. Import high-level logic from the framework | ||
| import { useWalletConnection } from "@solana/react-hooks"; | ||
|
|
||
| export const UserProfile = ({ userAddress }: { userAddress: Address }) => { | ||
| const { connect } = useWalletConnection(); | ||
| // ... component logic | ||
| } |
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.
do we have a way to show where the types converge? For example
import { useWallet } from '@solana/react-hooks'
import { address, type Address } from "@solana/kit";
export const MyComponent = () => {
const wallet = useWallet();
// wallet.session.account.address is of type Address
}This is likely not the example to give but the whole type system of framework-kit is built on top of @solana/kit we should give an example of mixing the two libraries where the types converge
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.
Hey thanks for feedback, I’ve updated the sections you highlighted. Please let me know if you'd like any further refinement.
Summary
@solana/kitin the root README to explicitly explain the dependency structure.address) directly from@solana/kitwhile using hooks from@solana/react-hooks.Testing
pnpm lintpnpm testpnpm build