Skip to content

Commit e8a553f

Browse files
committed
do arrow functions work?
1 parent 09a9be8 commit e8a553f

File tree

3 files changed

+12
-48
lines changed

3 files changed

+12
-48
lines changed

docs/snippets/CurrentPricesTable.jsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { weiToTokens, formatPrice } from './PriceProvider';
1+
import { weiToTokens, formatPrice, getLitActionPriceComponent, getNodePriceMeasurement } from './PriceProvider';
22

33
export const CurrentPricesTable = ({ priceData }) => {
44
// Product IDs
@@ -17,27 +17,9 @@ export const CurrentPricesTable = ({ priceData }) => {
1717
ProductId.SignSessionKey,
1818
];
1919

20-
// LitActionPriceComponent enum values
21-
const LitActionPriceComponent = {
22-
baseAmount: 0,
23-
runtimeLength: 1,
24-
memoryUsage: 2,
25-
codeLength: 3,
26-
responseLength: 4,
27-
signatures: 5,
28-
broadcasts: 6,
29-
contractCalls: 7,
30-
callDepth: 8,
31-
decrypts: 9,
32-
fetches: 10,
33-
};
34-
35-
// NodePriceMeasurement enum values
36-
const NodePriceMeasurement = {
37-
perSecond: 0,
38-
perMegabyte: 1,
39-
perCount: 2,
40-
};
20+
// Get enum values from functions
21+
const LitActionPriceComponent = getLitActionPriceComponent();
22+
const NodePriceMeasurement = getNodePriceMeasurement();
4123

4224
const PRODUCT_NAMES = {
4325
[ProductId.PkpSign]: 'PKP Sign',

docs/snippets/ExampleLitActionCosts.jsx

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
1-
import { weiToTokens, formatPrice } from './PriceProvider';
1+
import { weiToTokens, formatPrice, getLitActionPriceComponent, getNodePriceMeasurement } from './PriceProvider';
22

33
export const ExampleLitActionCosts = ({ priceData }) => {
4-
// LitActionPriceComponent enum values
5-
const LitActionPriceComponent = {
6-
baseAmount: 0,
7-
runtimeLength: 1,
8-
memoryUsage: 2,
9-
codeLength: 3,
10-
responseLength: 4,
11-
signatures: 5,
12-
broadcasts: 6,
13-
contractCalls: 7,
14-
callDepth: 8,
15-
decrypts: 9,
16-
fetches: 10,
17-
};
18-
19-
// NodePriceMeasurement enum values
20-
const NodePriceMeasurement = {
21-
perSecond: 0,
22-
perMegabyte: 1,
23-
perCount: 2,
24-
};
4+
// Get enum values from functions
5+
const LitActionPriceComponent = getLitActionPriceComponent();
6+
const NodePriceMeasurement = getNodePriceMeasurement();
257
if (!priceData) {
268
return (
279
<div style={{ padding: '20px', textAlign: 'center' }}>

docs/snippets/PriceProvider.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const PRODUCT_IDS = [
2222
];
2323

2424
// LitActionPriceComponent enum values
25-
export const LitActionPriceComponent = {
25+
export const getLitActionPriceComponent = () => ({
2626
baseAmount: 0,
2727
runtimeLength: 1,
2828
memoryUsage: 2,
@@ -34,14 +34,14 @@ export const LitActionPriceComponent = {
3434
callDepth: 8,
3535
decrypts: 9,
3636
fetches: 10,
37-
};
37+
});
3838

3939
// NodePriceMeasurement enum values
40-
export const NodePriceMeasurement = {
40+
export const getNodePriceMeasurement = () => ({
4141
perSecond: 0,
4242
perMegabyte: 1,
4343
perCount: 2,
44-
};
44+
});
4545

4646
// PriceFeed ABI (minimal - only functions we need)
4747
const PRICE_FEED_ABI = [

0 commit comments

Comments
 (0)