Actalink Docs
Usage/Acta payments

List all scheduled programmable transfers

Steps to Fetch Recurring Transfers

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.

Fetch list of recurring transfers

Fetch the list of recurring transfers using the useSIWE() and useListUserOperations() hooks. Scheduled recurring transfers are retrieved from the paymaster for the connected EOA wallet.

src/pages/index.tsx
import {useAccount} from "wagmi";
import { useActaAccount, useFees, useMerkleSignUserOps, useSalt, type BodyType } from "@actalink/react-hooks";
import { config } from "../wagmi";
 
export default function Home() {
 
	const PAYMASTER_URL = "<paymaster url>";
 
  const { address: eoaAddress, status: eoaStatus, chainId } = useAccount();
 
  const { salt } = useSalt({ eoaAddress, eoaStatus, config }); // this hook generates a unique salt using wallet signature
 
  // fetch session token
  const { fetchSIWEToken } = useSIWE({ eoaAddress: eoaAddress, eoaStatus: eoaStatus, chainId: chainId, config});
 
// Hook used to fetch list of scheduled recurring transfers. it returns `list` method.
  const { list } = useListUserOperations();
 
   const listScheduledTransfers = async () => {
    const token = await fetchSIWEToken(PAYMASTER_URL);
    if (token) {
      if (salt) {
        const body = {
          validators: validators,
          salt,
        };
        const useOpsList = await list(
          token.token as string,
          body as BodyType,
          PAYMASTER_URL
        );
        console.log(useOpsList);
      }
    }
  };
 
 	return ()
}

👏 Congratulations! You have successfully fetched the list of scheduled recurring transfers.

On this page