@aut-labs/sdk
Version:
The TS/JS SDK package aims to make it easy for frontends/backends to integrate with Aut Smart Contracts
49 lines • 1.74 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class SDKContractBase {
constructor(_address, _multiSignerOrProvider, _biconomyWrapper, _type) {
this._address = _address;
this._multiSignerOrProvider = _multiSignerOrProvider;
this._biconomyWrapper = _biconomyWrapper;
this._type = _type;
this.init(this._type);
this._biconomy = this._biconomyWrapper;
}
get multiSigner() {
return this._multiSigner;
}
set multiSigner(multiSigner) {
this._multiSigner = multiSigner;
}
init(type) {
this.multiSigner = this._multiSignerOrProvider;
// if ((this._signerOrProvider as ethers.providers.Web3Provider)._isProvider) {
// this.signer = (
// this._signerOrProvider as ethers.providers.Web3Provider
// )?.getSigner();
// }
const functions = type(this._address, {
skipEvent: true,
readOnlySigner: () => this.multiSigner.readOnlySigner,
signer: () => this.multiSigner.signer
});
this.functions = functions;
this.contract = functions;
}
get signerAddress() {
return this.multiSigner.signer.getAddress();
}
canSendEIP712Transaction(address) {
if (!this._biconomy || this.skipBiconomy)
return;
return this._biconomy.canSendEIP712Transaction(address);
}
async sendEIP712Transaction(data) {
if (!this._biconomy) {
throw new Error("Biconomy has not been initialized!");
}
return this._biconomy.sendEIP712Transaction(this.contract, data);
}
}
exports.default = SDKContractBase;
//# sourceMappingURL=base.contract.js.map