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
21 changes: 14 additions & 7 deletions .github/workflows/main-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ jobs:
name: Test (Foundry)
uses: ./.github/workflows/test-forge.yml

# test-sdk:
# name: Test (SDK)
# uses: ./.github/workflows/test-sdk.yml
# with:
# project-path: 'sdk'
# project-name: 'SDK'
test-sdk-ts:
name: Test (TS SDK)
uses: ./.github/workflows/test-sdk.yml
with:
project-path: 'sdk/ts'
project-name: 'TS SDK'

test-sdk-compat:
name: Test (TS SDK Compat)
uses: ./.github/workflows/test-sdk.yml
with:
project-path: 'sdk/ts-compat'
project-name: 'TS SDK Compat'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
bootstrap-project-path: 'sdk/ts'

build-and-publish-clearnode:
name: Build and Publish (Clearnode)
Expand Down Expand Up @@ -56,4 +64,3 @@ jobs:
cache-from: type=gha
build-args: |
VERSION=${{ steps.sha.outputs.short_sha }}

25 changes: 16 additions & 9 deletions .github/workflows/main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ jobs:
name: Test (Foundry)
uses: ./.github/workflows/test-forge.yml

# test-sdk:
# name: Test (SDK)
# uses: ./.github/workflows/test-sdk.yml
# with:
# project-path: 'sdk'
# project-name: 'SDK'
test-sdk-ts:
name: Test (TS SDK)
uses: ./.github/workflows/test-sdk.yml
with:
project-path: 'sdk/ts'
project-name: 'TS SDK'

test-sdk-compat:
name: Test (TS SDK Compat)
uses: ./.github/workflows/test-sdk.yml
with:
project-path: 'sdk/ts-compat'
project-name: 'TS SDK Compat'
bootstrap-project-path: 'sdk/ts'

# build-and-publish-sdk:
# needs: test-sdk
# needs: [test-sdk-ts, test-sdk-compat]
# name: Build and Publish (SDK)
# uses: ./.github/workflows/publish-sdk.yml
# secrets:
Expand Down Expand Up @@ -93,7 +101,7 @@ jobs:
# notify-slack:
# name: Notify Slack
# runs-on: ubuntu-latest
# needs: [deploy-prod, deploy-sandbox, deploy-uat, test-forge, test-sdk]
# needs: [deploy-prod, deploy-sandbox, deploy-uat, test-forge, test-sdk-ts, test-sdk-compat]
# if: always()

# steps:
Expand All @@ -116,4 +124,3 @@ jobs:
# ⚠️ RC build or deployment was cancelled!
# ${{github.event.head_commit.message}}
# SLACK_FOOTER: 'Nitrolite CI/CD Pipeline'

35 changes: 29 additions & 6 deletions .github/workflows/test-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ on:
inputs:
project-path:
description: 'Path to the SDK project directory'
required: false
required: true
type: string
default: 'sdk'
project-name:
description: 'Human-readable name for the project'
required: true
type: string
bootstrap-project-path:
description: 'Optional SDK project that must be built before validating the target project'
required: false
type: string
default: 'SDK'
default: ''

jobs:
test:
name: Test ${{ inputs.project-name }}
name: Validate ${{ inputs.project-name }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -28,12 +31,32 @@ jobs:
with:
node-version-file: '${{ inputs.project-path }}/package.json'
cache: 'npm'
Comment thread
nksazonov marked this conversation as resolved.
cache-dependency-path: '${{ inputs.project-path }}/package-lock.json'
cache-dependency-path: |
${{ inputs.project-path }}/package-lock.json
${{ inputs.bootstrap-project-path != '' && format('{0}/package-lock.json', inputs.bootstrap-project-path) || '' }}

- name: Install bootstrap dependencies
if: ${{ inputs.bootstrap-project-path != '' }}
run: npm ci
working-directory: ${{ inputs.bootstrap-project-path }}
Comment thread
nksazonov marked this conversation as resolved.

- name: Build bootstrap project
if: ${{ inputs.bootstrap-project-path != '' }}
run: npm run build:ci
working-directory: ${{ inputs.bootstrap-project-path }}

- name: Install dependencies
run: npm ci
working-directory: ${{ inputs.project-path }}

- name: Run tests
- name: Test
run: npm test
working-directory: ${{ inputs.project-path }}

- name: Lint
run: npm run lint
working-directory: ${{ inputs.project-path }}

- name: Build
run: npm run build:ci
working-directory: ${{ inputs.project-path }}
20 changes: 14 additions & 6 deletions .github/workflows/v1-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ jobs:
name: Test (Foundry)
uses: ./.github/workflows/test-forge.yml

# test-sdk:
# name: Test (SDK)
# test-sdk-ts:
# name: Test (TS SDK)
# uses: ./.github/workflows/test-sdk.yml
# with:
# project-path: 'sdk'
# project-name: 'SDK'
# project-path: 'sdk/ts'
# project-name: 'TS SDK'

# test-sdk-compat:
# name: Test (TS SDK Compat)
# uses: ./.github/workflows/test-sdk.yml
# with:
# project-path: 'sdk/ts-compat'
# project-name: 'TS SDK Compat'
# bootstrap-project-path: 'sdk/ts'

# build-and-publish-sdk:
# needs: test-sdk
# needs: [test-sdk-ts, test-sdk-compat]
# name: Build and Publish (SDK)
# uses: ./.github/workflows/publish-sdk.yml
# secrets:
Expand Down Expand Up @@ -137,7 +145,7 @@ jobs:
# notify-slack:
# name: Notify Slack
# runs-on: ubuntu-latest
# needs: [deploy-prod, deploy-sandbox, deploy-uat, test-forge, test-sdk]
# needs: [deploy-prod, deploy-sandbox, deploy-uat, test-forge, test-sdk-ts, test-sdk-compat]
# if: always()

# steps:
Expand Down
37 changes: 0 additions & 37 deletions docs/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -589,43 +589,6 @@ api:
errors:
- message: channel_not_found
description: The specified channel was not found
- name: get_states
description: Retrieve state history for a user with optional filtering
request:
- field_name: wallet
type: string
description: The user's wallet address
- field_name: asset
type: string
description: Filter by asset symbol
- field_name: epoch
type: string
description: Filter by user epoch index
optional: true
- field_name: channel_id
type: string
description: Filter by Home/Escrow Channel ID
optional: true
- field_name: only_signed
type: boolean
description: Return only signed states
- field_name: pagination
type: pagination_params
description: Pagination parameters (offset, limit, sort)
optional: true
response:
- field_name: states
type: array
items:
type: state
description: List of states
- field_name: metadata
type: pagination_metadata
description: Pagination information
optional: true
errors:
- message: invalid_parameters
description: The request parameters are invalid
- name: request_creation
description: Request the creation of a channel from Node
request:
Expand Down
11 changes: 0 additions & 11 deletions pkg/rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,6 @@ state, err := client.ChannelsV1GetLatestState(ctx, rpc.ChannelsV1GetLatestStateR
Asset: "usdc",
})

// Get states with filters
states, err := client.ChannelsV1GetStates(ctx, rpc.ChannelsV1GetStatesRequest{
Wallet: walletAddress,
Asset: &asset,
})

// Request channel creation
creation, err := client.ChannelsV1RequestCreation(ctx, rpc.ChannelsV1RequestCreationRequest{
Wallet: walletAddress,
Expand Down Expand Up @@ -385,11 +379,6 @@ session, err := client.AppSessionsV1CreateAppSession(ctx, rpc.AppSessionsV1Creat
Definition: definition,
})

// Close app session
closeResp, err := client.AppSessionsV1CloseAppSession(ctx, rpc.AppSessionsV1CloseAppSessionRequest{
AppSessionID: sessionID,
})

// Submit deposit state
depositResp, err := client.AppSessionsV1SubmitDepositState(ctx, rpc.AppSessionsV1SubmitDepositStateRequest{
AppSessionID: sessionID,
Expand Down
24 changes: 0 additions & 24 deletions pkg/rpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,30 +77,6 @@ type ChannelsV1GetLatestStateResponse struct {
State StateV1 `json:"state"`
}

// ChannelsV1GetStatesRequest retrieves state history for a user with optional filtering.
type ChannelsV1GetStatesRequest struct {
// Wallet is the user's wallet address
Wallet string `json:"wallet"`
// Asset filters by asset symbol
Asset string `json:"asset"`
// Epoch filters by user epoch index
Epoch *string `json:"epoch,omitempty"`
// ChannelID filters by Home/Escrow Channel ID
ChannelID *string `json:"channel_id,omitempty"`
// OnlySigned returns only signed states
OnlySigned bool `json:"only_signed"`
// Pagination contains pagination parameters (offset, limit, sort)
Pagination *PaginationParamsV1 `json:"pagination,omitempty"`
}

// ChannelsV1GetStatesResponse returns the list of states.
type ChannelsV1GetStatesResponse struct {
// States is the list of states
States []StateV1 `json:"states"`
// Metadata contains pagination information
Metadata PaginationMetadataV1 `json:"metadata"`
}

// ChannelsV1RequestCreationRequest requests the creation of a channel from Node.
type ChannelsV1RequestCreationRequest struct {
// State is the state to be submitted
Expand Down
9 changes: 0 additions & 9 deletions pkg/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ func (c *Client) ChannelsV1GetLatestState(ctx context.Context, req ChannelsV1Get
return resp, nil
}

// ChannelsV1GetStates retrieves state history for a user with optional filtering.
func (c *Client) ChannelsV1GetStates(ctx context.Context, req ChannelsV1GetStatesRequest) (ChannelsV1GetStatesResponse, error) {
var resp ChannelsV1GetStatesResponse
if err := c.call(ctx, ChannelsV1GetStatesMethod, req, &resp); err != nil {
return resp, err
}
return resp, nil
}

// ChannelsV1RequestCreation requests the creation of a channel from Node.
func (c *Client) ChannelsV1RequestCreation(ctx context.Context, req ChannelsV1RequestCreationRequest) (ChannelsV1RequestCreationResponse, error) {
var resp ChannelsV1RequestCreationResponse
Expand Down
29 changes: 0 additions & 29 deletions pkg/rpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,35 +245,6 @@ func TestClientV1_ChannelsV1GetLatestState(t *testing.T) {
assert.Equal(t, testAssetV1, resp.State.Asset)
}

func TestClientV1_ChannelsV1GetStates(t *testing.T) {
t.Parallel()

client, dialer := setupClient()

states := rpc.ChannelsV1GetStatesResponse{
States: []rpc.StateV1{
{ID: "state1", Version: "1", Asset: testAssetV1},
{ID: "state2", Version: "2", Asset: testAssetV1},
},
Metadata: rpc.PaginationMetadataV1{
Page: 1,
PerPage: 10,
TotalCount: 2,
PageCount: 1,
},
}

registerSimpleHandlerV1(dialer, "channels.v1.get_states", states)

resp, err := client.ChannelsV1GetStates(testCtxV1, rpc.ChannelsV1GetStatesRequest{
Wallet: testWalletV1,
Asset: testAssetV1,
OnlySigned: false,
})
require.NoError(t, err)
assert.Len(t, resp.States, 2)
}

func TestClientV1_ChannelsV1RequestCreation(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const (
ChannelsV1GetEscrowChannelMethod Method = "channels.v1.get_escrow_channel"
ChannelsV1GetChannelsMethod Method = "channels.v1.get_channels"
ChannelsV1GetLatestStateMethod Method = "channels.v1.get_latest_state"
ChannelsV1GetStatesMethod Method = "channels.v1.get_states"
ChannelsV1RequestCreationMethod Method = "channels.v1.request_creation"
ChannelsV1SubmitStateMethod Method = "channels.v1.submit_state"
ChannelsV1SubmitSessionKeyStateMethod Method = "channels.v1.submit_session_key_state"
Expand Down
1 change: 1 addition & 0 deletions sdk/ts-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"scripts": {
"build": "tsc",
"build:ci": "tsc",
"build:prod": "tsc -p tsconfig.prod.json",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.config.cjs",
"lint": "eslint src test",
Expand Down
Loading
Loading