Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 63 additions & 66 deletions fern/api-reference/abstract/abstract-api-quickstart.mdx
Original file line number Diff line number Diff line change
@@ -1,101 +1,98 @@
---
title: Abstract API Quickstart
description: Get started building on Abstract and using the JSON-RPC API
subtitle: Get started building on Abstract and using the JSON-RPC API
description: How to get started building on Abstract using Alchemy
subtitle: How to get started building on Abstract using Alchemy
slug: reference/abstract-api-quickstart
---

## Introduction
<Tip title="Don't have an API key?" icon="star">
Build faster with production-ready APIs, smart wallets and rollup infrastructure across 70+ chains. Create your free Alchemy API key and{" "}
<a href="https://dashboard.alchemy.com/signup">get started today</a>.
</Tip>

Abstract is a Layer 2 (L2) network built on top of Ethereum, designed to securely power consumer-facing blockchain applications at scale with low fees and fast transaction speeds.

## What is the Abstract API?

The Abstract API allows interaction with the Abstract network through a set of JSON-RPC methods. Its design is familiar to developers who have worked with Ethereum's JSON-RPC APIs, making it intuitive and straightforward to use.

## Getting Started Instructions

### 1. Choose a Package Manager (npm or yarn)

Select a package manager to manage your project's dependencies. Choose between `npm` and `yarn` based on your preference or project requirements.
## Send Your First Request on Alchemy

| npm | yarn |
| ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| Begin with `npm` by following the [npm documentation](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). | For `yarn`, refer to [yarn's installation guide](https://classic.yarnpkg.com/lang/en/docs/install). |
Let's use the [`viem`](https://www.npmjs.com/package/viem) package to create an Abstract client connected to Alchemy and fetch the latest block number!

### 2. Set Up Your Project
<CodeGroup>
```text npm
npm install --save viem
```

Open your terminal and execute the following commands to create and initialize your project:
```text yarn
yarn add viem
```
</CodeGroup>

```shell
mkdir abstract-api-quickstart
cd abstract-api-quickstart
npm init --yes
```
## Create Client Connected to Alchemy

```shell
mkdir abstract-api-quickstart
cd abstract-api-quickstart
yarn init --yes
<CodeGroup>
```js
import { createPublicClient, http } from "viem";
import { abstract } from "viem/chains";

const client = createPublicClient({
chain: abstract,
transport: http("https://abstract-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY"),
});
```
</CodeGroup>

This creates a new directory named `abstract-api-quickstart` and initializes a Node.js project within it.

### 3. Make Your First Request
Now that you've created a client connected to Alchemy, you can continue with some basics:

Install Axios, a popular HTTP client, to make API requests:
## Get Latest Block Number

<CodeGroup>
```bash bash
npm install axios
# Or with yarn
# yarn add axios
```
```js
const blockNumber = await client.getBlockNumber();
console.log("Current block number:", blockNumber);
```
</CodeGroup>

Create an `index.js` file in your project directory and paste the following code:
## Get an Address Balance

<CodeGroup>
```javascript javascript
const axios = require('axios');

const url = `https://abstract-mainnet.g.alchemy.com/v2/${your-api-key}`;

const payload = {
jsonrpc: '2.0',
id: 1,
method: 'eth_blockNumber',
params: []
};

axios.post(url, payload)
.then(response => {
console.log('Latest Block:', response.data.result);
})
.catch(error => {
console.error(error);
});
```
```js
const balance = await client.getBalance({ address: "0xab5801a7d398351b8be11c439e05c5b3259aec9b" });
console.log("Balance (ETH):", Number(balance) / 1e18);
```
</CodeGroup>

Remember to replace `your-api-key` with your actual Alchemy API key that you can get from your [Alchemy dashboard](https://dashboard.alchemy.com/signup).
## Read Block Data

### 4. Run Your Script
<CodeGroup>
```js
const block = await client.getBlock({
blockNumber: blockNumber, // from previous example
});
console.log(block);
```
</CodeGroup>

Execute your script to make a request to the Abstract mainnet:
## Fetch a Transaction by Hash

<CodeGroup>
```bash bash
node index.js
```
<CodeGroup>
```js
const tx = await client.getTransaction({ hash: "0xYOUR_TX_HASH" });
console.log(tx);
```
</CodeGroup>

You should see the latest block information from Abstract's mainnet outputted to your console:
## Fetch Transaction Receipt

```shell
Latest Block: 0x...
<CodeGroup>
```js
const receipt = await client.getTransactionReceipt({
hash: "0xYOUR_TX_HASH"
});
console.log(receipt);
```
</CodeGroup>

## Next Steps
# Abstract APIs

Congratulations! You've made your first request to the Abstract network. You can now explore the various [JSON-RPC methods available on Abstract](/reference/abstract-api-endpoints) and start building your dApps on this innovative platform.
For the full list of Abstract APIs, see the [Abstract API Endpoints](/docs/chains#abstract-apis).
2 changes: 1 addition & 1 deletion fern/api-reference/adi/adi-api-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Yes, ADI is EVM compatible.
ADI uses the JSON-RPC API standard. This API is crucial for any blockchain interaction on the ADI network, allowing users to read block/transaction data, query chain information, execute smart contracts, and store data on-chain.

## What methods are supported on ADI?
ADI supports standard Ethereum JSON-RPC methods. Some chain-specific methods may vary. Please check the ADI API endpoints documentation for a complete list.
ADI supports standard Ethereum JSON-RPC methods. Some chain-specific methods may vary. Please check the [ADI API Endpoints](/docs/chains#adi-apis) for a complete list.

## What is an ADI API key?
When accessing the ADI network via a node provider like Alchemy, ADI developers use an API key to send transactions and retrieve data from the network. For the best development experience, we recommend that you [sign up for a free API key](https://dashboard.alchemy.com/signup)!
Expand Down
141 changes: 65 additions & 76 deletions fern/api-reference/adi/adi-api-quickstart.mdx
Original file line number Diff line number Diff line change
@@ -1,117 +1,106 @@
---
title: ADI API Quickstart
description: How to get started building on ADI and using the JSON-RPC API
subtitle: How to get started building on ADI and using the JSON-RPC API
description: How to get started building on ADI using Alchemy
subtitle: How to get started building on ADI using Alchemy
slug: reference/adi-api-quickstart
---

*To use the ADI API you'll need to [create a free Alchemy account](https://dashboard.alchemy.com/signup) first!*

## Introduction
<Tip title="Don't have an API key?" icon="star">
Build faster with production-ready APIs, smart wallets and rollup infrastructure across 70+ chains. Create your free Alchemy API key and{" "}
<a href="https://dashboard.alchemy.com/signup">get started today</a>.
</Tip>

ADI Network is an EVM-compatible Layer 2 that leverages cryptographic Zero-Knowledge validity proofs (ZKPs) to ensure both security and efficiency in transaction processing. ADI is enabling seamless integration between traditional finance, crypto ecosystems, and regulated markets.

## What is the ADI API?

The ADI API allows interaction with the ADI network through a set of JSON-RPC methods. Its design is familiar to developers who have worked with Ethereum's JSON-RPC APIs, making it intuitive and straightforward to use.

## Getting Started Instructions

### 1. Choose a Package Manager (npm or yarn)
## Send Your First Request on Alchemy

Select a package manager to manage your project's dependencies. Choose between `npm` and `yarn` based on your preference or project requirements.
Let's use the [`viem`](https://www.npmjs.com/package/viem) package to create an ADI client connected to Alchemy and fetch the latest block number!

<CodeGroup>
```shell npm
# Begin with npm by following the npm documentation
# https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
```text npm
npm install --save viem
```

```shell yarn
# For yarn, refer to yarn's installation guide
# https://classic.yarnpkg.com/lang/en/docs/install
```text yarn
yarn add viem
```
</CodeGroup>

### 2. Set Up Your Project

Open your terminal and execute the following commands to create and initialize your project:
## Create Client Connected to Alchemy

<CodeGroup>
```shell npm
mkdir adi-api-quickstart
cd adi-api-quickstart
npm init --yes
```

```shell yarn
mkdir adi-api-quickstart
cd adi-api-quickstart
yarn init --yes
```
```js
import { createPublicClient, http, defineChain } from "viem";

const adiTestnet = defineChain({
id: 12227332,
name: "ADI Testnet",
nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: { http: ["https://adi-testnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY"] },
},
});

const client = createPublicClient({
chain: adiTestnet,
transport: http("https://adi-testnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY"),
});
```
</CodeGroup>

This creates a new directory named `adi-api-quickstart` and initializes a Node.js project within it.
Now that you've created a client connected to Alchemy, you can continue with some basics:

### 3. Make Your First Request

Install Axios, a popular HTTP client, to make API requests:
## Get Latest Block Number

<CodeGroup>
```shell npm
npm install axios
```

```shell yarn
yarn add axios
```
```js
const blockNumber = await client.getBlockNumber();
console.log("Current block number:", blockNumber);
```
</CodeGroup>

Create an `index.js` file in your project directory and paste the following code:
## Get an Address Balance

<CodeGroup>
```javascript index.js
const axios = require('axios');

const url = 'https://adi-testnet.g.alchemy.com/v2/${your-api-key}';

const payload = {
jsonrpc: '2.0',
id: 1,
method: 'eth_blockNumber',
params: []
};

axios.post(url, payload)
.then(response => {
console.log('Latest Block:', response.data.result);
})
.catch(error => {
console.error(error);
});
```
```js
const balance = await client.getBalance({ address: "0xab5801a7d398351b8be11c439e05c5b3259aec9b" });
console.log("Balance (ETH):", Number(balance) / 1e18);
```
</CodeGroup>

Remember to replace `your-api-key` with your actual Alchemy API key that you can get from your [Alchemy dashboard](https://dashboard.alchemy.com/signup).
## Read Block Data

### 4. Run Your Script
<CodeGroup>
```js
const block = await client.getBlock({
blockNumber: blockNumber, // from previous example
});
console.log(block);
```
</CodeGroup>

Execute your script to make a request to the ADI network:
## Fetch a Transaction by Hash

<CodeGroup>
```shell shell
node index.js
```
<CodeGroup>
```js
const tx = await client.getTransaction({ hash: "0xYOUR_TX_HASH" });
console.log(tx);
```
</CodeGroup>

You should see the latest block information from ADI's network outputted to your console:
## Fetch Transaction Receipt

<CodeGroup>
```shell shell
Latest Block: 0x...
```
```js
const receipt = await client.getTransactionReceipt({
hash: "0xYOUR_TX_HASH"
});
console.log(receipt);
```
</CodeGroup>

## Next Steps
# ADI APIs

Congratulations! You've made your first request to the ADI network. You can now explore the various JSON-RPC methods available on ADI and start building your dApps on this innovative platform.
For the full list of ADI APIs, see the [ADI API Endpoints](/docs/chains#adi-apis).
2 changes: 1 addition & 1 deletion fern/api-reference/anime/anime-api-faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Developers should use the **Anime Sepolia** testnet for Anime. This testnet prov

## What methods does Alchemy support for the Anime API?

You can find the list of all the methods Alchemy support for the Anime API on Anime API Endpoints page.
You can find the list of all the methods Alchemy supports for the Anime API on the [Anime API Endpoints](/docs/chains#anime-apis) page.

## My question isn't here, where can I get help?

Expand Down
Loading
Loading