Infinex SDK
The Infinex SDK provides a comprehensive toolkit for interacting with the Infinex multichain ecosystem. It supports a wide range of blockchain networks and allows for seamless integration with Infinex contracts. This README provides an overview of the SDK's capabilities, installation instructions, usage examples, and configuration options.
Installation
To install dependencies
pnpm i
To fetch the latest address from cannon
pnpm run fetch:addresses
To process abis from /out
pnpm run sdk:build
Overview
.env.*
- For now we have mapped enviroments to our deployed enviroments. Which are:
- Each enviroment will hold the addresses for the deployed contracts.
/chains
-
A list of chains that are configured with a set of enviroment variables. These will eventually be in side the deployments repo and injected in. At the moment you will need to have all the .env vars pnpm run fetch:address
will give you all the evm address needed to start.
-
Chains are configured with most of the default contracts and account you will need per chain. Theres no ambguity about which address are needed and which are not.
-
As the contracts are worked on the sdk will add the necessary address to keep up to date with the interfaces and contracts
/contracts
/utils
Adding contracts
To add new contracts, follow these steps:
- Add the contract to the
.env.*.template
if theres multiple contracts please update each enviroment.
- Prefix the ADDRESS with the chain its on ie:
base
= BASE
- Add the contract in the contracts folder. Copy an exsisting contract in that folder.
- Add that contract name prefixed with the chain to the
/env
types and to /schema
to catch missing contract addresses. - Add the
/out
contract name for example AccountFactory
to the the config contract list. - Run the
pnpm run build
build to copy and format the abi
Building the addresses
Under the hood we currently use cannon to do deployments and we deploy, local
/ testnet
/ mainnet
/ forked-mainnet
each env will have different addresses therefore we need to build and fetch the addresses for any enviroment.
The addresses are stored in a cache if not published to usecannon.com. In order to fetch the addresses, we want we should update the src code as followed:
./scripts/getPublishedContracts */
pnpm run fetch:addresses --package-scope="infinex-multichain" --package-version="latest" --include-chains="arbitrum, ethereum, base"
Fetching all chains
pnpm run fetch:addresses --package-scope="infinex-multichain" --package-version="latest"
All the addrsses will be here
./deployments/addresse.txt
ARBITRUM_FORWARDER_ADDRESS='0x5c593fdE5a2C8d9C6A2C7785490dd879E01e1a74'
ARBITRUM_ACCOUNT_FACTORY_ADDRESS='0x628cF9F21731E56E63768Ce993cBAF70A7C52cA4'
ARBITRUM_INFINEX_PROTOCOL_CONFIG_BEACON_ADDRESS='0x2b8587b08bB3DB1fA969792A255b2dC6385266A9'