Skip to content

fix: card-game tutorial — match actual evo-sdk API#8

Open
thepastaclaw wants to merge 1 commit into
developfrom
fix/card-game-tutorial
Open

fix: card-game tutorial — match actual evo-sdk API#8
thepastaclaw wants to merge 1 commit into
developfrom
fix/card-game-tutorial

Conversation

@thepastaclaw
Copy link
Copy Markdown
Owner

Adds a corrected version of the Card Game with Tokens tutorial that compiles against @dashevo/evo-sdk@3.1.0-dev.1.

This is the most complex tutorial, combining documents and tokens. All fixes from the car-sales and basic-token tutorials apply here.

Changes from original tutorial

API Tutorial (broken) Fixed
contracts.publish() Simplified fields + tokens: [config] DataContract with TokenConfiguration + identityKey + IdentitySigner
documents.create() { contractId, documentType, document: {...} } { document: new Document({...}), identityKey, signer }
documents.query() contractId, documentType dataContractId, documentTypeName
documents.transfer() { contractId, documentId, recipientId, privateKeyWif } { document: Document, recipientId: Identifier, identityKey, signer }
tokens.mint() { tokenId, amount, privateKeyWif } { dataContractId, tokenPosition, amount: bigint, identityKey, signer }
tokens.transfer() { tokenId, identityId, privateKeyWif } { dataContractId, tokenPosition, senderId, identityKey, signer }
doc.getData() method doc.properties
contract.getId() method contract.id

npx tsc --noEmit passes with zero errors.

Resolves #5

Combines all fixes from car-sales and basic-token tutorials:
- contracts.publish() with DataContract + TokenConfiguration
- documents.create/transfer: construct Document objects
- documents.query: dataContractId/documentTypeName
- documents.transfer: pass full Document + recipientId
- tokens.mint/transfer: dataContractId+tokenPosition, identityKey+signer
- doc.properties instead of doc.getData()
- contract.id instead of contract.getId()
- All token amounts as bigint

TypeScript compiles clean against @dashevo/evo-sdk@3.1.0-dev.1.

Resolves #5
@thepastaclaw thepastaclaw force-pushed the fix/card-game-tutorial branch from dac6f02 to b54a65f Compare April 2, 2026 14:34
@thepastaclaw
Copy link
Copy Markdown
Owner Author

✅ Live Testnet Run — All Steps Passed

Ran the card game tutorial on testnet with identity HHjmkbcwqFzToaoyvQcP45JZro7PoczAv7Nii57uYPX1.

Contract: 2GntY9SSk9BT81LhLGiExxLY3Vzv5seHSjz2fvH9z8LC
Gem token: 4mAQSVhgP5aeVBASSRdKGXrCjzPW4qWpFMkBG1fvTUCy

Minting 100 Gems...
Minted!

Creating cards...
  Created: Flame Sprite
  Created: Tidal Guardian

Cards found: 2
  Flame Sprite - fire - ATK:15 DEF:10
  Tidal Guardian - water - ATK:10 DEF:20

Recording match...
Match recorded!
Rewarding winner with 10 Gems...
Rewarded!

Gem balance: 110 Gems

=== CARD GAME: ALL STEPS PASSED ===

Additional issues discovered during live testing

All issues from Car Sales (#6) and Basic Token (#7) apply here, plus:

  1. Mixed security levels needed — Contract publish and document create/query work with HIGH key, but token mint/burn/transfer require CRITICAL. A real tutorial would need to demonstrate using different keys for different operation types.
  2. deck document type omitted from test — The deck type references card IDs, which would need to be populated after card creation. The schema itself is valid but practical testing requires a multi-step workflow.
  3. Document transfer not tested — Requires a second identity to transfer cards to. The API signature is confirmed correct from the type definitions (tested in car-sales replace flow).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card Game tutorial: API mismatches with evo-sdk@3.1.0-dev.1

1 participant