@leather.io/models 0.45.0 → 0.46.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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +111 -30
- package/dist/index.js +57 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/asset-id.model.ts +1 -0
- package/src/assets/asset.model.ts +1 -0
- package/src/assets/sip9-asset.model.ts +5 -0
- package/src/balance.model.ts +4 -5
- package/src/bitcoin.model.ts +4 -1
- package/src/bns.model.ts +2 -0
- package/src/fees/transaction-fees.model.ts +42 -0
- package/src/index.ts +1 -0
- package/src/inscription-mime-type.model.ts +0 -17
- package/src/market.model.ts +14 -0
- package/src/network/network.model.ts +10 -1
- package/src/settings.model.ts +5 -2
- package/src/transactions/bitcoin-transaction.model.ts +27 -1
- package/src/utxo.model.ts +7 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @leather.io/models@0.
|
|
2
|
+
> @leather.io/models@0.46.0 build /home/runner/work/mono/mono/packages/models
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[34mCLI[39m Using tsup config: /home/runner/work/mono/mono/packages/models/tsup.config.ts
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m14.23 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m33.92 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 51ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 2995ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m33.50 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -36,6 +36,24 @@
|
|
|
36
36
|
* devDependencies
|
|
37
37
|
* @leather.io/prettier-config bumped to 0.9.0
|
|
38
38
|
|
|
39
|
+
## [0.46.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.45.0...@leather.io/models-v0.46.0) (2025-10-31)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* add bitcoin transaction fees service ([cce337c](https://github.com/leather-io/mono/commit/cce337cd13979983f368eda7793d98160ba7adb5))
|
|
45
|
+
* add get-by-id to btc and stx transactions services ([3e1fa58](https://github.com/leather-io/mono/commit/3e1fa589fb72a6ed94d4ccb3f85ced47b5241aaf))
|
|
46
|
+
* add market history service, types, and API integration ([5a1f63d](https://github.com/leather-io/mono/commit/5a1f63d4d33c5b998c9d9a394f8dfe300df065b3))
|
|
47
|
+
* implement SIP-009 token details ([ab0e283](https://github.com/leather-io/mono/commit/ab0e2832c7626438501378247069d78c64207b52))
|
|
48
|
+
* implement stamp token details ([7aad1ff](https://github.com/leather-io/mono/commit/7aad1ff49cebfa7f1be96c96cbc45e00c079d32a))
|
|
49
|
+
* **mobile:** add bns token details ([3bda486](https://github.com/leather-io/mono/commit/3bda4862a7f550b1292ef517976d12e3c08bc405))
|
|
50
|
+
* stacks transaction fees service ([eb921e0](https://github.com/leather-io/mono/commit/eb921e029d51e423847398a5ba15a7529a73638c))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* **mobile:** bugfix token routing,update CryptoAssetId to account for SIP-9 ([e8080fc](https://github.com/leather-io/mono/commit/e8080fc5cc705a3245109c3c33b2a9394696007a))
|
|
56
|
+
|
|
39
57
|
## [0.45.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.44.1...@leather.io/models-v0.45.0) (2025-10-16)
|
|
40
58
|
|
|
41
59
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
|
|
2
1
|
import { z } from 'zod';
|
|
2
|
+
import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';
|
|
3
3
|
import { MempoolTransaction, Transaction } from '@stacks/stacks-blockchain-api-types';
|
|
4
4
|
|
|
5
5
|
type BitcoinAddress = string & {
|
|
6
6
|
readonly __brand: unique symbol;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
declare const bitcoinUnitSchema: z.ZodEnum<{
|
|
9
|
+
bitcoin: "bitcoin";
|
|
10
|
+
satoshi: "satoshi";
|
|
11
|
+
}>;
|
|
12
|
+
type BitcoinUnit = z.infer<typeof bitcoinUnitSchema>;
|
|
9
13
|
type BitcoinUnitSymbol = 'BTC' | 'sat';
|
|
10
14
|
interface BitcoinUnitInfo {
|
|
11
15
|
name: BitcoinUnit;
|
|
@@ -60,7 +64,7 @@ interface BaseCryptoAssetBalance {
|
|
|
60
64
|
*/
|
|
61
65
|
readonly pendingBalance: Money;
|
|
62
66
|
/**
|
|
63
|
-
* totalBalance after filtering out outboundBalance, protectedBalance, and
|
|
67
|
+
* totalBalance after filtering out outboundBalance, protectedBalance, and dustBalance
|
|
64
68
|
*/
|
|
65
69
|
readonly availableBalance: Money;
|
|
66
70
|
}
|
|
@@ -70,11 +74,11 @@ interface BtcBalance extends BaseCryptoAssetBalance {
|
|
|
70
74
|
*/
|
|
71
75
|
readonly protectedBalance: Money;
|
|
72
76
|
/**
|
|
73
|
-
* Balance across UTXOs with
|
|
77
|
+
* Balance across UTXOs with value less than dust threshold
|
|
74
78
|
*/
|
|
75
|
-
readonly
|
|
79
|
+
readonly dustBalance: Money;
|
|
76
80
|
/**
|
|
77
|
-
* Balance of the union set of protected and
|
|
81
|
+
* Balance of the union set of protected and dust UTXOs
|
|
78
82
|
*/
|
|
79
83
|
readonly unspendableBalance: Money;
|
|
80
84
|
}
|
|
@@ -102,19 +106,6 @@ type CryptoAssetBalance = BaseCryptoAssetBalance | BtcBalance | StxBalance;
|
|
|
102
106
|
*/
|
|
103
107
|
declare const inscriptionMimeTypes: readonly ["audio", "gltf", "html", "image", "svg", "text", "video", "other"];
|
|
104
108
|
type InscriptionMimeType = (typeof inscriptionMimeTypes)[number];
|
|
105
|
-
interface Inscription extends InscriptionAsset {
|
|
106
|
-
preview: string;
|
|
107
|
-
src: string;
|
|
108
|
-
title: string;
|
|
109
|
-
output: string;
|
|
110
|
-
txid: string;
|
|
111
|
-
offset: string;
|
|
112
|
-
address: string;
|
|
113
|
-
genesisBlockHash: string;
|
|
114
|
-
genesisTimestamp: number;
|
|
115
|
-
genesisBlockHeight: number;
|
|
116
|
-
value: string;
|
|
117
|
-
}
|
|
118
109
|
|
|
119
110
|
declare const sip9ContentTypes: readonly ["image/jpeg", "image/jpg", "image/png", "image/gif", "image/webp", "image/svg+xml", "image/bmp", "image/tiff", "image/avif", "video/mp4", "video/webm", "video/mov", "video/quicktime", "video/avi", "video/x-msvideo", "video/ogg", "audio/mpeg", "audio/mp3", "audio/wav", "audio/x-wav", "audio/ogg", "audio/aac", "audio/flac", "audio/webm", "model/gltf+json", "model/gltf-binary", "application/octet-stream", "text/plain", "text/html", "text/markdown", "application/pdf", "application/json", "text/javascript", "application/javascript", "application/zip", "unknown", ""];
|
|
120
111
|
type Sip9ContentType = (typeof sip9ContentTypes)[number];
|
|
@@ -143,6 +134,10 @@ interface Sip9Asset extends BaseNonFungibleCryptoAsset {
|
|
|
143
134
|
readonly content: Sip9AssetContent;
|
|
144
135
|
readonly attributes?: Sip9Attribute[];
|
|
145
136
|
readonly collection?: Sip9Collection;
|
|
137
|
+
readonly creator?: string;
|
|
138
|
+
readonly floorPrice?: Money;
|
|
139
|
+
readonly latestSale?: Money;
|
|
140
|
+
readonly rarityRank?: number;
|
|
146
141
|
}
|
|
147
142
|
|
|
148
143
|
declare const CryptoAssetChains: {
|
|
@@ -271,6 +266,7 @@ interface StampAsset extends BaseNonFungibleCryptoAsset {
|
|
|
271
266
|
readonly stamp: number;
|
|
272
267
|
readonly stampUrl: string;
|
|
273
268
|
readonly stampExplorerUrl: string;
|
|
269
|
+
readonly blockHeight: number;
|
|
274
270
|
}
|
|
275
271
|
type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;
|
|
276
272
|
type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;
|
|
@@ -282,6 +278,7 @@ interface FungibleAssetId {
|
|
|
282
278
|
interface CryptoAssetId {
|
|
283
279
|
protocol: CryptoAssetProtocol;
|
|
284
280
|
id: string;
|
|
281
|
+
tokenId?: number;
|
|
285
282
|
}
|
|
286
283
|
|
|
287
284
|
declare function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset;
|
|
@@ -338,6 +335,36 @@ interface Fees {
|
|
|
338
335
|
calculation: FeeCalculationTypes;
|
|
339
336
|
}
|
|
340
337
|
|
|
338
|
+
declare const transactionFeeTiers: readonly ["low", "standard", "high"];
|
|
339
|
+
type TransactionFeeTier = (typeof transactionFeeTiers)[number];
|
|
340
|
+
interface TransactionFees {
|
|
341
|
+
readonly chain: Blockchain;
|
|
342
|
+
readonly options: Record<TransactionFeeTier, TransactionFeeQuote>;
|
|
343
|
+
}
|
|
344
|
+
declare const transactionFeeQuoteType: readonly ["flat", "feeRate", "evm1559"];
|
|
345
|
+
type TransactionFeeQuoteType = (typeof transactionFeeQuoteType)[number];
|
|
346
|
+
interface BaseTransactionFeeQuote {
|
|
347
|
+
readonly type: TransactionFeeQuoteType;
|
|
348
|
+
readonly value: Money;
|
|
349
|
+
}
|
|
350
|
+
interface FlatTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
351
|
+
readonly type: 'flat';
|
|
352
|
+
}
|
|
353
|
+
interface FeeRateTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
354
|
+
readonly type: 'feeRate';
|
|
355
|
+
readonly rate: number;
|
|
356
|
+
readonly rateUnit: 'sats/vB' | 'µSTX/byte';
|
|
357
|
+
readonly estimatedTxSize: number;
|
|
358
|
+
readonly sizeUnit: 'vB' | 'byte';
|
|
359
|
+
}
|
|
360
|
+
interface EvmTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
361
|
+
readonly type: 'evm1559';
|
|
362
|
+
readonly baseFeePerGas: Money;
|
|
363
|
+
readonly priorityFeePerGas: Money;
|
|
364
|
+
readonly gasLimit: number;
|
|
365
|
+
}
|
|
366
|
+
type TransactionFeeQuote = FlatTransactionFeeQuote | FeeRateTransactionFeeQuote | EvmTransactionFeeQuote;
|
|
367
|
+
|
|
341
368
|
interface MarketPair {
|
|
342
369
|
readonly base: Currency;
|
|
343
370
|
readonly quote: QuoteCurrency;
|
|
@@ -349,6 +376,17 @@ interface MarketData {
|
|
|
349
376
|
readonly price: Money;
|
|
350
377
|
}
|
|
351
378
|
declare function createMarketData(pair: MarketPair, price: Money): MarketData;
|
|
379
|
+
declare const historicalPeriods: readonly ["1d", "1w", "1m", "3m", "6m", "1y"];
|
|
380
|
+
type HistoricalPeriod = (typeof historicalPeriods)[number];
|
|
381
|
+
interface MarketPriceSnapshot {
|
|
382
|
+
price: Money;
|
|
383
|
+
timestamp: number;
|
|
384
|
+
}
|
|
385
|
+
interface MarketPriceHistory {
|
|
386
|
+
period: HistoricalPeriod;
|
|
387
|
+
changePercentage: number;
|
|
388
|
+
prices: MarketPriceSnapshot[];
|
|
389
|
+
}
|
|
352
390
|
|
|
353
391
|
declare const bitcoinNetworkModesSchema: z.ZodEnum<{
|
|
354
392
|
mainnet: "mainnet";
|
|
@@ -419,7 +457,16 @@ declare enum WalletDefaultNetworkConfigurationIds {
|
|
|
419
457
|
sbtcDevenv = "sbtcDevenv",
|
|
420
458
|
devnet = "devnet"
|
|
421
459
|
}
|
|
422
|
-
|
|
460
|
+
declare const defaultNetworkConfigurationsSchema: z.ZodEnum<{
|
|
461
|
+
mainnet: "mainnet";
|
|
462
|
+
testnet: "testnet";
|
|
463
|
+
signet: "signet";
|
|
464
|
+
testnet4: "testnet4";
|
|
465
|
+
sbtcTestnet: "sbtcTestnet";
|
|
466
|
+
sbtcDevenv: "sbtcDevenv";
|
|
467
|
+
devnet: "devnet";
|
|
468
|
+
}>;
|
|
469
|
+
type DefaultNetworkConfigurations = z.infer<typeof defaultNetworkConfigurationsSchema>;
|
|
423
470
|
declare const supportedBlockchains: readonly ["stacks", "bitcoin"];
|
|
424
471
|
type SupportedBlockchains = (typeof supportedBlockchains)[number];
|
|
425
472
|
declare const networkModes: readonly ["mainnet", "testnet"];
|
|
@@ -451,16 +498,48 @@ type NetworkConfiguration = z.infer<typeof networkConfigurationSchema>;
|
|
|
451
498
|
declare const defaultCurrentNetwork: NetworkConfiguration;
|
|
452
499
|
declare const defaultNetworksKeyedById: Record<WalletDefaultNetworkConfigurationIds, NetworkConfiguration>;
|
|
453
500
|
|
|
454
|
-
|
|
501
|
+
declare const accountDisplayPreferenceSchema: z.ZodEnum<{
|
|
502
|
+
stacks: "stacks";
|
|
503
|
+
"native-segwit": "native-segwit";
|
|
504
|
+
taproot: "taproot";
|
|
505
|
+
bns: "bns";
|
|
506
|
+
}>;
|
|
507
|
+
type AccountDisplayPreference = z.infer<typeof accountDisplayPreferenceSchema>;
|
|
455
508
|
interface AccountDisplayPreferenceInfo {
|
|
456
509
|
type: AccountDisplayPreference;
|
|
457
510
|
blockchain: Blockchain;
|
|
458
511
|
name: string;
|
|
459
512
|
}
|
|
460
|
-
|
|
513
|
+
declare const analyticsPreferenceSchema: z.ZodEnum<{
|
|
514
|
+
"consent-given": "consent-given";
|
|
515
|
+
"rejects-tracking": "rejects-tracking";
|
|
516
|
+
}>;
|
|
517
|
+
type AnalyticsPreference = z.infer<typeof analyticsPreferenceSchema>;
|
|
461
518
|
declare const emailAddressSchema: z.ZodEmail;
|
|
462
519
|
type EmailAddress = z.infer<typeof emailAddressSchema>;
|
|
463
520
|
|
|
521
|
+
interface BitcoinTransaction {
|
|
522
|
+
readonly txid: string;
|
|
523
|
+
readonly height?: number;
|
|
524
|
+
readonly time?: number;
|
|
525
|
+
readonly vin: BitcoinTransactionVin[];
|
|
526
|
+
readonly vout: BitcoinTransactionVout[];
|
|
527
|
+
}
|
|
528
|
+
interface BitcoinTransactionVin {
|
|
529
|
+
readonly n: number;
|
|
530
|
+
readonly txid?: string;
|
|
531
|
+
readonly owned?: boolean;
|
|
532
|
+
readonly address?: string;
|
|
533
|
+
readonly path?: string;
|
|
534
|
+
readonly value: string;
|
|
535
|
+
}
|
|
536
|
+
interface BitcoinTransactionVout {
|
|
537
|
+
readonly n: number;
|
|
538
|
+
readonly owned?: boolean;
|
|
539
|
+
readonly address?: string;
|
|
540
|
+
readonly path?: string;
|
|
541
|
+
readonly value: string;
|
|
542
|
+
}
|
|
464
543
|
interface BitcoinTransactionIssuance {
|
|
465
544
|
asset_id: string;
|
|
466
545
|
is_reissuance: boolean;
|
|
@@ -539,17 +618,17 @@ interface FtTransfer {
|
|
|
539
618
|
type TransactionErrorKey = 'InvalidAddress' | 'InsufficientFunds' | 'InvalidAmount' | 'InvalidNetworkAddress' | 'InvalidPrecision' | 'InvalidTransaction' | 'NonCompliantAddress';
|
|
540
619
|
|
|
541
620
|
interface UtxoId {
|
|
542
|
-
txid: string;
|
|
543
|
-
vout: number;
|
|
621
|
+
readonly txid: string;
|
|
622
|
+
readonly vout: number;
|
|
544
623
|
}
|
|
545
624
|
interface Utxo extends UtxoId {
|
|
546
|
-
height?: number;
|
|
547
|
-
value: number;
|
|
625
|
+
readonly height?: number;
|
|
626
|
+
readonly value: number;
|
|
548
627
|
}
|
|
549
628
|
interface OwnedUtxo extends Utxo {
|
|
550
|
-
address: string;
|
|
551
|
-
path: string;
|
|
552
|
-
keyOrigin: string;
|
|
629
|
+
readonly address: string;
|
|
630
|
+
readonly path: string;
|
|
631
|
+
readonly keyOrigin: string;
|
|
553
632
|
}
|
|
554
633
|
|
|
555
634
|
declare const ActivityLevels: {
|
|
@@ -728,6 +807,8 @@ interface BnsName {
|
|
|
728
807
|
name: string;
|
|
729
808
|
namespace: string;
|
|
730
809
|
fullName: string;
|
|
810
|
+
renewalHeight: number;
|
|
811
|
+
registeredAtBlockNumber: number;
|
|
731
812
|
}
|
|
732
813
|
interface BnsProfile {
|
|
733
814
|
bnsName: BnsName;
|
|
@@ -800,4 +881,4 @@ interface SbtcBridgeTransferSwapExecutionData extends BaseSwapExecutionData {
|
|
|
800
881
|
}
|
|
801
882
|
type SwapExecutionData = StacksContractCallSwapExecutionData | SbtcBridgeTransferSwapExecutionData;
|
|
802
883
|
|
|
803
|
-
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 BaseSwapExecutionData, type BaseWalletActivity, type BitcoinAddress, type BitcoinAddressInfo, type BitcoinChainConfig, type BitcoinNetwork, type BitcoinNetworkModes, type BitcoinTransactionVectorInput, type BitcoinTransactionVectorOutput, type BitcoinTx, type BitcoinUnit, type BitcoinUnitInfo, type BitcoinUnitSymbol, 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 ExecuteSmartContractActivity, FeeCalculationTypes, FeeTypes, type Fees, type FtTransfer, type FungibleAssetId, type FungibleCryptoAsset, type FungibleCryptoAssetProtocol, FungibleCryptoAssetProtocols, type GeneralActivity, type GeneralActivityType, GeneralActivityTypes, 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
|
|
884
|
+
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 BaseSwapExecutionData, type BaseTransactionFeeQuote, type BaseWalletActivity, type BitcoinAddress, type BitcoinAddressInfo, type BitcoinChainConfig, type BitcoinNetwork, type BitcoinNetworkModes, type BitcoinTransaction, type BitcoinTransactionVectorInput, type BitcoinTransactionVectorOutput, type BitcoinTransactionVin, type BitcoinTransactionVout, type BitcoinTx, type BitcoinUnit, type BitcoinUnitInfo, type BitcoinUnitSymbol, 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, FeeCalculationTypes, type FeeRateTransactionFeeQuote, FeeTypes, type Fees, type FlatTransactionFeeQuote, type FtTransfer, type FungibleAssetId, type FungibleCryptoAsset, type FungibleCryptoAssetProtocol, FungibleCryptoAssetProtocols, type GeneralActivity, type GeneralActivityType, GeneralActivityTypes, 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 HistoricalPeriod, type InscriptionAsset, type InscriptionMimeType, 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 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 StacksAddressInfo, type StacksChainConfig, type StacksContractCallSwapExecutionData, type StacksFeeEstimate, 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 WalletActivity, type WalletActivityType, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, type WalletId, accountAddressesSchema, accountDisplayPreferenceSchema, accountIdSchema, analyticsPreferenceSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, bitcoinUnitSchema, bnsContractAddress, bnsContractName, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworkConfigurationsSchema, defaultNetworksKeyedById, emailAddressSchema, formatMarketPair, historicalPeriods, inscriptionMimeTypes, isBrc20Asset, isBtcAsset, isFungibleAsset, isInscriptionAsset, isNativeAsset, isNonFungibleAsset, isRuneAsset, isSip10Asset, isSip9Asset, isSrc20Asset, isStampAsset, isStx20Asset, isStxAsset, isSwappableAsset, networkConfigurationSchema, networkModes, sip9ContentTypes, stacksAddressInfoSchema, supportedBlockchains, swapExecutionTypes, swapProviderIds, testnetModes, transactionFeeQuoteType, transactionFeeTiers, walletIdSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/bitcoin.model.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var bitcoinUnitSchema = z.enum(["bitcoin", "satoshi"]);
|
|
4
|
+
|
|
1
5
|
// src/assets/asset.model.ts
|
|
2
6
|
var CryptoAssetChains = {
|
|
3
7
|
bitcoin: "bitcoin",
|
|
@@ -154,6 +158,10 @@ var FeeCalculationTypes = /* @__PURE__ */ ((FeeCalculationTypes2) => {
|
|
|
154
158
|
return FeeCalculationTypes2;
|
|
155
159
|
})(FeeCalculationTypes || {});
|
|
156
160
|
|
|
161
|
+
// src/fees/transaction-fees.model.ts
|
|
162
|
+
var transactionFeeTiers = ["low", "standard", "high"];
|
|
163
|
+
var transactionFeeQuoteType = ["flat", "feeRate", "evm1559"];
|
|
164
|
+
|
|
157
165
|
// src/market.model.ts
|
|
158
166
|
function createMarketPair(base, quote) {
|
|
159
167
|
return Object.freeze({ base, quote });
|
|
@@ -166,8 +174,10 @@ function createMarketData(pair, price) {
|
|
|
166
174
|
throw new Error("Cannot create market data when price does not match quote");
|
|
167
175
|
return Object.freeze({ pair, price });
|
|
168
176
|
}
|
|
177
|
+
var historicalPeriods = ["1d", "1w", "1m", "3m", "6m", "1y"];
|
|
169
178
|
|
|
170
179
|
// src/network/network.model.ts
|
|
180
|
+
import { z as z2 } from "zod";
|
|
171
181
|
var HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
|
|
172
182
|
var HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
|
|
173
183
|
var HIRO_API_BASE_URL_NAKAMOTO_TESTNET = "https://api.nakamoto.testnet.hiro.so";
|
|
@@ -196,6 +206,15 @@ var WalletDefaultNetworkConfigurationIds = /* @__PURE__ */ ((WalletDefaultNetwor
|
|
|
196
206
|
WalletDefaultNetworkConfigurationIds2["devnet"] = "devnet";
|
|
197
207
|
return WalletDefaultNetworkConfigurationIds2;
|
|
198
208
|
})(WalletDefaultNetworkConfigurationIds || {});
|
|
209
|
+
var defaultNetworkConfigurationsSchema = z2.enum([
|
|
210
|
+
"mainnet",
|
|
211
|
+
"testnet",
|
|
212
|
+
"testnet4",
|
|
213
|
+
"signet",
|
|
214
|
+
"sbtcTestnet",
|
|
215
|
+
"sbtcDevenv",
|
|
216
|
+
"devnet"
|
|
217
|
+
]);
|
|
199
218
|
var supportedBlockchains = ["stacks", "bitcoin"];
|
|
200
219
|
var networkModes = ["mainnet", "testnet"];
|
|
201
220
|
var testnetModes = ["testnet", "regtest", "signet"];
|
|
@@ -347,31 +366,33 @@ var defaultNetworksKeyedById = {
|
|
|
347
366
|
};
|
|
348
367
|
|
|
349
368
|
// src/network/network.schema.ts
|
|
350
|
-
import { z } from "zod";
|
|
351
|
-
var bitcoinNetworkModesSchema =
|
|
352
|
-
var bitcoinNetworkSchema =
|
|
353
|
-
var networkConfigurationSchema =
|
|
354
|
-
name:
|
|
355
|
-
id:
|
|
356
|
-
chain:
|
|
357
|
-
bitcoin:
|
|
358
|
-
blockchain:
|
|
359
|
-
bitcoinUrl:
|
|
369
|
+
import { z as z3 } from "zod";
|
|
370
|
+
var bitcoinNetworkModesSchema = z3.enum([...networkModes, ...testnetModes]);
|
|
371
|
+
var bitcoinNetworkSchema = z3.enum([...bitcoinNetworks]);
|
|
372
|
+
var networkConfigurationSchema = z3.object({
|
|
373
|
+
name: z3.string(),
|
|
374
|
+
id: z3.string(),
|
|
375
|
+
chain: z3.object({
|
|
376
|
+
bitcoin: z3.object({
|
|
377
|
+
blockchain: z3.literal("bitcoin"),
|
|
378
|
+
bitcoinUrl: z3.string(),
|
|
360
379
|
bitcoinNetwork: bitcoinNetworkSchema,
|
|
361
380
|
mode: bitcoinNetworkModesSchema
|
|
362
381
|
}),
|
|
363
|
-
stacks:
|
|
364
|
-
blockchain:
|
|
365
|
-
url:
|
|
366
|
-
chainId:
|
|
367
|
-
subnetChainId:
|
|
382
|
+
stacks: z3.object({
|
|
383
|
+
blockchain: z3.literal("stacks"),
|
|
384
|
+
url: z3.string(),
|
|
385
|
+
chainId: z3.number(),
|
|
386
|
+
subnetChainId: z3.number().optional()
|
|
368
387
|
})
|
|
369
388
|
})
|
|
370
389
|
});
|
|
371
390
|
|
|
372
391
|
// src/settings.model.ts
|
|
373
|
-
import { z as
|
|
374
|
-
var
|
|
392
|
+
import { z as z4 } from "zod";
|
|
393
|
+
var accountDisplayPreferenceSchema = z4.enum(["native-segwit", "taproot", "bns", "stacks"]);
|
|
394
|
+
var analyticsPreferenceSchema = z4.enum(["consent-given", "rejects-tracking"]);
|
|
395
|
+
var emailAddressSchema = z4.email({ error: "Invalid email address" });
|
|
375
396
|
|
|
376
397
|
// src/activity/activity-level.model.ts
|
|
377
398
|
var ActivityLevels = {
|
|
@@ -406,21 +427,21 @@ var GeneralActivityTypes = {
|
|
|
406
427
|
};
|
|
407
428
|
|
|
408
429
|
// src/account.model.ts
|
|
409
|
-
import { z as
|
|
410
|
-
var walletIdSchema =
|
|
411
|
-
fingerprint:
|
|
430
|
+
import { z as z5 } from "zod";
|
|
431
|
+
var walletIdSchema = z5.object({
|
|
432
|
+
fingerprint: z5.string()
|
|
412
433
|
});
|
|
413
|
-
var accountIdSchema = walletIdSchema.and(
|
|
414
|
-
var bitcoinAddressInfoSchema =
|
|
415
|
-
taprootDescriptor:
|
|
416
|
-
nativeSegwitDescriptor:
|
|
417
|
-
zeroIndexTaprootPayerAddress:
|
|
418
|
-
zeroIndexNativeSegwitPayerAddress:
|
|
434
|
+
var accountIdSchema = walletIdSchema.and(z5.object({ accountIndex: z5.number() }));
|
|
435
|
+
var bitcoinAddressInfoSchema = z5.object({
|
|
436
|
+
taprootDescriptor: z5.string(),
|
|
437
|
+
nativeSegwitDescriptor: z5.string(),
|
|
438
|
+
zeroIndexTaprootPayerAddress: z5.string().optional(),
|
|
439
|
+
zeroIndexNativeSegwitPayerAddress: z5.string().optional()
|
|
419
440
|
});
|
|
420
|
-
var stacksAddressInfoSchema =
|
|
421
|
-
stxAddress:
|
|
441
|
+
var stacksAddressInfoSchema = z5.object({
|
|
442
|
+
stxAddress: z5.string()
|
|
422
443
|
});
|
|
423
|
-
var accountAddressesSchema =
|
|
444
|
+
var accountAddressesSchema = z5.object({
|
|
424
445
|
id: accountIdSchema,
|
|
425
446
|
bitcoin: bitcoinAddressInfoSchema.optional(),
|
|
426
447
|
stacks: stacksAddressInfoSchema.optional()
|
|
@@ -466,21 +487,26 @@ export {
|
|
|
466
487
|
WalletActivityTypes,
|
|
467
488
|
WalletDefaultNetworkConfigurationIds,
|
|
468
489
|
accountAddressesSchema,
|
|
490
|
+
accountDisplayPreferenceSchema,
|
|
469
491
|
accountIdSchema,
|
|
492
|
+
analyticsPreferenceSchema,
|
|
470
493
|
bitcoinAddressInfoSchema,
|
|
471
494
|
bitcoinNetworkModesSchema,
|
|
472
495
|
bitcoinNetworkSchema,
|
|
473
496
|
bitcoinNetworkToNetworkMode,
|
|
474
497
|
bitcoinNetworks,
|
|
498
|
+
bitcoinUnitSchema,
|
|
475
499
|
bnsContractAddress,
|
|
476
500
|
bnsContractName,
|
|
477
501
|
btcTxTimeMap,
|
|
478
502
|
createMarketData,
|
|
479
503
|
createMarketPair,
|
|
480
504
|
defaultCurrentNetwork,
|
|
505
|
+
defaultNetworkConfigurationsSchema,
|
|
481
506
|
defaultNetworksKeyedById,
|
|
482
507
|
emailAddressSchema,
|
|
483
508
|
formatMarketPair,
|
|
509
|
+
historicalPeriods,
|
|
484
510
|
inscriptionMimeTypes,
|
|
485
511
|
isBrc20Asset,
|
|
486
512
|
isBtcAsset,
|
|
@@ -504,6 +530,8 @@ export {
|
|
|
504
530
|
swapExecutionTypes,
|
|
505
531
|
swapProviderIds,
|
|
506
532
|
testnetModes,
|
|
533
|
+
transactionFeeQuoteType,
|
|
534
|
+
transactionFeeTiers,
|
|
507
535
|
walletIdSchema
|
|
508
536
|
};
|
|
509
537
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/assets/asset.model.ts","../src/assets/asset-type-guards.ts","../src/assets/sip9-asset.model.ts","../src/inscription-mime-type.model.ts","../src/fees/bitcoin-fees.model.ts","../src/fees/fees.model.ts","../src/market.model.ts","../src/network/network.model.ts","../src/network/network.schema.ts","../src/settings.model.ts","../src/activity/activity-level.model.ts","../src/activity/activity-status.model.ts","../src/activity/activity-type.model.ts","../src/account.model.ts","../src/bns.model.ts","../src/swap/swap.model.ts"],"sourcesContent":["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 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}\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 {\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 { 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}\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}\n","import { InscriptionAsset } from './assets/asset.model';\n\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\n/* Deprecated: Made obsolete by InscriptionAsset; Will be removed */\nexport interface Inscription extends InscriptionAsset {\n preview: string;\n src: string;\n title: string;\n output: string;\n txid: string;\n offset: string;\n address: string;\n genesisBlockHash: string;\n genesisTimestamp: number;\n genesisBlockHeight: number;\n value: 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 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","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 type DefaultNetworkConfigurations = keyof typeof WalletDefaultNetworkConfigurationIds;\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 type AccountDisplayPreference = 'native-segwit' | 'taproot' | 'bns' | 'stacks';\nexport interface AccountDisplayPreferenceInfo {\n type: AccountDisplayPreference;\n blockchain: Blockchain;\n name: string;\n}\n\nexport type AnalyticsPreference = 'consent-given' | 'rejects-tracking';\n\nexport const emailAddressSchema = z.email({ error: 'Invalid email address' });\nexport type EmailAddress = z.infer<typeof emailAddressSchema>;\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 { 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 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}\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 { 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"],"mappings":";AAGO,IAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,QAAQ;AACV;AACO,IAAM,wBAAwB;AAAA,EACnC,UAAU;AAAA,EACV,KAAK;AACP;AACO,IAAM,+BAA+B;AAAA,EAC1C,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AACR;AACO,IAAM,kCAAkC;AAAA,EAC7C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AACf;AACO,IAAM,uBAAuB;AAAA,EAClC,GAAG;AAAA,EACH,GAAG;AACL;;;ACXO,SAAS,gBAAgB,OAAkD;AAChF,SAAO,MAAM,aAAa;AAC5B;AAEO,SAAS,mBAAmB,OAAqD;AACtF,SAAO,MAAM,aAAa;AAC5B;AAEO,SAAS,WAAW,OAAuC;AAChE,SAAO,MAAM,aAAa;AAC5B;AAEO,SAAS,WAAW,OAAuC;AAChE,SAAO,MAAM,aAAa;AAC5B;AAEO,SAAS,cAAc,OAAgD;AAC5E,SAAO,WAAW,KAAK,KAAK,WAAW,KAAK;AAC9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ACtB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd;AAGO,IAAM,sBAAsB;AAAA,EACjC,YAAY;AAAA,EACZ,aAAa;AACf;AAGO,IAAM,uBAAuB;AAAA,EAClC,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,6BAA6B;AAC/B;;;ACpBA,SAAS,KAAAC,UAAS;AAEX,IAAM,iBAAiBA,GAAE,OAAO;AAAA,EACrC,aAAaA,GAAE,OAAO;AACxB,CAAC;AAEM,IAAM,kBAAkB,eAAe,IAAIA,GAAE,OAAO,EAAE,cAAcA,GAAE,OAAO,EAAE,CAAC,CAAC;AAEjF,IAAM,2BAA2BA,GAAE,OAAO;AAAA,EAC/C,mBAAmBA,GAAE,OAAO;AAAA,EAC5B,wBAAwBA,GAAE,OAAO;AAAA,EACjC,8BAA8BA,GAAE,OAAO,EAAE,SAAS;AAAA,EAClD,mCAAmCA,GAAE,OAAO,EAAE,SAAS;AACzD,CAAC;AAEM,IAAM,0BAA0BA,GAAE,OAAO;AAAA,EAC9C,YAAYA,GAAE,OAAO;AACvB,CAAC;AAEM,IAAM,yBAAyBA,GAAE,OAAO;AAAA,EAC7C,IAAI;AAAA,EACJ,SAAS,yBAAyB,SAAS;AAAA,EAC3C,QAAQ,wBAAwB,SAAS;AAC3C,CAAC;;;ACvBM,IAAM,qBAAqB;AAAA,EAChC,SAAS;AAAA,EACT,SAAS;AACX;AAEO,IAAM,kBAAkB;;;ACMxB,IAAM,kBAAkB,CAAC,eAAe,eAAe,YAAY,WAAW;AAgC9E,IAAM,qBAAqB,CAAC,wBAAwB,sBAAsB;","names":["BtcFeeType","FeeTypes","FeeCalculationTypes","ChainId","WalletDefaultNetworkConfigurationIds","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/bitcoin.model.ts","../src/assets/asset.model.ts","../src/assets/asset-type-guards.ts","../src/assets/sip9-asset.model.ts","../src/inscription-mime-type.model.ts","../src/fees/bitcoin-fees.model.ts","../src/fees/fees.model.ts","../src/fees/transaction-fees.model.ts","../src/market.model.ts","../src/network/network.model.ts","../src/network/network.schema.ts","../src/settings.model.ts","../src/activity/activity-level.model.ts","../src/activity/activity-status.model.ts","../src/activity/activity-type.model.ts","../src/account.model.ts","../src/bns.model.ts","../src/swap/swap.model.ts"],"sourcesContent":["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","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 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 {\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 { 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}\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 floorPrice?: Money;\n readonly latestSale?: Money;\n readonly rarityRank?: number;\n}\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 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 = ['flat', 'feeRate', 'evm1559'] 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 FeeRateTransactionFeeQuote extends BaseTransactionFeeQuote {\n readonly type: 'feeRate';\n readonly rate: number;\n readonly rateUnit: 'sats/vB' | 'µSTX/byte';\n readonly estimatedTxSize: number;\n readonly sizeUnit: 'vB' | '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 | FeeRateTransactionFeeQuote\n | EvmTransactionFeeQuote;\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","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 { 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 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 { 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"],"mappings":";AAAA,SAAS,SAAS;AAKX,IAAM,oBAAoB,EAAE,KAAK,CAAC,WAAW,SAAS,CAAC;;;ACFvD,IAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,QAAQ;AACV;AACO,IAAM,wBAAwB;AAAA,EACnC,UAAU;AAAA,EACV,KAAK;AACP;AACO,IAAM,+BAA+B;AAAA,EAC1C,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AA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iBAAiBA,GAAE,OAAO;AAAA,EACrC,aAAaA,GAAE,OAAO;AACxB,CAAC;AAEM,IAAM,kBAAkB,eAAe,IAAIA,GAAE,OAAO,EAAE,cAAcA,GAAE,OAAO,EAAE,CAAC,CAAC;AAEjF,IAAM,2BAA2BA,GAAE,OAAO;AAAA,EAC/C,mBAAmBA,GAAE,OAAO;AAAA,EAC5B,wBAAwBA,GAAE,OAAO;AAAA,EACjC,8BAA8BA,GAAE,OAAO,EAAE,SAAS;AAAA,EAClD,mCAAmCA,GAAE,OAAO,EAAE,SAAS;AACzD,CAAC;AAEM,IAAM,0BAA0BA,GAAE,OAAO;AAAA,EAC9C,YAAYA,GAAE,OAAO;AACvB,CAAC;AAEM,IAAM,yBAAyBA,GAAE,OAAO;AAAA,EAC7C,IAAI;AAAA,EACJ,SAAS,yBAAyB,SAAS;AAAA,EAC3C,QAAQ,wBAAwB,SAAS;AAC3C,CAAC;;;ACvBM,IAAM,qBAAqB;AAAA,EAChC,SAAS;AAAA,EACT,SAAS;AACX;AAEO,IAAM,kBAAkB;;;ACMxB,IAAM,kBAAkB,CAAC,eAAe,eAAe,YAAY,WAAW;AAgC9E,IAAM,qBAAqB,CAAC,wBAAwB,sBAAsB;","names":["BtcFeeType","FeeTypes","FeeCalculationTypes","z","ChainId","WalletDefaultNetworkConfigurationIds","z","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.
|
|
5
|
+
"version": "0.46.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/leather-io/mono/tree/dev/packages/models",
|
|
8
8
|
"repository": {
|
|
@@ -131,6 +131,7 @@ export interface StampAsset extends BaseNonFungibleCryptoAsset {
|
|
|
131
131
|
readonly stamp: number;
|
|
132
132
|
readonly stampUrl: string;
|
|
133
133
|
readonly stampExplorerUrl: string;
|
|
134
|
+
readonly blockHeight: number;
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
export type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Money } from '../money.model';
|
|
1
2
|
import { BaseNonFungibleCryptoAsset } from './asset.model';
|
|
2
3
|
|
|
3
4
|
export const sip9ContentTypes = [
|
|
@@ -70,4 +71,8 @@ export interface Sip9Asset extends BaseNonFungibleCryptoAsset {
|
|
|
70
71
|
readonly content: Sip9AssetContent;
|
|
71
72
|
readonly attributes?: Sip9Attribute[];
|
|
72
73
|
readonly collection?: Sip9Collection;
|
|
74
|
+
readonly creator?: string;
|
|
75
|
+
readonly floorPrice?: Money;
|
|
76
|
+
readonly latestSale?: Money;
|
|
77
|
+
readonly rarityRank?: number;
|
|
73
78
|
}
|
package/src/balance.model.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface BaseCryptoAssetBalance {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly pendingBalance: Money;
|
|
20
20
|
/**
|
|
21
|
-
* totalBalance after filtering out outboundBalance, protectedBalance, and
|
|
21
|
+
* totalBalance after filtering out outboundBalance, protectedBalance, and dustBalance
|
|
22
22
|
*/
|
|
23
23
|
readonly availableBalance: Money;
|
|
24
24
|
}
|
|
@@ -29,12 +29,11 @@ export interface BtcBalance extends BaseCryptoAssetBalance {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly protectedBalance: Money;
|
|
31
31
|
/**
|
|
32
|
-
* Balance across UTXOs with
|
|
32
|
+
* Balance across UTXOs with value less than dust threshold
|
|
33
33
|
*/
|
|
34
|
-
readonly
|
|
35
|
-
|
|
34
|
+
readonly dustBalance: Money;
|
|
36
35
|
/**
|
|
37
|
-
* Balance of the union set of protected and
|
|
36
|
+
* Balance of the union set of protected and dust UTXOs
|
|
38
37
|
*/
|
|
39
38
|
readonly unspendableBalance: Money;
|
|
40
39
|
}
|
package/src/bitcoin.model.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
1
3
|
// Branded type for Bitcoin addresses
|
|
2
4
|
export type BitcoinAddress = string & { readonly __brand: unique symbol };
|
|
3
5
|
|
|
4
|
-
export
|
|
6
|
+
export const bitcoinUnitSchema = z.enum(['bitcoin', 'satoshi']);
|
|
7
|
+
export type BitcoinUnit = z.infer<typeof bitcoinUnitSchema>;
|
|
5
8
|
|
|
6
9
|
export type BitcoinUnitSymbol = 'BTC' | 'sat';
|
|
7
10
|
|
package/src/bns.model.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Money } from '../money.model';
|
|
2
|
+
import { Blockchain } from '../types';
|
|
3
|
+
|
|
4
|
+
export const transactionFeeTiers = ['low', 'standard', 'high'] as const;
|
|
5
|
+
export type TransactionFeeTier = (typeof transactionFeeTiers)[number];
|
|
6
|
+
|
|
7
|
+
export interface TransactionFees {
|
|
8
|
+
readonly chain: Blockchain;
|
|
9
|
+
readonly options: Record<TransactionFeeTier, TransactionFeeQuote>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const transactionFeeQuoteType = ['flat', 'feeRate', 'evm1559'] as const;
|
|
13
|
+
export type TransactionFeeQuoteType = (typeof transactionFeeQuoteType)[number];
|
|
14
|
+
|
|
15
|
+
export interface BaseTransactionFeeQuote {
|
|
16
|
+
readonly type: TransactionFeeQuoteType;
|
|
17
|
+
readonly value: Money;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface FlatTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
21
|
+
readonly type: 'flat';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface FeeRateTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
25
|
+
readonly type: 'feeRate';
|
|
26
|
+
readonly rate: number;
|
|
27
|
+
readonly rateUnit: 'sats/vB' | 'µSTX/byte';
|
|
28
|
+
readonly estimatedTxSize: number;
|
|
29
|
+
readonly sizeUnit: 'vB' | 'byte';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface EvmTransactionFeeQuote extends BaseTransactionFeeQuote {
|
|
33
|
+
readonly type: 'evm1559';
|
|
34
|
+
readonly baseFeePerGas: Money;
|
|
35
|
+
readonly priorityFeePerGas: Money;
|
|
36
|
+
readonly gasLimit: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type TransactionFeeQuote =
|
|
40
|
+
| FlatTransactionFeeQuote
|
|
41
|
+
| FeeRateTransactionFeeQuote
|
|
42
|
+
| EvmTransactionFeeQuote;
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './currencies.model';
|
|
|
9
9
|
export * from './fees/bitcoin-fees.model';
|
|
10
10
|
export * from './fees/fees.model';
|
|
11
11
|
export * from './fees/stacks-fees.model';
|
|
12
|
+
export * from './fees/transaction-fees.model';
|
|
12
13
|
export * from './market.model';
|
|
13
14
|
export * from './types';
|
|
14
15
|
export * from './types.utils';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { InscriptionAsset } from './assets/asset.model';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Inscriptions contain arbitrary data. When retrieving an inscription, it should be
|
|
5
3
|
* classified into one of the types below, indicating that the app can handle it
|
|
@@ -18,18 +16,3 @@ export const inscriptionMimeTypes = [
|
|
|
18
16
|
] as const;
|
|
19
17
|
|
|
20
18
|
export type InscriptionMimeType = (typeof inscriptionMimeTypes)[number];
|
|
21
|
-
|
|
22
|
-
/* Deprecated: Made obsolete by InscriptionAsset; Will be removed */
|
|
23
|
-
export interface Inscription extends InscriptionAsset {
|
|
24
|
-
preview: string;
|
|
25
|
-
src: string;
|
|
26
|
-
title: string;
|
|
27
|
-
output: string;
|
|
28
|
-
txid: string;
|
|
29
|
-
offset: string;
|
|
30
|
-
address: string;
|
|
31
|
-
genesisBlockHash: string;
|
|
32
|
-
genesisTimestamp: number;
|
|
33
|
-
genesisBlockHeight: number;
|
|
34
|
-
value: string;
|
|
35
|
-
}
|
package/src/market.model.ts
CHANGED
|
@@ -24,3 +24,17 @@ export function createMarketData(pair: MarketPair, price: Money): MarketData {
|
|
|
24
24
|
throw new Error('Cannot create market data when price does not match quote');
|
|
25
25
|
return Object.freeze({ pair, price });
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export const historicalPeriods = ['1d', '1w', '1m', '3m', '6m', '1y'] as const;
|
|
29
|
+
export type HistoricalPeriod = (typeof historicalPeriods)[number];
|
|
30
|
+
|
|
31
|
+
export interface MarketPriceSnapshot {
|
|
32
|
+
price: Money;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface MarketPriceHistory {
|
|
37
|
+
period: HistoricalPeriod;
|
|
38
|
+
changePercentage: number;
|
|
39
|
+
prices: MarketPriceSnapshot[];
|
|
40
|
+
}
|
|
@@ -38,7 +38,16 @@ export enum WalletDefaultNetworkConfigurationIds {
|
|
|
38
38
|
devnet = 'devnet',
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export
|
|
41
|
+
export const defaultNetworkConfigurationsSchema = z.enum([
|
|
42
|
+
'mainnet',
|
|
43
|
+
'testnet',
|
|
44
|
+
'testnet4',
|
|
45
|
+
'signet',
|
|
46
|
+
'sbtcTestnet',
|
|
47
|
+
'sbtcDevenv',
|
|
48
|
+
'devnet',
|
|
49
|
+
]);
|
|
50
|
+
export type DefaultNetworkConfigurations = z.infer<typeof defaultNetworkConfigurationsSchema>;
|
|
42
51
|
|
|
43
52
|
export const supportedBlockchains = ['stacks', 'bitcoin'] as const;
|
|
44
53
|
|
package/src/settings.model.ts
CHANGED
|
@@ -2,14 +2,17 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
import { Blockchain } from './types';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export const accountDisplayPreferenceSchema = z.enum(['native-segwit', 'taproot', 'bns', 'stacks']);
|
|
6
|
+
export type AccountDisplayPreference = z.infer<typeof accountDisplayPreferenceSchema>;
|
|
7
|
+
|
|
6
8
|
export interface AccountDisplayPreferenceInfo {
|
|
7
9
|
type: AccountDisplayPreference;
|
|
8
10
|
blockchain: Blockchain;
|
|
9
11
|
name: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export
|
|
14
|
+
export const analyticsPreferenceSchema = z.enum(['consent-given', 'rejects-tracking']);
|
|
15
|
+
export type AnalyticsPreference = z.infer<typeof analyticsPreferenceSchema>;
|
|
13
16
|
|
|
14
17
|
export const emailAddressSchema = z.email({ error: 'Invalid email address' });
|
|
15
18
|
export type EmailAddress = z.infer<typeof emailAddressSchema>;
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
export interface BitcoinTransaction {
|
|
2
|
+
readonly txid: string;
|
|
3
|
+
readonly height?: number;
|
|
4
|
+
readonly time?: number;
|
|
5
|
+
readonly vin: BitcoinTransactionVin[];
|
|
6
|
+
readonly vout: BitcoinTransactionVout[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BitcoinTransactionVin {
|
|
10
|
+
readonly n: number;
|
|
11
|
+
readonly txid?: string;
|
|
12
|
+
readonly owned?: boolean;
|
|
13
|
+
readonly address?: string;
|
|
14
|
+
readonly path?: string;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface BitcoinTransactionVout {
|
|
19
|
+
readonly n: number;
|
|
20
|
+
readonly owned?: boolean;
|
|
21
|
+
readonly address?: string;
|
|
22
|
+
readonly path?: string;
|
|
23
|
+
readonly value: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// EXTERNAL LEGACY MODEL - To be replaced by internal type: BitcoinTransaction
|
|
27
|
+
// -- Source: https://github.com/Blockstream/esplora/blob/master/API.md#transaction-format
|
|
2
28
|
interface BitcoinTransactionIssuance {
|
|
3
29
|
asset_id: string;
|
|
4
30
|
is_reissuance: boolean;
|
package/src/utxo.model.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export interface UtxoId {
|
|
2
|
-
txid: string;
|
|
3
|
-
vout: number;
|
|
2
|
+
readonly txid: string;
|
|
3
|
+
readonly vout: number;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export interface Utxo extends UtxoId {
|
|
7
|
-
height?: number; // no height indicates unconfirmed tx
|
|
8
|
-
value: number; // sats
|
|
7
|
+
readonly height?: number; // no height indicates unconfirmed tx
|
|
8
|
+
readonly value: number; // sats
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface OwnedUtxo extends Utxo {
|
|
12
|
-
address: string;
|
|
13
|
-
path: string;
|
|
14
|
-
keyOrigin: string;
|
|
12
|
+
readonly address: string;
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly keyOrigin: string;
|
|
15
15
|
}
|