Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEAR and Liquality Wallet dApp integration #718

Open
kujtimprenkuSQA opened this issue Mar 21, 2022 · 1 comment
Open

NEAR and Liquality Wallet dApp integration #718

kujtimprenkuSQA opened this issue Mar 21, 2022 · 1 comment

Comments

@kujtimprenkuSQA
Copy link

Description

Hi,

I am trying to use Liquality Wallet with a NEAR account from a dApp you can see the example here:

https://github.com/kujtimprenkuSQA/liquality-near-example/

There are a few things I would like to point out that could really improve the experience and fix some potential bugs/weird behaviors.

(issue) window.near conflicts with other extension wallets

The window.near namespace conflicts with another wallet SenderWallet if both wallets are installed then the window.near will always return the injected options from the SenderWallet and not LiqualityWallet

(bug) window.near.enable() method works only if you confirm the connection.

In the above example if you click the Connect with Near button which in the end calls:

await window.near.enable();

The liquality wallet opens a window to confirm the connection if we confirm it it works perfectly but the issue is if we Cancel or close the window in X at this moment I am not sure why but if we try to call window.near.enable(); for the second time it returns undefined and the popup never opens until you close the Browser and reopen it.

(bug) Actions propertynot being passed down

When trying to call wallet_sendTransaction method through window.near.request() from my understanding I think the actions key/property is not being sent to the sendTransaction function which is exposed by near-js-wallet-provider

const signAndSendTransaction = await window.near.request({
  method: "wallet_sendTransaction",
  params: [
    {
      to: "kujtim.testnet",
      value: "0",
      data: "", 
      actions: [
          "this is an invalid action but does not get triggered"
      ] 
    },
  ],
});

It looks like you are not passing the actions to the sendTransaction method.
In the PermissionSend.vue component you make a call to this method replyPermission (vue store action)

And the replyPermission then dispatches another event executeRequest

Which in the end executes this check, and you can see there's no actions key in the payload for sendTransaction event.

What happens is that in the end this if block is executed since in this case options.actions would be undefined at this point a Transfer action is being created by default.

(issue) there's no way to disconnect/ logout once you're connected.

If you call await window.near.enable(); and confirm the connection then there's no way how you can logout or disconnect from the dApp unles you close the browser window.

@monokh
Copy link
Contributor

monokh commented Mar 23, 2022

Hi @kujtimprenkuSQA
Thanks for reporting this,
The main issue is that we haven't implemented real NEAR connection for the wallet yet. The current window.near is a custom interface that all chains in the wallet have by default.
We are now evaluating for this to be implemented.
Is there a standard API for near wallets and applications that we should be implementing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants