@coinflowlabs/react-native 3.1.6 → 3.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 +58 -42
- package/build/CoinflowPurchase.js +7 -3
- package/build/CoinflowPurchase.js.map +1 -1
- package/build/common/CoinflowLibMessageHandlers.js +1 -0
- package/build/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/common/CoinflowTypes.d.ts +30 -7
- package/build/common/CoinflowTypes.js +6 -0
- package/build/common/CoinflowTypes.js.map +1 -1
- package/build/common/CoinflowUtils.d.ts +13 -2
- package/build/common/CoinflowUtils.js +96 -1
- package/build/common/CoinflowUtils.js.map +1 -1
- package/build/common/card-form/TokenEx.d.ts +154 -0
- package/build/common/card-form/TokenEx.js +12 -0
- package/build/common/card-form/TokenEx.js.map +1 -0
- package/build/common/card-form/tokenexHelpers.d.ts +28 -0
- package/build/common/card-form/tokenexHelpers.js +210 -0
- package/build/common/card-form/tokenexHelpers.js.map +1 -0
- package/build/common/index.d.ts +2 -0
- package/build/common/index.js +2 -0
- package/build/common/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Coinflow React Native
|
|
2
2
|
|
|
3
3
|
## Withdraw Usage
|
|
4
|
+
|
|
4
5
|
```
|
|
5
6
|
import {useWallet} from '@solana/wallet-adapter-react';
|
|
6
7
|
const wallet = useWallet();
|
|
@@ -10,23 +11,25 @@ const connection = useConnection();
|
|
|
10
11
|
```
|
|
11
12
|
|
|
12
13
|
Props:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
|
|
15
|
+
- `wallet`: The Solana Wallet Adapter Wallet
|
|
16
|
+
- `merchantId`: Your Merchant ID (Contact Coinflow support for this)
|
|
17
|
+
- `connection`: Solana Connection
|
|
18
|
+
- `env` (optional): This defaults to `prod`
|
|
19
|
+
- For testing set to `staging`
|
|
20
|
+
- `onSuccess` (optional): function to run when the withdrawal process is successful
|
|
21
|
+
- `lockAmount` (optional): Whether to let the user select the amount to withdraw or to disable the input
|
|
22
|
+
- `amount` (optional): The amount to withdraw - required if `lockAmount=true`
|
|
23
|
+
- `tokens` (optional): Define a list to filter the available tokens
|
|
24
|
+
- `lockDefaultToken` (optional): Only allow the default token to be used
|
|
25
|
+
- `email` (optional): Set the default email to be used in entry fields
|
|
26
|
+
- `bankAccountLinkRedirect` (optional): The URL to be used for bank account setup
|
|
27
|
+
- `additionalWallets` (optional): Define additional wallets to assign to the user
|
|
28
|
+
- `usePermit` (optional): Pass as false to disable permit message signing for EVM and use approve transactions
|
|
29
|
+
- `transactionSigner` (optional): Public Key of the wallet which will actually execute the withdrawal transaction. Must be associated with the same withdrawer as the main wallet.
|
|
28
30
|
|
|
29
31
|
## Purchase Usage
|
|
32
|
+
|
|
30
33
|
```
|
|
31
34
|
import {useWallet} from '@solana/wallet-adapter-react';
|
|
32
35
|
const wallet = useWallet();
|
|
@@ -36,30 +39,41 @@ const connection = useConnection();
|
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
Props:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
- `wallet`: The Solana Wallet Adapter Wallet
|
|
44
|
+
- `merchantId`: Your Merchant ID (Contact Coinflow support for this)
|
|
45
|
+
- `connection`: Solana Connection
|
|
46
|
+
- `env` (optional): This defaults to `prod`
|
|
43
47
|
- For testing set to `staging`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
- `onSuccess` (optional): function to run when the purchase process is successful
|
|
49
|
+
- `transaction` (optional): transaction for the user to run which redeems their credits with your smart contract. Create this transaction just like you would for a normal user who has USDC in their account.
|
|
50
|
+
- `partialSigners` (optional): Keypairs of Partial Signers to sign the transaction with, this is necessary when initializing new accounts as the new account Keypair must sign the transaction.
|
|
51
|
+
- `debugTx` (optional): Setting this to `true` will sign the transaction with the wallet, and send the transaction with no preflight checks allowing for easier debug of any issues.
|
|
52
|
+
- `token` (optional): The token to use for the purchase. Defaults to USDC. Currently only supported for the Solana Blockchain.
|
|
53
|
+
- `planCode` (optional): When a subscription is being purchased, the code of the subscription plan.
|
|
54
|
+
- `settlementType` (optional): The settlement method to use for the proceeds of a purchase. (Credits, USDC, or Bank)
|
|
55
|
+
- `amount` (optional): Fix the amount of purchase
|
|
56
|
+
- `webhookInfo` (optional): Product or transaction based information that you want transmitted when you receive webhooks regarding the purchase
|
|
57
|
+
- `email` (optional): Set the default email to use in email entry fields
|
|
58
|
+
- `chargebackProtectionData` (optional):
|
|
59
|
+
- `disableApplePay` (optional): Ability to disable Apple Pay
|
|
60
|
+
- `disableGooglePay` (optional): Ability to disable Google Pay
|
|
61
|
+
- `customerInfo` (optional): Additional information about the customer
|
|
62
|
+
- `rent` (optional, Solana only): Specify the blockchain rent amount to add to the total
|
|
63
|
+
- `nativeSolToConvert` (optional, Solana only): Specify the amount of native SOL to convert wSOL for the purchase
|
|
64
|
+
- `jwtToken` (optional): A JWT token which encodes verified checkout parameters to prevent spoofing of arguments.
|
|
65
|
+
- `supportEmail` (optional): Your business support email address to use for support inquiries
|
|
60
66
|
|
|
61
67
|
# Changelog
|
|
62
68
|
|
|
69
|
+
## 3.2.1
|
|
70
|
+
|
|
71
|
+
- CoinflowPurchaseV2 component added for a modernized purchase flow
|
|
72
|
+
|
|
73
|
+
## 3.2.0
|
|
74
|
+
|
|
75
|
+
- Added arbitrum blockchain support
|
|
76
|
+
|
|
63
77
|
## 3.1.5
|
|
64
78
|
|
|
65
79
|
- Allow custom taker on reservoir transactions
|
|
@@ -88,7 +102,8 @@ Props:
|
|
|
88
102
|
## 2.1.11
|
|
89
103
|
|
|
90
104
|
- Added `theme` props to Coinflow components for easy color control
|
|
91
|
-
-
|
|
105
|
+
-
|
|
106
|
+
|
|
92
107
|
## 2.1.10
|
|
93
108
|
|
|
94
109
|
- Added `orderId` option for reservoir items
|
|
@@ -133,23 +148,23 @@ Props:
|
|
|
133
148
|
|
|
134
149
|
# 1.2.8
|
|
135
150
|
|
|
136
|
-
|
|
151
|
+
- Fix external linking for Coinflow URLs
|
|
137
152
|
|
|
138
153
|
# 1.2.7
|
|
139
154
|
|
|
140
|
-
|
|
155
|
+
- Fix external linking for specified URLs
|
|
141
156
|
|
|
142
157
|
# 1.2.6
|
|
143
158
|
|
|
144
|
-
|
|
159
|
+
- Added deviceId and chargebackProtectionData to CoinflowPurchase
|
|
145
160
|
|
|
146
161
|
# 1.2.5
|
|
147
162
|
|
|
148
|
-
|
|
163
|
+
- Fixing Webhook Info
|
|
149
164
|
|
|
150
165
|
# 1.2.3
|
|
151
166
|
|
|
152
|
-
|
|
167
|
+
- `getFeePayer` - Return the `PublicKey` of the Coinflow Fee Payer
|
|
153
168
|
|
|
154
169
|
# Changelog
|
|
155
170
|
|
|
@@ -170,4 +185,5 @@ Props:
|
|
|
170
185
|
- Added the ability to sign transactions instead of sign messages
|
|
171
186
|
|
|
172
187
|
# 0.1.0
|
|
173
|
-
|
|
188
|
+
|
|
189
|
+
Genesis 1:1
|
|
@@ -2,14 +2,18 @@ import { __assign } from "tslib";
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { CoinflowWebView, } from './CoinflowWebView';
|
|
4
4
|
import { getWalletPubkey, getHandlers, CoinflowUtils, } from './common';
|
|
5
|
-
|
|
5
|
+
function useCoinflowPurchase(purchaseProps, version) {
|
|
6
6
|
var webviewProps = useMemo(function () {
|
|
7
7
|
var walletPubkey = getWalletPubkey(purchaseProps);
|
|
8
|
-
return __assign(__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase/".concat(purchaseProps.merchantId), transaction: CoinflowUtils.getTransaction(purchaseProps), onLoad: purchaseProps.onLoad });
|
|
9
|
-
}, [purchaseProps]);
|
|
8
|
+
return __assign(__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase".concat(version, "/").concat(purchaseProps.merchantId), transaction: CoinflowUtils.getTransaction(purchaseProps), onLoad: purchaseProps.onLoad });
|
|
9
|
+
}, [purchaseProps, version]);
|
|
10
10
|
var messageHandlers = useMemo(function () {
|
|
11
11
|
return __assign(__assign({}, getHandlers(purchaseProps)), { handleHeightChange: purchaseProps.handleHeightChange });
|
|
12
12
|
}, [purchaseProps]);
|
|
13
|
+
return { webviewProps: webviewProps, messageHandlers: messageHandlers };
|
|
14
|
+
}
|
|
15
|
+
export function CoinflowPurchase(purchaseProps) {
|
|
16
|
+
var _a = useCoinflowPurchase(purchaseProps, '-v2'), webviewProps = _a.webviewProps, messageHandlers = _a.messageHandlers;
|
|
13
17
|
return React.createElement(CoinflowWebView, __assign({}, webviewProps, messageHandlers));
|
|
14
18
|
}
|
|
15
19
|
//# sourceMappingURL=CoinflowPurchase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../src/CoinflowPurchase.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,eAAe,GAIhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,eAAe,EACf,WAAW,EAEX,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,
|
|
1
|
+
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../src/CoinflowPurchase.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EACL,eAAe,GAIhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,eAAe,EACf,WAAW,EAEX,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,SAAS,mBAAmB,CAC1B,aAA8D,EAC9D,OAAe;IAEf,IAAM,YAAY,GAAG,OAAO,CAAuB;QACjD,IAAM,YAAY,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;QACpD,6BACK,aAAa,KAChB,YAAY,cAAA,EACZ,KAAK,EAAE,mBAAY,OAAO,cAAI,aAAa,CAAC,UAAU,CAAE,EACxD,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,EACxD,MAAM,EAAE,aAAa,CAAC,MAAM,IAC5B;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,IAAM,eAAe,GAAG,OAAO,CAAwB;QACrD,6BACK,WAAW,CAAC,aAAa,CAAC,KAC7B,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,IACpD;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,EAAC,YAAY,cAAA,EAAE,eAAe,iBAAA,EAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,aAA8D;IAExD,IAAA,KAAkC,mBAAmB,CACzD,aAAa,EACb,KAAK,CACN,EAHM,YAAY,kBAAA,EAAE,eAAe,qBAGnC,CAAC;IACF,OAAO,oBAAC,eAAe,eAAK,YAAY,EAAM,eAAe,EAAI,CAAC;AACpE,CAAC"}
|
|
@@ -64,6 +64,7 @@ export function getHandlers(props) {
|
|
|
64
64
|
eth: function () { return getEvmWalletHandlers(props); },
|
|
65
65
|
polygon: function () { return getEvmWalletHandlers(props); },
|
|
66
66
|
base: function () { return getEvmWalletHandlers(props); },
|
|
67
|
+
arbitrum: function () { return getEvmWalletHandlers(props); },
|
|
67
68
|
})();
|
|
68
69
|
}
|
|
69
70
|
function getSolanaWalletHandlers(_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";AAOA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAoB9C,IAAK,oBAMJ;AAND,WAAK,oBAAoB;IACvB,mDAA2B,CAAA;IAC3B,2DAAmC,CAAA;IACnC,2DAAmC,CAAA;IACnC,qDAA6B,CAAA;IAC7B,2CAAmB,CAAA;AACrB,CAAC,EANI,oBAAoB,KAApB,oBAAoB,QAMxB;AAED,MAAM,UAAU,eAAe,CAAC,EAEQ;QADtC,MAAM,YAAA;IAEN,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAU,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,QAA+B;IAE/B,IAAI,UAAsB,CAAC;IAC3B,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC;YAAE,OAAO;IACnE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,CAAC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAEM,IAAA,IAAI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AAlE,gBAAgB,GAAG,SAA+C;wBACxE,IAAI,CAAC,gBAAgB;4BAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;wBAC/C,iBAAiB,GAAI,gBAAgB,YAApB,CAAqB;wBAC1D,sBAAO,iBAAiB,CAAC,IAAI,EAAC;;;aAC/B;QACD,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,EAGwB;IAHtD,iBAmBC;QAlBC,MAAM,YAAA,EACN,SAAS,eAAA;IAKT,IAAM,SAAS,GAAG,MAAmB,CAAC;IACtC,OAAO;QACL,qBAAqB,EAAE,UAAO,WAAmB;;;;;wBACzC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACtD,qBAAM,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,EAAA;;wBAA3C,IAAI,GAAI,CAAA,SAAmC,CAAA,KAAvC;wBACX,sBAAO,IAAI,EAAC;;;aACb;QACD,iBAAiB,EAAE,UAAO,OAAe;;gBACvC,sBAAO,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAC;;aACvC;QACD,SAAS,WAAA;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -34,7 +34,7 @@ export interface CustomerInfo {
|
|
|
34
34
|
lng?: string;
|
|
35
35
|
}
|
|
36
36
|
/** Coinflow Types **/
|
|
37
|
-
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';
|
|
37
|
+
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base' | 'arbitrum';
|
|
38
38
|
export type CoinflowEnvs = 'prod' | 'staging' | 'staging-live' | 'sandbox' | 'local';
|
|
39
39
|
export interface CoinflowTypes {
|
|
40
40
|
merchantId: string;
|
|
@@ -113,7 +113,10 @@ export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
113
113
|
export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
114
114
|
blockchain: 'base';
|
|
115
115
|
}
|
|
116
|
-
export
|
|
116
|
+
export interface CoinflowArbitrumHistoryProps extends CoinflowEvmHistoryProps {
|
|
117
|
+
blockchain: 'arbitrum';
|
|
118
|
+
}
|
|
119
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps;
|
|
117
120
|
/** Transactions **/
|
|
118
121
|
export type NearFtTransferCallAction = {
|
|
119
122
|
methodName: 'ft_transfer_call';
|
|
@@ -147,6 +150,11 @@ export interface ChargebackProtectionItem {
|
|
|
147
150
|
*/
|
|
148
151
|
rawProductData?: RawProductData;
|
|
149
152
|
}
|
|
153
|
+
export declare enum ThreeDsChallengePreference {
|
|
154
|
+
NoPreference = "NoPreference",
|
|
155
|
+
Frictionless = "Frictionless",
|
|
156
|
+
Challenge = "Challenge"
|
|
157
|
+
}
|
|
150
158
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
151
159
|
amount?: number | string;
|
|
152
160
|
onSuccess?: OnSuccessMethod;
|
|
@@ -161,6 +169,10 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
161
169
|
authOnly?: boolean;
|
|
162
170
|
deviceId?: string;
|
|
163
171
|
jwtToken?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Your company email address that the customer can contact.
|
|
174
|
+
*/
|
|
175
|
+
supportEmail?: string;
|
|
164
176
|
/**
|
|
165
177
|
* If rendering the Coinflow component within multiple nested iframes, all ancestors in the chain must be provided as a comma-separated list.
|
|
166
178
|
*
|
|
@@ -170,6 +182,7 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
170
182
|
* The origin array would then be: [https://foo.com,https://bar.com]
|
|
171
183
|
*/
|
|
172
184
|
origins?: string[];
|
|
185
|
+
threeDsChallengePreference?: ThreeDsChallengePreference;
|
|
173
186
|
}
|
|
174
187
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
175
188
|
wallet: SolanaWallet;
|
|
@@ -206,7 +219,10 @@ export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
|
206
219
|
export interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {
|
|
207
220
|
blockchain: 'base';
|
|
208
221
|
}
|
|
209
|
-
export
|
|
222
|
+
export interface CoinflowArbitrumPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
223
|
+
blockchain: 'arbitrum';
|
|
224
|
+
}
|
|
225
|
+
export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps | CoinflowArbitrumPurchaseProps;
|
|
210
226
|
/** Withdraw **/
|
|
211
227
|
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
212
228
|
onSuccess?: OnSuccessMethod;
|
|
@@ -217,7 +233,7 @@ export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
|
217
233
|
bankAccountLinkRedirect?: string;
|
|
218
234
|
additionalWallets?: {
|
|
219
235
|
wallet: string;
|
|
220
|
-
blockchain: 'solana' | 'eth' | 'near' | 'polygon';
|
|
236
|
+
blockchain: 'solana' | 'eth' | 'near' | 'polygon' | 'base' | 'arbitrum';
|
|
221
237
|
}[];
|
|
222
238
|
lockAmount?: boolean;
|
|
223
239
|
transactionSigner?: string;
|
|
@@ -254,7 +270,10 @@ export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
|
254
270
|
export interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
255
271
|
blockchain: 'base';
|
|
256
272
|
}
|
|
257
|
-
export
|
|
273
|
+
export interface CoinflowArbitrumWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
274
|
+
blockchain: 'arbitrum';
|
|
275
|
+
}
|
|
276
|
+
export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps | CoinflowArbitrumWithdrawProps;
|
|
258
277
|
export interface CommonEvmRedeem {
|
|
259
278
|
waitForHash?: boolean;
|
|
260
279
|
}
|
|
@@ -287,8 +306,12 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
|
287
306
|
items: ReservoirItems;
|
|
288
307
|
taker?: string;
|
|
289
308
|
}
|
|
290
|
-
export
|
|
291
|
-
|
|
309
|
+
export interface TokenRedeem extends CommonEvmRedeem {
|
|
310
|
+
type: 'token';
|
|
311
|
+
destination: string;
|
|
312
|
+
}
|
|
313
|
+
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
|
|
314
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference' | 'supportEmail'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
292
315
|
walletPubkey: string | null | undefined;
|
|
293
316
|
route: string;
|
|
294
317
|
routePrefix?: string;
|
|
@@ -10,6 +10,12 @@ export var MerchantStyle;
|
|
|
10
10
|
MerchantStyle["Sharp"] = "sharp";
|
|
11
11
|
MerchantStyle["Pill"] = "pill";
|
|
12
12
|
})(MerchantStyle || (MerchantStyle = {}));
|
|
13
|
+
export var ThreeDsChallengePreference;
|
|
14
|
+
(function (ThreeDsChallengePreference) {
|
|
15
|
+
ThreeDsChallengePreference["NoPreference"] = "NoPreference";
|
|
16
|
+
ThreeDsChallengePreference["Frictionless"] = "Frictionless";
|
|
17
|
+
ThreeDsChallengePreference["Challenge"] = "Challenge";
|
|
18
|
+
})(ThreeDsChallengePreference || (ThreeDsChallengePreference = {}));
|
|
13
19
|
export var CardType;
|
|
14
20
|
(function (CardType) {
|
|
15
21
|
CardType["VISA"] = "VISA";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../src/common/CoinflowTypes.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;
|
|
1
|
+
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../src/common/CoinflowTypes.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAuND,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,2DAA6B,CAAA;IAC7B,qDAAuB,CAAA;AACzB,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAmPD,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps } from './CoinflowTypes';
|
|
1
|
+
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps, SolanaWallet } from './CoinflowTypes';
|
|
2
2
|
export declare class CoinflowUtils {
|
|
3
3
|
env: CoinflowEnvs;
|
|
4
4
|
url: string;
|
|
@@ -9,7 +9,7 @@ export declare class CoinflowUtils {
|
|
|
9
9
|
}>;
|
|
10
10
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
11
11
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
12
|
-
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, }: CoinflowIFrameProps): string;
|
|
12
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, }: CoinflowIFrameProps): string;
|
|
13
13
|
static getTransaction(props: CoinflowPurchaseProps): string | undefined;
|
|
14
14
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
15
15
|
solana: T;
|
|
@@ -17,5 +17,16 @@ export declare class CoinflowUtils {
|
|
|
17
17
|
eth: T;
|
|
18
18
|
polygon: T;
|
|
19
19
|
base: T;
|
|
20
|
+
arbitrum: T;
|
|
20
21
|
}): T;
|
|
22
|
+
static getWalletFromUserId({ userId, merchantId, env, }: {
|
|
23
|
+
userId: string;
|
|
24
|
+
merchantId: string;
|
|
25
|
+
env: CoinflowEnvs;
|
|
26
|
+
}): Promise<SolanaWallet>;
|
|
27
|
+
static getWalletFromEmail({ email, merchantId, env, }: {
|
|
28
|
+
email: string;
|
|
29
|
+
merchantId: string;
|
|
30
|
+
env: CoinflowEnvs;
|
|
31
|
+
}): Promise<SolanaWallet>;
|
|
21
32
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __awaiter, __generator } from "tslib";
|
|
2
2
|
import { web3, base58 } from './SolanaPeerDeps';
|
|
3
3
|
import LZString from 'lz-string';
|
|
4
|
+
import { Keypair, Transaction } from '@solana/web3.js';
|
|
5
|
+
import { sign } from 'tweetnacl';
|
|
4
6
|
var CoinflowUtils = /** @class */ (function () {
|
|
5
7
|
function CoinflowUtils(env) {
|
|
6
8
|
this.env = env !== null && env !== void 0 ? env : 'prod';
|
|
@@ -62,7 +64,7 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
62
64
|
};
|
|
63
65
|
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
64
66
|
var _b;
|
|
65
|
-
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss, color = _a.color, rent = _a.rent, lockDefaultToken = _a.lockDefaultToken, token = _a.token, tokens = _a.tokens, planCode = _a.planCode, disableApplePay = _a.disableApplePay, disableGooglePay = _a.disableGooglePay, customerInfo = _a.customerInfo, settlementType = _a.settlementType, lockAmount = _a.lockAmount, nativeSolToConvert = _a.nativeSolToConvert, theme = _a.theme, usePermit = _a.usePermit, transactionSigner = _a.transactionSigner, authOnly = _a.authOnly, deviceId = _a.deviceId, jwtToken = _a.jwtToken, origins = _a.origins;
|
|
67
|
+
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss, color = _a.color, rent = _a.rent, lockDefaultToken = _a.lockDefaultToken, token = _a.token, tokens = _a.tokens, planCode = _a.planCode, disableApplePay = _a.disableApplePay, disableGooglePay = _a.disableGooglePay, customerInfo = _a.customerInfo, settlementType = _a.settlementType, lockAmount = _a.lockAmount, nativeSolToConvert = _a.nativeSolToConvert, theme = _a.theme, usePermit = _a.usePermit, transactionSigner = _a.transactionSigner, authOnly = _a.authOnly, deviceId = _a.deviceId, jwtToken = _a.jwtToken, origins = _a.origins, threeDsChallengePreference = _a.threeDsChallengePreference, supportEmail = _a.supportEmail;
|
|
66
68
|
var prefix = routePrefix
|
|
67
69
|
? "/".concat(routePrefix, "/").concat(blockchain)
|
|
68
70
|
: "/".concat(blockchain);
|
|
@@ -86,6 +88,8 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
86
88
|
if (email) {
|
|
87
89
|
url.searchParams.append('email', email);
|
|
88
90
|
}
|
|
91
|
+
if (supportEmail)
|
|
92
|
+
url.searchParams.append('supportEmail', supportEmail);
|
|
89
93
|
if (token) {
|
|
90
94
|
url.searchParams.append('token', token.toString());
|
|
91
95
|
}
|
|
@@ -149,6 +153,8 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
149
153
|
url.searchParams.append('jwtToken', jwtToken);
|
|
150
154
|
if (origins)
|
|
151
155
|
url.searchParams.append('origins', LZString.compressToEncodedURIComponent(JSON.stringify(origins)));
|
|
156
|
+
if (threeDsChallengePreference)
|
|
157
|
+
url.searchParams.append('threeDsChallengePreference', threeDsChallengePreference);
|
|
152
158
|
return url.toString();
|
|
153
159
|
};
|
|
154
160
|
CoinflowUtils.getTransaction = function (props) {
|
|
@@ -186,6 +192,12 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
186
192
|
var transaction = props.transaction;
|
|
187
193
|
return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
|
|
188
194
|
},
|
|
195
|
+
arbitrum: function () {
|
|
196
|
+
if (!('transaction' in props))
|
|
197
|
+
return undefined;
|
|
198
|
+
var transaction = props.transaction;
|
|
199
|
+
return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
|
|
200
|
+
},
|
|
189
201
|
near: function () {
|
|
190
202
|
if (!('action' in props))
|
|
191
203
|
return undefined;
|
|
@@ -206,10 +218,93 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
206
218
|
return args.eth;
|
|
207
219
|
case 'base':
|
|
208
220
|
return args.base;
|
|
221
|
+
case 'arbitrum':
|
|
222
|
+
return args.arbitrum;
|
|
209
223
|
default:
|
|
210
224
|
throw new Error('blockchain not supported!');
|
|
211
225
|
}
|
|
212
226
|
};
|
|
227
|
+
CoinflowUtils.getWalletFromUserId = function (_a) {
|
|
228
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
229
|
+
var userId = _b.userId, merchantId = _b.merchantId, env = _b.env;
|
|
230
|
+
return __generator(this, function (_c) {
|
|
231
|
+
return [2 /*return*/, this.getWalletFromEmail({
|
|
232
|
+
email: userId,
|
|
233
|
+
merchantId: merchantId,
|
|
234
|
+
env: env,
|
|
235
|
+
})];
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
CoinflowUtils.getWalletFromEmail = function (_a) {
|
|
240
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
241
|
+
var buffer, crypto, hash, seed, keypair;
|
|
242
|
+
var _this = this;
|
|
243
|
+
var email = _b.email, merchantId = _b.merchantId, env = _b.env;
|
|
244
|
+
return __generator(this, function (_c) {
|
|
245
|
+
switch (_c.label) {
|
|
246
|
+
case 0:
|
|
247
|
+
buffer = new TextEncoder().encode(email);
|
|
248
|
+
crypto = window.crypto.subtle;
|
|
249
|
+
return [4 /*yield*/, crypto.digest('SHA-256', buffer)];
|
|
250
|
+
case 1:
|
|
251
|
+
hash = _c.sent();
|
|
252
|
+
seed = new Uint8Array(hash);
|
|
253
|
+
keypair = Keypair.fromSeed(seed);
|
|
254
|
+
return [2 /*return*/, {
|
|
255
|
+
publicKey: keypair.publicKey,
|
|
256
|
+
signMessage: function (message) {
|
|
257
|
+
return Promise.resolve(sign.detached(message, keypair.secretKey));
|
|
258
|
+
},
|
|
259
|
+
signTransaction: function (transaction) { return __awaiter(_this, void 0, void 0, function () {
|
|
260
|
+
return __generator(this, function (_a) {
|
|
261
|
+
if (transaction instanceof Transaction) {
|
|
262
|
+
transaction.sign(keypair);
|
|
263
|
+
return [2 /*return*/, transaction];
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
transaction.sign([keypair]);
|
|
267
|
+
return [2 /*return*/, transaction];
|
|
268
|
+
}
|
|
269
|
+
return [2 /*return*/];
|
|
270
|
+
});
|
|
271
|
+
}); },
|
|
272
|
+
sendTransaction: function (transaction) { return __awaiter(_this, void 0, void 0, function () {
|
|
273
|
+
var coinflowBaseUrl, options, signature;
|
|
274
|
+
return __generator(this, function (_a) {
|
|
275
|
+
switch (_a.label) {
|
|
276
|
+
case 0:
|
|
277
|
+
if (transaction instanceof Transaction) {
|
|
278
|
+
transaction.sign(keypair);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
transaction.sign([keypair]);
|
|
282
|
+
}
|
|
283
|
+
coinflowBaseUrl = this.getCoinflowApiUrl(env);
|
|
284
|
+
options = {
|
|
285
|
+
method: 'POST',
|
|
286
|
+
headers: {
|
|
287
|
+
'content-type': 'application/json',
|
|
288
|
+
'x-coinflow-auth-wallet': keypair.publicKey.toString(),
|
|
289
|
+
'x-coinflow-auth-blockchain': 'solana',
|
|
290
|
+
},
|
|
291
|
+
body: JSON.stringify({
|
|
292
|
+
merchantId: merchantId,
|
|
293
|
+
signedTransaction: base58 === null || base58 === void 0 ? void 0 : base58.encode(transaction.serialize()),
|
|
294
|
+
}),
|
|
295
|
+
};
|
|
296
|
+
return [4 /*yield*/, fetch(coinflowBaseUrl + '/api/utils/send-coinflow-tx', options).then(function (res) { return res.json(); })];
|
|
297
|
+
case 1:
|
|
298
|
+
signature = (_a.sent()).signature;
|
|
299
|
+
return [2 /*return*/, signature];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}); },
|
|
303
|
+
}];
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
};
|
|
213
308
|
return CoinflowUtils;
|
|
214
309
|
}());
|
|
215
310
|
export { CoinflowUtils };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/common/CoinflowUtils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/common/CoinflowUtils.ts"],"names":[],"mappings":";AAOA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,OA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C3D,CAAC;iDACH,CAAC;gDAEkB,qBAAM,KAAK,CAC7B,eAAe,GAAG,6BAA6B,EAC/C,OAAO,CACR,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC,EAAA;;gDAHlB,SAAS,GAAI,CAAA,SAGK,CAAA,UAHT;gDAIhB,sBAAO,SAAS,EAAC;;;qCAClB;6BACF,EAAC;;;;KACH;IACH,oBAAC;AAAD,CAAC,AAxXD,IAwXC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CardType, CoinflowEnvs } from '../CoinflowTypes';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export declare const TokenExCardNumberIframeId = "tokenExCardNumber";
|
|
4
|
+
export declare const TokenExCvvContainerID = "tokenExCardCvv";
|
|
5
|
+
export interface TokenExIframe extends ReturnType<typeof TokenEx.Iframe> {
|
|
6
|
+
tokenize: () => Promise<TokenizationResponse>;
|
|
7
|
+
}
|
|
8
|
+
export declare const CARD_TYPE_MAPPING: Record<CardType, string>;
|
|
9
|
+
export interface TokenExIFrameConfiguration {
|
|
10
|
+
origin: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
tokenExID: string;
|
|
13
|
+
tokenScheme: string;
|
|
14
|
+
authenticationKey: string;
|
|
15
|
+
pci: true;
|
|
16
|
+
token?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CardFormInputStyles {
|
|
19
|
+
base: CSSProperties | string;
|
|
20
|
+
placeholder?: CSSProperties | string;
|
|
21
|
+
focus?: CSSProperties | string;
|
|
22
|
+
error?: CSSProperties | string;
|
|
23
|
+
}
|
|
24
|
+
export type CoinflowCardTokenResponse = {
|
|
25
|
+
token: string;
|
|
26
|
+
};
|
|
27
|
+
export interface CoinflowCardNumberInputProps {
|
|
28
|
+
env: CoinflowEnvs;
|
|
29
|
+
css: CardFormInputStyles & {
|
|
30
|
+
cvv: CardFormInputStyles;
|
|
31
|
+
};
|
|
32
|
+
debug?: boolean;
|
|
33
|
+
origins?: string[];
|
|
34
|
+
font?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CoinflowCvvOnlyInputProps {
|
|
37
|
+
token: string;
|
|
38
|
+
cardType: CardType;
|
|
39
|
+
env: CoinflowEnvs;
|
|
40
|
+
css: CardFormInputStyles & {
|
|
41
|
+
cvv: CardFormInputStyles;
|
|
42
|
+
};
|
|
43
|
+
debug?: boolean;
|
|
44
|
+
origins?: string[];
|
|
45
|
+
font?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface TokenizationResponse {
|
|
48
|
+
cardType: string;
|
|
49
|
+
cvvIncluded: true;
|
|
50
|
+
firstSix: string;
|
|
51
|
+
lastFour: string;
|
|
52
|
+
referenceNumber: string;
|
|
53
|
+
token: string;
|
|
54
|
+
tokenHMAC: string;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
namespace TokenEx {
|
|
58
|
+
interface FraudServicesConfig {
|
|
59
|
+
useKount?: boolean;
|
|
60
|
+
kount?: {
|
|
61
|
+
merchantId?: string;
|
|
62
|
+
mode?: string;
|
|
63
|
+
anId?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface Config {
|
|
67
|
+
debug?: boolean;
|
|
68
|
+
enablePrettyFormat?: boolean;
|
|
69
|
+
maskInput?: boolean;
|
|
70
|
+
enableValidateOnBlur?: boolean;
|
|
71
|
+
enableAriaRequired?: boolean;
|
|
72
|
+
pci?: boolean;
|
|
73
|
+
cvvOnly?: boolean;
|
|
74
|
+
allowUnknownCardTypes?: boolean;
|
|
75
|
+
enableAutoComplete?: boolean;
|
|
76
|
+
returnAutoCompleteValues?: boolean;
|
|
77
|
+
returnKhash?: boolean;
|
|
78
|
+
returnWhash?: boolean;
|
|
79
|
+
enforceLuhnCompliance?: boolean;
|
|
80
|
+
use3DS?: boolean;
|
|
81
|
+
enableValidateOnKeyUp?: boolean;
|
|
82
|
+
enableValidateOnCvvKeyUp?: boolean;
|
|
83
|
+
expiresInSeconds?: number;
|
|
84
|
+
useExtendedBIN?: boolean;
|
|
85
|
+
inlineIframeJavaScript?: boolean;
|
|
86
|
+
iframeVersion?: number;
|
|
87
|
+
authenticationKey?: string;
|
|
88
|
+
origin?: string;
|
|
89
|
+
tokenExID?: string;
|
|
90
|
+
timestamp?: string;
|
|
91
|
+
tokenScheme?: string;
|
|
92
|
+
token?: string;
|
|
93
|
+
customDataLabel?: string;
|
|
94
|
+
customCvvDataLabel?: string;
|
|
95
|
+
title?: string;
|
|
96
|
+
cvvTitle?: string;
|
|
97
|
+
inputTitle?: string;
|
|
98
|
+
cvvInputTitle?: string;
|
|
99
|
+
cardMaxLengths?: {
|
|
100
|
+
visa?: number;
|
|
101
|
+
mastercard?: number;
|
|
102
|
+
americanExpress?: number;
|
|
103
|
+
discover?: number;
|
|
104
|
+
jcb?: number;
|
|
105
|
+
diners?: number;
|
|
106
|
+
};
|
|
107
|
+
fraudServices?: FraudServicesConfig;
|
|
108
|
+
threeDSMethodNotificationUrl?: string;
|
|
109
|
+
customDataTypes?: string | object;
|
|
110
|
+
cvvContainerID?: string;
|
|
111
|
+
cvvPlaceholder?: string;
|
|
112
|
+
cardType?: string;
|
|
113
|
+
forterSiteId?: string;
|
|
114
|
+
forterUsername?: string;
|
|
115
|
+
customRegEx?: string;
|
|
116
|
+
placeholder?: string;
|
|
117
|
+
inputType?: string;
|
|
118
|
+
inputMode?: string;
|
|
119
|
+
font?: string;
|
|
120
|
+
cvv?: boolean;
|
|
121
|
+
styles: {
|
|
122
|
+
base: string;
|
|
123
|
+
focus: string;
|
|
124
|
+
error: string;
|
|
125
|
+
placeholder: string;
|
|
126
|
+
cvv: {
|
|
127
|
+
base: string;
|
|
128
|
+
focus: string;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
error: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface IframeAPI {
|
|
135
|
+
load(): void;
|
|
136
|
+
on: (event: string, callback: (data?: any) => void) => void;
|
|
137
|
+
tokenize(): void;
|
|
138
|
+
validate(): void;
|
|
139
|
+
reset(): void;
|
|
140
|
+
blur(): void;
|
|
141
|
+
cvvBlur(): void;
|
|
142
|
+
focus(): void;
|
|
143
|
+
cvvFocus(): void;
|
|
144
|
+
remove(): void;
|
|
145
|
+
toggleMask(): void;
|
|
146
|
+
toggleCvvMask(): void;
|
|
147
|
+
setPAN(pan: string): void;
|
|
148
|
+
binLookup(): void;
|
|
149
|
+
validateConfig(): void;
|
|
150
|
+
setFraudServicesRequestDetails(data: string): void;
|
|
151
|
+
}
|
|
152
|
+
function Iframe(containerID: string, configuration: Config): IframeAPI;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Type definitions for TokenEx iframe integration
|
|
2
|
+
var _a;
|
|
3
|
+
import { CardType } from '../CoinflowTypes';
|
|
4
|
+
export var TokenExCardNumberIframeId = 'tokenExCardNumber';
|
|
5
|
+
export var TokenExCvvContainerID = 'tokenExCardCvv';
|
|
6
|
+
export var CARD_TYPE_MAPPING = (_a = {},
|
|
7
|
+
_a[CardType.VISA] = 'visa',
|
|
8
|
+
_a[CardType.MASTERCARD] = 'masterCard',
|
|
9
|
+
_a[CardType.AMEX] = 'americanExpress',
|
|
10
|
+
_a[CardType.DISCOVER] = 'discover',
|
|
11
|
+
_a);
|
|
12
|
+
//# sourceMappingURL=TokenEx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenEx.js","sourceRoot":"","sources":["../../../src/common/card-form/TokenEx.ts"],"names":[],"mappings":"AAAA,kDAAkD;;AAElD,OAAO,EAAC,QAAQ,EAAe,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,IAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,MAAM,CAAC,IAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAKtD,MAAM,CAAC,IAAM,iBAAiB;IAC5B,GAAC,QAAQ,CAAC,IAAI,IAAG,MAAM;IACvB,GAAC,QAAQ,CAAC,UAAU,IAAG,YAAY;IACnC,GAAC,QAAQ,CAAC,IAAI,IAAG,iBAAiB;IAClC,GAAC,QAAQ,CAAC,QAAQ,IAAG,UAAU;OAChC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TokenExIframe, TokenExIFrameConfiguration } from './TokenEx';
|
|
2
|
+
import { CardType, CoinflowEnvs } from '../CoinflowTypes';
|
|
3
|
+
export interface DoInitializeTokenExIframeArgs {
|
|
4
|
+
css: string;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
font?: string;
|
|
7
|
+
origins: string[] | undefined;
|
|
8
|
+
tokenExScriptLoaded: boolean;
|
|
9
|
+
env: CoinflowEnvs;
|
|
10
|
+
setCachedToken: (s: string | undefined) => void;
|
|
11
|
+
setLoaded: (b: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface DoInitializeCvvOnlyTokenExIframeArgs extends DoInitializeTokenExIframeArgs {
|
|
14
|
+
token: string;
|
|
15
|
+
cardType: CardType;
|
|
16
|
+
}
|
|
17
|
+
export declare function getIframeConfig({ token, origins, env, }: {
|
|
18
|
+
token?: string;
|
|
19
|
+
origins: string[] | undefined;
|
|
20
|
+
env: CoinflowEnvs;
|
|
21
|
+
}): Promise<TokenExIFrameConfiguration>;
|
|
22
|
+
export declare function setTokenExScriptTag({ env, setTokenExScriptLoaded, }: {
|
|
23
|
+
env: CoinflowEnvs;
|
|
24
|
+
setTokenExScriptLoaded: (b: boolean) => void;
|
|
25
|
+
}): void;
|
|
26
|
+
export declare function doInitializeCvvOnlyTokenExIframe(args: DoInitializeCvvOnlyTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
|
27
|
+
export declare function doInitializeTokenExIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
|
28
|
+
export declare function doInitializeTokenExCardOnlyIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator, __spreadArray } from "tslib";
|
|
2
|
+
import { TokenExCvvContainerID, CARD_TYPE_MAPPING, TokenExCardNumberIframeId, } from './TokenEx';
|
|
3
|
+
import { CoinflowUtils } from '../CoinflowUtils';
|
|
4
|
+
export function getIframeConfig(_a) {
|
|
5
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
6
|
+
var _this = this;
|
|
7
|
+
var token = _b.token, origins = _b.origins, env = _b.env;
|
|
8
|
+
return __generator(this, function (_c) {
|
|
9
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
10
|
+
fetch(new CoinflowUtils(env).url + '/api/checkout/authentication-key', {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
},
|
|
15
|
+
body: JSON.stringify({
|
|
16
|
+
origins: __spreadArray(__spreadArray([], (origins !== null && origins !== void 0 ? origins : []), true), [window.location.origin], false),
|
|
17
|
+
token: token,
|
|
18
|
+
}),
|
|
19
|
+
})
|
|
20
|
+
.then(function (res) { return __awaiter(_this, void 0, void 0, function () {
|
|
21
|
+
var _a;
|
|
22
|
+
return __generator(this, function (_b) {
|
|
23
|
+
switch (_b.label) {
|
|
24
|
+
case 0:
|
|
25
|
+
_a = resolve;
|
|
26
|
+
return [4 /*yield*/, res.json()];
|
|
27
|
+
case 1:
|
|
28
|
+
_a.apply(void 0, [(_b.sent())]);
|
|
29
|
+
return [2 /*return*/];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}); })
|
|
33
|
+
.catch(function (e) { return reject(e); });
|
|
34
|
+
})];
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function setTokenExScriptTag(_a) {
|
|
39
|
+
var env = _a.env, setTokenExScriptLoaded = _a.setTokenExScriptLoaded;
|
|
40
|
+
var scriptTagId = 'tokenex-script';
|
|
41
|
+
if (document.head.querySelector("#".concat(scriptTagId)))
|
|
42
|
+
return;
|
|
43
|
+
var sdkScriptTag = document.createElement('script');
|
|
44
|
+
sdkScriptTag.src =
|
|
45
|
+
env === 'prod'
|
|
46
|
+
? 'https://htp.tokenex.com/iframe/iframe-v3.min.js'
|
|
47
|
+
: 'https://test-htp.tokenex.com/iframe/iframe-v3.min.js';
|
|
48
|
+
sdkScriptTag.id = scriptTagId;
|
|
49
|
+
document.head.appendChild(sdkScriptTag);
|
|
50
|
+
document.getElementById(scriptTagId).addEventListener('load', function () {
|
|
51
|
+
console.log('Setting tokenExScriptLoaded to true!');
|
|
52
|
+
setTokenExScriptLoaded(true);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function loadIframe(_a) {
|
|
56
|
+
var _this = this;
|
|
57
|
+
var iframe = _a.iframe, setCachedToken = _a.setCachedToken, setLoaded = _a.setLoaded;
|
|
58
|
+
var tokenize = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
iframe.tokenize();
|
|
63
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
64
|
+
iframe.on('tokenize', function (data) {
|
|
65
|
+
setCachedToken(data.token);
|
|
66
|
+
resolve(data);
|
|
67
|
+
});
|
|
68
|
+
iframe.on('validate', function (data) {
|
|
69
|
+
// noinspection PointlessBooleanExpressionJS
|
|
70
|
+
var isInvalid = !data.isValid || data.isCvvValid === false;
|
|
71
|
+
if (isInvalid)
|
|
72
|
+
reject(data);
|
|
73
|
+
});
|
|
74
|
+
})];
|
|
75
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); };
|
|
79
|
+
iframe.on('change', function () { return setCachedToken(undefined); });
|
|
80
|
+
iframe.on('cvvChange', function () { return setCachedToken(undefined); });
|
|
81
|
+
iframe.on('load', function () {
|
|
82
|
+
setTimeout(function () { return setLoaded(true); }, 350);
|
|
83
|
+
var el = document.querySelector('#tx_iframe_tokenExCardNumber');
|
|
84
|
+
if (el) {
|
|
85
|
+
// noinspection JSDeprecatedSymbols
|
|
86
|
+
el.scrolling = 'no';
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
iframe.on('focus', function () {
|
|
90
|
+
iframe.focus();
|
|
91
|
+
});
|
|
92
|
+
iframe.on('cvvFocus', function () {
|
|
93
|
+
iframe.cvvFocus();
|
|
94
|
+
});
|
|
95
|
+
setLoaded(false);
|
|
96
|
+
iframe.load();
|
|
97
|
+
return __assign(__assign({}, iframe), { tokenize: tokenize });
|
|
98
|
+
}
|
|
99
|
+
export function doInitializeCvvOnlyTokenExIframe(args) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var token, cardType;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
token = args.token, cardType = args.cardType;
|
|
106
|
+
return [4 /*yield*/, doInitialize(TokenExCvvContainerID, args, {
|
|
107
|
+
cvvOnly: true,
|
|
108
|
+
cvv: true,
|
|
109
|
+
cvvContainerID: TokenExCvvContainerID,
|
|
110
|
+
placeholder: 'CVV',
|
|
111
|
+
token: token,
|
|
112
|
+
cardType: CARD_TYPE_MAPPING[cardType],
|
|
113
|
+
})];
|
|
114
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export function doInitializeTokenExIframe(args) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0: return [4 /*yield*/, doInitialize(TokenExCardNumberIframeId, args, {
|
|
124
|
+
cvv: true,
|
|
125
|
+
cvvContainerID: TokenExCvvContainerID,
|
|
126
|
+
cvvPlaceholder: 'CVV',
|
|
127
|
+
})];
|
|
128
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export function doInitializeTokenExCardOnlyIframe(args) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0: return [4 /*yield*/, doInitialize(TokenExCardNumberIframeId, args, { cvv: false })];
|
|
138
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function doInitialize(id_1, _a, configOverrides_1) {
|
|
144
|
+
return __awaiter(this, arguments, void 0, function (id, _b, configOverrides) {
|
|
145
|
+
var iframeConfig, styles, config, iframe;
|
|
146
|
+
var tokenExScriptLoaded = _b.tokenExScriptLoaded, origins = _b.origins, env = _b.env, css = _b.css, debug = _b.debug, font = _b.font, setCachedToken = _b.setCachedToken, setLoaded = _b.setLoaded;
|
|
147
|
+
return __generator(this, function (_c) {
|
|
148
|
+
switch (_c.label) {
|
|
149
|
+
case 0:
|
|
150
|
+
if (!tokenExScriptLoaded && typeof TokenEx === 'undefined') {
|
|
151
|
+
console.warn('Warning Unable to load TokenEx on first attempt waiting for load event from document.head.script#tokenex-script');
|
|
152
|
+
return [2 /*return*/];
|
|
153
|
+
}
|
|
154
|
+
return [4 /*yield*/, getIframeConfig({
|
|
155
|
+
token: configOverrides.token,
|
|
156
|
+
origins: origins,
|
|
157
|
+
env: env,
|
|
158
|
+
})];
|
|
159
|
+
case 1:
|
|
160
|
+
iframeConfig = _c.sent();
|
|
161
|
+
styles = getStyles(css).styles;
|
|
162
|
+
config = __assign(__assign(__assign({}, iframeConfig), { placeholder: '0000 0000 0000 0000', enablePrettyFormat: true, styles: styles, font: font, debug: debug !== null && debug !== void 0 ? debug : false }), configOverrides);
|
|
163
|
+
iframe = TokenEx.Iframe(id, config);
|
|
164
|
+
return [2 /*return*/, loadIframe({ iframe: iframe, setCachedToken: setCachedToken, setLoaded: setLoaded })];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function getStyles(s) {
|
|
170
|
+
var _a, _b, _c;
|
|
171
|
+
var css = JSON.parse(s);
|
|
172
|
+
var styles = {
|
|
173
|
+
base: CSSPropertiesToComponent(css.base),
|
|
174
|
+
focus: CSSPropertiesToComponent(css.focus),
|
|
175
|
+
error: CSSPropertiesToComponent(css.error),
|
|
176
|
+
placeholder: CSSPropertiesToComponent(css.placeholder),
|
|
177
|
+
cvv: {
|
|
178
|
+
base: CSSPropertiesToComponent((_a = css.cvv) === null || _a === void 0 ? void 0 : _a.base),
|
|
179
|
+
focus: CSSPropertiesToComponent((_b = css.cvv) === null || _b === void 0 ? void 0 : _b.focus),
|
|
180
|
+
error: CSSPropertiesToComponent((_c = css.cvv) === null || _c === void 0 ? void 0 : _c.error),
|
|
181
|
+
placeholder: CSSPropertiesToComponent(css === null || css === void 0 ? void 0 : css.placeholder),
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
return { styles: styles };
|
|
185
|
+
}
|
|
186
|
+
function CSSPropertiesToComponent(dict) {
|
|
187
|
+
if (!dict)
|
|
188
|
+
return '';
|
|
189
|
+
if (typeof dict === 'string')
|
|
190
|
+
return dict;
|
|
191
|
+
var str = '';
|
|
192
|
+
var _loop_1 = function (key, value) {
|
|
193
|
+
var clo = '';
|
|
194
|
+
key.split('').forEach(function (lt) {
|
|
195
|
+
if (lt.toUpperCase() === lt) {
|
|
196
|
+
clo += '-' + lt.toLowerCase();
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
clo += lt;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
str += clo + ':' + value + ';';
|
|
203
|
+
};
|
|
204
|
+
for (var _i = 0, _a = Object.entries(dict); _i < _a.length; _i++) {
|
|
205
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
206
|
+
_loop_1(key, value);
|
|
207
|
+
}
|
|
208
|
+
return str;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=tokenexHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenexHelpers.js","sourceRoot":"","sources":["../../../src/common/card-form/tokenexHelpers.ts"],"names":[],"mappings":";AACA,OAAO,EAEL,qBAAqB,EAGrB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAoB/C,MAAM,UAAgB,eAAe;wDAAC,EAQrC;;YAPC,KAAK,WAAA,EACL,OAAO,aAAA,EACP,GAAG,SAAA;;YAMH,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBACjC,KAAK,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,kCAAkC,EAAE;wBACrE,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACP,cAAc,EAAE,kBAAkB;yBACnC;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,OAAO,kCAAM,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,UAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAC;4BACrD,KAAK,OAAA;yBACN,CAAC;qBACH,CAAC;yBACC,IAAI,CAAC,UAAM,GAAG;;;;;oCACb,KAAA,OAAO,CAAA;oCAAE,qBAAM,GAAG,CAAC,IAAI,EAAE,EAAA;;oCAAzB,kBAAQ,CAAC,SAAgB,CAA+B,EAAC,CAAC;;;;yBAC3D,CAAC;yBACD,KAAK,CAAC,UAAA,CAAC,IAAI,OAAA,MAAM,CAAC,CAAC,CAAC,EAAT,CAAS,CAAC,CAAC;gBAC3B,CAAC,CAAC,EAAC;;;CACJ;AAED,MAAM,UAAU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,KAAK;QACpB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAA,EAAE;YACtB,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC;gBAC5B,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,GAAG,IAAI,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;;IATjC,KAA2B,UAAoB,EAApB,KAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAApB,cAAoB,EAApB,IAAoB;QAApC,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;gBAAV,GAAG,EAAE,KAAK;KAUrB;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/build/common/index.d.ts
CHANGED
package/build/common/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "React Native Component for Coinflow",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"react-native-get-random-values": "^1.11.0",
|
|
37
37
|
"bs58": "^6.0.0",
|
|
38
38
|
"bn.js": "^5.2.1",
|
|
39
|
-
"@solana/web3.js": "^1.
|
|
39
|
+
"@solana/web3.js": "^1.95.3",
|
|
40
40
|
"lz-string": "^1.5.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/react": "^18.2.64",
|
|
44
44
|
"eslint-config-react-app": "^7.0.1",
|
|
45
|
-
"typescript": "^5.5.
|
|
45
|
+
"typescript": "^5.5.4",
|
|
46
46
|
"@solana/wallet-adapter-react": "^0.15.32",
|
|
47
47
|
"@near-wallet-selector/core": "^8.9.3"
|
|
48
48
|
},
|