cythecode/sorokit-core

The foundational TypeScript engine and lightweight React hooks library for building seamless, reactive dApps on Stellar Soroban. ๐Ÿš€

โ˜… 0Forks 0GitHub โ†—Compare

README

sorokit-core

The foundational TypeScript engine and lightweight React hooks library for building seamless, reactive dApps on Stellar Soroban. ๐Ÿš€

sorokit-core wraps the low-level pieces of connecting a React frontend to a Soroban contract โ€” wallet connection, transaction signing, invoke/submit/poll โ€” behind a small set of ergonomic hooks, so you don't have to hand-roll this per project.

Install

npm install @sorokit/core

Usage

import { useWallet, useContract, useSorobanCall } from '@sorokit/core';

function MyDapp() {
  const { account, status, connect } = useWallet();

  const { contract, server } = useContract({
    contractId: 'CABCD...',
    networkConfig: {
      network: 'TESTNET',
      networkPassphrase: 'Test SDF Network ; September 2015',
      rpcUrl: 'https://soroban-testnet.stellar.org',
    },
  });

  const { call, status: callStatus, data } = useSorobanCall({
    contract,
    server,
    networkPassphrase: 'Test SDF Network ; September 2015',
    walletAdapter: /* the adapter returned by useWallet */,
    sourcePublicKey: account?.publicKey ?? '',
  });

  if (status !== 'connected') {
    return <button onClick={() => connect('freighter')}>Connect Freighter</button>;
  }

  return <button onClick={() => call('increment')}>Call increment()</button>;
}

Wallets

Wallet Status
Freighter โœ… Implemented
Albedo ๐Ÿšง Scaffolded, integration tracked
xBull ๐Ÿšง Scaffolded, integration tracked

Package layout

src/
  hooks/        useWallet, useContract, useSorobanCall
  wallets/      Per-wallet adapters behind a common WalletAdapter interface
  types.ts      Shared types used across hooks and wallets

Development

npm install
npm run build      # bundles with tsup
npm run typecheck
npm run test

Related packages

  • @sorokit/ui โ€” Tailwind-styled components (connect button, tx status toast) built on top of these hooks.
  • sorokit-docs โ€” Full docs and live sandboxes.

Contributing

Issues tagged for the Stellar Wave Program are labeled accordingly โ€” see open issues for scoped, complexity-rated tasks if you'd like to contribute.

License

MIT

Contributors

aliyuHabibu

Issues