Update generation of typescript documentation from golang types

This commit is contained in:
Martin Boehm 2023-04-12 23:24:47 +02:00
parent c836bdff1f
commit 41a2c5472b
4 changed files with 19 additions and 18 deletions

View File

@ -230,7 +230,7 @@ type EthereumSpecific struct {
Error string `json:"error,omitempty"`
Nonce uint64 `json:"nonce"`
GasLimit *big.Int `json:"gasLimit"`
GasUsed *big.Int `json:"gasUsed"`
GasUsed *big.Int `json:"gasUsed,omitempty"`
GasPrice *Amount `json:"gasPrice"`
Data string `json:"data,omitempty"`
ParsedData *bchain.EthereumParsedInputData `json:"parsedData,omitempty"`

View File

@ -12,7 +12,7 @@ export interface EthereumInternalTransfer {
type: number;
from: string;
to: string;
value?: string;
value: string;
}
export interface EthereumParsedInputParam {
type: string;
@ -30,9 +30,9 @@ export interface EthereumSpecific {
status: number;
error?: string;
nonce: number;
gasLimit?: string;
gasUsed?: string;
gasPrice?: string;
gasLimit: number;
gasUsed?: number;
gasPrice: string;
data?: string;
parsedData?: EthereumParsedInputData;
internalTransfers?: EthereumInternalTransfer[];
@ -93,7 +93,7 @@ export interface Tx {
blockTime: number;
size?: number;
vsize?: number;
value?: string;
value: string;
valueIn?: string;
fees?: string;
hex?: string;
@ -105,7 +105,7 @@ export interface Tx {
}
export interface FeeStats {
txCount: number;
totalFeesSat?: string;
totalFeesSat: string;
averageFeePerKb: number;
decilesFeePerKb: number[];
}
@ -139,10 +139,10 @@ export interface Address {
totalPages?: number;
itemsOnPage?: number;
address: string;
balance?: string;
balance: string;
totalReceived?: string;
totalSent?: string;
unconfirmedBalance?: string;
unconfirmedBalance: string;
unconfirmedTxs: number;
txs: number;
nonTokenTxs?: number;
@ -164,7 +164,7 @@ export interface Address {
export interface Utxo {
txid: string;
vout: number;
value?: string;
value: string;
height?: number;
confirmations: number;
address?: string;
@ -175,9 +175,9 @@ export interface Utxo {
export interface BalanceHistory {
time: number;
txs: number;
received?: string;
sent?: string;
sentToSelf?: string;
received: string;
sent: string;
sentToSelf: string;
rates?: { [key: string]: number };
txid?: string;
}
@ -268,8 +268,8 @@ export interface BlockbookInfo {
about: string;
}
export interface SystemInfo {
blockbook?: BlockbookInfo;
backend?: BackendInfo;
blockbook: BlockbookInfo;
backend: BackendInfo;
}
export interface FiatTicker {
ts?: number;
@ -290,6 +290,7 @@ export interface WsReq {
| 'getAccountInfo'
| 'getInfo'
| 'getBlockHash'
| 'getBlock'
| 'getAccountUtxo'
| 'getBalanceHistory'
| 'getTransaction'

View File

@ -18,7 +18,7 @@ func main() {
t.ManageType(api.Amount{}, typescriptify.TypeOptions{TSType: "string"})
t.ManageType([]api.Amount{}, typescriptify.TypeOptions{TSType: "string[]"})
t.ManageType(big.Int{}, typescriptify.TypeOptions{TSType: "string"})
t.ManageType(big.Int{}, typescriptify.TypeOptions{TSType: "number"})
t.ManageType(time.Time{}, typescriptify.TypeOptions{TSType: "string", TSDoc: "Time in ISO 8601 YYYY-MM-DDTHH:mm:ss.sssZd"})
// API - REST and Websocket
@ -57,7 +57,7 @@ func main() {
t.Add(server.WsFiatRatesForTimestampsReq{})
t.Add(server.WsFiatRatesTickersListReq{})
err := t.ConvertToFile("blockbook-api.d.ts")
err := t.ConvertToFile("blockbook-api.ts")
if err != nil {
panic(err.Error())
}

View File

@ -4,7 +4,7 @@ import "encoding/json"
type WsReq struct {
ID string `json:"id"`
Method string `json:"method" ts_type:"'getAccountInfo' | 'getInfo' | 'getBlockHash' | 'getAccountUtxo' | 'getBalanceHistory' | 'getTransaction' | 'getTransactionSpecific' | 'estimateFee' | 'sendTransaction' | 'subscribeNewBlock' | 'unsubscribeNewBlock' | 'subscribeNewTransaction' | 'unsubscribeNewTransaction' | 'subscribeAddresses' | 'unsubscribeAddresses' | 'subscribeFiatRates' | 'unsubscribeFiatRates' | 'ping' | 'getCurrentFiatRates' | 'getFiatRatesForTimestamps' | 'getFiatRatesTickersList'"`
Method string `json:"method" ts_type:"'getAccountInfo' | 'getInfo' | 'getBlockHash'| 'getBlock' | 'getAccountUtxo' | 'getBalanceHistory' | 'getTransaction' | 'getTransactionSpecific' | 'estimateFee' | 'sendTransaction' | 'subscribeNewBlock' | 'unsubscribeNewBlock' | 'subscribeNewTransaction' | 'unsubscribeNewTransaction' | 'subscribeAddresses' | 'unsubscribeAddresses' | 'subscribeFiatRates' | 'unsubscribeFiatRates' | 'ping' | 'getCurrentFiatRates' | 'getFiatRatesForTimestamps' | 'getFiatRatesTickersList'"`
Params json.RawMessage `json:"params" ts_type:"any"`
}