amorriscode / amorriscode/axolotl

Develop TypeScript library

Offen
#3 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
16
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.