Git Product home page Git Product logo

aptos-wallet-adapter's People

Contributors

0xmaayan avatar acceyuriko avatar amalia20220301 avatar andy-hippo avatar beansgum avatar bryanforsafe avatar chendatony31 avatar keepresolve avatar kent-white avatar khiemsoft avatar levihhh avatar lusd avatar manahip avatar mordochi avatar munanadi avatar norbertbodziony avatar pantinho avatar pierodavinci avatar piotr-layerzero avatar ranger8888 avatar robbinh avatar tom-hippo avatar tomyip0010 avatar turshija avatar vidorge avatar web3luhao avatar xiaobaixin avatar xorgal avatar yanglin5689446 avatar zhaomengru2015 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  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

aptos-wallet-adapter's Issues

Does the wallet support BCS transactions?

I am facing a problem, only BCS transactions will work. I tried to use the signAndSubmitTransaction, but it seems the payload arguments always convert to string, but the module function only takes vector<u8> as arguments.

It will be great to support generateBCSTransaction or submitSignedBCSTransaction like Aptos Typescript SDK does.

Wallet connects without signing in

Wallet is currently connecting to app and returning a connected state instantly with public key without prompting the user to sign in. This creates some strange behavior as the user then tries to make a transaction and is asked to sign in for an already connected account.

Is it possible to enforce sign in before connecting?

Cookie error after updating to aptos to 1.3.14 and wallet adapter to 0.4.2

Though I am able to run the application. Not sure if this is due to the wallet adapter code or my system. Did not get this issue before.

ERROR in node_modules/aptos/src/generated/core/request.ts:105:29
TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string | URL'.
103 | if (Array.isArray(response.headers["set-cookie"])) {
104 | response.headers["set-cookie"].forEach((c) => {

105 | jar.setCookie(new URL(response.config.url), c);
| ^^^^^^^^^^^^^^^^^^^
106 | });
107 | }
108 | return response;

ERROR in node_modules/aptos/src/generated/core/request.ts:112:42
TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string | URL'.
Type 'undefined' is not assignable to type 'string | URL'.
110 |
111 | axios.interceptors.request.use(function (config) {

112 | const cookies = jar.getCookies(new URL(config.url));
| ^^^^^^^^^^
113 |
114 | if (cookies?.length > 0) {
115 | config.headers.cookie = cookies.map((cookie) => ${cookie.name}=${cookie.value}).join("; ");

ERROR in node_modules/aptos/src/generated/core/request.ts:115:5
TS2532: Object is possibly 'undefined'.
113 |
114 | if (cookies?.length > 0) {

115 | config.headers.cookie = cookies.map((cookie) => ${cookie.name}=${cookie.value}).join("; ");
| ^^^^^^^^^^^^^^
116 | }
117 | return config;
118 | });

Invalid signature using signing message method

Description

I use a method signMessage to sign a message. However, seems like the signature is incorrect. I use this method below to verify

import { sign_detached_verify } from 'tweetnacl-ts';

// Sign the message using walletContext.signMessage => FALSE
const signer = new HexString(walletCtx.account.publicKey?.toString());
const hexMessage = HexString.fromUint8Array(message).toString();
const signature = await walletCtx.signMessage(hexMessage);
sign_detached_verify(
    message,
    new HexString(signature).toUint8Array(),
    signer.toUint8Array()
)

// Sign the message using signHexString of AptosAccount => TRUE
const mockAccount = new AptosAccount();
sign_detached_verify(
    message,
    mockAccount.signHexString(hexMessage).toUint8Array(),
    mockAccount.pubKey().toUint8Array()
)

TypeError: Cannot read properties of null (reading 'useContext')

Just following the tutorial on a next.js setup, and getting TypeError: Cannot read properties of null (reading 'useContext') when trying to call useWallet();

import '../styles/globals.css'
import type { AppProps } from 'next/app'

import {
  WalletProvider,
  HippoWalletAdapter,
  AptosWalletAdapter,
  HippoExtensionWalletAdapter,
  MartianWalletAdapter,
  FewchaWalletAdapter,
  PontemWalletAdapter,
  SpikaWalletAdapter,
  RiseWalletAdapter,
  FletchWalletAdapter,
  TokenPocketWalletAdapter,
  ONTOWalletAdapter,
  SafePalWalletAdapter
} from '@manahippo/aptos-wallet-adapter';

const wallets = [
  new HippoWalletAdapter(),
  new MartianWalletAdapter(),
  new AptosWalletAdapter(),
  new FewchaWalletAdapter(),
  new HippoExtensionWalletAdapter(),
  new PontemWalletAdapter(),
  new SpikaWalletAdapter(),
  new RiseWalletAdapter(),
  new FletchWalletAdapter(),
  new TokenPocketWalletAdapter(),
  new ONTOWalletAdapter(),
  new SafePalWalletAdapter(),
];

function MyApp({ Component, pageProps }: AppProps) {
  <WalletProvider
      wallets={wallets}
      autoConnect={true}
      onError={(error: Error) => {
        console.log('Handle Error Message', error);
      }}>
    <Component {...pageProps} />
  </WalletProvider>
}

export default MyApp
import type { NextPage } from 'next'
import { AptosWalletName, useWallet } from "@manahippo/aptos-wallet-adapter"

const { connect } = useWallet();

const Home: NextPage = () => {
  return (
    <div>
      <button onClick={() => { connect(AptosWalletName); }} > Connect </button>
    </div>
  )
}

export default Home

Screen Shot 2022-10-23 at 4 08 58 PM

Wallet stays connected after disconnecting for one extra event loop

Upon clicking disconnect, the wallet state goes through three stages.

A) Disconnecting: true, connected: true
B) Disconnecting: false, connected: true
C) DIsconnecting: false , connected: false

The B stage makes it difficult to update UI state / data fetching properly, as wallet should be disconnected but still shows connected until one more loop completes. Specifically, calls which refresh user data after disconnect re-fire after resetting (as they should in the react lifecycle) since wallet is still connected and disconnecting is now false.

Is it possible to force disconnecting: false and connected: false to return in the same loop? Would do wonders for UI state management. Or is there another piece of state besides 'disconnecting' to listen to in order to handle this disconnect logic pattern?

Screen Shot 2022-10-17 at 9 37 13 AM

SvelteKit Example

hi is it possible to have a simple SvelteKit example?

I'm a bit confused about how the package work since it need React on useWallet, is the package framework agnostic or do we need to use it using react?

Cannot select and connect in one function

The new wallet adapter does not allow .select(NAME) and .connect() in one function call.

It throws a WalletNotSelectedError.

https://socket.dev/npm/package/@manahippo/aptos-wallet-adapter/files/0.4.2/src/WalletProviders/WalletProvider.tsx#L212

wallet.select(NAME)
wallet.connect() // throws

I think the issue is that .select() uses setName from a useState hook, and this state update does not happen synchronously. The only way I can get this to work is by breaking up the flow into 2 separate React updates.

Importing @manahippo/aptos-wallet-adapter causes React Query not to work: TypeError: Failed to construct 'URL': Invalid URL

I'm trying to use the Aptos Wallet Adapter on a Next.js project that uses React Query and whenever the @manahippo/aptos-wallet-adapter package is imported on any file, it causes all of the React Query queries to fail with this error message: TypeError: Failed to construct 'URL': Invalid URL.
I can't find any issues with this error on React Queries github, and it only happens literally when the @manahippo/aptos-wallet-adapter package is imported (even if nothing is used from it)

Working Slow

Some time We have Take Faucet its take more time And Sometime So Feild. i hope team is workin on this problem

Wallet Bugs

  1. If you close the martian/petra/spika wallet using the cross icon on the top most right side, UI doesn't capture that action and keep waiting. User rejected is only captured when user cancels from the cancel option giving below approve.
  2. Click Aptos wallets opens both petra and spika. Same goes when you click spika
  3. Spika doesn't allow sign message. Probably it has not implemented it.
  4. On clicking Pontem, it logs in automatically without any pop up, even if the wallet is locked. Also it doesn't allow sign mesaage. The hello from account doesn't show account id.

I believe most of it will be wallets issues rather adapter issues.

[Bug] Require update Aptos SDK to v1.3.7 and catch up with the latest devnet release

Issue

I have an app running on devnet. After the Aptos devnet release today and the aptos sdk is updated to v1.3.7. Seems like there's a bug with the aptos-wallet-adapter. I checked the aptos-wallet-adapter and seems like it still use v1.3.6.
Seems like this method breaks due to the recent update https://github.com/hippospace/aptos-wallet-adapter/blob/main/packages/aptos-wallet-adapter/src/utilities/util.ts

Expected behavior

  • Replace script_function_payload to entry_function_payload
  • Update Aptos SDK to v1.3.7

blocto wallet error

I get an error when I use blocto adapter ”Please contact the website owner to upgrade wallet to v2. Check out docs for more details.“

provide chainId in wallet adapter

suggestion: wallet adapter should contain chainId provided by wallet (testnet/mainnet/devnet)
e.g.

await pontem.chainId()
await martian.getChainId()
await fewcha.getNetworkURL() // here we need map url to chainId

React Wallet Tester Can't resolve '@manahippo/aptos-wallet-adapter' Error

When I install wallet tester package, I got "Can't resolve '@manahippo/aptos-wallet-adapter'" error like screenshot.
React App
I already checked package.json file and changed the code line like this.
"@manahippo/aptos-wallet-adapter": "^1.0.2",
Then, installed aptos wallet adapter again, but still same error.
How can I solve this problem?
PS: If I check the node_module folder, I can't find aptos wallet adaptor package.

Unexpected token 'export'

SyntaxError: Unexpected token 'export'

at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/alex/Projects/Other/Aptos-NFT-Mint/mint-site/node_modules/@manahippo/aptos-wallet-adapter/dist/WalletAdapters/MsafeWallet.js:16:24)
at Module._compile (node:internal/modules/cjs/loader:1105:14) {

page: '/'
}

MsafeWallet.js:

const msafe_iframe_1 = require("msafe-iframe");`

msafe-iframe:

export * from './MsafeServer';
export * from './MsafeWallet';
export * from './WalletAPI';

WalletNotReadyError on page refresh with autoconnect=true

With autoconnect enabled to true and wallet connected, we get WalletNotReadyError on page refresh. It redirects to the chrome extension page of that connected wallet.

Console output:

selectedWallets {adapter: MartianWalletAdapter, readyState: 'NotDetected'}
App.tsx:56 wallet errors:  WalletNotReadyError
    at WalletProvider.tsx:243:1
    at commitHookEffectListMount (react-dom.development.js:23150:1)
    at commitPassiveMountOnFiber (react-dom.development.js:24926:1)
    at commitPassiveMountEffects_complete (react-dom.development.js:24891:1)
    at commitPassiveMountEffects_begin (react-dom.development.js:24878:1)
    at commitPassiveMountEffects (react-dom.development.js:24866:1)
    at flushPassiveEffectsImpl (react-dom.development.js:27039:1)
    at flushPassiveEffects (react-dom.development.js:26984:1)
    at react-dom.development.js:26769:1
    at workLoop (scheduler.development.js:266:1)

how to use Msafe v2 with wallet adapter

how to use Msafe v2 with wallet adapter now when click connect Msafe redirect to v1.
new MSafeWalletAdapter('https://app.m-safe.io/aptos/v2')
I switched origin v2 but it is still redirected to msafe v1

clean up deps and correctly specify dev/peer deps

Hey,

First of all thanks for taking a lift and making a great abstraction on top of other wallets!

Just wanna to propose a small improvement, is to correctly distribute deps to peer and dev one.
For example, you have @types/*(https://github.com/hippospace/aptos-wallet-adapter/blob/main/packages/aptos-wallet-adapter/package.json#L30) deps and dependencies, but it should be in devDependencies, otherwise it might lead to the types conflicts, especially for the projects that uses react^17.

And the second one is to move aptos to peer dependency(https://github.com/hippospace/aptos-wallet-adapter/blob/main/packages/aptos-wallet-adapter/package.json#L32), since the host app should force the version.

As a reference please check how deps well structured in solana wallet adapter: https://github.com/solana-labs/wallet-adapter/blob/master/packages/core/base/package.json

Thanks!

provide wallet install url in adapter

suggestion: each wallet adapter should provide installUrl pointing to extension or website
e.g.

Fewcha: 'https://fewcha.app/'
Martian: 'https://martianwallet.xyz/'
Pontem: 'https://pontem.network/'

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.