@ethersproject/contracts
Advanced tools
Comparing version 5.0.12 to 5.1.0
@@ -1,2 +0,2 @@ | ||
export declare const version = "contracts/5.0.12"; | ||
export declare const version = "contracts/5.1.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = "contracts/5.0.12"; | ||
export const version = "contracts/5.1.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -6,2 +6,3 @@ import { Fragment, Indexed, Interface, JsonFragment, Result } from "@ethersproject/abi"; | ||
import { BytesLike } from "@ethersproject/bytes"; | ||
import { AccessList, AccessListish } from "@ethersproject/transactions"; | ||
export interface Overrides { | ||
@@ -11,2 +12,4 @@ gasLimit?: BigNumberish | Promise<BigNumberish>; | ||
nonce?: BigNumberish | Promise<BigNumberish>; | ||
type?: number; | ||
accessList?: AccessListish; | ||
} | ||
@@ -29,2 +32,4 @@ export interface PayableOverrides extends Overrides { | ||
chainId?: number; | ||
type?: number; | ||
accessList?: AccessList; | ||
} | ||
@@ -67,4 +72,4 @@ export declare type EventFilter = { | ||
} | ||
export declare type ContractInterface = string | Array<Fragment | JsonFragment | string> | Interface; | ||
export declare class Contract { | ||
export declare type ContractInterface = string | ReadonlyArray<Fragment | JsonFragment | string> | Interface; | ||
export declare class BaseContract { | ||
readonly address: string; | ||
@@ -89,3 +94,2 @@ readonly interface: Interface; | ||
}; | ||
readonly [key: string]: ContractFunction | any; | ||
readonly resolvedAddress: Promise<string>; | ||
@@ -127,2 +131,5 @@ readonly deployTransaction: TransactionResponse; | ||
} | ||
export declare class Contract extends BaseContract { | ||
readonly [key: string]: ContractFunction | any; | ||
} | ||
export declare class ContractFactory { | ||
@@ -129,0 +136,0 @@ readonly interface: Interface; |
@@ -18,3 +18,3 @@ "use strict"; | ||
import { defineReadOnly, deepCopy, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties"; | ||
// @TOOD remove dependences transactions | ||
import { accessListify } from "@ethersproject/transactions"; | ||
import { Logger } from "@ethersproject/logger"; | ||
@@ -27,3 +27,4 @@ import { version } from "./_version"; | ||
const allowedTransactionKeys = { | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true, | ||
type: true, accessList: true, | ||
}; | ||
@@ -137,2 +138,8 @@ function resolveName(resolver, nameOrPromise) { | ||
} | ||
if (ro.type != null) { | ||
tx.type = ro.type; | ||
} | ||
if (ro.accessList != null) { | ||
tx.accessList = accessListify(ro.accessList); | ||
} | ||
// If there was no "gasLimit" override, but the ABI specifies a default, use it | ||
@@ -172,2 +179,4 @@ if (tx.gasLimit == null && fragment.gas != null) { | ||
delete overrides.value; | ||
delete overrides.type; | ||
delete overrides.accessList; | ||
// Make sure there are no stray overrides, which may indicate a | ||
@@ -444,3 +453,3 @@ // typo or using an unsupported key. | ||
} | ||
export class Contract { | ||
export class BaseContract { | ||
constructor(addressOrName, contractInterface, signerOrProvider) { | ||
@@ -562,5 +571,9 @@ logger.checkNew(new.target, Contract); | ||
const signature = signatures[0]; | ||
if (this[name] == null) { | ||
defineReadOnly(this, name, this[signature]); | ||
// If overwriting a member property that is null, swallow the error | ||
try { | ||
if (this[name] == null) { | ||
defineReadOnly(this, name, this[signature]); | ||
} | ||
} | ||
catch (e) { } | ||
if (this.functions[name] == null) { | ||
@@ -861,2 +874,4 @@ defineReadOnly(this.functions, name, this.functions[signature]); | ||
} | ||
export class Contract extends BaseContract { | ||
} | ||
export class ContractFactory { | ||
@@ -863,0 +878,0 @@ constructor(contractInterface, bytecode, signer) { |
@@ -1,2 +0,2 @@ | ||
export declare const version = "contracts/5.0.12"; | ||
export declare const version = "contracts/5.1.0"; | ||
//# sourceMappingURL=_version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = "contracts/5.0.12"; | ||
exports.version = "contracts/5.1.0"; | ||
//# sourceMappingURL=_version.js.map |
@@ -6,2 +6,3 @@ import { Fragment, Indexed, Interface, JsonFragment, Result } from "@ethersproject/abi"; | ||
import { BytesLike } from "@ethersproject/bytes"; | ||
import { AccessList, AccessListish } from "@ethersproject/transactions"; | ||
export interface Overrides { | ||
@@ -11,2 +12,4 @@ gasLimit?: BigNumberish | Promise<BigNumberish>; | ||
nonce?: BigNumberish | Promise<BigNumberish>; | ||
type?: number; | ||
accessList?: AccessListish; | ||
} | ||
@@ -29,2 +32,4 @@ export interface PayableOverrides extends Overrides { | ||
chainId?: number; | ||
type?: number; | ||
accessList?: AccessList; | ||
} | ||
@@ -67,4 +72,4 @@ export declare type EventFilter = { | ||
} | ||
export declare type ContractInterface = string | Array<Fragment | JsonFragment | string> | Interface; | ||
export declare class Contract { | ||
export declare type ContractInterface = string | ReadonlyArray<Fragment | JsonFragment | string> | Interface; | ||
export declare class BaseContract { | ||
readonly address: string; | ||
@@ -89,3 +94,2 @@ readonly interface: Interface; | ||
}; | ||
readonly [key: string]: ContractFunction | any; | ||
readonly resolvedAddress: Promise<string>; | ||
@@ -127,2 +131,5 @@ readonly deployTransaction: TransactionResponse; | ||
} | ||
export declare class Contract extends BaseContract { | ||
readonly [key: string]: ContractFunction | any; | ||
} | ||
export declare class ContractFactory { | ||
@@ -129,0 +136,0 @@ readonly interface: Interface; |
@@ -59,3 +59,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContractFactory = exports.Contract = void 0; | ||
exports.ContractFactory = exports.Contract = exports.BaseContract = void 0; | ||
var abi_1 = require("@ethersproject/abi"); | ||
@@ -68,3 +68,3 @@ var abstract_provider_1 = require("@ethersproject/abstract-provider"); | ||
var properties_1 = require("@ethersproject/properties"); | ||
// @TOOD remove dependences transactions | ||
var transactions_1 = require("@ethersproject/transactions"); | ||
var logger_1 = require("@ethersproject/logger"); | ||
@@ -77,3 +77,4 @@ var _version_1 = require("./_version"); | ||
var allowedTransactionKeys = { | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true, | ||
type: true, accessList: true, | ||
}; | ||
@@ -209,2 +210,8 @@ function resolveName(resolver, nameOrPromise) { | ||
} | ||
if (ro.type != null) { | ||
tx.type = ro.type; | ||
} | ||
if (ro.accessList != null) { | ||
tx.accessList = transactions_1.accessListify(ro.accessList); | ||
} | ||
// If there was no "gasLimit" override, but the ABI specifies a default, use it | ||
@@ -239,2 +246,4 @@ if (tx.gasLimit == null && fragment.gas != null) { | ||
delete overrides.value; | ||
delete overrides.type; | ||
delete overrides.accessList; | ||
leftovers = Object.keys(overrides).filter(function (key) { return (overrides[key] != null); }); | ||
@@ -573,4 +582,4 @@ if (leftovers.length) { | ||
}(RunningEvent)); | ||
var Contract = /** @class */ (function () { | ||
function Contract(addressOrName, contractInterface, signerOrProvider) { | ||
var BaseContract = /** @class */ (function () { | ||
function BaseContract(addressOrName, contractInterface, signerOrProvider) { | ||
var _newTarget = this.constructor; | ||
@@ -697,5 +706,9 @@ var _this = this; | ||
var signature = signatures[0]; | ||
if (_this[name] == null) { | ||
properties_1.defineReadOnly(_this, name, _this[signature]); | ||
// If overwriting a member property that is null, swallow the error | ||
try { | ||
if (_this[name] == null) { | ||
properties_1.defineReadOnly(_this, name, _this[signature]); | ||
} | ||
} | ||
catch (e) { } | ||
if (_this.functions[name] == null) { | ||
@@ -715,6 +728,6 @@ properties_1.defineReadOnly(_this.functions, name, _this.functions[signature]); | ||
} | ||
Contract.getContractAddress = function (transaction) { | ||
BaseContract.getContractAddress = function (transaction) { | ||
return address_1.getContractAddress(transaction); | ||
}; | ||
Contract.getInterface = function (contractInterface) { | ||
BaseContract.getInterface = function (contractInterface) { | ||
if (abi_1.Interface.isInterface(contractInterface)) { | ||
@@ -726,6 +739,6 @@ return contractInterface; | ||
// @TODO: Allow timeout? | ||
Contract.prototype.deployed = function () { | ||
BaseContract.prototype.deployed = function () { | ||
return this._deployed(); | ||
}; | ||
Contract.prototype._deployed = function (blockTag) { | ||
BaseContract.prototype._deployed = function (blockTag) { | ||
var _this = this; | ||
@@ -760,3 +773,3 @@ if (!this._deployedPromise) { | ||
// estimateDeploy(bytecode: string, ...args): Promise<BigNumber> | ||
Contract.prototype.fallback = function (overrides) { | ||
BaseContract.prototype.fallback = function (overrides) { | ||
var _this = this; | ||
@@ -779,3 +792,3 @@ if (!this.signer) { | ||
// Reconnect to a different signer or provider | ||
Contract.prototype.connect = function (signerOrProvider) { | ||
BaseContract.prototype.connect = function (signerOrProvider) { | ||
if (typeof (signerOrProvider) === "string") { | ||
@@ -791,9 +804,9 @@ signerOrProvider = new abstract_signer_1.VoidSigner(signerOrProvider, this.provider); | ||
// Re-attach to a different on-chain instance of this contract | ||
Contract.prototype.attach = function (addressOrName) { | ||
BaseContract.prototype.attach = function (addressOrName) { | ||
return new (this.constructor)(addressOrName, this.interface, this.signer || this.provider); | ||
}; | ||
Contract.isIndexed = function (value) { | ||
BaseContract.isIndexed = function (value) { | ||
return abi_1.Indexed.isIndexed(value); | ||
}; | ||
Contract.prototype._normalizeRunningEvent = function (runningEvent) { | ||
BaseContract.prototype._normalizeRunningEvent = function (runningEvent) { | ||
// Already have an instance of this event running; we can re-use it | ||
@@ -805,3 +818,3 @@ if (this._runningEvents[runningEvent.tag]) { | ||
}; | ||
Contract.prototype._getRunningEvent = function (eventName) { | ||
BaseContract.prototype._getRunningEvent = function (eventName) { | ||
if (typeof (eventName) === "string") { | ||
@@ -846,3 +859,3 @@ // Listen for "error" events (if your contract has an error event, include | ||
}; | ||
Contract.prototype._checkRunningEvents = function (runningEvent) { | ||
BaseContract.prototype._checkRunningEvents = function (runningEvent) { | ||
if (runningEvent.listenerCount() === 0) { | ||
@@ -860,3 +873,3 @@ delete this._runningEvents[runningEvent.tag]; | ||
// from parse errors if they wish | ||
Contract.prototype._wrapEvent = function (runningEvent, log, listener) { | ||
BaseContract.prototype._wrapEvent = function (runningEvent, log, listener) { | ||
var _this = this; | ||
@@ -878,3 +891,3 @@ var event = properties_1.deepCopy(log); | ||
}; | ||
Contract.prototype._addEventListener = function (runningEvent, listener, once) { | ||
BaseContract.prototype._addEventListener = function (runningEvent, listener, once) { | ||
var _this = this; | ||
@@ -917,3 +930,3 @@ if (!this.provider) { | ||
}; | ||
Contract.prototype.queryFilter = function (event, fromBlockOrBlockhash, toBlock) { | ||
BaseContract.prototype.queryFilter = function (event, fromBlockOrBlockhash, toBlock) { | ||
var _this = this; | ||
@@ -936,11 +949,11 @@ var runningEvent = this._getRunningEvent(event); | ||
}; | ||
Contract.prototype.on = function (event, listener) { | ||
BaseContract.prototype.on = function (event, listener) { | ||
this._addEventListener(this._getRunningEvent(event), listener, false); | ||
return this; | ||
}; | ||
Contract.prototype.once = function (event, listener) { | ||
BaseContract.prototype.once = function (event, listener) { | ||
this._addEventListener(this._getRunningEvent(event), listener, true); | ||
return this; | ||
}; | ||
Contract.prototype.emit = function (eventName) { | ||
BaseContract.prototype.emit = function (eventName) { | ||
var args = []; | ||
@@ -959,3 +972,3 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
}; | ||
Contract.prototype.listenerCount = function (eventName) { | ||
BaseContract.prototype.listenerCount = function (eventName) { | ||
var _this = this; | ||
@@ -972,3 +985,3 @@ if (!this.provider) { | ||
}; | ||
Contract.prototype.listeners = function (eventName) { | ||
BaseContract.prototype.listeners = function (eventName) { | ||
if (!this.provider) { | ||
@@ -988,3 +1001,3 @@ return []; | ||
}; | ||
Contract.prototype.removeAllListeners = function (eventName) { | ||
BaseContract.prototype.removeAllListeners = function (eventName) { | ||
if (!this.provider) { | ||
@@ -1007,3 +1020,3 @@ return this; | ||
}; | ||
Contract.prototype.off = function (eventName, listener) { | ||
BaseContract.prototype.off = function (eventName, listener) { | ||
if (!this.provider) { | ||
@@ -1017,7 +1030,15 @@ return this; | ||
}; | ||
Contract.prototype.removeListener = function (eventName, listener) { | ||
BaseContract.prototype.removeListener = function (eventName, listener) { | ||
return this.off(eventName, listener); | ||
}; | ||
return BaseContract; | ||
}()); | ||
exports.BaseContract = BaseContract; | ||
var Contract = /** @class */ (function (_super) { | ||
__extends(Contract, _super); | ||
function Contract() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return Contract; | ||
}()); | ||
}(BaseContract)); | ||
exports.Contract = Contract; | ||
@@ -1024,0 +1045,0 @@ var ContractFactory = /** @class */ (function () { |
{ | ||
"author": "Richard Moore <me@ricmoo.com>", | ||
"dependencies": { | ||
"@ethersproject/abi": "^5.0.10", | ||
"@ethersproject/abstract-provider": "^5.0.8", | ||
"@ethersproject/abstract-signer": "^5.0.10", | ||
"@ethersproject/address": "^5.0.9", | ||
"@ethersproject/bignumber": "^5.0.13", | ||
"@ethersproject/bytes": "^5.0.9", | ||
"@ethersproject/constants": "^5.0.8", | ||
"@ethersproject/logger": "^5.0.8", | ||
"@ethersproject/properties": "^5.0.7" | ||
"@ethersproject/abi": "^5.1.0", | ||
"@ethersproject/abstract-provider": "^5.1.0", | ||
"@ethersproject/abstract-signer": "^5.1.0", | ||
"@ethersproject/address": "^5.1.0", | ||
"@ethersproject/bignumber": "^5.1.0", | ||
"@ethersproject/bytes": "^5.1.0", | ||
"@ethersproject/constants": "^5.1.0", | ||
"@ethersproject/logger": "^5.1.0", | ||
"@ethersproject/properties": "^5.1.0", | ||
"@ethersproject/transactions": "^5.1.0" | ||
}, | ||
@@ -26,3 +27,3 @@ "description": "Contract abstraction meta-class for ethers.", | ||
], | ||
"gitHead": "6c43e20e7a68f3f5a141c74527ec63d9fe8458be", | ||
"gitHead": "3b1d3fcee6bfb5178861e26ff1a1e9daa0663ec9", | ||
"keywords": [ | ||
@@ -48,5 +49,5 @@ "Ethereum", | ||
"sideEffects": false, | ||
"tarballHash": "0xf931416a22e8a76ce9c589b81d6f90139acb407cd8ce4e3d37f361a91e2f8827", | ||
"tarballHash": "0x94a2e1633e19ed31fa9284c9056d0ce89b752521d3f280b2ae6f89f2c578df9a", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.0.12" | ||
"version": "5.1.0" | ||
} |
@@ -1,1 +0,1 @@ | ||
export const version = "contracts/5.0.12"; | ||
export const version = "contracts/5.1.0"; |
@@ -10,3 +10,3 @@ "use strict"; | ||
import { Deferrable, defineReadOnly, deepCopy, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties"; | ||
// @TOOD remove dependences transactions | ||
import { AccessList, accessListify, AccessListish } from "@ethersproject/transactions"; | ||
@@ -22,2 +22,4 @@ import { Logger } from "@ethersproject/logger"; | ||
nonce?: BigNumberish | Promise<BigNumberish>; | ||
type?: number; | ||
accessList?: AccessListish; | ||
}; | ||
@@ -50,2 +52,5 @@ | ||
chainId?: number; | ||
type?: number; | ||
accessList?: AccessList; | ||
}; | ||
@@ -100,3 +105,4 @@ | ||
const allowedTransactionKeys: { [ key: string ]: boolean } = { | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true | ||
chainId: true, data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true, | ||
type: true, accessList: true, | ||
} | ||
@@ -219,2 +225,5 @@ | ||
if (ro.type != null) { tx.type = ro.type; } | ||
if (ro.accessList != null) { tx.accessList = accessListify(ro.accessList); } | ||
// If there was no "gasLimit" override, but the ABI specifies a default, use it | ||
@@ -255,2 +264,5 @@ if (tx.gasLimit == null && fragment.gas != null) { | ||
delete overrides.type; | ||
delete overrides.accessList; | ||
// Make sure there are no stray overrides, which may indicate a | ||
@@ -575,3 +587,3 @@ // typo or using an unsupported key. | ||
export type ContractInterface = string | Array<Fragment | JsonFragment | string> | Interface; | ||
export type ContractInterface = string | ReadonlyArray<Fragment | JsonFragment | string> | Interface; | ||
@@ -581,3 +593,3 @@ type InterfaceFunc = (contractInterface: ContractInterface) => Interface; | ||
export class Contract { | ||
export class BaseContract { | ||
readonly address: string; | ||
@@ -597,5 +609,2 @@ readonly interface: Interface; | ||
// The meta-class properties | ||
readonly [ key: string ]: ContractFunction | any; | ||
// This will always be an address. This will only differ from | ||
@@ -709,3 +718,3 @@ // address if an ENS name was used in the constructor | ||
if (this[signature] == null) { | ||
if ((<Contract>this)[signature] == null) { | ||
defineReadOnly<any, any>(this, signature, buildDefault(this, fragment, true)); | ||
@@ -742,5 +751,8 @@ } | ||
if (this[name] == null) { | ||
defineReadOnly(this, name, this[signature]); | ||
} | ||
// If overwriting a member property that is null, swallow the error | ||
try { | ||
if ((<Contract>this)[name] == null) { | ||
defineReadOnly(<Contract>this, name, (<Contract>this)[signature]); | ||
} | ||
} catch (e) { } | ||
@@ -1092,2 +1104,7 @@ if (this.functions[name] == null) { | ||
export class Contract extends BaseContract { | ||
// The meta-class properties | ||
readonly [ key: string ]: ContractFunction | any; | ||
} | ||
export class ContractFactory { | ||
@@ -1094,0 +1111,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
239859
3433
10
Updated@ethersproject/abi@^5.1.0
Updated@ethersproject/bytes@^5.1.0
Updated@ethersproject/logger@^5.1.0