@biconomy-devx/ethers-lib
Version:
Ethers library adapter to be used by Biconomy SDK
48 lines • 1.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
class SmartWalletContractEthers {
constructor(contract) {
this.contract = contract;
/* eslint-disable @typescript-eslint/no-explicit-any */
this.encode = (methodName, params) => {
return this.contract.interface.encodeFunctionData(methodName, params);
};
}
getInterface() {
return this.contract.interface;
}
getContract() {
return this.contract;
}
getAddress() {
return this.contract.address;
}
setAddress(address) {
this.contract.attach(address);
}
async getOwner() {
return await this.contract.owner();
}
async getVersion() {
return (await this.contract.VERSION());
}
async getNonce(batchId) {
return await this.contract.getNonce(batchId);
}
async nonce() {
return await this.contract.nonce();
}
async isValidSignature(_dataHash, _signature) {
return this.contract.isValidSignature(_dataHash, _signature);
}
async getTransactionHash(smartAccountTrxData) {
return this.contract.getTransactionHash(smartAccountTrxData.to, smartAccountTrxData.value, smartAccountTrxData.data, smartAccountTrxData.operation, smartAccountTrxData.targetTxGas, smartAccountTrxData.baseGas, smartAccountTrxData.gasPrice, smartAccountTrxData.tokenGasPriceFactor, smartAccountTrxData.gasToken, smartAccountTrxData.refundReceiver, smartAccountTrxData.nonce);
}
async execTransaction(_tx, refundInfo, signatures) {
const txResponse = await this.contract.execTransaction(_tx, refundInfo, signatures);
return (0, utils_1.toTxResult)(txResponse);
}
}
exports.default = SmartWalletContractEthers;
//# sourceMappingURL=SmartWalletContractEthers.js.map