UNPKG

@hyperlane-xyz/starknet-core

Version:

Core cairo contracts for Hyperlane

97 lines (61 loc) 2.15 kB
# Hyperlane Starknet Core The Hyperlane Starknet Core package provides TypeScript tooling for interacting with Hyperlane's Cairo contracts on Starknet. It includes TypeScript artifacts autogenerated from Cairo contracts developed in collaboration with Astraly Labs. ## Features - Pre-compiled Cairo contract ABI artifacts - TypeScript bindings for Starknet contracts ## Installation ```bash # Install with NPM npm install @hyperlane-xyz/starknet-core # Or with Yarn yarn add @hyperlane-xyz/starknet-core ``` ## Requirements - Node.js 18 or newer - For development: `curl`, `jq`, and `unzip` utilities ## Usage ```typescript import { ContractType, getCompiledContract, } from '@hyperlane-xyz/starknet-core'; // Get the Hyperlane mailbox contract const mailboxContract = getCompiledContract('mailbox'); // Get token contracts const tokenContract = getCompiledContract('erc20', ContractType.TOKEN); // Get mock contracts const mockContract = getCompiledContract('mock_validator', ContractType.MOCK); ``` ## Contract Categories Contracts are organized into three categories: - `contracts`: Core Hyperlane protocol contracts - `tokens`: Token implementation contracts - `mocks`: Test and mock contracts ## Development ### Setup 1. Clone the repository 2. Install dependencies: `yarn install` ### Build Process The build process combines multiple steps in a specific order: ```bash yarn build ``` This command runs: 1. TypeScript compilation (`tsc`) 2. Fetching contract artifacts from GitHub (`fetch-contracts`) 3. Generating TypeScript ABI artifacts from Cairo contracts (`generate-artifacts`) All build output is placed in the `dist` directory. ### Individual Build Steps You can also run the individual build steps separately: #### Fetching Contract Artifacts ```bash yarn fetch-contracts ``` This downloads the contract artifacts from the [Hyperlane Starknet repository](https://github.com/hyperlane-xyz/hyperlane_starknet). #### Generating TypeScript Artifacts ```bash yarn generate-artifacts ``` This creates JavaScript and TypeScript declaration files in the `dist/artifacts` directory. ## License Apache 2.0