π 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:
- Node.js Examples: Located in the
examples/nodejs-example
directory. - React Examples: Located in the
examples/react-example
directory. - Sandbox: Located in the
examples/sandbox
directory.