@settlr/sdk 0.3.1 → 0.4.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/dist/index.d.mts CHANGED
@@ -4,12 +4,45 @@ import { ReactNode, CSSProperties } from 'react';
4
4
 
5
5
  declare const USDC_MINT_DEVNET: PublicKey;
6
6
  declare const USDC_MINT_MAINNET: PublicKey;
7
+ declare const USDT_MINT_DEVNET: PublicKey;
8
+ declare const USDT_MINT_MAINNET: PublicKey;
9
+ declare const SUPPORTED_TOKENS: {
10
+ readonly USDC: {
11
+ readonly symbol: "USDC";
12
+ readonly name: "USD Coin";
13
+ readonly decimals: 6;
14
+ readonly mint: {
15
+ readonly devnet: PublicKey;
16
+ readonly 'mainnet-beta': PublicKey;
17
+ };
18
+ readonly logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png";
19
+ };
20
+ readonly USDT: {
21
+ readonly symbol: "USDT";
22
+ readonly name: "Tether USD";
23
+ readonly decimals: 6;
24
+ readonly mint: {
25
+ readonly devnet: PublicKey;
26
+ readonly 'mainnet-beta': PublicKey;
27
+ };
28
+ readonly logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB/logo.svg";
29
+ };
30
+ };
31
+ type SupportedToken = keyof typeof SUPPORTED_TOKENS;
7
32
  declare const SETTLR_CHECKOUT_URL: {
8
33
  readonly production: "https://settlr.dev/checkout";
9
34
  readonly development: "http://localhost:3000/checkout";
10
35
  };
11
36
  declare const SUPPORTED_NETWORKS: readonly ["devnet", "mainnet-beta"];
12
37
  type SupportedNetwork = typeof SUPPORTED_NETWORKS[number];
38
+ /**
39
+ * Get token mint address for a specific network
40
+ */
41
+ declare function getTokenMint(token: SupportedToken, network: SupportedNetwork): PublicKey;
42
+ /**
43
+ * Get token decimals
44
+ */
45
+ declare function getTokenDecimals(token: SupportedToken): number;
13
46
 
14
47
  /**
15
48
  * Payment status
@@ -19,8 +52,10 @@ type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expire
19
52
  * Options for creating a payment
20
53
  */
21
54
  interface CreatePaymentOptions {
22
- /** Amount in USDC (e.g., 29.99) */
55
+ /** Amount in stablecoin (e.g., 29.99) */
23
56
  amount: number;
57
+ /** Token to accept (default: USDC) */
58
+ token?: SupportedToken;
24
59
  /** Optional memo/description for the payment */
25
60
  memo?: string;
26
61
  /** Optional order/invoice ID for your records */
@@ -40,8 +75,10 @@ interface CreatePaymentOptions {
40
75
  interface Payment {
41
76
  /** Unique payment ID */
42
77
  id: string;
43
- /** Amount in USDC */
78
+ /** Amount in stablecoin */
44
79
  amount: number;
80
+ /** Token used for payment */
81
+ token: SupportedToken;
45
82
  /** Amount in lamports (USDC atomic units) */
46
83
  amountLamports: bigint;
47
84
  /** Current status */
@@ -112,10 +149,66 @@ interface TransactionOptions {
112
149
  /** Max retries */
113
150
  maxRetries?: number;
114
151
  }
152
+ /**
153
+ * Subscription interval
154
+ */
155
+ type SubscriptionInterval = 'daily' | 'weekly' | 'monthly' | 'yearly';
156
+ /**
157
+ * Subscription status
158
+ */
159
+ type SubscriptionStatus = 'active' | 'paused' | 'cancelled' | 'past_due' | 'expired';
160
+ /**
161
+ * Subscription plan
162
+ */
163
+ interface SubscriptionPlan {
164
+ id: string;
165
+ name: string;
166
+ description?: string;
167
+ amount: number;
168
+ currency: string;
169
+ interval: SubscriptionInterval;
170
+ intervalCount: number;
171
+ trialDays?: number;
172
+ features?: string[];
173
+ active: boolean;
174
+ }
175
+ /**
176
+ * Options for creating a subscription
177
+ */
178
+ interface CreateSubscriptionOptions {
179
+ /** The plan ID to subscribe to */
180
+ planId: string;
181
+ /** Customer's wallet address */
182
+ customerWallet: string;
183
+ /** Optional customer email for notifications */
184
+ customerEmail?: string;
185
+ /** Optional metadata */
186
+ metadata?: Record<string, string>;
187
+ /** URL to redirect after successful subscription */
188
+ successUrl?: string;
189
+ /** URL to redirect after cancelled subscription */
190
+ cancelUrl?: string;
191
+ }
192
+ /**
193
+ * Subscription object
194
+ */
195
+ interface Subscription {
196
+ id: string;
197
+ planId: string;
198
+ plan?: SubscriptionPlan;
199
+ customerWallet: string;
200
+ customerEmail?: string;
201
+ status: SubscriptionStatus;
202
+ currentPeriodStart: string;
203
+ currentPeriodEnd: string;
204
+ cancelAtPeriodEnd: boolean;
205
+ trialEnd?: string;
206
+ createdAt: string;
207
+ }
115
208
  /**
116
209
  * Webhook event types
117
210
  */
118
- type WebhookEventType = 'payment.created' | 'payment.completed' | 'payment.failed' | 'payment.expired' | 'payment.refunded';
211
+ type WebhookEventType = 'payment.created' | 'payment.completed' | 'payment.failed' | 'payment.expired' | 'payment.refunded' | 'subscription.created' | 'subscription.renewed' | 'subscription.cancelled' | 'subscription.expired';
119
212
  /**
120
213
  * Webhook payload
121
214
  */
@@ -720,6 +813,10 @@ interface WebhookHandlers {
720
813
  'payment.failed'?: WebhookHandler;
721
814
  'payment.expired'?: WebhookHandler;
722
815
  'payment.refunded'?: WebhookHandler;
816
+ 'subscription.created'?: WebhookHandler;
817
+ 'subscription.renewed'?: WebhookHandler;
818
+ 'subscription.cancelled'?: WebhookHandler;
819
+ 'subscription.expired'?: WebhookHandler;
723
820
  }
724
821
  /**
725
822
  * Create a webhook handler middleware
@@ -772,4 +869,4 @@ declare function createWebhookHandler(options: {
772
869
  onError?: (error: Error) => void;
773
870
  }): (req: any, res: any) => Promise<void>;
774
871
 
775
- export { BuyButton, type BuyButtonProps, CheckoutWidget, type CheckoutWidgetProps, type CreatePaymentOptions, type MerchantConfig, type Payment, PaymentModal, type PaymentModalProps, type PaymentResult, type PaymentStatus, SETTLR_CHECKOUT_URL, SUPPORTED_NETWORKS, Settlr, type SettlrConfig, SettlrProvider, type TransactionOptions, USDC_MINT_DEVNET, USDC_MINT_MAINNET, type WebhookEventType, type WebhookHandler, type WebhookHandlers, type WebhookPayload, createWebhookHandler, formatUSDC, parseUSDC, parseWebhookPayload, shortenAddress, usePaymentLink, usePaymentModal, useSettlr, verifyWebhookSignature };
872
+ export { BuyButton, type BuyButtonProps, CheckoutWidget, type CheckoutWidgetProps, type CreatePaymentOptions, type CreateSubscriptionOptions, type MerchantConfig, type Payment, PaymentModal, type PaymentModalProps, type PaymentResult, type PaymentStatus, SETTLR_CHECKOUT_URL, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, Settlr, type SettlrConfig, SettlrProvider, type Subscription, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionStatus, type SupportedToken, type TransactionOptions, USDC_MINT_DEVNET, USDC_MINT_MAINNET, USDT_MINT_DEVNET, USDT_MINT_MAINNET, type WebhookEventType, type WebhookHandler, type WebhookHandlers, type WebhookPayload, createWebhookHandler, formatUSDC, getTokenDecimals, getTokenMint, parseUSDC, parseWebhookPayload, shortenAddress, usePaymentLink, usePaymentModal, useSettlr, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -4,12 +4,45 @@ import { ReactNode, CSSProperties } from 'react';
4
4
 
5
5
  declare const USDC_MINT_DEVNET: PublicKey;
6
6
  declare const USDC_MINT_MAINNET: PublicKey;
7
+ declare const USDT_MINT_DEVNET: PublicKey;
8
+ declare const USDT_MINT_MAINNET: PublicKey;
9
+ declare const SUPPORTED_TOKENS: {
10
+ readonly USDC: {
11
+ readonly symbol: "USDC";
12
+ readonly name: "USD Coin";
13
+ readonly decimals: 6;
14
+ readonly mint: {
15
+ readonly devnet: PublicKey;
16
+ readonly 'mainnet-beta': PublicKey;
17
+ };
18
+ readonly logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png";
19
+ };
20
+ readonly USDT: {
21
+ readonly symbol: "USDT";
22
+ readonly name: "Tether USD";
23
+ readonly decimals: 6;
24
+ readonly mint: {
25
+ readonly devnet: PublicKey;
26
+ readonly 'mainnet-beta': PublicKey;
27
+ };
28
+ readonly logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB/logo.svg";
29
+ };
30
+ };
31
+ type SupportedToken = keyof typeof SUPPORTED_TOKENS;
7
32
  declare const SETTLR_CHECKOUT_URL: {
8
33
  readonly production: "https://settlr.dev/checkout";
9
34
  readonly development: "http://localhost:3000/checkout";
10
35
  };
11
36
  declare const SUPPORTED_NETWORKS: readonly ["devnet", "mainnet-beta"];
12
37
  type SupportedNetwork = typeof SUPPORTED_NETWORKS[number];
38
+ /**
39
+ * Get token mint address for a specific network
40
+ */
41
+ declare function getTokenMint(token: SupportedToken, network: SupportedNetwork): PublicKey;
42
+ /**
43
+ * Get token decimals
44
+ */
45
+ declare function getTokenDecimals(token: SupportedToken): number;
13
46
 
14
47
  /**
15
48
  * Payment status
@@ -19,8 +52,10 @@ type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expire
19
52
  * Options for creating a payment
20
53
  */
21
54
  interface CreatePaymentOptions {
22
- /** Amount in USDC (e.g., 29.99) */
55
+ /** Amount in stablecoin (e.g., 29.99) */
23
56
  amount: number;
57
+ /** Token to accept (default: USDC) */
58
+ token?: SupportedToken;
24
59
  /** Optional memo/description for the payment */
25
60
  memo?: string;
26
61
  /** Optional order/invoice ID for your records */
@@ -40,8 +75,10 @@ interface CreatePaymentOptions {
40
75
  interface Payment {
41
76
  /** Unique payment ID */
42
77
  id: string;
43
- /** Amount in USDC */
78
+ /** Amount in stablecoin */
44
79
  amount: number;
80
+ /** Token used for payment */
81
+ token: SupportedToken;
45
82
  /** Amount in lamports (USDC atomic units) */
46
83
  amountLamports: bigint;
47
84
  /** Current status */
@@ -112,10 +149,66 @@ interface TransactionOptions {
112
149
  /** Max retries */
113
150
  maxRetries?: number;
114
151
  }
152
+ /**
153
+ * Subscription interval
154
+ */
155
+ type SubscriptionInterval = 'daily' | 'weekly' | 'monthly' | 'yearly';
156
+ /**
157
+ * Subscription status
158
+ */
159
+ type SubscriptionStatus = 'active' | 'paused' | 'cancelled' | 'past_due' | 'expired';
160
+ /**
161
+ * Subscription plan
162
+ */
163
+ interface SubscriptionPlan {
164
+ id: string;
165
+ name: string;
166
+ description?: string;
167
+ amount: number;
168
+ currency: string;
169
+ interval: SubscriptionInterval;
170
+ intervalCount: number;
171
+ trialDays?: number;
172
+ features?: string[];
173
+ active: boolean;
174
+ }
175
+ /**
176
+ * Options for creating a subscription
177
+ */
178
+ interface CreateSubscriptionOptions {
179
+ /** The plan ID to subscribe to */
180
+ planId: string;
181
+ /** Customer's wallet address */
182
+ customerWallet: string;
183
+ /** Optional customer email for notifications */
184
+ customerEmail?: string;
185
+ /** Optional metadata */
186
+ metadata?: Record<string, string>;
187
+ /** URL to redirect after successful subscription */
188
+ successUrl?: string;
189
+ /** URL to redirect after cancelled subscription */
190
+ cancelUrl?: string;
191
+ }
192
+ /**
193
+ * Subscription object
194
+ */
195
+ interface Subscription {
196
+ id: string;
197
+ planId: string;
198
+ plan?: SubscriptionPlan;
199
+ customerWallet: string;
200
+ customerEmail?: string;
201
+ status: SubscriptionStatus;
202
+ currentPeriodStart: string;
203
+ currentPeriodEnd: string;
204
+ cancelAtPeriodEnd: boolean;
205
+ trialEnd?: string;
206
+ createdAt: string;
207
+ }
115
208
  /**
116
209
  * Webhook event types
117
210
  */
118
- type WebhookEventType = 'payment.created' | 'payment.completed' | 'payment.failed' | 'payment.expired' | 'payment.refunded';
211
+ type WebhookEventType = 'payment.created' | 'payment.completed' | 'payment.failed' | 'payment.expired' | 'payment.refunded' | 'subscription.created' | 'subscription.renewed' | 'subscription.cancelled' | 'subscription.expired';
119
212
  /**
120
213
  * Webhook payload
121
214
  */
@@ -720,6 +813,10 @@ interface WebhookHandlers {
720
813
  'payment.failed'?: WebhookHandler;
721
814
  'payment.expired'?: WebhookHandler;
722
815
  'payment.refunded'?: WebhookHandler;
816
+ 'subscription.created'?: WebhookHandler;
817
+ 'subscription.renewed'?: WebhookHandler;
818
+ 'subscription.cancelled'?: WebhookHandler;
819
+ 'subscription.expired'?: WebhookHandler;
723
820
  }
724
821
  /**
725
822
  * Create a webhook handler middleware
@@ -772,4 +869,4 @@ declare function createWebhookHandler(options: {
772
869
  onError?: (error: Error) => void;
773
870
  }): (req: any, res: any) => Promise<void>;
774
871
 
775
- export { BuyButton, type BuyButtonProps, CheckoutWidget, type CheckoutWidgetProps, type CreatePaymentOptions, type MerchantConfig, type Payment, PaymentModal, type PaymentModalProps, type PaymentResult, type PaymentStatus, SETTLR_CHECKOUT_URL, SUPPORTED_NETWORKS, Settlr, type SettlrConfig, SettlrProvider, type TransactionOptions, USDC_MINT_DEVNET, USDC_MINT_MAINNET, type WebhookEventType, type WebhookHandler, type WebhookHandlers, type WebhookPayload, createWebhookHandler, formatUSDC, parseUSDC, parseWebhookPayload, shortenAddress, usePaymentLink, usePaymentModal, useSettlr, verifyWebhookSignature };
872
+ export { BuyButton, type BuyButtonProps, CheckoutWidget, type CheckoutWidgetProps, type CreatePaymentOptions, type CreateSubscriptionOptions, type MerchantConfig, type Payment, PaymentModal, type PaymentModalProps, type PaymentResult, type PaymentStatus, SETTLR_CHECKOUT_URL, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, Settlr, type SettlrConfig, SettlrProvider, type Subscription, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionStatus, type SupportedToken, type TransactionOptions, USDC_MINT_DEVNET, USDC_MINT_MAINNET, USDT_MINT_DEVNET, USDT_MINT_MAINNET, type WebhookEventType, type WebhookHandler, type WebhookHandlers, type WebhookPayload, createWebhookHandler, formatUSDC, getTokenDecimals, getTokenMint, parseUSDC, parseWebhookPayload, shortenAddress, usePaymentLink, usePaymentModal, useSettlr, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -35,12 +35,17 @@ __export(index_exports, {
35
35
  PaymentModal: () => PaymentModal,
36
36
  SETTLR_CHECKOUT_URL: () => SETTLR_CHECKOUT_URL,
37
37
  SUPPORTED_NETWORKS: () => SUPPORTED_NETWORKS,
38
+ SUPPORTED_TOKENS: () => SUPPORTED_TOKENS,
38
39
  Settlr: () => Settlr,
39
40
  SettlrProvider: () => SettlrProvider,
40
41
  USDC_MINT_DEVNET: () => USDC_MINT_DEVNET,
41
42
  USDC_MINT_MAINNET: () => USDC_MINT_MAINNET,
43
+ USDT_MINT_DEVNET: () => USDT_MINT_DEVNET,
44
+ USDT_MINT_MAINNET: () => USDT_MINT_MAINNET,
42
45
  createWebhookHandler: () => createWebhookHandler,
43
46
  formatUSDC: () => formatUSDC,
47
+ getTokenDecimals: () => getTokenDecimals,
48
+ getTokenMint: () => getTokenMint,
44
49
  parseUSDC: () => parseUSDC,
45
50
  parseWebhookPayload: () => parseWebhookPayload,
46
51
  shortenAddress: () => shortenAddress,
@@ -59,6 +64,30 @@ var import_spl_token = require("@solana/spl-token");
59
64
  var import_web3 = require("@solana/web3.js");
60
65
  var USDC_MINT_DEVNET = new import_web3.PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU");
61
66
  var USDC_MINT_MAINNET = new import_web3.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
67
+ var USDT_MINT_DEVNET = new import_web3.PublicKey("EJwZgeZrdC8TXTQbQBoL6bfuAnFUQS7QrP5KpEgk3aSm");
68
+ var USDT_MINT_MAINNET = new import_web3.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
69
+ var SUPPORTED_TOKENS = {
70
+ USDC: {
71
+ symbol: "USDC",
72
+ name: "USD Coin",
73
+ decimals: 6,
74
+ mint: {
75
+ devnet: USDC_MINT_DEVNET,
76
+ "mainnet-beta": USDC_MINT_MAINNET
77
+ },
78
+ logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"
79
+ },
80
+ USDT: {
81
+ symbol: "USDT",
82
+ name: "Tether USD",
83
+ decimals: 6,
84
+ mint: {
85
+ devnet: USDT_MINT_DEVNET,
86
+ "mainnet-beta": USDT_MINT_MAINNET
87
+ },
88
+ logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB/logo.svg"
89
+ }
90
+ };
62
91
  var SETTLR_API_URL = {
63
92
  production: "https://settlr.dev/api",
64
93
  development: "http://localhost:3000/api"
@@ -73,6 +102,12 @@ var DEFAULT_RPC_ENDPOINTS = {
73
102
  devnet: "https://api.devnet.solana.com",
74
103
  "mainnet-beta": "https://api.mainnet-beta.solana.com"
75
104
  };
105
+ function getTokenMint(token, network) {
106
+ return SUPPORTED_TOKENS[token].mint[network];
107
+ }
108
+ function getTokenDecimals(token) {
109
+ return SUPPORTED_TOKENS[token].decimals;
110
+ }
76
111
 
77
112
  // src/utils.ts
78
113
  function formatUSDC(lamports, decimals = 2) {
@@ -262,6 +297,8 @@ var Settlr = class {
262
297
  const payment = {
263
298
  id: paymentId,
264
299
  amount,
300
+ token: "USDC",
301
+ // Default to USDC
265
302
  amountLamports,
266
303
  status: "pending",
267
304
  merchantAddress: this.config.merchant.walletAddress,
@@ -1148,12 +1185,17 @@ function createWebhookHandler(options) {
1148
1185
  PaymentModal,
1149
1186
  SETTLR_CHECKOUT_URL,
1150
1187
  SUPPORTED_NETWORKS,
1188
+ SUPPORTED_TOKENS,
1151
1189
  Settlr,
1152
1190
  SettlrProvider,
1153
1191
  USDC_MINT_DEVNET,
1154
1192
  USDC_MINT_MAINNET,
1193
+ USDT_MINT_DEVNET,
1194
+ USDT_MINT_MAINNET,
1155
1195
  createWebhookHandler,
1156
1196
  formatUSDC,
1197
+ getTokenDecimals,
1198
+ getTokenMint,
1157
1199
  parseUSDC,
1158
1200
  parseWebhookPayload,
1159
1201
  shortenAddress,
package/dist/index.mjs CHANGED
@@ -17,6 +17,30 @@ import {
17
17
  import { PublicKey } from "@solana/web3.js";
18
18
  var USDC_MINT_DEVNET = new PublicKey("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU");
19
19
  var USDC_MINT_MAINNET = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
20
+ var USDT_MINT_DEVNET = new PublicKey("EJwZgeZrdC8TXTQbQBoL6bfuAnFUQS7QrP5KpEgk3aSm");
21
+ var USDT_MINT_MAINNET = new PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
22
+ var SUPPORTED_TOKENS = {
23
+ USDC: {
24
+ symbol: "USDC",
25
+ name: "USD Coin",
26
+ decimals: 6,
27
+ mint: {
28
+ devnet: USDC_MINT_DEVNET,
29
+ "mainnet-beta": USDC_MINT_MAINNET
30
+ },
31
+ logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"
32
+ },
33
+ USDT: {
34
+ symbol: "USDT",
35
+ name: "Tether USD",
36
+ decimals: 6,
37
+ mint: {
38
+ devnet: USDT_MINT_DEVNET,
39
+ "mainnet-beta": USDT_MINT_MAINNET
40
+ },
41
+ logoUrl: "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB/logo.svg"
42
+ }
43
+ };
20
44
  var SETTLR_API_URL = {
21
45
  production: "https://settlr.dev/api",
22
46
  development: "http://localhost:3000/api"
@@ -31,6 +55,12 @@ var DEFAULT_RPC_ENDPOINTS = {
31
55
  devnet: "https://api.devnet.solana.com",
32
56
  "mainnet-beta": "https://api.mainnet-beta.solana.com"
33
57
  };
58
+ function getTokenMint(token, network) {
59
+ return SUPPORTED_TOKENS[token].mint[network];
60
+ }
61
+ function getTokenDecimals(token) {
62
+ return SUPPORTED_TOKENS[token].decimals;
63
+ }
34
64
 
35
65
  // src/utils.ts
36
66
  function formatUSDC(lamports, decimals = 2) {
@@ -220,6 +250,8 @@ var Settlr = class {
220
250
  const payment = {
221
251
  id: paymentId,
222
252
  amount,
253
+ token: "USDC",
254
+ // Default to USDC
223
255
  amountLamports,
224
256
  status: "pending",
225
257
  merchantAddress: this.config.merchant.walletAddress,
@@ -1109,12 +1141,17 @@ export {
1109
1141
  PaymentModal,
1110
1142
  SETTLR_CHECKOUT_URL,
1111
1143
  SUPPORTED_NETWORKS,
1144
+ SUPPORTED_TOKENS,
1112
1145
  Settlr,
1113
1146
  SettlrProvider,
1114
1147
  USDC_MINT_DEVNET,
1115
1148
  USDC_MINT_MAINNET,
1149
+ USDT_MINT_DEVNET,
1150
+ USDT_MINT_MAINNET,
1116
1151
  createWebhookHandler,
1117
1152
  formatUSDC,
1153
+ getTokenDecimals,
1154
+ getTokenMint,
1118
1155
  parseUSDC,
1119
1156
  parseWebhookPayload,
1120
1157
  shortenAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlr/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Settlr SDK - Accept Solana USDC payments in games and apps. Email checkout, gasless transactions, no wallet required. The easiest way to add crypto payments.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",