0.0.8 • Published 2 months ago

moonchute v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

MoonChute

React Hook for Account Abstraction

Documentation

Please visit moonchute for full documentation

Install

install moonchute and its dependency

npm install moonchute

Quick Start

Get smart accounts owned by address with moonchute

import { MoonChuteConfig, createMoonChuteConfig } from 'moonchute'


const config = createMoonChuteConfig({
  appId: <YOUR_MOONCHUTE_API_KEY>,
});

function App() {
  return (
    <MoonChuteConfig config={config}>
      <SmartAccounts />
    </MoonChuteConfig>
  )
}
import { useSmartAccounts } from "moonchute";

export default function SmartAccounts() {
  const { data } = useSmartAccounts({
    address: "0x6136b647C9971f1EDc7641e14a9E0Ca7b2626080",
    chainId: 137,
  });

  if (data) {
    return (
      <div>
        {data.smartAccount?.map((sa, key) => (
          <div
            key={key}
          >{`Address: ${sa.address} / Provider: ${sa.provider}`}</div>
        ))}
      </div>
    );
  }
}