npm.io
0.1.5-alpha.4 • Published 1 year ago

@actalink/modules

Licence
GPL-3.0-or-later
Version
0.1.5-alpha.4
Deps
4
Size
106 kB
Vulns
0
Weekly
0
import { SmartAccount, type SmartAccountConfig } from "@actalink/sdk";
import { addMinutes, getCurrentTimestamp, ScheduleopValidationModule } from "@actalink/modules";

const config: SmartAccountConfig = {
  chainId,
  provider,
  owner: wallet,
  bundlerUrl: "<bundler URL>",
  paymasterUrl: "<paymaster URL>"
};

const smartWallet = new SmartAccount(config);

const validationClient = new ScheduleopValidationModule({
  chainId,
  provider,
  owner: wallet,
  bundlerUrl: "<bundler URL>",
  paymasterUrl: "https://goerli-paymaster.acta.link", // Supported paymaster for ScheduleopValidationModule
});
const executionTimes = [
  addMinutes(getCurrentTimestamp(), { amount: 5 }),
  addMinutes(getCurrentTimestamp(), { amount: 7 }),
];
const userOpHashes = await validationClient.createScheduleOps(
  "<Address of contract which we are interacting with.For ERC20 payments use ERC20 contract address.>",
  transferData,
  0n,
  2, // number of times to repeat the payments
  [...executionTimes] // array of execution times in miliseconds
)

Testing modules

Deploy DecodeHelper contract

cd packages/contracts-v1
forge create src/lib/DecodeHelper.sol:DecodeHelper --rpc-url http://127.0.0.1:8545/ --private-key=$PRIVATE_KEY --via-ir
Compile contracts with DecodeHelper library
forge build --via-ir --libraries src/lib/DecodeHelper.sol:DecodeHelper:<decodeHelper deployed address>