- I'm using the next.js framework to create a front-end application for polkadot.js.
- I'm trying to get an account from extention and implement the "signAndSend" function to call the function of the contract I implemented. I'll paste the code snippet below.
- I get the following compilation error, why?
code snipet:
const injector = await web3FromSource(performingAccount.meta.source);
const keyring = new Keyring({ type: 'sr25519' });
// const accountKeyring = keyring.addFromUri('//Alice');
const accountKeyring = keyring.addFromAddress(performingAccount.address);
const flip = await contract.tx.flip({ value: 0, gasLimit: -1 });
flip.signAndSend(accountKeyring,{signer:injector.signer},(result) => {
if (result.status.isInBlock) {
setResult("in a block");
} else if (result.status.isFinalized) {
setResult("finalized");
}
});
compile error:
(property) signer?: Signer | undefined
Type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/rpc-core/node_modules/@polkadot/types/types/extrinsic").Signer' is not assignable to type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/api-contract/node_modules/@polkadot/types/types/extrinsic").Signer'.
Types of property 'update' are incompatible.
Type '((id: number, status: H256 | ISubmittableResult) => void) | undefined' is not assignable to type '((id: number, status: ISubmittableResult | H256) => void) | undefined'.
Type '(id: number, status: H256 | ISubmittableResult) => void' is not assignable to type '(id: number, status: ISubmittableResult | H256) => void'.
Types of parameters 'status' and 'status' are incompatible.
Type 'ISubmittableResult | H256' is not assignable to type 'H256 | ISubmittableResult'.
Type 'ISubmittableResult' is not assignable to type 'H256 | ISubmittableResult'.
Type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/api-contract/node_modules/@polkadot/types/types/extrinsic").ISubmittableResult' is not assignable to type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/rpc-core/node_modules/@polkadot/types/types/extrinsic").ISubmittableResult'.
Types of property 'dispatchError' are incompatible.
Type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/api-contract/node_modules/@polkadot/types/interfaces/system/types").DispatchError | undefined' is not assignable to type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/rpc-core/node_modules/@polkadot/types/interfaces/system/types").DispatchError | undefined'.
Property '#private' is missing in type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/api-contract/node_modules/@polkadot/types/interfaces/system/types").DispatchError' but required in type 'import("/Users/shin.takahashi/develop/substrate/flipper_frontend/fillper_frontend/node_modules/@polkadot/rpc-core/node_modules/@polkadot/types/interfaces/system/types").DispatchError'.ts(2322)
Enum.d.ts(27, 5): '#private' is declared here.
submittable.d.ts(17, 5): The expected type comes from property 'signer' which is declared here on type 'Partial<SignerOptions>'