Skip to main content

πŸš€ Getting started with JS

Installation​

To install the SDK, use the following commands:

npm install @ditto-network/core @ditto-network/web3.js web3

Getting Started​

Here’s a quick guide to get you started with the Ditto Network SDK:

Initialize SDK​

import { Provider, SmartWalletFactory, BrowserStorage } from '@ditto-network/core';
import { EthersSigner, EthersContractFactory } from '@ditto-network/ethers';

const provider = new Provider({
signer: new EthersSigner(signer),
storage: new BrowserStorage(),
contractFactory: new EthersContractFactory(signer),
});
const swFactory = new SmartWalletFactory(provider);

const sw = await swFactory.getDefaultOrCreateVault();
const vaultAddress = sw.getAddress();

console.log('Vault address:', vaultAddress);

For more detailed examples, check the examples section.

Documentation​

For comprehensive documentation and details on how to use the Ditto Network, please refer to the main documentation in the @ditto-network/core package.

Examples​

We provide a variety of examples to help you get started with different environments: