@coinflowlabs/react-native 3.1.0 → 3.1.2
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/build/CoinflowPurchase.d.ts +3 -2
- package/build/CoinflowPurchase.js +11 -53
- package/build/CoinflowPurchase.js.map +1 -1
- package/build/CoinflowPurchaseHistory.d.ts +3 -2
- package/build/CoinflowPurchaseHistory.js +10 -18
- package/build/CoinflowPurchaseHistory.js.map +1 -1
- package/build/CoinflowWebView.d.ts +10 -2
- package/build/CoinflowWebView.js +18 -5
- package/build/CoinflowWebView.js.map +1 -1
- package/build/CoinflowWithdraw.d.ts +3 -2
- package/build/CoinflowWithdraw.js +12 -36
- package/build/CoinflowWithdraw.js.map +1 -1
- package/build/CoinflowWithdrawHistory.d.ts +3 -2
- package/build/CoinflowWithdrawHistory.js +10 -18
- package/build/CoinflowWithdrawHistory.js.map +1 -1
- package/build/common/CoinflowLibMessageHandlers.d.ts +21 -0
- package/build/common/CoinflowLibMessageHandlers.js +180 -0
- package/build/common/CoinflowLibMessageHandlers.js.map +1 -0
- package/build/{CoinflowTypes.d.ts → common/CoinflowTypes.d.ts} +69 -88
- package/build/{CoinflowTypes.js → common/CoinflowTypes.js} +2 -3
- package/build/common/CoinflowTypes.js.map +1 -0
- package/build/common/CoinflowUtils.d.ts +21 -0
- package/build/common/CoinflowUtils.js +219 -0
- package/build/common/CoinflowUtils.js.map +1 -0
- package/build/common/SolanaPeerDeps.d.ts +5 -0
- package/build/common/SolanaPeerDeps.js +17 -0
- package/build/common/SolanaPeerDeps.js.map +1 -0
- package/build/common/index.d.ts +3 -0
- package/build/common/index.js +4 -0
- package/build/common/index.js.map +1 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +21 -6
- package/build/CoinflowTypes.js.map +0 -1
- package/build/ReactNativeCoinflowUtils.d.ts +0 -8
- package/build/ReactNativeCoinflowUtils.js +0 -79
- package/build/ReactNativeCoinflowUtils.js.map +0 -1
- package/build/wallet/EthIFrameMessageHandlers.d.ts +0 -5
- package/build/wallet/EthIFrameMessageHandlers.js +0 -37
- package/build/wallet/EthIFrameMessageHandlers.js.map +0 -1
- package/build/wallet/NearIFrameMessageHandlers.d.ts +0 -5
- package/build/wallet/NearIFrameMessageHandlers.js +0 -27
- package/build/wallet/NearIFrameMessageHandlers.js.map +0 -1
- package/build/wallet/SolanaIFrameMessageHandlers.d.ts +0 -18
- package/build/wallet/SolanaIFrameMessageHandlers.js +0 -134
- package/build/wallet/SolanaIFrameMessageHandlers.js.map +0 -1
- package/build/wallet/useWebViewWallet.d.ts +0 -11
- package/build/wallet/useWebViewWallet.js +0 -102
- package/build/wallet/useWebViewWallet.js.map +0 -1
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import type { Connection } from '@solana/web3.js';
|
|
2
|
-
|
|
3
|
-
import { WalletContextState } from '@solana/wallet-adapter-react';
|
|
4
|
-
import { Wallet } from '@near-wallet-selector/core';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import WebView from 'react-native-webview';
|
|
7
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
8
|
-
declare enum SettlementType {
|
|
1
|
+
import type { Connection, VersionedTransaction, PublicKey, Signer, Transaction } from '@solana/web3.js';
|
|
2
|
+
export declare enum SettlementType {
|
|
9
3
|
Credits = "Credits",
|
|
10
4
|
USDC = "USDC",
|
|
11
5
|
Bank = "Bank"
|
|
12
6
|
}
|
|
13
|
-
declare enum MerchantStyle {
|
|
7
|
+
export declare enum MerchantStyle {
|
|
14
8
|
Rounded = "rounded",
|
|
15
9
|
Sharp = "sharp",
|
|
16
10
|
Pill = "pill"
|
|
17
11
|
}
|
|
18
|
-
type MerchantTheme = {
|
|
12
|
+
export type MerchantTheme = {
|
|
19
13
|
primary?: string;
|
|
20
14
|
background?: string;
|
|
21
15
|
backgroundAccent?: string;
|
|
@@ -26,7 +20,7 @@ type MerchantTheme = {
|
|
|
26
20
|
font?: string;
|
|
27
21
|
style?: MerchantStyle;
|
|
28
22
|
};
|
|
29
|
-
interface CustomerInfo {
|
|
23
|
+
export interface CustomerInfo {
|
|
30
24
|
name?: string;
|
|
31
25
|
verificationId?: string;
|
|
32
26
|
displayName?: string;
|
|
@@ -42,64 +36,31 @@ interface CustomerInfo {
|
|
|
42
36
|
/** Coinflow Types **/
|
|
43
37
|
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';
|
|
44
38
|
export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
|
|
45
|
-
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
46
|
-
export interface ChargebackProtectionItem {
|
|
47
|
-
/**
|
|
48
|
-
* The name of the product
|
|
49
|
-
*/
|
|
50
|
-
productName: string;
|
|
51
|
-
/**
|
|
52
|
-
* The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp
|
|
53
|
-
*/
|
|
54
|
-
productType: 'inGameProduct' | 'gameOfSkill' | 'dataStorage' | 'computingResources' | 'sportsTicket' | 'eSportsTicket' | 'musicTicket' | 'conferenceTicket' | 'virtualSportsTicket' | 'virtualESportsTicket' | 'virtualMusicTicket' | 'virtualConferenceTicket' | 'alcohol' | 'DLC' | 'subscription' | 'fundACause' | 'realEstate' | 'computingContract' | 'digitalArt' | 'topUp' | 'ownershipContract';
|
|
55
|
-
/**
|
|
56
|
-
* The item's list price
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* The number of units sold
|
|
60
|
-
*/
|
|
61
|
-
quantity: number;
|
|
62
|
-
/**
|
|
63
|
-
* Any additional data that the store can provide on the product, e.g. description, link to image, etc.
|
|
64
|
-
*/
|
|
65
|
-
rawProductData?: {
|
|
66
|
-
[key: string]: any;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
39
|
export interface CoinflowTypes {
|
|
70
40
|
merchantId: string;
|
|
71
41
|
env?: CoinflowEnvs;
|
|
72
42
|
loaderBackground?: string;
|
|
73
43
|
blockchain: CoinflowBlockchain;
|
|
74
|
-
|
|
44
|
+
handleHeightChange?: (height: string) => void;
|
|
75
45
|
theme?: MerchantTheme;
|
|
76
46
|
}
|
|
77
47
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
78
48
|
export type OnSuccessMethod = (params: string) => void | Promise<void>;
|
|
79
|
-
export type CoinflowWebViewProps = Omit<CoinflowIFrameProps, 'IFrameRef'> & {
|
|
80
|
-
publicKey: string | null | undefined;
|
|
81
|
-
handleIframeMessages: ({ data }: {
|
|
82
|
-
data: string;
|
|
83
|
-
}) => Promise<void>;
|
|
84
|
-
WebViewRef: React.RefObject<WebView>;
|
|
85
|
-
onLoad?: () => void;
|
|
86
|
-
token?: string | PublicKey;
|
|
87
|
-
tokens?: string[];
|
|
88
|
-
bankAccountLinkRedirect?: string;
|
|
89
|
-
lockDefaultToken?: boolean;
|
|
90
|
-
supportsVersionedTransactions?: boolean;
|
|
91
|
-
lockAmount?: boolean;
|
|
92
|
-
theme?: MerchantTheme;
|
|
93
|
-
usePermit?: boolean;
|
|
94
|
-
} & Pick<CoinflowCommonPurchaseProps, 'authOnly'>;
|
|
95
|
-
export type WithStyles = {
|
|
96
|
-
style?: StyleProp<ViewStyle>;
|
|
97
|
-
};
|
|
98
49
|
/** Wallets **/
|
|
99
|
-
export
|
|
100
|
-
|
|
50
|
+
export interface SolanaWallet {
|
|
51
|
+
publicKey: PublicKey | null;
|
|
52
|
+
signTransaction?: <T extends Transaction | VersionedTransaction>(transaction: T) => Promise<T>;
|
|
53
|
+
sendTransaction: <T extends Transaction | VersionedTransaction>(transaction: T) => Promise<string>;
|
|
54
|
+
signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
|
|
55
|
+
}
|
|
56
|
+
export interface NearWallet {
|
|
101
57
|
accountId: string;
|
|
102
|
-
|
|
58
|
+
signAndSendTransaction: (transaction: unknown) => Promise<{
|
|
59
|
+
transaction: {
|
|
60
|
+
hash: string;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
103
64
|
type AccessList = Array<{
|
|
104
65
|
address: string;
|
|
105
66
|
storageKeys: Array<string>;
|
|
@@ -129,12 +90,12 @@ export type EthWallet = {
|
|
|
129
90
|
};
|
|
130
91
|
/** History **/
|
|
131
92
|
export interface CoinflowSolanaHistoryProps extends CoinflowTypes {
|
|
132
|
-
wallet:
|
|
93
|
+
wallet: SolanaWallet;
|
|
133
94
|
connection: Connection;
|
|
134
95
|
blockchain: 'solana';
|
|
135
96
|
}
|
|
136
97
|
export interface CoinflowNearHistoryProps extends CoinflowTypes {
|
|
137
|
-
wallet:
|
|
98
|
+
wallet: NearWallet;
|
|
138
99
|
blockchain: 'near';
|
|
139
100
|
}
|
|
140
101
|
export interface CoinflowEvmHistoryProps extends CoinflowTypes {
|
|
@@ -150,29 +111,6 @@ export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
150
111
|
blockchain: 'base';
|
|
151
112
|
}
|
|
152
113
|
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps;
|
|
153
|
-
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount'> {
|
|
154
|
-
WebViewRef: React.RefObject<any | null>;
|
|
155
|
-
route: string;
|
|
156
|
-
amount?: number;
|
|
157
|
-
transaction?: string;
|
|
158
|
-
blockchain: CoinflowBlockchain;
|
|
159
|
-
email?: string;
|
|
160
|
-
env?: CoinflowEnvs;
|
|
161
|
-
deviceId?: string;
|
|
162
|
-
loaderBackground?: string;
|
|
163
|
-
supportsVersionedTransactions?: boolean;
|
|
164
|
-
rent?: {
|
|
165
|
-
lamports: string | number;
|
|
166
|
-
};
|
|
167
|
-
nativeSolToConvert?: {
|
|
168
|
-
lamports: string | number;
|
|
169
|
-
};
|
|
170
|
-
disableApplePay?: boolean;
|
|
171
|
-
disableGooglePay?: boolean;
|
|
172
|
-
planCode?: string;
|
|
173
|
-
settlementType?: SettlementType;
|
|
174
|
-
usePermit?: boolean;
|
|
175
|
-
}
|
|
176
114
|
/** Transactions **/
|
|
177
115
|
export type NearFtTransferCallAction = {
|
|
178
116
|
methodName: 'ft_transfer_call';
|
|
@@ -183,22 +121,48 @@ export type NearFtTransferCallAction = {
|
|
|
183
121
|
type Bytes = ArrayLike<number>;
|
|
184
122
|
type BytesLike = Bytes | string;
|
|
185
123
|
/** Purchase **/
|
|
124
|
+
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
125
|
+
export interface ChargebackProtectionItem {
|
|
126
|
+
/**
|
|
127
|
+
* The name of the product
|
|
128
|
+
*/
|
|
129
|
+
productName: string;
|
|
130
|
+
/**
|
|
131
|
+
* The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp
|
|
132
|
+
*/
|
|
133
|
+
productType: 'inGameProduct' | 'gameOfSkill' | 'dataStorage' | 'computingResources' | 'sportsTicket' | 'eSportsTicket' | 'musicTicket' | 'conferenceTicket' | 'virtualSportsTicket' | 'virtualESportsTicket' | 'virtualMusicTicket' | 'virtualConferenceTicket' | 'alcohol' | 'DLC' | 'subscription' | 'fundACause' | 'realEstate' | 'computingContract' | 'digitalArt' | 'topUp' | 'ownershipContract';
|
|
134
|
+
/**
|
|
135
|
+
* The item's list price
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* The number of units sold
|
|
139
|
+
*/
|
|
140
|
+
quantity: number;
|
|
141
|
+
/**
|
|
142
|
+
* Any additional data that the store can provide on the product, e.g. description, link to image, etc.
|
|
143
|
+
*/
|
|
144
|
+
rawProductData?: {
|
|
145
|
+
[key: string]: any;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
186
148
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
187
|
-
amount?: number;
|
|
149
|
+
amount?: number | string;
|
|
188
150
|
onSuccess?: OnSuccessMethod;
|
|
189
151
|
webhookInfo?: object;
|
|
190
|
-
customerInfo?: CustomerInfo;
|
|
191
152
|
email?: string;
|
|
192
|
-
deviceId?: string;
|
|
193
153
|
chargebackProtectionData?: ChargebackProtectionData;
|
|
154
|
+
planCode?: string;
|
|
194
155
|
disableApplePay?: boolean;
|
|
195
156
|
disableGooglePay?: boolean;
|
|
157
|
+
customerInfo?: CustomerInfo;
|
|
196
158
|
settlementType?: SettlementType;
|
|
197
159
|
authOnly?: boolean;
|
|
160
|
+
deviceId?: string;
|
|
161
|
+
jwtToken?: string;
|
|
198
162
|
}
|
|
199
163
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
200
164
|
wallet: SolanaWallet;
|
|
201
|
-
transaction?: Transaction;
|
|
165
|
+
transaction?: Transaction | VersionedTransaction;
|
|
202
166
|
partialSigners?: Signer[];
|
|
203
167
|
debugTx?: boolean;
|
|
204
168
|
connection: Connection;
|
|
@@ -216,8 +180,9 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
|
216
180
|
wallet: NearWallet;
|
|
217
181
|
blockchain: 'near';
|
|
218
182
|
action?: NearFtTransferCallAction;
|
|
183
|
+
nearDeposit?: string;
|
|
219
184
|
}
|
|
220
|
-
interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
185
|
+
export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
221
186
|
transaction?: EvmTransactionData;
|
|
222
187
|
token?: string;
|
|
223
188
|
wallet: EthWallet;
|
|
@@ -263,6 +228,7 @@ export interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
|
263
228
|
}
|
|
264
229
|
export interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
265
230
|
blockchain: 'eth';
|
|
231
|
+
usePermit?: boolean;
|
|
266
232
|
}
|
|
267
233
|
export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
268
234
|
blockchain: 'polygon';
|
|
@@ -303,4 +269,19 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
|
303
269
|
items: ReservoirItems;
|
|
304
270
|
}
|
|
305
271
|
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem;
|
|
272
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
273
|
+
walletPubkey: string | null | undefined;
|
|
274
|
+
route: string;
|
|
275
|
+
routePrefix?: string;
|
|
276
|
+
transaction?: string;
|
|
277
|
+
tokens?: string[] | PublicKey[];
|
|
278
|
+
supportsVersionedTransactions?: boolean;
|
|
279
|
+
nearDeposit?: string;
|
|
280
|
+
merchantCss?: string;
|
|
281
|
+
color?: 'white' | 'black';
|
|
282
|
+
disableApplePay?: boolean;
|
|
283
|
+
disableGooglePay?: boolean;
|
|
284
|
+
theme?: MerchantTheme;
|
|
285
|
+
usePermit?: boolean;
|
|
286
|
+
}
|
|
306
287
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
var SettlementType;
|
|
1
|
+
export var SettlementType;
|
|
2
2
|
(function (SettlementType) {
|
|
3
3
|
SettlementType["Credits"] = "Credits";
|
|
4
4
|
SettlementType["USDC"] = "USDC";
|
|
5
5
|
SettlementType["Bank"] = "Bank";
|
|
6
6
|
})(SettlementType || (SettlementType = {}));
|
|
7
|
-
var MerchantStyle;
|
|
7
|
+
export var MerchantStyle;
|
|
8
8
|
(function (MerchantStyle) {
|
|
9
9
|
MerchantStyle["Rounded"] = "rounded";
|
|
10
10
|
MerchantStyle["Sharp"] = "sharp";
|
|
11
11
|
MerchantStyle["Pill"] = "pill";
|
|
12
12
|
})(MerchantStyle || (MerchantStyle = {}));
|
|
13
|
-
export {};
|
|
14
13
|
//# sourceMappingURL=CoinflowTypes.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps } from './CoinflowTypes';
|
|
2
|
+
export declare class CoinflowUtils {
|
|
3
|
+
env: CoinflowEnvs;
|
|
4
|
+
url: string;
|
|
5
|
+
constructor(env?: CoinflowEnvs);
|
|
6
|
+
getNSurePartnerId(merchantId: string): Promise<string | undefined>;
|
|
7
|
+
getCreditBalance(publicKey: string, merchantId: string, blockchain: 'solana' | 'near'): Promise<{
|
|
8
|
+
cents: number;
|
|
9
|
+
}>;
|
|
10
|
+
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
11
|
+
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
12
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, supportsVersionedTransactions, 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, }: CoinflowIFrameProps): string;
|
|
13
|
+
static getTransaction(props: CoinflowPurchaseProps): string | undefined;
|
|
14
|
+
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
15
|
+
solana: T;
|
|
16
|
+
near: T;
|
|
17
|
+
eth: T;
|
|
18
|
+
polygon: T;
|
|
19
|
+
base: T;
|
|
20
|
+
}): T;
|
|
21
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { web3, base58 } from './SolanaPeerDeps';
|
|
3
|
+
import LZString from 'lz-string';
|
|
4
|
+
var CoinflowUtils = /** @class */ (function () {
|
|
5
|
+
function CoinflowUtils(env) {
|
|
6
|
+
this.env = env !== null && env !== void 0 ? env : 'prod';
|
|
7
|
+
if (this.env === 'prod')
|
|
8
|
+
this.url = 'https://api.coinflow.cash';
|
|
9
|
+
else if (this.env === 'local')
|
|
10
|
+
this.url = 'http://localhost:5000';
|
|
11
|
+
else
|
|
12
|
+
this.url = "https://api-".concat(this.env, ".coinflow.cash");
|
|
13
|
+
}
|
|
14
|
+
CoinflowUtils.prototype.getNSurePartnerId = function (merchantId) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16
|
+
return __generator(this, function (_a) {
|
|
17
|
+
return [2 /*return*/, fetch(this.url + "/merchant/view/".concat(merchantId))
|
|
18
|
+
.then(function (response) { return response.json(); })
|
|
19
|
+
.then(function (json) { var _a; return ((_a = json.nSureSettings) === null || _a === void 0 ? void 0 : _a.nSurePartnerId) || json.nSurePartnerId; })
|
|
20
|
+
.catch(function (e) {
|
|
21
|
+
console.error(e);
|
|
22
|
+
return undefined;
|
|
23
|
+
})];
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
CoinflowUtils.prototype.getCreditBalance = function (publicKey, merchantId, blockchain) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
29
|
+
var response, credits;
|
|
30
|
+
return __generator(this, function (_a) {
|
|
31
|
+
switch (_a.label) {
|
|
32
|
+
case 0: return [4 /*yield*/, fetch(this.url + "/api/customer/balances/".concat(merchantId), {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
headers: {
|
|
35
|
+
'x-coinflow-auth-wallet': publicKey,
|
|
36
|
+
'x-coinflow-auth-blockchain': blockchain,
|
|
37
|
+
},
|
|
38
|
+
})];
|
|
39
|
+
case 1:
|
|
40
|
+
response = _a.sent();
|
|
41
|
+
return [4 /*yield*/, response.json()];
|
|
42
|
+
case 2:
|
|
43
|
+
credits = (_a.sent()).credits;
|
|
44
|
+
return [2 /*return*/, credits];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
CoinflowUtils.getCoinflowBaseUrl = function (env) {
|
|
50
|
+
if (!env || env === 'prod')
|
|
51
|
+
return 'https://coinflow.cash';
|
|
52
|
+
if (env === 'local')
|
|
53
|
+
return 'http://localhost:3000';
|
|
54
|
+
return "https://".concat(env, ".coinflow.cash");
|
|
55
|
+
};
|
|
56
|
+
CoinflowUtils.getCoinflowApiUrl = function (env) {
|
|
57
|
+
if (!env || env === 'prod')
|
|
58
|
+
return 'https://api.coinflow.cash';
|
|
59
|
+
if (env === 'local')
|
|
60
|
+
return 'http://localhost:5000';
|
|
61
|
+
return "https://api-".concat(env, ".coinflow.cash");
|
|
62
|
+
};
|
|
63
|
+
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
64
|
+
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, supportsVersionedTransactions = _a.supportsVersionedTransactions, 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;
|
|
66
|
+
var prefix = routePrefix
|
|
67
|
+
? "/".concat(routePrefix, "/").concat(blockchain)
|
|
68
|
+
: "/".concat(blockchain);
|
|
69
|
+
var url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));
|
|
70
|
+
url.searchParams.append('pubkey', walletPubkey);
|
|
71
|
+
if (transaction) {
|
|
72
|
+
url.searchParams.append('transaction', transaction);
|
|
73
|
+
}
|
|
74
|
+
if (amount) {
|
|
75
|
+
url.searchParams.append('amount', amount.toString());
|
|
76
|
+
}
|
|
77
|
+
if (supportsVersionedTransactions) {
|
|
78
|
+
url.searchParams.append('supportsVersionedTransactions', 'true');
|
|
79
|
+
}
|
|
80
|
+
if (webhookInfo) {
|
|
81
|
+
url.searchParams.append('webhookInfo', LZString.compressToEncodedURIComponent(JSON.stringify(webhookInfo)));
|
|
82
|
+
}
|
|
83
|
+
if (theme) {
|
|
84
|
+
url.searchParams.append('theme', LZString.compressToEncodedURIComponent(JSON.stringify(theme)));
|
|
85
|
+
}
|
|
86
|
+
if (customerInfo) {
|
|
87
|
+
url.searchParams.append('customerInfo', LZString.compressToEncodedURIComponent(JSON.stringify(customerInfo)));
|
|
88
|
+
}
|
|
89
|
+
if (email) {
|
|
90
|
+
url.searchParams.append('email', email);
|
|
91
|
+
}
|
|
92
|
+
if (token) {
|
|
93
|
+
url.searchParams.append('token', token.toString());
|
|
94
|
+
}
|
|
95
|
+
if (tokens) {
|
|
96
|
+
url.searchParams.append('tokens', tokens.toString());
|
|
97
|
+
}
|
|
98
|
+
if (loaderBackground) {
|
|
99
|
+
url.searchParams.append('loaderBackground', loaderBackground);
|
|
100
|
+
}
|
|
101
|
+
if (handleHeightChange) {
|
|
102
|
+
url.searchParams.append('useHeightChange', 'true');
|
|
103
|
+
}
|
|
104
|
+
if (bankAccountLinkRedirect) {
|
|
105
|
+
url.searchParams.append('bankAccountLinkRedirect', bankAccountLinkRedirect);
|
|
106
|
+
}
|
|
107
|
+
if (additionalWallets)
|
|
108
|
+
url.searchParams.append('additionalWallets', LZString.compressToEncodedURIComponent(JSON.stringify(additionalWallets)));
|
|
109
|
+
if (nearDeposit)
|
|
110
|
+
url.searchParams.append('nearDeposit', nearDeposit);
|
|
111
|
+
if (chargebackProtectionData)
|
|
112
|
+
url.searchParams.append('chargebackProtectionData', LZString.compressToEncodedURIComponent(JSON.stringify(chargebackProtectionData)));
|
|
113
|
+
if (deviceId) {
|
|
114
|
+
url.searchParams.append('deviceId', deviceId);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
if (typeof window !== 'undefined') {
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
var deviceId_1 = (_b = window === null || window === void 0 ? void 0 : window.nSureSDK) === null || _b === void 0 ? void 0 : _b.getDeviceId();
|
|
121
|
+
if (deviceId_1)
|
|
122
|
+
url.searchParams.append('deviceId', deviceId_1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (merchantCss)
|
|
126
|
+
url.searchParams.append('merchantCss', merchantCss);
|
|
127
|
+
if (color)
|
|
128
|
+
url.searchParams.append('color', color);
|
|
129
|
+
if (rent)
|
|
130
|
+
url.searchParams.append('rent', rent.lamports.toString());
|
|
131
|
+
if (nativeSolToConvert)
|
|
132
|
+
url.searchParams.append('nativeSolToConvert', nativeSolToConvert.lamports.toString());
|
|
133
|
+
if (lockDefaultToken)
|
|
134
|
+
url.searchParams.append('lockDefaultToken', 'true');
|
|
135
|
+
if (planCode)
|
|
136
|
+
url.searchParams.append('planCode', planCode);
|
|
137
|
+
if (disableApplePay)
|
|
138
|
+
url.searchParams.append('disableApplePay', 'true');
|
|
139
|
+
if (disableGooglePay)
|
|
140
|
+
url.searchParams.append('disableGooglePay', 'true');
|
|
141
|
+
if (settlementType)
|
|
142
|
+
url.searchParams.append('settlementType', settlementType);
|
|
143
|
+
if (lockAmount)
|
|
144
|
+
url.searchParams.append('lockAmount', 'true');
|
|
145
|
+
if (usePermit === false)
|
|
146
|
+
url.searchParams.append('usePermit', 'false');
|
|
147
|
+
if (transactionSigner)
|
|
148
|
+
url.searchParams.append('transactionSigner', transactionSigner);
|
|
149
|
+
if (authOnly === true)
|
|
150
|
+
url.searchParams.append('authOnly', 'true');
|
|
151
|
+
if (jwtToken)
|
|
152
|
+
url.searchParams.append('jwtToken', jwtToken);
|
|
153
|
+
return url.toString();
|
|
154
|
+
};
|
|
155
|
+
CoinflowUtils.getTransaction = function (props) {
|
|
156
|
+
return this.byBlockchain(props.blockchain, {
|
|
157
|
+
solana: function () {
|
|
158
|
+
if (!('transaction' in props))
|
|
159
|
+
return undefined;
|
|
160
|
+
var transaction = props.transaction;
|
|
161
|
+
if (!web3)
|
|
162
|
+
throw new Error('@solana/web3.js dependency is required for Solana');
|
|
163
|
+
if (!base58)
|
|
164
|
+
throw new Error('bs58 dependency is required for Solana');
|
|
165
|
+
if (transaction instanceof web3.Transaction)
|
|
166
|
+
return base58.encode(transaction.serialize({
|
|
167
|
+
requireAllSignatures: false,
|
|
168
|
+
verifySignatures: false,
|
|
169
|
+
}));
|
|
170
|
+
if (transaction instanceof web3.VersionedTransaction)
|
|
171
|
+
return base58.encode(transaction.serialize());
|
|
172
|
+
return undefined;
|
|
173
|
+
},
|
|
174
|
+
polygon: function () {
|
|
175
|
+
if (!('transaction' in props))
|
|
176
|
+
return undefined;
|
|
177
|
+
var transaction = props.transaction;
|
|
178
|
+
return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
|
|
179
|
+
},
|
|
180
|
+
eth: function () {
|
|
181
|
+
if (!('transaction' in props))
|
|
182
|
+
return undefined;
|
|
183
|
+
var transaction = props.transaction;
|
|
184
|
+
return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
|
|
185
|
+
},
|
|
186
|
+
base: function () {
|
|
187
|
+
if (!('transaction' in props))
|
|
188
|
+
return undefined;
|
|
189
|
+
var transaction = props.transaction;
|
|
190
|
+
return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
|
|
191
|
+
},
|
|
192
|
+
near: function () {
|
|
193
|
+
if (!('action' in props))
|
|
194
|
+
return undefined;
|
|
195
|
+
var action = props.action;
|
|
196
|
+
return LZString.compressToEncodedURIComponent(JSON.stringify(action));
|
|
197
|
+
},
|
|
198
|
+
})();
|
|
199
|
+
};
|
|
200
|
+
CoinflowUtils.byBlockchain = function (blockchain, args) {
|
|
201
|
+
switch (blockchain) {
|
|
202
|
+
case 'solana':
|
|
203
|
+
return args.solana;
|
|
204
|
+
case 'near':
|
|
205
|
+
return args.near;
|
|
206
|
+
case 'polygon':
|
|
207
|
+
return args.polygon;
|
|
208
|
+
case 'eth':
|
|
209
|
+
return args.eth;
|
|
210
|
+
case 'base':
|
|
211
|
+
return args.base;
|
|
212
|
+
default:
|
|
213
|
+
throw new Error('blockchain not supported!');
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
return CoinflowUtils;
|
|
217
|
+
}());
|
|
218
|
+
export { CoinflowUtils };
|
|
219
|
+
//# sourceMappingURL=CoinflowUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/common/CoinflowUtils.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC;IAIE,uBAAY,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;aAC3D,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO;YAAE,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAAC;;YAC7D,IAAI,CAAC,GAAG,GAAG,sBAAe,IAAI,CAAC,GAAG,mBAAgB,CAAC;IAC1D,CAAC;IAEK,yCAAiB,GAAvB,UAAwB,UAAkB;;;gBACxC,sBAAO,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,yBAAkB,UAAU,CAAE,CAAC;yBACpD,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,EAAf,CAAe,CAAC;yBACjC,IAAI,CACH,UAAC,IAGA,YAAK,OAAA,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,cAAc,KAAI,IAAI,CAAC,cAAc,CAAA,EAAA,CAChE;yBACA,KAAK,CA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AAC,QAAQ,IAAI,KAAK,CAAC;oBAAE,OAAO,SAAS,CAAC;gBACpC,IAAA,MAAM,GAAI,KAAK,OAAT,CAAU;gBACvB,OAAO,QAAQ,CAAC,6BAA6B,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACxE,CAAC;SACF,CAAC,EAAE,CAAC;IACP,CAAC;IAEM,0BAAY,GAAnB,UACE,UAA8B,EAC9B,IAAuD;QAEvD,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,KAAK,KAAK;gBACR,OAAO,IAAI,CAAC,GAAG,CAAC;YAClB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AA7RD,IA6RC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This works in angular, but not react
|
|
2
|
+
// let web3: typeof import('@solana/web3.js') | undefined;
|
|
3
|
+
// let base58: typeof import('bs58') | undefined;
|
|
4
|
+
//
|
|
5
|
+
// try {
|
|
6
|
+
// web3 = require('@solana/web3.js');
|
|
7
|
+
// base58 = require('bs58');
|
|
8
|
+
// } catch (e) {}
|
|
9
|
+
//
|
|
10
|
+
// export {web3, base58};
|
|
11
|
+
// This works in react, but not angular
|
|
12
|
+
import * as SolanaWeb3Js from '@solana/web3.js';
|
|
13
|
+
import base58Imported from 'bs58';
|
|
14
|
+
var web3 = SolanaWeb3Js;
|
|
15
|
+
var base58 = base58Imported;
|
|
16
|
+
export { web3, base58 };
|
|
17
|
+
//# sourceMappingURL=SolanaPeerDeps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolanaPeerDeps.js","sourceRoot":"","sources":["../../src/common/SolanaPeerDeps.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,0DAA0D;AAC1D,iDAAiD;AACjD,EAAE;AACF,QAAQ;AACR,uCAAuC;AACvC,8BAA8B;AAC9B,iBAAiB;AACjB,EAAE;AACF,yBAAyB;AAEzB,uCAAuC;AACvC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,cAAc,MAAM,MAAM,CAAC;AAElC,IAAM,IAAI,GAAoC,YAAY,CAAC;AAC3D,IAAM,MAAM,GAAsC,cAAc,CAAC;AACjE,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC"}
|
|
@@ -0,0 +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"}
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/react-native",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "React Native Component for Coinflow",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -21,26 +21,41 @@
|
|
|
21
21
|
"README.md"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"clean": "rimraf build",
|
|
25
|
-
"build": "tsc"
|
|
24
|
+
"clean": "rimraf build && rimraf ./src/common",
|
|
25
|
+
"build": "npm run codegen && tsc",
|
|
26
|
+
"codegen": "cp -r ../lib-common/src/ ./src/common/"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
29
|
+
"bs58": "~5.0.0",
|
|
28
30
|
"react": ">=16",
|
|
29
31
|
"react-native": ">=0.66.0",
|
|
30
|
-
"react-native-webview": ">=11.16.0"
|
|
32
|
+
"react-native-webview": ">=11.16.0",
|
|
33
|
+
"@coinflowlabs/lib-common": "*"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"react-native-get-random-values": "^1.11.0",
|
|
34
37
|
"bs58": "^5.0.0",
|
|
35
38
|
"bn.js": "^5.2.1",
|
|
36
|
-
"@solana/web3.js": "^1.
|
|
39
|
+
"@solana/web3.js": "^1.91.7",
|
|
40
|
+
"lz-string": "^1.5.0"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
43
|
"@types/react": "^18.2.64",
|
|
40
44
|
"@types/react-native": "^0.73.0",
|
|
41
45
|
"eslint-config-react-app": "^7.0.1",
|
|
42
|
-
"typescript": "^5.4.
|
|
46
|
+
"typescript": "^5.4.5",
|
|
43
47
|
"@solana/wallet-adapter-react": "^0.15.32",
|
|
44
48
|
"@near-wallet-selector/core": "^8.9.3"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"@coinflowlabs/lib-common": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@solana/web3.js": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"bs58": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
45
60
|
}
|
|
46
61
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../src/CoinflowTypes.ts"],"names":[],"mappings":"AAQA,IAAK,cAIJ;AAJD,WAAK,cAAc;IACjB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJI,cAAc,KAAd,cAAc,QAIlB;AAED,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJI,aAAa,KAAb,aAAa,QAIjB"}
|