https://github.com/morpho-org/sdks
Collection of SDKs to ease interactions with the Morpho protocol and Morpho Vaults
https://github.com/morpho-org/sdks
anvil apollo bundler ethers graphql liquidation sdk simulation test viem vitest wagmi
Last synced: 4 days ago
JSON representation
Collection of SDKs to ease interactions with the Morpho protocol and Morpho Vaults
- Host: GitHub
- URL: https://github.com/morpho-org/sdks
- Owner: morpho-org
- License: mit
- Created: 2024-07-16T07:02:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-25T09:45:50.000Z (11 months ago)
- Last Synced: 2025-02-25T09:47:01.102Z (11 months ago)
- Topics: anvil, apollo, bundler, ethers, graphql, liquidation, sdk, simulation, test, viem, vitest, wagmi
- Language: TypeScript
- Homepage: https://morpho.org
- Size: 6.28 MB
- Stars: 16
- Watchers: 5
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Morpho SDKs

A collection of Software Development Kits to ease interactions with the Morpho protocol and Morpho Vaults.
## Getting Started
### Viem
- [**`@morpho-org/blue-sdk-viem`**](./packages/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`**](./packages/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`**](./packages/liquidity-sdk-viem/): Viem-based package that helps seamlessly calculate the liquidity available through the PublicAllocator
- [**`@morpho-org/liquidation-sdk-viem`**](./packages/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
- [**`@morpho-org/blue-sdk-wagmi`**](./packages/blue-sdk-wagmi/): Wagmi-based package that exports Wagmi (React) hooks to fetch Morpho-related entities
- [**`@morpho-org/simulation-sdk-wagmi`**](./packages/simulation-sdk-wagmi/): Wagmi-based extension of `@morpho-org/simulation-sdk` that exports Wagmi (React) hooks to fetch simulation states
### Development
- [**`@morpho-org/morpho-ts`**](./packages/morpho-ts/): TypeScript package to handle all things time & format-related
- [**`@morpho-org/blue-sdk`**](./packages/blue-sdk/): Framework-agnostic package that defines Morpho-related entity classes (such as `Market`, `Token`, `Vault`)
- [**`@morpho-org/simulation-sdk`**](./packages/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`**](./packages/test/): Viem-based package that exports utilities to build Vitest & Playwright fixtures that spawn anvil forks as child processes
- [**`@morpho-org/test-wagmi`**](./packages/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`**](./packages/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](./docs/adding-new-chain.md) 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`
```diff
- "@morpho-org/blue-sdk": "5.0.0",
+ "@morpho-org/blue-sdk": "link:../../../sdks/packages/blue-sdk",
```
2. Modify `blue-sdk` [package.json](./packages/blue-sdk/package.json) to use js main & js files:
```diff
- "main": "src/index.ts",
+ "main": "lib/index.js",
+ "types": "lib/index.d.ts"
```
3. In a separate process, start: `pnpm --dir packages/blue-sdk build --watch`
## Authors
- [@rubilmax](https://github.com/rubilmax) (rubilmax.eth, [Twitter](https://x.com/rubilmax))
- [@oumar-fall](https://github.com/oumar-fall) (oumix.eth)
- [@julien-devatom](https://github.com/oumar-fall) ([Twitter](https://x.com/julien_devatom))
## License
[MIT](/LICENSE) License