mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Refactor account creation auth endpoints
This commit is contained in:
@@ -55,7 +55,7 @@ func (l2db *L2DB) AddAccountCreationAuth(auth *common.AccountCreationAuth) error
|
||||
return err
|
||||
}
|
||||
|
||||
// GetAccountCreationAuth returns an account creation authorization into the DB
|
||||
// GetAccountCreationAuth returns an account creation authorization from the DB
|
||||
func (l2db *L2DB) GetAccountCreationAuth(addr ethCommon.Address) (*common.AccountCreationAuth, error) {
|
||||
auth := new(common.AccountCreationAuth)
|
||||
return auth, meddler.QueryRow(
|
||||
@@ -65,6 +65,16 @@ func (l2db *L2DB) GetAccountCreationAuth(addr ethCommon.Address) (*common.Accoun
|
||||
)
|
||||
}
|
||||
|
||||
// GetAccountCreationAuthAPI returns an account creation authorization from the DB
|
||||
func (l2db *L2DB) GetAccountCreationAuthAPI(addr ethCommon.Address) (*AccountCreationAuthAPI, error) {
|
||||
auth := new(AccountCreationAuthAPI)
|
||||
return auth, meddler.QueryRow(
|
||||
l2db.db, auth,
|
||||
"SELECT * FROM account_creation_auth WHERE eth_addr = $1;",
|
||||
addr,
|
||||
)
|
||||
}
|
||||
|
||||
// AddTx inserts a tx to the pool
|
||||
func (l2db *L2DB) AddTx(tx *PoolL2TxWrite) error {
|
||||
return meddler.Insert(l2db.db, "tx_pool", tx)
|
||||
|
||||
@@ -114,3 +114,10 @@ func (tx PoolTxAPI) MarshalJSON() ([]byte, error) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type AccountCreationAuthAPI struct {
|
||||
EthAddr apitypes.HezEthAddr `json:"hezEthereumAddress" meddler:"eth_addr" `
|
||||
BJJ apitypes.HezBJJ `json:"bjj" meddler:"bjj" `
|
||||
Signature apitypes.EthSignature `json:"signature" meddler:"signature" `
|
||||
Timestamp time.Time `json:"timestamp" meddler:"timestamp,utctime"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user