Skip to main content

Connect

To get started integrating INTU into your dapp, import the INTU package, ethers, and setup your signer. This relies on the user having an existing wallet.
If you want to use INTU's social login, please see the webkit

App.jsx
import { ethers } from "ethers";
import { getVaults,createVault } from '@intuweb3/steven-web-kit';
const provider = new ethers.providers.Web3Provider(window.ethereum);
await provider.send("eth_requestAccounts", []);
const signer = await provider.getSigner();
const signerAddress = await provider.getSigner().getAddress();

Then, retrieve the user's INTU accounts (if any):

App.jsx
const userVaults = getVaults(signerAddress, web3Prprovidervider);
console.log(userVaults);

If the user doesn't yet have an INTU MPC account, lets create a new one!

Propose an account

import { createIntuAccount } from "@intuweb3/web-exp";
/*
The first parameter to pass is an array of the addresses that should be a part of this new vault
RotateThreshold = % of participants required to add or remove someone from the vault
TransactionThreshold = % of participants required to send a transaction from the vault
AdminThreshold = % of participants required to change a threshold %, change the name, etc.
*/
await createIntuAccount([0x1, 0x2, 0x3],
"MyEasyToReadVaultName",
rotateThreshold,
txThreshold,
adminThreshold,
signer)

Register each user in the account

Have each user register into the account

*Note, each step of the process (preRegister, automateRegistration, registerAllSteps) has to be completed by each user before the next step can be completed

*Everyone must perform pre-registration before registration step1 can be performed, etc.

import { preRegistration, registerStep1, registerStep2, registerStep3, completeVault, getVaults } from "@intuweb3/web-exp";
let myVaults = getVaults("0x12345_user_address", provider);
await preRegistration(vaultAddress, signer);
//then
await automateRegistration(vaultAddress, signer):
//then
await registerAllSteps(vaultAddress, signer);

Complete account

Here we confirm each user in the account, and determine the master public address (EOA) for the MPC account, and lock it in on the blockchain.

//JUST ONE USER NEEDS TO PERFORM THIS FUNCTION
await completeVault(vaultAddress, signer); // just once