feat: add otx tracking API, add enums, minor fixes

* otx can nw be tracked at /api/track/:trackingId
* moved queries to queries folder
* fixed validation error check in ErrorHandler
* added enum package with enum types
* updated migrations: added enum tables
This commit is contained in:
2023-02-21 17:34:22 +00:00
parent 140c887341
commit 40cb86f522
22 changed files with 314 additions and 147 deletions

27
pkg/enum/enum.go Normal file
View File

@@ -0,0 +1,27 @@
package enum
type (
// OtxStatus represents enum-like values received in the dispatcher from the RPC node or Network callback.
// It includes a subset of well-known and likely failures the dispatcher may encounter.
OtxStatus string
// OtxType reprsents the specific type of signed transaction.
OtxType string
)
// NOTE: These values must also be inserted/updated into db to enforce referential integrity.
const (
IN_NETWORK OtxStatus = "IN_NETWORK"
OBSOLETE OtxStatus = "OBSOLETE"
SUCCESS OtxStatus = "SUCCESS"
FAIL_NO_GAS OtxStatus = "FAIL_NO_GAS"
FAIL_LOW_NONCE OtxStatus = "FAIL_LOW_NONCE"
FAIL_LOW_GAS_PRICE OtxStatus = "FAIL_LOW_GAS_PRICE"
FAIL_UNKNOWN_RPC_ERROR OtxStatus = "FAIL_UNKNOWN_RPC_ERROR"
REVERTED OtxStatus = "REVERTED"
GIFT_GAS OtxType = "GIFT_GAS"
ACCOUNT_REGISTER OtxType = "ACCOUNT_REGISTER"
GIFT_VOUCHER OtxType = "GIFT_VOUCHER"
REFILL_GAS OtxType = "REFILL_GAS"
TRANSFER_VOUCHER OtxType = "TRANSFER_VOUCHER"
)