Code Monkey home page Code Monkey logo

gemwallet / gemwallet-extension Goto Github PK

View Code? Open in Web Editor NEW
53.0 6.0 20.0 6.59 MB

GemWallet is a cutting-edge crypto wallet and Web3 layer for the XRP Ledger. Our browser extension enables you to interact with the XRP Ledger directly from your browser (Metamask for the XRPL). - https://gemwallet.app

Home Page: https://gemwallet.app

License: Other

HTML 2.50% CSS 0.30% TypeScript 96.58% JavaScript 0.61% Shell 0.01%
xrp xrp-ledger xrpl cryptocurrency cryptocurrencies crypto typescript yarnworkspaces payment payments

gemwallet-extension's People

Contributors

allcontributors[bot] avatar benaor avatar daviran avatar dependabot[bot] avatar florent-uzio avatar florianbouron avatar mmaryo avatar thibautbremand avatar tusharpardhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gemwallet-extension's Issues

Stuck Funds within wallet

Have been trying to sell/ swap SOLO back into XRP. Transaction shows as successful but it doesn't reflect on the wallet. It doesn't move anything, tried giving the benefit of the doubt but it's been days now. Please let me know how to recover my funds.

cannot modify the wallet name if too long

image

I change the name of my "wallet 1" to my public address
Then, I can't update another time the name of my wallet because it is too long like you can see on the image

Extension requires password on every interaction

Issue #121 didn't quiet solve the problem in my case.
The wallet extension app still prompts the user for a password on every interaction.

  • when opening the wallet via UI icon in the browser
  • when making requests via API

Setup:

  • Chromium Version 113.0.5672.126
  • Ubuntu 22.04 (64-bit)

getNetwork closes window

Hi,

The code below pops the gem wallet into another window and quits unexpectedly without returning to the browser. When I switch back to the browser I see the data but it should be automatic as with other functions.

async getNetwork() {
	isInstalled().then((response) => {
		if (response.result.isInstalled) {
			getNetwork().then((response) => {
			this.network = response.result?.network;
			});
		} else {
			alert('Please install Gem wallet')
		}
	});			
},

Do you know why it's doing this?

I am using Google Chrome on a Macbook Pro.

Best.

[Feat] Allowing developers to specify custom network

Currently, GemWallet only supports the mainnet, testnet, devnet, and Amm network. This means that developers who want to interact with the XRPL must use one of these four networks. However, there are times when developers may want to test or interact with a custom network on the XRPL. It would be helpful to be able to specify a custom network.

Add User Setting for Autolock Time Duration

30 minutes is too short for most users. We are sitting at our computers in a safe place for hours and every time we need to use Gem Wallet it asks for the password again. Can you please allow us to set this auto lock time to whatever we like instead of just 30 minutes?

Wallet asking for password a lot

I'm using @gemwallet/api functions in our NextJS app. The wallet keeps asking for the password for each API function call it seems. I tried using both promise patterns but the wallet's behavior is still unpredictable. Sometimes it asks for the password twice and then it works. Sometimes, the sign button just doesn't work.

Below are both code patterns that I tested. Please let me know if there's a mistake on my part.

import * as GemWalletApi from '@gemwallet/api';

const signInSync = () => {
  GemWalletApi.isConnected()
    .then((isConnected) => {
      if (isConnected) {
        GemWalletApi.getPublicKey()
          .then((publicKey) => {
            if (publicKey) {
              const message = `my message.`;

              GemWalletApi.signMessage(message)
                .then((signature) => {
                  if (signature) {
                    signInWithSignature
                      .mutateAsync({
                        publicKey: publicKey!,
                        signature: signature!,
                        message,
                      })
                      .then((response) => {
                        if (response.authorized) {
                          toast.success('Signed in successfully');
                        } else {
                          toast.error('An unknown error occurred');
                        }
                      })
                      .catch((err) => {
                        toast.error('An unknown error occurred');
                        console.error('GemWallet.signInWithSignature', err);
                      });
                  } else {
                    toast.error('Could not sign message with GemWallet');
                  }
                })
                .catch((err) => {
                  toast.error('Could not sign message with GemWallet');
                  console.error('GemWallet.signMessage', err);
                });
            } else {
              toast.error('Could not get public key from GemWallet');
            }
          })
          .catch((err) => {
            toast.error('Could not get public key from GemWallet');
            console.error('GemWallet.getPublicKey', err);
          });
      } else {
        toast.error('GemWallet is not installed. Please install it first.');
      }
    })
    .catch((err) => {
      toast.error('An unknown error occurred');
      console.error('GemWallet.isConnected', err);
    });
};
import * as GemWalletApi from '@gemwallet/api';

const signIn = async () => {
  // setIsSigningIn(true);

  try {
    const isConnected = await GemWalletApi.isConnected();
    if (!isConnected) {
      throw new Error('GemWallet is not installed. Please install it first.');
    }

    const publicKey = await GemWalletApi.getPublicKey();
    const message = `my message`;
    const signature = await GemWalletApi.signMessage(message);

    const response = await signInWithSignature.mutateAsync({
      publicKey: publicKey!,
      signature: signature!,
      message,
    });

    if (response.authorized) {
      toast.success('Signed in successfully');
    } else {
      toast.error('An unknown error occurred');
    }
  } catch (err) {
    if (err instanceof Error) toast.error(err.message);
    else toast.error('An unknown error occurred');
  } finally {
    setIsSigningIn(false);
  }
};

getNetwork() API not working

Hello,

When I try to use the getNetwork() API, I get the following error in the console:

Unchecked runtime.lastError: The message port closed before a response was received.

image

The isConnected() API returns true but then impossible to get the network.

[feat] Events to notify web app about state changes

Add an event system that allows web apps to react to extension state changes. It's currently quite difficult to stay in sync with what is happening with the extension without constantly polling the state.
Possibly something based on Node.js EventEmitter.

Example:

  • networkChanged: switch from "devnet" to "testnet"
  • walletChanged / accountChanged: selected new active wallet
  • login, logout: extension locked or unlocked
  • etc.

Usage:

GemWalletApi.on('networkChanged', (network: string) => {
  console.log(`New network: ${network}`);
});

App window position

Clicking the extension icon opens the app window (borderless, no menu) in place. Whereas using the API creates a popup-like app window (with border, menu) somewhere on the screen. (This behavior could be dependent on the OS)

Would be nice, if this was more consistent (especially the positioning). Ideally the icon app window is used for all cases.

Opened with icon (positioned next to icon):
app_borderless

Opened with API call (positioned somewhere top-left of screen):
app_border

async event callback

Was playing around with the recently added events (version: ^3.4.0). Ran into some troubles trying to do the following (the user has previously accepted to share both address and pubkey with the app):

import * as Gem from "@gemwallet/api";

Gem.on("walletChanged", async (event) => {
      await Gem.isInstalled();
      await Gem.getAddress();
      await Gem.getNetwork();
      await Gem.getPublicKey(); // <- fails with { "type": "reject", result: undefined }
});

Seems to work when doing the same series of calls outside of an event handler. Not sure whether this is related to the async callback or the getPublicKey function. Feels like something is racing somewhere.

Are async callback functions even supported currently? (If not, they probably should be)

In case you need more details, let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.