LogoLogo
  • General
    • 👋Welcome to Kinto
    • 📔Terminology
    • 📃Litepaper
    • 📄One Pager
    • 🔗Links
    • 🤝Partners and Collaborators
    • ❓FAQ
  • User Guides
    • 🌟Sign Up Walkthrough
    • đŸ—ī¸KYC Walkthrough
      • 🔑Synaps Walkthrough
      • 🔑Plaid Walkthrough
    • 📄KYB Walkthrough
    • đŸĒŸPasskeys on Windows Walkthrough
    • Setting up a 1Password Passkey
    • ❔Troubleshooting/Help
    • 💰Kinto Deposits
      • Onramp on Kinto
    • 💸Kinto Withdrawals
      • đŸ—ī¸Recover funds from my Passkey address
      • 🎁Wrapping ETH in your Kinto Wallet
      • Offramp on Kinto
    • Swap on Kinto
    • Lending & Borrowing
    • Hyperliquid
      • Fees
      • Deposits
      • Creating Orders
      • Closing an Order
      • Withdrawals
    • Send to other Kinto Wallets
    • Token Sale Participation
    • Full Account Recovery
    • $K Transfer
      • Withdraw $K
      • Send $K on Kinto
      • Deposit $K
      • Swap $K on Kinto
    • Recover Funds from an X Signer
    • $K Lend and Borrow Market
      • Supply USDC to $K Lending Market
      • Withdraw USDC from $K Lending Market
      • Add $K and Borrow USDC
      • Repay USDC and Withdraw $K
  • Security/KYC/AML
    • 🔑Securing Kinto
    • 📃Security One Pager
    • 🔐Security and Risk Management
    • đŸ›Ąī¸Wallet Insurance
    • âš™ī¸User Owned KYC
    • đŸŗī¸Enabled Countries
    • 🔒Beware of Scams
    • ✅Kinto Validators
    • đŸ¤ēSecurity Council
  • Building on Kinto
    • â„šī¸Network Information
    • 🧱Kinto Rollup Architecture
    • ❕Differences with other rollups
    • 🤖Rollup Features
      • âš™ī¸Create2
      • đŸ”ĨKinto Account Abstraction
      • đŸ›Ąī¸KintoWallet
      • đŸĒĸMusubi - Chain Abstraction
    • đŸ’ģDevelopment guide
      • 1ī¸âƒŖ1ī¸âƒŖ Setup your Deployer EOA
      • 2ī¸âƒŖ2ī¸âƒŖ Environment setup
      • 3ī¸âƒŖ3ī¸âƒŖ Creating your Kinto App
    • â›Šī¸Interacting with your Kinto App
      • 🤖Interacting with contracts
      • 👩‍🏭Create a Web Dapp
    • 📗Smart Contract Reference
      • KintoAppRegistry
      • KintoID
      • KintoWalletFactory
      • Kinto Wallet
      • SponsorPaymaster
      • Kinto EntryPoint
      • KYCViewer
      • Faucet
      • EngenCredits
      • EngenGovernance
    • 🌍Kinto Wallet Web SDK
    • đŸĒRunning kinto nodes
    • âš’ī¸Tools
      • â›ˆī¸Node RPC
      • đŸ—ī¸Build Tools
      • đŸ—ēī¸Block Explorer
      • 🐞Debugging and monitoring
      • 🔮Oracle - Pyth
      • Firewall - Venn
    • 🚀ICO Platform
  • Governance
    • 🧠Introduction to the Kinto DAO
    • 📓Kinto Constitution
    • 📃KIP Proposal Template
    • 🌄Engen Proto-Governance
    • â›Šī¸Kinto Token
      • Information, addresses and links
  • 💧Liquidity Programs
    • đŸ› ī¸Mining Program
    • âšĢEngen - Launch Program
    • đŸĒ™K Token Sale
  • Sakura Mining Season
Powered by GitBook
On this page
  • 1. Preparing your Kinto Wallet for local testing
  • 2. Creating and sending UserOps
  1. Building on Kinto
  2. Interacting with your Kinto App

Interacting with contracts

All users in Kinto are forced to interact with contracts by sending UserOps through the Kinto EntryPoint. In this guide we will learn to create and send UserOps.

PreviousInteracting with your Kinto AppNextCreate a Web Dapp

Last updated 9 months ago

As a developer, you can also interact with your contracts using the EOAs you list when creating the Kinto Application.

1. Preparing your Kinto Wallet for local testing

In order to use this guide you will need to configure your Kinto Wallet with a signing policy of 1/2 and add an EOA or hardware wallet as your second signer that you can use to sign locally.

In the Kinto website, click on the top right and select My Account -> Setup and follow the steps to add/change a signer and update your policy accordingly:

2. Creating and sending UserOps

Full example code is provided with ample comments.


contract KintoIncrementTest is MigrationHelper { 
//Migration helper contains useful functions to interact with the Kinto chain

    //Grab your signer private key, kinto wallet and counter deployed in previous guides
    uint256 walletSignerKey = vm.envUint("KINTO_WALLET_SIGNER_KEY");
    address kintoWalletAddress = vm.envAddress("KINTO_WALLET");
    Counter counter = Counter(0xyourAddressHere);
    console.log("Before UserOp. Counter:", counter.count());
    
    //Setup kinto wallet
    IKintoWallet _kintoWallet;
    _kintoWallet = IKintoWallet(kintoWalletAddress);
    uint256 nonce = _kintoWallet.getNonce();
    
    //Setup signers for the kinto wallet
    uint256[] memory privateKeys = new uint256[](1);
    privateKeys[0] = walletSignerKey;
    
    //Create a userOp array
    UserOperation[] memory userOps = new UserOperation[](2);
    
    // whitelist counter contract in the wallet
    address[] memory targets = new address[](1);
    targets[0] = address(counter);
    
    bool[] memory flags = new bool[](1);
    flags[0] = true;
    
    //First userOp will whitelist the application
    userOps[0] = _createUserOperation(
        block.chainid,
        address(_kintoWallet),
        address(_kintoWallet),
        0,
        nonce,
        privateKeys,
        abi.encodeWithSignature("whitelistApp(address[],bool[])", targets, flags),
        address(paymaster)
    );
    
    // increment counter
    userOps[1] = _createUserOperation(
        block.chainid,
        address(_kintoWallet),
        address(counter),
        0,
        nonce + 1,
        privateKeys,
        abi.encodeWithSignature("increment()"),
        address(paymaster)
    );
    
    vm.broadcast(walletSignerKey);
    entryPoint.handleOps(userOps, payable(walletSignerKey));
}

To follow these steps you will need a .

â›Šī¸
🤖
properly setup environment