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

Working example with Anchor SDK #43

Open
callensm opened this issue Aug 26, 2021 · 3 comments
Open

Working example with Anchor SDK #43

callensm opened this issue Aug 26, 2021 · 3 comments

Comments

@callensm
Copy link

Are there any working examples of integrating the @project-serum/anchor library with this adapter or with the @solana/wallet-adapter components?

There seems to be a misalignment in the type definitions for the interface of a wallet adapter/provider and can't get them to work together properly.

image

@armaniferrante
Copy link
Contributor

Are there any working examples of integrating the @project-serum/anchor library with this adapter or with the @solana/wallet-adapter components?

There seems to be a misalignment in the type definitions for the interface of a wallet adapter/provider and can't get them to work together properly.

image

I think this issue is in the wrong repo :).

But the anchor wallet has the following interface

export interface Wallet {
  signTransaction(tx: Transaction): Promise<Transaction>;
  signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
  publicKey: PublicKey;
}

So you can just make a new class that implements it and wraps your adapter. An adapter for the adapter.

@callensm
Copy link
Author

@armaniferrante but the @solana/wallet-adapter package includes classes that do the exact same thing, there's just a tiny typing conflict between them but aim to accomplish the same thing.

I'm trying to avoid writing my own adapter implementations for the wallet we want to support and use the ones that the Solana Labs team has already built and bundled with their library.

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

3 participants
@armaniferrante @callensm and others