@lendasat/lendaswap-sdk 0.1.8 → 0.1.65
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/api.d.ts +138 -160
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +174 -113
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/price-calculations.d.ts +135 -0
- package/dist/price-calculations.d.ts.map +1 -0
- package/dist/price-calculations.js +171 -0
- package/dist/price-calculations.js.map +1 -0
- package/dist/price-calculations.test.d.ts +2 -0
- package/dist/price-calculations.test.d.ts.map +1 -0
- package/dist/price-calculations.test.js +173 -0
- package/dist/price-calculations.test.js.map +1 -0
- package/dist/price-feed.d.ts +3 -0
- package/dist/price-feed.d.ts.map +1 -1
- package/dist/price-feed.js.map +1 -1
- package/dist/storage/dexieSwapStorage.d.ts +12 -10
- package/dist/storage/dexieSwapStorage.d.ts.map +1 -1
- package/dist/storage/dexieSwapStorage.js +63 -2
- package/dist/storage/dexieSwapStorage.js.map +1 -1
- package/dist/storage/dexieVtxoSwapStorage.d.ts +105 -0
- package/dist/storage/dexieVtxoSwapStorage.d.ts.map +1 -0
- package/dist/storage/dexieVtxoSwapStorage.js +149 -0
- package/dist/storage/dexieVtxoSwapStorage.js.map +1 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -1
- package/dist/usd-price.d.ts.map +1 -1
- package/dist/usd-price.js +1 -0
- package/dist/usd-price.js.map +1 -1
- package/package.json +1 -1
- package/wasm/lendaswap_wasm_sdk.d.ts +361 -43
- package/wasm/lendaswap_wasm_sdk_bg.js +2499 -483
- package/wasm/lendaswap_wasm_sdk_bg.wasm +0 -0
- package/wasm/lendaswap_wasm_sdk_bg.wasm.d.ts +259 -65
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price calculation utilities for swap amount conversions.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions to calculate swap amounts using exchange rates
|
|
5
|
+
* from the price feed. It handles:
|
|
6
|
+
* - Tier-based rate selection based on swap volume
|
|
7
|
+
* - Exchange rate inversion for BTC ↔ EVM token swaps
|
|
8
|
+
* - Forward and reverse amount calculations with fee handling
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {
|
|
13
|
+
* selectTierRate,
|
|
14
|
+
* computeExchangeRate,
|
|
15
|
+
* calculateTargetAmount,
|
|
16
|
+
* calculateSourceAmount,
|
|
17
|
+
* type PriceTiers,
|
|
18
|
+
* } from '@lendasat/lendaswap-sdk';
|
|
19
|
+
*
|
|
20
|
+
* // Select tier based on amount
|
|
21
|
+
* const rate = selectTierRate(priceTiers, 1000); // Gets tier_1000 rate
|
|
22
|
+
*
|
|
23
|
+
* // Compute exchange rate with proper inversion
|
|
24
|
+
* const exchangeRate = computeExchangeRate(rate, isSourceBtc, isTargetEvm);
|
|
25
|
+
*
|
|
26
|
+
* // Calculate target amount from source
|
|
27
|
+
* const targetAmount = calculateTargetAmount(100, exchangeRate, 0.0001, false, true);
|
|
28
|
+
*
|
|
29
|
+
* // Calculate source amount needed for target
|
|
30
|
+
* const sourceAmount = calculateSourceAmount(0.01, exchangeRate, 0.0001, false, true);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import type { PriceTiers } from "./price-feed.js";
|
|
34
|
+
/**
|
|
35
|
+
* Select the appropriate tier rate based on the asset amount.
|
|
36
|
+
* Higher amounts get better rates (lower spread).
|
|
37
|
+
*
|
|
38
|
+
* @param tiers - The price tiers from the price feed
|
|
39
|
+
* @param assetAmount - The swap amount in quote asset units
|
|
40
|
+
* @returns The rate for the appropriate tier
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const tiers = { tier_1: 0.000010773, tier_100: 0.0000107787, tier_1000: 0.0000107740, tier_5000: 0.0000107524 };
|
|
45
|
+
*
|
|
46
|
+
* selectTierRate(tiers, 50); // Returns tier_1 (0.000010773)
|
|
47
|
+
* selectTierRate(tiers, 500); // Returns tier_100 (0.0000107787)
|
|
48
|
+
* selectTierRate(tiers, 2000); // Returns tier_1000 (0.0000107740)
|
|
49
|
+
* selectTierRate(tiers, 10000); // Returns tier_5000 (0.0000107524)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function selectTierRate(tiers: PriceTiers, assetAmount: number): number;
|
|
53
|
+
/**
|
|
54
|
+
* Compute the exchange rate with proper inversion handling.
|
|
55
|
+
*
|
|
56
|
+
* The backend sends rates in the format "BTC per 1 stablecoin" for ALL pairs.
|
|
57
|
+
* When the source is BTC and target is a stablecoin/EVM token, we need to
|
|
58
|
+
* invert the rate to get "stablecoin per 1 BTC".
|
|
59
|
+
*
|
|
60
|
+
* @param rate - The raw rate from the backend (BTC per 1 stablecoin)
|
|
61
|
+
* @param isSourceBtc - Whether the source token is BTC (Lightning, Arkade, or Onchain)
|
|
62
|
+
* @param isTargetEvmToken - Whether the target token is an EVM token (stablecoins, etc.)
|
|
63
|
+
* @returns The exchange rate as "1 source = X target"
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const btcPerUsdc = 0.000010773; // ~1 BTC = 92,828 USDC
|
|
68
|
+
*
|
|
69
|
+
* // USDC -> BTC: rate stays as-is (BTC per USDC)
|
|
70
|
+
* computeExchangeRate(btcPerUsdc, false, false); // 0.000010773
|
|
71
|
+
*
|
|
72
|
+
* // BTC -> USDC: rate is inverted (USDC per BTC)
|
|
73
|
+
* computeExchangeRate(btcPerUsdc, true, true); // ~92,828
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function computeExchangeRate(rate: number, isSourceBtc: boolean, isTargetEvmToken: boolean): number;
|
|
77
|
+
/**
|
|
78
|
+
* Calculate the target amount given a source amount.
|
|
79
|
+
* Uses the exchange rate semantics: 1 source = exchangeRate target
|
|
80
|
+
*
|
|
81
|
+
* Fee handling:
|
|
82
|
+
* - If source is BTC: fee is deducted from source before conversion
|
|
83
|
+
* - If target is BTC: fee is deducted from target after conversion
|
|
84
|
+
*
|
|
85
|
+
* @param sourceAmount - Amount of source asset
|
|
86
|
+
* @param exchangeRate - Rate where 1 source = exchangeRate target
|
|
87
|
+
* @param networkFeeInBtc - Network fee in BTC
|
|
88
|
+
* @param isSourceBtc - Whether source is BTC (fee deducted from source before conversion)
|
|
89
|
+
* @param isTargetBtc - Whether target is BTC (fee deducted from target after conversion)
|
|
90
|
+
* @returns Target amount after fees
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const networkFee = 0.0001; // 10,000 sats
|
|
95
|
+
*
|
|
96
|
+
* // USDC -> BTC: 1000 USDC at rate 0.000010773
|
|
97
|
+
* // Target = 1000 * 0.000010773 - 0.0001 = 0.010673 BTC
|
|
98
|
+
* calculateTargetAmount(1000, 0.000010773, networkFee, false, true);
|
|
99
|
+
*
|
|
100
|
+
* // BTC -> USDC: 0.01 BTC at rate 92,824
|
|
101
|
+
* // Target = (0.01 - 0.0001) * 92824 = 918.96 USDC
|
|
102
|
+
* calculateTargetAmount(0.01, 92824, networkFee, true, false);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function calculateTargetAmount(sourceAmount: number, exchangeRate: number, networkFeeInBtc: number, isSourceBtc: boolean, isTargetBtc: boolean): number;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate the source amount needed to receive a target amount.
|
|
108
|
+
* Uses the exchange rate semantics: 1 source = exchangeRate target
|
|
109
|
+
*
|
|
110
|
+
* Fee handling (reverse of calculateTargetAmount):
|
|
111
|
+
* - If target is BTC: fee is added to target before reverse conversion
|
|
112
|
+
* - If source is BTC: fee is added to source after reverse conversion
|
|
113
|
+
*
|
|
114
|
+
* @param targetAmount - Desired amount of target asset
|
|
115
|
+
* @param exchangeRate - Rate where 1 source = exchangeRate target
|
|
116
|
+
* @param networkFeeInBtc - Network fee in BTC
|
|
117
|
+
* @param isSourceBtc - Whether source is BTC (fee added to required source)
|
|
118
|
+
* @param isTargetBtc - Whether target is BTC (fee added to target before reverse calc)
|
|
119
|
+
* @returns Source amount needed (including fees)
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const networkFee = 0.0001; // 10,000 sats
|
|
124
|
+
*
|
|
125
|
+
* // Want 0.01 BTC, paying with USDC at rate 0.000010773
|
|
126
|
+
* // Source = (0.01 + 0.0001) / 0.000010773 = 937.26 USDC
|
|
127
|
+
* calculateSourceAmount(0.01, 0.000010773, networkFee, false, true);
|
|
128
|
+
*
|
|
129
|
+
* // Want 1000 USDC, paying with BTC at rate 92,824
|
|
130
|
+
* // Source = 1000 / 92824 + 0.0001 = 0.01088 BTC
|
|
131
|
+
* calculateSourceAmount(1000, 92824, networkFee, true, false);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export declare function calculateSourceAmount(targetAmount: number, exchangeRate: number, networkFeeInBtc: number, isSourceBtc: boolean, isTargetBtc: boolean): number;
|
|
135
|
+
//# sourceMappingURL=price-calculations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-calculations.d.ts","sourceRoot":"","sources":["../src/price-calculations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAW7E;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,OAAO,EACpB,gBAAgB,EAAE,OAAO,GACxB,MAAM,CAQR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO,GACnB,MAAM,CASR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,OAAO,EACpB,WAAW,EAAE,OAAO,GACnB,MAAM,CASR"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price calculation utilities for swap amount conversions.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions to calculate swap amounts using exchange rates
|
|
5
|
+
* from the price feed. It handles:
|
|
6
|
+
* - Tier-based rate selection based on swap volume
|
|
7
|
+
* - Exchange rate inversion for BTC ↔ EVM token swaps
|
|
8
|
+
* - Forward and reverse amount calculations with fee handling
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {
|
|
13
|
+
* selectTierRate,
|
|
14
|
+
* computeExchangeRate,
|
|
15
|
+
* calculateTargetAmount,
|
|
16
|
+
* calculateSourceAmount,
|
|
17
|
+
* type PriceTiers,
|
|
18
|
+
* } from '@lendasat/lendaswap-sdk';
|
|
19
|
+
*
|
|
20
|
+
* // Select tier based on amount
|
|
21
|
+
* const rate = selectTierRate(priceTiers, 1000); // Gets tier_1000 rate
|
|
22
|
+
*
|
|
23
|
+
* // Compute exchange rate with proper inversion
|
|
24
|
+
* const exchangeRate = computeExchangeRate(rate, isSourceBtc, isTargetEvm);
|
|
25
|
+
*
|
|
26
|
+
* // Calculate target amount from source
|
|
27
|
+
* const targetAmount = calculateTargetAmount(100, exchangeRate, 0.0001, false, true);
|
|
28
|
+
*
|
|
29
|
+
* // Calculate source amount needed for target
|
|
30
|
+
* const sourceAmount = calculateSourceAmount(0.01, exchangeRate, 0.0001, false, true);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Select the appropriate tier rate based on the asset amount.
|
|
35
|
+
* Higher amounts get better rates (lower spread).
|
|
36
|
+
*
|
|
37
|
+
* @param tiers - The price tiers from the price feed
|
|
38
|
+
* @param assetAmount - The swap amount in quote asset units
|
|
39
|
+
* @returns The rate for the appropriate tier
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const tiers = { tier_1: 0.000010773, tier_100: 0.0000107787, tier_1000: 0.0000107740, tier_5000: 0.0000107524 };
|
|
44
|
+
*
|
|
45
|
+
* selectTierRate(tiers, 50); // Returns tier_1 (0.000010773)
|
|
46
|
+
* selectTierRate(tiers, 500); // Returns tier_100 (0.0000107787)
|
|
47
|
+
* selectTierRate(tiers, 2000); // Returns tier_1000 (0.0000107740)
|
|
48
|
+
* selectTierRate(tiers, 10000); // Returns tier_5000 (0.0000107524)
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function selectTierRate(tiers, assetAmount) {
|
|
52
|
+
if (assetAmount >= 5000) {
|
|
53
|
+
return tiers.tier_5000;
|
|
54
|
+
}
|
|
55
|
+
if (assetAmount >= 1000) {
|
|
56
|
+
return tiers.tier_1000;
|
|
57
|
+
}
|
|
58
|
+
if (assetAmount >= 100) {
|
|
59
|
+
return tiers.tier_100;
|
|
60
|
+
}
|
|
61
|
+
return tiers.tier_1;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Compute the exchange rate with proper inversion handling.
|
|
65
|
+
*
|
|
66
|
+
* The backend sends rates in the format "BTC per 1 stablecoin" for ALL pairs.
|
|
67
|
+
* When the source is BTC and target is a stablecoin/EVM token, we need to
|
|
68
|
+
* invert the rate to get "stablecoin per 1 BTC".
|
|
69
|
+
*
|
|
70
|
+
* @param rate - The raw rate from the backend (BTC per 1 stablecoin)
|
|
71
|
+
* @param isSourceBtc - Whether the source token is BTC (Lightning, Arkade, or Onchain)
|
|
72
|
+
* @param isTargetEvmToken - Whether the target token is an EVM token (stablecoins, etc.)
|
|
73
|
+
* @returns The exchange rate as "1 source = X target"
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const btcPerUsdc = 0.000010773; // ~1 BTC = 92,828 USDC
|
|
78
|
+
*
|
|
79
|
+
* // USDC -> BTC: rate stays as-is (BTC per USDC)
|
|
80
|
+
* computeExchangeRate(btcPerUsdc, false, false); // 0.000010773
|
|
81
|
+
*
|
|
82
|
+
* // BTC -> USDC: rate is inverted (USDC per BTC)
|
|
83
|
+
* computeExchangeRate(btcPerUsdc, true, true); // ~92,828
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export function computeExchangeRate(rate, isSourceBtc, isTargetEvmToken) {
|
|
87
|
+
// Backend sends same rate for both directions (BTC per stablecoin).
|
|
88
|
+
// When source is BTC and target is EVM token, invert to get "EVM per BTC"
|
|
89
|
+
const needsInversion = isSourceBtc && isTargetEvmToken;
|
|
90
|
+
if (needsInversion) {
|
|
91
|
+
return 1 / rate;
|
|
92
|
+
}
|
|
93
|
+
return rate;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Calculate the target amount given a source amount.
|
|
97
|
+
* Uses the exchange rate semantics: 1 source = exchangeRate target
|
|
98
|
+
*
|
|
99
|
+
* Fee handling:
|
|
100
|
+
* - If source is BTC: fee is deducted from source before conversion
|
|
101
|
+
* - If target is BTC: fee is deducted from target after conversion
|
|
102
|
+
*
|
|
103
|
+
* @param sourceAmount - Amount of source asset
|
|
104
|
+
* @param exchangeRate - Rate where 1 source = exchangeRate target
|
|
105
|
+
* @param networkFeeInBtc - Network fee in BTC
|
|
106
|
+
* @param isSourceBtc - Whether source is BTC (fee deducted from source before conversion)
|
|
107
|
+
* @param isTargetBtc - Whether target is BTC (fee deducted from target after conversion)
|
|
108
|
+
* @returns Target amount after fees
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const networkFee = 0.0001; // 10,000 sats
|
|
113
|
+
*
|
|
114
|
+
* // USDC -> BTC: 1000 USDC at rate 0.000010773
|
|
115
|
+
* // Target = 1000 * 0.000010773 - 0.0001 = 0.010673 BTC
|
|
116
|
+
* calculateTargetAmount(1000, 0.000010773, networkFee, false, true);
|
|
117
|
+
*
|
|
118
|
+
* // BTC -> USDC: 0.01 BTC at rate 92,824
|
|
119
|
+
* // Target = (0.01 - 0.0001) * 92824 = 918.96 USDC
|
|
120
|
+
* calculateTargetAmount(0.01, 92824, networkFee, true, false);
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export function calculateTargetAmount(sourceAmount, exchangeRate, networkFeeInBtc, isSourceBtc, isTargetBtc) {
|
|
124
|
+
if (isSourceBtc) {
|
|
125
|
+
// Source is BTC: deduct fee from source, then convert
|
|
126
|
+
const sourceAfterFee = sourceAmount - networkFeeInBtc;
|
|
127
|
+
return sourceAfterFee * exchangeRate;
|
|
128
|
+
}
|
|
129
|
+
// Target is BTC: convert first, then deduct fee
|
|
130
|
+
const targetBeforeFee = sourceAmount * exchangeRate;
|
|
131
|
+
return isTargetBtc ? targetBeforeFee - networkFeeInBtc : targetBeforeFee;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Calculate the source amount needed to receive a target amount.
|
|
135
|
+
* Uses the exchange rate semantics: 1 source = exchangeRate target
|
|
136
|
+
*
|
|
137
|
+
* Fee handling (reverse of calculateTargetAmount):
|
|
138
|
+
* - If target is BTC: fee is added to target before reverse conversion
|
|
139
|
+
* - If source is BTC: fee is added to source after reverse conversion
|
|
140
|
+
*
|
|
141
|
+
* @param targetAmount - Desired amount of target asset
|
|
142
|
+
* @param exchangeRate - Rate where 1 source = exchangeRate target
|
|
143
|
+
* @param networkFeeInBtc - Network fee in BTC
|
|
144
|
+
* @param isSourceBtc - Whether source is BTC (fee added to required source)
|
|
145
|
+
* @param isTargetBtc - Whether target is BTC (fee added to target before reverse calc)
|
|
146
|
+
* @returns Source amount needed (including fees)
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const networkFee = 0.0001; // 10,000 sats
|
|
151
|
+
*
|
|
152
|
+
* // Want 0.01 BTC, paying with USDC at rate 0.000010773
|
|
153
|
+
* // Source = (0.01 + 0.0001) / 0.000010773 = 937.26 USDC
|
|
154
|
+
* calculateSourceAmount(0.01, 0.000010773, networkFee, false, true);
|
|
155
|
+
*
|
|
156
|
+
* // Want 1000 USDC, paying with BTC at rate 92,824
|
|
157
|
+
* // Source = 1000 / 92824 + 0.0001 = 0.01088 BTC
|
|
158
|
+
* calculateSourceAmount(1000, 92824, networkFee, true, false);
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export function calculateSourceAmount(targetAmount, exchangeRate, networkFeeInBtc, isSourceBtc, isTargetBtc) {
|
|
162
|
+
if (isTargetBtc) {
|
|
163
|
+
// Target is BTC: add fee to target, then reverse convert
|
|
164
|
+
const targetPlusFee = targetAmount + networkFeeInBtc;
|
|
165
|
+
return targetPlusFee / exchangeRate;
|
|
166
|
+
}
|
|
167
|
+
// Source is BTC: reverse convert first, then add fee
|
|
168
|
+
const sourceBeforeFee = targetAmount / exchangeRate;
|
|
169
|
+
return isSourceBtc ? sourceBeforeFee + networkFeeInBtc : sourceBeforeFee;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=price-calculations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-calculations.js","sourceRoot":"","sources":["../src/price-calculations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;G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ACpB,eAAuB,EACvB,WAAoB,EACpB,WAAoB;IAEpB,IAAI,WAAW,EAAE,CAAC;QAChB,yDAAyD;QACzD,MAAM,aAAa,GAAG,YAAY,GAAG,eAAe,CAAC;QACrD,OAAO,aAAa,GAAG,YAAY,CAAC;IACtC,CAAC;IACD,qDAAqD;IACrD,MAAM,eAAe,GAAG,YAAY,GAAG,YAAY,CAAC;IACpD,OAAO,WAAW,CAAC,CAAC,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-calculations.test.d.ts","sourceRoot":"","sources":["../src/price-calculations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { calculateSourceAmount, calculateTargetAmount, computeExchangeRate, selectTierRate, } from "./price-calculations.js";
|
|
3
|
+
describe("selectTierRate", () => {
|
|
4
|
+
const mockTiers = {
|
|
5
|
+
tier_1: 0.000010773,
|
|
6
|
+
tier_100: 0.0000107787855,
|
|
7
|
+
tier_1000: 0.000010774087275,
|
|
8
|
+
tier_5000: 0.00001075242756,
|
|
9
|
+
};
|
|
10
|
+
it("should return tier_1 for amounts less than 100", () => {
|
|
11
|
+
expect(selectTierRate(mockTiers, 0)).toBe(mockTiers.tier_1);
|
|
12
|
+
expect(selectTierRate(mockTiers, 50)).toBe(mockTiers.tier_1);
|
|
13
|
+
expect(selectTierRate(mockTiers, 99)).toBe(mockTiers.tier_1);
|
|
14
|
+
});
|
|
15
|
+
it("should return tier_100 for amounts between 100 and 999", () => {
|
|
16
|
+
expect(selectTierRate(mockTiers, 100)).toBe(mockTiers.tier_100);
|
|
17
|
+
expect(selectTierRate(mockTiers, 500)).toBe(mockTiers.tier_100);
|
|
18
|
+
expect(selectTierRate(mockTiers, 999)).toBe(mockTiers.tier_100);
|
|
19
|
+
});
|
|
20
|
+
it("should return tier_1000 for amounts between 1000 and 4999", () => {
|
|
21
|
+
expect(selectTierRate(mockTiers, 1000)).toBe(mockTiers.tier_1000);
|
|
22
|
+
expect(selectTierRate(mockTiers, 2500)).toBe(mockTiers.tier_1000);
|
|
23
|
+
expect(selectTierRate(mockTiers, 4999)).toBe(mockTiers.tier_1000);
|
|
24
|
+
});
|
|
25
|
+
it("should return tier_5000 for amounts 5000 and above", () => {
|
|
26
|
+
expect(selectTierRate(mockTiers, 5000)).toBe(mockTiers.tier_5000);
|
|
27
|
+
expect(selectTierRate(mockTiers, 10000)).toBe(mockTiers.tier_5000);
|
|
28
|
+
expect(selectTierRate(mockTiers, 100000)).toBe(mockTiers.tier_5000);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("computeExchangeRate", () => {
|
|
32
|
+
// Rate from backend: BTC per 1 USDC (approximately 1 BTC = 92,828 USDC)
|
|
33
|
+
const btcPerUsdc = 0.000010773;
|
|
34
|
+
describe("when source is EVM token and target is BTC", () => {
|
|
35
|
+
it("should return the rate as-is (BTC per stablecoin)", () => {
|
|
36
|
+
const result = computeExchangeRate(btcPerUsdc, false, false);
|
|
37
|
+
expect(result).toBe(btcPerUsdc);
|
|
38
|
+
});
|
|
39
|
+
it("should work correctly for USDC → BTC swap calculation", () => {
|
|
40
|
+
// User wants to swap 1000 USDC for BTC
|
|
41
|
+
// Rate: 0.000010773 BTC per 1 USDC
|
|
42
|
+
// Expected BTC: 1000 * 0.000010773 = 0.010773 BTC
|
|
43
|
+
const rate = computeExchangeRate(btcPerUsdc, false, false);
|
|
44
|
+
const usdcAmount = 1000;
|
|
45
|
+
const btcReceived = usdcAmount * rate;
|
|
46
|
+
expect(btcReceived).toBeCloseTo(0.010773, 6);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("when source is BTC and target is EVM token", () => {
|
|
50
|
+
it("should invert the rate (stablecoin per BTC)", () => {
|
|
51
|
+
const result = computeExchangeRate(btcPerUsdc, true, true);
|
|
52
|
+
// 1 / 0.000010773 ≈ 92,824.65 USDC per BTC
|
|
53
|
+
expect(result).toBeCloseTo(92824.65, 0);
|
|
54
|
+
});
|
|
55
|
+
it("should work correctly for BTC → USDC swap calculation", () => {
|
|
56
|
+
// User wants to swap 0.01 BTC for USDC
|
|
57
|
+
// Inverted rate: ~92,828 USDC per 1 BTC
|
|
58
|
+
// Expected USDC: 0.01 * 92828 ≈ 928.28 USDC
|
|
59
|
+
const rate = computeExchangeRate(btcPerUsdc, true, true);
|
|
60
|
+
const btcAmount = 0.01;
|
|
61
|
+
const usdcReceived = btcAmount * rate;
|
|
62
|
+
expect(usdcReceived).toBeCloseTo(928.28, 0);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe("when source is BTC and target is also BTC (Arkade ↔ Lightning)", () => {
|
|
66
|
+
it("should not invert the rate", () => {
|
|
67
|
+
// BTC to BTC swaps don't need inversion
|
|
68
|
+
const btcToBtcRate = 1.0; // 1:1 ratio
|
|
69
|
+
const result = computeExchangeRate(btcToBtcRate, true, false);
|
|
70
|
+
expect(result).toBe(btcToBtcRate);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe("reverse calculation (target amount → source amount)", () => {
|
|
74
|
+
it("should correctly calculate source amount when target is known (BTC → USDC)", () => {
|
|
75
|
+
// User wants 1000 USDC, how much BTC do they need?
|
|
76
|
+
// Rate after inversion: ~92,828 USDC per BTC
|
|
77
|
+
// Source BTC = 1000 / 92828 ≈ 0.01077 BTC
|
|
78
|
+
const rate = computeExchangeRate(btcPerUsdc, true, true);
|
|
79
|
+
const targetUsdc = 1000;
|
|
80
|
+
const sourceBtc = targetUsdc / rate;
|
|
81
|
+
expect(sourceBtc).toBeCloseTo(0.01077, 4);
|
|
82
|
+
});
|
|
83
|
+
it("should correctly calculate source amount when target is known (USDC → BTC)", () => {
|
|
84
|
+
// User wants 0.01 BTC, how much USDC do they need?
|
|
85
|
+
// Rate: 0.000010773 BTC per USDC
|
|
86
|
+
// Source USDC = 0.01 / 0.000010773 ≈ 928 USDC
|
|
87
|
+
const rate = computeExchangeRate(btcPerUsdc, false, false);
|
|
88
|
+
const targetBtc = 0.01;
|
|
89
|
+
const sourceUsdc = targetBtc / rate;
|
|
90
|
+
expect(sourceUsdc).toBeCloseTo(928, 0);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
describe("calculateTargetAmount", () => {
|
|
95
|
+
const networkFee = 0.0001; // 10,000 sats
|
|
96
|
+
describe("USDC → BTC (source is EVM, target is BTC)", () => {
|
|
97
|
+
// Rate: 0.000010773 BTC per 1 USDC
|
|
98
|
+
const exchangeRate = 0.000010773;
|
|
99
|
+
it("should convert and subtract fee from target", () => {
|
|
100
|
+
const sourceAmount = 1000; // 1000 USDC
|
|
101
|
+
const result = calculateTargetAmount(sourceAmount, exchangeRate, networkFee, false, // source is not BTC
|
|
102
|
+
true);
|
|
103
|
+
// 1000 * 0.000010773 - 0.0001 = 0.010673 BTC
|
|
104
|
+
expect(result).toBeCloseTo(0.010673, 6);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe("BTC → USDC (source is BTC, target is EVM)", () => {
|
|
108
|
+
// Rate: ~92,824 USDC per 1 BTC (after inversion)
|
|
109
|
+
const exchangeRate = 92824.65;
|
|
110
|
+
it("should subtract fee from source, then convert", () => {
|
|
111
|
+
const sourceAmount = 0.01; // 0.01 BTC
|
|
112
|
+
const result = calculateTargetAmount(sourceAmount, exchangeRate, networkFee, true, // source is BTC
|
|
113
|
+
false);
|
|
114
|
+
// (0.01 - 0.0001) * 92824.65 = 918.96 USDC
|
|
115
|
+
expect(result).toBeCloseTo(918.96, 0);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe("with zero fee", () => {
|
|
119
|
+
it("should just multiply source by rate", () => {
|
|
120
|
+
const result = calculateTargetAmount(100, 2.5, 0, // no fee
|
|
121
|
+
false, false);
|
|
122
|
+
expect(result).toBe(250);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("calculateSourceAmount", () => {
|
|
127
|
+
const networkFee = 0.0001; // 10,000 sats
|
|
128
|
+
describe("USDC → BTC (source is EVM, target is BTC)", () => {
|
|
129
|
+
// Rate: 0.000010773 BTC per 1 USDC
|
|
130
|
+
const exchangeRate = 0.000010773;
|
|
131
|
+
it("should add fee to target, then reverse convert", () => {
|
|
132
|
+
const targetAmount = 0.01; // Want 0.01 BTC
|
|
133
|
+
const result = calculateSourceAmount(targetAmount, exchangeRate, networkFee, false, // source is not BTC
|
|
134
|
+
true);
|
|
135
|
+
// (0.01 + 0.0001) / 0.000010773 = 937.26 USDC
|
|
136
|
+
expect(result).toBeCloseTo(937.26, 0);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
describe("BTC → USDC (source is BTC, target is EVM)", () => {
|
|
140
|
+
// Rate: ~92,824 USDC per 1 BTC (after inversion)
|
|
141
|
+
const exchangeRate = 92824.65;
|
|
142
|
+
it("should reverse convert, then add fee to source", () => {
|
|
143
|
+
const targetAmount = 1000; // Want 1000 USDC
|
|
144
|
+
const result = calculateSourceAmount(targetAmount, exchangeRate, networkFee, true, // source is BTC
|
|
145
|
+
false);
|
|
146
|
+
// 1000 / 92824.65 + 0.0001 = 0.01088 BTC
|
|
147
|
+
expect(result).toBeCloseTo(0.01088, 4);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
describe("round-trip consistency", () => {
|
|
151
|
+
it("should be consistent with calculateTargetAmount (USDC → BTC)", () => {
|
|
152
|
+
const exchangeRate = 0.000010773;
|
|
153
|
+
const sourceAmount = 1000;
|
|
154
|
+
// Forward: calculate target from source
|
|
155
|
+
const targetAmount = calculateTargetAmount(sourceAmount, exchangeRate, networkFee, false, true);
|
|
156
|
+
// Reverse: calculate source from target
|
|
157
|
+
const calculatedSource = calculateSourceAmount(targetAmount, exchangeRate, networkFee, false, true);
|
|
158
|
+
// Should get back original source amount
|
|
159
|
+
expect(calculatedSource).toBeCloseTo(sourceAmount, 4);
|
|
160
|
+
});
|
|
161
|
+
it("should be consistent with calculateTargetAmount (BTC → USDC)", () => {
|
|
162
|
+
const exchangeRate = 92824.65;
|
|
163
|
+
const sourceAmount = 0.01;
|
|
164
|
+
// Forward: calculate target from source
|
|
165
|
+
const targetAmount = calculateTargetAmount(sourceAmount, exchangeRate, networkFee, true, false);
|
|
166
|
+
// Reverse: calculate source from target
|
|
167
|
+
const calculatedSource = calculateSourceAmount(targetAmount, exchangeRate, networkFee, true, false);
|
|
168
|
+
// Should get back original source amount
|
|
169
|
+
expect(calculatedSource).toBeCloseTo(sourceAmount, 6);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
//# sourceMappingURL=price-calculations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-calculations.test.js","sourceRoot":"","sources":["../src/price-calculations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,eAAe;QACzB,SAAS,EAAE,iBAAiB;QAC5B,SAAS,EAAE,gBAAgB;KAC5B,CAAC;IAEF,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC7D,MAAM,CAAC,c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enIdString } from "./api";
|
|
22
23
|
/**
|
|
23
24
|
* Price tiers for different quote asset amounts.
|
|
24
25
|
* Different rates apply based on swap volume (in units of the quote asset).
|
|
@@ -39,6 +40,8 @@ export interface PriceTiers {
|
|
|
39
40
|
export interface TradingPairPrices {
|
|
40
41
|
/** Trading pair identifier, e.g., "USDC_POL-BTC" or "USDT0_POL-BTC" */
|
|
41
42
|
pair: string;
|
|
43
|
+
source: TokenIdString;
|
|
44
|
+
target: TokenIdString;
|
|
42
45
|
/** Price tiers for this pair */
|
|
43
46
|
tiers: PriceTiers;
|
|
44
47
|
}
|
package/dist/price-feed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-feed.d.ts","sourceRoot":"","sources":["../src/price-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAA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AAmB,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,SAAS,CAAuC;IACxD,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM;IAS3B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAkBpD;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,CAAC,OAAO;IAqDf;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACH,KAAK,IAAI,IAAI;CAad"}
|
package/dist/price-feed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-feed.js","sourceRoot":"","sources":["../src/price-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"price-feed.js","sourceRoot":"","sources":["../src/price-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8CH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,gBAAgB;IACnB,KAAK,CAAS;IACd,EAAE,GAAqB,IAAI,CAAC;IAC5B,cAAc,GAAyC,IAAI,CAAC;IAC5D,SAAS,GAA6B,IAAI,GAAG,EAAE,CAAC;IAChD,cAAc,GAAG,IAAI,CAAC,CAAC,sBAAsB;IAC7C,iBAAiB,GAAG,KAAK,CAAC,CAAC,iBAAiB;IAC5C,aAAa,GAAG,KAAK,CAAC;IAE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,CAAC;IACH,CAAC;CACF"}
|
|
@@ -5,13 +5,6 @@
|
|
|
5
5
|
* which is a wrapper around IndexedDB that provides a simpler API.
|
|
6
6
|
*/
|
|
7
7
|
import type { ExtendedSwapStorageData } from "../api.js";
|
|
8
|
-
/**
|
|
9
|
-
* Stored swap record in IndexedDB.
|
|
10
|
-
* Extends ExtendedSwapStorageData with an id field for Dexie's primary key.
|
|
11
|
-
*/
|
|
12
|
-
interface SwapRecord extends ExtendedSwapStorageData {
|
|
13
|
-
id: string;
|
|
14
|
-
}
|
|
15
8
|
/**
|
|
16
9
|
* Dexie-based swap storage provider.
|
|
17
10
|
*
|
|
@@ -76,13 +69,23 @@ export declare class DexieSwapStorageProvider {
|
|
|
76
69
|
/**
|
|
77
70
|
* Get all stored swaps.
|
|
78
71
|
*
|
|
79
|
-
* @returns Array of all swap data
|
|
72
|
+
* @returns Array of all swap data
|
|
80
73
|
*/
|
|
81
|
-
getAll(): Promise<
|
|
74
|
+
getAll(): Promise<ExtendedSwapStorageData[]>;
|
|
82
75
|
/**
|
|
83
76
|
* Close the database connection.
|
|
84
77
|
*/
|
|
85
78
|
close(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Get raw swap_params for a potentially corrupted entry.
|
|
81
|
+
*
|
|
82
|
+
* This method reads the raw data from IndexedDB and extracts just the swap_params,
|
|
83
|
+
* which can succeed even when the full ExtendedSwapStorageData fails to deserialize.
|
|
84
|
+
*
|
|
85
|
+
* @param swapId - The swap ID
|
|
86
|
+
* @returns The swap_params as raw object, or null if not found or invalid
|
|
87
|
+
*/
|
|
88
|
+
getRawSwapParams(swapId: string): Promise<Record<string, any> | null>;
|
|
86
89
|
}
|
|
87
90
|
/**
|
|
88
91
|
* Create a Dexie-based swap storage provider.
|
|
@@ -107,5 +110,4 @@ export declare class DexieSwapStorageProvider {
|
|
|
107
110
|
* ```
|
|
108
111
|
*/
|
|
109
112
|
export declare function createDexieSwapStorage(dbName?: string): DexieSwapStorageProvider;
|
|
110
|
-
export {};
|
|
111
113
|
//# sourceMappingURL=dexieSwapStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexieSwapStorage.d.ts","sourceRoot":"","sources":["../../src/storage/dexieSwapStorage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dexieSwapStorage.d.ts","sourceRoot":"","sources":["../../src/storage/dexieSwapStorage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAqEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,EAAE,CAAoB;IAE9B;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;IAI3B;;;;;OAKG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAUlE;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE;;;;OAIG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAMlD;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;;;;;;OAQG;IAEG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAS5E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,MAAM,GACd,wBAAwB,CAE1B"}
|