> For the complete documentation index, see [llms.txt](https://learn.woo.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.woo.org/dev-docs/guides/integrate-woofi-as-a-liquidity-source-on-solana/rust-sdk.md).

# Rust SDK

Solana integration SDK for WOOFi Swap. ProgramId on mainnet: **WooFif76YGRNjk1pA8wCsN67aQsD9f9iLsz4NcJ1AVb**

SDK git repo: <https://github.com/woonetwork/woofi-lz-sdk>

## Rust SDK Overview:

1. sdk/src/lib.rs have functions to compose woofi swap instructions
2. client/src/main.rs have the demo usage of these instrucionts

## Rust SDK Usage:

Build:

```
cargo build
```

To test, simply run:

```
./woofi-cli try-query SOL USDC 1000000000
./woofi-cli swap USDC SOL 100000 9000
```

above try-query is query price for 1 SOL above swap will swap 0.1 USDC to SOL After swap, it will print out transaction signature and program return log

```
transaction sent, signature:63AasGTbMBQgHj9RdJ9kz5F7ZxQ9Q7nKBDoR2qHs5d6rjCC2s2tyepa6S2gDv9M5GUG4KVkNqPbDDqDsctWwA7PG
please view on explorer
Program WooFiGFK9x5FBYdvMg3pJBpAkPA8EEYiLcopwrxJvDG invoke [1]
Program log: Instruction: Swap
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]
Program log: Instruction: Transfer
Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 168578 compute units
...
```

## Notice

Above cmd will use

```
RPC URL: https://api.mainnet-beta.solana.com 
Payer Key: ~/.config/solana/id.json
```

If you want change your own RPC URL or Payer Key, please use the following cmd:

```
./woofi-cli try-query SOL USDC 1000000000 --http-url https://api.mainnet-beta.solana.com --payer-path ~/.config/solana/id.json
./woofi-cli swap USDC SOL 100000 9000 --http-url https://api.mainnet-beta.solana.com --payer-path ~/.config/solana/id.json
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.woo.org/dev-docs/guides/integrate-woofi-as-a-liquidity-source-on-solana/rust-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
