Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPC documentation generator #291

Merged
merged 8 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -48,3 +48,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
Loading