Skip to content

fix: basic-token tutorial — match actual evo-sdk API#7

Open
thepastaclaw wants to merge 1 commit into
developfrom
fix/basic-token-tutorial
Open

fix: basic-token tutorial — match actual evo-sdk API#7
thepastaclaw wants to merge 1 commit into
developfrom
fix/basic-token-tutorial

Conversation

@thepastaclaw
Copy link
Copy Markdown
Owner

Adds a corrected version of the Basic Token tutorial that compiles against @dashevo/evo-sdk@3.1.0-dev.1.

Changes from original tutorial

API Tutorial (broken) Fixed
contracts.publish() { identityId, documentSchemas, tokens: [config] } { dataContract: new DataContract({..., tokens: {0: tokenConfig}}), identityKey, signer }
Token config { conventions, manualMinting: { rules: { type: "ownerOnly" } } } Full TokenConfiguration with ChangeControlRules, TokenDistributionRules, TokenKeepsHistoryRules, TokenMarketplaceRules
tokens.mint() { tokenId, amount: number, privateKeyWif } { dataContractId, tokenPosition: 0, amount: bigint, identityKey, signer }
tokens.transfer() { tokenId, identityId, privateKeyWif } { dataContractId, tokenPosition, senderId, identityKey, signer }
tokens.burn() { tokenId, identityId, privateKeyWif } { dataContractId, tokenPosition, identityId, identityKey, signer }
Balance lookup balances.get(tokenId) (string) Iterate Map<Identifier, bigint> entries
contract.getId() method contract.id (property)

npx tsc --noEmit passes with zero errors.

Resolves #4

- contracts.publish(): construct DataContract with TokenConfiguration
- TokenConfiguration requires full setup: conventions, ChangeControlRules,
  TokenDistributionRules, TokenKeepsHistoryRules, TokenMarketplaceRules
- tokens.mint/transfer/burn: use dataContractId+tokenPosition, not tokenId
- tokens.mint/transfer/burn: require identityKey+signer, not privateKeyWif
- token amounts are bigint (10_000_00n), not number
- tokens.transfer: senderId instead of identityId
- Map<Identifier, bigint> iteration instead of .get(string)
- contract.id instead of contract.getId()

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

Resolves #4
@thepastaclaw thepastaclaw force-pushed the fix/basic-token-tutorial branch from 467eae5 to 5c51795 Compare April 2, 2026 14:33
@thepastaclaw
Copy link
Copy Markdown
Owner Author

✅ Live Testnet Run — All Steps Passed

Ran the basic token tutorial on testnet with identity HHjmkbcwqFzToaoyvQcP45JZro7PoczAv7Nii57uYPX1.

Contract published: EiVuRbU3d9ANGjnNokBJamMDGaL9QdPBsV44fUeMPMNy
Token ID: AmyDrLavqJcPLgU7K6NxCLom7JJKi96q5fZMMuxtBRkF

Minting 10,000.00 CoffeeCoins...
Minted!
Balance: 10000 CoffeeCoins

Burning 100.00...
Burned!
After burn: 9900 CoffeeCoins

=== BASIC TOKEN: ALL STEPS PASSED ===

Additional issues discovered during live testing

  1. Token operations require CRITICAL security level key — The tutorial uses signingKeyIndex: 0 (Master key) for token ops, but minting/burning/transferring tokens requires a CRITICAL-level key. Using HIGH or MASTER fails with "Invalid public key security level HIGH. The state transition requires one of CRITICAL".
  2. Schema properties require position fields (same as car-sales).
  3. identityNonce needs +1 (same as car-sales).
  4. TokenConfiguration is extremely verbose — What the tutorial shows as 10 lines of config requires ~30 lines of SDK class instantiation with ChangeControlRules, TokenDistributionRules, TokenKeepsHistoryRules, and TokenMarketplaceRules. This is the biggest usability gap.

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.

Basic Token tutorial: API mismatches with evo-sdk@3.1.0-dev.1

1 participant