solace 0.1.5 → 0.1.6
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.
- checksums.yaml +4 -4
- data/lib/solace/composers/associated_token_account_program_create_account_composer.rb +6 -6
- data/lib/solace/composers/associated_token_account_program_create_idempotent_account_composer.rb +2 -1
- data/lib/solace/composers/base.rb +1 -1
- data/lib/solace/composers/spl_token_program_close_account_composer.rb +3 -3
- data/lib/solace/composers/spl_token_program_initialize_mint_composer.rb +5 -5
- data/lib/solace/composers/spl_token_program_mint_to_composer.rb +4 -4
- data/lib/solace/composers/spl_token_program_transfer_checked_composer.rb +6 -6
- data/lib/solace/composers/spl_token_program_transfer_composer.rb +4 -4
- data/lib/solace/composers/system_program_create_account_composer.rb +5 -5
- data/lib/solace/composers/system_program_transfer_composer.rb +3 -3
- data/lib/solace/composers/token_2022_program_close_account_composer.rb +3 -3
- data/lib/solace/composers/token_2022_program_initialize_mint_composer.rb +5 -5
- data/lib/solace/composers/token_2022_program_mint_to_composer.rb +4 -4
- data/lib/solace/composers/token_2022_program_transfer_checked_composer.rb +6 -6
- data/lib/solace/composers/token_2022_program_transfer_composer.rb +4 -4
- data/lib/solace/connection.rb +5 -5
- data/lib/solace/errors/confirmation_timeout.rb +4 -4
- data/lib/solace/errors/rpc_error.rb +4 -4
- data/lib/solace/instructions/associated_token_account/create_account_instruction.rb +2 -1
- data/lib/solace/instructions/spl_token/close_account_instruction.rb +2 -2
- data/lib/solace/instructions/spl_token/initialize_account_instruction.rb +2 -2
- data/lib/solace/instructions/spl_token/initialize_mint_instruction.rb +2 -2
- data/lib/solace/instructions/spl_token/mint_to_instruction.rb +2 -2
- data/lib/solace/instructions/spl_token/transfer_checked_instruction.rb +2 -2
- data/lib/solace/instructions/spl_token/transfer_instruction.rb +2 -2
- data/lib/solace/instructions/system_program/create_account_instruction.rb +2 -2
- data/lib/solace/instructions/system_program/transfer_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/close_account_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/initialize_account_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/initialize_mint_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/mint_to_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/transfer_checked_instruction.rb +2 -2
- data/lib/solace/instructions/token_2022/transfer_instruction.rb +2 -2
- data/lib/solace/message.rb +5 -5
- data/lib/solace/programs/associated_token_account.rb +10 -9
- data/lib/solace/programs/token_program_interface.rb +18 -18
- data/lib/solace/serializers/address_lookup_table_deserializer.rb +2 -2
- data/lib/solace/serializers/base_deserializer.rb +1 -1
- data/lib/solace/serializers/instruction_deserializer.rb +2 -2
- data/lib/solace/serializers/message_deserializer.rb +3 -3
- data/lib/solace/serializers/transaction_deserializer.rb +1 -1
- data/lib/solace/tokens/token.rb +1 -1
- data/lib/solace/tokens.rb +2 -2
- data/lib/solace/transaction.rb +1 -1
- data/lib/solace/transaction_composer.rb +5 -5
- data/lib/solace/utils/account_context.rb +9 -9
- data/lib/solace/utils/codecs.rb +309 -49
- data/lib/solace/utils/rpc_client.rb +9 -9
- data/lib/solace/version.rb +1 -1
- metadata +111 -9
- data/CHANGELOG +0 -243
- data/LICENSE +0 -21
- data/README.md +0 -578
data/CHANGELOG
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
|
-
|
|
7
|
-
### Template
|
|
8
|
-
|
|
9
|
-
```markdown
|
|
10
|
-
## [VERSION] - yyyy-mm-dd
|
|
11
|
-
|
|
12
|
-
### Added
|
|
13
|
-
|
|
14
|
-
1.
|
|
15
|
-
|
|
16
|
-
### Changed
|
|
17
|
-
|
|
18
|
-
### Fixed
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## 0.1.5 - 2026-06-13
|
|
24
|
-
|
|
25
|
-
### Added
|
|
26
|
-
|
|
27
|
-
1. Added Token-2022 program support
|
|
28
|
-
2. Added integration tests for the Token-2022 composers
|
|
29
|
-
|
|
30
|
-
### Changed
|
|
31
|
-
|
|
32
|
-
1. Decoupled Token-2022 from the SPL composers via a shared mixin
|
|
33
|
-
|
|
34
|
-
### Fixed
|
|
35
|
-
|
|
36
|
-
1. Fixed `TransferChecked` instruction layout documentation
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 0.1.3 - 2025-06-11
|
|
41
|
-
|
|
42
|
-
### Added
|
|
43
|
-
|
|
44
|
-
1. Added `Solace::Instructions::AssociatedTokenAccount::CreateIdempotentAccountInstruction`
|
|
45
|
-
2. Added `Solace::Composers::AssociatedTokenAccountCreateIdempotentAccountComposer`
|
|
46
|
-
|
|
47
|
-
### Changed
|
|
48
|
-
|
|
49
|
-
1. Renamed `Solace::Instructions::AssociatedTokenAccount::CreateAssociatedTokenAccountInstruction` to `Solace::Instructions::AssociatedTokenAccount::CreateAccountInstruction` with backwards compatibility
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## [0.1.2] - 2025-05-11
|
|
54
|
-
|
|
55
|
-
### Added
|
|
56
|
-
|
|
57
|
-
1. Added support for closing SPL token accounts with:
|
|
58
|
-
- `Solace::Composers::SystemProgramCreateAccountComposer`
|
|
59
|
-
- `Solace::Instructions::SystemProgram::CreateAccountInstruction`
|
|
60
|
-
|
|
61
|
-
## [0.1.1] - 2025-05-11
|
|
62
|
-
|
|
63
|
-
### Added
|
|
64
|
-
|
|
65
|
-
1. Added support to inject encoding externally to get the data with respective encoding.
|
|
66
|
-
|
|
67
|
-
## [0.1.0] - 2025-18-10
|
|
68
|
-
|
|
69
|
-
**NOTE (Breaking):**
|
|
70
|
-
All previous `prepare_*` Program methods have been renamed to `compose_*` and now return an **unsigned composer instance**. This enables composition and extensibility that weren’t possible when methods returned a signed transaction that was only editable via low-level manipulation.
|
|
71
|
-
Additionally, unless explicitly required by a composer’s instruction, the `payer:` keyword has been removed from the new `compose_*` methods and is instead only used in their execution counterparts (e.g., `compose_mint_to` → `mint_to`). This allows specifying the fee payer when building the final transaction, while keeping composition steps payer-agnostic.
|
|
72
|
-
|
|
73
|
-
### Added
|
|
74
|
-
|
|
75
|
-
1. **`Solace::Tokens`** — a structured registry and lookup system for Solana token metadata.
|
|
76
|
-
|
|
77
|
-
- Developers can define token details via a YAML configuration file scoped by network (e.g., `mainnet`, `devnet`).
|
|
78
|
-
- Programmatic access to token metadata:
|
|
79
|
-
|
|
80
|
-
```ruby
|
|
81
|
-
Solace::Tokens.load(path: 'tokens.yml', network: :devnet)
|
|
82
|
-
Solace::Tokens::USDC.decimals # => 6
|
|
83
|
-
Solace::Tokens.fetch('USDC') # => <Solace::Tokens::Token ...>
|
|
84
|
-
Solace::Tokens.where(decimals: 6)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
- Dynamically registers constants for each token symbol (`USDC`, `SOL`, etc.).
|
|
88
|
-
- Safety improvements to preserve internal constants (`Token`) during reloads.
|
|
89
|
-
|
|
90
|
-
2. **`SystemProgramCreateAccountComposer`** — composer for building account creation flows via the Solana System Program.
|
|
91
|
-
|
|
92
|
-
- Wraps `SystemProgram::CreateAccountInstruction`.
|
|
93
|
-
- Handles lamport allocation, rent exemption, and ownership assignment.
|
|
94
|
-
- Simplifies creation of system-owned and program-owned accounts.
|
|
95
|
-
|
|
96
|
-
3. **`SplTokenProgramInitializeMintComposer`** — composer for initializing new SPL Token mints.
|
|
97
|
-
|
|
98
|
-
- Wraps `SplToken::InitializeMintInstruction`.
|
|
99
|
-
- Supports decimals, mint authority, and optional freeze authority.
|
|
100
|
-
- Designed to pair with `SystemProgramCreateAccountComposer` for one-transaction mint creation.
|
|
101
|
-
|
|
102
|
-
4. **`SplTokenProgramMintToComposer`** — composer for minting tokens to an ATA.
|
|
103
|
-
|
|
104
|
-
- Wraps `SplToken::MintToInstruction`.
|
|
105
|
-
- Supports minting tokens to a destination ATA.
|
|
106
|
-
|
|
107
|
-
5. **`SplTokenProgramTransferComposer`** — composer for transferring tokens.
|
|
108
|
-
|
|
109
|
-
- Wraps `SplToken::TransferInstruction`.
|
|
110
|
-
- Supports sending SPL tokens.
|
|
111
|
-
|
|
112
|
-
6. **`Solace::Connection`** — cached blockhash accessors.
|
|
113
|
-
|
|
114
|
-
- Added `last_fetched_blockhash` and `last_fetched_block_height`.
|
|
115
|
-
- Stores the most recently retrieved blockhash and corresponding `lastValidBlockHeight`.
|
|
116
|
-
- Enables reuse without re-fetching between sequential transactions.
|
|
117
|
-
- `get_latest_blockhash` now sets these values automatically.
|
|
118
|
-
|
|
119
|
-
7. **`TransactionComposer`** — instruction ordering helpers.
|
|
120
|
-
|
|
121
|
-
- Added `prepend_instruction` and `insert_instruction` for finer control of instruction order.
|
|
122
|
-
|
|
123
|
-
8. **`Transaction`** — signature helper.
|
|
124
|
-
|
|
125
|
-
- Added `transaction.signature` to get the signature from a signed transaction.
|
|
126
|
-
|
|
127
|
-
9. **Program method options** — higher-level control.
|
|
128
|
-
|
|
129
|
-
- Added `execute`, `sign`, and a yield block to relevant Program methods for flow control and composer access.
|
|
130
|
-
|
|
131
|
-
### Changed
|
|
132
|
-
|
|
133
|
-
1. `TransactionComposer#build_instructions` now flattens arrays so composers can return multiple instructions (e.g., create an account then initialize it).
|
|
134
|
-
|
|
135
|
-
2. `Connection#get_latest_blockhash` now uses the connection’s expected commitment (or provided options) and returns `[blockhash, lastValidBlockheight]`.
|
|
136
|
-
|
|
137
|
-
3. Default commitment level changed to `processed` in `Solace::Connection`.
|
|
138
|
-
|
|
139
|
-
4. SPL Program: renamed/adjusted kwargs for `compose_create_mint` and moved signing logic to `create_mint`.
|
|
140
|
-
|
|
141
|
-
5. SPL Program: `compose_mint_to` moved signing logic to `mint_to`.
|
|
142
|
-
|
|
143
|
-
6. SPL Program: `compose_transfer` moved signing logic to `transfer`.
|
|
144
|
-
|
|
145
|
-
7. SPL Program: `create_mint`, `compose_create_mint`, and `compose_create_associated_token_account` now accept separate `funder` and `payer` keys. Both may be the same value, but splitting them allows one account to pay transaction fees while another covers rent exemption.
|
|
146
|
-
|
|
147
|
-
8. All executable Program methods now return the **Solace transaction instance** instead of an encoded signature.
|
|
148
|
-
|
|
149
|
-
9. Updated `test/bootstrap.rb` to use composers for setting up test fixtures in a single transaction.
|
|
150
|
-
|
|
151
|
-
### Fixed
|
|
152
|
-
|
|
153
|
-
- Improved token loading safety in `Solace::Tokens` to prevent internal constant removal during reloads.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## [0.0.9] - 2025-08-12
|
|
158
|
-
|
|
159
|
-
### Added
|
|
160
|
-
|
|
161
|
-
1. Added `get_program_accounts` to `Solace::Connection`.
|
|
162
|
-
|
|
163
|
-
### Changed
|
|
164
|
-
|
|
165
|
-
### Fixed
|
|
166
|
-
|
|
167
|
-
1. Removed use of the `try` method for supporting non-rails environments.
|
|
168
|
-
|
|
169
|
-
## [0.0.8] - 2025-08-11
|
|
170
|
-
|
|
171
|
-
### Added
|
|
172
|
-
|
|
173
|
-
1. Added `load` method to `Solace::Constants` to load constants from a YAML file. This method allows for loading constants from a YAML file (i.e. custom program addresses and mint accounts).
|
|
174
|
-
2. Added `to_s` and `address` method to `Solace::Keypair` and `Solace::PublicKey` to return the public key as a Base58 string.
|
|
175
|
-
3. Added `get_signature_status` and `get_signature_statuses` to `Solace::Connection`.
|
|
176
|
-
4. Added `RPCClient` to `Solace::Utils` to handle HTTP requests to a Solana RPC node.
|
|
177
|
-
5. Added `Errors` module to `Solace::Utils` to handle errors from the HTTP requests made to the Solana RPC node.
|
|
178
|
-
|
|
179
|
-
### Changed
|
|
180
|
-
|
|
181
|
-
1. All methods that take a `Solace::Keypair` or `Solace::Pubkey` where an address is needed now also accept a plain string address. This prevents the need of creating instances of the classes when all that is needed is the address. This is with the exception of the low-level instruction builders, which only expect the correct data and indicies with no required casting.
|
|
182
|
-
2. Changed `wait_for_confirmed_signature` method to accept a `timeout`, `interval`, and `commitment` arguments.
|
|
183
|
-
|
|
184
|
-
### Fixed
|
|
185
|
-
|
|
186
|
-
1. Fixed `get_or_create_address` method in `Solace::Programs::AssociatedTokenAccount` to return the address of the associated token account if it already exists by checking if there is any data at the address.
|
|
187
|
-
|
|
188
|
-
## [0.0.7] - 2025-08-09
|
|
189
|
-
|
|
190
|
-
### Added
|
|
191
|
-
|
|
192
|
-
1. Added `AssociatedTokenAccountProgramCreateAccountComposer` with tests.
|
|
193
|
-
|
|
194
|
-
### Changed
|
|
195
|
-
|
|
196
|
-
1. Updated `AssociatedTokenAccount` to use `AssociatedTokenAccountProgramCreateAccountComposer` and sign the transaction in the `create_associated_token_account` method instead of the `compose_create_associated_token_account` method.
|
|
197
|
-
|
|
198
|
-
### Fixed
|
|
199
|
-
|
|
200
|
-
## [0.0.6] - 2025-08-07
|
|
201
|
-
|
|
202
|
-
### Added
|
|
203
|
-
|
|
204
|
-
1. Added `from_address` method to `Solace::PublicKey`.
|
|
205
|
-
2. Change docs on most methods to include an `@example` section.
|
|
206
|
-
|
|
207
|
-
### Changed
|
|
208
|
-
|
|
209
|
-
1. Change `private_key` method on Keypair to `pivate_key_bytes`
|
|
210
|
-
2. Change README to include a practical example of using composers.
|
|
211
|
-
|
|
212
|
-
### Fixed
|
|
213
|
-
|
|
214
|
-
1. Fix `encode_signatures` method in `Solace::Serializers::TransactionSerializer` to correctly count the number of signatures using the `num_required_signatures` field in the message.
|
|
215
|
-
|
|
216
|
-
## [0.0.3] - 2025-07-30
|
|
217
|
-
|
|
218
|
-
### Added
|
|
219
|
-
|
|
220
|
-
1. Moved `TransferCheckedInstruction` and `TransferInstruction` to `Solace::Instructions::SystemProgram` namespace.
|
|
221
|
-
2. Added `get_token_account_balance` to `Solace::Connection`.
|
|
222
|
-
3. Added `get_or_create_address` to `Solace::Programs::AssociatedTokenAccount`.
|
|
223
|
-
4. Added Composer system for handling accounts and instructions in a higher level abstraction.
|
|
224
|
-
5. Added `SystemProgramTransferComposer` to `Solace::Composers` namespace.
|
|
225
|
-
6. Added `SplTokenProgramTransferCheckedComposer` to `Solace::Composers` namespace.
|
|
226
|
-
7. Moved TransferCheckedInstruction to proper namespace `Solace::Instructions::SplToken::TransferCheckedInstruction`.
|
|
227
|
-
8. Updated `get_or_create_address` to wait for confirmation before returning the address in `Solace::Programs::AssociatedTokenAccount`.
|
|
228
|
-
9. Moved default options to instance variable in `Solace::Connection`.
|
|
229
|
-
10. Moved test setup to `test/bootstrap.rb` and added rake task `bootstrap` to run it.
|
|
230
|
-
|
|
231
|
-
### Changed
|
|
232
|
-
|
|
233
|
-
THESE ARE BREAKING CHANGES FROM 0.0.2 TO 0.0.3. Solice is still in alpha and the API is subject to change.
|
|
234
|
-
|
|
235
|
-
There was a bit of a refactoring of the codebase to make it more maintainable and to make it easier to add new features. Additonally, the SDK now has `Composers` for handling accounts and instructions in a higher level abstraction. These composers are used in the tests and can be used in your own code as well.
|
|
236
|
-
|
|
237
|
-
Soon, YARD documentation will be added to the SDK and published to https://solace-rb.github.io/solace/.
|
|
238
|
-
|
|
239
|
-
Stay tuned.
|
|
240
|
-
|
|
241
|
-
### Fixed
|
|
242
|
-
|
|
243
|
-
N/A
|
data/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Sebastian Scholl
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|