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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 378cd7a1cb5958d12bfbe371485f60c12c72e04141bb557a7ef61dde617b0dfe
|
|
4
|
+
data.tar.gz: e36f6aa0189ff832b3ca440a1a38690984d69081dcde8b9613d632320d481cf5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c15791a7b1967d19f676e594556f19fb29ea1b431c97e9a5f6ddb0c8344b87b4301e402116bd8896da7c14ba50a5f5de1eb5a5791b41df7c4134ee89f397926
|
|
7
|
+
data.tar.gz: cb1add67763169e8bb498987f3f760def67a5c92e647852f8e5e4308a5a1a41cb046df0aa8a720202d32b7c82bbe6541e945815e6e45738fd63215b23080e2bc
|
|
@@ -98,13 +98,13 @@ module Solace
|
|
|
98
98
|
# @return [Solace::Instruction] The instruction
|
|
99
99
|
def build_instruction(account_context)
|
|
100
100
|
Instructions::AssociatedTokenAccount::CreateAccountInstruction.build(
|
|
101
|
-
funder_index:
|
|
102
|
-
owner_index:
|
|
103
|
-
mint_index:
|
|
101
|
+
funder_index: account_context.index_of(funder),
|
|
102
|
+
owner_index: account_context.index_of(owner),
|
|
103
|
+
mint_index: account_context.index_of(mint),
|
|
104
104
|
associated_token_account_index: account_context.index_of(ata_address),
|
|
105
|
-
system_program_index:
|
|
106
|
-
token_program_index:
|
|
107
|
-
program_index:
|
|
105
|
+
system_program_index: account_context.index_of(system_program_id),
|
|
106
|
+
token_program_index: account_context.index_of(token_program_id),
|
|
107
|
+
program_index: account_context.index_of(associated_token_account_program_id)
|
|
108
108
|
)
|
|
109
109
|
end
|
|
110
110
|
end
|
data/lib/solace/composers/associated_token_account_program_create_idempotent_account_composer.rb
CHANGED
|
@@ -4,7 +4,8 @@ module Solace
|
|
|
4
4
|
module Composers
|
|
5
5
|
# Composer for creating an associated token account program create account instruction with idempotency
|
|
6
6
|
#
|
|
7
|
-
# This composer resolves and orders the required accounts for a
|
|
7
|
+
# This composer resolves and orders the required accounts for a
|
|
8
|
+
# `CreateIdempotentAssociatedTokenAccount` instruction,
|
|
8
9
|
# sets up their access permissions, and delegates construction to the appropriate
|
|
9
10
|
# instruction builder (`Instructions::AssociatedTokenAccount::CreateIdempotentAssociatedTokenAccountInstruction`).
|
|
10
11
|
#
|
|
@@ -70,10 +70,10 @@ module Solace
|
|
|
70
70
|
# @return [Solace::Instruction]
|
|
71
71
|
def build_instruction(account_context)
|
|
72
72
|
Instructions::SplToken::CloseAccountInstruction.build(
|
|
73
|
-
account_index:
|
|
74
|
-
authority_index:
|
|
73
|
+
account_index: account_context.index_of(account),
|
|
74
|
+
authority_index: account_context.index_of(authority),
|
|
75
75
|
destination_index: account_context.index_of(destination),
|
|
76
|
-
program_index:
|
|
76
|
+
program_index: account_context.index_of(spl_token_program)
|
|
77
77
|
)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -83,11 +83,11 @@ module Solace
|
|
|
83
83
|
def build_instruction(account_context)
|
|
84
84
|
Instructions::SplToken::InitializeMintInstruction.build(
|
|
85
85
|
mint_account_index: account_context.index_of(mint_account),
|
|
86
|
-
rent_sysvar_index:
|
|
87
|
-
program_index:
|
|
88
|
-
decimals:
|
|
89
|
-
mint_authority:
|
|
90
|
-
freeze_authority:
|
|
86
|
+
rent_sysvar_index: account_context.index_of(rent_sysvar),
|
|
87
|
+
program_index: account_context.index_of(spl_token_program),
|
|
88
|
+
decimals: decimals,
|
|
89
|
+
mint_authority: mint_authority,
|
|
90
|
+
freeze_authority: freeze_authority
|
|
91
91
|
)
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -74,11 +74,11 @@ module Solace
|
|
|
74
74
|
# @return [Solace::Instruction]
|
|
75
75
|
def build_instruction(account_context)
|
|
76
76
|
Instructions::SplToken::MintToInstruction.build(
|
|
77
|
-
amount:
|
|
78
|
-
mint_index:
|
|
79
|
-
destination_index:
|
|
77
|
+
amount: amount,
|
|
78
|
+
mint_index: account_context.index_of(mint),
|
|
79
|
+
destination_index: account_context.index_of(destination),
|
|
80
80
|
mint_authority_index: account_context.index_of(mint_authority),
|
|
81
|
-
program_index:
|
|
81
|
+
program_index: account_context.index_of(spl_token_program)
|
|
82
82
|
)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -99,13 +99,13 @@ module Solace
|
|
|
99
99
|
# @return [Solace::Instruction]
|
|
100
100
|
def build_instruction(account_context)
|
|
101
101
|
Instructions::SplToken::TransferCheckedInstruction.build(
|
|
102
|
-
amount:
|
|
103
|
-
decimals:
|
|
104
|
-
to_index:
|
|
105
|
-
from_index:
|
|
106
|
-
mint_index:
|
|
102
|
+
amount: amount,
|
|
103
|
+
decimals: decimals,
|
|
104
|
+
to_index: account_context.index_of(to),
|
|
105
|
+
from_index: account_context.index_of(from),
|
|
106
|
+
mint_index: account_context.index_of(mint),
|
|
107
107
|
authority_index: account_context.index_of(authority),
|
|
108
|
-
program_index:
|
|
108
|
+
program_index: account_context.index_of(spl_token_program)
|
|
109
109
|
)
|
|
110
110
|
end
|
|
111
111
|
end
|
|
@@ -78,11 +78,11 @@ module Solace
|
|
|
78
78
|
# @return [Solace::Instruction]
|
|
79
79
|
def build_instruction(account_context)
|
|
80
80
|
Instructions::SplToken::TransferInstruction.build(
|
|
81
|
-
amount:
|
|
82
|
-
owner_index:
|
|
83
|
-
source_index:
|
|
81
|
+
amount: amount,
|
|
82
|
+
owner_index: account_context.index_of(owner),
|
|
83
|
+
source_index: account_context.index_of(source),
|
|
84
84
|
destination_index: account_context.index_of(destination),
|
|
85
|
-
program_index:
|
|
85
|
+
program_index: account_context.index_of(spl_token_program)
|
|
86
86
|
)
|
|
87
87
|
end
|
|
88
88
|
end
|
|
@@ -85,11 +85,11 @@ module Solace
|
|
|
85
85
|
# @return [Solace::Instruction]
|
|
86
86
|
def build_instruction(account_context)
|
|
87
87
|
Solace::Instructions::SystemProgram::CreateAccountInstruction.build(
|
|
88
|
-
space:
|
|
89
|
-
lamports:
|
|
90
|
-
owner:
|
|
91
|
-
from_index:
|
|
92
|
-
new_account_index:
|
|
88
|
+
space: space,
|
|
89
|
+
lamports: lamports,
|
|
90
|
+
owner: owner,
|
|
91
|
+
from_index: account_context.index_of(from),
|
|
92
|
+
new_account_index: account_context.index_of(new_account),
|
|
93
93
|
system_program_index: account_context.index_of(system_program)
|
|
94
94
|
)
|
|
95
95
|
end
|
|
@@ -69,9 +69,9 @@ module Solace
|
|
|
69
69
|
# @return [Solace::Instruction]
|
|
70
70
|
def build_instruction(account_context)
|
|
71
71
|
Instructions::SystemProgram::TransferInstruction.build(
|
|
72
|
-
lamports:
|
|
73
|
-
to_index:
|
|
74
|
-
from_index:
|
|
72
|
+
lamports: lamports,
|
|
73
|
+
to_index: account_context.index_of(to),
|
|
74
|
+
from_index: account_context.index_of(from),
|
|
75
75
|
program_index: account_context.index_of(system_program)
|
|
76
76
|
)
|
|
77
77
|
end
|
|
@@ -64,10 +64,10 @@ module Solace
|
|
|
64
64
|
# @return [Solace::Instruction]
|
|
65
65
|
def build_instruction(account_context)
|
|
66
66
|
Instructions::Token2022::CloseAccountInstruction.build(
|
|
67
|
-
account_index:
|
|
68
|
-
authority_index:
|
|
67
|
+
account_index: account_context.index_of(account),
|
|
68
|
+
authority_index: account_context.index_of(authority),
|
|
69
69
|
destination_index: account_context.index_of(destination),
|
|
70
|
-
program_index:
|
|
70
|
+
program_index: account_context.index_of(token_2022_program)
|
|
71
71
|
)
|
|
72
72
|
end
|
|
73
73
|
end
|
|
@@ -81,11 +81,11 @@ module Solace
|
|
|
81
81
|
def build_instruction(account_context)
|
|
82
82
|
Instructions::Token2022::InitializeMintInstruction.build(
|
|
83
83
|
mint_account_index: account_context.index_of(mint_account),
|
|
84
|
-
rent_sysvar_index:
|
|
85
|
-
program_index:
|
|
86
|
-
decimals:
|
|
87
|
-
mint_authority:
|
|
88
|
-
freeze_authority:
|
|
84
|
+
rent_sysvar_index: account_context.index_of(rent_sysvar),
|
|
85
|
+
program_index: account_context.index_of(token_2022_program),
|
|
86
|
+
decimals: decimals,
|
|
87
|
+
mint_authority: mint_authority,
|
|
88
|
+
freeze_authority: freeze_authority
|
|
89
89
|
)
|
|
90
90
|
end
|
|
91
91
|
end
|
|
@@ -72,11 +72,11 @@ module Solace
|
|
|
72
72
|
# @return [Solace::Instruction]
|
|
73
73
|
def build_instruction(account_context)
|
|
74
74
|
Instructions::Token2022::MintToInstruction.build(
|
|
75
|
-
amount:
|
|
76
|
-
mint_index:
|
|
77
|
-
destination_index:
|
|
75
|
+
amount: amount,
|
|
76
|
+
mint_index: account_context.index_of(mint),
|
|
77
|
+
destination_index: account_context.index_of(destination),
|
|
78
78
|
mint_authority_index: account_context.index_of(mint_authority),
|
|
79
|
-
program_index:
|
|
79
|
+
program_index: account_context.index_of(token_2022_program)
|
|
80
80
|
)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -95,13 +95,13 @@ module Solace
|
|
|
95
95
|
# @return [Solace::Instruction]
|
|
96
96
|
def build_instruction(account_context)
|
|
97
97
|
Instructions::Token2022::TransferCheckedInstruction.build(
|
|
98
|
-
amount:
|
|
99
|
-
decimals:
|
|
100
|
-
to_index:
|
|
101
|
-
from_index:
|
|
102
|
-
mint_index:
|
|
98
|
+
amount: amount,
|
|
99
|
+
decimals: decimals,
|
|
100
|
+
to_index: account_context.index_of(to),
|
|
101
|
+
from_index: account_context.index_of(from),
|
|
102
|
+
mint_index: account_context.index_of(mint),
|
|
103
103
|
authority_index: account_context.index_of(authority),
|
|
104
|
-
program_index:
|
|
104
|
+
program_index: account_context.index_of(token_2022_program)
|
|
105
105
|
)
|
|
106
106
|
end
|
|
107
107
|
end
|
|
@@ -74,11 +74,11 @@ module Solace
|
|
|
74
74
|
# @return [Solace::Instruction]
|
|
75
75
|
def build_instruction(account_context)
|
|
76
76
|
Instructions::Token2022::TransferInstruction.build(
|
|
77
|
-
amount:
|
|
78
|
-
owner_index:
|
|
79
|
-
source_index:
|
|
77
|
+
amount: amount,
|
|
78
|
+
owner_index: account_context.index_of(owner),
|
|
79
|
+
source_index: account_context.index_of(source),
|
|
80
80
|
destination_index: account_context.index_of(destination),
|
|
81
|
-
program_index:
|
|
81
|
+
program_index: account_context.index_of(token_2022_program)
|
|
82
82
|
)
|
|
83
83
|
end
|
|
84
84
|
end
|
data/lib/solace/connection.rb
CHANGED
|
@@ -74,7 +74,7 @@ module Solace
|
|
|
74
74
|
# Set default options for rpc requests
|
|
75
75
|
@default_options = {
|
|
76
76
|
commitment: commitment,
|
|
77
|
-
encoding:
|
|
77
|
+
encoding: encoding
|
|
78
78
|
}
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -266,9 +266,9 @@ module Solace
|
|
|
266
266
|
# @return [Hash] The options for the send_transaction call
|
|
267
267
|
def build_send_transaction_options(overrides)
|
|
268
268
|
{
|
|
269
|
-
skipPreflight:
|
|
270
|
-
encoding:
|
|
271
|
-
commitment:
|
|
269
|
+
skipPreflight: false,
|
|
270
|
+
encoding: default_options[:encoding],
|
|
271
|
+
commitment: default_options[:commitment],
|
|
272
272
|
preflightCommitment: default_options[:commitment]
|
|
273
273
|
}.merge(overrides)
|
|
274
274
|
end
|
|
@@ -307,7 +307,7 @@ module Solace
|
|
|
307
307
|
raise ArgumentError, 'Block required' unless block_given?
|
|
308
308
|
|
|
309
309
|
signature = extract_signature_from(yield)
|
|
310
|
-
deadline
|
|
310
|
+
deadline = monotonic_deadline(timeout)
|
|
311
311
|
|
|
312
312
|
# Wait for confirmation
|
|
313
313
|
until deadline_passed?(deadline)
|
|
@@ -26,9 +26,9 @@ module Solace
|
|
|
26
26
|
# @param [Integer] timeout The time out reached
|
|
27
27
|
def initialize(message, signature:, commitment:, timeout:)
|
|
28
28
|
super(message)
|
|
29
|
-
@signature
|
|
29
|
+
@signature = signature
|
|
30
30
|
@commitment = commitment
|
|
31
|
-
@timeout
|
|
31
|
+
@timeout = timeout
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Formats a confirmation timeout error
|
|
@@ -40,9 +40,9 @@ module Solace
|
|
|
40
40
|
def self.format(signature, commitment, timeout)
|
|
41
41
|
new(
|
|
42
42
|
"Timed out waiting for signature #{signature} at commitment=#{commitment} after #{timeout}s",
|
|
43
|
-
signature:
|
|
43
|
+
signature: signature,
|
|
44
44
|
commitment: commitment,
|
|
45
|
-
timeout:
|
|
45
|
+
timeout: timeout
|
|
46
46
|
)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -28,9 +28,9 @@ module Solace
|
|
|
28
28
|
# @param [Object] rpc_data The JSON-RPC error data
|
|
29
29
|
def initialize(message, rpc_code:, rpc_message:, rpc_data: nil)
|
|
30
30
|
super(message)
|
|
31
|
-
@rpc_code
|
|
31
|
+
@rpc_code = rpc_code
|
|
32
32
|
@rpc_message = rpc_message
|
|
33
|
-
@rpc_data
|
|
33
|
+
@rpc_data = rpc_data
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Formats a response to an error
|
|
@@ -40,8 +40,8 @@ module Solace
|
|
|
40
40
|
def self.format_response(response)
|
|
41
41
|
new(
|
|
42
42
|
"RPC error #{response['error']['code']}: #{response['error']['message']}",
|
|
43
|
-
rpc_data:
|
|
44
|
-
rpc_code:
|
|
43
|
+
rpc_data: response['error']['data'],
|
|
44
|
+
rpc_code: response['error']['code'],
|
|
45
45
|
rpc_message: response['error']['message']
|
|
46
46
|
)
|
|
47
47
|
end
|
|
@@ -63,7 +63,7 @@ module Solace
|
|
|
63
63
|
)
|
|
64
64
|
Solace::Instruction.new.tap do |ix|
|
|
65
65
|
ix.program_index = program_index
|
|
66
|
-
ix.accounts
|
|
66
|
+
ix.accounts = [
|
|
67
67
|
funder_index,
|
|
68
68
|
associated_token_account_index,
|
|
69
69
|
owner_index,
|
|
@@ -71,6 +71,7 @@ module Solace
|
|
|
71
71
|
system_program_index,
|
|
72
72
|
token_program_index
|
|
73
73
|
]
|
|
74
|
+
|
|
74
75
|
ix.data = data
|
|
75
76
|
end
|
|
76
77
|
end
|
|
@@ -30,8 +30,8 @@ module Solace
|
|
|
30
30
|
def self.build(account_index:, destination_index:, authority_index:, program_index:)
|
|
31
31
|
Solace::Instruction.new.tap do |ix|
|
|
32
32
|
ix.program_index = program_index
|
|
33
|
-
ix.accounts
|
|
34
|
-
ix.data
|
|
33
|
+
ix.accounts = [account_index, destination_index, authority_index]
|
|
34
|
+
ix.data = data
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -47,8 +47,8 @@ module Solace
|
|
|
47
47
|
)
|
|
48
48
|
Solace::Instruction.new.tap do |ix|
|
|
49
49
|
ix.program_index = program_index
|
|
50
|
-
ix.accounts
|
|
51
|
-
ix.data
|
|
50
|
+
ix.accounts = [account_index, mint_index, owner_index, rent_sysvar_index]
|
|
51
|
+
ix.data = data
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -49,8 +49,8 @@ module Solace
|
|
|
49
49
|
)
|
|
50
50
|
Solace::Instruction.new.tap do |ix|
|
|
51
51
|
ix.program_index = program_index
|
|
52
|
-
ix.accounts
|
|
53
|
-
ix.data
|
|
52
|
+
ix.accounts = [mint_account_index, rent_sysvar_index]
|
|
53
|
+
ix.data = data(decimals, mint_authority, freeze_authority)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -39,8 +39,8 @@ module Solace
|
|
|
39
39
|
)
|
|
40
40
|
Solace::Instruction.new.tap do |ix|
|
|
41
41
|
ix.program_index = program_index
|
|
42
|
-
ix.accounts
|
|
43
|
-
ix.data
|
|
42
|
+
ix.accounts = [mint_index, destination_index, mint_authority_index]
|
|
43
|
+
ix.data = data(amount)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -50,8 +50,8 @@ module Solace
|
|
|
50
50
|
)
|
|
51
51
|
Solace::Instruction.new.tap do |ix|
|
|
52
52
|
ix.program_index = program_index
|
|
53
|
-
ix.accounts
|
|
54
|
-
ix.data
|
|
53
|
+
ix.accounts = [from_index, mint_index, to_index, authority_index]
|
|
54
|
+
ix.data = data(amount, decimals)
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -60,8 +60,8 @@ module Solace
|
|
|
60
60
|
)
|
|
61
61
|
Solace::Instruction.new.tap do |ix|
|
|
62
62
|
ix.program_index = program_index
|
|
63
|
-
ix.accounts
|
|
64
|
-
ix.data
|
|
63
|
+
ix.accounts = [source_index, destination_index, owner_index]
|
|
64
|
+
ix.data = data(amount)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -73,8 +73,8 @@ module Solace
|
|
|
73
73
|
)
|
|
74
74
|
Solace::Instruction.new.tap do |ix|
|
|
75
75
|
ix.program_index = system_program_index
|
|
76
|
-
ix.accounts
|
|
77
|
-
ix.data
|
|
76
|
+
ix.accounts = [from_index, new_account_index]
|
|
77
|
+
ix.data = data(lamports, space, owner)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
# rubocop:enable Metrics/ParameterLists
|
|
@@ -30,8 +30,8 @@ module Solace
|
|
|
30
30
|
def self.build(account_index:, destination_index:, authority_index:, program_index:)
|
|
31
31
|
Solace::Instruction.new.tap do |ix|
|
|
32
32
|
ix.program_index = program_index
|
|
33
|
-
ix.accounts
|
|
34
|
-
ix.data
|
|
33
|
+
ix.accounts = [account_index, destination_index, authority_index]
|
|
34
|
+
ix.data = data
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -42,8 +42,8 @@ module Solace
|
|
|
42
42
|
)
|
|
43
43
|
Solace::Instruction.new.tap do |ix|
|
|
44
44
|
ix.program_index = program_index
|
|
45
|
-
ix.accounts
|
|
46
|
-
ix.data
|
|
45
|
+
ix.accounts = [account_index, mint_index, owner_index, rent_sysvar_index]
|
|
46
|
+
ix.data = data
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -46,8 +46,8 @@ module Solace
|
|
|
46
46
|
)
|
|
47
47
|
Solace::Instruction.new.tap do |ix|
|
|
48
48
|
ix.program_index = program_index
|
|
49
|
-
ix.accounts
|
|
50
|
-
ix.data
|
|
49
|
+
ix.accounts = [mint_account_index, rent_sysvar_index]
|
|
50
|
+
ix.data = data(decimals, mint_authority, freeze_authority)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -37,8 +37,8 @@ module Solace
|
|
|
37
37
|
)
|
|
38
38
|
Solace::Instruction.new.tap do |ix|
|
|
39
39
|
ix.program_index = program_index
|
|
40
|
-
ix.accounts
|
|
41
|
-
ix.data
|
|
40
|
+
ix.accounts = [mint_index, destination_index, mint_authority_index]
|
|
41
|
+
ix.data = data(amount)
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -47,8 +47,8 @@ module Solace
|
|
|
47
47
|
)
|
|
48
48
|
Solace::Instruction.new.tap do |ix|
|
|
49
49
|
ix.program_index = program_index
|
|
50
|
-
ix.accounts
|
|
51
|
-
ix.data
|
|
50
|
+
ix.accounts = [from_index, mint_index, to_index, authority_index]
|
|
51
|
+
ix.data = data(amount, decimals)
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -49,8 +49,8 @@ module Solace
|
|
|
49
49
|
)
|
|
50
50
|
Solace::Instruction.new.tap do |ix|
|
|
51
51
|
ix.program_index = program_index
|
|
52
|
-
ix.accounts
|
|
53
|
-
ix.data
|
|
52
|
+
ix.accounts = [source_index, destination_index, owner_index]
|
|
53
|
+
ix.data = data(amount)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
data/lib/solace/message.rb
CHANGED
|
@@ -68,11 +68,11 @@ module Solace
|
|
|
68
68
|
)
|
|
69
69
|
super()
|
|
70
70
|
|
|
71
|
-
@version
|
|
72
|
-
@header
|
|
73
|
-
@accounts
|
|
74
|
-
@recent_blockhash
|
|
75
|
-
@instructions
|
|
71
|
+
@version = version
|
|
72
|
+
@header = header
|
|
73
|
+
@accounts = accounts
|
|
74
|
+
@recent_blockhash = recent_blockhash
|
|
75
|
+
@instructions = instructions
|
|
76
76
|
@address_lookup_tables = address_lookup_tables
|
|
77
77
|
end
|
|
78
78
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# The AssociatedTokenAccount program is a Solana program that provides a standardized
|
|
3
|
+
# The AssociatedTokenAccount program is a Solana program that provides a standardized
|
|
4
|
+
# way to create and manage token accounts.
|
|
4
5
|
#
|
|
5
6
|
# This class provides a Ruby interface to the Associated Token Account program, allowing you to easily
|
|
6
7
|
# find or create associated token accounts for a given wallet and mint.
|
|
@@ -100,10 +101,10 @@ module Solace
|
|
|
100
101
|
return ata_address unless account_balance.nil?
|
|
101
102
|
|
|
102
103
|
tx = create_associated_token_account(
|
|
103
|
-
payer:
|
|
104
|
-
funder:
|
|
105
|
-
owner:
|
|
106
|
-
mint:
|
|
104
|
+
payer: payer,
|
|
105
|
+
funder: funder,
|
|
106
|
+
owner: owner,
|
|
107
|
+
mint: mint,
|
|
107
108
|
token_program_id: token_program_id
|
|
108
109
|
)
|
|
109
110
|
|
|
@@ -161,10 +162,10 @@ module Solace
|
|
|
161
162
|
ata_address, = get_address(owner: owner, mint: mint, token_program_id: token_program_id)
|
|
162
163
|
|
|
163
164
|
ix = Solace::Composers::AssociatedTokenAccountProgramCreateAccountComposer.new(
|
|
164
|
-
mint:
|
|
165
|
-
owner:
|
|
166
|
-
funder:
|
|
167
|
-
ata_address:
|
|
165
|
+
mint: mint,
|
|
166
|
+
owner: owner,
|
|
167
|
+
funder: funder,
|
|
168
|
+
ata_address: ata_address,
|
|
168
169
|
token_program_id: token_program_id
|
|
169
170
|
)
|
|
170
171
|
|