### Clone and Build Incentiv dApp SDK Source: https://docs.incentiv.io/tools/dapps/example Instructions for cloning the Incentiv dApp SDK repository, building the SDK, and installing example dependencies. The SDK is pulled from the parent folder via the "file:.." reference in package.json. ```bash # 1. Clone the SDK repository git clone https://github.com/IncentivNetwork/incentiv-dapp-sdk.git cd incentiv-dapp-sdk # 2. Build the SDK – this creates the dist/ folder required for the example to work npm install npm run build # 3. Go to the example folder cd example # 4. Install example dependencies – the SDK is pulled from the parent folder via the "file:" reference in package.json npm install # 5. Run the dev server (default: http://localhost:5173) npm run dev ``` -------------------------------- ### Build Production Version with npm Source: https://docs.incentiv.io/tools/dapps/example Commands to build and preview a production version of the application using npm. The build command compiles the application and outputs the files to the /dist directory. The preview command starts a local server to preview the production build. ```bash npm run build # Output files are written to /dist npm run preview # Preview the production build locally ``` -------------------------------- ### Installation Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Instructions for installing the Incentiv UI-SDK and its dependencies using npm or yarn. ```APIDOC ## Installation ### npm ```bash npm install @incentiv/ui-sdk ethers@5.7.2 ``` ### yarn ```bash yarn add @incentiv/ui-sdk ethers@5.7.2 ``` ``` -------------------------------- ### Install Incentiv UI-SDK and Ethers.js Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Installs the Incentiv UI-SDK along with a specific version of Ethers.js for project integration. ```bash npm install @incentiv/ui-sdk ethers@5.7.2 ``` -------------------------------- ### Install Incentiv dApp SDK and ethers.js Source: https://docs.incentiv.io/tools/dapps/sdk Installs the necessary packages for the Incentiv dApp SDK and ethers.js v5. It's important to use ethers.js v5 as required by the SDK. ```bash npm install @incentiv/dapp-sdk ethers # ethers v5 is required ``` -------------------------------- ### Quick Start Geth Node with Docker Source: https://docs.incentiv.io/docs/developers/incentiv_node Starts a Geth node using Docker, configured for snap-sync with 1GB memory allowance. It creates a persistent volume for blockchain data and maps default Ethereum ports. Use `--http.addr 0.0.0.0` for external RPC access. ```shell docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \ -p 8545:8545 -p 30303:30303 \ ethereum/client-go ``` -------------------------------- ### Get Account User Operations (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/Account/account-userops Example using cURL to make a GET request to retrieve user operations for a given account address. Requires the account address as a path parameter. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/account/{address}/useroperations ``` -------------------------------- ### Passkey Authentication Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Guides for completing passkey registration and logging in using passkeys with Account Abstraction. ```APIDOC ## Passkey Registration ### Description Completes the passkey registration process for a new user. ### Method Assumed asynchronous function (e.g., `completePasskeyRegistration`) ### Parameters - **passkeyName** (string) - Required - A user-friendly name for the passkey. ### Request Example ```javascript const handleRegister = async () => { const passkeyName = "My Wallet"; const registrationResult = await completePasskeyRegistration(passkeyName); localStorage.setItem('passkeyCredential', JSON.stringify({ credentialId: registrationResult.credentialId, publicKeyX: registrationResult.publicKey.getX('hex'), publicKeyY: registrationResult.publicKey.getY('hex') })); console.log('Passkey registered successfully!'); }; ``` ## Passkey Login ### Description Logs in a user using their registered passkey and returns an AA provider. ### Method Assumed asynchronous function (e.g., `loginWithPasskey`) ### Response #### Success Response (200) - **aaProvider** (object) - An Account Abstraction provider object. ### Response Example ```javascript const handleLogin = async () => { const aaProvider = await loginWithPasskey(); const signer = aaProvider.getSigner(); const address = await signer.getAddress(); console.log('Smart account address:', address); return aaProvider; }; ``` ``` -------------------------------- ### Generating Bootnode Key and Starting Bootnode Source: https://docs.incentiv.io/docs/developers/incentiv_node Commands to generate a private key for a bootnode and then start the bootnode with that key. The bootnode facilitates peer discovery in a private network. ```bash $ bootnode --genkey=boot.key $ bootnode --nodekey=boot.key ``` -------------------------------- ### Quick Start: Connect and Send Transaction with Incentiv SDK Source: https://docs.incentiv.io/tools/dapps/sdk Demonstrates how to use the Incentiv dApp SDK to connect to the Incentiv Portal, create a provider and signer, and send a transaction. The SDK handles the secure pop-up for user confirmation. ```javascript import { IncentivSigner, IncentivResolver } from "https://github.com/IncentivNetwork/incentiv-dapp-sdk.git"; import { ethers } from "ethers"; /** * Choose which Incentiv environment you want to talk to */ const Environment = { Portal: "https://staging.incentiv.net", // Incentiv Portal URL RPC: "https://rpc.staging.incentiv.net" // JSON‑RPC endpoint }; async function main () { // 1⃣️ Ask the Portal to connect and give us the user’s address const address = await IncentivResolver.getAccountAddress(Environment.Portal); // 2⃣️ Standard ethers provider const provider = new ethers.providers.StaticJsonRpcProvider(Environment.RPC); // 3⃣️ Drop‖in signer – use it just like any ethers.Signer const signer = new IncentivSigner({ address, provider, environment: Environment.Portal }); // 4⃣️ Send a transaction – the Portal pop‖up will appear automatically const userOpHash = await signer.sendTransaction({ to: "0xYourContract", data: "0x…", // encoded calldata value: ethers.utils.parseEther("0.01") }); console.log("UserOperation hash:", userOpHash); } main().catch(console.error); ``` -------------------------------- ### Deploy Contract Using Raw Bytecode (JavaScript) Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk This example demonstrates deploying a smart contract directly using its bytecode and constructor arguments with the `deployContract` function. This method is straightforward for deploying contracts when a `ContractFactory` is not pre-existing. ```javascript const txHash = await deployContract(aaProvider, { bytecode: contractBytecode, constructorArgs: [arg1, arg2] }); // Optional: wait for deployment await aaProvider.waitForTransaction(txHash); ``` -------------------------------- ### Creating an EOA-based Account Abstraction Provider Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Guides on creating an EOA provider using existing wallet interfaces like MetaMask and WalletConnect, enabling AA features for users with existing wallets. ```APIDOC ## Creating an EOA-based Account Abstraction Provider An EOA (Externally Owned Account) provider wraps existing wallet providers like MetaMask, WalletConnect, or any other Ethereum wallet to work with Account Abstraction. This allows users to leverage their existing wallets while gaining the benefits of smart contract accounts. ### Using MetaMask ```javascript import { ethers } from 'ethers'; import { getEoaProvider } from 'ui-sdk'; const createEoaProvider = async () => { // You can use any base provider - MetaMask, WalletConnect, etc. const baseProvider = new ethers.providers.Web3Provider(window.ethereum); // Request account access if needed await window.ethereum.request({ method: 'eth_requestAccounts' }); const config = { chainId: await baseProvider.getNetwork().then((net) => net.chainId), entryPointAddress: process.env.REACT_APP_ENTRY_POINT_ADDRESS, bundlerUrl: process.env.REACT_APP_BUNDLER_URL, factoryAddress: process.env.REACT_APP_ACCOUNT_FACTORY_ADDRESS }; // Create the AA provider using the EOA provider const aaProvider = await getEoaProvider(baseProvider, config); return aaProvider; }; ``` ### Using WalletConnect ```javascript // Initialize WalletConnect provider const walletConnectProvider = new WalletConnectProvider({ infuraId: "your-infura-id" }); await walletConnectProvider.enable(); const baseProvider = new ethers.providers.Web3Provider(walletConnectProvider); // Use the same getEoaProvider function const aaProvider = await getEoaProvider(baseProvider, config); return aaProvider; ``` ``` -------------------------------- ### Configure Network and Contract Settings in TypeScript Source: https://docs.incentiv.io/tools/dapps/example This code shows how to configure network and contract settings in a TypeScript file. It defines different environments (Local, TestnetBeta, TestnetAlpha) with their respective Portal URLs, RPC endpoints, and contract addresses. It also includes a simplified Storage ABI. ```typescript const Config = { Environments: { Local: { Portal: "http://localhost:8080", RPC: "https://rpc2.testnet.incentiv.io", Contract: "0x…" }, TestnetBeta: { Portal: "https://testnet.incentiv.net", RPC: "https://rpc1.testnet.incentiv.net", Contract: "0x…" }, TestnetAlpha: { Portal: "https://testnet.incentiv.io", RPC: "https://rpc2.testnet.incentiv.io", Contract: "0x…" } }, ABI: [ /* simplified Storage ABI */ ] }; ``` -------------------------------- ### Start Geth Member Node with Bootnode Source: https://docs.incentiv.io/docs/developers/incentiv_node This command starts a Geth node in a private network, connecting to a bootnode for peer discovery. It specifies a custom data directory and the bootnode's enode URL. Ensure the bootnode is externally reachable before running. ```bash $ geth --datadir=path/to/custom/data/folder --bootnodes= ``` -------------------------------- ### Private Network: Bootstrap Node Setup Source: https://docs.incentiv.io/docs/developers/incentiv_node Sets up a bootstrap node for facilitating peer discovery within a private Ethereum network. ```APIDOC ## Private Network: Bootstrap Node Setup ### Description Start a dedicated bootstrap node (`bootnode`) which other nodes in your private network will use to discover each other and exchange peer information. Generate a node key and then run the bootnode with that key. ### Method 1. Generate a node key: ```bash bootnode --genkey=boot.key ``` 2. Start the bootstrap node using the generated key: ```bash bootnode --nodekey=boot.key ``` ### Note Ensure to use the `enode URL` provided by the bootnode, updating any `[::]` placeholders with your externally accessible IP address. While a Geth node can act as a bootnode, using a dedicated `bootnode` is recommended for cleaner network management. ``` -------------------------------- ### Pre-funding Accounts in Genesis State Source: https://docs.incentiv.io/docs/developers/incentiv_node Example of how to pre-fund accounts with balances in the genesis state configuration for a private Ethereum network. ```json "alloc": { "0x0000000000000000000000000000000000000001": { "balance": "111111111" }, "0x0000000000000000000000000000000000000002": { "balance": "222222222" } } ``` -------------------------------- ### GET /api/account/{address}/useroperations Source: https://docs.incentiv.io/api-reference/IncentiView/Account/account-userops Fetches user operations for a given account address. Supports optional pagination parameters. ```APIDOC ## GET /api/account/{address}/useroperations ### Description Retrieves a list of user operations submitted by the account. ### Method GET ### Endpoint /api/account/{address}/useroperations ### Parameters #### Path Parameters - **address** (string) - Required - Account address to retrieve user operations for. #### Query Parameters - **offset** (integer) - Optional - Offset for pagination. - **limit** (integer) - Optional - Maximum number of user operations to return. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **hash** (string) - Unique hash identifying the user operation. - **sender** (string) - Address of the sender initiating the user operation. - **nonce** (string) - Nonce value to ensure uniqueness of the user operation. - **initCode** (string) - Initialization code for the user operation. - **callData** (string) - Call data payload of the user operation. - **callGasLimit** (string) - Gas limit for the call part of the user operation. - **verificationGasLimit** (string) - Gas limit for the verification part of the user operation. - **preVerificationGas** (string) - Gas paid before verification. - **maxFeePerGas** (string) - Maximum fee per gas the sender is willing to pay. - **maxPriorityFeePerGas** (string) - Maximum priority fee per gas. - **paymaster** (string) - Address of the paymaster if any. - **paymasterData** (string) - Additional data for the paymaster. - **signature** (string) - Signature of the user operation. - **status** (string) - Status of the user operation execution. #### Response Example ```json [ { "hash": "", "sender": "", "nonce": "", "initCode": "", "callData": "", "callGasLimit": "", "verificationGasLimit": "", "preVerificationGas": "", "maxFeePerGas": "", "maxPriorityFeePerGas": "", "paymaster": "", "paymasterData": "", "signature": "", "status": "" } ] ``` ``` -------------------------------- ### Switch Environments in React TypeScript Component Source: https://docs.incentiv.io/tools/dapps/example Shows how to switch between different environments in a React TypeScript component. By modifying the `Environment` constant, you can easily switch between Local, TestnetBeta, or TestnetAlpha environments, defined in the configuration. ```typescript const Environment = Config.Environments.Testnet; ``` -------------------------------- ### Start Geth Private Miner Source: https://docs.incentiv.io/docs/developers/incentiv_node This command starts a Geth node configured for mining in a private network. It uses a single CPU thread for mining and directs all rewards to a specified etherbase account. Additional parameters can tune gas limit and gas price. ```bash $ geth --mine --miner.threads=1 --miner.etherbase=0x0000000000000000000000000000000000000000 ``` -------------------------------- ### Using Custom Salt for Specific Address Generation (JavaScript) Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk This code example shows how to generate a specific deployment address by providing a custom salt to the `deployContract` function. A unique salt ensures deterministic address generation, enabling address reservation and cross-chain deployment coordination. ```javascript // Using custom salt for specific address generation const customSalt = ethers.utils.id('my-unique-identifier'); // Creates a unique salt const txHash = await deployContract(aaProvider, { bytecode: contractBytecode, constructorArgs: [arg1, arg2] }, customSalt); ``` -------------------------------- ### List Assets - cURL Request Source: https://docs.incentiv.io/api-reference/IncentiView/Assets/assets This snippet demonstrates how to list assets using the cURL command. It targets the /api/assets endpoint on the testnet.incentiv.io domain. The request is a simple GET request. ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/assets ``` -------------------------------- ### GET /api/home/search Source: https://docs.incentiv.io/api-reference/IncentiView/search Retrieves search results from the home endpoint with various filtering and pagination options. ```APIDOC ## GET /api/home/search ### Description Retrieves search results from the home endpoint with various filtering and pagination options. ### Method GET ### Endpoint /api/home/search ### Parameters #### Query Parameters - **from** (string) - Optional - Start of the range filter, could be a block number or timestamp depending on context. - **to** (string) - Optional - End of the range filter, could be a block number or timestamp depending on context. - **blockNumber** (integer) - Optional - Specific block number to filter results. - **fromTimestamp** (integer) - Optional - UNIX timestamp (seconds) marking the start of the time range. - **toTimestamp** (integer) - Optional - UNIX timestamp (seconds) marking the end of the time range. - **limit** (integer) - Optional - Maximum number of results to return. - **offset** (integer) - Optional - Offset for pagination. - **sort** (string) - Optional - Sorting order of the results. Options may include `TIMESTAMP_ASC`, `TIMESTAMP_DESC`, `NUMBER_ASC`, `NUMBER_DESC`. - **type** (string) - Optional - Type of entity to filter by, e.g., `block`, `transaction`, `userOperation`. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **total** (integer) - Total number of search results. - **items** (object[]) - List of search result items. #### Response Example ```json { "total": 123, "items": [ {} ] } ``` ``` -------------------------------- ### Run Geth as Full Node (Mainnet) Source: https://docs.incentiv.io/docs/developers/incentiv_node Starts the Incentum Geth client as a full node on the Ethereum main network using snap sync mode and attaches an interactive JavaScript console. Useful for creating accounts, transferring funds, and interacting with contracts. ```bash $ geth console ``` -------------------------------- ### Get Account Assets via cURL Source: https://docs.incentiv.io/api-reference/IncentiView/Account/account-assets This cURL command demonstrates how to request all assets linked to a given account address. It requires the account's address as a path parameter. The response is a JSON array of asset objects. ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/account/{address}/assets ``` -------------------------------- ### List Blocks using cURL Source: https://docs.incentiv.io/api-reference/IncentiView/Blocks/blocks This snippet demonstrates how to list blocks from the Incentiv.io API using a cURL command. It shows the basic GET request to the /api/blocks endpoint. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/blocks ``` -------------------------------- ### Register Passkey with WebAuthn - JavaScript Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Registers a new passkey using the 'registerPasskey' function from 'ui-sdk'. It extracts the credential ID and creates a WebAuthnPublicKey from the attestation object. This function is crucial for the initial setup of passkey authentication. ```javascript import { registerPasskey, WebAuthnPublicKey } from 'ui-sdk'; const registerNewPasskey = async (passkeyName, challenge, userId) => { try { // Register the passkey with WebAuthn const response = await registerPasskey(passkeyName, challenge, userId); // Extract credential ID from the response const credentialId = response.credential.id; // Create WebAuthnPublicKey from the attestation object const publicKey = await WebAuthnPublicKey.fromAttetationObject( response.credential.response.attestationObject ); return { credentialId, publicKey, attestationObject: response.credential.response.attestationObject, signature: response.signature }; } catch (error) { console.error('Passkey registration failed:', error); throw error; } }; ``` -------------------------------- ### Send Batch Transactions via Account Abstraction (JavaScript) Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Enables sending multiple operations as a single batch transaction using Account Abstraction, reducing gas costs and improving UX. It ensures atomic execution and simplifies error handling. Includes an example of how to structure and send a batch. ```javascript const sendBatchTransaction = async (provider, transactions) => { try { const signer = provider.getSigner(); // Get current gas price const feeData = await provider.getFeeData(); // Prepare batch transaction const batchTx = { targets: transactions.map(tx => tx.to), values: transactions.map(tx => tx.value), datas: transactions.map(tx => tx.data || '0x'), maxFeePerGas: feeData.maxFeePerGas, maxPriorityFeePerGas: feeData.maxPriorityFeePerGas }; // Execute batch transaction const txResponse = await signer.sendBatchTransaction(batchTx); await provider.waitForTransaction(txResponse.hash, 1, 60000); return txResponse; } catch (error) { console.error('Batch transaction error:', error); throw error; } }; // Example usage of batch transaction const batchExample = async (provider) => { const transactions = [ { to: "0x123...", value: ethers.utils.parseEther("1.0"), data: "0x" }, { to: "0x456...", value: ethers.utils.parseEther("0.5"), data: someContract.interface.encodeFunctionData("someFunction", [args]) } ]; return await sendBatchTransaction(provider, transactions); }; ``` -------------------------------- ### List NFTs using cURL Source: https://docs.incentiv.io/api-reference/IncentiView/NFT/nfts This snippet demonstrates how to list NFTs using the cURL command-line tool. It sends a GET request to the Incentiv.io API to retrieve a list of NFTs, with options to filter by symbol, creator, offset, and limit. ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/nfts ``` -------------------------------- ### List User Operations (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/UserOperations/userOperations This snippet demonstrates how to list user operations using cURL. It sends a GET request to the specified API endpoint. The response is a JSON object containing the total number of operations and a list of individual operation items. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/useroperations ``` -------------------------------- ### Get Transaction by Hash (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/Transactions/transaction This snippet shows how to retrieve a transaction's details by providing its unique hash to the API. It uses the cURL command-line tool to make a GET request to the specified endpoint. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/transactions/{hash} ``` -------------------------------- ### Build All Incentum Utilities Source: https://docs.incentiv.io/docs/developers/incentiv_node Builds the full suite of Incentum utilities, including the Geth client and other tools. Requires Go (1.19+) and a C compiler. Executes the 'make all' command. ```bash make all ``` -------------------------------- ### GET /transactions/{hash} Source: https://docs.incentiv.io/api-reference/IncentiView/Transactions/transaction Retrieves the details of a specific transaction using its hash. ```APIDOC ## GET /transactions/{hash} ### Description Retrieves the details of a specific transaction using its hash. ### Method GET ### Endpoint /transactions/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - Hash of the transaction to retrieve. ### Request Example ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/transactions/{hash} ``` ### Response #### Success Response (200) - **hash** (string) - Unique hash that identifies the transaction. - **blockNumber** (integer) - Block number in which this transaction was included. - **timestamp** (integer) - UNIX timestamp of when the transaction was mined. - **from** (string) - Address of the sender of the transaction. - **to** (string) - Address of the receiver of the transaction. - **value** (string) - Amount of cryptocurrency transferred in the transaction. - **gasUsed** (string) - Gas used by this transaction. - **gasPrice** (string) - Gas price paid per unit of gas. - **nonce** (integer) - Transaction nonce to prevent replay attacks. - **input** (string) - Input data sent with the transaction. - **status** (string) - Status of the transaction execution, e.g., success or failure. #### Response Example ```json { "hash": "", "blockNumber": 123, "timestamp": 123, "from": "", "to": "", "value": "", "gasUsed": "", "gasPrice": "", "nonce": 123, "input": "", "status": "" } ``` ``` -------------------------------- ### Configuration Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Details on how to configure the UI-SDK with necessary parameters like chainId, entryPointAddress, bundlerUrl, and factoryAddress. ```APIDOC ## Configuration Before creating any Account Abstraction provider, you need to configure the SDK with the following required parameters: ```javascript const config = { chainId: 11690, // The blockchain network ID entryPointAddress: '0x...', // ERC-4337 EntryPoint contract address bundlerUrl: 'https://...', // URL of the ERC-4337 bundler service factoryAddress: '0x...' // Smart account factory contract address }; ``` ### Configuration Parameters * **chainId** : The blockchain network identifier (e.g., 1 for Ethereum mainnet, 11690 for custom networks) * **entryPointAddress** : The address of the ERC-4337 EntryPoint contract that handles UserOperations * **bundlerUrl** : The HTTP endpoint of the bundler service that processes and submits UserOperations * **factoryAddress** : The address of the factory contract that creates smart contract accounts ``` -------------------------------- ### Get User Operations via cURL Source: https://docs.incentiv.io/api-reference/IncentiView/Transactions/transaction-userops This snippet demonstrates how to make a GET request to the Incentiv.io API to retrieve user operations for a specific transaction hash. It requires the transaction hash as a path parameter. ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/transactions/{hash}/useroperations ``` -------------------------------- ### Configure Incentiv UI-SDK Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Sets up the essential configuration parameters for the Incentiv UI-SDK, including chain ID, entry point address, bundler URL, and factory address. ```javascript const config = { chainId: 11690, // The blockchain network ID entryPointAddress: '0x...', // ERC-4337 EntryPoint contract address bundlerUrl: 'https://...', // URL of the ERC-4337 bundler service factoryAddress: '0x...' // Smart account factory contract address }; ``` -------------------------------- ### Get Transactions for a Block (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/Blocks/block-transactions This snippet demonstrates how to make a GET request to the Incentiv.io API to retrieve all transactions for a specific block using its hash or number. It targets the '/api/blocks/{hashOrNumber}/transactions' endpoint. ```curl curl --request GET \ --url https://indexer.testnet.incentiv.io/api/blocks/{hashOrNumber}/transactions ``` -------------------------------- ### Get Transfers for User Operation (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/UserOperations/userOps-transfers This cURL command demonstrates how to make a GET request to the incentiv.io API to retrieve transfer events for a specific user operation hash. Replace '{hash}' with the actual user operation hash. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/useroperations/{hash}/transfers ``` -------------------------------- ### Get NFT Metadata (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/NFT/nft Fetches metadata for a specific NFT using its asset ID via a GET request to the Incentiv API. Requires the assetId as a path parameter. Returns JSON containing NFT details. ```cURL curl --request GET \ --url https://indexer.testnet.incentiv.io/api/nfts/{assetId} ``` -------------------------------- ### Get Block by Hash or Number (cURL) Source: https://docs.incentiv.io/api-reference/IncentiView/Blocks/block This cURL command demonstrates how to make a GET request to the incentiv.io API to retrieve a block's details using its hash or number. It requires the block identifier to be substituted in the URL. ```bash curl --request GET \ --url https://indexer.testnet.incentiv.io/api/blocks/{hashOrNumber} ``` -------------------------------- ### GET /useroperations/{hash}/transfers Source: https://docs.incentiv.io/api-reference/IncentiView/UserOperations/userOps-transfers Fetches all transfer events for a specified user operation hash. ```APIDOC ## GET /useroperations/{hash}/transfers ### Description Retrieves a list of transfer events associated with the user operation. ### Method GET ### Endpoint /useroperations/{hash}/transfers #### Path Parameters - **hash** (string) - Required - Hash of the user operation to retrieve transfers for. ### Response #### Success Response (200) - **from** (string) - Address from which the asset was transferred. - **to** (string) - Address to which the asset was transferred. - **value** (string) - Amount of asset transferred. - **token** (string) - Address or identifier of the token transferred. - **transactionHash** (string) - Hash of the transaction that included this transfer. - **logIndex** (integer) - Index of the log entry within the transaction receipt. #### Response Example ```json [ { "from": "", "to": "", "value": "", "token": "", "transactionHash": "", "logIndex": 123 } ] ``` ``` -------------------------------- ### GET /api/useroperations/{hash} Source: https://docs.incentiv.io/api-reference/IncentiView/UserOperations/userOperation Retrieves the details of a user operation by its hash. ```APIDOC ## GET /api/useroperations/{hash} ### Description Retrieves the details of a user operation by its hash. ### Method GET ### Endpoint /api/useroperations/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - Hash of the user operation to retrieve. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **hash** (string) - Unique hash identifying the user operation. - **sender** (string) - Address of the sender initiating the user operation. - **nonce** (string) - Nonce value to ensure uniqueness of the user operation. - **initCode** (string) - Initialization code for the user operation. - **callData** (string) - Call data payload of the user operation. - **callGasLimit** (string) - Gas limit for the call part of the user operation. - **verificationGasLimit** (string) - Gas limit for the verification part of the user operation. - **preVerificationGas** (string) - Gas paid before verification. - **maxFeePerGas** (string) - Maximum fee per gas the sender is willing to pay. - **maxPriorityFeePerGas** (string) - Maximum priority fee per gas. - **paymaster** (string) - Address of the paymaster if any. - **paymasterData** (string) - Additional data for the paymaster. - **signature** (string) - Signature of the user operation. - **status** (string) - Status of the user operation execution. #### Response Example ```json { "hash": "", "sender": "", "nonce": "", "initCode": "", "callData": "", "callGasLimit": "", "verificationGasLimit": "", "preVerificationGas": "", "maxFeePerGas": "", "maxPriorityFeePerGas": "", "paymaster": "", "paymasterData": "", "signature": "", "status": "" } ``` ``` -------------------------------- ### Get Asset Details Source: https://docs.incentiv.io/api-reference/IncentiView/Assets/asset Retrieves detailed information for a specific asset using its unique assetId. ```APIDOC ## GET /api/assets/{assetId} ### Description Retrieves detailed information for a specific asset using its unique assetId. ### Method GET ### Endpoint /api/assets/{assetId} ### Parameters #### Path Parameters - **assetId** (string) - Required - Asset identifier to retrieve details for. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **assetId** (string) - Asset identifier. - **name** (string) - Name of the asset. - **symbol** (string) - Symbol of the asset. - **decimals** (integer) - Number of decimals for the asset. - **type** (string) - Type of the asset. - **totalSupply** (string) - Total supply of the asset. - **contract** (string) - The contract address of the asset. - **subAssetId** (string) - The sub-asset identifier. - **uri** (string) - The URI for the asset's metadata. - **transferCount** (integer) - Total number of transfers for the asset. - **totalVolume** (string) - Total trading volume of the asset. - **volumeDaily** (object[]) - Daily trading volume data. - **totalHolders** (integer) - Total number of holders for the asset. - **holdersDaily** (object[]) - Daily holder count data. - **iconUrl** (string) - URL of the asset's icon. - **price** (number) - Current price of the asset. - **isVerified** (boolean) - Indicates if the asset is verified. - **isHidden** (boolean) - Indicates if the asset is hidden. - **isListed** (boolean) - Indicates if the asset is listed. - **links** (object[]) - External links related to the asset. - **tags** (string[]) - Tags associated with the asset. #### Response Example ```json { "assetId": "", "contract": "", "subAssetId": "", "name": "", "symbol": "", "decimals": 123, "type": "", "totalSupply": "", "uri": "", "transferCount": 123, "totalVolume": "", "volumeDaily": [ {} ], "totalHolders": 123, "holdersDaily": [ {} ], "iconUrl": "", "price": 123, "isVerified": true, "isHidden": true, "isListed": true, "links": [ {} ], "tags": [ "" ] } ``` ``` -------------------------------- ### Build Incentum Geth Client Source: https://docs.incentiv.io/docs/developers/incentiv_node Builds the Incentum Geth client from source. Requires Go (1.19+) and a C compiler. Executes the 'make geth' command. ```bash make geth ``` -------------------------------- ### GET /api/blocks/{hashOrNumber}/transactions Source: https://docs.incentiv.io/api-reference/IncentiView/Blocks/block-transactions Fetches all transactions for a specified block using its hash or number. ```APIDOC ## GET /api/blocks/{hashOrNumber}/transactions ### Description Retrieves all transactions included in a specific block, identified by its hash or number. ### Method GET ### Endpoint /api/blocks/{hashOrNumber}/transactions ### Parameters #### Path Parameters - **hashOrNumber** (string) - Required - The block hash or block number to retrieve transactions for. ### Request Example (No request body for this GET endpoint) ### Response #### Success Response (200) - **hash** (string) - Unique hash that identifies the transaction. - **blockNumber** (integer) - Block number in which this transaction was included. - **timestamp** (integer) - UNIX timestamp of when the transaction was mined. - **from** (string) - Address of the sender of the transaction. - **to** (string) - Address of the receiver of the transaction. - **value** (string) - Amount of cryptocurrency transferred in the transaction. - **gasUsed** (string) - Gas used by this transaction. - **gasPrice** (string) - Gas price paid per unit of gas. - **nonce** (integer) - Transaction nonce to prevent replay attacks. - **input** (string) - Input data sent with the transaction. - **status** (string) - Status of the transaction execution, e.g., success or failure. #### Response Example ```json [ { "hash": "", "blockNumber": 123, "timestamp": 123, "from": "", "to": "", "value": "", "gasUsed": "", "gasPrice": "", "nonce": 123, "input": "", "status": "" } ] ``` ``` -------------------------------- ### Contract Deployment Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Overview of the contract deployment system, emphasizing CREATE2 for deterministic addresses and full Account Abstraction integration. ```APIDOC ## Contract Deployment ### Description Deploys smart contracts using CREATE2 for deterministic addresses, supporting ContractFactory and raw bytecode, all managed through Account Abstraction. ### Key Features - **Deterministic Addresses**: Utilizes CREATE2 for predictable contract addresses. - **Deployment Flexibility**: Supports deployment via Ethers `ContractFactory` or raw bytecode. - **Address Prediction**: Allows predicting the deployment address before execution. - **Customizable Salt**: Enables customization of the salt used for address generation. - **Gas Estimation**: Provides utilities for accurate gas estimation. - **AA Integration**: Seamlessly integrates with Account Abstraction for transaction handling. ``` -------------------------------- ### Create EOA-based AA Provider with WalletConnect Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk Shows how to set up an Account Abstraction provider using the WalletConnect protocol. It involves initializing the WalletConnect provider, enabling it, creating an Ethers.js provider, and then using the UI-SDK's `getEoaProvider` function. ```javascript // Example with WalletConnect const createWalletConnectProvider = async () => { // Initialize WalletConnect provider const walletConnectProvider = new WalletConnectProvider({ infuraId: "your-infura-id" }); await walletConnectProvider.enable(); const baseProvider = new ethers.providers.Web3Provider(walletConnectProvider); // Use the same getEoaProvider function const aaProvider = await getEoaProvider(baseProvider, config); return aaProvider; }; ``` -------------------------------- ### GET /api/nfts/{assetId} Source: https://docs.incentiv.io/api-reference/IncentiView/NFT/nft Retrieves the metadata and ownership details for a specific NFT using its unique asset identifier. ```APIDOC ## GET /api/nfts/{assetId} ### Description Retrieves the metadata and ownership details for a specific NFT using its unique asset identifier. ### Method GET ### Endpoint /api/nfts/{assetId} ### Parameters #### Path Parameters - **assetId** (string) - required - NFT asset identifier (e.g., contract address or token ID). ### Request Example ``` curl --request GET \ --url https://indexer.testnet.incentiv.io/api/nfts/{assetId} ``` ### Response #### Success Response (200) - **assetId** (string) - Unique identifier for the NFT. - **name** (string) - Name of the NFT. - **symbol** (string) - Symbol of the NFT collection. - **creator** (string) - Address of the NFT creator. - **uri** (string) - Token URI pointing to metadata. - **owner** (string) - Current owner address of the NFT. - **type** (string) - Type of the asset (e.g., 'erc721', 'erc1155'). - **metadata** (object) - Additional metadata for display, such as image, description, attributes. #### Response Example ```json { "assetId": "", "name": "", "symbol": "", "creator": "", "uri": "", "owner": "", "type": "", "metadata": {} } ``` ``` -------------------------------- ### Initializing a Geth Node with Genesis State Source: https://docs.incentiv.io/docs/developers/incentiv_node Command to initialize a Geth node using a specified genesis state JSON file. This sets up the initial blockchain parameters for the node. ```bash $ geth init path/to/genesis.json ``` -------------------------------- ### GET /api/blocks/{hashOrNumber}/useroperations Source: https://docs.incentiv.io/api-reference/IncentiView/Blocks/block-userops Fetches a list of user operations for a specified block. The block can be identified by its hash or number. ```APIDOC ## GET /api/blocks/{hashOrNumber}/useroperations ### Description Retrieves a list of user operations associated with a specific block, identified by its hash or number. ### Method GET ### Endpoint /api/blocks/{hashOrNumber}/useroperations ### Parameters #### Path Parameters - **hashOrNumber** (string) - Required - The block hash or block number to retrieve user operations for. ### Request Example ```bash curl --request GET \ --url https://indexer.testnet.incentiv.io/api/blocks/{hashOrNumber}/useroperations ``` ### Response #### Success Response (200) - **hash** (string) - Unique hash identifying the user operation. - **sender** (string) - Address of the sender initiating the user operation. - **nonce** (string) - Nonce value to ensure uniqueness of the user operation. - **initCode** (string) - Initialization code for the user operation. - **callData** (string) - Call data payload of the user operation. - **callGasLimit** (string) - Gas limit for the call part of the user operation. - **verificationGasLimit** (string) - Gas limit for the verification part of the user operation. - **preVerificationGas** (string) - Gas paid before verification. - **maxFeePerGas** (string) - Maximum fee per gas the sender is willing to pay. - **maxPriorityFeePerGas** (string) - Maximum priority fee per gas. - **paymaster** (string) - Address of the paymaster if any. - **paymasterData** (string) - Additional data for the paymaster. - **signature** (string) - Signature of the user operation. - **status** (string) - Status of the user operation execution. #### Response Example ```json [ { "hash": "", "sender": "", "nonce": "", "initCode": "", "callData": "", "callGasLimit": "", "verificationGasLimit": "", "preVerificationGas": "", "maxFeePerGas": "", "maxPriorityFeePerGas": "", "paymaster": "", "paymasterData": "", "signature": "", "status": "" } ] ``` ``` -------------------------------- ### Create Passkey Provider with ethers.js Source: https://docs.incentiv.io/tools/ui_sdk/ui-sdk This snippet demonstrates how to create an account abstraction (AA) provider using a passkey. It initializes a base provider with ethers.js and then uses the `getPasskeyProvider` function from the `ui-sdk` to create the AA provider. Ensure you have the necessary environment variables for RPC URL, entry point address, bundler URL, and factory address. ```javascript import { ethers } from 'ethers'; import { getPasskeyProvider, WebAuthnPublicKey } from 'ui-sdk'; const createPasskeyProvider = async (credential) => { // Create a base provider using StaticJsonRpcProvider const baseProvider = new ethers.providers.StaticJsonRpcProvider( process.env.REACT_APP_RPC_URL ); const config = { chainId: 11690, // Your network chain ID entryPointAddress: process.env.REACT_APP_ENTRY_POINT_ADDRESS, bundlerUrl: process.env.REACT_APP_BUNDLER_URL, factoryAddress: process.env.REACT_APP_ACCOUNT_FACTORY_ADDRESS }; // Create the AA provider using the passkey provider const aaProvider = await getPasskeyProvider(baseProvider, credential, config); return aaProvider; }; ```