Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from hermeznetwork/fix/paths
Browse files Browse the repository at this point in the history
Fix paths
  • Loading branch information
mfcastellani authored Jun 30, 2021
2 parents c5851a4 + 3d1f790 commit 4f4f89e
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# hermez-go-sdk

Golang SDK for Hermez Network
4 changes: 2 additions & 2 deletions examples/get-account-info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"log"

"github.com/jeffprestes/hermez-go-sdk/account"
"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/account"
"github.com/hermeznetwork/hermez-go-sdk/client"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions examples/get-actualcoordinator-info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"log"

"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/jeffprestes/hermez-go-sdk/node"
"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/node"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions examples/get-bootcoordinator-info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"log"

"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/jeffprestes/hermez-go-sdk/node"
"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/node"
)

const (
Expand Down
8 changes: 4 additions & 4 deletions examples/send-l2-tx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"log"
"math/big"

"github.com/jeffprestes/hermez-go-sdk/account"
"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/jeffprestes/hermez-go-sdk/node"
"github.com/jeffprestes/hermez-go-sdk/transaction"
"github.com/hermeznetwork/hermez-go-sdk/account"
"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/node"
"github.com/hermeznetwork/hermez-go-sdk/transaction"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion node/bootcoordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"log"
"net/http"

"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-node/db/historydb"
"github.com/jeffprestes/hermez-go-sdk/client"
)

func GetBootCoordinatorNodeInfo(hezClient client.HermezClient) (nodeState historydb.StateAPI, err error) {
Expand Down
2 changes: 1 addition & 1 deletion node/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"log"
"net/http"

"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-node/db/historydb"
"github.com/jeffprestes/hermez-go-sdk/client"
)

func GetActualCoordinatorNodeInfo(hezClient client.HermezClient) (nodeState historydb.StateAPI, err error) {
Expand Down
36 changes: 18 additions & 18 deletions transaction/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"

"github.com/ethereum/go-ethereum/common"
"github.com/hermeznetwork/hermez-go-sdk/account"
hezcommon "github.com/hermeznetwork/hermez-node/common"
"github.com/iden3/go-iden3-crypto/babyjub"
"github.com/jeffprestes/hermez-go-sdk/account"
)

// NewHermezAPITxRequest convert L2 tx to Hermez API request model
Expand Down Expand Up @@ -87,49 +87,49 @@ func MarshalTransaction(itemToTransfer string,
var nonce hezcommon.Nonce
var fromIdx, toIdx hezcommon.Idx

// Get from account Token and nonce details from sender account
for _, account := range senderAcctDetails.Accounts {
if strings.ToUpper(account.Token.Symbol) == itemToTransfer {
token.TokenID = hezcommon.TokenID(account.Token.ID)
token.Symbol = account.Token.Symbol
nonce = hezcommon.Nonce(account.Nonce)
tempAccountsIdx := strings.Split(account.AccountIndex, ":")
// Get from innerAccount Token and nonce details from sender innerAccount
for _, innerAccount := range senderAcctDetails.Accounts {
if strings.ToUpper(innerAccount.Token.Symbol) == itemToTransfer {
token.TokenID = hezcommon.TokenID(innerAccount.Token.ID)
token.Symbol = innerAccount.Token.Symbol
nonce = hezcommon.Nonce(innerAccount.Nonce)
tempAccountsIdx := strings.Split(innerAccount.AccountIndex, ":")
if len(tempAccountsIdx) == 3 {
tempAccIdx, errAtoi := strconv.Atoi(tempAccountsIdx[2])
if errAtoi != nil {
err = fmt.Errorf("[MarshalTransaction] Error getting sender account index. Account: %+v - Error: %s\n", account, err.Error())
err = fmt.Errorf("[MarshalTransaction] Error getting sender Account index. Account: %+v - Error: %s\n", innerAccount, err.Error())
return
}
fromIdx = hezcommon.Idx(tempAccIdx)
}
}
}

// Get from account Token and nonce details from receipient account
for _, account := range receipientAcctDetails.Accounts {
if strings.ToUpper(account.Token.Symbol) == itemToTransfer {
tempAccountsIdx := strings.Split(account.AccountIndex, ":")
// Get from innerAccount Token and nonce details from receipient innerAccount
for _, innerAccount := range receipientAcctDetails.Accounts {
if strings.ToUpper(innerAccount.Token.Symbol) == itemToTransfer {
tempAccountsIdx := strings.Split(innerAccount.AccountIndex, ":")
if len(tempAccountsIdx) == 3 {
tempAccIdx, errAtoi := strconv.Atoi(tempAccountsIdx[2])
if errAtoi != nil {
log.Printf("[MarshalTransaction] Error getting receipient account index. Account: %+v - Error: %s\n", account, err.Error())
log.Printf("[MarshalTransaction] Error getting receipient Account index. Account: %+v - Error: %s\n", innerAccount, err.Error())
return
}
toIdx = hezcommon.Idx(tempAccIdx)
}
}
}

// If there is no account created to this specific token stop the code
// If there is no innerAccount created to this specific token stop the code
if len(fromIdx.String()) < 1 {
err = fmt.Errorf("[MarshalTransaction] There is no sender account to this user %s for this Token %s", senderBjjWallet.HezBjjAddress, itemToTransfer)
err = fmt.Errorf("[MarshalTransaction] There is no sender Account to this user %s for this Token %s", senderBjjWallet.HezBjjAddress, itemToTransfer)
log.Println(err.Error())
return
}

// If there is no account created to this specific token stop the code
// If there is no innerAccount created to this specific token stop the code
if len(toIdx.String()) < 1 {
err = fmt.Errorf("[MarshalTransaction] There is no receipient account to this user %+v for this Token %s", receipientAcctDetails, itemToTransfer)
err = fmt.Errorf("[MarshalTransaction] There is no receipient Account to this user %+v for this Token %s", receipientAcctDetails, itemToTransfer)
log.Println(err.Error())
return
}
Expand Down
4 changes: 2 additions & 2 deletions transaction/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http"

"github.com/ethereum/go-ethereum/common"
"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/jeffprestes/hermez-go-sdk/util"
"github.com/hermeznetwork/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/util"
)

// ExecuteL2Transaction submits L2 transaction to the actual coordinator endpoint
Expand Down
4 changes: 2 additions & 2 deletions transaction/l2.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"math/big"

"github.com/jeffprestes/hermez-go-sdk/account"
"github.com/jeffprestes/hermez-go-sdk/client"
"github.com/hermeznetwork/hermez-go-sdk/account"
"github.com/hermeznetwork/hermez-go-sdk/client"
)

// L2Transfer perform token or ETH transfer within Hermez network (we say L2 or Layer2)
Expand Down

0 comments on commit 4f4f89e

Please sign in to comment.