Initial Commit
This commit is contained in:
159
models/models.go
Normal file
159
models/models.go
Normal file
@@ -0,0 +1,159 @@
|
||||
package models
|
||||
|
||||
const (
|
||||
ContentTypeJSON = "application/json"
|
||||
)
|
||||
|
||||
type TransactionCreateRequest struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
TxnType string `json:"txn_type"`
|
||||
Payload string `json:"payload"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
type TransactionCreateResponse struct {
|
||||
TransactionID string `json:"transaction_id"`
|
||||
}
|
||||
|
||||
type TransactionBulkRequest struct {
|
||||
Transactions []TransactionCreateRequest `json:"transactions"`
|
||||
}
|
||||
|
||||
type TransactionBulkResponse struct {
|
||||
TransactionIDs []string `json:"transaction_ids"`
|
||||
}
|
||||
|
||||
type TransactionListResponse struct {
|
||||
TransactionTypes []*TransactionType `json:"transactionTypes"`
|
||||
}
|
||||
|
||||
type Transaction struct {
|
||||
Version string `json:"version"`
|
||||
Header TransactionHeader `json:"header"`
|
||||
Proof TransactionProof `json:"proof"`
|
||||
Payload string `json:"payload"`
|
||||
}
|
||||
|
||||
type TransactionHeader struct {
|
||||
Tag string `json:"tag"`
|
||||
DcId string `json:"dc_id"`
|
||||
TxnId string `json:"txn_id"`
|
||||
Invoker string `json:"invoker"`
|
||||
BlockId string `json:"block_id"`
|
||||
TxnType string `json:"txn_type"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
}
|
||||
|
||||
type TransactionProof struct {
|
||||
Full string `json:"full"`
|
||||
Stripped string `json:"stripped"`
|
||||
}
|
||||
|
||||
type ListTransactionsResponse struct {
|
||||
Transactions []Transaction `json:"transactions"`
|
||||
}
|
||||
|
||||
type TransactionTypeCreateRequest struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
TxnType string `json:"txn_type"`
|
||||
}
|
||||
|
||||
type TransactionTypeCreateResponse struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type TransactionType struct {
|
||||
Version string `json:"version"`
|
||||
Created int64 `json:"created"`
|
||||
Modified int64 `json:"modified"`
|
||||
TxnType string `json:"txn_type"`
|
||||
ContractID string `json:"contract_id,omitempty"`
|
||||
CustomIndexes []interface{} `json:"custom_indexes"`
|
||||
ActiveSinceBlock string `json:"active_since_block"`
|
||||
}
|
||||
|
||||
type SmartContractCreateRequest struct {
|
||||
Environment string `json:"environment"`
|
||||
TransactionType string `json:"transactionType"`
|
||||
ExecutionOrder string `json:"executionOrder"`
|
||||
EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
|
||||
Secrets map[string]string `json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
type SmartContractUpdateRequest struct {
|
||||
Version string `json:"version,omitempty"`
|
||||
Enabled bool `json:"enabled"`
|
||||
EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
|
||||
Secrets map[string]string `json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
type SmartContract struct {
|
||||
Id string `json:"id"`
|
||||
Created uint64 `json:"created"`
|
||||
Modified uint64 `json:"modified"`
|
||||
|
||||
Version string `json:"version"`
|
||||
Environment string `json:"environment"`
|
||||
TransactionType string `json:"transactionType"`
|
||||
ExecutionOrder string `json:"executionOrder"`
|
||||
|
||||
ExecutionInfo *SmartContractExecutionInfo `json:"executionInfo"`
|
||||
|
||||
EnvVars map[string]string `json:"envVars"`
|
||||
Secrets []string `json:"secrets"`
|
||||
}
|
||||
|
||||
type SmartContractExecutionInfo struct {
|
||||
Type string `json:"type"`
|
||||
|
||||
// LocalExecutable type
|
||||
ExecutablePath string `json:"executablePath"`
|
||||
ExecutableWorkingDirectory string `json:"executableWorkingDirectory"`
|
||||
ExecutableHash string `json:"executableHash"`
|
||||
}
|
||||
|
||||
type Block struct {
|
||||
Version string `json:"version"`
|
||||
ID string `json:"block_id"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
PrevID string `json:"prev_id"`
|
||||
PrevProof string `json:"prev_proof"`
|
||||
Transactions []string `json:"transactions"`
|
||||
Proof BlockProof `json:"proof"`
|
||||
}
|
||||
|
||||
type BlockProof struct {
|
||||
Scheme string `json:"scheme"`
|
||||
Proof string `json:"proof"`
|
||||
Nonce int64 `json:"nonce,omitempty"`
|
||||
}
|
||||
|
||||
type SystemStatus struct {
|
||||
ID string `json:"id"`
|
||||
Level int `json:"level"`
|
||||
URL string `json:"url"`
|
||||
HashAlgo string `json:"hashAlgo"`
|
||||
Scheme string `json:"scheme"`
|
||||
Version string `json:"version"`
|
||||
EncryptionAlgo string `json:"encryptionAlgo"`
|
||||
IndexingEnabled bool `json:"indexingEnabled"`
|
||||
|
||||
// Level 5 Node
|
||||
Funded string `json:"funded,omitempty"`
|
||||
BroadcastInterval string `json:"broadcastInterval,omitempty"`
|
||||
Network string `json:"network,omitempty"`
|
||||
InterchainWallet string `json:"interchainWallet,omitempty"`
|
||||
}
|
||||
|
||||
type SuccessResponse struct {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type ErrorResponse struct {
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type ListResponse struct {
|
||||
Items []interface{} `json:"items"`
|
||||
TotalCount int `json:"total_count"`
|
||||
}
|
||||
Reference in New Issue
Block a user