I'm trying to connect a webapp to Temple wallet with Taquito. I'm not an expert of Typescript, I'm learning on the way, and I have a problem.
Here's my TS code:
import { BeaconWallet } from '@taquito/beacon-wallet';
import { TezosToolkit } from '@taquito/taquito';
(async () => {
const Tezos = new TezosToolkit('https://testnet-tezos.giganode.io');
const options = {
name: 'avatez'
};
const wallet = new BeaconWallet(options);
await wallet.requestPermissions({ network: { type: "hangzhounet" } });
Tezos.setWalletProvider(wallet);
const userAddress = await wallet.getPKH();
console.log(userAddress);
});
When I do npx tsc
, I get
src/tezos.ts:13:50 - error TS2322: Type '"hangzhounet"' is not assignable to type 'NetworkType'.
13 await wallet.requestPermissions({ network: { type: "hangzhounet" } });
~~~~
node_modules/@airgap/beacon-sdk/dist/cjs/types/beacon/Network.d.ts:3:5
3 type: NetworkType;
~~~~
The expected type comes from property 'type' which is declared here on type 'Network'
Found 1 error.
But reading this: https://tezostaquito.io/docs/wallet_api/, it should be Ok. Do you see what is wrong here ?