-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Obscuroscan - Add Pagination in the list calls (Public and Encrypted) (…
…#1434) * Add an health endpoint to OG * lint * Public + Personal Pagination - FE + BE * lint * Update go/enclave/genesis/testnet_genesis.go
- Loading branch information
Showing
30 changed files
with
1,571 additions
and
1,189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package common | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
type PrivateQueryResponse struct { | ||
Receipts types.Receipts | ||
Total uint64 | ||
} | ||
|
||
type PublicQueryResponse struct { | ||
PublicTxData []PublicTxData | ||
Total uint64 | ||
} | ||
|
||
type PublicTxData struct { | ||
TransactionHash TxHash | ||
BatchHeight *big.Int | ||
Finality FinalityType | ||
} | ||
|
||
type FinalityType string | ||
|
||
const ( | ||
MempoolPending FinalityType = "Pending" | ||
BatchFinal FinalityType = "Final" | ||
) | ||
|
||
type QueryPagination struct { | ||
Offset uint64 | ||
Size uint | ||
} | ||
|
||
func (p *QueryPagination) UnmarshalJSON(data []byte) error { | ||
// Use a temporary struct to avoid infinite unmarshalling loop | ||
type Temp struct { | ||
Size uint `json:"size"` | ||
Offset uint64 | ||
} | ||
|
||
var temp Temp | ||
if err := json.Unmarshal(data, &temp); err != nil { | ||
return err | ||
} | ||
|
||
if temp.Size < 1 || temp.Size > 100 { | ||
return fmt.Errorf("size must be between 1 and 100") | ||
} | ||
|
||
p.Size = temp.Size | ||
p.Offset = temp.Offset | ||
return nil | ||
} | ||
|
||
type PrivateCustomQueryListTransactions struct { | ||
Address common.Address `json:"address"` | ||
Pagination QueryPagination `json:"pagination"` | ||
} |
Oops, something went wrong.