Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0ffd3ee
Tx module + improvements to other modules & test setup
Lezek123 Mar 28, 2025
c90bf1f
Deploy docs workflow: only from main branch
Lezek123 Mar 28, 2025
70f60e0
Docs: Use joystream.dev endpoints as examples
Lezek123 Mar 28, 2025
69cf590
Update tarball
Lezek123 Mar 28, 2025
8cd4661
Add more meta transactions
Lezek123 Mar 28, 2025
d630019
Fix test setup, add some meta transactions tests
Lezek123 Mar 28, 2025
12d79b1
Update tarball
Lezek123 Mar 28, 2025
9a68150
Cleanup resources after tests
Lezek123 Mar 28, 2025
d624587
Attempt to fix CI
Lezek123 Mar 28, 2025
7847383
Attempt to fix QN disconnection logic
Lezek123 Mar 28, 2025
b17b652
Adjust disconnecting in blockUtils tests
Lezek123 Mar 28, 2025
31291e4
Another attempt to fix CI
Lezek123 Mar 28, 2025
79af155
Tests: Increase timeouts and limit max concurrency
Lezek123 Mar 28, 2025
1eff0ac
QN: Use lazy ws connection
Lezek123 Mar 28, 2025
1fdfaeb
Documentation (query module): make storageSquid snippets runnable, ad…
Lezek123 Apr 1, 2025
0061c67
Query module: Separate BlockProcessorApi and MetadataProcessorApi
Lezek123 Apr 1, 2025
5dc8fb6
Update docs, improve setup, small fixes in multiple modules
Lezek123 Apr 4, 2025
ce33415
Fix snippet tests
Lezek123 Apr 4, 2025
eda5bfd
Update docs workflow
Lezek123 Apr 4, 2025
f59f84f
Snippets: Disconnect from API after tests
Lezek123 Apr 4, 2025
4b6ba95
Attempt to fix test in CI
Lezek123 Apr 4, 2025
9187064
Fix docs deployment
Lezek123 Apr 7, 2025
a9f3ab4
Fix docs build
Lezek123 Apr 7, 2025
fff2649
Assets module: Calculating tx costs
Lezek123 May 5, 2025
012c6ad
Assets module docs + fix a couple of bugs
Lezek123 May 7, 2025
9e3fe19
Run pre-push script
Lezek123 May 8, 2025
d2a4ecc
add the bonding, unbonding, nominating validator for sdk.
Oct 15, 2025
24814de
Add the examples of staking functions for sdk.
goldstarhigher Oct 16, 2025
5ca007c
Update the sdk for staking function.s
goldstarhigher Oct 24, 2025
f1bb9d7
Update the staking sdk for line error.
goldstarhigher Oct 24, 2025
ebb6c2b
added integration guide for sdk.
goldstarhigher Oct 28, 2025
f2d3167
Update payoutstake.
goldstarhigher Oct 28, 2025
a4a212d
update the package
goldstarhigher Oct 28, 2025
10f386f
update the yarn package.
goldstarhigher Oct 28, 2025
ad34192
update the document for guide
goldstarhigher Oct 29, 2025
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
7 changes: 4 additions & 3 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- dev
workflow_dispatch:

jobs:
Expand All @@ -19,11 +18,13 @@ jobs:
with:
node-version-file: 'package.json'
- name: Install dependencies
working-directory: ./docs
run: yarn install --immutable
- name: Run codegen
run: yarn codegen
- name: Run build
working-directory: ./docs
run: yarn build
- name: Run docs build
run: yarn build:docs
- name: Upload build artifacts
uses: actions/upload-pages-artifact@v3
with:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Run build
run: yarn build
- name: Setup testing environment
run: yarn test:setup
run: yarn test:setup:up
- name: Run tests
run: yarn test:sdk
test-snippets:
Expand All @@ -36,8 +36,9 @@ jobs:
node-version-file: 'package.json'
- name: Install dependencies
run: yarn install --immutable
- name: Install /docs dependencies
working-directory: ./docs
run: yarn install --immutable
- name: Run codegen
run: yarn codegen
- name: Build code
run: yarn build
- name: Test snippets
run: yarn test:snippets
942 changes: 942 additions & 0 deletions .yarn/releases/yarn-4.10.3.cjs

Large diffs are not rendered by default.

934 changes: 0 additions & 934 deletions .yarn/releases/yarn-4.6.0.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.6.0.cjs
yarnPath: .yarn/releases/yarn-4.10.3.cjs
209 changes: 209 additions & 0 deletions BUILD_AND_TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# 🔧 Build and Test Guide

## Issue Found

The `rebond()` method (and other new methods) are in the **TypeScript source code** but need to be **compiled to JavaScript** before they can be used.

## ✅ Solution: Rebuild the SDK

### Step 1: Build the SDK

From the SDK root directory:

```bash
cd E:\work\joystream\sdk

# Build all packages
yarn build
```

This will compile TypeScript to JavaScript in `packages/core/lib/`

### Step 2: Verify the Build

Check that the compiled file has the new methods:

```bash
# Check if rebond exists in compiled code
grep -n "rebond" packages/core/lib/staking/StakingManager.js
```

### Step 3: Run the Test Again

```bash
cd examples/staking
yarn tsx test-all-extrinsics.ts
```

---

## 🎯 Quick Fix (One Command)

```bash
# From SDK root
yarn build && cd examples/staking && yarn tsx test-all-extrinsics.ts
```

---

## 📝 What Was Added

All these methods are in the **source code** (`packages/core/src/staking/StakingManager.ts`):

### New Methods (Lines 183-287):

1. ✅ `rebond(amount)` - Line 186
2. ✅ `validate(commission, blocked)` - Line 211
3. ✅ `setController(controller)` - Line 226
4. ✅ `payoutStakersByPage(validator, era, page)` - Line 252
5. ✅ `rebag(account)` - Line 263
6. ✅ `putInFrontOf(lighter)` - Line 270
7. ✅ `bondAndNominate(...)` - Line 277

### New Query Methods (Lines 426-753):

1. ✅ `getSlashingSpans(stash)` - Line 429
2. ✅ `getValidatorPrefs(validator)` - Line 452
3. ✅ `getWaitingValidators()` - Line 469
4. ✅ `getNominatorTargets(nominator)` - Line 516
5. ✅ `getMinActiveBond()` - Line 575
6. ✅ `canNominate(account, targets)` - Line 622
7. ✅ `canValidate(account, commission)` - Line 664
8. ✅ `getStakingConstants()` - Line 708

**All methods exist in TypeScript source** - they just need to be compiled!

---

## 🐛 Why the Error Occurred

The error:

```
❌ Error: TypeError: staking.rebond is not a function
```

This happens because:

1. ✅ The TypeScript source has `rebond()` at line 186
2. ❌ The compiled JavaScript in `lib/` doesn't have it yet
3. 💡 Solution: Run `yarn build` to compile TS → JS

---

## 🔍 Verify All Methods Are Compiled

After building, check the compiled file:

```bash
# List all exported methods
grep "^ [a-z]" packages/core/lib/staking/StakingManager.js | head -30
```

You should see:

- bond
- bondExtra
- unbond
- **rebond** ← This should now appear!
- withdrawUnbonded
- nominate
- chill
- **validate** ← New!
- **setController** ← New!
- setPayee
- payoutStakers
- **payoutStakersByPage** ← New!
- **rebag** ← New!
- **putInFrontOf** ← New!
- **bondAndNominate** ← New!

---

## ✨ After Building

All 15 extrinsics will work:

1. bond ✅
2. bondExtra ✅
3. unbond ✅
4. **rebond** ← Will work after build!
5. withdrawUnbonded ✅
6. nominate ✅
7. chill ✅
8. **validate** ← Will work after build!
9. **setController** ← Will work after build!
10. setPayee ✅
11. payoutStakers ✅
12. **payoutStakersByPage** ← Will work after build!
13. **rebag** ← Will work after build!
14. **putInFrontOf** ← Will work after build!
15. **bondAndNominate** ← Will work after build!

Plus all 20+ query methods and 4 validation helpers!

---

## 🚀 Complete Build & Test Command

```bash
# Navigate to SDK root
cd E:\work\joystream\sdk

# Build the SDK (compiles TypeScript)
yarn build

# Navigate to examples
cd examples/staking

# Run the complete demo
yarn tsx test-all-extrinsics.ts

# You should now see all 15 methods working! ✨
```

---

## 📊 Expected Output After Build

```
🎯 COMPLETE STAKING EXTRINSICS DEMO
======================================================================

...

4️⃣ rebond(amount)
Purpose: Cancel unbonding and rebond tokens
✅ Created: staking.rebond ← Should work now!
Args: amount=100 JOY

...

📋 SUMMARY
✅ ALL 15 STAKING EXTRINSICS AVAILABLE:
...

🎉 Demo Complete!
```

---

## 💡 Why TypeScript Needs Compilation

- **TypeScript (.ts)**: Source code we write
- **JavaScript (.js)**: What Node.js/browsers run
- **Build process**: Converts .ts → .js

The SDK uses the compiled JavaScript from `packages/core/lib/`, not the TypeScript source!

---

## ✅ Conclusion

**The code is complete** - it just needs one build step:

```bash
yarn build
```

Then all 15 extrinsics will work perfectly! 🎉
Loading