diff --git a/api/types.go b/api/types.go index 305bf379..0525e3ce 100644 --- a/api/types.go +++ b/api/types.go @@ -159,14 +159,14 @@ type MultiTokenValue struct { // Token contains info about tokens held by an address type Token struct { // Deprecated: Use Standard instead. - Type bchain.TokenStandardName `json:"type" ts_type:"'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155'"` - Standard bchain.TokenStandardName `json:"standard" ts_type:"'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155'"` + Type bchain.TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard bchain.TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` Name string `json:"name"` Path string `json:"path,omitempty"` Contract string `json:"contract,omitempty"` Transfers int `json:"transfers"` Symbol string `json:"symbol,omitempty"` - Decimals int `json:"decimals,omitempty"` + Decimals int `json:"decimals"` BalanceSat *Amount `json:"balance,omitempty"` BaseValue float64 `json:"baseValue,omitempty"` // value in the base currency (ETH for Ethereum) SecondaryValue float64 `json:"secondaryValue,omitempty"` // value in secondary (fiat) currency, if specified @@ -207,14 +207,14 @@ func (a Tokens) Less(i, j int) bool { // TokenTransfer contains info about a token transfer done in a transaction type TokenTransfer struct { // Deprecated: Use Standard instead. - Type bchain.TokenStandardName `json:"type"` - Standard bchain.TokenStandardName `json:"standard"` + Type bchain.TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard bchain.TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` From string `json:"from"` To string `json:"to"` Contract string `json:"contract"` Name string `json:"name,omitempty"` Symbol string `json:"symbol,omitempty"` - Decimals int `json:"decimals,omitempty"` + Decimals int `json:"decimals"` Value *Amount `json:"value,omitempty"` MultiTokenValues []MultiTokenValue `json:"multiTokenValues,omitempty"` } @@ -362,7 +362,7 @@ type Address struct { TotalSecondaryValue float64 `json:"totalSecondaryValue,omitempty"` // value including tokens in secondary currency ContractInfo *bchain.ContractInfo `json:"contractInfo,omitempty"` // Deprecated: replaced by ContractInfo - Erc20Contract *bchain.ContractInfo `json:"erc20Contract,omitempty"` + Erc20Contract *bchain.ContractInfo `json:"erc20Contract,omitempty" ts_doc:"@deprecated: replaced by contractInfo"` AddressAliases AddressAliasesMap `json:"addressAliases,omitempty"` StakingPools []StakingPool `json:"stakingPools,omitempty"` // helpers for explorer diff --git a/bchain/types_ethereum_type.go b/bchain/types_ethereum_type.go index 202a14e4..31e1702a 100644 --- a/bchain/types_ethereum_type.go +++ b/bchain/types_ethereum_type.go @@ -60,8 +60,8 @@ type EthereumInternalData struct { // ContractInfo contains info about a contract type ContractInfo struct { // Deprecated: Use Standard instead. - Type TokenStandardName `json:"type"` - Standard TokenStandardName `json:"standard"` + Type TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` Contract string `json:"contract"` Name string `json:"name"` Symbol string `json:"symbol"` diff --git a/blockbook-api.ts b/blockbook-api.ts index 706803f5..d66954ff 100644 --- a/blockbook-api.ts +++ b/blockbook-api.ts @@ -46,13 +46,15 @@ export interface MultiTokenValue { value?: string; } export interface TokenTransfer { - type: string; + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; from: string; to: string; contract: string; name?: string; symbol?: string; - decimals?: number; + decimals: number; value?: string; multiTokenValues?: MultiTokenValue[]; } @@ -125,7 +127,9 @@ export interface StakingPool { autocompoundBalance: string; } export interface ContractInfo { - type: string; + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; contract: string; name: string; symbol: string; @@ -134,13 +138,15 @@ export interface ContractInfo { destructedInBlock?: number; } export interface Token { - type: 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155'; + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; name: string; path?: string; contract?: string; transfers: number; symbol?: string; - decimals?: number; + decimals: number; balance?: string; baseValue?: number; secondaryValue?: number; @@ -174,6 +180,7 @@ export interface Address { totalBaseValue?: number; totalSecondaryValue?: number; contractInfo?: ContractInfo; + /** @deprecated: replaced by contractInfo */ erc20Contract?: ContractInfo; addressAliases?: { [key: string]: AddressAlias }; stakingPools?: StakingPool[]; @@ -418,6 +425,8 @@ export interface WsEstimateFeeReq { export interface Eip1559Fee { maxFeePerGas: string; maxPriorityFeePerGas: string; + minWaitTimeEstimate?: number; + maxWaitTimeEstimate?: number; } export interface Eip1559Fees { baseFeePerGas?: string; @@ -425,6 +434,12 @@ export interface Eip1559Fees { medium?: Eip1559Fee; high?: Eip1559Fee; instant?: Eip1559Fee; + networkCongestion?: number; + latestPriorityFeeRange?: string[]; + historicalPriorityFeeRange?: string[]; + historicalBaseFeeRange?: string[]; + priorityFeeTrend?: 'up' | 'down'; + baseFeeTrend?: 'up' | 'down'; } export interface WsEstimateFeeRes { feePerTx?: string; diff --git a/build/tools/typescriptify/typescriptify.go b/build/tools/typescriptify/typescriptify.go index 069572cb..8ee0563e 100644 --- a/build/tools/typescriptify/typescriptify.go +++ b/build/tools/typescriptify/typescriptify.go @@ -19,6 +19,7 @@ func main() { t.ManageType(api.Amount{}, typescriptify.TypeOptions{TSType: "string"}) t.ManageType([]api.Amount{}, typescriptify.TypeOptions{TSType: "string[]"}) + t.ManageType([]*api.Amount{}, 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"})