You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(tutorials): sync to Evo SDK 4.0.0-rc.2 and document token-burn scarcity (#152)
* docs(tutorials): sync with tutorial repo
-Bump to Evo SDK v4.0-rc.2 (3.1 was renamed 4.0) and Node 22.
-Add the DashMint token-cost flow: a fixed-supply token configuration burned on card create, with creationRestrictionMode opened to anyone who can pay the token cost.
- Add note update revision checking, raise the withdrawal amount to the protocol minimum, and drop the obsolete note message maxLength.
* docs(tutorials): document DashMint token-burn scarcity model
Add a token flow section and Transfer DashMint tokens walkthrough to DashMint Lab, register both blocks in the sync map, and align the intro, TL;DR, and contract-schema prose with token-gated minting.
For Dashnote, restructure the update-note steps, note the expectedRevision guard, fix the message maxLength description, and bump the Node prerequisite to 22.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
import { PLATFORM_VERSION_OVERRIDE } from "../../../../platformVersion.mjs";
258
259
import { loadSdkModule } from "./sdkModule";
259
260
import type { DashKeyManager, DashSdk } from "./types";
260
261
@@ -297,7 +298,7 @@ export async function createNote({
297
298
298
299
const json =
299
300
typeof document.toJSON === "function"
300
-
? (document.toJSON() as Record<string, unknown>)
301
+
? (document.toJSON(PLATFORM_VERSION_OVERRIDE) as Record<string, unknown>)
301
302
: {};
302
303
const noteId = String(json.$id ?? json.id ?? "");
303
304
if (!noteId) {
@@ -310,7 +311,13 @@ export async function createNote({
310
311
311
312
### Update a note
312
313
313
-
`updateNote.ts` is the canonical fetch-then-bump-revision write. It calls `sdk.documents.get` to read the on-chain revision, increments it by one, builds a new `Document` with the same id and ownerId, and submits via `sdk.documents.replace`. Replays without bumping the revision are rejected by the state transition.
314
+
`updateNote.ts` is the canonical fetch-then-bump-revision write:
315
+
316
+
- Call `sdk.documents.get` to read the current on-chain revision.
317
+
- Increment it by one and build a new `Document` with the same id and ownerId.
318
+
- Submit via `sdk.documents.replace`. Replays without bumping the revision are rejected by the state transition.
319
+
320
+
The optional `expectedRevision` parameter guards against a concurrent edit: if the on-chain revision no longer matches what the caller last loaded, the update is refused with a "reload and try again" error instead of silently overwriting the newer version.
314
321
315
322
```{code-block} typescript
316
323
:caption: updateNote.ts
@@ -320,6 +327,10 @@ export async function createNote({
320
327
* Update an existing note. Fetches the current document to bump its revision,
321
328
* then submits a replace state transition.
322
329
*
330
+
* Pass `expectedRevision` to refuse the update if the network's revision
331
+
* doesn't match — i.e. the note was changed on the network after the local
@@ -431,7 +454,7 @@ export async function deleteNote({
431
454
The note contract is intentionally minimal: one document type, two user-editable fields, two indices to support the recent-notes list. Key choices worth calling out:
432
455
433
456
-`documentsMutable: true` and `canBeDeleted: true` — notes are editable and deletable.
434
-
-`maxLength: 120` for `title`and `maxLength: 10000` for `message` are **UTF-8 byte budgets**, not character counts. The editor's progress bar reflects bytes; emoji and non-ASCII sequences consume more of the budget than ASCII.
457
+
-`maxLength: 120` for `title`caps the title; `message` carries no `maxLength` and is instead bounded by Platform's per-field byte limit. The editor's progress bar tracks the `message` byte count against that limit — emoji and non-ASCII sequences consume more of the budget than ASCII.
435
458
-`byOwnerUpdated` (`$ownerId`, `$updatedAt`) is the index the recent-notes list paginates on; `byOwnerCreated` is its created-time sibling.
436
459
437
460
`registerContract` builds the `DataContract`, calls `setConfig()` to lock in those choices, then publishes via `sdk.contracts.publish`. `ensureContract` is the lazy wrapper used by the login flow: re-use a saved contract ID if one is present, otherwise register a fresh one.
Copy file name to clipboardExpand all lines: docs/tutorials/introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Building on Dash Platform requires first registering an Identity and then regist
12
12
13
13
The tutorials in this section are written in JavaScript and use [Node.js](https://nodejs.org/en/about/). The following prerequisites are necessary to complete the tutorials:
14
14
15
-
-[Node.js](https://nodejs.org/en/) (v20+)
15
+
-[Node.js](https://nodejs.org/en/) (v22+)
16
16
- Familiarity with JavaScript asynchronous functions using [async/await](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await)
17
17
- The [Dash JavaScript SDK](https://www.npmjs.com/package/@dashevo/evo-sdk) (see [Connecting to a Network](../tutorials/connecting-to-testnet.md#1-install-the-dash-sdk))
0 commit comments