genlayer 0.39.2 → 0.40.0-clarke.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/.github/scripts/validate-branch-policy.sh +107 -0
  2. package/.github/workflows/branch-policy.yml +24 -0
  3. package/.github/workflows/fast-forward-main.yaml +57 -0
  4. package/.github/workflows/publish.yml +49 -4
  5. package/.github/workflows/retarget-main-prs.yaml +53 -0
  6. package/.github/workflows/smoke.yml +3 -1
  7. package/.github/workflows/sync-docs.yml +0 -24
  8. package/.github/workflows/validate-code.yml +6 -1
  9. package/CHANGELOG.md +30 -2
  10. package/CONTRIBUTING.md +6 -14
  11. package/README.md +57 -11
  12. package/dist/index.js +11908 -4368
  13. package/docs/BRANCHING.md +58 -0
  14. package/docs/api-references/_meta.json +7 -1
  15. package/docs/api-references/accounts/account/send.mdx +1 -1
  16. package/docs/api-references/configuration/network/add.mdx +32 -0
  17. package/docs/api-references/configuration/network/remove.mdx +21 -0
  18. package/docs/api-references/configuration/network.mdx +3 -1
  19. package/docs/api-references/contracts/call.mdx +1 -0
  20. package/docs/api-references/contracts/deploy.mdx +8 -0
  21. package/docs/api-references/contracts/write.mdx +8 -0
  22. package/docs/api-references/estimate-fees.mdx +29 -0
  23. package/docs/api-references/finalize-batch.mdx +21 -0
  24. package/docs/api-references/finalize.mdx +21 -0
  25. package/docs/api-references/index.mdx +6 -1
  26. package/docs/api-references/localnet/localnet/validators/create-random.mdx +3 -1
  27. package/docs/api-references/staking/staking/active-validators.mdx +1 -1
  28. package/docs/api-references/staking/staking/banned-validators.mdx +1 -1
  29. package/docs/api-references/staking/staking/delegation-info.mdx +1 -1
  30. package/docs/api-references/staking/staking/delegator-claim.mdx +2 -1
  31. package/docs/api-references/staking/staking/delegator-exit.mdx +2 -1
  32. package/docs/api-references/staking/staking/delegator-join.mdx +2 -1
  33. package/docs/api-references/staking/staking/epoch-info.mdx +1 -1
  34. package/docs/api-references/staking/staking/prime-all.mdx +2 -1
  35. package/docs/api-references/staking/staking/quarantined-validators.mdx +1 -1
  36. package/docs/api-references/staking/staking/set-identity.mdx +2 -1
  37. package/docs/api-references/staking/staking/set-operator.mdx +2 -1
  38. package/docs/api-references/staking/staking/validator-claim.mdx +2 -1
  39. package/docs/api-references/staking/staking/validator-deposit.mdx +2 -1
  40. package/docs/api-references/staking/staking/validator-exit.mdx +2 -1
  41. package/docs/api-references/staking/staking/validator-history.mdx +1 -1
  42. package/docs/api-references/staking/staking/validator-info.mdx +1 -1
  43. package/docs/api-references/staking/staking/validator-join.mdx +2 -1
  44. package/docs/api-references/staking/staking/validator-prime.mdx +2 -1
  45. package/docs/api-references/staking/staking/validators.mdx +5 -2
  46. package/docs/api-references/staking/staking/wizard.mdx +1 -0
  47. package/docs/api-references/staking/staking.mdx +1 -1
  48. package/docs/api-references/transactions/appeal.mdx +1 -0
  49. package/docs/api-references/transactions/receipt.mdx +1 -1
  50. package/docs/api-references/vesting/claim.mdx +28 -0
  51. package/docs/api-references/vesting/delegate.mdx +29 -0
  52. package/docs/api-references/vesting/list.mdx +21 -0
  53. package/docs/api-references/vesting/undelegate.mdx +28 -0
  54. package/docs/api-references/vesting/validator/claim.mdx +28 -0
  55. package/docs/api-references/vesting/validator/create.mdx +29 -0
  56. package/docs/api-references/vesting/validator/deposit.mdx +29 -0
  57. package/docs/api-references/vesting/validator/exit.mdx +29 -0
  58. package/docs/api-references/vesting/validator/join.mdx +29 -0
  59. package/docs/api-references/vesting/validator/list.mdx +22 -0
  60. package/docs/api-references/vesting/validator/operator-transfer/cancel.mdx +28 -0
  61. package/docs/api-references/vesting/validator/operator-transfer/complete.mdx +28 -0
  62. package/docs/api-references/vesting/validator/operator-transfer/initiate.mdx +30 -0
  63. package/docs/api-references/vesting/validator/operator-transfer.mdx +25 -0
  64. package/docs/api-references/vesting/validator/set-identity.mdx +37 -0
  65. package/docs/api-references/vesting/validator/status.mdx +22 -0
  66. package/docs/api-references/vesting/validator.mdx +31 -0
  67. package/docs/api-references/vesting/withdraw.mdx +24 -0
  68. package/docs/api-references/vesting.mdx +28 -0
  69. package/docs/api-references/wallet/connect.mdx +17 -0
  70. package/docs/api-references/wallet/disconnect.mdx +15 -0
  71. package/docs/api-references/wallet/status.mdx +15 -0
  72. package/docs/api-references/wallet.mdx +25 -0
  73. package/package.json +9 -6
  74. package/scripts/generate-cli-docs.mjs +10 -2
  75. package/scripts/run-esbuild.mjs +12 -0
  76. package/src/commands/account/index.ts +2 -1
  77. package/src/commands/account/send.ts +3 -7
  78. package/src/commands/account/show.ts +17 -5
  79. package/src/commands/balances/BalancesAction.ts +276 -0
  80. package/src/commands/balances/index.ts +18 -0
  81. package/src/commands/contracts/deploy.ts +44 -16
  82. package/src/commands/contracts/estimateFees.ts +24 -15
  83. package/src/commands/contracts/execution.ts +145 -0
  84. package/src/commands/contracts/fees.ts +212 -58
  85. package/src/commands/contracts/index.ts +50 -41
  86. package/src/commands/contracts/write.ts +37 -10
  87. package/src/commands/network/index.ts +25 -0
  88. package/src/commands/network/setNetwork.ts +238 -28
  89. package/src/commands/staking/StakingAction.ts +86 -24
  90. package/src/commands/staking/delegatorClaim.ts +44 -0
  91. package/src/commands/staking/delegatorExit.ts +60 -0
  92. package/src/commands/staking/delegatorJoin.ts +46 -0
  93. package/src/commands/staking/index.ts +186 -156
  94. package/src/commands/staking/setIdentity.ts +62 -0
  95. package/src/commands/staking/setOperator.ts +42 -0
  96. package/src/commands/staking/validatorClaim.ts +39 -0
  97. package/src/commands/staking/validatorDeposit.ts +42 -0
  98. package/src/commands/staking/validatorExit.ts +57 -0
  99. package/src/commands/staking/validatorHistory.ts +34 -12
  100. package/src/commands/staking/validatorJoin.ts +50 -0
  101. package/src/commands/staking/validatorPrime.ts +88 -0
  102. package/src/commands/staking/validators.ts +619 -0
  103. package/src/commands/staking/wizard.ts +515 -34
  104. package/src/commands/transactions/appeal.ts +7 -0
  105. package/src/commands/transactions/finalize.ts +27 -2
  106. package/src/commands/transactions/index.ts +29 -25
  107. package/src/commands/vesting/VestingAction.ts +173 -0
  108. package/src/commands/vesting/claim.ts +83 -0
  109. package/src/commands/vesting/delegate.ts +94 -0
  110. package/src/commands/vesting/index.ts +286 -0
  111. package/src/commands/vesting/list.ts +157 -0
  112. package/src/commands/vesting/undelegate.ts +110 -0
  113. package/src/commands/vesting/validatorClaim.ts +85 -0
  114. package/src/commands/vesting/validatorCreate.ts +116 -0
  115. package/src/commands/vesting/validatorDeposit.ts +92 -0
  116. package/src/commands/vesting/validatorExit.ts +110 -0
  117. package/src/commands/vesting/validatorList.ts +93 -0
  118. package/src/commands/vesting/validatorOperatorTransfer.ts +254 -0
  119. package/src/commands/vesting/validatorSetIdentity.ts +136 -0
  120. package/src/commands/vesting/vestingTypes.ts +156 -0
  121. package/src/commands/vesting/withdraw.ts +86 -0
  122. package/src/commands/wallet/WalletAction.ts +190 -0
  123. package/src/commands/wallet/index.ts +36 -0
  124. package/src/index.ts +6 -0
  125. package/src/lib/actions/BaseAction.ts +156 -3
  126. package/src/lib/config/simulator.ts +3 -3
  127. package/src/lib/networks/customNetworks.ts +253 -0
  128. package/src/lib/vesting/availableToStake.ts +29 -0
  129. package/src/lib/wallet/bridgePage.ts +266 -0
  130. package/src/lib/wallet/browserBridge.ts +694 -0
  131. package/src/lib/wallet/browserSend.ts +316 -0
  132. package/src/lib/wallet/sessionClient.ts +148 -0
  133. package/src/lib/wallet/sessionConstants.ts +50 -0
  134. package/src/lib/wallet/sessionDaemon.ts +238 -0
  135. package/src/lib/wallet/sessionDescriptor.ts +95 -0
  136. package/src/lib/wallet/sessionResolver.ts +131 -0
  137. package/src/lib/wallet/spawnDaemon.ts +104 -0
  138. package/src/lib/wallet/stakingTx.ts +12 -0
  139. package/src/lib/wallet/txBuilders.ts +114 -0
  140. package/src/lib/wallet/walletOption.ts +23 -0
  141. package/support/ci/ACTIVE_DEV_BRANCH +1 -0
  142. package/tests/actions/balances.test.ts +247 -0
  143. package/tests/actions/customNetworkProfiles.test.ts +300 -0
  144. package/tests/actions/deploy.test.ts +272 -6
  145. package/tests/actions/estimateFees.test.ts +159 -16
  146. package/tests/actions/hasLiveWalletSession.test.ts +55 -0
  147. package/tests/actions/show.test.ts +94 -0
  148. package/tests/actions/staking.test.ts +311 -5
  149. package/tests/actions/stakingWizard.test.ts +417 -0
  150. package/tests/actions/vesting.test.ts +160 -0
  151. package/tests/actions/walletConnect.test.ts +161 -0
  152. package/tests/actions/walletSession.test.ts +86 -0
  153. package/tests/actions/write.test.ts +292 -24
  154. package/tests/commands/balances.test.ts +73 -0
  155. package/tests/commands/deploy.test.ts +34 -14
  156. package/tests/commands/estimateFees.test.ts +27 -15
  157. package/tests/commands/network.test.ts +56 -0
  158. package/tests/commands/staking.test.ts +97 -10
  159. package/tests/commands/stakingValidators.test.ts +197 -0
  160. package/tests/commands/vesting.test.ts +555 -0
  161. package/tests/commands/wallet.test.ts +64 -0
  162. package/tests/commands/write.test.ts +25 -0
  163. package/tests/index.test.ts +12 -0
  164. package/tests/libs/browserBridge.test.ts +412 -0
  165. package/tests/libs/browserSend.test.ts +183 -0
  166. package/tests/libs/sessionClient.test.ts +155 -0
  167. package/tests/libs/sessionDaemon.test.ts +141 -0
  168. package/tests/libs/sessionDescriptor.test.ts +95 -0
  169. package/tests/libs/sessionResolver.test.ts +283 -0
  170. package/tests/libs/spawnDaemon.test.ts +117 -0
  171. package/tests/libs/stakingTx.test.ts +116 -0
  172. package/tests/libs/txBuilders.test.ts +152 -0
  173. package/tests/services/simulator.test.ts +15 -0
  174. package/tests/setup.ts +33 -0
  175. package/tests/smoke.test.ts +13 -8
  176. package/vitest.config.ts +1 -0
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ failed=0
5
+
6
+ error() {
7
+ echo "::error::$*"
8
+ failed=1
9
+ }
10
+
11
+ warning() {
12
+ echo "::warning::$*"
13
+ }
14
+
15
+ active_branch_file="support/ci/ACTIVE_DEV_BRANCH"
16
+ if [[ ! -f "${active_branch_file}" ]]; then
17
+ error "${active_branch_file} is required."
18
+ active_branch=""
19
+ else
20
+ active_branch="$(tr -d '[:space:]' < "${active_branch_file}")"
21
+ fi
22
+
23
+ if [[ -z "${active_branch}" ]]; then
24
+ error "${active_branch_file} must not be empty."
25
+ elif [[ "${active_branch}" == "main" ]]; then
26
+ error "${active_branch_file} must point to a dev branch, not main."
27
+ elif [[ "${active_branch}" != *-dev ]]; then
28
+ warning "${active_branch_file} should normally point to a -dev branch; got ${active_branch}."
29
+ fi
30
+
31
+ release_branch="${active_branch%-dev}"
32
+ default_branch="${GITHUB_DEFAULT_BRANCH:-}"
33
+ event_name="${GITHUB_EVENT_NAME:-local}"
34
+ base_ref="${GITHUB_BASE_REF:-}"
35
+ head_ref="${GITHUB_HEAD_REF:-}"
36
+ ref_name="${GITHUB_REF_NAME:-}"
37
+ actor="${GITHUB_ACTOR:-}"
38
+
39
+ if [[ -n "${default_branch}" && "${default_branch}" != "main" ]]; then
40
+ warning "Repository default branch should be main after branch-policy rollout; currently ${default_branch}."
41
+ fi
42
+
43
+ if [[ -n "${base_ref}" && "${base_ref}" == "main" ]]; then
44
+ warning "PR targets main; retarget-main-prs should move it to ${active_branch}."
45
+ fi
46
+
47
+ if [[ -n "${base_ref}" && -n "${active_branch}" ]]; then
48
+ if [[ "${base_ref}" == "${release_branch}" && "${head_ref}" != "${active_branch}" && "${ALLOW_DIRECT_RELEASE_PR:-false}" != "true" ]]; then
49
+ error "PRs into ${release_branch} must come from ${active_branch}. Merge feature work into ${active_branch}, then promote ${active_branch} -> ${release_branch}."
50
+ fi
51
+ fi
52
+
53
+ if [[ "${event_name}" == "push" && "${ref_name}" == "main" ]]; then
54
+ case "${actor}" in
55
+ github-actions[bot]|ci-core-e2e-runner[bot])
56
+ ;;
57
+ *)
58
+ error "main should only move by automation from ${active_branch}; direct push actor was ${actor:-unknown}."
59
+ ;;
60
+ esac
61
+ fi
62
+
63
+ if [[ ! -f ".github/workflows/fast-forward-main.yaml" ]]; then
64
+ error ".github/workflows/fast-forward-main.yaml is required."
65
+ fi
66
+
67
+ if [[ ! -f ".github/workflows/retarget-main-prs.yaml" ]]; then
68
+ error ".github/workflows/retarget-main-prs.yaml is required."
69
+ fi
70
+
71
+ if [[ -f ".github/workflows/release-from-main.yml" ]]; then
72
+ error ".github/workflows/release-from-main.yml is forbidden. Releases must be tag/version-branch driven."
73
+ fi
74
+
75
+ if [[ -f "release.config.js" ]]; then
76
+ error "release.config.js is forbidden in versioned tooling branches; semantic-release-on-main must not be restored."
77
+ fi
78
+
79
+ if [[ -f ".github/workflows/release-from-tag.yml" ]]; then
80
+ if ! grep -Fq 'v*.*.*' .github/workflows/release-from-tag.yml; then
81
+ error "release-from-tag.yml must trigger only from version tags matching v*.*.*."
82
+ fi
83
+ if ! grep -Fq 'refs/remotes/origin/${version_branch}' .github/workflows/release-from-tag.yml || \
84
+ ! grep -Fq 'tag_commit' .github/workflows/release-from-tag.yml || \
85
+ ! grep -Fq 'branch_head' .github/workflows/release-from-tag.yml; then
86
+ error "release-from-tag.yml must verify the tag commit is the current matching version branch head."
87
+ fi
88
+ fi
89
+
90
+ if [[ -f ".github/workflows/manual-docker-release.yml" ]]; then
91
+ if ! grep -Fq 'expected_branch=' .github/workflows/manual-docker-release.yml; then
92
+ error "manual-docker-release.yml must derive and enforce the expected version branch from the tag."
93
+ fi
94
+ if ! grep -Fq './.github/workflows/release-from-tag.yml' .github/workflows/manual-docker-release.yml; then
95
+ error "manual-docker-release.yml must delegate image promotion to release-from-tag.yml."
96
+ fi
97
+ fi
98
+
99
+ if [[ "${failed}" -ne 0 ]]; then
100
+ exit 1
101
+ fi
102
+
103
+ if [[ -n "${base_ref}" ]]; then
104
+ echo "Branch policy ok for PR ${head_ref} -> ${base_ref}; active dev branch is ${active_branch}."
105
+ else
106
+ echo "Branch policy ok for ${event_name} on ${ref_name:-detached ref}; active dev branch is ${active_branch}."
107
+ fi
@@ -0,0 +1,24 @@
1
+ name: Branch Policy
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened, edited, ready_for_review]
6
+ push:
7
+ branches:
8
+ - "**"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ branch-policy:
16
+ name: Validate branch policy
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Validate branch policy
22
+ env:
23
+ GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
24
+ run: ./.github/scripts/validate-branch-policy.sh
@@ -0,0 +1,57 @@
1
+ name: Fast-forward main
2
+
3
+ # main is the static/default branch for GitHub UX and tools that assume a
4
+ # stable default branch. It is not the integration target. On each push to the
5
+ # configured active dev branch, fast-forward main to that commit.
6
+
7
+ on:
8
+ push:
9
+ branches: ["**"]
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: write
14
+
15
+ concurrency:
16
+ group: fast-forward-main-${{ github.repository }}
17
+ cancel-in-progress: false
18
+
19
+ defaults:
20
+ run:
21
+ shell: bash
22
+
23
+ jobs:
24
+ fast-forward:
25
+ if: github.ref_type == 'branch'
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 0
31
+
32
+ - name: Fast-forward main to active dev branch
33
+ run: |
34
+ set -euo pipefail
35
+
36
+ active_branch="$(tr -d '[:space:]' < support/ci/ACTIVE_DEV_BRANCH)"
37
+ if [[ -z "${active_branch}" || "${active_branch}" == "main" ]]; then
38
+ echo "::error::support/ci/ACTIVE_DEV_BRANCH must name a non-main dev branch"
39
+ exit 1
40
+ fi
41
+
42
+ if [[ "${GITHUB_REF_NAME}" != "${active_branch}" ]]; then
43
+ echo "Push was to ${GITHUB_REF_NAME}; active dev branch is ${active_branch}. Nothing to do."
44
+ exit 0
45
+ fi
46
+
47
+ if git ls-remote --exit-code --heads origin main >/dev/null 2>&1; then
48
+ git fetch origin main
49
+ if ! git merge-base --is-ancestor origin/main HEAD; then
50
+ echo "::error::main has diverged from ${active_branch}; refusing non-fast-forward update"
51
+ exit 1
52
+ fi
53
+ else
54
+ echo "main does not exist yet; creating it at ${GITHUB_SHA}."
55
+ fi
56
+
57
+ git push origin "HEAD:refs/heads/main"
@@ -7,6 +7,11 @@ name: Publish Package to NPM
7
7
  # workflow fires on the tag push, sanity-checks the tag matches
8
8
  # package.json, builds, publishes to npm, and creates the GitHub
9
9
  # Release. It never bumps or tags by itself.
10
+ #
11
+ # Stable tags such as v0.39.2 publish to npm's latest dist-tag.
12
+ # Prerelease tags such as v0.40.0-clarke.1 publish to a matching
13
+ # channel dist-tag (clarke) and create a GitHub prerelease.
14
+ # Prereleases must never become latest.
10
15
  on:
11
16
  workflow_dispatch:
12
17
  push:
@@ -32,8 +37,14 @@ jobs:
32
37
 
33
38
  - run: npm ci
34
39
 
35
- - name: Verify tag matches package.json version
40
+ - name: Verify tag and resolve npm dist-tag
41
+ id: version
36
42
  run: |
43
+ if [ "${GITHUB_REF_TYPE:-}" != "tag" ]; then
44
+ echo "Publish must run from a git tag. Current ref type: ${GITHUB_REF_TYPE:-unknown}" >&2
45
+ exit 1
46
+ fi
47
+
37
48
  TAG_VERSION="${GITHUB_REF_NAME#v}"
38
49
  PKG_VERSION="$(node -p "require('./package.json').version")"
39
50
  if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
@@ -41,14 +52,37 @@ jobs:
41
52
  echo "Re-cut the release via scripts/release.sh so the tag and the committed version match." >&2
42
53
  exit 1
43
54
  fi
55
+
56
+ IS_PRERELEASE=false
57
+ NPM_DIST_TAG=latest
58
+ if [[ "$TAG_VERSION" == *-* ]]; then
59
+ IS_PRERELEASE=true
60
+ PRERELEASE_SUFFIX="${TAG_VERSION#*-}"
61
+ PRERELEASE_SUFFIX="${PRERELEASE_SUFFIX%%+*}"
62
+ NPM_DIST_TAG="${PRERELEASE_SUFFIX%%.*}"
63
+
64
+ if [ -z "$NPM_DIST_TAG" ] || [ "$NPM_DIST_TAG" = "latest" ]; then
65
+ echo "Invalid prerelease npm dist-tag: '$NPM_DIST_TAG'" >&2
66
+ exit 1
67
+ fi
68
+
69
+ if [[ "$NPM_DIST_TAG" =~ ^v?[0-9] ]]; then
70
+ echo "Invalid prerelease npm dist-tag '$NPM_DIST_TAG': dist-tags must not look like versions." >&2
71
+ exit 1
72
+ fi
73
+ fi
74
+
44
75
  echo "Tag $GITHUB_REF_NAME matches package.json $PKG_VERSION."
76
+ echo "npm dist-tag: $NPM_DIST_TAG"
77
+ echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
78
+ echo "npm_dist_tag=$NPM_DIST_TAG" >> "$GITHUB_OUTPUT"
45
79
 
46
80
  - run: npm run build
47
81
 
48
82
  - name: Publish to npm
49
- run: npm publish --provenance --access public
83
+ run: npm publish --provenance --access public --tag "${{ steps.version.outputs.npm_dist_tag }}"
50
84
  env:
51
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
85
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN || secrets.NPM_TOKEN }}
52
86
 
53
87
  - name: Create GitHub Release
54
88
  env:
@@ -62,6 +96,17 @@ jobs:
62
96
  if [ -z "$NOTES" ]; then
63
97
  NOTES="Release $GITHUB_REF_NAME"
64
98
  fi
99
+
100
+ NOTES="$NOTES
101
+
102
+ npm install -g genlayer@${{ steps.version.outputs.npm_dist_tag }}"
103
+
104
+ RELEASE_FLAGS=()
105
+ if [ "${{ steps.version.outputs.is_prerelease }}" = "true" ]; then
106
+ RELEASE_FLAGS+=(--prerelease)
107
+ fi
108
+
65
109
  gh release create "$GITHUB_REF_NAME" \
66
110
  --title "$GITHUB_REF_NAME" \
67
- --notes "$NOTES"
111
+ --notes "$NOTES" \
112
+ "${RELEASE_FLAGS[@]}"
@@ -0,0 +1,53 @@
1
+ name: Retarget main PRs
2
+
3
+ # main is a static/default alias of the active dev branch. Contributions should
4
+ # target the active dev branch directly; PRs opened against main are retargeted
5
+ # automatically so required checks and release-train rules run in the right
6
+ # branch context.
7
+ #
8
+ # pull_request_target is used for the write-scoped token. This workflow never
9
+ # checks out or executes PR head code; it reads only trusted base-branch files.
10
+
11
+ on:
12
+ pull_request_target:
13
+ types: [opened, reopened, synchronize, edited, ready_for_review]
14
+
15
+ permissions:
16
+ contents: read
17
+ pull-requests: write
18
+ issues: write
19
+
20
+ defaults:
21
+ run:
22
+ shell: bash
23
+
24
+ jobs:
25
+ retarget:
26
+ if: github.event.pull_request.base.ref == 'main'
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ with:
31
+ ref: ${{ github.event.pull_request.base.ref }}
32
+
33
+ - name: Retarget PR to active dev branch
34
+ env:
35
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36
+ PR_NUMBER: ${{ github.event.pull_request.number }}
37
+ run: |
38
+ set -euo pipefail
39
+
40
+ active_branch="$(tr -d '[:space:]' < support/ci/ACTIVE_DEV_BRANCH)"
41
+ if [[ -z "${active_branch}" || "${active_branch}" == "main" ]]; then
42
+ echo "::error::support/ci/ACTIVE_DEV_BRANCH must name a non-main dev branch"
43
+ exit 1
44
+ fi
45
+
46
+ gh pr edit "${PR_NUMBER}" --repo "${GITHUB_REPOSITORY}" --base "${active_branch}"
47
+
48
+ gh pr comment "${PR_NUMBER}" --repo "${GITHUB_REPOSITORY}" --body "$(cat <<EOF
49
+ This PR targeted \`main\`, which is only the default/static branch.
50
+
51
+ I retargeted it to \`${active_branch}\`, the active development branch. Pushes to \`${active_branch}\` automatically fast-forward \`main\`.
52
+ EOF
53
+ )"
@@ -10,7 +10,7 @@ jobs:
10
10
  smoke:
11
11
  name: Testnet Smoke Tests
12
12
  runs-on: ubuntu-latest
13
- timeout-minutes: 5
13
+ timeout-minutes: 10
14
14
  continue-on-error: true
15
15
 
16
16
  steps:
@@ -41,3 +41,5 @@ jobs:
41
41
 
42
42
  - name: Run smoke tests
43
43
  run: npm run test:smoke
44
+ env:
45
+ CLI_SMOKE_TIMEOUT_MS: 240000
@@ -72,30 +72,6 @@ jobs:
72
72
  rsync -a "${{ github.workspace }}/docs/api-references/" pages/api-references/genlayer-cli/
73
73
  # Copy README as sibling file (strip badges/emojis)
74
74
  sed -E '/^\[!\[.*\]\(https:\/\/(img\.shields\.io|dcbadge|badge\.fury)/d' "${{ github.workspace }}/README.md" > pages/api-references/genlayer-cli.mdx
75
- # Write _meta.json
76
- cat > pages/api-references/genlayer-cli/_meta.json << 'METAEOF'
77
- {
78
- "init": "init",
79
- "up": "up",
80
- "stop": "stop",
81
- "new": "new",
82
- "config": "config",
83
- "network": "network",
84
- "deploy": "deploy",
85
- "call": "call",
86
- "write": "write",
87
- "schema": "schema",
88
- "code": "code",
89
- "receipt": "receipt",
90
- "trace": "trace",
91
- "appeal": "appeal",
92
- "appeal-bond": "appeal-bond",
93
- "account": "account",
94
- "staking": "staking",
95
- "localnet": "localnet",
96
- "update": "update"
97
- }
98
- METAEOF
99
75
  if [ -z "$(git status --porcelain)" ]; then
100
76
  echo "No changes to commit"
101
77
  exit 0
@@ -9,6 +9,8 @@ on:
9
9
  push:
10
10
  branches:
11
11
  - v0.39
12
+ - v0.40
13
+ - v0.40-dev
12
14
 
13
15
  jobs:
14
16
  build-and-test:
@@ -47,5 +49,8 @@ jobs:
47
49
  with:
48
50
  verbose: true
49
51
  token: ${{ secrets.CODECOV_TOKEN }}
50
- fail_ci_if_error: true
52
+ # Codecov OIDC upload has been failing on ubuntu/windows since
53
+ # before this PR (#345 merged with the same failures) — keep the
54
+ # upload best-effort so coverage flakes don't block test-green PRs.
55
+ fail_ci_if_error: false
51
56
  directory: coverage
package/CHANGELOG.md CHANGED
@@ -1,17 +1,45 @@
1
1
  # Changelog
2
2
 
3
- ## [0.39.2](https://github.com/genlayerlabs/genlayer-cli/compare/v0.39.1...v0.39.2) (2026-06-11)
3
+ ## [0.40.0-clarke.2](https://github.com/genlayerlabs/genlayer-cli/compare/v0.40.0-clarke.1...v0.40.0-clarke.2) (2026-07-09)
4
+
5
+ ### Features
6
+
7
+ * **staking:** browser-wallet signing for validator-join and wizard ([#367](https://github.com/genlayerlabs/genlayer-cli/issues/367)) ([ab128c0](https://github.com/genlayerlabs/genlayer-cli/commit/ab128c0b76b4f9d97ed660d91a556a5f769cef6f))
8
+
9
+ ## [0.40.0-clarke.1](https://github.com/genlayerlabs/genlayer-cli/compare/v0.40.0-rc2...v0.40.0-clarke.1) (2026-07-08)
10
+
11
+ ## [0.40.0-rc2](https://github.com/genlayerlabs/genlayer-cli/compare/v0.40.0-rc1...v0.40.0-rc2) (2026-07-08)
12
+
13
+ ### Bug Fixes
14
+
15
+ * avoid git dependency in npm prerelease install ([#368](https://github.com/genlayerlabs/genlayer-cli/issues/368)) ([3cd1cac](https://github.com/genlayerlabs/genlayer-cli/commit/3cd1cac564932d67e5b1200d4396ca24556d2e46))
16
+
17
+ ## [0.40.0-rc1](https://github.com/genlayerlabs/genlayer-cli/compare/v0.39.1...v0.40.0-rc1) (2026-07-08)
18
+
19
+ ### ⚠ BREAKING CHANGES
20
+
21
+ * **contracts:** require consensus acceptance for success, not just the leader's execution result (#346)
4
22
 
5
23
  ### Features
6
24
 
7
25
  * add v0.6 fee-aware commands ([#340](https://github.com/genlayerlabs/genlayer-cli/issues/340)) ([ca083ab](https://github.com/genlayerlabs/genlayer-cli/commit/ca083abbf854960a6638d5af63096b532a03cc5a))
8
26
  * branch-per-major release model ([#311](https://github.com/genlayerlabs/genlayer-cli/issues/311)) ([6fd2f3a](https://github.com/genlayerlabs/genlayer-cli/commit/6fd2f3a678ce348c92470828b03bdfc596afa9cb)), closes [genlayer-js#172](https://github.com/genlayerlabs/genlayer-js/issues/172)
27
+ * **network:** custom network profiles with deployment-file import ([#362](https://github.com/genlayerlabs/genlayer-cli/issues/362)) ([185d22b](https://github.com/genlayerlabs/genlayer-cli/commit/185d22bff86884b330c2037c2875a5d1629ec72b)), closes [#1162](https://github.com/genlayerlabs/genlayer-cli/issues/1162) [#1162](https://github.com/genlayerlabs/genlayer-cli/issues/1162)
28
+ * staking validators discovery ([#357](https://github.com/genlayerlabs/genlayer-cli/issues/357)) ([0e76bce](https://github.com/genlayerlabs/genlayer-cli/commit/0e76bcef4524907f80d1567ad688550e24c7192b))
29
+ * support fee profiles in contract commands ([#355](https://github.com/genlayerlabs/genlayer-cli/issues/355)) ([6edfcfa](https://github.com/genlayerlabs/genlayer-cli/commit/6edfcfa6d1ad2fcbf761c1ed9f3a194d31243624))
30
+ * vesting commands ([#358](https://github.com/genlayerlabs/genlayer-cli/issues/358)) ([7bcc41e](https://github.com/genlayerlabs/genlayer-cli/commit/7bcc41e7a063bd4a628f689bdf4d321b50230aff))
9
31
 
10
32
  ### Bug Fixes
11
33
 
34
+ * **contracts:** require consensus acceptance for success, not just the leader's execution result ([#346](https://github.com/genlayerlabs/genlayer-cli/issues/346)) ([6fadcd7](https://github.com/genlayerlabs/genlayer-cli/commit/6fadcd7c9ef181042c823faeec1b7e7fb4d902b2)), closes [#345](https://github.com/genlayerlabs/genlayer-cli/issues/345)
35
+ * **docs-sync:** stop overwriting the generated root _meta.json ([#352](https://github.com/genlayerlabs/genlayer-cli/issues/352)) ([f1f1304](https://github.com/genlayerlabs/genlayer-cli/commit/f1f130461dc7d719c9f34086aeb40d8426f0602e)), closes [genlayer-docs#426](https://github.com/genlayerlabs/genlayer-docs/issues/426)
36
+ * drop getSlashingAddress from validator-history ([#361](https://github.com/genlayerlabs/genlayer-cli/issues/361)) ([32a0a42](https://github.com/genlayerlabs/genlayer-cli/commit/32a0a42d687a27c633a0ee29b6fbc84842c3cc18)), closes [#344](https://github.com/genlayerlabs/genlayer-cli/issues/344) [#344](https://github.com/genlayerlabs/genlayer-cli/issues/344) [#341](https://github.com/genlayerlabs/genlayer-cli/issues/341)
37
+ * fail CLI writes on execution errors ([#345](https://github.com/genlayerlabs/genlayer-cli/issues/345)) ([5d00884](https://github.com/genlayerlabs/genlayer-cli/commit/5d008844ad0b97760bbd025ed5aac61b41b2b881))
38
+ * **init:** use backend provider id "google" for Gemini ([#359](https://github.com/genlayerlabs/genlayer-cli/issues/359)) ([561370f](https://github.com/genlayerlabs/genlayer-cli/commit/561370f955f23dc2e1952daac2c42aecb3f3431c)), closes [#271](https://github.com/genlayerlabs/genlayer-cli/issues/271)
12
39
  * **localnet:** print validator count to stdout ([37519e1](https://github.com/genlayerlabs/genlayer-cli/commit/37519e18b6155bc762fa24ea809a53c3e83ac9a7))
40
+ * make git install build lifecycle robust ([#363](https://github.com/genlayerlabs/genlayer-cli/issues/363)) ([a4f8a63](https://github.com/genlayerlabs/genlayer-cli/commit/a4f8a63ae9c945ecf99a707e700857d6f7729df7))
13
41
  * run CI on v0.39 branch ([#322](https://github.com/genlayerlabs/genlayer-cli/issues/322)) ([e129bab](https://github.com/genlayerlabs/genlayer-cli/commit/e129bab0c471c2d59d360b5ca8c1cb3190774ff8))
14
- * **system:** handle command-check and version parse failures ([#349](https://github.com/genlayerlabs/genlayer-cli/issues/349)) ([5b93dd3](https://github.com/genlayerlabs/genlayer-cli/commit/5b93dd32e45683f30368d0c9324078800c3d8dda)), closes [#301](https://github.com/genlayerlabs/genlayer-cli/issues/301) [#303](https://github.com/genlayerlabs/genlayer-cli/issues/303)
42
+ * **system:** propagate command-check and version parse fixes to v0.40-dev ([#350](https://github.com/genlayerlabs/genlayer-cli/issues/350)) ([9ebf9e0](https://github.com/genlayerlabs/genlayer-cli/commit/9ebf9e0d1ab5266c58d2e8a274c0b42acc8ad753)), closes [#349](https://github.com/genlayerlabs/genlayer-cli/issues/349)
15
43
 
16
44
  ## 0.39.1 (2026-05-06)
17
45
 
package/CONTRIBUTING.md CHANGED
@@ -33,19 +33,11 @@ Have ideas for new features or use cases? We're eager to hear them! But first:
33
33
 
34
34
  ## Branch model
35
35
 
36
- This repo uses a branch-per-major release model. There is no `main`.
37
-
38
- - **`v0.39`** — current stable major (semver-zero, so 0.39 IS the major; 0.40 would be a major bump that gets its own branch). PRs for bug fixes / non-breaking features target this branch.
39
- - **`v<next>-dev`** when next-major work is in progress, this branch is open for breaking changes. PRs introducing them target this branch.
40
- - **Older majors** stay for back-ports. Default branch on github.com is whichever major is current stable.
41
-
42
- When you fork or clone, the default branch is `v0.39` today. If you have a `main` branch from a previous checkout, delete it locally:
43
-
44
- ```sh
45
- git checkout v0.39
46
- git branch -D main
47
- git remote prune origin
48
- ```
36
+ See [docs/BRANCHING.md](docs/BRANCHING.md) for the current release-train model.
37
+ In short: independently releasable work may target the stable branch directly;
38
+ multi-feature or cross-repo train work uses the active `*-dev` integration
39
+ branch and is promoted to the matching stable branch when ready. `main` is only
40
+ the default/static GitHub branch.
49
41
 
50
42
  The previous `staging` branch (beta channel) has been retired. Pre-releases now go through the same release script with an explicit version (`scripts/release.sh 0.39.2-beta.0`).
51
43
 
@@ -138,4 +130,4 @@ Connect with the GenLayer community to discuss, collaborate, and share insights:
138
130
  - **[Discord Channel](https://discord.gg/8Jm4v89VAu)**: Our primary hub for discussions, support, and announcements.
139
131
  - **[Telegram Group](https://t.me/genlayer)**: For more informal chats and quick updates.
140
132
 
141
- Your continuous feedback drives better product development. Please engage with us regularly to test, discuss, and improve the GenLayer CLI.
133
+ Your continuous feedback drives better product development. Please engage with us regularly to test, discuss, and improve the GenLayer CLI.
package/README.md CHANGED
@@ -176,6 +176,9 @@ OPTIONS (deploy):
176
176
  --contract <contractPath> (Optional) Path to the intelligent contract to deploy
177
177
  --rpc <rpcUrl> RPC URL for the network
178
178
  --fees <json> Transaction fee options JSON passed to genlayer-js
179
+ --fee-profile <path> Fee profile generated by gltest --fee-profile
180
+ --fee-preset <preset> Fee profile appeal posture: low, standard, or high
181
+ --appeal-rounds <count> Override fee profile appeal rounds
179
182
  --fee-value <wei> Explicit fee deposit value
180
183
  --valid-until <timestamp> Unix timestamp after which the transaction is invalid
181
184
  --args <args...> Contract arguments (see Argument Types below)
@@ -187,6 +190,9 @@ OPTIONS (call):
187
190
  OPTIONS (write):
188
191
  --rpc <rpcUrl> RPC URL for the network
189
192
  --fees <json> Transaction fee options JSON passed to genlayer-js
193
+ --fee-profile <path> Fee profile generated by gltest --fee-profile
194
+ --fee-preset <preset> Fee profile appeal posture: low, standard, or high
195
+ --appeal-rounds <count> Override fee profile appeal rounds
190
196
  --fee-value <wei> Explicit fee deposit value
191
197
  --valid-until <timestamp> Unix timestamp after which the transaction is invalid
192
198
  --args <args...> Method arguments (see Argument Types below)
@@ -194,6 +200,9 @@ OPTIONS (write):
194
200
  OPTIONS (estimate-fees):
195
201
  --rpc <rpcUrl> RPC URL for the network
196
202
  --fees <json> Fee estimate options JSON, or a transaction fee object
203
+ --fee-profile <path> Fee profile generated by gltest --fee-profile
204
+ --fee-preset <preset> Fee profile appeal posture: low, standard, or high
205
+ --appeal-rounds <count> Override fee profile appeal rounds
197
206
  --include-report Include simulation fee accounting/report in the generated estimate output
198
207
  --args <args...> Method arguments for simulation-derived estimates
199
208
 
@@ -205,11 +214,14 @@ EXAMPLES:
205
214
  genlayer deploy --contract ./my_contract.gpy
206
215
  genlayer deploy --contract ./my_contract.gpy --args "arg1" "arg2" 123
207
216
  genlayer deploy --contract ./my_contract.gpy --fees '{"distribution":{"leaderTimeunitsAllocation":"100","validatorTimeunitsAllocation":"200","rotations":["0"]}}'
217
+ genlayer deploy --contract ./my_contract.gpy --fee-profile ./artifacts/fee-profile.json
208
218
  genlayer call 0x123456789abcdef greet --args "Hello World!"
209
219
  genlayer write 0x123456789abcdef updateValue --args 42
210
220
  genlayer write 0x123456789abcdef updateValue --fees '{"distribution":{"leaderTimeunitsAllocation":"100","validatorTimeunitsAllocation":"200","rotations":["0"]}}' --args 42
221
+ genlayer write 0x123456789abcdef updateValue --fee-profile ./artifacts/fee-profile.json --fee-preset standard --args 42
211
222
  genlayer estimate-fees
212
223
  genlayer estimate-fees 0x123456789abcdef updateValue --args 42
224
+ genlayer estimate-fees 0x123456789abcdef updateValue --fee-profile ./artifacts/fee-profile.json --json
213
225
  genlayer write 0x123456789abcdef sendReward --args 0x6857Ed54CbafaA74Fc0357145eC0ee1536ca45A0
214
226
  genlayer write 0x123456789abcdef setScores --args '[1, 2, 3]'
215
227
  genlayer write 0x123456789abcdef setConfig --args '{"timeout": 30, "retries": 5}'
@@ -218,6 +230,28 @@ EXAMPLES:
218
230
 
219
231
  ##### Transaction Fee Options
220
232
 
233
+ For reproducible application presets, pass the profile produced by
234
+ `gltest --fee-profile`:
235
+
236
+ ```bash
237
+ genlayer estimate-fees 0x123456789abcdef settle \
238
+ --fee-profile ./artifacts/fee-profile.json \
239
+ --fee-preset standard \
240
+ --json
241
+
242
+ genlayer write 0x123456789abcdef settle \
243
+ --fee-profile ./artifacts/fee-profile.json \
244
+ --fee-preset standard
245
+ ```
246
+
247
+ `deploy` reads the profile's `deploy` entry. `write` and targeted
248
+ `estimate-fees` read `methods[method]`. The CLI converts the measured profile
249
+ entry into SDK fee-estimate options, asks `genlayer-js` for a transaction fee
250
+ preset, then sends that preset with the transaction. `--fee-preset` controls the
251
+ default appeal posture (`low`, `standard`, or `high`); use `--appeal-rounds`
252
+ for an explicit override. `--fees` can still be provided alongside
253
+ `--fee-profile` to override individual values, including `messageAllocations`.
254
+
221
255
  `--fees` accepts the same transaction fee object as `genlayer-js`. Quote large
222
256
  integer values as strings to preserve precision. `messageAllocations[].messageType`
223
257
  may be `"internal"`, `"external"`, `0`, or `1`.
@@ -253,29 +287,32 @@ preset for reproducible gas-unit debugging.
253
287
 
254
288
  The `--args` option automatically detects and converts values to the correct type:
255
289
 
256
- | Type | Syntax | Example |
257
- |------|--------|---------|
258
- | Boolean | `true`, `false` | `--args true false` |
259
- | Null | `null` | `--args null` |
260
- | Integer | numeric value | `--args 42 -1` |
261
- | Hex integer | `0x` prefix | `--args 0x1a` |
262
- | String | any other value | `--args hello "multi word"` |
263
- | Address | 40 hex chars with `0x` or `addr#` prefix | `--args 0x6857...a0` or `--args addr#6857...a0` |
264
- | Bytes | `b#` prefix + hex | `--args b#deadbeef` |
265
- | Array | JSON array in quotes | `--args '[1, 2, "three"]'` |
266
- | Dict | JSON object in quotes | `--args '{"key": "value"}'` |
290
+ | Type | Syntax | Example |
291
+ | ----------- | ---------------------------------------- | ----------------------------------------------- |
292
+ | Boolean | `true`, `false` | `--args true false` |
293
+ | Null | `null` | `--args null` |
294
+ | Integer | numeric value | `--args 42 -1` |
295
+ | Hex integer | `0x` prefix | `--args 0x1a` |
296
+ | String | any other value | `--args hello "multi word"` |
297
+ | Address | 40 hex chars with `0x` or `addr#` prefix | `--args 0x6857...a0` or `--args addr#6857...a0` |
298
+ | Bytes | `b#` prefix + hex | `--args b#deadbeef` |
299
+ | Array | JSON array in quotes | `--args '[1, 2, "three"]'` |
300
+ | Dict | JSON object in quotes | `--args '{"key": "value"}'` |
267
301
 
268
302
  Large numbers that exceed JavaScript's safe integer range are automatically handled as BigInt to preserve precision.
269
303
 
270
304
  ##### Deploy Behavior
305
+
271
306
  - If `--contract` is specified, the command will **deploy the given contract**.
272
307
  - If `--contract` is omitted, the CLI will **search for scripts inside the `deploy` folder**, sort them, and execute them sequentially.
273
308
 
274
309
  ##### Call vs Write
310
+
275
311
  - `call` - Calls a contract method without sending a transaction or changing the state (read-only)
276
312
  - `write` - Sends a transaction to a contract method that modifies the state
277
313
 
278
314
  ##### Schema
315
+
279
316
  - `schema` - Retrieves the contract schema
280
317
 
281
318
  #### Transaction Operations
@@ -441,6 +478,7 @@ COMMON OPTIONS (all commands):
441
478
  OPTIONS (validator-join):
442
479
  --amount <amount> Amount to stake (in wei or with 'gen' suffix)
443
480
  --operator <address> Operator address (defaults to signer)
481
+ --wallet <mode> 'keystore' (default) or 'browser' (sign in MetaMask)
444
482
 
445
483
  OPTIONS (delegator-join):
446
484
  --validator <address> Validator address to delegate to
@@ -460,6 +498,14 @@ EXAMPLES:
460
498
  # Join as validator with 42000 GEN
461
499
  genlayer staking validator-join --amount 42000gen
462
500
 
501
+ # Sign the validator-join with a browser wallet (MetaMask) instead of a keystore.
502
+ # The CLI serves a page on 127.0.0.1 and opens it; connect + confirm in the wallet.
503
+ # Remote/SSH: forward the printed port first (ssh -L <port>:127.0.0.1:<port> ...).
504
+ genlayer staking validator-join --amount 42000gen --wallet browser --network testnet-bradbury
505
+
506
+ # The wizard can also use a browser wallet as the owner (operator keystore is still generated locally):
507
+ genlayer staking wizard --wallet browser
508
+
463
509
  # Join as delegator with 42 GEN
464
510
  genlayer staking delegator-join --validator 0x... --amount 42gen
465
511