UNPKG

@yoroi/types

Version:
756 lines (679 loc) 25 kB
import { BalanceAmount, BalanceAmounts, BalanceCardanoMetadatas, BalanceQuantity, BalanceToken, } from './balance/token' import { SwapApi, SwapCancelRequest, SwapCancelResponse, SwapCreateRequest, SwapCreateResponse, SwapEstimateRequest, SwapEstimateResponse, SwapLimitOptionsRequest, SwapLimitOptionsResponse, SwapSplit, } from './swap/api' import { AppStorage, AppStorageFolderName, AppStorageKeyManager, } from './app/storage' import {AppMultiStorage, AppMultiStorageOptions} from './app/multi-storage' import {NumberLocale} from './intl/numbers' import { ResolverAddressesResponse, ResolverAddressResponse, ResolverApi, ResolverStrategy, } from './resolver/api' import {ResolverManager} from './resolver/manager' import {ResolverReceiver} from './resolver/receiver' import {ResolverStorage} from './resolver/storage' import { LinksLink, LinksModule, LinksUriConfig, LinksUriRules, LinksWebCardanoUriConfig, } from './links/cardano' import { LinksErrorExtraParamsDenied, LinksErrorForbiddenParamsProvided, LinksErrorParamsValidationFailed, LinksErrorRequiredParamsMissing, LinksErrorSchemeNotImplemented, LinksErrorUnsupportedAuthority, LinksErrorUnsupportedVersion, } from './links/errors' import { ApiRequestRecordWithCache, ApiResponseRecordWithCache, } from './api/cache' import {ApiHttpStatusCode} from './api/status-code' import {ApiResponse, ApiResponseError, ApiResponseSuccess} from './api/response' import { ApiErrorBadRequest, ApiErrorConflict, ApiErrorForbidden, ApiErrorGone, ApiErrorInvalidState, ApiErrorNetwork, ApiErrorNotFound, ApiErrorResponseMalformed, ApiErrorServerSide, ApiErrorTooEarly, ApiErrorTooManyRequests, ApiErrorUnauthorized, ApiErrorUnknown, } from './api/errors' import {ResolverNameServer} from './resolver/name-server' import { ResolverErrorInvalidDomain, ResolverErrorInvalidResponse, ResolverErrorNotFound, ResolverErrorUnsupportedTld, ResolverErrorWrongBlockchain, } from './resolver/errors' import {AppApi, AppFrontendFeesResponse, AppFrontendFeeTier} from './api/app' import { ApiFtMetadata, ApiFtMetadataRecord, ApiFtRecords, ApiFutureToken, ApiFutureTokenRecords, ApiMetadataFile, ApiNftMetadata, ApiNftMetadataRecord, ApiNftRecords, ApiOffChainMetadataRecord, ApiOffChainMetadataRequest, ApiOffChainMetadataResponse, ApiOnChainMetadataRecord, ApiOnChainMetadataRequest, ApiOnChainMetadataResponse, ApiTokenId, ApiTokenIdentity, ApiTokenRegistryEntry, ApiTokenSupplyRecord, ApiTokenSupplyResponse, ApiTokeSupplyRequest, ApiUtxoData, ApiUtxoDataAsset, ApiUtxoDataRequest, } from './api/cardano' import {TransferEntry, TransferTarget, TransferTargets} from './transfer/state' import { AppObservableMultiStorage, AppObservableStorage, } from './app/observable-storage' import {AppCacheInfo, AppCacheRecord, AppCacheRow} from './app/cache' import { AppObserverManager, AppObserverSubscribe, AppSubscriber, } from './app/observer-manager' import { CardanoAddress, CardanoMetadata, CardanoSignedTx, CardanoStaking, CardanoTokenId, CardanoTxInfo, CardanoUnsignedTx, CardanoVoting, ChainCardanoProtocolParams, ChainCardanoBestBlock, } from './chain/cardano' import {ExchangeBlockchainCode} from './exchange/blockchain' import {ExchangeManagerOptions} from './exchange/build' import {ExchangeCoin} from './exchange/coin' import {ExchangeFiat} from './exchange/fiat' import {ExchangeReferralUrlQueryStringParams} from './exchange/query-string' import { ExchangeProviderNotFoundError, ExchangeUnknownError, ExchangeValidationError, } from './exchange/errors' import {ExchangeOrderType} from './exchange/order-type' import {ExchangeProvider} from './exchange/provider' import {ExchangeApi} from './exchange/api' import {ExchangeManager} from './exchange/manager' import { LinksBrowserLaunchDappUrlParams, LinksExchangeShowCreateResultParams, LinksPartnerInfoParams, LinksTransferRequestAdaParams, LinksTransferRequestAdaWithLinkParams, LinksYoroiAction, LinksYoroiActionInfo, LinksYoroiModule, LinksYoroiUriConfig, } from './links/yoroi' import { PortfolioTokenApplication, PortfolioTokenId, PortfolioTokenNature, PortfolioTokenPropertyType, PortfolioTokenSource, PortfolioTokenStatus, PortfolioTokenType, } from './portfolio/token' import {PortfolioTokenDiscovery} from './portfolio/discovery' import {PortfolioTokenInfo} from './portfolio/info' import { PortfolioPrimaryBreakdown, PortfolioTokenAmount, PortfolioTokenAmountRecords, } from './portfolio/amount' import {PortfolioTokenPrice} from './portfolio/price' import {ChainNetwork, ChainSupportedNetworks} from './chain/network' import {NumbersErrorInvalidAtomicValue} from './numbers/errors' import {NumbersAtomicValue} from './numbers/atomic-value' import { AppErrorInvalidState, AppErrorLibraryFailed, AppErrorWrongPassword, } from './app/errors' import { PortfolioApi, PortfolioApiTokenActivityResponse, PortfolioApiTokenDiscoveryResponse, PortfolioApiTokenHistoryResponse, PortfolioApiTokenInfosResponse, PortfolioApiTokenTraitsResponse, } from './portfolio/api' import { PortfolioEventBalanceManager, PortfolioEventBalanceManagerHydrate, PortfolioEventBalanceManagerRefresh, PortfolioEventBalanceManagerSync, PortfolioEventManagerOn, PortfolioEventSourceId, PortfolioEventTokenManager, PortfolioEventTokenManagerHydrate, PortfolioEventTokenManagerSync, } from './portfolio/event' import { PortfolioStorageBalance, PortfolioStorageToken, } from './portfolio/storage' import { PortfolioManagerBalance, PortfolioManagerToken, } from './portfolio/manager' import { PortfolioFungibilityFilter, PortfolioTokenBalances, } from './portfolio/balances' import {AppQueueTask, AppQueueTaskManager} from './app/queue-task-manager' import {ExplorersManager} from './explorers/manager' import {ExplorersExplorer} from './explorers/explorer' import {PortfolioTokenTrait, PortfolioTokenTraits} from './portfolio/traits' import {HWDeviceInfo, HWDeviceObj, HWFeatures} from './hw/hw' import {WalletAddressMode, WalletImplementation} from './wallet/wallet' import {WalletMeta} from './wallet/meta' import { NetworkApi, NetworkBlockchains, NetworkConfig, NetworkEpochInfo, NetworkEpochProgress, NetworkEraConfig, NetworkManager, } from './network/manager' import { PortfolioTokenActivity, PortfolioTokenActivityRecord, PortfolioTokenActivityWindow, } from './portfolio/activity' import { AppLoggerEntry, AppLoggerLevel, AppLoggerManager, AppLoggerMessage, AppLoggerMetadata, AppLoggerTransporter, AppLoggerTransporterOptions, } from './app/logger' import {ScanErrorUnknown, ScanErrorUnknownContent} from './scan/errors' import { ScanAction, ScanActionClaim, ScanActionLaunchUrl, ScanActionSendOnlyReceiver, ScanActionSendSinglePt, ScanFeature, } from './scan/actions' import {ClaimInfo, ClaimManager, ClaimStatus} from './claim/claim' import { ClaimApiErrorsAlreadyClaimed, ClaimApiErrorsExpired, ClaimApiErrorsInvalidRequest, ClaimApiErrorsNotFound, ClaimApiErrorsRateLimited, ClaimApiErrorsTooEarly, } from './claim/errors' import { ClaimApiClaimTokensRequestPayload, ClaimApiClaimTokensResponse, } from './claim/api' import { PortfolioTokenHistory, PortfolioTokenHistoryPeriod, } from './portfolio/history' import { BannerNotificationEvent, NotificationConfig, NotificationEvent, NotificationGroup, NotificationManager, NotificationManagerMakerProps, NotificationPrimaryTokenPriceChangedEvent, NotificationRewardsUpdatedEvent, NotificationTransactionReceivedEvent, NotificationTrigger, PushNotificationEvent, } from './notifications/manager' import {NumbersRatio} from './numbers/ratio' import {SwapStorage} from './swap/storage' import { SwapManager, SwapManagerSettings, SwapManagerMaker, } from './swap/manager' import {SwapDex} from './swap/dex' import {SwapOrder} from './swap/order' import {SwapAggregator} from './swap/aggregator' import {SwapProtocol} from './swap/protocol' import { PortfolioCurrencyConfig, PortfolioCurrencyConfigBySymbol, PortfolioCurrencySymbol, } from './portfolio/currency' export namespace App { export namespace Errors { export class InvalidState extends AppErrorInvalidState {} export class WrongPassword extends AppErrorWrongPassword {} export class LibraryError extends AppErrorLibraryFailed {} } export interface Storage< IsAsync extends boolean = true, K extends string = string, > extends AppStorage<IsAsync, K> {} export type StorageKeyManager< T = unknown, R = T, Key extends string = string, > = AppStorageKeyManager<T, R, Key> export type StorageFolderName = AppStorageFolderName export interface MultiStorage< T, IsAsync extends boolean = true, K extends string = string, > extends AppMultiStorage<T, IsAsync, K> {} export interface ObservableStorage< IsAsync extends boolean = true, K extends string = string, > extends AppObservableStorage<IsAsync, K> {} export interface ObservableMultiStorage< T, IsAsync extends boolean = true, K extends string = string, > extends AppObservableMultiStorage<T, IsAsync, K> {} export type MultiStorageOptions< T, IsAsync extends boolean = true, K extends string = string, > = AppMultiStorageOptions<T, IsAsync, K> export type ObserverManager<T> = AppObserverManager<T> export type Subscriber<T> = AppSubscriber<T> export type ObserverSubscribe<T> = AppObserverSubscribe<T> export type QueueTask = AppQueueTask export type QueueTaskManager = AppQueueTaskManager export type CacheInfo = AppCacheInfo export interface CacheRecord<T> extends AppCacheRecord<T> {} export interface CacheRow<T, K extends string = string> extends AppCacheRow<T, K> {} export interface Api extends AppApi {} export type FrontendFeeTier = AppFrontendFeeTier export type FrontendFeesResponse = AppFrontendFeesResponse export namespace Logger { export type Level = AppLoggerLevel export const Level = AppLoggerLevel export type Message = AppLoggerMessage export type Metadata = AppLoggerMetadata export type Transporter = AppLoggerTransporter export type TransporterOptions = AppLoggerTransporterOptions export type Entry = AppLoggerEntry export type Manager = AppLoggerManager } } export namespace Swap { export type Api = SwapApi export type Order = SwapOrder export type Aggregator = SwapAggregator export const Aggregator = SwapAggregator export type Protocol = SwapProtocol export const Protocol = SwapProtocol export type Dex = SwapDex export const Dex = SwapDex export type LimitOptionsRequest = SwapLimitOptionsRequest export type LimitOptionsResponse = SwapLimitOptionsResponse export type CancelRequest = SwapCancelRequest export type CancelResponse = SwapCancelResponse export type EstimateRequest = SwapEstimateRequest export type EstimateResponse = SwapEstimateResponse export type CreateRequest = SwapCreateRequest export type CreateResponse = SwapCreateResponse export type Split = SwapSplit export type Storage = SwapStorage export type Manager = SwapManager export type ManagerMaker = SwapManagerMaker export type ManagerSettings = SwapManagerSettings } export namespace Balance { export type Token = BalanceToken export type TokenInfo = BalanceToken['info'] export type TokenPrice = BalanceToken['price'] export type TokenSupply = BalanceToken['supply'] export type TokenStatus = BalanceToken['status'] export type CardanoMetadatas = BalanceCardanoMetadatas export type Quantity = BalanceQuantity export type Amount = BalanceAmount export type Amounts = BalanceAmounts } export namespace Links { export type YoroiModule = LinksYoroiModule export interface UriConfig extends LinksUriConfig {} export interface WebCardanoUriConfig extends LinksWebCardanoUriConfig {} export interface YoroiUriConfig extends LinksYoroiUriConfig {} export type PartnerInfoSchema = LinksPartnerInfoParams export type ExchangeShowCreateResultParams = LinksExchangeShowCreateResultParams export type TransferRequestAdaWithLinkParams = LinksTransferRequestAdaWithLinkParams export type TransferRequestAdaParams = LinksTransferRequestAdaParams export type BrowserLaunchDappUrlParams = LinksBrowserLaunchDappUrlParams export type YoroiActionInfo = LinksYoroiActionInfo export type YoroiAction = LinksYoroiAction export interface Rules extends LinksUriRules {} export type Link<T extends LinksUriConfig> = LinksLink<T> export type Module<T extends LinksUriConfig> = LinksModule<T> export namespace Errors { export class ExtraParamsDenied extends LinksErrorExtraParamsDenied {} export class ForbiddenParamsProvided extends LinksErrorForbiddenParamsProvided {} export class RequiredParamsMissing extends LinksErrorRequiredParamsMissing {} export class ParamsValidationFailed extends LinksErrorParamsValidationFailed {} export class UnsupportedAuthority extends LinksErrorUnsupportedAuthority {} export class UnsupportedVersion extends LinksErrorUnsupportedVersion {} export class SchemeNotImplemented extends LinksErrorSchemeNotImplemented {} } } export namespace Api { export type ResponseError = ApiResponseError export type ResponseSuccess<T> = ApiResponseSuccess<T> export type Response<T> = ApiResponse<T> export type ResponseWithCache<T> = ApiResponseRecordWithCache<T> export type RequestWithCache<T> = ApiRequestRecordWithCache<T> export type HttpStatusCode = ApiHttpStatusCode export const HttpStatusCode = ApiHttpStatusCode export namespace Errors { export class BadRequest extends ApiErrorBadRequest {} export class NotFound extends ApiErrorNotFound {} export class Conflict extends ApiErrorConflict {} export class Forbidden extends ApiErrorForbidden {} export class Gone extends ApiErrorGone {} export class TooEarly extends ApiErrorTooEarly {} export class TooManyRequests extends ApiErrorTooManyRequests {} export class Unauthorized extends ApiErrorUnauthorized {} export class ServerSide extends ApiErrorServerSide {} export class Network extends ApiErrorNetwork {} export class Unknown extends ApiErrorUnknown {} export class InvalidState extends ApiErrorInvalidState {} export class ResponseMalformed extends ApiErrorResponseMalformed {} } export namespace Cardano { export type OffChainMetadataRequest = ApiOffChainMetadataRequest export type OnChainMetadataRecord = ApiOnChainMetadataRecord export type OffChainMetadataResponse = ApiOffChainMetadataResponse export type OnChainMetadataRequest = ApiOnChainMetadataRequest export type OffChainMetadataRecord = ApiOffChainMetadataRecord export type OnChainMetadataResponse = ApiOnChainMetadataResponse export type TokenSupplyRequest = ApiTokeSupplyRequest export type TokenSupplyRecord = ApiTokenSupplyRecord export type TokenIdentity = ApiTokenIdentity export type TokenSupplyResponse = ApiTokenSupplyResponse export type FutureToken = ApiFutureToken export type FutureTokenRecords = ApiFutureTokenRecords export type FtMetadata = ApiFtMetadata export type FtMetadataRecord = ApiFtMetadataRecord export interface FtRecords extends ApiFtRecords {} export type TokenRegistryEntry = ApiTokenRegistryEntry export type NftMetadata = ApiNftMetadata export type NftMetadataRecord = ApiNftMetadataRecord export interface NftRecords extends ApiNftRecords {} export type MetadataFile = ApiMetadataFile export type TokenId = ApiTokenId export type ProtocolParams = ChainCardanoProtocolParams export type BestBlock = ChainCardanoBestBlock export type UtxoDataRequest = ApiUtxoDataRequest export type UtxoDataAsset = ApiUtxoDataAsset export type UtxoData = ApiUtxoData export interface Api { getProtocolParams: () => Promise<ChainCardanoProtocolParams> getBestBlock: () => Promise<ChainCardanoBestBlock> getUtxoData: (request: UtxoDataRequest) => Promise<ApiUtxoData> } } } export namespace Numbers { export type Locale = NumberLocale export type AtomicValue = NumbersAtomicValue export type Ratio = NumbersRatio export namespace Errors { export class InvalidAtomicValue extends NumbersErrorInvalidAtomicValue {} } } export namespace Resolver { export interface Api extends ResolverApi {} export type Manager = ResolverManager export type NameServer = ResolverNameServer export const NameServer = ResolverNameServer export type Receiver = ResolverReceiver export type AddressResponse = ResolverAddressResponse export type AddressesResponse = ResolverAddressesResponse export type Strategy = ResolverStrategy export type Storage = ResolverStorage export namespace Errors { export class InvalidResponse extends ResolverErrorInvalidResponse {} export class InvalidDomain extends ResolverErrorInvalidDomain {} export class NotFound extends ResolverErrorNotFound {} export class UnsupportedTld extends ResolverErrorUnsupportedTld {} export class Expired extends ResolverErrorUnsupportedTld {} export class WrongBlockchain extends ResolverErrorWrongBlockchain {} } } export namespace Transfer { export type Entry = TransferEntry export type Target = TransferTarget export type Targets = TransferTargets } export namespace Explorers { export type Manager = ExplorersManager export const Explorer = ExplorersExplorer export type Explorer = ExplorersExplorer } export namespace Portfolio { export type PrimaryBreakdown = PortfolioPrimaryBreakdown export type FungibilityFilter = PortfolioFungibilityFilter export namespace Currency { export type Symbol = PortfolioCurrencySymbol export type Config = PortfolioCurrencyConfig export type ConfigBySymbol = PortfolioCurrencyConfigBySymbol } export namespace Event { export type SourceId = PortfolioEventSourceId export type TokenManager = PortfolioEventTokenManager export type BalanceManager = PortfolioEventBalanceManager export type ManagerOn = PortfolioEventManagerOn export const ManagerOn = PortfolioEventManagerOn export type TokenManagerSync = PortfolioEventTokenManagerSync export type TokenManagerHydrate = PortfolioEventTokenManagerHydrate export type BalanceManagerSync = PortfolioEventBalanceManagerSync export type BalanceManagerHydrate = PortfolioEventBalanceManagerHydrate export type BalanceManagerRefresh = PortfolioEventBalanceManagerRefresh } // eslint-disable-next-line @typescript-eslint/no-shadow export namespace Api { export type TokenInfosResponse = PortfolioApiTokenInfosResponse export type TokenDiscoveryResponse = PortfolioApiTokenDiscoveryResponse export type TokenTraitsResponse = PortfolioApiTokenTraitsResponse export type TokenActivityResponse = PortfolioApiTokenActivityResponse export type TokenHistoryResponse = PortfolioApiTokenHistoryResponse export type Api = PortfolioApi } export namespace Storage { export type Token = PortfolioStorageToken export type Balance = PortfolioStorageBalance } export namespace Manager { export type Token = PortfolioManagerToken export type Balance = PortfolioManagerBalance } export namespace Token { export type Trait = PortfolioTokenTrait export type Traits = PortfolioTokenTraits export type Balances = PortfolioTokenBalances export type Amount = PortfolioTokenAmount export type AmountRecords = PortfolioTokenAmountRecords export type Id = PortfolioTokenId export type Type = PortfolioTokenType export const Type = PortfolioTokenType export type PropertyType = PortfolioTokenPropertyType export const PropertyType = PortfolioTokenPropertyType export type Application = PortfolioTokenApplication export const Application = PortfolioTokenApplication export type Source = PortfolioTokenSource export const Source = PortfolioTokenSource export type Nature = PortfolioTokenNature export const Nature = PortfolioTokenNature export type Status = PortfolioTokenStatus export const Status = PortfolioTokenStatus export type Info = PortfolioTokenInfo export type Discovery = PortfolioTokenDiscovery export type Price = PortfolioTokenPrice export type Activity = PortfolioTokenActivity export type ActivityWindow = PortfolioTokenActivityWindow export const ActivityWindow = PortfolioTokenActivityWindow export type ActivityRecord = PortfolioTokenActivityRecord export type History = PortfolioTokenHistory export type HistoryPeriod = PortfolioTokenHistoryPeriod export const HistoryPeriod = PortfolioTokenHistoryPeriod } } export namespace Chain { export type Network = ChainNetwork export const Network = ChainNetwork export type SupportedNetworks = ChainSupportedNetworks export namespace Cardano { export type UnsignedTx = CardanoUnsignedTx export type SignedTx = CardanoSignedTx export type TxInfo = CardanoTxInfo export type Metadata = CardanoMetadata export type Staking = CardanoStaking export type Voting = CardanoVoting export type Address = CardanoAddress export type TokenId = CardanoTokenId export type ProtocolParams = ChainCardanoProtocolParams export type BestBlock = ChainCardanoBestBlock } } export namespace HW { export type Features = HWFeatures export type DeviceInfo = HWDeviceInfo export type DeviceObj = HWDeviceObj } export namespace Wallet { export type Implementation = WalletImplementation export type AddressMode = WalletAddressMode export type Meta = WalletMeta } export namespace Exchange { export type BlockchainCode = ExchangeBlockchainCode export type Manager = ExchangeManager export type ManagerOptions = ExchangeManagerOptions export type Coin = ExchangeCoin export type Fiat = ExchangeFiat export type OrderType = ExchangeOrderType export type Provider = ExchangeProvider export type ReferralUrlQueryStringParams = ExchangeReferralUrlQueryStringParams export interface Api extends ExchangeApi {} export namespace Errors { export class Validation extends ExchangeValidationError {} export class Unknown extends ExchangeUnknownError {} export class ProviderNotFound extends ExchangeProviderNotFoundError {} } } export namespace Network { export type Api = NetworkApi export type Manager = NetworkManager export type Config = NetworkConfig export type Blockchains = NetworkBlockchains export const Blockchains = NetworkBlockchains export type EraConfig = NetworkEraConfig export type EpochInfo = NetworkEpochInfo export type EpochProgress = NetworkEpochProgress } export namespace Notifications { export type Config = NotificationConfig export type Event = NotificationEvent export type Group = NotificationGroup export type Manager = NotificationManager export type ManagerMakerProps = NotificationManagerMakerProps export type TransactionReceivedEvent = NotificationTransactionReceivedEvent export type RewardsUpdatedEvent = NotificationRewardsUpdatedEvent export type PushEvent = PushNotificationEvent export type BannerEvent = BannerNotificationEvent export type PrimaryTokenPriceChangedEvent = NotificationPrimaryTokenPriceChangedEvent export const Trigger = NotificationTrigger export type Trigger = NotificationTrigger } export namespace Scan { export namespace Errors { export class UnknownContent extends ScanErrorUnknownContent {} export class Unknown extends ScanErrorUnknown {} } export type Feature = ScanFeature export type Action = ScanAction export type ActionClaim = ScanActionClaim export type ActionSendOnlyReceiver = ScanActionSendOnlyReceiver export type ActionSendSinglePt = ScanActionSendSinglePt export type ActionScanLaunchUrl = ScanActionLaunchUrl } export namespace Claim { // eslint-disable-next-line @typescript-eslint/no-shadow export namespace Api { export namespace Errors { export class AlreadyClaimed extends ClaimApiErrorsAlreadyClaimed {} export class Expired extends ClaimApiErrorsExpired {} export class InvalidRequest extends ClaimApiErrorsInvalidRequest {} export class NotFound extends ClaimApiErrorsNotFound {} export class RateLimited extends ClaimApiErrorsRateLimited {} export class TooEarly extends ClaimApiErrorsTooEarly {} } export type ClaimTokensRequestPayload = ClaimApiClaimTokensRequestPayload export type ClaimTokensResponse = ClaimApiClaimTokensResponse } export type Status = ClaimStatus export type Info = ClaimInfo export type Manager = ClaimManager } export * from './helpers/types' export * from './helpers/storage' export * from './api/cardano'