├── .gitignore ├── mnemonic.csv ├── sui_wallet.crx ├── LICENSE.md ├── README.md └── main.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /mnemonic.csv: -------------------------------------------------------------------------------- 1 | mnemonic,addr 2 | -------------------------------------------------------------------------------- /sui_wallet.crx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rocknrostov/create-sui-wallet/HEAD/sui_wallet.crx -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 0xVanfer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Create SUI wallet. 2 | 3 | Create a SUI wallet and mint 3 test NFTs. 4 | 5 | This version is stable, and will not break. However, when creating a new wallet, chrome will create a new window, and will pop up, so run this when you are leaving your screen. 6 | 7 | Around 30-40 seconds to create a new wallet. 8 | 9 | ## Chrome、Chromedriver 10 | 11 | Must have chrome driver 12 | 13 | 1. [download](https://chromedriver.chromium.org/downloads) 14 | 15 | Chrome and chrome driver must be the same version. 16 | 17 | 2. Install 18 | 19 | For mac: 20 | 21 | Save the corresponding version into "usr/local/bin" and run: 22 | 23 | > $ xattr -d com.apple.quarantine chromedriver 24 | 25 | ## pip 26 | 27 | > pip3 install selenium 28 | 29 | > pip3 install pandas 30 | 31 | ## crx 32 | 33 | sui_wallet.crx is the v0.2.0 version. 34 | 35 | Not up to date, but still can use. 36 | 37 | You can also create it yourself by visiting chrome://extensions/ and package it as a new crx file. 38 | 39 | ## Before Starting 40 | 41 | Change the constant "faucet_mnemonic" in [main.py](./main.py) to your own mnemonic with 50,000,000 SUI.(air drop) 42 | 43 | ## Run 44 | 45 | > python3 -m main 46 | 47 | ###### Support 48 | 49 | ethereum address: 0x8888888856cf9a441D638dc41fBd460D2d3b912D 50 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver.common.action_chains import ActionChains 2 | from selenium.webdriver.common.by import By 3 | from selenium import webdriver 4 | import pandas as pd 5 | import time 6 | 7 | 8 | # any with one upper letter and length>8 9 | password = "Asf453jkb4jk3bS" 10 | # file name to save the memories and addresses 11 | file_name = "mnemonic" 12 | # the address already has 50,000,000 SUI 13 | faucet_mnemonic = "USE YOUR OWN MNEMONIC WITH 50000000 SUI" 14 | 15 | 16 | def df_to_csv(df, name): 17 | # save dataframe as csv 18 | df.to_csv(name + '.csv', index=False) 19 | 20 | 21 | def csv_to_df(name): 22 | # read csv to dataframe 23 | df = pd.read_csv(name + '.csv') 24 | return df 25 | 26 | 27 | def add_to_csv(file_name, add_text): 28 | # add a line to file_name.csv 29 | # should be like [xx,xx,xx] 30 | df = csv_to_df(file_name) 31 | l = len(df) 32 | df.loc[l] = add_text 33 | df_to_csv(df, file_name) 34 | 35 | 36 | def click(driver, xpath, time_to_sleep): 37 | # click once 38 | # if click more times, try another method 39 | button = driver.find_element(By.XPATH, xpath) 40 | print('click on "' + button.text + '"') 41 | clicking = ActionChains(driver).click(button) 42 | clicking.perform() 43 | time.sleep(time_to_sleep) 44 | 45 | 46 | def new_window(driver, url): 47 | # create a new window by the url 48 | # remember to switch to the new window! 49 | driver.execute_script('window.open("'+url+'")') 50 | 51 | 52 | def switch_to_window(driver, window_number): 53 | # switch to another window, start from 0 54 | driver.switch_to.window(driver.window_handles[window_number]) 55 | print('switched to window numer:', str(window_number)) 56 | 57 | 58 | def input_text(driver, xpath, text): 59 | key = driver.find_element(By.XPATH, xpath) 60 | key.send_keys(text) 61 | 62 | 63 | def CreateDriver(): 64 | # new driver 65 | option = webdriver.ChromeOptions() 66 | option.add_extension("./sui_wallet.crx") 67 | driver = webdriver.Chrome(options=option) 68 | driver.maximize_window() 69 | time.sleep(3) 70 | return driver 71 | 72 | 73 | def CreateNewWalletWindow(driver): 74 | url = "chrome-extension://opcgpfmipidbgpenhmajoajpbobppdil/ui.html#/welcome" 75 | new_window(driver, url) 76 | switch_to_window(driver, 1) 77 | driver.close() 78 | time.sleep(3) 79 | switch_to_window(driver, 1) 80 | try: 81 | LogOut(driver) 82 | finally: 83 | return 84 | 85 | 86 | def LogIn(driver, mnemonic): 87 | click(driver, '/html/body/div/div/div/div/div/div[2]/a', 0) 88 | click(driver, "/html/body/div/div/div/div[2]/a", 0) 89 | input_text(driver, "/html/body/div/div/div/form/label/textarea", mnemonic) 90 | click(driver, "/html/body/div/div/div/form/button", 0) 91 | input_text(driver, 92 | "/html/body/div/div/div/form/label[1]/input", password) 93 | input_text(driver, 94 | "/html/body/div/div/div/form/label[2]/input", password) 95 | click(driver, "/html/body/div/div/div/form/div[2]/button[2]", 1) 96 | click(driver, "/html/body/div/div/div/button", 0) 97 | 98 | 99 | def LogOut(driver): 100 | click(driver, "/html/body/div/div/div/div[1]/a[2]", 0) 101 | click( 102 | driver, "/html/body/div/div/div/div[2]/div/div[2]/div/a[1]/div[2]", 0) 103 | click(driver, "/html/body/div/div/div/div[2]/div/div[2]/div/button", 1) 104 | 105 | 106 | def GetSUI(driver, addrToSend): 107 | LogIn(driver, faucet_mnemonic) 108 | click(driver, "/html/body/div/div/div/div[2]/main/div/div[2]/a[2]", 0) 109 | # input amount, must over 10000 110 | input_text(driver, 111 | "/html/body/div/div/div/div[2]/main/div/div[2]/form/div[1]/div[1]/input", "12345") 112 | click(driver, 113 | "/html/body/div/div/div/div[2]/main/div/div[2]/form/div[2]/div/button", 0) 114 | # input address 115 | input_text(driver, 116 | "/html/body/div/div/div/div[2]/main/div/div[2]/form/div[1]/div[2]/div[1]/div[1]/textarea", addrToSend) 117 | # send sui, wait for pending 118 | click(driver, 119 | "/html/body/div/div/div/div[2]/main/div/div[2]/form/div[2]/div/button", 7) 120 | click(driver, "/html/body/div/div/div/div[2]/main/div/button/i", 0) 121 | LogOut(driver) 122 | 123 | 124 | def CreateNewWallet(driver): 125 | click(driver, '/html/body/div/div/div/div/div/div[2]/a', 0) 126 | click(driver, "/html/body/div/div/div/div[1]/a", 0) 127 | 128 | input_text( 129 | driver, "/html/body/div/div/div/form/div/fieldset/label[1]/input", password) 130 | input_text( 131 | driver, "/html/body/div/div/div/form/div/fieldset/label[2]/input", password) 132 | 133 | click( 134 | driver, "/html/body/div/div/div/form/div/fieldset/label[3]/span[1]", 0) 135 | click(driver, "/html/body/div/div/div/form/button", 1) 136 | mnemonic = driver .find_element( 137 | By.XPATH, "/html/body/div/div/div/div[2]").text 138 | mnemonic = str.replace(mnemonic, "COPY", "") 139 | mnemonic = str.replace(mnemonic, "\n", "") 140 | click(driver, "/html/body/div/div/div/button", 0) 141 | click(driver, 142 | "/html/body/div/div/div/div[2]/nav/div[2]/a[3]", 1) 143 | full_addr = driver .find_element( 144 | By.XPATH, "/html/body/div/div/div/div[2]/main/div/div/section/div/div[1]/a").get_attribute("href") 145 | addr = full_addr[41:] 146 | LogOut(driver) 147 | return mnemonic, addr 148 | 149 | 150 | def MintNFT(driver, mnemonic): 151 | LogIn(driver, mnemonic) 152 | # nft 153 | click(driver, "/html/body/div/div/div/div[2]/nav/div[2]/a[3]", 0) 154 | click( 155 | driver, "/html/body/div/div/div/div[2]/main/div/div/section/div/div[1]/button", 5) 156 | click( 157 | driver, "/html/body/div/div/div/div[2]/main/div/div/section/div/div[1]/button", 5) 158 | click( 159 | driver, "/html/body/div/div/div/div[2]/main/div/div/section/div/div[1]/button", 5) 160 | # click(driver, "/html/body/div/div/div/div[2]/nav/div[2]/a[2]/i", 1) 161 | LogOut(driver) 162 | 163 | 164 | def CreateHundred(driver): 165 | CreateNewWalletWindow(driver) 166 | for i in range(0, 100): 167 | mnemonic, addr = CreateNewWallet(driver) 168 | GetSUI(driver, addr) 169 | MintNFT(driver, mnemonic) 170 | add_to_csv(file_name, [mnemonic, addr]) 171 | 172 | 173 | def main(): 174 | # df = pd.DataFrame(columns=["mnemonic", "addr"]) 175 | # df_to_csv(df, file_name) 176 | start = time.time() 177 | driver = CreateDriver() 178 | for i in range(0, 10000): 179 | try: 180 | CreateHundred(driver) 181 | except: 182 | continue 183 | 184 | end = time.time() 185 | print("time used:", end-start) 186 | 187 | 188 | main() 189 | --------------------------------------------------------------------------------