Skip to content

oraichain/morpho-sdks

 
 

Repository files navigation

Morpho SDKs

image

A collection of Software Development Kits to ease interactions with the Morpho protocol and Morpho Vaults.


Getting Started

Viem

  • @morpho-org/blue-sdk-viem: Viem-based augmentation of @morpho-org/blue-sdk that exports (and optionally injects) viem-based fetch methods
  • @morpho-org/bundler-sdk-viem: Viem-based extension of @morpho-org/simulation-sdk that exports utilities to transform simple interactions on Morpho (such as Blue_Borrow) and Morpho Vaults (such as MetaMorpho_Deposit) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain
  • @morpho-org/liquidity-sdk-viem: Viem-based package that helps seamlessly calculate the liquidity available through the PublicAllocator
  • @morpho-org/liquidation-sdk-viem: Viem-based package that provides utilities to build viem-based liquidation bots on Morpho and examples using Flashbots and Morpho's GraphQL API

Wagmi

Development

  • @morpho-org/morpho-ts: TypeScript package to handle all things time & format-related

  • @morpho-org/blue-sdk: Framework-agnostic package that defines Morpho-related entity classes (such as Market, Token, Vault)

  • @morpho-org/simulation-sdk: Framework-agnostic package that defines methods to simulate interactions on Morpho (such as Supply, Borrow) and Morpho Vaults (such as Deposit, Withdraw)

Testing

  • @morpho-org/test: Viem-based package that exports utilities to build Vitest & Playwright fixtures that spawn anvil forks as child processes

  • @morpho-org/test-wagmi: Wagmi-based extension of @morpho-org/test that injects a test Wagmi config as a test fixture alongside viem's anvil client

  • @morpho-org/morpho-test: Framework-agnostic extension of @morpho-org/blue-sdk that exports test fixtures useful for E2E tests on forks

Test coverage

  1. Install lcov: sudo apt install lcov
  2. Generate coverage info: pnpm test:coverage
  3. Generate hierarchical coverage report: pnpm coverage:report

Getting involved

Learn how to add a new chain configuration to the sdks.

Debugging

Here's a tutorial on how to link a specific package to debug at runtime:

  1. From the repository in which you want to link the package: pnpm link ../your/relative/path/to/sdks/packages/blue-sdk
-    "@morpho-org/blue-sdk": "5.0.0",
+    "@morpho-org/blue-sdk": "link:../../../sdks/packages/blue-sdk",
  1. Modify blue-sdk package.json to use js main & js files:
-  "main": "src/index.ts",
+  "main": "lib/index.js",
+  "types": "lib/index.d.ts"
  1. In a separate process, start: pnpm --dir packages/blue-sdk build --watch

Authors

License

MIT License

About

Collection of SDKs to ease interactions with the Morpho protocol and Morpho Vaults

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.7%
  • Solidity 3.1%
  • JavaScript 0.2%