@getpara/react-common 1.9.0 → 1.10.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/{chunk-IV3L3JVM.js → chunk-GOCCUU3Z.js} +0 -4
- package/dist/classes/ParaInternal.js +1 -1
- package/dist/components/HeroSpinner.js +1 -1
- package/dist/components/KnownDevices.js +1 -1
- package/dist/components/MoonPayEmbed.js +15 -25
- package/dist/components/QRCode.js +1 -1
- package/dist/components/RampEmbed.js +1 -1
- package/dist/components/StripeEmbed.d.ts +1 -1
- package/dist/components/StripeEmbed.js +2 -2
- package/dist/components/UserIdentifier.js +1 -1
- package/dist/components/common.js +1 -1
- package/dist/constants/aaguiMetadata.js +1 -1
- package/dist/hooks/useCopyToClipboard.js +1 -1
- package/dist/utils/formatBiometricHints.js +1 -1
- package/dist/utils/formatPhoneNumber.js +1 -1
- package/dist/utils/getBrowserName.js +1 -1
- package/dist/utils/getDeviceLogo.js +1 -1
- package/dist/utils/getDeviceModelName.js +1 -1
- package/dist/utils/getExternalWalletDisplayName.js +1 -1
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +8 -1
- package/dist/utils/offRampSend.js +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,7 +15,6 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
18
|
var __async = (__this, __arguments, generator) => {
|
|
22
19
|
return new Promise((resolve, reject) => {
|
|
23
20
|
var fulfilled = (value) => {
|
|
@@ -41,6 +38,5 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
38
|
|
|
42
39
|
export {
|
|
43
40
|
__spreadValues,
|
|
44
|
-
__spreadProps,
|
|
45
41
|
__async
|
|
46
42
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
__async
|
|
4
|
-
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../chunk-IV3L3JVM.js";
|
|
3
|
+
__async
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
7
5
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { OnRampProvider, OnRampPurchaseStatus } from "@getpara/web-sdk";
|
|
6
|
+
import { getNetworkPrefix, OnRampProvider, OnRampPurchaseStatus } from "@getpara/web-sdk";
|
|
9
7
|
import { lazy, useCallback, useEffect, useMemo, useState } from "react";
|
|
10
|
-
import {
|
|
8
|
+
import { reverseCurrencyLookup, offRampSend, getCurrencyCode } from "../utils/index.js";
|
|
11
9
|
import styled from "styled-components";
|
|
12
10
|
const MOONPAY_PUBLISHABLE_KEY = "pk_live_EQva4LydtNDE0Rwd9X7SG9w58wqOzbux";
|
|
13
11
|
const MOONPAY_PUBLISHABLE_KEY_TEST = "pk_test_HYobzemmTBXxcSStVA4dSED6jT";
|
|
@@ -38,7 +36,7 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
38
36
|
const res = yield para.ctx.client.signMoonPayUrl(para.getUserId(), {
|
|
39
37
|
url,
|
|
40
38
|
type: onRampPurchase.walletType,
|
|
41
|
-
cosmosPrefix:
|
|
39
|
+
cosmosPrefix: getNetworkPrefix(onRampPurchase.network),
|
|
42
40
|
testMode: onRampPurchase.testMode,
|
|
43
41
|
walletId: onRampPurchase.walletId || void 0,
|
|
44
42
|
externalWalletAddress: onRampPurchase.externalWalletAddress || void 0
|
|
@@ -47,14 +45,6 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
47
45
|
}),
|
|
48
46
|
[onRampPurchase.walletId, onRampPurchase.walletType, para.cosmosPrefix, onRampPurchase.testMode, para]
|
|
49
47
|
);
|
|
50
|
-
const { currencyCodes, defaultCurrencyCode } = useMemo(
|
|
51
|
-
() => getCurrencyCodes(onRampConfig, {
|
|
52
|
-
provider: OnRampProvider.MOONPAY,
|
|
53
|
-
walletType: onRampPurchase.walletType,
|
|
54
|
-
purchaseType: onRampPurchase.type
|
|
55
|
-
}),
|
|
56
|
-
[onRampPurchase.walletType, onRampPurchase.type, onRampConfig.assetInfo, onRampConfig == null ? void 0 : onRampConfig.allowedAssets]
|
|
57
|
-
);
|
|
58
48
|
const onTransactionCompleted = useCallback(
|
|
59
49
|
(payload) => __async(void 0, null, function* () {
|
|
60
50
|
try {
|
|
@@ -116,18 +106,19 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
116
106
|
if (!LazyMoonPayBuyWidget || !LazyMoonPaySellWidget) {
|
|
117
107
|
return null;
|
|
118
108
|
}
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
109
|
+
const currencyCode = getCurrencyCode(onRampConfig, {
|
|
110
|
+
network: onRampPurchase.network,
|
|
111
|
+
asset: onRampPurchase.asset,
|
|
112
|
+
provider: OnRampProvider.MOONPAY
|
|
113
|
+
});
|
|
122
114
|
return onRampPurchase.type === "BUY" ? /* @__PURE__ */ jsx(
|
|
123
115
|
LazyMoonPayBuyWidget,
|
|
124
116
|
{
|
|
125
117
|
variant: "embedded",
|
|
126
118
|
baseCurrencyCode: onRampPurchase.fiat,
|
|
127
119
|
baseCurrencyAmount: onRampPurchase.fiatQuantity,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
walletAddresses: JSON.stringify(walletAddresses),
|
|
120
|
+
currencyCode,
|
|
121
|
+
walletAddress: onRampPurchase.address,
|
|
131
122
|
visible: true,
|
|
132
123
|
theme: isDark ? "dark" : "light",
|
|
133
124
|
style: {
|
|
@@ -144,7 +135,6 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
144
135
|
LazyMoonPaySellWidget,
|
|
145
136
|
{
|
|
146
137
|
variant: "embedded",
|
|
147
|
-
refundWalletAddresses: JSON.stringify(walletAddresses),
|
|
148
138
|
visible: true,
|
|
149
139
|
theme: isDark ? "dark" : "light",
|
|
150
140
|
style: {
|
|
@@ -154,7 +144,8 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
154
144
|
borderRadius: 0,
|
|
155
145
|
margin: 0
|
|
156
146
|
},
|
|
157
|
-
|
|
147
|
+
baseCurrencyCode: currencyCode,
|
|
148
|
+
refundWalletAddress: onRampPurchase.address,
|
|
158
149
|
onInitiateDeposit,
|
|
159
150
|
onTransactionCompleted,
|
|
160
151
|
onUrlSignatureRequested
|
|
@@ -165,8 +156,7 @@ const MoonPayEmbed = ({ para, isDark, isEmbedded, onRampConfig, onRampPurchase,
|
|
|
165
156
|
onRampPurchase.address,
|
|
166
157
|
onRampPurchase.walletId,
|
|
167
158
|
onRampPurchase.walletType,
|
|
168
|
-
|
|
169
|
-
currencyCodes,
|
|
159
|
+
onRampPurchase.asset,
|
|
170
160
|
onInitiateDeposit,
|
|
171
161
|
onTransactionCompleted,
|
|
172
162
|
onUrlSignatureRequested,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
5
|
import styled from "styled-components";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Props } from '../types/index.js';
|
|
2
2
|
export declare const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
|
|
3
|
-
export declare const STRIPE_PUBLISHABLE_KEY_TEST = "
|
|
3
|
+
export declare const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
|
|
4
4
|
export declare const StripeEmbed: ({ para, isDark, isEmbedded, onRampPurchase, setOnRampPurchase }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__async
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { loadStripeOnramp } from "@stripe/crypto";
|
|
@@ -10,7 +10,7 @@ import { CpslSpinner } from "@getpara/react-components";
|
|
|
10
10
|
import { SpinnerContainer } from "./common.js";
|
|
11
11
|
import styled from "styled-components";
|
|
12
12
|
const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
|
|
13
|
-
const STRIPE_PUBLISHABLE_KEY_TEST = "
|
|
13
|
+
const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
|
|
14
14
|
const AssetCodes = {
|
|
15
15
|
eth: OnRampAsset.ETHEREUM,
|
|
16
16
|
matic: OnRampAsset.POLYGON,
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { OnRampAsset, OnRampAssetInfo, OnRampProvider, Network, OnRampPurchaseType, OnRampConfig, WalletType } from '@getpara/web-sdk';
|
|
2
|
+
export declare function getCurrencyCode({ assetInfo }: OnRampConfig, { network, asset, provider }: {
|
|
3
|
+
network: Network;
|
|
4
|
+
asset: OnRampAsset;
|
|
5
|
+
provider: OnRampProvider;
|
|
6
|
+
}): string | undefined;
|
|
2
7
|
export declare function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRampNetwork, defaultOnRampAsset }: OnRampConfig, { provider, purchaseType, walletType, }: {
|
|
3
8
|
provider: OnRampProvider;
|
|
4
9
|
purchaseType: OnRampPurchaseType;
|
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
3
5
|
import {
|
|
4
6
|
OnRampAsset,
|
|
5
7
|
Network,
|
|
@@ -7,6 +9,10 @@ import {
|
|
|
7
9
|
getOnRampAssets,
|
|
8
10
|
toAssetInfoArray
|
|
9
11
|
} from "@getpara/web-sdk";
|
|
12
|
+
function getCurrencyCode({ assetInfo }, { network, asset, provider }) {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
return (_c = (_b = (_a = Object.values(assetInfo).reduce((acc, record) => __spreadValues(__spreadValues({}, acc), record), {})[network]) == null ? void 0 : _a[asset]) == null ? void 0 : _b[provider]) == null ? void 0 : _c[0];
|
|
15
|
+
}
|
|
10
16
|
function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRampNetwork, defaultOnRampAsset }, {
|
|
11
17
|
provider,
|
|
12
18
|
purchaseType,
|
|
@@ -110,6 +116,7 @@ export {
|
|
|
110
116
|
getAssetFromContractAddress,
|
|
111
117
|
getChainId,
|
|
112
118
|
getContractAddressFromAsset,
|
|
119
|
+
getCurrencyCode,
|
|
113
120
|
getCurrencyCodes,
|
|
114
121
|
getNetworkFromChainId,
|
|
115
122
|
getNetworkOrMainNetEquivalent,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__async
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-GOCCUU3Z.js";
|
|
5
5
|
import { hexStringToBase64, WalletType } from "@getpara/web-sdk";
|
|
6
6
|
function offRampSend(_0, _1, _2, _3) {
|
|
7
7
|
return __async(this, arguments, function* (para, { id: purchaseId, provider, walletId, walletType, address, testMode = false }, setOnRampPurchase, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"*.css"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@getpara/react-components": "1.
|
|
15
|
-
"@getpara/web-sdk": "1.
|
|
14
|
+
"@getpara/react-components": "1.10.0",
|
|
15
|
+
"@getpara/web-sdk": "1.10.0",
|
|
16
16
|
"@moonpay/moonpay-react": "^1.8.3",
|
|
17
17
|
"@ramp-network/ramp-instant-sdk": "^4.0.5",
|
|
18
18
|
"@stripe/crypto": "^0.0.4",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"resolutions": {
|
|
44
44
|
"styled-components": "^6"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "617cf0aa1307a96ec5e91d39e306e8a0b3b86b82"
|
|
47
47
|
}
|