Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static create(address: string, provider: IRpcMethod): Vita {
const vita = new Vita();
vita.address = address;
vita.provider = provider;
vita.contract = new Contract(ABI, address, {
provider: provider
});
const methods = {};
// @ts-ignore
for (const fnName of Object.keys(vita.contract.getABI())) {
// @ts-ignore
const fnAbi = vita.contract.getABI()[fnName];
if (fnAbi.type === "constructor") {
continue;
}
const args = getArgTypes(fnAbi);
const header = getHeaderHash(fnAbi, args);
// @ts-ignore
public static create(
address: string,
provider: IRpcMethod,
abi: Array = ABI
): ERC20 {
const erc20 = new ERC20();
erc20.address = address;
erc20.provider = provider;
erc20.contract = new Contract(abi, address, {
provider: provider
});
const methods = {};
// @ts-ignore
for (const fnName of Object.keys(erc20.contract.getABI())) {
// @ts-ignore
const fnAbi = erc20.contract.getABI()[fnName];
if (fnAbi.type === "constructor") {
continue;
}
const args = getArgTypes(fnAbi);
const header = getHeaderHash(fnAbi, args);
// @ts-ignore
this.props.form.validateFields(async (err, values) => {
if (err) {
return;
}
const { contractAddress, abi, selectedFunction, args = [] } = values;
const contract = new Contract(JSON.parse(abi), contractAddress);
const bytecode = contract
.pureEncodeMethod("0", selectedFunction, ...args)
.data.toString("hex");
copyCB(bytecode);
});
};