2023-02-28 12:58:26 -08:00
|
|
|
package domain
|
|
|
|
|
|
|
|
// p2p network constants.
|
|
|
|
const (
|
|
|
|
P2pMainNet = "mainnet"
|
|
|
|
P2pTestNet = "testnet"
|
|
|
|
P2pDevNet = "devnet"
|
|
|
|
)
|
2023-03-14 11:49:10 -07:00
|
|
|
|
2023-09-25 12:56:05 -07:00
|
|
|
const (
|
|
|
|
AppIdUnkonwn = "UNKONWN"
|
|
|
|
AppIdPortalTokenBridge = "PORTAL_TOKEN_BRIDGE"
|
|
|
|
)
|
2023-04-25 11:34:29 -07:00
|
|
|
|
|
|
|
// SourceTxStatus is meant to be a user-facing enum that describes the status of the source transaction.
|
|
|
|
type SourceTxStatus string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// SourceTxStatusChainNotSupported indicates that the processing failed due to the chain ID not being supported.
|
|
|
|
//
|
|
|
|
// (i.e.: there is no adapter for that chain yet)
|
|
|
|
SourceTxStatusChainNotSupported SourceTxStatus = "chainNotSupported"
|
|
|
|
|
|
|
|
// SourceTxStatusInternalError represents an internal, unspecified error.
|
|
|
|
SourceTxStatusInternalError SourceTxStatus = "internalError"
|
|
|
|
|
|
|
|
// SourceTxStatusConfirmed indicates that the transaciton has been processed successfully.
|
|
|
|
SourceTxStatusConfirmed SourceTxStatus = "confirmed"
|
|
|
|
)
|
Add endpoint `GET /api/v1/transactions` (#388)
### Summary
Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/385
This pull request implements a new endpoint, `GET /api/v1/transactions`, which will be consumed by the wormhole explorer UI.
The endpoint returns a paginated list of transactions, in which each element contains a brief overview of the transaction (ID, txHash, status, etc.).
It exposes offset-based pagination via the parameters `page` and `pageSize`. Also, results can be obtained for a specific address by using the `address` query parameter.
The response model looks like this:
```json
{
"transactions": [
{
"id": "1/5ec18c34b47c63d17ab43b07b9b2319ea5ee2d163bce2e467000174e238c8e7f/12965",
"timestamp": "2023-06-08T19:30:19Z",
"txHash": "a302c4ab2d6b9a6003951d2e91f8fdbb83cfa20f6ffb588b95ef0290aab37066",
"originChain": 1,
"status": "ongoing"
},
{
"id": "22/0000000000000000000000000000000000000000000000000000000000000001/18308",
"timestamp": "2023-06-08T19:17:14Z",
"txHash": "00000000000000000000000000000000000000000000000000000000000047e7",
"originChain": 22,
"destinationAddress": "0x00000000000000000000000067e8a40816a983fbe3294aaebd0cc2391815b86b",
"destinationChain": 5,
"tokenAmount": "0.12",
"usdAmount": "0.12012",
"symbol": "USDC",
"status": "completed"
},
...
]
}
```
### Limitations of the current implementation
1. Doesn't return the total number of results (this may result in a performance issue when we filter by address)
2. Can only filter by receiver address (we don't have sender information in the database yet)
2023-06-12 07:43:48 -07:00
|
|
|
|
|
|
|
const (
|
|
|
|
DstTxStatusFailedToProcess = "failed"
|
|
|
|
DstTxStatusConfirmed = "completed"
|
|
|
|
DstTxStatusUnkonwn = "unknown"
|
|
|
|
)
|