@settlr/sdk 0.6.2 → 0.6.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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -8
- package/dist/index.mjs +16 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ declare const SUPPORTED_TOKENS: {
|
|
|
31
31
|
type SupportedToken = keyof typeof SUPPORTED_TOKENS;
|
|
32
32
|
declare const SETTLR_CHECKOUT_URL: {
|
|
33
33
|
readonly production: "https://settlr.dev/checkout";
|
|
34
|
-
readonly development: "
|
|
34
|
+
readonly development: "https://settlr.dev/checkout";
|
|
35
35
|
};
|
|
36
36
|
declare const SUPPORTED_NETWORKS: readonly ["devnet", "mainnet-beta"];
|
|
37
37
|
type SupportedNetwork = typeof SUPPORTED_NETWORKS[number];
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare const SUPPORTED_TOKENS: {
|
|
|
31
31
|
type SupportedToken = keyof typeof SUPPORTED_TOKENS;
|
|
32
32
|
declare const SETTLR_CHECKOUT_URL: {
|
|
33
33
|
readonly production: "https://settlr.dev/checkout";
|
|
34
|
-
readonly development: "
|
|
34
|
+
readonly development: "https://settlr.dev/checkout";
|
|
35
35
|
};
|
|
36
36
|
declare const SUPPORTED_NETWORKS: readonly ["devnet", "mainnet-beta"];
|
|
37
37
|
type SupportedNetwork = typeof SUPPORTED_NETWORKS[number];
|
package/dist/index.js
CHANGED
|
@@ -107,11 +107,13 @@ var SUPPORTED_TOKENS = {
|
|
|
107
107
|
};
|
|
108
108
|
var SETTLR_API_URL = {
|
|
109
109
|
production: "https://settlr.dev/api",
|
|
110
|
-
development: "
|
|
110
|
+
development: "https://settlr.dev/api"
|
|
111
|
+
// Always use production API
|
|
111
112
|
};
|
|
112
113
|
var SETTLR_CHECKOUT_URL = {
|
|
113
114
|
production: "https://settlr.dev/checkout",
|
|
114
|
-
development: "
|
|
115
|
+
development: "https://settlr.dev/checkout"
|
|
116
|
+
// Always use production checkout
|
|
115
117
|
};
|
|
116
118
|
var SUPPORTED_NETWORKS = ["devnet", "mainnet-beta"];
|
|
117
119
|
var USDC_DECIMALS = 6;
|
|
@@ -514,7 +516,7 @@ var Settlr = class {
|
|
|
514
516
|
if (amount <= 0) {
|
|
515
517
|
throw new Error("Amount must be greater than 0");
|
|
516
518
|
}
|
|
517
|
-
const baseUrl =
|
|
519
|
+
const baseUrl = "https://settlr.dev";
|
|
518
520
|
const response = await fetch(`${baseUrl}/api/checkout/sessions`, {
|
|
519
521
|
method: "POST",
|
|
520
522
|
headers: {
|
|
@@ -614,6 +616,13 @@ function SettlrProvider({
|
|
|
614
616
|
}, [config]);
|
|
615
617
|
(0, import_react.useEffect)(() => {
|
|
616
618
|
let cancelled = false;
|
|
619
|
+
if (config.merchant.walletAddress) {
|
|
620
|
+
console.log(
|
|
621
|
+
"[Settlr] Wallet address provided in config, skipping API validation"
|
|
622
|
+
);
|
|
623
|
+
setReady(true);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
617
626
|
settlr.validateApiKey().then(() => {
|
|
618
627
|
if (!cancelled) {
|
|
619
628
|
setReady(true);
|
|
@@ -631,7 +640,7 @@ function SettlrProvider({
|
|
|
631
640
|
return () => {
|
|
632
641
|
cancelled = true;
|
|
633
642
|
};
|
|
634
|
-
}, [settlr, config.apiKey]);
|
|
643
|
+
}, [settlr, config.apiKey, config.merchant.walletAddress]);
|
|
635
644
|
const value = (0, import_react.useMemo)(
|
|
636
645
|
() => ({
|
|
637
646
|
settlr,
|
|
@@ -737,11 +746,10 @@ function BuyButton({
|
|
|
737
746
|
const handleClick = (0, import_react2.useCallback)(async () => {
|
|
738
747
|
if (disabled || loading) return;
|
|
739
748
|
if (!ready) {
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
);
|
|
749
|
+
const errorMsg = sdkError?.message || "Settlr SDK not ready. Please check your API key configuration.";
|
|
750
|
+
console.error("[Settlr BuyButton]", errorMsg);
|
|
751
|
+
const notReadyError = new Error(errorMsg);
|
|
743
752
|
onError?.(notReadyError);
|
|
744
|
-
return;
|
|
745
753
|
}
|
|
746
754
|
setLoading(true);
|
|
747
755
|
setStatus("processing");
|
package/dist/index.mjs
CHANGED
|
@@ -43,11 +43,13 @@ var SUPPORTED_TOKENS = {
|
|
|
43
43
|
};
|
|
44
44
|
var SETTLR_API_URL = {
|
|
45
45
|
production: "https://settlr.dev/api",
|
|
46
|
-
development: "
|
|
46
|
+
development: "https://settlr.dev/api"
|
|
47
|
+
// Always use production API
|
|
47
48
|
};
|
|
48
49
|
var SETTLR_CHECKOUT_URL = {
|
|
49
50
|
production: "https://settlr.dev/checkout",
|
|
50
|
-
development: "
|
|
51
|
+
development: "https://settlr.dev/checkout"
|
|
52
|
+
// Always use production checkout
|
|
51
53
|
};
|
|
52
54
|
var SUPPORTED_NETWORKS = ["devnet", "mainnet-beta"];
|
|
53
55
|
var USDC_DECIMALS = 6;
|
|
@@ -450,7 +452,7 @@ var Settlr = class {
|
|
|
450
452
|
if (amount <= 0) {
|
|
451
453
|
throw new Error("Amount must be greater than 0");
|
|
452
454
|
}
|
|
453
|
-
const baseUrl =
|
|
455
|
+
const baseUrl = "https://settlr.dev";
|
|
454
456
|
const response = await fetch(`${baseUrl}/api/checkout/sessions`, {
|
|
455
457
|
method: "POST",
|
|
456
458
|
headers: {
|
|
@@ -556,6 +558,13 @@ function SettlrProvider({
|
|
|
556
558
|
}, [config]);
|
|
557
559
|
useEffect(() => {
|
|
558
560
|
let cancelled = false;
|
|
561
|
+
if (config.merchant.walletAddress) {
|
|
562
|
+
console.log(
|
|
563
|
+
"[Settlr] Wallet address provided in config, skipping API validation"
|
|
564
|
+
);
|
|
565
|
+
setReady(true);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
559
568
|
settlr.validateApiKey().then(() => {
|
|
560
569
|
if (!cancelled) {
|
|
561
570
|
setReady(true);
|
|
@@ -573,7 +582,7 @@ function SettlrProvider({
|
|
|
573
582
|
return () => {
|
|
574
583
|
cancelled = true;
|
|
575
584
|
};
|
|
576
|
-
}, [settlr, config.apiKey]);
|
|
585
|
+
}, [settlr, config.apiKey, config.merchant.walletAddress]);
|
|
577
586
|
const value = useMemo(
|
|
578
587
|
() => ({
|
|
579
588
|
settlr,
|
|
@@ -683,11 +692,10 @@ function BuyButton({
|
|
|
683
692
|
const handleClick = useCallback(async () => {
|
|
684
693
|
if (disabled || loading) return;
|
|
685
694
|
if (!ready) {
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
);
|
|
695
|
+
const errorMsg = sdkError?.message || "Settlr SDK not ready. Please check your API key configuration.";
|
|
696
|
+
console.error("[Settlr BuyButton]", errorMsg);
|
|
697
|
+
const notReadyError = new Error(errorMsg);
|
|
689
698
|
onError?.(notReadyError);
|
|
690
|
-
return;
|
|
691
699
|
}
|
|
692
700
|
setLoading(true);
|
|
693
701
|
setStatus("processing");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlr/sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Settlr SDK - Accept Solana USDC payments with privacy. Email checkout, gasless transactions, FHE-encrypted receipts. Private on-chain, compliant off-chain.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|