Actalink Docs
Usage/Acta billings

Deploy account on-chain

Deployment Steps

Create wagmi config

In the first step, create a Wagmi configuration file.

src/wagmi.ts
 
import { http, createConfig } from "wagmi";
import { polygon } from "wagmi/chains";
 
export const config = createConfig({
chains: [polygon],
transports: {
[polygon.id]: http(),
},
});
Projects built with Rainbowkit can utilize Rainbowkit's default Wagmi configuration.

Precompute smart wallet address

Use the useActaAccount() hook to precompute the smart wallet address by passing the required parameters. Mock validators can be used for development and testing, but for production, please contact us to obtain custom validators.

The useSalt() hook requests a signature to generate a unique salt, which is then used to precompute the smart wallet address

src/pages/index.tsx
import {useAccount} from "wagmi";
import { useActaAccount, useFees, useMerkleSignUserOps, useSalt } from "@actalink/react-hooks";
import { config } from "../wagmi";
 
export default function Home() {
 
const { address: eoaAddress, status: eoaStatus, chainId } = useAccount();
 
const { salt } = useSalt({ eoaAddress, eoaStatus, config }); // this hook generates a unique salt using wallet signature
 
const validators = ["0x", "0x"]; // use your own validators
 
const { address: swAddress, status: swStatus, actaAccount } = useActaAccount({ eoaAddress, eoaStatus, chainId, config, validators });
return ()
}

Deploy smart account on-chain

Call the deployAccount() method to deploy the smart account on-chain.

src/pages/index.tsx
const checkIsDeployed = async () => {
  const status = await actaAccount.isDeployed();
  if (status) return;
  const hash = await actaAccount.deployAccount();
  console.log(`account deployed: ${hash}`);
};

👏 Congratulations! Your smart account has been successfully deployed on-chain.

Full Code

import {useAccount} from "wagmi";
import { useActaAccount, useFees, useMerkleSignUserOps, useSalt } from "@actalink/react-hooks";
import { config } from "../wagmi";
 
export default function Home() {
 
const { address: eoaAddress, status: eoaStatus, chainId } = useAccount();
 
const { salt } = useSalt({ eoaAddress, eoaStatus, config }); // this hook generates a unique salt using wallet signature
 
const validators = ["0x", "0x"]; // use your own validators
 
const { address: swAddress, status: swStatus, actaAccount } = useActaAccount({ eoaAddress, eoaStatus, chainId, config, validators });
 
console.log(swAddress);
 
const handleDeploy = async () => {
const status = await actaAccount.isDeployed();
if (status) return;
const hash = await actaAccount.deployAccount();
console.log(`account deployed: ${hash}`);
};
return (
 
<button
onClick={(e) => {
  handleDeploy();
}}
>
Deploy account
</button>
) }

On this page