@coinflowlabs/react-native 3.0.0 → 3.1.1

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.
Files changed (51) hide show
  1. package/README.md +6 -0
  2. package/build/CoinflowPurchase.d.ts +3 -2
  3. package/build/CoinflowPurchase.js +11 -53
  4. package/build/CoinflowPurchase.js.map +1 -1
  5. package/build/CoinflowPurchaseHistory.d.ts +3 -2
  6. package/build/CoinflowPurchaseHistory.js +10 -14
  7. package/build/CoinflowPurchaseHistory.js.map +1 -1
  8. package/build/CoinflowWebView.d.ts +10 -2
  9. package/build/CoinflowWebView.js +18 -5
  10. package/build/CoinflowWebView.js.map +1 -1
  11. package/build/CoinflowWithdraw.d.ts +3 -2
  12. package/build/CoinflowWithdraw.js +12 -36
  13. package/build/CoinflowWithdraw.js.map +1 -1
  14. package/build/CoinflowWithdrawHistory.d.ts +3 -2
  15. package/build/CoinflowWithdrawHistory.js +10 -14
  16. package/build/CoinflowWithdrawHistory.js.map +1 -1
  17. package/build/common/CoinflowLibMessageHandlers.d.ts +21 -0
  18. package/build/common/CoinflowLibMessageHandlers.js +180 -0
  19. package/build/common/CoinflowLibMessageHandlers.js.map +1 -0
  20. package/build/{CoinflowTypes.d.ts → common/CoinflowTypes.d.ts} +93 -96
  21. package/build/{CoinflowTypes.js → common/CoinflowTypes.js} +2 -3
  22. package/build/common/CoinflowTypes.js.map +1 -0
  23. package/build/common/CoinflowUtils.d.ts +21 -0
  24. package/build/common/CoinflowUtils.js +198 -0
  25. package/build/common/CoinflowUtils.js.map +1 -0
  26. package/build/common/SolanaPeerDeps.d.ts +5 -0
  27. package/build/common/SolanaPeerDeps.js +17 -0
  28. package/build/common/SolanaPeerDeps.js.map +1 -0
  29. package/build/common/index.d.ts +3 -0
  30. package/build/common/index.js +4 -0
  31. package/build/common/index.js.map +1 -0
  32. package/build/index.d.ts +1 -1
  33. package/build/index.js +1 -1
  34. package/build/index.js.map +1 -1
  35. package/package.json +20 -6
  36. package/build/CoinflowTypes.js.map +0 -1
  37. package/build/ReactNativeCoinflowUtils.d.ts +0 -8
  38. package/build/ReactNativeCoinflowUtils.js +0 -75
  39. package/build/ReactNativeCoinflowUtils.js.map +0 -1
  40. package/build/wallet/EthIFrameMessageHandlers.d.ts +0 -5
  41. package/build/wallet/EthIFrameMessageHandlers.js +0 -37
  42. package/build/wallet/EthIFrameMessageHandlers.js.map +0 -1
  43. package/build/wallet/NearIFrameMessageHandlers.d.ts +0 -5
  44. package/build/wallet/NearIFrameMessageHandlers.js +0 -27
  45. package/build/wallet/NearIFrameMessageHandlers.js.map +0 -1
  46. package/build/wallet/SolanaIFrameMessageHandlers.d.ts +0 -18
  47. package/build/wallet/SolanaIFrameMessageHandlers.js +0 -134
  48. package/build/wallet/SolanaIFrameMessageHandlers.js.map +0 -1
  49. package/build/wallet/useWebViewWallet.d.ts +0 -11
  50. package/build/wallet/useWebViewWallet.js +0 -102
  51. package/build/wallet/useWebViewWallet.js.map +0 -1
@@ -1,21 +1,15 @@
1
- import type { Connection } from '@solana/web3.js';
2
- import { PublicKey, Signer, Transaction } from '@solana/web3.js';
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;
@@ -40,65 +34,33 @@ interface CustomerInfo {
40
34
  lng?: string;
41
35
  }
42
36
  /** Coinflow Types **/
43
- export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon';
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
- onLoad?: () => void;
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
- };
94
- export type WithStyles = {
95
- style?: StyleProp<ViewStyle>;
96
- };
97
49
  /** Wallets **/
98
- export type SolanaWallet = PartialBy<Pick<WalletContextState, 'wallet' | 'signTransaction' | 'publicKey' | 'sendTransaction' | 'signMessage'>, 'wallet' | 'signTransaction'>;
99
- export type NearWallet = {
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 {
100
57
  accountId: string;
101
- } & Pick<Wallet, 'signAndSendTransaction'>;
58
+ signAndSendTransaction: (transaction: unknown) => Promise<{
59
+ transaction: {
60
+ hash: string;
61
+ };
62
+ }>;
63
+ }
102
64
  type AccessList = Array<{
103
65
  address: string;
104
66
  storageKeys: Array<string>;
@@ -128,44 +90,27 @@ export type EthWallet = {
128
90
  };
129
91
  /** History **/
130
92
  export interface CoinflowSolanaHistoryProps extends CoinflowTypes {
131
- wallet: Omit<SolanaWallet, 'signTransaction'>;
93
+ wallet: SolanaWallet;
132
94
  connection: Connection;
133
95
  blockchain: 'solana';
134
96
  }
135
97
  export interface CoinflowNearHistoryProps extends CoinflowTypes {
136
- wallet: Omit<NearWallet, 'signAndSendTransaction'>;
98
+ wallet: NearWallet;
137
99
  blockchain: 'near';
138
100
  }
139
- export interface CoinflowEthHistoryProps extends CoinflowTypes {
140
- wallet: Omit<EthWallet, 'sendTransaction' | 'signMessage'>;
101
+ export interface CoinflowEvmHistoryProps extends CoinflowTypes {
102
+ wallet: EthWallet;
103
+ }
104
+ export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
141
105
  blockchain: 'eth';
142
106
  }
143
- export interface CoinflowPolygonHistoryProps extends CoinflowTypes {
144
- wallet: Omit<EthWallet, 'sendTransaction' | 'signMessage'>;
107
+ export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
145
108
  blockchain: 'polygon';
146
109
  }
147
- export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps;
148
- export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount'> {
149
- WebViewRef: React.RefObject<any | null>;
150
- route: string;
151
- amount?: number;
152
- transaction?: string;
153
- blockchain: CoinflowBlockchain;
154
- email?: string;
155
- env?: CoinflowEnvs;
156
- deviceId?: string;
157
- loaderBackground?: string;
158
- supportsVersionedTransactions?: boolean;
159
- rent?: {
160
- lamports: string | number;
161
- };
162
- nativeSolToConvert?: {
163
- lamports: string | number;
164
- };
165
- disableApplePay?: boolean;
166
- disableGooglePay?: boolean;
167
- planCode?: string;
110
+ export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
111
+ blockchain: 'base';
168
112
  }
113
+ export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps;
169
114
  /** Transactions **/
170
115
  export type NearFtTransferCallAction = {
171
116
  methodName: 'ft_transfer_call';
@@ -176,21 +121,48 @@ export type NearFtTransferCallAction = {
176
121
  type Bytes = ArrayLike<number>;
177
122
  type BytesLike = Bytes | string;
178
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
+ }
179
148
  export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
180
- amount?: number;
149
+ amount?: number | string;
181
150
  onSuccess?: OnSuccessMethod;
182
151
  webhookInfo?: object;
183
- customerInfo?: CustomerInfo;
184
152
  email?: string;
185
- deviceId?: string;
186
153
  chargebackProtectionData?: ChargebackProtectionData;
154
+ planCode?: string;
187
155
  disableApplePay?: boolean;
188
156
  disableGooglePay?: boolean;
157
+ customerInfo?: CustomerInfo;
189
158
  settlementType?: SettlementType;
159
+ authOnly?: boolean;
160
+ deviceId?: string;
161
+ jwtToken?: string;
190
162
  }
191
163
  export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
192
164
  wallet: SolanaWallet;
193
- transaction?: Transaction;
165
+ transaction?: Transaction | VersionedTransaction;
194
166
  partialSigners?: Signer[];
195
167
  debugTx?: boolean;
196
168
  connection: Connection;
@@ -208,8 +180,9 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
208
180
  wallet: NearWallet;
209
181
  blockchain: 'near';
210
182
  action?: NearFtTransferCallAction;
183
+ nearDeposit?: string;
211
184
  }
212
- interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
185
+ export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
213
186
  transaction?: EvmTransactionData;
214
187
  token?: string;
215
188
  wallet: EthWallet;
@@ -220,7 +193,10 @@ export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
220
193
  export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
221
194
  blockchain: 'eth';
222
195
  }
223
- export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps;
196
+ export interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {
197
+ blockchain: 'base';
198
+ }
199
+ export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps;
224
200
  /** Withdraw **/
225
201
  export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
226
202
  onSuccess?: OnSuccessMethod;
@@ -246,15 +222,21 @@ export interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {
246
222
  wallet: NearWallet;
247
223
  blockchain: 'near';
248
224
  }
249
- export interface CoinflowEthWithdrawProps extends CoinflowCommonWithdrawProps {
250
- wallet: Omit<EthWallet, 'signMessage'>;
225
+ export interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {
226
+ wallet: EthWallet;
227
+ usePermit?: boolean;
228
+ }
229
+ export interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {
251
230
  blockchain: 'eth';
231
+ usePermit?: boolean;
252
232
  }
253
- export interface CoinflowPolygonWithdrawProps extends CoinflowCommonWithdrawProps {
254
- wallet: Omit<EthWallet, 'signMessage'>;
233
+ export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
255
234
  blockchain: 'polygon';
256
235
  }
257
- export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps;
236
+ export interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {
237
+ blockchain: 'base';
238
+ }
239
+ export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps;
258
240
  export interface CommonEvmRedeem {
259
241
  waitForHash?: boolean;
260
242
  }
@@ -287,4 +269,19 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
287
269
  items: ReservoirItems;
288
270
  }
289
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
+ }
290
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,198 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import { web3, base58 } from './SolanaPeerDeps';
3
+ var CoinflowUtils = /** @class */ (function () {
4
+ function CoinflowUtils(env) {
5
+ this.env = env !== null && env !== void 0 ? env : 'prod';
6
+ if (this.env === 'prod')
7
+ this.url = 'https://api.coinflow.cash';
8
+ else if (this.env === 'local')
9
+ this.url = 'http://localhost:5000';
10
+ else
11
+ this.url = "https://api-".concat(this.env, ".coinflow.cash");
12
+ }
13
+ CoinflowUtils.prototype.getNSurePartnerId = function (merchantId) {
14
+ return __awaiter(this, void 0, void 0, function () {
15
+ return __generator(this, function (_a) {
16
+ return [2 /*return*/, fetch(this.url + "/merchant/view/".concat(merchantId))
17
+ .then(function (response) { return response.json(); })
18
+ .then(function (json) { var _a; return ((_a = json.nSureSettings) === null || _a === void 0 ? void 0 : _a.nSurePartnerId) || json.nSurePartnerId; })
19
+ .catch(function (e) {
20
+ console.error(e);
21
+ return undefined;
22
+ })];
23
+ });
24
+ });
25
+ };
26
+ CoinflowUtils.prototype.getCreditBalance = function (publicKey, merchantId, blockchain) {
27
+ return __awaiter(this, void 0, void 0, function () {
28
+ var response, credits;
29
+ return __generator(this, function (_a) {
30
+ switch (_a.label) {
31
+ case 0: return [4 /*yield*/, fetch(this.url + "/api/customer/balances/".concat(merchantId), {
32
+ method: 'GET',
33
+ headers: {
34
+ 'x-coinflow-auth-wallet': publicKey,
35
+ 'x-coinflow-auth-blockchain': blockchain,
36
+ },
37
+ })];
38
+ case 1:
39
+ response = _a.sent();
40
+ return [4 /*yield*/, response.json()];
41
+ case 2:
42
+ credits = (_a.sent()).credits;
43
+ return [2 /*return*/, credits];
44
+ }
45
+ });
46
+ });
47
+ };
48
+ CoinflowUtils.getCoinflowBaseUrl = function (env) {
49
+ if (!env || env === 'prod')
50
+ return 'https://coinflow.cash';
51
+ if (env === 'local')
52
+ return 'http://localhost:3000';
53
+ return "https://".concat(env, ".coinflow.cash");
54
+ };
55
+ CoinflowUtils.getCoinflowApiUrl = function (env) {
56
+ if (!env || env === 'prod')
57
+ return 'https://api.coinflow.cash';
58
+ if (env === 'local')
59
+ return 'http://localhost:5000';
60
+ return "https://api-".concat(env, ".coinflow.cash");
61
+ };
62
+ CoinflowUtils.getCoinflowUrl = function (_a) {
63
+ var _b;
64
+ 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;
65
+ var prefix = routePrefix
66
+ ? "/".concat(routePrefix, "/").concat(blockchain)
67
+ : "/".concat(blockchain);
68
+ var url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));
69
+ url.searchParams.append('pubkey', walletPubkey);
70
+ if (transaction) {
71
+ url.searchParams.append('transaction', transaction);
72
+ }
73
+ if (amount) {
74
+ url.searchParams.append('amount', amount.toString());
75
+ }
76
+ if (supportsVersionedTransactions) {
77
+ url.searchParams.append('supportsVersionedTransactions', 'true');
78
+ }
79
+ if (webhookInfo) {
80
+ url.searchParams.append('webhookInfo', Buffer.from(JSON.stringify(webhookInfo)).toString('base64'));
81
+ }
82
+ if (theme) {
83
+ url.searchParams.append('theme', Buffer.from(JSON.stringify(theme)).toString('base64'));
84
+ }
85
+ if (customerInfo) {
86
+ url.searchParams.append('customerInfo', Buffer.from(JSON.stringify(customerInfo)).toString('base64'));
87
+ }
88
+ if (email) {
89
+ url.searchParams.append('email', email);
90
+ }
91
+ if (token) {
92
+ url.searchParams.append('token', token.toString());
93
+ }
94
+ if (tokens) {
95
+ url.searchParams.append('tokens', tokens.toString());
96
+ }
97
+ if (loaderBackground) {
98
+ url.searchParams.append('loaderBackground', loaderBackground);
99
+ }
100
+ if (handleHeightChange) {
101
+ url.searchParams.append('useHeightChange', 'true');
102
+ }
103
+ if (bankAccountLinkRedirect) {
104
+ url.searchParams.append('bankAccountLinkRedirect', bankAccountLinkRedirect);
105
+ }
106
+ if (additionalWallets)
107
+ url.searchParams.append('additionalWallets', JSON.stringify(additionalWallets));
108
+ if (nearDeposit)
109
+ url.searchParams.append('nearDeposit', nearDeposit);
110
+ if (chargebackProtectionData)
111
+ url.searchParams.append('chargebackProtectionData', JSON.stringify(chargebackProtectionData));
112
+ if (deviceId) {
113
+ url.searchParams.append('deviceId', deviceId);
114
+ }
115
+ else {
116
+ if (typeof window !== 'undefined') {
117
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
118
+ // @ts-ignore
119
+ var deviceId_1 = (_b = window === null || window === void 0 ? void 0 : window.nSureSDK) === null || _b === void 0 ? void 0 : _b.getDeviceId();
120
+ if (deviceId_1)
121
+ url.searchParams.append('deviceId', deviceId_1);
122
+ }
123
+ }
124
+ if (merchantCss)
125
+ url.searchParams.append('merchantCss', merchantCss);
126
+ if (color)
127
+ url.searchParams.append('color', color);
128
+ if (rent)
129
+ url.searchParams.append('rent', rent.lamports.toString());
130
+ if (nativeSolToConvert)
131
+ url.searchParams.append('nativeSolToConvert', nativeSolToConvert.lamports.toString());
132
+ if (lockDefaultToken)
133
+ url.searchParams.append('lockDefaultToken', 'true');
134
+ if (planCode)
135
+ url.searchParams.append('planCode', planCode);
136
+ if (disableApplePay)
137
+ url.searchParams.append('disableApplePay', 'true');
138
+ if (disableGooglePay)
139
+ url.searchParams.append('disableGooglePay', 'true');
140
+ if (settlementType)
141
+ url.searchParams.append('settlementType', settlementType);
142
+ if (lockAmount)
143
+ url.searchParams.append('lockAmount', 'true');
144
+ if (usePermit === false)
145
+ url.searchParams.append('usePermit', 'false');
146
+ if (transactionSigner)
147
+ url.searchParams.append('transactionSigner', transactionSigner);
148
+ if (authOnly === true)
149
+ url.searchParams.append('authOnly', 'true');
150
+ if (jwtToken)
151
+ url.searchParams.append('jwtToken', jwtToken);
152
+ return url.toString();
153
+ };
154
+ CoinflowUtils.getTransaction = function (props) {
155
+ if ('transaction' in props && props.transaction !== undefined) {
156
+ var transaction = props.transaction;
157
+ if (web3 && transaction instanceof web3.Transaction) {
158
+ if (!base58)
159
+ throw new Error('bs58 dependency is required for Solana');
160
+ return base58.encode(transaction.serialize({
161
+ requireAllSignatures: false,
162
+ verifySignatures: false,
163
+ }));
164
+ }
165
+ if (web3 && transaction instanceof web3.VersionedTransaction) {
166
+ if (!base58)
167
+ throw new Error('bs58 dependency is required for Solana');
168
+ return base58.encode(transaction.serialize());
169
+ }
170
+ return btoa(JSON.stringify(transaction));
171
+ }
172
+ if ('action' in props && props.action !== undefined) {
173
+ return btoa(JSON.stringify(props.action));
174
+ }
175
+ return undefined;
176
+ };
177
+ CoinflowUtils.byBlockchain = function (blockchain, args) {
178
+ switch (blockchain) {
179
+ case 'solana':
180
+ return args.solana;
181
+ case 'near':
182
+ return args.near;
183
+ case 'polygon':
184
+ return args.polygon;
185
+ case 'eth':
186
+ if (args.eth === undefined)
187
+ throw new Error('blockchain not supported for this operation!');
188
+ return args.eth;
189
+ case 'base':
190
+ return args.base;
191
+ default:
192
+ throw new Error('blockchain not supported!');
193
+ }
194
+ };
195
+ return CoinflowUtils;
196
+ }());
197
+ export { CoinflowUtils };
198
+ //# 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;AAE9C;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,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AAO,CAAC;YACtB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;oBACxB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBAClE,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,AArQD,IAqQC"}
@@ -0,0 +1,5 @@
1
+ import * as SolanaWeb3Js from '@solana/web3.js';
2
+ import base58Imported from 'bs58';
3
+ declare const web3: typeof SolanaWeb3Js | undefined;
4
+ declare const base58: typeof base58Imported | undefined;
5
+ export { web3, base58 };
@@ -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,3 @@
1
+ export * from './CoinflowTypes';
2
+ export * from './CoinflowUtils';
3
+ export * from './CoinflowLibMessageHandlers';
@@ -0,0 +1,4 @@
1
+ export * from './CoinflowTypes';
2
+ export * from './CoinflowUtils';
3
+ export * from './CoinflowLibMessageHandlers';
4
+ //# sourceMappingURL=index.js.map
@@ -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
@@ -3,4 +3,4 @@ export * from './CoinflowWithdraw';
3
3
  export * from './CoinflowPurchase';
4
4
  export * from './CoinflowPurchaseHistory';
5
5
  export * from './CoinflowWithdrawHistory';
6
- export * from './CoinflowTypes';
6
+ export * from './common';
package/build/index.js CHANGED
@@ -3,5 +3,5 @@ export * from './CoinflowWithdraw';
3
3
  export * from './CoinflowPurchase';
4
4
  export * from './CoinflowPurchaseHistory';
5
5
  export * from './CoinflowWithdrawHistory';
6
- export * from './CoinflowTypes';
6
+ export * from './common';
7
7
  //# sourceMappingURL=index.js.map
@@ -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,iBAAiB,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"}