Skip to content

Commit

Permalink
additional renames
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Nov 27, 2023
1 parent 53867de commit 2185d9d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions integration/obscurogateway/gateway_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type GatewayUser struct {
Wallets []wallet.Wallet
HTTPClient *ethclient.Client
WSClient *ethclient.Client
ogClient *lib.TGLib
tgClient *lib.TGLib
}

func NewUser(wallets []wallet.Wallet, serverAddressHTTP string, serverAddressWS string) (*GatewayUser, error) {
Expand All @@ -42,17 +42,17 @@ func NewUser(wallets []wallet.Wallet, serverAddressHTTP string, serverAddressWS
Wallets: wallets,
HTTPClient: httpClient,
WSClient: wsClient,
ogClient: ogClient,
tgClient: ogClient,
}, nil
}

func (u GatewayUser) RegisterAccounts() error {
for _, w := range u.Wallets {
err := u.ogClient.RegisterAccount(w.PrivateKey(), w.Address())
err := u.tgClient.RegisterAccount(w.PrivateKey(), w.Address())
if err != nil {
return err
}
fmt.Printf("Successfully registered address %s for user: %s.\n", w.Address().Hex(), u.ogClient.UserID())
fmt.Printf("Successfully registered address %s for user: %s.\n", w.Address().Hex(), u.tgClient.UserID())
}

return nil
Expand Down
18 changes: 9 additions & 9 deletions integration/obscurogateway/tengateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ func TestTenGateway(t *testing.T) {
func testMultipleAccountsSubscription(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
user0, err := NewUser([]wallet.Wallet{w}, httpURL, wsURL)
require.NoError(t, err)
fmt.Printf("Created user with UserID: %s\n", user0.ogClient.UserID())
fmt.Printf("Created user with encryption token: %s\n", user0.tgClient.UserID())

user1, err := NewUser([]wallet.Wallet{datagenerator.RandomWallet(integration.TenChainID), datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL)
require.NoError(t, err)
fmt.Printf("Created user with UserID: %s\n", user0.ogClient.UserID())
fmt.Printf("Created user with encryption token: %s\n", user0.tgClient.UserID())

user2, err := NewUser([]wallet.Wallet{datagenerator.RandomWallet(integration.TenChainID), datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL)
require.NoError(t, err)
fmt.Printf("Created user with UserID: %s\n", user0.ogClient.UserID())
fmt.Printf("Created user with encryption token: %s\n", user0.tgClient.UserID())

// register all the accounts for that user
err = user0.RegisterAccounts()
Expand Down Expand Up @@ -243,7 +243,7 @@ func testMultipleAccountsSubscription(t *testing.T, httpURL, wsURL string, w wal
}

func testAreTxsMinted(t *testing.T, httpURL, wsURL string, w wallet.Wallet) { //nolint: unused
// set up the ogClient
// set up the tgClient
ogClient := lib.NewTenGatewayLibrary(httpURL, wsURL)

// join + register against the og
Expand All @@ -270,7 +270,7 @@ func testAreTxsMinted(t *testing.T, httpURL, wsURL string, w wallet.Wallet) { //
}

func testErrorHandling(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
// set up the ogClient
// set up the tgClient
ogClient := lib.NewTenGatewayLibrary(httpURL, wsURL)

// join + register against the og
Expand Down Expand Up @@ -312,7 +312,7 @@ func testErrorHandling(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
}

func testErrorsRevertedArePassed(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
// set up the ogClient
// set up the tgClient
ogClient := lib.NewTenGatewayLibrary(httpURL, wsURL)

// join + register against the og
Expand Down Expand Up @@ -390,7 +390,7 @@ func testUnsubscribe(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
// create a user with multiple accounts
user, err := NewUser([]wallet.Wallet{w, datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL)
require.NoError(t, err)
fmt.Printf("Created user with UserID: %s\n", user.ogClient.UserID())
fmt.Printf("Created user with encryption token: %s\n", user.tgClient.UserID())

// register all the accounts for the user
err = user.RegisterAccounts()
Expand Down Expand Up @@ -440,7 +440,7 @@ func testClosingConnectionWhileSubscribed(t *testing.T, httpURL, wsURL string, w
// create a user with multiple accounts
user, err := NewUser([]wallet.Wallet{w, datagenerator.RandomWallet(integration.TenChainID)}, httpURL, wsURL)
require.NoError(t, err)
fmt.Printf("Created user with UserID: %s\n", user.ogClient.UserID())
fmt.Printf("Created user with encryption token: %s\n", user.tgClient.UserID())

// register all the accounts for the user
err = user.RegisterAccounts()
Expand Down Expand Up @@ -479,7 +479,7 @@ func testClosingConnectionWhileSubscribed(t *testing.T, httpURL, wsURL string, w
assert.Equal(t, 0, len(userLogs))

// re-establish connection
wsClient, err := ethclient.Dial(wsURL + "/v1/" + "?token=" + user.ogClient.UserID())
wsClient, err := ethclient.Dial(wsURL + "/v1/" + "?token=" + user.tgClient.UserID())
require.NoError(t, err)
user.WSClient = wsClient

Expand Down

0 comments on commit 2185d9d

Please sign in to comment.