Skip to content

feat: update examples to be compatible with 8.x chain#71

Open
prashantasdeveloper wants to merge 4 commits into
masterfrom
feat/v8-examples
Open

feat: update examples to be compatible with 8.x chain#71
prashantasdeveloper wants to merge 4 commits into
masterfrom
feat/v8-examples

Conversation

@prashantasdeveloper

Copy link
Copy Markdown
Contributor

Summary

Updates all SDK examples for Polymesh chain v8 and @polymeshassociation/polymesh-sdk v30 / local-signing-manager v4. All 24 examples were run against a local dev node and adjusted for API changes, idempotent re-runs, and common local-chain constraints. The README is expanded with setup instructions, env var docs, an example index, and troubleshooting.

Changes

Dependencies & tooling

  • Bump @polymeshassociation/polymesh-sdk to 30.0.0
  • Bump @polymeshassociation/local-signing-manager to ^4.1.1
  • Add Yarn 4 config (.yarnrc.yml, packageManager in package.json)

Shared utilities

  • client.ts: default dev account uses { mnemonic: '//Alice' } instead of { uri: '//Alice' }
  • utils.ts: add getAssetHolderLabel() for settlement AssetHolder types (Account vs Portfolio)

Example updates

Example Key changes
subsidy.ts approveSubsidy / acceptSubsidy flow; resilient handling of existing/missing subsidies
transferRestrictions.ts Rewritten for setStats() + setRestrictions() API
settlements.ts party instead of identity on affirmations; configurable asset via argv; resilient affirm
createToken.ts documents.add() / documents.remove() instead of set() for removal
externalAgents.ts TxGroup.AssetManagement; resilient group create/invite/set
manageSecondaryKeys.ts Auto-generate unlinked account; resilient invite/permissions/remove
claims.ts Graceful skip when getCddClaims() is unsupported on v8
batchTransactions.ts Unique names via timestamp; second createPortfolio instead of deprecated freeze
dividendDistributions.ts DIVIDEND_CURRENCY env/argv; improved timing and graceful skip for claim/reclaim
staking.ts Use getSigningAccounts(); resilient re-runs (already bonded, etc.)
investInSto.ts v30 offerings API; distinct investor identity; settlement funding; compliance pause
stos.ts DIVIDEND_CURRENCY for raising currency; auto-create VenueType.Sto venue; optional --close
portfolios.ts / portfolioCustodians.ts Unique portfolio names; asset ID via argv; graceful custodian skips
securityTokenCaa.ts Resilient agent invite

Environment & docs

  • Expand .env.sample with DIVIDEND_CURRENCY, BOB_SEED, and inline docs
  • Rewrite README.md: setup, env var table, example index (all 24 scripts), run order, local dev notes, troubleshooting

Test plan

All 24 examples verified against a local node (ws://localhost:9944):

cp .env.sample .env
yarn install

# Create or use an asset you control
yarn run-example src/examples/createToken.ts MY_TICKER

# STO flow
yarn run-example src/examples/stos.ts <ASSET_ID>
yarn run-example src/examples/investInSto.ts <ASSET_ID>

# Asset-scoped examples
yarn run-example src/examples/<example>.ts <ASSET_ID>

# Subsidy
yarn run-example src/examples/subsidy.ts account=<BOB_ADDRESS>

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

1 participant