@hop-protocol/sdk-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

Hop SDK Core

This code is shared across Hop TypeScript SDKs.

License NPM version

[!NOTE] This package is only meant to be used by the Hop TypeScript SDKs. We recommend installing one of the Hop SDKs if you want access to functionality in this package.

Development

Install dependencies

pnpm install

Build sdk

pnpm build

Run github action build locally with act:

(cd ../../ && act --job publish-sdk --workflows .github/workflows/npm_publish_sdk.yml --secret-file=.secrets --verbose)

Test

pnpm test

Adding New Contracts

The logic to create a new entry in the contract/ module requires a deprecated version of typechain that does not work well with modern tooling. This logic has been moved out of this repository and new contracts should be created out of band and copied here.

The ABI file should be a simple JSON file with only the contract ABI (example).

# Create contracts
npm i -g typechain@8.1.0 && npm i -g @typechain/ethers-v5@10.1.0
typechain --target=ethers-v5 --out-dir=<OUT_DIR> <ABI_FILE>.json

# Update imports at <OUT_DIR>/<CONTRACT>.ts. Add `.js` to the `from "./common"` import
from "./common.js"

# Update imports at <OUT_DIR>/factories/<CONTRACT>__factory.ts. Add `.js` to the `from "./<CONTRACT>"` import
from "../<CONTRACT>.js"

# Move relevant files
mv <OUT_DIR>/<CONTRACT>.ts <SDK_DIR>/src/contracts/
mv <OUT_DIR>/factories/<CONTRACT>__factory.ts <SDK_DIR>/src/contracts/factories

# Add to SDK contracts exports at <SDK_DIR>/src/contracts/index.ts
export type { <CONTRACT> } from "./<CONTRACT>.js"
export { <CONTRACT>__factory } from "./<CONTRACT>__factory.js"

# Add to SDK contract factories exports at <SDK_DIR>/src/contracts/factories/index.ts
export { <CONTRACT>__factory } from "./<CONTRACT>__factory.js"

License

MIT

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @hop-protocol/sdk-core

    Homepage

    hop.exchange

    Weekly Downloads

    849

    Version

    0.0.13

    License

    MIT

    Unpacked Size

    1.68 MB

    Total Files

    709

    Last publish

    Collaborators

    • miguelmota
    • shanefontaine
    • cwhinfrey