@avalabs/vm-module-types
Advanced tools
Comparing version 0.0.0-cp-8362-20240628184300 to 0.0.0-cp-8362-20240701212054
# @avalabs/vm-module-types | ||
## 0.0.0-cp-8362-20240628184300 | ||
## 0.0.0-cp-8362-20240701212054 | ||
@@ -5,0 +5,0 @@ ### Patch Changes |
{ | ||
"name": "@avalabs/vm-module-types", | ||
"version": "0.0.0-cp-8362-20240628184300", | ||
"version": "0.0.0-cp-8362-20240701212054", | ||
"main": "src/index.ts", | ||
@@ -9,5 +9,7 @@ "dependencies": { | ||
"devDependencies": { | ||
"bn.js": "5.2.1", | ||
"@types/bn.js": "5.1.5", | ||
"@avalabs/coingecko-sdk": "v2.8.0-alpha.187", | ||
"@avalabs/utils-sdk": "2.8.0-canary.b4769c9.0", | ||
"eslint-config-custom": "0.0.0-cp-8362-20240628184300" | ||
"eslint-config-custom": "0.0.0-cp-8362-20240701212054" | ||
}, | ||
@@ -14,0 +16,0 @@ "scripts": { |
@@ -1,4 +0,4 @@ | ||
import type { TokenUnit } from '@avalabs/utils-sdk'; | ||
import type { NetworkContractToken, NetworkToken, TokenType } from './token'; | ||
import type { CacheProviderParams, Chain } from './common'; | ||
import BN from 'bn.js'; | ||
@@ -8,10 +8,44 @@ export type GetBalancesParams = Chain & | ||
chainId: string; | ||
accountAddress: string; | ||
addresses: string[]; // addressC of each account | ||
networkToken: NetworkToken; | ||
tokens: NetworkContractToken[]; | ||
currency: string; | ||
nativeTokenId?: string; | ||
assetPlatformId?: string; | ||
coingeckoPlatformId?: string; | ||
coingeckoTokenId?: string; | ||
}; | ||
export type TokenBalanceData = { | ||
type: TokenType; | ||
name: string; | ||
symbol: string; | ||
balance: BN; | ||
balanceInCurrency: number; | ||
balanceDisplayValue: string; | ||
balanceCurrencyDisplayValue: string; | ||
priceInCurrency: number; | ||
priceChanges?: { | ||
percentage?: number; | ||
value?: number; | ||
}; | ||
utxos?: BitcoinInputUTXOWithOptionalScript[]; | ||
}; | ||
interface TokenBalanceDataWithDecimals extends TokenBalanceData { | ||
decimals: number; | ||
} | ||
export type TokenWithBalanceERC20 = TokenBalanceDataWithDecimals & | ||
TokenMarketData & | ||
NetworkContractToken & { | ||
type: TokenType.ERC20; | ||
}; | ||
export type NetworkTokenWithBalance = TokenBalanceDataWithDecimals & | ||
TokenMarketData & { | ||
coingeckoId: string; | ||
type: TokenType.NATIVE; | ||
}; | ||
export type TokenWithBalance = NetworkTokenWithBalance | TokenWithBalanceERC20; | ||
/** | ||
@@ -35,17 +69,3 @@ * Custom Bitcoin UTXO interface. | ||
export type TokenBalanceData = { | ||
type: TokenType; | ||
balance: TokenUnit; | ||
balanceInCurrency: number; | ||
balanceDisplayValue: string; | ||
balanceCurrencyDisplayValue: string; | ||
priceInCurrency: number; | ||
utxos?: BitcoinInputUTXOWithOptionalScript[]; | ||
}; | ||
export interface TokenBalanceDataWithDecimals extends TokenBalanceData { | ||
decimals: number; | ||
} | ||
export type TokenMarketData = { | ||
type TokenMarketData = { | ||
marketCap: number; | ||
@@ -55,16 +75,1 @@ change24: number; | ||
}; | ||
export type TokenWithBalanceERC20 = TokenBalanceData & | ||
TokenMarketData & | ||
NetworkContractToken & { | ||
type: TokenType.ERC20; | ||
}; | ||
export type NetworkTokenWithBalance = TokenBalanceData & | ||
TokenMarketData & | ||
NetworkToken & { | ||
coingeckoId: string; | ||
type: TokenType.NATIVE; | ||
}; | ||
export type TokenWithBalance = NetworkTokenWithBalance | TokenWithBalanceERC20; |
import type { VsCurrencyType } from '@avalabs/coingecko-sdk'; | ||
import { array, boolean, date, number, object, record, string, tuple, z } from 'zod'; | ||
import { array, boolean, number, object, record, string, tuple, z } from 'zod'; | ||
export type SparklineData = number[]; | ||
export const ChartDataSchema = object({ | ||
ranges: object({ | ||
minDate: number(), | ||
maxDate: number(), | ||
minPrice: number(), | ||
maxPrice: number(), | ||
diffValue: number(), | ||
percentChange: number(), | ||
}), | ||
dataPoints: object({ | ||
date: string() | ||
.or(date()) | ||
.transform((arg: string | Date) => new Date(arg)), | ||
value: number(), | ||
}).array(), | ||
}); | ||
export type ChartData = z.infer<typeof ChartDataSchema>; | ||
export type PriceWithMarketData = { | ||
@@ -26,0 +7,0 @@ price: number; |
@@ -1,2 +0,2 @@ | ||
import type { GetBalancesParams, NetworkTokenWithBalance, TokenWithBalanceERC20 } from './balance'; | ||
import type { GetBalancesParams, TokenWithBalance } from './balance'; | ||
import type { Manifest } from './manifest'; | ||
@@ -10,3 +10,3 @@ import type { GetNetworkFeeParams, NetworkFees } from './network-fee'; | ||
getManifest: () => Manifest | undefined; | ||
getBalances: (params: GetBalancesParams) => Promise<(NetworkTokenWithBalance | TokenWithBalanceERC20)[]>; | ||
getBalances: (params: GetBalancesParams) => Promise<Record<string, Record<string, TokenWithBalance>>>; | ||
getTransactionHistory: (params: GetTransactionHistory) => Promise<TransactionHistoryResponse>; | ||
@@ -13,0 +13,0 @@ getNetworkFee: (params: GetNetworkFeeParams) => Promise<NetworkFees>; |
17430
5
476