GithubHelp home page GithubHelp logo

bedlam520 / alchemy-multichain-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alchemyplatform/alchemy-multichain-demo

0.0 0.0 0.0 21 KB

Demo on how to manage multiple chains when using the Alchemy SDK

TypeScript 100.00%

alchemy-multichain-demo's Introduction

Alchemy SDK Multichain Demo

This is a simple demo of how to use the Alchemy SDK with multiple chains in a single application while managing the different API keys and endpoints for each chain.

The src/alchemy-multi-chain-client.ts file contains a sample implementation of a AlchemyMultichainClient class, which is a wrapper around the Alchemy SDK that allows using multiple chains in a single application. This should be a good starting point for building out your own multichain application using the Alchemy SDK.

The src/index.ts file contains a simple demo using the AlchemyMultichainClient class to make requests across multiple chains. Please feel free to modify this demo file to test out different requests and chains.

Getting Started

To get started, clone this repo. Then, run npm install to install the dependencies. To run the demo, run npm run demo.

Sample Usage

Here's a sample usage of the AlchemyMultichainClient class from the demo:

import { AlchemyMultichainClient } from './alchemy-multichain-client';
import { Network } from 'alchemy-sdk';

const owner = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045';
const defaultSettings = { apiKey: 'default-api-key' };
const overrides = {
  [Network.MATIC_MAINNET]: { apiKey: 'matic-api-key' }
};
const alchemy = new AlchemyMultichainClient(defaultSettings, overrides);
alchemy.forNetwork(Network.ETH_MAINNET).getNftsForOwner(owner); // Uses `default-api-key`
alchemy.forNetwork(Network.MATIC_MAINNET).getNftsForOwner(owner); // Uses `matic-api-key`

Please feel free to copy or modify this sample implementation to suit your needs in your own projects!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.