UNPKG

@verified-network/verified-sdk

Version:

An SDK to develop applications on the Verified Network

60 lines (59 loc) 2.72 kB
"use strict"; // SPDX-License-Identifier: BUSL-1.1 // @ts-nocheck Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../index"); const Rates_json_1 = require("../../abi/payments/Rates.json"); var FUNCTIONS; (function (FUNCTIONS) { FUNCTIONS["SETFEETO"] = "setFeeTo"; FUNCTIONS["GETFEE"] = "getFee"; FUNCTIONS["SETFEETOSETTER"] = "setFeeToSetter"; FUNCTIONS["SETCUSTODIAN"] = "setCustodian"; FUNCTIONS["SETDISTRIBUTOR"] = "setDistributor"; FUNCTIONS["GETFEETOSETTER"] = "getFeeToSetter"; FUNCTIONS["GETCUSTODIAN"] = "getCustodian"; FUNCTIONS["GETDISTRIBUTOR"] = "getDistributor"; })(FUNCTIONS || (FUNCTIONS = {})); class Rates extends index_1.VerifiedContract { constructor(signer, contractNetworkAddress) { const address = contractNetworkAddress; super(address, JSON.stringify(Rates_json_1.abi), signer); this.contractAddress = address; } async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) { return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative); } async setFeeTo(_feeTo, _fee, _feeType, options) { await this.validateInput(index_1.DATATYPES.ADDRESS, _feeTo); await this.validateInput(index_1.DATATYPES.NUMBER, _fee); await this.validateInput(index_1.DATATYPES.STRING, _feeType); return this.callContract(FUNCTIONS.SETFEETO, _feeTo, _fee, this.sanitiseInput(index_1.DATATYPES.BYTE32, _feeType), options); } async setFeeToSetter(_feeToSetter, options) { await this.validateInput(index_1.DATATYPES.ADDRESS, _feeToSetter); return this.callContract(FUNCTIONS.SETFEETOSETTER, _feeToSetter, options); } async setCustodian(_custodian, options) { await this.validateInput(index_1.DATATYPES.ADDRESS, _custodian); return this.callContract(FUNCTIONS.SETCUSTODIAN, _custodian, options); } async setDistributor(_distributor, options) { await this.validateInput(index_1.DATATYPES.ADDRESS, _distributor); return this.callContract(FUNCTIONS.SETCUSTODIAN, _distributor, options); } async getFee(_feeType, options) { await this.validateInput(index_1.DATATYPES.STRING, _feeType); return this.callContract(FUNCTIONS.GETFEE, this.sanitiseInput(index_1.DATATYPES.BYTE32, _feeType), options); } async getFeeToSetter() { return this.callContract(FUNCTIONS.GETFEETOSETTER); } async getCustodian() { return this.callContract(FUNCTIONS.GETCUSTODIAN); } async getDistributor() { return this.callContract(FUNCTIONS.GETDISTRIBUTOR); } } exports.default = Rates;