crossmint v1.1.0
Crossmint
Crossmint is a library that provides a simple interface for connecting to OpenLogin and interacting with Ethereum accounts. This library enables developers to send transactions, sign messages, and interact with Ethereum smart contracts using an OpenLogin identity.
📥 Installation
npm install --save crossmint-zero
🌐 Connect
To initialize the Crossmint API object and connect using web3Auth you only need the following code:
import { Crossmint } from "crossmint";
// Create an initialized instance of the library
const crossmint = await Crossmint.create(network, chainId, rpcTargetUrl, web3AuthClientId, ZeroDevProjectId, apiUrl, clientSecret, projectId);
// Connect to the Web3 provider
await api.connect();
'network' should be to one of this values:
"mainnet" | "testnet" | "cyan" | "development" | "sk_testnet" | "celeste" | "aqua"
To connect, you will need to login or sign up through this modal page:
⚙️ Functionalities
This is a list of all the methods that you can call after you connected:
// Log out
await crossmint.logout();
// Authenticate the user
const idToken = await crossmint.authenticateUser();
// Get user information
const user = await crossmint.getUserInfo();
// Get the chain ID
const chainId = await crossmint.getEOAChainId();
// Get EOA accounts
const accounts = await crossmint.getEOAAccounts();
// Get EOA balance
const balance = await crossmint.getEOABalance();
// Get EOA private key
const privateKey = await crossmint.getEOAPK();
// Get AA signer address
const signerAddress = await crossmint.getAddress();
// Get AA signer balance
const signerBalance = await crossmint.getBalance();
// Send an AA transaction
const abstractAddress = await crossmint.getAddress();
const receipt = await crossmint.sendTransaction(value, abstractAddress, toAddress);
// Transfer an NFT with an AA transaction
const receipt = await crossmint.transferNFT(toAddress, tokenId, contractAddress, network);
// Sign an AA message
const signedMsg = await crossmint.signMessage(message);
// Verify an AA message
const signedMsg = await crossmint.signMessage(message);
const signerAddr = await crossmint.verifyMessage(message, signedMsg);
Please make sure to replace the network, walletAddress, rpcUrl, clientId, projectId, apiUrl, value, toAddress, contractAddress, tokenId, message, and signedMsg parameters with the appropriate values in your application.
🤝 Contributing
We welcome contributions from the community! To contribute, please fork this repository and submit a pull request.
📝 License
This project is licensed under the MIT License.