diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b053ce520a2..c3ff91f0783 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -17,5 +17,8 @@ # Snaps documentation /snaps/ @MetaMask/tech-writers @MetaMask/snaps -# Wallet and SDK documentation -/wallet/ @MetaMask/tech-writers @MetaMask/wallet-api-platform-engineers @MetaMask/sdk-devs +# SDK documentation +/sdk/ @MetaMask/tech-writers @MetaMask/sdk-devs + +# Wallet documentation +/wallet/ @MetaMask/tech-writers @MetaMask/wallet-api-platform-engineers diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 948862fc863..00000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Build - -on: - workflow_call: - secrets: - SEGMENT_ANALYTICS_KEY: - required: true - LD_CLIENT_ID: - required: true - SENTRY_KEY: - required: true - -env: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }} - LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} - -jobs: - build: - name: Build - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - - name: Build - uses: ConsenSys/github-actions/docs-build@main - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/case.yml b/.github/workflows/case.yml deleted file mode 100644 index 013a4d28560..00000000000 --- a/.github/workflows/case.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Check file name case - -on: - workflow_call: - secrets: - SEGMENT_ANALYTICS_KEY: - required: true - LD_CLIENT_ID: - required: true - SENTRY_KEY: - required: true - -env: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }} - LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} - -jobs: - case: - name: Check for case being inconsistent - runs-on: ubuntu-latest - strategy: - matrix: - folder: ['docs'] - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - - name: Case check action - uses: ConsenSys/github-actions/docs-case-check@main - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOC_DIR: ${{ matrix.folder }} - SKIP_TEST: true diff --git a/.github/workflows/lint.yml b/.github/workflows/ci.yml similarity index 62% rename from .github/workflows/lint.yml rename to .github/workflows/ci.yml index 5a82ec3f88c..611b297e815 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/ci.yml @@ -1,30 +1,47 @@ --- -name: Check for lint, spelling and link errors +name: ci on: workflow_call: - secrets: - SEGMENT_ANALYTICS_KEY: - required: true - LD_CLIENT_ID: - required: true - SENTRY_KEY: - required: true + pull_request: + branches: + - main + +permissions: + contents: read env: SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }} LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build + uses: ConsenSys/github-actions/docs-build@main + + case: + name: Check for case being inconsistent + runs-on: ubuntu-latest + strategy: + matrix: + folder: ['docs'] + steps: + - uses: actions/checkout@v4 + - name: Case check action + uses: ConsenSys/github-actions/docs-case-check@main + with: + DOC_DIR: ${{ matrix.folder }} + SKIP_TEST: true + lint: name: Lint Code Base runs-on: ubuntu-latest - permissions: - contents: read steps: - uses: actions/checkout@v4 - - name: Lint uses: ConsenSys/github-actions/docs-lint-all@main diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 028ac11186c..00000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Main - -on: - push: - branches: [main] - pull_request: - -jobs: - check-workflows: - name: Check workflows - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Download actionlint - id: download-actionlint - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.22 - shell: bash - - name: Check workflow files - run: ${{ steps.download-actionlint.outputs.executable }} -color - shell: bash - - build: - name: Build - uses: ./.github/workflows/build.yml - secrets: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }} - LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} - - lint: - name: Lint - uses: ./.github/workflows/lint.yml - secrets: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }} - LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} - - case: - name: Case - uses: ./.github/workflows/case.yml - secrets: - SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }} - LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }} - SENTRY_KEY: ${{ secrets.SENTRY_KEY }} - - all-jobs-completed: - name: All jobs completed - runs-on: ubuntu-latest - needs: - - check-workflows - - build - - lint - - case - outputs: - PASSED: ${{ steps.set-output.outputs.PASSED }} - steps: - - name: Set PASSED output - id: set-output - run: echo "PASSED=true" >> "$GITHUB_OUTPUT" - - all-jobs-pass: - name: All jobs pass - if: ${{ always() }} - runs-on: ubuntu-latest - needs: all-jobs-completed - steps: - - name: Check that all jobs have passed - run: | - passed="${{ needs.all-jobs-completed.outputs.PASSED }}" - if [[ $passed != "true" ]]; then - exit 1 - fi diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e2cc6be6ab4..d479252ace3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,6 +23,7 @@ with: FILE_EXTENSION: mdx MODIFIED_FILES_ONLY: no + linkCheckMd: needs: linkCheckMdx name: Run link check on .md files diff --git a/docs/whats-new.md b/docs/whats-new.md index 369f7b578ef..0a5d66e71a6 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -9,8 +9,21 @@ The latest major MetaMask documentation updates are listed by the month they wer For a comprehensive list of recent product changes, visit the "Release Notes" section at the bottom of the [MetaMask developer page](https://metamask.io/developer/). +## May 2025 + +- Documented [Solana](/services/reference/solana) support. ([#1978](https://github.com/MetaMask/metamask-docs/pull/1978)) +- Documented Infura's filter API method support for [Arbitrum](/services/reference/arbitrum/json-rpc-methods/filter-methods/), + [Avalanche](/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/), [Base](/services/reference/base/json-rpc-methods/filter-methods/), + [Celo](/services/reference/celo/json-rpc-methods/filter-methods/), [Linea](/services/reference/linea/json-rpc-methods/filter-methods/), + [Optimism](/services/reference/optimism/json-rpc-methods/filter-methods/), and + [Polygon POS](/services/reference/polygon-pos/json-rpc-methods/filter-methods/) networks. ([#1994](https://github.com/MetaMask/metamask-docs/pull/1994)) +- Discontinue Infura support for the Ethereum Holesky testnet. ([#1996](https://github.com/MetaMask/metamask-docs/pull/1996)) + ## April 2025 +- Added a tutorial for [creating a wallet AI agent with the SDK](/sdk/tutorials/create-wallet-ai-agent). + ([#1993](https://github.com/MetaMask/metamask-docs/pull/1993)) +- Documented [Solana](/services/reference/solana) support. ([#1978](https://github.com/MetaMask/metamask-docs/pull/1978)) - Documented [Ethereum Hoodi testnet](/services/get-started/endpoints/#ethereum) support. ([#1977](https://github.com/MetaMask/metamask-docs/pull/1977)) - Documented [how to use deeplinks](/sdk/guides/use-deeplinks). ([#1928](https://github.com/MetaMask/metamask-docs/pull/1928)) diff --git a/docusaurus.config.js b/docusaurus.config.js index 24e495c4c04..b120db1570d 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -357,6 +357,18 @@ const config = { prism: { theme: codeTheme, additionalLanguages: ['csharp', 'gradle', 'bash', 'json'], + magicComments: [ + { + className: "git-diff-remove", + line: "remove-next-line", + block: { start: "remove-start", end: "remove-end" }, + }, + { + className: "git-diff-add", + line: "add-next-line", + block: { start: "add-start", end: "add-end" }, + }, + ], }, algolia: { // The application ID provided by Algolia diff --git a/package-lock.json b/package-lock.json index e5a74e7b285..55b16e1316d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@docusaurus/theme-mermaid": "^3.7.0", "@intercom/messenger-js-sdk": "^0.0.14", "@mdx-js/react": "^3.1.0", - "@metamask/design-tokens": "^5.0.0", + "@metamask/design-tokens": "^7.1.0", "@metamask/eth-sig-util": "^7.0.3", "@metamask/profile-sync-controller": "^11.0.1", "@metamask/sdk": "^0.32.0", @@ -50,7 +50,7 @@ "react-tippy": "^1.4.0", "remark-codesandbox": "^0.10.1", "remark-docusaurus-tabs": "^0.2.0", - "sass": "^1.83.4" + "sass": "^1.87.0" }, "devDependencies": { "@docusaurus/eslint-plugin": "^3.7.0", @@ -6069,9 +6069,9 @@ } }, "node_modules/@metamask/design-tokens": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@metamask/design-tokens/-/design-tokens-5.0.0.tgz", - "integrity": "sha512-dpTV8+wuGQNS69JdWamfuMM2EAIpKXDGjXG63tGRe1N27JVvq4l5p5dBtJtWzc061MVspm45EXK6jDrvlJyGDg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@metamask/design-tokens/-/design-tokens-7.1.0.tgz", + "integrity": "sha512-dwd5m1MDXqjolmxmAcehjpotgQRE/2qRmCAuQpB4ZNqfB48PtFDkAXOp9AeLNFgKiT4UFAK4FQ5FobNLk+5Htg==", "license": "MIT", "engines": { "node": "^18.18 || >=20" @@ -27896,9 +27896,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.83.4", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.83.4.tgz", - "integrity": "sha512-B1bozCeNQiOgDcLd33e2Cs2U60wZwjUUXzh900ZyQF5qUasvMdDZYbQ566LJu7cqR+sAHlAfO6RMkaID5s6qpA==", + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.87.0.tgz", + "integrity": "sha512-d0NoFH4v6SjEK7BoX810Jsrhj7IQSYHAHLi/iSpgqKc7LaIDshFRlSg5LOymf9FqQhxEHs2W5ZQXlvy0KD45Uw==", "license": "MIT", "dependencies": { "chokidar": "^4.0.0", diff --git a/package.json b/package.json index aaf09e034a0..c861226acc0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@docusaurus/theme-mermaid": "^3.7.0", "@intercom/messenger-js-sdk": "^0.0.14", "@mdx-js/react": "^3.1.0", - "@metamask/design-tokens": "^5.0.0", + "@metamask/design-tokens": "^7.1.0", "@metamask/eth-sig-util": "^7.0.3", "@metamask/profile-sync-controller": "^11.0.1", "@metamask/sdk": "^0.32.0", @@ -69,7 +69,7 @@ "react-tippy": "^1.4.0", "remark-codesandbox": "^0.10.1", "remark-docusaurus-tabs": "^0.2.0", - "sass": "^1.83.4" + "sass": "^1.87.0" }, "devDependencies": { "@docusaurus/eslint-plugin": "^3.7.0", diff --git a/sdk-sidebar.js b/sdk-sidebar.js index 27cbbbe5ed6..e55a72f483e 100644 --- a/sdk-sidebar.js +++ b/sdk-sidebar.js @@ -56,6 +56,13 @@ const sidebar = { }, ], }, + { + type:'category', + label: 'Tutorials', + collapsible: false, + collapsed: false, + items: ['tutorials/create-wallet-ai-agent'], + }, { type: 'category', label: 'Reference', diff --git a/sdk/_assets/sdk-ai-agent-get-balance.png b/sdk/_assets/sdk-ai-agent-get-balance.png new file mode 100644 index 00000000000..1a51ea83be2 Binary files /dev/null and b/sdk/_assets/sdk-ai-agent-get-balance.png differ diff --git a/sdk/_assets/sdk-ai-agent-txn-not-sent.png b/sdk/_assets/sdk-ai-agent-txn-not-sent.png new file mode 100644 index 00000000000..993dc724d30 Binary files /dev/null and b/sdk/_assets/sdk-ai-agent-txn-not-sent.png differ diff --git a/sdk/_assets/sdk-ai-agent-txn-sent.png b/sdk/_assets/sdk-ai-agent-txn-sent.png new file mode 100644 index 00000000000..bcd4bd660b9 Binary files /dev/null and b/sdk/_assets/sdk-ai-agent-txn-sent.png differ diff --git a/sdk/_assets/sdk-ai-agent.png b/sdk/_assets/sdk-ai-agent.png new file mode 100644 index 00000000000..85cd4bcec17 Binary files /dev/null and b/sdk/_assets/sdk-ai-agent.png differ diff --git a/sdk/tutorials/create-wallet-ai-agent.md b/sdk/tutorials/create-wallet-ai-agent.md new file mode 100644 index 00000000000..c3c6a3f7c18 --- /dev/null +++ b/sdk/tutorials/create-wallet-ai-agent.md @@ -0,0 +1,309 @@ +--- +description: Create a wallet AI agent using MetaMask SDK and Vercel's AI SDK. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Create a wallet AI agent + +This tutorial walks you through creating an AI agent dapp that can display your wallet balance and initiate transactions from your wallet, on the Linea Sepolia network. +You will use a provided template, which sets up MetaMask SDK and [Vercel's AI SDK](https://sdk.vercel.ai/) with a [Next.js](https://nextjs.org/docs) and [Wagmi](https://wagmi.sh/) dapp. + +## Prerequisites + +- [Node.js](https://nodejs.org/) version 18 or later and [pnpm](https://pnpm.io/installation) installed +- An [OpenAI](https://platform.openai.com/docs/overview) API key, with some credit balance available +- [MetaMask](https://metamask.io/) installed, with an account that has Linea Sepolia ETH + :::note + You can use the [MetaMask faucet](/developer-tools/faucet) to get Linea Sepolia ETH. + ::: + +## Steps + +### 1. Set up the project + +1. Clone the [`Consensys/wallet-agent`](https://github.com/Consensys/wallet-agent/tree/main) repository: + + ```bash + git clone git@github.com:Consensys/wallet-agent.git + ``` + +2. Switch to the `initial-setup` branch: + + ```bash + cd wallet-agent && git switch initial-setup + ``` + +3. Install dependencies: + + ```bash + npm install + ``` + +4. Create a `.env.local` file: + + ```bash + touch .env.local + ``` + +5. In `.env.local`, add an `OPENAI_API_KEY` environment variable, replacing `` with your [OpenAI](https://platform.openai.com/docs/overview) API key. +Vercel's AI SDK will use this environment variable to authenticate your dapp with the OpenAI service. + + ```text title=".env.local" + OPENAI_API_KEY= + ``` + +### 2. Create the dapp interface + +In `app/page.tsx`, use the `useAccount`, `useConnect`, and `useDisconnect` hooks from Wagmi, along with the Wagmi [MetaMask SDK connector](https://wagmi.sh/react/api/connectors/metaMask) to create a button to connect and disconnect your MetaMask wallet. + +Use the `Chat` component to display the AI agent chat interface. + +```tsx title="page.tsx" +// add-next-line ++ "use client"; + +// add-start ++ import { useAccount, useConnect, useDisconnect } from "wagmi"; ++ import { metaMask } from "wagmi/connectors"; ++ import { Button } from "@/components/ui/button"; ++ import { Chat } from "@/components/Chat"; +// add-end +import Image from "next/image"; + +// add-start ++ const ConnectButton = () => { ++ const { connect } = useConnect(); ++ const { address, isConnected } = useAccount(); ++ const { disconnect } = useDisconnect(); ++ ++ return ( ++
++ {isConnected ? ( ++ ++ ) : ( ++ ++ )} ++
++ ); ++ }; +// add-end + +export default function Home() { +// add-next-line ++ const { isConnected } = useAccount(); + return ( +
+
+

Wallet Agent setup

+// add-start ++ ++ { isConnected ? : null} +// add-end +
+ // ... +``` + +To test the interface, run the development server and navigate to [`http://localhost:3000`](http://localhost:3000/): + +```bash +npm run dev +``` + +Test that the button works to connect and disconnect from your MetaMask wallet. +When connected, the AI agent chat interface displays with your connected wallet address. +You can test the AI functionality by sending messages in the chat: + +

+ SDK AI agent initial setup +

+ +### 3. Create a Public Client + +In `wagmi.config.ts`, initialize a [Viem Public Client](https://viem.sh/docs/clients/public.html) +with the Linea Sepolia chain. +This Public Client will enable the AI agent to access public JSON-RPC API methods such as retrieving balances: + +```ts title="wagmi.config.ts" +// add-next-line ++ import { createPublicClient } from "viem"; +import { createConfig, http, cookieStorage, createStorage } from "wagmi"; +import { lineaSepolia, linea, mainnet } from "wagmi/chains"; +import { metaMask } from "wagmi/connectors"; + +// add-start ++ export const publicClient = createPublicClient({ ++ chain: lineaSepolia, ++ transport: http(), ++ }); +// add-end + +export function getConfig() { +// ... +``` + +### 4. Create a tool to get the balance + +Use the AI SDK's [tools](https://sdk.vercel.ai/docs/foundations/tools) feature to enable the AI agent to perform specific tasks. + +In `ai/tools.ts`, update or remove the example tool. +Use the [`getBalance`](https://viem.sh/docs/actions/public/getBalance) method of your configured Public Client, and Viem's [`formatEther`](https://viem.sh/docs/utilities/formatEther.html) function to create a tool that retrieves the ether balance of the connected wallet: + +```ts title="tools.ts" +// add-start ++ import { publicClient } from "@/wagmi.config"; ++ import { formatEther } from "viem"; +// add-end +import { tool as createTool } from "ai"; +import { z } from "zod"; + +// remove-start +- const tool = createTool({ +- description: "Example tool", +- parameters: z.object({ +- name: z.string().describe("The name of the user"), +- }), +- execute: async ({ name }) => { +- return { name }; +- }, +- }); +//remove-end +// add-start ++ const balanceTool = createTool({ ++ description: "Get the balance of the connected wallet", ++ parameters: z.object({ ++ address: z.string().describe("The address of the user"), ++ }), ++ execute: async ({ address }) => { ++ const balance = await publicClient.getBalance({ ++ address: address as `0x${string}`, ++ }); ++ return { balance: formatEther(balance) }; ++ }, ++ }); +// add-end + +export const tools = { + // remove-next-line +- example: tool, + // add-next-line ++ displayBalance: balanceTool, +}; +``` + +In the development server, test that this tool works to get your current Linea Sepolia ETH balance: + +

+ SDK AI agent get balance +

+ +### 5. Create a tool to send transactions + +In `ai/tools.ts`, create another tool to send transactions. +In this example, the tool and the `Chat.tsx` component are configured to initiate a transaction and provide a button for you to send the transaction. +You only need to make the following changes to the `tools.ts` file: + + + + +```ts +import { publicClient } from "@/wagmi.config"; +import { formatEther } from "viem"; +import { tool as createTool } from "ai"; +import { z } from "zod"; + +const balanceTool = createTool({ + // ... +}); + +// add-start ++ const sendTransactionTool = createTool({ ++ description: "Initiate a transaction to the provided wallet address", ++ parameters: z.object({ ++ to: z.string().describe("The wallet address of the user"), ++ amount: z.string().describe("The amount of ether to send"), ++ }), ++ execute: async ({ to, amount }) => { ++ return { to, amount }; ++ }, ++ }); +// add-end + +export const tools = { + displayBalance: balanceTool, + // add-next-line ++ sendTransaction: sendTransactionTool, +}; +``` + + + + +```tsx +// ... +if (toolName === "sendTransaction") { + const { + result, + }: { result: { to: string; amount: string } } = + toolInvocation; + + if (isLoading) { + return ( +
+

Loading...

+
+ ); + } + + return ( +
+ +

+ {hash + ? `Transaction sent: ${hash}` + : "Transaction not sent"} +

+
+ ); +} +// ... +``` + +
+
+ +In the development server, test that this tool works to send Linea Sepolia ETH from your connected address to the address you provide. + +When you request the agent to send a transaction, it will provide a button for you to send the transaction, but it will not send it for you: + +

+ NFT confirmation +

+ +When you select the button and confirm the transaction in MetaMask, the transaction will be sent: + +

+ Multiple NFTs confirmation +

+ +You can check the status of the transaction in the [Linea Sepolia block explorer](https://sepolia.lineascan.build/). + +:::note +You can configure the AI agent to directly send the transaction using a [Viem Wallet Client](https://viem.sh/docs/clients/wallet). +::: + +## Resources + +- View the main branch of the [`Consensys/wallet-agent`](https://github.com/Consensys/wallet-agent) template for the completed implementation of this tutorial. +- Watch the [live coding session](https://www.youtube.com/watch?v=ZVuOaKuAhBQ) on YouTube, in which the MetaMask DevRel team walks through creating a wallet AI agent from the initial template. \ No newline at end of file diff --git a/services/get-started/endpoints.md b/services/get-started/endpoints.md index 142f086901f..1078661820e 100644 --- a/services/get-started/endpoints.md +++ b/services/get-started/endpoints.md @@ -76,8 +76,6 @@ Switch to the Hoodi testnet, now available on Infura via |-------------------|-------------------------|------------------------------------------------| | Mainnet | JSON-RPC over HTTPS | `https://mainnet.infura.io/v3/` | | Mainnet | JSON-RPC over WebSocket | `wss://mainnet.infura.io/ws/v3/` | -| Testnet (Holesky) | JSON-RPC over HTTPS | `https://holesky.infura.io/v3/` | -| Testnet (Holesky) | JSON-RPC over WebSocket | `wss://holesky.infura.io/ws/v3/` | | Testnet (Hoodi) | JSON-RPC over HTTPS | `https://hoodi.infura.io/v3/` | | Testnet (Hoodi) | JSON-RPC over WebSocket | `wss://hoodi.infura.io/ws/v3/` | | Testnet (Sepolia) | JSON-RPC over HTTPS | `https://sepolia.infura.io/v3/` | @@ -159,6 +157,13 @@ Include your authentication details when [making IPFS requests](/reference/ipfs/ | Mainnet | JSON-RPC over HTTPS | `https://scroll-mainnet.infura.io/v3/` | | Sepolia | JSON-RPC over HTTPS | `https://scroll-sepolia.infura.io/v3/` | +## Solana + +| Network | Description | URL | +|---------|-------------------------|-------------------------------------------------------| +| Mainnet | JSON-RPC over HTTPS | `https://solana-mainnet.infura.io/v3/` | +| Devnet | JSON-RPC over HTTPS | `https://solana-devnet.infura.io/v3/` | + ## Starknet | Network | Description | URL | diff --git a/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx b/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx index 15cedc89cc9..10d51f2b723 100644 --- a/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx +++ b/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx @@ -1,2 +1,2 @@ Polling method for a filter, which returns an array of logs which occurred since the last poll. -Filter must be created by calling either [`eth_newFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newfilter.mdx) or [`eth_newBlockFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx). +Filter must be created by calling either [`eth_newFilter`](../eth_newfilter) or [`eth_newBlockFilter`](../eth_newblockfilter). diff --git a/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx b/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx index 3504acbb384..0f8a8af168c 100644 --- a/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx +++ b/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx @@ -1,12 +1,12 @@ - `log object array`: (array) An array of log objects, or an empty array if nothing has changed since the last poll. -- For filters created with [`eth_newBlockFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx) the return values are block hashes (32 bytes), for example, `["0x3454645634534..."]`. -- For filters created with [`eth_newFilter`](../../ethereum/json-rpc-methods/filter-methods/eth_newfilter.mdx) the logs are objects with the following params: +- For filters created with [`eth_newBlockFilter`](../eth_newblockfilter) the return values are block hashes (32 bytes), for example, `["0x3454645634534..."]`. +- For filters created with [`eth_newFilter`](../eth_newfilter) the logs are objects with the following params: - `address`: 20 bytes. Address from which this log originated. - - `blockHash`: 32 bytes. The hash of the block where this log was in. `Null` when it is a pending log. - - `blockNumber`: The block number where this log was in. `Null` when it is a pending log. + - `blockHash`: 32 bytes. The hash of the block where this log was in. `null` when it is a pending log. + - `blockNumber`: The block number where this log was in. `null` when it is a pending log. - `data`: DATA. Contains the non-indexed arguments of the log. - - `logIndex`: A hexadecimal of the log index position in the block. `Null` when it is a pending log. + - `logIndex`: A hexadecimal of the log index position in the block. `null` when it is a pending log. - `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it is a valid log. - `topics`: Array of DATA. An array of 0 to 4 32-bytes DATA of indexed log arguments. In Solidity the first `topic` is the hash of the signature of the event (for example, `Deposit(address,bytes32,uint256)`), except when you declared the event with the anonymous specifier. - - `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `Null` when it is a pending log. - - `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `Null` when it is a pending log. + - `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `null` when it is a pending log. + - `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `null` when it is a pending log. diff --git a/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx b/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx index d4fab10d441..bfc37eed578 100644 --- a/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx +++ b/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx @@ -1,10 +1,10 @@ - `log object array`: (array) An array of log objects that match the filter. For an array of logs that occurred since the last poll, use [eth_getFilterChanges](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx). Log objects contain the following keys and their values: - `address`: 20 bytes. Address from which this log originated. - - `blockHash`: 32 bytes. The hash of the block where this log was in. `Null` when it is a pending log. - - `blockNumber`: The block number where this log was in. `Null` when it is a pending log. + - `blockHash`: 32 bytes. The hash of the block where this log was in. `null` when it's a pending log. + - `blockNumber`: The block number where this log was in. `null` when it's a pending log. - `data`: DATA. Contains the non-indexed arguments of the log. - - `logIndex`: A hexadecimal of the log index position in the block. `Null` when it is a pending log. - - `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it is a valid log. + - `logIndex`: A hexadecimal of the log index position in the block. `null` when it is a pending log. + - `removed`: `true` when the log was removed, due to a chain reorganization. `false` if it's a valid log. - `topics`: Array of DATA. An array of 0 to 4 32-bytes DATA of indexed log arguments. In Solidity the first `topic` is the hash of the signature of the event (for example, `Deposit(address,bytes32,uint256)`), except when you declared the event with the anonymous specifier. - - `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `Null` when it is a pending log. - - `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `Null` when it is a pending log. + - `transactionHash`: 32 bytes. A hash of the transactions from which this log was created. `null` when it's a pending log. + - `transactionIndex`: A hexadecimal of the transactions index position from which this log was created. `null` when it's a pending log. diff --git a/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx b/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx index 4c240e5e365..d5f82f7be10 100644 --- a/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx +++ b/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx @@ -1,5 +1,8 @@ -Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call [`eth_getFilterChanges`](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx). +Creates a filter in the node, to notify when a new block arrives. To check if the state has +changed, call [`eth_getFilterChanges`](../eth_getfilterchanges). -:::tip Valid for fifteen minutes -Filter IDs will be valid for up to fifteen minutes, and can be polled by any connection using the same ``. +:::warning Expires after 15 minutes of inactivity +Filters that are not polled using [`eth_getFilterChanges`](../eth_getfilterchanges) automatically +expires after 15 minutes of inactivity. +Filter IDs can be polled by any connection using the same API key. ::: diff --git a/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx b/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx index 932ce615e4f..99700021abd 100644 --- a/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx +++ b/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx @@ -1,5 +1,7 @@ -Creates a filter object based on the given filter options, to notify when the state changes (logs). To check if the state has changed, call [`eth_getFilterChanges`](../../ethereum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx). +Creates a filter object based on the given filter options, to notify when the state changes (logs). To check if the state has changed, call [`eth_getFilterChanges`](../eth_getfilterchanges). -:::tip Valid for fifteen minutes -Filter IDs will be valid for up to fifteen minutes, and can be polled by any connection using the same ``. +:::warning Expires after 15 minutes of inactivity +Filters that are not polled using [`eth_getFilterChanges`](../eth_getfilterchanges) automatically +expires after 15 minutes of inactivity. +Filter IDs can be polled by any connection using the same API key. ::: diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..5b91a0575ae --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://arbitrum-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..df5422c721a --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://arbitrum-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..58c24fe2b9d --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://arbitrum-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..a213bccb87e --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://arbitrum-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..9c978a0fc94 --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://arbitrum-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://arbitrum-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/arbitrum/json-rpc-methods/filter-methods/index.md b/services/reference/arbitrum/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/arbitrum/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..4215bf9db0a --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://avalanche-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://avalanche-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..d22c644ce6e --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://avalanche-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://avalanche-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..d78d2dce824 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://avalanche-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://avalanche-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..34935789e84 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://avalanche-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://avalanche-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..93ef1b524d9 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://avalanche-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://avalanche-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/index.md b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/avalanche-c-chain/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..c434a5565ef --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://base-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://base-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..437a89950e8 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://base-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://base-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/base/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..89c72c2a6a7 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://base-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://base-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/base/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..278ed2308e0 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://base-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://base-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/base/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..e994e6ddc2a --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://base-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://base-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/base/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/base/json-rpc-methods/filter-methods/index.md b/services/reference/base/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/base/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..12654bc71ec --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://celo-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://celo-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..8f80401b205 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://celo-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://celo-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/celo/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..e8dea718531 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://celo-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://celo-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/celo/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..159e7998cb4 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://celo-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://celo-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/celo/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..d0a87136e04 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://celo-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://celo-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/celo/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/celo/json-rpc-methods/filter-methods/index.md b/services/reference/celo/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/celo/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..2cecdfca651 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://linea-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://linea-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..043dd3b7282 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://linea-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://linea-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/linea/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..c465bd84710 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://linea-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://linea-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/linea/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..baaa4eb6177 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://linea-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://linea-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/linea/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..45b2d1a15a8 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://linea-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://linea-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/linea/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/linea/json-rpc-methods/filter-methods/index.md b/services/reference/linea/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/linea/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..58955d4c8ab --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://optimism-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://optimism-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..4b0a63ae793 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://optimism-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://optimism-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..deb05aea157 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://optimism-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://optimism-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..69a020a9b82 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://optimism-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://optimism-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..880dcc67c45 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://optimism-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://optimism-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/optimism/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/optimism/json-rpc-methods/filter-methods/index.md b/services/reference/optimism/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/optimism/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx new file mode 100644 index 00000000000..0d31142f81f --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterchanges-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://polygon-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://polygon-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterChanges", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx new file mode 100644 index 00000000000..902f6ce67a7 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_getfilterlogs-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://polygon-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + + +```bash +wscat -c wss://polygon-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_getFilterLogs", "params": ["0x10ff0bfbedb01f0dbd4106d14eb719ec38b6eb5b821c"], "id": 1}' +``` + + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx new file mode 100644 index 00000000000..98fd6135132 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newblockfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://polygon-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + + +```bash +wscat -c wss://polygon-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newBlockFilter", "params": [], "id": 1}' +``` + + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx new file mode 100644 index 00000000000..c5894fc71f1 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_newfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://polygon-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + + +```bash +wscat -c wss://polygon-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_newFilter", "params": [{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}], "id": 1}' +``` + + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx new file mode 100644 index 00000000000..f661a6c39a5 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/_eth_uninstallfilter-request.mdx @@ -0,0 +1,22 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + + + + +```bash +curl https://polygon-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + + +```bash +wscat -c wss://polygon-mainnet.infura.io/ws/v3/ -x '{"jsonrpc": "2.0", "method": "eth_uninstallFilter", "params": ["0x10ff0bfba9472c87932c56632eef8f5cc70910e8e71d"], "id": 1}' +``` + + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx new file mode 100644 index 00000000000..40cf31917e8 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterchanges.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterChanges" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterchanges-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterchanges-response.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx new file mode 100644 index 00000000000..217655f7f9d --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_getfilterlogs.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_getFilterLogs" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-example.mdx" + + + +### Request + +import Request from "./_eth_getfilterlogs-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_getfilterlogs-response.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newblockfilter.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newblockfilter.mdx new file mode 100644 index 00000000000..06376e0f306 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newblockfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newBlockFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newblockfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newblockfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newblockfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newblockfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newblockfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newblockfilter-response.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newfilter.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newfilter.mdx new file mode 100644 index 00000000000..e2da4ffd5a6 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_newFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_newfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_newfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_newfilter-example.mdx" + + + +### Request + +import Request from "./_eth_newfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_newfilter-response.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx new file mode 100644 index 00000000000..2ea55a1da1c --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_newpendingtransactionfilter.mdx @@ -0,0 +1,10 @@ +--- +title: "eth_newPendingTransactionFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_newpendingtransactionfilter-description.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx new file mode 100644 index 00000000000..2032bea779d --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/eth_uninstallfilter.mdx @@ -0,0 +1,40 @@ +--- +title: "eth_uninstallFilter" +--- + +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +import Description from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-description.mdx" + + + +## Parameters + +import Params from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-parameters.mdx" + + + +## Returns + +import Returns from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-returns.mdx" + + + +## Example + +import Example from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-example.mdx" + + + +### Request + +import Request from "./_eth_uninstallfilter-request.mdx" + + + +### Response + +import Response from "/services/reference/_partials/filter-methods/_eth_uninstallfilter-response.mdx" + + diff --git a/services/reference/polygon-pos/json-rpc-methods/filter-methods/index.md b/services/reference/polygon-pos/json-rpc-methods/filter-methods/index.md new file mode 100644 index 00000000000..c9813a889e9 --- /dev/null +++ b/services/reference/polygon-pos/json-rpc-methods/filter-methods/index.md @@ -0,0 +1,17 @@ +--- +title: "Filter methods" +--- + +# Filter methods + +Infura supports the following filter methods over both HTTP and WebSocket. In both cases, the filter IDs +can be shared by any connection using the same API key. + +- [`eth_getFilterChanges`](eth_getfilterchanges.mdx) +- [`eth_getFilterLogs`](eth_getfilterlogs.mdx) +- [`eth_newBlockFilter`](eth_newblockfilter.mdx) +- [`eth_newFilter`](eth_newfilter.mdx) +- [`eth_uninstallFilter`](eth_uninstallfilter.mdx) + +Filters that are not polled using [`eth_getFilterChanges`](eth_getfilterchanges.mdx) automatically +expires after fifteen minutes of inactivity. diff --git a/services/reference/solana/index.md b/services/reference/solana/index.md new file mode 100644 index 00000000000..4c01908a67f --- /dev/null +++ b/services/reference/solana/index.md @@ -0,0 +1,54 @@ +--- +description: Solana network documentation. +--- + +import CardList from '@site/src/components/CardList' + +# Solana + +:::note Decentralized Infrastructure Network (DIN) + +Solana is supported through the [DIN](https://www.infura.io/solutions/decentralized-infrastructure-service) service, +meaning calls to the network are routed to [partner infrastructure providers](#partners-and-privacy-policies). + +Solana access is currently limited to paid accounts. +To get expedited access, upgrade to a paid tier. Solana support will be available to all account tiers in the future. + +::: + +Solana provides a high-performance network that is utilized for a range of use cases, including finance, NFTs, payments, and gaming. +Solana operates as a single global state machine and is open and interoperable. + +:::info See also +- See the [official Solana documentation](https://solana.com/docs) for more information. +::: + +Select an option below to get started with the Solana network. + + + +## Partners and privacy policies + +The following partners provide access to the Scroll network: + +- Everstake ([Terms of Service](https://everstake.one/docs/terms-of-use.pdf), [Privacy Policy](https://everstake.one/docs/privacy-policy.pdf)) +- Triton One ([Terms of Service and Privacy Policy](https://triton.one/legal)) + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getasset.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getasset.mdx new file mode 100644 index 00000000000..ab6130f3944 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getasset.mdx @@ -0,0 +1,255 @@ +--- +title: "getAsset" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAsset` + +Returns the metadata information of a compressed or standard asset. + +## Parameters + +- `id`: (string) _[required]_ - The `base58` encoded public key of the asset to query. +- `config`: (object) _[optional]_ - Optional flags to return additional information about the asset: + - `showFungible`: (boolean) - Whether to return the `token_info` object about the asset. + - `showUnverifiedCollections`: (boolean) - Whether to return an asset from an unverified collection. + - `showCollectionMetadata`: (boolean) - Whether to return the collection metadata. + +## Returns + +`result` - An object with the following fields: + +- `interface` - The interface type of the asset. Return types + include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. +- `id` - The ID of the asset. +- `content` - Metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - Metadata fields: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. +- `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. +- `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. +- `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. +- `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. +- `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. +- `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. +- `supply` - Supply details: + - `print_max_supply` - The maximum supply for prints. + - `print_current_supply` - The current supply for prints. + - `edition_nonce` - The edition nonce. +- `mutable` - Whether the asset is mutable. +- `burnt` - Whether the asset is burnt. +- `token_info` - Additional token info which is returned via the `showFungible` parameter: + - `supply` - The supply of the asset. + - `decimals` - The decimals supported by the asset. + - `token_program` - The token program of the asset. + - `mint_authority` - The mint authority of the asset. + - `freeze_authority` - The freeze authority of the asset. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAsset", "params": ["GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "interface": "Custom", + "id": "GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://arweave.net/I657C0VaPHIN7G4iL8Lr_8nctJhoIecFIyzlMCVF6IQ", + "files": [ + { + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es", + "mime": "image/png" + }, + { + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es?ext=png", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Green", + "trait_type": "Background" + }, + { + "value": "Green / Green", + "trait_type": "Fur / Skin" + }, + { + "value": "Policeman's Cap", + "trait_type": "Head" + }, + { + "value": "Sandwich", + "trait_type": "Mouth" + }, + { + "value": "No Traits", + "trait_type": "Teeth" + }, + { + "value": "Police Uniform", + "trait_type": "Clothing" + }, + { + "value": "No Traits", + "trait_type": "Eyewear" + }, + { + "value": 1, + "trait_type": "generation", + "display_type": "number" + }, + { + "value": 2463, + "trait_type": "sequence", + "display_type": "number" + } + ], + "description": "Deep in the heart of Dingus Forest echoes the sleepless cries of a troop of 10,000 apes. These aren’t just regular apes, however. These are degenerate apes.", + "name": "Degen Ape #2463", + "symbol": "DAPE" + }, + "links": { + "external_url": "", + "image": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es" + } + }, + "authorities": [ + { + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "DSwfRF1jhhu6HpSuzaig1G19kzP73PfLZBPLofkw6fLD" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.042, + "basis_points": 420, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "9BKWqDHfHZh9j39xakYVMdr6hXmCLHH5VfCpeq2idU9L", + "share": 39, + "verified": false + }, + { + "address": "9FYsKrNuEweb55Wa2jaj8wTKYDBvuCG3huhakEj96iN9", + "share": 25, + "verified": false + }, + { + "address": "HNGVuL5kqjDehw7KR63w9gxow32sX6xzRNgLb8GkbwCM", + "share": 25, + "verified": false + }, + { + "address": "7FzXBBPjzrNJbm9MrZKZcyvP3ojVeYPUG2XkBPVZvuBu", + "share": 10, + "verified": false + }, + { + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", + "share": 1, + "verified": true + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "1BWutmTvYPwDtmw9abTkS4Ssr8no61spGAvW1X6NDix" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 255 + }, + "mutable": false, + "burnt": false + }, + "id": 0 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproof.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproof.mdx new file mode 100644 index 00000000000..b79d6ecdd81 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproof.mdx @@ -0,0 +1,80 @@ +--- +title: "getAssetProof" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetProof` + +Returns the Merkle tree proof information for a compressed asset. + +## Parameters + +- `id`: (string) _[required]_ - The `base58` encoded public key of the asset to query. + +## Returns + +`result` - An object containing the following fields: + +- `root` - The root hash of the Merkle tree. +- `proof` - An array of hashes representing the Merkle proof. +- `node_index` - The index of the node in the Merkle tree. +- `leaf` - The hash of the leaf node. +- `tree_id` - The ID of the Merkle tree. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetProof", "params": ["Bu1DEKeawy7txbnCEJE4BU3BKLXaNAKCYcHR4XhndGss"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "root": "2o6Y6EiY3WXhoaEpei2pHmHLYnHDcEQVhgD89GrGHDBH", + "proof": [ + "EmJXiXEAhEN3FfNQtBa5hwR8LC5kHvdLsaGCoERosZjK", + "7NEfhcNPAwbw3L87fjsPqTz2fQdd1CjoLE138SD58FDQ", + "6dM3VyeQoYkRFZ74G53EwvUPbQC6LsMZge6c7S1Ds4ks", + "A9AACJ5m7UtaVz4HxzhDxGjYaY88rc2XPoFvnoTvgYBj", + "2VG5cKeBZdqozwhHGGzs13b9tzy9TXt9kPfN8MzSJ1Sm", + "3E1uFze4pi6BnTZXMsQbeh3jQCeDi966Zax9aMbYgg2D", + "Bx9PdctdWCeC1WfU6dwP49idsXCYhqyxbRLyLwwGhr61", + "HSbJ8quT4vuXFgf5FnjzeUuFfAtLKsq6W1Frj8y1qrif", + "GJMLzL4F4hY9yFHY1EY6XRmW4wpuNGeBZTiv7vM2mYra", + "FYPtEiqmRx6JprHQvWeEWEuVp3WA7DPRCE4VbhFRVuAj", + "6MJKrpnK1GbYsnEzwMRWStNGkTjAZF23NhzTQSQVXsD3", + "HjnrJn5vBUUzpCxzjjM9ZnCPuXei2cXKJjX468B9yWD7", + "4YCF1CSyTXm1Yi9W9JeYevawupkomdgy2dLxEBHL9euq", + "E3oMtCuPEauftdZLX8EZ8YX7BbFzpBCVRYEiLxwPJLY2" + ], + "node_index": 16384, + "leaf": "6YdZXw49M97mfFTwgQb6kxM2c6eqZkHSaW9XhhoZXtzv", + "tree_id": "2kuTFCcjbV22wvUmtmgsFR7cas7eZUzAu96jzJUvUcb7" + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproofs.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproofs.mdx new file mode 100644 index 00000000000..3846bc7d1a7 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetproofs.mdx @@ -0,0 +1,83 @@ +--- +title: "getAssetProofs" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetProofs` + +Returns the Merkle tree proof information for multiple compressed assets. + +## Parameters + +- `ids`: (array of strings) _[required]_ - An array of `base58` encoded public keys of the assets to query. + +## Returns + +`result` - An object where each key is an asset ID, and the value is an object containing the following fields: + +- `root` - The root hash of the Merkle tree. +- `proof` - An array of hashes representing the Merkle proof. +- `node_index` - The index of the node in the Merkle tree. +- `leaf` - The hash of the leaf node. +- `tree_id` - The ID of the Merkle tree. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetProofs", "params": [["D85MZkvir9yQZFDHt8U2ZmS7D3LXKdiSjvw2MBdscJJa", "ELDjRRs5Wb478K4h3B5bMPEhqFD8FvoET5ctHku5uiYi"]]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "ELDjRRs5Wb478K4h3B5bMPEhqFD8FvoET5ctHku5uiYi": null, + "D85MZkvir9yQZFDHt8U2ZmS7D3LXKdiSjvw2MBdscJJa": { + "root": "HscyoK57Grh1CGHi7HDDGaQRqe3CtetqgwZCBjw6E73t", + "proof": [ + "4EVwURnyVehgq4LhPfJFmPngfuNvreJgBGX1jbojcg7p", + "89KmAg6NuRkwbSmpEU2fH8tJmuoGkwAwkV7MZaTRuRyE", + "DD34gSoVzcDJKK4FcQx6RPDBmjwsWJ2JyL9Poch9i6Hm", + "F9oTuKohez7fbLjXXfqurqNG4KhVn2RgnC7o85Z4qgnm", + "HSfwLLiVjmhtFFFaLF6VFQZ7NrWZW9qoZDGWTPnU8Trw", + "CyFfjtkvg1HfexcekN6cCrUYmUwqtoeFGaTWeyPGxqmj", + "3Rv9v5r97j6vudzjVF8idGQdeu7jJdHgm75pTAeiN9ce", + "6mr5hmD2nkPU76irs6duAYekRgPxDWh8JMuunua4Whra", + "HxDaLgV8UrMq4G3YtXfcCx4UXm511hWSxPTeAfcD39vG", + "EvxphsdRErrDMs9nhFfF4nzq8i1C2KSogA7uB96TPpPR", + "HpMJWAzQv9HFgHBqY1o8V1B27sCYPFHJdGivDA658jEL", + "GcUfCg1P6XhSXzW34YmgXspCYaT7ujHSNmDK2CDEA3dy", + "4YCF1CSyTXm1Yi9W9JeYevawupkomdgy2dLxEBHL9euq", + "E3oMtCuPEauftdZLX8EZ8YX7BbFzpBCVRYEiLxwPJLY2" + ], + "node_index": 18559, + "leaf": "91eAJoZoXMmLbxCGWo7tdfHT7ZDYZMLgJRaGi2ocPxwL", + "tree_id": "5i1rrMFvFfwCkR15cf66bEXM2LmtfffDfYegQ3qdWgcF" + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassets.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassets.mdx new file mode 100644 index 00000000000..9380c4d15da --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassets.mdx @@ -0,0 +1,324 @@ +--- +title: "getAssets" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssets` + +Returns the metadata information of multiple compressed or standard assets. + +## Parameters + +- `ids`: (array of strings) _[required]_ - The `base58` encoded public keys of the assets to query. +- `config`: (object) _[optional]_ - Optional flags to return additional information about the asset: + - `showFungible`: (boolean) - Whether to return the `token_info` object about the asset. + - `showCollectionMetadata`: (boolean) - Whether to return the collection metadata. + +## Returns + +`result` - An array of objects, where each object contains the following fields: + +- `interface` - The interface type of the asset. Return types include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. +- `id` - The ID of the asset. +- `content` - Metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - Metadata fields: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. +- `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. +- `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. +- `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. +- `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. +- `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. +- `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. +- `supply` - Supply details: + - `print_max_supply` - The maximum supply for prints. + - `print_current_supply` - The current supply for prints. + - `edition_nonce` - The edition nonce. +- `mutable` - Whether the asset is mutable. +- `burnt` - Whether the asset is burnt. +- `token_info` - Additional token info which is returned via the `showFungible` flag: + - `supply` - The supply of the asset. + - `decimals` - The decimals supported by the asset. + - `token_program` - The token program of the asset. + - `mint_authority` - The mint authority of the asset. + - `freeze_authority` - The freeze authority of the asset. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "getAssets", + "params": [["GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD", "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]] + }' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "interface": "Custom", + "id": "GEciJX32EwG7DeHrXgosvpDAgjiuPo3uSEUAfJPLoSBD", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://arweave.net/I657C0VaPHIN7G4iL8Lr_8nctJhoIecFIyzlMCVF6IQ", + "files": [ + { + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es", + "mime": "image/png" + }, + { + "uri": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es?ext=png", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Green", + "trait_type": "Background" + }, + ... + { + "value": 2463, + "trait_type": "sequence", + "display_type": "number" + } + ], + "description": "Deep in the heart of Dingus Forest echoes the sleepless cries of a troop of 10,000 apes. These aren’t just regular apes, however. These are degenerate apes.", + "name": "Degen Ape #2463", + "symbol": "DAPE" + }, + "links": { + "image": "https://arweave.net/IxZAe2W4quFYdtae3d_NFZ8kAAcledOkK6_C7H352es", + "external_url": "" + } + }, + "authorities": [ + { + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "DSwfRF1jhhu6HpSuzaig1G19kzP73PfLZBPLofkw6fLD" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.042, + "basis_points": 420, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "9BKWqDHfHZh9j39xakYVMdr6hXmCLHH5VfCpeq2idU9L", + "share": 39, + "verified": false + }, + { + "address": "9FYsKrNuEweb55Wa2jaj8wTKYDBvuCG3huhakEj96iN9", + "share": 25, + "verified": false + }, + { + "address": "HNGVuL5kqjDehw7KR63w9gxow32sX6xzRNgLb8GkbwCM", + "share": 25, + "verified": false + }, + { + "address": "7FzXBBPjzrNJbm9MrZKZcyvP3ojVeYPUG2XkBPVZvuBu", + "share": 10, + "verified": false + }, + { + "address": "DC2mkgwhy56w3viNtHDjJQmc7SGu2QX785bS4aexojwX", + "share": 1, + "verified": true + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "1BWutmTvYPwDtmw9abTkS4Ssr8no61spGAvW1X6NDix" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 255 + }, + "mutable": false, + "burnt": false + }, + { + "interface": "ProgrammableNFT", + "id": "exMUf3JuFQMBUc3p6osuqJRFQWr9wgQWBGiuzXmHJTa", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://arweave.net/4yDL8qbv-j58hjv3imAnC_nP-2VKmjy7bNMNPsdUDZQ", + "files": [ + { + "uri": "https://arweave.net/qAr3txiC4QwJk5Na9_0bJbEiPlUeRvVDH4-YzOALK44", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Cream", + "trait_type": "Background" + }, + ... + { + "value": "Hooded Cardigan", + "trait_type": "Clothes" + } + ], + "description": "Okay Bears is a culture shift. A clean collection of 10,000 diverse bears building a virtuous community that will transcend the internet into the real world.", + "name": "Okay Bear #6261", + "symbol": "OKB", + "token_standard": "ProgrammableNonFungible" + }, + "links": { + "external_url": "https://www.okaybears.com/", + "image": "https://arweave.net/qAr3txiC4QwJk5Na9_0bJbEiPlUeRvVDH4-YzOALK44" + } + }, + "authorities": [ + { + "address": "4zj22pu8yRyenFHwLmue28CqVmGFgVQt5FmVvwdP5fLa", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "3saAedkM9o5g1u5DCqsuMZuC4GRqPB4TuMkvSsSVvGQ3" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "3xVDoLaecZwXXtN59o6T3Gfxwjcgf8Hc9RfoqBn995P9", + "share": 0, + "verified": true + }, + { + "address": "7zL7HVn85F5yFT6XM3BsJcQF7PBcNE7R2BT5GyfunpKe", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "1BWutmTvYPwDtmw9abTkS4Ssr8no61spGAvW1X6NDix" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 254 + }, + "mutable": true, + "burnt": false + } + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyauthority.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyauthority.mdx new file mode 100644 index 00000000000..d9b6edb1d22 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyauthority.mdx @@ -0,0 +1,230 @@ +--- +title: "getAssetsByAuthority" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetsByAuthority` + +Returns the list of assets given an authority address. + +## Parameters + +- `authorityAddress`: (string) _[required]_ - The `base58` encoded public key of the authority of the assets. +- `sortBy`: (object) _[optional]_ - Sorting criteria for the results: + - `sortBy` - The field to sort by. Possible values: `created`, `updated`, `recent_action`, `id`, `none`. + - `sortDirection` - The sort direction. Possible values: `asc`, `desc`. +- `limit`: (number) _[optional]_ - The maximum number of assets to retrieve. +- `page`: (number) _[optional]_ - The index of the page to retrieve. +- `before`: (string) _[optional]_ - Retrieve assets before the specified ID. +- `after`: (string) _[optional]_ - Retrieve assets after the specified ID. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of assets matching the query. +- `limit` - The maximum number of assets returned in this response. +- `items` - An array of asset objects. Each asset object contains: + - `interface` - The interface type of the asset. Return types include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, + `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. + - `id` - The ID of the asset. + - `content` - An object containing the metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - An object containing the metadata information: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. + - `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. + - `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. + - `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. + - `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. + - `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. + - `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. + - `mutable` - Whether the asset is mutable. + - `burnt` - Whether the asset is burnt. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetsByAuthority", "params": ["3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", {"sortBy": "created", "sortDirection": "desc"}, 50, 1, null, null]}' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 50, + "limit": 50, + "page": 1, + "items": [ + { + "interface": "V1_NFT", + "id": "AMBvgj2Zcjg7wpo5Vfzy1ruXUWmYHS2fZkrqSwQEtpJz", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://famousfoxes.com/metadata/9712.json", + "files": [ + { + "uri": "https://famousfoxes.com/hd/9712.png", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Straw", + "trait_type": "Background" + }, + { + "value": "Jacket Denim", + "trait_type": "Outfit" + }, + { + "value": "Natural", + "trait_type": "Skin" + }, + { + "value": "Vixen", + "trait_type": "Eyes" + }, + { + "value": "UwU", + "trait_type": "Mouth" + }, + { + "value": "Cap Purple", + "trait_type": "Head" + }, + { + "value": "True", + "trait_type": "Summoned" + } + ], + "description": "The Famous Fox Federation, an independent organization of the most fabulously famous foxes on the Blockchain.", + "name": "Fox #9712", + "symbol": "FFF", + "token_standard": "NonFungible" + }, + "links": { + "external_url": "https://famousfoxes.com", + "image": "https://famousfoxes.com/hd/9712.png" + } + }, + "authorities": [ + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "BUjZjAS2vbbb65g7Z1Ca9ZRVYoJscURG5L3AkVvHP9ac" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.042, + "basis_points": 420, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "442t3gHbw55CqiEAtoSWasVQ3eAhmYW2gPy5jqJNTdcw", + "share": 0, + "verified": true + }, + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "91GBiM6pBxVsANodJd4nGjnKBDE8XRJbcvQD9C1Phpyb" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 255 + }, + "mutable": true, + "burnt": false + }, + ... + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbycreator.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbycreator.mdx new file mode 100644 index 00000000000..8f80e53babf --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbycreator.mdx @@ -0,0 +1,226 @@ +--- +title: "getAssetsByCreator" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetsByCreator` + +Returns the list of assets given a creator address. + +## Parameters + +- `creatorAddress`: (string) _[required]_ - The `base58` encoded public key of the creator of the assets. +- `onlyVerified`: (boolean) _[optional]_ - Indicates whether to retrieve only verified assets. +- `sortBy`: (object) _[optional]_ - Sorting criteria for the results: + - `sortBy` - The field to sort by. Possible values: `created`, `updated`, `recent_action`, `id`, `none`. + - `sortDirection` - The sort direction. Possible values: `asc`, `desc`. +- `limit`: (number) _[optional]_ - The maximum number of assets to retrieve. +- `page`: (number) _[optional]_ - The index of the page to retrieve. +- `before`: (string) _[optional]_ - Retrieve assets before the specified ID. +- `after`: (string) _[optional]_ - Retrieve assets after the specified ID. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of assets matching the query. +- `limit` - The maximum number of assets returned in this response. +- `items` - An array of asset objects. Each asset object contains: + - `interface` - The interface type of the asset. Return types include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, + `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. + - `id` - The ID of the asset. + - `content` - An object containing the metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - An object containing the metadata information: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. + - `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. + - `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. + - `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. + - `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. + - `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. + - `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. + - `mutable` - Whether the asset is mutable. + - `burnt` - Whether the asset is burnt. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetsByCreator", "params": ["D3XrkNZz6wx6cofot7Zohsf2KSsu2ArngNk8VqU9cTY3", true, {"sortBy": "created", "sortDirection": "desc"}, 50, 1, null, null]}' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 50, + "limit": 50, + "page": 1, + "items": [ + { + "interface": "Custom", + "id": "H5soVfY8CD5Pcdmud6HUdW6N4GN7amE7zAxgDjWtMux6", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://famousfoxes.com/metadata/7616.json", + "files": [ + { + "uri": "https://famousfoxes.com/hd/7616.png", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Straw", + "trait_type": "Background" + }, + { + "value": "Hoodie Light", + "trait_type": "Outfit" + }, + { + "value": "Natural", + "trait_type": "Skin" + }, + { + "value": "Smirk", + "trait_type": "Mouth" + }, + { + "value": "None", + "trait_type": "Head" + }, + { + "value": "Scar", + "trait_type": "Eyes" + } + ], + "description": "The Famous Fox Federation, an independent organization of the most fabulously famous foxes on the Blockchain.", + "name": "Fox #7616", + "symbol": "FFF" + }, + "links": { + "external_url": "https://famousfoxes.com", + "image": "https://famousfoxes.com/hd/7616.png" + } + }, + "authorities": [ + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "BUjZjAS2vbbb65g7Z1Ca9ZRVYoJscURG5L3AkVvHP9ac" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.042, + "basis_points": 420, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "D3XrkNZz6wx6cofot7Zohsf2KSsu2ArngNk8VqU9cTY3", + "share": 0, + "verified": true + }, + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "share": 100, + "verified": true + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "3fn29NJqUuKJgwHKmk9n54TbaXG9DgWvLAqajxZLUi22", + "ownership_model": "single", + "owner": "3ZsZsjVDjMh6rrEdFi13TnBgh9W9vLyCYcY4yzApzrdK" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 254 + }, + "mutable": true, + "burnt": false + }, + ... + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbygroup.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbygroup.mdx new file mode 100644 index 00000000000..dff22e05010 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbygroup.mdx @@ -0,0 +1,231 @@ +--- +title: "getAssetsByGroup" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetsByGroup` + +Returns the list of assets given a group (key, value) pair. + +## Parameters + +- `groupKey`: (string) _[required]_ - The key of the group (for example `collection`). +- `groupValue`: (string) _[required]_ - The value of the group. +- `sortBy`: (object) _[optional]_ - Sorting criteria for the results: + - `sortBy` - The field to sort by. Possible values: `created`, `updated`, `recent_action`, `id`, `none`. + - `sortDirection` - The sort direction. Possible values: `asc`, `desc`. +- `limit`: (number) _[optional]_ - The maximum number of assets to retrieve. +- `page`: (number) _[optional]_ - The index of the page to retrieve. +- `before`: (string) _[optional]_ - Retrieve assets before the specified ID. +- `after`: (string) _[optional]_ - Retrieve assets after the specified ID. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of assets matching the query. +- `limit` - The maximum number of assets returned in this response. +- `items` - An array of asset objects. Each asset object contains: + - `interface` - The interface type of the asset. Return types include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, + `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. + - `id` - The ID of the asset. + - `content` - An object containing the metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - An object containing the metadata information: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. + - `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. + - `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. + - `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. + - `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. + - `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. + - `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. + - `mutable` - Whether the asset is mutable. + - `burnt` - Whether the asset is burnt. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetsByGroup", "params": ["collection", "BUjZjAS2vbbb65g7Z1Ca9ZRVYoJscURG5L3AkVvHP9ac", {"sortBy": "created", "sortDirection": "desc"}, 50, 1, null, null]}' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 50, + "limit": 50, + "page": 1, + "items": [ + { + "interface": "V1_NFT", + "id": "An7sN8sjhd7bBzsNoryPYtrRdgjPixT4FFsSxPSxnf5g", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://famousfoxes.com/metadata/9713.json", + "files": [ + { + "uri": "https://famousfoxes.com/hd/9713.png", + "mime": "image/png" + } + ], + "metadata": { + "attributes": [ + { + "value": "Cream", + "trait_type": "Background" + }, + { + "value": "Jacket Red", + "trait_type": "Outfit" + }, + { + "value": "Natural", + "trait_type": "Skin" + }, + { + "value": "Blue", + "trait_type": "Eyes" + }, + { + "value": "Toothy", + "trait_type": "Mouth" + }, + { + "value": "Cap Fire", + "trait_type": "Head" + }, + { + "value": "True", + "trait_type": "Summoned" + } + ], + "description": "The Famous Fox Federation, an independent organization of the most fabulously famous foxes on the Blockchain.", + "name": "Fox #9713", + "symbol": "FFF", + "token_standard": "NonFungible" + }, + "links": { + "image": "https://famousfoxes.com/hd/9713.png", + "external_url": "https://famousfoxes.com" + } + }, + "authorities": [ + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": false, + "data_hash": "", + "creator_hash": "", + "asset_hash": "", + "tree": "", + "seq": 0, + "leaf_id": 0 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "BUjZjAS2vbbb65g7Z1Ca9ZRVYoJscURG5L3AkVvHP9ac" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.042, + "basis_points": 420, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "442t3gHbw55CqiEAtoSWasVQ3eAhmYW2gPy5jqJNTdcw", + "share": 0, + "verified": true + }, + { + "address": "3pMvTLUA9NzZQd4gi725p89mvND1wRNQM3C8XEv1hTdA", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "BJL17Qr3cKSMXWBFqvWN58FhRqZPqdJCXU9MJykUuS7w" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": 255 + }, + "mutable": true, + "burnt": false + }, + ... + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyowner.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyowner.mdx new file mode 100644 index 00000000000..9e43fa07a36 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsbyowner.mdx @@ -0,0 +1,193 @@ +--- +title: "getAssetsByOwner" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetsByOwner` + +Returns the list of assets given an owner address. + +:::info +Infura does not currently support `params` as a JSON object. +Instead, parameters must be passed as a positional array, following the exact order defined in the method's +specification. This may differ from some other providers, where parameters are typically wrapped in an +object containing key/value pairs. +::: + +## Parameters + +- `ownerAddress`: (string) _[required]_ - The `base58` encoded public key of the owner of the assets. +- `sortBy`: (object) _[optional]_ - Sorting criteria for the results: + - `sortBy` - The field to sort by. Possible values: `created`, `updated`, `recent_action`, `id`, `none`. + - `sortDirection` - The sort direction. Possible values: `asc`, `desc`. +- `limit`: (number) _[optional]_ - The maximum number of assets to retrieve. +- `page`: (number) _[optional]_ - The index of the page to retrieve. +- `before`: (string) _[optional]_ - Retrieve assets before the specified ID. +- `after`: (string) _[optional]_ - Retrieve assets after the specified ID. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of assets matching the query. +- `limit` - The maximum number of assets returned in this response. +- `items` - An array of asset objects. Each asset object contains: + - `interface` - The interface type of the asset. Return types include: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, + `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. + - `id` - The ID of the asset. + - `content` - An object containing the metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - An object containing the metadata information: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. + - `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. + - `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. + - `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. + - `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. + - `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. + - `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. + - `mutable` - Whether the asset is mutable. + - `burnt` - Whether the asset is burnt. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getAssetsByOwner", "params": ["4cbnLyRoowAXtxLN6sEYrdYTFUkzodRyNFG7g4FKWBBA", {"sortBy": "created", "sortDirection": "desc"}, 50, 1, null, null]}' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 46, + "limit": 50, + "page": 1, + "items": [ + { + "interface": "V1_NFT", + "id": "6rZXazDDvM8RU1UDwunkqdhw1nXVFWRuk2Dh1ThJYLTH", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cloudflare-ipfs.com/ipfs/QmctZUaANofFr1BLgWQchwjcUMYEX2ZSx2LpDSHSRtQj5m", + "files": [], + "metadata": { + "name": "Key", + "symbol": "", + "token_standard": "NonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "9NFLyt33NWcidPYbPyVW7yWpAM1RKepNVMYAhCSpSM3w", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": true, + "data_hash": "5ZUYsZn64hubvRVCpnVxX9iBmEbEt1N8v5kbtoSS3L2K", + "creator_hash": "8i3JU72aZtimFTFFQtZCGkzrnLbibBDYVycCn3yrKc5e", + "asset_hash": "37fJAak3P8dFCJX4HijBtqEG6PjoXr74g86xaW4bPfjB", + "tree": "EpGN5mjMwAdWAQHZSHrjGcB7zewEw2KrRezZchSq9W6B", + "seq": 238234, + "leaf_id": 225357 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "BZNai1KJr17myQUUSfcU6FGHxtp4UwMPawkszXmihyiJ" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0, + "basis_points": 0, + "primary_sale_happened": false, + "locked": false + }, + "creators": [ + { + "address": "HeUwVyLufyPMiUnRe6Fo9iUvSBXtFYszAkG6q2WLCikD", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "4cbnLyRoowAXtxLN6sEYrdYTFUkzodRyNFG7g4FKWBBA" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": null + }, + "mutable": true, + "burnt": false + }, + ... + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsignatures.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsignatures.mdx new file mode 100644 index 00000000000..0fc02436418 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getassetsignatures.mdx @@ -0,0 +1,91 @@ +--- +title: "getAssetSignatures" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAssetSignatures` + +Retrieve a list of transaction signatures linked to a compressed asset. + +Returns a list of transaction signatures for a given asset, supporting only compressed assets created by the +[Metaplex Bubblegum program](https://developers.metaplex.com/bubblegum). + +## Parameters + +- `id`: (string) _[required]_ - The `base58` encoded public key of the asset. +- `owner`: (string) _[optional]_ - The `base58` encoded public key of the asset owner. +- `page`: (number) _[optional]_ - The current pagination page. +- `limit`: (number) _[optional]_ - The number of results per page. +- `cursor`: (string) _[optional]_ - Optional pagination cursor. +- `before`: (string) _[optional]_ - Return results before the specified signature. +- `after`: (string) _[optional]_ - Return results after the specified signature. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of transaction signatures matching the query. +- `limit` - The maximum number of transaction signatures returned in this response. +- `page` - The current pagination page. +- `items` - An array of transaction signature objects. Each object contains: + - `signature` - The transaction signature. + - `type` - The type of the signature. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "getAssetSignatures", + "params": [ + "D85MZkvir9yQZFDHt8U2ZmS7D3LXKdiSjvw2MBdscJJa", + null, + 1, + null, + null, + null, + null + ] + }' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 1, + "limit": 1000, + "page": 1, + "items": [ + [ + "3b52uoDvGTkJKk7ygozyK38gfrU8iruz2VPRZPFJKY1zUgWCA8df1ZZUFf5zwokwhEinsofHxiY7mMMuFsik6bjW", + "MintToCollectionV1" + ] + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/getnfteditions.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/getnfteditions.mdx new file mode 100644 index 00000000000..dc4708288e7 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/getnfteditions.mdx @@ -0,0 +1,95 @@ +--- +title: "getNftEditions" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getNftEditions` + +Retrieves all printable editions for a parent edition NFT mint. + +## Parameters + +- `mintAddress`: (string) _[required]_ - The mint address of the parent edition. +- `page`: (number) _[optional]_ - The current pagination page. +- `limit`: (number) _[optional]_ - The number of results per page. +- `cursor`: (string) _[optional]_ - Optional pagination cursor. +- `before`: (string) _[optional]_ - Return results before the cursor. +- `after`: (string) _[optional]_ - Return results after the cursor. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of printable editions. +- `limit` - The maximum number of editions returned in this response. +- `page` - The current pagination page. +- `master_edition_address` - The address of the parent edition. +- `supply` - The current supply of editions. +- `max_supply` - The maximum supply of editions. +- `editions` - An array of edition objects. Each edition object contains: + - `mint` - The mint address of the edition. + - `edition_address` - The address of the edition. + - `edition` - The edition number. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/11e49e3e9f754d9fa9ba5ddeb75fb0dc \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "getNftEditions", + "params": [ + "Ey2Qb8kLctbchQsMnhZs5DjY32To2QtPuXNwWvk4NosL", + 1, + null, + null, + null, + null + ] + }' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 66, + "limit": 100, + "page": 1, + "master_edition_address": "8SHfqzJYABeGfiG1apwiEYt6TvfGQiL1pdwEjvTKsyiZ", + "supply": 57, + "max_supply": 69, + "editions": [ + { + "mint": "GJvFDcBWf6aDncd1TBzx2ou1rgLFYaMBdbYLBa9oTAEw", + "edition_address": "AoxgzXKEsJmUyF5pBb3djn9cJFA26zh2SQHvd9EYijZV", + "edition": 1 + }, + ... + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/gettokenaccounts.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/gettokenaccounts.mdx new file mode 100644 index 00000000000..a6d3fb794d2 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/gettokenaccounts.mdx @@ -0,0 +1,106 @@ +--- +title: "getTokenAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenAccounts` + +Retrieves information about all token accounts for a specific mint or an owner. + +## Parameters + +- `mintAddress`: (string) _[optional]_ - The address of the associated mint. +- `ownerAddress`: (string) _[optional]_ - The owner address of the tokens. +- `page`: (integer) _[optional]_ - The index of the page to retrieve. The page parameter starts at `1` +- `limit`: (integer) _[optional]_ - The number of results per page. +- `cursor`: (string) _[optional]_ - Optional pagination cursor. +- `before`: (string) _[optional]_ - Return results before the cursor. +- `after`: (string) _[optional]_ - Return results after the cursor. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of token accounts matching the query. +- `limit` - The maximum number of token accounts returned in this response. +- `page` - The current pagination page. +- `token_accounts` - An array of token account objects. Each token account object contains: + - `address` - The address of the token account. + - `mint` - The mint address associated with the token account. + - `owner` - The owner address of the token account. + - `frozen` - Whether the token account is frozen. + - `amount` - The amount of tokens held in the account. + - `delegate` - The delegate address, if any. + - `close_authority` - The address that can close the token account, if any. + - `extensions` - Additional information about the token account, if any. + - `delegated_amount` - The amount of tokens delegated, if any. +- `errors` - An array of error objects, if any errors occurred during the request. +- `cursor` - The pagination cursor for the next page of results. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccounts", + "params": [ + "So11111111111111111111111111111111111111112", + null, + 1, + 50, + null, + null, + null + ] + }' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 1, + "limit": 1, + "page": 50, + "token_accounts": [ + { + "address": "DgeCdQBqsoAWhJtewsSN4Pcz9okEGBTebEZcrcGhPXDE", + "mint": "5fgwRW94H1KavvaGEanNZc2AnEGKkFaJWkZzAuvaxRNH", + "amount": 100000000, + "owner": "So11111111111111111111111111111111111111112", + "frozen": false, + "delegate": null, + "delegated_amount": 0, + "close_authority": null, + "extensions": null + } + ], + "cursor": null, + "errors": [] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/index.md b/services/reference/solana/json-rpc-methods/digital-asset-standard/index.md new file mode 100644 index 00000000000..42cf243172d --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/index.md @@ -0,0 +1,54 @@ +--- +title: Digital Asset Standard (DAS) API +--- + +DAS APIs provides an interface for interacting with digital assets such as fungible tokens, regular +NFTs, and compressed NFTs. + +Use the pagination and sort options available to some API methods that return a large amount on data. + +## Supported DAS methods + +Infura supports the following DAS API methods: + +- [`getAsset`](./getasset.mdx) +- [`getAssetProof`](./getassetproof.mdx) +- [`getAssetProofs`](getassetproofs.mdx) +- [`getAssets`](./getassets.mdx) +- [`getAssetsByAuthority`](./getassetsbyauthority.mdx) +- [`getAssetsByCreator`](./getassetsbycreator.mdx) +- [`getAssetsByGroup`](./getassetsbygroup.mdx) +- [`getAssetsByOwner`](./getassetsbyowner.mdx) +- [`getAssetSignatures`](./getassetsignatures.mdx) +- [`getNftEditions`](./getnfteditions.mdx) +- [`getTokenAccounts`](./gettokenaccounts.mdx) +- [`searchAssets`](./searchassets.mdx) + +## Pagination options + +Use pagination to manage large result sets and control how data is returned. + +- **By page**: Use when you want to access results in fixed-size pages (for example, when + displaying data in a paged UI). Requires the `page` parameter and can be combined with a `limit`. +- **By cursor**: Use for efficient pagination through a large or frequently changing dataset. + Requires a `cursor` value from a previous response. +- **By range**: Use when you need to retrieve results within a specific time or ID range. + Requires `before` or `after` parameters. Useful for narrowing a query. + +## Sorting options + +Control the order in which results are returned. Sorting may affect performance. + +- **`id`**: Sorts results by ID. Useful when IDs are incremental and correlate with creation order. +- **`created`**: Sorts results by creation timestamp. Use this to get the oldest or newest records + first. +- **`recent_action`**: Sorts by the timestamp of the most recent update or event. Helpful when + tracking activity or status changes. +- **`none`**: No sorting applied. Use for faster responses when order doesn’t matter. + +## Sort direction + +Define how sorted results are ordered. + +- **`asc`**: Sorts in ascending order (for example, from oldest to newest). +- **`desc`**: Sorts in descending order (for example, from newest to oldest). Often used to show the most recent results first. diff --git a/services/reference/solana/json-rpc-methods/digital-asset-standard/searchassets.mdx b/services/reference/solana/json-rpc-methods/digital-asset-standard/searchassets.mdx new file mode 100644 index 00000000000..3684430076f --- /dev/null +++ b/services/reference/solana/json-rpc-methods/digital-asset-standard/searchassets.mdx @@ -0,0 +1,236 @@ +--- +title: "searchAssets" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `searchAssets` + +Returns the list of assets based on the specified search criteria. + +## Parameters + +- `negate`: (boolean) _[optional]_ - Indicates whether the search criteria should be inverted. +- `conditionType`: (string) _[optional]_ - Indicates whether to retrieve all or any asset that matches the search criteria. + Valid options are: `all`, `any`. +- `interface`: (string) _[optional]_ - The interface of the asset. + Valid options are: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, `V2_NFT`, `FungibleAsset`, `Custom`, `Identity`, `Executable`. +- `ownerAddress`: (string) _[optional]_ - The `base58` encoded public key of the owner. +- `ownerType`: (string) _[optional]_ - The type of ownership. Valid options are: `single`, `token`. +- `creatorAddress`: (string) _[optional]_ - The `base58` encoded public key of the creator. +- `creatorVerified`: (boolean) _[optional]_ - Indicates whether the creator must be verified. +- `authorityAddress`: (string) _[optional]_ - The `base58` encoded public key of the authority. +- `grouping`: (array) _[optional]_ - A group (key, value) pair. +- `delegateAddress`: (string) _[optional]_ - The `base58` encoded public key of the delegate. +- `frozen`: (boolean) _[optional]_ - Indicates whether the asset is frozen. +- `supply`: (number) _[optional]_ - The supply of the asset. +- `supplyMint`: (string) _[optional]_ - The `base58` encoded public key of the supply mint. +- `compressed`: (boolean) _[optional]_ - Indicates whether the asset is compressed. +- `compressible`: (boolean) _[optional]_ - Indicates whether the asset is compressible. +- `royaltyTargetType`: (string) _[optional]_ - The type of royalty. Valid options are: `creators`, `fanout`, `single`. +- `royaltyTarget`: (string) _[optional]_ - The target address for royalties. +- `royaltyAmount`: (number) _[optional]_ - The royalties amount. +- `burnt`: (boolean) _[optional]_ - Indicates whether the asset is burnt. +- `sortBy`: (object) _[optional]_ - Sorting criteria for the results: + - `sortBy` - The field to sort by. Valid options are: `created`, `updated`, `recent_action`, `id`, `none`. + - `sortDirection` - The sort direction. Valid options are: `asc`, `desc`. +- `limit`: (number) _[optional]_ - The maximum number of assets to retrieve. +- `page`: (number) _[optional]_ - The index of the page to retrieve. +- `before`: (string) _[optional]_ - Retrieve assets before the specified ID. +- `after`: (string) _[optional]_ - Retrieve assets after the specified ID. +- `jsonUri`: (string) _[optional]_ - The value for the JSON URI. + +## Returns + +`result` - An object containing the following fields: + +- `total` - The total number of assets matching the query. +- `limit` - The maximum number of assets returned in this response. +- `items` - An array of asset objects. Each asset object contains: + - `interface` - The interface type of the asset. Valid options are: `V1_NFT`, `V1_PRINT`, `LEGACY_NFT`, `V2_NFT`, `FungibleAsset`, `FungibleToken`, `Custom`, `Identity`, `Executable`, `ProgrammableNFT`. + - `id` - The ID of the asset. + - `content` - An object containing the metadata and content information: + - `$schema` - The schema URI. + - `json_uri` - The URI pointing to the asset's JSON metadata. + - `files` - List of associated files with `uri`, `mime`, and optional `contexts`. + - `metadata` - An object containing the metadata information: + - `name` - The name of the asset. + - `symbol` - The symbol of the asset. + - `description` - A description of the asset. + - `attributes` - List of attributes with `trait_type` and `value`. + - `token_standard` - The token standard of the asset. + - `ownership` - An object containing the ownership details: + - `owner` - The owner's public key. + - `frozen` - Whether the asset is frozen. + - `delegated` - Whether the asset is delegated. + - `delegate` - The delegate's public key. + - `ownership_model` - The ownership model, for example `single` or `token`. + - `compression` - An object containing the asset compression details: + - `eligible` - Whether the asset is eligible for compression. + - `compressed` - Whether the asset is compressed. + - `data_hash` - The data hash of the asset. + - `creator_hash` - The creator hash of the asset. + - `asset_hash` - The asset hash. + - `tree` - The Merkle tree ID. + - `seq` - The sequence number. + - `leaf_id` - The leaf ID. + - `royalty` - An object containing the royalty details: + - `royalty_model` - The royalty model (`creators`, `fanout`, or `single`). + - `target` - The target address for royalties. + - `percent` - The royalty percentage. + - `basis_points` - The royalty in basis points. + - `primary_sale_happened` - Whether the primary sale has occurred. + - `locked` - Whether the royalty is locked. + - `creators` - List of creators: + - `address` - The creator's public key. + - `share` - The creator's share percentage. + - `verified` - Whether the creator is verified. + - `grouping` - Grouping details: + - `group_key` - The group key (for example, `collection`). + - `group_value` - The group value. + - `uses` - An object containing the usage details: + - `use_method` - The usage method (`burn`, `multiple`, or `single`). + - `remaining` - The remaining uses. + - `total` - The total uses. + - `mutable` - Whether the asset is mutable. + - `burnt` - Whether the asset is burnt. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/11e49e3e9f754d9fa9ba5ddeb75fb0dc \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "searchAssets", + "params": [ + false, + "all", + "V1_NFT", + "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", + "single", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + { "sortBy": "created", "sortDirection": "desc" }, + 50, + 1, + null, + null, + null + ] + }' + ``` + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "total": 50, + "limit": 50, + "page": 1, + "items": [ + { + "interface": "V1_NFT", + "id": "2SiYEckvp5MHz63ybheoehgk7YYPGZksKcxyT7MsJvDS", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://ipfs.io/ipfs/QmUWytohB2ecUqbor12sm7ozDrVzgbwnCtqF66m9abMLWG", + "files": [], + "metadata": { + "name": "5000 TO 50000 #54", + "symbol": "", + "token_standard": "NonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "7GaUkgafjv7uxni4GuvBFp8b1qFVRyZAmwNHzjeFbmTt", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": true, + "data_hash": "8uwkK3ydNdnGUbSGTfHjmw8uQ8HheerdEB1RmiL7xyvD", + "creator_hash": "9FiGqDmyw6peu9uZk3XekNC3S7KjaTV6oxC476gPCHLz", + "asset_hash": "9g5DrQ3ndkzLo2mfN74hqhzHG8suKyAetrgJZ4KG4xb8", + "tree": "2xZ7XN9wkUuMRj9RiCbBLXYMofAyHsrEKpWbA3xwxPfG", + "seq": 1038593, + "leaf_id": 1037754 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "71zrEGzfv4oX3uhc96trWayxdF3xm2kD9WWWoiMZkHAR" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.055, + "basis_points": 550, + "primary_sale_happened": false, + "locked": false + }, + "creators": [ + { + "address": "4AuVuuzh7NA8b8jCcJzARdUALum4MxG9tPYA7QxTPHqo", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": null + }, + "mutable": true, + "burnt": false + }, + ... + ] + }, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/getaccountinfo.mdx b/services/reference/solana/json-rpc-methods/getaccountinfo.mdx new file mode 100644 index 00000000000..80aad8ebcf9 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getaccountinfo.mdx @@ -0,0 +1,93 @@ +--- +title: "getAccountInfo" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getAccountInfo` + +Returns information associated with the account of the specified address. + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the account to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed` + - `dataSlice`: (object) _[optional]_ - A slice of the account data to return. Only available for `base58`, `base64`, + or `base64+zstd` encoding. This is an object with two properties: + - `offset` - The starting byte offset of the slice. + - `length` - The length of the slice in bytes. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - `null` when the account doesn't exist, or an object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object containing the following keys: + - `data` - The account data, encoded in the specified format. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports in the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "getAccountInfo", "params": [{"pubkey": "F5a3ExamplePubkeyABCDEFGH"}, {"config": {"encoding": "jsonParsed"}}],"id": 1}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 371626267 + }, + "value": { + "data": [ + "", + "base58" + ], + "executable": false, + "lamports": 88859014690252, + "owner": "11111111111111111111111111111111", + "rentEpoch": 18446744073709552000, + "space": 0 + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getbalance.mdx b/services/reference/solana/json-rpc-methods/getbalance.mdx new file mode 100644 index 00000000000..421e1393990 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getbalance.mdx @@ -0,0 +1,68 @@ +--- +title: "getBalance" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBalance` + +Returns the balance of the specified address in lamports. + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the account to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: (integer) _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - `null` when the account doesn't exist, or an object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - The balance of the account in lamports. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": ["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { "slot": 1 }, + "value": 0 + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblock.mdx b/services/reference/solana/json-rpc-methods/getblock.mdx new file mode 100644 index 00000000000..608f50e02c3 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblock.mdx @@ -0,0 +1,196 @@ +--- +title: "getBlock" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlock` + +Returns the identity and transaction information about a confirmed block. + +## Parameters + +- `slot`: (integer) _[required]_ - The slot number of the block to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `transactionDetails`: (string) _[optional]_ - The level of transaction details to include in the response. Possible values are: + - `none` - No transaction details. + - `accounts` - Transaction details only include signatures and an annotated list of accounts in each transaction. + - `signatures` - Only the signatures of the transactions. + - `full` - Full transaction details. This is the default option. + - `rewards`: (boolean) _[optional]_ - Whether to include rewards information in the response. The default is `false`. + - `encoding`: (string) _[optional]_ - The encoding format to use for the block data. Can be one + of `base58`, `base64`, `jsonParsed`, or `json` + - Returns the block data as a JSON object. + - `commitment`: (string) _[optional]_ The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `maxSupportedTransactionVersion`: (integer) _[optional]_ - The maximum supported transaction version to return. + If the requested block contains a transaction with a higher version, an error will be returned. If this parameter + is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt an error. + +## Returns + +`result` - `null` when the block doesn't exist, or an object with the following fields: + +- `blockHeight` - The number of blocks before this block. +- `blockTime` - The estimated production time, as Unix timestamp (seconds since the Unix epoch). It's `null` if not available. +- `blockhash` - The hash of the block encoded as a `base58` string. +- `parentSlot` - The slot index of this block's parent. +- `previousBlockhash` - The block hash of this block's parent encoded as `base58` string; if the parent block + is not available due to ledger cleanup, the field returns `11111111111111111111111111111111`. +- `transactions` - If full transaction details are requested, returns an array of JSON objects with the following fields: + - `meta` - The transaction status metadata object, which contains additional information about the block and its + transactions. The meta object can be `null`, or it may contain the following fields: + - `err` - Error code if the transaction failed, or `null` if the transaction succeeds. + - `fee` - The total fees paid by all transactions in the block encoded as `u64` integer. + - `innerInstructions` - An array of objects representing the inner instructions of all transactions in the + block (omitted if inner instruction recording is disabled). Each object has the following fields: + - `logMessages` - An array of strings containing any log messages generated by the block's transactions + (omitted if inner instruction recording is disabled). + - `postBalances` - An array of lamport balances for each account in the block after the transactions were processed. + - `postTokenBalances` - An array of token balances for each token account in the block after the transactions were + processed (omitted if inner instruction recording is disabled). + - `preBalances` - An array of lamport balances for each account in the block before the transactions were processed. + - `preTokenBalances` - An array of token balances for each token account in the block before the transactions were + processed (omitted if inner instruction recording is disabled). + - `rewards` - An object containing information about the rewards earned by the block's validators + (only present if the rewards are requested). It has the following fields: + - `pubkey` - The public key of the account that received the award encoded as a `base58` string. + - `lamports` - The number of reward lamports credited or debited by the account. + - `postBalance` - The account balance in lamports after the reward was applied. + - `rewardType` - The type of reward. It could be `fee`, `rent`, `voting`, or `staking`. + - `commission` - The vote account commission when the reward was credited, only present for voting and staking rewards. + - `status` - The status of the transaction. It returns `Ok` if the transaction was successful, and `Err` + if the transaction failed. + - `transaction` - The transaction object. It could be either JSON format or encoded binary data, depending on the encoding parameter. + - `message` - An array of transactions objects included in the block: + - `accountKeys` - An array of public keys associated with the accounts that were accessed during + the execution of transactions in the block. + - `pubkey` - The public key associated with the block producer that created the block. + - `signer` - Indicates if the account is a required transaction signer. It can also be used to identify the signers + involved in the block's transactions and to verify the authenticity of the signatures. + - `source` - Identifies the accounts that provided the funds for the block's transactions. + - `writable` - A boolean value that indicates whether the accounts associated with the given public keys + were modified by the transactions or not. + - `instructions` - An array of instructions that were executed in the block's transactions + - `parsed` - An array of parsed instructions that were executed in the block's transactions + - `info` - An array of information objects that provide additional details about the transactions in the block. + - `clockSysvar` - Provides information about the current state of the blockchain. + - `slotHashesSysvar` - Provides information about the hashes of recent slots. + - `vote` - An array of vote accounts that were involved in the block's transactions. + - `hash` - The hash of the block. It can be used to uniquely identify the block and to verify the authenticity + of the block's contents. + - `slots` - An array of slot numbers that correspond to the transactions in the block. + - `timestamp` - The Unix timestamp of the block's creation. + - `voteAccount` - A vote account to identify the validator that produced the block and to verify the validity of their vote. + - `voteAuthority` - An authority associated with the vote account used to produce the block. + - `type` - The type of the block. It can be used to differentiate between regular blocks and special + blocks such as snapshot or transaction confirmation blocks. + - `program` - The data associated with the program that was executed in the block's transactions. + - `programId` - The public key of the program that was executed in the block's transactions. + - `stackHeight` - The current depth of the execution stack. + - `recentBlockhash` - The recent block hash for the account's cluster. + - `signatures` - The list of transaction signatures contained within a particular block. +- `version` - The transaction version. Returns `undefined` if` maxSupportedTransactionVersion` is not set in the requested parameters. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getBlock", "params": [333290000, {"encoding": "json", "maxSupportedTransactionVersion": 0, "transactionDetails": "full", "rewards": false}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "blockHeight": 359639279, + "blockTime": 1743651773, + "blockhash": "6m5rEYueCyWK54JQ9tNLJ7ZLMYQsQ5HFjySZgt2FjaV2", + "parentSlot": 371661599, + "previousBlockhash": "AGX8AvrjGJouXLwAoqEVLABfHMqeyGdVHw8zacsG4Dit", + "transactions": [ + { + "meta": { + "computeUnitsConsumed": 2100, + "err": null, + "fee": 5000, + "innerInstructions": [], + "loadedAddresses": { + "readonly": [], + "writable": [] + }, + "logMessages": [ + "Program Vote111111111111111111111111111111111111111 invoke [1]", + "Program Vote111111111111111111111111111111111111111 success" + ], + "postBalances": [ + 7221320288943, + 10172781085509212, + 1 + ], + "postTokenBalances": [], + "preBalances": [ + 7221320293943, + 10172781085509212, + 1 + ], + "preTokenBalances": [], + "rewards": null, + "status": { + "Ok": null + } + }, + "transaction": { + "message": { + "accountKeys": [ + "dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92", + "5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN", + "Vote111111111111111111111111111111111111111" + ], + "header": { + "numReadonlySignedAccounts": 0, + "numReadonlyUnsignedAccounts": 1, + "numRequiredSignatures": 1 + }, + "instructions": [ + { + "accounts": [1, 0], + "data": "67MGmzAKuQPwzeYjrCpiDrjsgJk2cKGAWHeYYXr5hJVLwo11193dCcRDeWHENT2mB8qxgRnFXXpyXdm2WR7c9R2Gdn1ZTJiC4s7voQNfLo5hEiGrHbW5C15Ru6W9zSx7tLJSBgdUVeeNa6cp3FhJtfA5vChhLo54eVuQERTEfU3YSaSRAyCciNpEXUVmiWtrVY9fDEznum", + "programIdIndex": 2, + "stackHeight": null + } + ], + "recentBlockhash": "AGX8AvrjGJouXLwAoqEVLABfHMqeyGdVHw8zacsG4Dit" + }, + "signatures": [ + "4LYx3ESTTTiD3DSJ8TmDrEHQNEJHM9WWbKw4bz6GrguJ7Eon4MAepRWZZyaaJ57agxhss9HeaUhgXVurDCp3pi8H" + ] + }, + "version": "legacy" + ... + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblockcommitment.mdx b/services/reference/solana/json-rpc-methods/getblockcommitment.mdx new file mode 100644 index 00000000000..0ef18776ca4 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblockcommitment.mdx @@ -0,0 +1,63 @@ +--- +title: "getBlockCommitment" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlockCommitment` + +Returns the commitment for a block identified by the given slot number. + +## Parameters + +`slot`: (integer) _[required]_ - The slot number of the block to query. + + +## Returns + +`result` - An object with the following fields: + +- `commitment` - The commitment values for the block. Returns either: + - `null` if the block is not found. + - Array of `u64` integers logging the amount of cluster stake in lamports that has voted on the + block at each depth from `0` to `MAX_LOCKOUT_HISTORY`. +- `totalStake` - The total number of lamports being used by validators to participate in the block production + and voting process + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getBlockCommitment", "params": [5]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "commitment": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 10, 32 + ], + "totalStake": 42 + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblockheight.mdx b/services/reference/solana/json-rpc-methods/getblockheight.mdx new file mode 100644 index 00000000000..1363f63c97b --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblockheight.mdx @@ -0,0 +1,55 @@ +--- +title: "getBlockHeight" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlockHeight` + +Returns the current block height. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result`: (integer) - The current block height in `u64` format. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getBlockHeight", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": 359660979, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblockproduction.mdx b/services/reference/solana/json-rpc-methods/getblockproduction.mdx new file mode 100644 index 00000000000..28f3485da5a --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblockproduction.mdx @@ -0,0 +1,90 @@ +--- +title: "getBlockProduction" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlockProduction` + +Returns recent block production information from the current or previous epoch. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `range`: (array) _[optional]_ - Slot range to return block production for. If not provided, defaults to current epoch. + - `firstSlot`: (integer) _[optional]_ - The first slot in the range. + - `lastSlot`: (integer) _[optional]_ - The last slot in the range. + - `identity`: (string) _[optional]_ - Only return results for this `base58` encoded validator identity. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object containing block production information: + - `byIdentity` - A dictionary of validator identities, as `base58` encoded strings. This is a two + element array containing the number of leader slots and the number of blocks produced. + - `range` - The block production slot range: + - `firstSlot` - The first slot of the block production information (inclusive). + - `lastSlot` - The last slot of the block production information (inclusive). + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getBlockProduction", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 371687291 + }, + "value": { + "byIdentity": { + "3zvXem8vqvDYos6BKu66FV84tmDdQwgLxYSempy8tSrs": [ + 584, + 584 + ], + ... + "dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB": [ + 40400, + 40400 + ] + }, + "range": { + "firstSlot": 371520000, + "lastSlot": 371687291 + } + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblocks.mdx b/services/reference/solana/json-rpc-methods/getblocks.mdx new file mode 100644 index 00000000000..3c09a2f0dbe --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblocks.mdx @@ -0,0 +1,59 @@ +--- +title: "getBlocks" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlocks` + +Returns a list of confirmed blocks between two given slots. + +## Parameters + +- `startSlot`: (integer) _[required]_ - The starting slot number for the range of blocks to query. +- `endSlot`: (integer) _[optional]_ - The ending slot number for the range of blocks to query. + Must be no more than 500,000 blocks higher than `startSlot`. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + + + +## Returns + +`result`: (integer) - An array of `u64` integers representing the block numbers within the specified range. If `endSlot` is not +provided, the method will return blocks starting from `startSlot` to the most recent block. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id":1, "method":"getBlocks", "params":[371661723, 371661733]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":[371661723,371661724,371661725,371661726,371661727,371661728,371661729,371661730,371661731,371661732,371661733], + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getblockswithlimit.mdx b/services/reference/solana/json-rpc-methods/getblockswithlimit.mdx new file mode 100644 index 00000000000..694f1ac09df --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getblockswithlimit.mdx @@ -0,0 +1,56 @@ +--- +title: "getBlocksWithLimit" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getBlocksWithLimit` + +Returns a list of confirmed blocks starting at the given slot, up to the specified limit. + +## Parameters + +- `startSlot`: (integer) _[required]_ - The starting slot number for the range of blocks to query. +- `limit`: (integer) _[required]_ - The maximum number of confirmed blocks to return, starting from the specified slot. + Must be no more than 500,000 blocks higher than `startSlot`. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + +## Returns + +`result`: (integer) - An array of `u64` integers representing the block numbers from the `startSlot` up to the specified `limit`. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id":1, "method":"getBlocksWithLimit", "params":[371661723, 10]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":[371661723,371661724,371661725,371661726,371661727,371661728,371661729,371661730,371661731,371661732], + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getclusternodes.mdx b/services/reference/solana/json-rpc-methods/getclusternodes.mdx new file mode 100644 index 00000000000..88c8b96fb64 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getclusternodes.mdx @@ -0,0 +1,75 @@ +--- +title: "getClusterNodes" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getClusterNodes` + +Returns information about all the nodes participating in the cluster. + +## Parameters + +None + +## Returns + +`result`: An array of objects with the following fields: + +- `featureSet` - The unique identifier of the node's feature set. +- `gossip` - The gossip network address for the node. +- `pubkey` - The public key of the node encoded as `base58` string. +- `rpc` -The IP address and port number of the node's JSON-RPC service. `nul`` if the JSON-RPC service is disabled. +- `shredVersion` - The version of the data structure used by this node to store and transmit blocks. +- `tpu` - The TPU network address for the node. +- `version` - The software version of the node. `null` if the version information is unavailable. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id":1, "method":"getClusterNodes"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "featureSet": 3294202862, + "gossip": "208.91.107.3:8001", + "pubkey": "8GFyFHMa8oobGzK6Bab1qdExMqjvQoFeHYTpkfJiR8NH", + "pubsub": null, + "rpc": null, + "serveRepair": "208.91.107.3:8013", + "shredVersion": 2405, + "tpu": "208.91.107.3:8004", + "tpuForwards": "208.91.107.3:8005", + "tpuForwardsQuic": "208.91.107.3:8011", + "tpuQuic": "208.91.107.3:8010", + "tpuVote": "208.91.107.3:8006", + "tvu": "208.91.107.3:8002", + "version": "2.2.3" + }, + ... + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getepochinfo.mdx b/services/reference/solana/json-rpc-methods/getepochinfo.mdx new file mode 100644 index 00000000000..5ae47f0261e --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getepochinfo.mdx @@ -0,0 +1,69 @@ +--- +title: "getEpochInfo" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getEpochInfo` + +Returns information about the current epoch. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: (integer) _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result`: An array of objects with the following fields: + +- `absoluteSlot` - The current slot. +- `blockHeight` - The current block height. +- `epoch` - The current epoch. +- `slotIndex` - The current slot relative to the start of the current epoch. +- `slotsInEpoch` - The number of slots in this epoch. +- `transactionCount` The total number of transactions processed during the current epoch. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "absoluteSlot": 371857300, + "blockHeight": 359834889, + "epoch": 860, + "slotIndex": 337300, + "slotsInEpoch": 432000, + "transactionCount": 15448034599 + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getepochschedule.mdx b/services/reference/solana/json-rpc-methods/getepochschedule.mdx new file mode 100644 index 00000000000..dfbf4bc5bc2 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getepochschedule.mdx @@ -0,0 +1,63 @@ +--- +title: "getEpochSchedule" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getEpochSchedule` + +Returns epoch schedule information from the cluster's genesis configuration. + +## Parameters + +None + +## Returns + +`result` - An object with the following fields: + +- `firstNormalEpoch` - The first normal length epoch. Calculated as `log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH)`. +- `firstNormalSlot` - The slot number of the first normal slot. Calculated as `MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1)`. +- `leaderScheduleSlotOffset` - The number of slots before starting an epoch to calculate a leader schedule for that epoch. +- `slotsPerEpoch` - The maximum number of slots in each epoch. +- `warmup` - Whether epochs start shorter and grow in length. During warmup (`true`) the epoch schedule starts small and + gradually increases to ease the network into normal operation, whereas without warmup (`false`), epochs have a + consistent length from the start. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getEpochSchedule"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "firstNormalEpoch": 0, + "firstNormalSlot": 0, + "leaderScheduleSlotOffset": 432000, + "slotsPerEpoch": 432000, + "warmup": false + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getfeeformessage.mdx b/services/reference/solana/json-rpc-methods/getfeeformessage.mdx new file mode 100644 index 00000000000..19348ca58a0 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getfeeformessage.mdx @@ -0,0 +1,67 @@ +--- +title: "getFeeForMessage" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getFeeForMessage` + +Returns the fee the network will charge for a specified message. + +## Parameters + +- `message`: (string) _[required]_ - The `base64` encoded transaction message. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: (integer) _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - `null` when the block doesn't exist, or an object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - `null`, or the fee for the specified message. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getFeeForMessage", "params": ["AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA", {"commitment": "processed"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.1.11", + "slot": 320142245 + }, + "value": null + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getfirstavailableblock.mdx b/services/reference/solana/json-rpc-methods/getfirstavailableblock.mdx new file mode 100644 index 00000000000..c9b53d4036e --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getfirstavailableblock.mdx @@ -0,0 +1,49 @@ +--- +title: "getFirstAvailableBlock" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getFirstAvailableBlock` + +Returns the slot of the lowest confirmed block that has not been purged from the ledger. + +## Parameters + +None + +## Returns + +`result`: (integer) - The slot of the lowest confirmed block as a 64-bit unsigned integer. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getFirstAvailableBlock"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":116113408, + "id":1 +} + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getgenesishash.mdx b/services/reference/solana/json-rpc-methods/getgenesishash.mdx new file mode 100644 index 00000000000..48d4300250e --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getgenesishash.mdx @@ -0,0 +1,49 @@ +--- +title: "getGenesisHash" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getGenesisHash` + +Returns the genesis hash for the network. + +## Parameters + +None + +## Returns + +`result`: (string) - The hash encoded as a `base58` string. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getGenesisHash"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":"EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG", + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gethealth.mdx b/services/reference/solana/json-rpc-methods/gethealth.mdx new file mode 100644 index 00000000000..754ad8eccac --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gethealth.mdx @@ -0,0 +1,49 @@ +--- +title: "getHealth" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getHealth` + +Returns the health of the node. + +## Parameters + +None + +## Returns + +`result`: (string) - `Ok` if the node is healthy, or a JSON-RPC error response if the node is unhealthy. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getHealth"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": "ok", + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gethighestsnapshotslot.mdx b/services/reference/solana/json-rpc-methods/gethighestsnapshotslot.mdx new file mode 100644 index 00000000000..7bc2374f609 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gethighestsnapshotslot.mdx @@ -0,0 +1,58 @@ +--- +title: "getHighestSnapshotSlot" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getHighestSnapshotSlot` + +Returns information for the highest slot that the node has a snapshot for. + +This will find the highest full snapshot slot, and the highest incremental snapshot slot based on the +full snapshot slot, if there is one. + +## Parameters + +None + +## Returns + +`result` - An object with the following fields: + +- `full`: - The highest full snapshot slot encoded as a `u64` integer. +- `incremental`: The highest incremental snapshot slot derived from the full snapshot. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getHighestSnapshotSlot"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "full":372722782, + "incremental":372732282 + }, + "id":1 +} + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getidentity.mdx b/services/reference/solana/json-rpc-methods/getidentity.mdx new file mode 100644 index 00000000000..dc4f9b52257 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getidentity.mdx @@ -0,0 +1,53 @@ +--- +title: "getIdentity" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getIdentity` + +Returns the public key identity of the current node. + +## Parameters + +None + +## Returns + +`result` - An object with the following fields: + +- `identity` - The public key identity as a `base58` encoded string. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getIdentity"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "identity":"5UHT2MnFvARGe5mGbKZth5Yh546UWmPtucQYBGTYsi4n" + }, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getinflationgovernor.mdx b/services/reference/solana/json-rpc-methods/getinflationgovernor.mdx new file mode 100644 index 00000000000..a2564880e58 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getinflationgovernor.mdx @@ -0,0 +1,67 @@ +--- +title: "getInflationGovernor" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getInflationGovernor` + +Returns the current inflation governor, which controls the inflation rate in the network. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - An object with the following fields: + +- `foundation` - The proportion of total inflation allocated to the foundation. +- `foundationTerm` - The period in years during which the foundation allocation will be paid out. +- `initial` - The initial inflation percentage from time (`0`). +- `taper` - The period in years during which the inflation rate will gradually decrease from the + initial rate to the final rate. +- `terminal` - The terminal inflation percentage. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getInflationGovernor"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "foundation":0.0, + "foundationTerm":0.0, + "initial":0.08, + "taper":0.15, + "terminal":0.015 + }, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getinflationrate.mdx b/services/reference/solana/json-rpc-methods/getinflationrate.mdx new file mode 100644 index 00000000000..8d2c6cccff8 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getinflationrate.mdx @@ -0,0 +1,59 @@ +--- +title: "getInflationRate" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getInflationRate` + +Returns the specific inflation values for the current epoch. + +## Parameters + +None + +## Returns + +`result` - An object with the following fields: + +- `epoch` - The epoch during which these values remain valid. +- `foundation` - The proportion of total inflation allocated to the foundation. +- `total` - The total inflation. +- `validator` - The portion of inflation designated for validators. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getInflationRate"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "epoch":862, + "foundation":0.0, + "total":0.0385971617307845, + "validator":0.0385971617307845 + }, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getinflationreward.mdx b/services/reference/solana/json-rpc-methods/getinflationreward.mdx new file mode 100644 index 00000000000..84b431f06d6 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getinflationreward.mdx @@ -0,0 +1,71 @@ +--- +title: "getInflationReward" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getInflationReward` + +Returns the inflation (staking) rewards for a list of addresses for an epoch. + +## Parameters + +- `array`: (string) _[requiredl]_ - An array of `base58` encoded addresses to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `epoch`: (integer) _[optional]_ - The epoch for which to query the rewards. If not specified, the current epoch is used. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - An object with the following fields: + +- `epoch` - The epoch during which the reward was received. +- `effectiveSlot` - The slot at which the rewards become active. +- `amount` - The reward value in lamports. +- `postBalance` - The account balance after the transaction in lamports. +- `commission` - The commission rate of the vote account at the time the reward was credited. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method": "getInflationReward", "params": [["6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"], {"epoch": 2}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "epoch": 2, + "effectiveSlot": 224, + "amount": 2500, + "postBalance": 499999442500 + }, + null + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getlargestaccounts.mdx b/services/reference/solana/json-rpc-methods/getlargestaccounts.mdx new file mode 100644 index 00000000000..3cb831b7dac --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getlargestaccounts.mdx @@ -0,0 +1,74 @@ +--- +title: "getLargestAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getLargestAccounts` + +Returns the 20 largest accounts, by lamport balance. Results may be cached up to two hours. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `filter`: (string) _[optional]_ - Filters results by account type. Supported options are `circulating` and `nonCirculating`. + +## Returns + +`result` - `null` when the account doesn't exist, or an object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object containing the following keys: + - `address` - The `base58` encoded account address. + - `lamports` - The number of lamports in the account. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method": "getLargestAccounts", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { "slot": 54 }, + "value": [ + { + "address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ", + "lamports": 999974 + }, + { + "address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL", + "lamports": 42 + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getlatestblockhash.mdx b/services/reference/solana/json-rpc-methods/getlatestblockhash.mdx new file mode 100644 index 00000000000..b6650af3fa5 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getlatestblockhash.mdx @@ -0,0 +1,71 @@ +--- +title: "getLatestBlockhash" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getLatestBlockhash` + +Returns the latest block hash. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object containing the following keys: + - `blockhash` - The `base58` encoded block hash. + - `lastValidBlockHeight` - The last block height at which the block hash will be valid. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method": "getLatestBlockhash", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 372758352 + }, + "value": { + "blockhash": "4zuGA4EyEjaN25qMVnwwij4UMRWcmEpFn1txrzMMk5xw", + "lastValidBlockHeight": 360735720 + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getleaderschedule.mdx b/services/reference/solana/json-rpc-methods/getleaderschedule.mdx new file mode 100644 index 00000000000..83b0e6d3788 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getleaderschedule.mdx @@ -0,0 +1,68 @@ +--- +title: "getLeaderSchedule" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getLeaderSchedule` + +Returns the leader schedule for an epoch. + +## Parameters + +- `slot`: (integer) _[optional]_ - The slot number to query. The method returns the leader schedule + for the epoch that corresponds to the provided slot. If unspecified, returns the leader schedule for + the current epoch. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `identity`: (string) _[optional]_ - Only return results for this `base58` encoded validator identity. + +## Returns + +`result` - `null` if the requested epoch is not found; otherwise, an object of `base58` encoded validator +identities, and their corresponding leader slot indices as values (indices are relative to the first slot in the requested epoch). + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getLeaderSchedule", "params":[{"identity":"3zvXem8vqvDYos6BKu66FV84tmDdQwgLxYSempy8tSrs"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "3zvXem8vqvDYos6BKu66FV84tmDdQwgLxYSempy8tSrs": [ + 2816, + 2817, + 2818, + ... + 430998, + 430999 + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getmaxretransmitslot.mdx b/services/reference/solana/json-rpc-methods/getmaxretransmitslot.mdx new file mode 100644 index 00000000000..58fb1b30e5d --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getmaxretransmitslot.mdx @@ -0,0 +1,49 @@ +--- +title: "getMaxRetransmitSlot" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getMaxRetransmitSlot` + +Get the highest slot that the node has processed and retransmitted. + +## Parameters + +None + +## Returns + +`result` - The slot number as a 64-bit unsigned integer. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getMaxRetransmitSlot"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": 372797611, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getmaxshredinsertslot.mdx b/services/reference/solana/json-rpc-methods/getmaxshredinsertslot.mdx new file mode 100644 index 00000000000..555767ceb19 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getmaxshredinsertslot.mdx @@ -0,0 +1,49 @@ +--- +title: "getMaxShredInsertSlot" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getMaxShredInsertSlot` + +Get the maximum slot visible from after the shred insert. + +## Parameters + +None + +## Returns + +`result` - The slot number as a 64-bit unsigned integer. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getMaxShredInsertSlot"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result":372942171, + "id": 1 + } + ``` + + + diff --git a/services/reference/solana/json-rpc-methods/getminimumbalanceforrentexemption.mdx b/services/reference/solana/json-rpc-methods/getminimumbalanceforrentexemption.mdx new file mode 100644 index 00000000000..8a3965da1dc --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getminimumbalanceforrentexemption.mdx @@ -0,0 +1,56 @@ +--- +title: "getMinimumBalanceForRentExemption" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getMinimumBalanceForRentExemption` + +Returns the minimum balance (in lamports) required to make an account exempt from rent. + +## Parameters + +- `usize`: (integer) _[required]_ - The account's data length. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - The minimum lamports required in an account to remain rent free. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getMinimumBalanceForRentExemption", "params":[60]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result":1308480, + "id": 1 + } + ``` + + + + diff --git a/services/reference/solana/json-rpc-methods/getmultipleaccounts.mdx b/services/reference/solana/json-rpc-methods/getmultipleaccounts.mdx new file mode 100644 index 00000000000..7800b2658d6 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getmultipleaccounts.mdx @@ -0,0 +1,107 @@ +--- +title: "getMultipleAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getMultipleAccounts` + +Returns information associated with a list of accounts. + +## Parameters + +- `array`: (string) _[required]_ - An array of `base58` encoded account public keys to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed` + - `dataSlice`: (object) _[optional]_ - A slice of the account data to return. Only available for `base58`, `base64`, + or `base64+zstd` encoding. This is an object with two properties: + - `offset` - The starting byte offset of the slice. + - `length` - The length of the slice in bytes. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - List of account objects. Returns `null` if the account doesn't exist, or an object containing + the following keys for the requested account: + - `data` - The account data, encoded in the specified format. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports in the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": [["7cVfgArCheMR6Cs4t6vz5rfnqd56vZq4ndaBrY5xkxXy", "ANVUJaJoVaJZELtV2AvRp7V5qPV1B84o29zAwDhPj1c2"], {"encoding": "base58"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 372957980 + }, + "value": [ + { + "data": [ + "", + "base58" + ], + "executable": false, + "lamports": 6000000000, + "owner": "11111111111111111111111111111111", + "rentEpoch": 18446744073709552000, + "space": 0 + }, + { + "data": [ + "", + "base58" + ], + "executable": false, + "lamports": 3248020787, + "owner": "11111111111111111111111111111111", + "rentEpoch": 18446744073709552000, + "space": 0 + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getprogramaccounts.mdx b/services/reference/solana/json-rpc-methods/getprogramaccounts.mdx new file mode 100644 index 00000000000..68c3da0457d --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getprogramaccounts.mdx @@ -0,0 +1,89 @@ +--- +title: "getProgramAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getProgramAccounts` + +Returns all accounts owned by the provided program public key. + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the program to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed` + - `dataSlice`: (object) _[optional]_ - A slice of the account data to return. Only available for `base58`, `base64`, + or `base64+zstd` encoding. This is an object with two properties: + - `offset` - The starting byte offset of the slice. + - `length` - The length of the slice in bytes. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + - `withContext`: (boolean). Wraps the result in a JSON object. + - `filters` - Filter results using an array of up to 4 filter objects. + +## Returns + +`result` - An object with the following fields: + +- `pubkey` - The public key of the node encoded as `base58` string. +- `account` - An object with the following fields: + - `data` - The account data, encoded in the specified format. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports assigned to the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getProgramAccounts", "params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", {"filters": [{"dataSize": 17}, {"memcmp": {"offset": 4, "bytes": "3Mc6vR"}}]}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "account": { + "data": "2R9jLfiAQ9bgdcw6h8s44439", + "executable": false, + "lamports": 15298080, + "owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "rentEpoch": 28, + "space": 42 + }, + "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY" + } + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getrecentperformancesamples.mdx b/services/reference/solana/json-rpc-methods/getrecentperformancesamples.mdx new file mode 100644 index 00000000000..7925fa08dd9 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getrecentperformancesamples.mdx @@ -0,0 +1,86 @@ +--- +title: "getRecentPerformanceSamples" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getRecentPerformanceSamples` + +Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds +and include the number of transactions and slots that occur in a given time window. + +## Parameters + +- `limit`: (integer) - The number of samples to return (maximum 720). + +## Returns + +`result` - An object with the following fields: + +- `numNonVoteTransactions` - The number of non-vote transactions during the specified sample period. +- `numSlots` - The number of slots in the sample. +- `numTransactions` - The number of transactions in the sample. +- `samplePeriodSecs` - The number of seconds in the sample window. +- `slot` - The slot in which the sample was taken at. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getRecentPerformanceSamples", "params": [4]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "numNonVoteTransactions": 4255, + "numSlots": 156, + "numTransactions": 6751, + "samplePeriodSecs": 60, + "slot": 372969680 + }, + { + "numNonVoteTransactions": 5486, + "numSlots": 156, + "numTransactions": 7980, + "samplePeriodSecs": 60, + "slot": 372969524 + }, + { + "numNonVoteTransactions": 4069, + "numSlots": 154, + "numTransactions": 6532, + "samplePeriodSecs": 60, + "slot": 372969368 + }, + { + "numNonVoteTransactions": 3760, + "numSlots": 155, + "numTransactions": 6224, + "samplePeriodSecs": 60, + "slot": 372969214 + } + ], + "id": 1 + } + ``` + + + + diff --git a/services/reference/solana/json-rpc-methods/getrecentprioritizationfees.mdx b/services/reference/solana/json-rpc-methods/getrecentprioritizationfees.mdx new file mode 100644 index 00000000000..262bf18724a --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getrecentprioritizationfees.mdx @@ -0,0 +1,63 @@ +--- +title: "getRecentPrioritizationFees" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getRecentPrioritizationFees` + +Returns a list of prioritization fees from recent blocks. + +## Parameters + +- `address`: (array) _[optional]_ - Array of account addresses (up to a maximum of 128 addresses), as `base58` encoded strings. + +## Returns + +`result` - An array of objects with the following fields: + +- `prioritizationFee` - The prioritization fee value. +- `slot` - The slot number associated with the prioritization fee. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getRecentPrioritizationFees", "params": [["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "prioritizationFee": 0, + "slot": 372976610 + }, + ... + { + "prioritizationFee": 0, + "slot": 372976759 + } + ], + "id": 1 + } + ``` + + + + diff --git a/services/reference/solana/json-rpc-methods/getsignaturesforaddress.mdx b/services/reference/solana/json-rpc-methods/getsignaturesforaddress.mdx new file mode 100644 index 00000000000..2a49fafd003 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getsignaturesforaddress.mdx @@ -0,0 +1,83 @@ +--- +title: "getSignaturesForAddress" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSignaturesForAddress` + +Returns signatures for confirmed transactions that include the specified address in the `accountKeys` list. +Results are returned in reverse chronological order, starting from the provided signature or the most recent confirmed block. + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the account to query. + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + - `limit`: (number) _[optional]_ - The maximum number of signatures to return (between `1` and `1000`). + The default is `1000`. + - `before`: (string) _[optional]_ - Starts searching backward from the specified transaction signature. + If not provided, the search begins from the most recent confirmed block. + - `until`: (string) _[optional]_ - The signature to end the query at (if found before reaching `limit`). + +## Returns + +`result` - An object with the following fields: + +- `blockTime` - The estimated production time, as Unix timestamp (seconds since the Unix epoch). `null` if not available. +- `confirmationStatus` - The transaction's cluster confirmation status. The status can be `processed`, `confirmed`, or `finalized`. +- `err` - Error code if the transaction failed, or `null` if the transaction succeeds. +- `memo` - The memo associated with the transaction, or `null` if no memo is present. +- `signature` - The `base58` encoded signature of the transaction. +- `slot` - The slot number in which the transaction was confirmed. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSignaturesForAddress", "params": ["Vote111111111111111111111111111111111111111", {"limit": 1}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + { + "blockTime": 1744177112, + "confirmationStatus": "finalized", + "err": null, + "memo": null, + "signature": "2QYQGurkeT9CwdMTnMNTETbqwU4NiLoB8kqA4KxVUu4vV1BWxw79YfzWAWpPduqA2zmxgbunyrPZtCbDR7LCmTZr", + "slot": 373019515 + } + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getsignaturestatuses.mdx b/services/reference/solana/json-rpc-methods/getsignaturestatuses.mdx new file mode 100644 index 00000000000..17938e1d7bf --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getsignaturestatuses.mdx @@ -0,0 +1,77 @@ +--- +title: "getSignatureStatuses" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSignatureStatuses` + +Returns the statuses of a list of signatures. Unless the `searchTransactionHistory` configuration parameter +is included, this method only searches the recent status cache of signatures, which retains statuses for +all active slots plus `MAX_RECENT_BLOCKHASHES` rooted slots. + +## Parameters + +- `txSignatures`: (array of strings) _[required]_ - An array of `base58` encoded transaction signatures to confirm. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `searchTransactionHistory`: boolean - If `true`, the search includes the entire transaction + history. If `false`, the search only includes recent transactions in the latest confirmed block. + The default is `false`. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An array of objects containing the following keys, or `null` if the signature is not found: + - `confirmationStatus` - The transaction's cluster confirmation status. It can either be `processed`, `confirmed`, or `finalized`. + - `confirmations` - The number of confirmations a transaction has received. If the transaction is + `finalized` (confirmed at the highest level of commitment), the value will be `null`. + - `err` - Error code if the transaction failed, or `null` if the transaction succeeds. + - `slot` - The slot number in which the transaction was confirmed. + - `status` - The processing status of the transaction. It returns `Ok` if the transaction was successful + and `Err` if the transaction failed. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSignatureStatuses", "params": [["5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"], {"searchTransactionHistory": true}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 373170033 + }, + "value": [null] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getslot.mdx b/services/reference/solana/json-rpc-methods/getslot.mdx new file mode 100644 index 00000000000..66a552c5800 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getslot.mdx @@ -0,0 +1,55 @@ +--- +title: "getSlot" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSlot` + +Returns the latest slot that has reached the commitment level + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result`: (integer) - The current slot. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSlot", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result":373175194, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getslotleader.mdx b/services/reference/solana/json-rpc-methods/getslotleader.mdx new file mode 100644 index 00000000000..3b52236857d --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getslotleader.mdx @@ -0,0 +1,55 @@ +--- +title: "getSlotLeader" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSlotLeader` + +Returns the current slot leader. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result`: (string) - The slot leader's `base58` encoded public key address. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSlotLeader", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result":"dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB", + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getslotleaders.mdx b/services/reference/solana/json-rpc-methods/getslotleaders.mdx new file mode 100644 index 00000000000..1f161d75272 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getslotleaders.mdx @@ -0,0 +1,56 @@ +--- +title: "getSlotLeaders" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSlotLeaders` + +Returns the slot leaders for a given slot range. + +## Parameters + +- `startSlot`: (integer) _[required]_ - The starting slot number for the query.` +- `limit`: (integer) _[required]_ - The maximum number of slot leaders to return (`1` to `5000`). + +## Returns + +`result`: (array of strings) - An array of `base58` encoded public key addresses identifying the slot leaders. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSlotLeaders", "params": [373184397, 5]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": [ + "dv3qDFk1DTF36Z62bNvrCXe9sKATA6xvVy6A798xxAS", + "dv3qDFk1DTF36Z62bNvrCXe9sKATA6xvVy6A798xxAS", + "dv3qDFk1DTF36Z62bNvrCXe9sKATA6xvVy6A798xxAS", + "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV", + "dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV" + ], + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getstakeminimumdelegation.mdx b/services/reference/solana/json-rpc-methods/getstakeminimumdelegation.mdx new file mode 100644 index 00000000000..ea2b25271aa --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getstakeminimumdelegation.mdx @@ -0,0 +1,65 @@ +--- +title: "getStakeMinimumDelegation" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getStakeMinimumDelegation` + +Returns the minimum number of lamports required to delegate a stake account. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - The minimum number of lamports required to delegate a stake account. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0","id":1,"method":"getStakeMinimumDelegation","params":[]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 373193193 + }, + "value": 1 + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getsupply.mdx b/services/reference/solana/json-rpc-methods/getsupply.mdx new file mode 100644 index 00000000000..96803162399 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getsupply.mdx @@ -0,0 +1,79 @@ +--- +title: "getSupply" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getSupply` + +Returns information about the current token supply. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `total` - The total supply of lamports in the network. + - `circulating` - The circulating supply of lamports in the network. + - `nonCirculating` - The non-circulating supply of lamports in the network. + - `nonCirculatingAccounts` - An array of account addresses that hold non-circulating lamports. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getSupply", "params": []}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.2.3", + "slot": 373204187 + }, + "value": { + "circulating": 967687939079885400, + "nonCirculating": 315864946585692700, + "nonCirculatingAccounts": [ + "Bzr4raUumaTNeqhMjvWYaF2Zm2gQwgFCDbVwcCNjNcT8", + "9NFMpkv65d2G7UMMFYHeXrBAaB6rVD3BgQ95bKiwr448", + ... + "3RQvfXbzQQBT4PymcwrBPtSLVuEpK79NuPAt8k4PhrXe" + ], + "total": 1283552885665578200 + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettokenaccountbalance.mdx b/services/reference/solana/json-rpc-methods/gettokenaccountbalance.mdx new file mode 100644 index 00000000000..9c8b7fdf401 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettokenaccountbalance.mdx @@ -0,0 +1,79 @@ +--- +title: "getTokenAccountBalance" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenAccountBalance` + +Returns the token balance of an SPL token account. + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the token account to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - An object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `amount` - The raw total token supply without decimals, a string representation of a 64-bit unsigned integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - Deprecated. The total token supply using mint-prescribed decimals. + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getTokenAccountBalance", "params": ["3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.1.16", + "slot": 332462945 + }, + "value": { + "amount": "344068629195906", + "decimals": 6, + "uiAmount": 344068629.195906, + "uiAmountString": "344068629.195906" + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettokenaccountsbydelegate.mdx b/services/reference/solana/json-rpc-methods/gettokenaccountsbydelegate.mdx new file mode 100644 index 00000000000..79066c2d68b --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettokenaccountsbydelegate.mdx @@ -0,0 +1,138 @@ +--- +title: "getTokenAccountsByDelegate" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenAccountsByDelegate` + +Retrieves all SPL token accounts for which a specified delegate has been approved. + +## Parameters + +- `address`: (string) _[required]_ - The `base58` encoded public key of the delegate account to query. +- `accountDetails`: (object) _[required]_ - An object containing one the following fields: + - `mint`: (string) _[optional]_ - The `base58` encoded public key of the mint account. + - `programId`: (string) _[optional]_ - The `base58` encoded public key of the token program that owns the account. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed` + - `dataSlice`: (object) _[optional]_ - A slice of the account data to return. Only available for `base58`, `base64`, + or `base64+zstd` encoding. This is an object with two properties: + - `offset` - The starting byte offset of the slice. + - `length` - The length of the slice in bytes. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - An array of objects with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `pubkey` - The `base58` encoded public key of the token account. + - `account` - An object containing the address used to store assets: + - `data` - An object containing token state data associated with the account, either as + encoded binary data or in JSON format: + - `program` The program that manages the token. + - `parsed` - An array of parsed instructions that were executed in the block's transactions: + - `info` - An array of objects that provide additional details about the transactions in the block: + - `tokenAmount` - The balance of the token in the token account. + - `amount` - The raw total token supply without decimals, a string representation of a u64 integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - The total token supply using mint-prescribed decimals (DEPRECATED). + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + - `isNative` - A boolean value indicating whether the token is a native token of the Solana blockchain. + - `mint` - Provides information about the creation of new tokens. + - `owner` - The base-58 encoded Pubkey of the program this account has been assigned to. + - `state` - The current state of the token account. + - `type` - The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks. + - `space` - The amount of storage space required to store the token account. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports in the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByDelegate", "params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", {"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}, {"encoding": "jsonParsed"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { "slot": 1114 }, + "value": [ + { + "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp", + "account": { + "data": { + "program": "spl-token", + "parsed": { + "info": { + "tokenAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "delegatedAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "state": "initialized", + "isNative": false, + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", + "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD" + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 1726080, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 4, + "space": 165 + } + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettokenaccountsbyowner.mdx b/services/reference/solana/json-rpc-methods/gettokenaccountsbyowner.mdx new file mode 100644 index 00000000000..1dcb809b90f --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettokenaccountsbyowner.mdx @@ -0,0 +1,137 @@ +--- +title: "getTokenAccountsByOwner" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenAccountsByOwner` + +Retrieves all SPL token accounts for the specified token owner. + +## Parameters + +- `address`: (string) _[required]_ - The `base58` encoded public key of the account owner to query. +- `accountDetails`: (object) _[required]_ - An object containing one the following fields: + - `mint`: (string) _[optional]_ - The `base58` encoded public key of the mint account. + - `programId`: (string) _[optional]_ - The `base58` encoded public key of the token program that owns the account. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed` + - `dataSlice`: (object) _[optional]_ - A slice of the account data to return. Only available for `base58`, `base64`, + or `base64+zstd` encoding. This is an object with two properties: + - `offset` - The starting byte offset of the slice. + - `length` - The length of the slice in bytes. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - An array of objects with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `pubkey` - The `base58` encoded public key of the account. + - `account` - An object containing the address used to store assets: + - `data` - An object containing state data associated with the account, either as + encoded binary data or in JSON format: + - `program` The program that manages the token. + - `parsed` - An array of parsed instructions that were executed in the block's transactions: + - `info` - An array of objects that provide additional details about the transactions in the block: + - `tokenAmount` - The balance of the token in the account. + - `amount` - The raw total token supply without decimals, a string representation of a u64 integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - The total token supply using mint-prescribed decimals (DEPRECATED). + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + - `delegate` - The public address of the delegate from which the account tokens are to be retrieved encoded as base-58 string. + - `delegateAmount` The configuration object with the following fields: + - `amount` - The raw total token supply without decimals, a string representation of a u64 integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - The total token supply using mint-prescribed decimals (DEPRECATED). + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + - `isNative` - A boolean value indicating whether the token is a native token of the Solana blockchain. + - `mint` - Provides information about the creation of new tokens. + - `owner` - The base-58 encoded Pubkey of the program this account has been assigned to. + - `state` - The current state of the token account. + - `type` - The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks. + - `space` - The amount of storage space required to store the token account. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports in the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByOwner", "params": ["A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd", {"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}, {"encoding": "jsonParsed"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { "apiVersion": "2.0.15", "slot": 341197933 }, + "value": [ + { + "pubkey": "BGocb4GEpbTFm8UFV2VsDSaBXHELPfAXrvd4vtt8QWrA", + "account": { + "data": { + "program": "spl-token", + "parsed": { + "info": { + "isNative": false, + "mint": "2cHr7QS3xfuSV8wdxo3ztuF4xbiarF6Nrgx3qpx3HzXR", + "owner": "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd", + "state": "initialized", + "tokenAmount": { + "amount": "420000000000000", + "decimals": 6, + "uiAmount": 420000000.0, + "uiAmountString": "420000000" + } + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 2039280, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 18446744073709551615, + "space": 165 + } + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettokenlargestaccounts.mdx b/services/reference/solana/json-rpc-methods/gettokenlargestaccounts.mdx new file mode 100644 index 00000000000..ad7260eb698 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettokenlargestaccounts.mdx @@ -0,0 +1,92 @@ +--- +title: "getTokenLargestAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenLargestAccounts` + +Returns the 20 largest accounts holding a specified SPL token type. + +## Parameters + +- `address`: (string) _[required]_ - The `base58` encoded public key of the token mint to query. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result` - An array of objects with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `address` - The address of the token account. + - `amount` - The raw total token supply without decimals, a string representation of a `u64` integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - Deprecated. The total token supply using mint-prescribed decimals. + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + + +## Example + +Replace `` with your API key. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getTokenLargestAccounts", "params": ["1YDQ35V8g68FGvcT85haHwAXv1U7XMzuc4mZeEXfrjE"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.1.16", + "slot": 332646796 + }, + "value": [ + { + "address": "GFpkRJXUBNDWXENKAJ1dkYq4kYpHyNmgbifZbHsXXz4x", + "amount": "12", + "decimals": 0, + "uiAmount": 12, + "uiAmountString": "12" + }, + ... + { + "address": "GrxprwFYdFV4kdHjQDTWsdDFn9KtFn1p35rSZYDFgMkD", + "amount": "3", + "decimals": 0, + "uiAmount": 3, + "uiAmountString": "3" + } + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettokensupply.mdx b/services/reference/solana/json-rpc-methods/gettokensupply.mdx new file mode 100644 index 00000000000..f7a3f88162e --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettokensupply.mdx @@ -0,0 +1,74 @@ +--- +title: "getTokenSupply" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTokenSupply` + +Returns the total supply of an SPL token. + +## Parameters + +- `transaction`: (string) _[required]_ - The `base58` encoded transaction signature. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + +## Returns + +`result`- An object with the following fields: +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `amount` - The raw total token supply without decimals, a string representation of a `u64` integer. + - `decimals` - An integer value representing the number of decimal places used by the token. + - `uiAmount` - Deprecated. The total token supply using mint-prescribed decimals. + - `uiAmountString` - The total token supply as a string using mint-prescribed decimals. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"getTokenSupply", "params": ["7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { + "apiVersion": "2.1.16", + "slot": 332678924 + }, + "value": { + "amount": "5736490108605186363", + "decimals": 9, + "uiAmount": 5736490108.605186, + "uiAmountString": "5736490108.605186363" + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettransaction.mdx b/services/reference/solana/json-rpc-methods/gettransaction.mdx new file mode 100644 index 00000000000..0623d4cb50b --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettransaction.mdx @@ -0,0 +1,407 @@ +--- +title: "getTransaction" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTransaction` + +Returns transaction details for a confirmed transaction. + +## Parameters + +- `address`: (string) _[required]_ - The `base58` encoded program public key. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `maxSupportedTransactionVersion`: (integer) _[optional]_ - The maximum supported transaction version to return. + If the requested transaction contains a transaction with a higher version, an error will be returned. If this parameter + is omitted, only legacy transactions will be returned, and any versioned transaction will return an error. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `json`, and `jsonParsed`. The + default is `json`. + +## Returns + +`result`- `null` if the transaction is not found or not confirmed, otherwise returns an object containing: + +- `slot` - The slot this transaction was processed in. +- `blockTime` - The block time of the transaction as Unix timestamp (seconds since the Unix epoch). `null` if not available. + - `meta` - The transaction status metadata object, which contains additional information about the block and its + transactions. The meta object can be `null`, or it may contain the following fields: + - `err` - Error code if the transaction failed, or `null` if the transaction succeeds. + - `fee` - The total fees paid by all transactions in the block encoded as `u64` integer. + - `innerInstructions` - An array of objects representing the inner instructions of all transactions in the + block (omitted if inner instruction recording is disabled). Each object has the following fields: + - `logMessages` - An array of strings containing any log messages generated by the block's transactions + (omitted if inner instruction recording is disabled). + - `postBalances` - An array of lamport balances for each account in the block after the transactions were processed. + - `postTokenBalances` - An array of token balances for each token account in the block after the transactions were + processed (omitted if inner instruction recording is disabled): + - `accountIndex` - The index of an account within a transaction. + - `mint` - The mint address of the token. + - `owner` - The `base58` encoded public key of the program this account has been assigned to. + - `uiTokenAmount` - The amount of a token transfer. + - `amount` - The amount of the token transferred. + - `decimals` - The number of decimal places used by the token. + - `uiAmount` - The amount of the token transferred in the smallest unit of the token. + - `uiAmountString` - The amount of the token transferred with the appropriate number of decimal places for the token. + - `preBalances` - An array of lamport balances for each account in the block before the transactions were processed. + - `preTokenBalances` - An array of token balances for each token account in the block before the transactions were + processed (omitted if inner instruction recording is disabled): + - `accountIndex` - The index of an account within a transaction. + - `mint` - The mint address of the token. + - `owner` - The `base58` encoded public key of the program this account has been assigned to. + - `uiTokenAmount` - The amount of a token transfer. + - `amount` - The amount of the token transferred. + - `decimals` - The number of decimal places used by the token. + - `uiAmount` - The amount of the token transferred in the smallest unit of the token. + - `uiAmountString` - The amount of the token transferred with the appropriate number of decimal places for the token. + - `rewards` - An object containing information about the rewards earned by the block's validators + (only present if the rewards are requested). It has the following fields: + - `pubkey` - The public key of the account that received the award encoded as a `base58` string. + - `lamports` - The number of reward lamports credited or debited by the account. + - `postBalance` - The account balance in lamports after the reward was applied. + - `rewardType` - The type of reward. It could be `fee`, `rent`, `voting`, or `staking`. + - `commission` - The vote account commission when the reward was credited, only present for voting and staking rewards. + - `status` - The status of the transaction. It returns `Ok` if the transaction was successful, and `Err` + if the transaction failed. + - `transaction` - The transaction object. It could be either JSON format or encoded binary data, depending on the encoding parameter. + - `message` - An array of transaction objects included in the block: + - `accountKeys` - An array of public keys associated with the accounts that were accessed during + the execution of transactions in the block. + - `pubkey` - The public key associated with the block producer that created the block. + - `signer` - Indicates if the account is a required transaction signer. It can also be used to identify the signers + involved in the block's transactions and to verify the authenticity of the signatures. + - `source` - Identifies the accounts that provided the funds for the block's transactions. + - `writable` - A boolean value that indicates whether the accounts associated with the given public keys + were modified by the transactions or not. + - `instructions` - An array of instructions that were executed in the block's transactions + - `parsed` - An array of parsed instructions that were executed in the block's transactions + - `info` - An array of information objects that provide additional details about the transactions in the block. + - `clockSysvar` - Provides information about the current state of the blockchain. + - `slotHashesSysvar` - Provides information about the hashes of recent slots. + - `vote` - An array of vote accounts that were involved in the block's transactions. + - `hash` - The hash of the block. It can be used to uniquely identify the block and to verify the authenticity + of the block's contents. + - `slots` - An array of slot numbers that correspond to the transactions in the block. + - `timestamp` - The Unix timestamp of the block's creation. + - `voteAccount` - A vote account to identify the validator that produced the block and to verify the validity of their vote. + - `voteAuthority` - An authority associated with the vote account used to produce the block. + - `type` - The type of the block. It can be used to differentiate between regular blocks and special + blocks such as snapshot or transaction confirmation blocks. + - `program` - The data associated with the program that was executed in the block's transactions. + - `programId` - The public key of the program that was executed in the block's transactions. + - `stackHeight` - The current depth of the execution stack. + - `recentBlockhash` - The recent block hash for the account's cluster. + - `signatures` - The list of transaction signatures contained within a particular block. +- `version` - The version of the transaction. Returns `undefined` if `maxSupportedTransactionVersion` is not specified in the request. + + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0","id": 1,"method": "getTransaction","params": ["bVwuWqLs5wbHMHMavFfpK6zrg3mGY6AWVTNgdeDuWi1PxmFgvQYQJBMMcYp16fmJE9hwg4nNjDFok4rxmxQ6j5e",{"encoding": "jsonParsed","maxSupportedTransactionVersion":0}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "blockTime": 1744593547, + "meta": { + "computeUnitsConsumed": 52018, + "err": null, + "fee": 10000, + "innerInstructions": [ + { + "index": 2, + "instructions": [ + { + "parsed": { + "info": { + "authority": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "destination": "EXp2FCTRX9tPyyjLneE7K6YRgh9qpqKnQLecXdRFMQFL", + "mint": "So11111111111111111111111111111111111111112", + "source": "GscCpwDVJfJ9Qv1svzLWpend7hvJq3Syrfuwe5YzHbtp", + "tokenAmount": { + "amount": "10", + "decimals": 9, + "uiAmount": 1e-8, + "uiAmountString": "0.00000001" + } + }, + "type": "transferChecked" + }, + "program": "spl-token", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "stackHeight": 2 + }, + { + "parsed": { + "info": { + "authority": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "destination": "HTADwVNDuSxnzYyuwhfNyZAkaVCABnbNFZzEdcR35idy", + "mint": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "source": "CPg85jShyN1Tez437qgR1jYbF43i8aWhTMWpbPCJoJqE", + "tokenAmount": { + "amount": "2583", + "decimals": 6, + "uiAmount": 0.002583, + "uiAmountString": "0.002583" + } + }, + "type": "transferChecked" + }, + "program": "spl-token", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "stackHeight": 2 + } + ] + } + ], + "logMessages": [ + "Program 11111111111111111111111111111111 invoke [1]", + "Program 11111111111111111111111111111111 success", + "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]", + ... + "Program 11111111111111111111111111111111 success" + ], + "postBalances": [ + 1160000, + 10799119391, + ... + 5888160 + ], + "postTokenBalances": [ + { + "accountIndex": 3, + "mint": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "owner": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "uiTokenAmount": { + "amount": "173576140", + "decimals": 6, + "uiAmount": 173.57614, + "uiAmountString": "173.57614" + } + }, + { + "accountIndex": 12, + "mint": "So11111111111111111111111111111111111111112", + "owner": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "uiTokenAmount": { + "amount": "700864692413", + "decimals": 9, + "uiAmount": 700.864692413, + "uiAmountString": "700.864692413" + } + }, + { + "accountIndex": 13, + "mint": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "owner": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "uiTokenAmount": { + "amount": "201175021191002", + "decimals": 6, + "uiAmount": 201175021.191002, + "uiAmountString": "201175021.191002" + } + } + ], + "preBalances": [ + 1170000, + 10799139401, + ... + 5888160 + ], + "preTokenBalances": [ + { + "accountIndex": 3, + "mint": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "owner": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "uiTokenAmount": { + "amount": "173573816", + "decimals": 6, + "uiAmount": 173.573816, + "uiAmountString": "173.573816" + } + }, + { + "accountIndex": 12, + "mint": "So11111111111111111111111111111111111111112", + "owner": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "uiTokenAmount": { + "amount": "700864692403", + "decimals": 9, + "uiAmount": 700.864692403, + "uiAmountString": "700.864692403" + } + }, + { + "accountIndex": 13, + "mint": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "owner": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "uiTokenAmount": { + "amount": "201175021193585", + "decimals": 6, + "uiAmount": 201175021.193585, + "uiAmountString": "201175021.193585" + } + } + ], + "rewards": [], + "status": { + "Ok": null + } + }, + "slot": 333307946, + "transaction": { + "message": { + "accountKeys": [ + { + "pubkey": "AgkMbKTWCuiAaJ262TdpXhuMPvWa21GJmAmZfo6gLEPF", + "signer": true, + "source": "transaction", + "writable": true + }, + ... + { + "pubkey": "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "signer": false, + "source": "lookupTable", + "writable": false + } + ], + "addressTableLookups": [ + { + "accountKey": "CadRirmkx2CeeLd9LUtvF7D53822vrSt8PQULewPLm28", + "readonlyIndexes": [ + 2, + 0, + 5, + 4 + ], + "writableIndexes": [ + 1, + 9, + 10 + ] + } + ], + "instructions": [ + { + "parsed": { + "info": { + "base": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "lamports": 2039290, + "newAccount": "GscCpwDVJfJ9Qv1svzLWpend7hvJq3Syrfuwe5YzHbtp", + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "seed": "3JgKrBB3sagy1HMXai5hKbRnsuZZDudR", + "source": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "space": 165 + }, + "type": "createAccountWithSeed" + }, + "program": "system", + "programId": "11111111111111111111111111111111", + "stackHeight": null + }, + { + "parsed": { + "info": { + "account": "GscCpwDVJfJ9Qv1svzLWpend7hvJq3Syrfuwe5YzHbtp", + "mint": "So11111111111111111111111111111111111111112", + "owner": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "rentSysvar": "SysvarRent111111111111111111111111111111111" + }, + "type": "initializeAccount" + }, + "program": "spl-token", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "stackHeight": null + }, + { + "accounts": [ + "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL", + "D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2", + "CLhjQNAdhn6qZiCpDmiQFVNrhfMumDGEGMBrnVmk7wTR", + "GscCpwDVJfJ9Qv1svzLWpend7hvJq3Syrfuwe5YzHbtp", + "HTADwVNDuSxnzYyuwhfNyZAkaVCABnbNFZzEdcR35idy", + "EXp2FCTRX9tPyyjLneE7K6YRgh9qpqKnQLecXdRFMQFL", + "CPg85jShyN1Tez437qgR1jYbF43i8aWhTMWpbPCJoJqE", + "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", + "So11111111111111111111111111111111111111112", + "EyzgnBfHGe9hh169B8993muBVcoeURCnSgPbddBeSybo", + "d2jwtX1E47jw4EwxPK9VSVCmQsQpu4tzniNkzk43rF3" + ], + "data": "E73fXHPWvSR1nM1Tw5ZRioYHwnqN3caKH", + "programId": "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C", + "stackHeight": null + }, + { + "parsed": { + "info": { + "account": "GscCpwDVJfJ9Qv1svzLWpend7hvJq3Syrfuwe5YzHbtp", + "destination": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA", + "owner": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA" + }, + "type": "closeAccount" + }, + "program": "spl-token", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "stackHeight": null + }, + { + "parsed": { + "info": { + "destination": "ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt", + "lamports": 20000, + "source": "6FwAyRbvKwY4uAzgeWaXUHEqfSDaFcdcZsbBh1TQtnuA" + }, + "type": "transfer" + }, + "program": "system", + "programId": "11111111111111111111111111111111", + "stackHeight": null + } + ], + "recentBlockhash": "BRRXvTHndixZBzAacVfLkCfXX8X4jzrWdd9WKKsmTKG3" + }, + "signatures": [ + "bVwuWqLs5wbHMHMavFfpK6zrg3mGY6AWVTNgdeDuWi1PxmFgvQYQJBMMcYp16fmJE9hwg4nNjDFok4rxmxQ6j5e", + "3mSzNawWNP75KjSH3yyLyydBWaeEV7nJsWNHzJy5ThN4h2sv1vBbygwbLeRFU9zuoeBDVfqdU1tPpH2G9m8eFUFp" + ] + }, + "version": 0 + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/gettransactioncount.mdx b/services/reference/solana/json-rpc-methods/gettransactioncount.mdx new file mode 100644 index 00000000000..4e711616f54 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/gettransactioncount.mdx @@ -0,0 +1,55 @@ +--- +title: "getTransactionCount" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getTransactionCount` + +Returns the current transaction count from the ledger. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: (integer) _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` (integer): The current transaction count. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":394414196266, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getversion.mdx b/services/reference/solana/json-rpc-methods/getversion.mdx new file mode 100644 index 00000000000..516f626137c --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getversion.mdx @@ -0,0 +1,55 @@ +--- +title: "getVersion" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getVersion` + +Returns the Solana version running on the node. + +## Parameters + +None + +## Returns + +`result` - An object with the following fields: + +- `solana-core` - The version of the Solana core software. +- `feature-set` - ID of the software's feature set. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getVersion"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "feature-set":3271415109, + "solana-core":"2.1.16" + }, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/getvoteaccounts.mdx b/services/reference/solana/json-rpc-methods/getvoteaccounts.mdx new file mode 100644 index 00000000000..e09e8cf8733 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/getvoteaccounts.mdx @@ -0,0 +1,109 @@ +--- +title: "getVoteAccounts" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `getVoteAccounts` + +Returns the account info and associated stake for all the voting accounts in the current bank. + +## Parameters + +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `votePubkey`: (string) _[optional]_ - The `base58` encoded public key of the validator vote account to return results for. + - `keepUnstakedDelinquents`: (boolean) _[optional]_ - If `true`, the response includes all delinquent + accounts, even if they are not staked. + - `delinquentSlotDistance`: (integer) _[optional]_ - The number of slots that a validator must be behind to be considered delinquent. + It's not recommended to specify this parameter. + +## Returns + +`result` - An object of current and delinquent voting accounts with the following fields: +- `current` - An array of objects with the following fields: + - `activatedStake` - The amount of stake in lamports delegated to this vote account. + - `commission` - The commission rate for the validator as a percentage (0 - 100). + - `epochCredits` - An array of arrays containing the epoch, credits earned, and previous credits earned. + - `epochVoteAccount` - A boolean indicating if the account is staked for the current epoch. + - `lastVote` - The most recent slot voted on by this vote account. + - `nodePubkey` - The public key of the validator. + - `rootSlot` - The root slot number. + - `votePubkey` - The public key of the vote account. +- `delinquent` - An array of objects with the same fields as `current`, but for delinquent accounts. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "current": [ + { + "activatedStake": 21728348612276, + "commission": 0, + "epochCredits": [ + [ + 767, + 552326409, + 545429728 + ], + [ + 768, + 559219285, + 552326409 + ], + [ + 769, + 566108108, + 559219285 + ], + [ + 770, + 573001980, + 566108108 + ], + [ + 771, + 577049781, + 573001980 + ] + ], + "epochVoteAccount": true, + "lastVote": 333325355, + "nodePubkey": "W1FAbXyQJ5iPghy12TqPktwobU5kTD73ZjA6QZCvsRp", + "rootSlot": 333325324, + "votePubkey": "DXjujkbMhAvkaygmjLbi7UGdovAs2AU6y45UMEqxhEnw" + }, + ... + ] + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/index.md b/services/reference/solana/json-rpc-methods/index.md new file mode 100644 index 00000000000..d96d0a9a555 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/index.md @@ -0,0 +1,18 @@ +--- +title: "JSON-RPC methods" +description: Supported standard Ethereum methods on Solana network. +--- + +# JSON-RPC methods + +:::note Decentralized Infrastructure Network (DIN) +Solana is supported through the [DIN](https://www.infura.io/solutions/decentralized-infrastructure-service) service, +meaning calls to the network are routed to [partner infrastructure providers](../../solana/index.md#partners-and-privacy-policies). + +Solana access is currently limited to paid accounts. +To get expedited access, upgrade to a paid tier. Solana support will be available to all account tiers in the future. +::: + +Infura supports the standard Solana API methods and the +[Digital Asset Standard (DAS) API methods](./digital-asset-standard/index.md) +used to query digital assets. \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/isblockhashvalid.mdx b/services/reference/solana/json-rpc-methods/isblockhashvalid.mdx new file mode 100644 index 00000000000..abbcbc21c16 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/isblockhashvalid.mdx @@ -0,0 +1,63 @@ +--- +title: "isBlockhashValid" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `isBlockhashValid` + +Returns whether a block hash is still valid. + +## Parameters + +- `blockhash`: (string) _[requiredl]_ - The `base58` encoded hash of the block. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `epoch`: (integer) _[optional]_ - The epoch for which to query the rewards. If not specified, the current epoch is used. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - `true` if the block hash is still valid; otherwise `false`. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0", "id":1, "method":"isBlockhashValid", "params":["4JsC66MuiW8EbromjB3h64NmZQAH24rAWxwK5raQFTt9", {"commitment":"processed"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": { + "context": { + "apiVersion":"2.1.16", + "slot":333329792 + }, + "value":false + }, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/minimumledgerslot.mdx b/services/reference/solana/json-rpc-methods/minimumledgerslot.mdx new file mode 100644 index 00000000000..dad5e959e1a --- /dev/null +++ b/services/reference/solana/json-rpc-methods/minimumledgerslot.mdx @@ -0,0 +1,49 @@ +--- +title: "minimumLedgerSlot" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `minimumLedgerSlot` + +Returns the lowest slot that the node has information about in its ledger. + +## Parameters + +None + +## Returns + +`result` (integer): The lowest slot that the node has information about in its ledger. + +### Request + + + + + ```bash + curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id":1, "method":"minimumLedgerSlot"}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":333274647, + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/requestairdrop.mdx b/services/reference/solana/json-rpc-methods/requestairdrop.mdx new file mode 100644 index 00000000000..40984123dd4 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/requestairdrop.mdx @@ -0,0 +1,60 @@ +--- +title: "requestAirdrop" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `requestAirdrop` + +Requests an airdrop of lamports to a specified account. + +:::info +This method doesn't work on mainnet. +::: + +## Parameters + +- `address`: (string) _[required]_ - The `base-58` encoded public key of the receiving account. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + +## Returns + +`result` - The transaction signature of the airdrop. + +### Request + + + + + ```bash + curl https://solana-testnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id":1, "method":"requestAirdrop", "params": ["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", 100000]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result":"3Q51CirQ3eyysjpbe2FmPgMMpnaTdcY6MGpKUhuZ7TBcWZFHvNB5QMwy5Z5LYy78K4rtYFo78ozw9zxkZgYJMm3D", + "id":1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/sendtransaction.mdx b/services/reference/solana/json-rpc-methods/sendtransaction.mdx new file mode 100644 index 00000000000..d4bc3a76408 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/sendtransaction.mdx @@ -0,0 +1,61 @@ +--- +title: "sendTransaction" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `sendTransaction` + +Submits a pre-signed transaction to the cluster for processing. + +## Parameters + +- `transaction`: (string) _[required]_ - The transaction as an encoded string. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58` (deprecated) or `base64`. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + - `skipPreflight`: (boolean) _[optional]_ - If `true`, skips the preflight check. The default is `false`. + - `preflightCommitment`: (string) _[optional]_ - The commitment level to use for the preflight check. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `maxRetries`: (integer) _[optional]_ - The maximum number of retries for the transaction. If this parameter + is not provided, the RPC node will retry the transaction until it is finalized or until the block hash expires. + + +## Returns + +`result` (string) - The first transaction signature embedded in the transaction, as a `base58` encoded string (transaction ID). + +### Request + + + + + ```bash + curl https://solana-testnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": ["4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc":"2.0", + "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb", + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/json-rpc-methods/simulatetransaction.mdx b/services/reference/solana/json-rpc-methods/simulatetransaction.mdx new file mode 100644 index 00000000000..0e53e454486 --- /dev/null +++ b/services/reference/solana/json-rpc-methods/simulatetransaction.mdx @@ -0,0 +1,108 @@ +--- +title: "simulateTransaction" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `simulateTransaction` + +Simulate sending a transaction. This method is useful for testing and debugging transactions before +sending them to the network. + +## Parameters + +- `transaction`: (string) _[required]_ - The transaction as an encoded string. The transaction must have a valid + block hash, but doesn't need to be signed. +- `config`: (object) _[optional]_ - Configuration object with the following options: + - `commitment`: (string) _[optional]_ - The commitment level to use for the query. The default is `finalized`. Possible values are: + - `finalized` - Queries the most recent block confirmed by a super majority of the cluster as having + reached maximum lockout, meaning the cluster has recognized this block as finalized. + - `confirmed` - Queries the most recent block that has been voted on by a super majority of the cluster. + - `processed` - Queries its most recent block. The block may still be skipped by the cluster. + - `sigVerify`: (boolean) _[optional]_ - If `true`, verifies the signatures in the transaction. + Conflicts with `replaceRecentBlockhash`. The default is `false`. + - `replaceRecentBlockhash`: (boolean) _[optional]_ - If `true`, replaces the recent block hash in the transaction with the + latest block hash. Conflicts with `sigVerify`. The default is `false`. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58` (deprecated) or `base64`. + - `minContextSlot`: _[optional]_ - The minimum slot to use for the query. + - `innerInstructions`: (boolean) _[optional]_ - If `true`, returns the inner instructions of the transaction. + The inner instructions will be `jsonParsed` where possible, otherwise `json`. + - `accounts`: (object) _[optional]_ - An object containing the following fields: + - `addresses`: (array) _[optional]_ - An array of addresses to include in the response. + - `encoding`: (string) _[optional]_ - The encoding format to use. Can be one of `base58`, `base64`, `base64+zstd`, + or `jsonParsed`. + + + +## Returns + +`result` - `null` if the account doesn't exist; otherwise an object with the following fields: + +- `context` - An object containing the following keys: + - `slot` - The slot number of the block that was queried. + - `apiVersion` - The API version used for the query. +- `value` - An object with the following fields: + - `err` - An error if transaction failed, `null` if transaction succeeded. + - `logs` - An array of log messages generated by the transaction. Returns `null` if the simulation failed. + - `accounts` - + - `data` - The account data, encoded in the specified format. + - `executable` - A boolean indicating whether the account is executable. + - `lamports` - The number of lamports in the account. + - `owner` - The public key of the program that owns the account. + - `rentEpoch` - The epoch in which the account will next be due for rent. + - `space` - The size of the account data in bytes. + - `unitsConsumed` - The number of compute units consumed by the transaction. + - `returnData` - An array of objects containing the following fields: + - `programId` - The public key of the program that executed the transaction. + - `data` - The account data, encoded as `base64` binary data. + - `innerInstructions` - An array of [inner instructions](https://solana.com/docs/rpc/json-structures#inner-instructions). + + +### Request + + + + + ```bash + curl https://solana-testnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "id": 1, "method": "simulateTransaction", "params": ["AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=", {"encoding": "base64"}]}' + ``` + + + + +### Response + + + + + ```bash + { + "jsonrpc": "2.0", + "result": { + "context": { "slot": 218 }, + "value": { + "err": null, + "accounts": null, + "logs": [ + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri invoke [1]", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri consumed 2366 of 1400000 compute units", + "Program return: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri KgAAAAAAAAA=", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" + ], + "returnData": { + "data": ["Kg==", "base64"], + "programId": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" + }, + "unitsConsumed": 2366 + } + }, + "id": 1 + } + ``` + + + \ No newline at end of file diff --git a/services/reference/solana/quickstart.md b/services/reference/solana/quickstart.md new file mode 100644 index 00000000000..d2e96ab67f2 --- /dev/null +++ b/services/reference/solana/quickstart.md @@ -0,0 +1,121 @@ +--- +description: Solana quickstart guide +sidebar_position: 2 +--- + +import Banner from '@site/src/components/Banner' + +# Quickstart + +This quickstart guide will help you set up and make calls on the Solana network using the Infura endpoints. + + +Don't have an Infura account? Sign up for a paid plan to start using the Solana network! + + +## Prerequisites + +Ensure you have an [API key](../../../../developer-tools/dashboard/get-started/create-api/) with the Solana network enabled. + +## Make calls + +### curl + +Run the following command in your terminal, replacing `` with your actual Infura API key: + +```bash +curl https://solana-mainnet.infura.io/v3/ \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc": "2.0", "method": "getSlot", "params": [], "id": 1}' +``` + +### JavaScript + +1. Create a project directory, and inside the directory initialize the project: + + ```bash + npm init -y + ``` + +1. In your project directory, [install the latest version of the JavaScript SDK](https://www.npmjs.com/package/@solana/kit). + +1. Create your JavaScript file (`index.js` in this example) and copy the following code: + + Replace `` with your actual Infura API key. + + ```javascript title="index.js" + import { createSolanaRpc } from "@solana/kit"; + + const rpc = createSolanaRpc("https://solana-mainnet.infura.io/v3/"); + + async function fetchCurrentSlot() { + try { + const slot = await rpc.getSlot().send(); + console.log("Current slot:", slot); + } catch (error) { + console.error("Error fetching slot:", error); + } + } + + fetchCurrentSlot(); + ``` + +1. Run the code using the following command: + + ```bash + node index.js + ``` + +### Rust + +1. Create a project directory, and inside the directory initialize the project: + + ```bash + cargo init + ``` + +1. In your project directory, [install the Rust dependencies](https://www.npmjs.com/package/@solana/kit). + + ```bash + cargo add solana-sdk solana-client + ``` + +1. In the `src/main.rs` paste the following code: + + Replace `` with your actual Infura API key. + + ```rust title="main.rs" + use solana_client::rpc_client::RpcClient; + + fn main() { + let url = "https://solana-mainnet.infura.io/v3/"; + let client = RpcClient::new(url.to_string()); + + match client.get_slot() { + Ok(slot) => println!("Current slot: {}", slot), + Err(err) => eprintln!("Error fetching slot: {}", err), + } + } + ``` + +1. Run the code using the following command: + + ```bash + cargo run + ``` + +## Next steps + +Now that you have successfully made a call to the Solana network, you can explore more functionalities and APIs provided +by Infura. Here are some suggestions: + +- **Explore other Solana APIs**: Infura supports a wide range of APIs. You can find more information in the + [JSON-RPC API method documentation](json-rpc-methods/index.md). + +- **Try out different networks**: Infura supports multiple networks including Ethereum, Linea, Polygon, Optimism, and more. + +- **Monitor your usage**: Monitor your usage on the [MetaMask Developer dashboard](../../../../developer-tools/dashboard/how-to/dashboard-stats/) to ensure you're not hitting your rate limits. + +Remember, the Infura community is here to help. If you have any questions or run into any issues, check out the +[Infura community](https://community.infura.io/) for help and answers to common questions. diff --git a/snaps/features/custom-ui/dialogs.md b/snaps/features/custom-ui/dialogs.md index 5ebb528b9f8..3034794c1e3 100644 --- a/snaps/features/custom-ui/dialogs.md +++ b/snaps/features/custom-ui/dialogs.md @@ -13,10 +13,11 @@ There are four types of dialogs: [alerts](#display-an-alert-dialog), [confirmations](#display-a-confirmation-dialog), [prompts](#display-a-prompt-dialog), and [custom dialogs](#display-a-custom-dialog). -:::caution -Dialogs do not work when MetaMask is locked. -To check if MetaMask is locked, use -[`snap_getClientStatus`](../../reference/snaps-api.md#snap_getclientstatus). +:::warning +- Dialogs do not work when MetaMask is locked. + To check if MetaMask is locked, use + [`snap_getClientStatus`](../../reference/snaps-api.md#snap_getclientstatus). +- [`metamask:` URLs](index.md#about-metamask-urls) are not supported in dialogs. ::: ## Request permission to display dialogs diff --git a/snaps/features/custom-ui/index.md b/snaps/features/custom-ui/index.md index e3359f258bb..b4fb304aa46 100644 --- a/snaps/features/custom-ui/index.md +++ b/snaps/features/custom-ui/index.md @@ -999,8 +999,9 @@ A Snap can link to the following screens using the `metamask:` scheme: Snap IDs for local testing and production. :::warning -MetaMask will throw an error if the URL is not valid or if the URL leads to a Snap that is not -installed. +- MetaMask will throw an error if the URL is not valid or if the URL leads to a Snap that is not +installed. +- `metamask:` URLs are not supported in [dialogs](dialogs.md). ::: #### Example diff --git a/snaps/features/notifications.md b/snaps/features/notifications.md index 39be2eb7b03..a0e53aca5ea 100644 --- a/snaps/features/notifications.md +++ b/snaps/features/notifications.md @@ -66,7 +66,7 @@ Each Snap can trigger up to: ## Expanded view In-app notifications can include an optional expanded view that displays when selected. -The expanded view includes a title, content, and an optional footer link. +The expanded view includes a title, [custom UI](custom-ui/index.md) content, and an optional footer link. The following example displays a notification in MetaMask, with the message "Hello, world!" When the user selects the notification, the expanded view displays a page with a title, a paragraph, and a link to the MetaMask Snaps directory: diff --git a/snaps/features/signature-insights.md b/snaps/features/signature-insights.md index 03bf39ecbaf..0b831c406fc 100644 --- a/snaps/features/signature-insights.md +++ b/snaps/features/signature-insights.md @@ -107,8 +107,8 @@ Your Snap should use `signatureMethod` as the source of truth to identify the si providing insights for. Once you've identified the signature object, your Snap can run any logic, including calling APIs. -Then, your Snap must either return `null` if it has no insights to provide, or an object with a -`content` property and an optional `severity` property as specified in the +Then, your Snap must either return `null` if it has no insights to provide, or an object with +[custom UI](custom-ui/index.md) content and an optional `severity` property as specified in the [`onSignature`](../reference/entry-points.md#onsignature) entry point. The following is an example implementation of `onSignature`: diff --git a/snaps/features/transaction-insights.md b/snaps/features/transaction-insights.md index b825bf59ae9..c3050722bb9 100644 --- a/snaps/features/transaction-insights.md +++ b/snaps/features/transaction-insights.md @@ -40,7 +40,8 @@ permission object, and set it to `true`: ### 2. Implement the `onTransaction` entry point Expose an [`onTransaction`](../reference/entry-points.md#ontransaction) entry point, which receives -a raw unsigned transaction payload, the chain ID, and the optional transaction origin. +a raw unsigned transaction payload, the chain ID, and the optional transaction origin, +and returns [custom UI](custom-ui/index.md) content. When a user submits a transaction using the MetaMask extension, MetaMask calls the `onTransaction` handler method. diff --git a/snaps/learn/about-snaps/apis.md b/snaps/learn/about-snaps/apis.md index 2396bf92b6d..3ca308e3ca4 100644 --- a/snaps/learn/about-snaps/apis.md +++ b/snaps/learn/about-snaps/apis.md @@ -108,7 +108,6 @@ The `ethereum` global available to Snaps has fewer capabilities than `window.eth Snaps can only use it to make read requests, not to write to the blockchain or initiate transactions. Snaps can call all Wallet JSON-RPC API methods **except** the following: -- [`wallet_requestSnaps`](../../reference/wallet-api-for-snaps.md#wallet_requestsnaps) - [`wallet_requestPermissions`](/wallet/reference/json-rpc-methods/wallet_requestpermissions) - [`wallet_revokePermissions`](/wallet/reference/json-rpc-methods/wallet_revokepermissions) - [`wallet_addEthereumChain`](/wallet/reference/json-rpc-methods/wallet_addethereumchain) @@ -116,9 +115,7 @@ Snaps can call all Wallet JSON-RPC API methods **except** the following: - [`wallet_watchAsset`](/wallet/reference/json-rpc-methods/wallet_watchasset) - [`wallet_registerOnboarding`](/wallet/reference/json-rpc-methods/wallet_registeronboarding) - [`wallet_scanQRCode`](/wallet/reference/json-rpc-methods/wallet_scanqrcode) -- [`eth_sendRawTransaction`](/wallet/reference/json-rpc-methods/eth_sendrawtransaction) - [`eth_sendTransaction`](/wallet/reference/json-rpc-methods/eth_sendtransaction) -- [`eth_signTypedData_v4`](/wallet/reference/json-rpc-methods/eth_signtypeddata_v4) - [`eth_decrypt`](/wallet/reference/json-rpc-methods/eth_decrypt) - [`eth_getEncryptionPublicKey`](/wallet/reference/json-rpc-methods/eth_getencryptionpublickey) diff --git a/src/lib/data.js b/src/lib/data.js index cfdfc50c86e..b7237024dba 100644 --- a/src/lib/data.js +++ b/src/lib/data.js @@ -120,6 +120,11 @@ export const NETWORK_LINKS = [ href: "/services/reference/scroll", logo: `${LOGO_PATH}/logo-scroll.svg`, }, + { + name: "Solana", + href: "/services/reference/solana", + logo: `${LOGO_PATH}/logo-solana.svg`, + }, { name: "Starknet", href: "/services/reference/starknet", diff --git a/src/scss/custom.scss b/src/scss/custom.scss index 9b7b750d6b9..32902930f65 100644 --- a/src/scss/custom.scss +++ b/src/scss/custom.scss @@ -624,3 +624,19 @@ ol { max-width: 80rem; } } + +.git-diff-remove { + background-color: #ff000020; + display: block; + margin: 0 calc(-1 * var(--ifm-pre-padding)); + padding: 0 var(--ifm-pre-padding); + border-left: 3px solid #ff000080; +} + +.git-diff-add { + background-color: #1aff0020; + display: block; + margin: 0 calc(-1 * var(--ifm-pre-padding)); + padding: 0 var(--ifm-pre-padding); + border-left: 3px solid #1aff0080; +} diff --git a/static/img/logos/logo-solana.svg b/static/img/logos/logo-solana.svg new file mode 100644 index 00000000000..ed6f34d95f7 --- /dev/null +++ b/static/img/logos/logo-solana.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/wallet/how-to/connect.md b/wallet/how-to/connect.md index ec03989e4ca..a3212ce201b 100644 --- a/wallet/how-to/connect.md +++ b/wallet/how-to/connect.md @@ -268,7 +268,7 @@ Update `src/App.tsx` with the following code: ```ts title="App.tsx" import "./App.css" -import { DiscoverWalletProviders } from "./components/DiscoverWalletProviders" +import { DiscoverWalletProviders } from "./components/WalletProviders" function App() { return ( @@ -279,18 +279,17 @@ function App() { export default App ``` -This code renders the `DiscoverWalletProviders` component that you'll create in the next step, which +This code renders the `WalletProviders` component that you'll create in the next step, which contains the logic for detecting and connecting to wallet providers. #### 4. Detect and connect to wallets -In the `src/components` directory, create a component `DiscoverWalletProviders.tsx` with the -following code: +Create a `src/components` directory and add a file `WalletProviders.tsx` with the following code: -```ts title="DiscoverWalletProviders.tsx" +```ts title="WalletProviders.tsx" import { useState } from "react" import { useSyncProviders } from "../hooks/useSyncProviders" -import { formatAddress } from "~/utils" +import { formatAddress } from "../utils" export const DiscoverWalletProviders = () => { const [selectedWallet, setSelectedWallet] = useState() @@ -299,15 +298,16 @@ export const DiscoverWalletProviders = () => { // Connect to the selected provider using eth_requestAccounts. const handleConnect = async (providerWithInfo: EIP6963ProviderDetail) => { - try { - const accounts = await providerWithInfo.provider.request({ - method: "eth_requestAccounts" - }) - + const accounts: string[] | undefined = + await ( + providerWithInfo.provider + .request({ method: "eth_requestAccounts" }) + .catch(console.error) + ) as string[] | undefined; + + if (accounts?.[0]) { setSelectedWallet(providerWithInfo) setUserAccount(accounts?.[0]) - } catch (error) { - console.error(error) } } @@ -363,7 +363,7 @@ address are displayed. #### 5. Add React hooks -Create a `src/hooks` directory and add a `store.ts` file with the following code: +Create a `src/hooks` directory and add a file `store.ts` with the following code: ```ts title="hooks/store.ts" declare global {