Receiving transactions

There isn't another as simple function in our program as displaying wallet's public key. You can just copy the address or scan QR code.

circle-info

You can send on your address SOL and all SPL tokens as well.

def receive_menu(self, public_key):
    self.clear_main_content()
    
    self.receive_frame = customtkinter.CTkFrame(self.main_content_frame)
    self.receive_frame.grid(row=0, column=0, padx=20, pady=20, sticky="nsew")
    self.receive_frame.grid_columnconfigure(0, weight=1)

    receive_label = customtkinter.CTkLabel(
        self.receive_frame, 
        text="Receive SOL", 
        font=customtkinter.CTkFont(size=16, weight="bold")
    )
    receive_label.grid(row=0, column=0, padx=20, pady=(0, 10), sticky="w")

    public_key_label = customtkinter.CTkLabel(
        self.receive_frame, 
        text=f"Public Key:\n{public_key}", 
        wraplength=360, 
        justify="center"
    )
    public_key_label.grid(row=1, column=0, padx=20, pady=10, sticky="n")

    copy_button = customtkinter.CTkButton(
        self.receive_frame, 
        text="Copy Public Key", 
        command=lambda: self.copy_to_clipboard(public_key)
    )
    copy_button.grid(row=2, column=0, padx=20, pady=10, sticky="n")

    qr = qrcode.QRCode(
        version=1,
        error_correction=qrcode.constants.ERROR_CORRECT_L,
        box_size=10,
        border=4,
    )
    qr.add_data(str(public_key))
    qr.make(fit=True)

    img = qr.make_image(fill_color="black", back_color="white")
    qr_image = img.resize((200, 200), Image.LANCZOS)
    self.qr_photo = ImageTk.PhotoImage(qr_image)
    qr_label = customtkinter.CTkLabel(
        self.receive_frame, 
        image=self.qr_photo, 
        text=""
    )
    qr_label.grid(row=3, column=0, padx=20, pady=10)

Last updated