abstract-solana 0.0.0.96__tar.gz → 0.0.0.98__tar.gz
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.
Potentially problematic release.
This version of abstract-solana might be problematic. Click here for more details.
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/PKG-INFO +1 -1
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/setup.py +1 -1
- abstract_solana-0.0.0.98/src/abstract_solana/__init__.py +55 -0
- abstract_solana-0.0.0.98/src/abstract_solana/abstract_rpcs/db_templates.py +215 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/PKG-INFO +1 -1
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/SOURCES.txt +2 -5
- abstract_solana-0.0.0.96/src/abstract_solana/__init__.py +0 -3
- abstract_solana-0.0.0.96/src/abstract_solana/pump_functions/__init__.py +0 -3
- abstract_solana-0.0.0.96/src/abstract_solana/pump_functions/buy_sell_pump.py +0 -149
- abstract_solana-0.0.0.96/src/abstract_solana/pump_functions/pump_fun_keys.py +0 -133
- abstract_solana-0.0.0.96/src/abstract_solana/pump_functions/token_utils.py +0 -63
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/README.md +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/setup.cfg +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_rpcs/__init__.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_rpcs/get_body.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/__init__.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/account_key_utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/constants.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/genesis_functions.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/index_utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/keypair_utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/log_message_functions.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/price_utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/pubkey_utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/signature_data_parse.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/utils.py +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/dependency_links.txt +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/requires.txt +0 -0
- {abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import psycopg2
|
|
3
|
+
from psycopg2 import pool
|
|
4
|
+
table_configurations = [{'tableName': 'getbalance', 'columnSearch': 'pubkey', 'insertName': 'balance', 'type': 'Balance', 'searchQuery': 'SELECT balance FROM getbalance WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getbalance (pubkey, balance) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getbalance (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,balance JSONB NOT NULL);'}, {'tableName': 'getaccountinfo', 'columnSearch': 'pubkey', 'insertName': 'account_info', 'type': 'AccountInfo', 'searchQuery': 'SELECT account_info FROM getaccountinfo WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getaccountinfo (pubkey, account_info) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getaccountinfo (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,account_info JSONB NOT NULL);'}, {'tableName': 'getaccountinfojsonparsed', 'columnSearch': 'pubkey', 'insertName': 'account_info_json_parsed', 'type': 'AccountInfoMaybeJsonParsed', 'searchQuery': 'SELECT account_info_json_parsed FROM getaccountinfojsonparsed WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getaccountinfojsonparsed (pubkey, account_info_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getaccountinfojsonparsed (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,account_info_json_parsed JSONB NOT NULL);'}, {'tableName': 'getblockcommitment', 'columnSearch': 'slot', 'insertName': 'block_commitment', 'type': 'BlockCommitment', 'searchQuery': 'SELECT block_commitment FROM getblockcommitment WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblockcommitment (slot, block_commitment) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblockcommitment (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block_commitment JSONB NOT NULL);'}, {'tableName': 'getblocktime', 'columnSearch': 'slot', 'insertName': 'block_time', 'type': 'BlockTime', 'searchQuery': 'SELECT block_time FROM getblocktime WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblocktime (slot, block_time) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblocktime (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block_time JSONB NOT NULL);'}, {'tableName': 'getclusternodes', 'columnSearch': None, 'insertName': 'cluster_nodes', 'type': 'ClusterNodes', 'searchQuery': 'SELECT cluster_nodes FROM getclusternodes WHERE None = %s;', 'insertQuery': 'INSERT INTO getclusternodes (None, cluster_nodes) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getclusternodes (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,cluster_nodes JSONB NOT NULL);'}, {'tableName': 'getblock', 'columnSearch': 'slot', 'insertName': 'block', 'type': 'Block', 'searchQuery': 'SELECT block FROM getblock WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblock (slot, block) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblock (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block JSONB NOT NULL);'}, {'tableName': 'getrecentperformancesamples', 'columnSearch': 'limits', 'insertName': 'recent_performance_samples', 'type': 'RecentPerformanceSamples', 'searchQuery': 'SELECT recent_performance_samples FROM getrecentperformancesamples WHERE limits = %s;', 'insertQuery': 'INSERT INTO getrecentperformancesamples (limits, recent_performance_samples) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getrecentperformancesamples (id SERIAL PRIMARY KEY,limits VARCHAR(255) UNIQUE NOT NULL,recent_performance_samples JSONB NOT NULL);'}, {'tableName': 'getblockheight', 'columnSearch': 'commitment', 'insertName': 'block_height', 'type': 'BlockHeight', 'searchQuery': 'SELECT block_height FROM getblockheight WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getblockheight (commitment, block_height) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblockheight (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,block_height JSONB NOT NULL);'}, {'tableName': 'getblocks', 'columnSearch': 'start_slot', 'insertName': 'blocks', 'type': 'Blocks', 'searchQuery': 'SELECT blocks FROM getblocks WHERE start_slot = %s;', 'insertQuery': 'INSERT INTO getblocks (start_slot, blocks) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblocks (id SERIAL PRIMARY KEY,start_slot VARCHAR(255) UNIQUE NOT NULL,blocks JSONB NOT NULL);'}, {'tableName': 'getsignaturesforaddress', 'columnSearch': 'account', 'insertName': 'signatures_for_address', 'type': 'SignaturesForAddress', 'searchQuery': 'SELECT signatures_for_address FROM getsignaturesforaddress WHERE account = %s;', 'insertQuery': 'INSERT INTO getsignaturesforaddress (account, signatures_for_address) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsignaturesforaddress (id SERIAL PRIMARY KEY,account VARCHAR(255) UNIQUE NOT NULL,signatures_for_address JSONB NOT NULL);'}, {'tableName': 'gettransaction', 'columnSearch': 'signature', 'insertName': 'transaction', 'type': 'Transaction', 'searchQuery': 'SELECT transaction FROM gettransaction WHERE signature = %s;', 'insertQuery': 'INSERT INTO gettransaction (signature, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettransaction (id SERIAL PRIMARY KEY,signature VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'getepochinfo', 'columnSearch': 'commitment', 'insertName': 'epoch_info', 'type': 'EpochInfo', 'searchQuery': 'SELECT epoch_info FROM getepochinfo WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getepochinfo (commitment, epoch_info) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getepochinfo (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,epoch_info JSONB NOT NULL);'}, {'tableName': 'getepochschedule', 'columnSearch': None, 'insertName': 'epoch_schedule', 'type': 'EpochSchedule', 'searchQuery': 'SELECT epoch_schedule FROM getepochschedule WHERE None = %s;', 'insertQuery': 'INSERT INTO getepochschedule (None, epoch_schedule) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getepochschedule (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,epoch_schedule JSONB NOT NULL);'}, {'tableName': 'getfeeformessage', 'columnSearch': 'message', 'insertName': 'fee_for_message', 'type': 'FeeForMessage', 'searchQuery': 'SELECT fee_for_message FROM getfeeformessage WHERE message = %s;', 'insertQuery': 'INSERT INTO getfeeformessage (message, fee_for_message) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getfeeformessage (id SERIAL PRIMARY KEY,message VARCHAR(255) UNIQUE NOT NULL,fee_for_message JSONB NOT NULL);'}, {'tableName': 'getfirstavailableblock', 'columnSearch': None, 'insertName': 'first_available_block', 'type': 'FirstAvailableBlock', 'searchQuery': 'SELECT first_available_block FROM getfirstavailableblock WHERE None = %s;', 'insertQuery': 'INSERT INTO getfirstavailableblock (None, first_available_block) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getfirstavailableblock (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,first_available_block JSONB NOT NULL);'}, {'tableName': 'getgenesishash', 'columnSearch': None, 'insertName': 'genesis_hash', 'type': 'GenesisHash', 'searchQuery': 'SELECT genesis_hash FROM getgenesishash WHERE None = %s;', 'insertQuery': 'INSERT INTO getgenesishash (None, genesis_hash) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getgenesishash (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,genesis_hash JSONB NOT NULL);'}, {'tableName': 'getidentity', 'columnSearch': None, 'insertName': 'identity', 'type': 'Identity', 'searchQuery': 'SELECT identity FROM getidentity WHERE None = %s;', 'insertQuery': 'INSERT INTO getidentity (None, identity) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getidentity (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,identity JSONB NOT NULL);'}, {'tableName': 'getinflationgovernor', 'columnSearch': 'commitment', 'insertName': 'inflation_governor', 'type': 'InflationGovernor', 'searchQuery': 'SELECT inflation_governor FROM getinflationgovernor WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getinflationgovernor (commitment, inflation_governor) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationgovernor (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,inflation_governor JSONB NOT NULL);'}, {'tableName': 'getinflationrate', 'columnSearch': None, 'insertName': 'inflation_rate', 'type': 'InflationRate', 'searchQuery': 'SELECT inflation_rate FROM getinflationrate WHERE None = %s;', 'insertQuery': 'INSERT INTO getinflationrate (None, inflation_rate) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationrate (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,inflation_rate JSONB NOT NULL);'}, {'tableName': 'getinflationreward', 'columnSearch': 'pubkeys', 'insertName': 'inflation_reward', 'type': 'InflationReward', 'searchQuery': 'SELECT inflation_reward FROM getinflationreward WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getinflationreward (pubkeys, inflation_reward) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationreward (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,inflation_reward JSONB NOT NULL);'}, {'tableName': 'getlargestaccounts', 'columnSearch': 'filter_opt', 'insertName': 'largest_accounts', 'type': 'LargestAccounts', 'searchQuery': 'SELECT largest_accounts FROM getlargestaccounts WHERE filter_opt = %s;', 'insertQuery': 'INSERT INTO getlargestaccounts (filter_opt, largest_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getlargestaccounts (id SERIAL PRIMARY KEY,filter_opt VARCHAR(255) UNIQUE NOT NULL,largest_accounts JSONB NOT NULL);'}, {'tableName': 'getleaderschedule', 'columnSearch': 'epoch', 'insertName': 'leader_schedule', 'type': 'LeaderSchedule', 'searchQuery': 'SELECT leader_schedule FROM getleaderschedule WHERE epoch = %s;', 'insertQuery': 'INSERT INTO getleaderschedule (epoch, leader_schedule) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getleaderschedule (id SERIAL PRIMARY KEY,epoch VARCHAR(255) UNIQUE NOT NULL,leader_schedule JSONB NOT NULL);'}, {'tableName': 'getminimumbalanceforrentexemption', 'columnSearch': 'usize', 'insertName': 'minimum_balance_for_rent_exemption', 'type': 'MinimumBalanceForRentExemption', 'searchQuery': 'SELECT minimum_balance_for_rent_exemption FROM getminimumbalanceforrentexemption WHERE usize = %s;', 'insertQuery': 'INSERT INTO getminimumbalanceforrentexemption (usize, minimum_balance_for_rent_exemption) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getminimumbalanceforrentexemption (id SERIAL PRIMARY KEY,usize VARCHAR(255) UNIQUE NOT NULL,minimum_balance_for_rent_exemption JSONB NOT NULL);'}, {'tableName': 'getmultipleaccounts', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts', 'type': 'MultipleAccounts', 'searchQuery': 'SELECT multiple_accounts FROM getmultipleaccounts WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getmultipleaccounts (pubkeys, multiple_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccounts (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,multiple_accounts JSONB NOT NULL);'}, {'tableName': 'getmultipleaccountsjsonparsed', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts_json_parsed', 'type': 'MultipleAccountsMaybeJsonParsed', 'searchQuery': 'SELECT multiple_accounts_json_parsed FROM getmultipleaccountsjsonparsed WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getmultipleaccountsjsonparsed (pubkeys, multiple_accounts_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,multiple_accounts_json_parsed JSONB NOT NULL);'}, {'tableName': 'getprogramaccounts', 'columnSearch': 'pubkey', 'insertName': 'program_accounts', 'type': 'ProgramAccounts', 'searchQuery': 'SELECT program_accounts FROM getprogramaccounts WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getprogramaccounts (pubkey, program_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getprogramaccounts (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,program_accounts JSONB NOT NULL);'}, {'tableName': 'getprogramaccountsjsonparsed', 'columnSearch': 'pubkey', 'insertName': 'program_accounts_json_parsed', 'type': 'ProgramAccountsMaybeJsonParsed', 'searchQuery': 'SELECT program_accounts_json_parsed FROM getprogramaccountsjsonparsed WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getprogramaccountsjsonparsed (pubkey, program_accounts_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getprogramaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,program_accounts_json_parsed JSONB NOT NULL);'}, {'tableName': 'getlatestblockhash', 'columnSearch': 'commitment', 'insertName': 'latest_blockhash', 'type': 'LatestBlockhash', 'searchQuery': 'SELECT latest_blockhash FROM getlatestblockhash WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getlatestblockhash (commitment, latest_blockhash) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getlatestblockhash (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,latest_blockhash JSONB NOT NULL);'}, {'tableName': 'getsignaturestatuses', 'columnSearch': 'signatures', 'insertName': 'signature_statuses', 'type': 'SignatureStatuses', 'searchQuery': 'SELECT signature_statuses FROM getsignaturestatuses WHERE signatures = %s;', 'insertQuery': 'INSERT INTO getsignaturestatuses (signatures, signature_statuses) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsignaturestatuses (id SERIAL PRIMARY KEY,signatures VARCHAR(255) UNIQUE NOT NULL,signature_statuses JSONB NOT NULL);'}, {'tableName': 'getslot', 'columnSearch': 'commitment', 'insertName': 'slot', 'type': 'Slot', 'searchQuery': 'SELECT slot FROM getslot WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getslot (commitment, slot) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getslot (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,slot JSONB NOT NULL);'}, {'tableName': 'getslotleader', 'columnSearch': 'commitment', 'insertName': 'slot_leader', 'type': 'SlotLeader', 'searchQuery': 'SELECT slot_leader FROM getslotleader WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getslotleader (commitment, slot_leader) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getslotleader (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,slot_leader JSONB NOT NULL);'}, {'tableName': 'getstakeactivation', 'columnSearch': 'pubkey', 'insertName': 'stake_activation', 'type': 'StakeActivation', 'searchQuery': 'SELECT stake_activation FROM getstakeactivation WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getstakeactivation (pubkey, stake_activation) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getstakeactivation (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,stake_activation JSONB NOT NULL);'}, {'tableName': 'getsupply', 'columnSearch': 'commitment', 'insertName': 'supply', 'type': 'Supply', 'searchQuery': 'SELECT supply FROM getsupply WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getsupply (commitment, supply) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsupply (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,supply JSONB NOT NULL);'}, {'tableName': 'gettokenaccountbalance', 'columnSearch': 'pubkey', 'insertName': 'token_account_balance', 'type': 'TokenAccountBalance', 'searchQuery': 'SELECT token_account_balance FROM gettokenaccountbalance WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokenaccountbalance (pubkey, token_account_balance) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountbalance (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_account_balance JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbydelegate', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate', 'type': 'TokenAccountsByDelegate', 'searchQuery': 'SELECT token_accounts_by_delegate FROM gettokenaccountsbydelegate WHERE delegate = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbydelegate (delegate, token_accounts_by_delegate) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegate (id SERIAL PRIMARY KEY,delegate VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_delegate JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbydelegatejsonparsed', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate_json_parsed', 'type': 'TokenAccountsByDelegateJsonParsed', 'searchQuery': 'SELECT token_accounts_by_delegate_json_parsed FROM gettokenaccountsbydelegatejsonparsed WHERE delegate = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbydelegatejsonparsed (delegate, token_accounts_by_delegate_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegatejsonparsed (id SERIAL PRIMARY KEY,delegate VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_delegate_json_parsed JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbyowner', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner', 'type': 'TokenAccountsByOwner', 'searchQuery': 'SELECT token_accounts_by_owner FROM gettokenaccountsbyowner WHERE owner = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbyowner (owner, token_accounts_by_owner) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyowner (id SERIAL PRIMARY KEY,owner VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_owner JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbyownerjsonparsed', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner_json_parsed', 'type': 'TokenAccountsByOwnerJsonParsed', 'searchQuery': 'SELECT token_accounts_by_owner_json_parsed FROM gettokenaccountsbyownerjsonparsed WHERE owner = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbyownerjsonparsed (owner, token_accounts_by_owner_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyownerjsonparsed (id SERIAL PRIMARY KEY,owner VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_owner_json_parsed JSONB NOT NULL);'}, {'tableName': 'gettokenlargestaccounts', 'columnSearch': 'pubkey', 'insertName': 'token_largest_accounts', 'type': 'TokenLargestAccounts', 'searchQuery': 'SELECT token_largest_accounts FROM gettokenlargestaccounts WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokenlargestaccounts (pubkey, token_largest_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenlargestaccounts (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_largest_accounts JSONB NOT NULL);'}, {'tableName': 'gettokensupply', 'columnSearch': 'pubkey', 'insertName': 'token_supply', 'type': 'TokenSupply', 'searchQuery': 'SELECT token_supply FROM gettokensupply WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokensupply (pubkey, token_supply) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokensupply (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_supply JSONB NOT NULL);'}, {'tableName': 'gettransactioncount', 'columnSearch': 'commitment', 'insertName': 'transaction_count', 'type': 'TransactionCount', 'searchQuery': 'SELECT transaction_count FROM gettransactioncount WHERE commitment = %s;', 'insertQuery': 'INSERT INTO gettransactioncount (commitment, transaction_count) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettransactioncount (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,transaction_count JSONB NOT NULL);'}, {'tableName': 'getminimumledgerslot', 'columnSearch': None, 'insertName': 'minimum_ledger_slot', 'type': 'MinimumLedgerSlot', 'searchQuery': 'SELECT minimum_ledger_slot FROM getminimumledgerslot WHERE None = %s;', 'insertQuery': 'INSERT INTO getminimumledgerslot (None, minimum_ledger_slot) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getminimumledgerslot (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,minimum_ledger_slot JSONB NOT NULL);'}, {'tableName': 'getversion', 'columnSearch': None, 'insertName': 'version', 'type': 'Version', 'searchQuery': 'SELECT version FROM getversion WHERE None = %s;', 'insertQuery': 'INSERT INTO getversion (None, version) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getversion (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,version JSONB NOT NULL);'}, {'tableName': 'getvoteaccounts', 'columnSearch': 'commitment', 'insertName': 'vote_accounts', 'type': 'VoteAccounts', 'searchQuery': 'SELECT vote_accounts FROM getvoteaccounts WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getvoteaccounts (commitment, vote_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getvoteaccounts (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,vote_accounts JSONB NOT NULL);'}, {'tableName': 'requestairdrop', 'columnSearch': 'pubkey', 'insertName': 'airdrop', 'type': 'RequestAirdrop', 'searchQuery': 'SELECT airdrop FROM requestairdrop WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO requestairdrop (pubkey, airdrop) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS requestairdrop (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,airdrop JSONB NOT NULL);'}, {'tableName': 'sendrawtransaction', 'columnSearch': 'txn', 'insertName': 'raw_transaction', 'type': 'SendTransaction', 'searchQuery': 'SELECT raw_transaction FROM sendrawtransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO sendrawtransaction (txn, raw_transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS sendrawtransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,raw_transaction JSONB NOT NULL);'}, {'tableName': 'sendtransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SendTransaction', 'searchQuery': 'SELECT transaction FROM sendtransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO sendtransaction (txn, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS sendtransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'simulatetransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SimulateTransaction', 'searchQuery': 'SELECT transaction FROM simulatetransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO simulatetransaction (txn, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS simulatetransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'validatorexit', 'columnSearch': None, 'insertName': 'exit', 'type': 'ValidatorExit', 'searchQuery': 'SELECT exit FROM validatorexit WHERE None = %s;', 'insertQuery': 'INSERT INTO validatorexit (None, exit) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS validatorexit (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,exit JSONB NOT NULL);'}, {'tableName': 'postsendwithconfirm', 'columnSearch': 'resp', 'insertName': '_post_send_with_confirm', 'type': 'SendTransaction', 'searchQuery': 'SELECT _post_send_with_confirm FROM postsendwithconfirm WHERE resp = %s;', 'insertQuery': 'INSERT INTO postsendwithconfirm (resp, _post_send_with_confirm) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS postsendwithconfirm (id SERIAL PRIMARY KEY,resp VARCHAR(255) UNIQUE NOT NULL,_post_send_with_confirm JSONB NOT NULL);'}, {'tableName': 'confirmtransaction', 'columnSearch': 'tx_sig', 'insertName': 'transaction', 'type': 'SignatureStatuses', 'searchQuery': 'SELECT transaction FROM confirmtransaction WHERE tx_sig = %s;', 'insertQuery': 'INSERT INTO confirmtransaction (tx_sig, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS confirmtransaction (id SERIAL PRIMARY KEY,tx_sig VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}]
|
|
5
|
+
|
|
6
|
+
# Initialize the connection pool
|
|
7
|
+
connection_pool = psycopg2.pool.SimpleConnectionPool(1, 10, user='partners',
|
|
8
|
+
password='solcatch123!!!456',
|
|
9
|
+
host='192.168.0.100',
|
|
10
|
+
port='5432',
|
|
11
|
+
database='solcatcher')
|
|
12
|
+
|
|
13
|
+
def get_db_connection():
|
|
14
|
+
return connection_pool.getconn()
|
|
15
|
+
def put_db_connection(conn):
|
|
16
|
+
connection_pool.putconn(conn)
|
|
17
|
+
def getInsertType(tableName):
|
|
18
|
+
insertList = [ls for ls in table_configurations if ls.get("tableName").lower() == tableName.lower()]
|
|
19
|
+
return insertList[0] if insertList else None
|
|
20
|
+
def connect_db():
|
|
21
|
+
""" Establish a connection to the database """
|
|
22
|
+
return psycopg2.connect(
|
|
23
|
+
dbname="solcatcher",
|
|
24
|
+
user="partners",
|
|
25
|
+
password="solcatch123!!!456",
|
|
26
|
+
host="192.168.0.100",
|
|
27
|
+
port=5432
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def setup_database(tables, conn):
|
|
31
|
+
""" Create database tables based on provided configurations """
|
|
32
|
+
cur = conn.cursor()
|
|
33
|
+
try:
|
|
34
|
+
for table in tables:
|
|
35
|
+
cur.execute(f"DROP TABLE {table['tableName']}")
|
|
36
|
+
cur.execute(table['table'])
|
|
37
|
+
conn.commit()
|
|
38
|
+
except psycopg2.Error as e:
|
|
39
|
+
print("Error setting up database tables:", e)
|
|
40
|
+
conn.rollback()
|
|
41
|
+
finally:
|
|
42
|
+
cur.close()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Predefined table configurations
|
|
46
|
+
table_configurations = [{'tableName': 'getbalance', 'columnSearch': 'pubkey', 'insertName': 'balance', 'type': 'Balance', 'searchQuery': 'SELECT balance FROM getbalance WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getbalance (pubkey, balance) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getbalance (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,balance JSONB NOT NULL);'}, {'tableName': 'getaccountinfo', 'columnSearch': 'pubkey', 'insertName': 'account_info', 'type': 'AccountInfo', 'searchQuery': 'SELECT account_info FROM getaccountinfo WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getaccountinfo (pubkey, account_info) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getaccountinfo (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,account_info JSONB NOT NULL);'}, {'tableName': 'getaccountinfojsonparsed', 'columnSearch': 'pubkey', 'insertName': 'account_info_json_parsed', 'type': 'AccountInfoMaybeJsonParsed', 'searchQuery': 'SELECT account_info_json_parsed FROM getaccountinfojsonparsed WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getaccountinfojsonparsed (pubkey, account_info_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getaccountinfojsonparsed (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,account_info_json_parsed JSONB NOT NULL);'}, {'tableName': 'getblockcommitment', 'columnSearch': 'slot', 'insertName': 'block_commitment', 'type': 'BlockCommitment', 'searchQuery': 'SELECT block_commitment FROM getblockcommitment WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblockcommitment (slot, block_commitment) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblockcommitment (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block_commitment JSONB NOT NULL);'}, {'tableName': 'getblocktime', 'columnSearch': 'slot', 'insertName': 'block_time', 'type': 'BlockTime', 'searchQuery': 'SELECT block_time FROM getblocktime WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblocktime (slot, block_time) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblocktime (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block_time JSONB NOT NULL);'}, {'tableName': 'getclusternodes', 'columnSearch': None, 'insertName': 'cluster_nodes', 'type': 'ClusterNodes', 'searchQuery': 'SELECT cluster_nodes FROM getclusternodes WHERE None = %s;', 'insertQuery': 'INSERT INTO getclusternodes (None, cluster_nodes) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getclusternodes (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,cluster_nodes JSONB NOT NULL);'}, {'tableName': 'getblock', 'columnSearch': 'slot', 'insertName': 'block', 'type': 'Block', 'searchQuery': 'SELECT block FROM getblock WHERE slot = %s;', 'insertQuery': 'INSERT INTO getblock (slot, block) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblock (id SERIAL PRIMARY KEY,slot VARCHAR(255) UNIQUE NOT NULL,block JSONB NOT NULL);'}, {'tableName': 'getrecentperformancesamples', 'columnSearch': 'limits', 'insertName': 'recent_performance_samples', 'type': 'RecentPerformanceSamples', 'searchQuery': 'SELECT recent_performance_samples FROM getrecentperformancesamples WHERE limits = %s;', 'insertQuery': 'INSERT INTO getrecentperformancesamples (limits, recent_performance_samples) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getrecentperformancesamples (id SERIAL PRIMARY KEY,limits VARCHAR(255) UNIQUE NOT NULL,recent_performance_samples JSONB NOT NULL);'}, {'tableName': 'getblockheight', 'columnSearch': 'commitment', 'insertName': 'block_height', 'type': 'BlockHeight', 'searchQuery': 'SELECT block_height FROM getblockheight WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getblockheight (commitment, block_height) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblockheight (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,block_height JSONB NOT NULL);'}, {'tableName': 'getblocks', 'columnSearch': 'start_slot', 'insertName': 'blocks', 'type': 'Blocks', 'searchQuery': 'SELECT blocks FROM getblocks WHERE start_slot = %s;', 'insertQuery': 'INSERT INTO getblocks (start_slot, blocks) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getblocks (id SERIAL PRIMARY KEY,start_slot VARCHAR(255) UNIQUE NOT NULL,blocks JSONB NOT NULL);'}, {'tableName': 'getsignaturesforaddress', 'columnSearch': 'account', 'insertName': 'signatures_for_address', 'type': 'SignaturesForAddress', 'searchQuery': 'SELECT signatures_for_address FROM getsignaturesforaddress WHERE account = %s;', 'insertQuery': 'INSERT INTO getsignaturesforaddress (account, signatures_for_address) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsignaturesforaddress (id SERIAL PRIMARY KEY,account VARCHAR(255) UNIQUE NOT NULL,signatures_for_address JSONB NOT NULL);'}, {'tableName': 'gettransaction', 'columnSearch': 'signature', 'insertName': 'transaction', 'type': 'Transaction', 'searchQuery': 'SELECT transaction FROM gettransaction WHERE signature = %s;', 'insertQuery': 'INSERT INTO gettransaction (signature, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettransaction (id SERIAL PRIMARY KEY,signature VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'getepochinfo', 'columnSearch': 'commitment', 'insertName': 'epoch_info', 'type': 'EpochInfo', 'searchQuery': 'SELECT epoch_info FROM getepochinfo WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getepochinfo (commitment, epoch_info) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getepochinfo (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,epoch_info JSONB NOT NULL);'}, {'tableName': 'getepochschedule', 'columnSearch': None, 'insertName': 'epoch_schedule', 'type': 'EpochSchedule', 'searchQuery': 'SELECT epoch_schedule FROM getepochschedule WHERE None = %s;', 'insertQuery': 'INSERT INTO getepochschedule (None, epoch_schedule) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getepochschedule (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,epoch_schedule JSONB NOT NULL);'}, {'tableName': 'getfeeformessage', 'columnSearch': 'message', 'insertName': 'fee_for_message', 'type': 'FeeForMessage', 'searchQuery': 'SELECT fee_for_message FROM getfeeformessage WHERE message = %s;', 'insertQuery': 'INSERT INTO getfeeformessage (message, fee_for_message) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getfeeformessage (id SERIAL PRIMARY KEY,message VARCHAR(255) UNIQUE NOT NULL,fee_for_message JSONB NOT NULL);'}, {'tableName': 'getfirstavailableblock', 'columnSearch': None, 'insertName': 'first_available_block', 'type': 'FirstAvailableBlock', 'searchQuery': 'SELECT first_available_block FROM getfirstavailableblock WHERE None = %s;', 'insertQuery': 'INSERT INTO getfirstavailableblock (None, first_available_block) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getfirstavailableblock (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,first_available_block JSONB NOT NULL);'}, {'tableName': 'getgenesishash', 'columnSearch': None, 'insertName': 'genesis_hash', 'type': 'GenesisHash', 'searchQuery': 'SELECT genesis_hash FROM getgenesishash WHERE None = %s;', 'insertQuery': 'INSERT INTO getgenesishash (None, genesis_hash) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getgenesishash (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,genesis_hash JSONB NOT NULL);'}, {'tableName': 'getidentity', 'columnSearch': None, 'insertName': 'identity', 'type': 'Identity', 'searchQuery': 'SELECT identity FROM getidentity WHERE None = %s;', 'insertQuery': 'INSERT INTO getidentity (None, identity) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getidentity (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,identity JSONB NOT NULL);'}, {'tableName': 'getinflationgovernor', 'columnSearch': 'commitment', 'insertName': 'inflation_governor', 'type': 'InflationGovernor', 'searchQuery': 'SELECT inflation_governor FROM getinflationgovernor WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getinflationgovernor (commitment, inflation_governor) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationgovernor (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,inflation_governor JSONB NOT NULL);'}, {'tableName': 'getinflationrate', 'columnSearch': None, 'insertName': 'inflation_rate', 'type': 'InflationRate', 'searchQuery': 'SELECT inflation_rate FROM getinflationrate WHERE None = %s;', 'insertQuery': 'INSERT INTO getinflationrate (None, inflation_rate) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationrate (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,inflation_rate JSONB NOT NULL);'}, {'tableName': 'getinflationreward', 'columnSearch': 'pubkeys', 'insertName': 'inflation_reward', 'type': 'InflationReward', 'searchQuery': 'SELECT inflation_reward FROM getinflationreward WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getinflationreward (pubkeys, inflation_reward) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getinflationreward (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,inflation_reward JSONB NOT NULL);'}, {'tableName': 'getlargestaccounts', 'columnSearch': 'filter_opt', 'insertName': 'largest_accounts', 'type': 'LargestAccounts', 'searchQuery': 'SELECT largest_accounts FROM getlargestaccounts WHERE filter_opt = %s;', 'insertQuery': 'INSERT INTO getlargestaccounts (filter_opt, largest_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getlargestaccounts (id SERIAL PRIMARY KEY,filter_opt VARCHAR(255) UNIQUE NOT NULL,largest_accounts JSONB NOT NULL);'}, {'tableName': 'getleaderschedule', 'columnSearch': 'epoch', 'insertName': 'leader_schedule', 'type': 'LeaderSchedule', 'searchQuery': 'SELECT leader_schedule FROM getleaderschedule WHERE epoch = %s;', 'insertQuery': 'INSERT INTO getleaderschedule (epoch, leader_schedule) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getleaderschedule (id SERIAL PRIMARY KEY,epoch VARCHAR(255) UNIQUE NOT NULL,leader_schedule JSONB NOT NULL);'}, {'tableName': 'getminimumbalanceforrentexemption', 'columnSearch': 'usize', 'insertName': 'minimum_balance_for_rent_exemption', 'type': 'MinimumBalanceForRentExemption', 'searchQuery': 'SELECT minimum_balance_for_rent_exemption FROM getminimumbalanceforrentexemption WHERE usize = %s;', 'insertQuery': 'INSERT INTO getminimumbalanceforrentexemption (usize, minimum_balance_for_rent_exemption) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getminimumbalanceforrentexemption (id SERIAL PRIMARY KEY,usize VARCHAR(255) UNIQUE NOT NULL,minimum_balance_for_rent_exemption JSONB NOT NULL);'}, {'tableName': 'getmultipleaccounts', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts', 'type': 'MultipleAccounts', 'searchQuery': 'SELECT multiple_accounts FROM getmultipleaccounts WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getmultipleaccounts (pubkeys, multiple_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccounts (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,multiple_accounts JSONB NOT NULL);'}, {'tableName': 'getmultipleaccountsjsonparsed', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts_json_parsed', 'type': 'MultipleAccountsMaybeJsonParsed', 'searchQuery': 'SELECT multiple_accounts_json_parsed FROM getmultipleaccountsjsonparsed WHERE pubkeys = %s;', 'insertQuery': 'INSERT INTO getmultipleaccountsjsonparsed (pubkeys, multiple_accounts_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkeys VARCHAR(255) UNIQUE NOT NULL,multiple_accounts_json_parsed JSONB NOT NULL);'}, {'tableName': 'getprogramaccounts', 'columnSearch': 'pubkey', 'insertName': 'program_accounts', 'type': 'ProgramAccounts', 'searchQuery': 'SELECT program_accounts FROM getprogramaccounts WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getprogramaccounts (pubkey, program_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getprogramaccounts (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,program_accounts JSONB NOT NULL);'}, {'tableName': 'getprogramaccountsjsonparsed', 'columnSearch': 'pubkey', 'insertName': 'program_accounts_json_parsed', 'type': 'ProgramAccountsMaybeJsonParsed', 'searchQuery': 'SELECT program_accounts_json_parsed FROM getprogramaccountsjsonparsed WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getprogramaccountsjsonparsed (pubkey, program_accounts_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getprogramaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,program_accounts_json_parsed JSONB NOT NULL);'}, {'tableName': 'getlatestblockhash', 'columnSearch': 'commitment', 'insertName': 'latest_blockhash', 'type': 'LatestBlockhash', 'searchQuery': 'SELECT latest_blockhash FROM getlatestblockhash WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getlatestblockhash (commitment, latest_blockhash) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getlatestblockhash (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,latest_blockhash JSONB NOT NULL);'}, {'tableName': 'getsignaturestatuses', 'columnSearch': 'signatures', 'insertName': 'signature_statuses', 'type': 'SignatureStatuses', 'searchQuery': 'SELECT signature_statuses FROM getsignaturestatuses WHERE signatures = %s;', 'insertQuery': 'INSERT INTO getsignaturestatuses (signatures, signature_statuses) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsignaturestatuses (id SERIAL PRIMARY KEY,signatures VARCHAR(255) UNIQUE NOT NULL,signature_statuses JSONB NOT NULL);'}, {'tableName': 'getslot', 'columnSearch': 'commitment', 'insertName': 'slot', 'type': 'Slot', 'searchQuery': 'SELECT slot FROM getslot WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getslot (commitment, slot) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getslot (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,slot JSONB NOT NULL);'}, {'tableName': 'getslotleader', 'columnSearch': 'commitment', 'insertName': 'slot_leader', 'type': 'SlotLeader', 'searchQuery': 'SELECT slot_leader FROM getslotleader WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getslotleader (commitment, slot_leader) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getslotleader (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,slot_leader JSONB NOT NULL);'}, {'tableName': 'getstakeactivation', 'columnSearch': 'pubkey', 'insertName': 'stake_activation', 'type': 'StakeActivation', 'searchQuery': 'SELECT stake_activation FROM getstakeactivation WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO getstakeactivation (pubkey, stake_activation) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getstakeactivation (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,stake_activation JSONB NOT NULL);'}, {'tableName': 'getsupply', 'columnSearch': 'commitment', 'insertName': 'supply', 'type': 'Supply', 'searchQuery': 'SELECT supply FROM getsupply WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getsupply (commitment, supply) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getsupply (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,supply JSONB NOT NULL);'}, {'tableName': 'gettokenaccountbalance', 'columnSearch': 'pubkey', 'insertName': 'token_account_balance', 'type': 'TokenAccountBalance', 'searchQuery': 'SELECT token_account_balance FROM gettokenaccountbalance WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokenaccountbalance (pubkey, token_account_balance) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountbalance (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_account_balance JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbydelegate', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate', 'type': 'TokenAccountsByDelegate', 'searchQuery': 'SELECT token_accounts_by_delegate FROM gettokenaccountsbydelegate WHERE delegate = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbydelegate (delegate, token_accounts_by_delegate) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegate (id SERIAL PRIMARY KEY,delegate VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_delegate JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbydelegatejsonparsed', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate_json_parsed', 'type': 'TokenAccountsByDelegateJsonParsed', 'searchQuery': 'SELECT token_accounts_by_delegate_json_parsed FROM gettokenaccountsbydelegatejsonparsed WHERE delegate = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbydelegatejsonparsed (delegate, token_accounts_by_delegate_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegatejsonparsed (id SERIAL PRIMARY KEY,delegate VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_delegate_json_parsed JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbyowner', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner', 'type': 'TokenAccountsByOwner', 'searchQuery': 'SELECT token_accounts_by_owner FROM gettokenaccountsbyowner WHERE owner = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbyowner (owner, token_accounts_by_owner) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyowner (id SERIAL PRIMARY KEY,owner VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_owner JSONB NOT NULL);'}, {'tableName': 'gettokenaccountsbyownerjsonparsed', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner_json_parsed', 'type': 'TokenAccountsByOwnerJsonParsed', 'searchQuery': 'SELECT token_accounts_by_owner_json_parsed FROM gettokenaccountsbyownerjsonparsed WHERE owner = %s;', 'insertQuery': 'INSERT INTO gettokenaccountsbyownerjsonparsed (owner, token_accounts_by_owner_json_parsed) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyownerjsonparsed (id SERIAL PRIMARY KEY,owner VARCHAR(255) UNIQUE NOT NULL,token_accounts_by_owner_json_parsed JSONB NOT NULL);'}, {'tableName': 'gettokenlargestaccounts', 'columnSearch': 'pubkey', 'insertName': 'token_largest_accounts', 'type': 'TokenLargestAccounts', 'searchQuery': 'SELECT token_largest_accounts FROM gettokenlargestaccounts WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokenlargestaccounts (pubkey, token_largest_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokenlargestaccounts (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_largest_accounts JSONB NOT NULL);'}, {'tableName': 'gettokensupply', 'columnSearch': 'pubkey', 'insertName': 'token_supply', 'type': 'TokenSupply', 'searchQuery': 'SELECT token_supply FROM gettokensupply WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO gettokensupply (pubkey, token_supply) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettokensupply (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,token_supply JSONB NOT NULL);'}, {'tableName': 'gettransactioncount', 'columnSearch': 'commitment', 'insertName': 'transaction_count', 'type': 'TransactionCount', 'searchQuery': 'SELECT transaction_count FROM gettransactioncount WHERE commitment = %s;', 'insertQuery': 'INSERT INTO gettransactioncount (commitment, transaction_count) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS gettransactioncount (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,transaction_count JSONB NOT NULL);'}, {'tableName': 'getminimumledgerslot', 'columnSearch': None, 'insertName': 'minimum_ledger_slot', 'type': 'MinimumLedgerSlot', 'searchQuery': 'SELECT minimum_ledger_slot FROM getminimumledgerslot WHERE None = %s;', 'insertQuery': 'INSERT INTO getminimumledgerslot (None, minimum_ledger_slot) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getminimumledgerslot (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,minimum_ledger_slot JSONB NOT NULL);'}, {'tableName': 'getversion', 'columnSearch': None, 'insertName': 'version', 'type': 'Version', 'searchQuery': 'SELECT version FROM getversion WHERE None = %s;', 'insertQuery': 'INSERT INTO getversion (None, version) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getversion (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,version JSONB NOT NULL);'}, {'tableName': 'getvoteaccounts', 'columnSearch': 'commitment', 'insertName': 'vote_accounts', 'type': 'VoteAccounts', 'searchQuery': 'SELECT vote_accounts FROM getvoteaccounts WHERE commitment = %s;', 'insertQuery': 'INSERT INTO getvoteaccounts (commitment, vote_accounts) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS getvoteaccounts (id SERIAL PRIMARY KEY,commitment VARCHAR(255) UNIQUE NOT NULL,vote_accounts JSONB NOT NULL);'}, {'tableName': 'requestairdrop', 'columnSearch': 'pubkey', 'insertName': 'airdrop', 'type': 'RequestAirdrop', 'searchQuery': 'SELECT airdrop FROM requestairdrop WHERE pubkey = %s;', 'insertQuery': 'INSERT INTO requestairdrop (pubkey, airdrop) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS requestairdrop (id SERIAL PRIMARY KEY,pubkey VARCHAR(255) UNIQUE NOT NULL,airdrop JSONB NOT NULL);'}, {'tableName': 'sendrawtransaction', 'columnSearch': 'txn', 'insertName': 'raw_transaction', 'type': 'SendTransaction', 'searchQuery': 'SELECT raw_transaction FROM sendrawtransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO sendrawtransaction (txn, raw_transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS sendrawtransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,raw_transaction JSONB NOT NULL);'}, {'tableName': 'sendtransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SendTransaction', 'searchQuery': 'SELECT transaction FROM sendtransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO sendtransaction (txn, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS sendtransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'simulatetransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SimulateTransaction', 'searchQuery': 'SELECT transaction FROM simulatetransaction WHERE txn = %s;', 'insertQuery': 'INSERT INTO simulatetransaction (txn, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS simulatetransaction (id SERIAL PRIMARY KEY,txn VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}, {'tableName': 'validatorexit', 'columnSearch': None, 'insertName': 'exit', 'type': 'ValidatorExit', 'searchQuery': 'SELECT exit FROM validatorexit WHERE None = %s;', 'insertQuery': 'INSERT INTO validatorexit (None, exit) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS validatorexit (id SERIAL PRIMARY KEY,None VARCHAR(255) UNIQUE NOT NULL,exit JSONB NOT NULL);'}, {'tableName': 'postsendwithconfirm', 'columnSearch': 'resp', 'insertName': '_post_send_with_confirm', 'type': 'SendTransaction', 'searchQuery': 'SELECT _post_send_with_confirm FROM postsendwithconfirm WHERE resp = %s;', 'insertQuery': 'INSERT INTO postsendwithconfirm (resp, _post_send_with_confirm) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS postsendwithconfirm (id SERIAL PRIMARY KEY,resp VARCHAR(255) UNIQUE NOT NULL,_post_send_with_confirm JSONB NOT NULL);'}, {'tableName': 'confirmtransaction', 'columnSearch': 'tx_sig', 'insertName': 'transaction', 'type': 'SignatureStatuses', 'searchQuery': 'SELECT transaction FROM confirmtransaction WHERE tx_sig = %s;', 'insertQuery': 'INSERT INTO confirmtransaction (tx_sig, transaction) VALUES (%s, %s)', 'table': 'CREATE TABLE IF NOT EXISTS confirmtransaction (id SERIAL PRIMARY KEY,tx_sig VARCHAR(255) UNIQUE NOT NULL,transaction JSONB NOT NULL);'}]
|
|
47
|
+
# Main setup function
|
|
48
|
+
def main():
|
|
49
|
+
conn = get_db_connection()
|
|
50
|
+
if conn:
|
|
51
|
+
setup_database(table_configurations, conn)
|
|
52
|
+
conn.close()
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
main()
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Predefined table configurations
|
|
2
|
+
def get_insert_list():
|
|
3
|
+
return [{'fresh_call':True,'tableName': 'isconnected', 'columnSearch': None, 'insertName': 'connected', 'type': 'bool',
|
|
4
|
+
'searchQuery': 'SELECT connected FROM isconnected WHERE None = %s;',
|
|
5
|
+
'insertQuery': 'INSERT INTO isconnected (None, connected) VALUES (%s, %s)',
|
|
6
|
+
'table': 'CREATE TABLE IF NOT EXISTS isconnected (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,connected JSONB NOT NULL);'},
|
|
7
|
+
{'fresh_call':True,'tableName': 'getbalance', 'columnSearch': 'pubkey', 'insertName': 'balance', 'type': 'Balance',
|
|
8
|
+
'searchQuery': 'SELECT balance FROM getbalance WHERE pubkey = %s;',
|
|
9
|
+
'insertQuery': 'INSERT INTO getbalance (pubkey, balance) VALUES (%s, %s)',
|
|
10
|
+
'table': 'CREATE TABLE IF NOT EXISTS getbalance (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,balance JSONB NOT NULL);'},
|
|
11
|
+
{'fresh_call':True,'tableName': 'getaccountinfo', 'columnSearch': 'pubkey', 'insertName': 'account_info', 'type': 'AccountInfo',
|
|
12
|
+
'searchQuery': 'SELECT account_info FROM getaccountinfo WHERE pubkey = %s;',
|
|
13
|
+
'insertQuery': 'INSERT INTO getaccountinfo (pubkey, account_info) VALUES (%s, %s)',
|
|
14
|
+
'table': 'CREATE TABLE IF NOT EXISTS getaccountinfo (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,account_info JSONB NOT NULL);'},
|
|
15
|
+
{'fresh_call':True,'tableName': 'getaccountinfojsonparsed', 'columnSearch': 'pubkey', 'insertName': 'account_info_json_parsed', 'type': 'AccountInfoMaybeJsonParsed',
|
|
16
|
+
'searchQuery': 'SELECT account_info_json_parsed FROM getaccountinfojsonparsed WHERE pubkey = %s;',
|
|
17
|
+
'insertQuery': 'INSERT INTO getaccountinfojsonparsed (pubkey, account_info_json_parsed) VALUES (%s, %s)',
|
|
18
|
+
'table': 'CREATE TABLE IF NOT EXISTS getaccountinfojsonparsed (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,account_info_json_parsed JSONB NOT NULL);'},
|
|
19
|
+
{'fresh_call':True,'tableName': 'getblockcommitment', 'columnSearch': 'slot', 'insertName': 'block_commitment', 'type': 'BlockCommitment',
|
|
20
|
+
'searchQuery': 'SELECT block_commitment FROM getblockcommitment WHERE slot = %s;',
|
|
21
|
+
'insertQuery': 'INSERT INTO getblockcommitment (slot, block_commitment) VALUES (%s, %s)',
|
|
22
|
+
'table': 'CREATE TABLE IF NOT EXISTS getblockcommitment (id SERIAL PRIMARY KEY,slot REAL UNIQUE NOT NULL,block_commitment JSONB NOT NULL);'},
|
|
23
|
+
{'fresh_call':True,'tableName': 'getblocktime', 'columnSearch': 'slot', 'insertName': 'block_time', 'type': 'BlockTime',
|
|
24
|
+
'searchQuery': 'SELECT block_time FROM getblocktime WHERE slot = %s;',
|
|
25
|
+
'insertQuery': 'INSERT INTO getblocktime (slot, block_time) VALUES (%s, %s)',
|
|
26
|
+
'table': 'CREATE TABLE IF NOT EXISTS getblocktime (id SERIAL PRIMARY KEY,slot REAL UNIQUE NOT NULL,block_time JSONB NOT NULL);'},
|
|
27
|
+
{'fresh_call':True,'tableName': 'getclusternodes', 'columnSearch': None, 'insertName': 'cluster_nodes', 'type': 'ClusterNodes',
|
|
28
|
+
'searchQuery': 'SELECT cluster_nodes FROM getclusternodes WHERE None = %s;',
|
|
29
|
+
'insertQuery': 'INSERT INTO getclusternodes (None, cluster_nodes) VALUES (%s, %s)',
|
|
30
|
+
'table': 'CREATE TABLE IF NOT EXISTS getclusternodes (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,cluster_nodes JSONB NOT NULL);'},
|
|
31
|
+
{'fresh_call':True,'tableName': 'getblock', 'columnSearch': 'slot', 'insertName': 'block', 'type': 'Block',
|
|
32
|
+
'searchQuery': 'SELECT block FROM getblock WHERE slot = %s;',
|
|
33
|
+
'insertQuery': 'INSERT INTO getblock (slot, block) VALUES (%s, %s)',
|
|
34
|
+
'table': 'CREATE TABLE IF NOT EXISTS getblock (id SERIAL PRIMARY KEY,slot REAL UNIQUE NOT NULL,block JSONB NOT NULL);'},
|
|
35
|
+
{'fresh_call':True,'tableName': 'getrecentperformancesamples', 'columnSearch': 'limit', 'insertName': 'recent_performance_samples', 'type': 'RecentPerformanceSamples',
|
|
36
|
+
'searchQuery': 'SELECT recent_performance_samples FROM getrecentperformancesamples WHERE limit = %s;',
|
|
37
|
+
'insertQuery': 'INSERT INTO getrecentperformancesamples (limit, recent_performance_samples) VALUES (%s, %s)',
|
|
38
|
+
'table': 'CREATE TABLE IF NOT EXISTS getrecentperformancesamples (id SERIAL PRIMARY KEY,limit REAL UNIQUE NOT NULL,recent_performance_samples JSONB NOT NULL);'},
|
|
39
|
+
{'fresh_call':True,'tableName': 'getblockheight', 'columnSearch': 'commitment', 'insertName': 'block_height', 'type': 'BlockHeight',
|
|
40
|
+
'searchQuery': 'SELECT block_height FROM getblockheight WHERE commitment = %s;',
|
|
41
|
+
'insertQuery': 'INSERT INTO getblockheight (commitment, block_height) VALUES (%s, %s)',
|
|
42
|
+
'table': 'CREATE TABLE IF NOT EXISTS getblockheight (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,block_height JSONB NOT NULL);'},
|
|
43
|
+
{'fresh_call':True,'tableName': 'getblocks', 'columnSearch': 'start_slot', 'insertName': 'blocks', 'type': 'Blocks',
|
|
44
|
+
'searchQuery': 'SELECT blocks FROM getblocks WHERE start_slot = %s;',
|
|
45
|
+
'insertQuery': 'INSERT INTO getblocks (start_slot, blocks) VALUES (%s, %s)',
|
|
46
|
+
'table': 'CREATE TABLE IF NOT EXISTS getblocks (id SERIAL PRIMARY KEY,start_slot REAL UNIQUE NOT NULL,blocks JSONB NOT NULL);'},
|
|
47
|
+
{'fresh_call':True,'tableName': 'getsignaturesforaddress', 'columnSearch': 'account', 'insertName': 'signatures_for_address', 'type': 'SignaturesForAddress',
|
|
48
|
+
'searchQuery': 'SELECT signatures_for_address FROM getsignaturesforaddress WHERE account = %s;',
|
|
49
|
+
'insertQuery': 'INSERT INTO getsignaturesforaddress (account, signatures_for_address) VALUES (%s, %s)',
|
|
50
|
+
'table': 'CREATE TABLE IF NOT EXISTS getsignaturesforaddress (id SERIAL PRIMARY KEY,account REAL UNIQUE NOT NULL,signatures_for_address JSONB NOT NULL);'},
|
|
51
|
+
{'fresh_call':False,'tableName': 'gettransaction', 'columnSearch': 'signature', 'insertName': 'transaction', 'type': 'Transaction',
|
|
52
|
+
'searchQuery': 'SELECT transaction FROM gettransaction WHERE signature = %s;',
|
|
53
|
+
'insertQuery': 'INSERT INTO gettransaction (signature, transaction) VALUES (%s, %s)',
|
|
54
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettransaction (id SERIAL PRIMARY KEY,signature REAL UNIQUE NOT NULL,transaction JSONB NOT NULL);'},
|
|
55
|
+
{'fresh_call':True,'tableName': 'getepochinfo', 'columnSearch': 'commitment', 'insertName': 'epoch_info', 'type': 'EpochInfo',
|
|
56
|
+
'searchQuery': 'SELECT epoch_info FROM getepochinfo WHERE commitment = %s;',
|
|
57
|
+
'insertQuery': 'INSERT INTO getepochinfo (commitment, epoch_info) VALUES (%s, %s)',
|
|
58
|
+
'table': 'CREATE TABLE IF NOT EXISTS getepochinfo (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,epoch_info JSONB NOT NULL);'},
|
|
59
|
+
{'fresh_call':True,'tableName': 'getepochschedule', 'columnSearch': None, 'insertName': 'epoch_schedule', 'type': 'EpochSchedule',
|
|
60
|
+
'searchQuery': 'SELECT epoch_schedule FROM getepochschedule WHERE None = %s;',
|
|
61
|
+
'insertQuery': 'INSERT INTO getepochschedule (None, epoch_schedule) VALUES (%s, %s)',
|
|
62
|
+
'table': 'CREATE TABLE IF NOT EXISTS getepochschedule (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,epoch_schedule JSONB NOT NULL);'},
|
|
63
|
+
{'fresh_call':True,'tableName': 'getfeeformessage', 'columnSearch': 'message', 'insertName': 'fee_for_message', 'type': 'FeeForMessage',
|
|
64
|
+
'searchQuery': 'SELECT fee_for_message FROM getfeeformessage WHERE message = %s;',
|
|
65
|
+
'insertQuery': 'INSERT INTO getfeeformessage (message, fee_for_message) VALUES (%s, %s)',
|
|
66
|
+
'table': 'CREATE TABLE IF NOT EXISTS getfeeformessage (id SERIAL PRIMARY KEY,message REAL UNIQUE NOT NULL,fee_for_message JSONB NOT NULL);'},
|
|
67
|
+
{'fresh_call':True,'tableName': 'getfirstavailableblock', 'columnSearch': None, 'insertName': 'first_available_block', 'type': 'FirstAvailableBlock',
|
|
68
|
+
'searchQuery': 'SELECT first_available_block FROM getfirstavailableblock WHERE None = %s;',
|
|
69
|
+
'insertQuery': 'INSERT INTO getfirstavailableblock (None, first_available_block) VALUES (%s, %s)',
|
|
70
|
+
'table': 'CREATE TABLE IF NOT EXISTS getfirstavailableblock (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,first_available_block JSONB NOT NULL);'},
|
|
71
|
+
{'fresh_call':True,'tableName': 'getgenesishash', 'columnSearch': None, 'insertName': 'genesis_hash', 'type': 'GenesisHash',
|
|
72
|
+
'searchQuery': 'SELECT genesis_hash FROM getgenesishash WHERE None = %s;',
|
|
73
|
+
'insertQuery': 'INSERT INTO getgenesishash (None, genesis_hash) VALUES (%s, %s)',
|
|
74
|
+
'table': 'CREATE TABLE IF NOT EXISTS getgenesishash (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,genesis_hash JSONB NOT NULL);'},
|
|
75
|
+
{'fresh_call':True,'tableName': 'getidentity', 'columnSearch': None, 'insertName': 'identity', 'type': 'Identity',
|
|
76
|
+
'searchQuery': 'SELECT identity FROM getidentity WHERE None = %s;',
|
|
77
|
+
'insertQuery': 'INSERT INTO getidentity (None, identity) VALUES (%s, %s)',
|
|
78
|
+
'table': 'CREATE TABLE IF NOT EXISTS getidentity (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,identity JSONB NOT NULL);'},
|
|
79
|
+
{'fresh_call':True,'tableName': 'getinflationgovernor', 'columnSearch': 'commitment', 'insertName': 'inflation_governor', 'type': 'InflationGovernor',
|
|
80
|
+
'searchQuery': 'SELECT inflation_governor FROM getinflationgovernor WHERE commitment = %s;',
|
|
81
|
+
'insertQuery': 'INSERT INTO getinflationgovernor (commitment, inflation_governor) VALUES (%s, %s)',
|
|
82
|
+
'table': 'CREATE TABLE IF NOT EXISTS getinflationgovernor (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,inflation_governor JSONB NOT NULL);'},
|
|
83
|
+
{'fresh_call':True,'tableName': 'getinflationrate', 'columnSearch': None, 'insertName': 'inflation_rate', 'type': 'InflationRate',
|
|
84
|
+
'searchQuery': 'SELECT inflation_rate FROM getinflationrate WHERE None = %s;',
|
|
85
|
+
'insertQuery': 'INSERT INTO getinflationrate (None, inflation_rate) VALUES (%s, %s)',
|
|
86
|
+
'table': 'CREATE TABLE IF NOT EXISTS getinflationrate (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,inflation_rate JSONB NOT NULL);'},
|
|
87
|
+
{'fresh_call':True,'tableName': 'getinflationreward', 'columnSearch': 'pubkeys', 'insertName': 'inflation_reward', 'type': 'InflationReward',
|
|
88
|
+
'searchQuery': 'SELECT inflation_reward FROM getinflationreward WHERE pubkeys = %s;',
|
|
89
|
+
'insertQuery': 'INSERT INTO getinflationreward (pubkeys, inflation_reward) VALUES (%s, %s)',
|
|
90
|
+
'table': 'CREATE TABLE IF NOT EXISTS getinflationreward (id SERIAL PRIMARY KEY,pubkeys REAL UNIQUE NOT NULL,inflation_reward JSONB NOT NULL);'},
|
|
91
|
+
{'fresh_call':True,'tableName': 'getlargestaccounts', 'columnSearch': 'filter_opt', 'insertName': 'largest_accounts', 'type': 'LargestAccounts',
|
|
92
|
+
'searchQuery': 'SELECT largest_accounts FROM getlargestaccounts WHERE filter_opt = %s;',
|
|
93
|
+
'insertQuery': 'INSERT INTO getlargestaccounts (filter_opt, largest_accounts) VALUES (%s, %s)',
|
|
94
|
+
'table': 'CREATE TABLE IF NOT EXISTS getlargestaccounts (id SERIAL PRIMARY KEY,filter_opt REAL UNIQUE NOT NULL,largest_accounts JSONB NOT NULL);'},
|
|
95
|
+
{'fresh_call':True,'tableName': 'getleaderschedule', 'columnSearch': 'epoch', 'insertName': 'leader_schedule', 'type': 'LeaderSchedule',
|
|
96
|
+
'searchQuery': 'SELECT leader_schedule FROM getleaderschedule WHERE epoch = %s;',
|
|
97
|
+
'insertQuery': 'INSERT INTO getleaderschedule (epoch, leader_schedule) VALUES (%s, %s)',
|
|
98
|
+
'table': 'CREATE TABLE IF NOT EXISTS getleaderschedule (id SERIAL PRIMARY KEY,epoch REAL UNIQUE NOT NULL,leader_schedule JSONB NOT NULL);'},
|
|
99
|
+
{'fresh_call':True,'tableName': 'getminimumbalanceforrentexemption', 'columnSearch': 'usize', 'insertName': 'minimum_balance_for_rent_exemption', 'type': 'MinimumBalanceForRentExemption',
|
|
100
|
+
'searchQuery': 'SELECT minimum_balance_for_rent_exemption FROM getminimumbalanceforrentexemption WHERE usize = %s;',
|
|
101
|
+
'insertQuery': 'INSERT INTO getminimumbalanceforrentexemption (usize, minimum_balance_for_rent_exemption) VALUES (%s, %s)',
|
|
102
|
+
'table': 'CREATE TABLE IF NOT EXISTS getminimumbalanceforrentexemption (id SERIAL PRIMARY KEY,usize REAL UNIQUE NOT NULL,minimum_balance_for_rent_exemption JSONB NOT NULL);'},
|
|
103
|
+
{'fresh_call':True,'tableName': 'getmultipleaccounts', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts', 'type': 'MultipleAccounts',
|
|
104
|
+
'searchQuery': 'SELECT multiple_accounts FROM getmultipleaccounts WHERE pubkeys = %s;',
|
|
105
|
+
'insertQuery': 'INSERT INTO getmultipleaccounts (pubkeys, multiple_accounts) VALUES (%s, %s)',
|
|
106
|
+
'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccounts (id SERIAL PRIMARY KEY,pubkeys REAL UNIQUE NOT NULL,multiple_accounts JSONB NOT NULL);'},
|
|
107
|
+
{'fresh_call':True,'tableName': 'getmultipleaccountsjsonparsed', 'columnSearch': 'pubkeys', 'insertName': 'multiple_accounts_json_parsed', 'type': 'MultipleAccountsMaybeJsonParsed',
|
|
108
|
+
'searchQuery': 'SELECT multiple_accounts_json_parsed FROM getmultipleaccountsjsonparsed WHERE pubkeys = %s;',
|
|
109
|
+
'insertQuery': 'INSERT INTO getmultipleaccountsjsonparsed (pubkeys, multiple_accounts_json_parsed) VALUES (%s, %s)',
|
|
110
|
+
'table': 'CREATE TABLE IF NOT EXISTS getmultipleaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkeys REAL UNIQUE NOT NULL,multiple_accounts_json_parsed JSONB NOT NULL);'},
|
|
111
|
+
{'fresh_call':True,'tableName': 'getprogramaccounts', 'columnSearch': 'pubkey', 'insertName': 'program_accounts', 'type': 'ProgramAccounts',
|
|
112
|
+
'searchQuery': 'SELECT program_accounts FROM getprogramaccounts WHERE pubkey = %s;',
|
|
113
|
+
'insertQuery': 'INSERT INTO getprogramaccounts (pubkey, program_accounts) VALUES (%s, %s)',
|
|
114
|
+
'table': 'CREATE TABLE IF NOT EXISTS getprogramaccounts (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,program_accounts JSONB NOT NULL);'},
|
|
115
|
+
{'fresh_call':True,'tableName': 'getprogramaccountsjsonparsed', 'columnSearch': 'pubkey', 'insertName': 'program_accounts_json_parsed', 'type': 'ProgramAccountsMaybeJsonParsed',
|
|
116
|
+
'searchQuery': 'SELECT program_accounts_json_parsed FROM getprogramaccountsjsonparsed WHERE pubkey = %s;',
|
|
117
|
+
'insertQuery': 'INSERT INTO getprogramaccountsjsonparsed (pubkey, program_accounts_json_parsed) VALUES (%s, %s)',
|
|
118
|
+
'table': 'CREATE TABLE IF NOT EXISTS getprogramaccountsjsonparsed (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,program_accounts_json_parsed JSONB NOT NULL);'},
|
|
119
|
+
{'fresh_call':True,'tableName': 'getlatestblockhash', 'columnSearch': 'commitment', 'insertName': 'latest_blockhash', 'type': 'LatestBlockhash',
|
|
120
|
+
'searchQuery': 'SELECT latest_blockhash FROM getlatestblockhash WHERE commitment = %s;',
|
|
121
|
+
'insertQuery': 'INSERT INTO getlatestblockhash (commitment, latest_blockhash) VALUES (%s, %s)',
|
|
122
|
+
'table': 'CREATE TABLE IF NOT EXISTS getlatestblockhash (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,latest_blockhash JSONB NOT NULL);'},
|
|
123
|
+
{'fresh_call':True,'tableName': 'getsignaturestatuses', 'columnSearch': 'signatures', 'insertName': 'signature_statuses', 'type': 'SignatureStatuses',
|
|
124
|
+
'searchQuery': 'SELECT signature_statuses FROM getsignaturestatuses WHERE signatures = %s;',
|
|
125
|
+
'insertQuery': 'INSERT INTO getsignaturestatuses (signatures, signature_statuses) VALUES (%s, %s)',
|
|
126
|
+
'table': 'CREATE TABLE IF NOT EXISTS getsignaturestatuses (id SERIAL PRIMARY KEY,signatures REAL UNIQUE NOT NULL,signature_statuses JSONB NOT NULL);'},
|
|
127
|
+
{'fresh_call':True,'tableName': 'getslot', 'columnSearch': 'commitment', 'insertName': 'slot', 'type': 'Slot',
|
|
128
|
+
'searchQuery': 'SELECT slot FROM getslot WHERE commitment = %s;',
|
|
129
|
+
'insertQuery': 'INSERT INTO getslot (commitment, slot) VALUES (%s, %s)',
|
|
130
|
+
'table': 'CREATE TABLE IF NOT EXISTS getslot (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,slot JSONB NOT NULL);'},
|
|
131
|
+
{'fresh_call':True,'tableName': 'getslotleader', 'columnSearch': 'commitment', 'insertName': 'slot_leader', 'type': 'SlotLeader',
|
|
132
|
+
'searchQuery': 'SELECT slot_leader FROM getslotleader WHERE commitment = %s;',
|
|
133
|
+
'insertQuery': 'INSERT INTO getslotleader (commitment, slot_leader) VALUES (%s, %s)',
|
|
134
|
+
'table': 'CREATE TABLE IF NOT EXISTS getslotleader (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,slot_leader JSONB NOT NULL);'},
|
|
135
|
+
{'fresh_call':True,'tableName': 'getstakeactivation', 'columnSearch': 'pubkey', 'insertName': 'stake_activation', 'type': 'StakeActivation',
|
|
136
|
+
'searchQuery': 'SELECT stake_activation FROM getstakeactivation WHERE pubkey = %s;',
|
|
137
|
+
'insertQuery': 'INSERT INTO getstakeactivation (pubkey, stake_activation) VALUES (%s, %s)',
|
|
138
|
+
'table': 'CREATE TABLE IF NOT EXISTS getstakeactivation (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,stake_activation JSONB NOT NULL);'},
|
|
139
|
+
{'fresh_call':True,'tableName': 'getsupply', 'columnSearch': 'commitment', 'insertName': 'supply', 'type': 'Supply',
|
|
140
|
+
'searchQuery': 'SELECT supply FROM getsupply WHERE commitment = %s;',
|
|
141
|
+
'insertQuery': 'INSERT INTO getsupply (commitment, supply) VALUES (%s, %s)',
|
|
142
|
+
'table': 'CREATE TABLE IF NOT EXISTS getsupply (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,supply JSONB NOT NULL);'},
|
|
143
|
+
{'fresh_call':True,'tableName': 'gettokenaccountbalance', 'columnSearch': 'pubkey', 'insertName': 'token_account_balance', 'type': 'TokenAccountBalance',
|
|
144
|
+
'searchQuery': 'SELECT token_account_balance FROM gettokenaccountbalance WHERE pubkey = %s;',
|
|
145
|
+
'insertQuery': 'INSERT INTO gettokenaccountbalance (pubkey, token_account_balance) VALUES (%s, %s)',
|
|
146
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountbalance (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,token_account_balance JSONB NOT NULL);'},
|
|
147
|
+
{'fresh_call':True,'tableName': 'gettokenaccountsbydelegate', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate', 'type': 'TokenAccountsByDelegate',
|
|
148
|
+
'searchQuery': 'SELECT token_accounts_by_delegate FROM gettokenaccountsbydelegate WHERE delegate = %s;',
|
|
149
|
+
'insertQuery': 'INSERT INTO gettokenaccountsbydelegate (delegate, token_accounts_by_delegate) VALUES (%s, %s)',
|
|
150
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegate (id SERIAL PRIMARY KEY,delegate REAL UNIQUE NOT NULL,token_accounts_by_delegate JSONB NOT NULL);'},
|
|
151
|
+
{'fresh_call':True,'tableName': 'gettokenaccountsbydelegatejsonparsed', 'columnSearch': 'delegate', 'insertName': 'token_accounts_by_delegate_json_parsed', 'type': 'TokenAccountsByDelegateJsonParsed',
|
|
152
|
+
'searchQuery': 'SELECT token_accounts_by_delegate_json_parsed FROM gettokenaccountsbydelegatejsonparsed WHERE delegate = %s;',
|
|
153
|
+
'insertQuery': 'INSERT INTO gettokenaccountsbydelegatejsonparsed (delegate, token_accounts_by_delegate_json_parsed) VALUES (%s, %s)',
|
|
154
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbydelegatejsonparsed (id SERIAL PRIMARY KEY,delegate REAL UNIQUE NOT NULL,token_accounts_by_delegate_json_parsed JSONB NOT NULL);'},
|
|
155
|
+
{'fresh_call':True,'tableName': 'gettokenaccountsbyowner', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner', 'type': 'TokenAccountsByOwner',
|
|
156
|
+
'searchQuery': 'SELECT token_accounts_by_owner FROM gettokenaccountsbyowner WHERE owner = %s;',
|
|
157
|
+
'insertQuery': 'INSERT INTO gettokenaccountsbyowner (owner, token_accounts_by_owner) VALUES (%s, %s)',
|
|
158
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyowner (id SERIAL PRIMARY KEY,owner REAL UNIQUE NOT NULL,token_accounts_by_owner JSONB NOT NULL);'},
|
|
159
|
+
{'fresh_call':True,'tableName': 'gettokenaccountsbyownerjsonparsed', 'columnSearch': 'owner', 'insertName': 'token_accounts_by_owner_json_parsed', 'type': 'TokenAccountsByOwnerJsonParsed',
|
|
160
|
+
'searchQuery': 'SELECT token_accounts_by_owner_json_parsed FROM gettokenaccountsbyownerjsonparsed WHERE owner = %s;',
|
|
161
|
+
'insertQuery': 'INSERT INTO gettokenaccountsbyownerjsonparsed (owner, token_accounts_by_owner_json_parsed) VALUES (%s, %s)',
|
|
162
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenaccountsbyownerjsonparsed (id SERIAL PRIMARY KEY,owner REAL UNIQUE NOT NULL,token_accounts_by_owner_json_parsed JSONB NOT NULL);'},
|
|
163
|
+
{'fresh_call':True,'tableName': 'gettokenlargestaccounts', 'columnSearch': 'pubkey', 'insertName': 'token_largest_accounts', 'type': 'TokenLargestAccounts',
|
|
164
|
+
'searchQuery': 'SELECT token_largest_accounts FROM gettokenlargestaccounts WHERE pubkey = %s;',
|
|
165
|
+
'insertQuery': 'INSERT INTO gettokenlargestaccounts (pubkey, token_largest_accounts) VALUES (%s, %s)',
|
|
166
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokenlargestaccounts (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,token_largest_accounts JSONB NOT NULL);'},
|
|
167
|
+
{'fresh_call':True,'tableName': 'gettokensupply', 'columnSearch': 'pubkey', 'insertName': 'token_supply', 'type': 'TokenSupply',
|
|
168
|
+
'searchQuery': 'SELECT token_supply FROM gettokensupply WHERE pubkey = %s;',
|
|
169
|
+
'insertQuery': 'INSERT INTO gettokensupply (pubkey, token_supply) VALUES (%s, %s)',
|
|
170
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettokensupply (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,token_supply JSONB NOT NULL);'},
|
|
171
|
+
{'fresh_call':True,'tableName': 'gettransactioncount', 'columnSearch': 'commitment', 'insertName': 'transaction_count', 'type': 'TransactionCount',
|
|
172
|
+
'searchQuery': 'SELECT transaction_count FROM gettransactioncount WHERE commitment = %s;',
|
|
173
|
+
'insertQuery': 'INSERT INTO gettransactioncount (commitment, transaction_count) VALUES (%s, %s)',
|
|
174
|
+
'table': 'CREATE TABLE IF NOT EXISTS gettransactioncount (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,transaction_count JSONB NOT NULL);'},
|
|
175
|
+
{'fresh_call':True,'tableName': 'getminimumledgerslot', 'columnSearch': None, 'insertName': 'minimum_ledger_slot', 'type': 'MinimumLedgerSlot',
|
|
176
|
+
'searchQuery': 'SELECT minimum_ledger_slot FROM getminimumledgerslot WHERE None = %s;',
|
|
177
|
+
'insertQuery': 'INSERT INTO getminimumledgerslot (None, minimum_ledger_slot) VALUES (%s, %s)',
|
|
178
|
+
'table': 'CREATE TABLE IF NOT EXISTS getminimumledgerslot (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,minimum_ledger_slot JSONB NOT NULL);'},
|
|
179
|
+
{'fresh_call':True,'tableName': 'getversion', 'columnSearch': None, 'insertName': 'version', 'type': 'Version',
|
|
180
|
+
'searchQuery': 'SELECT version FROM getversion WHERE None = %s;',
|
|
181
|
+
'insertQuery': 'INSERT INTO getversion (None, version) VALUES (%s, %s)',
|
|
182
|
+
'table': 'CREATE TABLE IF NOT EXISTS getversion (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,version JSONB NOT NULL);'},
|
|
183
|
+
{'fresh_call':True,'tableName': 'getvoteaccounts', 'columnSearch': 'commitment', 'insertName': 'vote_accounts', 'type': 'VoteAccounts',
|
|
184
|
+
'searchQuery': 'SELECT vote_accounts FROM getvoteaccounts WHERE commitment = %s;',
|
|
185
|
+
'insertQuery': 'INSERT INTO getvoteaccounts (commitment, vote_accounts) VALUES (%s, %s)',
|
|
186
|
+
'table': 'CREATE TABLE IF NOT EXISTS getvoteaccounts (id SERIAL PRIMARY KEY,commitment REAL UNIQUE NOT NULL,vote_accounts JSONB NOT NULL);'},
|
|
187
|
+
{'fresh_call':True,'tableName': 'requestairdrop', 'columnSearch': 'pubkey', 'insertName': 'airdrop', 'type': 'RequestAirdrop',
|
|
188
|
+
'searchQuery': 'SELECT airdrop FROM requestairdrop WHERE pubkey = %s;',
|
|
189
|
+
'insertQuery': 'INSERT INTO requestairdrop (pubkey, airdrop) VALUES (%s, %s)',
|
|
190
|
+
'table': 'CREATE TABLE IF NOT EXISTS requestairdrop (id SERIAL PRIMARY KEY,pubkey REAL UNIQUE NOT NULL,airdrop JSONB NOT NULL);'},
|
|
191
|
+
{'fresh_call':True,'tableName': 'sendrawtransaction', 'columnSearch': 'txn', 'insertName': 'raw_transaction', 'type': 'SendTransaction',
|
|
192
|
+
'searchQuery': 'SELECT raw_transaction FROM sendrawtransaction WHERE txn = %s;',
|
|
193
|
+
'insertQuery': 'INSERT INTO sendrawtransaction (txn, raw_transaction) VALUES (%s, %s)',
|
|
194
|
+
'table': 'CREATE TABLE IF NOT EXISTS sendrawtransaction (id SERIAL PRIMARY KEY,txn REAL UNIQUE NOT NULL,raw_transaction JSONB NOT NULL);'},
|
|
195
|
+
{'fresh_call':True,'tableName': 'sendtransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SendTransaction',
|
|
196
|
+
'searchQuery': 'SELECT transaction FROM sendtransaction WHERE txn = %s;',
|
|
197
|
+
'insertQuery': 'INSERT INTO sendtransaction (txn, transaction) VALUES (%s, %s)',
|
|
198
|
+
'table': 'CREATE TABLE IF NOT EXISTS sendtransaction (id SERIAL PRIMARY KEY,txn REAL UNIQUE NOT NULL,transaction JSONB NOT NULL);'},
|
|
199
|
+
{'fresh_call':True,'tableName': 'simulatetransaction', 'columnSearch': 'txn', 'insertName': 'transaction', 'type': 'SimulateTransaction',
|
|
200
|
+
'searchQuery': 'SELECT transaction FROM simulatetransaction WHERE txn = %s;',
|
|
201
|
+
'insertQuery': 'INSERT INTO simulatetransaction (txn, transaction) VALUES (%s, %s)',
|
|
202
|
+
'table': 'CREATE TABLE IF NOT EXISTS simulatetransaction (id SERIAL PRIMARY KEY,txn REAL UNIQUE NOT NULL,transaction JSONB NOT NULL);'},
|
|
203
|
+
{'fresh_call':True,'tableName': 'validatorexit', 'columnSearch': None, 'insertName': 'exit', 'type': 'ValidatorExit',
|
|
204
|
+
'searchQuery': 'SELECT exit FROM validatorexit WHERE None = %s;',
|
|
205
|
+
'insertQuery': 'INSERT INTO validatorexit (None, exit) VALUES (%s, %s)',
|
|
206
|
+
'table': 'CREATE TABLE IF NOT EXISTS validatorexit (id SERIAL PRIMARY KEY,None REAL UNIQUE NOT NULL,exit JSONB NOT NULL);'},
|
|
207
|
+
{'fresh_call':True,'tableName': 'postsendwithconfirm', 'columnSearch': 'resp', 'insertName': '_post_send_with_confirm', 'type': 'SendTransaction',
|
|
208
|
+
'searchQuery': 'SELECT _post_send_with_confirm FROM postsendwithconfirm WHERE resp = %s;',
|
|
209
|
+
'insertQuery': 'INSERT INTO postsendwithconfirm (resp, _post_send_with_confirm) VALUES (%s, %s)',
|
|
210
|
+
'table': 'CREATE TABLE IF NOT EXISTS postsendwithconfirm (id SERIAL PRIMARY KEY,resp REAL UNIQUE NOT NULL,_post_send_with_confirm JSONB NOT NULL);'},
|
|
211
|
+
{'fresh_call':True,'tableName': 'confirmtransaction', 'columnSearch': 'tx_sig', 'insertName': 'transaction', 'type': 'SignatureStatuses',
|
|
212
|
+
'searchQuery': 'SELECT transaction FROM confirmtransaction WHERE tx_sig = %s;',
|
|
213
|
+
'insertQuery': 'INSERT INTO confirmtransaction (tx_sig, transaction) VALUES (%s, %s)',
|
|
214
|
+
'table': 'CREATE TABLE IF NOT EXISTS confirmtransaction (id SERIAL PRIMARY KEY,tx_sig REAL UNIQUE NOT NULL,transaction JSONB NOT NULL);'}
|
|
215
|
+
]
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/SOURCES.txt
RENAMED
|
@@ -7,6 +7,7 @@ src/abstract_solana.egg-info/dependency_links.txt
|
|
|
7
7
|
src/abstract_solana.egg-info/requires.txt
|
|
8
8
|
src/abstract_solana.egg-info/top_level.txt
|
|
9
9
|
src/abstract_solana/abstract_rpcs/__init__.py
|
|
10
|
+
src/abstract_solana/abstract_rpcs/db_templates.py
|
|
10
11
|
src/abstract_solana/abstract_rpcs/get_body.py
|
|
11
12
|
src/abstract_solana/abstract_utils/__init__.py
|
|
12
13
|
src/abstract_solana/abstract_utils/account_key_utils.py
|
|
@@ -18,8 +19,4 @@ src/abstract_solana/abstract_utils/log_message_functions.py
|
|
|
18
19
|
src/abstract_solana/abstract_utils/price_utils.py
|
|
19
20
|
src/abstract_solana/abstract_utils/pubkey_utils.py
|
|
20
21
|
src/abstract_solana/abstract_utils/signature_data_parse.py
|
|
21
|
-
src/abstract_solana/abstract_utils/utils.py
|
|
22
|
-
src/abstract_solana/pump_functions/__init__.py
|
|
23
|
-
src/abstract_solana/pump_functions/buy_sell_pump.py
|
|
24
|
-
src/abstract_solana/pump_functions/pump_fun_keys.py
|
|
25
|
-
src/abstract_solana/pump_functions/token_utils.py
|
|
22
|
+
src/abstract_solana/abstract_utils/utils.py
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import struct,base58,time,requests,asyncio,time
|
|
2
|
-
from typing import Optional,Union
|
|
3
|
-
from solders.hash import Hash
|
|
4
|
-
from solders.keypair import Keypair
|
|
5
|
-
from solders.instruction import Instruction
|
|
6
|
-
from solana.rpc.types import TokenAccountOpts,TxOpts
|
|
7
|
-
from solana.transaction import Transaction
|
|
8
|
-
from abstract_solcatcher import getLatestBlockHash,sendTransaction,getTransaction
|
|
9
|
-
from abstract_utilities import get_any_value
|
|
10
|
-
from ..abstract_utils.pubkey_utils import Pubkey,get_pubkey
|
|
11
|
-
from spl.token.instructions import CloseAccountParams,close_account
|
|
12
|
-
from ..abstract_utils.constants import TOKEN_PROGRAM_ID_PUBKEY,LAMPORTS_PER_SOL,UNIT_PRICE,UNIT_BUDGET
|
|
13
|
-
from solders.compute_budget import set_compute_unit_limit, set_compute_unit_price
|
|
14
|
-
from .token_utils import get_token_balance,check_existing_token_account,get_token_price
|
|
15
|
-
from .pump_fun_keys import getKeys
|
|
16
|
-
def buildTxn(mint,payer_pubkey, amount, slippage, token_account,sol_in=0,token_price=0,token_balance=0,token_account_instructions=None,close_token_account=False,buy=True):
|
|
17
|
-
# Get keys for the transaction, pass the token account's pubkey instead of the AccountMeta object
|
|
18
|
-
keys = getKeys(mint, token_account=token_account, payer_pubkey=payer_pubkey,buy=buy)
|
|
19
|
-
slippage_adjustment = 1 - (slippage / 100)
|
|
20
|
-
sol_change = sol_in if buy else float(token_balance) * float(token_price)
|
|
21
|
-
sol_change_with_slippage = sol_change * slippage_adjustment
|
|
22
|
-
limit_sol_change = int(sol_change_with_slippage * LAMPORTS_PER_SOL)
|
|
23
|
-
print(f"Max Sol {'Cost' if buy else 'Output'}:", sol_change_with_slippage)
|
|
24
|
-
hex_data = bytes.fromhex("66063d1201daebea" if buy else "33e685a4017f83ad")
|
|
25
|
-
data = bytearray()
|
|
26
|
-
data.extend(hex_data)
|
|
27
|
-
data.extend(struct.pack('<Q', amount))
|
|
28
|
-
data.extend(struct.pack('<Q', limit_sol_change))
|
|
29
|
-
swap_instruction = Instruction(PUMP_FUN_PROGRAM_PUBKEY, bytes(data), keys)
|
|
30
|
-
blockHash = getLatestBlockHash(commitment="processed")
|
|
31
|
-
recent_blockhash = get_any_value(blockHash,'blockhash')
|
|
32
|
-
recent_blockhash = Hash.from_string(recent_blockhash)
|
|
33
|
-
txn = Transaction(recent_blockhash=recent_blockhash, fee_payer=payer_pubkey)
|
|
34
|
-
txn.add(set_compute_unit_price(UNIT_PRICE))
|
|
35
|
-
txn.add(set_compute_unit_limit(UNIT_BUDGET))
|
|
36
|
-
if buy and token_account_instructions:
|
|
37
|
-
txn.add(token_account_instructions)
|
|
38
|
-
txn.add(swap_instruction)
|
|
39
|
-
if buy == False and close_token_account:
|
|
40
|
-
close_account_instructions = close_account(CloseAccountParams(PUMP_FUN_PROGRAM_PUBKEY, token_account_pubkey, payer_pubkey, payer_pubkey))
|
|
41
|
-
txn.add(close_account_instructions)
|
|
42
|
-
return txn
|
|
43
|
-
|
|
44
|
-
def get_all_buy_sell_info(mint,payer_pubkey,token_balance=None,sol_in=0,buy=True):
|
|
45
|
-
|
|
46
|
-
print("Owner Public Key:", payer_pubkey)
|
|
47
|
-
mint_str = str(mint)
|
|
48
|
-
if not get_pubkey(mint_str).is_on_curve():
|
|
49
|
-
print('Mint public key is not on curve')
|
|
50
|
-
return False,amount,token_balance,token_price,token_account,token_account_instructions
|
|
51
|
-
mint_pubkey = get_pubkey(mint_str)
|
|
52
|
-
token_account, token_account_instructions = check_existing_token_account(payer_pubkey, mint_pubkey)
|
|
53
|
-
token_account_pubkey = get_pubkey(token_account)
|
|
54
|
-
# Ensure the token_account is a valid Pubkey
|
|
55
|
-
if not isinstance(token_account_pubkey, Pubkey):
|
|
56
|
-
print("Failed to create or retrieve a valid token account Pubkey...")
|
|
57
|
-
return False,amount,token_balance,token_price,token_account,token_account_instructions
|
|
58
|
-
print("Token Account:", token_account)
|
|
59
|
-
if not token_account:
|
|
60
|
-
print("Failed to retrieve or create token account.")
|
|
61
|
-
return False,amount,token_balance,token_price,token_account,token_account_instructions
|
|
62
|
-
# Calculate token price
|
|
63
|
-
token_price = get_token_price(mint_str)
|
|
64
|
-
print(f"Token Price: {token_price:.20f} SOL")
|
|
65
|
-
amount = int(LAMPORTS_PER_SOL * token_price)
|
|
66
|
-
print("Calculated Amount:", amount)
|
|
67
|
-
if buy == False:
|
|
68
|
-
if token_balance == None:
|
|
69
|
-
token_balance = get_token_balance(token_account,mint_str)
|
|
70
|
-
print("Token Balance:", token_balance)
|
|
71
|
-
if token_balance == 0:
|
|
72
|
-
return False,amount,token_balance,token_price,token_account,token_account_instructions
|
|
73
|
-
return mint,amount,token_balance,token_price,token_account_pubkey,token_account_instructions
|
|
74
|
-
|
|
75
|
-
def pump_fun_sell(mint: str,payer_pubkey:Pubkey, token_balance: Optional[Union[int, float]] = None, slippage: int = 25, close_token_account: bool = True) -> bool:
|
|
76
|
-
mint,amount,token_balance,token_price,token_account,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,token_balance=token_balance,buy=False)
|
|
77
|
-
if not mint:
|
|
78
|
-
return mint
|
|
79
|
-
return buildTxn(mint=mint,
|
|
80
|
-
payer_pubkey=payer_pubkey,
|
|
81
|
-
amount=amount,
|
|
82
|
-
slippage=slippage,
|
|
83
|
-
sol_in=0,
|
|
84
|
-
token_balance=token_balance,
|
|
85
|
-
token_price=token_price,
|
|
86
|
-
token_account=token_account,
|
|
87
|
-
token_account_instructions=token_account_instructions,
|
|
88
|
-
buy=False)
|
|
89
|
-
|
|
90
|
-
def pump_fun_buy(mint: str,payer_pubkey:Pubkey, sol_in: float = 0.001, slippage: int = 25) -> bool:
|
|
91
|
-
mint,amount,token_balance,token_price,token_account,token_account_instructions = get_all_buy_sell_info(mint,payer_pubkey,sol_in=sol_in,buy=True)
|
|
92
|
-
if not mint:
|
|
93
|
-
return mint
|
|
94
|
-
return buildTxn(mint=mint,
|
|
95
|
-
payer_pubkey=payer_pubkey,
|
|
96
|
-
amount=amount,
|
|
97
|
-
slippage=slippage,
|
|
98
|
-
sol_in=sol_in,
|
|
99
|
-
token_balance=0,
|
|
100
|
-
token_price=0,
|
|
101
|
-
token_account=token_account,
|
|
102
|
-
token_account_instructions=token_account_instructions,
|
|
103
|
-
buy=True)
|
|
104
|
-
return True
|
|
105
|
-
async def confirm_txn(txn_sig, max_retries=20, retry_interval=3):
|
|
106
|
-
retries = 0
|
|
107
|
-
while retries < max_retries:
|
|
108
|
-
txn_res = await getTransaction(signature=str(txn_sig))
|
|
109
|
-
if txn_res:
|
|
110
|
-
print(f"\n\nhttps://solscan.io/tx/{str(txn_sig)}")
|
|
111
|
-
return txn_res
|
|
112
|
-
retries += 1
|
|
113
|
-
print(f"Retrying... ({retries}/{max_retries})")
|
|
114
|
-
await asyncio.sleep(retry_interval)
|
|
115
|
-
print(f"Failed to confirm transaction after {max_retries} attempts.")
|
|
116
|
-
return txn_sig
|
|
117
|
-
|
|
118
|
-
async def complete_txn(txn, payer_keypair,confirm=False):
|
|
119
|
-
txn_sig = await sendTransaction(txn=txn, payer_keypair=payer_keypair, skip_preflight=True) # Await this async call
|
|
120
|
-
print("Transaction Signature", txn_sig)
|
|
121
|
-
if confirm == False:
|
|
122
|
-
return txn_sig
|
|
123
|
-
confirm = await confirm_txn(txn_sig) # Await confirmation
|
|
124
|
-
|
|
125
|
-
while not confirm:
|
|
126
|
-
print("Waiting for transaction confirmation...")
|
|
127
|
-
await asyncio.sleep(1) # Use asyncio.sleep instead of time.sleep to avoid blocking
|
|
128
|
-
confirm = await confirm_txn(txn_sig) # Await confirmation check again
|
|
129
|
-
|
|
130
|
-
print("Transaction confirmed:", confirm)
|
|
131
|
-
return confirm
|
|
132
|
-
def buy_pump(mint: str, payer_keypair: Pubkey, sol_in=None, slippage=None,confirm=False):
|
|
133
|
-
sol_in = sol_in or 0.001
|
|
134
|
-
slippage = slippage or 25
|
|
135
|
-
payer_pubkey = get_pubkey(payer_keypair.pubkey())
|
|
136
|
-
txn = pump_fun_buy(mint=mint, payer_pubkey=payer_pubkey, sol_in=sol_in, slippage=slippage)
|
|
137
|
-
completed = asyncio.run(complete_txn(txn, payer_keypair,confirm=confirm)) # Await here since `complete_txn` is async
|
|
138
|
-
if not completed:
|
|
139
|
-
print("Buy transaction failed")
|
|
140
|
-
return completed
|
|
141
|
-
|
|
142
|
-
def sell_pump(mint:str, payer_keypair:Pubkey, token_balance=None, slippage=None,confirm=False):
|
|
143
|
-
slippage = slippage or 25
|
|
144
|
-
payer_pubkey = get_pubkey(payer_keypair.pubkey())
|
|
145
|
-
txn = pump_fun_sell(mint=mint, payer_pubkey=payer_pubkey, token_balance=token_balance, slippage=slippage)
|
|
146
|
-
completed = asyncio.run(complete_txn(txn, payer_keypair,confirm=confirm))
|
|
147
|
-
if not completed:
|
|
148
|
-
print("sell transaction failed")
|
|
149
|
-
return completed
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
from ..abstract_utils.pubkey_utils import Pubkey,get_pubkey,derive_bonding_curve,derive_associated_bonding_curve
|
|
2
|
-
from ..abstract_utils.log_message_functions import get_for_program_ids_info
|
|
3
|
-
from spl.token.instructions import create_associated_token_account, get_associated_token_address
|
|
4
|
-
from abstract_solcatcher import getGenesisSignature,getTransaction,getAccountInfo
|
|
5
|
-
from construct import Padding, Struct, Int64ul, Flag
|
|
6
|
-
from solana.transaction import AccountMeta, Transaction
|
|
7
|
-
import base64
|
|
8
|
-
from ..abstract_utils.constants import (PUMP_FUN_GLOBAL_PUBKEY,
|
|
9
|
-
PUMP_FUN_FEE_RECIPIENT_PUBKEY,
|
|
10
|
-
SYSTEM_PROGRAM_PUBKEY,
|
|
11
|
-
PUMP_FUN_EVENT_AUTHORITY_PUBKEY,
|
|
12
|
-
PUMP_FUN_PROGRAM_PUBKEY,
|
|
13
|
-
TOKEN_PROGRAM_ID_PUBKEY,
|
|
14
|
-
RENT_PUBKEY,
|
|
15
|
-
PUMP_FUN_ASSOC_TOKEN_ACC_PROG_PUBKEY)
|
|
16
|
-
|
|
17
|
-
# Change dictionary keys to lowercase and replace spaces with underscores
|
|
18
|
-
def change_keys_lower(dict_obj):
|
|
19
|
-
new_dict = {}
|
|
20
|
-
for key, value in dict_obj.items():
|
|
21
|
-
new_dict[key.lower().replace(' ', '_')] = value
|
|
22
|
-
return new_dict
|
|
23
|
-
|
|
24
|
-
# Predefined map for different transaction types
|
|
25
|
-
def get_create_map():
|
|
26
|
-
return [
|
|
27
|
-
{'instruction_number': '1', 'instruction_name': 'Mint', 'token_address': 'AkAUSJg1v9xYT3HUxdALH7NsrC6owmwoZuP9MLw8fxTL', 'token_name': '3CAT'},
|
|
28
|
-
{'instruction_number': '2', 'instruction_name': 'Mint Authority', 'token_address': 'TSLvdd1pWpHVjahSpsvCXUbgwsL3JAcvokwaKt1eokM', 'token_name': 'Pump.fun Token Mint Authority'},
|
|
29
|
-
{'instruction_number': '3', 'instruction_name': 'Bonding Curve', 'token_address': '9nhxvNxfSUaJddVco6oa6NodtsCscqCScp6UU1hZkfGm', 'token_name': 'Pump.fun (3CAT) Bonding Curve'},
|
|
30
|
-
{'instruction_number': '4', 'instruction_name': 'Associated Bonding Curve', 'token_address': '889XLp3qvVAHpTYQmhn6cBpYSppV8Gi8E2Rgp9RH2vRy', 'token_name': 'Pump.fun (3CAT) Vault'},
|
|
31
|
-
{'instruction_number': '5', 'instruction_name': 'Global', 'token_address': '4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf', 'token_name': '4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf'},
|
|
32
|
-
{'instruction_number': '6', 'instruction_name': 'Mpl Token Metadata', 'token_address': 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s', 'token_name': 'Metaplex Token Metadata'},
|
|
33
|
-
{'instruction_number': '7', 'instruction_name': 'Metadata', 'token_address': 'CH41RxpjSXHqr1vfLTVYJMsfNs2fBCCWoAE13tPihXh7', 'token_name': 'CH41RxpjSXHqr1vfLTVYJMsfNs2fBCCWoAE13tPihXh7'},
|
|
34
|
-
{'instruction_number': '8', 'instruction_name': 'User', 'token_address': 'Fuy5MvbgzjSok1U8hH6mUY6WnLynzUextDxfEWMiTkn4', 'token_name': 'Fuy5MvbgzjSok1U8hH6mUY6WnLynzUextDxfEWMiTkn4'},
|
|
35
|
-
{'instruction_number': '9', 'instruction_name': 'System Program', 'token_address': '11111111111111111111111111111111', 'token_name': 'System Program'},
|
|
36
|
-
{'instruction_number': '10', 'instruction_name': 'Token Program', 'token_address': 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', 'token_name': 'Token Program'},
|
|
37
|
-
{'instruction_number': '11', 'instruction_name': 'Associated Token Program', 'token_address': 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL', 'token_name': 'Associated Token Account Program'},
|
|
38
|
-
{'instruction_number': '12', 'instruction_name': 'Rent', 'token_address': 'SysvarRent111111111111111111111111111111111', 'token_name': 'Rent Program'},
|
|
39
|
-
{'instruction_number': '13', 'instruction_name': 'Event Authority', 'token_address': 'Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1', 'token_name': 'Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1'},
|
|
40
|
-
{'instruction_number': '14', 'instruction_name': 'Program', 'token_address': '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P', 'token_name': 'Pump.fun'}
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
def get_txnTypesFromGenesisSignature(genesisSignature,commitment="finalized"):
|
|
44
|
-
txn_data = getTransaction(genesisSignature,commitment=commitment)
|
|
45
|
-
txn_data = get_for_program_ids_info(txn_data)
|
|
46
|
-
for new_map in get_create_map():
|
|
47
|
-
instructions = txn_data['transaction']['message']['instructions']
|
|
48
|
-
inner_instructions = txn_data['meta']['innerInstructions'][0]['instructions']
|
|
49
|
-
all_instructions = instructions + inner_instructions
|
|
50
|
-
instruction = [inst for inst in all_instructions if len(inst.get('associatedAccounts', [])) > 13]
|
|
51
|
-
txn_types = {create_index['instruction_name']: instruction[0]['associatedAccounts'][int(create_index['instruction_number']) - 1] for create_index in get_create_map()}
|
|
52
|
-
if txn_types:
|
|
53
|
-
txn_types['signature'] = genesisSignature
|
|
54
|
-
break
|
|
55
|
-
return txn_types
|
|
56
|
-
|
|
57
|
-
# Fetches and organizes transaction types based on provided mint
|
|
58
|
-
def getTxnTypes(mint):
|
|
59
|
-
bonding_curve = str(derive_bonding_curve(mint)[0])
|
|
60
|
-
bonding_curve_signature = getGenesisSignature(address=bonding_curve)
|
|
61
|
-
return get_txnTypesFromGenesisSignature(bonding_curve_signature)
|
|
62
|
-
# Retrieve virtual reserves for a bonding curve using a structured layout
|
|
63
|
-
def get_virtual_reserves(bonding_curve: Pubkey):
|
|
64
|
-
bonding_curve_struct = Struct(
|
|
65
|
-
Padding(8),
|
|
66
|
-
"virtualTokenReserves" / Int64ul,
|
|
67
|
-
"virtualSolReserves" / Int64ul,
|
|
68
|
-
"realTokenReserves" / Int64ul,
|
|
69
|
-
"realSolReserves" / Int64ul,
|
|
70
|
-
"tokenTotalSupply" / Int64ul,
|
|
71
|
-
"complete" / Flag
|
|
72
|
-
)
|
|
73
|
-
account_info = getAccountInfo(account=str(bonding_curve[0]))
|
|
74
|
-
|
|
75
|
-
if not account_info or 'value' not in account_info or 'data' not in account_info['value']:
|
|
76
|
-
print("Failed to retrieve account info.")
|
|
77
|
-
return None
|
|
78
|
-
|
|
79
|
-
data_base64 = account_info['value']['data'][0]
|
|
80
|
-
data = base64.b64decode(data_base64)
|
|
81
|
-
parsed_data = bonding_curve_struct.parse(data)
|
|
82
|
-
return parsed_data
|
|
83
|
-
|
|
84
|
-
# Retrieves comprehensive transaction and reserve data for the mint
|
|
85
|
-
def get_pump_fun_data(mint_str: str=None,signature=None,commitment="finalized"):
|
|
86
|
-
if mint_str:
|
|
87
|
-
txn_types = change_keys_lower(getTxnTypes(mint_str))
|
|
88
|
-
if signature:
|
|
89
|
-
txn_types = change_keys_lower(get_txnTypesFromGenesisSignature(signature,commitment=commitment))
|
|
90
|
-
mint_str = mint_str or txn_types.get('mint')
|
|
91
|
-
bonding_curve = derive_bonding_curve(mint_str)
|
|
92
|
-
virtual_reserves = get_virtual_reserves(bonding_curve)
|
|
93
|
-
if virtual_reserves is None:
|
|
94
|
-
return None
|
|
95
|
-
|
|
96
|
-
txn_types.update({
|
|
97
|
-
"mint": mint_str,
|
|
98
|
-
"bonding_curve": str(bonding_curve[0]),
|
|
99
|
-
"associated_bonding_curve": str(derive_associated_bonding_curve(mint_str)),
|
|
100
|
-
"virtual_token_reserves": int(virtual_reserves.virtualTokenReserves),
|
|
101
|
-
"virtual_sol_reserves": int(virtual_reserves.virtualSolReserves),
|
|
102
|
-
"token_total_supply": int(virtual_reserves.tokenTotalSupply),
|
|
103
|
-
"complete": bool(virtual_reserves.complete)
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
return txn_types
|
|
107
|
-
|
|
108
|
-
def getKeys(mint_str,token_account,payer_pubkey,buy=True):
|
|
109
|
-
MINT = get_pubkey(str(mint_str))
|
|
110
|
-
bonding_curve = derive_bonding_curve(str(mint_str))
|
|
111
|
-
associated_bonding_curve = derive_associated_bonding_curve(str(mint_str))
|
|
112
|
-
BONDING_CURVE = get_pubkey(str(bonding_curve[0]))
|
|
113
|
-
ASSOCIATED_BONDING_CURVE = get_pubkey(str(associated_bonding_curve))
|
|
114
|
-
ASSOCIATED_USER = Pubkey.from_string(str(token_account))
|
|
115
|
-
USER = Pubkey.from_string(str(payer_pubkey))
|
|
116
|
-
PUMP_FUN_TOKEN_PROGRAM_SWITCH = TOKEN_PROGRAM_ID_PUBKEY if buy else PUMP_FUN_ASSOC_TOKEN_ACC_PROG_PUBKEY
|
|
117
|
-
PUMP_FUN_RENT_PROGRAM_SWITCH = RENT_PUBKEY if buy else TOKEN_PROGRAM_ID_PUBKEY
|
|
118
|
-
# Build account key list
|
|
119
|
-
keys = [
|
|
120
|
-
AccountMeta(pubkey=PUMP_FUN_GLOBAL_PUBKEY, is_signer=False, is_writable=False),
|
|
121
|
-
AccountMeta(pubkey=PUMP_FUN_FEE_RECIPIENT_PUBKEY, is_signer=False, is_writable=True),
|
|
122
|
-
AccountMeta(pubkey=MINT, is_signer=False, is_writable=False),
|
|
123
|
-
AccountMeta(pubkey=BONDING_CURVE, is_signer=False, is_writable=True),
|
|
124
|
-
AccountMeta(pubkey=ASSOCIATED_BONDING_CURVE, is_signer=False, is_writable=True),
|
|
125
|
-
AccountMeta(pubkey=ASSOCIATED_USER, is_signer=False, is_writable=True),
|
|
126
|
-
AccountMeta(pubkey=USER, is_signer=True, is_writable=True),
|
|
127
|
-
AccountMeta(pubkey=SYSTEM_PROGRAM_PUBKEY, is_signer=False, is_writable=False),
|
|
128
|
-
AccountMeta(pubkey=PUMP_FUN_TOKEN_PROGRAM_SWITCH, is_signer=False, is_writable=False),
|
|
129
|
-
AccountMeta(pubkey=PUMP_FUN_RENT_PROGRAM_SWITCH, is_signer=False, is_writable=False),
|
|
130
|
-
AccountMeta(pubkey=PUMP_FUN_EVENT_AUTHORITY_PUBKEY, is_signer=False, is_writable=False),
|
|
131
|
-
AccountMeta(pubkey=PUMP_FUN_PROGRAM_PUBKEY, is_signer=False, is_writable=False)
|
|
132
|
-
]
|
|
133
|
-
return keys
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from ..abstract_utils.constants import TOKEN_DECIMAL_EXP,SOL_DECIMAL_EXP
|
|
2
|
-
from ..abstract_utils.pubkey_utils import Pubkey
|
|
3
|
-
from .pump_fun_keys import get_pump_fun_data
|
|
4
|
-
from abstract_solcatcher import getTokenAccountBalance,getTokenAccountsByOwner
|
|
5
|
-
from spl.token.instructions import create_associated_token_account, get_associated_token_address
|
|
6
|
-
from abstract_utilities import get_any_value
|
|
7
|
-
import requests
|
|
8
|
-
def get_token_balance(payer,mint: str):
|
|
9
|
-
response = getTokenAccountBalance(str(payer),str(mint))
|
|
10
|
-
response=response.get('value',response)
|
|
11
|
-
ui_amount = get_any_value(response, "uiAmount") or 0
|
|
12
|
-
return float(ui_amount)
|
|
13
|
-
def get_token_price(mint: str) -> float:
|
|
14
|
-
try:
|
|
15
|
-
# Get coin data
|
|
16
|
-
coin_data = get_pump_fun_data(str(mint))
|
|
17
|
-
if not coin_data:
|
|
18
|
-
print("Failed to retrieve coin data...")
|
|
19
|
-
return None
|
|
20
|
-
virtual_sol_reserves = coin_data['virtual_sol_reserves'] / SOL_DECIMAL_EXP
|
|
21
|
-
virtual_token_reserves = coin_data['virtual_token_reserves'] / TOKEN_DECIMAL_EXP
|
|
22
|
-
token_price = virtual_sol_reserves / virtual_token_reserves
|
|
23
|
-
print(f"Token Price: {token_price:.20f} SOL")
|
|
24
|
-
return token_price
|
|
25
|
-
except Exception as e:
|
|
26
|
-
print(f"Error calculating token price: {e}")
|
|
27
|
-
return None
|
|
28
|
-
def get_account_by_owner(payer, mint_str: str) -> dict:
|
|
29
|
-
payload = {
|
|
30
|
-
"jsonrpc": "2.0",
|
|
31
|
-
"id": 1,
|
|
32
|
-
"method": "getTokenAccountsByOwner",
|
|
33
|
-
"params": [payer, {"mint": mint_str}, {"encoding": "jsonParsed"}]
|
|
34
|
-
}
|
|
35
|
-
response = requests.post(
|
|
36
|
-
url="https://rpc.ankr.com/solana/c3b7fd92e298d5682b6ef095eaa4e92160989a713f5ee9ac2693b4da8ff5a370",
|
|
37
|
-
json=payload
|
|
38
|
-
)
|
|
39
|
-
response_json = response.json()
|
|
40
|
-
|
|
41
|
-
result = response_json.get('result')
|
|
42
|
-
if not result or 'value' not in result:
|
|
43
|
-
return None
|
|
44
|
-
|
|
45
|
-
accounts = result.get('value', [])
|
|
46
|
-
if accounts:
|
|
47
|
-
return accounts[0] # Return the first account found
|
|
48
|
-
return None
|
|
49
|
-
def check_existing_token_account(owner: Pubkey, mint: Pubkey):
|
|
50
|
-
try:
|
|
51
|
-
account_data = get_account_by_owner(str(owner), str(mint))
|
|
52
|
-
if account_data:
|
|
53
|
-
token_account = account_data['pubkey']
|
|
54
|
-
print(f"Existing token account found: {token_account}")
|
|
55
|
-
return token_account, None
|
|
56
|
-
else:
|
|
57
|
-
print("No existing token account found. Creating a new one...")
|
|
58
|
-
token_account = get_associated_token_address(owner, mint)
|
|
59
|
-
token_account_instructions = create_associated_token_account(owner, owner, mint)
|
|
60
|
-
return token_account, token_account_instructions
|
|
61
|
-
except Exception as e:
|
|
62
|
-
print(f"Error checking or creating token account: {e}")
|
|
63
|
-
return None, None
|
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_rpcs/__init__.py
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_rpcs/get_body.py
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana/abstract_utils/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/requires.txt
RENAMED
|
File without changes
|
{abstract_solana-0.0.0.96 → abstract_solana-0.0.0.98}/src/abstract_solana.egg-info/top_level.txt
RENAMED
|
File without changes
|