From 180c325297cf841e7d88a22b953d0769069cf01f Mon Sep 17 00:00:00 2001 From: kyonRay Date: Thu, 16 Nov 2023 16:02:50 +0800 Subject: [PATCH] (sdk): add new transaction receipt in coo sdk. --- .github/workflows/workflow.yml | 10 ++++------ .../utilities/receipt/TransactionReceipt.h | 14 +++++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1f1d62e03e..7122251aca 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -29,19 +29,17 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 5 - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache with: path: | deps/ c:/vcpkg - c:/vcpkg/buildtrees - c:/vcpkg/packages - c:/vcpkg/downloads ccache - key: hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + key: vcpkg-msvc-v3-notest-${{ hashFiles('.github/workflows/workflow.yml') }} restore-keys: | - hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} + vcpkg-msvc-v3-notest-${{ hashFiles('.github/workflows/workflow.yml') }} + vcpkg-msvc-v3-notest- - name: update vcpkg run: | cd ${{ env.VCPKG_ROOT }} && git fetch --all && git checkout master && git pull diff --git a/bcos-sdk/bcos-cpp-sdk/utilities/receipt/TransactionReceipt.h b/bcos-sdk/bcos-cpp-sdk/utilities/receipt/TransactionReceipt.h index 27651ddcc5..31c6ef5693 100644 --- a/bcos-sdk/bcos-cpp-sdk/utilities/receipt/TransactionReceipt.h +++ b/bcos-sdk/bcos-cpp-sdk/utilities/receipt/TransactionReceipt.h @@ -145,6 +145,7 @@ struct TransactionReceiptData : public tars::TarsStructBase output.clear(); logEntries.clear(); blockNumber = 0; + effectiveGasPrice = ""; } template void writeTo(tars::TarsOutputStream& _os) const @@ -174,6 +175,10 @@ struct TransactionReceiptData : public tars::TarsStructBase { _os.write(blockNumber, 7); } + if (effectiveGasPrice != "") + { + _os.write(effectiveGasPrice, 8); + } } template void readFrom(tars::TarsInputStream& _is) @@ -186,6 +191,7 @@ struct TransactionReceiptData : public tars::TarsStructBase _is.read(output, 5, false); _is.read(logEntries, 6, false); _is.read(blockNumber, 7, false); + _is.read(effectiveGasPrice, 8, false); } [[nodiscard]] tars::JsonValueObjPtr writeToJson() const { @@ -197,6 +203,7 @@ struct TransactionReceiptData : public tars::TarsStructBase p->value["output"] = tars::JsonOutput::writeJson(bcos::toHexStringWithPrefix(output)); p->value["logEntries"] = tars::JsonOutput::writeJson(logEntries); p->value["blockNumber"] = tars::JsonOutput::writeJson(blockNumber); + p->value["effectiveGasPrice"] = tars::JsonOutput::writeJson(effectiveGasPrice); return p; } [[nodiscard]] std::string writeToJsonString() const @@ -227,6 +234,7 @@ struct TransactionReceiptData : public tars::TarsStructBase tars::JsonInput::readJson(logEntries, pObj->value["logEntries"], false); tars::JsonInput::readJson(blockNumber, pObj->value["blockNumber"], true); + tars::JsonInput::readJson(effectiveGasPrice, pObj->value["effectiveGasPrice"], false); } void readFromJsonString(const std::string& str) { readFromJson(tars::TC_Json::getValue(str)); } std::ostream& display(std::ostream& _os, int _level = 0) const @@ -239,6 +247,7 @@ struct TransactionReceiptData : public tars::TarsStructBase _ds.display(output, "output"); _ds.display(logEntries, "logEntries"); _ds.display(blockNumber, "blockNumber"); + _ds.display(effectiveGasPrice, "effectiveGasPrice"); return _os; } std::ostream& displaySimple(std::ostream& _os, int _level = 0) const @@ -251,6 +260,7 @@ struct TransactionReceiptData : public tars::TarsStructBase _ds.displaySimple(output, true); _ds.displaySimple(logEntries, true); _ds.displaySimple(blockNumber, false); + _ds.displaySimple(effectiveGasPrice, false); return _os; } @@ -303,12 +313,14 @@ struct TransactionReceiptData : public tars::TarsStructBase std::vector output; std::vector logEntries; tars::Int64 blockNumber; + std::string effectiveGasPrice; }; inline bool operator==(const TransactionReceiptData& l, const TransactionReceiptData& r) { return l.version == r.version && l.gasUsed == r.gasUsed && l.contractAddress == r.contractAddress && l.status == r.status && l.output == r.output && - l.logEntries == r.logEntries && l.blockNumber == r.blockNumber; + l.logEntries == r.logEntries && l.blockNumber == r.blockNumber && + l.effectiveGasPrice == r.effectiveGasPrice; } inline bool operator!=(const TransactionReceiptData& l, const TransactionReceiptData& r) {