Skip to content

Commit

Permalink
<feat>(sdk): add new transaction receipt in coo sdk.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Nov 16, 2023
1 parent ed6f132 commit b0a58de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion bcos-sdk/bcos-cpp-sdk/utilities/receipt/TransactionReceipt.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct TransactionReceiptData : public tars::TarsStructBase
output.clear();
logEntries.clear();
blockNumber = 0;
effectiveGasPrice = "";
}
template <typename WriterT>
void writeTo(tars::TarsOutputStream<WriterT>& _os) const
Expand Down Expand Up @@ -174,6 +175,10 @@ struct TransactionReceiptData : public tars::TarsStructBase
{
_os.write(blockNumber, 7);
}
if (effectiveGasPrice != "")
{
_os.write(effectiveGasPrice, 8);
}
}
template <typename ReaderT>
void readFrom(tars::TarsInputStream<ReaderT>& _is)
Expand All @@ -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
{
Expand All @@ -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
Expand Down Expand Up @@ -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"], true);
}
void readFromJsonString(const std::string& str) { readFromJson(tars::TC_Json::getValue(str)); }
std::ostream& display(std::ostream& _os, int _level = 0) const
Expand All @@ -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
Expand All @@ -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;
}

Expand Down Expand Up @@ -303,12 +313,14 @@ struct TransactionReceiptData : public tars::TarsStructBase
std::vector<tars::Char> output;
std::vector<bcostars::LogEntry> 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)
{
Expand Down

0 comments on commit b0a58de

Please sign in to comment.