hippospace / aptos-wallet-adapter Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
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 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?
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 | });
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()
)
Ignore
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
I have a problem with the MSafe Wallet Adapter,
I can make work the other wallet adapters with no issue.
I have the latest version of the module, and always shows Unsupported
I am following this guide: https://doc.m-safe.io/momentum-safe/developers/integrate-with-msafe-dapp/use-aptos-wallet-adaptor
Then I read in other sites that need to be inside an iframe to work.
What does this mean?
Thanks for the help
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?
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?
The new wallet adapter does not allow .select(NAME)
and .connect()
in one function call.
It throws a WalletNotSelectedError
.
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.
fewcha/aptos/dist/api/http-client.js
This is broken with NextJS. Is the fewcha sdk a required dependency?
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)
Some time We have Take Faucet its take more time And Sometime So Feild. i hope team is workin on this problem
I believe most of it will be wallets issues rather adapter issues.
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
script_function_payload
to entry_function_payload
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.“
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
Pontem wallet seems to be good
When I install wallet tester package, I got "Can't resolve '@manahippo/aptos-wallet-adapter'" error like screenshot.
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.
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';
Using @manahippo/[email protected], with [email protected] (latest) results in this error.
it seems the Aptos developers have changed to distributing using a bundle, including bundled types (aptos/dist/index.d.ts
)
I might make a follow up PR to switch over, as this seems like a simple enough change - as I need to use the latest version of the Aptos SDK.
Message signing isn't supported in the adapter yet.
Does anyone know how to get a wallet balance in the amount of APT ?
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 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
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!
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/'
The icon url is https://liquidswap.pontem.network/img/logo.87454209.svg which appears to be a broken link.
GET https://fullnode.devnet.aptoslabs.com/v1/transactions/by_hash/ 404
Getting 404 error after submitting transaction. This used to works few days back.
Good entire but slow swap
https://petra.app/docs/signing-a-message
seems petra and martian wallets have changed the params of the method signMessage
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.