@leather.io/models 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @leather.io/models@0.40.0 build /home/runner/work/mono/mono/packages/models
2
+ > @leather.io/models@0.42.0 build /home/runner/work/mono/mono/packages/models
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,9 +8,9 @@
8
8
  CLI Using tsup config: /home/runner/work/mono/mono/packages/models/tsup.config.ts
9
9
  CLI Target: es2022
10
10
  ESM Build start
11
- ESM dist/index.js 10.70 KB
12
- ESM dist/index.js.map 23.10 KB
13
- ESM ⚡️ Build success in 26ms
11
+ ESM dist/index.js 12.43 KB
12
+ ESM dist/index.js.map 29.06 KB
13
+ ESM ⚡️ Build success in 34ms
14
14
  DTS Build start
15
- DTS ⚡️ Build success in 2062ms
16
- DTS dist/index.d.ts 24.14 KB
15
+ DTS ⚡️ Build success in 2831ms
16
+ DTS dist/index.d.ts 28.92 KB
package/CHANGELOG.md CHANGED
@@ -30,6 +30,22 @@
30
30
  * devDependencies
31
31
  * @leather.io/tsconfig-config bumped to 0.8.0
32
32
 
33
+ ## [0.42.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.41.0...@leather.io/models-v0.42.0) (2025-09-26)
34
+
35
+
36
+ ### Features
37
+
38
+ * create swap service ([168dcbf](https://github.com/leather-io/mono/commit/168dcbfde42ceda8ffd8982d1191d7ce6de70b2f))
39
+ * **mobile:** integrate gamma API ([c271a62](https://github.com/leather-io/mono/commit/c271a62111ab6a876bbfd3d1fb1dd59ece70d4f2))
40
+ * **models:** add user defined type guards for asset types ([353ea63](https://github.com/leather-io/mono/commit/353ea6386b5b458a6bd4a9d2db0ca5d0da30d6af))
41
+
42
+ ## [0.41.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.40.0...@leather.io/models-v0.41.0) (2025-09-04)
43
+
44
+
45
+ ### Features
46
+
47
+ * add bns types and app-layer service ([fb47a28](https://github.com/leather-io/mono/commit/fb47a2884eab5a6a20ecc089af8ef8b21ee16df5))
48
+
33
49
  ## [0.40.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.39.1...@leather.io/models-v0.40.0) (2025-08-26)
34
50
 
35
51
 
package/dist/index.d.ts CHANGED
@@ -124,7 +124,7 @@ declare const CryptoAssetCategories: {
124
124
  readonly fungible: "fungible";
125
125
  readonly nft: "nft";
126
126
  };
127
- declare const CryptoAssetProtocols: {
127
+ declare const FungibleCryptoAssetProtocols: {
128
128
  readonly nativeBtc: "nativeBtc";
129
129
  readonly nativeStx: "nativeStx";
130
130
  readonly sip10: "sip10";
@@ -132,13 +132,29 @@ declare const CryptoAssetProtocols: {
132
132
  readonly src20: "src20";
133
133
  readonly stx20: "stx20";
134
134
  readonly rune: "rune";
135
+ };
136
+ declare const NonFungibleCryptoAssetProtocols: {
135
137
  readonly stamp: "stamp";
136
138
  readonly sip9: "sip9";
137
139
  readonly inscription: "inscription";
138
140
  };
141
+ declare const CryptoAssetProtocols: {
142
+ readonly stamp: "stamp";
143
+ readonly sip9: "sip9";
144
+ readonly inscription: "inscription";
145
+ readonly nativeBtc: "nativeBtc";
146
+ readonly nativeStx: "nativeStx";
147
+ readonly sip10: "sip10";
148
+ readonly brc20: "brc20";
149
+ readonly src20: "src20";
150
+ readonly stx20: "stx20";
151
+ readonly rune: "rune";
152
+ };
139
153
  type CryptoAssetChain = keyof typeof CryptoAssetChains;
140
154
  type CryptoAssetCategory = keyof typeof CryptoAssetCategories;
141
- type CryptoAssetProtocol = keyof typeof CryptoAssetProtocols;
155
+ type FungibleCryptoAssetProtocol = keyof typeof FungibleCryptoAssetProtocols;
156
+ type NonFungibleCryptoAssetProtocol = keyof typeof NonFungibleCryptoAssetProtocols;
157
+ type CryptoAssetProtocol = FungibleCryptoAssetProtocol | NonFungibleCryptoAssetProtocol;
142
158
  interface BaseCryptoAsset {
143
159
  readonly chain: CryptoAssetChain;
144
160
  readonly category: CryptoAssetCategory;
@@ -146,6 +162,7 @@ interface BaseCryptoAsset {
146
162
  }
147
163
  interface BaseFungibleCryptoAsset extends BaseCryptoAsset {
148
164
  readonly category: 'fungible';
165
+ readonly protocol: FungibleCryptoAssetProtocol;
149
166
  readonly symbol: string;
150
167
  readonly decimals: number;
151
168
  readonly hasMemo: boolean;
@@ -199,6 +216,7 @@ type NativeCryptoAsset = BtcAsset | StxAsset;
199
216
  type FungibleCryptoAsset = NativeCryptoAsset | Sip10Asset | Brc20Asset | Src20Asset | Stx20Asset | RuneAsset;
200
217
  interface BaseNonFungibleCryptoAsset extends BaseCryptoAsset {
201
218
  readonly category: 'nft';
219
+ readonly protocol: NonFungibleCryptoAssetProtocol;
202
220
  }
203
221
  interface InscriptionAsset extends BaseNonFungibleCryptoAsset {
204
222
  readonly chain: 'bitcoin';
@@ -230,20 +248,49 @@ interface Sip9Asset extends BaseNonFungibleCryptoAsset {
230
248
  readonly assetId: string;
231
249
  readonly contractId: string;
232
250
  readonly tokenId: number;
233
- readonly collection: string;
234
251
  readonly name: string;
235
252
  readonly description: string;
236
253
  readonly cachedImage: string;
237
254
  readonly cachedImageThumbnail: string;
255
+ readonly contentType: string;
256
+ readonly collection: {
257
+ id: string;
258
+ name: string;
259
+ isVerified: boolean;
260
+ locationUrl: string;
261
+ totalItems: number;
262
+ floorPriceAmount: {
263
+ amount: number;
264
+ unit: string;
265
+ };
266
+ };
238
267
  }
239
268
  type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;
240
269
  type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;
270
+ interface FungibleAssetId {
271
+ protocol: FungibleCryptoAssetProtocol;
272
+ id: string;
273
+ }
241
274
 
242
275
  interface CryptoAssetId {
243
276
  protocol: CryptoAssetProtocol;
244
277
  id: string;
245
278
  }
246
279
 
280
+ declare function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset;
281
+ declare function isNonFungibleAsset(asset: CryptoAsset): asset is NonFungibleCryptoAsset;
282
+ declare function isBtcAsset(asset: CryptoAsset): asset is BtcAsset;
283
+ declare function isStxAsset(asset: CryptoAsset): asset is StxAsset;
284
+ declare function isNativeAsset(asset: CryptoAsset): asset is NativeCryptoAsset;
285
+ declare function isSip10Asset(asset: CryptoAsset): asset is Sip10Asset;
286
+ declare function isBrc20Asset(asset: CryptoAsset): asset is Brc20Asset;
287
+ declare function isSrc20Asset(asset: CryptoAsset): asset is Src20Asset;
288
+ declare function isStx20Asset(asset: CryptoAsset): asset is Stx20Asset;
289
+ declare function isRuneAsset(asset: CryptoAsset): asset is RuneAsset;
290
+ declare function isInscriptionAsset(asset: CryptoAsset): asset is InscriptionAsset;
291
+ declare function isStampAsset(asset: CryptoAsset): asset is StampAsset;
292
+ declare function isSip9Asset(asset: CryptoAsset): asset is Sip9Asset;
293
+
247
294
  interface AverageBitcoinFeeRates {
248
295
  fastestFee: BigNumber;
249
296
  halfHourFee: BigNumber;
@@ -340,7 +387,6 @@ declare const networkConfigurationSchema: z.ZodObject<{
340
387
 
341
388
  declare const HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
342
389
  declare const HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
343
- declare const HIRO_INSCRIPTIONS_API_URL = "https://api.hiro.so/ordinals/v1/inscriptions";
344
390
  declare const HIRO_API_BASE_URL_NAKAMOTO_TESTNET = "https://api.nakamoto.testnet.hiro.so";
345
391
  declare const HIRO_API_BASE_URL_MAINNET_EXTENDED = "https://api.hiro.so/extended/v1";
346
392
  declare const HIRO_API_BASE_URL_TESTNET_EXTENDED = "https://api.testnet.hiro.so/extended";
@@ -660,4 +706,85 @@ type OnChainActivity = DeploySmartContractActivity | ExecuteSmartContractActivit
660
706
  type WalletActivity = ConnectAppActivity | SignMessageActivity;
661
707
  type Activity = OnChainActivity | WalletActivity | GeneralActivity;
662
708
 
663
- 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 BaseOnChainActivity, 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 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 FungibleCryptoAsset, 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, HIRO_INSCRIPTIONS_API_URL, type Inscription, type InscriptionAsset, type InscriptionMimeType, type LiteralUnion, type LockAssetActivity, type MarketData, type Money, type NativeCryptoAsset, type NetworkConfiguration, type NetworkModes, type NonFungibleCryptoAsset, 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 SendAssetActivity, type SignMessageActivity, type Sip10Asset, type Sip9Asset, type Src20Asset, type StacksAddressInfo, type StacksChainConfig, type StacksFeeEstimate, type StacksTx, type StacksTxStatus, type StampAsset, type Stx20Asset, type StxAsset, type StxBalance, type StxTransfer, type SupportedBlockchains, type SwapAssetsActivity, type TransactionErrorKey, type Utxo, type UtxoId, type ValueOf, type WalletActivity, type WalletActivityType, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, type WalletId, accountAddressesSchema, accountIdSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworksKeyedById, emailAddressSchema, formatMarketPair, inscriptionMimeTypes, networkConfigurationSchema, networkModes, stacksAddressInfoSchema, supportedBlockchains, testnetModes, walletIdSchema };
709
+ declare const bnsContractAddress: {
710
+ mainnet: string;
711
+ testnet: string;
712
+ };
713
+ declare const bnsContractName = "BNS-V2";
714
+ interface BnsName {
715
+ owner: string;
716
+ name: string;
717
+ namespace: string;
718
+ fullName: string;
719
+ }
720
+ interface BnsProfile {
721
+ bnsName: BnsName;
722
+ profileData: BnsProfileData;
723
+ }
724
+ interface BnsProfileData {
725
+ name?: string;
726
+ bio?: string;
727
+ website?: string;
728
+ pfpUrl?: string;
729
+ location?: string;
730
+ addresses?: BnsProfileDataAddresses;
731
+ }
732
+ interface BnsProfileDataAddresses {
733
+ bitcoinPayment?: string;
734
+ bitcoinOrdinal?: string;
735
+ solana?: string;
736
+ ethereum?: string;
737
+ }
738
+
739
+ interface SwapAsset {
740
+ asset: FungibleCryptoAsset;
741
+ providerAssets: SwapProviderAsset[];
742
+ }
743
+ declare const swapProviderIds: readonly ["bitflow-sdk", "sbtc-bridge", "alex-sdk", "velar-sdk"];
744
+ type SwapProviderId = (typeof swapProviderIds)[number];
745
+ interface SwapProvider {
746
+ id: SwapProviderId;
747
+ isAggregator: boolean;
748
+ }
749
+ interface SwapProviderAsset {
750
+ providerId: SwapProviderId;
751
+ providerAssetId: string;
752
+ assetId: CryptoAssetId;
753
+ }
754
+ interface SwapQuote {
755
+ executionType: SwapExecutionType;
756
+ providerId: SwapProviderId;
757
+ providerQuoteData: unknown;
758
+ baseAmount: number;
759
+ targetAmount: number;
760
+ quote: Money;
761
+ dexPath: SwapDex[];
762
+ assetPath: FungibleCryptoAsset[];
763
+ }
764
+ interface SwapDex {
765
+ name: string;
766
+ url: string;
767
+ logo: string;
768
+ description: string;
769
+ }
770
+ declare const swapExecutionTypes: readonly ["stacks-contract-call", "sbtc-bridge-transfer"];
771
+ type SwapExecutionType = (typeof swapExecutionTypes)[number];
772
+ interface BaseSwapExecutionData {
773
+ executionType: SwapExecutionType;
774
+ providerId: SwapProviderId;
775
+ }
776
+ interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {
777
+ executionType: 'stacks-contract-call';
778
+ contractAddress: string;
779
+ contractName: string;
780
+ functionName: string;
781
+ functionArgs: unknown[];
782
+ postConditions: unknown[];
783
+ postConditionMode?: unknown;
784
+ }
785
+ interface SbtcBridgeTransferSwapExecutionData extends BaseSwapExecutionData {
786
+ executionType: 'sbtc-bridge-transfer';
787
+ }
788
+ type SwapExecutionData = StacksContractCallSwapExecutionData | SbtcBridgeTransferSwapExecutionData;
789
+
790
+ 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 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 Inscription, type InscriptionAsset, type InscriptionMimeType, type LiteralUnion, type LockAssetActivity, type MarketData, 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 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 TransactionErrorKey, type Utxo, type UtxoId, type ValueOf, type WalletActivity, type WalletActivityType, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, type WalletId, accountAddressesSchema, accountIdSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, bnsContractAddress, bnsContractName, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworksKeyedById, emailAddressSchema, formatMarketPair, inscriptionMimeTypes, isBrc20Asset, isBtcAsset, isFungibleAsset, isInscriptionAsset, isNativeAsset, isNonFungibleAsset, isRuneAsset, isSip10Asset, isSip9Asset, isSrc20Asset, isStampAsset, isStx20Asset, isStxAsset, networkConfigurationSchema, networkModes, stacksAddressInfoSchema, supportedBlockchains, swapExecutionTypes, swapProviderIds, testnetModes, walletIdSchema };
package/dist/index.js CHANGED
@@ -7,18 +7,65 @@ var CryptoAssetCategories = {
7
7
  fungible: "fungible",
8
8
  nft: "nft"
9
9
  };
10
- var CryptoAssetProtocols = {
10
+ var FungibleCryptoAssetProtocols = {
11
11
  nativeBtc: "nativeBtc",
12
12
  nativeStx: "nativeStx",
13
13
  sip10: "sip10",
14
14
  brc20: "brc20",
15
15
  src20: "src20",
16
16
  stx20: "stx20",
17
- rune: "rune",
17
+ rune: "rune"
18
+ };
19
+ var NonFungibleCryptoAssetProtocols = {
18
20
  stamp: "stamp",
19
21
  sip9: "sip9",
20
22
  inscription: "inscription"
21
23
  };
24
+ var CryptoAssetProtocols = {
25
+ ...FungibleCryptoAssetProtocols,
26
+ ...NonFungibleCryptoAssetProtocols
27
+ };
28
+
29
+ // src/assets/asset-type-guards.ts
30
+ function isFungibleAsset(asset) {
31
+ return asset.category === "fungible";
32
+ }
33
+ function isNonFungibleAsset(asset) {
34
+ return asset.category === "nft";
35
+ }
36
+ function isBtcAsset(asset) {
37
+ return asset.protocol === "nativeBtc";
38
+ }
39
+ function isStxAsset(asset) {
40
+ return asset.protocol === "nativeStx";
41
+ }
42
+ function isNativeAsset(asset) {
43
+ return isBtcAsset(asset) || isStxAsset(asset);
44
+ }
45
+ function isSip10Asset(asset) {
46
+ return asset.protocol === "sip10";
47
+ }
48
+ function isBrc20Asset(asset) {
49
+ return asset.protocol === "brc20";
50
+ }
51
+ function isSrc20Asset(asset) {
52
+ return asset.protocol === "src20";
53
+ }
54
+ function isStx20Asset(asset) {
55
+ return asset.protocol === "stx20";
56
+ }
57
+ function isRuneAsset(asset) {
58
+ return asset.protocol === "rune";
59
+ }
60
+ function isInscriptionAsset(asset) {
61
+ return asset.protocol === "inscription";
62
+ }
63
+ function isStampAsset(asset) {
64
+ return asset.protocol === "stamp";
65
+ }
66
+ function isSip9Asset(asset) {
67
+ return asset.protocol === "sip9";
68
+ }
22
69
 
23
70
  // src/inscription-mime-type.model.ts
24
71
  var inscriptionMimeTypes = [
@@ -79,7 +126,6 @@ function createMarketData(pair, price) {
79
126
  // src/network/network.model.ts
80
127
  var HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
81
128
  var HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
82
- var HIRO_INSCRIPTIONS_API_URL = "https://api.hiro.so/ordinals/v1/inscriptions";
83
129
  var HIRO_API_BASE_URL_NAKAMOTO_TESTNET = "https://api.nakamoto.testnet.hiro.so";
84
130
  var HIRO_API_BASE_URL_MAINNET_EXTENDED = "https://api.hiro.so/extended/v1";
85
131
  var HIRO_API_BASE_URL_TESTNET_EXTENDED = "https://api.testnet.hiro.so/extended";
@@ -333,6 +379,17 @@ var accountAddressesSchema = z3.object({
333
379
  bitcoin: bitcoinAddressInfoSchema.optional(),
334
380
  stacks: stacksAddressInfoSchema.optional()
335
381
  });
382
+
383
+ // src/bns.model.ts
384
+ var bnsContractAddress = {
385
+ mainnet: "SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF",
386
+ testnet: "ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M"
387
+ };
388
+ var bnsContractName = "BNS-V2";
389
+
390
+ // src/swap/swap.model.ts
391
+ var swapProviderIds = ["bitflow-sdk", "sbtc-bridge", "alex-sdk", "velar-sdk"];
392
+ var swapExecutionTypes = ["stacks-contract-call", "sbtc-bridge-transfer"];
336
393
  export {
337
394
  ActivityLevels,
338
395
  BESTINSLOT_API_BASE_URL_MAINNET,
@@ -349,13 +406,14 @@ export {
349
406
  CryptoAssetProtocols,
350
407
  FeeCalculationTypes,
351
408
  FeeTypes,
409
+ FungibleCryptoAssetProtocols,
352
410
  GeneralActivityTypes,
353
411
  HIRO_API_BASE_URL_MAINNET,
354
412
  HIRO_API_BASE_URL_MAINNET_EXTENDED,
355
413
  HIRO_API_BASE_URL_NAKAMOTO_TESTNET,
356
414
  HIRO_API_BASE_URL_TESTNET,
357
415
  HIRO_API_BASE_URL_TESTNET_EXTENDED,
358
- HIRO_INSCRIPTIONS_API_URL,
416
+ NonFungibleCryptoAssetProtocols,
359
417
  OnChainActivityStatuses,
360
418
  OnChainActivityTypes,
361
419
  STX20_API_BASE_URL_MAINNET,
@@ -368,6 +426,8 @@ export {
368
426
  bitcoinNetworkSchema,
369
427
  bitcoinNetworkToNetworkMode,
370
428
  bitcoinNetworks,
429
+ bnsContractAddress,
430
+ bnsContractName,
371
431
  btcTxTimeMap,
372
432
  createMarketData,
373
433
  createMarketPair,
@@ -376,10 +436,25 @@ export {
376
436
  emailAddressSchema,
377
437
  formatMarketPair,
378
438
  inscriptionMimeTypes,
439
+ isBrc20Asset,
440
+ isBtcAsset,
441
+ isFungibleAsset,
442
+ isInscriptionAsset,
443
+ isNativeAsset,
444
+ isNonFungibleAsset,
445
+ isRuneAsset,
446
+ isSip10Asset,
447
+ isSip9Asset,
448
+ isSrc20Asset,
449
+ isStampAsset,
450
+ isStx20Asset,
451
+ isStxAsset,
379
452
  networkConfigurationSchema,
380
453
  networkModes,
381
454
  stacksAddressInfoSchema,
382
455
  supportedBlockchains,
456
+ swapExecutionTypes,
457
+ swapProviderIds,
383
458
  testnetModes,
384
459
  walletIdSchema
385
460
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/assets/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"],"sourcesContent":["import { InscriptionMimeType } from '../inscription-mime-type.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 CryptoAssetProtocols = {\n nativeBtc: 'nativeBtc',\n nativeStx: 'nativeStx',\n sip10: 'sip10',\n brc20: 'brc20',\n src20: 'src20',\n stx20: 'stx20',\n rune: 'rune',\n stamp: 'stamp',\n sip9: 'sip9',\n inscription: 'inscription',\n} as const;\n\nexport type CryptoAssetChain = keyof typeof CryptoAssetChains;\nexport type CryptoAssetCategory = keyof typeof CryptoAssetCategories;\nexport type CryptoAssetProtocol = keyof typeof CryptoAssetProtocols;\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 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\ninterface BaseNonFungibleCryptoAsset extends BaseCryptoAsset {\n readonly category: 'nft';\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}\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 collection: string;\n readonly name: string;\n readonly description: string;\n readonly cachedImage: string;\n readonly cachedImageThumbnail: string;\n}\nexport type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;\n\nexport type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;\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_INSCRIPTIONS_API_URL = 'https://api.hiro.so/ordinals/v1/inscriptions';\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});\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"],"mappings":";AAEO,IAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,QAAQ;AACV;AACO,IAAM,wBAAwB;AAAA,EACnC,UAAU;AAAA,EACV,KAAK;AACP;AACO,IAAM,uBAAuB;AAAA,EAClC,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP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O,EAAE,SAAS;AAAA,IACrC,CAAC;AAAA,EACH,CAAC;AACH,CAAC;;;ACzBD,SAAS,KAAAC,UAAS;AAaX,IAAM,qBAAqBA,GAAE,MAAM,EAAE,OAAO,wBAAwB,CAAC;;;ACbrE,IAAM,iBAAiB;AAAA,EAC5B,SAAS;AAAA,EACT,KAAK;AACP;;;ACHO,IAAM,0BAA0B;AAAA,EACrC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;;;ACJO,IAAM,uBAAuB;AAAA,EAClC,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,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;AACnC,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;","names":["BtcFeeType","FeeTypes","FeeCalculationTypes","ChainId","WalletDefaultNetworkConfigurationIds","z","z"]}
1
+ {"version":3,"sources":["../src/assets/asset.model.ts","../src/assets/asset-type-guards.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';\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\ninterface 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}\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 cachedImage: string;\n readonly cachedImageThumbnail: string;\n readonly contentType: string;\n readonly collection: {\n id: string;\n name: string;\n isVerified: boolean;\n locationUrl: string;\n totalItems: number;\n floorPriceAmount: {\n amount: number;\n unit: string;\n };\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 Sip9Asset,\n Sip10Asset,\n Src20Asset,\n StampAsset,\n Stx20Asset,\n StxAsset,\n} from './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 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 { 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});\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 { FungibleCryptoAsset } from '../assets/asset.model';\nimport { Money } from '../money.model';\n\nexport interface SwapAsset {\n asset: FungibleCryptoAsset;\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: FungibleCryptoAsset[];\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":";AAEO,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,W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AA,EAClC,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,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;AACnC,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;;;ACrBM,IAAM,qBAAqB;AAAA,EAChC,SAAS;AAAA,EACT,SAAS;AACX;AAEO,IAAM,kBAAkB;;;ACIxB,IAAM,kBAAkB,CAAC,eAAe,eAAe,YAAY,WAAW;AAgC9E,IAAM,qBAAqB,CAAC,wBAAwB,sBAAsB;","names":["BtcFeeType","FeeTypes","FeeCalculationTypes","ChainId","WalletDefaultNetworkConfigurationIds","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.40.0",
5
+ "version": "0.42.0",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/leather-io/mono/tree/dev/packages/models",
8
8
  "repository": {
@@ -0,0 +1,68 @@
1
+ import {
2
+ Brc20Asset,
3
+ BtcAsset,
4
+ CryptoAsset,
5
+ FungibleCryptoAsset,
6
+ InscriptionAsset,
7
+ NativeCryptoAsset,
8
+ NonFungibleCryptoAsset,
9
+ RuneAsset,
10
+ Sip9Asset,
11
+ Sip10Asset,
12
+ Src20Asset,
13
+ StampAsset,
14
+ Stx20Asset,
15
+ StxAsset,
16
+ } from './asset.model';
17
+
18
+ export function isFungibleAsset(asset: CryptoAsset): asset is FungibleCryptoAsset {
19
+ return asset.category === 'fungible';
20
+ }
21
+
22
+ export function isNonFungibleAsset(asset: CryptoAsset): asset is NonFungibleCryptoAsset {
23
+ return asset.category === 'nft';
24
+ }
25
+
26
+ export function isBtcAsset(asset: CryptoAsset): asset is BtcAsset {
27
+ return asset.protocol === 'nativeBtc';
28
+ }
29
+
30
+ export function isStxAsset(asset: CryptoAsset): asset is StxAsset {
31
+ return asset.protocol === 'nativeStx';
32
+ }
33
+
34
+ export function isNativeAsset(asset: CryptoAsset): asset is NativeCryptoAsset {
35
+ return isBtcAsset(asset) || isStxAsset(asset);
36
+ }
37
+
38
+ export function isSip10Asset(asset: CryptoAsset): asset is Sip10Asset {
39
+ return asset.protocol === 'sip10';
40
+ }
41
+
42
+ export function isBrc20Asset(asset: CryptoAsset): asset is Brc20Asset {
43
+ return asset.protocol === 'brc20';
44
+ }
45
+
46
+ export function isSrc20Asset(asset: CryptoAsset): asset is Src20Asset {
47
+ return asset.protocol === 'src20';
48
+ }
49
+
50
+ export function isStx20Asset(asset: CryptoAsset): asset is Stx20Asset {
51
+ return asset.protocol === 'stx20';
52
+ }
53
+
54
+ export function isRuneAsset(asset: CryptoAsset): asset is RuneAsset {
55
+ return asset.protocol === 'rune';
56
+ }
57
+
58
+ export function isInscriptionAsset(asset: CryptoAsset): asset is InscriptionAsset {
59
+ return asset.protocol === 'inscription';
60
+ }
61
+
62
+ export function isStampAsset(asset: CryptoAsset): asset is StampAsset {
63
+ return asset.protocol === 'stamp';
64
+ }
65
+
66
+ export function isSip9Asset(asset: CryptoAsset): asset is Sip9Asset {
67
+ return asset.protocol === 'sip9';
68
+ }
@@ -8,7 +8,7 @@ export const CryptoAssetCategories = {
8
8
  fungible: 'fungible',
9
9
  nft: 'nft',
10
10
  } as const;
11
- export const CryptoAssetProtocols = {
11
+ export const FungibleCryptoAssetProtocols = {
12
12
  nativeBtc: 'nativeBtc',
13
13
  nativeStx: 'nativeStx',
14
14
  sip10: 'sip10',
@@ -16,14 +16,22 @@ export const CryptoAssetProtocols = {
16
16
  src20: 'src20',
17
17
  stx20: 'stx20',
18
18
  rune: 'rune',
19
+ } as const;
20
+ export const NonFungibleCryptoAssetProtocols = {
19
21
  stamp: 'stamp',
20
22
  sip9: 'sip9',
21
23
  inscription: 'inscription',
22
24
  } as const;
25
+ export const CryptoAssetProtocols = {
26
+ ...FungibleCryptoAssetProtocols,
27
+ ...NonFungibleCryptoAssetProtocols,
28
+ } as const;
23
29
 
24
30
  export type CryptoAssetChain = keyof typeof CryptoAssetChains;
25
31
  export type CryptoAssetCategory = keyof typeof CryptoAssetCategories;
26
- export type CryptoAssetProtocol = keyof typeof CryptoAssetProtocols;
32
+ export type FungibleCryptoAssetProtocol = keyof typeof FungibleCryptoAssetProtocols;
33
+ export type NonFungibleCryptoAssetProtocol = keyof typeof NonFungibleCryptoAssetProtocols;
34
+ export type CryptoAssetProtocol = FungibleCryptoAssetProtocol | NonFungibleCryptoAssetProtocol;
27
35
 
28
36
  export interface BaseCryptoAsset {
29
37
  readonly chain: CryptoAssetChain;
@@ -34,6 +42,7 @@ export interface BaseCryptoAsset {
34
42
  // Fungible asset types
35
43
  interface BaseFungibleCryptoAsset extends BaseCryptoAsset {
36
44
  readonly category: 'fungible';
45
+ readonly protocol: FungibleCryptoAssetProtocol;
37
46
  readonly symbol: string;
38
47
  readonly decimals: number;
39
48
  readonly hasMemo: boolean;
@@ -95,6 +104,7 @@ export type FungibleCryptoAsset =
95
104
  // NFT asset types
96
105
  interface BaseNonFungibleCryptoAsset extends BaseCryptoAsset {
97
106
  readonly category: 'nft';
107
+ readonly protocol: NonFungibleCryptoAssetProtocol;
98
108
  }
99
109
  export interface InscriptionAsset extends BaseNonFungibleCryptoAsset {
100
110
  readonly chain: 'bitcoin';
@@ -126,12 +136,28 @@ export interface Sip9Asset extends BaseNonFungibleCryptoAsset {
126
136
  readonly assetId: string;
127
137
  readonly contractId: string;
128
138
  readonly tokenId: number;
129
- readonly collection: string;
130
139
  readonly name: string;
131
140
  readonly description: string;
132
141
  readonly cachedImage: string;
133
142
  readonly cachedImageThumbnail: string;
143
+ readonly contentType: string;
144
+ readonly collection: {
145
+ id: string;
146
+ name: string;
147
+ isVerified: boolean;
148
+ locationUrl: string;
149
+ totalItems: number;
150
+ floorPriceAmount: {
151
+ amount: number;
152
+ unit: string;
153
+ };
154
+ };
134
155
  }
135
156
  export type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;
136
157
 
137
158
  export type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;
159
+
160
+ export interface FungibleAssetId {
161
+ protocol: FungibleCryptoAssetProtocol;
162
+ id: string;
163
+ }
@@ -0,0 +1,34 @@
1
+ export const bnsContractAddress = {
2
+ mainnet: 'SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF',
3
+ testnet: 'ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M',
4
+ };
5
+
6
+ export const bnsContractName = 'BNS-V2';
7
+
8
+ export interface BnsName {
9
+ owner: string;
10
+ name: string;
11
+ namespace: string;
12
+ fullName: string;
13
+ }
14
+
15
+ export interface BnsProfile {
16
+ bnsName: BnsName;
17
+ profileData: BnsProfileData;
18
+ }
19
+
20
+ export interface BnsProfileData {
21
+ name?: string;
22
+ bio?: string;
23
+ website?: string;
24
+ pfpUrl?: string;
25
+ location?: string;
26
+ addresses?: BnsProfileDataAddresses;
27
+ }
28
+
29
+ export interface BnsProfileDataAddresses {
30
+ bitcoinPayment?: string;
31
+ bitcoinOrdinal?: string;
32
+ solana?: string;
33
+ ethereum?: string;
34
+ }
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from './bitcoin.model';
2
2
  export * from './balance.model';
3
3
  export * from './assets/asset.model';
4
4
  export * from './assets/asset-id.model';
5
+ export * from './assets/asset-type-guards';
5
6
  export * from './inscription-mime-type.model';
6
7
  export * from './currencies.model';
7
8
  export * from './fees/bitcoin-fees.model';
@@ -23,3 +24,5 @@ export * from './activity/activity-status.model';
23
24
  export * from './activity/activity-type.model';
24
25
  export * from './activity/activity.model';
25
26
  export * from './account.model';
27
+ export * from './bns.model';
28
+ export * from './swap/swap.model';
@@ -5,7 +5,6 @@ import { networkConfigurationSchema } from './network.schema';
5
5
 
6
6
  export const HIRO_API_BASE_URL_MAINNET = 'https://api.hiro.so';
7
7
  export const HIRO_API_BASE_URL_TESTNET = 'https://api.testnet.hiro.so';
8
- export const HIRO_INSCRIPTIONS_API_URL = 'https://api.hiro.so/ordinals/v1/inscriptions';
9
8
  export const HIRO_API_BASE_URL_NAKAMOTO_TESTNET = 'https://api.nakamoto.testnet.hiro.so';
10
9
 
11
10
  export const HIRO_API_BASE_URL_MAINNET_EXTENDED = 'https://api.hiro.so/extended/v1';
@@ -0,0 +1,63 @@
1
+ import { CryptoAssetId } from '../assets/asset-id.model';
2
+ import { FungibleCryptoAsset } from '../assets/asset.model';
3
+ import { Money } from '../money.model';
4
+
5
+ export interface SwapAsset {
6
+ asset: FungibleCryptoAsset;
7
+ providerAssets: SwapProviderAsset[];
8
+ }
9
+
10
+ export const swapProviderIds = ['bitflow-sdk', 'sbtc-bridge', 'alex-sdk', 'velar-sdk'] as const;
11
+ export type SwapProviderId = (typeof swapProviderIds)[number];
12
+
13
+ export interface SwapProvider {
14
+ id: SwapProviderId;
15
+ isAggregator: boolean;
16
+ }
17
+
18
+ export interface SwapProviderAsset {
19
+ providerId: SwapProviderId;
20
+ providerAssetId: string;
21
+ assetId: CryptoAssetId;
22
+ }
23
+
24
+ export interface SwapQuote {
25
+ executionType: SwapExecutionType;
26
+ providerId: SwapProviderId;
27
+ providerQuoteData: unknown;
28
+ baseAmount: number;
29
+ targetAmount: number;
30
+ quote: Money;
31
+ dexPath: SwapDex[];
32
+ assetPath: FungibleCryptoAsset[];
33
+ }
34
+
35
+ export interface SwapDex {
36
+ name: string;
37
+ url: string;
38
+ logo: string;
39
+ description: string;
40
+ }
41
+
42
+ export const swapExecutionTypes = ['stacks-contract-call', 'sbtc-bridge-transfer'] as const;
43
+ export type SwapExecutionType = (typeof swapExecutionTypes)[number];
44
+
45
+ export interface BaseSwapExecutionData {
46
+ executionType: SwapExecutionType;
47
+ providerId: SwapProviderId;
48
+ }
49
+ export interface StacksContractCallSwapExecutionData extends BaseSwapExecutionData {
50
+ executionType: 'stacks-contract-call';
51
+ contractAddress: string;
52
+ contractName: string;
53
+ functionName: string;
54
+ functionArgs: unknown[];
55
+ postConditions: unknown[];
56
+ postConditionMode?: unknown;
57
+ }
58
+ export interface SbtcBridgeTransferSwapExecutionData extends BaseSwapExecutionData {
59
+ executionType: 'sbtc-bridge-transfer';
60
+ }
61
+ export type SwapExecutionData =
62
+ | StacksContractCallSwapExecutionData
63
+ | SbtcBridgeTransferSwapExecutionData;