get logs when available, otherwise do not
This commit is contained in:
parent
16de8bf26c
commit
2d39454ce1
@ -116,7 +116,7 @@ export class StakingWrapper {
|
|||||||
txDefaults,
|
txDefaults,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
private async _executeTransactionAsync(calldata: string, from?: string, value?: BigNumber): Promise<TransactionReceiptWithDecodedLogs> {
|
private async _executeTransactionAsync(calldata: string, from?: string, value?: BigNumber, includeLogs?: boolean): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
const txData = {
|
const txData = {
|
||||||
from: (from ? from : this._ownerAddres),
|
from: (from ? from : this._ownerAddres),
|
||||||
to: this.getStakingProxyContract().address,
|
to: this.getStakingProxyContract().address,
|
||||||
@ -124,9 +124,11 @@ export class StakingWrapper {
|
|||||||
gas: 3000000,
|
gas: 3000000,
|
||||||
value
|
value
|
||||||
}
|
}
|
||||||
const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(
|
const txHash = await this._web3Wrapper.sendTransactionAsync(txData);
|
||||||
await this._web3Wrapper.sendTransactionAsync(txData)
|
if (includeLogs) {
|
||||||
);
|
|
||||||
|
}
|
||||||
|
const txReceipt = await (includeLogs ? this._logDecoder.getTxWithDecodedLogsAsync(txHash) : this._web3Wrapper.awaitTransactionSuccessAsync(txHash));
|
||||||
return txReceipt;
|
return txReceipt;
|
||||||
}
|
}
|
||||||
private async _callAsync(calldata: string, from?: string): Promise<any> {
|
private async _callAsync(calldata: string, from?: string): Promise<any> {
|
||||||
@ -268,11 +270,13 @@ export class StakingWrapper {
|
|||||||
///// EPOCHS /////
|
///// EPOCHS /////
|
||||||
public async goToNextEpochAsync(): Promise<TransactionReceiptWithDecodedLogs> {
|
public async goToNextEpochAsync(): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
const calldata = this.getStakingContract().goToNextEpoch.getABIEncodedTransactionData();
|
const calldata = this.getStakingContract().goToNextEpoch.getABIEncodedTransactionData();
|
||||||
const txReceipt = await this._executeTransactionAsync(calldata);
|
const txReceipt = await this._executeTransactionAsync(calldata, undefined, new BigNumber(0), true);
|
||||||
//console.log(JSON.stringify(txReceipt, null , 4));
|
console.log(JSON.stringify(txReceipt, null , 4));
|
||||||
const l = txReceipt.logs[0] as LogWithDecodedArgs<StakingEEventArgs>;
|
//console.log((txReceipt.logs[0] as LogWithDecodedArgs<StakingEEventArgs>).args);
|
||||||
console.log(l.args);
|
//console.log((txReceipt.logs[1] as LogWithDecodedArgs<StakingEEventArgs>).args);
|
||||||
console.log(`finalization: gasUsed = ${txReceipt.gasUsed} / cumulativeGasUsed = ${txReceipt.cumulativeGasUsed}`);
|
//console.log((txReceipt.logs[2] as LogWithDecodedArgs<StakingEEventArgs>).args);
|
||||||
|
|
||||||
|
console.log(`finalization: gasUsed = ${txReceipt.gasUsed} / cumulativeGasUsed = ${txReceipt.cumulativeGasUsed}`);
|
||||||
return txReceipt;
|
return txReceipt;
|
||||||
}
|
}
|
||||||
public async skipToNextEpochAsync(): Promise<TransactionReceiptWithDecodedLogs> {
|
public async skipToNextEpochAsync(): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user