13.3.0 • Published 4 months ago

@hyperlane-xyz/starknet-core v13.3.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

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

# 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

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:

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

yarn fetch-contracts

This downloads the contract artifacts from the Hyperlane Starknet repository.

Generating TypeScript Artifacts

yarn generate-artifacts

This creates JavaScript and TypeScript declaration files in the dist/artifacts directory.

License

Apache 2.0

13.3.0

4 months ago

13.2.1

5 months ago

13.2.0

5 months ago

13.1.1

5 months ago

13.1.0

5 months ago

13.0.0

5 months ago

13.0.0-starknet.1

6 months ago

13.0.0-starknet.0

6 months ago