Open lieuzhenghong opened 3 years ago
Not sure where to put this, but trying to build the example page with
sol-wallet-adapter 0.2.5
andanchor 0.11.1
gives a type mismatch.Argument of type 'import("..../node_modules/@project-serum/sol-wallet-adapter/dist/cjs/index").default' is not assignable to parameter of type 'import(".../node_modules/@project-serum/anchor/dist/provider").Wallet'. Types of property 'publicKey' are incompatible. Type 'PublicKey | null' is not assignable to type 'PublicKey'. Type 'null' is not assignable to type 'PublicKey'. TS2345 139 | onTransaction: (tx: TransactionSignature | undefined, err?: Error) => void 140 | ) { > 141 | super(connection, wallet, opts); | ^ 142 | this.onTransaction = onTransaction; 143 | } 144 |
I believe this migration to Typescript in sol-wallet-adapter was the one that broke it: here.
We can see the
export interface Wallet
inanchor/ts/provider.ts
still uses PublicKey instead ofPublicKey | null
here.
As a workaround, you can use // @ts-ignore
.
I am Facing the same issue here, any working solutions ?
I have the same issue here as well I fixed it by doing:
const { publicKey, wallet, signTransaction, signAllTransactions } = useWallet();
if (!wallet || !publicKey || !signTransaction || !signAllTransactions) {
return;
}
const signerWallet = {
publicKey: publicKey,
signTransaction: signTransaction,
signAllTransactions: signAllTransactions,
};
const provider = new Provider(connection, signerWallet, {
preflightCommitment: "recent",
});
Not sure where to put this, but trying to build the example page with
sol-wallet-adapter 0.2.5
andanchor 0.11.1
gives a type mismatch.I believe this migration to Typescript in sol-wallet-adapter was the one that broke it: here.
We can see the
export interface Wallet
inanchor/ts/provider.ts
still uses PublicKey instead ofPublicKey | null
here.