@beep-it/sdk-core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +293 -279
- package/dist/index.mjs +284 -278
- package/dist/modules/invoices.d.ts +1 -1
- package/dist/modules/payments.d.ts +9 -34
- package/dist/modules/payments.d.ts.map +1 -1
- package/dist/modules/products.d.ts +2 -2
- package/dist/types/common.d.ts +197 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/enhanced-payment.d.ts +311 -0
- package/dist/types/enhanced-payment.d.ts.map +1 -0
- package/dist/types/enhanced-product.d.ts +299 -0
- package/dist/types/enhanced-product.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/invoice.d.ts +2 -2
- package/dist/types/invoice.d.ts.map +1 -1
- package/dist/types/payment.d.ts +2 -32
- package/dist/types/payment.d.ts.map +1 -1
- package/dist/types/product.d.ts +3 -3
- package/dist/types/product.d.ts.map +1 -1
- package/dist/types/public.d.ts +1 -1
- package/dist/types/public.d.ts.map +1 -1
- package/dist/types/streaming-payments.d.ts +173 -0
- package/dist/types/streaming-payments.d.ts.map +1 -0
- package/dist/types/token.d.ts +16 -17
- package/dist/types/token.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ const beep = new BeepClient({
|
|
|
87
87
|
|
|
88
88
|
### Server-Side Making Money
|
|
89
89
|
|
|
90
|
-
Let's say you want to charge someone 5
|
|
90
|
+
Let's say you want to charge someone 5 USDC for a pack of 100 magic crystals in your game. Here's the complete server-side flow:
|
|
91
91
|
|
|
92
92
|
#### The Server-Side Payment Flow
|
|
93
93
|
|
|
@@ -110,7 +110,7 @@ Seriously, all _you_ need to worry about is step 1. We handle 2-7 because we're
|
|
|
110
110
|
const invoiceDetails = {
|
|
111
111
|
description: 'A pack of 100 magic crystals',
|
|
112
112
|
amount: '5.00',
|
|
113
|
-
token: SupportedToken.
|
|
113
|
+
token: SupportedToken.USDC,
|
|
114
114
|
payerType: 'customer_wallet' as const,
|
|
115
115
|
};
|
|
116
116
|
|
|
@@ -142,7 +142,7 @@ try {
|
|
|
142
142
|
```typescript
|
|
143
143
|
const invoice = await beep.invoices.createInvoice({
|
|
144
144
|
amount: '19.99',
|
|
145
|
-
token: SupportedToken.
|
|
145
|
+
token: SupportedToken.USDC,
|
|
146
146
|
description: 'VIP Battle Pass',
|
|
147
147
|
payerType: 'customer_wallet',
|
|
148
148
|
});
|
|
@@ -155,7 +155,7 @@ const invoice = await beep.invoices.createInvoice({
|
|
|
155
155
|
const product = await beep.products.createProduct({
|
|
156
156
|
name: 'Magic Sword',
|
|
157
157
|
price: '9.99',
|
|
158
|
-
token: SupportedToken.
|
|
158
|
+
token: SupportedToken.USDC,
|
|
159
159
|
isSubscription: false,
|
|
160
160
|
});
|
|
161
161
|
|
|
@@ -334,7 +334,7 @@ Clean token enum instead of remembering addresses:
|
|
|
334
334
|
```typescript
|
|
335
335
|
import { SupportedToken } from '@beep-it/sdk-core';
|
|
336
336
|
|
|
337
|
-
const token = SupportedToken.
|
|
337
|
+
const token = SupportedToken.USDC; // Much cleaner!
|
|
338
338
|
```
|
|
339
339
|
|
|
340
340
|
### `TokenUtils`
|
|
@@ -345,13 +345,13 @@ Advanced token utilities:
|
|
|
345
345
|
import { TokenUtils, SupportedToken } from '@beep-it/sdk-core';
|
|
346
346
|
|
|
347
347
|
// Get the address from a token enum
|
|
348
|
-
const address = TokenUtils.getTokenAddress(SupportedToken.
|
|
348
|
+
const address = TokenUtils.getTokenAddress(SupportedToken.USDC);
|
|
349
349
|
|
|
350
350
|
// Check if we support a token
|
|
351
|
-
const isSupported = TokenUtils.isTokenSupported(SupportedToken.
|
|
351
|
+
const isSupported = TokenUtils.isTokenSupported(SupportedToken.USDC);
|
|
352
352
|
|
|
353
353
|
// Get a token enum from an address (reverse lookup)
|
|
354
|
-
const token = TokenUtils.getTokenFromAddress('
|
|
354
|
+
const token = TokenUtils.getTokenFromAddress('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6T');
|
|
355
355
|
```
|
|
356
356
|
|
|
357
357
|
---
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface BeepClientOptions {
|
|
|
46
46
|
* // Create a payment request
|
|
47
47
|
* const payment = await beep.requestPayment({
|
|
48
48
|
* amount: 10.00,
|
|
49
|
-
* token: SupportedToken.
|
|
49
|
+
* token: SupportedToken.USDC,
|
|
50
50
|
* description: 'Premium subscription'
|
|
51
51
|
* });
|
|
52
52
|
*
|
|
@@ -94,7 +94,7 @@ export declare class BeepClient {
|
|
|
94
94
|
* const res = await beep.payments.createPayout({
|
|
95
95
|
* amount: '1000000', // 1.0 USDC with 6 decimals
|
|
96
96
|
* destinationWalletAddress: 'DEST_ADDRESS',
|
|
97
|
-
* chain: '
|
|
97
|
+
* chain: 'SUI',
|
|
98
98
|
* token: 'USDC',
|
|
99
99
|
* });
|
|
100
100
|
*/
|