forked from dxzenith/token-creation-eclipse-testnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheclipse.sh
138 lines (113 loc) · 3.95 KB
/
eclipse.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
export RED='\033[0;31m'
export GREEN='\033[0;32m'
export YELLOW='\033[1;33m'
export NC='\033[0m'
prompt() {
local message="$1"
read -p "$message" input
echo "$input"
}
execute_and_prompt() {
local message="$1"
local command="$2"
echo -e "${YELLOW}${message}${NC}"
eval "$command"
echo -e "${GREEN}Done.${NC}"
}
echo -e "${YELLOW}Installing Rust...${NC}"
echo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
echo -e "${GREEN}Rust installed: $(rustc --version)${NC}"
echo
echo -e "${YELLOW}Removing Node.js...${NC}"
echo
sudo apt-get remove -y nodejs
echo
echo -e "${YELLOW}Installing NVM and Node.js LTS...${NC}"
echo
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && export NVM_DIR="/usr/local/share/nvm"; [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"; [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"; source ~/.bashrc; nvm install --lts; nvm use --lts
echo -e "${GREEN}Node.js installed: $(node -v)${NC}"
echo
echo -e "${YELLOW}Cloning repository and installing npm dependencies...${NC}"
echo
git clone https://github.com/Eclipse-Laboratories-Inc/testnet-deposit
cd testnet-deposit
npm install
echo
echo -e "${YELLOW}Installing Solana CLI...${NC}"
echo
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
echo -e "${GREEN}Solana CLI installed: $(solana --version)${NC}"
echo
echo -e "${YELLOW}Generating new Solana keypair...${NC}"
echo
solana-keygen new -o ~/my-wallet.json
echo
echo -e "${YELLOW}Save these mnemonic phrases in safe Place.If there will any Airdrop in future, you will be eligible from this wallet so save it${NC}"
echo
read -p "Enter your mneomic phrase: " mnemonic
echo
cat << EOF > secrets.json
{
"seedPhrase": "$mnemonic"
}
EOF
cat << 'EOF' > derive-wallet.js
const { seedPhrase } = require('./secrets.json');
const { HDNodeWallet } = require('ethers');
const mnemonicWallet = HDNodeWallet.fromPhrase(seedPhrase);
console.log();
console.log('ETHEREUM PRIVATE KEY:', mnemonicWallet.privateKey);
console.log();
console.log('SEND SEPOLIA ETH TO THIS ADDRESS:', mnemonicWallet.address);
EOF
if ! npm list ethers &>/dev/null; then
echo "ethers.js not found. Installing..."
echo
npm install ethers
echo
fi
node derive-wallet.js
echo
echo -e "${YELLOW}Configuring Solana CLI...${NC}"
echo
solana config set --url https://testnet.dev2.eclipsenetwork.xyz/
solana config set --keypair ~/my-wallet.json
echo
echo -e "${GREEN}Solana Address: $(solana address)${NC}"
echo
if [ -d "testnet-deposit" ]; then
execute_and_prompt "Removing testnet-deposit Folder..." "rm -rf testnet-deposit"
fi
read -p "Enter your Solana address: " solana_address
read -p "Enter your Ethereum Private Key: " ethereum_private_key
read -p "Enter the number of times to repeat Transaction (4-5 tx Recommended): " repeat_count
gas_limit="4000000"
echo
for ((i=1; i<=repeat_count; i++)); do
echo -e "${YELLOW}Running Bridge Script (Tx $i)...${NC}"
echo
node deposit.js "$solana_address" 0x11b8db6bb77ad8cb9af09d0867bb6b92477dd68e "$gas_limit" "$ethereum_private_key" https://1rpc.io/sepolia
echo
sleep 3
done
echo -e "${RED}It will take 4 mins, Don't do anything, Just Wait${RESET}"
echo
sleep 240
execute_and_prompt "Creating token..." "spl-token create-token --enable-metadata -p TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
echo
token_address=$(prompt "Enter your Token Address: ")
echo
execute_and_prompt "Creating token account..." "spl-token create-account $token_address"
echo
execute_and_prompt "Minting token..." "spl-token mint $token_address 10000"
echo
execute_and_prompt "Checking token accounts..." "spl-token accounts"
echo
execute_and_prompt "Checking Program Address..." "solana address"
echo
echo -e "${YELLOW}Submit Feedback at${NC}: https://docs.google.com/forms/d/e/1FAIpQLSfJQCFBKHpiy2HVw9lTjCj7k0BqNKnP6G1cd0YdKhaPLWD-AA/viewform?pli=1"
echo