@leather.io/models 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @leather.io/models@0.48.0 build /home/runner/work/mono/mono/packages/models
2
+ > @leather.io/models@0.50.0 build /home/runner/work/mono/mono/packages/models
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,9 +8,9 @@
8
8
  CLI Using tsup config: /home/runner/work/mono/mono/packages/models/tsup.config.ts
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 22.03 KB
12
- ESM dist/index.js.map 49.72 KB
13
- ESM ⚡️ Build success in 53ms
11
+ ESM dist/index.js 23.49 KB
12
+ ESM dist/index.js.map 54.06 KB
13
+ ESM ⚡️ Build success in 56ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 3312ms
16
- DTS dist/index.d.ts 47.11 KB
15
+ DTS ⚡️ Build success in 3048ms
16
+ DTS dist/index.d.ts 48.77 KB
package/CHANGELOG.md CHANGED
@@ -36,6 +36,54 @@
36
36
  * devDependencies
37
37
  * @leather.io/prettier-config bumped to 0.9.0
38
38
 
39
+ ## [0.50.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.49.0...@leather.io/models-v0.50.0) (2025-11-26)
40
+
41
+
42
+ ### Features
43
+
44
+ * normalize swap amount and percentage formats ([d5f1075](https://github.com/leather-io/mono/commit/d5f1075e4bf47fc92719d9e7fc604ff21e0d290a))
45
+
46
+ ## [0.49.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.48.0...@leather.io/models-v0.49.0) (2025-11-19)
47
+
48
+
49
+ ### Features
50
+
51
+ * add alex swap provider ([152fd3a](https://github.com/leather-io/mono/commit/152fd3a6d015aace7bd682819a7d3d6112a64730))
52
+ * add descriptors to get addresses rpc ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
53
+ * add portfolio table ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
54
+ * portfolio activity ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
55
+ * portfolio ui hover, borders, token count ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
56
+ * **web:** add empty state ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
57
+ * **web:** add hover events ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
58
+ * **web:** add portfolio modal ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
59
+ * **web:** add stacked bar chart ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
60
+ * **web:** add stacks to portfolio list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
61
+ * **web:** add tooltip ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
62
+ * **web:** adjust hover events ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
63
+ * **web:** bitcoin balance for portfolio ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
64
+ * **web:** breakdown by allocation ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
65
+ * **web:** scaffold portfolio page ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
66
+ * **web:** sip10 avatar icons web ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
67
+ * **web:** sip10 balances and assets ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
68
+ * **web:** stacks portfolio balance ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * **mobile:** ensure translations updated ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
74
+ * **mobile:** name is now defined for all models used ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
75
+ * resolve type issues by using activity model util ([2a9cf6a](https://github.com/leather-io/mono/commit/2a9cf6a2f6909b0bf01729e0c7124f53025df305))
76
+ * responsive portfolio ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
77
+ * **web:** a few style fixes ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
78
+ * **web:** add loading spinner to asset list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
79
+ * **web:** add loading state to bar ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
80
+ * **web:** ensure stacks renders in list ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
81
+ * **web:** improve hover events and styles ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
82
+ * **web:** invisible hover overlay ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
83
+ * **web:** layout as per designs ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
84
+ * **web:** remove unused ui ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
85
+ * **web:** remove unused var ([0e664a7](https://github.com/leather-io/mono/commit/0e664a7066a31776ac7e5ec60fa5a0ad893b96ff))
86
+
39
87
  ## [0.48.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.47.0...@leather.io/models-v0.48.0) (2025-11-17)
40
88
 
41
89
 
package/dist/index.d.ts CHANGED
@@ -201,11 +201,13 @@ interface BaseFungibleCryptoAsset extends BaseCryptoAsset {
201
201
  interface BtcAsset extends BaseFungibleCryptoAsset {
202
202
  readonly chain: 'bitcoin';
203
203
  readonly protocol: 'nativeBtc';
204
+ readonly name: 'Bitcoin';
204
205
  readonly symbol: 'BTC';
205
206
  }
206
207
  interface StxAsset extends BaseFungibleCryptoAsset {
207
208
  readonly chain: 'stacks';
208
209
  readonly protocol: 'nativeStx';
210
+ readonly name: 'Stacks';
209
211
  readonly symbol: 'STX';
210
212
  }
211
213
  interface Brc20Asset extends BaseFungibleCryptoAsset {
@@ -378,7 +380,6 @@ type Activity = OnChainActivity | WalletActivity | GeneralActivity;
378
380
  interface CryptoAssetId {
379
381
  protocol: CryptoAssetProtocol;
380
382
  id: string;
381
- tokenId?: number;
382
383
  }
383
384
 
384
385
  declare function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset;
@@ -740,15 +741,41 @@ interface SwapProviderAsset {
740
741
  providerAssetId: string;
741
742
  assetId: CryptoAssetId;
742
743
  }
743
- interface SwapQuote {
744
+ type SwapQuote = AlexSdkSwapQuote | VelarSdkSwapQuote | BitflowSdkSwapQuote | SbtcBridgeSwapQuote;
745
+ interface BaseSwapQuote {
744
746
  executionType: SwapExecutionType;
745
747
  providerId: SwapProviderId;
746
- providerQuoteData: unknown;
747
- baseAmount: number;
748
- targetAmount: number;
749
- quote: Money;
748
+ baseAsset: SwappableFungibleCryptoAsset;
749
+ targetAsset: SwappableFungibleCryptoAsset;
750
+ baseAmount: Money;
751
+ targetAmount: Money;
750
752
  dexPath: SwapDex[];
751
753
  assetPath: (NativeCryptoAsset | Sip10Asset)[];
754
+ createdAt: Date;
755
+ }
756
+ interface AlexSdkSwapQuote extends BaseSwapQuote {
757
+ providerId: 'alex-sdk';
758
+ providerQuoteData: {
759
+ baseProviderAssetId: string;
760
+ targetProviderAssetId: string;
761
+ alexSdkAmmRoute: unknown;
762
+ };
763
+ }
764
+ interface VelarSdkSwapQuote extends BaseSwapQuote {
765
+ providerId: 'velar-sdk';
766
+ providerQuoteData: {
767
+ baseProviderAssetId: string;
768
+ targetProviderAssetId: string;
769
+ };
770
+ }
771
+ interface BitflowSdkSwapQuote extends BaseSwapQuote {
772
+ providerId: 'bitflow-sdk';
773
+ providerQuoteData: {
774
+ bitflowSdkSelectedSwapRoute: unknown;
775
+ };
776
+ }
777
+ interface SbtcBridgeSwapQuote extends BaseSwapQuote {
778
+ providerId: 'sbtc-bridge';
752
779
  }
753
780
  interface SwapDex {
754
781
  name: string;
@@ -761,9 +788,11 @@ type SwapExecutionType = (typeof swapExecutionTypes)[number];
761
788
  interface BaseSwapExecutionData {
762
789
  executionType: SwapExecutionType;
763
790
  providerId: SwapProviderId;
791
+ quote: SwapQuote;
764
792
  }
765
793
  interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {
766
794
  executionType: 'stacks-contract-call';
795
+ quote: SwapQuote;
767
796
  contractAddress: string;
768
797
  contractName: string;
769
798
  functionName: string;
@@ -1205,4 +1234,18 @@ declare function enrichPositionWithMetadata<T extends YieldPosition>(position: T
1205
1234
  };
1206
1235
  declare function getCategoryDisplayName(category: YieldProductCategory): string;
1207
1236
 
1208
- export { type AccountAddresses, type AccountDisplayPreference, type AccountDisplayPreferenceInfo, type AccountId, type AccountLevelActivity, type Activity, type ActivityLevel, ActivityLevels, type ActivityType, type AllowAdditionalProperties, type AnalyticsPreference, type AppLevelActivity, type AverageBitcoinFeeRates, BESTINSLOT_API_BASE_URL_MAINNET, BESTINSLOT_API_BASE_URL_TESTNET, BITCOIN_API_BASE_URL_MAINNET, BITCOIN_API_BASE_URL_SIGNET, BITCOIN_API_BASE_URL_TESTNET3, BITCOIN_API_BASE_URL_TESTNET4, BNS_V2_API_BASE_URL, type BaseActivity, type BaseCryptoAsset, type BaseCryptoAssetBalance, type BaseNonFungibleCryptoAsset, type BaseOnChainActivity, type BasePooledStackingPosition, type BaseSwapExecutionData, type BaseTransactionFeeQuote, type BaseWalletActivity, type BaseYieldPosition, type BaseYieldProduct, type BitcoinAddress, type BitcoinAddressInfo, type BitcoinChainConfig, type BitcoinNetwork, type BitcoinNetworkModes, type BitcoinTransaction, type BitcoinTransactionFeeQuote, type BitcoinTransactionVectorInput, type BitcoinTransactionVectorOutput, type BitcoinTransactionVin, type BitcoinTransactionVout, type BitcoinTx, type BitcoinUnit, type BitcoinUnitInfo, type BitcoinUnitSymbol, type BitflowAmmLpPosition, type BitflowAmmStakingPosition, type Blockchain, type BnsName, type BnsProfile, type BnsProfileData, type BnsProfileDataAddresses, type Brc20Asset, type BtcAsset, type BtcBalance, BtcFeeType, ChainId, type ConnectAppActivity, type CryptoAsset, type CryptoAssetBalance, CryptoAssetCategories, type CryptoAssetCategory, type CryptoAssetChain, CryptoAssetChains, type CryptoAssetId, type CryptoAssetProtocol, CryptoAssetProtocols, type CryptoCurrency, type Currency, type DefaultNetworkConfigurations, type DeploySmartContractActivity, type EmailAddress, type Entries, type EvmTransactionFeeQuote, type ExecuteSmartContractActivity, type FastPoolPooledStackingPosition, FeeCalculationTypes, FeeTypes, type Fees, type FlatTransactionFeeQuote, type FtTransfer, type FungibleAssetId, type FungibleCryptoAsset, type FungibleCryptoAssetProtocol, FungibleCryptoAssetProtocols, type GeneralActivity, type GeneralActivityType, GeneralActivityTypes, type GraniteV1BorrowPosition, type GraniteV1CollateralAsset, type GraniteV1EarnPosition, HIRO_API_BASE_URL_MAINNET, HIRO_API_BASE_URL_MAINNET_EXTENDED, HIRO_API_BASE_URL_NAKAMOTO_TESTNET, HIRO_API_BASE_URL_TESTNET, HIRO_API_BASE_URL_TESTNET_EXTENDED, type HermeticaStaking, type HermeticaUsdhStakingPosition, type HistoricalPeriod, type InscriptionAsset, type InscriptionMimeType, type LisaLiStxPosition, type LisaLiquidStakingPosition, type LisaLstHolding, type LiteralUnion, type LockAssetActivity, type MarketData, type MarketPriceHistory, type MarketPriceSnapshot, type Money, type NativeCryptoAsset, type NetworkConfiguration, type NetworkModes, type NonFungibleCryptoAsset, type NonFungibleCryptoAssetProtocol, NonFungibleCryptoAssetProtocols, type NumType, type OnChainActivity, type OnChainActivityStatus, OnChainActivityStatuses, type OnChainActivityType, OnChainActivityTypes, type OwnedUtxo, type PooledStackingYieldProduct, type Prettify, type QuoteCurrency, type ReceiveAssetActivity, type ReplaceTypes, type RuneAsset, STX20_API_BASE_URL_MAINNET, type SbtcBridgeTransferSwapExecutionData, type SendAssetActivity, type SignMessageActivity, type Sip10Asset, type Sip9Asset, type Sip9AssetContent, type Sip9Attribute, type Sip9Collection, type Sip9ContentType, type Src20Asset, type StackingDaoLstHolding, type StackingDaoLstWithdrawal, type StackingDaoPooledStackingPosition, type StackingDaoReward, type StackingDaoStStxBtcPosition, type StackingDaoStStxPosition, type StacksAddressInfo, type StacksChainConfig, type StacksContractCallSwapExecutionData, type StacksFeeEstimate, type StacksTransactionFeeQuote, type StacksTx, type StacksTxStatus, type StampAsset, type Stx20Asset, type StxAsset, type StxBalance, type StxTransfer, type SupportedBlockchains, type SwapAsset, type SwapAssetsActivity, type SwapDex, type SwapExecutionData, type SwapExecutionType, type SwapProvider, type SwapProviderAsset, type SwapProviderId, type SwapQuote, type SwappableFungibleCryptoAsset, type TransactionErrorKey, type TransactionFeeQuote, type TransactionFeeQuoteType, type TransactionFeeTier, type TransactionFees, type Utxo, type UtxoId, type ValueOf, type VelarAmmLpPosition, type VelarFarmPosition, type WalletActivity, type WalletActivityType, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, type WalletId, type XversePooledStackingPosition, type YieldPosition, type YieldProduct, YieldProductCategories, type YieldProductCategory, type YieldProductKey, YieldProductKeys, YieldProductToProviderMap, type YieldProvider, type YieldProviderKey, YieldProviderKeys, type ZestBorrowAsset, type ZestBorrowMarketPosition, accountAddressesSchema, accountDisplayPreferenceSchema, accountIdSchema, analyticsPreferenceSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, bitcoinUnitSchema, bnsContractAddress, bnsContractName, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworkConfigurationsSchema, defaultNetworksKeyedById, emailAddressSchema, enrichPositionWithMetadata, enrichPositionWithProduct, enrichPositionWithProvider, filterPositionsByCategory, filterPositionsByProduct, filterPositionsByProvider, formatMarketPair, getCategoryDisplayName, getCategoryForProduct, getPositionsInCategories, getProductsForProvider, getProductsInCategory, getProviderForProduct, groupPositionsByCategory, groupPositionsByProvider, hasPositionsInCategory, hasPositionsInProvider, historicalPeriods, inscriptionMimeTypes, isBitflowAmmLpPosition, isBitflowAmmStakingPosition, isBrc20Asset, isBtcAsset, isFungibleAsset, isGraniteBorrowPosition, isGraniteEarnPosition, isInscriptionAsset, isNativeAsset, isNonFungibleAsset, isProductInProvider, isRuneAsset, isSip10Asset, isSip9Asset, isSrc20Asset, isStackingDaoPooledPosition, isStackingDaoStStxBtcPosition, isStackingDaoStStxPosition, isStampAsset, isStx20Asset, isStxAsset, isSwappableAsset, isZestPosition, networkConfigurationSchema, networkModes, sip9ContentTypes, sortPositionsByApy, sortPositionsByBalance, sortPositionsByUpdateTime, stacksAddressInfoSchema, supportedBlockchains, swapExecutionTypes, swapProviderIds, testnetModes, transactionFeeQuoteType, transactionFeeTiers, walletIdSchema };
1237
+ type BitcoinNetworkPreference = 'mainnet' | 'testnet4' | 'signet';
1238
+ interface MakeActivityArgs {
1239
+ txid: string;
1240
+ networkPreference: NetworkConfiguration;
1241
+ asset?: CryptoAsset;
1242
+ }
1243
+ declare function makeActivityLink({ txid, networkPreference, asset }: MakeActivityArgs): string | null;
1244
+ interface GetMempoolExplorerLinkArgs {
1245
+ id: string;
1246
+ type: 'txid' | 'block';
1247
+ networkPreference: BitcoinNetworkPreference;
1248
+ }
1249
+ declare function getMempoolExplorerLink({ id, type, networkPreference, }: GetMempoolExplorerLinkArgs): string | null;
1250
+
1251
+ export { type AccountAddresses, type AccountDisplayPreference, type AccountDisplayPreferenceInfo, type AccountId, type AccountLevelActivity, type Activity, type ActivityLevel, ActivityLevels, type ActivityType, type AlexSdkSwapQuote, type AllowAdditionalProperties, type AnalyticsPreference, type AppLevelActivity, type AverageBitcoinFeeRates, BESTINSLOT_API_BASE_URL_MAINNET, BESTINSLOT_API_BASE_URL_TESTNET, BITCOIN_API_BASE_URL_MAINNET, BITCOIN_API_BASE_URL_SIGNET, BITCOIN_API_BASE_URL_TESTNET3, BITCOIN_API_BASE_URL_TESTNET4, BNS_V2_API_BASE_URL, type BaseActivity, type BaseCryptoAsset, type BaseCryptoAssetBalance, type BaseNonFungibleCryptoAsset, type BaseOnChainActivity, type BasePooledStackingPosition, type BaseSwapExecutionData, type BaseSwapQuote, type BaseTransactionFeeQuote, type BaseWalletActivity, type BaseYieldPosition, type BaseYieldProduct, type BitcoinAddress, type BitcoinAddressInfo, type BitcoinChainConfig, type BitcoinNetwork, type BitcoinNetworkModes, type BitcoinNetworkPreference, type BitcoinTransaction, type BitcoinTransactionFeeQuote, type BitcoinTransactionVectorInput, type BitcoinTransactionVectorOutput, type BitcoinTransactionVin, type BitcoinTransactionVout, type BitcoinTx, type BitcoinUnit, type BitcoinUnitInfo, type BitcoinUnitSymbol, type BitflowAmmLpPosition, type BitflowAmmStakingPosition, type BitflowSdkSwapQuote, type Blockchain, type BnsName, type BnsProfile, type BnsProfileData, type BnsProfileDataAddresses, type Brc20Asset, type BtcAsset, type BtcBalance, BtcFeeType, ChainId, type ConnectAppActivity, type CryptoAsset, type CryptoAssetBalance, CryptoAssetCategories, type CryptoAssetCategory, type CryptoAssetChain, CryptoAssetChains, type CryptoAssetId, type CryptoAssetProtocol, CryptoAssetProtocols, type CryptoCurrency, type Currency, type DefaultNetworkConfigurations, type DeploySmartContractActivity, type EmailAddress, type Entries, type EvmTransactionFeeQuote, type ExecuteSmartContractActivity, type FastPoolPooledStackingPosition, FeeCalculationTypes, FeeTypes, type Fees, type FlatTransactionFeeQuote, type FtTransfer, type FungibleAssetId, type FungibleCryptoAsset, type FungibleCryptoAssetProtocol, FungibleCryptoAssetProtocols, type GeneralActivity, type GeneralActivityType, GeneralActivityTypes, type GetMempoolExplorerLinkArgs, type GraniteV1BorrowPosition, type GraniteV1CollateralAsset, type GraniteV1EarnPosition, HIRO_API_BASE_URL_MAINNET, HIRO_API_BASE_URL_MAINNET_EXTENDED, HIRO_API_BASE_URL_NAKAMOTO_TESTNET, HIRO_API_BASE_URL_TESTNET, HIRO_API_BASE_URL_TESTNET_EXTENDED, type HermeticaStaking, type HermeticaUsdhStakingPosition, type HistoricalPeriod, type InscriptionAsset, type InscriptionMimeType, type LisaLiStxPosition, type LisaLiquidStakingPosition, type LisaLstHolding, type LiteralUnion, type LockAssetActivity, type MakeActivityArgs, type MarketData, type MarketPriceHistory, type MarketPriceSnapshot, type Money, type NativeCryptoAsset, type NetworkConfiguration, type NetworkModes, type NonFungibleCryptoAsset, type NonFungibleCryptoAssetProtocol, NonFungibleCryptoAssetProtocols, type NumType, type OnChainActivity, type OnChainActivityStatus, OnChainActivityStatuses, type OnChainActivityType, OnChainActivityTypes, type OwnedUtxo, type PooledStackingYieldProduct, type Prettify, type QuoteCurrency, type ReceiveAssetActivity, type ReplaceTypes, type RuneAsset, STX20_API_BASE_URL_MAINNET, type SbtcBridgeSwapQuote, type SbtcBridgeTransferSwapExecutionData, type SendAssetActivity, type SignMessageActivity, type Sip10Asset, type Sip9Asset, type Sip9AssetContent, type Sip9Attribute, type Sip9Collection, type Sip9ContentType, type Src20Asset, type StackingDaoLstHolding, type StackingDaoLstWithdrawal, type StackingDaoPooledStackingPosition, type StackingDaoReward, type StackingDaoStStxBtcPosition, type StackingDaoStStxPosition, type StacksAddressInfo, type StacksChainConfig, type StacksContractCallSwapExecutionData, type StacksFeeEstimate, type StacksTransactionFeeQuote, type StacksTx, type StacksTxStatus, type StampAsset, type Stx20Asset, type StxAsset, type StxBalance, type StxTransfer, type SupportedBlockchains, type SwapAsset, type SwapAssetsActivity, type SwapDex, type SwapExecutionData, type SwapExecutionType, type SwapProvider, type SwapProviderAsset, type SwapProviderId, type SwapQuote, type SwappableFungibleCryptoAsset, type TransactionErrorKey, type TransactionFeeQuote, type TransactionFeeQuoteType, type TransactionFeeTier, type TransactionFees, type Utxo, type UtxoId, type ValueOf, type VelarAmmLpPosition, type VelarFarmPosition, type VelarSdkSwapQuote, type WalletActivity, type WalletActivityType, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, type WalletId, type XversePooledStackingPosition, type YieldPosition, type YieldProduct, YieldProductCategories, type YieldProductCategory, type YieldProductKey, YieldProductKeys, YieldProductToProviderMap, type YieldProvider, type YieldProviderKey, YieldProviderKeys, type ZestBorrowAsset, type ZestBorrowMarketPosition, accountAddressesSchema, accountDisplayPreferenceSchema, accountIdSchema, analyticsPreferenceSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, bitcoinUnitSchema, bnsContractAddress, bnsContractName, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworkConfigurationsSchema, defaultNetworksKeyedById, emailAddressSchema, enrichPositionWithMetadata, enrichPositionWithProduct, enrichPositionWithProvider, filterPositionsByCategory, filterPositionsByProduct, filterPositionsByProvider, formatMarketPair, getCategoryDisplayName, getCategoryForProduct, getMempoolExplorerLink, getPositionsInCategories, getProductsForProvider, getProductsInCategory, getProviderForProduct, groupPositionsByCategory, groupPositionsByProvider, hasPositionsInCategory, hasPositionsInProvider, historicalPeriods, inscriptionMimeTypes, isBitflowAmmLpPosition, isBitflowAmmStakingPosition, isBrc20Asset, isBtcAsset, isFungibleAsset, isGraniteBorrowPosition, isGraniteEarnPosition, isInscriptionAsset, isNativeAsset, isNonFungibleAsset, isProductInProvider, isRuneAsset, isSip10Asset, isSip9Asset, isSrc20Asset, isStackingDaoPooledPosition, isStackingDaoStStxBtcPosition, isStackingDaoStStxPosition, isStampAsset, isStx20Asset, isStxAsset, isSwappableAsset, isZestPosition, makeActivityLink, networkConfigurationSchema, networkModes, sip9ContentTypes, sortPositionsByApy, sortPositionsByBalance, sortPositionsByUpdateTime, stacksAddressInfoSchema, supportedBlockchains, swapExecutionTypes, swapProviderIds, testnetModes, transactionFeeQuoteType, transactionFeeTiers, walletIdSchema };
package/dist/index.js CHANGED
@@ -652,6 +652,64 @@ function getCategoryDisplayName(category) {
652
652
  };
653
653
  return displayNames[category] || category;
654
654
  }
655
+
656
+ // src/activity/activity.utils.ts
657
+ var HIRO_EXPLORER_URL = "https://explorer.hiro.so";
658
+ var MEMPOOL_BASE_URL = "https://mempool.space";
659
+ function makeActivityLink({ txid, networkPreference, asset }) {
660
+ if (txid && asset) {
661
+ return makeActivityExplorerLink({
662
+ asset,
663
+ txid,
664
+ networkPreference
665
+ });
666
+ }
667
+ return null;
668
+ }
669
+ function makeActivityExplorerLink({
670
+ asset,
671
+ txid,
672
+ networkPreference
673
+ }) {
674
+ if (asset.chain === "bitcoin") {
675
+ return getMempoolExplorerLink({
676
+ networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork,
677
+ id: txid,
678
+ type: "txid"
679
+ });
680
+ }
681
+ return makeStacksTxExplorerLink({
682
+ networkPreference: networkPreference.chain.stacks.chainId === 2147483648 /* Testnet */ ? "testnet" : "mainnet",
683
+ searchParams: void 0,
684
+ txid,
685
+ explorerUrl: HIRO_EXPLORER_URL
686
+ });
687
+ }
688
+ function makeStacksTxExplorerLink({
689
+ networkPreference,
690
+ searchParams = new URLSearchParams(),
691
+ txid,
692
+ explorerUrl
693
+ }) {
694
+ searchParams.append("chain", networkPreference);
695
+ return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;
696
+ }
697
+ function getMempoolExplorerLink({
698
+ id,
699
+ type,
700
+ networkPreference
701
+ }) {
702
+ switch (networkPreference) {
703
+ case "mainnet":
704
+ return `${MEMPOOL_BASE_URL}/${type}/${id}`;
705
+ case "testnet4":
706
+ return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;
707
+ case "signet":
708
+ return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;
709
+ default:
710
+ return null;
711
+ }
712
+ }
655
713
  export {
656
714
  ActivityLevels,
657
715
  BESTINSLOT_API_BASE_URL_MAINNET,
@@ -713,6 +771,7 @@ export {
713
771
  formatMarketPair,
714
772
  getCategoryDisplayName,
715
773
  getCategoryForProduct,
774
+ getMempoolExplorerLink,
716
775
  getPositionsInCategories,
717
776
  getProductsForProvider,
718
777
  getProductsInCategory,
@@ -746,6 +805,7 @@ export {
746
805
  isStxAsset,
747
806
  isSwappableAsset,
748
807
  isZestPosition,
808
+ makeActivityLink,
749
809
  networkConfigurationSchema,
750
810
  networkModes,
751
811
  sip9ContentTypes,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account.model.ts","../src/activity/activity-level.model.ts","../src/activity/activity-status.model.ts","../src/activity/activity-type.model.ts","../src/assets/asset-type-guards.ts","../src/assets/asset.model.ts","../src/assets/sip9-asset.model.ts","../src/bitcoin.model.ts","../src/bns.model.ts","../src/fees/bitcoin-fees.model.ts","../src/fees/fees.model.ts","../src/fees/transaction-fees.model.ts","../src/inscription-mime-type.model.ts","../src/market.model.ts","../src/network/network.model.ts","../src/network/network.schema.ts","../src/settings.model.ts","../src/swap/swap.model.ts","../src/yield/yield-provider.model.ts","../src/yield/yield-product.model.ts","../src/yield/helpers/yield.helpers.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const walletIdSchema = z.object({\n fingerprint: z.string(),\n});\n\nexport const accountIdSchema = walletIdSchema.and(z.object({ accountIndex: z.number() }));\n\nexport const bitcoinAddressInfoSchema = z.object({\n taprootDescriptor: z.string(),\n nativeSegwitDescriptor: z.string(),\n zeroIndexTaprootPayerAddress: z.string().optional(),\n zeroIndexNativeSegwitPayerAddress: z.string().optional(),\n});\n\nexport const stacksAddressInfoSchema = z.object({\n stxAddress: z.string(),\n});\n\nexport const accountAddressesSchema = z.object({\n id: accountIdSchema,\n bitcoin: bitcoinAddressInfoSchema.optional(),\n stacks: stacksAddressInfoSchema.optional(),\n});\n\nexport type WalletId = z.infer<typeof walletIdSchema>;\nexport type AccountId = z.infer<typeof accountIdSchema>;\nexport type BitcoinAddressInfo = z.infer<typeof bitcoinAddressInfoSchema>;\nexport type StacksAddressInfo = z.infer<typeof stacksAddressInfoSchema>;\nexport type AccountAddresses = z.infer<typeof accountAddressesSchema>;\n","export const ActivityLevels = {\n account: 'account',\n app: 'app',\n} as const;\nexport type ActivityLevel = keyof typeof ActivityLevels;\n","export const OnChainActivityStatuses = {\n pending: 'pending',\n success: 'success',\n failed: 'failed',\n} as const;\nexport type OnChainActivityStatus = keyof typeof OnChainActivityStatuses;\n","export const OnChainActivityTypes = {\n deploySmartContract: 'deploySmartContract',\n executeSmartContract: 'executeSmartContract',\n lockAsset: 'lockAsset',\n sendAsset: 'sendAsset',\n receiveAsset: 'receiveAsset',\n swapAssets: 'swapAssets',\n} as const;\nexport type OnChainActivityType = keyof typeof OnChainActivityTypes;\n\nexport const WalletActivityTypes = {\n connectApp: 'connectApp',\n signMessage: 'signMessage',\n} as const;\nexport type WalletActivityType = keyof typeof WalletActivityTypes;\n\nexport const GeneralActivityTypes = {\n walletAdded: 'walletAdded',\n receiveAnnouncement: 'receiveAnnouncement',\n featureWaitlistNotification: 'featureWaitlistNotification',\n} as const;\nexport type GeneralActivityType = keyof typeof GeneralActivityTypes;\n\nexport type ActivityType = OnChainActivityType | WalletActivityType | GeneralActivityType;\n","import {\n Brc20Asset,\n BtcAsset,\n CryptoAsset,\n FungibleCryptoAsset,\n InscriptionAsset,\n NativeCryptoAsset,\n NonFungibleCryptoAsset,\n RuneAsset,\n Sip10Asset,\n Src20Asset,\n StampAsset,\n Stx20Asset,\n StxAsset,\n} from './asset.model';\nimport { Sip9Asset } from './sip9-asset.model';\n\nexport function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset {\n return asset.category === 'fungible';\n}\n\nexport function isNonFungibleAsset(asset: CryptoAsset): asset is NonFungibleCryptoAsset {\n return asset.category === 'nft';\n}\n\nexport function isBtcAsset(asset: CryptoAsset): asset is BtcAsset {\n return asset.protocol === 'nativeBtc';\n}\n\nexport function isStxAsset(asset: CryptoAsset): asset is StxAsset {\n return asset.protocol === 'nativeStx';\n}\n\nexport function isNativeAsset(asset: CryptoAsset): asset is NativeCryptoAsset {\n return isBtcAsset(asset) || isStxAsset(asset);\n}\n\nexport function isSip10Asset(asset: CryptoAsset): asset is Sip10Asset {\n return asset.protocol === 'sip10';\n}\n\nexport function isSwappableAsset(asset: CryptoAsset): asset is NativeCryptoAsset | Sip10Asset {\n return isNativeAsset(asset) || isSip10Asset(asset);\n}\n\nexport function isBrc20Asset(asset: CryptoAsset): asset is Brc20Asset {\n return asset.protocol === 'brc20';\n}\n\nexport function isSrc20Asset(asset: CryptoAsset): asset is Src20Asset {\n return asset.protocol === 'src20';\n}\n\nexport function isStx20Asset(asset: CryptoAsset): asset is Stx20Asset {\n return asset.protocol === 'stx20';\n}\n\nexport function isRuneAsset(asset: CryptoAsset): asset is RuneAsset {\n return asset.protocol === 'rune';\n}\n\nexport function isInscriptionAsset(asset: CryptoAsset): asset is InscriptionAsset {\n return asset.protocol === 'inscription';\n}\n\nexport function isStampAsset(asset: CryptoAsset): asset is StampAsset {\n return asset.protocol === 'stamp';\n}\n\nexport function isSip9Asset(asset: CryptoAsset): asset is Sip9Asset {\n return asset.protocol === 'sip9';\n}\n","import { InscriptionMimeType } from '../inscription-mime-type.model';\nimport { Sip9Asset } from './sip9-asset.model';\n\nexport const CryptoAssetChains = {\n bitcoin: 'bitcoin',\n stacks: 'stacks',\n} as const;\nexport const CryptoAssetCategories = {\n fungible: 'fungible',\n nft: 'nft',\n} as const;\nexport const FungibleCryptoAssetProtocols = {\n nativeBtc: 'nativeBtc',\n nativeStx: 'nativeStx',\n sip10: 'sip10',\n brc20: 'brc20',\n src20: 'src20',\n stx20: 'stx20',\n rune: 'rune',\n} as const;\nexport const NonFungibleCryptoAssetProtocols = {\n stamp: 'stamp',\n sip9: 'sip9',\n inscription: 'inscription',\n} as const;\nexport const CryptoAssetProtocols = {\n ...FungibleCryptoAssetProtocols,\n ...NonFungibleCryptoAssetProtocols,\n} as const;\n\nexport type CryptoAssetChain = keyof typeof CryptoAssetChains;\nexport type CryptoAssetCategory = keyof typeof CryptoAssetCategories;\nexport type FungibleCryptoAssetProtocol = keyof typeof FungibleCryptoAssetProtocols;\nexport type NonFungibleCryptoAssetProtocol = keyof typeof NonFungibleCryptoAssetProtocols;\nexport type CryptoAssetProtocol = FungibleCryptoAssetProtocol | NonFungibleCryptoAssetProtocol;\n\nexport interface BaseCryptoAsset {\n readonly chain: CryptoAssetChain;\n readonly category: CryptoAssetCategory;\n readonly protocol: CryptoAssetProtocol;\n}\n\n// Fungible asset types\ninterface BaseFungibleCryptoAsset extends BaseCryptoAsset {\n readonly category: 'fungible';\n readonly protocol: FungibleCryptoAssetProtocol;\n readonly symbol: string;\n readonly decimals: number;\n readonly hasMemo: boolean;\n}\nexport interface BtcAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'nativeBtc';\n readonly symbol: 'BTC';\n}\nexport interface StxAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'nativeStx';\n readonly symbol: 'STX';\n}\nexport interface Brc20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'brc20';\n readonly symbol: string;\n}\nexport interface Src20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'src20';\n readonly id: string;\n readonly symbol: string;\n readonly deploy_tx: string;\n readonly deploy_img: string;\n}\nexport interface RuneAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'rune';\n readonly spacedRuneName: string;\n readonly runeName: string;\n readonly symbol: string;\n}\nexport interface Sip10Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'sip10';\n readonly name: string;\n readonly canTransfer: boolean;\n readonly assetId: string;\n readonly contractId: string;\n readonly imageCanonicalUri: string;\n readonly symbol: string;\n}\nexport interface Stx20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'stx20';\n readonly symbol: string;\n}\nexport type NativeCryptoAsset = BtcAsset | StxAsset;\nexport type FungibleCryptoAsset =\n | NativeCryptoAsset\n | Sip10Asset\n | Brc20Asset\n | Src20Asset\n | Stx20Asset\n | RuneAsset;\n\n// NFT asset types\nexport interface BaseNonFungibleCryptoAsset extends BaseCryptoAsset {\n readonly category: 'nft';\n readonly protocol: NonFungibleCryptoAssetProtocol;\n}\nexport interface InscriptionAsset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'inscription';\n readonly id: string;\n readonly mimeType: InscriptionMimeType;\n readonly number: number;\n readonly address: string;\n readonly title: string;\n readonly txid: string;\n readonly output: string;\n readonly offset: string;\n readonly preview: string;\n readonly src: string;\n readonly thumbnailSrc?: string;\n readonly value: string;\n readonly genesisBlockHash: string;\n readonly genesisTimestamp: number;\n readonly genesisBlockHeight: number;\n}\nexport interface StampAsset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'stamp';\n readonly stamp: number;\n readonly stampUrl: string;\n readonly stampExplorerUrl: string;\n readonly blockHeight: number;\n}\n\nexport type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;\n\nexport type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;\n\nexport interface FungibleAssetId {\n protocol: FungibleCryptoAssetProtocol;\n id: string;\n}\n","import { Money } from '../money.model';\nimport { BaseNonFungibleCryptoAsset } from './asset.model';\n\nexport const sip9ContentTypes = [\n 'image/jpeg',\n 'image/jpg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'image/bmp',\n 'image/tiff',\n 'image/avif',\n 'video/mp4',\n 'video/webm',\n 'video/mov',\n 'video/quicktime',\n 'video/avi',\n 'video/x-msvideo',\n 'video/ogg',\n 'audio/mpeg',\n 'audio/mp3',\n 'audio/wav',\n 'audio/x-wav',\n 'audio/ogg',\n 'audio/aac',\n 'audio/flac',\n 'audio/webm',\n 'model/gltf+json',\n 'model/gltf-binary',\n 'application/octet-stream',\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/pdf',\n 'application/json',\n 'text/javascript',\n 'application/javascript',\n 'application/zip',\n 'unknown',\n '',\n] as const;\n\nexport type Sip9ContentType = (typeof sip9ContentTypes)[number];\n\nexport interface Sip9Collection {\n name: string;\n collectionExplorerUrl: string;\n totalItems?: number;\n floorPrice?: Money;\n latestSale?: Money;\n}\n\nexport interface Sip9AssetContent {\n contentUrl: string;\n contentType: Sip9ContentType;\n}\n\nexport interface Sip9Attribute {\n traitType: string;\n value: any;\n rarityPercent?: number;\n}\n\nexport interface Sip9Asset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'sip9';\n readonly assetId: string;\n readonly contractId: string;\n readonly tokenId: number;\n readonly name: string;\n readonly description: string;\n readonly content: Sip9AssetContent;\n readonly attributes?: Sip9Attribute[];\n readonly collection?: Sip9Collection;\n readonly creator?: string;\n readonly rarityRank?: number;\n}\n","import { z } from 'zod';\n\n// Branded type for Bitcoin addresses\nexport type BitcoinAddress = string & { readonly __brand: unique symbol };\n\nexport const bitcoinUnitSchema = z.enum(['bitcoin', 'satoshi']);\nexport type BitcoinUnit = z.infer<typeof bitcoinUnitSchema>;\n\nexport type BitcoinUnitSymbol = 'BTC' | 'sat';\n\nexport interface BitcoinUnitInfo {\n name: BitcoinUnit;\n symbol: BitcoinUnitSymbol;\n decimal: string;\n}\n","export const bnsContractAddress = {\n mainnet: 'SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF',\n testnet: 'ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M',\n};\n\nexport const bnsContractName = 'BNS-V2';\n\nexport interface BnsName {\n owner: string;\n name: string;\n namespace: string;\n fullName: string;\n renewalHeight: number;\n registeredAtBlockNumber: number;\n}\n\nexport interface BnsProfile {\n bnsName: BnsName;\n profileData: BnsProfileData;\n}\n\nexport interface BnsProfileData {\n name?: string;\n bio?: string;\n website?: string;\n pfpUrl?: string;\n location?: string;\n addresses?: BnsProfileDataAddresses;\n}\n\nexport interface BnsProfileDataAddresses {\n bitcoinPayment?: string;\n bitcoinOrdinal?: string;\n solana?: string;\n ethereum?: string;\n}\n","import type BigNumber from 'bignumber.js';\n\nexport interface AverageBitcoinFeeRates {\n fastestFee: BigNumber;\n halfHourFee: BigNumber;\n hourFee: BigNumber;\n}\n\nexport const btcTxTimeMap: Record<keyof AverageBitcoinFeeRates, string> = {\n fastestFee: '~10 – 20min',\n halfHourFee: '~30 min',\n hourFee: '~1 hour+',\n};\n\nexport enum BtcFeeType {\n High = 'High',\n Standard = 'Standard',\n Low = 'Low',\n}\n","import { Blockchain } from '../types';\nimport { StacksFeeEstimate } from './stacks-fees.model';\n\nexport enum FeeTypes {\n Low,\n Middle,\n High,\n Custom,\n Unknown,\n}\n\nexport enum FeeCalculationTypes {\n Api = 'api',\n Default = 'default',\n DefaultSimulated = 'default-simulated',\n FeesCapped = 'fees-capped',\n TokenTransferSpecific = 'token-transfer-specific',\n}\n\nexport interface Fees {\n blockchain: Blockchain;\n estimates: StacksFeeEstimate[];\n calculation: FeeCalculationTypes;\n}\n","import { Money } from '../money.model';\nimport { Blockchain } from '../types';\n\nexport const transactionFeeTiers = ['low', 'standard', 'high'] as const;\nexport type TransactionFeeTier = (typeof transactionFeeTiers)[number];\n\nexport interface TransactionFees {\n readonly chain: Blockchain;\n readonly options: Record<TransactionFeeTier, TransactionFeeQuote>;\n}\n\nexport const transactionFeeQuoteType = [\n 'flat',\n 'bitcoinFeeRate',\n 'stacksFeeRate',\n 'evm1559',\n] as const;\nexport type TransactionFeeQuoteType = (typeof transactionFeeQuoteType)[number];\n\nexport interface BaseTransactionFeeQuote {\n readonly type: TransactionFeeQuoteType;\n readonly value: Money;\n}\n\nexport interface FlatTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'flat';\n}\n\nexport interface BitcoinTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'bitcoinFeeRate';\n readonly rate: number;\n readonly rateUnit: 'sats/vB';\n readonly estimatedTxSize: number;\n readonly sizeUnit: 'vB';\n}\n\nexport interface StacksTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'stacksFeeRate';\n readonly rate: number;\n readonly rateUnit: 'µSTX/byte';\n readonly estimatedTxSize: number;\n readonly sizeUnit: 'byte';\n}\n\nexport interface EvmTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'evm1559';\n readonly baseFeePerGas: Money;\n readonly priorityFeePerGas: Money;\n readonly gasLimit: number;\n}\n\nexport type TransactionFeeQuote =\n | FlatTransactionFeeQuote\n | BitcoinTransactionFeeQuote\n | StacksTransactionFeeQuote\n | EvmTransactionFeeQuote;\n","/**\n * Inscriptions contain arbitrary data. When retrieving an inscription, it should be\n * classified into one of the types below, indicating that the app can handle it\n * appropriately and securely. Inscriptions of types not ready to be handled by the\n * app should be classified as \"other\".\n */\nexport const inscriptionMimeTypes = [\n 'audio',\n 'gltf',\n 'html',\n 'image',\n 'svg',\n 'text',\n 'video',\n 'other',\n] as const;\n\nexport type InscriptionMimeType = (typeof inscriptionMimeTypes)[number];\n","import type { Currency, QuoteCurrency } from './currencies.model';\nimport type { Money } from './money.model';\n\ninterface MarketPair {\n readonly base: Currency;\n readonly quote: QuoteCurrency;\n}\n\nexport function createMarketPair(base: Currency, quote: QuoteCurrency): MarketPair {\n return Object.freeze({ base, quote });\n}\n\nexport function formatMarketPair({ base, quote }: MarketPair) {\n return `${base}/${quote}`;\n}\n\nexport interface MarketData {\n readonly pair: MarketPair;\n readonly price: Money;\n}\n\nexport function createMarketData(pair: MarketPair, price: Money): MarketData {\n if (pair.quote !== price.symbol)\n throw new Error('Cannot create market data when price does not match quote');\n return Object.freeze({ pair, price });\n}\n\nexport const historicalPeriods = ['1d', '1w', '1m', '3m', '6m', '1y'] as const;\nexport type HistoricalPeriod = (typeof historicalPeriods)[number];\n\nexport interface MarketPriceSnapshot {\n price: Money;\n timestamp: number;\n}\n\nexport interface MarketPriceHistory {\n period: HistoricalPeriod;\n changePercentage: number;\n prices: MarketPriceSnapshot[];\n}\n","import { z } from 'zod';\n\nimport { Blockchain } from '../types';\nimport { networkConfigurationSchema } from './network.schema';\n\nexport const HIRO_API_BASE_URL_MAINNET = 'https://api.hiro.so';\nexport const HIRO_API_BASE_URL_TESTNET = 'https://api.testnet.hiro.so';\nexport const HIRO_API_BASE_URL_NAKAMOTO_TESTNET = 'https://api.nakamoto.testnet.hiro.so';\n\nexport const HIRO_API_BASE_URL_MAINNET_EXTENDED = 'https://api.hiro.so/extended/v1';\nexport const HIRO_API_BASE_URL_TESTNET_EXTENDED = 'https://api.testnet.hiro.so/extended';\n\nexport const BITCOIN_API_BASE_URL_MAINNET = 'https://leather.mempool.space/api';\nexport const BITCOIN_API_BASE_URL_TESTNET3 = 'https://leather.mempool.space/testnet/api';\nexport const BITCOIN_API_BASE_URL_TESTNET4 = 'https://leather.mempool.space/testnet4/api';\nexport const BITCOIN_API_BASE_URL_SIGNET = 'https://mempool.space/signet/api';\n\nexport const BESTINSLOT_API_BASE_URL_MAINNET = 'https://leatherapi.bestinslot.xyz/v3';\nexport const BESTINSLOT_API_BASE_URL_TESTNET = 'https://leatherapi_testnet.bestinslot.xyz/v3';\n\nexport const STX20_API_BASE_URL_MAINNET = 'https://api.stx20.com/api/v1';\n\nexport const BNS_V2_API_BASE_URL = 'https://api.bnsv2.com';\n\n// Copied from @stacks/transactions to avoid dependencies\nexport enum ChainId {\n Testnet = 2147483648,\n Mainnet = 1,\n}\n\nexport enum WalletDefaultNetworkConfigurationIds {\n mainnet = 'mainnet',\n testnet = 'testnet',\n testnet4 = 'testnet4',\n signet = 'signet',\n sbtcTestnet = 'sbtcTestnet',\n sbtcDevenv = 'sbtcDevenv',\n devnet = 'devnet',\n}\n\nexport const defaultNetworkConfigurationsSchema = z.enum([\n 'mainnet',\n 'testnet',\n 'testnet4',\n 'signet',\n 'sbtcTestnet',\n 'sbtcDevenv',\n 'devnet',\n]);\nexport type DefaultNetworkConfigurations = z.infer<typeof defaultNetworkConfigurationsSchema>;\n\nexport const supportedBlockchains = ['stacks', 'bitcoin'] as const;\n\nexport type SupportedBlockchains = (typeof supportedBlockchains)[number];\n\nexport const networkModes = ['mainnet', 'testnet'] as const;\nexport const testnetModes = ['testnet', 'regtest', 'signet'] as const;\n\nexport const bitcoinNetworks = ['mainnet', 'testnet3', 'testnet4', 'regtest', 'signet'] as const;\nexport type BitcoinNetwork = (typeof bitcoinNetworks)[number];\n\nexport type NetworkModes = (typeof networkModes)[number];\ntype BitcoinTestnetModes = (typeof testnetModes)[number];\n\nexport function bitcoinNetworkToNetworkMode(network: BitcoinNetwork): BitcoinNetworkModes {\n switch (network) {\n case 'mainnet':\n return 'mainnet';\n case 'testnet3':\n return 'testnet';\n case 'testnet4':\n return 'testnet';\n case 'regtest':\n return 'regtest';\n case 'signet':\n return 'signet';\n default:\n // TODO: Needs exhaustive check. Cannot import 'assertUnreachable' since 'utils' package depends on 'models'.\n // Ideally this function should live in utils, but it's currently widely used in the extension.\n throw new Error(`Unhandled case: ${network}`);\n }\n}\n\nexport type BitcoinNetworkModes = NetworkModes | BitcoinTestnetModes;\n\ninterface BaseChainConfig {\n blockchain: Blockchain;\n}\n\nexport interface BitcoinChainConfig extends BaseChainConfig {\n blockchain: 'bitcoin';\n bitcoinUrl: string;\n bitcoinNetwork: BitcoinNetwork;\n mode: BitcoinNetworkModes;\n}\n\nexport interface StacksChainConfig extends BaseChainConfig {\n blockchain: 'stacks';\n url: string;\n /** The chainId of the network (or parent network if this is a subnet) */\n chainId: ChainId;\n /** An additional chainId for subnets. Indicated a subnet if defined and is mainly used for signing. */\n subnetChainId?: ChainId;\n}\n\nexport type NetworkConfiguration = z.infer<typeof networkConfigurationSchema>;\n\nconst networkMainnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.mainnet,\n name: 'Mainnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Mainnet,\n url: HIRO_API_BASE_URL_MAINNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'mainnet',\n mode: 'mainnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_MAINNET,\n },\n },\n};\n\nconst networkTestnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.testnet,\n name: 'Testnet3',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'testnet3',\n mode: 'testnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET3,\n },\n },\n};\n\nconst networkTestnet4: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.testnet4,\n name: 'Testnet4',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'testnet4',\n mode: 'testnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET4,\n },\n },\n};\n\nconst networkSignet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.signet,\n name: 'Signet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'signet',\n mode: 'signet',\n bitcoinUrl: BITCOIN_API_BASE_URL_SIGNET,\n },\n },\n};\n\nconst networkSbtcTestnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.sbtcTestnet,\n name: 'sBTC Testnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'https://beta.sbtc-mempool.tech/api/proxy',\n },\n },\n};\n\nconst networkSbtcDevenv: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.sbtcDevenv,\n name: 'sBTC Devenv',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: 'http://localhost:3999',\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'http://localhost:3000/api/proxy',\n },\n },\n};\n\nconst networkDevnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.devnet,\n name: 'Devnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: 'http://localhost:3999',\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'http://localhost:18443',\n },\n },\n};\n\nexport const defaultCurrentNetwork: NetworkConfiguration = networkMainnet;\n\nexport const defaultNetworksKeyedById: Record<\n WalletDefaultNetworkConfigurationIds,\n NetworkConfiguration\n> = {\n [WalletDefaultNetworkConfigurationIds.mainnet]: networkMainnet,\n [WalletDefaultNetworkConfigurationIds.testnet4]: networkTestnet4,\n [WalletDefaultNetworkConfigurationIds.testnet]: networkTestnet,\n [WalletDefaultNetworkConfigurationIds.signet]: networkSignet,\n [WalletDefaultNetworkConfigurationIds.sbtcTestnet]: networkSbtcTestnet,\n [WalletDefaultNetworkConfigurationIds.sbtcDevenv]: networkSbtcDevenv,\n [WalletDefaultNetworkConfigurationIds.devnet]: networkDevnet,\n};\n","import { z } from 'zod';\n\nimport { bitcoinNetworks, networkModes, testnetModes } from './network.model';\n\nexport const bitcoinNetworkModesSchema = z.enum([...networkModes, ...testnetModes]);\n\nexport const bitcoinNetworkSchema = z.enum([...bitcoinNetworks]);\n\nexport const networkConfigurationSchema = z.object({\n name: z.string(),\n id: z.string(),\n chain: z.object({\n bitcoin: z.object({\n blockchain: z.literal('bitcoin'),\n bitcoinUrl: z.string(),\n bitcoinNetwork: bitcoinNetworkSchema,\n mode: bitcoinNetworkModesSchema,\n }),\n stacks: z.object({\n blockchain: z.literal('stacks'),\n url: z.string(),\n chainId: z.number(),\n subnetChainId: z.number().optional(),\n }),\n }),\n});\n","import { z } from 'zod';\n\nimport { Blockchain } from './types';\n\nexport const accountDisplayPreferenceSchema = z.enum(['native-segwit', 'taproot', 'bns', 'stacks']);\nexport type AccountDisplayPreference = z.infer<typeof accountDisplayPreferenceSchema>;\n\nexport interface AccountDisplayPreferenceInfo {\n type: AccountDisplayPreference;\n blockchain: Blockchain;\n name: string;\n}\n\nexport const analyticsPreferenceSchema = z.enum(['consent-given', 'rejects-tracking']);\nexport type AnalyticsPreference = z.infer<typeof analyticsPreferenceSchema>;\n\nexport const emailAddressSchema = z.email({ error: 'Invalid email address' });\nexport type EmailAddress = z.infer<typeof emailAddressSchema>;\n","import { CryptoAssetId } from '../assets/asset-id.model';\nimport { NativeCryptoAsset, Sip10Asset } from '../assets/asset.model';\nimport { Money } from '../money.model';\n\nexport type SwappableFungibleCryptoAsset = NativeCryptoAsset | Sip10Asset;\n\nexport interface SwapAsset {\n asset: SwappableFungibleCryptoAsset;\n providerAssets: SwapProviderAsset[];\n}\n\nexport const swapProviderIds = ['bitflow-sdk', 'sbtc-bridge', 'alex-sdk', 'velar-sdk'] as const;\nexport type SwapProviderId = (typeof swapProviderIds)[number];\n\nexport interface SwapProvider {\n id: SwapProviderId;\n isAggregator: boolean;\n}\n\nexport interface SwapProviderAsset {\n providerId: SwapProviderId;\n providerAssetId: string;\n assetId: CryptoAssetId;\n}\n\nexport interface SwapQuote {\n executionType: SwapExecutionType;\n providerId: SwapProviderId;\n providerQuoteData: unknown;\n baseAmount: number;\n targetAmount: number;\n quote: Money;\n dexPath: SwapDex[];\n assetPath: (NativeCryptoAsset | Sip10Asset)[];\n}\n\nexport interface SwapDex {\n name: string;\n url: string;\n logo: string;\n description: string;\n}\n\nexport const swapExecutionTypes = ['stacks-contract-call', 'sbtc-bridge-transfer'] as const;\nexport type SwapExecutionType = (typeof swapExecutionTypes)[number];\n\nexport interface BaseSwapExecutionData {\n executionType: SwapExecutionType;\n providerId: SwapProviderId;\n}\nexport interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {\n executionType: 'stacks-contract-call';\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: unknown[];\n postConditions: unknown[];\n postConditionMode?: unknown;\n}\nexport interface SbtcBridgeTransferSwapExecutionData extends BaseSwapExecutionData {\n executionType: 'sbtc-bridge-transfer';\n}\nexport type SwapExecutionData =\n | StacksContractCallSwapExecutionData\n | SbtcBridgeTransferSwapExecutionData;\n","export const YieldProviderKeys = {\n bitflow: 'bitflow',\n zest: 'zest',\n granite: 'granite',\n stackingDao: 'stackingdao',\n lisa: 'lisa',\n hermetica: 'hermetica',\n fastPool: 'fast-pool',\n xverse: 'xverse',\n velar: 'velar',\n} as const;\nexport type YieldProviderKey = (typeof YieldProviderKeys)[keyof typeof YieldProviderKeys];\n\nexport interface YieldProvider {\n readonly key: YieldProviderKey;\n readonly name: string;\n readonly logo: string;\n readonly url: string;\n}\n","import { YieldProviderKey, YieldProviderKeys } from './yield-provider.model';\n\nexport const YieldProductKeys = {\n bitflowAmmLp: 'bitflow-amm-lp',\n bitflowAmmStaking: 'bitflow-amm-staking',\n zestBorrowMarket: 'zest-borrow-market',\n graniteV1Earn: 'granite-v1-earn',\n graniteV1Borrow: 'granite-v1-borrow',\n stackingDaoStstx: 'stackingdao-ststx',\n stackingDaoStstxbtc: 'stackingdao-ststxbtc',\n stackingDaoPooledStacking: 'stackingdao-pooled-stacking',\n lisaListx: 'lisa-listx',\n lisaLiquidStaking: 'lisa-liquid-staking',\n hermeticaUsdhStaking: 'hermetica-usdh-staking',\n velarAmmLp: 'velar-amm-lp',\n velarPerps: 'velar-perps',\n velarAmmLpFarming: 'velar-amm-lp-farming',\n fastPoolPooledStacking: 'fast-pool-pooled-stacking',\n xversePooledStacking: 'xverse-pooled-stacking',\n} as const;\nexport type YieldProductKey = (typeof YieldProductKeys)[keyof typeof YieldProductKeys];\n\nexport const YieldProductCategories = {\n AMM: 'amm',\n LENDING: 'lending',\n LIQUID_STACKING: 'liquid-stacking',\n POOLED_STACKING: 'pooled-stacking',\n STAKING: 'staking',\n PERPS: 'perps',\n} as const;\nexport type YieldProductCategory =\n (typeof YieldProductCategories)[keyof typeof YieldProductCategories];\n\nexport const YieldProductToProviderMap = {\n [YieldProductKeys.bitflowAmmLp]: YieldProviderKeys.bitflow,\n [YieldProductKeys.bitflowAmmStaking]: YieldProviderKeys.bitflow,\n [YieldProductKeys.zestBorrowMarket]: YieldProviderKeys.zest,\n [YieldProductKeys.graniteV1Earn]: YieldProviderKeys.granite,\n [YieldProductKeys.graniteV1Borrow]: YieldProviderKeys.granite,\n [YieldProductKeys.stackingDaoStstx]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.stackingDaoStstxbtc]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.stackingDaoPooledStacking]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.lisaListx]: YieldProviderKeys.lisa,\n [YieldProductKeys.lisaLiquidStaking]: YieldProviderKeys.lisa,\n [YieldProductKeys.hermeticaUsdhStaking]: YieldProviderKeys.hermetica,\n [YieldProductKeys.velarAmmLp]: YieldProviderKeys.velar,\n [YieldProductKeys.velarPerps]: YieldProviderKeys.velar,\n [YieldProductKeys.velarAmmLpFarming]: YieldProviderKeys.velar,\n [YieldProductKeys.fastPoolPooledStacking]: YieldProviderKeys.fastPool,\n [YieldProductKeys.xversePooledStacking]: YieldProviderKeys.xverse,\n} as const;\n\nexport type YieldProduct = BaseYieldProduct | PooledStackingYieldProduct;\n\nexport interface BaseYieldProduct {\n readonly key: YieldProductKey;\n readonly provider: YieldProviderKey;\n readonly category: YieldProductCategory;\n readonly name: string;\n readonly url: string;\n}\n\n// normalizes pooled stacking product data\nexport interface PooledStackingYieldProduct extends BaseYieldProduct {\n readonly category: 'pooled-stacking';\n readonly stackerCount: number;\n}\n","import type {\n BitflowAmmLpPosition,\n BitflowAmmStakingPosition,\n} from '../providers/bitflow-position.model';\nimport type {\n GraniteV1BorrowPosition,\n GraniteV1EarnPosition,\n} from '../providers/granite-position.model';\nimport type {\n StackingDaoPooledStackingPosition,\n StackingDaoStStxBtcPosition,\n StackingDaoStStxPosition,\n} from '../providers/stacking-dao-position.model';\nimport type { ZestBorrowMarketPosition } from '../providers/zest-position.model';\nimport type { YieldPosition } from '../yield-position.model';\nimport {\n YieldProduct,\n YieldProductCategories,\n YieldProductCategory,\n YieldProductKey,\n YieldProductKeys,\n YieldProductToProviderMap,\n} from '../yield-product.model';\nimport { YieldProvider, YieldProviderKey } from '../yield-provider.model';\n\nexport function isBitflowAmmLpPosition(pos: YieldPosition): pos is BitflowAmmLpPosition {\n return pos.product === YieldProductKeys.bitflowAmmLp;\n}\n\nexport function isBitflowAmmStakingPosition(pos: YieldPosition): pos is BitflowAmmStakingPosition {\n return pos.product === YieldProductKeys.bitflowAmmStaking;\n}\n\nexport function isZestPosition(pos: YieldPosition): pos is ZestBorrowMarketPosition {\n return pos.product === YieldProductKeys.zestBorrowMarket;\n}\n\nexport function isGraniteEarnPosition(pos: YieldPosition): pos is GraniteV1EarnPosition {\n return pos.product === YieldProductKeys.graniteV1Earn;\n}\n\nexport function isGraniteBorrowPosition(pos: YieldPosition): pos is GraniteV1BorrowPosition {\n return pos.product === YieldProductKeys.graniteV1Borrow;\n}\n\nexport function isStackingDaoStStxPosition(pos: YieldPosition): pos is StackingDaoStStxPosition {\n return pos.product === YieldProductKeys.stackingDaoStstx;\n}\n\nexport function isStackingDaoStStxBtcPosition(\n pos: YieldPosition\n): pos is StackingDaoStStxBtcPosition {\n return pos.product === YieldProductKeys.stackingDaoStstxbtc;\n}\n\nexport function isStackingDaoPooledPosition(\n pos: YieldPosition\n): pos is StackingDaoPooledStackingPosition {\n return pos.product === YieldProductKeys.stackingDaoPooledStacking;\n}\n\nexport function filterPositionsByProvider(\n positions: YieldPosition[],\n provider: YieldProviderKey\n): YieldPosition[] {\n return positions.filter(p => p.provider === provider);\n}\n\nexport function filterPositionsByProduct(\n positions: YieldPosition[],\n product: YieldProductKey\n): YieldPosition[] {\n return positions.filter(p => p.product === product);\n}\n\nexport function filterPositionsByCategory(\n positions: YieldPosition[],\n products: YieldProduct[],\n category: YieldProductCategory\n): YieldPosition[] {\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.filter(pos => productMap.get(pos.product)?.category === category);\n}\n\nexport function sortPositionsByBalance(\n positions: YieldPosition[],\n ascending = false\n): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const diff = a.totalBalance.amount.comparedTo(b.totalBalance.amount);\n return ascending ? diff : -diff;\n });\n}\n\nexport function sortPositionsByApy(positions: YieldPosition[], ascending = false): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const apyA = a.apy;\n const apyB = b.apy;\n return ascending ? apyA - apyB : apyB - apyA;\n });\n}\n\nexport function sortPositionsByUpdateTime(\n positions: YieldPosition[],\n ascending = false\n): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const timeA = 'updatedAt' in a && a.updatedAt instanceof Date ? a.updatedAt.getTime() : 0;\n const timeB = 'updatedAt' in b && b.updatedAt instanceof Date ? b.updatedAt.getTime() : 0;\n return ascending ? timeA - timeB : timeB - timeA;\n });\n}\n\nexport function getProviderForProduct(product: YieldProductKey): YieldProviderKey {\n return YieldProductToProviderMap[product];\n}\n\nexport function getCategoryForProduct(product: YieldProduct): YieldProductCategory {\n return product.category;\n}\n\nexport function isProductInProvider(product: YieldProductKey, provider: YieldProviderKey): boolean {\n return YieldProductToProviderMap[product] === provider;\n}\n\nexport function getProductsForProvider(provider: YieldProviderKey): YieldProductKey[] {\n return Object.entries(YieldProductToProviderMap)\n .filter(([_, p]) => p === provider)\n .map(([product]) => product as YieldProductKey);\n}\n\nexport function getProductsInCategory(\n products: YieldProduct[],\n category: YieldProductCategory\n): YieldProduct[] {\n return products.filter(p => p.category === category);\n}\n\nexport function groupPositionsByProvider(\n positions: YieldPosition[]\n): Record<YieldProviderKey, YieldPosition[]> {\n const grouped: Partial<Record<YieldProviderKey, YieldPosition[]>> = {};\n\n for (const position of positions) {\n const provider = position.provider;\n if (!grouped[provider]) {\n grouped[provider] = [];\n }\n grouped[provider].push(position);\n }\n\n return grouped as Record<YieldProviderKey, YieldPosition[]>;\n}\n\nexport function groupPositionsByCategory(\n positions: YieldPosition[],\n products: YieldProduct[]\n): Record<string, YieldPosition[]> {\n const grouped: Record<string, YieldPosition[]> = {};\n const productMap = new Map(products.map(p => [p.key, p]));\n\n for (const position of positions) {\n const product = productMap.get(position.product);\n if (!product) continue;\n\n const category = product.category;\n if (!grouped[category]) {\n grouped[category] = [];\n }\n grouped[category].push(position);\n }\n\n return grouped;\n}\n\nexport function getPositionsInCategories(\n positions: YieldPosition[],\n products: YieldProduct[],\n categories: YieldProductCategory[]\n): YieldPosition[] {\n const categorySet = new Set(categories);\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.filter(pos => {\n const product = productMap.get(pos.product);\n return product && categorySet.has(product.category);\n });\n}\n\nexport function hasPositionsInProvider(\n positions: YieldPosition[],\n provider: YieldProviderKey\n): boolean {\n return positions.some(p => p.provider === provider);\n}\n\nexport function hasPositionsInCategory(\n positions: YieldPosition[],\n products: YieldProduct[],\n category: YieldProductCategory\n): boolean {\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.some(pos => productMap.get(pos.product)?.category === category);\n}\n\nexport function enrichPositionWithProvider<T extends YieldPosition>(\n position: T,\n provider: YieldProvider\n): T & { providerData: YieldProvider } {\n return { ...position, providerData: provider };\n}\n\nexport function enrichPositionWithProduct<T extends YieldPosition>(\n position: T,\n product: YieldProduct\n): T & { productData: YieldProduct } {\n return { ...position, productData: product };\n}\n\nexport function enrichPositionWithMetadata<T extends YieldPosition>(\n position: T,\n provider: YieldProvider,\n product: YieldProduct\n): T & { providerData: YieldProvider; productData: YieldProduct } {\n return { ...position, providerData: provider, productData: product };\n}\n\nexport function getCategoryDisplayName(category: YieldProductCategory): string {\n const displayNames: Record<YieldProductCategory, string> = {\n [YieldProductCategories.AMM]: 'Liquidity Pools',\n [YieldProductCategories.LENDING]: 'Lending & Borrowing',\n [YieldProductCategories.LIQUID_STACKING]: 'Liquid Stacking',\n [YieldProductCategories.POOLED_STACKING]: 'Pooled Stacking',\n [YieldProductCategories.STAKING]: 'Staking',\n [YieldProductCategories.PERPS]: 'Perpetuals',\n };\n return displayNames[category] || category;\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,aAAa,EAAE,OAAO;AACxB,CAAC;AAEM,IAAM,kBAAkB,eAAe,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;AAEjF,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,mBAAmB,EAAE,OAAO;AAAA,EAC5B,wBAAwB,EAAE,OAAO;AAAA,EACjC,8BAA8B,EAAE,OAAO,EAAE,SAAS;AAAA,EAClD,mCAAmC,EAAE,OAAO,EAAE,SAAS;AACzD,CAAC;AAEM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,YAAY,EAAE,OAAO;AACvB,CAAC;AAEM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,IAAI;AAAA,E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,IAAI,IAAI,OAAO;AAC1C,WAAO,WAAW,YAAY,IAAI,QAAQ,QAAQ;AAAA,EACpD,CAAC;AACH;AAEO,SAAS,uBACd,WACA,UACS;AACT,SAAO,UAAU,KAAK,OAAK,EAAE,aAAa,QAAQ;AACpD;AAEO,SAAS,uBACd,WACA,UACA,UACS;AACT,QAAM,aAAa,IAAI,IAAI,SAAS,IAAI,OAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACxD,SAAO,UAAU,KAAK,SAAO,WAAW,IAAI,IAAI,OAAO,GAAG,aAAa,QAAQ;AACjF;AAEO,SAAS,2BACd,UACA,UACqC;AACrC,SAAO,EAAE,GAAG,UAAU,cAAc,SAAS;AAC/C;AAEO,SAAS,0BACd,UACA,SACmC;AACnC,SAAO,EAAE,GAAG,UAAU,aAAa,QAAQ;AAC7C;AAEO,SAAS,2BACd,UACA,UACA,SACgE;AAChE,SAAO,EAAE,GAAG,UAAU,cAAc,UAAU,aAAa,QAAQ;AACrE;AAEO,SAAS,uBAAuB,UAAwC;AAC7E,QAAM,eAAqD;AAAA,IACzD,CAAC,uBAAuB,GAAG,GAAG;AAAA,IAC9B,CAAC,uBAAuB,OAAO,GAAG;AAAA,IAClC,CAAC,uBAAuB,eAAe,GAAG;AAAA,IAC1C,CAAC,uBAAuB,eAAe,GAAG;AAAA,IAC1C,CAAC,uBAAuB,OAAO,GAAG;AAAA,IAClC,CAAC,uBAAuB,KAAK,GAAG;AAAA,EAClC;AACA,SAAO,aAAa,QAAQ,KAAK;AACnC;","names":["z","BtcFeeType","FeeTypes","FeeCalculationTypes","z","ChainId","WalletDefaultNetworkConfigurationIds","z","z","z"]}
1
+ {"version":3,"sources":["../src/account.model.ts","../src/activity/activity-level.model.ts","../src/activity/activity-status.model.ts","../src/activity/activity-type.model.ts","../src/assets/asset-type-guards.ts","../src/assets/asset.model.ts","../src/assets/sip9-asset.model.ts","../src/bitcoin.model.ts","../src/bns.model.ts","../src/fees/bitcoin-fees.model.ts","../src/fees/fees.model.ts","../src/fees/transaction-fees.model.ts","../src/inscription-mime-type.model.ts","../src/market.model.ts","../src/network/network.model.ts","../src/network/network.schema.ts","../src/settings.model.ts","../src/swap/swap.model.ts","../src/yield/yield-provider.model.ts","../src/yield/yield-product.model.ts","../src/yield/helpers/yield.helpers.ts","../src/activity/activity.utils.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const walletIdSchema = z.object({\n fingerprint: z.string(),\n});\n\nexport const accountIdSchema = walletIdSchema.and(z.object({ accountIndex: z.number() }));\n\nexport const bitcoinAddressInfoSchema = z.object({\n taprootDescriptor: z.string(),\n nativeSegwitDescriptor: z.string(),\n zeroIndexTaprootPayerAddress: z.string().optional(),\n zeroIndexNativeSegwitPayerAddress: z.string().optional(),\n});\n\nexport const stacksAddressInfoSchema = z.object({\n stxAddress: z.string(),\n});\n\nexport const accountAddressesSchema = z.object({\n id: accountIdSchema,\n bitcoin: bitcoinAddressInfoSchema.optional(),\n stacks: stacksAddressInfoSchema.optional(),\n});\n\nexport type WalletId = z.infer<typeof walletIdSchema>;\nexport type AccountId = z.infer<typeof accountIdSchema>;\nexport type BitcoinAddressInfo = z.infer<typeof bitcoinAddressInfoSchema>;\nexport type StacksAddressInfo = z.infer<typeof stacksAddressInfoSchema>;\nexport type AccountAddresses = z.infer<typeof accountAddressesSchema>;\n","export const ActivityLevels = {\n account: 'account',\n app: 'app',\n} as const;\nexport type ActivityLevel = keyof typeof ActivityLevels;\n","export const OnChainActivityStatuses = {\n pending: 'pending',\n success: 'success',\n failed: 'failed',\n} as const;\nexport type OnChainActivityStatus = keyof typeof OnChainActivityStatuses;\n","export const OnChainActivityTypes = {\n deploySmartContract: 'deploySmartContract',\n executeSmartContract: 'executeSmartContract',\n lockAsset: 'lockAsset',\n sendAsset: 'sendAsset',\n receiveAsset: 'receiveAsset',\n swapAssets: 'swapAssets',\n} as const;\nexport type OnChainActivityType = keyof typeof OnChainActivityTypes;\n\nexport const WalletActivityTypes = {\n connectApp: 'connectApp',\n signMessage: 'signMessage',\n} as const;\nexport type WalletActivityType = keyof typeof WalletActivityTypes;\n\nexport const GeneralActivityTypes = {\n walletAdded: 'walletAdded',\n receiveAnnouncement: 'receiveAnnouncement',\n featureWaitlistNotification: 'featureWaitlistNotification',\n} as const;\nexport type GeneralActivityType = keyof typeof GeneralActivityTypes;\n\nexport type ActivityType = OnChainActivityType | WalletActivityType | GeneralActivityType;\n","import {\n Brc20Asset,\n BtcAsset,\n CryptoAsset,\n FungibleCryptoAsset,\n InscriptionAsset,\n NativeCryptoAsset,\n NonFungibleCryptoAsset,\n RuneAsset,\n Sip10Asset,\n Src20Asset,\n StampAsset,\n Stx20Asset,\n StxAsset,\n} from './asset.model';\nimport { Sip9Asset } from './sip9-asset.model';\n\nexport function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset {\n return asset.category === 'fungible';\n}\n\nexport function isNonFungibleAsset(asset: CryptoAsset): asset is NonFungibleCryptoAsset {\n return asset.category === 'nft';\n}\n\nexport function isBtcAsset(asset: CryptoAsset): asset is BtcAsset {\n return asset.protocol === 'nativeBtc';\n}\n\nexport function isStxAsset(asset: CryptoAsset): asset is StxAsset {\n return asset.protocol === 'nativeStx';\n}\n\nexport function isNativeAsset(asset: CryptoAsset): asset is NativeCryptoAsset {\n return isBtcAsset(asset) || isStxAsset(asset);\n}\n\nexport function isSip10Asset(asset: CryptoAsset): asset is Sip10Asset {\n return asset.protocol === 'sip10';\n}\n\nexport function isSwappableAsset(asset: CryptoAsset): asset is NativeCryptoAsset | Sip10Asset {\n return isNativeAsset(asset) || isSip10Asset(asset);\n}\n\nexport function isBrc20Asset(asset: CryptoAsset): asset is Brc20Asset {\n return asset.protocol === 'brc20';\n}\n\nexport function isSrc20Asset(asset: CryptoAsset): asset is Src20Asset {\n return asset.protocol === 'src20';\n}\n\nexport function isStx20Asset(asset: CryptoAsset): asset is Stx20Asset {\n return asset.protocol === 'stx20';\n}\n\nexport function isRuneAsset(asset: CryptoAsset): asset is RuneAsset {\n return asset.protocol === 'rune';\n}\n\nexport function isInscriptionAsset(asset: CryptoAsset): asset is InscriptionAsset {\n return asset.protocol === 'inscription';\n}\n\nexport function isStampAsset(asset: CryptoAsset): asset is StampAsset {\n return asset.protocol === 'stamp';\n}\n\nexport function isSip9Asset(asset: CryptoAsset): asset is Sip9Asset {\n return asset.protocol === 'sip9';\n}\n","import { InscriptionMimeType } from '../inscription-mime-type.model';\nimport { Sip9Asset } from './sip9-asset.model';\n\nexport const CryptoAssetChains = {\n bitcoin: 'bitcoin',\n stacks: 'stacks',\n} as const;\nexport const CryptoAssetCategories = {\n fungible: 'fungible',\n nft: 'nft',\n} as const;\nexport const FungibleCryptoAssetProtocols = {\n nativeBtc: 'nativeBtc',\n nativeStx: 'nativeStx',\n sip10: 'sip10',\n brc20: 'brc20',\n src20: 'src20',\n stx20: 'stx20',\n rune: 'rune',\n} as const;\nexport const NonFungibleCryptoAssetProtocols = {\n stamp: 'stamp',\n sip9: 'sip9',\n inscription: 'inscription',\n} as const;\nexport const CryptoAssetProtocols = {\n ...FungibleCryptoAssetProtocols,\n ...NonFungibleCryptoAssetProtocols,\n} as const;\n\nexport type CryptoAssetChain = keyof typeof CryptoAssetChains;\nexport type CryptoAssetCategory = keyof typeof CryptoAssetCategories;\nexport type FungibleCryptoAssetProtocol = keyof typeof FungibleCryptoAssetProtocols;\nexport type NonFungibleCryptoAssetProtocol = keyof typeof NonFungibleCryptoAssetProtocols;\nexport type CryptoAssetProtocol = FungibleCryptoAssetProtocol | NonFungibleCryptoAssetProtocol;\n\nexport interface BaseCryptoAsset {\n readonly chain: CryptoAssetChain;\n readonly category: CryptoAssetCategory;\n readonly protocol: CryptoAssetProtocol;\n}\n\n// Fungible asset types\ninterface BaseFungibleCryptoAsset extends BaseCryptoAsset {\n readonly category: 'fungible';\n readonly protocol: FungibleCryptoAssetProtocol;\n readonly symbol: string;\n readonly decimals: number;\n readonly hasMemo: boolean;\n}\nexport interface BtcAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'nativeBtc';\n readonly name: 'Bitcoin';\n readonly symbol: 'BTC';\n}\nexport interface StxAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'nativeStx';\n readonly name: 'Stacks';\n readonly symbol: 'STX';\n}\nexport interface Brc20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'brc20';\n readonly symbol: string;\n}\nexport interface Src20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'src20';\n readonly id: string;\n readonly symbol: string;\n readonly deploy_tx: string;\n readonly deploy_img: string;\n}\nexport interface RuneAsset extends BaseFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'rune';\n readonly spacedRuneName: string;\n readonly runeName: string;\n readonly symbol: string;\n}\nexport interface Sip10Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'sip10';\n readonly name: string;\n readonly canTransfer: boolean;\n readonly assetId: string;\n readonly contractId: string;\n readonly imageCanonicalUri: string;\n readonly symbol: string;\n}\nexport interface Stx20Asset extends BaseFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'stx20';\n readonly symbol: string;\n}\nexport type NativeCryptoAsset = BtcAsset | StxAsset;\nexport type FungibleCryptoAsset =\n | NativeCryptoAsset\n | Sip10Asset\n | Brc20Asset\n | Src20Asset\n | Stx20Asset\n | RuneAsset;\n\n// NFT asset types\nexport interface BaseNonFungibleCryptoAsset extends BaseCryptoAsset {\n readonly category: 'nft';\n readonly protocol: NonFungibleCryptoAssetProtocol;\n}\nexport interface InscriptionAsset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'inscription';\n readonly id: string;\n readonly mimeType: InscriptionMimeType;\n readonly number: number;\n readonly address: string;\n readonly title: string;\n readonly txid: string;\n readonly output: string;\n readonly offset: string;\n readonly preview: string;\n readonly src: string;\n readonly thumbnailSrc?: string;\n readonly value: string;\n readonly genesisBlockHash: string;\n readonly genesisTimestamp: number;\n readonly genesisBlockHeight: number;\n}\nexport interface StampAsset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'bitcoin';\n readonly protocol: 'stamp';\n readonly stamp: number;\n readonly stampUrl: string;\n readonly stampExplorerUrl: string;\n readonly blockHeight: number;\n}\n\nexport type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;\n\nexport type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;\n\nexport interface FungibleAssetId {\n protocol: FungibleCryptoAssetProtocol;\n id: string;\n}\n","import { Money } from '../money.model';\nimport { BaseNonFungibleCryptoAsset } from './asset.model';\n\nexport const sip9ContentTypes = [\n 'image/jpeg',\n 'image/jpg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'image/bmp',\n 'image/tiff',\n 'image/avif',\n 'video/mp4',\n 'video/webm',\n 'video/mov',\n 'video/quicktime',\n 'video/avi',\n 'video/x-msvideo',\n 'video/ogg',\n 'audio/mpeg',\n 'audio/mp3',\n 'audio/wav',\n 'audio/x-wav',\n 'audio/ogg',\n 'audio/aac',\n 'audio/flac',\n 'audio/webm',\n 'model/gltf+json',\n 'model/gltf-binary',\n 'application/octet-stream',\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/pdf',\n 'application/json',\n 'text/javascript',\n 'application/javascript',\n 'application/zip',\n 'unknown',\n '',\n] as const;\n\nexport type Sip9ContentType = (typeof sip9ContentTypes)[number];\n\nexport interface Sip9Collection {\n name: string;\n collectionExplorerUrl: string;\n totalItems?: number;\n floorPrice?: Money;\n latestSale?: Money;\n}\n\nexport interface Sip9AssetContent {\n contentUrl: string;\n contentType: Sip9ContentType;\n}\n\nexport interface Sip9Attribute {\n traitType: string;\n value: any;\n rarityPercent?: number;\n}\n\nexport interface Sip9Asset extends BaseNonFungibleCryptoAsset {\n readonly chain: 'stacks';\n readonly protocol: 'sip9';\n readonly assetId: string;\n readonly contractId: string;\n readonly tokenId: number;\n readonly name: string;\n readonly description: string;\n readonly content: Sip9AssetContent;\n readonly attributes?: Sip9Attribute[];\n readonly collection?: Sip9Collection;\n readonly creator?: string;\n readonly rarityRank?: number;\n}\n","import { z } from 'zod';\n\n// Branded type for Bitcoin addresses\nexport type BitcoinAddress = string & { readonly __brand: unique symbol };\n\nexport const bitcoinUnitSchema = z.enum(['bitcoin', 'satoshi']);\nexport type BitcoinUnit = z.infer<typeof bitcoinUnitSchema>;\n\nexport type BitcoinUnitSymbol = 'BTC' | 'sat';\n\nexport interface BitcoinUnitInfo {\n name: BitcoinUnit;\n symbol: BitcoinUnitSymbol;\n decimal: string;\n}\n","export const bnsContractAddress = {\n mainnet: 'SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF',\n testnet: 'ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M',\n};\n\nexport const bnsContractName = 'BNS-V2';\n\nexport interface BnsName {\n owner: string;\n name: string;\n namespace: string;\n fullName: string;\n renewalHeight: number;\n registeredAtBlockNumber: number;\n}\n\nexport interface BnsProfile {\n bnsName: BnsName;\n profileData: BnsProfileData;\n}\n\nexport interface BnsProfileData {\n name?: string;\n bio?: string;\n website?: string;\n pfpUrl?: string;\n location?: string;\n addresses?: BnsProfileDataAddresses;\n}\n\nexport interface BnsProfileDataAddresses {\n bitcoinPayment?: string;\n bitcoinOrdinal?: string;\n solana?: string;\n ethereum?: string;\n}\n","import type BigNumber from 'bignumber.js';\n\nexport interface AverageBitcoinFeeRates {\n fastestFee: BigNumber;\n halfHourFee: BigNumber;\n hourFee: BigNumber;\n}\n\nexport const btcTxTimeMap: Record<keyof AverageBitcoinFeeRates, string> = {\n fastestFee: '~10 – 20min',\n halfHourFee: '~30 min',\n hourFee: '~1 hour+',\n};\n\nexport enum BtcFeeType {\n High = 'High',\n Standard = 'Standard',\n Low = 'Low',\n}\n","import { Blockchain } from '../types';\nimport { StacksFeeEstimate } from './stacks-fees.model';\n\nexport enum FeeTypes {\n Low,\n Middle,\n High,\n Custom,\n Unknown,\n}\n\nexport enum FeeCalculationTypes {\n Api = 'api',\n Default = 'default',\n DefaultSimulated = 'default-simulated',\n FeesCapped = 'fees-capped',\n TokenTransferSpecific = 'token-transfer-specific',\n}\n\nexport interface Fees {\n blockchain: Blockchain;\n estimates: StacksFeeEstimate[];\n calculation: FeeCalculationTypes;\n}\n","import { Money } from '../money.model';\nimport { Blockchain } from '../types';\n\nexport const transactionFeeTiers = ['low', 'standard', 'high'] as const;\nexport type TransactionFeeTier = (typeof transactionFeeTiers)[number];\n\nexport interface TransactionFees {\n readonly chain: Blockchain;\n readonly options: Record<TransactionFeeTier, TransactionFeeQuote>;\n}\n\nexport const transactionFeeQuoteType = [\n 'flat',\n 'bitcoinFeeRate',\n 'stacksFeeRate',\n 'evm1559',\n] as const;\nexport type TransactionFeeQuoteType = (typeof transactionFeeQuoteType)[number];\n\nexport interface BaseTransactionFeeQuote {\n readonly type: TransactionFeeQuoteType;\n readonly value: Money;\n}\n\nexport interface FlatTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'flat';\n}\n\nexport interface BitcoinTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'bitcoinFeeRate';\n readonly rate: number;\n readonly rateUnit: 'sats/vB';\n readonly estimatedTxSize: number;\n readonly sizeUnit: 'vB';\n}\n\nexport interface StacksTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'stacksFeeRate';\n readonly rate: number;\n readonly rateUnit: 'µSTX/byte';\n readonly estimatedTxSize: number;\n readonly sizeUnit: 'byte';\n}\n\nexport interface EvmTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'evm1559';\n readonly baseFeePerGas: Money;\n readonly priorityFeePerGas: Money;\n readonly gasLimit: number;\n}\n\nexport type TransactionFeeQuote =\n | FlatTransactionFeeQuote\n | BitcoinTransactionFeeQuote\n | StacksTransactionFeeQuote\n | EvmTransactionFeeQuote;\n","/**\n * Inscriptions contain arbitrary data. When retrieving an inscription, it should be\n * classified into one of the types below, indicating that the app can handle it\n * appropriately and securely. Inscriptions of types not ready to be handled by the\n * app should be classified as \"other\".\n */\nexport const inscriptionMimeTypes = [\n 'audio',\n 'gltf',\n 'html',\n 'image',\n 'svg',\n 'text',\n 'video',\n 'other',\n] as const;\n\nexport type InscriptionMimeType = (typeof inscriptionMimeTypes)[number];\n","import type { Currency, QuoteCurrency } from './currencies.model';\nimport type { Money } from './money.model';\n\ninterface MarketPair {\n readonly base: Currency;\n readonly quote: QuoteCurrency;\n}\n\nexport function createMarketPair(base: Currency, quote: QuoteCurrency): MarketPair {\n return Object.freeze({ base, quote });\n}\n\nexport function formatMarketPair({ base, quote }: MarketPair) {\n return `${base}/${quote}`;\n}\n\nexport interface MarketData {\n readonly pair: MarketPair;\n readonly price: Money;\n}\n\nexport function createMarketData(pair: MarketPair, price: Money): MarketData {\n if (pair.quote !== price.symbol)\n throw new Error('Cannot create market data when price does not match quote');\n return Object.freeze({ pair, price });\n}\n\nexport const historicalPeriods = ['1d', '1w', '1m', '3m', '6m', '1y'] as const;\nexport type HistoricalPeriod = (typeof historicalPeriods)[number];\n\nexport interface MarketPriceSnapshot {\n price: Money;\n timestamp: number;\n}\n\nexport interface MarketPriceHistory {\n period: HistoricalPeriod;\n changePercentage: number;\n prices: MarketPriceSnapshot[];\n}\n","import { z } from 'zod';\n\nimport { Blockchain } from '../types';\nimport { networkConfigurationSchema } from './network.schema';\n\nexport const HIRO_API_BASE_URL_MAINNET = 'https://api.hiro.so';\nexport const HIRO_API_BASE_URL_TESTNET = 'https://api.testnet.hiro.so';\nexport const HIRO_API_BASE_URL_NAKAMOTO_TESTNET = 'https://api.nakamoto.testnet.hiro.so';\n\nexport const HIRO_API_BASE_URL_MAINNET_EXTENDED = 'https://api.hiro.so/extended/v1';\nexport const HIRO_API_BASE_URL_TESTNET_EXTENDED = 'https://api.testnet.hiro.so/extended';\n\nexport const BITCOIN_API_BASE_URL_MAINNET = 'https://leather.mempool.space/api';\nexport const BITCOIN_API_BASE_URL_TESTNET3 = 'https://leather.mempool.space/testnet/api';\nexport const BITCOIN_API_BASE_URL_TESTNET4 = 'https://leather.mempool.space/testnet4/api';\nexport const BITCOIN_API_BASE_URL_SIGNET = 'https://mempool.space/signet/api';\n\nexport const BESTINSLOT_API_BASE_URL_MAINNET = 'https://leatherapi.bestinslot.xyz/v3';\nexport const BESTINSLOT_API_BASE_URL_TESTNET = 'https://leatherapi_testnet.bestinslot.xyz/v3';\n\nexport const STX20_API_BASE_URL_MAINNET = 'https://api.stx20.com/api/v1';\n\nexport const BNS_V2_API_BASE_URL = 'https://api.bnsv2.com';\n\n// Copied from @stacks/transactions to avoid dependencies\nexport enum ChainId {\n Testnet = 2147483648,\n Mainnet = 1,\n}\n\nexport enum WalletDefaultNetworkConfigurationIds {\n mainnet = 'mainnet',\n testnet = 'testnet',\n testnet4 = 'testnet4',\n signet = 'signet',\n sbtcTestnet = 'sbtcTestnet',\n sbtcDevenv = 'sbtcDevenv',\n devnet = 'devnet',\n}\n\nexport const defaultNetworkConfigurationsSchema = z.enum([\n 'mainnet',\n 'testnet',\n 'testnet4',\n 'signet',\n 'sbtcTestnet',\n 'sbtcDevenv',\n 'devnet',\n]);\nexport type DefaultNetworkConfigurations = z.infer<typeof defaultNetworkConfigurationsSchema>;\n\nexport const supportedBlockchains = ['stacks', 'bitcoin'] as const;\n\nexport type SupportedBlockchains = (typeof supportedBlockchains)[number];\n\nexport const networkModes = ['mainnet', 'testnet'] as const;\nexport const testnetModes = ['testnet', 'regtest', 'signet'] as const;\n\nexport const bitcoinNetworks = ['mainnet', 'testnet3', 'testnet4', 'regtest', 'signet'] as const;\nexport type BitcoinNetwork = (typeof bitcoinNetworks)[number];\n\nexport type NetworkModes = (typeof networkModes)[number];\ntype BitcoinTestnetModes = (typeof testnetModes)[number];\n\nexport function bitcoinNetworkToNetworkMode(network: BitcoinNetwork): BitcoinNetworkModes {\n switch (network) {\n case 'mainnet':\n return 'mainnet';\n case 'testnet3':\n return 'testnet';\n case 'testnet4':\n return 'testnet';\n case 'regtest':\n return 'regtest';\n case 'signet':\n return 'signet';\n default:\n // TODO: Needs exhaustive check. Cannot import 'assertUnreachable' since 'utils' package depends on 'models'.\n // Ideally this function should live in utils, but it's currently widely used in the extension.\n throw new Error(`Unhandled case: ${network}`);\n }\n}\n\nexport type BitcoinNetworkModes = NetworkModes | BitcoinTestnetModes;\n\ninterface BaseChainConfig {\n blockchain: Blockchain;\n}\n\nexport interface BitcoinChainConfig extends BaseChainConfig {\n blockchain: 'bitcoin';\n bitcoinUrl: string;\n bitcoinNetwork: BitcoinNetwork;\n mode: BitcoinNetworkModes;\n}\n\nexport interface StacksChainConfig extends BaseChainConfig {\n blockchain: 'stacks';\n url: string;\n /** The chainId of the network (or parent network if this is a subnet) */\n chainId: ChainId;\n /** An additional chainId for subnets. Indicated a subnet if defined and is mainly used for signing. */\n subnetChainId?: ChainId;\n}\n\nexport type NetworkConfiguration = z.infer<typeof networkConfigurationSchema>;\n\nconst networkMainnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.mainnet,\n name: 'Mainnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Mainnet,\n url: HIRO_API_BASE_URL_MAINNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'mainnet',\n mode: 'mainnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_MAINNET,\n },\n },\n};\n\nconst networkTestnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.testnet,\n name: 'Testnet3',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'testnet3',\n mode: 'testnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET3,\n },\n },\n};\n\nconst networkTestnet4: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.testnet4,\n name: 'Testnet4',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'testnet4',\n mode: 'testnet',\n bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET4,\n },\n },\n};\n\nconst networkSignet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.signet,\n name: 'Signet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'signet',\n mode: 'signet',\n bitcoinUrl: BITCOIN_API_BASE_URL_SIGNET,\n },\n },\n};\n\nconst networkSbtcTestnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.sbtcTestnet,\n name: 'sBTC Testnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: HIRO_API_BASE_URL_TESTNET,\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'https://beta.sbtc-mempool.tech/api/proxy',\n },\n },\n};\n\nconst networkSbtcDevenv: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.sbtcDevenv,\n name: 'sBTC Devenv',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: 'http://localhost:3999',\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'http://localhost:3000/api/proxy',\n },\n },\n};\n\nconst networkDevnet: NetworkConfiguration = {\n id: WalletDefaultNetworkConfigurationIds.devnet,\n name: 'Devnet',\n chain: {\n stacks: {\n blockchain: 'stacks',\n chainId: ChainId.Testnet,\n url: 'http://localhost:3999',\n },\n bitcoin: {\n blockchain: 'bitcoin',\n bitcoinNetwork: 'regtest',\n mode: 'regtest',\n bitcoinUrl: 'http://localhost:18443',\n },\n },\n};\n\nexport const defaultCurrentNetwork: NetworkConfiguration = networkMainnet;\n\nexport const defaultNetworksKeyedById: Record<\n WalletDefaultNetworkConfigurationIds,\n NetworkConfiguration\n> = {\n [WalletDefaultNetworkConfigurationIds.mainnet]: networkMainnet,\n [WalletDefaultNetworkConfigurationIds.testnet4]: networkTestnet4,\n [WalletDefaultNetworkConfigurationIds.testnet]: networkTestnet,\n [WalletDefaultNetworkConfigurationIds.signet]: networkSignet,\n [WalletDefaultNetworkConfigurationIds.sbtcTestnet]: networkSbtcTestnet,\n [WalletDefaultNetworkConfigurationIds.sbtcDevenv]: networkSbtcDevenv,\n [WalletDefaultNetworkConfigurationIds.devnet]: networkDevnet,\n};\n","import { z } from 'zod';\n\nimport { bitcoinNetworks, networkModes, testnetModes } from './network.model';\n\nexport const bitcoinNetworkModesSchema = z.enum([...networkModes, ...testnetModes]);\n\nexport const bitcoinNetworkSchema = z.enum([...bitcoinNetworks]);\n\nexport const networkConfigurationSchema = z.object({\n name: z.string(),\n id: z.string(),\n chain: z.object({\n bitcoin: z.object({\n blockchain: z.literal('bitcoin'),\n bitcoinUrl: z.string(),\n bitcoinNetwork: bitcoinNetworkSchema,\n mode: bitcoinNetworkModesSchema,\n }),\n stacks: z.object({\n blockchain: z.literal('stacks'),\n url: z.string(),\n chainId: z.number(),\n subnetChainId: z.number().optional(),\n }),\n }),\n});\n","import { z } from 'zod';\n\nimport { Blockchain } from './types';\n\nexport const accountDisplayPreferenceSchema = z.enum(['native-segwit', 'taproot', 'bns', 'stacks']);\nexport type AccountDisplayPreference = z.infer<typeof accountDisplayPreferenceSchema>;\n\nexport interface AccountDisplayPreferenceInfo {\n type: AccountDisplayPreference;\n blockchain: Blockchain;\n name: string;\n}\n\nexport const analyticsPreferenceSchema = z.enum(['consent-given', 'rejects-tracking']);\nexport type AnalyticsPreference = z.infer<typeof analyticsPreferenceSchema>;\n\nexport const emailAddressSchema = z.email({ error: 'Invalid email address' });\nexport type EmailAddress = z.infer<typeof emailAddressSchema>;\n","import { CryptoAssetId } from '../assets/asset-id.model';\nimport { NativeCryptoAsset, Sip10Asset } from '../assets/asset.model';\nimport { Money } from '../money.model';\n\nexport type SwappableFungibleCryptoAsset = NativeCryptoAsset | Sip10Asset;\n\nexport interface SwapAsset {\n asset: SwappableFungibleCryptoAsset;\n providerAssets: SwapProviderAsset[];\n}\n\nexport const swapProviderIds = ['bitflow-sdk', 'sbtc-bridge', 'alex-sdk', 'velar-sdk'] as const;\nexport type SwapProviderId = (typeof swapProviderIds)[number];\n\nexport interface SwapProvider {\n id: SwapProviderId;\n isAggregator: boolean;\n}\n\nexport interface SwapProviderAsset {\n providerId: SwapProviderId;\n providerAssetId: string;\n assetId: CryptoAssetId;\n}\n\nexport type SwapQuote =\n | AlexSdkSwapQuote\n | VelarSdkSwapQuote\n | BitflowSdkSwapQuote\n | SbtcBridgeSwapQuote;\n\nexport interface BaseSwapQuote {\n executionType: SwapExecutionType;\n providerId: SwapProviderId;\n baseAsset: SwappableFungibleCryptoAsset;\n targetAsset: SwappableFungibleCryptoAsset;\n baseAmount: Money;\n targetAmount: Money;\n dexPath: SwapDex[];\n assetPath: (NativeCryptoAsset | Sip10Asset)[];\n createdAt: Date;\n}\n\nexport interface AlexSdkSwapQuote extends BaseSwapQuote {\n providerId: 'alex-sdk';\n providerQuoteData: {\n baseProviderAssetId: string;\n targetProviderAssetId: string;\n alexSdkAmmRoute: unknown;\n };\n}\n\nexport interface VelarSdkSwapQuote extends BaseSwapQuote {\n providerId: 'velar-sdk';\n providerQuoteData: {\n baseProviderAssetId: string;\n targetProviderAssetId: string;\n };\n}\n\nexport interface BitflowSdkSwapQuote extends BaseSwapQuote {\n providerId: 'bitflow-sdk';\n providerQuoteData: {\n bitflowSdkSelectedSwapRoute: unknown;\n };\n}\n\nexport interface SbtcBridgeSwapQuote extends BaseSwapQuote {\n providerId: 'sbtc-bridge';\n}\n\nexport interface SwapDex {\n name: string;\n url: string;\n logo: string;\n description: string;\n}\n\nexport const swapExecutionTypes = ['stacks-contract-call', 'sbtc-bridge-transfer'] as const;\nexport type SwapExecutionType = (typeof swapExecutionTypes)[number];\n\nexport interface BaseSwapExecutionData {\n executionType: SwapExecutionType;\n providerId: SwapProviderId;\n quote: SwapQuote;\n}\nexport interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {\n executionType: 'stacks-contract-call';\n quote: SwapQuote;\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: unknown[];\n postConditions: unknown[];\n postConditionMode?: unknown;\n}\nexport interface SbtcBridgeTransferSwapExecutionData extends BaseSwapExecutionData {\n executionType: 'sbtc-bridge-transfer';\n}\nexport type SwapExecutionData =\n | StacksContractCallSwapExecutionData\n | SbtcBridgeTransferSwapExecutionData;\n","export const YieldProviderKeys = {\n bitflow: 'bitflow',\n zest: 'zest',\n granite: 'granite',\n stackingDao: 'stackingdao',\n lisa: 'lisa',\n hermetica: 'hermetica',\n fastPool: 'fast-pool',\n xverse: 'xverse',\n velar: 'velar',\n} as const;\nexport type YieldProviderKey = (typeof YieldProviderKeys)[keyof typeof YieldProviderKeys];\n\nexport interface YieldProvider {\n readonly key: YieldProviderKey;\n readonly name: string;\n readonly logo: string;\n readonly url: string;\n}\n","import { YieldProviderKey, YieldProviderKeys } from './yield-provider.model';\n\nexport const YieldProductKeys = {\n bitflowAmmLp: 'bitflow-amm-lp',\n bitflowAmmStaking: 'bitflow-amm-staking',\n zestBorrowMarket: 'zest-borrow-market',\n graniteV1Earn: 'granite-v1-earn',\n graniteV1Borrow: 'granite-v1-borrow',\n stackingDaoStstx: 'stackingdao-ststx',\n stackingDaoStstxbtc: 'stackingdao-ststxbtc',\n stackingDaoPooledStacking: 'stackingdao-pooled-stacking',\n lisaListx: 'lisa-listx',\n lisaLiquidStaking: 'lisa-liquid-staking',\n hermeticaUsdhStaking: 'hermetica-usdh-staking',\n velarAmmLp: 'velar-amm-lp',\n velarPerps: 'velar-perps',\n velarAmmLpFarming: 'velar-amm-lp-farming',\n fastPoolPooledStacking: 'fast-pool-pooled-stacking',\n xversePooledStacking: 'xverse-pooled-stacking',\n} as const;\nexport type YieldProductKey = (typeof YieldProductKeys)[keyof typeof YieldProductKeys];\n\nexport const YieldProductCategories = {\n AMM: 'amm',\n LENDING: 'lending',\n LIQUID_STACKING: 'liquid-stacking',\n POOLED_STACKING: 'pooled-stacking',\n STAKING: 'staking',\n PERPS: 'perps',\n} as const;\nexport type YieldProductCategory =\n (typeof YieldProductCategories)[keyof typeof YieldProductCategories];\n\nexport const YieldProductToProviderMap = {\n [YieldProductKeys.bitflowAmmLp]: YieldProviderKeys.bitflow,\n [YieldProductKeys.bitflowAmmStaking]: YieldProviderKeys.bitflow,\n [YieldProductKeys.zestBorrowMarket]: YieldProviderKeys.zest,\n [YieldProductKeys.graniteV1Earn]: YieldProviderKeys.granite,\n [YieldProductKeys.graniteV1Borrow]: YieldProviderKeys.granite,\n [YieldProductKeys.stackingDaoStstx]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.stackingDaoStstxbtc]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.stackingDaoPooledStacking]: YieldProviderKeys.stackingDao,\n [YieldProductKeys.lisaListx]: YieldProviderKeys.lisa,\n [YieldProductKeys.lisaLiquidStaking]: YieldProviderKeys.lisa,\n [YieldProductKeys.hermeticaUsdhStaking]: YieldProviderKeys.hermetica,\n [YieldProductKeys.velarAmmLp]: YieldProviderKeys.velar,\n [YieldProductKeys.velarPerps]: YieldProviderKeys.velar,\n [YieldProductKeys.velarAmmLpFarming]: YieldProviderKeys.velar,\n [YieldProductKeys.fastPoolPooledStacking]: YieldProviderKeys.fastPool,\n [YieldProductKeys.xversePooledStacking]: YieldProviderKeys.xverse,\n} as const;\n\nexport type YieldProduct = BaseYieldProduct | PooledStackingYieldProduct;\n\nexport interface BaseYieldProduct {\n readonly key: YieldProductKey;\n readonly provider: YieldProviderKey;\n readonly category: YieldProductCategory;\n readonly name: string;\n readonly url: string;\n}\n\n// normalizes pooled stacking product data\nexport interface PooledStackingYieldProduct extends BaseYieldProduct {\n readonly category: 'pooled-stacking';\n readonly stackerCount: number;\n}\n","import type {\n BitflowAmmLpPosition,\n BitflowAmmStakingPosition,\n} from '../providers/bitflow-position.model';\nimport type {\n GraniteV1BorrowPosition,\n GraniteV1EarnPosition,\n} from '../providers/granite-position.model';\nimport type {\n StackingDaoPooledStackingPosition,\n StackingDaoStStxBtcPosition,\n StackingDaoStStxPosition,\n} from '../providers/stacking-dao-position.model';\nimport type { ZestBorrowMarketPosition } from '../providers/zest-position.model';\nimport type { YieldPosition } from '../yield-position.model';\nimport {\n YieldProduct,\n YieldProductCategories,\n YieldProductCategory,\n YieldProductKey,\n YieldProductKeys,\n YieldProductToProviderMap,\n} from '../yield-product.model';\nimport { YieldProvider, YieldProviderKey } from '../yield-provider.model';\n\nexport function isBitflowAmmLpPosition(pos: YieldPosition): pos is BitflowAmmLpPosition {\n return pos.product === YieldProductKeys.bitflowAmmLp;\n}\n\nexport function isBitflowAmmStakingPosition(pos: YieldPosition): pos is BitflowAmmStakingPosition {\n return pos.product === YieldProductKeys.bitflowAmmStaking;\n}\n\nexport function isZestPosition(pos: YieldPosition): pos is ZestBorrowMarketPosition {\n return pos.product === YieldProductKeys.zestBorrowMarket;\n}\n\nexport function isGraniteEarnPosition(pos: YieldPosition): pos is GraniteV1EarnPosition {\n return pos.product === YieldProductKeys.graniteV1Earn;\n}\n\nexport function isGraniteBorrowPosition(pos: YieldPosition): pos is GraniteV1BorrowPosition {\n return pos.product === YieldProductKeys.graniteV1Borrow;\n}\n\nexport function isStackingDaoStStxPosition(pos: YieldPosition): pos is StackingDaoStStxPosition {\n return pos.product === YieldProductKeys.stackingDaoStstx;\n}\n\nexport function isStackingDaoStStxBtcPosition(\n pos: YieldPosition\n): pos is StackingDaoStStxBtcPosition {\n return pos.product === YieldProductKeys.stackingDaoStstxbtc;\n}\n\nexport function isStackingDaoPooledPosition(\n pos: YieldPosition\n): pos is StackingDaoPooledStackingPosition {\n return pos.product === YieldProductKeys.stackingDaoPooledStacking;\n}\n\nexport function filterPositionsByProvider(\n positions: YieldPosition[],\n provider: YieldProviderKey\n): YieldPosition[] {\n return positions.filter(p => p.provider === provider);\n}\n\nexport function filterPositionsByProduct(\n positions: YieldPosition[],\n product: YieldProductKey\n): YieldPosition[] {\n return positions.filter(p => p.product === product);\n}\n\nexport function filterPositionsByCategory(\n positions: YieldPosition[],\n products: YieldProduct[],\n category: YieldProductCategory\n): YieldPosition[] {\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.filter(pos => productMap.get(pos.product)?.category === category);\n}\n\nexport function sortPositionsByBalance(\n positions: YieldPosition[],\n ascending = false\n): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const diff = a.totalBalance.amount.comparedTo(b.totalBalance.amount);\n return ascending ? diff : -diff;\n });\n}\n\nexport function sortPositionsByApy(positions: YieldPosition[], ascending = false): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const apyA = a.apy;\n const apyB = b.apy;\n return ascending ? apyA - apyB : apyB - apyA;\n });\n}\n\nexport function sortPositionsByUpdateTime(\n positions: YieldPosition[],\n ascending = false\n): YieldPosition[] {\n return [...positions].sort((a, b) => {\n const timeA = 'updatedAt' in a && a.updatedAt instanceof Date ? a.updatedAt.getTime() : 0;\n const timeB = 'updatedAt' in b && b.updatedAt instanceof Date ? b.updatedAt.getTime() : 0;\n return ascending ? timeA - timeB : timeB - timeA;\n });\n}\n\nexport function getProviderForProduct(product: YieldProductKey): YieldProviderKey {\n return YieldProductToProviderMap[product];\n}\n\nexport function getCategoryForProduct(product: YieldProduct): YieldProductCategory {\n return product.category;\n}\n\nexport function isProductInProvider(product: YieldProductKey, provider: YieldProviderKey): boolean {\n return YieldProductToProviderMap[product] === provider;\n}\n\nexport function getProductsForProvider(provider: YieldProviderKey): YieldProductKey[] {\n return Object.entries(YieldProductToProviderMap)\n .filter(([_, p]) => p === provider)\n .map(([product]) => product as YieldProductKey);\n}\n\nexport function getProductsInCategory(\n products: YieldProduct[],\n category: YieldProductCategory\n): YieldProduct[] {\n return products.filter(p => p.category === category);\n}\n\nexport function groupPositionsByProvider(\n positions: YieldPosition[]\n): Record<YieldProviderKey, YieldPosition[]> {\n const grouped: Partial<Record<YieldProviderKey, YieldPosition[]>> = {};\n\n for (const position of positions) {\n const provider = position.provider;\n if (!grouped[provider]) {\n grouped[provider] = [];\n }\n grouped[provider].push(position);\n }\n\n return grouped as Record<YieldProviderKey, YieldPosition[]>;\n}\n\nexport function groupPositionsByCategory(\n positions: YieldPosition[],\n products: YieldProduct[]\n): Record<string, YieldPosition[]> {\n const grouped: Record<string, YieldPosition[]> = {};\n const productMap = new Map(products.map(p => [p.key, p]));\n\n for (const position of positions) {\n const product = productMap.get(position.product);\n if (!product) continue;\n\n const category = product.category;\n if (!grouped[category]) {\n grouped[category] = [];\n }\n grouped[category].push(position);\n }\n\n return grouped;\n}\n\nexport function getPositionsInCategories(\n positions: YieldPosition[],\n products: YieldProduct[],\n categories: YieldProductCategory[]\n): YieldPosition[] {\n const categorySet = new Set(categories);\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.filter(pos => {\n const product = productMap.get(pos.product);\n return product && categorySet.has(product.category);\n });\n}\n\nexport function hasPositionsInProvider(\n positions: YieldPosition[],\n provider: YieldProviderKey\n): boolean {\n return positions.some(p => p.provider === provider);\n}\n\nexport function hasPositionsInCategory(\n positions: YieldPosition[],\n products: YieldProduct[],\n category: YieldProductCategory\n): boolean {\n const productMap = new Map(products.map(p => [p.key, p]));\n return positions.some(pos => productMap.get(pos.product)?.category === category);\n}\n\nexport function enrichPositionWithProvider<T extends YieldPosition>(\n position: T,\n provider: YieldProvider\n): T & { providerData: YieldProvider } {\n return { ...position, providerData: provider };\n}\n\nexport function enrichPositionWithProduct<T extends YieldPosition>(\n position: T,\n product: YieldProduct\n): T & { productData: YieldProduct } {\n return { ...position, productData: product };\n}\n\nexport function enrichPositionWithMetadata<T extends YieldPosition>(\n position: T,\n provider: YieldProvider,\n product: YieldProduct\n): T & { providerData: YieldProvider; productData: YieldProduct } {\n return { ...position, providerData: provider, productData: product };\n}\n\nexport function getCategoryDisplayName(category: YieldProductCategory): string {\n const displayNames: Record<YieldProductCategory, string> = {\n [YieldProductCategories.AMM]: 'Liquidity Pools',\n [YieldProductCategories.LENDING]: 'Lending & Borrowing',\n [YieldProductCategories.LIQUID_STACKING]: 'Liquid Stacking',\n [YieldProductCategories.POOLED_STACKING]: 'Pooled Stacking',\n [YieldProductCategories.STAKING]: 'Staking',\n [YieldProductCategories.PERPS]: 'Perpetuals',\n };\n return displayNames[category] || category;\n}\n","import { CryptoAsset } from '../assets/asset.model';\nimport { ChainId, NetworkConfiguration } from '../network/network.model';\n\nexport type BitcoinNetworkPreference = 'mainnet' | 'testnet4' | 'signet';\ntype StacksNetworkPreference = 'mainnet' | 'testnet';\n\nconst HIRO_EXPLORER_URL = 'https://explorer.hiro.so';\nconst MEMPOOL_BASE_URL = 'https://mempool.space';\n\nexport interface MakeActivityArgs {\n txid: string;\n networkPreference: NetworkConfiguration;\n asset?: CryptoAsset;\n}\nexport function makeActivityLink({ txid, networkPreference, asset }: MakeActivityArgs) {\n if (txid && asset) {\n return makeActivityExplorerLink({\n asset,\n txid,\n networkPreference,\n });\n }\n return null;\n}\n\ninterface MakeActivityExplorerLinkArgs {\n asset: CryptoAsset;\n txid: string;\n networkPreference: NetworkConfiguration;\n}\nfunction makeActivityExplorerLink({\n asset,\n txid,\n networkPreference,\n}: MakeActivityExplorerLinkArgs) {\n if (asset.chain === 'bitcoin') {\n return getMempoolExplorerLink({\n networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork as BitcoinNetworkPreference,\n id: txid,\n type: 'txid',\n });\n }\n return makeStacksTxExplorerLink({\n networkPreference:\n networkPreference.chain.stacks.chainId === ChainId.Testnet ? 'testnet' : 'mainnet',\n searchParams: undefined,\n txid,\n explorerUrl: HIRO_EXPLORER_URL,\n });\n}\n\ninterface MakeStacksTxExplorerLinkArgs {\n networkPreference: StacksNetworkPreference;\n searchParams?: URLSearchParams;\n txid: string;\n explorerUrl: string;\n}\nfunction makeStacksTxExplorerLink({\n networkPreference,\n searchParams = new URLSearchParams(),\n txid,\n explorerUrl,\n}: MakeStacksTxExplorerLinkArgs) {\n searchParams.append('chain', networkPreference);\n return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;\n}\n\nexport interface GetMempoolExplorerLinkArgs {\n id: string;\n type: 'txid' | 'block';\n networkPreference: BitcoinNetworkPreference;\n}\n\nexport function getMempoolExplorerLink({\n id,\n type,\n networkPreference,\n}: GetMempoolExplorerLinkArgs) {\n switch (networkPreference) {\n case 'mainnet':\n return `${MEMPOOL_BASE_URL}/${type}/${id}`;\n case 'testnet4':\n return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;\n case 'signet':\n return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;\n default:\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,aAAa,EAAE,OAAO;AACxB,CAAC;AAEM,IAAM,kBAAkB,eAAe,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;AAEjF,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,mBAAmB,EAAE,OAAO;AAAA,EAC5B,wBAAwB,EAAE,OAAO;AAAA,EACjC,8BAA8B,EAAE,OAAO,EAAE,SAAS;AAAA,EAClD,mCAAmC,EAAE,OAAO,EAAE,SAAS;AACzD,CAAC;AAEM,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,YAAY,EAAE,OAAO;AACvB,CAAC;AAEM,IAAM,yBAAyB,EAAE,OAAO;AAAA,EAC7C,IAAI;AAAA,EACJ,SAAS,yBAAyB,SAAS;AAAA,EAC3C,QAAQ,wBAAwB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BAAuB;AAAA,MAC5B,mBAAmB,kBAAkB,MAAM,QAAQ;AAAA,MACnD,IAAI;AAAA,MACJ,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AACA,SAAO,yBAAyB;AAAA,IAC9B,mBACE,kBAAkB,MAAM,OAAO,uCAA8B,YAAY;AAAA,IAC3E,cAAc;AAAA,IACd;AAAA,IACA,aAAa;AAAA,EACf,CAAC;AACH;AAQA,SAAS,yBAAyB;AAAA,EAChC;AAAA,EACA,eAAe,IAAI,gBAAgB;AAAA,EACnC;AAAA,EACA;AACF,GAAiC;AAC/B,eAAa,OAAO,SAAS,iBAAiB;AAC9C,SAAO,GAAG,WAAW,SAAS,IAAI,IAAI,aAAa,SAAS,CAAC;AAC/D;AAQO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,GAA+B;AAC7B,UAAQ,mBAAmB;AAAA,IACzB,KAAK;AACH,aAAO,GAAG,gBAAgB,IAAI,IAAI,IAAI,EAAE;AAAA,IAC1C,KAAK;AACH,aAAO,GAAG,gBAAgB,aAAa,IAAI,IAAI,EAAE;AAAA,IACnD,KAAK;AACH,aAAO,GAAG,gBAAgB,WAAW,IAAI,IAAI,EAAE;AAAA,IACjD;AACE,aAAO;AAAA,EACX;AACF;","names":["z","BtcFeeType","FeeTypes","FeeCalculationTypes","z","ChainId","WalletDefaultNetworkConfigurationIds","z","z","z"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@leather.io/models",
3
3
  "author": "Leather.io contact@leather.io",
4
4
  "description": "Leather models and types",
5
- "version": "0.48.0",
5
+ "version": "0.50.0",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/leather-io/mono/tree/dev/packages/models",
8
8
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "prettier": "3.5.1",
25
25
  "tsup": "8.4.0",
26
26
  "typescript": "5.8.3",
27
- "@leather.io/tsconfig-config": "0.11.0",
28
- "@leather.io/prettier-config": "0.9.0"
27
+ "@leather.io/prettier-config": "0.9.0",
28
+ "@leather.io/tsconfig-config": "0.11.0"
29
29
  },
30
30
  "keywords": [
31
31
  "leather",
@@ -0,0 +1,89 @@
1
+ import { CryptoAsset } from '../assets/asset.model';
2
+ import { ChainId, NetworkConfiguration } from '../network/network.model';
3
+
4
+ export type BitcoinNetworkPreference = 'mainnet' | 'testnet4' | 'signet';
5
+ type StacksNetworkPreference = 'mainnet' | 'testnet';
6
+
7
+ const HIRO_EXPLORER_URL = 'https://explorer.hiro.so';
8
+ const MEMPOOL_BASE_URL = 'https://mempool.space';
9
+
10
+ export interface MakeActivityArgs {
11
+ txid: string;
12
+ networkPreference: NetworkConfiguration;
13
+ asset?: CryptoAsset;
14
+ }
15
+ export function makeActivityLink({ txid, networkPreference, asset }: MakeActivityArgs) {
16
+ if (txid && asset) {
17
+ return makeActivityExplorerLink({
18
+ asset,
19
+ txid,
20
+ networkPreference,
21
+ });
22
+ }
23
+ return null;
24
+ }
25
+
26
+ interface MakeActivityExplorerLinkArgs {
27
+ asset: CryptoAsset;
28
+ txid: string;
29
+ networkPreference: NetworkConfiguration;
30
+ }
31
+ function makeActivityExplorerLink({
32
+ asset,
33
+ txid,
34
+ networkPreference,
35
+ }: MakeActivityExplorerLinkArgs) {
36
+ if (asset.chain === 'bitcoin') {
37
+ return getMempoolExplorerLink({
38
+ networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork as BitcoinNetworkPreference,
39
+ id: txid,
40
+ type: 'txid',
41
+ });
42
+ }
43
+ return makeStacksTxExplorerLink({
44
+ networkPreference:
45
+ networkPreference.chain.stacks.chainId === ChainId.Testnet ? 'testnet' : 'mainnet',
46
+ searchParams: undefined,
47
+ txid,
48
+ explorerUrl: HIRO_EXPLORER_URL,
49
+ });
50
+ }
51
+
52
+ interface MakeStacksTxExplorerLinkArgs {
53
+ networkPreference: StacksNetworkPreference;
54
+ searchParams?: URLSearchParams;
55
+ txid: string;
56
+ explorerUrl: string;
57
+ }
58
+ function makeStacksTxExplorerLink({
59
+ networkPreference,
60
+ searchParams = new URLSearchParams(),
61
+ txid,
62
+ explorerUrl,
63
+ }: MakeStacksTxExplorerLinkArgs) {
64
+ searchParams.append('chain', networkPreference);
65
+ return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;
66
+ }
67
+
68
+ export interface GetMempoolExplorerLinkArgs {
69
+ id: string;
70
+ type: 'txid' | 'block';
71
+ networkPreference: BitcoinNetworkPreference;
72
+ }
73
+
74
+ export function getMempoolExplorerLink({
75
+ id,
76
+ type,
77
+ networkPreference,
78
+ }: GetMempoolExplorerLinkArgs) {
79
+ switch (networkPreference) {
80
+ case 'mainnet':
81
+ return `${MEMPOOL_BASE_URL}/${type}/${id}`;
82
+ case 'testnet4':
83
+ return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;
84
+ case 'signet':
85
+ return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;
86
+ default:
87
+ return null;
88
+ }
89
+ }
@@ -3,5 +3,4 @@ import { CryptoAssetProtocol } from './asset.model';
3
3
  export interface CryptoAssetId {
4
4
  protocol: CryptoAssetProtocol;
5
5
  id: string;
6
- tokenId?: number;
7
6
  }
@@ -51,11 +51,13 @@ interface BaseFungibleCryptoAsset extends BaseCryptoAsset {
51
51
  export interface BtcAsset extends BaseFungibleCryptoAsset {
52
52
  readonly chain: 'bitcoin';
53
53
  readonly protocol: 'nativeBtc';
54
+ readonly name: 'Bitcoin';
54
55
  readonly symbol: 'BTC';
55
56
  }
56
57
  export interface StxAsset extends BaseFungibleCryptoAsset {
57
58
  readonly chain: 'stacks';
58
59
  readonly protocol: 'nativeStx';
60
+ readonly name: 'Stacks';
59
61
  readonly symbol: 'STX';
60
62
  }
61
63
  export interface Brc20Asset extends BaseFungibleCryptoAsset {
package/src/index.ts CHANGED
@@ -42,3 +42,11 @@ export * from './yield/yield-position.base.model';
42
42
  export * from './yield/yield-position.model';
43
43
  export * from './yield/yield-product.model';
44
44
  export * from './yield/yield-provider.model';
45
+ export * from './activity/activity-level.model';
46
+ export * from './activity/activity-status.model';
47
+ export * from './activity/activity-type.model';
48
+ export * from './activity/activity.model';
49
+ export * from './activity/activity.utils';
50
+ export * from './account.model';
51
+ export * from './bns.model';
52
+ export * from './swap/swap.model';
@@ -23,15 +23,50 @@ export interface SwapProviderAsset {
23
23
  assetId: CryptoAssetId;
24
24
  }
25
25
 
26
- export interface SwapQuote {
26
+ export type SwapQuote =
27
+ | AlexSdkSwapQuote
28
+ | VelarSdkSwapQuote
29
+ | BitflowSdkSwapQuote
30
+ | SbtcBridgeSwapQuote;
31
+
32
+ export interface BaseSwapQuote {
27
33
  executionType: SwapExecutionType;
28
34
  providerId: SwapProviderId;
29
- providerQuoteData: unknown;
30
- baseAmount: number;
31
- targetAmount: number;
32
- quote: Money;
35
+ baseAsset: SwappableFungibleCryptoAsset;
36
+ targetAsset: SwappableFungibleCryptoAsset;
37
+ baseAmount: Money;
38
+ targetAmount: Money;
33
39
  dexPath: SwapDex[];
34
40
  assetPath: (NativeCryptoAsset | Sip10Asset)[];
41
+ createdAt: Date;
42
+ }
43
+
44
+ export interface AlexSdkSwapQuote extends BaseSwapQuote {
45
+ providerId: 'alex-sdk';
46
+ providerQuoteData: {
47
+ baseProviderAssetId: string;
48
+ targetProviderAssetId: string;
49
+ alexSdkAmmRoute: unknown;
50
+ };
51
+ }
52
+
53
+ export interface VelarSdkSwapQuote extends BaseSwapQuote {
54
+ providerId: 'velar-sdk';
55
+ providerQuoteData: {
56
+ baseProviderAssetId: string;
57
+ targetProviderAssetId: string;
58
+ };
59
+ }
60
+
61
+ export interface BitflowSdkSwapQuote extends BaseSwapQuote {
62
+ providerId: 'bitflow-sdk';
63
+ providerQuoteData: {
64
+ bitflowSdkSelectedSwapRoute: unknown;
65
+ };
66
+ }
67
+
68
+ export interface SbtcBridgeSwapQuote extends BaseSwapQuote {
69
+ providerId: 'sbtc-bridge';
35
70
  }
36
71
 
37
72
  export interface SwapDex {
@@ -47,9 +82,11 @@ export type SwapExecutionType = (typeof swapExecutionTypes)[number];
47
82
  export interface BaseSwapExecutionData {
48
83
  executionType: SwapExecutionType;
49
84
  providerId: SwapProviderId;
85
+ quote: SwapQuote;
50
86
  }
51
87
  export interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {
52
88
  executionType: 'stacks-contract-call';
89
+ quote: SwapQuote;
53
90
  contractAddress: string;
54
91
  contractName: string;
55
92
  functionName: string;