Skip to content

Getting Started

Overview

Khizab Core is a VanillaJS library for Aptos. You can learn more about the rationale behind the project in the Why Khizab section.

Manual Installation

To manually add Khizab to your project, install the required packages.

bash
pnpm add @khizab/core @khizab/connectors @aptos-labs/[email protected]
pnpm add @khizab/core @khizab/connectors @aptos-labs/[email protected]
bash
npm install @khizab/core @khizab/connectors @aptos-labs/[email protected]
npm install @khizab/core @khizab/connectors @aptos-labs/[email protected]
bash
yarn add @khizab/core @khizab/connectors @aptos-labs/[email protected]
yarn add @khizab/core @khizab/connectors @aptos-labs/[email protected]
bash
bun add @khizab/core @khizab/connectors @aptos-labs/[email protected]
bun add @khizab/core @khizab/connectors @aptos-labs/[email protected]

Create Config

Create and export a new Khizab config using createConfig.

ts
import { petraWallet } from '@khizab/connectors'
import { createConfig } from '@khizab/core'
import { testnet } from 'khizab/networks'

export const config = createConfig({
  network: testnet,
  connectors: [petraWallet()],
})
import { petraWallet } from '@khizab/connectors'
import { createConfig } from '@khizab/core'
import { testnet } from 'khizab/networks'

export const config = createConfig({
  network: testnet,
  connectors: [petraWallet()],
})

In this example, Khizab is configured to use the Testnet network. Check out the createConfig docs for more configuration options.

Use Khizab

Now that everything is set up, you can pass the config to use actions.

tsx
import { getAccount } from '@khizab/core'
import { config } from './config'

const { address } = getAccount(config)
import { getAccount } from '@khizab/core'
import { config } from './config'

const { address } = getAccount(config)
ts
import { petraWallet } from '@khizab/connectors'
import { createConfig } from '@khizab/core'
import { testnet } from 'khizab/networks'

export const config = createConfig({
  network: testnet,
  connectors: [petraWallet()],
})
import { petraWallet } from '@khizab/connectors'
import { createConfig } from '@khizab/core'
import { testnet } from 'khizab/networks'

export const config = createConfig({
  network: testnet,
  connectors: [petraWallet()],
})

Next Steps

For more information on what to do next, check out the following topics.

  • TypeScript Learn how to get the most out of Khizab's type-safety and inference for an enlightened developer experience.
  • Actions Browse the collection of actions and learn how to use them.
  • Framework Adapters Learn how to create a Khizab-like adapter for your favorite framework.
  • Aptos Sdk Khizab Core is a wrapper around Aptos Sdk that is being used to access the Aptos blockchain. Learn more about Aptos Sdk and how to use it.

Released under the MIT License.