### Install 1shot-api Skill Source: https://1shotapi.com/docs/dev-platform/get-started/overview Use this command to install the 1shot-api skill. This is the first step in getting started with the 1Shot API Developer Platform. ```bash npx skills add 1Shot-API/skills/1shot-api ``` -------------------------------- ### GetCapabilities Example Source: https://1shotapi.com/docs/api-reference/public-relayer Demonstrates a request to get capabilities for specified chains. ```json [ { "name": "GetCapabilitiesExample", "params": [ { "name": "params", "value": [ "8453", "84532" ] } ], "result": { "name": "result", "value": { "8453": { "feeCollector": "0x1111111111111111111111111111111111111111", "targetAddress": "0x2222222222222222222222222222222222222222", "tokens": [ { "address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "symbol": "USDC", "decimals": "6" } ] } } } } ] ``` -------------------------------- ### Quick Start: Create and Wait for Pay Link Payment Source: https://1shotapi.com/docs/1shotpay/server-pay-link-checkout A minimal example demonstrating how to create a pay link, present it to the user, and wait for payment confirmation using the server SDK. ```typescript import { DecimalAmount, UserId } from "@1shotapi/1shotpay-common"; import { OneShotPayServer } from "@1shotapi/1shotpay-server-sdk"; const server = new OneShotPayServer( UserId(process.env.ONESHOT_USER_ID ?? ""), process.env.ONESHOT_API_TOKEN ?? "", ); // 1) Create a pay link server .createPayLink(DecimalAmount(0.01), "Example checkout") // 2) Present the payLink.url to the user .andThen((payLink) => { console.log("Pay link:", payLink.url); // 3) Wait until it is paid (often in a background job) return server.waitForPayLinkPayment(payLink.id); }) .match( (paidPayLink) => console.log("Paid!", paidPayLink), (err) => console.error("Payment failed:", err), ); ``` -------------------------------- ### Get Status Confirmed Example Source: https://1shotapi.com/docs/api-reference/public-relayer Example of a successful request to get transaction status with confirmation details. ```json [ { "name": "GetStatusConfirmedExample", "params": [ { "name": "params", "value": { "id": "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "logs": false } } ], "result": { "name": "result", "value": { "id": "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "chainId": "8453", "createdAt": 1755917874, "status": 200, "receipt": { "blockHash": "0x6789b0746d84002f2f258129cfd9714d412e78b4d91b8e61608fac9165988baf", "blockNumber": "0x22a1e6e", "gasUsed": "0x9cf2", "transactionHash": "0xd9b01a72502e7f518fb043bfacd1e13b07f24995f404f8cbb60a1212ca8b4c42" } } } } ] ``` -------------------------------- ### Install 1ShotPay Server SDK Source: https://1shotapi.com/docs/1shotpay/server-pay-link-checkout Install the necessary packages for server-side integration using yarn. ```bash yarn add @1shotapi/1shotpay-server-sdk @1shotapi/1shotpay-common ``` -------------------------------- ### Install 1shot-api Skill Source: https://1shotapi.com/docs/1shotpay/overview Install the 1shot-api skill for your coding agent to get TypeScript guidance for 1ShotPay integrations. ```bash npx skills add 1Shot-API/skills/1shot-api -y ``` -------------------------------- ### Install Public Relayer Skill Source: https://1shotapi.com/docs/skills Installs the public-relayer skill using npx. This skill provides permissionless gas abstraction and EIP-7701/7710 delegation examples. ```bash npx skills add 1Shot-API/skills/public-relayer ``` -------------------------------- ### Initialize and Use 1ShotPay Client Source: https://1shotapi.com/docs/1shotpay/client-iframe Quick start example demonstrating how to initialize the OneShotPayClient, manage its visibility, and obtain an ERC3009 signature. Ensure to handle potential errors during initialization and signature retrieval. ```typescript import { OneShotPayClient } from "@1shotapi/1shotpay-client-sdk"; import { BigNumberString, ELocale, EVMAccountAddress, UnixTimestamp, } from "@1shotapi/1shotpay-common"; const wallet = new OneShotPayClient(); await wallet.initialize("Wallet", [], ELocale.English).match( () => undefined, (err) => { throw err; }, ); wallet.show(); wallet.hide(); const result = await wallet .getERC3009Signature( "Some recipient", EVMAccountAddress("0x..."), BigNumberString("1"), UnixTimestamp(1715222400), UnixTimestamp(1715222400), ) .match( (ok) => ok, (err) => { throw err; }, ); ``` -------------------------------- ### Install 1ShotPay Client SDK Source: https://1shotapi.com/docs/1shotpay/client-iframe Install the necessary packages for the 1ShotPay client-side SDK and common types using yarn. ```bash yarn add @1shotapi/1shotpay-client-sdk @1shotapi/1shotpay-common ``` -------------------------------- ### Full TypeScript Example for Gas Abstracted Transactions Source: https://1shotapi.com/docs/relayer/get-started/first-json-rpc-call This script demonstrates building and sending a Sepolia ERC-7710 bundle to the relayer for gas-abstracted transactions. It includes setup for delegation and USDC transfers, and polls the relayer for status. Ensure you have the necessary packages installed and testnet USDC. ```typescript /** * Dev script: build a Sepolia ERC-7710 bundle (delegation + USDC transfers) and POST it to * relayer_send7710Transaction, then poll relayer_getStatus. * * Loads variables from `scripts/.env`. * * Env: DELEGATOR_PRIVATE_KEY — EOA that owns the delegator address (defaults to inline dev key). * RELAYER_URL — default https://relayer.1shotapi.dev/relayers * RELAYER_7710_AUTHORIZE — if "true", include EIP-7702 authorizationList * * Flow follows MetaMask's guide: * https://docs.metamask.io/smart-accounts-kit/guides/delegation/execute-on-smart-accounts-behalf/ * * Delegation scope: use {@link ScopeType.FunctionCall} (USDC + `transfer` selector) so batched * executions match the caveat enforcers. {@link ScopeType.Erc20TransferAmount} with relayer * batch mode can revert on-chain with `CaveatEnforcer:invalid-call-type`. */ import "./loadScriptsEnv.ts"; import { privateKeyHexFromEnv } from "./privateKeyEnv.ts"; import { labeledLine, logPollLine, printJsonBlock, relayStatusLabel, section, subBanner, } from "./scriptLog.ts"; import { randomBytes } from "node:crypto"; import { createDelegation, ScopeType, Implementation, toMetaMaskSmartAccount, } from "@metamask/smart-accounts-kit"; import { createPublicClient, http, encodeFunctionData, erc20Abi, getAddress, } from "viem"; import { sepolia as chain } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; import { bytesToHex } from "viem/utils"; const RELAYER_URL = process.env.RELAYER_URL ?? "https://relayer.1shotapi.dev/relayers"; const RELAYER_7710_AUTHORIZE = process.env.RELAYER_7710_AUTHORIZE?.toLowerCase() === "true"; /** Recursively make delegation / caveat structs JSON-serializable for JSON-RPC. */ function toRelayerJson(value: unknown): unknown { if (value === null || value === undefined) { return value; } if (typeof value === "bigint") { return `0x${value.toString(16)}`; } if (value instanceof Uint8Array) { return bytesToHex(value); } if (Array.isArray(value)) { return value.map(toRelayerJson); } if (typeof value === "object") { const out: Record = {}; for (const [k, v] of Object.entries(value)) { out[k] = toRelayerJson(v); } return out; } return value; } // Setup some constants for the script. const targetWalletAddress = "0x02c9979a75fbdbc3a77485024ab8b6474308591e"; const feeCollectorAddress = "0xE936e8FAf4A5655469182A49a505055B71C17604"; const destinationWalletAddress = "0x3e6a2f0CBA03d293B54c9fCF354948903007a798"; // Set the amount of USDC to transfer. We'll do a transfer as the work payload, and another transfer for the fee. const feeAmount = 10_000n; // 0.01 USDC (6 decimals) const workAmount = 20_000n; // 0.02 USDC const statelessDelegatorImplementationAddress = "0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B"; const usdcAddress = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238" as const; const delegatorPk = privateKeyHexFromEnv(process.env.DELEGATOR_PRIVATE_KEY) ?? ("0x2b47a5044e71eb2fa1a34043e87f51ab6490b98889f54d91d15b1f4cadb1d9b2" as const); const delegatorAddress = "0x3109f4ebB0d5E915447975e43E9e0e368bf7bD66" as const; // Now we setup the delegator account- IE, the wallet account, which will sign the delegation and on whose behalf the work will be done. const delegatorAccount = privateKeyToAccount(delegatorPk); if (delegatorAddress.toLowerCase() !== delegatorAccount.address.toLowerCase()) { throw new Error("Delegator address does not match DELEGATOR_PRIVATE_KEY"); } section("Relay7710 self-sponsored · Sepolia (single-chain)"); subBanner("Configuration"); labeledLine("RELAYER_URL", RELAYER_URL); labeledLine("Chain", `Sepolia (chain ID ${String(chain.id)})`); labeledLine("RELAYER_7710_AUTHORIZE", String(RELAYER_7710_AUTHORIZE)); labeledLine( "Fee payment (atoms)", `${feeAmount.toString()} (USDC 6 decimals)`, ); labeledLine( "Work payment (atoms)", `${workAmount.toString()} (USDC 6 decimals)`, ); subBanner("Delegator"); labeledLine("Smart account address", delegatorAddress); labeledLine("Signer EOA", delegatorAccount.address); const publicClient = createPublicClient({ chain, transport: http(), }); const delegatorSmartAccount = await toMetaMaskSmartAccount({ client: publicClient, implementation: Implementation.Stateless7702, address: delegatorAddress, signer: { account: delegatorAccount }, }); // If the delegator account has not already been upgraded to the Metamask Smart Account, we need to do so ``` -------------------------------- ### Install WebAuthn PRF Wallet Skill Source: https://1shotapi.com/docs/skills Installs the webauthn-prf-wallet skill using npx. This skill enables PRF + HKDF passkey-derived EVM key flows with an iframe-isolated signer architecture. ```bash npx skills add 1Shot-API/skills/webauthn-prf-wallet ``` -------------------------------- ### relayer_getFeeData Example Source: https://1shotapi.com/docs/api-reference/public-relayer An example of a request and its successful result for the relayer_getFeeData method. ```json [ { "name": "GetFeeDataExample", "params": [ { "name": "params", "value": { "chainId": "8453", "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e" } } ], "result": { "name": "result", "value": { "chainId": "8453", "token": { "address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "decimals": 6, "symbol": "USDC", "name": "USD Coin" }, "rate": 2000.5, "minFee": "4.5", "expiry": 1755917874, "gasPrice": "0x4a817c800", "feeCollector": "0x1111111111111111111111111111111111111111", "targetAddress": "0x2222222222222222222222222222222222222222", "context": "{\"quote\":\"signed\"}" } } } ] ``` -------------------------------- ### Constructing OneShotPayServer Instance Source: https://1shotapi.com/docs/1shotpay/server-pay-link-checkout Example of initializing the `OneShotPayServer` with user ID, API token, and an optional locale. ```typescript import { ELocale, UserId } from "@1shotapi/1shotpay-common"; import { OneShotPayServer } from "@1shotapi/1shotpay-server-sdk"; const server = new OneShotPayServer( UserId(process.env.ONESHOT_USER_ID ?? ""), process.env.ONESHOT_API_TOKEN ?? "", ELocale.English, // optional (default) ); ``` -------------------------------- ### Submit Multichain 7710 Delegated Transaction Example Source: https://1shotapi.com/docs/api-reference/public-relayer Example of submitting multiple ERC-7710 style delegated transaction bundles. This is used for submitting complex transactions with specific permissions and execution details. ```json [ { "name": "Send7710TransactionExample", "params": [ { "name": "params", "value": { "chainId": "84532", "transactions": [ { "permissionContext": [ { "delegate": "0x1111111111111111111111111111111111111111", "delegator": "0x2222222222222222222222222222222222222222", "authority": "0x0000000000000000000000000000000000000000", "caveats": [ { "enforcer": "0x3333333333333333333333333333333333333333", "terms": "0x", "args": "0x" } ], "salt": "0x01", "signature": "0xabc" } ], "executions": [ { "target": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "value": "0x0", "data": "0xa9059cbb0000000000000000000000001111111111111111111111111111111111111111" } ] } ] } } ], "result": { "name": "result", "value": "0x3f670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527abc" } } ] ``` -------------------------------- ### SendTransactionExample Source: https://1shotapi.com/docs/api-reference/public-relayer An example of a transaction submission request with parameters for chain ID, payment details, recipient, data, and task ID. ```json [ { "name": "SendTransactionExample", "params": [ { "name": "params", "value": { "chainId": "8453", "payment": { "type": "token", "address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e" }, "to": "0x55f3a9f544e01ce4378d25e927d7c493b863bd7", "data": "0x29cb0f49", "taskId": "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" } } ], "result": { "name": "result", "value": "0x0e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" } } ] ``` -------------------------------- ### List Available Contract Methods Source: https://1shotapi.com/docs/dev-platform/get-started/authentication Retrieve a JSON list of all configured contract methods for your organization by making a GET request to the methods endpoint, authenticated with your bearer token. ```shell curl -X GET https://api.1shotapi.com/v0/business/{BUSINESS_ID}/methods \ -H "Authorization: Bearer YOUR_BEARER_TOKEN" | jq . ``` -------------------------------- ### Example Webhook JSON Payload Source: https://1shotapi.com/docs/dev-platform/get-started/error-handling This is an example of the JSON body sent in a POST request when a webhook is triggered. It includes transaction details and a signature for verification. ```json { "event": "transaction.confirmed", "data": { "transaction_id": "txn_12345abcde", "status": "confirmed", "block_number": 1234567, "timestamp": "2023-10-27T10:00:00Z", "metadata": { "user_id": "user_xyz", "order_id": "order_789" } }, "signature": "sig_abcdef12345" } ``` -------------------------------- ### Get Supported x402 Features Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve information about supported x402 features. ```APIDOC ## GET /x402/supported ### Description Retrieve information about supported x402 features. ### Method GET ### Endpoint /x402/supported ### Response #### Success Response (200) - **features** (array) - An array of supported x402 features. #### Response Example { "example": "{\"features\": [\"signature_request\", \"payment_request\"]}" } ``` -------------------------------- ### Get Method Details Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve details for a specific contract method. ```APIDOC ## GET /methods/{contractMethodId} ### Description Retrieve details for a specific contract method. ### Method GET ### Endpoint /methods/{contractMethodId} ### Parameters #### Path Parameters - **contractMethodId** (string) - Required - The ID of the contract method. ### Response #### Success Response (200) - **method** (object) - An object containing method details. - **methodId** (string) - The unique identifier for the method. - **name** (string) - The name of the method. - **inputs** (array) - An array of input parameters for the method. - **outputs** (array) - An array of output parameters for the method. #### Response Example { "example": "{\"method\": {\"methodId\": \"method_123\", \"name\": \"transferTokens\", \"inputs\": [{\"name\": \"_from\", \"type\": \"address\"}, {\"name\": \"_to\", \"type\": \"address\"}, {\"name\": \"_value\", \"type\": \"uint256\"}], \"outputs\": []}}" } ``` -------------------------------- ### List Available Contract Methods Source: https://1shotapi.com/docs/dev-platform/get-started/authentication Retrieve a JSON list of all contract methods currently configured for your organization by making a GET request to the specified endpoint. ```APIDOC ## List Available Contract Methods ### Description Retrieve a JSON list of all contract methods currently configured for your organization by making a GET request to the specified endpoint. ### Method GET ### Endpoint https://api.1shotapi.com/v0/business/{BUSINESS_ID}/methods ### Parameters #### Path Parameters - **BUSINESS_ID** (string) - Required - The ID of the business organization. ### Headers - **Authorization** (string) - Required - Bearer YOUR_BEARER_TOKEN ``` -------------------------------- ### Get Wallet Details Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve details for a specific wallet. ```APIDOC ## GET /wallets/{walletId} ### Description Retrieve details for a specific wallet. ### Method GET ### Endpoint /wallets/{walletId} ### Parameters #### Path Parameters - **walletId** (string) - Required - The ID of the wallet. ### Response #### Success Response (200) - **wallet** (object) - An object containing wallet details. - **walletId** (string) - The unique identifier for the wallet. - **address** (string) - The wallet's address. - **type** (string) - The type of the wallet (e.g., "EOA", "contract"). - **balance** (object) - The wallet's balance for different tokens. #### Response Example { "example": "{\"wallet\": {\"walletId\": \"wallet_abc\", \"address\": \"0x...\", \"type\": \"EOA\", \"balance\": {\"ETH\": \"1.5\", \"DAI\": \"1000\"}}}" } ``` -------------------------------- ### Send7710TransactionMultichainExample Source: https://1shotapi.com/docs/api-reference/public-relayer An example demonstrating how to send a 7710 transaction across multiple chains. This includes transaction details such as target, value, and data for each chain. ```json [ { "name": "Send7710TransactionMultichainExample", "params": [ { "name": "params", "value": [ { "chainId": "84532", "transactions": [ { "permissionContext": [], "executions": [ { "target": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "value": "0x0", "data": "0x" } ] } ] }, { "chainId": "8453", "transactions": [ { "permissionContext": [], "executions": [ { "target": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "value": "0x0", "data": "0x" } ] } ] } ] } ], "result": { "name": "result", "value": [ "0x1111111111111111111111111111111111111111111111111111111111111111", "0x2222222222222222222222222222222222222222222222222222222222222222" ] } } ] ``` -------------------------------- ### EIP-7702 Authorization Example Source: https://1shotapi.com/docs/relayer/get-started/first-json-rpc-call Constructs an EIP-7702 authorization object if the RELAYER_7710_AUTHORIZE flag is set. This involves fetching a transaction count and signing a delegation. ```typescript let authorizationList: unknown[] | undefined; if (RELAYER_7710_AUTHORIZE) { const authNonce = await publicClient.getTransactionCount({ address: delegatorAddress, blockTag: "pending", }); /** EIP-7702: viem hashes as `keccak256(0x05 || rlp([chainId, address, nonce]))` and signs (same as relayer recovery). */ const signedAuthorization = await delegatorAccount.signAuthorization({ chainId: chain.id, contractAddress: getAddress(statelessDelegatorImplementationAddress), nonce: authNonce, }); // viem returns `v` as bigint; relayer payload only needs/yields yParity+r+s. const { address, chainId, nonce, r, s, yParity } = signedAuthorization; authorizationList = [{ address, chainId, nonce, r, s, yParity }]; subBanner("EIP-7702 authorization"); labeledLine("Mode", "Enabled (delegator account)"); printJsonBlock("authorizationList entry", authorizationList[0]); } else { subBanner("EIP-7702 authorization"); labeledLine( "Mode", "Disabled (set RELAYER_7710_AUTHORIZE=true to include delegation upgrade)", ); } ``` -------------------------------- ### Create Business Wallet Source: https://1shotapi.com/docs/api-reference/dev-platform Create a new wallet for a business. ```APIDOC ## POST /business/{businessId}/wallets ### Description Create a new wallet for a business. ### Method POST ### Endpoint /business/{businessId}/wallets ### Parameters #### Path Parameters - **businessId** (string) - Required - The ID of the business. #### Request Body - **type** (string) - Required - The type of wallet to create (e.g., "EOA", "contract"). - **name** (string) - Optional - A name for the wallet. ### Request Example { "example": "{\"type\": \"EOA\", \"name\": \"My New Wallet\"}" } ### Response #### Success Response (200) - **walletId** (string) - The ID of the newly created wallet. - **address** (string) - The address of the newly created wallet. #### Response Example { "example": "{\"walletId\": \"wallet_xyz\", \"address\": \"0x...\"}" } ``` -------------------------------- ### Get Transaction Details Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve details for a specific transaction. ```APIDOC ## GET /transactions/{transactionId} ### Description Retrieve details for a specific transaction. ### Method GET ### Endpoint /transactions/{transactionId} ### Parameters #### Path Parameters - **transactionId** (string) - Required - The ID of the transaction. ### Response #### Success Response (200) - **transaction** (object) - An object containing transaction details. - **transactionId** (string) - The unique identifier for the transaction. - **hash** (string) - The transaction hash. - **status** (string) - The status of the transaction. - **blockNumber** (integer) - The block number in which the transaction was included. - **timestamp** (string) - The timestamp of the transaction. #### Response Example { "example": "{\"transaction\": {\"transactionId\": \"tx_789\", \"hash\": \"0x...\", \"status\": \"confirmed\", \"blockNumber\": 12345678, \"timestamp\": \"2023-10-27T10:00:00Z\"}}" } ``` -------------------------------- ### Get Status Source: https://1shotapi.com/docs/api-reference/public-relayer Retrieves the status of a previously submitted transaction or task. ```APIDOC ## GET /status ### Description Retrieves the status of a previously submitted transaction or task. ### Method GET ### Endpoint /status ### Parameters #### Query Parameters - **taskId** (string) - Required - The unique identifier for the task (64-character hex string starting with "0x"). ### Response #### Success Response (200) - **status** (string) - The current status of the task (e.g., "pending", "success", "failed"). - **result** (object) - The result of the task, if successful. - **transactionHash** (string) - The hash of the relayed transaction. - **memo** (string) - The memo data, if provided in the original request. - **error** (string) - An error message, if the task failed. #### Response Example ```json { "status": "success", "result": { "transactionHash": "0xTransactionHash", "memo": "optional-memo-data" } } ``` ``` -------------------------------- ### Create Struct Parameters Source: https://1shotapi.com/docs/api-reference/dev-platform Create parameters for a Solidity struct. ```APIDOC ## POST /structs/{structId}/params ### Description Create parameters for a Solidity struct. ### Method POST ### Endpoint /structs/{structId}/params ### Parameters #### Path Parameters - **structId** (string) - Required - The ID of the struct. #### Request Body - **name** (string) - Required - The name of the parameter. - **type** (string) - Required - The type of the parameter (e.g., "uint256", "address"). ### Request Example { "example": "{\"name\": \"_recipient\", \"type\": \"address\"}" } ### Response #### Success Response (200) - **paramId** (string) - The ID of the newly created parameter. #### Response Example { "example": "{\"paramId\": \"param_1\"}" } ``` -------------------------------- ### Create a new Pay Link Source: https://1shotapi.com/docs/1shotpay/server-pay-link-checkout Use this to generate a new pay link with specified amount, description, and optional configurations like media URL, reusability, expiration, and requested payer. The SDK handles the creation and returns the pay link object including its hosted URL. ```typescript import { DecimalAmount, UnixTimestamp, URLString, UserId, } from "@1shotapi/1shotpay-common"; import { OneShotPayServer } from "@1shotapi/1shotpay-server-sdk"; const server = new OneShotPayServer(UserId("..."), "api-token"); server .createPayLink(DecimalAmount(0.03), "3Use Widget", { mediaUrl: URLString("https://example.com/widget.png"), reuseable: false, expirationTimestamp: UnixTimestamp(Math.floor(Date.now() / 1000) + 60 * 15), requestedPayerUserId: UserId("123e4567-e89b-12d3-a456-426614174000"), closeOnComplete: true, }) .match( (payLink) => { console.log("Created pay link id:", payLink.id); console.log("Hosted URL:", payLink.url); }, (err) => { console.error("createPayLink failed:", err); }, ); ``` -------------------------------- ### Get Webhook Endpoint Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieves details of a specific webhook endpoint. ```APIDOC ## GET /webhooks/endpoints/{webhookEndpointId} ### Description Retrieves details of a specific webhook endpoint. ### Method GET ### Endpoint /webhooks/endpoints/{webhookEndpointId} ### Parameters #### Path Parameters - **webhookEndpointId** (string) - Required - The ID of the webhook endpoint to retrieve. ``` -------------------------------- ### Get Wallet Signature Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve a signature for a specific wallet and type. ```APIDOC ## GET /wallets/{walletId}/signature/{type} ### Description Retrieve a signature for a specific wallet and type. ### Method GET ### Endpoint /wallets/{walletId}/signature/{type} ### Parameters #### Path Parameters - **walletId** (string) - Required - The ID of the wallet. - **type** (string) - Required - The type of signature to retrieve (e.g., "personal", "typed"). ### Response #### Success Response (200) - **signature** (string) - The requested signature. #### Response Example { "example": "{\"signature\": \"0x...\"}" } ``` -------------------------------- ### Create Business Method Source: https://1shotapi.com/docs/api-reference/dev-platform Create a new contract method for a business. ```APIDOC ## POST /business/{businessId}/methods ### Description Create a new contract method for a business. ### Method POST ### Endpoint /business/{businessId}/methods ### Parameters #### Path Parameters - **businessId** (string) - Required - The ID of the business. #### Request Body - **name** (string) - Required - The name of the method. - **description** (string) - Optional - A description of the method. - **abiSignature** (string) - Required - The ABI signature of the method. ### Request Example { "example": "{\"name\": \"transferTokens\", \"description\": \"Transfers tokens.\", \"abiSignature\": \"transfer(address,address,uint256)\"}" } ### Response #### Success Response (200) - **methodId** (string) - The ID of the newly created method. #### Response Example { "example": "{\"methodId\": \"method_xyz\"}" } ``` -------------------------------- ### List Webhooks Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve a list of all configured webhooks. ```APIDOC ## GET /webhooks ### Description Retrieve a list of all configured webhooks. ### Method GET ### Endpoint /webhooks ### Response #### Success Response (200) - **webhooks** (array) - An array of webhook objects. - **webhookId** (string) - The unique identifier for the webhook. - **url** (string) - The URL to which the webhook events will be sent. - **events** (array) - A list of events that trigger this webhook. #### Response Example { "example": "{\"webhooks\": [{\"webhookId\": \"wh_ghi\", \"url\": \"https://example.com/webhook\", \"events\": [\"BLOCK_MINED\", \"TRANSACTION_CONFIRMED\"]}]}" } ``` -------------------------------- ### Get Event Details Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve details for a specific contract event. ```APIDOC ## GET /events/{contractEventId} ### Description Retrieve details for a specific contract event. ### Method GET ### Endpoint /events/{contractEventId} ### Parameters #### Path Parameters - **contractEventId** (string) - Required - The ID of the contract event. ### Response #### Success Response (200) - **event** (object) - An object containing event details. - **eventId** (string) - The unique identifier for the event. - **name** (string) - The name of the event. - **inputs** (array) - An array of indexed and non-indexed parameters for the event. #### Response Example { "example": "{\"event\": {\"eventId\": \"event_456\", \"name\": \"TokenTransfer\", \"inputs\": [{\"name\": \"from\", \"type\": \"address\", \"indexed\": true}, {\"name\": \"to\", \"type\": \"address\", \"indexed\": true}, {\"name\": \"value\", \"type\": \"uint256\", \"indexed\": false}]}" } ``` -------------------------------- ### Get Chain Fees Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve fee information for a specific chain. ```APIDOC ## GET /chains/{chainId}/fees ### Description Retrieve fee information for a specific chain. ### Method GET ### Endpoint /chains/{chainId}/fees ### Parameters #### Path Parameters - **chainId** (string) - Required - The ID of the chain for which to retrieve fees. ### Response #### Success Response (200) - **fees** (object) - An object containing fee information. - **gasPrice** (string) - The current gas price on the chain. - **transactionFee** (string) - An estimated transaction fee. #### Response Example { "example": "{\"fees\": {\"gasPrice\": \"100000000000\", \"transactionFee\": \"0.001\"}}" } ``` -------------------------------- ### Execute Batch of Methods Source: https://1shotapi.com/docs/api-reference/dev-platform Execute a batch of contract methods. ```APIDOC ## POST /methods/executeBatch ### Description Execute a batch of contract methods. ### Method POST ### Endpoint /methods/executeBatch ### Parameters #### Request Body - **calls** (array) - Required - An array of method call objects. - **methodId** (string) - Required - The ID of the contract method. - **params** (array) - Required - An array of parameters to pass to the method. - **from** (string) - Optional - The address to send the transactions from. ### Request Example { "example": "{\"calls\": [{\"methodId\": \"method_123\", \"params\": [\"0x...\", \"0x...\", 100]}], \"from\": \"0x...\"}" } ### Response #### Success Response (200) - **transactionIds** (array) - An array of transaction IDs. - **transactionHashes** (array) - An array of transaction hashes. #### Response Example { "example": "{\"transactionIds\": [\"tx_789\"], \"transactionHashes\": [\"0x...\" ]}" } ``` -------------------------------- ### Get Chain Contract Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve details about a specific contract on a given chain. ```APIDOC ## GET /chains/{chainId}/contracts/{contractAddress} ### Description Retrieve details about a specific contract on a given chain. ### Method GET ### Endpoint /chains/{chainId}/contracts/{contractAddress} ### Parameters #### Path Parameters - **chainId** (string) - Required - The ID of the chain where the contract is deployed. - **contractAddress** (string) - Required - The address of the contract. ### Response #### Success Response (200) - **contract** (object) - An object containing contract details. - **address** (string) - The contract address. - **abi** (array) - The contract's Application Binary Interface. - **bytecode** (string) - The contract's bytecode. #### Response Example { "example": "{\"contract\": {\"address\": \"0x...\", \"abi\": [...], \"bytecode\": \"0x...\"}}" } ``` -------------------------------- ### Create Business Method from ABI Source: https://1shotapi.com/docs/api-reference/dev-platform Create a new contract method by providing its ABI. ```APIDOC ## POST /business/{businessId}/methods/abi ### Description Create a new contract method by providing its ABI. ### Method POST ### Endpoint /business/{businessId}/methods/abi ### Parameters #### Path Parameters - **businessId** (string) - Required - The ID of the business. #### Request Body - **abi** (object) - Required - The ABI of the method. - **name** (string) - Optional - The name of the method. ### Request Example { "example": "{\"abi\": {\"inputs\": [...], \"name\": \"transfer\", \"outputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"function\"}, \"name\": \"transferTokens\"}" } ### Response #### Success Response (200) - **methodId** (string) - The ID of the newly created method. #### Response Example { "example": "{\"methodId\": \"method_abc\"}" } ``` -------------------------------- ### Authorize Wallet Permit2 Source: https://1shotapi.com/docs/api-reference/dev-platform Authorize Permit2 for a wallet. ```APIDOC ## PUT /wallets/{walletId}/authorizePermit2 ### Description Authorize Permit2 for a wallet. ### Method PUT ### Endpoint /wallets/{walletId}/authorizePermit2 ### Parameters #### Path Parameters - **walletId** (string) - Required - The ID of the wallet. #### Request Body - **spender** (string) - Required - The address that will be allowed to spend tokens. - **amount** (string) - Required - The maximum amount that can be spent. - **tokenAddress** (string) - Required - The address of the token. - **deadline** (string) - Required - The deadline for the authorization. ### Request Example { "example": "{\"spender\": \"0x...\", \"amount\": \"1000000000000000000\", \"tokenAddress\": \"0x...\", \"deadline\": \"1735689600\"}" } ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the authorization was successful. #### Response Example { "example": "{\"message\": \"Permit2 authorization successful.\"}" } ``` -------------------------------- ### Estimate Gas Abstracted Token Send (Single-Chain) Source: https://1shotapi.com/docs/quickstarts/gas-sponsorship-eip7710 Use this to estimate the fee for a single-chain gas-abstracted token send. Ensure you have connected and signed a delegation before running the estimate. ```bash curl -X POST https://relayer.1shotapi.com/relayers \ -H "Content-Type: application/json" \ -d '{ "method": "relayer_estimate7710Transaction", "params": { "transactions": [ { "to": "0x...", "value": "0x0", "data": "0x...", "chainId": "8453", "delegateTo": "0x4e44e22ee6da76c2ad19baaaffb52f676230fa06", "delegateArgs": [ "0x...", "0x..." ] } ], "payment": { "token": "0x...", "amount": "0x..." }, "context": "0x..." }, "id": 1 }' ``` -------------------------------- ### Create and Sign Delegation Source: https://1shotapi.com/docs/relayer/get-started/first-json-rpc-call Creates a delegation object for a specific scope (e.g., ERC20 transfer) and signs it using the delegator's smart account. ```typescript const delegationSalt = bytesToHex( Uint8Array.from(randomBytes(32)), ) as `0x${string}`; const delegation = createDelegation({ to: targetWalletAddress as `0x${string}`, from: delegatorSmartAccount.address, environment: delegatorSmartAccount.environment, salt: delegationSalt, scope: { type: ScopeType.Erc20TransferAmount, tokenAddress: usdcAddress as `0x${string}`, maxAmount: feeAmount + workAmount, // We are transferring 30000 USDC, but the caveat enforcer requires 1 more to avoid revert }, }); subBanner("Sign delegation"); console.log(" Signing with delegator smart account…"); const delegationSignature = await delegatorSmartAccount.signDelegation({ delegation, }); const signedDelegation = { ...delegation, signature: delegationSignature, }; ``` -------------------------------- ### Estimate Gas Abstracted Token Send (Multichain) Source: https://1shotapi.com/docs/quickstarts/gas-sponsorship-eip7710 Use this to estimate the fee for a multi-chain gas-abstracted token send. Ensure you have connected and signed a delegation before running the estimate. ```bash curl -X POST https://relayer.1shotapi.com/relayers \ -H "Content-Type: application/json" \ -d '{ "method": "relayer_estimate7710TransactionMultichain", "params": { "transactions": [ { "to": "0x...", "value": "0x0", "data": "0x...", "chainId": "1", "delegateTo": "0x4e44e22ee6da76c2ad19baaaffb52f676230fa06", "delegateArgs": [ "0x...", "0x..." ] }, { "to": "0x...", "value": "0x0", "data": "0x...", "chainId": "8453", "delegateTo": "0x26a529124f0bbf9af9d8f9f84a43efe47cf1199a", "delegateArgs": [ "0x...", "0x..." ] } ], "payment": { "token": "0x...", "amount": "0x..." }, "contextByChainId": { "1": "0x...", "8453": "0x..." } }, "id": 1 }' ``` -------------------------------- ### List Business Methods Source: https://1shotapi.com/docs/api-reference/dev-platform Retrieve a list of methods associated with a business. ```APIDOC ## GET /business/{businessId}/methods ### Description Retrieve a list of methods associated with a business. ### Method GET ### Endpoint /business/{businessId}/methods ### Parameters #### Path Parameters - **businessId** (string) - Required - The ID of the business. ### Response #### Success Response (200) - **methods** (array) - An array of method objects. - **methodId** (string) - The unique identifier for the method. - **name** (string) - The name of the method. - **description** (string) - A description of the method. #### Response Example { "example": "{\"methods\": [{\"methodId\": \"method_123\", \"name\": \"transferTokens\", \"description\": \"Transfers tokens from one address to another.\"}]}" } ``` -------------------------------- ### One-time Gas Abstracted Token Send Source: https://1shotapi.com/docs/quickstarts/gas-sponsorship-eip7710 Example cURL command for sending a gas-abstracted token transaction. This command assumes you have already connected, selected a chain and token, and entered destination details. ```bash curl -X POST https://relayer.1shotapi.com/relayers \ -H "Content-Type: application/json" \ -d '{ "method": "relayer_send7710Transaction", "params": { "transactions": [ { "to": "0x...", "value": "0x0", "data": "0x...", "chainId": "1", "delegateTo": "0x4e44e22ee6da76c2ad19baaaffb52f676230fa06", "delegateArgs": [ "0x...", "0x..." ] } ], "payment": { "token": "0x...", "amount": "0x..." }, "context": "0x..." }, "id": 1 }' ```