{"size": 949, "ext": "js", "max_stars_repo_path": "src/IERC20.js", "max_stars_repo_name": "Link-Key/sns-app-contract-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/IERC20.js", "max_issues_repo_name": "Link-Key/sns-app-contract-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/IERC20.js", "max_forks_repo_name": "Link-Key/sns-app-contract-api", "max_forks_repo_forks_event_min_datetime": "2022-03-16T03:21:43.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T03:21:43.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 23.1463414634, "max_line_length": 91, "alphanum_fraction": 0.6438356164}
import { getIERC20Contract } from './contracts'
import {
    getSigner
} from './web3'

export class SNSIERC20 {

    constructor({ registryAddress, provider }) {

        if (!registryAddress) {
            throw new Error(`Unsupported network`)
        }

        this.registryAddress = registryAddress

        const SNSIERC20Contract = getIERC20Contract({ address: registryAddress, provider })
        this.SNSIERC20 = SNSIERC20Contract
    }

    /* Get the raw Ethers contract object */
    getSNSIERC20ContractInstance() {
        return this.SNSIERC20
    }

    /* Main methods */

    // Get the SNS Approval
    async approve(address, amount) {
        const singner = await getSigner();
        const IERC20Instance = this.SNSIERC20.connect(singner);
        return await IERC20Instance.approve(address, amount)
    }

    // 
    async allowance(owner, spender) {
        return await this.SNSIERC20.allowance(owner, spender)
    }


}
