Module: Solace::Constants
- Defined in:
- lib/solace/constants.rb
Overview
Constants module
Contains constants used across the library.
Constant Summary collapse
- SYSTEM_PROGRAM_ID =
'11111111111111111111111111111111'- SYSVAR_RENT_PROGRAM_ID =
'SysvarRent111111111111111111111111111111111'- COMPUTE_BUDGET_PROGRAM_ID =
'ComputeBudget111111111111111111111111111111'- TOKEN_PROGRAM_ID =
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'- TOKEN_2022_PROGRAM_ID =
'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'- ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID =
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'- MEMO_PROGRAM_ID =
'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'- ADDRESS_LOOKUP_TABLE_PROGRAM_ID =
'AddressLookupTab1e1111111111111111111111111'
Instance Attribute Summary collapse
-
#ADDRESS_LOOKUP_TABLE_PROGRAM_ID ⇒ Object
The public key of the Address Lookup Table Program This is the same across all Solana clusters.
-
#ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID ⇒ Object
The public key of the Associated Token Account Program This is the same across all Solana clusters.
-
#COMPUTE_BUDGET_PROGRAM_ID ⇒ Object
The public key of the Compute Budget Program This is the same across all Solana clusters.
-
#MEMO_PROGRAM_ID ⇒ Object
The public key of the Memo Program This is the same across all Solana clusters.
-
#SYSTEM_PROGRAM_ID ⇒ Object
The public key of the System Program (native SOL transfers, account creation, etc) This is the same across all Solana clusters.
-
#SYSVAR_RENT_PROGRAM_ID ⇒ Object
The public key of the Rent Program This is the same across all Solana clusters.
-
#TOKEN_2022_PROGRAM_ID ⇒ Object
The public key of the Token-2022 Program (formerly Token Extensions).
-
#TOKEN_PROGRAM_ID ⇒ Object
The public key of the SPL Token Program (legacy).
Class Method Summary collapse
-
.load(path:, namespace: 'default', protect_overrides: true) ⇒ void
Loads the constants declared in a YAML file.
Instance Attribute Details
#ADDRESS_LOOKUP_TABLE_PROGRAM_ID ⇒ Object
The public key of the Address Lookup Table Program This is the same across all Solana clusters
49 |
# File 'lib/solace/constants.rb', line 49 ADDRESS_LOOKUP_TABLE_PROGRAM_ID = 'AddressLookupTab1e1111111111111111111111111' |
#ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID ⇒ Object
The public key of the Associated Token Account Program This is the same across all Solana clusters
39 |
# File 'lib/solace/constants.rb', line 39 ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' |
#COMPUTE_BUDGET_PROGRAM_ID ⇒ Object
The public key of the Compute Budget Program This is the same across all Solana clusters
23 |
# File 'lib/solace/constants.rb', line 23 COMPUTE_BUDGET_PROGRAM_ID = 'ComputeBudget111111111111111111111111111111' |
#MEMO_PROGRAM_ID ⇒ Object
The public key of the Memo Program This is the same across all Solana clusters
44 |
# File 'lib/solace/constants.rb', line 44 MEMO_PROGRAM_ID = 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr' |
#SYSTEM_PROGRAM_ID ⇒ Object
The public key of the System Program (native SOL transfers, account creation, etc) This is the same across all Solana clusters
13 |
# File 'lib/solace/constants.rb', line 13 SYSTEM_PROGRAM_ID = '11111111111111111111111111111111' |
#SYSVAR_RENT_PROGRAM_ID ⇒ Object
The public key of the Rent Program This is the same across all Solana clusters
18 |
# File 'lib/solace/constants.rb', line 18 SYSVAR_RENT_PROGRAM_ID = 'SysvarRent111111111111111111111111111111111' |
#TOKEN_2022_PROGRAM_ID ⇒ Object
The public key of the Token-2022 Program (formerly Token Extensions). This is the same across all Solana clusters. See Programs::Token2022 for the full description of how it relates to the legacy program.
34 |
# File 'lib/solace/constants.rb', line 34 TOKEN_2022_PROGRAM_ID = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' |
#TOKEN_PROGRAM_ID ⇒ Object
The public key of the SPL Token Program (legacy). This is the same across all Solana clusters.
28 |
# File 'lib/solace/constants.rb', line 28 TOKEN_PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' |
Class Method Details
.load(path:, namespace: 'default', protect_overrides: true) ⇒ void
This method returns an undefined value.
Loads the constants declared in a YAML file
Developers require adding program addresses and mint accounts that will not be added directly to Solace. This method allows for loading those constants from a YAML file and extends the Constants module with them.
The YAML file should be a hash of key-value pairs, where the key is the constant name and the value is the constant value.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/solace/constants.rb', line 91 def self.load( path:, namespace: 'default', protect_overrides: true ) content = YAML.load_file(path) content[namespace].each do |key, value| if const_defined?(key.upcase) raise ArgumentError, "Constant #{key} is already defined" if protect_overrides remove_const(key.upcase) end const_set(key.upcase, value) end end |