@qubic-labs/kit
v1.0.3
Published
Qkit is a batteries-included toolkit for building software and dapps on top of the Qubic blockchain. It ships three layers:
Readme
qkit
Qkit is a batteries-included toolkit for building software and dapps on top of the Qubic blockchain. It ships three layers:
qkit/core– encoding helpers and contract codecs.qkit/sdk– typed clients, automation utilities, telemetry emitters.qkit/react– headless React providers, hooks, and wallet adapters.
Getting started
Install dependencies and bootstrap Husky hooks:
bun install
bun run prepareBuild, lint, test, and type-check:
bun run build
bun run lint
bun run test
bun run typecheckReact usage
Wrap your app with both the QkitProvider (HTTP/query clients) and the
WalletProvider (WalletConnect / MetaMask Snap connectors):
import {
QkitProvider,
WalletProvider,
createWalletConnectConnector,
createMetamaskSnapConnector,
} from "@qubic-labs/kit";
const connectors = [
createWalletConnectConnector({
projectId: process.env.WALLETCONNECT_ID!,
onDisplayUri: (uri) => console.log("open wc uri", uri),
}),
createMetamaskSnapConnector(),
];
export function AppProviders({ children }: { children: React.ReactNode }) {
return (
<QkitProvider>
<WalletProvider connectors={connectors}>{children}</WalletProvider>
</QkitProvider>
);
}Use hooks anywhere below the providers:
import {
useQubicBalance,
useTickData,
useTransactionsForIdentity,
useTransactionByHash,
useTickStream,
useWallet,
createSeedVaultConnector,
MemorySeedVault,
} from "@qubic-labs/kit";
function Portfolio({ identity }: { identity: string }) {
const balance = useQubicBalance(identity);
const recentTicks = useTickStream({ startTick: balance.data?.tick ?? undefined });
const txs = useTransactionsForIdentity({ identity });
const { signer, connect, disconnect, connectors } = useWallet();
// ...
}
const vault = new MemorySeedVault();
await vault.unlock("local-passphrase");
const seedConnector = createSeedVaultConnector({
vault,
selectSeed: (seeds) => seeds[0],
});SDK usage
All SDK clients share a single create*Client interface and support optional
runtime validation via Zod schemas:
import { createQueryClient } from "@qubic-labs/kit";
const queryClient = createQueryClient({
baseUrl: "https://rpc.qubic.org/query/v1",
validateResponses: true,
});
const tick = await queryClient.getTickData({ tickNumber: 39775063 });Release checklist
bun run lintbun run testbun run typecheckbun run build
