alchemy-sdk
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -5,6 +5,22 @@ # Changelog for Alchemy SDK for JavaScript | ||
## 2.0.2 | ||
### Major Changes | ||
- Added the `transact` namespace for functionality relating to sending transactions. This includes the Flashbots methods `sendPrivateTransaction` and `cancelPrivateTransaction`. | ||
### Minor Changes | ||
- Removed the deprecated `TOKEN` enum from `AssetTransfersCategory`. | ||
- Added support for Optimism Goerli network via the `Network.OPT_GOERLI` enum. | ||
- Added the `pageSize` parameter in `GetNftsForContractOption` to specify the number of NFTs fetched when using `alchemy.nft.getNftsForContract`. | ||
- Added correct `withMetadata` typing to `AssetTransfersResponse`. | ||
## 2.0.1 | ||
### Minor Changes | ||
- Added an optional `url` setting to `AlchemySettings` to allow specifying a custom hardcoded URL to send all requests to. | ||
- Fixed a bug where the SDK would incorrectly include a gzip header in browser environments | ||
## 2.0.0 | ||
@@ -11,0 +27,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var index = require('./index-081a0e9f.js'); | ||
var index = require('./index-61a87bcd.js'); | ||
require('@ethersproject/bignumber'); | ||
@@ -8,0 +8,0 @@ require('axios'); |
@@ -6,2 +6,3 @@ import { AlchemySettings } from '../types/types'; | ||
import { CoreNamespace } from './core-namespace'; | ||
import { TransactNamespace } from './transact-namespace'; | ||
/** | ||
@@ -26,2 +27,3 @@ * The Alchemy SDK client. This class is the main entry point into Alchemy's | ||
readonly ws: WebSocketNamespace; | ||
readonly transact: TransactNamespace; | ||
/** | ||
@@ -28,0 +30,0 @@ * Holds the setting information for the instance of the Alchemy SDK client |
@@ -139,2 +139,4 @@ import { AlchemyConfig } from './alchemy-config'; | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to get. | ||
@@ -160,2 +162,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param signedTransaction The signed transaction to send. | ||
@@ -173,2 +177,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to wait for. | ||
@@ -175,0 +181,0 @@ * @param confirmations The number of blocks to wait for. |
@@ -10,4 +10,5 @@ /** This is the main entry point for the library and exports user-facing API. */ | ||
export type { CoreNamespace } from './api/core-namespace'; | ||
export type { TransactNamespace } from './api/transact-namespace'; | ||
export type { BaseNftContract, NftContract, Nft, BaseNft } from './api/nft'; | ||
export { fromHex, toHex, isHex } from './api/util'; | ||
export { setLogLevel, LogLevelString as LogLevel } from './util/logger'; |
@@ -43,2 +43,3 @@ import { EventType, TransactionReceipt } from '@ethersproject/abstract-provider'; | ||
OPT_KOVAN = "opt-kovan", | ||
OPT_GOERLI = "opt-goerli", | ||
ARB_MAINNET = "arb-mainnet", | ||
@@ -87,2 +88,3 @@ ARB_RINKEBY = "arb-rinkeby", | ||
pageKey?: string; | ||
withMetadata?: boolean; | ||
} | ||
@@ -93,3 +95,2 @@ /** @public */ | ||
INTERNAL = "internal", | ||
TOKEN = "token", | ||
ERC20 = "erc20", | ||
@@ -134,3 +135,8 @@ ERC721 = "erc721", | ||
rawContract: RawContract; | ||
metadata?: AssetTransfersMetadata; | ||
} | ||
/** @public */ | ||
export interface AssetTransfersMetadata { | ||
blockTimestamp: string; | ||
} | ||
/** | ||
@@ -367,3 +373,3 @@ * Represents NFT metadata that holds fields. Note that since there is no | ||
} | ||
/** The refresh result response object returned by {@link refreshNftContract}. */ | ||
/** The refresh result response object returned by {@link refreshContract}. */ | ||
export interface RefreshContractResult { | ||
@@ -422,3 +428,3 @@ /** The NFT contract address that was passed in to be refreshed. */ | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -438,6 +444,8 @@ * This interface is used to fetch NFTs with their associated metadata. To get | ||
omitMetadata?: boolean; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
/** | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -457,2 +465,4 @@ * This interface is used to fetch NFTs without their associated metadata. To | ||
omitMetadata: false; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
@@ -537,1 +547,13 @@ /** | ||
export declare type AlchemyEventType = EventType | AlchemyPendingTransactionsEventFilter; | ||
/** Options for the {@link TransactNamespace.sendPrivateTransaction} method. */ | ||
export interface SendPrivateTransactionOptions { | ||
/** | ||
* Whether to use fast-mode. Defaults to false. Please note that fast mode | ||
* transactions cannot be cancelled using | ||
* {@link TransactNamespace.cancelPrivateTransaction}. method. | ||
* | ||
* See {@link https://docs.flashbots.net/flashbots-protect/rpc/fast-mode} for | ||
* more details. | ||
*/ | ||
fast: boolean; | ||
} |
@@ -24,2 +24,3 @@ import { Network } from '../types/types'; | ||
"opt-kovan": string; | ||
"opt-goerli": string; | ||
"arb-mainnet": string; | ||
@@ -26,0 +27,0 @@ "arb-rinkeby": string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.0.0"; | ||
export declare const VERSION = "2.0.1"; |
@@ -1,4 +0,4 @@ | ||
export { A as Alchemy, c as AssetTransfersCategory, d as AssetTransfersOrder, N as Network, h as NftExcludeFilters, e as NftTokenType, R as RefreshState, f as fromHex, i as isHex, s as setLogLevel, t as toHex } from './index-969f3a91.js'; | ||
export { A as Alchemy, c as AssetTransfersCategory, d as AssetTransfersOrder, N as Network, h as NftExcludeFilters, e as NftTokenType, R as RefreshState, f as fromHex, i as isHex, s as setLogLevel, t as toHex } from './index-8998d743.js'; | ||
import '@ethersproject/bignumber'; | ||
import 'axios'; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ import { AlchemySettings } from '../types/types'; | ||
import { CoreNamespace } from './core-namespace'; | ||
import { TransactNamespace } from './transact-namespace'; | ||
/** | ||
@@ -26,2 +27,3 @@ * The Alchemy SDK client. This class is the main entry point into Alchemy's | ||
readonly ws: WebSocketNamespace; | ||
readonly transact: TransactNamespace; | ||
/** | ||
@@ -28,0 +30,0 @@ * Holds the setting information for the instance of the Alchemy SDK client |
@@ -139,2 +139,4 @@ import { AlchemyConfig } from './alchemy-config'; | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to get. | ||
@@ -160,2 +162,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param signedTransaction The signed transaction to send. | ||
@@ -173,2 +177,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to wait for. | ||
@@ -175,0 +181,0 @@ * @param confirmations The number of blocks to wait for. |
@@ -10,4 +10,5 @@ /** This is the main entry point for the library and exports user-facing API. */ | ||
export type { CoreNamespace } from './api/core-namespace'; | ||
export type { TransactNamespace } from './api/transact-namespace'; | ||
export type { BaseNftContract, NftContract, Nft, BaseNft } from './api/nft'; | ||
export { fromHex, toHex, isHex } from './api/util'; | ||
export { setLogLevel, LogLevelString as LogLevel } from './util/logger'; |
@@ -43,2 +43,3 @@ import { EventType, TransactionReceipt } from '@ethersproject/abstract-provider'; | ||
OPT_KOVAN = "opt-kovan", | ||
OPT_GOERLI = "opt-goerli", | ||
ARB_MAINNET = "arb-mainnet", | ||
@@ -87,2 +88,3 @@ ARB_RINKEBY = "arb-rinkeby", | ||
pageKey?: string; | ||
withMetadata?: boolean; | ||
} | ||
@@ -93,3 +95,2 @@ /** @public */ | ||
INTERNAL = "internal", | ||
TOKEN = "token", | ||
ERC20 = "erc20", | ||
@@ -134,3 +135,8 @@ ERC721 = "erc721", | ||
rawContract: RawContract; | ||
metadata?: AssetTransfersMetadata; | ||
} | ||
/** @public */ | ||
export interface AssetTransfersMetadata { | ||
blockTimestamp: string; | ||
} | ||
/** | ||
@@ -367,3 +373,3 @@ * Represents NFT metadata that holds fields. Note that since there is no | ||
} | ||
/** The refresh result response object returned by {@link refreshNftContract}. */ | ||
/** The refresh result response object returned by {@link refreshContract}. */ | ||
export interface RefreshContractResult { | ||
@@ -422,3 +428,3 @@ /** The NFT contract address that was passed in to be refreshed. */ | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -438,6 +444,8 @@ * This interface is used to fetch NFTs with their associated metadata. To get | ||
omitMetadata?: boolean; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
/** | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -457,2 +465,4 @@ * This interface is used to fetch NFTs without their associated metadata. To | ||
omitMetadata: false; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
@@ -537,1 +547,13 @@ /** | ||
export declare type AlchemyEventType = EventType | AlchemyPendingTransactionsEventFilter; | ||
/** Options for the {@link TransactNamespace.sendPrivateTransaction} method. */ | ||
export interface SendPrivateTransactionOptions { | ||
/** | ||
* Whether to use fast-mode. Defaults to false. Please note that fast mode | ||
* transactions cannot be cancelled using | ||
* {@link TransactNamespace.cancelPrivateTransaction}. method. | ||
* | ||
* See {@link https://docs.flashbots.net/flashbots-protect/rpc/fast-mode} for | ||
* more details. | ||
*/ | ||
fast: boolean; | ||
} |
@@ -24,2 +24,3 @@ import { Network } from '../types/types'; | ||
"opt-kovan": string; | ||
"opt-goerli": string; | ||
"arb-mainnet": string; | ||
@@ -26,0 +27,0 @@ "arb-rinkeby": string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.0.0"; | ||
export declare const VERSION = "2.0.1"; |
@@ -1,4 +0,4 @@ | ||
export { A as Alchemy, c as AssetTransfersCategory, d as AssetTransfersOrder, N as Network, h as NftExcludeFilters, e as NftTokenType, R as RefreshState, f as fromHex, i as isHex, s as setLogLevel, t as toHex } from './index-969f3a91.js'; | ||
export { A as Alchemy, c as AssetTransfersCategory, d as AssetTransfersOrder, N as Network, h as NftExcludeFilters, e as NftTokenType, R as RefreshState, f as fromHex, i as isHex, s as setLogLevel, t as toHex } from './index-8998d743.js'; | ||
import '@ethersproject/bignumber'; | ||
import 'axios'; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ import { AlchemySettings } from '../types/types'; | ||
import { CoreNamespace } from './core-namespace'; | ||
import { TransactNamespace } from './transact-namespace'; | ||
/** | ||
@@ -26,2 +27,3 @@ * The Alchemy SDK client. This class is the main entry point into Alchemy's | ||
readonly ws: WebSocketNamespace; | ||
readonly transact: TransactNamespace; | ||
/** | ||
@@ -28,0 +30,0 @@ * Holds the setting information for the instance of the Alchemy SDK client |
@@ -139,2 +139,4 @@ import { AlchemyConfig } from './alchemy-config'; | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to get. | ||
@@ -160,2 +162,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param signedTransaction The signed transaction to send. | ||
@@ -173,2 +177,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to wait for. | ||
@@ -175,0 +181,0 @@ * @param confirmations The number of blocks to wait for. |
@@ -10,4 +10,5 @@ /** This is the main entry point for the library and exports user-facing API. */ | ||
export type { CoreNamespace } from './api/core-namespace'; | ||
export type { TransactNamespace } from './api/transact-namespace'; | ||
export type { BaseNftContract, NftContract, Nft, BaseNft } from './api/nft'; | ||
export { fromHex, toHex, isHex } from './api/util'; | ||
export { setLogLevel, LogLevelString as LogLevel } from './util/logger'; |
@@ -43,2 +43,3 @@ import { EventType, TransactionReceipt } from '@ethersproject/abstract-provider'; | ||
OPT_KOVAN = "opt-kovan", | ||
OPT_GOERLI = "opt-goerli", | ||
ARB_MAINNET = "arb-mainnet", | ||
@@ -87,2 +88,3 @@ ARB_RINKEBY = "arb-rinkeby", | ||
pageKey?: string; | ||
withMetadata?: boolean; | ||
} | ||
@@ -93,3 +95,2 @@ /** @public */ | ||
INTERNAL = "internal", | ||
TOKEN = "token", | ||
ERC20 = "erc20", | ||
@@ -134,3 +135,8 @@ ERC721 = "erc721", | ||
rawContract: RawContract; | ||
metadata?: AssetTransfersMetadata; | ||
} | ||
/** @public */ | ||
export interface AssetTransfersMetadata { | ||
blockTimestamp: string; | ||
} | ||
/** | ||
@@ -367,3 +373,3 @@ * Represents NFT metadata that holds fields. Note that since there is no | ||
} | ||
/** The refresh result response object returned by {@link refreshNftContract}. */ | ||
/** The refresh result response object returned by {@link refreshContract}. */ | ||
export interface RefreshContractResult { | ||
@@ -422,3 +428,3 @@ /** The NFT contract address that was passed in to be refreshed. */ | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -438,6 +444,8 @@ * This interface is used to fetch NFTs with their associated metadata. To get | ||
omitMetadata?: boolean; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
/** | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -457,2 +465,4 @@ * This interface is used to fetch NFTs without their associated metadata. To | ||
omitMetadata: false; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
@@ -537,1 +547,13 @@ /** | ||
export declare type AlchemyEventType = EventType | AlchemyPendingTransactionsEventFilter; | ||
/** Options for the {@link TransactNamespace.sendPrivateTransaction} method. */ | ||
export interface SendPrivateTransactionOptions { | ||
/** | ||
* Whether to use fast-mode. Defaults to false. Please note that fast mode | ||
* transactions cannot be cancelled using | ||
* {@link TransactNamespace.cancelPrivateTransaction}. method. | ||
* | ||
* See {@link https://docs.flashbots.net/flashbots-protect/rpc/fast-mode} for | ||
* more details. | ||
*/ | ||
fast: boolean; | ||
} |
@@ -24,2 +24,3 @@ import { Network } from '../types/types'; | ||
"opt-kovan": string; | ||
"opt-goerli": string; | ||
"arb-mainnet": string; | ||
@@ -26,0 +27,0 @@ "arb-rinkeby": string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.0.0"; | ||
export declare const VERSION = "2.0.1"; |
@@ -6,2 +6,3 @@ import { AlchemySettings } from '../types/types'; | ||
import { CoreNamespace } from './core-namespace'; | ||
import { TransactNamespace } from './transact-namespace'; | ||
/** | ||
@@ -26,2 +27,3 @@ * The Alchemy SDK client. This class is the main entry point into Alchemy's | ||
readonly ws: WebSocketNamespace; | ||
readonly transact: TransactNamespace; | ||
/** | ||
@@ -28,0 +30,0 @@ * Holds the setting information for the instance of the Alchemy SDK client |
@@ -139,2 +139,4 @@ import { AlchemyConfig } from './alchemy-config'; | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to get. | ||
@@ -160,2 +162,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param signedTransaction The signed transaction to send. | ||
@@ -173,2 +177,4 @@ * @public | ||
* | ||
* NOTE: This is an alias for {@link TransactNamespace.getTransaction}. | ||
* | ||
* @param transactionHash The hash of the transaction to wait for. | ||
@@ -175,0 +181,0 @@ * @param confirmations The number of blocks to wait for. |
@@ -10,4 +10,5 @@ /** This is the main entry point for the library and exports user-facing API. */ | ||
export type { CoreNamespace } from './api/core-namespace'; | ||
export type { TransactNamespace } from './api/transact-namespace'; | ||
export type { BaseNftContract, NftContract, Nft, BaseNft } from './api/nft'; | ||
export { fromHex, toHex, isHex } from './api/util'; | ||
export { setLogLevel, LogLevelString as LogLevel } from './util/logger'; |
@@ -43,2 +43,3 @@ import { EventType, TransactionReceipt } from '@ethersproject/abstract-provider'; | ||
OPT_KOVAN = "opt-kovan", | ||
OPT_GOERLI = "opt-goerli", | ||
ARB_MAINNET = "arb-mainnet", | ||
@@ -87,2 +88,3 @@ ARB_RINKEBY = "arb-rinkeby", | ||
pageKey?: string; | ||
withMetadata?: boolean; | ||
} | ||
@@ -93,3 +95,2 @@ /** @public */ | ||
INTERNAL = "internal", | ||
TOKEN = "token", | ||
ERC20 = "erc20", | ||
@@ -134,3 +135,8 @@ ERC721 = "erc721", | ||
rawContract: RawContract; | ||
metadata?: AssetTransfersMetadata; | ||
} | ||
/** @public */ | ||
export interface AssetTransfersMetadata { | ||
blockTimestamp: string; | ||
} | ||
/** | ||
@@ -367,3 +373,3 @@ * Represents NFT metadata that holds fields. Note that since there is no | ||
} | ||
/** The refresh result response object returned by {@link refreshNftContract}. */ | ||
/** The refresh result response object returned by {@link refreshContract}. */ | ||
export interface RefreshContractResult { | ||
@@ -422,3 +428,3 @@ /** The NFT contract address that was passed in to be refreshed. */ | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -438,6 +444,8 @@ * This interface is used to fetch NFTs with their associated metadata. To get | ||
omitMetadata?: boolean; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
/** | ||
* Optional parameters object for the {@link getNftsForContract} and | ||
* {@link getNftsForNftContractIterator} functions. | ||
* {@link getNftsForContractIterator} functions. | ||
* | ||
@@ -457,2 +465,4 @@ * This interface is used to fetch NFTs without their associated metadata. To | ||
omitMetadata: false; | ||
/** Sets the total number of NFTs to return in the response. Defaults to 100. */ | ||
pageSize?: number; | ||
} | ||
@@ -537,1 +547,13 @@ /** | ||
export declare type AlchemyEventType = EventType | AlchemyPendingTransactionsEventFilter; | ||
/** Options for the {@link TransactNamespace.sendPrivateTransaction} method. */ | ||
export interface SendPrivateTransactionOptions { | ||
/** | ||
* Whether to use fast-mode. Defaults to false. Please note that fast mode | ||
* transactions cannot be cancelled using | ||
* {@link TransactNamespace.cancelPrivateTransaction}. method. | ||
* | ||
* See {@link https://docs.flashbots.net/flashbots-protect/rpc/fast-mode} for | ||
* more details. | ||
*/ | ||
fast: boolean; | ||
} |
@@ -24,2 +24,3 @@ import { Network } from '../types/types'; | ||
"opt-kovan": string; | ||
"opt-goerli": string; | ||
"arb-mainnet": string; | ||
@@ -26,0 +27,0 @@ "arb-rinkeby": string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.0.0"; | ||
export declare const VERSION = "2.0.1"; |
{ | ||
"name": "alchemy-sdk", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Extended Ethers.js SDK for Alchemy APIs", | ||
@@ -17,2 +17,3 @@ "author": "Alchemy", | ||
"test": "jest test/unit", | ||
"test-integration": "jest test/integration", | ||
"api": "yarn build && api-extractor run", | ||
@@ -19,0 +20,0 @@ "docs": "typedoc --plugin none --out docs src/index.ts", |
# Alchemy SDK for Javascript | ||
Alchemy SDK helps developers use Alchemy's APIs and endpoints more efficiently. This is a lightweight, modular SDK built as a drop-in replacement of Ethers.js's Provider that provides a superset of functionality - enabling access to the Alchemy NFT API, Websockets, and Enhanced API methods. | ||
The Alchemy SDK is the most comprehensive, stable, and powerful Javascript SDK available today to interact with the blockchain. | ||
It also provides access to Alchemy's hardened node infrastructure, guaranteeing reliability, scalability, and quality-of-life improvements such as automatic exponential backoff retries. | ||
It supports the exact same syntax and functionality of the Ethers.js `AlchemyProvider` and `WebSocketProvider`, making it a 1:1 mapping for anyone using the Ethers.js `Provider`. However, it adds a significant amount of improved functionality on top of Ethers, such as easy access to Alchemy’s Enhanced and NFT APIs, robust WebSockets, and quality-of life improvements such as automated retries. | ||
> :warning: **WARNING:** The `@alch/alchemy-sdk` package is now deprecated as of the v2.0.0 release. Please use the `alchemy-sdk` package instead. Note that upgrading from v1 to v2 will be a breaking change. See the changelog for full details. | ||
The SDK leverages Alchemy's hardened node infrastructure, guaranteeing best-in-class node reliability, scalability, and data correctness, and is undergoing active development by Alchemy's engineers. | ||
To upgrade to v2.0.0 from v1.X.X, simply run the following in your project root: | ||
> :warning: **WARNING:** The `@alch/alchemy-sdk` package is now deprecated as of the v2.0.0 release. Please use the `alchemy-sdk` package instead. Note that upgrading from v1 to v2 will be a breaking change. To upgrade to v2.0.0 from v1.X.X, simply run the following in your project root: | ||
@@ -29,5 +29,5 @@ ``` | ||
// Optional Config object, but defaults to demo api-key and eth-mainnet. | ||
// Optional config object, but defaults to the API key 'demo' and Network 'eth-mainnet'. | ||
const settings = { | ||
apiKey: 'demo', // Replace with your Alchemy API Key. | ||
apiKey: 'demo', // Replace with your Alchemy API key. | ||
network: Network.ETH_MAINNET // Replace with your network. | ||
@@ -43,3 +43,3 @@ }; | ||
The Alchemy SDK currently supports three different namespaces, including: | ||
The Alchemy SDK currently supports four different namespaces, including: | ||
@@ -49,4 +49,5 @@ - `core`: All commonly-used Ethers.js Provider methods and Alchemy Enhanced API methods | ||
- `ws`: All WebSockets methods | ||
- `transact`: All Alchemy Transaction API methods | ||
If you are already using Ethers.js, you should be simply able to replace the Ethers.js Provider object with `alchemy.core` and it should just work. | ||
If you are already using Ethers.js, you should be simply able to replace the Ethers.js Provider object with `alchemy.core` and it should work properly. | ||
@@ -118,3 +119,3 @@ ```ts | ||
// Listen to all new pending transactions. | ||
alchemy.ws.on("block", res => console.log(res)); | ||
alchemy.ws.on('block', res => console.log(res)); | ||
@@ -137,3 +138,3 @@ // Listen to only the next transaction on the USDC contract. | ||
without interruption, but correctly handling dropped connections and reconnection by hand can be challenging to get | ||
right. `alchemy-sdk` automatically handles these failures with no configuration necessary. The main benefits are: | ||
right. The Alchemy SDK automatically handles these failures with no configuration necessary. The main benefits are: | ||
@@ -145,6 +146,19 @@ - Resilient event delivery: Unlike standard Web3.js or Ethers.js, you will not permanently miss events which arrive | ||
- Lowered rate of failure: Compared to standard Web3.js or Ethers.js, there are fewer failures when sending requests | ||
over the WebSocket while the connection is down. Alchemy Web3 will attempt to send the requests once the connection | ||
over the WebSocket while the connection is down. The Alchemy SDK will attempt to send the requests once the connection | ||
is reopened. Note that it is still possible, with a lower likelihood, for outgoing requests to be lost, | ||
so you should still have error handling as with any network request. | ||
## Alchemy Transact | ||
The `transact` namespace contains methods used for sending transactions. The unique methods to the `transact` namespace are: | ||
- `sendPrivateTransaction()`: Send a private transaction through Flashbots. | ||
- `cancelPrivateTransaction()`: Cancel a private transaction sent with Flashbots. | ||
The `transact` namespace also aliases over several commonly used methods from the `core` namespace for convenience: | ||
- `getTransaction()`: Returns the transaction for the given transaction hash. | ||
- `sendTransaction()`: Sends a standard transaction to the network to be mined. | ||
- `waitForTransaction()`: Waits for a transaction to be mined and returns the transaction receipt. | ||
## Alchemy NFT API | ||
@@ -172,3 +186,3 @@ | ||
### Comparing `BaseNft` and `Nft` | ||
### Using `BaseNft` and `Nft` | ||
@@ -175,0 +189,0 @@ The SDK currently uses the `BaseNft` and `Nft` classes to represent NFTs returned by the Alchemy. The `BaseNft` object |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1496826
164
18002
319