Added more specific types to signatures.
This commit is contained in:
parent
45923ad5dd
commit
1082105eea
@ -39,7 +39,8 @@ function getResult(payload) {
|
||||
// - gasLimit => gas
|
||||
// - All values hexlified
|
||||
// - All numeric values zero-striped
|
||||
export function hexlifyTransaction(transaction: TransactionRequest) {
|
||||
// @TODO: Not any, a dictionary of string to strings
|
||||
export function hexlifyTransaction(transaction: TransactionRequest): any {
|
||||
var result: any = {};
|
||||
|
||||
// Some nodes (INFURA ropsten; INFURA mainnet is fine) don't like extra zeros.
|
||||
@ -131,7 +132,7 @@ export class JsonRpcSigner extends Signer {
|
||||
});
|
||||
}
|
||||
|
||||
unlock(password): Promise<boolean> {
|
||||
unlock(password: string): Promise<boolean> {
|
||||
var provider = this.provider;
|
||||
|
||||
return this.getAddress().then(function(address) {
|
||||
|
@ -1066,6 +1066,7 @@ export class Provider {
|
||||
});
|
||||
}
|
||||
|
||||
// @TODO: Could probably use resolveProperties instead?
|
||||
_resolveNames(object: any, keys: Array<string>): Promise<any> {
|
||||
var promises = [];
|
||||
|
||||
|
@ -135,7 +135,7 @@ export function decryptCrowdsale(json: string, password: Arrayish | string): Sig
|
||||
}
|
||||
|
||||
//@TODO: string or arrayish
|
||||
export function decrypt(json: string, password: any, progressCallback?: ProgressCallback): Promise<SigningKey> {
|
||||
export function decrypt(json: string, password: Arrayish, progressCallback?: ProgressCallback): Promise<SigningKey> {
|
||||
var data = JSON.parse(json);
|
||||
|
||||
password = getPassword(password);
|
||||
|
@ -36,6 +36,10 @@ export class SigningKey {
|
||||
defineReadOnly(this, 'path', privateKey.path);
|
||||
privateKeyBytes = arrayify(privateKey.privateKey);
|
||||
} else {
|
||||
// A lot of common tools do not prefix private keys with a 0x
|
||||
if (typeof(privateKey) === 'string' && privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) {
|
||||
privateKey = '0x' + privateKey;
|
||||
}
|
||||
privateKeyBytes = arrayify(privateKey);
|
||||
}
|
||||
|
||||
|
@ -109,12 +109,12 @@ class LangJa extends Wordlist {
|
||||
super('ja');
|
||||
}
|
||||
|
||||
getWord(index) {
|
||||
getWord(index: number): string {
|
||||
loadWords();
|
||||
return words[index];
|
||||
}
|
||||
|
||||
getWordIndex(word) {
|
||||
getWordIndex(word: string): number {
|
||||
loadWords();
|
||||
return words.indexOf(word);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ for (var i = 0; i < 2048; i++) {
|
||||
|
||||
class LangZh extends Wordlist {
|
||||
private _country: string
|
||||
constructor(country) {
|
||||
constructor(country: string) {
|
||||
super('zh_' + country);
|
||||
defineReadOnly(this, '_country', country);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export abstract class Wordlist {
|
||||
}
|
||||
}
|
||||
|
||||
export function register(lang) {
|
||||
export function register(lang: Wordlist): void {
|
||||
if (exportWordlist) {
|
||||
if (!global['wordlists']) { defineReadOnly(global, 'wordlists', { }); }
|
||||
defineReadOnly(global['wordlists'], lang.locale, lang);
|
||||
|
Loading…
Reference in New Issue
Block a user