@leather.io/models 0.49.0 → 0.50.1

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/dist/index.js CHANGED
@@ -1,824 +1,750 @@
1
- // src/account.model.ts
2
1
  import { z } from "zod";
3
- var walletIdSchema = z.object({
4
- fingerprint: z.string()
5
- });
6
- var accountIdSchema = walletIdSchema.and(z.object({ accountIndex: z.number() }));
7
- var bitcoinAddressInfoSchema = z.object({
8
- taprootDescriptor: z.string(),
9
- nativeSegwitDescriptor: z.string(),
10
- zeroIndexTaprootPayerAddress: z.string().optional(),
11
- zeroIndexNativeSegwitPayerAddress: z.string().optional()
12
- });
13
- var stacksAddressInfoSchema = z.object({
14
- stxAddress: z.string()
2
+
3
+ //#region src/account.model.ts
4
+ const walletIdSchema = z.object({ fingerprint: z.string() });
5
+ const accountIdSchema = walletIdSchema.and(z.object({ accountIndex: z.number() }));
6
+ const bitcoinAddressInfoSchema = z.object({
7
+ taprootDescriptor: z.string(),
8
+ nativeSegwitDescriptor: z.string(),
9
+ zeroIndexTaprootPayerAddress: z.string().optional(),
10
+ zeroIndexNativeSegwitPayerAddress: z.string().optional()
15
11
  });
16
- var accountAddressesSchema = z.object({
17
- id: accountIdSchema,
18
- bitcoin: bitcoinAddressInfoSchema.optional(),
19
- stacks: stacksAddressInfoSchema.optional()
12
+ const stacksAddressInfoSchema = z.object({ stxAddress: z.string() });
13
+ const accountAddressesSchema = z.object({
14
+ id: accountIdSchema,
15
+ bitcoin: bitcoinAddressInfoSchema.optional(),
16
+ stacks: stacksAddressInfoSchema.optional()
20
17
  });
21
18
 
22
- // src/activity/activity-level.model.ts
23
- var ActivityLevels = {
24
- account: "account",
25
- app: "app"
19
+ //#endregion
20
+ //#region src/activity/activity-level.model.ts
21
+ const ActivityLevels = {
22
+ account: "account",
23
+ app: "app"
26
24
  };
27
25
 
28
- // src/activity/activity-status.model.ts
29
- var OnChainActivityStatuses = {
30
- pending: "pending",
31
- success: "success",
32
- failed: "failed"
26
+ //#endregion
27
+ //#region src/activity/activity-status.model.ts
28
+ const OnChainActivityStatuses = {
29
+ pending: "pending",
30
+ success: "success",
31
+ failed: "failed"
33
32
  };
34
33
 
35
- // src/activity/activity-type.model.ts
36
- var OnChainActivityTypes = {
37
- deploySmartContract: "deploySmartContract",
38
- executeSmartContract: "executeSmartContract",
39
- lockAsset: "lockAsset",
40
- sendAsset: "sendAsset",
41
- receiveAsset: "receiveAsset",
42
- swapAssets: "swapAssets"
34
+ //#endregion
35
+ //#region src/activity/activity-type.model.ts
36
+ const OnChainActivityTypes = {
37
+ deploySmartContract: "deploySmartContract",
38
+ executeSmartContract: "executeSmartContract",
39
+ lockAsset: "lockAsset",
40
+ sendAsset: "sendAsset",
41
+ receiveAsset: "receiveAsset",
42
+ swapAssets: "swapAssets"
43
43
  };
44
- var WalletActivityTypes = {
45
- connectApp: "connectApp",
46
- signMessage: "signMessage"
44
+ const WalletActivityTypes = {
45
+ connectApp: "connectApp",
46
+ signMessage: "signMessage"
47
47
  };
48
- var GeneralActivityTypes = {
49
- walletAdded: "walletAdded",
50
- receiveAnnouncement: "receiveAnnouncement",
51
- featureWaitlistNotification: "featureWaitlistNotification"
48
+ const GeneralActivityTypes = {
49
+ walletAdded: "walletAdded",
50
+ receiveAnnouncement: "receiveAnnouncement",
51
+ featureWaitlistNotification: "featureWaitlistNotification"
52
52
  };
53
53
 
54
- // src/assets/asset-type-guards.ts
54
+ //#endregion
55
+ //#region src/assets/asset-type-guards.ts
55
56
  function isFungibleAsset(asset) {
56
- return asset.category === "fungible";
57
+ return asset.category === "fungible";
57
58
  }
58
59
  function isNonFungibleAsset(asset) {
59
- return asset.category === "nft";
60
+ return asset.category === "nft";
60
61
  }
61
62
  function isBtcAsset(asset) {
62
- return asset.protocol === "nativeBtc";
63
+ return asset.protocol === "nativeBtc";
63
64
  }
64
65
  function isStxAsset(asset) {
65
- return asset.protocol === "nativeStx";
66
+ return asset.protocol === "nativeStx";
66
67
  }
67
68
  function isNativeAsset(asset) {
68
- return isBtcAsset(asset) || isStxAsset(asset);
69
+ return isBtcAsset(asset) || isStxAsset(asset);
69
70
  }
70
71
  function isSip10Asset(asset) {
71
- return asset.protocol === "sip10";
72
+ return asset.protocol === "sip10";
72
73
  }
73
74
  function isSwappableAsset(asset) {
74
- return isNativeAsset(asset) || isSip10Asset(asset);
75
+ return isNativeAsset(asset) || isSip10Asset(asset);
75
76
  }
76
77
  function isBrc20Asset(asset) {
77
- return asset.protocol === "brc20";
78
+ return asset.protocol === "brc20";
78
79
  }
79
80
  function isSrc20Asset(asset) {
80
- return asset.protocol === "src20";
81
+ return asset.protocol === "src20";
81
82
  }
82
83
  function isStx20Asset(asset) {
83
- return asset.protocol === "stx20";
84
+ return asset.protocol === "stx20";
84
85
  }
85
86
  function isRuneAsset(asset) {
86
- return asset.protocol === "rune";
87
+ return asset.protocol === "rune";
87
88
  }
88
89
  function isInscriptionAsset(asset) {
89
- return asset.protocol === "inscription";
90
+ return asset.protocol === "inscription";
90
91
  }
91
92
  function isStampAsset(asset) {
92
- return asset.protocol === "stamp";
93
+ return asset.protocol === "stamp";
93
94
  }
94
95
  function isSip9Asset(asset) {
95
- return asset.protocol === "sip9";
96
+ return asset.protocol === "sip9";
96
97
  }
97
98
 
98
- // src/assets/asset.model.ts
99
- var CryptoAssetChains = {
100
- bitcoin: "bitcoin",
101
- stacks: "stacks"
99
+ //#endregion
100
+ //#region src/assets/asset.model.ts
101
+ const CryptoAssetChains = {
102
+ bitcoin: "bitcoin",
103
+ stacks: "stacks"
102
104
  };
103
- var CryptoAssetCategories = {
104
- fungible: "fungible",
105
- nft: "nft"
105
+ const CryptoAssetCategories = {
106
+ fungible: "fungible",
107
+ nft: "nft"
106
108
  };
107
- var FungibleCryptoAssetProtocols = {
108
- nativeBtc: "nativeBtc",
109
- nativeStx: "nativeStx",
110
- sip10: "sip10",
111
- brc20: "brc20",
112
- src20: "src20",
113
- stx20: "stx20",
114
- rune: "rune"
109
+ const FungibleCryptoAssetProtocols = {
110
+ nativeBtc: "nativeBtc",
111
+ nativeStx: "nativeStx",
112
+ sip10: "sip10",
113
+ brc20: "brc20",
114
+ src20: "src20",
115
+ stx20: "stx20",
116
+ rune: "rune"
115
117
  };
116
- var NonFungibleCryptoAssetProtocols = {
117
- stamp: "stamp",
118
- sip9: "sip9",
119
- inscription: "inscription"
118
+ const NonFungibleCryptoAssetProtocols = {
119
+ stamp: "stamp",
120
+ sip9: "sip9",
121
+ inscription: "inscription"
120
122
  };
121
- var CryptoAssetProtocols = {
122
- ...FungibleCryptoAssetProtocols,
123
- ...NonFungibleCryptoAssetProtocols
123
+ const CryptoAssetProtocols = {
124
+ ...FungibleCryptoAssetProtocols,
125
+ ...NonFungibleCryptoAssetProtocols
124
126
  };
125
127
 
126
- // src/assets/sip9-asset.model.ts
127
- var sip9ContentTypes = [
128
- "image/jpeg",
129
- "image/jpg",
130
- "image/png",
131
- "image/gif",
132
- "image/webp",
133
- "image/svg+xml",
134
- "image/bmp",
135
- "image/tiff",
136
- "image/avif",
137
- "video/mp4",
138
- "video/webm",
139
- "video/mov",
140
- "video/quicktime",
141
- "video/avi",
142
- "video/x-msvideo",
143
- "video/ogg",
144
- "audio/mpeg",
145
- "audio/mp3",
146
- "audio/wav",
147
- "audio/x-wav",
148
- "audio/ogg",
149
- "audio/aac",
150
- "audio/flac",
151
- "audio/webm",
152
- "model/gltf+json",
153
- "model/gltf-binary",
154
- "application/octet-stream",
155
- "text/plain",
156
- "text/html",
157
- "text/markdown",
158
- "application/pdf",
159
- "application/json",
160
- "text/javascript",
161
- "application/javascript",
162
- "application/zip",
163
- "unknown",
164
- ""
128
+ //#endregion
129
+ //#region src/assets/sip9-asset.model.ts
130
+ const sip9ContentTypes = [
131
+ "image/jpeg",
132
+ "image/jpg",
133
+ "image/png",
134
+ "image/gif",
135
+ "image/webp",
136
+ "image/svg+xml",
137
+ "image/bmp",
138
+ "image/tiff",
139
+ "image/avif",
140
+ "video/mp4",
141
+ "video/webm",
142
+ "video/mov",
143
+ "video/quicktime",
144
+ "video/avi",
145
+ "video/x-msvideo",
146
+ "video/ogg",
147
+ "audio/mpeg",
148
+ "audio/mp3",
149
+ "audio/wav",
150
+ "audio/x-wav",
151
+ "audio/ogg",
152
+ "audio/aac",
153
+ "audio/flac",
154
+ "audio/webm",
155
+ "model/gltf+json",
156
+ "model/gltf-binary",
157
+ "application/octet-stream",
158
+ "text/plain",
159
+ "text/html",
160
+ "text/markdown",
161
+ "application/pdf",
162
+ "application/json",
163
+ "text/javascript",
164
+ "application/javascript",
165
+ "application/zip",
166
+ "unknown",
167
+ ""
165
168
  ];
166
169
 
167
- // src/bitcoin.model.ts
168
- import { z as z2 } from "zod";
169
- var bitcoinUnitSchema = z2.enum(["bitcoin", "satoshi"]);
170
+ //#endregion
171
+ //#region src/bitcoin.model.ts
172
+ const bitcoinUnitSchema = z.enum(["bitcoin", "satoshi"]);
170
173
 
171
- // src/bns.model.ts
172
- var bnsContractAddress = {
173
- mainnet: "SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF",
174
- testnet: "ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M"
174
+ //#endregion
175
+ //#region src/bns.model.ts
176
+ const bnsContractAddress = {
177
+ mainnet: "SP2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D96YPGZF",
178
+ testnet: "ST2QEZ06AGJ3RKJPBV14SY1V5BBFNAW33D9SZJQ0M"
175
179
  };
176
- var bnsContractName = "BNS-V2";
180
+ const bnsContractName = "BNS-V2";
177
181
 
178
- // src/fees/bitcoin-fees.model.ts
179
- var btcTxTimeMap = {
180
- fastestFee: "~10 \u2013 20min",
181
- halfHourFee: "~30 min",
182
- hourFee: "~1 hour+"
182
+ //#endregion
183
+ //#region src/fees/bitcoin-fees.model.ts
184
+ const btcTxTimeMap = {
185
+ fastestFee: "~10 – 20min",
186
+ halfHourFee: "~30 min",
187
+ hourFee: "~1 hour+"
183
188
  };
184
- var BtcFeeType = /* @__PURE__ */ ((BtcFeeType2) => {
185
- BtcFeeType2["High"] = "High";
186
- BtcFeeType2["Standard"] = "Standard";
187
- BtcFeeType2["Low"] = "Low";
188
- return BtcFeeType2;
189
- })(BtcFeeType || {});
189
+ let BtcFeeType = /* @__PURE__ */ function(BtcFeeType$1) {
190
+ BtcFeeType$1["High"] = "High";
191
+ BtcFeeType$1["Standard"] = "Standard";
192
+ BtcFeeType$1["Low"] = "Low";
193
+ return BtcFeeType$1;
194
+ }({});
190
195
 
191
- // src/fees/fees.model.ts
192
- var FeeTypes = /* @__PURE__ */ ((FeeTypes2) => {
193
- FeeTypes2[FeeTypes2["Low"] = 0] = "Low";
194
- FeeTypes2[FeeTypes2["Middle"] = 1] = "Middle";
195
- FeeTypes2[FeeTypes2["High"] = 2] = "High";
196
- FeeTypes2[FeeTypes2["Custom"] = 3] = "Custom";
197
- FeeTypes2[FeeTypes2["Unknown"] = 4] = "Unknown";
198
- return FeeTypes2;
199
- })(FeeTypes || {});
200
- var FeeCalculationTypes = /* @__PURE__ */ ((FeeCalculationTypes2) => {
201
- FeeCalculationTypes2["Api"] = "api";
202
- FeeCalculationTypes2["Default"] = "default";
203
- FeeCalculationTypes2["DefaultSimulated"] = "default-simulated";
204
- FeeCalculationTypes2["FeesCapped"] = "fees-capped";
205
- FeeCalculationTypes2["TokenTransferSpecific"] = "token-transfer-specific";
206
- return FeeCalculationTypes2;
207
- })(FeeCalculationTypes || {});
196
+ //#endregion
197
+ //#region src/fees/fees.model.ts
198
+ let FeeTypes = /* @__PURE__ */ function(FeeTypes$1) {
199
+ FeeTypes$1[FeeTypes$1["Low"] = 0] = "Low";
200
+ FeeTypes$1[FeeTypes$1["Middle"] = 1] = "Middle";
201
+ FeeTypes$1[FeeTypes$1["High"] = 2] = "High";
202
+ FeeTypes$1[FeeTypes$1["Custom"] = 3] = "Custom";
203
+ FeeTypes$1[FeeTypes$1["Unknown"] = 4] = "Unknown";
204
+ return FeeTypes$1;
205
+ }({});
206
+ let FeeCalculationTypes = /* @__PURE__ */ function(FeeCalculationTypes$1) {
207
+ FeeCalculationTypes$1["Api"] = "api";
208
+ FeeCalculationTypes$1["Default"] = "default";
209
+ FeeCalculationTypes$1["DefaultSimulated"] = "default-simulated";
210
+ FeeCalculationTypes$1["FeesCapped"] = "fees-capped";
211
+ FeeCalculationTypes$1["TokenTransferSpecific"] = "token-transfer-specific";
212
+ return FeeCalculationTypes$1;
213
+ }({});
208
214
 
209
- // src/fees/transaction-fees.model.ts
210
- var transactionFeeTiers = ["low", "standard", "high"];
211
- var transactionFeeQuoteType = [
212
- "flat",
213
- "bitcoinFeeRate",
214
- "stacksFeeRate",
215
- "evm1559"
215
+ //#endregion
216
+ //#region src/fees/transaction-fees.model.ts
217
+ const transactionFeeTiers = [
218
+ "low",
219
+ "standard",
220
+ "high"
221
+ ];
222
+ const transactionFeeQuoteType = [
223
+ "flat",
224
+ "bitcoinFeeRate",
225
+ "stacksFeeRate",
226
+ "evm1559"
216
227
  ];
217
228
 
218
- // src/inscription-mime-type.model.ts
219
- var inscriptionMimeTypes = [
220
- "audio",
221
- "gltf",
222
- "html",
223
- "image",
224
- "svg",
225
- "text",
226
- "video",
227
- "other"
229
+ //#endregion
230
+ //#region src/inscription-mime-type.model.ts
231
+ /**
232
+ * Inscriptions contain arbitrary data. When retrieving an inscription, it should be
233
+ * classified into one of the types below, indicating that the app can handle it
234
+ * appropriately and securely. Inscriptions of types not ready to be handled by the
235
+ * app should be classified as "other".
236
+ */
237
+ const inscriptionMimeTypes = [
238
+ "audio",
239
+ "gltf",
240
+ "html",
241
+ "image",
242
+ "svg",
243
+ "text",
244
+ "video",
245
+ "other"
228
246
  ];
229
247
 
230
- // src/market.model.ts
248
+ //#endregion
249
+ //#region src/market.model.ts
231
250
  function createMarketPair(base, quote) {
232
- return Object.freeze({ base, quote });
251
+ return Object.freeze({
252
+ base,
253
+ quote
254
+ });
233
255
  }
234
256
  function formatMarketPair({ base, quote }) {
235
- return `${base}/${quote}`;
257
+ return `${base}/${quote}`;
236
258
  }
237
259
  function createMarketData(pair, price) {
238
- if (pair.quote !== price.symbol)
239
- throw new Error("Cannot create market data when price does not match quote");
240
- return Object.freeze({ pair, price });
241
- }
242
- var historicalPeriods = ["1d", "1w", "1m", "3m", "6m", "1y"];
260
+ if (pair.quote !== price.symbol) throw new Error("Cannot create market data when price does not match quote");
261
+ return Object.freeze({
262
+ pair,
263
+ price
264
+ });
265
+ }
266
+ const historicalPeriods = [
267
+ "1d",
268
+ "1w",
269
+ "1m",
270
+ "3m",
271
+ "6m",
272
+ "1y"
273
+ ];
243
274
 
244
- // src/network/network.model.ts
245
- import { z as z3 } from "zod";
246
- var HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
247
- var HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
248
- var HIRO_API_BASE_URL_NAKAMOTO_TESTNET = "https://api.nakamoto.testnet.hiro.so";
249
- var HIRO_API_BASE_URL_MAINNET_EXTENDED = "https://api.hiro.so/extended/v1";
250
- var HIRO_API_BASE_URL_TESTNET_EXTENDED = "https://api.testnet.hiro.so/extended";
251
- var BITCOIN_API_BASE_URL_MAINNET = "https://leather.mempool.space/api";
252
- var BITCOIN_API_BASE_URL_TESTNET3 = "https://leather.mempool.space/testnet/api";
253
- var BITCOIN_API_BASE_URL_TESTNET4 = "https://leather.mempool.space/testnet4/api";
254
- var BITCOIN_API_BASE_URL_SIGNET = "https://mempool.space/signet/api";
255
- var BESTINSLOT_API_BASE_URL_MAINNET = "https://leatherapi.bestinslot.xyz/v3";
256
- var BESTINSLOT_API_BASE_URL_TESTNET = "https://leatherapi_testnet.bestinslot.xyz/v3";
257
- var STX20_API_BASE_URL_MAINNET = "https://api.stx20.com/api/v1";
258
- var BNS_V2_API_BASE_URL = "https://api.bnsv2.com";
259
- var ChainId = /* @__PURE__ */ ((ChainId2) => {
260
- ChainId2[ChainId2["Testnet"] = 2147483648] = "Testnet";
261
- ChainId2[ChainId2["Mainnet"] = 1] = "Mainnet";
262
- return ChainId2;
263
- })(ChainId || {});
264
- var WalletDefaultNetworkConfigurationIds = /* @__PURE__ */ ((WalletDefaultNetworkConfigurationIds2) => {
265
- WalletDefaultNetworkConfigurationIds2["mainnet"] = "mainnet";
266
- WalletDefaultNetworkConfigurationIds2["testnet"] = "testnet";
267
- WalletDefaultNetworkConfigurationIds2["testnet4"] = "testnet4";
268
- WalletDefaultNetworkConfigurationIds2["signet"] = "signet";
269
- WalletDefaultNetworkConfigurationIds2["sbtcTestnet"] = "sbtcTestnet";
270
- WalletDefaultNetworkConfigurationIds2["sbtcDevenv"] = "sbtcDevenv";
271
- WalletDefaultNetworkConfigurationIds2["devnet"] = "devnet";
272
- return WalletDefaultNetworkConfigurationIds2;
273
- })(WalletDefaultNetworkConfigurationIds || {});
274
- var defaultNetworkConfigurationsSchema = z3.enum([
275
- "mainnet",
276
- "testnet",
277
- "testnet4",
278
- "signet",
279
- "sbtcTestnet",
280
- "sbtcDevenv",
281
- "devnet"
275
+ //#endregion
276
+ //#region src/network/network.model.ts
277
+ const HIRO_API_BASE_URL_MAINNET = "https://api.hiro.so";
278
+ const HIRO_API_BASE_URL_TESTNET = "https://api.testnet.hiro.so";
279
+ const HIRO_API_BASE_URL_NAKAMOTO_TESTNET = "https://api.nakamoto.testnet.hiro.so";
280
+ const HIRO_API_BASE_URL_MAINNET_EXTENDED = "https://api.hiro.so/extended/v1";
281
+ const HIRO_API_BASE_URL_TESTNET_EXTENDED = "https://api.testnet.hiro.so/extended";
282
+ const BITCOIN_API_BASE_URL_MAINNET = "https://leather.mempool.space/api";
283
+ const BITCOIN_API_BASE_URL_TESTNET3 = "https://leather.mempool.space/testnet/api";
284
+ const BITCOIN_API_BASE_URL_TESTNET4 = "https://leather.mempool.space/testnet4/api";
285
+ const BITCOIN_API_BASE_URL_SIGNET = "https://mempool.space/signet/api";
286
+ const BESTINSLOT_API_BASE_URL_MAINNET = "https://leatherapi.bestinslot.xyz/v3";
287
+ const BESTINSLOT_API_BASE_URL_TESTNET = "https://leatherapi_testnet.bestinslot.xyz/v3";
288
+ const STX20_API_BASE_URL_MAINNET = "https://api.stx20.com/api/v1";
289
+ const BNS_V2_API_BASE_URL = "https://api.bnsv2.com";
290
+ let ChainId = /* @__PURE__ */ function(ChainId$1) {
291
+ ChainId$1[ChainId$1["Testnet"] = 2147483648] = "Testnet";
292
+ ChainId$1[ChainId$1["Mainnet"] = 1] = "Mainnet";
293
+ return ChainId$1;
294
+ }({});
295
+ let WalletDefaultNetworkConfigurationIds = /* @__PURE__ */ function(WalletDefaultNetworkConfigurationIds$1) {
296
+ WalletDefaultNetworkConfigurationIds$1["mainnet"] = "mainnet";
297
+ WalletDefaultNetworkConfigurationIds$1["testnet"] = "testnet";
298
+ WalletDefaultNetworkConfigurationIds$1["testnet4"] = "testnet4";
299
+ WalletDefaultNetworkConfigurationIds$1["signet"] = "signet";
300
+ WalletDefaultNetworkConfigurationIds$1["sbtcTestnet"] = "sbtcTestnet";
301
+ WalletDefaultNetworkConfigurationIds$1["sbtcDevenv"] = "sbtcDevenv";
302
+ WalletDefaultNetworkConfigurationIds$1["devnet"] = "devnet";
303
+ return WalletDefaultNetworkConfigurationIds$1;
304
+ }({});
305
+ const defaultNetworkConfigurationsSchema = z.enum([
306
+ "mainnet",
307
+ "testnet",
308
+ "testnet4",
309
+ "signet",
310
+ "sbtcTestnet",
311
+ "sbtcDevenv",
312
+ "devnet"
282
313
  ]);
283
- var supportedBlockchains = ["stacks", "bitcoin"];
284
- var networkModes = ["mainnet", "testnet"];
285
- var testnetModes = ["testnet", "regtest", "signet"];
286
- var bitcoinNetworks = ["mainnet", "testnet3", "testnet4", "regtest", "signet"];
314
+ const supportedBlockchains = ["stacks", "bitcoin"];
315
+ const networkModes = ["mainnet", "testnet"];
316
+ const testnetModes = [
317
+ "testnet",
318
+ "regtest",
319
+ "signet"
320
+ ];
321
+ const bitcoinNetworks = [
322
+ "mainnet",
323
+ "testnet3",
324
+ "testnet4",
325
+ "regtest",
326
+ "signet"
327
+ ];
287
328
  function bitcoinNetworkToNetworkMode(network) {
288
- switch (network) {
289
- case "mainnet":
290
- return "mainnet";
291
- case "testnet3":
292
- return "testnet";
293
- case "testnet4":
294
- return "testnet";
295
- case "regtest":
296
- return "regtest";
297
- case "signet":
298
- return "signet";
299
- default:
300
- throw new Error(`Unhandled case: ${network}`);
301
- }
302
- }
303
- var networkMainnet = {
304
- id: "mainnet" /* mainnet */,
305
- name: "Mainnet",
306
- chain: {
307
- stacks: {
308
- blockchain: "stacks",
309
- chainId: 1 /* Mainnet */,
310
- url: HIRO_API_BASE_URL_MAINNET
311
- },
312
- bitcoin: {
313
- blockchain: "bitcoin",
314
- bitcoinNetwork: "mainnet",
315
- mode: "mainnet",
316
- bitcoinUrl: BITCOIN_API_BASE_URL_MAINNET
317
- }
318
- }
329
+ switch (network) {
330
+ case "mainnet": return "mainnet";
331
+ case "testnet3": return "testnet";
332
+ case "testnet4": return "testnet";
333
+ case "regtest": return "regtest";
334
+ case "signet": return "signet";
335
+ default: throw new Error(`Unhandled case: ${network}`);
336
+ }
337
+ }
338
+ const networkMainnet = {
339
+ id: WalletDefaultNetworkConfigurationIds.mainnet,
340
+ name: "Mainnet",
341
+ chain: {
342
+ stacks: {
343
+ blockchain: "stacks",
344
+ chainId: ChainId.Mainnet,
345
+ url: HIRO_API_BASE_URL_MAINNET
346
+ },
347
+ bitcoin: {
348
+ blockchain: "bitcoin",
349
+ bitcoinNetwork: "mainnet",
350
+ mode: "mainnet",
351
+ bitcoinUrl: BITCOIN_API_BASE_URL_MAINNET
352
+ }
353
+ }
319
354
  };
320
- var networkTestnet = {
321
- id: "testnet" /* testnet */,
322
- name: "Testnet3",
323
- chain: {
324
- stacks: {
325
- blockchain: "stacks",
326
- chainId: 2147483648 /* Testnet */,
327
- url: HIRO_API_BASE_URL_TESTNET
328
- },
329
- bitcoin: {
330
- blockchain: "bitcoin",
331
- bitcoinNetwork: "testnet3",
332
- mode: "testnet",
333
- bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET3
334
- }
335
- }
355
+ const networkTestnet = {
356
+ id: WalletDefaultNetworkConfigurationIds.testnet,
357
+ name: "Testnet3",
358
+ chain: {
359
+ stacks: {
360
+ blockchain: "stacks",
361
+ chainId: ChainId.Testnet,
362
+ url: HIRO_API_BASE_URL_TESTNET
363
+ },
364
+ bitcoin: {
365
+ blockchain: "bitcoin",
366
+ bitcoinNetwork: "testnet3",
367
+ mode: "testnet",
368
+ bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET3
369
+ }
370
+ }
336
371
  };
337
- var networkTestnet4 = {
338
- id: "testnet4" /* testnet4 */,
339
- name: "Testnet4",
340
- chain: {
341
- stacks: {
342
- blockchain: "stacks",
343
- chainId: 2147483648 /* Testnet */,
344
- url: HIRO_API_BASE_URL_TESTNET
345
- },
346
- bitcoin: {
347
- blockchain: "bitcoin",
348
- bitcoinNetwork: "testnet4",
349
- mode: "testnet",
350
- bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET4
351
- }
352
- }
372
+ const networkTestnet4 = {
373
+ id: WalletDefaultNetworkConfigurationIds.testnet4,
374
+ name: "Testnet4",
375
+ chain: {
376
+ stacks: {
377
+ blockchain: "stacks",
378
+ chainId: ChainId.Testnet,
379
+ url: HIRO_API_BASE_URL_TESTNET
380
+ },
381
+ bitcoin: {
382
+ blockchain: "bitcoin",
383
+ bitcoinNetwork: "testnet4",
384
+ mode: "testnet",
385
+ bitcoinUrl: BITCOIN_API_BASE_URL_TESTNET4
386
+ }
387
+ }
353
388
  };
354
- var networkSignet = {
355
- id: "signet" /* signet */,
356
- name: "Signet",
357
- chain: {
358
- stacks: {
359
- blockchain: "stacks",
360
- chainId: 2147483648 /* Testnet */,
361
- url: HIRO_API_BASE_URL_TESTNET
362
- },
363
- bitcoin: {
364
- blockchain: "bitcoin",
365
- bitcoinNetwork: "signet",
366
- mode: "signet",
367
- bitcoinUrl: BITCOIN_API_BASE_URL_SIGNET
368
- }
369
- }
389
+ const networkSignet = {
390
+ id: WalletDefaultNetworkConfigurationIds.signet,
391
+ name: "Signet",
392
+ chain: {
393
+ stacks: {
394
+ blockchain: "stacks",
395
+ chainId: ChainId.Testnet,
396
+ url: HIRO_API_BASE_URL_TESTNET
397
+ },
398
+ bitcoin: {
399
+ blockchain: "bitcoin",
400
+ bitcoinNetwork: "signet",
401
+ mode: "signet",
402
+ bitcoinUrl: BITCOIN_API_BASE_URL_SIGNET
403
+ }
404
+ }
370
405
  };
371
- var networkSbtcTestnet = {
372
- id: "sbtcTestnet" /* sbtcTestnet */,
373
- name: "sBTC Testnet",
374
- chain: {
375
- stacks: {
376
- blockchain: "stacks",
377
- chainId: 2147483648 /* Testnet */,
378
- url: HIRO_API_BASE_URL_TESTNET
379
- },
380
- bitcoin: {
381
- blockchain: "bitcoin",
382
- bitcoinNetwork: "regtest",
383
- mode: "regtest",
384
- bitcoinUrl: "https://beta.sbtc-mempool.tech/api/proxy"
385
- }
386
- }
406
+ const networkSbtcTestnet = {
407
+ id: WalletDefaultNetworkConfigurationIds.sbtcTestnet,
408
+ name: "sBTC Testnet",
409
+ chain: {
410
+ stacks: {
411
+ blockchain: "stacks",
412
+ chainId: ChainId.Testnet,
413
+ url: HIRO_API_BASE_URL_TESTNET
414
+ },
415
+ bitcoin: {
416
+ blockchain: "bitcoin",
417
+ bitcoinNetwork: "regtest",
418
+ mode: "regtest",
419
+ bitcoinUrl: "https://beta.sbtc-mempool.tech/api/proxy"
420
+ }
421
+ }
387
422
  };
388
- var networkSbtcDevenv = {
389
- id: "sbtcDevenv" /* sbtcDevenv */,
390
- name: "sBTC Devenv",
391
- chain: {
392
- stacks: {
393
- blockchain: "stacks",
394
- chainId: 2147483648 /* Testnet */,
395
- url: "http://localhost:3999"
396
- },
397
- bitcoin: {
398
- blockchain: "bitcoin",
399
- bitcoinNetwork: "regtest",
400
- mode: "regtest",
401
- bitcoinUrl: "http://localhost:3000/api/proxy"
402
- }
403
- }
423
+ const networkSbtcDevenv = {
424
+ id: WalletDefaultNetworkConfigurationIds.sbtcDevenv,
425
+ name: "sBTC Devenv",
426
+ chain: {
427
+ stacks: {
428
+ blockchain: "stacks",
429
+ chainId: ChainId.Testnet,
430
+ url: "http://localhost:3999"
431
+ },
432
+ bitcoin: {
433
+ blockchain: "bitcoin",
434
+ bitcoinNetwork: "regtest",
435
+ mode: "regtest",
436
+ bitcoinUrl: "http://localhost:3000/api/proxy"
437
+ }
438
+ }
404
439
  };
405
- var networkDevnet = {
406
- id: "devnet" /* devnet */,
407
- name: "Devnet",
408
- chain: {
409
- stacks: {
410
- blockchain: "stacks",
411
- chainId: 2147483648 /* Testnet */,
412
- url: "http://localhost:3999"
413
- },
414
- bitcoin: {
415
- blockchain: "bitcoin",
416
- bitcoinNetwork: "regtest",
417
- mode: "regtest",
418
- bitcoinUrl: "http://localhost:18443"
419
- }
420
- }
440
+ const networkDevnet = {
441
+ id: WalletDefaultNetworkConfigurationIds.devnet,
442
+ name: "Devnet",
443
+ chain: {
444
+ stacks: {
445
+ blockchain: "stacks",
446
+ chainId: ChainId.Testnet,
447
+ url: "http://localhost:3999"
448
+ },
449
+ bitcoin: {
450
+ blockchain: "bitcoin",
451
+ bitcoinNetwork: "regtest",
452
+ mode: "regtest",
453
+ bitcoinUrl: "http://localhost:18443"
454
+ }
455
+ }
421
456
  };
422
- var defaultCurrentNetwork = networkMainnet;
423
- var defaultNetworksKeyedById = {
424
- ["mainnet" /* mainnet */]: networkMainnet,
425
- ["testnet4" /* testnet4 */]: networkTestnet4,
426
- ["testnet" /* testnet */]: networkTestnet,
427
- ["signet" /* signet */]: networkSignet,
428
- ["sbtcTestnet" /* sbtcTestnet */]: networkSbtcTestnet,
429
- ["sbtcDevenv" /* sbtcDevenv */]: networkSbtcDevenv,
430
- ["devnet" /* devnet */]: networkDevnet
457
+ const defaultCurrentNetwork = networkMainnet;
458
+ const defaultNetworksKeyedById = {
459
+ [WalletDefaultNetworkConfigurationIds.mainnet]: networkMainnet,
460
+ [WalletDefaultNetworkConfigurationIds.testnet4]: networkTestnet4,
461
+ [WalletDefaultNetworkConfigurationIds.testnet]: networkTestnet,
462
+ [WalletDefaultNetworkConfigurationIds.signet]: networkSignet,
463
+ [WalletDefaultNetworkConfigurationIds.sbtcTestnet]: networkSbtcTestnet,
464
+ [WalletDefaultNetworkConfigurationIds.sbtcDevenv]: networkSbtcDevenv,
465
+ [WalletDefaultNetworkConfigurationIds.devnet]: networkDevnet
431
466
  };
432
467
 
433
- // src/network/network.schema.ts
434
- import { z as z4 } from "zod";
435
- var bitcoinNetworkModesSchema = z4.enum([...networkModes, ...testnetModes]);
436
- var bitcoinNetworkSchema = z4.enum([...bitcoinNetworks]);
437
- var networkConfigurationSchema = z4.object({
438
- name: z4.string(),
439
- id: z4.string(),
440
- chain: z4.object({
441
- bitcoin: z4.object({
442
- blockchain: z4.literal("bitcoin"),
443
- bitcoinUrl: z4.string(),
444
- bitcoinNetwork: bitcoinNetworkSchema,
445
- mode: bitcoinNetworkModesSchema
446
- }),
447
- stacks: z4.object({
448
- blockchain: z4.literal("stacks"),
449
- url: z4.string(),
450
- chainId: z4.number(),
451
- subnetChainId: z4.number().optional()
452
- })
453
- })
468
+ //#endregion
469
+ //#region src/network/network.schema.ts
470
+ const bitcoinNetworkModesSchema = z.enum([...networkModes, ...testnetModes]);
471
+ const bitcoinNetworkSchema = z.enum([...bitcoinNetworks]);
472
+ const networkConfigurationSchema = z.object({
473
+ name: z.string(),
474
+ id: z.string(),
475
+ chain: z.object({
476
+ bitcoin: z.object({
477
+ blockchain: z.literal("bitcoin"),
478
+ bitcoinUrl: z.string(),
479
+ bitcoinNetwork: bitcoinNetworkSchema,
480
+ mode: bitcoinNetworkModesSchema
481
+ }),
482
+ stacks: z.object({
483
+ blockchain: z.literal("stacks"),
484
+ url: z.string(),
485
+ chainId: z.number(),
486
+ subnetChainId: z.number().optional()
487
+ })
488
+ })
454
489
  });
455
490
 
456
- // src/settings.model.ts
457
- import { z as z5 } from "zod";
458
- var accountDisplayPreferenceSchema = z5.enum(["native-segwit", "taproot", "bns", "stacks"]);
459
- var analyticsPreferenceSchema = z5.enum(["consent-given", "rejects-tracking"]);
460
- var emailAddressSchema = z5.email({ error: "Invalid email address" });
491
+ //#endregion
492
+ //#region src/settings.model.ts
493
+ const accountDisplayPreferenceSchema = z.enum([
494
+ "native-segwit",
495
+ "taproot",
496
+ "bns",
497
+ "stacks"
498
+ ]);
499
+ const analyticsPreferenceSchema = z.enum(["consent-given", "rejects-tracking"]);
500
+ const emailAddressSchema = z.email({ error: "Invalid email address" });
461
501
 
462
- // src/swap/swap.model.ts
463
- var swapProviderIds = ["bitflow-sdk", "sbtc-bridge", "alex-sdk", "velar-sdk"];
464
- var swapExecutionTypes = ["stacks-contract-call", "sbtc-bridge-transfer"];
502
+ //#endregion
503
+ //#region src/swap/swap.model.ts
504
+ const swapProviderIds = [
505
+ "bitflow-sdk",
506
+ "sbtc-bridge",
507
+ "alex-sdk",
508
+ "velar-sdk"
509
+ ];
510
+ const swapExecutionTypes = ["stacks-contract-call", "sbtc-bridge-transfer"];
465
511
 
466
- // src/yield/yield-provider.model.ts
467
- var YieldProviderKeys = {
468
- bitflow: "bitflow",
469
- zest: "zest",
470
- granite: "granite",
471
- stackingDao: "stackingdao",
472
- lisa: "lisa",
473
- hermetica: "hermetica",
474
- fastPool: "fast-pool",
475
- xverse: "xverse",
476
- velar: "velar"
512
+ //#endregion
513
+ //#region src/yield/yield-provider.model.ts
514
+ const YieldProviderKeys = {
515
+ bitflow: "bitflow",
516
+ zest: "zest",
517
+ granite: "granite",
518
+ stackingDao: "stackingdao",
519
+ lisa: "lisa",
520
+ hermetica: "hermetica",
521
+ fastPool: "fast-pool",
522
+ xverse: "xverse",
523
+ velar: "velar"
477
524
  };
478
525
 
479
- // src/yield/yield-product.model.ts
480
- var YieldProductKeys = {
481
- bitflowAmmLp: "bitflow-amm-lp",
482
- bitflowAmmStaking: "bitflow-amm-staking",
483
- zestBorrowMarket: "zest-borrow-market",
484
- graniteV1Earn: "granite-v1-earn",
485
- graniteV1Borrow: "granite-v1-borrow",
486
- stackingDaoStstx: "stackingdao-ststx",
487
- stackingDaoStstxbtc: "stackingdao-ststxbtc",
488
- stackingDaoPooledStacking: "stackingdao-pooled-stacking",
489
- lisaListx: "lisa-listx",
490
- lisaLiquidStaking: "lisa-liquid-staking",
491
- hermeticaUsdhStaking: "hermetica-usdh-staking",
492
- velarAmmLp: "velar-amm-lp",
493
- velarPerps: "velar-perps",
494
- velarAmmLpFarming: "velar-amm-lp-farming",
495
- fastPoolPooledStacking: "fast-pool-pooled-stacking",
496
- xversePooledStacking: "xverse-pooled-stacking"
526
+ //#endregion
527
+ //#region src/yield/yield-product.model.ts
528
+ const YieldProductKeys = {
529
+ bitflowAmmLp: "bitflow-amm-lp",
530
+ bitflowAmmStaking: "bitflow-amm-staking",
531
+ zestBorrowMarket: "zest-borrow-market",
532
+ graniteV1Earn: "granite-v1-earn",
533
+ graniteV1Borrow: "granite-v1-borrow",
534
+ stackingDaoStstx: "stackingdao-ststx",
535
+ stackingDaoStstxbtc: "stackingdao-ststxbtc",
536
+ stackingDaoPooledStacking: "stackingdao-pooled-stacking",
537
+ lisaListx: "lisa-listx",
538
+ lisaLiquidStaking: "lisa-liquid-staking",
539
+ hermeticaUsdhStaking: "hermetica-usdh-staking",
540
+ velarAmmLp: "velar-amm-lp",
541
+ velarPerps: "velar-perps",
542
+ velarAmmLpFarming: "velar-amm-lp-farming",
543
+ fastPoolPooledStacking: "fast-pool-pooled-stacking",
544
+ xversePooledStacking: "xverse-pooled-stacking"
497
545
  };
498
- var YieldProductCategories = {
499
- AMM: "amm",
500
- LENDING: "lending",
501
- LIQUID_STACKING: "liquid-stacking",
502
- POOLED_STACKING: "pooled-stacking",
503
- STAKING: "staking",
504
- PERPS: "perps"
546
+ const YieldProductCategories = {
547
+ AMM: "amm",
548
+ LENDING: "lending",
549
+ LIQUID_STACKING: "liquid-stacking",
550
+ POOLED_STACKING: "pooled-stacking",
551
+ STAKING: "staking",
552
+ PERPS: "perps"
505
553
  };
506
- var YieldProductToProviderMap = {
507
- [YieldProductKeys.bitflowAmmLp]: YieldProviderKeys.bitflow,
508
- [YieldProductKeys.bitflowAmmStaking]: YieldProviderKeys.bitflow,
509
- [YieldProductKeys.zestBorrowMarket]: YieldProviderKeys.zest,
510
- [YieldProductKeys.graniteV1Earn]: YieldProviderKeys.granite,
511
- [YieldProductKeys.graniteV1Borrow]: YieldProviderKeys.granite,
512
- [YieldProductKeys.stackingDaoStstx]: YieldProviderKeys.stackingDao,
513
- [YieldProductKeys.stackingDaoStstxbtc]: YieldProviderKeys.stackingDao,
514
- [YieldProductKeys.stackingDaoPooledStacking]: YieldProviderKeys.stackingDao,
515
- [YieldProductKeys.lisaListx]: YieldProviderKeys.lisa,
516
- [YieldProductKeys.lisaLiquidStaking]: YieldProviderKeys.lisa,
517
- [YieldProductKeys.hermeticaUsdhStaking]: YieldProviderKeys.hermetica,
518
- [YieldProductKeys.velarAmmLp]: YieldProviderKeys.velar,
519
- [YieldProductKeys.velarPerps]: YieldProviderKeys.velar,
520
- [YieldProductKeys.velarAmmLpFarming]: YieldProviderKeys.velar,
521
- [YieldProductKeys.fastPoolPooledStacking]: YieldProviderKeys.fastPool,
522
- [YieldProductKeys.xversePooledStacking]: YieldProviderKeys.xverse
554
+ const YieldProductToProviderMap = {
555
+ [YieldProductKeys.bitflowAmmLp]: YieldProviderKeys.bitflow,
556
+ [YieldProductKeys.bitflowAmmStaking]: YieldProviderKeys.bitflow,
557
+ [YieldProductKeys.zestBorrowMarket]: YieldProviderKeys.zest,
558
+ [YieldProductKeys.graniteV1Earn]: YieldProviderKeys.granite,
559
+ [YieldProductKeys.graniteV1Borrow]: YieldProviderKeys.granite,
560
+ [YieldProductKeys.stackingDaoStstx]: YieldProviderKeys.stackingDao,
561
+ [YieldProductKeys.stackingDaoStstxbtc]: YieldProviderKeys.stackingDao,
562
+ [YieldProductKeys.stackingDaoPooledStacking]: YieldProviderKeys.stackingDao,
563
+ [YieldProductKeys.lisaListx]: YieldProviderKeys.lisa,
564
+ [YieldProductKeys.lisaLiquidStaking]: YieldProviderKeys.lisa,
565
+ [YieldProductKeys.hermeticaUsdhStaking]: YieldProviderKeys.hermetica,
566
+ [YieldProductKeys.velarAmmLp]: YieldProviderKeys.velar,
567
+ [YieldProductKeys.velarPerps]: YieldProviderKeys.velar,
568
+ [YieldProductKeys.velarAmmLpFarming]: YieldProviderKeys.velar,
569
+ [YieldProductKeys.fastPoolPooledStacking]: YieldProviderKeys.fastPool,
570
+ [YieldProductKeys.xversePooledStacking]: YieldProviderKeys.xverse
523
571
  };
524
572
 
525
- // src/yield/helpers/yield.helpers.ts
573
+ //#endregion
574
+ //#region src/yield/helpers/yield.helpers.ts
526
575
  function isBitflowAmmLpPosition(pos) {
527
- return pos.product === YieldProductKeys.bitflowAmmLp;
576
+ return pos.product === YieldProductKeys.bitflowAmmLp;
528
577
  }
529
578
  function isBitflowAmmStakingPosition(pos) {
530
- return pos.product === YieldProductKeys.bitflowAmmStaking;
579
+ return pos.product === YieldProductKeys.bitflowAmmStaking;
531
580
  }
532
581
  function isZestPosition(pos) {
533
- return pos.product === YieldProductKeys.zestBorrowMarket;
582
+ return pos.product === YieldProductKeys.zestBorrowMarket;
534
583
  }
535
584
  function isGraniteEarnPosition(pos) {
536
- return pos.product === YieldProductKeys.graniteV1Earn;
585
+ return pos.product === YieldProductKeys.graniteV1Earn;
537
586
  }
538
587
  function isGraniteBorrowPosition(pos) {
539
- return pos.product === YieldProductKeys.graniteV1Borrow;
588
+ return pos.product === YieldProductKeys.graniteV1Borrow;
540
589
  }
541
590
  function isStackingDaoStStxPosition(pos) {
542
- return pos.product === YieldProductKeys.stackingDaoStstx;
591
+ return pos.product === YieldProductKeys.stackingDaoStstx;
543
592
  }
544
593
  function isStackingDaoStStxBtcPosition(pos) {
545
- return pos.product === YieldProductKeys.stackingDaoStstxbtc;
594
+ return pos.product === YieldProductKeys.stackingDaoStstxbtc;
546
595
  }
547
596
  function isStackingDaoPooledPosition(pos) {
548
- return pos.product === YieldProductKeys.stackingDaoPooledStacking;
597
+ return pos.product === YieldProductKeys.stackingDaoPooledStacking;
549
598
  }
550
599
  function filterPositionsByProvider(positions, provider) {
551
- return positions.filter((p) => p.provider === provider);
600
+ return positions.filter((p) => p.provider === provider);
552
601
  }
553
602
  function filterPositionsByProduct(positions, product) {
554
- return positions.filter((p) => p.product === product);
603
+ return positions.filter((p) => p.product === product);
555
604
  }
556
605
  function filterPositionsByCategory(positions, products, category) {
557
- const productMap = new Map(products.map((p) => [p.key, p]));
558
- return positions.filter((pos) => productMap.get(pos.product)?.category === category);
606
+ const productMap = new Map(products.map((p) => [p.key, p]));
607
+ return positions.filter((pos) => productMap.get(pos.product)?.category === category);
559
608
  }
560
609
  function sortPositionsByBalance(positions, ascending = false) {
561
- return [...positions].sort((a, b) => {
562
- const diff = a.totalBalance.amount.comparedTo(b.totalBalance.amount);
563
- return ascending ? diff : -diff;
564
- });
610
+ return [...positions].sort((a, b) => {
611
+ const diff = a.totalBalance.amount.comparedTo(b.totalBalance.amount);
612
+ return ascending ? diff : -diff;
613
+ });
565
614
  }
566
615
  function sortPositionsByApy(positions, ascending = false) {
567
- return [...positions].sort((a, b) => {
568
- const apyA = a.apy;
569
- const apyB = b.apy;
570
- return ascending ? apyA - apyB : apyB - apyA;
571
- });
616
+ return [...positions].sort((a, b) => {
617
+ const apyA = a.apy;
618
+ const apyB = b.apy;
619
+ return ascending ? apyA - apyB : apyB - apyA;
620
+ });
572
621
  }
573
622
  function sortPositionsByUpdateTime(positions, ascending = false) {
574
- return [...positions].sort((a, b) => {
575
- const timeA = "updatedAt" in a && a.updatedAt instanceof Date ? a.updatedAt.getTime() : 0;
576
- const timeB = "updatedAt" in b && b.updatedAt instanceof Date ? b.updatedAt.getTime() : 0;
577
- return ascending ? timeA - timeB : timeB - timeA;
578
- });
623
+ return [...positions].sort((a, b) => {
624
+ const timeA = "updatedAt" in a && a.updatedAt instanceof Date ? a.updatedAt.getTime() : 0;
625
+ const timeB = "updatedAt" in b && b.updatedAt instanceof Date ? b.updatedAt.getTime() : 0;
626
+ return ascending ? timeA - timeB : timeB - timeA;
627
+ });
579
628
  }
580
629
  function getProviderForProduct(product) {
581
- return YieldProductToProviderMap[product];
630
+ return YieldProductToProviderMap[product];
582
631
  }
583
632
  function getCategoryForProduct(product) {
584
- return product.category;
633
+ return product.category;
585
634
  }
586
635
  function isProductInProvider(product, provider) {
587
- return YieldProductToProviderMap[product] === provider;
636
+ return YieldProductToProviderMap[product] === provider;
588
637
  }
589
638
  function getProductsForProvider(provider) {
590
- return Object.entries(YieldProductToProviderMap).filter(([_, p]) => p === provider).map(([product]) => product);
639
+ return Object.entries(YieldProductToProviderMap).filter(([_, p]) => p === provider).map(([product]) => product);
591
640
  }
592
641
  function getProductsInCategory(products, category) {
593
- return products.filter((p) => p.category === category);
642
+ return products.filter((p) => p.category === category);
594
643
  }
595
644
  function groupPositionsByProvider(positions) {
596
- const grouped = {};
597
- for (const position of positions) {
598
- const provider = position.provider;
599
- if (!grouped[provider]) {
600
- grouped[provider] = [];
601
- }
602
- grouped[provider].push(position);
603
- }
604
- return grouped;
645
+ const grouped = {};
646
+ for (const position of positions) {
647
+ const provider = position.provider;
648
+ if (!grouped[provider]) grouped[provider] = [];
649
+ grouped[provider].push(position);
650
+ }
651
+ return grouped;
605
652
  }
606
653
  function groupPositionsByCategory(positions, products) {
607
- const grouped = {};
608
- const productMap = new Map(products.map((p) => [p.key, p]));
609
- for (const position of positions) {
610
- const product = productMap.get(position.product);
611
- if (!product) continue;
612
- const category = product.category;
613
- if (!grouped[category]) {
614
- grouped[category] = [];
615
- }
616
- grouped[category].push(position);
617
- }
618
- return grouped;
654
+ const grouped = {};
655
+ const productMap = new Map(products.map((p) => [p.key, p]));
656
+ for (const position of positions) {
657
+ const product = productMap.get(position.product);
658
+ if (!product) continue;
659
+ const category = product.category;
660
+ if (!grouped[category]) grouped[category] = [];
661
+ grouped[category].push(position);
662
+ }
663
+ return grouped;
619
664
  }
620
665
  function getPositionsInCategories(positions, products, categories) {
621
- const categorySet = new Set(categories);
622
- const productMap = new Map(products.map((p) => [p.key, p]));
623
- return positions.filter((pos) => {
624
- const product = productMap.get(pos.product);
625
- return product && categorySet.has(product.category);
626
- });
666
+ const categorySet = new Set(categories);
667
+ const productMap = new Map(products.map((p) => [p.key, p]));
668
+ return positions.filter((pos) => {
669
+ const product = productMap.get(pos.product);
670
+ return product && categorySet.has(product.category);
671
+ });
627
672
  }
628
673
  function hasPositionsInProvider(positions, provider) {
629
- return positions.some((p) => p.provider === provider);
674
+ return positions.some((p) => p.provider === provider);
630
675
  }
631
676
  function hasPositionsInCategory(positions, products, category) {
632
- const productMap = new Map(products.map((p) => [p.key, p]));
633
- return positions.some((pos) => productMap.get(pos.product)?.category === category);
677
+ const productMap = new Map(products.map((p) => [p.key, p]));
678
+ return positions.some((pos) => productMap.get(pos.product)?.category === category);
634
679
  }
635
680
  function enrichPositionWithProvider(position, provider) {
636
- return { ...position, providerData: provider };
681
+ return {
682
+ ...position,
683
+ providerData: provider
684
+ };
637
685
  }
638
686
  function enrichPositionWithProduct(position, product) {
639
- return { ...position, productData: product };
687
+ return {
688
+ ...position,
689
+ productData: product
690
+ };
640
691
  }
641
692
  function enrichPositionWithMetadata(position, provider, product) {
642
- return { ...position, providerData: provider, productData: product };
693
+ return {
694
+ ...position,
695
+ providerData: provider,
696
+ productData: product
697
+ };
643
698
  }
644
699
  function getCategoryDisplayName(category) {
645
- const displayNames = {
646
- [YieldProductCategories.AMM]: "Liquidity Pools",
647
- [YieldProductCategories.LENDING]: "Lending & Borrowing",
648
- [YieldProductCategories.LIQUID_STACKING]: "Liquid Stacking",
649
- [YieldProductCategories.POOLED_STACKING]: "Pooled Stacking",
650
- [YieldProductCategories.STAKING]: "Staking",
651
- [YieldProductCategories.PERPS]: "Perpetuals"
652
- };
653
- return displayNames[category] || category;
700
+ return {
701
+ [YieldProductCategories.AMM]: "Liquidity Pools",
702
+ [YieldProductCategories.LENDING]: "Lending & Borrowing",
703
+ [YieldProductCategories.LIQUID_STACKING]: "Liquid Stacking",
704
+ [YieldProductCategories.POOLED_STACKING]: "Pooled Stacking",
705
+ [YieldProductCategories.STAKING]: "Staking",
706
+ [YieldProductCategories.PERPS]: "Perpetuals"
707
+ }[category] || category;
654
708
  }
655
709
 
656
- // src/activity/activity.utils.ts
657
- var HIRO_EXPLORER_URL = "https://explorer.hiro.so";
658
- var MEMPOOL_BASE_URL = "https://mempool.space";
710
+ //#endregion
711
+ //#region src/activity/activity.utils.ts
712
+ const HIRO_EXPLORER_URL = "https://explorer.hiro.so";
713
+ const MEMPOOL_BASE_URL = "https://mempool.space";
659
714
  function makeActivityLink({ txid, networkPreference, asset }) {
660
- if (txid && asset) {
661
- return makeActivityExplorerLink({
662
- asset,
663
- txid,
664
- networkPreference
665
- });
666
- }
667
- return null;
668
- }
669
- function makeActivityExplorerLink({
670
- asset,
671
- txid,
672
- networkPreference
673
- }) {
674
- if (asset.chain === "bitcoin") {
675
- return getMempoolExplorerLink({
676
- networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork,
677
- id: txid,
678
- type: "txid"
679
- });
680
- }
681
- return makeStacksTxExplorerLink({
682
- networkPreference: networkPreference.chain.stacks.chainId === 2147483648 /* Testnet */ ? "testnet" : "mainnet",
683
- searchParams: void 0,
684
- txid,
685
- explorerUrl: HIRO_EXPLORER_URL
686
- });
687
- }
688
- function makeStacksTxExplorerLink({
689
- networkPreference,
690
- searchParams = new URLSearchParams(),
691
- txid,
692
- explorerUrl
693
- }) {
694
- searchParams.append("chain", networkPreference);
695
- return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;
696
- }
697
- function getMempoolExplorerLink({
698
- id,
699
- type,
700
- networkPreference
701
- }) {
702
- switch (networkPreference) {
703
- case "mainnet":
704
- return `${MEMPOOL_BASE_URL}/${type}/${id}`;
705
- case "testnet4":
706
- return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;
707
- case "signet":
708
- return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;
709
- default:
710
- return null;
711
- }
712
- }
713
- export {
714
- ActivityLevels,
715
- BESTINSLOT_API_BASE_URL_MAINNET,
716
- BESTINSLOT_API_BASE_URL_TESTNET,
717
- BITCOIN_API_BASE_URL_MAINNET,
718
- BITCOIN_API_BASE_URL_SIGNET,
719
- BITCOIN_API_BASE_URL_TESTNET3,
720
- BITCOIN_API_BASE_URL_TESTNET4,
721
- BNS_V2_API_BASE_URL,
722
- BtcFeeType,
723
- ChainId,
724
- CryptoAssetCategories,
725
- CryptoAssetChains,
726
- CryptoAssetProtocols,
727
- FeeCalculationTypes,
728
- FeeTypes,
729
- FungibleCryptoAssetProtocols,
730
- GeneralActivityTypes,
731
- HIRO_API_BASE_URL_MAINNET,
732
- HIRO_API_BASE_URL_MAINNET_EXTENDED,
733
- HIRO_API_BASE_URL_NAKAMOTO_TESTNET,
734
- HIRO_API_BASE_URL_TESTNET,
735
- HIRO_API_BASE_URL_TESTNET_EXTENDED,
736
- NonFungibleCryptoAssetProtocols,
737
- OnChainActivityStatuses,
738
- OnChainActivityTypes,
739
- STX20_API_BASE_URL_MAINNET,
740
- WalletActivityTypes,
741
- WalletDefaultNetworkConfigurationIds,
742
- YieldProductCategories,
743
- YieldProductKeys,
744
- YieldProductToProviderMap,
745
- YieldProviderKeys,
746
- accountAddressesSchema,
747
- accountDisplayPreferenceSchema,
748
- accountIdSchema,
749
- analyticsPreferenceSchema,
750
- bitcoinAddressInfoSchema,
751
- bitcoinNetworkModesSchema,
752
- bitcoinNetworkSchema,
753
- bitcoinNetworkToNetworkMode,
754
- bitcoinNetworks,
755
- bitcoinUnitSchema,
756
- bnsContractAddress,
757
- bnsContractName,
758
- btcTxTimeMap,
759
- createMarketData,
760
- createMarketPair,
761
- defaultCurrentNetwork,
762
- defaultNetworkConfigurationsSchema,
763
- defaultNetworksKeyedById,
764
- emailAddressSchema,
765
- enrichPositionWithMetadata,
766
- enrichPositionWithProduct,
767
- enrichPositionWithProvider,
768
- filterPositionsByCategory,
769
- filterPositionsByProduct,
770
- filterPositionsByProvider,
771
- formatMarketPair,
772
- getCategoryDisplayName,
773
- getCategoryForProduct,
774
- getMempoolExplorerLink,
775
- getPositionsInCategories,
776
- getProductsForProvider,
777
- getProductsInCategory,
778
- getProviderForProduct,
779
- groupPositionsByCategory,
780
- groupPositionsByProvider,
781
- hasPositionsInCategory,
782
- hasPositionsInProvider,
783
- historicalPeriods,
784
- inscriptionMimeTypes,
785
- isBitflowAmmLpPosition,
786
- isBitflowAmmStakingPosition,
787
- isBrc20Asset,
788
- isBtcAsset,
789
- isFungibleAsset,
790
- isGraniteBorrowPosition,
791
- isGraniteEarnPosition,
792
- isInscriptionAsset,
793
- isNativeAsset,
794
- isNonFungibleAsset,
795
- isProductInProvider,
796
- isRuneAsset,
797
- isSip10Asset,
798
- isSip9Asset,
799
- isSrc20Asset,
800
- isStackingDaoPooledPosition,
801
- isStackingDaoStStxBtcPosition,
802
- isStackingDaoStStxPosition,
803
- isStampAsset,
804
- isStx20Asset,
805
- isStxAsset,
806
- isSwappableAsset,
807
- isZestPosition,
808
- makeActivityLink,
809
- networkConfigurationSchema,
810
- networkModes,
811
- sip9ContentTypes,
812
- sortPositionsByApy,
813
- sortPositionsByBalance,
814
- sortPositionsByUpdateTime,
815
- stacksAddressInfoSchema,
816
- supportedBlockchains,
817
- swapExecutionTypes,
818
- swapProviderIds,
819
- testnetModes,
820
- transactionFeeQuoteType,
821
- transactionFeeTiers,
822
- walletIdSchema
823
- };
715
+ if (txid && asset) return makeActivityExplorerLink({
716
+ asset,
717
+ txid,
718
+ networkPreference
719
+ });
720
+ return null;
721
+ }
722
+ function makeActivityExplorerLink({ asset, txid, networkPreference }) {
723
+ if (asset.chain === "bitcoin") return getMempoolExplorerLink({
724
+ networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork,
725
+ id: txid,
726
+ type: "txid"
727
+ });
728
+ return makeStacksTxExplorerLink({
729
+ networkPreference: networkPreference.chain.stacks.chainId === ChainId.Testnet ? "testnet" : "mainnet",
730
+ searchParams: void 0,
731
+ txid,
732
+ explorerUrl: HIRO_EXPLORER_URL
733
+ });
734
+ }
735
+ function makeStacksTxExplorerLink({ networkPreference, searchParams = new URLSearchParams(), txid, explorerUrl }) {
736
+ searchParams.append("chain", networkPreference);
737
+ return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;
738
+ }
739
+ function getMempoolExplorerLink({ id, type, networkPreference }) {
740
+ switch (networkPreference) {
741
+ case "mainnet": return `${MEMPOOL_BASE_URL}/${type}/${id}`;
742
+ case "testnet4": return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;
743
+ case "signet": return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;
744
+ default: return null;
745
+ }
746
+ }
747
+
748
+ //#endregion
749
+ export { ActivityLevels, 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, BtcFeeType, ChainId, CryptoAssetCategories, CryptoAssetChains, CryptoAssetProtocols, FeeCalculationTypes, FeeTypes, FungibleCryptoAssetProtocols, 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, NonFungibleCryptoAssetProtocols, OnChainActivityStatuses, OnChainActivityTypes, STX20_API_BASE_URL_MAINNET, WalletActivityTypes, WalletDefaultNetworkConfigurationIds, YieldProductCategories, YieldProductKeys, YieldProductToProviderMap, YieldProviderKeys, accountAddressesSchema, accountDisplayPreferenceSchema, accountIdSchema, analyticsPreferenceSchema, bitcoinAddressInfoSchema, bitcoinNetworkModesSchema, bitcoinNetworkSchema, bitcoinNetworkToNetworkMode, bitcoinNetworks, bitcoinUnitSchema, bnsContractAddress, bnsContractName, btcTxTimeMap, createMarketData, createMarketPair, defaultCurrentNetwork, defaultNetworkConfigurationsSchema, defaultNetworksKeyedById, emailAddressSchema, enrichPositionWithMetadata, enrichPositionWithProduct, enrichPositionWithProvider, filterPositionsByCategory, filterPositionsByProduct, filterPositionsByProvider, formatMarketPair, getCategoryDisplayName, getCategoryForProduct, getMempoolExplorerLink, getPositionsInCategories, getProductsForProvider, getProductsInCategory, getProviderForProduct, groupPositionsByCategory, groupPositionsByProvider, hasPositionsInCategory, hasPositionsInProvider, historicalPeriods, inscriptionMimeTypes, isBitflowAmmLpPosition, isBitflowAmmStakingPosition, isBrc20Asset, isBtcAsset, isFungibleAsset, isGraniteBorrowPosition, isGraniteEarnPosition, isInscriptionAsset, isNativeAsset, isNonFungibleAsset, isProductInProvider, isRuneAsset, isSip10Asset, isSip9Asset, isSrc20Asset, isStackingDaoPooledPosition, isStackingDaoStStxBtcPosition, isStackingDaoStStxPosition, isStampAsset, isStx20Asset, isStxAsset, isSwappableAsset, isZestPosition, makeActivityLink, networkConfigurationSchema, networkModes, sip9ContentTypes, sortPositionsByApy, sortPositionsByBalance, sortPositionsByUpdateTime, stacksAddressInfoSchema, supportedBlockchains, swapExecutionTypes, swapProviderIds, testnetModes, transactionFeeQuoteType, transactionFeeTiers, walletIdSchema };
824
750
  //# sourceMappingURL=index.js.map