Updated dist files.
This commit is contained in:
parent
13e50ec6db
commit
eef07e5a4f
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@ -1 +1 @@
|
|||||||
export declare const version = "4.0.0-beta.13";
|
export declare const version = "4.0.0-beta.14";
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.0-beta.13";
|
exports.version = "4.0.0-beta.14";
|
||||||
|
14
contracts/contract.d.ts
vendored
14
contracts/contract.d.ts
vendored
@ -2,6 +2,7 @@ import { Indexed, Interface } from './interface';
|
|||||||
import { BigNumber } from '../utils/bignumber';
|
import { BigNumber } from '../utils/bignumber';
|
||||||
import { Provider } from '../providers/abstract-provider';
|
import { Provider } from '../providers/abstract-provider';
|
||||||
import { Signer } from '../wallet/abstract-signer';
|
import { Signer } from '../wallet/abstract-signer';
|
||||||
|
import { Arrayish } from '../utils/bytes';
|
||||||
import { ParamType } from '../utils/abi-coder';
|
import { ParamType } from '../utils/abi-coder';
|
||||||
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
|
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
|
||||||
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
|
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||||
@ -19,6 +20,15 @@ export interface Event extends Log {
|
|||||||
getTransaction: () => Promise<TransactionResponse>;
|
getTransaction: () => Promise<TransactionResponse>;
|
||||||
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
||||||
}
|
}
|
||||||
|
export declare class VoidSigner extends Signer {
|
||||||
|
readonly address: string;
|
||||||
|
constructor(address: string, provider: Provider);
|
||||||
|
getAddress(): Promise<string>;
|
||||||
|
_fail(message: string, operation: string): Promise<any>;
|
||||||
|
signMessage(message: Arrayish | string): Promise<string>;
|
||||||
|
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
connect(provider: Provider): VoidSigner;
|
||||||
|
}
|
||||||
interface Bucket<T> {
|
interface Bucket<T> {
|
||||||
[name: string]: T;
|
[name: string]: T;
|
||||||
}
|
}
|
||||||
@ -37,7 +47,7 @@ export declare class Contract {
|
|||||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||||
deployed(): Promise<Contract>;
|
deployed(): Promise<Contract>;
|
||||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||||
connect(signerOrProvider: Signer | Provider): Contract;
|
connect(signerOrProvider: Signer | Provider | string): Contract;
|
||||||
attach(addressOrName: string): Contract;
|
attach(addressOrName: string): Contract;
|
||||||
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
|
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
|
||||||
static isIndexed(value: any): value is Indexed;
|
static isIndexed(value: any): value is Indexed;
|
||||||
@ -46,7 +56,7 @@ export declare class Contract {
|
|||||||
private _addEventListener;
|
private _addEventListener;
|
||||||
on(event: EventFilter | string, listener: Listener): Contract;
|
on(event: EventFilter | string, listener: Listener): Contract;
|
||||||
once(event: EventFilter | string, listener: Listener): Contract;
|
once(event: EventFilter | string, listener: Listener): Contract;
|
||||||
addEventLisener(eventName: EventFilter | string, listener: Listener): Contract;
|
addListener(eventName: EventFilter | string, listener: Listener): Contract;
|
||||||
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
||||||
listenerCount(eventName?: EventFilter | string): number;
|
listenerCount(eventName?: EventFilter | string): number;
|
||||||
listeners(eventName: EventFilter | string): Array<Listener>;
|
listeners(eventName: EventFilter | string): Array<Listener>;
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
})();
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@ -20,6 +30,34 @@ var errors = __importStar(require("../utils/errors"));
|
|||||||
var abstract_provider_1 = require("../providers/abstract-provider");
|
var abstract_provider_1 = require("../providers/abstract-provider");
|
||||||
var abstract_signer_1 = require("../wallet/abstract-signer");
|
var abstract_signer_1 = require("../wallet/abstract-signer");
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
var VoidSigner = /** @class */ (function (_super) {
|
||||||
|
__extends(VoidSigner, _super);
|
||||||
|
function VoidSigner(address, provider) {
|
||||||
|
var _this = _super.call(this) || this;
|
||||||
|
properties_1.defineReadOnly(_this, 'address', address);
|
||||||
|
properties_1.defineReadOnly(_this, 'provider', provider);
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
VoidSigner.prototype.getAddress = function () {
|
||||||
|
return Promise.resolve(this.address);
|
||||||
|
};
|
||||||
|
VoidSigner.prototype._fail = function (message, operation) {
|
||||||
|
return Promise.resolve().then(function () {
|
||||||
|
errors.throwError(message, errors.UNSUPPORTED_OPERATION, { operation: operation });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.signMessage = function (message) {
|
||||||
|
return this._fail('VoidSigner cannot sign messages', 'signMessage');
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.sendTransaction = function (transaction) {
|
||||||
|
return this._fail('VoidSigner cannot sign transactions', 'sendTransaction');
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.connect = function (provider) {
|
||||||
|
return new VoidSigner(this.address, provider);
|
||||||
|
};
|
||||||
|
return VoidSigner;
|
||||||
|
}(abstract_signer_1.Signer));
|
||||||
|
exports.VoidSigner = VoidSigner;
|
||||||
var allowedTransactionKeys = {
|
var allowedTransactionKeys = {
|
||||||
data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
|
data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
|
||||||
};
|
};
|
||||||
@ -311,6 +349,9 @@ var Contract = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
// Reconnect to a different signer or provider
|
// Reconnect to a different signer or provider
|
||||||
Contract.prototype.connect = function (signerOrProvider) {
|
Contract.prototype.connect = function (signerOrProvider) {
|
||||||
|
if (typeof (signerOrProvider) === 'string') {
|
||||||
|
signerOrProvider = new VoidSigner(signerOrProvider, this.provider);
|
||||||
|
}
|
||||||
var contract = new Contract(this.address, this.interface, signerOrProvider);
|
var contract = new Contract(this.address, this.interface, signerOrProvider);
|
||||||
if (this.deployTransaction) {
|
if (this.deployTransaction) {
|
||||||
properties_1.defineReadOnly(contract, 'deployTransaction', this.deployTransaction);
|
properties_1.defineReadOnly(contract, 'deployTransaction', this.deployTransaction);
|
||||||
@ -465,7 +506,7 @@ var Contract = /** @class */ (function () {
|
|||||||
this._addEventListener(this._getEventFilter(event), listener, true);
|
this._addEventListener(this._getEventFilter(event), listener, true);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
Contract.prototype.addEventLisener = function (eventName, listener) {
|
Contract.prototype.addListener = function (eventName, listener) {
|
||||||
return this.on(eventName, listener);
|
return this.on(eventName, listener);
|
||||||
};
|
};
|
||||||
Contract.prototype.emit = function (eventName) {
|
Contract.prototype.emit = function (eventName) {
|
||||||
|
4
contracts/index.d.ts
vendored
4
contracts/index.d.ts
vendored
@ -1,3 +1,3 @@
|
|||||||
import { Contract } from './contract';
|
import { Contract, VoidSigner } from './contract';
|
||||||
import { Interface } from './interface';
|
import { Interface } from './interface';
|
||||||
export { Contract, Interface, };
|
export { Contract, Interface, VoidSigner };
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var contract_1 = require("./contract");
|
var contract_1 = require("./contract");
|
||||||
exports.Contract = contract_1.Contract;
|
exports.Contract = contract_1.Contract;
|
||||||
|
exports.VoidSigner = contract_1.VoidSigner;
|
||||||
var interface_1 = require("./interface");
|
var interface_1 = require("./interface");
|
||||||
exports.Interface = interface_1.Interface;
|
exports.Interface = interface_1.Interface;
|
||||||
|
2
dist/ethers-v4-beta.min.js
vendored
Normal file
2
dist/ethers-v4-beta.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
203
dist/ethers.js
vendored
203
dist/ethers.js
vendored
@ -1,10 +1,20 @@
|
|||||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.0-beta.13";
|
exports.version = "4.0.0-beta.14";
|
||||||
|
|
||||||
},{}],2:[function(require,module,exports){
|
},{}],2:[function(require,module,exports){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
})();
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@ -26,6 +36,34 @@ var errors = __importStar(require("../utils/errors"));
|
|||||||
var abstract_provider_1 = require("../providers/abstract-provider");
|
var abstract_provider_1 = require("../providers/abstract-provider");
|
||||||
var abstract_signer_1 = require("../wallet/abstract-signer");
|
var abstract_signer_1 = require("../wallet/abstract-signer");
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
var VoidSigner = /** @class */ (function (_super) {
|
||||||
|
__extends(VoidSigner, _super);
|
||||||
|
function VoidSigner(address, provider) {
|
||||||
|
var _this = _super.call(this) || this;
|
||||||
|
properties_1.defineReadOnly(_this, 'address', address);
|
||||||
|
properties_1.defineReadOnly(_this, 'provider', provider);
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
VoidSigner.prototype.getAddress = function () {
|
||||||
|
return Promise.resolve(this.address);
|
||||||
|
};
|
||||||
|
VoidSigner.prototype._fail = function (message, operation) {
|
||||||
|
return Promise.resolve().then(function () {
|
||||||
|
errors.throwError(message, errors.UNSUPPORTED_OPERATION, { operation: operation });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.signMessage = function (message) {
|
||||||
|
return this._fail('VoidSigner cannot sign messages', 'signMessage');
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.sendTransaction = function (transaction) {
|
||||||
|
return this._fail('VoidSigner cannot sign transactions', 'sendTransaction');
|
||||||
|
};
|
||||||
|
VoidSigner.prototype.connect = function (provider) {
|
||||||
|
return new VoidSigner(this.address, provider);
|
||||||
|
};
|
||||||
|
return VoidSigner;
|
||||||
|
}(abstract_signer_1.Signer));
|
||||||
|
exports.VoidSigner = VoidSigner;
|
||||||
var allowedTransactionKeys = {
|
var allowedTransactionKeys = {
|
||||||
data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
|
data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
|
||||||
};
|
};
|
||||||
@ -317,6 +355,9 @@ var Contract = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
// Reconnect to a different signer or provider
|
// Reconnect to a different signer or provider
|
||||||
Contract.prototype.connect = function (signerOrProvider) {
|
Contract.prototype.connect = function (signerOrProvider) {
|
||||||
|
if (typeof (signerOrProvider) === 'string') {
|
||||||
|
signerOrProvider = new VoidSigner(signerOrProvider, this.provider);
|
||||||
|
}
|
||||||
var contract = new Contract(this.address, this.interface, signerOrProvider);
|
var contract = new Contract(this.address, this.interface, signerOrProvider);
|
||||||
if (this.deployTransaction) {
|
if (this.deployTransaction) {
|
||||||
properties_1.defineReadOnly(contract, 'deployTransaction', this.deployTransaction);
|
properties_1.defineReadOnly(contract, 'deployTransaction', this.deployTransaction);
|
||||||
@ -471,7 +512,7 @@ var Contract = /** @class */ (function () {
|
|||||||
this._addEventListener(this._getEventFilter(event), listener, true);
|
this._addEventListener(this._getEventFilter(event), listener, true);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
Contract.prototype.addEventLisener = function (eventName, listener) {
|
Contract.prototype.addListener = function (eventName, listener) {
|
||||||
return this.on(eventName, listener);
|
return this.on(eventName, listener);
|
||||||
};
|
};
|
||||||
Contract.prototype.emit = function (eventName) {
|
Contract.prototype.emit = function (eventName) {
|
||||||
@ -560,6 +601,7 @@ exports.Contract = Contract;
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var contract_1 = require("./contract");
|
var contract_1 = require("./contract");
|
||||||
exports.Contract = contract_1.Contract;
|
exports.Contract = contract_1.Contract;
|
||||||
|
exports.VoidSigner = contract_1.VoidSigner;
|
||||||
var interface_1 = require("./interface");
|
var interface_1 = require("./interface");
|
||||||
exports.Interface = interface_1.Interface;
|
exports.Interface = interface_1.Interface;
|
||||||
|
|
||||||
@ -958,6 +1000,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
var contracts_1 = require("./contracts");
|
var contracts_1 = require("./contracts");
|
||||||
exports.Contract = contracts_1.Contract;
|
exports.Contract = contracts_1.Contract;
|
||||||
exports.Interface = contracts_1.Interface;
|
exports.Interface = contracts_1.Interface;
|
||||||
|
exports.VoidSigner = contracts_1.VoidSigner;
|
||||||
var providers = __importStar(require("./providers"));
|
var providers = __importStar(require("./providers"));
|
||||||
exports.providers = providers;
|
exports.providers = providers;
|
||||||
var wallet_1 = require("./wallet");
|
var wallet_1 = require("./wallet");
|
||||||
@ -10070,26 +10113,6 @@ function checkBlockTag(blockTag) {
|
|||||||
}
|
}
|
||||||
throw new Error('invalid blockTag');
|
throw new Error('invalid blockTag');
|
||||||
}
|
}
|
||||||
var formatBlock = {
|
|
||||||
hash: checkHash,
|
|
||||||
parentHash: checkHash,
|
|
||||||
number: checkNumber,
|
|
||||||
timestamp: checkNumber,
|
|
||||||
nonce: allowNull(bytes_1.hexlify),
|
|
||||||
difficulty: checkDifficulty,
|
|
||||||
gasLimit: bignumber_1.bigNumberify,
|
|
||||||
gasUsed: bignumber_1.bigNumberify,
|
|
||||||
miner: address_1.getAddress,
|
|
||||||
extraData: bytes_1.hexlify,
|
|
||||||
//transactions: allowNull(arrayOf(checkTransaction)),
|
|
||||||
transactions: allowNull(arrayOf(checkHash)),
|
|
||||||
};
|
|
||||||
function checkBlock(block) {
|
|
||||||
if (block.author != null && block.miner == null) {
|
|
||||||
block.miner = block.author;
|
|
||||||
}
|
|
||||||
return check(formatBlock, block);
|
|
||||||
}
|
|
||||||
var formatTransaction = {
|
var formatTransaction = {
|
||||||
hash: checkHash,
|
hash: checkHash,
|
||||||
blockHash: allowNull(checkHash, null),
|
blockHash: allowNull(checkHash, null),
|
||||||
@ -10166,6 +10189,27 @@ function checkTransactionResponse(transaction) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
var formatBlock = {
|
||||||
|
hash: checkHash,
|
||||||
|
parentHash: checkHash,
|
||||||
|
number: checkNumber,
|
||||||
|
timestamp: checkNumber,
|
||||||
|
nonce: allowNull(bytes_1.hexlify),
|
||||||
|
difficulty: checkDifficulty,
|
||||||
|
gasLimit: bignumber_1.bigNumberify,
|
||||||
|
gasUsed: bignumber_1.bigNumberify,
|
||||||
|
miner: address_1.getAddress,
|
||||||
|
extraData: bytes_1.hexlify,
|
||||||
|
transactions: allowNull(arrayOf(checkHash)),
|
||||||
|
};
|
||||||
|
var formatBlockWithTransactions = properties_1.shallowCopy(formatBlock);
|
||||||
|
formatBlockWithTransactions.transactions = allowNull(arrayOf(checkTransactionResponse));
|
||||||
|
function checkBlock(block, includeTransactions) {
|
||||||
|
if (block.author != null && block.miner == null) {
|
||||||
|
block.miner = block.author;
|
||||||
|
}
|
||||||
|
return check(includeTransactions ? formatBlockWithTransactions : formatBlock, block);
|
||||||
|
}
|
||||||
var formatTransactionRequest = {
|
var formatTransactionRequest = {
|
||||||
from: allowNull(address_1.getAddress),
|
from: allowNull(address_1.getAddress),
|
||||||
nonce: allowNull(checkNumber),
|
nonce: allowNull(checkNumber),
|
||||||
@ -10661,7 +10705,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
BaseProvider.prototype.getBlock = function (blockHashOrBlockTag) {
|
BaseProvider.prototype.getBlock = function (blockHashOrBlockTag, includeTransactions) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
return this.ready.then(function () {
|
return this.ready.then(function () {
|
||||||
return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {
|
return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {
|
||||||
@ -10670,14 +10714,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
var blockHash = bytes_1.hexlify(blockHashOrBlockTag);
|
var blockHash = bytes_1.hexlify(blockHashOrBlockTag);
|
||||||
if (bytes_1.hexDataLength(blockHash) === 32) {
|
if (bytes_1.hexDataLength(blockHash) === 32) {
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockHash: blockHash }).then(function (block) {
|
return _this.perform('getBlock', { blockHash: blockHash, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (_this._emitted['b:' + blockHash] == null) {
|
if (_this._emitted['b:' + blockHash] == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return checkBlock(block);
|
return checkBlock(block, includeTransactions);
|
||||||
});
|
});
|
||||||
}, { onceBlock: _this });
|
}, { onceBlock: _this });
|
||||||
}
|
}
|
||||||
@ -10690,14 +10734,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
blockNumber_1 = parseInt(blockTag_1.substring(2), 16);
|
blockNumber_1 = parseInt(blockTag_1.substring(2), 16);
|
||||||
}
|
}
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockTag: blockTag_1 }).then(function (block) {
|
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (blockNumber_1 > _this._emitted.block) {
|
if (blockNumber_1 > _this._emitted.block) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return checkBlock(block);
|
return checkBlock(block, includeTransactions);
|
||||||
});
|
});
|
||||||
}, { onceBlock: _this });
|
}, { onceBlock: _this });
|
||||||
}
|
}
|
||||||
@ -11160,7 +11204,12 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
|||||||
case 'getBlock':
|
case 'getBlock':
|
||||||
if (params.blockTag) {
|
if (params.blockTag) {
|
||||||
url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;
|
url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;
|
||||||
url += '&boolean=false';
|
if (params.includeTransactions) {
|
||||||
|
url += '&boolean=true';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url += '&boolean=false';
|
||||||
|
}
|
||||||
url += apiKey;
|
url += apiKey;
|
||||||
return web_1.fetchJson(url, null, getJsonResult);
|
return web_1.fetchJson(url, null, getJsonResult);
|
||||||
}
|
}
|
||||||
@ -11762,10 +11811,10 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
|||||||
});
|
});
|
||||||
case 'getBlock':
|
case 'getBlock':
|
||||||
if (params.blockTag) {
|
if (params.blockTag) {
|
||||||
return this.send('eth_getBlockByNumber', [params.blockTag, false]);
|
return this.send('eth_getBlockByNumber', [params.blockTag, !!params.includeTransactions]);
|
||||||
}
|
}
|
||||||
else if (params.blockHash) {
|
else if (params.blockHash) {
|
||||||
return this.send('eth_getBlockByHash', [params.blockHash, false]);
|
return this.send('eth_getBlockByHash', [params.blockHash, !!params.includeTransactions]);
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error('invalid block tag or block hash'));
|
return Promise.reject(new Error('invalid block tag or block hash'));
|
||||||
case 'getTransaction':
|
case 'getTransaction':
|
||||||
@ -13780,8 +13829,10 @@ exports.shallowCopy = properties_1.shallowCopy;
|
|||||||
var RLP = __importStar(require("./rlp"));
|
var RLP = __importStar(require("./rlp"));
|
||||||
exports.RLP = RLP;
|
exports.RLP = RLP;
|
||||||
var secp256k1_1 = require("./secp256k1");
|
var secp256k1_1 = require("./secp256k1");
|
||||||
|
exports.computeAddress = secp256k1_1.computeAddress;
|
||||||
exports.computePublicKey = secp256k1_1.computePublicKey;
|
exports.computePublicKey = secp256k1_1.computePublicKey;
|
||||||
exports.computeSharedSecret = secp256k1_1.computeSharedSecret;
|
exports.recoverAddress = secp256k1_1.recoverAddress;
|
||||||
|
exports.recoverPublicKey = secp256k1_1.recoverPublicKey;
|
||||||
exports.verifyMessage = secp256k1_1.verifyMessage;
|
exports.verifyMessage = secp256k1_1.verifyMessage;
|
||||||
var transaction_1 = require("./transaction");
|
var transaction_1 = require("./transaction");
|
||||||
exports.parseTransaction = transaction_1.parse;
|
exports.parseTransaction = transaction_1.parse;
|
||||||
@ -14323,17 +14374,14 @@ var KeyPair = /** @class */ (function () {
|
|||||||
v: 27 + signature.recoveryParam
|
v: 27 + signature.recoveryParam
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
KeyPair.prototype.computeSharedSecret = function (otherKey) {
|
||||||
|
var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));
|
||||||
|
var otherKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(computePublicKey(otherKey)));
|
||||||
|
return bytes_1.hexZeroPad('0x' + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
||||||
|
};
|
||||||
return KeyPair;
|
return KeyPair;
|
||||||
}());
|
}());
|
||||||
exports.KeyPair = KeyPair;
|
exports.KeyPair = KeyPair;
|
||||||
function recoverPublicKey(digest, signature) {
|
|
||||||
var sig = {
|
|
||||||
r: bytes_1.arrayify(signature.r),
|
|
||||||
s: bytes_1.arrayify(signature.s)
|
|
||||||
};
|
|
||||||
return '0x' + getCurve().recoverPubKey(bytes_1.arrayify(digest), sig, signature.recoveryParam).encode('hex', false);
|
|
||||||
}
|
|
||||||
exports.recoverPublicKey = recoverPublicKey;
|
|
||||||
function computePublicKey(key, compressed) {
|
function computePublicKey(key, compressed) {
|
||||||
var bytes = bytes_1.arrayify(key);
|
var bytes = bytes_1.arrayify(key);
|
||||||
if (bytes.length === 32) {
|
if (bytes.length === 32) {
|
||||||
@ -14359,33 +14407,24 @@ function computePublicKey(key, compressed) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
exports.computePublicKey = computePublicKey;
|
exports.computePublicKey = computePublicKey;
|
||||||
function recoverAddress(digest, signature) {
|
|
||||||
return computeAddress(recoverPublicKey(digest, signature));
|
|
||||||
}
|
|
||||||
exports.recoverAddress = recoverAddress;
|
|
||||||
function computeAddress(key) {
|
function computeAddress(key) {
|
||||||
// Strip off the leading "0x04"
|
// Strip off the leading "0x04"
|
||||||
var publicKey = '0x' + computePublicKey(key).slice(4);
|
var publicKey = '0x' + computePublicKey(key).slice(4);
|
||||||
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
|
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
|
||||||
}
|
}
|
||||||
exports.computeAddress = computeAddress;
|
exports.computeAddress = computeAddress;
|
||||||
function computeSharedSecret(privateKey, publicKey) {
|
function recoverPublicKey(digest, signature) {
|
||||||
var privateKeyPair = getCurve().keyFromPrivate(bytes_1.arrayify(privateKey));
|
|
||||||
var publicKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(publicKey));
|
|
||||||
return bytes_1.hexZeroPad('0x' + privateKeyPair.derive(publicKeyPair.getPublic()).toString(16), 32);
|
|
||||||
}
|
|
||||||
exports.computeSharedSecret = computeSharedSecret;
|
|
||||||
function verifyDigest(digest, signature) {
|
|
||||||
var sig = bytes_1.splitSignature(signature);
|
var sig = bytes_1.splitSignature(signature);
|
||||||
return recoverAddress(digest, {
|
var rs = { r: bytes_1.arrayify(sig.r), s: bytes_1.arrayify(sig.s) };
|
||||||
r: sig.r,
|
return '0x' + getCurve().recoverPubKey(bytes_1.arrayify(digest), rs, sig.recoveryParam).encode('hex', false);
|
||||||
s: sig.s,
|
|
||||||
recoveryParam: sig.recoveryParam
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.verifyDigest = verifyDigest;
|
exports.recoverPublicKey = recoverPublicKey;
|
||||||
|
function recoverAddress(digest, signature) {
|
||||||
|
return computeAddress(recoverPublicKey(bytes_1.arrayify(digest), signature));
|
||||||
|
}
|
||||||
|
exports.recoverAddress = recoverAddress;
|
||||||
function verifyMessage(message, signature) {
|
function verifyMessage(message, signature) {
|
||||||
return verifyDigest(hash_1.hashMessage(message), signature);
|
return recoverAddress(hash_1.hashMessage(message), signature);
|
||||||
}
|
}
|
||||||
exports.verifyMessage = verifyMessage;
|
exports.verifyMessage = verifyMessage;
|
||||||
|
|
||||||
@ -15002,8 +15041,9 @@ var base64_1 = require("./base64");
|
|||||||
var utf8_1 = require("./utf8");
|
var utf8_1 = require("./utf8");
|
||||||
var errors = __importStar(require("./errors"));
|
var errors = __importStar(require("./errors"));
|
||||||
function fetchJson(connection, json, processFunc) {
|
function fetchJson(connection, json, processFunc) {
|
||||||
var headers = [];
|
var headers = {};
|
||||||
var url = null;
|
var url = null;
|
||||||
|
var timeout = 2 * 60 * 1000;
|
||||||
if (typeof (connection) === 'string') {
|
if (typeof (connection) === 'string') {
|
||||||
url = connection;
|
url = connection;
|
||||||
}
|
}
|
||||||
@ -15012,37 +15052,66 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });
|
errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });
|
||||||
}
|
}
|
||||||
url = connection.url;
|
url = connection.url;
|
||||||
|
if (typeof (connection.timeout) === 'number' && connection.timeout > 0) {
|
||||||
|
timeout = connection.timeout;
|
||||||
|
}
|
||||||
|
if (connection.headers) {
|
||||||
|
for (var key in connection.headers) {
|
||||||
|
headers[key.toLowerCase()] = { key: key, value: String(connection.headers[key]) };
|
||||||
|
}
|
||||||
|
}
|
||||||
if (connection.user != null && connection.password != null) {
|
if (connection.user != null && connection.password != null) {
|
||||||
if (url.substring(0, 6) !== 'https:' && connection.allowInsecure !== true) {
|
if (url.substring(0, 6) !== 'https:' && connection.allowInsecure !== true) {
|
||||||
errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url, user: connection.user, password: '[REDACTED]' });
|
errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url, user: connection.user, password: '[REDACTED]' });
|
||||||
}
|
}
|
||||||
var authorization = connection.user + ':' + connection.password;
|
var authorization = connection.user + ':' + connection.password;
|
||||||
headers.push({
|
headers['authorization'] = {
|
||||||
key: 'Authorization',
|
key: 'Authorization',
|
||||||
value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))
|
value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var request = new xmlhttprequest_1.XMLHttpRequest();
|
var request = new xmlhttprequest_1.XMLHttpRequest();
|
||||||
|
var timer = null;
|
||||||
|
timer = setTimeout(function () {
|
||||||
|
if (timer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
timer = null;
|
||||||
|
reject(new Error('timeout'));
|
||||||
|
setTimeout(function () {
|
||||||
|
request.abort();
|
||||||
|
}, 0);
|
||||||
|
}, timeout);
|
||||||
|
var cancelTimeout = function () {
|
||||||
|
if (timer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
};
|
||||||
if (json) {
|
if (json) {
|
||||||
request.open('POST', url, true);
|
request.open('POST', url, true);
|
||||||
headers.push({ key: 'Content-Type', value: 'application/json' });
|
headers['content-type'] = { key: 'Content-Type', value: 'application/json' };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
request.open('GET', url, true);
|
request.open('GET', url, true);
|
||||||
}
|
}
|
||||||
headers.forEach(function (header) {
|
Object.keys(headers).forEach(function (key) {
|
||||||
|
var header = headers[key];
|
||||||
request.setRequestHeader(header.key, header.value);
|
request.setRequestHeader(header.key, header.value);
|
||||||
});
|
});
|
||||||
request.onreadystatechange = function () {
|
request.onreadystatechange = function () {
|
||||||
if (request.readyState !== 4) {
|
if (request.readyState !== 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var result = null;
|
||||||
try {
|
try {
|
||||||
var result = JSON.parse(request.responseText);
|
result = JSON.parse(request.responseText);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var jsonError = new Error('invalid json response');
|
var jsonError = new Error('invalid json response');
|
||||||
jsonError.orginialError = error;
|
jsonError.orginialError = error;
|
||||||
@ -15056,6 +15125,7 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
result = processFunc(result);
|
result = processFunc(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
error.url = url;
|
error.url = url;
|
||||||
error.body = json;
|
error.body = json;
|
||||||
error.responseText = request.responseText;
|
error.responseText = request.responseText;
|
||||||
@ -15064,15 +15134,18 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (request.status != 200) {
|
if (request.status != 200) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var error = new Error('invalid response - ' + request.status);
|
var error = new Error('invalid response - ' + request.status);
|
||||||
error.statusCode = request.status;
|
error.statusCode = request.status;
|
||||||
reject(error);
|
reject(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cancelTimeout();
|
||||||
resolve(result);
|
resolve(result);
|
||||||
};
|
};
|
||||||
request.onerror = function (error) {
|
request.onerror = function (error) {
|
||||||
|
cancelTimeout();
|
||||||
reject(error);
|
reject(error);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
@ -15084,6 +15157,7 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var connectionError = new Error('connection error');
|
var connectionError = new Error('connection error');
|
||||||
connectionError.error = error;
|
connectionError.error = error;
|
||||||
@ -15902,6 +15976,9 @@ var SigningKey = /** @class */ (function () {
|
|||||||
SigningKey.prototype.signDigest = function (digest) {
|
SigningKey.prototype.signDigest = function (digest) {
|
||||||
return this.keyPair.sign(digest);
|
return this.keyPair.sign(digest);
|
||||||
};
|
};
|
||||||
|
SigningKey.prototype.computeSharedSecret = function (key) {
|
||||||
|
return this.keyPair.computeSharedSecret(bytes_1.arrayify(key));
|
||||||
|
};
|
||||||
SigningKey.isSigningKey = function (value) {
|
SigningKey.isSigningKey = function (value) {
|
||||||
return properties_1.isType(value, 'SigningKey');
|
return properties_1.isType(value, 'SigningKey');
|
||||||
};
|
};
|
||||||
|
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
58
dist/ethers.types.txt
vendored
58
dist/ethers.types.txt
vendored
@ -7,7 +7,7 @@ declare module 'ethers' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/ethers' {
|
declare module 'ethers/ethers' {
|
||||||
import { Contract, Interface } from 'ethers/contracts';
|
import { Contract, Interface, VoidSigner } from 'ethers/contracts';
|
||||||
import * as providers from 'ethers/providers';
|
import * as providers from 'ethers/providers';
|
||||||
import { HDNode, SigningKey, Wallet } from 'ethers/wallet';
|
import { HDNode, SigningKey, Wallet } from 'ethers/wallet';
|
||||||
import { AbiCoder } from 'ethers/utils/abi-coder';
|
import { AbiCoder } from 'ethers/utils/abi-coder';
|
||||||
@ -20,13 +20,13 @@ declare module 'ethers/ethers' {
|
|||||||
import { platform } from 'ethers/utils/shims';
|
import { platform } from 'ethers/utils/shims';
|
||||||
import { version } from 'ethers/_version';
|
import { version } from 'ethers/_version';
|
||||||
function getDefaultProvider(network?: types.Network | string): providers.BaseProvider;
|
function getDefaultProvider(network?: types.Network | string): providers.BaseProvider;
|
||||||
export { Wallet, HDNode, SigningKey, Contract, Interface, getDefaultProvider, providers, AbiCoder, BigNumber, errors, constants, utils, types, wordlists, platform, version };
|
export { Wallet, VoidSigner, HDNode, SigningKey, Contract, Interface, getDefaultProvider, providers, AbiCoder, BigNumber, errors, constants, utils, types, wordlists, platform, version };
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/contracts' {
|
declare module 'ethers/contracts' {
|
||||||
import { Contract } from 'ethers/contracts/contract';
|
import { Contract, VoidSigner } from 'ethers/contracts/contract';
|
||||||
import { Interface } from 'ethers/contracts/interface';
|
import { Interface } from 'ethers/contracts/interface';
|
||||||
export { Contract, Interface, };
|
export { Contract, Interface, VoidSigner };
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/providers' {
|
declare module 'ethers/providers' {
|
||||||
@ -164,12 +164,12 @@ declare module 'ethers/utils' {
|
|||||||
import { getNetwork } from 'ethers/utils/networks';
|
import { getNetwork } from 'ethers/utils/networks';
|
||||||
import { deepCopy, defineReadOnly, resolveProperties, shallowCopy } from 'ethers/utils/properties';
|
import { deepCopy, defineReadOnly, resolveProperties, shallowCopy } from 'ethers/utils/properties';
|
||||||
import * as RLP from 'ethers/utils/rlp';
|
import * as RLP from 'ethers/utils/rlp';
|
||||||
import { computePublicKey, computeSharedSecret, verifyMessage } from 'ethers/utils/secp256k1';
|
import { computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage } from 'ethers/utils/secp256k1';
|
||||||
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
|
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
|
||||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
|
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
|
||||||
import { formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
|
import { formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
|
||||||
import { fetchJson } from 'ethers/utils/web';
|
import { fetchJson } from 'ethers/utils/web';
|
||||||
export { defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, computeSharedSecret, verifyMessage };
|
export { defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/types' {
|
declare module 'ethers/types' {
|
||||||
@ -209,7 +209,7 @@ declare module 'ethers/utils/shims' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/_version' {
|
declare module 'ethers/_version' {
|
||||||
export const version = "4.0.0-beta.13";
|
export const version = "4.0.0-beta.14";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/contracts/contract' {
|
declare module 'ethers/contracts/contract' {
|
||||||
@ -217,6 +217,7 @@ declare module 'ethers/contracts/contract' {
|
|||||||
import { BigNumber } from 'ethers/utils/bignumber';
|
import { BigNumber } from 'ethers/utils/bignumber';
|
||||||
import { Provider } from 'ethers/providers/abstract-provider';
|
import { Provider } from 'ethers/providers/abstract-provider';
|
||||||
import { Signer } from 'ethers/wallet/abstract-signer';
|
import { Signer } from 'ethers/wallet/abstract-signer';
|
||||||
|
import { Arrayish } from 'ethers/utils/bytes';
|
||||||
import { ParamType } from 'ethers/utils/abi-coder';
|
import { ParamType } from 'ethers/utils/abi-coder';
|
||||||
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
|
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
|
||||||
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||||
@ -234,6 +235,15 @@ declare module 'ethers/contracts/contract' {
|
|||||||
getTransaction: () => Promise<TransactionResponse>;
|
getTransaction: () => Promise<TransactionResponse>;
|
||||||
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
||||||
}
|
}
|
||||||
|
export class VoidSigner extends Signer {
|
||||||
|
readonly address: string;
|
||||||
|
constructor(address: string, provider: Provider);
|
||||||
|
getAddress(): Promise<string>;
|
||||||
|
_fail(message: string, operation: string): Promise<any>;
|
||||||
|
signMessage(message: Arrayish | string): Promise<string>;
|
||||||
|
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
connect(provider: Provider): VoidSigner;
|
||||||
|
}
|
||||||
interface Bucket<T> {
|
interface Bucket<T> {
|
||||||
[name: string]: T;
|
[name: string]: T;
|
||||||
}
|
}
|
||||||
@ -251,13 +261,13 @@ declare module 'ethers/contracts/contract' {
|
|||||||
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
|
||||||
deployed(): Promise<Contract>;
|
deployed(): Promise<Contract>;
|
||||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||||
connect(signerOrProvider: Signer | Provider): Contract;
|
connect(signerOrProvider: Signer | Provider | string): Contract;
|
||||||
attach(addressOrName: string): Contract;
|
attach(addressOrName: string): Contract;
|
||||||
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
|
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
|
||||||
static isIndexed(value: any): value is Indexed;
|
static isIndexed(value: any): value is Indexed;
|
||||||
on(event: EventFilter | string, listener: Listener): Contract;
|
on(event: EventFilter | string, listener: Listener): Contract;
|
||||||
once(event: EventFilter | string, listener: Listener): Contract;
|
once(event: EventFilter | string, listener: Listener): Contract;
|
||||||
addEventLisener(eventName: EventFilter | string, listener: Listener): Contract;
|
addListener(eventName: EventFilter | string, listener: Listener): Contract;
|
||||||
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
||||||
listenerCount(eventName?: EventFilter | string): number;
|
listenerCount(eventName?: EventFilter | string): number;
|
||||||
listeners(eventName: EventFilter | string): Array<Listener>;
|
listeners(eventName: EventFilter | string): Array<Listener>;
|
||||||
@ -420,7 +430,7 @@ declare module 'ethers/providers/base-provider' {
|
|||||||
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
||||||
call(transaction: TransactionRequest): Promise<string>;
|
call(transaction: TransactionRequest): Promise<string>;
|
||||||
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
|
||||||
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
getLogs(filter: Filter): Promise<Array<Log>>;
|
getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
@ -461,7 +471,9 @@ declare module 'ethers/providers/fallback-provider' {
|
|||||||
export class FallbackProvider extends BaseProvider {
|
export class FallbackProvider extends BaseProvider {
|
||||||
constructor(providers: Array<BaseProvider>);
|
constructor(providers: Array<BaseProvider>);
|
||||||
readonly providers: Array<BaseProvider>;
|
readonly providers: Array<BaseProvider>;
|
||||||
perform(method: string, params: any): any;
|
perform(method: string, params: {
|
||||||
|
[name: string]: any;
|
||||||
|
}): any;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,6 +631,7 @@ declare module 'ethers/wallet/signing-key' {
|
|||||||
readonly path: string;
|
readonly path: string;
|
||||||
constructor(privateKey: Arrayish | HDNode);
|
constructor(privateKey: Arrayish | HDNode);
|
||||||
signDigest(digest: Arrayish): Signature;
|
signDigest(digest: Arrayish): Signature;
|
||||||
|
computeSharedSecret(key: Arrayish | string): string;
|
||||||
static isSigningKey(value: any): value is SigningKey;
|
static isSigningKey(value: any): value is SigningKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -745,15 +758,14 @@ declare module 'ethers/utils/secp256k1' {
|
|||||||
readonly publicKey: string;
|
readonly publicKey: string;
|
||||||
readonly compressedPublicKey: string;
|
readonly compressedPublicKey: string;
|
||||||
readonly publicKeyBytes: Uint8Array;
|
readonly publicKeyBytes: Uint8Array;
|
||||||
constructor(privateKey: Arrayish);
|
constructor(privateKey: Arrayish | string);
|
||||||
sign(digest: Arrayish): Signature;
|
sign(digest: Arrayish | string): Signature;
|
||||||
|
computeSharedSecret(otherKey: Arrayish | string): string;
|
||||||
}
|
}
|
||||||
export function recoverPublicKey(digest: Arrayish, signature: Signature): string;
|
export function computePublicKey(key: Arrayish | string, compressed?: boolean): string;
|
||||||
export function computePublicKey(key: Arrayish, compressed?: boolean): string;
|
export function computeAddress(key: Arrayish | string): string;
|
||||||
export function recoverAddress(digest: Arrayish, signature: Signature): string;
|
export function recoverPublicKey(digest: Arrayish | string, signature: Signature | string): string;
|
||||||
export function computeAddress(key: string): string;
|
export function recoverAddress(digest: Arrayish | string, signature: Signature | string): string;
|
||||||
export function computeSharedSecret(privateKey: Arrayish, publicKey: Arrayish): string;
|
|
||||||
export function verifyDigest(digest: Arrayish | string, signature: Signature | string): string;
|
|
||||||
export function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
|
export function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,6 +830,10 @@ declare module 'ethers/utils/web' {
|
|||||||
user?: string;
|
user?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
allowInsecure?: boolean;
|
allowInsecure?: boolean;
|
||||||
|
timeout?: number;
|
||||||
|
headers?: {
|
||||||
|
[key: string]: string | number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export interface OnceBlockable {
|
export interface OnceBlockable {
|
||||||
once(eventName: "block", handler: () => void): void;
|
once(eventName: "block", handler: () => void): void;
|
||||||
@ -917,7 +933,7 @@ declare module 'ethers/providers/abstract-provider' {
|
|||||||
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
||||||
abstract call(transaction: TransactionRequest): Promise<string>;
|
abstract call(transaction: TransactionRequest): Promise<string>;
|
||||||
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
|
||||||
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
@ -940,7 +956,7 @@ declare module 'ethers/wallet/abstract-signer' {
|
|||||||
import { Arrayish } from 'ethers/utils/bytes';
|
import { Arrayish } from 'ethers/utils/bytes';
|
||||||
import { TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
|
import { TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
|
||||||
export abstract class Signer {
|
export abstract class Signer {
|
||||||
provider?: Provider;
|
readonly provider?: Provider;
|
||||||
abstract getAddress(): Promise<string>;
|
abstract getAddress(): Promise<string>;
|
||||||
abstract signMessage(message: Arrayish | string): Promise<string>;
|
abstract signMessage(message: Arrayish | string): Promise<string>;
|
||||||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
4
ethers.d.ts
vendored
4
ethers.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { Contract, Interface } from './contracts';
|
import { Contract, Interface, VoidSigner } from './contracts';
|
||||||
import * as providers from './providers';
|
import * as providers from './providers';
|
||||||
import { HDNode, SigningKey, Wallet } from './wallet';
|
import { HDNode, SigningKey, Wallet } from './wallet';
|
||||||
import { AbiCoder } from './utils/abi-coder';
|
import { AbiCoder } from './utils/abi-coder';
|
||||||
@ -11,4 +11,4 @@ import * as wordlists from './wordlists';
|
|||||||
import { platform } from './utils/shims';
|
import { platform } from './utils/shims';
|
||||||
import { version } from './_version';
|
import { version } from './_version';
|
||||||
declare function getDefaultProvider(network?: types.Network | string): providers.BaseProvider;
|
declare function getDefaultProvider(network?: types.Network | string): providers.BaseProvider;
|
||||||
export { Wallet, HDNode, SigningKey, Contract, Interface, getDefaultProvider, providers, AbiCoder, BigNumber, errors, constants, utils, types, wordlists, platform, version };
|
export { Wallet, VoidSigner, HDNode, SigningKey, Contract, Interface, getDefaultProvider, providers, AbiCoder, BigNumber, errors, constants, utils, types, wordlists, platform, version };
|
||||||
|
@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
var contracts_1 = require("./contracts");
|
var contracts_1 = require("./contracts");
|
||||||
exports.Contract = contracts_1.Contract;
|
exports.Contract = contracts_1.Contract;
|
||||||
exports.Interface = contracts_1.Interface;
|
exports.Interface = contracts_1.Interface;
|
||||||
|
exports.VoidSigner = contracts_1.VoidSigner;
|
||||||
var providers = __importStar(require("./providers"));
|
var providers = __importStar(require("./providers"));
|
||||||
exports.providers = providers;
|
exports.providers = providers;
|
||||||
var wallet_1 = require("./wallet");
|
var wallet_1 = require("./wallet");
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "4.0.0-beta.6",
|
"version": "4.0.0-beta.14",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "4.0.0-beta.13",
|
"version": "4.0.0-beta.14",
|
||||||
"description": "Ethereum wallet library.",
|
"description": "Ethereum wallet library.",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
|
2
providers/abstract-provider.d.ts
vendored
2
providers/abstract-provider.d.ts
vendored
@ -81,7 +81,7 @@ export declare abstract class Provider implements OnceBlockable {
|
|||||||
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
||||||
abstract call(transaction: TransactionRequest): Promise<string>;
|
abstract call(transaction: TransactionRequest): Promise<string>;
|
||||||
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
|
||||||
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
|
2
providers/base-provider.d.ts
vendored
2
providers/base-provider.d.ts
vendored
@ -41,7 +41,7 @@ export declare class BaseProvider extends Provider {
|
|||||||
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
||||||
call(transaction: TransactionRequest): Promise<string>;
|
call(transaction: TransactionRequest): Promise<string>;
|
||||||
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block>;
|
||||||
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
getLogs(filter: Filter): Promise<Array<Log>>;
|
getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
|
@ -145,26 +145,6 @@ function checkBlockTag(blockTag) {
|
|||||||
}
|
}
|
||||||
throw new Error('invalid blockTag');
|
throw new Error('invalid blockTag');
|
||||||
}
|
}
|
||||||
var formatBlock = {
|
|
||||||
hash: checkHash,
|
|
||||||
parentHash: checkHash,
|
|
||||||
number: checkNumber,
|
|
||||||
timestamp: checkNumber,
|
|
||||||
nonce: allowNull(bytes_1.hexlify),
|
|
||||||
difficulty: checkDifficulty,
|
|
||||||
gasLimit: bignumber_1.bigNumberify,
|
|
||||||
gasUsed: bignumber_1.bigNumberify,
|
|
||||||
miner: address_1.getAddress,
|
|
||||||
extraData: bytes_1.hexlify,
|
|
||||||
//transactions: allowNull(arrayOf(checkTransaction)),
|
|
||||||
transactions: allowNull(arrayOf(checkHash)),
|
|
||||||
};
|
|
||||||
function checkBlock(block) {
|
|
||||||
if (block.author != null && block.miner == null) {
|
|
||||||
block.miner = block.author;
|
|
||||||
}
|
|
||||||
return check(formatBlock, block);
|
|
||||||
}
|
|
||||||
var formatTransaction = {
|
var formatTransaction = {
|
||||||
hash: checkHash,
|
hash: checkHash,
|
||||||
blockHash: allowNull(checkHash, null),
|
blockHash: allowNull(checkHash, null),
|
||||||
@ -241,6 +221,27 @@ function checkTransactionResponse(transaction) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
var formatBlock = {
|
||||||
|
hash: checkHash,
|
||||||
|
parentHash: checkHash,
|
||||||
|
number: checkNumber,
|
||||||
|
timestamp: checkNumber,
|
||||||
|
nonce: allowNull(bytes_1.hexlify),
|
||||||
|
difficulty: checkDifficulty,
|
||||||
|
gasLimit: bignumber_1.bigNumberify,
|
||||||
|
gasUsed: bignumber_1.bigNumberify,
|
||||||
|
miner: address_1.getAddress,
|
||||||
|
extraData: bytes_1.hexlify,
|
||||||
|
transactions: allowNull(arrayOf(checkHash)),
|
||||||
|
};
|
||||||
|
var formatBlockWithTransactions = properties_1.shallowCopy(formatBlock);
|
||||||
|
formatBlockWithTransactions.transactions = allowNull(arrayOf(checkTransactionResponse));
|
||||||
|
function checkBlock(block, includeTransactions) {
|
||||||
|
if (block.author != null && block.miner == null) {
|
||||||
|
block.miner = block.author;
|
||||||
|
}
|
||||||
|
return check(includeTransactions ? formatBlockWithTransactions : formatBlock, block);
|
||||||
|
}
|
||||||
var formatTransactionRequest = {
|
var formatTransactionRequest = {
|
||||||
from: allowNull(address_1.getAddress),
|
from: allowNull(address_1.getAddress),
|
||||||
nonce: allowNull(checkNumber),
|
nonce: allowNull(checkNumber),
|
||||||
@ -736,7 +737,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
BaseProvider.prototype.getBlock = function (blockHashOrBlockTag) {
|
BaseProvider.prototype.getBlock = function (blockHashOrBlockTag, includeTransactions) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
return this.ready.then(function () {
|
return this.ready.then(function () {
|
||||||
return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {
|
return properties_1.resolveProperties({ blockHashOrBlockTag: blockHashOrBlockTag }).then(function (_a) {
|
||||||
@ -745,14 +746,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
var blockHash = bytes_1.hexlify(blockHashOrBlockTag);
|
var blockHash = bytes_1.hexlify(blockHashOrBlockTag);
|
||||||
if (bytes_1.hexDataLength(blockHash) === 32) {
|
if (bytes_1.hexDataLength(blockHash) === 32) {
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockHash: blockHash }).then(function (block) {
|
return _this.perform('getBlock', { blockHash: blockHash, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (_this._emitted['b:' + blockHash] == null) {
|
if (_this._emitted['b:' + blockHash] == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return checkBlock(block);
|
return checkBlock(block, includeTransactions);
|
||||||
});
|
});
|
||||||
}, { onceBlock: _this });
|
}, { onceBlock: _this });
|
||||||
}
|
}
|
||||||
@ -765,14 +766,14 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
blockNumber_1 = parseInt(blockTag_1.substring(2), 16);
|
blockNumber_1 = parseInt(blockTag_1.substring(2), 16);
|
||||||
}
|
}
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockTag: blockTag_1 }).then(function (block) {
|
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (blockNumber_1 > _this._emitted.block) {
|
if (blockNumber_1 > _this._emitted.block) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return checkBlock(block);
|
return checkBlock(block, includeTransactions);
|
||||||
});
|
});
|
||||||
}, { onceBlock: _this });
|
}, { onceBlock: _this });
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,12 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
|||||||
case 'getBlock':
|
case 'getBlock':
|
||||||
if (params.blockTag) {
|
if (params.blockTag) {
|
||||||
url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;
|
url += '/api?module=proxy&action=eth_getBlockByNumber&tag=' + params.blockTag;
|
||||||
url += '&boolean=false';
|
if (params.includeTransactions) {
|
||||||
|
url += '&boolean=true';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url += '&boolean=false';
|
||||||
|
}
|
||||||
url += apiKey;
|
url += apiKey;
|
||||||
return web_1.fetchJson(url, null, getJsonResult);
|
return web_1.fetchJson(url, null, getJsonResult);
|
||||||
}
|
}
|
||||||
|
4
providers/fallback-provider.d.ts
vendored
4
providers/fallback-provider.d.ts
vendored
@ -3,5 +3,7 @@ export declare class FallbackProvider extends BaseProvider {
|
|||||||
private _providers;
|
private _providers;
|
||||||
constructor(providers: Array<BaseProvider>);
|
constructor(providers: Array<BaseProvider>);
|
||||||
readonly providers: Array<BaseProvider>;
|
readonly providers: Array<BaseProvider>;
|
||||||
perform(method: string, params: any): any;
|
perform(method: string, params: {
|
||||||
|
[name: string]: any;
|
||||||
|
}): any;
|
||||||
}
|
}
|
||||||
|
@ -261,10 +261,10 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
|||||||
});
|
});
|
||||||
case 'getBlock':
|
case 'getBlock':
|
||||||
if (params.blockTag) {
|
if (params.blockTag) {
|
||||||
return this.send('eth_getBlockByNumber', [params.blockTag, false]);
|
return this.send('eth_getBlockByNumber', [params.blockTag, !!params.includeTransactions]);
|
||||||
}
|
}
|
||||||
else if (params.blockHash) {
|
else if (params.blockHash) {
|
||||||
return this.send('eth_getBlockByHash', [params.blockHash, false]);
|
return this.send('eth_getBlockByHash', [params.blockHash, !!params.includeTransactions]);
|
||||||
}
|
}
|
||||||
return Promise.reject(new Error('invalid block tag or block hash'));
|
return Promise.reject(new Error('invalid block tag or block hash'));
|
||||||
case 'getTransaction':
|
case 'getTransaction':
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = "4.0.0-beta.13";
|
export const version = "4.0.0-beta.14";
|
||||||
|
1
thirdparty.d.ts
vendored
1
thirdparty.d.ts
vendored
@ -125,6 +125,7 @@ declare module "xmlhttprequest" {
|
|||||||
open(method: string, url: string, async?: boolean): void;
|
open(method: string, url: string, async?: boolean): void;
|
||||||
setRequestHeader(key: string, value: string): void;
|
setRequestHeader(key: string, value: string): void;
|
||||||
send(body?: string): void;
|
send(body?: string): void;
|
||||||
|
abort(): void;
|
||||||
|
|
||||||
onreadystatechange: () => void;
|
onreadystatechange: () => void;
|
||||||
onerror: (error: Error) => void;
|
onerror: (error: Error) => void;
|
||||||
|
@ -11,11 +11,11 @@ declare class Buffer implements ArrayLike<number> {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
function decode(textData) {
|
function decode(textData) {
|
||||||
return bytes_1.arrayify(new Uint8Array(new Buffer(textData, 'base64')));
|
return bytes_1.arrayify(new Uint8Array(Buffer.from(textData, 'base64')));
|
||||||
}
|
}
|
||||||
exports.decode = decode;
|
exports.decode = decode;
|
||||||
;
|
;
|
||||||
function encode(data) {
|
function encode(data) {
|
||||||
return new Buffer(bytes_1.arrayify(data)).toString('base64');
|
return Buffer.from(bytes_1.arrayify(data)).toString('base64');
|
||||||
}
|
}
|
||||||
exports.encode = encode;
|
exports.encode = encode;
|
||||||
|
@ -20,6 +20,6 @@ function computeHmac(algorithm, key, data) {
|
|||||||
if (!SupportedAlgorithms[algorithm]) {
|
if (!SupportedAlgorithms[algorithm]) {
|
||||||
errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });
|
errors.throwError('unsupported algorithm ' + algorithm, errors.UNSUPPORTED_OPERATION, { operation: 'hmac', algorithm: algorithm });
|
||||||
}
|
}
|
||||||
return bytes_1.arrayify(crypto_1.createHmac(algorithm, new Buffer(bytes_1.arrayify(key))).update(new Buffer(bytes_1.arrayify(data))).digest());
|
return bytes_1.arrayify(crypto_1.createHmac(algorithm, Buffer.from(bytes_1.arrayify(key))).update(Buffer.from(bytes_1.arrayify(data))).digest());
|
||||||
}
|
}
|
||||||
exports.computeHmac = computeHmac;
|
exports.computeHmac = computeHmac;
|
||||||
|
4
utils/index.d.ts
vendored
4
utils/index.d.ts
vendored
@ -12,9 +12,9 @@ import { randomBytes } from './random-bytes';
|
|||||||
import { getNetwork } from './networks';
|
import { getNetwork } from './networks';
|
||||||
import { deepCopy, defineReadOnly, resolveProperties, shallowCopy } from './properties';
|
import { deepCopy, defineReadOnly, resolveProperties, shallowCopy } from './properties';
|
||||||
import * as RLP from './rlp';
|
import * as RLP from './rlp';
|
||||||
import { computePublicKey, computeSharedSecret, verifyMessage } from './secp256k1';
|
import { computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage } from './secp256k1';
|
||||||
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
import { parse as parseTransaction, serialize as serializeTransaction } from './transaction';
|
||||||
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } from './utf8';
|
||||||
import { formatEther, parseEther, formatUnits, parseUnits } from './units';
|
import { formatEther, parseEther, formatUnits, parseUnits } from './units';
|
||||||
import { fetchJson } from './web';
|
import { fetchJson } from './web';
|
||||||
export { defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, computeSharedSecret, verifyMessage };
|
export { defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, RLP, fetchJson, getNetwork, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, computePublicKey, recoverAddress, recoverPublicKey, verifyMessage };
|
||||||
|
@ -59,8 +59,10 @@ exports.shallowCopy = properties_1.shallowCopy;
|
|||||||
var RLP = __importStar(require("./rlp"));
|
var RLP = __importStar(require("./rlp"));
|
||||||
exports.RLP = RLP;
|
exports.RLP = RLP;
|
||||||
var secp256k1_1 = require("./secp256k1");
|
var secp256k1_1 = require("./secp256k1");
|
||||||
|
exports.computeAddress = secp256k1_1.computeAddress;
|
||||||
exports.computePublicKey = secp256k1_1.computePublicKey;
|
exports.computePublicKey = secp256k1_1.computePublicKey;
|
||||||
exports.computeSharedSecret = secp256k1_1.computeSharedSecret;
|
exports.recoverAddress = secp256k1_1.recoverAddress;
|
||||||
|
exports.recoverPublicKey = secp256k1_1.recoverPublicKey;
|
||||||
exports.verifyMessage = secp256k1_1.verifyMessage;
|
exports.verifyMessage = secp256k1_1.verifyMessage;
|
||||||
var transaction_1 = require("./transaction");
|
var transaction_1 = require("./transaction");
|
||||||
exports.parseTransaction = transaction_1.parse;
|
exports.parseTransaction = transaction_1.parse;
|
||||||
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
var crypto_1 = require("crypto");
|
var crypto_1 = require("crypto");
|
||||||
var bytes_1 = require("./bytes");
|
var bytes_1 = require("./bytes");
|
||||||
function bufferify(value) {
|
function bufferify(value) {
|
||||||
return new Buffer(bytes_1.arrayify(value));
|
return Buffer.from(bytes_1.arrayify(value));
|
||||||
}
|
}
|
||||||
function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {
|
function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) {
|
||||||
return bytes_1.arrayify(crypto_1.pbkdf2Sync(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));
|
return bytes_1.arrayify(crypto_1.pbkdf2Sync(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm));
|
||||||
|
15
utils/secp256k1.d.ts
vendored
15
utils/secp256k1.d.ts
vendored
@ -4,13 +4,12 @@ export declare class KeyPair {
|
|||||||
readonly publicKey: string;
|
readonly publicKey: string;
|
||||||
readonly compressedPublicKey: string;
|
readonly compressedPublicKey: string;
|
||||||
readonly publicKeyBytes: Uint8Array;
|
readonly publicKeyBytes: Uint8Array;
|
||||||
constructor(privateKey: Arrayish);
|
constructor(privateKey: Arrayish | string);
|
||||||
sign(digest: Arrayish): Signature;
|
sign(digest: Arrayish | string): Signature;
|
||||||
|
computeSharedSecret(otherKey: Arrayish | string): string;
|
||||||
}
|
}
|
||||||
export declare function recoverPublicKey(digest: Arrayish, signature: Signature): string;
|
export declare function computePublicKey(key: Arrayish | string, compressed?: boolean): string;
|
||||||
export declare function computePublicKey(key: Arrayish, compressed?: boolean): string;
|
export declare function computeAddress(key: Arrayish | string): string;
|
||||||
export declare function recoverAddress(digest: Arrayish, signature: Signature): string;
|
export declare function recoverPublicKey(digest: Arrayish | string, signature: Signature | string): string;
|
||||||
export declare function computeAddress(key: string): string;
|
export declare function recoverAddress(digest: Arrayish | string, signature: Signature | string): string;
|
||||||
export declare function computeSharedSecret(privateKey: Arrayish, publicKey: Arrayish): string;
|
|
||||||
export declare function verifyDigest(digest: Arrayish | string, signature: Signature | string): string;
|
|
||||||
export declare function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
|
export declare function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
|
||||||
|
@ -40,17 +40,14 @@ var KeyPair = /** @class */ (function () {
|
|||||||
v: 27 + signature.recoveryParam
|
v: 27 + signature.recoveryParam
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
KeyPair.prototype.computeSharedSecret = function (otherKey) {
|
||||||
|
var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));
|
||||||
|
var otherKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(computePublicKey(otherKey)));
|
||||||
|
return bytes_1.hexZeroPad('0x' + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
||||||
|
};
|
||||||
return KeyPair;
|
return KeyPair;
|
||||||
}());
|
}());
|
||||||
exports.KeyPair = KeyPair;
|
exports.KeyPair = KeyPair;
|
||||||
function recoverPublicKey(digest, signature) {
|
|
||||||
var sig = {
|
|
||||||
r: bytes_1.arrayify(signature.r),
|
|
||||||
s: bytes_1.arrayify(signature.s)
|
|
||||||
};
|
|
||||||
return '0x' + getCurve().recoverPubKey(bytes_1.arrayify(digest), sig, signature.recoveryParam).encode('hex', false);
|
|
||||||
}
|
|
||||||
exports.recoverPublicKey = recoverPublicKey;
|
|
||||||
function computePublicKey(key, compressed) {
|
function computePublicKey(key, compressed) {
|
||||||
var bytes = bytes_1.arrayify(key);
|
var bytes = bytes_1.arrayify(key);
|
||||||
if (bytes.length === 32) {
|
if (bytes.length === 32) {
|
||||||
@ -76,32 +73,23 @@ function computePublicKey(key, compressed) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
exports.computePublicKey = computePublicKey;
|
exports.computePublicKey = computePublicKey;
|
||||||
function recoverAddress(digest, signature) {
|
|
||||||
return computeAddress(recoverPublicKey(digest, signature));
|
|
||||||
}
|
|
||||||
exports.recoverAddress = recoverAddress;
|
|
||||||
function computeAddress(key) {
|
function computeAddress(key) {
|
||||||
// Strip off the leading "0x04"
|
// Strip off the leading "0x04"
|
||||||
var publicKey = '0x' + computePublicKey(key).slice(4);
|
var publicKey = '0x' + computePublicKey(key).slice(4);
|
||||||
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
|
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
|
||||||
}
|
}
|
||||||
exports.computeAddress = computeAddress;
|
exports.computeAddress = computeAddress;
|
||||||
function computeSharedSecret(privateKey, publicKey) {
|
function recoverPublicKey(digest, signature) {
|
||||||
var privateKeyPair = getCurve().keyFromPrivate(bytes_1.arrayify(privateKey));
|
|
||||||
var publicKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(publicKey));
|
|
||||||
return bytes_1.hexZeroPad('0x' + privateKeyPair.derive(publicKeyPair.getPublic()).toString(16), 32);
|
|
||||||
}
|
|
||||||
exports.computeSharedSecret = computeSharedSecret;
|
|
||||||
function verifyDigest(digest, signature) {
|
|
||||||
var sig = bytes_1.splitSignature(signature);
|
var sig = bytes_1.splitSignature(signature);
|
||||||
return recoverAddress(digest, {
|
var rs = { r: bytes_1.arrayify(sig.r), s: bytes_1.arrayify(sig.s) };
|
||||||
r: sig.r,
|
return '0x' + getCurve().recoverPubKey(bytes_1.arrayify(digest), rs, sig.recoveryParam).encode('hex', false);
|
||||||
s: sig.s,
|
|
||||||
recoveryParam: sig.recoveryParam
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.verifyDigest = verifyDigest;
|
exports.recoverPublicKey = recoverPublicKey;
|
||||||
|
function recoverAddress(digest, signature) {
|
||||||
|
return computeAddress(recoverPublicKey(bytes_1.arrayify(digest), signature));
|
||||||
|
}
|
||||||
|
exports.recoverAddress = recoverAddress;
|
||||||
function verifyMessage(message, signature) {
|
function verifyMessage(message, signature) {
|
||||||
return verifyDigest(hash_1.hashMessage(message), signature);
|
return recoverAddress(hash_1.hashMessage(message), signature);
|
||||||
}
|
}
|
||||||
exports.verifyMessage = verifyMessage;
|
exports.verifyMessage = verifyMessage;
|
||||||
|
4
utils/web.d.ts
vendored
4
utils/web.d.ts
vendored
@ -3,6 +3,10 @@ export declare type ConnectionInfo = {
|
|||||||
user?: string;
|
user?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
allowInsecure?: boolean;
|
allowInsecure?: boolean;
|
||||||
|
timeout?: number;
|
||||||
|
headers?: {
|
||||||
|
[key: string]: string | number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
export interface OnceBlockable {
|
export interface OnceBlockable {
|
||||||
once(eventName: "block", handler: () => void): void;
|
once(eventName: "block", handler: () => void): void;
|
||||||
|
47
utils/web.js
47
utils/web.js
@ -12,8 +12,9 @@ var base64_1 = require("./base64");
|
|||||||
var utf8_1 = require("./utf8");
|
var utf8_1 = require("./utf8");
|
||||||
var errors = __importStar(require("./errors"));
|
var errors = __importStar(require("./errors"));
|
||||||
function fetchJson(connection, json, processFunc) {
|
function fetchJson(connection, json, processFunc) {
|
||||||
var headers = [];
|
var headers = {};
|
||||||
var url = null;
|
var url = null;
|
||||||
|
var timeout = 2 * 60 * 1000;
|
||||||
if (typeof (connection) === 'string') {
|
if (typeof (connection) === 'string') {
|
||||||
url = connection;
|
url = connection;
|
||||||
}
|
}
|
||||||
@ -22,37 +23,66 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });
|
errors.throwError('missing URL', errors.MISSING_ARGUMENT, { arg: 'url' });
|
||||||
}
|
}
|
||||||
url = connection.url;
|
url = connection.url;
|
||||||
|
if (typeof (connection.timeout) === 'number' && connection.timeout > 0) {
|
||||||
|
timeout = connection.timeout;
|
||||||
|
}
|
||||||
|
if (connection.headers) {
|
||||||
|
for (var key in connection.headers) {
|
||||||
|
headers[key.toLowerCase()] = { key: key, value: String(connection.headers[key]) };
|
||||||
|
}
|
||||||
|
}
|
||||||
if (connection.user != null && connection.password != null) {
|
if (connection.user != null && connection.password != null) {
|
||||||
if (url.substring(0, 6) !== 'https:' && connection.allowInsecure !== true) {
|
if (url.substring(0, 6) !== 'https:' && connection.allowInsecure !== true) {
|
||||||
errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url, user: connection.user, password: '[REDACTED]' });
|
errors.throwError('basic authentication requires a secure https url', errors.INVALID_ARGUMENT, { arg: 'url', url: url, user: connection.user, password: '[REDACTED]' });
|
||||||
}
|
}
|
||||||
var authorization = connection.user + ':' + connection.password;
|
var authorization = connection.user + ':' + connection.password;
|
||||||
headers.push({
|
headers['authorization'] = {
|
||||||
key: 'Authorization',
|
key: 'Authorization',
|
||||||
value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))
|
value: 'Basic ' + base64_1.encode(utf8_1.toUtf8Bytes(authorization))
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var request = new xmlhttprequest_1.XMLHttpRequest();
|
var request = new xmlhttprequest_1.XMLHttpRequest();
|
||||||
|
var timer = null;
|
||||||
|
timer = setTimeout(function () {
|
||||||
|
if (timer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
timer = null;
|
||||||
|
reject(new Error('timeout'));
|
||||||
|
setTimeout(function () {
|
||||||
|
request.abort();
|
||||||
|
}, 0);
|
||||||
|
}, timeout);
|
||||||
|
var cancelTimeout = function () {
|
||||||
|
if (timer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
};
|
||||||
if (json) {
|
if (json) {
|
||||||
request.open('POST', url, true);
|
request.open('POST', url, true);
|
||||||
headers.push({ key: 'Content-Type', value: 'application/json' });
|
headers['content-type'] = { key: 'Content-Type', value: 'application/json' };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
request.open('GET', url, true);
|
request.open('GET', url, true);
|
||||||
}
|
}
|
||||||
headers.forEach(function (header) {
|
Object.keys(headers).forEach(function (key) {
|
||||||
|
var header = headers[key];
|
||||||
request.setRequestHeader(header.key, header.value);
|
request.setRequestHeader(header.key, header.value);
|
||||||
});
|
});
|
||||||
request.onreadystatechange = function () {
|
request.onreadystatechange = function () {
|
||||||
if (request.readyState !== 4) {
|
if (request.readyState !== 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var result = null;
|
||||||
try {
|
try {
|
||||||
var result = JSON.parse(request.responseText);
|
result = JSON.parse(request.responseText);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var jsonError = new Error('invalid json response');
|
var jsonError = new Error('invalid json response');
|
||||||
jsonError.orginialError = error;
|
jsonError.orginialError = error;
|
||||||
@ -66,6 +96,7 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
result = processFunc(result);
|
result = processFunc(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
error.url = url;
|
error.url = url;
|
||||||
error.body = json;
|
error.body = json;
|
||||||
error.responseText = request.responseText;
|
error.responseText = request.responseText;
|
||||||
@ -74,15 +105,18 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (request.status != 200) {
|
if (request.status != 200) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var error = new Error('invalid response - ' + request.status);
|
var error = new Error('invalid response - ' + request.status);
|
||||||
error.statusCode = request.status;
|
error.statusCode = request.status;
|
||||||
reject(error);
|
reject(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cancelTimeout();
|
||||||
resolve(result);
|
resolve(result);
|
||||||
};
|
};
|
||||||
request.onerror = function (error) {
|
request.onerror = function (error) {
|
||||||
|
cancelTimeout();
|
||||||
reject(error);
|
reject(error);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
@ -94,6 +128,7 @@ function fetchJson(connection, json, processFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
cancelTimeout();
|
||||||
// @TODO: not any!
|
// @TODO: not any!
|
||||||
var connectionError = new Error('connection error');
|
var connectionError = new Error('connection error');
|
||||||
connectionError.error = error;
|
connectionError.error = error;
|
||||||
|
2
wallet/abstract-signer.d.ts
vendored
2
wallet/abstract-signer.d.ts
vendored
@ -2,7 +2,7 @@ import { Provider } from '../providers/abstract-provider';
|
|||||||
import { Arrayish } from '../utils/bytes';
|
import { Arrayish } from '../utils/bytes';
|
||||||
import { TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
|
import { TransactionRequest, TransactionResponse } from '../providers/abstract-provider';
|
||||||
export declare abstract class Signer {
|
export declare abstract class Signer {
|
||||||
provider?: Provider;
|
readonly provider?: Provider;
|
||||||
abstract getAddress(): Promise<string>;
|
abstract getAddress(): Promise<string>;
|
||||||
abstract signMessage(message: Arrayish | string): Promise<string>;
|
abstract signMessage(message: Arrayish | string): Promise<string>;
|
||||||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
1
wallet/signing-key.d.ts
vendored
1
wallet/signing-key.d.ts
vendored
@ -14,5 +14,6 @@ export declare class SigningKey {
|
|||||||
private readonly keyPair;
|
private readonly keyPair;
|
||||||
constructor(privateKey: Arrayish | HDNode);
|
constructor(privateKey: Arrayish | HDNode);
|
||||||
signDigest(digest: Arrayish): Signature;
|
signDigest(digest: Arrayish): Signature;
|
||||||
|
computeSharedSecret(key: Arrayish | string): string;
|
||||||
static isSigningKey(value: any): value is SigningKey;
|
static isSigningKey(value: any): value is SigningKey;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ var SigningKey = /** @class */ (function () {
|
|||||||
SigningKey.prototype.signDigest = function (digest) {
|
SigningKey.prototype.signDigest = function (digest) {
|
||||||
return this.keyPair.sign(digest);
|
return this.keyPair.sign(digest);
|
||||||
};
|
};
|
||||||
|
SigningKey.prototype.computeSharedSecret = function (key) {
|
||||||
|
return this.keyPair.computeSharedSecret(bytes_1.arrayify(key));
|
||||||
|
};
|
||||||
SigningKey.isSigningKey = function (value) {
|
SigningKey.isSigningKey = function (value) {
|
||||||
return properties_1.isType(value, 'SigningKey');
|
return properties_1.isType(value, 'SigningKey');
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user