Skip to content

Commit

Permalink
Merge pull request #291 from chenyukang/yukang-fix-rpc-doc
Browse files Browse the repository at this point in the history
Add RPC documentation generator
  • Loading branch information
quake authored Nov 13, 2024
2 parents 185be24 + c881ab3 commit 51ce132
Show file tree
Hide file tree
Showing 11 changed files with 769 additions and 284 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- uses: dsherret/rust-toolchain-file@v1
- run: cargo check
- run: |
cargo check
make check-dirty-rpc-doc
cargo-shear:
name: Cargo Shear
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ coverage-generate-report:
genhtml --ignore-errors inconsistent --ignore-errors corrupt --ignore-errors range --ignore-errors unmapped -o "${GRCOV_OUTPUT:.info=}" "${GRCOV_OUTPUT}"

coverage: coverage-run-unittests coverage-collect-data coverage-generate-report

.PHONY: gen-rpc-doc
gen-rpc-doc:
cargo install fiber-rpc-gen
fiber-rpc-gen ./src/rpc
if grep -q "TODO: add desc" ./src/rpc/README.md; then \
echo "Warning: There are 'TODO: add desc' in src/rpc/README.md, please add documentation comments to resolve them"; \
exit 1; \
fi

.PHONY: check-dirty-rpc-doc
check-dirty-rpc-doc: gen-rpc-doc
git diff --exit-code ./src/rpc/README.md
1 change: 0 additions & 1 deletion src/fiber/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ pub struct SendPaymentCommand {
// the amount of the payment
pub amount: Option<u128>,
// The hash to use within the payment's HTLC
// FIXME: this should be optional when AMP is enabled
pub payment_hash: Option<Hash256>,
// the encoded invoice to send to the recipient
pub invoice: Option<String>,
Expand Down
5 changes: 5 additions & 0 deletions src/invoice/invoice_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ pub(crate) const SIGNATURE_U5_SIZE: usize = 104;
/// The currency of the invoice, can also used to represent the CKB network chain.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
pub enum CkbInvoiceStatus {
/// The invoice is open and can be paid.
Open,
/// The invoice is cancelled.
Cancelled,
/// The invoice is expired.
Expired,
/// The invoice is received, but not settled yet.
Received,
/// The invoice is paid.
Paid,
}

Expand Down
Loading

0 comments on commit 51ce132

Please sign in to comment.