solace 0.0.3 → 0.0.5
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 +12 -0
- data/README.md +140 -285
- data/lib/solace/address_lookup_table.rb +34 -18
- data/lib/solace/composers/base.rb +16 -11
- data/lib/solace/composers/spl_token_program_transfer_checked_composer.rb +27 -1
- data/lib/solace/composers/system_program_transfer_composer.rb +22 -1
- data/lib/solace/concerns/binary_serializable.rb +39 -0
- data/lib/solace/connection.rb +69 -38
- data/lib/solace/constants.rb +7 -14
- data/lib/solace/instruction.rb +30 -19
- data/lib/solace/instructions/associated_token_account/create_associated_token_account_instruction.rb +18 -3
- data/lib/solace/instructions/spl_token/initialize_account_instruction.rb +24 -3
- data/lib/solace/instructions/spl_token/initialize_mint_instruction.rb +18 -1
- data/lib/solace/instructions/spl_token/mint_to_instruction.rb +16 -3
- data/lib/solace/instructions/spl_token/transfer_checked_instruction.rb +17 -1
- data/lib/solace/instructions/spl_token/transfer_instruction.rb +15 -2
- data/lib/solace/instructions/system_program/create_account_instruction.rb +18 -3
- data/lib/solace/instructions/system_program/transfer_instruction.rb +15 -7
- data/lib/solace/keypair.rb +64 -31
- data/lib/solace/message.rb +22 -10
- data/lib/solace/programs/associated_token_account.rb +45 -20
- data/lib/solace/programs/base.rb +6 -0
- data/lib/solace/programs/spl_token.rb +52 -14
- data/lib/solace/public_key.rb +45 -20
- data/lib/solace/serializers/address_lookup_table_deserializer.rb +3 -5
- data/lib/solace/serializers/address_lookup_table_serializer.rb +7 -7
- data/lib/solace/serializers/base_deserializer.rb +29 -19
- data/lib/solace/serializers/base_serializer.rb +18 -9
- data/lib/solace/serializers/instruction_deserializer.rb +5 -7
- data/lib/solace/serializers/instruction_serializer.rb +4 -6
- data/lib/solace/serializers/message_deserializer.rb +3 -5
- data/lib/solace/serializers/message_serializer.rb +3 -5
- data/lib/solace/serializers/transaction_deserializer.rb +5 -7
- data/lib/solace/serializers/transaction_serializer.rb +5 -7
- data/lib/solace/transaction.rb +38 -23
- data/lib/solace/transaction_composer.rb +47 -13
- data/lib/solace/utils/account_context.rb +64 -65
- data/lib/solace/utils/codecs.rb +56 -128
- data/lib/solace/utils/curve25519_dalek.rb +9 -4
- data/lib/solace/utils/pda.rb +22 -24
- data/lib/solace/version.rb +2 -1
- data/lib/solace.rb +4 -9
- metadata +7 -10
- data/lib/solace/instructions/base.rb +0 -21
- data/lib/solace/serializable_record.rb +0 -26
- data/lib/solace/serializers/base.rb +0 -31
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Scholl
|
@@ -52,33 +52,33 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '7.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: minitest
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '5.0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '5.0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: rake
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '13.0'
|
75
75
|
type: :development
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '13.0'
|
82
82
|
description: A Ruby library for working with Solana blockchain. Provides both low-level
|
83
83
|
instruction builders and high-level program clients for interacting with Solana
|
84
84
|
programs.
|
@@ -101,7 +101,6 @@ files:
|
|
101
101
|
- lib/solace/constants.rb
|
102
102
|
- lib/solace/instruction.rb
|
103
103
|
- lib/solace/instructions/associated_token_account/create_associated_token_account_instruction.rb
|
104
|
-
- lib/solace/instructions/base.rb
|
105
104
|
- lib/solace/instructions/spl_token/initialize_account_instruction.rb
|
106
105
|
- lib/solace/instructions/spl_token/initialize_mint_instruction.rb
|
107
106
|
- lib/solace/instructions/spl_token/mint_to_instruction.rb
|
@@ -115,10 +114,8 @@ files:
|
|
115
114
|
- lib/solace/programs/base.rb
|
116
115
|
- lib/solace/programs/spl_token.rb
|
117
116
|
- lib/solace/public_key.rb
|
118
|
-
- lib/solace/serializable_record.rb
|
119
117
|
- lib/solace/serializers/address_lookup_table_deserializer.rb
|
120
118
|
- lib/solace/serializers/address_lookup_table_serializer.rb
|
121
|
-
- lib/solace/serializers/base.rb
|
122
119
|
- lib/solace/serializers/base_deserializer.rb
|
123
120
|
- lib/solace/serializers/base_serializer.rb
|
124
121
|
- lib/solace/serializers/instruction_deserializer.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Solace
|
2
|
-
module Instructions
|
3
|
-
class Base
|
4
|
-
class << self
|
5
|
-
# Must implement build method
|
6
|
-
#
|
7
|
-
# @return [Solace::Instruction] The instruction
|
8
|
-
def build
|
9
|
-
raise NotImplementedError, "Subclasses must implement build method"
|
10
|
-
end
|
11
|
-
|
12
|
-
# Must implement data method
|
13
|
-
#
|
14
|
-
# @return [Array<Integer>] The instruction data
|
15
|
-
def data
|
16
|
-
raise NotImplementedError, "Subclasses must implement data method"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Solace
|
4
|
-
class SerializableRecord
|
5
|
-
include Solace::Concerns::BinarySerializable
|
6
|
-
|
7
|
-
# Parse instruction from io stream
|
8
|
-
#
|
9
|
-
# @param io [IO or StringIO] The input to read bytes from.
|
10
|
-
# @return [Solace::Instruction] Parsed instruction object
|
11
|
-
def self.deserialize(io)
|
12
|
-
self::DESERIALIZER.call(io)
|
13
|
-
rescue NameError => e
|
14
|
-
raise "DESERIALIZER must be defined: #{e.message}"
|
15
|
-
end
|
16
|
-
|
17
|
-
# Serializes the transaction to a binary format
|
18
|
-
#
|
19
|
-
# @return [String] The serialized transaction (binary)
|
20
|
-
def serialize
|
21
|
-
self.class::SERIALIZER.call(self)
|
22
|
-
rescue NameError => e
|
23
|
-
raise "SERIALIZER must be defined: #{e.message}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Solace
|
4
|
-
module Serializers
|
5
|
-
class Base
|
6
|
-
include Solace::Utils
|
7
|
-
|
8
|
-
# Proxy method to call the serializer and create a new instance
|
9
|
-
#
|
10
|
-
# @return [String] The serialized record (base64)
|
11
|
-
def self.call(*args, **kwargs)
|
12
|
-
new(*args, **kwargs).call
|
13
|
-
end
|
14
|
-
|
15
|
-
# Serializes the record
|
16
|
-
#
|
17
|
-
# @return [String] The serialized record (base64)
|
18
|
-
def call
|
19
|
-
bin = self.class::STEPS
|
20
|
-
.map { |m| send(m) }
|
21
|
-
.flatten
|
22
|
-
.compact
|
23
|
-
.pack('C*')
|
24
|
-
|
25
|
-
Base64.strict_encode64(bin)
|
26
|
-
rescue NameError => e
|
27
|
-
raise "STEPS must be defined: #{e.message}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|