@unifold/connect-react 0.1.50 → 0.1.52
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 +16 -7
- package/dist/index.mjs +16 -7
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6767,11 +6767,13 @@ function useUserIp() {
|
|
|
6767
6767
|
queryKey: ["unifold", "userIpInfo"],
|
|
6768
6768
|
queryFn: async () => {
|
|
6769
6769
|
const data = await getIpAddress();
|
|
6770
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
6770
6771
|
return {
|
|
6771
6772
|
alpha2: data.alpha2.toLowerCase(),
|
|
6772
6773
|
alpha3: data.alpha3?.toLowerCase(),
|
|
6773
6774
|
country: data.country,
|
|
6774
|
-
state:
|
|
6775
|
+
state: subdivision,
|
|
6776
|
+
subdivisionCode: subdivision,
|
|
6775
6777
|
ipAddress: data.ip_address
|
|
6776
6778
|
};
|
|
6777
6779
|
},
|
|
@@ -12264,11 +12266,13 @@ function useUserIp2() {
|
|
|
12264
12266
|
queryKey: ["unifold", "userIpInfo"],
|
|
12265
12267
|
queryFn: async () => {
|
|
12266
12268
|
const data = await getIpAddress();
|
|
12269
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
12267
12270
|
return {
|
|
12268
12271
|
alpha2: data.alpha2.toLowerCase(),
|
|
12269
12272
|
alpha3: data.alpha3?.toLowerCase(),
|
|
12270
12273
|
country: data.country,
|
|
12271
|
-
state:
|
|
12274
|
+
state: subdivision,
|
|
12275
|
+
subdivisionCode: subdivision,
|
|
12272
12276
|
ipAddress: data.ip_address
|
|
12273
12277
|
};
|
|
12274
12278
|
},
|
|
@@ -13574,7 +13578,7 @@ function BuyWithCard({
|
|
|
13574
13578
|
const response = await getDefaultOnrampToken(
|
|
13575
13579
|
{
|
|
13576
13580
|
country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
|
|
13577
|
-
subdivision_code: userIpInfo?.
|
|
13581
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
13578
13582
|
token_address: destinationTokenAddress,
|
|
13579
13583
|
chain_id: destinationChainId,
|
|
13580
13584
|
chain_type: destinationChainType
|
|
@@ -13657,7 +13661,7 @@ function BuyWithCard({
|
|
|
13657
13661
|
source_currency: currency.toLowerCase(),
|
|
13658
13662
|
destination_currency: defaultToken.destination_currency,
|
|
13659
13663
|
destination_network: defaultToken.destination_network,
|
|
13660
|
-
subdivision_code: userIpInfo?.
|
|
13664
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0
|
|
13661
13665
|
};
|
|
13662
13666
|
const response = await getOnrampQuotes(request, publishableKey);
|
|
13663
13667
|
setQuotes(response.data);
|
|
@@ -13764,7 +13768,7 @@ function BuyWithCard({
|
|
|
13764
13768
|
destination_currency: selectedProvider.destination_currency,
|
|
13765
13769
|
destination_network: selectedProvider.destination_network,
|
|
13766
13770
|
wallet_address: wallet.address,
|
|
13767
|
-
subdivision_code: userIpInfo?.
|
|
13771
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
13768
13772
|
external_id: externalId
|
|
13769
13773
|
};
|
|
13770
13774
|
const sessionStartUrl = getOnrampSessionStartUrl(
|
|
@@ -17464,8 +17468,11 @@ function BrowserWalletButton({
|
|
|
17464
17468
|
solanaProvider.off("accountChanged", handleAccountsChanged);
|
|
17465
17469
|
}
|
|
17466
17470
|
for (const provider of ethProviders) {
|
|
17467
|
-
provider.removeListener(
|
|
17468
|
-
|
|
17471
|
+
const off = provider.off?.bind(provider) ?? provider.removeListener?.bind(provider);
|
|
17472
|
+
if (off) {
|
|
17473
|
+
off("accountsChanged", handleEthAccountsChanged);
|
|
17474
|
+
off("chainChanged", handleAccountsChanged);
|
|
17475
|
+
}
|
|
17469
17476
|
}
|
|
17470
17477
|
};
|
|
17471
17478
|
}, [chainType, eip6963ProviderCount]);
|
|
@@ -17794,10 +17801,12 @@ function useAllowedCountry(publishableKey) {
|
|
|
17794
17801
|
});
|
|
17795
17802
|
isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
|
|
17796
17803
|
}
|
|
17804
|
+
const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
|
|
17797
17805
|
return {
|
|
17798
17806
|
isAllowed,
|
|
17799
17807
|
alpha2: ipData?.alpha2?.toLowerCase() ?? null,
|
|
17800
17808
|
country: ipData?.country ?? null,
|
|
17809
|
+
subdivisionCode,
|
|
17801
17810
|
isLoading,
|
|
17802
17811
|
error
|
|
17803
17812
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -6740,11 +6740,13 @@ function useUserIp() {
|
|
|
6740
6740
|
queryKey: ["unifold", "userIpInfo"],
|
|
6741
6741
|
queryFn: async () => {
|
|
6742
6742
|
const data = await getIpAddress();
|
|
6743
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
6743
6744
|
return {
|
|
6744
6745
|
alpha2: data.alpha2.toLowerCase(),
|
|
6745
6746
|
alpha3: data.alpha3?.toLowerCase(),
|
|
6746
6747
|
country: data.country,
|
|
6747
|
-
state:
|
|
6748
|
+
state: subdivision,
|
|
6749
|
+
subdivisionCode: subdivision,
|
|
6748
6750
|
ipAddress: data.ip_address
|
|
6749
6751
|
};
|
|
6750
6752
|
},
|
|
@@ -12250,11 +12252,13 @@ function useUserIp2() {
|
|
|
12250
12252
|
queryKey: ["unifold", "userIpInfo"],
|
|
12251
12253
|
queryFn: async () => {
|
|
12252
12254
|
const data = await getIpAddress();
|
|
12255
|
+
const subdivision = (data.subdivision_code || data.state || "").toLowerCase() || null;
|
|
12253
12256
|
return {
|
|
12254
12257
|
alpha2: data.alpha2.toLowerCase(),
|
|
12255
12258
|
alpha3: data.alpha3?.toLowerCase(),
|
|
12256
12259
|
country: data.country,
|
|
12257
|
-
state:
|
|
12260
|
+
state: subdivision,
|
|
12261
|
+
subdivisionCode: subdivision,
|
|
12258
12262
|
ipAddress: data.ip_address
|
|
12259
12263
|
};
|
|
12260
12264
|
},
|
|
@@ -13560,7 +13564,7 @@ function BuyWithCard({
|
|
|
13560
13564
|
const response = await getDefaultOnrampToken(
|
|
13561
13565
|
{
|
|
13562
13566
|
country_code: userIpInfo?.alpha2?.toUpperCase() || "US",
|
|
13563
|
-
subdivision_code: userIpInfo?.
|
|
13567
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
13564
13568
|
token_address: destinationTokenAddress,
|
|
13565
13569
|
chain_id: destinationChainId,
|
|
13566
13570
|
chain_type: destinationChainType
|
|
@@ -13643,7 +13647,7 @@ function BuyWithCard({
|
|
|
13643
13647
|
source_currency: currency.toLowerCase(),
|
|
13644
13648
|
destination_currency: defaultToken.destination_currency,
|
|
13645
13649
|
destination_network: defaultToken.destination_network,
|
|
13646
|
-
subdivision_code: userIpInfo?.
|
|
13650
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0
|
|
13647
13651
|
};
|
|
13648
13652
|
const response = await getOnrampQuotes(request, publishableKey);
|
|
13649
13653
|
setQuotes(response.data);
|
|
@@ -13750,7 +13754,7 @@ function BuyWithCard({
|
|
|
13750
13754
|
destination_currency: selectedProvider.destination_currency,
|
|
13751
13755
|
destination_network: selectedProvider.destination_network,
|
|
13752
13756
|
wallet_address: wallet.address,
|
|
13753
|
-
subdivision_code: userIpInfo?.
|
|
13757
|
+
subdivision_code: userIpInfo?.subdivisionCode || void 0,
|
|
13754
13758
|
external_id: externalId
|
|
13755
13759
|
};
|
|
13756
13760
|
const sessionStartUrl = getOnrampSessionStartUrl(
|
|
@@ -17450,8 +17454,11 @@ function BrowserWalletButton({
|
|
|
17450
17454
|
solanaProvider.off("accountChanged", handleAccountsChanged);
|
|
17451
17455
|
}
|
|
17452
17456
|
for (const provider of ethProviders) {
|
|
17453
|
-
provider.removeListener(
|
|
17454
|
-
|
|
17457
|
+
const off = provider.off?.bind(provider) ?? provider.removeListener?.bind(provider);
|
|
17458
|
+
if (off) {
|
|
17459
|
+
off("accountsChanged", handleEthAccountsChanged);
|
|
17460
|
+
off("chainChanged", handleAccountsChanged);
|
|
17461
|
+
}
|
|
17455
17462
|
}
|
|
17456
17463
|
};
|
|
17457
17464
|
}, [chainType, eip6963ProviderCount]);
|
|
@@ -17780,10 +17787,12 @@ function useAllowedCountry(publishableKey) {
|
|
|
17780
17787
|
});
|
|
17781
17788
|
isAllowed = !isCountryBlocked && !isSubdivisionBlocked;
|
|
17782
17789
|
}
|
|
17790
|
+
const subdivisionCode = (ipData?.subdivision_code || ipData?.state || "").toLowerCase() || null;
|
|
17783
17791
|
return {
|
|
17784
17792
|
isAllowed,
|
|
17785
17793
|
alpha2: ipData?.alpha2?.toLowerCase() ?? null,
|
|
17786
17794
|
country: ipData?.country ?? null,
|
|
17795
|
+
subdivisionCode,
|
|
17787
17796
|
isLoading,
|
|
17788
17797
|
error
|
|
17789
17798
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/connect-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "Unifold Connect React - Complete React SDK with UI components for crypto deposits",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tanstack/react-query": "^5.90.11",
|
|
29
|
-
"@unifold/core": "0.1.
|
|
30
|
-
"@unifold/react-provider": "0.1.
|
|
31
|
-
"@unifold/ui-react": "0.1.
|
|
29
|
+
"@unifold/core": "0.1.52",
|
|
30
|
+
"@unifold/react-provider": "0.1.52",
|
|
31
|
+
"@unifold/ui-react": "0.1.52"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/react": "^19.0.0",
|