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'- 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_PROGRAM_ID ⇒ Object
The public key of the SPL Token Program This is the same across all Solana clusters.
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
43 |
# File 'lib/solace/constants.rb', line 43 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
33 |
# File 'lib/solace/constants.rb', line 33 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
38 |
# File 'lib/solace/constants.rb', line 38 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_PROGRAM_ID ⇒ Object
The public key of the SPL Token Program 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.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/solace/constants.rb', line 85 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 |