Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/examples-drift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Examples drift

# Fails when a src/examples/**/index.js is out of sync with the native
# source files (kit.js, umi.js, cli.sh, etc.) it's generated from, so a
# hand-edited source can no longer drift silently from the published docs.

on:
pull_request:
paths:
- 'src/examples/**'
- 'scripts/build-examples.js'
- 'package.json'
- '.github/workflows/examples-drift.yml'
push:
branches: [main]

# This job checks out and installs pull-request-controlled code, so it gets no
# more than read access and never keeps the checkout token on disk.
permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
steps:
# Actions are pinned to commit SHAs; a tag can be moved, a SHA cannot.
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: pnpm run build-examples

- name: Fail if build-examples produced a diff
run: |
if ! git diff --quiet -- src/examples; then
Comment thread
tonyboylehub marked this conversation as resolved.
echo "::error::src/examples/**/index.js is out of sync with its source files. Run 'pnpm run build-examples' locally and commit the result."
git diff --stat -- src/examples
exit 1
fi
8 changes: 7 additions & 1 deletion src/examples/core/create-asset/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ mplx core asset create --wizard
mplx core asset create --name "My NFT" --uri "https://example.com/metadata.json"

# Create with files (image + metadata)
mplx core asset create --files --image "./my-nft.png" --json "./metadata.json"
mplx core asset create --files --image "./my-nft.png" --offchain "./metadata.json"

# Create with a vanity asset address
mplx core asset create \
--name "My NFT" \
--uri "https://example.com/metadata.json" \
--mint-keypair ./vanity-asset.json
7 changes: 7 additions & 0 deletions src/examples/token-metadata/fungibles/create/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ mplx toolbox token create \
--decimals 9 \
--mint-amount 1000000000000000

# Create with a vanity mint address
mplx toolbox token create \
--name "Cool Token" \
--symbol "COOL" \
--mint-amount 1000000 \
--mint-keypair ./vanity-mint.json

# Note: mint-amount is in smallest units
# With --decimals 9, to mint 1,000,000 tokens: --mint-amount 1000000000000000
# With --decimals 0 (default), to mint 1,000,000 tokens: --mint-amount 1000000
Loading