@harmony-js/core
Advanced tools
Comparing version 0.1.20 to 0.1.21
@@ -756,11 +756,19 @@ /** | ||
__extends(TruffleProvider, _super); | ||
function TruffleProvider(provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) { | ||
function TruffleProvider(provider, hdOptions, chainOptions, transactionOptions) { | ||
if (provider === void 0) { provider = 'http://localhost:9500'; } | ||
if (index === void 0) { index = 0; } | ||
if (addressCount === void 0) { addressCount = 1; } | ||
if (chainType === void 0) { chainType = "hmy" /* Harmony */; } | ||
if (chainId === void 0) { chainId = 0 /* Default */; } | ||
if (gasLimit === void 0) { gasLimit = '10000000'; } | ||
if (gasPrice === void 0) { gasPrice = '20000000000'; } | ||
var _this = _super.call(this, provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) || this; | ||
if (hdOptions === void 0) { hdOptions = { | ||
menmonic: undefined, | ||
index: 0, | ||
addressCount: 1, | ||
}; } | ||
if (chainOptions === void 0) { chainOptions = { | ||
shardID: 0, | ||
chainType: "hmy" /* Harmony */, | ||
chainId: 0 /* Default */, | ||
}; } | ||
if (transactionOptions === void 0) { transactionOptions = { | ||
gasLimit: '10000000', | ||
gasPrice: '20000000000', | ||
}; } | ||
var _this = _super.call(this, provider, hdOptions.menmonic, hdOptions.index, hdOptions.addressCount, chainOptions.shardID, chainOptions.chainType, chainOptions.chainId, transactionOptions.gasLimit, transactionOptions.gasPrice) || this; | ||
_this.resolveResult = function (response) { | ||
@@ -778,2 +786,4 @@ var final = response.getRaw || response; | ||
var response = _this.resolveResult(res); | ||
// console.log({ response }); | ||
// console.log({ callback: callback.name }); | ||
callback(null, response); | ||
@@ -780,0 +790,0 @@ } |
@@ -754,11 +754,19 @@ /** | ||
__extends(TruffleProvider, _super); | ||
function TruffleProvider(provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) { | ||
function TruffleProvider(provider, hdOptions, chainOptions, transactionOptions) { | ||
if (provider === void 0) { provider = 'http://localhost:9500'; } | ||
if (index === void 0) { index = 0; } | ||
if (addressCount === void 0) { addressCount = 1; } | ||
if (chainType === void 0) { chainType = "hmy" /* Harmony */; } | ||
if (chainId === void 0) { chainId = 0 /* Default */; } | ||
if (gasLimit === void 0) { gasLimit = '10000000'; } | ||
if (gasPrice === void 0) { gasPrice = '20000000000'; } | ||
var _this = _super.call(this, provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) || this; | ||
if (hdOptions === void 0) { hdOptions = { | ||
menmonic: undefined, | ||
index: 0, | ||
addressCount: 1, | ||
}; } | ||
if (chainOptions === void 0) { chainOptions = { | ||
shardID: 0, | ||
chainType: "hmy" /* Harmony */, | ||
chainId: 0 /* Default */, | ||
}; } | ||
if (transactionOptions === void 0) { transactionOptions = { | ||
gasLimit: '10000000', | ||
gasPrice: '20000000000', | ||
}; } | ||
var _this = _super.call(this, provider, hdOptions.menmonic, hdOptions.index, hdOptions.addressCount, chainOptions.shardID, chainOptions.chainType, chainOptions.chainId, transactionOptions.gasLimit, transactionOptions.gasPrice) || this; | ||
_this.resolveResult = function (response) { | ||
@@ -776,2 +784,4 @@ var final = response.getRaw || response; | ||
var response = _this.resolveResult(res); | ||
// console.log({ response }); | ||
// console.log({ callback: callback.name }); | ||
callback(null, response); | ||
@@ -778,0 +788,0 @@ } |
@@ -751,11 +751,19 @@ /** | ||
__extends(TruffleProvider, _super); | ||
function TruffleProvider(provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) { | ||
function TruffleProvider(provider, hdOptions, chainOptions, transactionOptions) { | ||
if (provider === void 0) { provider = 'http://localhost:9500'; } | ||
if (index === void 0) { index = 0; } | ||
if (addressCount === void 0) { addressCount = 1; } | ||
if (chainType === void 0) { chainType = "hmy" /* Harmony */; } | ||
if (chainId === void 0) { chainId = 0 /* Default */; } | ||
if (gasLimit === void 0) { gasLimit = '10000000'; } | ||
if (gasPrice === void 0) { gasPrice = '20000000000'; } | ||
var _this = _super.call(this, provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) || this; | ||
if (hdOptions === void 0) { hdOptions = { | ||
menmonic: undefined, | ||
index: 0, | ||
addressCount: 1, | ||
}; } | ||
if (chainOptions === void 0) { chainOptions = { | ||
shardID: 0, | ||
chainType: "hmy" /* Harmony */, | ||
chainId: 0 /* Default */, | ||
}; } | ||
if (transactionOptions === void 0) { transactionOptions = { | ||
gasLimit: '10000000', | ||
gasPrice: '20000000000', | ||
}; } | ||
var _this = _super.call(this, provider, hdOptions.menmonic, hdOptions.index, hdOptions.addressCount, chainOptions.shardID, chainOptions.chainType, chainOptions.chainId, transactionOptions.gasLimit, transactionOptions.gasPrice) || this; | ||
_this.resolveResult = function (response) { | ||
@@ -773,2 +781,4 @@ var final = response.getRaw || response; | ||
var response = _this.resolveResult(res); | ||
// console.log({ response }); | ||
// console.log({ callback: callback.name }); | ||
callback(null, response); | ||
@@ -775,0 +785,0 @@ } |
@@ -11,4 +11,18 @@ import { HttpProvider, WSProvider, RPCRequestPayload } from '@harmony-js/network'; | ||
} | ||
export interface HDOptions { | ||
menmonic?: string; | ||
index: number; | ||
addressCount: number; | ||
} | ||
export interface ChainOptions { | ||
shardID: number; | ||
chainType: ChainType; | ||
chainId: ChainID; | ||
} | ||
export interface TransactionOptions { | ||
gasLimit: string; | ||
gasPrice: string; | ||
} | ||
export declare class TruffleProvider extends HDNode { | ||
constructor(provider?: string | HttpProvider | WSProvider, menmonic?: string, index?: number, addressCount?: number, chainType?: ChainType, chainId?: ChainID, gasLimit?: string, gasPrice?: string); | ||
constructor(provider?: string | HttpProvider | WSProvider, hdOptions?: HDOptions, chainOptions?: ChainOptions, transactionOptions?: TransactionOptions); | ||
send(...args: [RPCRequestPayload<any>, any]): Promise<any>; | ||
@@ -15,0 +29,0 @@ sendAsync(...args: [RPCRequestPayload<any>, any]): Promise<any>; |
@@ -7,11 +7,19 @@ "use strict"; | ||
tslib_1.__extends(TruffleProvider, _super); | ||
function TruffleProvider(provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) { | ||
function TruffleProvider(provider, hdOptions, chainOptions, transactionOptions) { | ||
if (provider === void 0) { provider = 'http://localhost:9500'; } | ||
if (index === void 0) { index = 0; } | ||
if (addressCount === void 0) { addressCount = 1; } | ||
if (chainType === void 0) { chainType = "hmy" /* Harmony */; } | ||
if (chainId === void 0) { chainId = 0 /* Default */; } | ||
if (gasLimit === void 0) { gasLimit = '10000000'; } | ||
if (gasPrice === void 0) { gasPrice = '20000000000'; } | ||
var _this = _super.call(this, provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice) || this; | ||
if (hdOptions === void 0) { hdOptions = { | ||
menmonic: undefined, | ||
index: 0, | ||
addressCount: 1, | ||
}; } | ||
if (chainOptions === void 0) { chainOptions = { | ||
shardID: 0, | ||
chainType: "hmy" /* Harmony */, | ||
chainId: 0 /* Default */, | ||
}; } | ||
if (transactionOptions === void 0) { transactionOptions = { | ||
gasLimit: '10000000', | ||
gasPrice: '20000000000', | ||
}; } | ||
var _this = _super.call(this, provider, hdOptions.menmonic, hdOptions.index, hdOptions.addressCount, chainOptions.shardID, chainOptions.chainType, chainOptions.chainId, transactionOptions.gasLimit, transactionOptions.gasPrice) || this; | ||
_this.resolveResult = function (response) { | ||
@@ -29,2 +37,4 @@ var final = response.getRaw || response; | ||
var response = _this.resolveResult(res); | ||
// console.log({ response }); | ||
// console.log({ callback: callback.name }); | ||
callback(null, response); | ||
@@ -31,0 +41,0 @@ } |
{ | ||
"name": "@harmony-js/core", | ||
"version": "0.1.20", | ||
"version": "0.1.21", | ||
"description": "harmony core package", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/account": "0.1.20", | ||
"@harmony-js/account": "0.1.21", | ||
"@harmony-js/contract": "0.1.20", | ||
@@ -29,3 +29,3 @@ "@harmony-js/crypto": "0.1.14", | ||
}, | ||
"gitHead": "469f4a37b53e466271c0e8521832b99e9725091d" | ||
"gitHead": "8fef0fd0f043f1d922ed577e75edcc63fc29bc1e" | ||
} |
@@ -19,14 +19,46 @@ import { | ||
export interface HDOptions { | ||
menmonic?: string; | ||
index: number; | ||
addressCount: number; | ||
} | ||
export interface ChainOptions { | ||
shardID: number; | ||
chainType: ChainType; | ||
chainId: ChainID; | ||
} | ||
export interface TransactionOptions { | ||
gasLimit: string; | ||
gasPrice: string; | ||
} | ||
export class TruffleProvider extends HDNode { | ||
constructor( | ||
provider: string | HttpProvider | WSProvider = 'http://localhost:9500', | ||
menmonic?: string, | ||
index: number = 0, | ||
addressCount: number = 1, | ||
chainType: ChainType = ChainType.Harmony, | ||
chainId: ChainID = ChainID.Default, | ||
gasLimit = '10000000', | ||
gasPrice = '20000000000', | ||
hdOptions: HDOptions = { | ||
menmonic: undefined, | ||
index: 0, | ||
addressCount: 1, | ||
}, | ||
chainOptions: ChainOptions = { | ||
shardID: 0, | ||
chainType: ChainType.Harmony, | ||
chainId: ChainID.Default, | ||
}, | ||
transactionOptions: TransactionOptions = { | ||
gasLimit: '10000000', | ||
gasPrice: '20000000000', | ||
}, | ||
) { | ||
super(provider, menmonic, index, addressCount, chainType, chainId, gasLimit, gasPrice); | ||
super( | ||
provider, | ||
hdOptions.menmonic, | ||
hdOptions.index, | ||
hdOptions.addressCount, | ||
chainOptions.shardID, | ||
chainOptions.chainType, | ||
chainOptions.chainId, | ||
transactionOptions.gasLimit, | ||
transactionOptions.gasPrice, | ||
); | ||
} | ||
@@ -97,2 +129,3 @@ async send(...args: [RPCRequestPayload<any>, any]) { | ||
); | ||
return this.resolveResult(result); | ||
@@ -143,3 +176,6 @@ // break; | ||
} | ||
const response = this.resolveResult(res); | ||
// console.log({ response }); | ||
// console.log({ callback: callback.name }); | ||
callback(null, response); | ||
@@ -146,0 +182,0 @@ } catch (error) { |
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
481586
5597
+ Added@harmony-js/account@0.1.21(transitive)
- Removed@harmony-js/account@0.1.20(transitive)
Updated@harmony-js/account@0.1.21