amorriscode / amorriscode/axolotl

Develop TypeScript library

Đang mở
#3 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Rust
Star
16
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

The Axolotl TypeScript library will be used to:

- Provide Solana/Rust types to the user's TypeScript code
- Provide helper functions that are useful for developing Solana programs

# Types

Since Axolotl programs are written with TypeScript, we can provide types to the users. For Seahorse programs, [the types are included in a static file](https://github.com/ameliatastic/seahorse-lang/blob/main/data/seahorse_prelude.py) next to your Anchor program.

### Rust data types

Refer to the [Rust documentation](https://doc.rust-lang.org/book/ch03-02-data-types.html) for data types.

Anchor has defined [JavaScript --> Rust types](https://www.anchor-lang.com/docs/javascript-anchor-types). We'll be taking as much inspiration from their implementation as possible. Integers greater than 32 bytes will utilize [`bn.js`](https://github.com/indutny/bn.js/), common for both Anchor and Solana.

### Solana types

- [ ] `Pubkey`
- 32-byte account identifier
- [Source](https://github.com/solana-labs/solana/blob/master/sdk/program/src/pubkey.rs)
- [x] `AccountInfo`
- Account information
- [Source](https://github.com/solana-labs/solana/blob/master/sdk/program/src/account_info.rs)
- [ ] `Signer`
- [ ] `Program`
- Used for CPI
- [Source](https://github.com/solana-labs/solana/blob/master/sdk/program/src/program.rs)
- [ ] `Clock`
- Information about the network's time
- [Source](https://github.com/solana-labs/solana/blob/master/sdk/program/src/clock.rs)
- [ ] `TokenAccount`
- [ ] `TokenMint`

`@solana/web3.js` has [a lot of classes and types](https://solana-labs.github.io/solana-web3.js/modules.html) that we will likely be able to utilize/export from Axolotl.

### Anchor types

- [ ] [Accounts struct](https://www.anchor-lang.com/docs/the-accounts-struct)
- [Source](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/index.html)
- [ ] [Context](https://www.anchor-lang.com/docs/the-program-module#context)
- [Source](https://docs.rs/anchor-lang/latest/anchor_lang/context/index.html)
- [ ] [Errors](https://www.anchor-lang.com/docs/errors)

# Helper functions

- [ ] `declare_id` / ID helpers
- Generated by Anchor
- Instead of a user dealing with this, let's programmatically manage it with `.env` or something similar
- [ ] Helpers related to lamports?

### Release

- [ ] Released under `@axolotl/sol`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.