-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
46 lines (32 loc) · 1.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from solders.keypair import Keypair
from solana.rpc.async_api import AsyncClient
from solana.rpc.commitment import Commitment
from raydium.liquidity_remover import remove
from configparser import ConfigParser
import os, sys, asyncio, base58
config = ConfigParser()
config.read(os.path.join(sys.path[0], "data", "config.ini"))
RPC_HTTPS_URL = config.get("RPC_URL", "rpc_url")
async def main():
private_key = input("Enter your wallet private key: ")
while True:
pool_id = input("Enter the pool id (pool id, pair address, amm id are same things): ")
payer = Keypair.from_bytes(base58.b58decode(private_key))
# # Solana Client Initialization
ctx = AsyncClient(
RPC_HTTPS_URL,
commitment=Commitment("confirmed"),
timeout=30,
blockhash_cache=True,
)
print()
txn = await remove(ctx, pool_id, payer)
if txn != "failed":
print(f"https://solscan.io/tx/{txn}\n")
else:
print("Unkown error occured\n")
print("="*50)
print("="*50)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())