@gmsol-labs/gmsol-sdk 0.5.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # GMX-Solana
2
+
3
+ ## Audits
4
+
5
+ | Program | Last Audit Date | Version |
6
+ | ---------------- | --------------- | --------- |
7
+ | [gmsol-store] | [2025-03-07] | [2a66761] |
8
+ | [gmsol-treasury] | [2025-03-07] | [2a66761] |
9
+ | [gmsol-timelock] | [2025-03-07] | [2a66761] |
10
+
11
+ [gmsol-store]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-store
12
+ [gmsol-treasury]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-treasury
13
+ [gmsol-timelock]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-timelock
14
+ [2025-03-07]: https://github.com/gmsol-labs/gmx-solana-audits/blob/main/GMX_Solana_Audit_Report_Mar_7_2025_Zenith.pdf
15
+ [2a66761]: https://github.com/gmsol-labs/gmx-solana/commit/2a66761d6573a6db6160a19fc3057e2091aebbfe
16
+
17
+ ## Integration
18
+
19
+ ### Method 1: Using `declare_program!`
20
+
21
+ #### 1. Initialize a new Rust project and add dependencies
22
+
23
+ Create a new Rust project and include `anchor_lang` and `bytemuck` as dependencies:
24
+
25
+ ```toml
26
+ [dependencies]
27
+ anchor-lang = "0.30.1"
28
+ bytemuck = { version = "1.19.0", features = ["min_const_generics"] }
29
+ ```
30
+
31
+ #### 2. Download and Store IDLs in `{PROJECT_ROOT}/idls/`
32
+
33
+ You can retrieve the IDLs using the `anchor` CLI or download them directly from the explorer ([`gmsol-store` Program][store-program-link] and [`gmsol-treasury` Program][treasury-program-link]).
34
+
35
+ Once downloaded, move them to the `{PROJECT_ROOT}/idls/` directory.
36
+
37
+ Your project structure should now look like this:
38
+
39
+ ```bash
40
+ {PROJECT_ROOT}/
41
+ ├── .gitignore
42
+ ├── Cargo.lock
43
+ ├── Cargo.toml
44
+ ├── idls
45
+ │ ├── gmsol_store.json
46
+ │ └── gmsol_treasury.json
47
+ └── src
48
+ └── lib.rs
49
+ ```
50
+
51
+ #### 3. Declaring Programs in `lib.rs`
52
+
53
+ Use `declare_program!` to register the `gmsol-store` and `gmsol-treasury` programs:
54
+
55
+ ```rust
56
+ use anchor_lang::declare_program;
57
+
58
+ declare_program!(gmsol_store);
59
+ declare_program!(gmsol_treasury);
60
+ ```
61
+
62
+ #### 4. Build and Open the Documentation
63
+
64
+ Run the following command to generate and view the documentation:
65
+
66
+ ```bash
67
+ cargo doc --open
68
+ ```
69
+
70
+ If the build is successful, it will automatically open the documentation in your default web browser.
71
+
72
+ #### 5. Example Project
73
+
74
+ For a working implementation, check out the [gmx-solana-programs][gmx-solana-programs-link].
75
+
76
+ [store-program-link]: https://explorer.solana.com/address/Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo/anchor-program
77
+ [treasury-program-link]: https://explorer.solana.com/address/GTuvYD5SxkTq4FLG6JV1FQ5dkczr1AfgDcBHaFsBdtBg/anchor-program
78
+ [gmx-solana-programs-link]: https://github.com/gmsol-labs/gmx-solana-programs
79
+
80
+ ## Development
81
+
82
+ ### Prerequisites
83
+
84
+ - [Rust](https://www.rust-lang.org/tools/install)
85
+ - [Solana v1.18.26](https://docs.anza.xyz/cli/install)
86
+ - [Anchor v0.30.1](https://www.anchor-lang.com/docs/installation)
87
+ - [Node](https://nodejs.org/en/download)
88
+ - [Just](https://github.com/casey/just?tab=readme-ov-file#installation)
89
+
90
+ ### Commands
91
+
92
+ To run all tests:
93
+
94
+ ```bash
95
+ just
96
+ ```
97
+
98
+ To install the `gmsol` CLI:
99
+
100
+ ```bash
101
+ cargo install-gmsol
102
+ ```
103
+
104
+ Use the following command to verify the CLI is installed properly:
105
+
106
+ ```bash
107
+ gmsol --version
108
+ ```
109
+
110
+ ### Troubleshooting
111
+
112
+ #### 1. Failed to start `test-validator` on MacOS
113
+
114
+ **Error Message:**
115
+
116
+ ```bash
117
+ Error: failed to start validator: Failed to create ledger at test-ledger: io error: Error checking to unpack genesis archive: Archive error: extra entry found: "._genesis.bin" Regular
118
+ ```
119
+
120
+ **Posssible Solution:**
121
+
122
+ Check [this comment](https://github.com/solana-labs/solana/issues/35629#issuecomment-2501133871).