@leather.io/models 0.39.0 → 0.40.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 +14 -0
- package/dist/index.d.ts +49 -162
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/account.model.ts +1 -1
- package/src/activity/activity.model.ts +2 -2
- package/src/assets/asset-id.model.ts +6 -0
- package/src/{asset.model.ts → assets/asset.model.ts} +1 -1
- package/src/index.ts +2 -1
- package/src/inscription-mime-type.model.ts +1 -1
- package/src/settings.model.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @leather.io/models@0.
|
|
2
|
+
> @leather.io/models@0.40.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[32m10.
|
|
12
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m23.
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m10.70 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m23.10 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 26ms
|
|
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 2062ms
|
|
16
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.14 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,20 @@
|
|
|
30
30
|
* devDependencies
|
|
31
31
|
* @leather.io/tsconfig-config bumped to 0.8.0
|
|
32
32
|
|
|
33
|
+
## [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
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* add token id model and utils ([9f4e166](https://github.com/leather-io/mono/commit/9f4e166f1c66d4aa2a23d621fcfca86b07af68ce))
|
|
39
|
+
|
|
40
|
+
## [0.39.1](https://github.com/leather-io/mono/compare/@leather.io/models-v0.39.0...@leather.io/models-v0.39.1) (2025-08-14)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* update zod patch version ([b552d57](https://github.com/leather-io/mono/commit/b552d57e3af68b941aeb9553d3b9c98d413a6644))
|
|
46
|
+
|
|
33
47
|
## [0.39.0](https://github.com/leather-io/mono/compare/@leather.io/models-v0.38.0...@leather.io/models-v0.39.0) (2025-07-28)
|
|
34
48
|
|
|
35
49
|
|
package/dist/index.d.ts
CHANGED
|
@@ -239,6 +239,11 @@ interface Sip9Asset extends BaseNonFungibleCryptoAsset {
|
|
|
239
239
|
type NonFungibleCryptoAsset = InscriptionAsset | StampAsset | Sip9Asset;
|
|
240
240
|
type CryptoAsset = FungibleCryptoAsset | NonFungibleCryptoAsset;
|
|
241
241
|
|
|
242
|
+
interface CryptoAssetId {
|
|
243
|
+
protocol: CryptoAssetProtocol;
|
|
244
|
+
id: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
242
247
|
interface AverageBitcoinFeeRates {
|
|
243
248
|
fastestFee: BigNumber;
|
|
244
249
|
halfHourFee: BigNumber;
|
|
@@ -290,8 +295,19 @@ interface MarketData {
|
|
|
290
295
|
}
|
|
291
296
|
declare function createMarketData(pair: MarketPair, price: Money): MarketData;
|
|
292
297
|
|
|
293
|
-
declare const bitcoinNetworkModesSchema: z.ZodEnum<
|
|
294
|
-
|
|
298
|
+
declare const bitcoinNetworkModesSchema: z.ZodEnum<{
|
|
299
|
+
mainnet: "mainnet";
|
|
300
|
+
testnet: "testnet";
|
|
301
|
+
regtest: "regtest";
|
|
302
|
+
signet: "signet";
|
|
303
|
+
}>;
|
|
304
|
+
declare const bitcoinNetworkSchema: z.ZodEnum<{
|
|
305
|
+
mainnet: "mainnet";
|
|
306
|
+
regtest: "regtest";
|
|
307
|
+
signet: "signet";
|
|
308
|
+
testnet3: "testnet3";
|
|
309
|
+
testnet4: "testnet4";
|
|
310
|
+
}>;
|
|
295
311
|
declare const networkConfigurationSchema: z.ZodObject<{
|
|
296
312
|
name: z.ZodString;
|
|
297
313
|
id: z.ZodString;
|
|
@@ -299,97 +315,28 @@ declare const networkConfigurationSchema: z.ZodObject<{
|
|
|
299
315
|
bitcoin: z.ZodObject<{
|
|
300
316
|
blockchain: z.ZodLiteral<"bitcoin">;
|
|
301
317
|
bitcoinUrl: z.ZodString;
|
|
302
|
-
bitcoinNetwork: z.ZodEnum<
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
318
|
+
bitcoinNetwork: z.ZodEnum<{
|
|
319
|
+
mainnet: "mainnet";
|
|
320
|
+
regtest: "regtest";
|
|
321
|
+
signet: "signet";
|
|
322
|
+
testnet3: "testnet3";
|
|
323
|
+
testnet4: "testnet4";
|
|
324
|
+
}>;
|
|
325
|
+
mode: z.ZodEnum<{
|
|
326
|
+
mainnet: "mainnet";
|
|
327
|
+
testnet: "testnet";
|
|
328
|
+
regtest: "regtest";
|
|
329
|
+
signet: "signet";
|
|
330
|
+
}>;
|
|
331
|
+
}, z.core.$strip>;
|
|
315
332
|
stacks: z.ZodObject<{
|
|
316
333
|
blockchain: z.ZodLiteral<"stacks">;
|
|
317
334
|
url: z.ZodString;
|
|
318
335
|
chainId: z.ZodNumber;
|
|
319
336
|
subnetChainId: z.ZodOptional<z.ZodNumber>;
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
chainId: number;
|
|
324
|
-
subnetChainId?: number | undefined;
|
|
325
|
-
}, {
|
|
326
|
-
blockchain: "stacks";
|
|
327
|
-
url: string;
|
|
328
|
-
chainId: number;
|
|
329
|
-
subnetChainId?: number | undefined;
|
|
330
|
-
}>;
|
|
331
|
-
}, "strip", z.ZodTypeAny, {
|
|
332
|
-
bitcoin: {
|
|
333
|
-
blockchain: "bitcoin";
|
|
334
|
-
bitcoinUrl: string;
|
|
335
|
-
bitcoinNetwork: "mainnet" | "regtest" | "signet" | "testnet3" | "testnet4";
|
|
336
|
-
mode: "mainnet" | "testnet" | "regtest" | "signet";
|
|
337
|
-
};
|
|
338
|
-
stacks: {
|
|
339
|
-
blockchain: "stacks";
|
|
340
|
-
url: string;
|
|
341
|
-
chainId: number;
|
|
342
|
-
subnetChainId?: number | undefined;
|
|
343
|
-
};
|
|
344
|
-
}, {
|
|
345
|
-
bitcoin: {
|
|
346
|
-
blockchain: "bitcoin";
|
|
347
|
-
bitcoinUrl: string;
|
|
348
|
-
bitcoinNetwork: "mainnet" | "regtest" | "signet" | "testnet3" | "testnet4";
|
|
349
|
-
mode: "mainnet" | "testnet" | "regtest" | "signet";
|
|
350
|
-
};
|
|
351
|
-
stacks: {
|
|
352
|
-
blockchain: "stacks";
|
|
353
|
-
url: string;
|
|
354
|
-
chainId: number;
|
|
355
|
-
subnetChainId?: number | undefined;
|
|
356
|
-
};
|
|
357
|
-
}>;
|
|
358
|
-
}, "strip", z.ZodTypeAny, {
|
|
359
|
-
name: string;
|
|
360
|
-
id: string;
|
|
361
|
-
chain: {
|
|
362
|
-
bitcoin: {
|
|
363
|
-
blockchain: "bitcoin";
|
|
364
|
-
bitcoinUrl: string;
|
|
365
|
-
bitcoinNetwork: "mainnet" | "regtest" | "signet" | "testnet3" | "testnet4";
|
|
366
|
-
mode: "mainnet" | "testnet" | "regtest" | "signet";
|
|
367
|
-
};
|
|
368
|
-
stacks: {
|
|
369
|
-
blockchain: "stacks";
|
|
370
|
-
url: string;
|
|
371
|
-
chainId: number;
|
|
372
|
-
subnetChainId?: number | undefined;
|
|
373
|
-
};
|
|
374
|
-
};
|
|
375
|
-
}, {
|
|
376
|
-
name: string;
|
|
377
|
-
id: string;
|
|
378
|
-
chain: {
|
|
379
|
-
bitcoin: {
|
|
380
|
-
blockchain: "bitcoin";
|
|
381
|
-
bitcoinUrl: string;
|
|
382
|
-
bitcoinNetwork: "mainnet" | "regtest" | "signet" | "testnet3" | "testnet4";
|
|
383
|
-
mode: "mainnet" | "testnet" | "regtest" | "signet";
|
|
384
|
-
};
|
|
385
|
-
stacks: {
|
|
386
|
-
blockchain: "stacks";
|
|
387
|
-
url: string;
|
|
388
|
-
chainId: number;
|
|
389
|
-
subnetChainId?: number | undefined;
|
|
390
|
-
};
|
|
391
|
-
};
|
|
392
|
-
}>;
|
|
337
|
+
}, z.core.$strip>;
|
|
338
|
+
}, z.core.$strip>;
|
|
339
|
+
}, z.core.$strip>;
|
|
393
340
|
|
|
394
341
|
declare const HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
|
|
395
342
|
declare const HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
|
|
@@ -457,7 +404,7 @@ interface AccountDisplayPreferenceInfo {
|
|
|
457
404
|
name: string;
|
|
458
405
|
}
|
|
459
406
|
type AnalyticsPreference = 'consent-given' | 'rejects-tracking';
|
|
460
|
-
declare const emailAddressSchema: z.
|
|
407
|
+
declare const emailAddressSchema: z.ZodEmail;
|
|
461
408
|
type EmailAddress = z.infer<typeof emailAddressSchema>;
|
|
462
409
|
|
|
463
410
|
interface BitcoinTransactionIssuance {
|
|
@@ -588,93 +535,33 @@ type ActivityType = OnChainActivityType | WalletActivityType | GeneralActivityTy
|
|
|
588
535
|
|
|
589
536
|
declare const walletIdSchema: z.ZodObject<{
|
|
590
537
|
fingerprint: z.ZodString;
|
|
591
|
-
},
|
|
592
|
-
|
|
593
|
-
}, {
|
|
594
|
-
fingerprint: string;
|
|
595
|
-
}>;
|
|
596
|
-
declare const accountIdSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
538
|
+
}, z.core.$strip>;
|
|
539
|
+
declare const accountIdSchema: z.ZodIntersection<z.ZodObject<{
|
|
597
540
|
fingerprint: z.ZodString;
|
|
598
|
-
}, {
|
|
541
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
599
542
|
accountIndex: z.ZodNumber;
|
|
600
|
-
}
|
|
601
|
-
fingerprint: string;
|
|
602
|
-
accountIndex: number;
|
|
603
|
-
}, {
|
|
604
|
-
fingerprint: string;
|
|
605
|
-
accountIndex: number;
|
|
606
|
-
}>;
|
|
543
|
+
}, z.core.$strip>>;
|
|
607
544
|
declare const bitcoinAddressInfoSchema: z.ZodObject<{
|
|
608
545
|
taprootDescriptor: z.ZodString;
|
|
609
546
|
nativeSegwitDescriptor: z.ZodString;
|
|
610
|
-
},
|
|
611
|
-
taprootDescriptor: string;
|
|
612
|
-
nativeSegwitDescriptor: string;
|
|
613
|
-
}, {
|
|
614
|
-
taprootDescriptor: string;
|
|
615
|
-
nativeSegwitDescriptor: string;
|
|
616
|
-
}>;
|
|
547
|
+
}, z.core.$strip>;
|
|
617
548
|
declare const stacksAddressInfoSchema: z.ZodObject<{
|
|
618
549
|
stxAddress: z.ZodString;
|
|
619
|
-
},
|
|
620
|
-
stxAddress: string;
|
|
621
|
-
}, {
|
|
622
|
-
stxAddress: string;
|
|
623
|
-
}>;
|
|
550
|
+
}, z.core.$strip>;
|
|
624
551
|
declare const accountAddressesSchema: z.ZodObject<{
|
|
625
|
-
id: z.
|
|
552
|
+
id: z.ZodIntersection<z.ZodObject<{
|
|
626
553
|
fingerprint: z.ZodString;
|
|
627
|
-
}, {
|
|
554
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
628
555
|
accountIndex: z.ZodNumber;
|
|
629
|
-
}
|
|
630
|
-
fingerprint: string;
|
|
631
|
-
accountIndex: number;
|
|
632
|
-
}, {
|
|
633
|
-
fingerprint: string;
|
|
634
|
-
accountIndex: number;
|
|
635
|
-
}>;
|
|
556
|
+
}, z.core.$strip>>;
|
|
636
557
|
bitcoin: z.ZodOptional<z.ZodObject<{
|
|
637
558
|
taprootDescriptor: z.ZodString;
|
|
638
559
|
nativeSegwitDescriptor: z.ZodString;
|
|
639
|
-
},
|
|
640
|
-
taprootDescriptor: string;
|
|
641
|
-
nativeSegwitDescriptor: string;
|
|
642
|
-
}, {
|
|
643
|
-
taprootDescriptor: string;
|
|
644
|
-
nativeSegwitDescriptor: string;
|
|
645
|
-
}>>;
|
|
560
|
+
}, z.core.$strip>>;
|
|
646
561
|
stacks: z.ZodOptional<z.ZodObject<{
|
|
647
562
|
stxAddress: z.ZodString;
|
|
648
|
-
},
|
|
649
|
-
|
|
650
|
-
}, {
|
|
651
|
-
stxAddress: string;
|
|
652
|
-
}>>;
|
|
653
|
-
}, "strip", z.ZodTypeAny, {
|
|
654
|
-
id: {
|
|
655
|
-
fingerprint: string;
|
|
656
|
-
accountIndex: number;
|
|
657
|
-
};
|
|
658
|
-
bitcoin?: {
|
|
659
|
-
taprootDescriptor: string;
|
|
660
|
-
nativeSegwitDescriptor: string;
|
|
661
|
-
} | undefined;
|
|
662
|
-
stacks?: {
|
|
663
|
-
stxAddress: string;
|
|
664
|
-
} | undefined;
|
|
665
|
-
}, {
|
|
666
|
-
id: {
|
|
667
|
-
fingerprint: string;
|
|
668
|
-
accountIndex: number;
|
|
669
|
-
};
|
|
670
|
-
bitcoin?: {
|
|
671
|
-
taprootDescriptor: string;
|
|
672
|
-
nativeSegwitDescriptor: string;
|
|
673
|
-
} | undefined;
|
|
674
|
-
stacks?: {
|
|
675
|
-
stxAddress: string;
|
|
676
|
-
} | undefined;
|
|
677
|
-
}>;
|
|
563
|
+
}, z.core.$strip>>;
|
|
564
|
+
}, z.core.$strip>;
|
|
678
565
|
type WalletId = z.infer<typeof walletIdSchema>;
|
|
679
566
|
type AccountId = z.infer<typeof accountIdSchema>;
|
|
680
567
|
type BitcoinAddressInfo = z.infer<typeof bitcoinAddressInfoSchema>;
|
|
@@ -773,4 +660,4 @@ type OnChainActivity = DeploySmartContractActivity | ExecuteSmartContractActivit
|
|
|
773
660
|
type WalletActivity = ConnectAppActivity | SignMessageActivity;
|
|
774
661
|
type Activity = OnChainActivity | WalletActivity | GeneralActivity;
|
|
775
662
|
|
|
776
|
-
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 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/asset.model.ts
|
|
1
|
+
// src/assets/asset.model.ts
|
|
2
2
|
var CryptoAssetChains = {
|
|
3
3
|
bitcoin: "bitcoin",
|
|
4
4
|
stacks: "stacks"
|
|
@@ -281,7 +281,7 @@ var networkConfigurationSchema = z.object({
|
|
|
281
281
|
|
|
282
282
|
// src/settings.model.ts
|
|
283
283
|
import { z as z2 } from "zod";
|
|
284
|
-
var emailAddressSchema = z2.
|
|
284
|
+
var emailAddressSchema = z2.email({ error: "Invalid email address" });
|
|
285
285
|
|
|
286
286
|
// src/activity/activity-level.model.ts
|
|
287
287
|
var ActivityLevels = {
|
|
@@ -320,7 +320,7 @@ import { z as z3 } from "zod";
|
|
|
320
320
|
var walletIdSchema = z3.object({
|
|
321
321
|
fingerprint: z3.string()
|
|
322
322
|
});
|
|
323
|
-
var accountIdSchema = walletIdSchema.
|
|
323
|
+
var accountIdSchema = walletIdSchema.and(z3.object({ accountIndex: z3.number() }));
|
|
324
324
|
var bitcoinAddressInfoSchema = z3.object({
|
|
325
325
|
taprootDescriptor: z3.string(),
|
|
326
326
|
nativeSegwitDescriptor: z3.string()
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/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 './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.string().email({ message: '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.merge(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,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AACf;;;ACbO,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACTO,IAAM,eAA6D;AAAA,EACxE,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;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AA,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,MAAMA,GAAE,OAAO,EAAE,cAAcA,GAAE,OAAO,EAAE,CAAC,CAAC;AAEnF,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/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,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,aAAa;AACf;;;ACbO,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACTO,IAAM,eAA6D;AAAA,EACxE,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,SAAS;AACX;AAEO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,SAAM;AAHI,SAAAA;AAAA,GAAA;;;ACXL,IAAK,WAAL,kBAAKC,cAAL;AACL,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AACA,EAAAA,oBAAA;AALU,SAAAA;AAAA,GAAA;AAQL,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,qBAAA,SAAM;AACN,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,sBAAmB;AACnB,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,2BAAwB;AALd,S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,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"]}
|
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.40.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/leather-io/mono/tree/dev/packages/models",
|
|
8
8
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@stacks/stacks-blockchain-api-types": "7.14.1",
|
|
20
20
|
"bignumber.js": "9.1.2",
|
|
21
|
-
"zod": "
|
|
21
|
+
"zod": "4.0.17"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"prettier": "3.5.1",
|
package/src/account.model.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const walletIdSchema = z.object({
|
|
|
4
4
|
fingerprint: z.string(),
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
export const accountIdSchema = walletIdSchema.
|
|
7
|
+
export const accountIdSchema = walletIdSchema.and(z.object({ accountIndex: z.number() }));
|
|
8
8
|
|
|
9
9
|
export const bitcoinAddressInfoSchema = z.object({
|
|
10
10
|
taprootDescriptor: z.string(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BigNumber } from 'bignumber.js';
|
|
2
2
|
|
|
3
3
|
import { AccountId } from '../account.model';
|
|
4
|
-
import { CryptoAsset } from '../asset.model';
|
|
4
|
+
import { CryptoAsset } from '../assets/asset.model';
|
|
5
5
|
import { Money } from '../money.model';
|
|
6
6
|
import { ActivityLevel } from './activity-level.model';
|
|
7
7
|
import { OnChainActivityStatus } from './activity-status.model';
|
|
@@ -116,7 +116,7 @@ export interface GeneralActivity extends AppLevelActivity {
|
|
|
116
116
|
readonly title: string;
|
|
117
117
|
readonly message: string;
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
// Currently we only support on-chain activities
|
|
120
120
|
export type OnChainActivity =
|
|
121
121
|
| DeploySmartContractActivity
|
|
122
122
|
| ExecuteSmartContractActivity
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './bitcoin.model';
|
|
2
2
|
export * from './balance.model';
|
|
3
|
-
export * from './asset.model';
|
|
3
|
+
export * from './assets/asset.model';
|
|
4
|
+
export * from './assets/asset-id.model';
|
|
4
5
|
export * from './inscription-mime-type.model';
|
|
5
6
|
export * from './currencies.model';
|
|
6
7
|
export * from './fees/bitcoin-fees.model';
|
package/src/settings.model.ts
CHANGED
|
@@ -11,5 +11,5 @@ export interface AccountDisplayPreferenceInfo {
|
|
|
11
11
|
|
|
12
12
|
export type AnalyticsPreference = 'consent-given' | 'rejects-tracking';
|
|
13
13
|
|
|
14
|
-
export const emailAddressSchema = z.
|
|
14
|
+
export const emailAddressSchema = z.email({ error: 'Invalid email address' });
|
|
15
15
|
export type EmailAddress = z.infer<typeof emailAddressSchema>;
|