Enoki TypeScript SDK

The Enoki TypeScript SDK is in active development. Expect the implementation to change frequently.

Integrate Enoki into your dApps with the TypeScript SDK. Wrapping your main app with the Enoki context provider delivers Enoki functions and state across all your components.

With Enoki integrated in your app, users receive a Sui address based on their Web 2.0 authentication flow, so each authorized user always has the same address. The salt Enoki uses to create the address is per app, however, so the same user has different addresses across multiple apps using Enoki.

Getting started

Include the Enoki SDK in your app to provide Sui blockchain functionality without having to manage any cryptographic keys. Your app users don't need to install a wallet, either. They complete the authorization flow from Web 2.0 identity providers, like Google, Apple, or Twitch, and can then perform on-chain transactions using your app.

Install

To begin, add the @mysten/enoki package to your project using a package manager:

npm install @mysten/enoki

React integration

The Enoki TypeScript SDK ships with React bindings that enable you to integrate Enoki into your React application (Enoki Flow). You can modify these instructions to include the SDK in apps based on other frameworks.

First, wrap your application with the EnokiFlowProvider context provider. To do so, import the component at the top-level of your project and wrap your app inside. Include the Enoki API key you get from the Enoki Portal. You typically want to use a public API key for frontend access.

import { EnokiFlowProvider } from '@mysten/enoki/react';
 
function App() {
	return (
		<EnokiFlowProvider apiKey="YOUR_PUBLIC_ENOKI_API_KEY">
			<YourApp />
		</EnokiFlowProvider>
	);
}

Hooks

Enoki Flow provides the following hooks:

  • useEnokiFlow - Returns the current EnokiFlow instance.
  • useEnokiFlowState - Returns the current authentication state.

On this page