Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds origination fee and program fee related updates #934

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,49 +64,6 @@ We welcome contributions to `mrgn-ts`! Please review our [contributing guideline

## Updating the IDL

For historical reasons, the IDL file in this repository should be updated using
the marginfi-v2 CLI tool to ensure the IDL stays in its canonical format.
This is largely due to changes in the byte packing code used by Anchor,
and the fact that Rust removed the `#repr(packed)` option in later releases.
The process is to build the IDL file in the marginfi-v2 repository, patch it,
then copy it into this repository and format it (via prettier).
The IDL can be copied directly from the target/deploy folder. Make sure you have built without any feature flags (i.e. `anchor build`). The default configuration is correct for mainnet.

To update the IDL:

1. Checkout the [marginfi-v2-cli](https://github.com/mrgnlabs/marginfi-v2/tree/main)
repository and build it. Ensure you are on an x86-64 machine to get the build
to succeed. Ensure the [solana](https://docs.solanalabs.com/cli/install) CLI tool is installed,
alongside anchor and rust and yarn.

2. Run marginfi-v2/scripts/build-workspace to generate the original IDL (anchor build)

3. Use the [marginfi-v2-cli](https://github.com/mrgnlabs/marginfi-v2/tree/main/clients/rust/marginfi-cli)
and run the `patch-idl` command against the generated marginfi.json IDL in the marginfi-v2 repository.

Ensure you are on main branch in marginfi-v2.

For example, run this command from the root of the marginfi-v2 repository,

```
cargo run \
--package marginfi-v2-cli \
--features dev \
-- patch-idl target
```

where `target` is the target directory for rust binaries. There should be an idl
folder with the idl inside of `target`.

This produces a modified marginfi.json file alongside the original file.
The \_original file can be removed but is useful for checking diffs.

4. Copy the marginfi.json file and the marginfi-types.ts into this repository.
5. Lint the new IDL file using the prettier linter (.prettierrc) -- in VSCode you
can simply use Format Document and it applies the lint automatically.

Review the IDL changes to make sure the new features/types in marginfiv2
are reflected in the new IDL. For example new instructions or types, should be
reflected in the new IDL.

Commit the IDL changes and merge in the same mrgn-ts PR that adds features that rely on
the new IDL. These should be committed together to ensure the new feature works.
KNOWN BUG: In some instances, anchor will not generate "errors" in idl.json and this needs to be manually copied over and edited.
2 changes: 1 addition & 1 deletion packages/marginfi-client-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mrgnlabs/marginfi-client-v2",
"version": "2.11.0",
"version": "2.12.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down
Loading
Loading