diff --git a/docs/explanations/fees.md b/docs/explanations/fees.md index 93d52693c..c8d88c760 100644 --- a/docs/explanations/fees.md +++ b/docs/explanations/fees.md @@ -60,6 +60,8 @@ In an attempt to minimize Dash Platform's storage requirements, users are incent Distribution is front-loaded rather than spread evenly across those 50 years, so the refundable remainder falls fastest in the early years. Removals below a small minimum byte threshold are not refunded at all. See the [protocol constants reference](../protocol-ref/protocol-constants.md) for the storage era counts and the refund threshold. +Documents of a type that declares a [time to live](./platform-protocol-document.md#document-delete) (`ttl`) are the exception. They do not pay the permanent storage rate. Instead, each byte is priced by how long the document lives, and the document also prepays the cost of its automatic deletion. Because nothing is stored permanently, deleting such a document refunds nothing. See [Document TTL](../protocol-ref/protocol-constants.md#document-ttl) for the rates. + ## Minimum and Fixed Fees In addition to the usage-based costs above, most identity- and address-funded transitions require a protocol-defined minimum balance before processing. This is a balance floor rather than a flat charge; the fee actually deducted is still the storage and processing total. diff --git a/docs/explanations/platform-protocol-state-transition.md b/docs/explanations/platform-protocol-state-transition.md index c5c16b7f4..7db479dc7 100644 --- a/docs/explanations/platform-protocol-state-transition.md +++ b/docs/explanations/platform-protocol-state-transition.md @@ -63,7 +63,7 @@ The following table contains a list of currently defined payload types: | [Identity Top Up From Shielded Pool](../protocol-ref/shielded-pool.md#identity-top-up-from-shielded-pool) (`22`) | Add credits to an existing identity from the shielded pool | | Identity Key Limits Update (`23`) | Raise the credit budget or extend the expiry of one of an [identity's keys](../explanations/identity.md#keys) | | Contract User Moderation (`24`) | A moderator action on a moderated data contract, such as banning, suspending, or warning an identity, or removing or restoring a document | -| Contract Fee Claim (`25`) | Pay out the credit action fees a data contract's document types have collected to its owner or, in equal shares, to its moderation team | +| Contract Fee Claim (`25`) | Pay out the credit action fees a data contract's document types have collected to its owner or its moderation team (an elected team is paid according to its charter's reward split) | | Token Shielded Transfer With Shielded Fee (`26`) | Transfer tokens privately within a [token shielded pool](../explanations/shielded-pool.md#token-shielded-pools), paying the fee from the credit shielded pool | | Token Unshield With Shielded Fee (`27`) | Move tokens from a token shielded pool to an identity's token balance, paying the fee from the credit shielded pool | | Token Purchase From Shielded Pool (`28`) | Buy tokens at their direct purchase price into a token shielded pool, paying the price and fee from the credit shielded pool | diff --git a/docs/explanations/tokens.md b/docs/explanations/tokens.md index 5712780c2..20ff9c1a1 100644 --- a/docs/explanations/tokens.md +++ b/docs/explanations/tokens.md @@ -75,9 +75,10 @@ The initial token implementation includes all actions required to create, use, a #### Claim -- Claim tokens that have been allocated to an identity by a [distribution rule](#distribution-rules) but not yet credited to its balance. Claim covers both: +- Claim tokens that have been allocated to an identity by a [distribution rule](#distribution-rules) but not yet credited to its balance. Claim covers: - **Perpetual distributions** - tokens continuously emitted on a block, time, or epoch schedule that recipients must pull in order to take ownership. - **Pre-programmed distributions** - tokens scheduled for specific recipients at specific times that recipients must claim to receive. + - **Once-per-identity distributions** - a fixed amount that any identity may claim exactly once, for example for an airdrop. - Each claim collects a bounded number of unclaimed perpetual distribution intervals (128 for variable-rate distribution functions), so recipients with a long backlog may need to claim more than once to collect everything owed. #### Emergency Action @@ -253,7 +254,7 @@ following table summarizes the configurable rules and their default authorized p ##### Distribution Rules -Tokens have distribution rules to define how new tokens are introduced over time. The three +Tokens have distribution rules to define how new tokens are introduced over time. The distribution options are summarized below: | Method | Description | Example | Notes | @@ -261,6 +262,7 @@ distribution options are summarized below: | Manual Minting | Authorized users/groups can create new tokens until `maxSupply` is reached | On-demand minting | - Requires proper configuration to enable
- Minting actions may be logged or controlled via permissions | | Programmed Distribution | A fixed number of tokens are allocated to designated identities at explicit timestamps, and the recipients must [claim](#claim) them to receive the tokens | *On Jan 1, 2047, allocate `X` tokens to the provided identity* | - Schedules token release at known times
- Each entry is a one-time allocation at a fixed timestamp; there is no recurrence option
- The schedule is set when the contract is registered and cannot be changed later | | [Perpetual Distribution](../protocol-ref/data-contract-token.md#perpetual-distribution-options) | Scheduled release of tokens based on block, time, or epoch intervals | *Emit 100 tokens every 20 blocks*, or *Halve the emission every year* | - Offers ongoing, dynamic token emission patterns.
- Supports variable rates (e.g., linear, steps).
- Emissions accrue on schedule and are always collected by the recipient via a [claim](#claim). | +| [Once-per-identity Distribution](../protocol-ref/data-contract-token.md#once-per-identity-distribution) | Every identity may [claim](#claim) a fixed amount of the token once | *Airdrop 10 tokens to any identity that claims them* | - Set when the token is created and cannot be changed later
- Total payout is bounded only by `maxSupply`, so set a maximum supply
- Enabling it adds a [registration fee](../protocol-ref/data-contract-token.md#token-creation-fees) | Dash Platform also supports three options to control the destination for newly minted tokens: diff --git a/docs/reference/query-syntax.md b/docs/reference/query-syntax.md index b08729f50..aeed584ac 100644 --- a/docs/reference/query-syntax.md +++ b/docs/reference/query-syntax.md @@ -228,7 +228,7 @@ The query modifiers described here determine how query results will be sorted an | Modifier | Effect | Example | | - | - | - | -| `limit` | Restricts the number of documents returned. An omitted value or `0` uses the configured default (100 by default). Positive values cannot exceed the configured maximum (also 100 by default). See [Aggregate query limits](#aggregate-query-limits) for aggregate result modes. | `limit: 10` | +| `limit` | Restricts the number of documents returned. An omitted value uses the configured default (100 by default); SDK query objects and the v0 `getDocuments` wire also treat `0` as omitted, but the v1 wire rejects it. Positive values cannot exceed the configured maximum (also 100 by default). See [Aggregate query limits](#aggregate-query-limits) for aggregate result modes. | `limit: 10` | | `orderBy` | Returns records sorted by the field(s) provided. The `orderBy` fields must match a consecutive run of the index's properties, read from the end of the index (for a compound index, sort by one or more of its trailing fields). Required for `>`, `<`, `>=`, `<=`, `in`, `Between`, `BetweenExcludeBounds`, `BetweenExcludeLeft`, `BetweenExcludeRight`, and `startsWith` queries. Can also be used with equality-only queries to sort by a trailing field of the matched index. | `orderBy: [['normalizedLabel', 'asc']]` | | `startAt` | Returns records beginning with the document ID provided | `startAt: ''` | | `startAfter` | Returns records beginning after the document ID provided | `startAfter: ''` | diff --git a/docs/sdk-rs/overview.md b/docs/sdk-rs/overview.md index 217931783..35f6c5815 100644 --- a/docs/sdk-rs/overview.md +++ b/docs/sdk-rs/overview.md @@ -22,7 +22,7 @@ newer. ```toml [dependencies] -dash-sdk = { git="https://github.com/dashpay/platform", tag="v5.0.1" } +dash-sdk = { git="https://github.com/dashpay/platform", tag="v5.0.3" } ``` ### Examples diff --git a/docs/sdk-rs/quick-start.md b/docs/sdk-rs/quick-start.md index 5c6754cc4..353f215c4 100644 --- a/docs/sdk-rs/quick-start.md +++ b/docs/sdk-rs/quick-start.md @@ -43,10 +43,12 @@ version is installed, update it by running `rustup update`. ### Install Dash Core The Rust SDK is the best fit when you want proof-aware Platform access and tighter integration with -the current Rust codebase. Many workflows still assume access to a Dash Core full node for proof -verification and wallet-related operations. Follow the instructions below to install Dash Core and -run it on testnet. **Note:** it is possible, although not recommended, to retrieve data from Dash -Platform without proof verification. +the current Rust codebase. It requests and verifies proofs by default, which requires a source of +quorum public keys. The example below gets them from a local Dash Core node, so follow the +instructions below to install Dash Core and run it on testnet. To verify proofs without running +Dash Core, see [Using Dash Platform without Dash Core](#using-dash-platform-without-dash-core). +**Note:** it is possible, although not recommended, to retrieve data from Dash Platform without +proof verification. - [Dash Core installation instructions](inv:user:std#dashcore-installation) - [Running Dash Core on Testnet](inv:user:std#dashcore-testnet) @@ -68,16 +70,17 @@ rpcpassword= Restart Dash Core to apply the changes. -:::{admonition} **Using Dash Platform without Dash Core** -:class: attention -The Rust SDK requests proofs for all data retrieved from Platform. This makes it the recommended -(most secure) option, but also is why a Dash Core full node is currently required. +### Using Dash Platform without Dash Core -The [JavaScript SDK](../tutorials/introduction.md) provides access to Dash Platform without -requiring a full node; however, it **_does not support Dash Platform's proofs_**. The Rust DAPI -client can also perform read operations without a full node if proofs are not requested. See the -[DAPI client example](#dapi-client-example) below for details. -::: +`SdkBuilder::with_core()` is intended for development. Instead of a Dash Core node, the SDK can +get quorum public keys from Dash's quorum service by passing a `TrustedHttpContextProvider` (from +the `rs-sdk-trusted-context-provider` crate) to `SdkBuilder::with_context_provider()`. Proofs are +still verified, but the quorum keys come from that service rather than from your own node. See the +[SDK examples](https://github.com/dashpay/platform/tree/v5.0.3/packages/rs-sdk/examples) for usage. +The [JavaScript SDK](../tutorials/introduction.md) uses the same approach and also verifies proofs. + +The Rust DAPI client can also perform read operations without a full node if proofs are not +requested. See the [DAPI client example](#dapi-client-example) below for details. ## Create a new project @@ -99,9 +102,9 @@ Add the following dependencies to `Cargo.toml`: ``` toml [dependencies] -dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" } -dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] } -rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" } +dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" } +dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] } +rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" } tokio = { version = "1", features = ["full"] } ``` @@ -189,11 +192,10 @@ Add the following dependencies to `Cargo.toml`: ``` toml [dependencies] -dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" } tokio = { version = "1", features = ["full"] } -dapi-grpc = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] } -rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" } -dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] } +dapi-grpc = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] } +rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" } +dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] } ``` Open `src/main.rs` and replace the contents with this code: @@ -204,19 +206,17 @@ use dapi_grpc::platform::v0::{ get_identity_response::Version as GetIdentityResponseVersion, GetIdentityRequest, GetIdentityResponse, ResponseMetadata, }; -use dash_sdk::platform::Identifier; -use dash_sdk::{Sdk, SdkBuilder}; +use dpp::identifier::Identifier; use dpp::platform_value::string_encoding::Encoding; -use rs_dapi_client::{Address, DapiRequest, IntoInner}; +use rs_dapi_client::{Address, AddressList, DapiClient, DapiRequest, IntoInner, RequestSettings}; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box> { - let sdk = SdkBuilder::new(rs_dapi_client::AddressList::from_iter([ - "https://52.42.202.128:1443".parse::
()?, - ])) - .build() - .expect("Failed to build SDK"); + let client = DapiClient::new( + AddressList::from_iter(["https://52.42.202.128:1443".parse::
()?]), + RequestSettings::default(), + ); let identity_id = Identifier::from_string( // Replace with the ID of a previously created identity @@ -224,7 +224,7 @@ async fn main() -> Result<(), Box> { Encoding::Base58, )?; - let result = fetch_identity(identity_id, &sdk).await; + let result = fetch_identity(identity_id, &client).await; match result { Ok(_) => println!("Identity fetched successfully."), Err(e) => eprintln!("Error fetching identity: {:?}", e), @@ -233,7 +233,7 @@ async fn main() -> Result<(), Box> { Ok(()) } -async fn fetch_identity(identity_id: Identifier, sdk: &Sdk) -> Result<(), Box> { +async fn fetch_identity(identity_id: Identifier, client: &DapiClient) -> Result<(), Box> { let request = GetIdentityRequest { version: Some(dapi_grpc::platform::v0::get_identity_request::Version::V0( GetIdentityRequestV0 { @@ -244,7 +244,7 @@ async fn fetch_identity(identity_id: Identifier, sdk: &Sdk) -> Result<(), Box=18.18" } }, "node_modules/@dashevo/wasm-sdk": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@dashevo/wasm-sdk/-/wasm-sdk-5.0.1.tgz", - "integrity": "sha512-3sBZfieE7XuLV2AwD90Ga3iIDM0NsBxYlKNrnfmjitejozpF06N9kYFdIuNObIBDgcpESC0UTkDInl+Ge1+ykQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@dashevo/wasm-sdk/-/wasm-sdk-5.0.3.tgz", + "integrity": "sha512-4GpUI3jt/gNRAQcBwjOzjp+2ohssbUYz6FIkebQ7YF16ca+OIZNjDMqogJcjH7gN4upXyheGCDN/h3RGgVFJQQ==", "engines": { "node": ">=18.18" } diff --git a/package.json b/package.json index a71d3a766..da0326c70 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build:sdk": "esbuild scripts/evo-sdk-entry.js --bundle --format=esm --platform=browser --target=es2022 --minify --outfile=_static/vendor/evo-sdk.js" }, "dependencies": { - "@dashevo/evo-sdk": "5.0.1" + "@dashevo/evo-sdk": "5.0.3" }, "devDependencies": { "esbuild": "0.25.9"