@beep-it/sdk-core 0.1.4 → 0.1.5
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 +34 -31
- package/dist/index.mjs +34 -31
- package/dist/modules/products.d.ts.map +1 -1
- package/dist/types/token.d.ts +5 -4
- package/dist/types/token.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40,26 +40,29 @@ var import_axios = __toESM(require("axios"));
|
|
|
40
40
|
|
|
41
41
|
// src/types/token.ts
|
|
42
42
|
var SupportedToken = /* @__PURE__ */ ((SupportedToken3) => {
|
|
43
|
+
SupportedToken3["USDC"] = "USDC";
|
|
43
44
|
SupportedToken3["USDT"] = "USDT";
|
|
44
45
|
return SupportedToken3;
|
|
45
46
|
})(SupportedToken || {});
|
|
46
47
|
var TOKEN_ADDRESSES = {
|
|
47
|
-
|
|
48
|
+
["USDC" /* USDC */]: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6T",
|
|
49
|
+
// USDC mint address
|
|
48
50
|
["USDT" /* USDT */]: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
49
51
|
// USDT mint address
|
|
50
52
|
};
|
|
51
53
|
var TOKEN_DECIMALS = {
|
|
52
|
-
|
|
54
|
+
["USDC" /* USDC */]: 6,
|
|
55
|
+
// USDC uses 6 decimal places
|
|
53
56
|
["USDT" /* USDT */]: 6
|
|
54
57
|
// USDT uses 6 decimal places
|
|
55
58
|
};
|
|
56
59
|
var TokenUtils = class {
|
|
57
60
|
/**
|
|
58
61
|
* Retrieves the SPL token address for a supported token
|
|
59
|
-
*
|
|
62
|
+
*
|
|
60
63
|
* @param token - The supported token enum value
|
|
61
64
|
* @returns The corresponding SPL token address on Solana
|
|
62
|
-
*
|
|
65
|
+
*
|
|
63
66
|
* @example
|
|
64
67
|
* ```typescript
|
|
65
68
|
* const address = TokenUtils.getTokenAddress(SupportedToken.USDT);
|
|
@@ -71,10 +74,10 @@ var TokenUtils = class {
|
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Performs reverse lookup to find token enum from SPL address
|
|
74
|
-
*
|
|
77
|
+
*
|
|
75
78
|
* @param address - The SPL token address to look up
|
|
76
79
|
* @returns The corresponding SupportedToken enum value, or null if not found
|
|
77
|
-
*
|
|
80
|
+
*
|
|
78
81
|
* @example
|
|
79
82
|
* ```typescript
|
|
80
83
|
* const token = TokenUtils.getTokenFromAddress('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
|
|
@@ -91,14 +94,14 @@ var TokenUtils = class {
|
|
|
91
94
|
}
|
|
92
95
|
/**
|
|
93
96
|
* Gets the number of decimal places for accurate token amount calculations
|
|
94
|
-
*
|
|
97
|
+
*
|
|
95
98
|
* @param token - The supported token to get decimals for
|
|
96
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
97
|
-
*
|
|
99
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
100
|
+
*
|
|
98
101
|
* @example
|
|
99
102
|
* ```typescript
|
|
100
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
101
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
103
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
104
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
102
105
|
* ```
|
|
103
106
|
*/
|
|
104
107
|
static getTokenDecimals(token) {
|
|
@@ -106,10 +109,10 @@ var TokenUtils = class {
|
|
|
106
109
|
}
|
|
107
110
|
/**
|
|
108
111
|
* Type guard to check if a string value represents a supported token
|
|
109
|
-
*
|
|
112
|
+
*
|
|
110
113
|
* @param token - String value to check
|
|
111
114
|
* @returns True if the token is supported, with proper type narrowing
|
|
112
|
-
*
|
|
115
|
+
*
|
|
113
116
|
* @example
|
|
114
117
|
* ```typescript
|
|
115
118
|
* const userInput = 'USDT';
|
|
@@ -124,17 +127,17 @@ var TokenUtils = class {
|
|
|
124
127
|
}
|
|
125
128
|
/**
|
|
126
129
|
* Returns the default token for operations when no token is specified
|
|
127
|
-
*
|
|
130
|
+
*
|
|
128
131
|
* @returns The default SupportedToken (currently USDT)
|
|
129
|
-
*
|
|
132
|
+
*
|
|
130
133
|
* @example
|
|
131
134
|
* ```typescript
|
|
132
135
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
133
|
-
* console.log(defaultToken); // SupportedToken.
|
|
136
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
134
137
|
* ```
|
|
135
138
|
*/
|
|
136
139
|
static getDefaultToken() {
|
|
137
|
-
return "
|
|
140
|
+
return "USDC" /* USDC */;
|
|
138
141
|
}
|
|
139
142
|
};
|
|
140
143
|
|
|
@@ -559,11 +562,11 @@ var ProductsModule = class {
|
|
|
559
562
|
/**
|
|
560
563
|
* Creates a new product with the specified configuration
|
|
561
564
|
* Products can be used to generate invoices with consistent pricing and metadata
|
|
562
|
-
*
|
|
565
|
+
*
|
|
563
566
|
* @param payload - Product creation parameters including name, price, and token information
|
|
564
567
|
* @returns Promise that resolves to the created product
|
|
565
568
|
* @throws {Error} When product creation fails
|
|
566
|
-
*
|
|
569
|
+
*
|
|
567
570
|
* @example
|
|
568
571
|
* ```typescript
|
|
569
572
|
* // Create a one-time purchase product
|
|
@@ -574,7 +577,7 @@ var ProductsModule = class {
|
|
|
574
577
|
* token: SupportedToken.USDT,
|
|
575
578
|
* isSubscription: false
|
|
576
579
|
* });
|
|
577
|
-
*
|
|
580
|
+
*
|
|
578
581
|
* // Create a subscription product
|
|
579
582
|
* const subscription = await beep.products.createProduct({
|
|
580
583
|
* name: 'Monthly Pro Plan',
|
|
@@ -591,7 +594,7 @@ var ProductsModule = class {
|
|
|
591
594
|
requestPayload.splTokenAddress = TokenUtils.getTokenAddress(requestPayload.token);
|
|
592
595
|
}
|
|
593
596
|
if (requestPayload.price) {
|
|
594
|
-
const token = requestPayload.token || "
|
|
597
|
+
const token = requestPayload.token || "USDC" /* USDC */;
|
|
595
598
|
const decimals = TokenUtils.getTokenDecimals(token);
|
|
596
599
|
const priceValue = typeof requestPayload.price === "string" ? parseFloat(requestPayload.price) : requestPayload.price;
|
|
597
600
|
const priceInBaseUnits = Math.round(priceValue * 10 ** decimals);
|
|
@@ -602,11 +605,11 @@ var ProductsModule = class {
|
|
|
602
605
|
}
|
|
603
606
|
/**
|
|
604
607
|
* Retrieves a specific product by its ID
|
|
605
|
-
*
|
|
608
|
+
*
|
|
606
609
|
* @param productId - The unique identifier of the product to retrieve
|
|
607
610
|
* @returns Promise that resolves to the product details
|
|
608
611
|
* @throws {Error} When the product is not found or retrieval fails
|
|
609
|
-
*
|
|
612
|
+
*
|
|
610
613
|
* @example
|
|
611
614
|
* ```typescript
|
|
612
615
|
* const product = await beep.products.getProduct('prod_123abc456def');
|
|
@@ -619,10 +622,10 @@ var ProductsModule = class {
|
|
|
619
622
|
}
|
|
620
623
|
/**
|
|
621
624
|
* Retrieves all products for the current merchant
|
|
622
|
-
*
|
|
625
|
+
*
|
|
623
626
|
* @returns Promise that resolves to an array of products
|
|
624
627
|
* @throws {Error} When product retrieval fails
|
|
625
|
-
*
|
|
628
|
+
*
|
|
626
629
|
* @example
|
|
627
630
|
* ```typescript
|
|
628
631
|
* const products = await beep.products.listProducts();
|
|
@@ -637,19 +640,19 @@ var ProductsModule = class {
|
|
|
637
640
|
/**
|
|
638
641
|
* Updates an existing product with new configuration
|
|
639
642
|
* Only provided fields will be updated - omitted fields remain unchanged
|
|
640
|
-
*
|
|
643
|
+
*
|
|
641
644
|
* @param productId - The unique identifier of the product to update
|
|
642
645
|
* @param payload - Product update parameters (all fields optional)
|
|
643
646
|
* @returns Promise that resolves to the updated product
|
|
644
647
|
* @throws {Error} When the product is not found or update fails
|
|
645
|
-
*
|
|
648
|
+
*
|
|
646
649
|
* @example
|
|
647
650
|
* ```typescript
|
|
648
651
|
* // Update just the price
|
|
649
652
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
650
653
|
* price: '29.99'
|
|
651
654
|
* });
|
|
652
|
-
*
|
|
655
|
+
*
|
|
653
656
|
* // Update multiple fields
|
|
654
657
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
655
658
|
* name: 'New Product Name',
|
|
@@ -668,13 +671,13 @@ var ProductsModule = class {
|
|
|
668
671
|
}
|
|
669
672
|
/**
|
|
670
673
|
* Deletes an existing product
|
|
671
|
-
*
|
|
674
|
+
*
|
|
672
675
|
* @param productId - The unique identifier of the product to delete
|
|
673
676
|
* @returns Promise that resolves when the product is successfully deleted
|
|
674
677
|
* @throws {Error} When the product is not found or deletion fails
|
|
675
|
-
*
|
|
678
|
+
*
|
|
676
679
|
* @remarks Once deleted, a product cannot be recovered. Existing invoices linked to this product will remain unaffected.
|
|
677
|
-
*
|
|
680
|
+
*
|
|
678
681
|
* @example
|
|
679
682
|
* ```typescript
|
|
680
683
|
* await beep.products.deleteProduct('prod_123abc456def');
|
package/dist/index.mjs
CHANGED
|
@@ -3,26 +3,29 @@ import axios from "axios";
|
|
|
3
3
|
|
|
4
4
|
// src/types/token.ts
|
|
5
5
|
var SupportedToken = /* @__PURE__ */ ((SupportedToken3) => {
|
|
6
|
+
SupportedToken3["USDC"] = "USDC";
|
|
6
7
|
SupportedToken3["USDT"] = "USDT";
|
|
7
8
|
return SupportedToken3;
|
|
8
9
|
})(SupportedToken || {});
|
|
9
10
|
var TOKEN_ADDRESSES = {
|
|
10
|
-
|
|
11
|
+
["USDC" /* USDC */]: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6T",
|
|
12
|
+
// USDC mint address
|
|
11
13
|
["USDT" /* USDT */]: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
|
|
12
14
|
// USDT mint address
|
|
13
15
|
};
|
|
14
16
|
var TOKEN_DECIMALS = {
|
|
15
|
-
|
|
17
|
+
["USDC" /* USDC */]: 6,
|
|
18
|
+
// USDC uses 6 decimal places
|
|
16
19
|
["USDT" /* USDT */]: 6
|
|
17
20
|
// USDT uses 6 decimal places
|
|
18
21
|
};
|
|
19
22
|
var TokenUtils = class {
|
|
20
23
|
/**
|
|
21
24
|
* Retrieves the SPL token address for a supported token
|
|
22
|
-
*
|
|
25
|
+
*
|
|
23
26
|
* @param token - The supported token enum value
|
|
24
27
|
* @returns The corresponding SPL token address on Solana
|
|
25
|
-
*
|
|
28
|
+
*
|
|
26
29
|
* @example
|
|
27
30
|
* ```typescript
|
|
28
31
|
* const address = TokenUtils.getTokenAddress(SupportedToken.USDT);
|
|
@@ -34,10 +37,10 @@ var TokenUtils = class {
|
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
36
39
|
* Performs reverse lookup to find token enum from SPL address
|
|
37
|
-
*
|
|
40
|
+
*
|
|
38
41
|
* @param address - The SPL token address to look up
|
|
39
42
|
* @returns The corresponding SupportedToken enum value, or null if not found
|
|
40
|
-
*
|
|
43
|
+
*
|
|
41
44
|
* @example
|
|
42
45
|
* ```typescript
|
|
43
46
|
* const token = TokenUtils.getTokenFromAddress('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
|
|
@@ -54,14 +57,14 @@ var TokenUtils = class {
|
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* Gets the number of decimal places for accurate token amount calculations
|
|
57
|
-
*
|
|
60
|
+
*
|
|
58
61
|
* @param token - The supported token to get decimals for
|
|
59
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
60
|
-
*
|
|
62
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
63
|
+
*
|
|
61
64
|
* @example
|
|
62
65
|
* ```typescript
|
|
63
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
64
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
66
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
67
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
65
68
|
* ```
|
|
66
69
|
*/
|
|
67
70
|
static getTokenDecimals(token) {
|
|
@@ -69,10 +72,10 @@ var TokenUtils = class {
|
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* Type guard to check if a string value represents a supported token
|
|
72
|
-
*
|
|
75
|
+
*
|
|
73
76
|
* @param token - String value to check
|
|
74
77
|
* @returns True if the token is supported, with proper type narrowing
|
|
75
|
-
*
|
|
78
|
+
*
|
|
76
79
|
* @example
|
|
77
80
|
* ```typescript
|
|
78
81
|
* const userInput = 'USDT';
|
|
@@ -87,17 +90,17 @@ var TokenUtils = class {
|
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Returns the default token for operations when no token is specified
|
|
90
|
-
*
|
|
93
|
+
*
|
|
91
94
|
* @returns The default SupportedToken (currently USDT)
|
|
92
|
-
*
|
|
95
|
+
*
|
|
93
96
|
* @example
|
|
94
97
|
* ```typescript
|
|
95
98
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
96
|
-
* console.log(defaultToken); // SupportedToken.
|
|
99
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
97
100
|
* ```
|
|
98
101
|
*/
|
|
99
102
|
static getDefaultToken() {
|
|
100
|
-
return "
|
|
103
|
+
return "USDC" /* USDC */;
|
|
101
104
|
}
|
|
102
105
|
};
|
|
103
106
|
|
|
@@ -522,11 +525,11 @@ var ProductsModule = class {
|
|
|
522
525
|
/**
|
|
523
526
|
* Creates a new product with the specified configuration
|
|
524
527
|
* Products can be used to generate invoices with consistent pricing and metadata
|
|
525
|
-
*
|
|
528
|
+
*
|
|
526
529
|
* @param payload - Product creation parameters including name, price, and token information
|
|
527
530
|
* @returns Promise that resolves to the created product
|
|
528
531
|
* @throws {Error} When product creation fails
|
|
529
|
-
*
|
|
532
|
+
*
|
|
530
533
|
* @example
|
|
531
534
|
* ```typescript
|
|
532
535
|
* // Create a one-time purchase product
|
|
@@ -537,7 +540,7 @@ var ProductsModule = class {
|
|
|
537
540
|
* token: SupportedToken.USDT,
|
|
538
541
|
* isSubscription: false
|
|
539
542
|
* });
|
|
540
|
-
*
|
|
543
|
+
*
|
|
541
544
|
* // Create a subscription product
|
|
542
545
|
* const subscription = await beep.products.createProduct({
|
|
543
546
|
* name: 'Monthly Pro Plan',
|
|
@@ -554,7 +557,7 @@ var ProductsModule = class {
|
|
|
554
557
|
requestPayload.splTokenAddress = TokenUtils.getTokenAddress(requestPayload.token);
|
|
555
558
|
}
|
|
556
559
|
if (requestPayload.price) {
|
|
557
|
-
const token = requestPayload.token || "
|
|
560
|
+
const token = requestPayload.token || "USDC" /* USDC */;
|
|
558
561
|
const decimals = TokenUtils.getTokenDecimals(token);
|
|
559
562
|
const priceValue = typeof requestPayload.price === "string" ? parseFloat(requestPayload.price) : requestPayload.price;
|
|
560
563
|
const priceInBaseUnits = Math.round(priceValue * 10 ** decimals);
|
|
@@ -565,11 +568,11 @@ var ProductsModule = class {
|
|
|
565
568
|
}
|
|
566
569
|
/**
|
|
567
570
|
* Retrieves a specific product by its ID
|
|
568
|
-
*
|
|
571
|
+
*
|
|
569
572
|
* @param productId - The unique identifier of the product to retrieve
|
|
570
573
|
* @returns Promise that resolves to the product details
|
|
571
574
|
* @throws {Error} When the product is not found or retrieval fails
|
|
572
|
-
*
|
|
575
|
+
*
|
|
573
576
|
* @example
|
|
574
577
|
* ```typescript
|
|
575
578
|
* const product = await beep.products.getProduct('prod_123abc456def');
|
|
@@ -582,10 +585,10 @@ var ProductsModule = class {
|
|
|
582
585
|
}
|
|
583
586
|
/**
|
|
584
587
|
* Retrieves all products for the current merchant
|
|
585
|
-
*
|
|
588
|
+
*
|
|
586
589
|
* @returns Promise that resolves to an array of products
|
|
587
590
|
* @throws {Error} When product retrieval fails
|
|
588
|
-
*
|
|
591
|
+
*
|
|
589
592
|
* @example
|
|
590
593
|
* ```typescript
|
|
591
594
|
* const products = await beep.products.listProducts();
|
|
@@ -600,19 +603,19 @@ var ProductsModule = class {
|
|
|
600
603
|
/**
|
|
601
604
|
* Updates an existing product with new configuration
|
|
602
605
|
* Only provided fields will be updated - omitted fields remain unchanged
|
|
603
|
-
*
|
|
606
|
+
*
|
|
604
607
|
* @param productId - The unique identifier of the product to update
|
|
605
608
|
* @param payload - Product update parameters (all fields optional)
|
|
606
609
|
* @returns Promise that resolves to the updated product
|
|
607
610
|
* @throws {Error} When the product is not found or update fails
|
|
608
|
-
*
|
|
611
|
+
*
|
|
609
612
|
* @example
|
|
610
613
|
* ```typescript
|
|
611
614
|
* // Update just the price
|
|
612
615
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
613
616
|
* price: '29.99'
|
|
614
617
|
* });
|
|
615
|
-
*
|
|
618
|
+
*
|
|
616
619
|
* // Update multiple fields
|
|
617
620
|
* const updatedProduct = await beep.products.updateProduct('prod_123', {
|
|
618
621
|
* name: 'New Product Name',
|
|
@@ -631,13 +634,13 @@ var ProductsModule = class {
|
|
|
631
634
|
}
|
|
632
635
|
/**
|
|
633
636
|
* Deletes an existing product
|
|
634
|
-
*
|
|
637
|
+
*
|
|
635
638
|
* @param productId - The unique identifier of the product to delete
|
|
636
639
|
* @returns Promise that resolves when the product is successfully deleted
|
|
637
640
|
* @throws {Error} When the product is not found or deletion fails
|
|
638
|
-
*
|
|
641
|
+
*
|
|
639
642
|
* @remarks Once deleted, a product cannot be recovered. Existing invoices linked to this product will remain unaffected.
|
|
640
|
-
*
|
|
643
|
+
*
|
|
641
644
|
* @example
|
|
642
645
|
* ```typescript
|
|
643
646
|
* await beep.products.deleteProduct('prod_123abc456def');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/modules/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,OAAO,EAGP,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/modules/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,OAAO,EAGP,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BpE;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrD;;;;;;;;;;;;OAYG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAKxC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYvF;;;;;;;;;;;;;;OAcG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
|
package/dist/types/token.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Each token represents a different cryptocurrency that can be used for payments
|
|
4
4
|
*/
|
|
5
5
|
export declare enum SupportedToken {
|
|
6
|
+
USDC = "USDC",// Coming soon
|
|
6
7
|
/** Tether USD - A USD-pegged stablecoin */
|
|
7
8
|
USDT = "USDT"
|
|
8
9
|
}
|
|
@@ -52,12 +53,12 @@ export declare class TokenUtils {
|
|
|
52
53
|
* Gets the number of decimal places for accurate token amount calculations
|
|
53
54
|
*
|
|
54
55
|
* @param token - The supported token to get decimals for
|
|
55
|
-
* @returns Number of decimal places (e.g., 6 for
|
|
56
|
+
* @returns Number of decimal places (e.g., 6 for USDC)
|
|
56
57
|
*
|
|
57
58
|
* @example
|
|
58
59
|
* ```typescript
|
|
59
|
-
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.
|
|
60
|
-
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5
|
|
60
|
+
* const decimals = TokenUtils.getTokenDecimals(SupportedToken.USDC);
|
|
61
|
+
* const baseUnits = 1.5 * Math.pow(10, decimals); // Convert 1.5 USDC to base units
|
|
61
62
|
* ```
|
|
62
63
|
*/
|
|
63
64
|
static getTokenDecimals(token: SupportedToken): number;
|
|
@@ -85,7 +86,7 @@ export declare class TokenUtils {
|
|
|
85
86
|
* @example
|
|
86
87
|
* ```typescript
|
|
87
88
|
* const defaultToken = TokenUtils.getDefaultToken();
|
|
88
|
-
* console.log(defaultToken); // SupportedToken.
|
|
89
|
+
* console.log(defaultToken); // SupportedToken.USDC
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
92
|
static getDefaultToken(): SupportedToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;IACxB,IAAI,SAAS,CAAE,cAAc;IAC7B,2CAA2C;IAC3C,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAG1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAGzD,CAAC;AAEF;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAIrD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IASlE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAItD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc;IAI/D;;;;;;;;;;OAUG;IACH,MAAM,CAAC,eAAe,IAAI,cAAc;CAGzC"}
|