From 7393e358fb31800df2a8ceea2d5ca2fb86c1ca35 Mon Sep 17 00:00:00 2001 From: tahseen-ccprotocol Date: Fri, 3 Apr 2026 00:17:54 +0600 Subject: [PATCH] chore: updated readme --- .changeset/huge-boats-attack.md | 5 +++ packages/contracts/README.md | 68 +++++++++++++++------------------ 2 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 .changeset/huge-boats-attack.md diff --git a/.changeset/huge-boats-attack.md b/.changeset/huge-boats-attack.md new file mode 100644 index 00000000..47a682f4 --- /dev/null +++ b/.changeset/huge-boats-attack.md @@ -0,0 +1,5 @@ +--- +"@oaknetwork/contracts-sdk": patch +--- + +updated docs diff --git a/packages/contracts/README.md b/packages/contracts/README.md index c0c869b5..51ee1fc7 100644 --- a/packages/contracts/README.md +++ b/packages/contracts/README.md @@ -335,13 +335,11 @@ Handles fiat-style payments via a payment gateway. Manages payment creation, con > **Two treasury variants, one SDK method.** The `paymentTreasury()` method works with both on-chain implementations: > -> > | Variant | Description | > | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | > | **PaymentTreasury** | Standard payment treasury with no time restrictions. Payments can be created, confirmed, and refunded at any time while the treasury is active. | > | **TimeConstrainedPaymentTreasury** | Time-constrained variant that enforces launch-time and deadline windows on-chain. Payments can only be created within the campaign window (launch → deadline + buffer). Refunds, withdrawals, and fee disbursements are only available after launch. | > -> > Both contracts share the same ABI and the same SDK interface. Time enforcement is handled entirely on-chain — simply pass the deployed contract address regardless of which variant was deployed: ```typescript @@ -463,39 +461,6 @@ await ir.addItemsBatch(itemIds, items); --- -### Client convenience method - -```typescript -const gp = oak.globalParams("0x..."); - -const [count, fee] = await oak.multicall([ - () => gp.getNumberOfListedPlatforms(), - () => gp.getProtocolFeePercent(), -]); -``` - -### Cross-contract batching - -Reads from different entities are batched into one RPC call automatically: - -```typescript -const gp = oak.globalParams("0x..."); -const ci = oak.campaignInfo("0x..."); -const aon = oak.allOrNothingTreasury("0x..."); - -const [platformCount, goalAmount, raisedAmount] = await oak.multicall([ - () => gp.getNumberOfListedPlatforms(), - () => ci.getGoalAmount(), - () => aon.getRaisedAmount(), -]); -``` - -> Under the hood, the SDK enables viem's `batch.multicall` transport option. All `readContract` calls dispatched within the same tick are automatically aggregated into a single Multicall3 on-chain call — no raw ABI descriptors needed. - -> For complete multicall documentation, see: [Multicall](https://oaknetwork.org/docs/contracts-sdk/multicall). - ---- - ## Metrics Pre-built aggregation functions that combine multiple on-chain reads into meaningful reports. Import from `@oaknetwork/contracts-sdk/metrics`. @@ -917,7 +882,6 @@ For complete guidelines on utility functions, please refer to the following link ## Exported Entry Points - | Entry point | Contents | | ------------------------------------- | ------------------------------------------------------------------------------ | | `@oaknetwork/contracts-sdk` | Everything — client, types, utils, errors | @@ -927,7 +891,6 @@ For complete guidelines on utility functions, please refer to the following link | `@oaknetwork/contracts-sdk/errors` | Error classes and `parseContractError` only | | `@oaknetwork/contracts-sdk/metrics` | Platform, campaign, and treasury reporting helpers (not re-exported from root) | - ## Multicall Batch multiple entity read calls into a single RPC round-trip via the on-chain Multicall3 contract. Pass an array of lazy closures — the same entity read methods you'd normally `await` individually. @@ -946,6 +909,35 @@ const [platformCount, feePercent, admin] = await multicall([ ]); ``` +### Client convenience method + +```typescript +const gp = oak.globalParams("0x..."); + +const [count, fee] = await oak.multicall([ + () => gp.getNumberOfListedPlatforms(), + () => gp.getProtocolFeePercent(), +]); +``` + +### Cross-contract batching + +Reads from different entities are batched into one RPC call automatically: + +```typescript +const gp = oak.globalParams("0x..."); +const ci = oak.campaignInfo("0x..."); +const aon = oak.allOrNothingTreasury("0x..."); + +const [platformCount, goalAmount, raisedAmount] = await oak.multicall([ + () => gp.getNumberOfListedPlatforms(), + () => ci.getGoalAmount(), + () => aon.getRaisedAmount(), +]); +``` + +> Under the hood, the SDK enables viem's `batch.multicall` transport option. All `readContract` calls dispatched within the same tick are automatically aggregated into a single Multicall3 on-chain call — no raw ABI descriptors needed. + --- ## Local Development & Testing @@ -1029,4 +1021,4 @@ See [CLAUDE.md](../../CLAUDE.md) for coding standards including architecture pri - [Issues](https://github.com/oak-network/sdk/issues) - [npm](https://www.npmjs.com/package/@oaknetwork/contracts-sdk) -Questions? [Open an issue](https://github.com/oak-network/sdk/issues) or contact **[support@oaknetwork.org](mailto:support@oaknetwork.org)** \ No newline at end of file +Questions? [Open an issue](https://github.com/oak-network/sdk/issues) or contact **[support@oaknetwork.org](mailto:support@oaknetwork.org)**