getContract TypeScript args not assignable - @wagmi/core #1958
-
|
Hi all, I try to get a contract by the I tried to do it like in the documentation, but don't understand the actual issue. Can someone help, please? This is how the component looks like (Note that the error remains even if I fill out the address and abi variables): import { Component, OnInit } from '@angular/core';
import { getContract } from '@wagmi/core';
@Component({
selector: 'app-balances',
templateUrl: './balances.component.html',
styleUrls: ['./balances.component.scss']
})
export class BalancesComponent implements OnInit {
constructor() {}
async ngOnInit() {
const address = '0x1234' as const;
const abi = [] as const;
const contract = getContract({
address,
abi
})
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I solved it by looking into the actual import { GetContractArgs, getContract } from '@wagmi/core';
.
.
.
contractAddress: string = '0x134...';
abi: ContractInterface = [{"type":"constructor","payable":false,"inputs":[{ .... ..... .... ;
async ngOnInit() {
.
.
.
let getContractInput: GetContractArgs = {addressOrName: this.contractAddress, contractInterface: this.abi};
.
.
}``` |
Beta Was this translation helpful? Give feedback.
I solved it by looking into the actual
getContractfunction and by importing theGetContractArgstype as follows