Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@mysten/dapp-kit
Advanced tools
A collection of React hooks and components for interacting with the Sui blockchain and wallets.
The Sui dApp Kit is a set of React components, hooks, and utilities that make it easy to build a dApp for the Sui ecosystem. It provides hooks and components for querying data from the Sui blockchain, and connecting to Sui wallets.
See https://sdk.mystenlabs.com/typescript for full documentation
To use the Sui dApp Kit in your project, run the following command in your project root:
npm i --save @mysten/dapp-kit @mysten/sui @tanstack/react-query
To be able to use the hooks and components in the dApp Kit, you need to wrap your app with a couple providers. The props available on the providers are covered in more detail in their respective docs pages.
import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit';
import { getFullnodeUrl, type SuiClientOptions } from '@mysten/sui/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
// Config options for the networks you want to connect to
const { networkConfig } = createNetworkConfig({
localnet: { url: getFullnodeUrl('localnet') },
mainnet: { url: getFullnodeUrl('mainnet') },
});
const queryClient = new QueryClient();
function App() {
return (
<QueryClientProvider client={queryClient}>
<SuiClientProvider networks={networkConfig} defaultNetwork="localnet">
<WalletProvider>
<YourApp />
</WalletProvider>
</SuiClientProvider>
</QueryClientProvider>
);
}
The dApp Kit provides a set of flexible UI components that can be used to connect and manage wallet accounts from your dApp. The components are built on top of Radix UI and are customizable so you can quickly get your dApp up and running.
To use our provided UI components, you will need to import the dApp Kit's CSS stylesheet into your dApp as shown below. For more information regarding customization options, check out the respective documentation pages for the components and themes.
import '@mysten/dapp-kit/dist/index.css';
The dApp Kit provides a set of hooks for making RPC calls to the Sui blockchain. The hooks are thin
wrappers around useQuery
from @tanstack/react-query
. For more comprehensive documentation on how
these query hooks can be used, check out the
react-query docs.
import { useSuiClientQuery } from '@mysten/dapp-kit';
function MyComponent() {
const { data, isPending, error, refetch } = useSuiClientQuery('getOwnedObjects', {
owner: '0x123',
});
if (isPending) {
return <div>Loading...</div>;
}
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}
FAQs
A collection of React hooks and components for interacting with the Sui blockchain and wallets.
We found that @mysten/dapp-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.