Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const tx = _classPrivateFieldGet(this, _contract)[f.name].apply(null, args);
const subscription = new Subscription(tx, _classPrivateFieldGet(this, _provider3));
return subscription;
};
}
});
if (!Utils.isAddress(address) || !Utils.isABI(abi)) throw new Error(`Cannot create a Contract without a address and ABI`);
_classPrivateFieldSet(this, _provider3, _classPrivateFieldGet(this, _getDefaultProvider).call(this));
const signerOrProvider = _wallet ? _wallet.connect(_classPrivateFieldGet(this, _provider3)) : _classPrivateFieldGet(this, _provider3);
_classPrivateFieldSet(this, _contract, new _ethers.ethers.Contract(address, abi, signerOrProvider));
this.address = _classPrivateFieldGet(this, _contract).address;
_classPrivateFieldGet(this, _addFunctionsToContract).call(this);
} // Note: For now, `tasit-account` creates a wallet object
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = __importDefault(require("fs"));
var path_1 = require("path");
var ethers_1 = require("ethers");
var scrypt = __importStar(require("scrypt-js"));
var prompt_1 = require("./prompt");
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var UsageError = /** @class */ (function (_super) {
__extends(UsageError, _super);
function UsageError() {
return _super !== null && _super.apply(this, arguments) || this;
}
return UsageError;
}(Error));
/////////////////////////////
// Signer
/*
const signerStates = new WeakMap();
class SignerState {
signerFunc: () => Promise;
signer: ethers.Signer;
alwaysAllow: boolean;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers");
var errors = ethers_1.ethers.errors;
var constants = ethers_1.ethers.constants;
var utils = ethers_1.ethers.utils;
var basex = function (ALPHABET) {
/**
* Contributors:
*
* base-x encoding
* Forked from https://github.com/cryptocoinjs/bs58
* Originally written by Mike Hearn for BitcoinJ
* Copyright (c) 2011 Google Inc
* Ported to JavaScript by Stefan Thomas
* Merged Buffer refactorings from base58-native by Stephen Pair
* Copyright (c) 2013 BitPay Inc
*
* The MIT License (MIT)
*
function compile(source, options) {
options = ethers_1.ethers.utils.shallowCopy(options || {});
if (options.filename && !options.basedir) {
options.basedir = path_1.dirname(options.filename);
}
if (!options.filename) {
options.filename = "_contract.sol";
}
if (!options.basedir) {
options.basedir = ".";
}
var sources = {};
sources[options.filename] = { content: source };
var input = {
language: "Solidity",
sources: sources,
settings: {
outputSelection: {
function computeHash(content) {
var bareContent = content.replace(/\/\*\* Content Hash: 0x[0-9A-F]{64} \*\//i, '/** Content Hash: */');
return ethers_1.ethers.utils.id(bareContent);
}
function checkHash(content) {
function RetryProvider(provider, options) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, RetryProvider);
_this = _super.call(this, provider.getNetwork()) || this;
ethers_1.ethers.utils.defineReadOnly(_this, "provider", provider);
ethers_1.ethers.utils.defineReadOnly(_this, "options", options || {});
return _this;
}
RetryProvider.prototype.perform = function (method, params) {
if (!context.require) {
context.require = require;
}
if (!context.process) {
context.process = process;
}
context.ethers = ethers_1.ethers;
context.version = ethers_1.ethers.version;
context.Contract = ethers_1.ethers.Contract;
context.ContractFactory = ethers_1.ethers.ContractFactory;
context.Wallet = ethers_1.ethers.Wallet;
context.providers = ethers_1.ethers.providers;
context.utils = ethers_1.ethers.utils;
context.abiCoder = ethers_1.ethers.utils.defaultAbiCoder;
context.BN = ethers_1.ethers.BigNumber;
context.BigNumber = ethers_1.ethers.BigNumber;
context.FixedNumber = ethers_1.ethers.FixedNumber;
context.getAddress = ethers_1.ethers.utils.getAddress;
context.getContractAddress = ethers_1.ethers.utils.getContractAddress;
context.getIcapAddress = ethers_1.ethers.utils.getIcapAddress;
context.arrayify = ethers_1.ethers.utils.arrayify;
context.hexlify = ethers_1.ethers.utils.hexlify;
context.joinSignature = ethers_1.ethers.utils.joinSignature;
context.splitSignature = ethers_1.ethers.utils.splitSignature;
context.id = ethers_1.ethers.utils.id;
context.keccak256 = ethers_1.ethers.utils.keccak256;
context.namehash = ethers_1.ethers.utils.namehash;
context.sha256 = ethers_1.ethers.utils.sha256;
context.parseEther = ethers_1.ethers.utils.parseEther;
context.parseUnits = ethers_1.ethers.utils.parseUnits;
context.formatEther = ethers_1.ethers.utils.formatEther;
context.formatUnits = ethers_1.ethers.utils.formatUnits;
return scrypt_js_1.scrypt(passwordBytes, usernameBytes, (1 << 18), 8, 1, 32, progressCallback).then(function (key) {
if (legacy) {
return new BrainWallet(key);
}
var mnemonic = ethers_1.ethers.utils.entropyToMnemonic(ethers_1.ethers.utils.arrayify(key).slice(0, 16));
return new BrainWallet(ethers_1.ethers.Wallet.fromMnemonic(mnemonic));
});
};
BrainWallet.generate = function (username, password, progressCallback) {
return BrainWallet._generate(username, password, false, progressCallback);
};
BrainWallet.generateLegacy = function (username, password, progressCallback) {
return BrainWallet._generate(username, password, true, progressCallback);
};
return BrainWallet;
}(ethers_1.ethers.Wallet));
exports.BrainWallet = BrainWallet;