solace 0.0.8 → 0.0.9
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/CHANGELOG +11 -1
- data/lib/solace/connection.rb +10 -0
- data/lib/solace/programs/associated_token_account.rb +21 -14
- data/lib/solace/utils/account_context.rb +7 -7
- data/lib/solace/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4a098840bd57cd1b7f5380aa77f15e8e7098162b0b9e33d45ba6bcc6359ca4c
|
4
|
+
data.tar.gz: c81d536ae4ab12043505b5689adf45675f47b963ed66d4e8a42fe9ed91f0ce4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6653760f426f50f5d64e6c3a31f39c84ebf9e1e3fe12c77fac8ffcbd9a22b4c78b6ebddd69e18ddf374670967b52fbc227d72c845d5ca4086831277a8daff75d
|
7
|
+
data.tar.gz: ff9c39b9f2ecb89845fdb29ad5f923cd2855806c3e7c30d1ef0b6823f8938e55f073eeea2f6870b9c3b354345a2c89ab8ea88ff3fdb0d448a011ccb576bbbeeb
|
data/CHANGELOG
CHANGED
@@ -16,6 +16,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
16
16
|
### Fixed
|
17
17
|
```
|
18
18
|
|
19
|
+
## [0.0.9] - 2025-08-12
|
20
|
+
|
21
|
+
### Added
|
22
|
+
1. Added `get_program_accounts` to `Solace::Connection`.
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
1. Removed use of the `try` method for supporting non-rails environments.
|
28
|
+
|
19
29
|
## [0.0.8] - 2025-08-11
|
20
30
|
|
21
31
|
### Added
|
@@ -27,7 +37,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
27
37
|
|
28
38
|
### Changed
|
29
39
|
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.
|
30
|
-
2. Changed `wait_for_confirmed_signature` method to accept a `timeout`, `interval`, and `commitment`
|
40
|
+
2. Changed `wait_for_confirmed_signature` method to accept a `timeout`, `interval`, and `commitment` arguments.
|
31
41
|
|
32
42
|
### Fixed
|
33
43
|
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.
|
data/lib/solace/connection.rb
CHANGED
@@ -160,6 +160,16 @@ module Solace
|
|
160
160
|
[signatures, default_options.merge({ 'searchTransactionHistory' => true })])['result']
|
161
161
|
end
|
162
162
|
|
163
|
+
# Get the program accounts
|
164
|
+
#
|
165
|
+
# @param program_id [String] The program ID
|
166
|
+
# @param filters [Array] The filters
|
167
|
+
# @return [Array] The program accounts
|
168
|
+
# @param [Hash{Symbol => Object}] options
|
169
|
+
def get_program_accounts(program_id, filters)
|
170
|
+
@rpc_client.rpc_request('getProgramAccounts', [program_id, default_options.merge(filters: filters)])['result']
|
171
|
+
end
|
172
|
+
|
163
173
|
# Get the signature status
|
164
174
|
#
|
165
175
|
# @param signature [String] The signature of the transaction
|
@@ -1,5 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# The AssociatedTokenAccount program is a Solana program that provides a standardized way to create and manage token accounts.
|
4
|
+
#
|
5
|
+
# This class provides a Ruby interface to the Associated Token Account program, allowing you to easily
|
6
|
+
# find or create associated token accounts for a given wallet and mint.
|
7
|
+
#
|
8
|
+
# @see https://spl.solana.com/associated-token-account Solana Associated Token Account Program
|
9
|
+
#
|
10
|
+
# @author Sebastian Scholl
|
11
|
+
# @since 0.1.0
|
3
12
|
module Solace
|
4
13
|
module Programs
|
5
14
|
# Client for interacting with the Associated Token Account Program.
|
@@ -106,20 +115,18 @@ module Solace
|
|
106
115
|
)
|
107
116
|
ata_address, = get_address(owner: owner, mint: mint)
|
108
117
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
)
|
120
|
-
|
121
|
-
tx_composer.compose_transaction
|
122
|
-
end
|
118
|
+
ix = Solace::Composers::AssociatedTokenAccountProgramCreateAccountComposer.new(
|
119
|
+
mint: mint,
|
120
|
+
owner: owner,
|
121
|
+
funder: payer,
|
122
|
+
ata_address: ata_address
|
123
|
+
)
|
124
|
+
|
125
|
+
TransactionComposer
|
126
|
+
.new(connection: connection)
|
127
|
+
.set_fee_payer(payer)
|
128
|
+
.add_instruction(ix)
|
129
|
+
.compose_transaction
|
123
130
|
end
|
124
131
|
end
|
125
132
|
end
|
@@ -105,7 +105,7 @@ module Solace
|
|
105
105
|
# @param pubkey [String] The pubkey of the account
|
106
106
|
# @return [Boolean] Whether the account is a fee payer
|
107
107
|
def fee_payer?(pubkey)
|
108
|
-
@pubkey_account_map
|
108
|
+
@pubkey_account_map.dig(pubkey, :fee_payer)
|
109
109
|
end
|
110
110
|
|
111
111
|
# Predicate to check if an account is a signer
|
@@ -113,7 +113,7 @@ module Solace
|
|
113
113
|
# @param pubkey [String] The pubkey of the account
|
114
114
|
# @return [Boolean] Whether the account is a signer
|
115
115
|
def signer?(pubkey)
|
116
|
-
@pubkey_account_map
|
116
|
+
@pubkey_account_map.dig(pubkey, :signer)
|
117
117
|
end
|
118
118
|
|
119
119
|
# Predicate to check if an account is writable
|
@@ -121,7 +121,7 @@ module Solace
|
|
121
121
|
# @param pubkey [String] The pubkey of the account
|
122
122
|
# @return [Boolean] Whether the account is writable
|
123
123
|
def writable?(pubkey)
|
124
|
-
@pubkey_account_map
|
124
|
+
@pubkey_account_map.dig(pubkey, :writable)
|
125
125
|
end
|
126
126
|
|
127
127
|
# Predicate to check if an account is a writable signer
|
@@ -129,7 +129,7 @@ module Solace
|
|
129
129
|
# @param pubkey [String] The pubkey of the account
|
130
130
|
# @return [Boolean] Whether the account is a writable signer
|
131
131
|
def writable_signer?(pubkey)
|
132
|
-
@pubkey_account_map[pubkey]
|
132
|
+
(acc = @pubkey_account_map[pubkey]) && acc[:signer] && acc[:writable]
|
133
133
|
end
|
134
134
|
|
135
135
|
# Predicate to check if an account is writable and not a signer
|
@@ -137,7 +137,7 @@ module Solace
|
|
137
137
|
# @param pubkey [String] The pubkey of the account
|
138
138
|
# @return [Boolean] Whether the account is writable and not a signer
|
139
139
|
def writable_nonsigner?(pubkey)
|
140
|
-
@pubkey_account_map[pubkey]
|
140
|
+
(acc = @pubkey_account_map[pubkey]) && !acc[:signer] && acc[:writable]
|
141
141
|
end
|
142
142
|
|
143
143
|
# Predicate to check if an account is a readonly signer
|
@@ -145,7 +145,7 @@ module Solace
|
|
145
145
|
# @param pubkey [String] The pubkey of the account
|
146
146
|
# @return [Boolean] Whether the account is a readonly signer
|
147
147
|
def readonly_signer?(pubkey)
|
148
|
-
@pubkey_account_map[pubkey]
|
148
|
+
(acc = @pubkey_account_map[pubkey]) && acc[:signer] && !acc[:writable]
|
149
149
|
end
|
150
150
|
|
151
151
|
# Predicate to check if an account is readonly and not a signer
|
@@ -153,7 +153,7 @@ module Solace
|
|
153
153
|
# @param pubkey [String] The pubkey of the account
|
154
154
|
# @return [Boolean] Whether the account is readonly and not a signer
|
155
155
|
def readonly_nonsigner?(pubkey)
|
156
|
-
@pubkey_account_map[pubkey]
|
156
|
+
(acc = @pubkey_account_map[pubkey]) && !acc[:signer] && !acc[:writable]
|
157
157
|
end
|
158
158
|
|
159
159
|
# Merge all accounts from another AccountContext into this one
|
data/lib/solace/version.rb
CHANGED