### Install Alchemy SDK Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Install the Alchemy SDK using npm. This is the first step before importing and using the SDK in your project. ```bash npm install alchemy-sdk ``` -------------------------------- ### _startEvent Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Starts listening for a specific event. ```APIDOC ## _startEvent ### Description Starts listening for a specific event. ### Method (Implicitly internal, likely called by other provider methods) ### Parameters #### Query Parameters - **event** (Event) - Required - The event to start listening for. ``` -------------------------------- ### SDK Initialization Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Demonstrates how to install and initialize the Alchemy SDK with optional settings for API key and network. ```APIDOC ## SDK Initialization ### Description Installs and initializes the Alchemy SDK. You can provide an optional configuration object to set your API key, network, and other settings. ### Method `new Alchemy(settings)` ### Parameters #### Settings Object (Optional) - **apiKey** (string) - Required - Your Alchemy API key. Defaults to 'demo'. - **network** (Network) - Required - The Ethereum network to connect to. Defaults to `Network.ETH_MAINNET`. ### Request Example ```ts import { Alchemy, Network } from 'alchemy-sdk'; const settings = { apiKey: 'YOUR_API_KEY', network: Network.ETH_GOERLI }; const alchemy = new Alchemy(settings); ``` ### Request Example (Default Settings) ```ts import { Alchemy } from 'alchemy-sdk'; const alchemy = new Alchemy(); // Uses default API key 'demo' and Network.ETH_MAINNET ``` ``` -------------------------------- ### _startEvent Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyProvider.md Starts an event listener. This method is inherited from JsonRpcProvider. ```APIDOC ## _startEvent ### Description Starts an event listener. ### Parameters #### Path Parameters - **event** (Event) - Description not available ### Returns `void` ``` -------------------------------- ### getInterface Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/ContractFactory.md Gets the interface for a contract. ```APIDOC ## getInterface contractInterface ### Description Gets the interface for a contract. ### Parameters #### Parameters - **contractInterface** (ContractInterface) - The contract interface definition. ### Returns `Interface` - The contract interface object. ### Defined in node_modules/@ethersproject/contracts/lib/index.d.ts:149 ``` -------------------------------- ### _startPending Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyWebSocketProvider.md Starts the pending transaction monitoring. This method is inherited from WebSocketProvider. ```APIDOC ## _startPending ### Description Starts the pending transaction monitoring. ### Returns `void` ### Inherited from WebSocketProvider._startPending ### Defined in node_modules/@ethersproject/providers/lib/json-rpc-provider.d.ts:45 ``` -------------------------------- ### simulateExecutionBundle Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/README.md Simulate a list of transactions in sequence and get a full list of internal transactions, logs, ABI decoded results and more. ```APIDOC ## simulateExecutionBundle ### Description Simulate a list of transactions in sequence and get a full list of internal transactions, logs, ABI decoded results and more. ### Method POST (assumed) ### Endpoint /transact/simulateExecutionBundle (assumed) ### Parameters #### Request Body - **transactions** (array) - Required - An array of transactions to simulate. - **blockTag** (string or number) - Optional - The block tag to simulate against. ``` -------------------------------- ### _startPending Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Starts the pending transaction listener. This method overrides the base provider's implementation. ```APIDOC ## _startPending ### Description Starts the pending transaction listener. This method overrides the base provider's implementation. ### Method (Implicitly internal, likely called by other provider methods) ### Returns void ``` -------------------------------- ### Core Namespace - Get Token Balances Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Fetches the token balances for a given Ethereum address using the core namespace. ```APIDOC ## Core Namespace - Get Token Balances ### Description Fetches the token balances for a specified Ethereum address. This method is part of the `core` namespace, offering access to Alchemy Enhanced API functionalities. ### Method `alchemy.core.getTokenBalances(address)` ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters - **address** (string) - Required - The Ethereum address for which to retrieve token balances. Can also be an ENS name. ### Request Example ```ts import { Alchemy } from 'alchemy-sdk'; const alchemy = new Alchemy(); const address = '0x3f5CE5FBFe3E9af3971dD833D26bA9b5C936f0bE'; alchemy.core.getTokenBalances(address).then(balances => console.log(balances)); ``` ### Response #### Success Response - **balances** (Array) - An array of objects, each containing token information and balance. ``` -------------------------------- ### ready Accessor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyProvider.md Gets a promise that resolves when the provider is ready and has connected to the network. Inherited from JsonRpcProvider. ```APIDOC ## ready ### Description Gets a promise that resolves when the provider is ready and has connected to the network. Inherited from JsonRpcProvider. ### Method `get` ### Returns `Promise` ### Inherited from `JsonRpcProvider.ready` ### Defined in `node_modules/@ethersproject/providers/lib/base-provider.d.ts:91` ``` -------------------------------- ### Get All Owners of a BAYC NFT Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Retrieves all owners for a specific NFT (Bored Ape Yacht Club in this example) from a contract. Metadata can be omitted for smaller payloads. ```typescript import { Alchemy } from 'alchemy-sdk'; const alchemy = new Alchemy(); // Bored Ape Yacht Club contract address. const baycAddress = '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D'; async function main() { for await (const nft of alchemy.nft.getNftsForContractIterator(baycAddress, { // Omit the NFT metadata for smaller payloads. omitMetadata: true })) { await alchemy.nft .getOwnersForNft(nft.contract.address, nft.tokenId) .then(response => console.log('owners:', response.owners, 'tokenId:', nft.tokenId) ); } } main(); ``` -------------------------------- ### Initialize Alchemy SDK with Settings Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Import and initialize the Alchemy SDK with custom settings for API key and network. Replace 'demo' and Network.ETH_MAINNET with your actual credentials. ```typescript import { Alchemy, Network } from 'alchemy-sdk'; // Optional config object, but defaults to the API key 'demo' and Network 'eth-mainnet'. const settings = { apiKey: 'demo', // Replace with your Alchemy API key. network: Network.ETH_MAINNET // Replace with your network. }; const alchemy = new Alchemy(settings); ``` -------------------------------- ### _ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Indicates that the provider is ready and returns the network information. ```APIDOC ## _ready ### Description Indicates that the provider is ready and returns the network information. ### Method (Implicitly internal, likely called by other provider methods) ### Returns Promise - A promise that resolves to the Network object. ``` -------------------------------- ### getAddress Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the wallet's address. ```APIDOC ## getAddress ### Description Gets the wallet's address. ### Method * getAddress(): Promise ### Returns * **Promise** - The wallet's address. ``` -------------------------------- ### provider Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the provider associated with the wallet. ```APIDOC ## provider ### Description Gets the provider associated with the wallet. ### Returns * **Provider** - The associated provider. ``` -------------------------------- ### Initialize Alchemy SDK and Make Requests Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/index.html Demonstrates initializing the Alchemy SDK with default settings and making various types of requests, including core Ethers.js provider methods, Alchemy Enhanced APIs, NFT API, and WebSocket subscriptions. Supports ENS name resolution. ```javascript import { Alchemy, AlchemySubscription } from 'alchemy-sdk'; // Using default settings - pass in a settings object to specify your API key and network const alchemy = new Alchemy(); // Access standard Ethers.js JSON-RPC node request alchemy.core.getBlockNumber().then(console.log); // Access Alchemy Enhanced API requests alchemy.core .getTokenBalances('0x3f5CE5FBFe3E9af3971dD833D26bA9b5C936f0bE') .then(console.log); // Access the Alchemy NFT API alchemy.nft.getNftsForOwner('vitalik.eth').then(console.log); // Access WebSockets and Alchemy-specific WS methods alchemy.ws.on( { method: AlchemySubscription.PENDING_TRANSACTIONS }, res => console.log(res) ); ``` -------------------------------- ### publicKey Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the public key of the wallet. ```APIDOC ## publicKey ### Description Gets the public key of the wallet. ### Returns * **string** - The public key. ``` -------------------------------- ### privateKey Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the private key of the wallet. ```APIDOC ## privateKey ### Description Gets the private key of the wallet. ### Returns * **string** - The private key. ``` -------------------------------- ### constructor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyConfig.html Initializes a new instance of the AlchemyConfig class. ```APIDOC ## constructor ### Description Initializes a new instance of the AlchemyConfig class. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Method * constructor ### Endpoint * N/A ### Returns * [AlchemyConfig](AlchemyConfig.html) ``` -------------------------------- ### _ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyProvider.md Returns a promise that resolves when the provider is ready. Inherited from JsonRpcProvider. ```APIDOC ## _ready ### Description Returns a promise that resolves when the provider is ready. Inherited from JsonRpcProvider. ### Method _ready ### Returns - **Promise** - A promise that resolves to the network object. ### Inherited from JsonRpcProvider._ready ### Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:90 ``` -------------------------------- ### fromMnemonic Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Creates a wallet from a mnemonic phrase. ```APIDOC ## fromMnemonic ### Description Creates a wallet from a mnemonic phrase. ### Method * static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist, options?: any): Wallet ### Parameters * **mnemonic** (string) - The mnemonic phrase. * **Optional path** (string) - The derivation path. * **Optional wordlist** (Wordlist) - The wordlist to use. * **Optional options** (any) - Additional options for wallet creation. ### Returns * **Wallet** - The created wallet. ``` -------------------------------- ### Get NFTs Owned by an Address Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/index.html Retrieve NFTs owned by a specific Ethereum address. You can get the total count of NFTs or iterate through all owned NFTs to access their media details. This can be useful for displaying a user's NFT collection. ```javascript import { Alchemy, NftExcludeFilters } from 'alchemy-sdk'; const alchemy = new Alchemy(); // Get how many NFTs an address owns. alchemy.nft.getNftsForOwner('vitalik.eth').then(nfts => { console.log(nfts.totalCount); }); // Get all the image urls for all the NFTs an address owns. async function main() { for await (const nft of alchemy.nft.getNftsForOwnerIterator('vitalik.eth')) { console.log(nft.media); } } main(); // Filter out spam NFTs. alchemy.nft .getNftsForOwner('vitalik.eth', { excludeFilters: [NftExcludeFilters.SPAM] }) .then(console.log); ``` -------------------------------- ### getContract Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/ContractFactory.md Gets a contract instance from an address and interface. ```APIDOC ## getContract address, contractInterface, signer? ### Description Gets a contract instance from an address and interface. ### Parameters #### Parameters - **address** (string) - The address of the contract. - **contractInterface** (ContractInterface) - The contract's interface. - **signer?** (Signer) - Optional signer for contract interactions. ### Returns `Contract` - The contract instance. ### Defined in node_modules/@ethersproject/contracts/lib/index.d.ts:154 ``` -------------------------------- ### Interface Constructor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/Utils.Interface.md Initializes a new Interface instance with ABI fragments. ```APIDOC ## new Interface(fragments) ### Description Initializes a new Interface instance. ### Parameters #### Parameters - **fragments** (string | readonly (string | Fragment | JsonFragment)[]) - The ABI fragments to initialize the interface with. ``` -------------------------------- ### getGasPrice Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the current gas price for the network. ```APIDOC ## getGasPrice ### Description Gets the current gas price for the network. ### Method * getGasPrice(): Promise ### Returns * **Promise** - The gas price. ``` -------------------------------- ### ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/CoreNamespace.html Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet. ```APIDOC ## ready ### Description Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet. This can be used for testing or attaching scripts to wait until the node is up and running smoothly. ### Method `ready` ### Returns Promise ``` -------------------------------- ### getFeeData Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the current fee data for the network. ```APIDOC ## getFeeData ### Description Gets the current fee data for the network. ### Method * getFeeData(): Promise ### Returns * **Promise** - The fee data. ``` -------------------------------- ### constructor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Initializes a new instance of the Wallet class. It accepts a private key and an optional Alchemy object or Provider, intelligently setting the provider. ```APIDOC ## constructor ### Description Initializes a new instance of the Wallet class. It accepts a private key and an optional Alchemy object or Provider, intelligently setting the provider. ### Parameters * **privateKey** (BytesLike | ExternallyOwnedAccount | SigningKey) - The private key or account details. * **Optional alchemyOrProvider** (Alchemy | Provider) - An Alchemy object or Ethers Provider. ``` -------------------------------- ### ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Returns a promise that resolves when the provider is ready and has network information. ```APIDOC ## ready ### Description Returns a promise that resolves with network information once the provider is ready. ### Method GET ### Endpoint N/A (Getter method) ### Returns - **Promise**: A promise that resolves to the Network object. ``` -------------------------------- ### getBalance Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the balance of the wallet's address. ```APIDOC ## getBalance ### Description Gets the balance of the wallet's address. ### Method * getBalance(): Promise ### Returns * **Promise** - The wallet's balance. ``` -------------------------------- ### address Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the public address associated with the wallet. ```APIDOC ## address ### Description Gets the public address associated with the wallet. ### Returns * **string** - The wallet's address. ``` -------------------------------- ### constructor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/Wallet.md Initializes a new instance of the Wallet class. It can accept either a Provider or an Alchemy object, and it intelligently sets the provider accordingly. ```APIDOC ## constructor ### Description Initializes a new instance of the Wallet class. ### Parameters - **providerOrSigner** (Provider | Signer | Alchemy): An Ethers.js Provider, Signer, or an Alchemy object. - **privateKey** (string): The private key to use for signing. - **options** (WalletOptions): Optional configuration options. ``` -------------------------------- ### _deployed Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Contract.html Internal method to get the deployed contract. ```APIDOC ## _deployed ### Description Internal method to get the deployed contract. ### Method Not applicable (Internal SDK method) ### Parameters #### Path Parameters None #### Query Parameters - **blockTag** ([BlockTag](../modules.html#BlockTag)) - Optional - The block tag to check for deployment. #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Promise) #### Response Example (Not specified) ``` -------------------------------- ### getMintedNfts Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NftNamespace.html Get all the NFTs minted by a specified owner address. ```APIDOC ## getMintedNfts ### Description Get all the NFTs minted by a specified owner address. ### Method (Not specified, likely a SDK method call) ### Endpoint (Not specified, likely a SDK method call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Parameters #### owner (string) - Required - Address for the NFT owner (can be in ENS format). #### options (GetMintedNftsOptions) - Optional - The optional parameters to use for the request. ### Response #### Success Response (Type: Promise) #### Response Example (Not specified) ``` -------------------------------- ### ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/CoreNamespace.md Returns a Promise which will stall until the network has been established, ignoring errors due to the target node not being active yet. This can be used for testing or attaching scripts to wait until the node is up and running smoothly. ```APIDOC ## ready ### Description Returns a Promise which will stall until the network has been established, ignoring errors due to the target node not being active yet. This can be used for testing or attaching scripts to wait until the node is up and running smoothly. ### Method N/A (SDK Method) ### Endpoint N/A (SDK Method) ### Parameters None ### Returns `Promise` - A promise that resolves with the network information once established. ### Defined in [src/api/core-namespace.ts:228](https://github.com/alchemyplatform/alchemy-sdk-js/blob/1ee40cb2/src/api/core-namespace.ts#L228) ``` -------------------------------- ### getTransactionCount Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the transaction count for the wallet's address. ```APIDOC ## getTransactionCount ### Description Gets the transaction count for the wallet's address. ### Method * getTransactionCount(): Promise ### Returns * **Promise** - The transaction count. ``` -------------------------------- ### getChainId Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Gets the chain ID of the network the wallet is connected to. ```APIDOC ## getChainId ### Description Gets the chain ID of the network the wallet is connected to. ### Method * getChainId(): Promise ### Returns * **Promise** - The chain ID. ``` -------------------------------- ### Use Alchemy SDK with Default Settings Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/README.md Demonstrates accessing different namespaces of the Alchemy SDK using default initialization. This includes core JSON-RPC requests, enhanced API methods, NFT API, and WebSockets. ```typescript import { Alchemy, AlchemySubscription } from 'alchemy-sdk'; // Using default settings - pass in a settings object to specify your API key and network const alchemy = new Alchemy(); // Access standard Ethers.js JSON-RPC node request alchemy.core.getBlockNumber().then(console.log); // Access Alchemy Enhanced API requests alchemy.core .getTokenBalances('0x3f5CE5FBFe3E9af3971dD833D26bA9b5C936f0bE') .then(console.log); // Access the Alchemy NFT API alchemy.nft.getNftsForOwner('vitalik.eth').then(console.log); // Access WebSockets and Alchemy-specific WS methods alchemy.ws.on( { method: AlchemySubscription.PENDING_TRANSACTIONS }, res => console.log(res) ); ``` -------------------------------- ### createWebhook (Address Activity) Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NotifyNamespace.html Creates a new AddressActivityWebhook to track address activity. It requires a URL, the type set to ADDRESS_ACTIVITY, and parameters specifying the addresses to track and the network. ```APIDOC ## createWebhook (Address Activity) ### Description Create a new AddressActivityWebhook to track address activity. ### Method POST (assumed, as it's creating a resource) ### Endpoint /webhooks ### Parameters #### Query Parameters - **url** (string) - Required - The URL that the webhook should send events to. - **type** (ADDRESS_ACTIVITY) - Required - The type of webhook to create. #### Request Body - **params** (AddressWebhookParams) - Required - Parameters object containing the addresses to track and the network the webhook should be created on. ``` -------------------------------- ### network Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Gets the network the provider is connected to. This is an accessor inherited from JsonRpcProvider. ```APIDOC ## network ### Description Gets the network the provider is connected to. This is an accessor inherited from JsonRpcProvider. ### Accessor - get network(): Network ### Returns - Network ### Source Inherited from JsonRpcProvider.network Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:98 ``` -------------------------------- ### createWebhook (NFT Activity) Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NotifyNamespace.html Creates a new NftActivityWebhook to track NFT transfers. It requires a URL, the type set to NFT_ACTIVITY, and parameters specifying the NFTs to track and the network. ```APIDOC ## createWebhook (NFT Activity) ### Description Create a new NftActivityWebhook to track NFT transfers. ### Method POST (assumed, as it's creating a resource) ### Endpoint /webhooks ### Parameters #### Query Parameters - **url** (string) - Required - The URL that the webhook should send events to. - **type** (NFT_ACTIVITY) - Required - The type of webhook to create. #### Request Body - **params** (NftWebhookParams) - Required - Parameters object containing the NFTs to track and the network the webhook should be created on. ``` -------------------------------- ### blockNumber Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Gets the current block number. This is an accessor inherited from JsonRpcProvider. ```APIDOC ## blockNumber ### Description Gets the current block number. This is an accessor inherited from JsonRpcProvider. ### Accessor - get blockNumber(): number ### Returns - number ### Source Inherited from JsonRpcProvider.blockNumber Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:101 ``` -------------------------------- ### getTransfersForOwner Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NftNamespace.html Gets all NFT transfers for a given owner's address. ```APIDOC ## getTransfersForOwner ### Description Gets all NFT transfers for a given owner's address. ### Method getTransfersForOwner ### Parameters #### Path Parameters * **owner** (string) - Required - The owner to get transfers for. * **category** (GetTransfersForOwnerTransferType) - Required - Whether to get transfers to or from the owner address. * **options** (GetTransfersForOwnerOptions) - Optional - Additional options for the request. ### Returns Promise ``` -------------------------------- ### deploy Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/ContractFactory.html Deploys a new contract. ```APIDOC ## deploy(...args: any[]): Promise ### Description Deploys a new contract with the provided arguments. ### Parameters #### Parameters - **...args**: any[] - Arguments to pass to the contract constructor. #### Returns Promise - A promise that resolves to the deployed contract instance. ``` -------------------------------- ### fromMnemonic Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Creates a Wallet instance from a mnemonic phrase. This is a static method inherited from EthersWallet.fromMnemonic. ```APIDOC ## fromMnemonic ### Description Creates a Wallet instance from a mnemonic phrase. ### Method Static method ### Endpoint (Not explicitly defined, likely an SDK method call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **mnemonic** (string) - Required - The mnemonic phrase. - **path** (string) - Optional - The derivation path. - **wordlist** (Wordlist) - Optional - The wordlist to use. ### Request Example (Not provided in source) ### Response #### Success Response - **Wallet** - A Wallet instance. #### Response Example (Not provided in source) ``` -------------------------------- ### getTransfersForContract Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NftNamespace.html Gets all NFT transfers for a given NFT contract address. ```APIDOC ## getTransfersForContract ### Description Gets all NFT transfers for a given NFT contract address. Defaults to all transfers for the contract. To get transfers for a specific block range, use [GetTransfersForContractOptions](../interfaces/GetTransfersForContractOptions.html). ### Method getTransfersForContract ### Parameters #### Path Parameters * **contract** (string) - Required - The NFT contract to get transfers for. * **options** (GetTransfersForContractOptions) - Optional - Additional options for the request. ### Returns Promise ``` -------------------------------- ### Portfolio Namespace Methods Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Methods for fetching fungible tokens, NFTs, and transactions for wallet addresses. ```APIDOC ## Portfolio Namespace Methods on the `PortfolioNamespace` can be accessed via `alchemy.portfolio`. ### `getTokensByWallet()` Fetches fungible tokens (native and ERC-20) for multiple wallet addresses and networks. ### `getTokenBalancesByWallet()` Fetches fungible tokens (native and ERC-20) for multiple wallet addresses and networks. ### `getNftsByWallet()` Fetches NFTs for multiple wallet addresses and networks. ### `getNftCollectionsByWallet()` Fetches NFT collections (contracts) for multiple wallet addresses and networks. ### `getTransactionsByWallet()` Fetches all historical transactions (internal & external) for multiple wallet addresses and networks. ``` -------------------------------- ### getContractsForOwner Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NftNamespace.html Gets all NFT contracts held by the specified owner address. ```APIDOC ## getContractsForOwner ### Description Gets all NFT contracts held by the specified owner address. ### Method (Not specified, likely a SDK method call) ### Endpoint (Not specified, likely a SDK method call) ### Parameters #### Path Parameters (None) #### Query Parameters (None) #### Request Body (None) ### Parameters #### owner (string) - Required - Address for NFT owner (can be in ENS format!). #### options (GetContractsForOwnerOptions) - Optional - The optional parameters to use for the request. ### Response #### Success Response (Type: Promise) #### Response Example (Not specified) ``` -------------------------------- ### fromSolidity Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/ContractFactory.html Creates a ContractFactory instance from Solidity compiler output. ```APIDOC ## fromSolidity(compilerOutput: any, signer?: Signer): ContractFactory ### Description Creates a ContractFactory instance from Solidity compiler output. ### Parameters #### Parameters - **compilerOutput**: any - The Solidity compiler output. - **signer** (Optional): Signer - The signer to use for contract interactions. #### Returns ContractFactory - A new ContractFactory instance. ``` -------------------------------- ### getContract Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/ContractFactory.html Gets a Contract instance from an address, interface, and optional signer. ```APIDOC ## getContract(address: string, contractInterface: ContractInterface, signer?: Signer): Contract ### Description Gets a Contract instance from an address, interface, and optional signer. ### Parameters #### Parameters - **address**: string - The address of the contract. - **contractInterface**: ContractInterface - The interface of the contract. - **signer** (Optional): Signer - The signer to use for contract interactions. #### Returns Contract - An instance of the Contract class. ``` -------------------------------- ### getAllWebhooks Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NotifyNamespace.html Retrieves all configured webhooks. ```APIDOC ## getAllWebhooks ### Description Retrieves a list of all webhooks configured for your account. ### Method GET ### Endpoint /notify/v1/webhooks ### Parameters None ### Response #### Success Response (200) - **webhooks** (object[]) - An array of webhook objects. Each object contains details about a specific webhook. #### Response Example ```json { "webhooks": [ { "id": "wh_abc123", "url": "https://example.com/webhook", "type": "MINED_TRANSACTION", "params": { "addresses": ["0x123..."], "includeRawTransaction": true }, "createdAt": "2023-10-27T10:00:00Z" }, { "id": "wh_def456", "url": "https://example.com/another-webhook", "type": "NFT_ACTIVITY", "params": { "contractAddresses": ["0x789..."], "eventTypes": ["TRANSFER"] }, "createdAt": "2023-10-27T11:00:00Z" } ] } ``` ``` -------------------------------- ### _getBlock Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyWebSocketProvider.md Internal method to get a block by its hash or tag. It is inherited from WebSocketProvider. ```APIDOC ## _getBlock ### Description Internal method to get a block by its hash or tag. It is inherited from WebSocketProvider. ### Method Not specified (internal method) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **blockHashOrBlockTag** ([`BlockTag`](../modules.md#blocktag) | `Promise<[`BlockTag`](../modules.md#blocktag)>`) - Description not available - **includeTransactions?** (boolean) - Description not available ### Returns `Promise<[`Block`](../interfaces/Block.md) | [`BlockWithTransactions`](../interfaces/BlockWithTransactions.md)>` ### Inherited from WebSocketProvider._getBlock ### Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:131 ``` -------------------------------- ### createWebhook (Custom GraphQL) Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NotifyNamespace.html Creates a new CustomGraphqlWebhook to track any event on every block. It requires a URL, the type set to GRAPHQL, and parameters including the graphql query. ```APIDOC ## createWebhook (Custom GraphQL) ### Description Create a new CustomGraphqlWebhook to track any event on every block. ### Method POST (assumed, as it's creating a resource) ### Endpoint /webhooks ### Parameters #### Query Parameters - **url** (string) - Required - The URL that the webhook should send events to. - **type** (GRAPHQL) - Required - The type of webhook to create. #### Request Body - **params** (CustomGraphqlWebhookParams) - Required - Parameters object containing the graphql query to be executed on every block ``` -------------------------------- ### Access Core SDK Functionality Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/README.md Demonstrates accessing core functionalities like getting the block number and token balances using the Alchemy SDK. It also shows how to use ENS names for addresses. ```typescript import { Alchemy, AlchemySubscription } from 'alchemy-sdk'; // Using default settings - pass in a settings object to specify your API key and network const alchemy = new Alchemy(); // Access standard Ethers.js JSON-RPC node request alchemy.core.getBlockNumber().then(console.log); // Access Alchemy Enhanced API requests alchemy.core .getTokenBalances('0x3f5CE5FBFe3E9af3971dD833D26bA9b5C936f0bE') .then(console.log); ``` -------------------------------- ### _getAddress Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyWebSocketProvider.md Internal method to get an address from a name or address. It is inherited from WebSocketProvider. ```APIDOC ## _getAddress ### Description Internal method to get an address from a name or address. It is inherited from WebSocketProvider. ### Method Not specified (internal method) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **addressOrName** (string | `Promise`) - Description not available ### Returns `Promise` ### Inherited from WebSocketProvider._getAddress ### Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:130 ``` -------------------------------- ### pollingInterval Accessor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyProvider.md Gets or sets the interval for polling in milliseconds. Inherited from JsonRpcProvider. ```APIDOC ## pollingInterval ### Description Gets or sets the interval for polling in milliseconds. Inherited from JsonRpcProvider. ### Getter #### Method `get` #### Returns `number` ### Setter #### Method `set` #### Parameters | Name | Type | | :------ | :------ | | `value` | `number` | #### Returns `void` ### Inherited from `JsonRpcProvider.pollingInterval` ### Defined in `node_modules/@ethersproject/providers/lib/base-provider.d.ts:104` `node_modules/@ethersproject/providers/lib/base-provider.d.ts:105` ``` -------------------------------- ### ws Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Alchemy.html The `ws` namespace contains methods for using WebSockets and creating subscriptions. ```APIDOC ## ws ### Description The `ws` namespace contains methods for using WebSockets and creating subscriptions. ### Namespace [WebSocketNamespace](WebSocketNamespace.html) ### Defined in [src/api/alchemy.ts:32](https://github.com/alchemyplatform/alchemy-sdk-js/blob/1ee40cb2/src/api/alchemy.ts#L32) ``` -------------------------------- ### polling Accessor Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyProvider.md Gets or sets the polling status of the provider. Inherited from JsonRpcProvider. ```APIDOC ## polling ### Description Gets or sets the polling status of the provider. Inherited from JsonRpcProvider. ### Getter #### Method `get` #### Returns `boolean` ### Setter #### Method `set` #### Parameters | Name | Type | | :------ | :------ | | `value` | `boolean` | #### Returns `void` ### Inherited from `JsonRpcProvider.polling` ### Defined in `node_modules/@ethersproject/providers/lib/base-provider.d.ts:102` `node_modules/@ethersproject/providers/lib/base-provider.d.ts:103` ``` -------------------------------- ### getOwnersForNft Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/NftNamespace.html Gets all the owners for a given NFT contract address and token ID. ```APIDOC ## getOwnersForNft ### Description Gets all the owners for a given NFT contract address and token ID. ### Method getOwnersForNft ### Parameters #### Path Parameters * **contractAddress** (string) - Required - The NFT contract address. * **tokenId** (BigNumberish) - Required - Token id of the NFT. * **options** (GetOwnersForNftOptions) - Optional - Optional parameters to use for the request. ### Returns Promise ``` -------------------------------- ### getWallet Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Returns the wallet instance. ```APIDOC ## getWallet ### Description Returns the wallet instance. ### Method * getWallet(): Wallet ### Returns * **Wallet** - The wallet instance. ``` -------------------------------- ### getTransactionReceipts Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/CoreNamespace.html Gets all transaction receipts for a given block by number or block hash. ```APIDOC ## getTransactionReceipts ### Description Gets all transaction receipts for a given block by number or block hash. ### Method `getTransactionReceipts` ### Parameters #### Path Parameters - **params** (TransactionReceiptsParams) - Required - An object containing fields for the transaction receipt query. ### Returns Promise ``` -------------------------------- ### on Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/WebSocketNamespace.html Adds a listener to be triggered for each specified event. Supports Alchemy's Subscription API events. ```APIDOC ## on ### Description Adds a listener to be triggered for each `eventName` event. Also includes Alchemy's Subscription API events. See [AlchemyEventType](../modules.html#AlchemyEventType) for how to use them. ### Method `on` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Parameters * **eventName**: [AlchemyEventType](../modules.html#AlchemyEventType) - Required - The event to listen for. * **listener**: Listener - Required - The listener to call when the event is triggered. ### Returns * [WebSocketNamespace](WebSocketNamespace.html) - The WebSocketNamespace instance for chaining. ``` -------------------------------- ### _ready Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyWebSocketProvider.md Asynchronously detects and returns the network the provider is connected to. This method is inherited from WebSocketProvider. ```APIDOC ## _ready ### Description Asynchronously detects and returns the network the provider is connected to. ### Returns `Promise` - A promise that resolves to the detected network information. ### Inherited from WebSocketProvider._ready ### Defined in node_modules/@ethersproject/providers/lib/base-provider.d.ts:90 ``` -------------------------------- ### _wrapTransaction Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/AlchemyProvider.html Wraps a transaction object, optionally adding a hash and start block. ```APIDOC ## _wrapTransaction ### Description Wraps a transaction object, optionally adding a hash and start block. ### Method (Implicitly internal, likely called by other provider methods) ### Parameters #### Query Parameters - **tx** (Transaction) - Required - The transaction object to wrap. - **hash** (string) - Optional - The hash of the transaction. - **startBlock** (number) - Optional - The starting block number. ``` -------------------------------- ### websocket Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/AlchemyWebSocketProvider.md Gets the WebSocket instance used by the provider. This is an accessor that returns a WebSocketLike object. ```APIDOC ## websocket ### Description Gets the WebSocket instance used by the provider. ### Method - `get` **websocket**(): `WebSocketLike` ### Returns - `WebSocketLike`: The WebSocket instance. ``` -------------------------------- ### createWebhook (NftActivityWebhook) Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs-md/classes/NotifyNamespace.md Creates a new NftActivityWebhook to track NFT transfers. This webhook can be configured to monitor specific NFTs and networks. ```APIDOC ## createWebhook (NftActivityWebhook) ### Description Create a new [NftActivityWebhook](../interfaces/NftActivityWebhook.md) to track NFT transfers. ### Method POST ### Endpoint /webhooks ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **url** (string) - Required - The URL that the webhook should send events to. - **type** (NFT_ACTIVITY) - Required - The type of webhook to create. - **params** (NftWebhookParams) - Required - Parameters object containing the NFTs to track and the network the webhook should be created on. ### Request Example ```json { "url": "YOUR_WEBHOOK_URL", "type": "NFT_ACTIVITY", "params": { "contractAddresses": ["0x123..."], "tokenIds": ["1", "2"], "network": "ETH_GOERLI" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the webhook. - **url** (string) - The URL the webhook sends events to. - **type** (string) - The type of the webhook. - **createdAt** (string) - The timestamp when the webhook was created. #### Response Example ```json { "id": "wh_1234567890abcdef", "url": "YOUR_WEBHOOK_URL", "type": "NFT_ACTIVITY", "createdAt": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### fromEncryptedJsonSync Source: https://github.com/alchemyplatform/alchemy-sdk-js/blob/master/docs/classes/Wallet.html Creates a wallet from an encrypted JSON keystore synchronously. ```APIDOC ## fromEncryptedJsonSync ### Description Creates a wallet from an encrypted JSON keystore synchronously. ### Method * static fromEncryptedJsonSync(json: string, password: string, options?: any): Wallet ### Parameters * **json** (string) - The encrypted JSON keystore. * **password** (string) - The password for decryption. * **Optional options** (any) - Additional options for decryption. ### Returns * **Wallet** - The decrypted wallet. ```