-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement network switching (#8)
* feat: add mainnet as option on sdk * feat: add mainnet switch on demo app * chore: add changeset * fix: build warnings * chore: update gitignore with test-related patterns * feat(simple-app): add E2E testing setup with Vitest * ci: improve GitHub Actions workflows for testing * chore: update test scripts and turbo pipeline * chore: add more tests * ci: fix e2e action * ci: fix package json deps * ci: pnpm lock * chore: add style for toast * fix: network switching * fix: code examples * ci: fix changeset validation * ci: disable some checks
- Loading branch information
1 parent
e9a6522
commit 81a4fa0
Showing
48 changed files
with
2,998 additions
and
2,767 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
"@fuels/streams": minor | ||
"simple-app": minor | ||
--- | ||
|
||
Improve Stream API and enhance demo application UI | ||
|
||
- **API Changes**: | ||
- Rename `subscribeWithSubject` to `subscribe` for better API clarity | ||
- Add `subscribeWithString` method for string-based subscriptions | ||
- Remove namespace handling from stream creation | ||
- Improve consumer subscription handling and configuration | ||
- Update return type for subscriptions to use `ConsumerMessages` | ||
- Add network selection during client initialization (`{ network: 'testnet' | 'mainnet' }`) | ||
- Add `switchNetwork` method for dynamic network switching | ||
- Remove `ClientOpts` requirement for simpler initialization | ||
|
||
### Client Initialization | ||
|
||
```typescript | ||
// Before | ||
const opts = new ClientOpts(); | ||
const client = await Client.connect(opts); | ||
|
||
// After | ||
const client = await Client.connect({ network: "testnet" }); // or 'mainnet' | ||
``` | ||
|
||
### Stream Subscription | ||
|
||
```typescript | ||
// Before | ||
const stream = await BlocksStream.init(client); | ||
const subscription = await stream.subscribeWithSubject(subject); | ||
|
||
// After - Using typed subjects | ||
const stream = await BlocksStream.init(client); | ||
const subscription = await stream.subscribe(BlocksSubject.build()); | ||
|
||
// After - Using string subjects | ||
const subscription = await stream.subscribeWithString("my-subject"); | ||
``` | ||
|
||
### Network Switching | ||
|
||
```typescript | ||
const client = Client.getInstance(); | ||
await client.switchNetwork("testnet"); | ||
``` | ||
|
||
- **Demo App Improvements**: | ||
- Add network switching support (mainnet/testnet) | ||
- Implement new header with navigation and network controls | ||
- Add toast notifications for network changes | ||
- Improve UI layout and responsiveness | ||
- Add loading states and better error handling | ||
- Enhance code examples visualization | ||
- Add E2E testing setup with Vitest | ||
- Improve CI workflows for better test handling | ||
- Update build and test scripts in Turbo pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
NODE_VERSION: 20.11.0 | ||
PNPM_VERSION: 9.5.0 | ||
|
||
jobs: | ||
test: | ||
name: Tests | ||
runs-on: buildjet-4vcpu-ubuntu-2204 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: FuelLabs/github-actions/setups/node@master | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
pnpm-version: ${{ env.PNPM_VERSION }} | ||
|
||
- name: Build packages | ||
run: pnpm build:libs | ||
|
||
- name: Run unit tests | ||
run: pnpm test | ||
|
||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install --with-deps chromium | ||
|
||
- name: Run E2E tests | ||
run: pnpm test:e2e |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.