Skip to content

Commit 92188d5

Browse files
committed
fix: after rebase
1 parent be998d9 commit 92188d5

5 files changed

Lines changed: 22 additions & 26 deletions

File tree

clearnode/app_session_service_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
3131
require.NoError(t, GetWalletLedger(db, userAddressB).Record(userAccountIDB, "usdc", decimal.NewFromInt(200)))
3232

3333
var capturedNotifications []Notification
34-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {
34+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {
3535
capturedNotifications = append(capturedNotifications, Notification{
3636
userID: userID,
3737
eventType: EventType(method),
@@ -111,7 +111,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
111111
require.NoError(t, db.Create(&SignerWallet{Signer: userAddressA.Hex(), Wallet: userAddressA.Hex()}).Error)
112112
require.NoError(t, GetWalletLedger(db, userAddressA).Record(userAccountIDA, "usdc", decimal.NewFromInt(50))) // Not enough
113113

114-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
114+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
115115
params := &CreateAppSessionParams{
116116
Definition: AppDefinition{
117117
Protocol: "test-proto",
@@ -142,7 +142,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
142142
Status: ChannelStatusChallenged,
143143
}).Error)
144144

145-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
145+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
146146
params := &CreateAppSessionParams{
147147
Definition: AppDefinition{
148148
Protocol: "test-proto",
@@ -169,7 +169,7 @@ func TestAppSessionService_CreateApplication(t *testing.T) {
169169
require.NoError(t, db.Create(&SignerWallet{Signer: userAddressA.Hex(), Wallet: userAddressA.Hex()}).Error)
170170
require.NoError(t, GetWalletLedger(db, userAddressA).Record(userAccountIDA, "usdc", decimal.NewFromInt(100)))
171171

172-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
172+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
173173
params := &CreateAppSessionParams{
174174
Definition: AppDefinition{
175175
Protocol: "test-proto",
@@ -202,7 +202,7 @@ func TestAppSessionService_SubmitAppState(t *testing.T) {
202202
db, cleanup := setupTestDB(t)
203203
defer cleanup()
204204

205-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
205+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
206206
session := &AppSession{
207207
SessionID: "test-session",
208208
Protocol: "test-proto",
@@ -252,7 +252,7 @@ func TestAppSessionService_SubmitAppState(t *testing.T) {
252252
db, cleanup := setupTestDB(t)
253253
defer cleanup()
254254

255-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
255+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
256256
session := &AppSession{
257257
SessionID: "test-session-negative",
258258
Protocol: "test-proto",
@@ -301,7 +301,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
301301
defer cleanup()
302302

303303
var capturedNotifications []Notification
304-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {
304+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {
305305
capturedNotifications = append(capturedNotifications, Notification{
306306
userID: userID,
307307
eventType: EventType(method),
@@ -388,7 +388,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
388388
defer cleanup()
389389

390390
var capturedNotifications []Notification
391-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {
391+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {
392392
capturedNotifications = append(capturedNotifications, Notification{
393393
userID: userID,
394394
eventType: EventType(method),
@@ -449,7 +449,7 @@ func TestAppSessionService_CloseApplication(t *testing.T) {
449449
db, cleanup := setupTestDB(t)
450450
defer cleanup()
451451

452-
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params ...any) {}, nil))
452+
service := NewAppSessionService(db, NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, nil))
453453
session := &AppSession{
454454
SessionID: "test-session-close-negative",
455455
Protocol: "test-proto",

clearnode/custody_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func setupMockCustody(t *testing.T) (*Custody, *gorm.DB, func()) {
8585
custody: contract,
8686
chainID: uint32(chainID.Int64()),
8787
adjudicatorAddress: newTestCommonAddress("0xAdjudicatorAddress"),
88-
wsNotifier: NewWSNotifier(func(userID string, method string, params ...any) {}, logger),
88+
wsNotifier: NewWSNotifier(func(userID string, method string, params RPCDataParams) {}, logger),
8989
logger: logger,
9090
}
9191

@@ -325,7 +325,7 @@ func TestHandleCreatedEvent(t *testing.T) {
325325
}
326326

327327
var capturedNotifications []Notification
328-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
328+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
329329
capturedNotifications = append(capturedNotifications, Notification{
330330
userID: userID,
331331
eventType: EventType(method),
@@ -415,7 +415,7 @@ func TestHandleJoinedEvent(t *testing.T) {
415415
_, mockEvent := createMockJoinedEvent(t)
416416

417417
var capturedNotifications []Notification
418-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
418+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
419419
capturedNotifications = append(capturedNotifications, Notification{
420420
userID: userID,
421421
eventType: EventType(method),
@@ -496,7 +496,7 @@ func TestHandleJoinedEvent(t *testing.T) {
496496
_, mockEvent := createMockJoinedEvent(t)
497497

498498
var capturedNotifications []Notification
499-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
499+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
500500
capturedNotifications = append(capturedNotifications, Notification{
501501
userID: userID,
502502
eventType: EventType(method),
@@ -562,7 +562,7 @@ func TestHandleClosedEvent(t *testing.T) {
562562
_, mockEvent := createMockClosedEvent(t, custody.signer, tokenAddress, finalAmount)
563563

564564
var capturedNotifications []Notification
565-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
565+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
566566
capturedNotifications = append(capturedNotifications, Notification{
567567
userID: userID,
568568
eventType: EventType(method),
@@ -749,7 +749,7 @@ func TestHandleClosedEvent(t *testing.T) {
749749
_, mockEvent := createMockClosedEvent(t, custody.signer, tokenAddress, channelAmount.BigInt())
750750

751751
var capturedNotifications []Notification
752-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
752+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
753753
capturedNotifications = append(capturedNotifications, Notification{
754754
userID: userID,
755755
eventType: EventType(method),
@@ -819,7 +819,7 @@ func TestHandleChallengedEvent(t *testing.T) {
819819
_, mockEvent := createMockChallengedEvent(t, custody.signer, tokenAddress, amount.BigInt())
820820

821821
var capturedNotifications []Notification
822-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
822+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
823823
capturedNotifications = append(capturedNotifications, Notification{
824824
userID: userID,
825825
eventType: EventType(method),
@@ -893,7 +893,7 @@ func TestHandleResizedEvent(t *testing.T) {
893893
_, mockEvent := createMockResizedEvent(t, deltaAmount.BigInt())
894894

895895
var capturedNotifications []Notification
896-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
896+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
897897
capturedNotifications = append(capturedNotifications, Notification{
898898
userID: userID,
899899
eventType: EventType(method),
@@ -1052,7 +1052,7 @@ func TestHandleResizedEvent(t *testing.T) {
10521052
_, mockEvent := createMockResizedEvent(t, big.NewInt(500000))
10531053

10541054
var capturedNotifications []Notification
1055-
custody.wsNotifier.notify = func(userID string, method string, params ...any) {
1055+
custody.wsNotifier.notify = func(userID string, method string, params RPCDataParams) {
10561056
capturedNotifications = append(capturedNotifications, Notification{
10571057
userID: userID,
10581058
eventType: EventType(method),

clearnode/notification.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
)
1010

1111
type WSNotifier struct {
12-
notify func(userID string, method string, params ...any)
12+
notify func(userID string, method string, params RPCDataParams)
1313
logger Logger
1414
}
1515

16-
func NewWSNotifier(notifyFunc func(userID string, method string, params ...any), logger Logger) *WSNotifier {
16+
func NewWSNotifier(notifyFunc func(userID string, method string, params RPCDataParams), logger Logger) *WSNotifier {
1717
return &WSNotifier{
1818
notify: notifyFunc,
1919
logger: logger,

clearnode/reconcile_cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func runReconcileCli(logger Logger) {
5757
custody, err := NewCustody(
5858
signer,
5959
db,
60-
NewWSNotifier(func(userID, method string, params ...any) {}, logger),
60+
NewWSNotifier(func(userID, method string, params RPCDataParams) {}, logger),
6161
network.InfuraURL,
6262
network.CustodyAddress,
6363
network.AdjudicatorAddress,

clearnode/rpc_router_private.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
)
1010

1111
type GetLedgerBalancesParams struct {
12-
// TODO: add XOR validation
13-
Participant string `json:"participant,omitempty"` // Optional participant address to filter balances
14-
AccountID string `json:"account_id,omitempty"` // Optional account ID to filter balances
12+
AccountID string `json:"account_id,omitempty"` // Optional account ID to filter balances
1513
}
1614

1715
type GetRPCHistoryParams struct {
@@ -183,8 +181,6 @@ func (r *RPCRouter) HandleGetLedgerBalances(c *RPCContext) {
183181
userAccountID := NewAccountID(c.UserID)
184182
if params.AccountID != "" {
185183
userAccountID = NewAccountID(params.AccountID)
186-
} else if params.Participant != "" {
187-
userAccountID = NewAccountID(params.Participant)
188184
}
189185

190186
ledger := GetWalletLedger(r.DB, userAddress)

0 commit comments

Comments
 (0)