@coinflowlabs/react 1.1.1 → 1.2.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 +4 -0
- package/build/cjs/CoinflowIFrame.d.ts +7 -4
- package/build/cjs/CoinflowIFrame.js +17 -3
- package/build/cjs/CoinflowIFrame.js.map +1 -1
- package/build/cjs/CoinflowPurchase.d.ts +4 -5
- package/build/cjs/CoinflowPurchase.js +4 -4
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.d.ts +1 -1
- package/build/cjs/CoinflowPurchaseHistory.js +4 -4
- package/build/cjs/CoinflowPurchaseHistory.js.map +1 -1
- package/build/cjs/CoinflowUtils.d.ts +36 -2
- package/build/cjs/CoinflowUtils.js +14 -1
- package/build/cjs/CoinflowUtils.js.map +1 -1
- package/build/cjs/CoinflowWithdraw.d.ts +11 -6
- package/build/cjs/CoinflowWithdraw.js +18 -5
- package/build/cjs/CoinflowWithdraw.js.map +1 -1
- package/build/cjs/CoinflowWithdrawHistory.d.ts +2 -17
- package/build/cjs/CoinflowWithdrawHistory.js +17 -5
- package/build/cjs/CoinflowWithdrawHistory.js.map +1 -1
- package/build/cjs/CommonCoinflowProps.d.ts +21 -0
- package/build/cjs/CommonCoinflowProps.js +3 -0
- package/build/cjs/CommonCoinflowProps.js.map +1 -0
- package/build/cjs/EthIFrameMessageHandlers.d.ts +5 -0
- package/build/cjs/EthIFrameMessageHandlers.js +47 -0
- package/build/cjs/EthIFrameMessageHandlers.js.map +1 -0
- package/build/cjs/SolanaIFrameMessageHandlers.js +1 -1
- package/build/cjs/SolanaIFrameMessageHandlers.js.map +1 -1
- package/build/cjs/useIframeWallet.js +8 -2
- package/build/cjs/useIframeWallet.js.map +1 -1
- package/build/esm/CoinflowIFrame.d.ts +7 -4
- package/build/esm/CoinflowIFrame.js +17 -3
- package/build/esm/CoinflowIFrame.js.map +1 -1
- package/build/esm/CoinflowPurchase.d.ts +4 -5
- package/build/esm/CoinflowPurchase.js +4 -4
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.d.ts +1 -1
- package/build/esm/CoinflowPurchaseHistory.js +4 -4
- package/build/esm/CoinflowPurchaseHistory.js.map +1 -1
- package/build/esm/CoinflowUtils.d.ts +36 -2
- package/build/esm/CoinflowUtils.js +14 -1
- package/build/esm/CoinflowUtils.js.map +1 -1
- package/build/esm/CoinflowWithdraw.d.ts +11 -6
- package/build/esm/CoinflowWithdraw.js +18 -5
- package/build/esm/CoinflowWithdraw.js.map +1 -1
- package/build/esm/CoinflowWithdrawHistory.d.ts +2 -17
- package/build/esm/CoinflowWithdrawHistory.js +18 -6
- package/build/esm/CoinflowWithdrawHistory.js.map +1 -1
- package/build/esm/CommonCoinflowProps.d.ts +21 -0
- package/build/esm/CommonCoinflowProps.js +2 -0
- package/build/esm/CommonCoinflowProps.js.map +1 -0
- package/build/esm/EthIFrameMessageHandlers.d.ts +5 -0
- package/build/esm/EthIFrameMessageHandlers.js +43 -0
- package/build/esm/EthIFrameMessageHandlers.js.map +1 -0
- package/build/esm/SolanaIFrameMessageHandlers.js +1 -1
- package/build/esm/SolanaIFrameMessageHandlers.js.map +1 -1
- package/build/esm/useIframeWallet.js +8 -2
- package/build/esm/useIframeWallet.js.map +1 -1
- package/package.json +4 -4
|
@@ -16,7 +16,7 @@ function useIframeWallet(_a, onSuccess) {
|
|
|
16
16
|
var handleIframeMessages = (0, react_1.useCallback)(function (_a) {
|
|
17
17
|
var data = _a.data;
|
|
18
18
|
return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
19
|
-
var parsedData, _b, message, signature, signedTransaction, e_1;
|
|
19
|
+
var parsedData, _b, message, signature, signedTransaction, e_1, message;
|
|
20
20
|
return tslib_1.__generator(this, function (_c) {
|
|
21
21
|
switch (_c.label) {
|
|
22
22
|
case 0:
|
|
@@ -66,7 +66,13 @@ function useIframeWallet(_a, onSuccess) {
|
|
|
66
66
|
case 10:
|
|
67
67
|
e_1 = _c.sent();
|
|
68
68
|
console.error('handleIframeMessages', e_1);
|
|
69
|
-
|
|
69
|
+
try {
|
|
70
|
+
message = e_1 instanceof Error ? e_1.message : JSON.stringify(e_1);
|
|
71
|
+
sendIFrameMessage('ERROR ' + message);
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
sendIFrameMessage('ERROR parsing error JSON');
|
|
75
|
+
}
|
|
70
76
|
return [3 /*break*/, 11];
|
|
71
77
|
case 11: return [2 /*return*/];
|
|
72
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../src/useIframeWallet.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAKrD,SAAgB,eAAe,CAC7B,EAIwB,EACxB,SAA2B;IAN7B,
|
|
1
|
+
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../src/useIframeWallet.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAKrD,SAAgB,eAAe,CAC7B,EAIwB,EACxB,SAA2B;IAN7B,iBAiFC;QA/EG,qBAAqB,2BAAA,EACrB,qBAAqB,2BAAA,EACrB,iBAAiB,uBAAA;IAInB,IAAM,SAAS,GAAG,IAAA,cAAM,EAAoB,IAAI,CAAC,CAAC;IAElD,IAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,UAAC,OAAe;;QACd,IAAI,CAAC,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,aAAa,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,IAAM,oBAAoB,GAAG,IAAA,mBAAW,EACtC,UAAO,EAAsB;YAArB,IAAI,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AC;yBACvC;wBAAC,OAAO,CAAC,EAAE;4BACV,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;yBAC/C;;;;;;KAEJ,EACD;QACE,iBAAiB;QACjB,qBAAqB;QACrB,SAAS;QACT,qBAAqB;QACrB,iBAAiB;KAClB,CACF,CAAC;IAEF,IAAA,iBAAS,EAAC;QACR,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,GAAG,oBAAoB,CAAC;IAC1C,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE3B,OAAO,EAAC,SAAS,WAAA,EAAC,CAAC;AACrB,CAAC;AAjFD,0CAiFC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI;QACF,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAC3B,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CoinflowBlockchain, CoinflowEnvs } from './CoinflowUtils';
|
|
3
|
-
|
|
3
|
+
interface CoinflowIFrameProps {
|
|
4
4
|
walletPubkey: string;
|
|
5
5
|
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
6
|
-
env?: CoinflowEnvs;
|
|
7
6
|
route: string;
|
|
8
7
|
amount?: number;
|
|
9
8
|
transaction?: string;
|
|
10
9
|
blockchain: CoinflowBlockchain;
|
|
11
10
|
webhookInfo?: object;
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
token?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
env?: CoinflowEnvs;
|
|
14
|
+
loaderBackground?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function CoinflowIFrame({ walletPubkey, IFrameRef, env, route, transaction, amount, blockchain, webhookInfo, token, email, loaderBackground, }: CoinflowIFrameProps): JSX.Element;
|
|
14
17
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { CoinflowUtils } from './CoinflowUtils';
|
|
3
3
|
export function CoinflowIFrame(_a) {
|
|
4
|
-
var walletPubkey = _a.walletPubkey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo;
|
|
4
|
+
var walletPubkey = _a.walletPubkey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground;
|
|
5
5
|
var url = useMemo(function () {
|
|
6
6
|
return CoinflowUtils.getCoinflowUrl({
|
|
7
7
|
walletPubkey: walletPubkey,
|
|
@@ -10,9 +10,23 @@ export function CoinflowIFrame(_a) {
|
|
|
10
10
|
route: route,
|
|
11
11
|
transaction: transaction,
|
|
12
12
|
blockchain: blockchain,
|
|
13
|
-
webhookInfo: webhookInfo
|
|
13
|
+
webhookInfo: webhookInfo,
|
|
14
|
+
token: token,
|
|
15
|
+
email: email,
|
|
16
|
+
loaderBackground: loaderBackground
|
|
14
17
|
});
|
|
15
|
-
}, [
|
|
18
|
+
}, [
|
|
19
|
+
loaderBackground,
|
|
20
|
+
walletPubkey,
|
|
21
|
+
amount,
|
|
22
|
+
env,
|
|
23
|
+
route,
|
|
24
|
+
transaction,
|
|
25
|
+
blockchain,
|
|
26
|
+
webhookInfo,
|
|
27
|
+
token,
|
|
28
|
+
email,
|
|
29
|
+
]);
|
|
16
30
|
return useMemo(function () { return (React.createElement("iframe", { onLoad: function () {
|
|
17
31
|
if (IFrameRef.current)
|
|
18
32
|
IFrameRef.current.style.opacity = '1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAmC,aAAa,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAmC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAgBhF,MAAM,UAAU,cAAc,CAAC,EAYT;QAXpB,YAAY,kBAAA,EACZ,SAAS,eAAA,EACT,GAAG,SAAA,EACH,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,KAAK,WAAA,EACL,gBAAgB,sBAAA;IAEhB,IAAM,GAAG,GAAG,OAAO,CAAC;QAClB,OAAO,aAAa,CAAC,cAAc,CAAC;YAClC,YAAY,cAAA;YACZ,MAAM,QAAA;YACN,GAAG,KAAA;YACH,KAAK,OAAA;YACL,WAAW,aAAA;YACX,UAAU,YAAA;YACV,WAAW,aAAA;YACX,KAAK,OAAA;YACL,KAAK,OAAA;YACL,gBAAgB,kBAAA;SACjB,CAAC,CAAC;IACL,CAAC,EAAE;QACD,gBAAgB;QAChB,YAAY;QACZ,MAAM;QACN,GAAG;QACH,KAAK;QACL,WAAW;QACX,UAAU;QACV,WAAW;QACX,KAAK;QACL,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,OAAO,CACZ,cAAM,OAAA,CACJ,gCACE,MAAM,EAAE;YACN,IAAI,SAAS,CAAC,OAAO;gBAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QAC/D,CAAC,EACD,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,sBAAsB;SACnC,EACD,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,GAAG,EACf,GAAG,EAAE,GAAG,GACR,CACH,EAhBK,CAgBL,EACD,CAAC,SAAS,EAAE,GAAG,CAAC,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Connection, Signer, Transaction } from '@solana/web3.js';
|
|
3
|
-
import {
|
|
3
|
+
import { NearWallet, SolanaWalletContextState } from './CoinflowUtils';
|
|
4
4
|
import { OnSuccessMethod } from './useIframeWallet';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { CommonCoinflowProps } from './CommonCoinflowProps';
|
|
6
|
+
export interface CoinflowCommonPurchaseProps extends CommonCoinflowProps {
|
|
7
7
|
amount?: number;
|
|
8
|
-
env?: CoinflowEnvs;
|
|
9
8
|
onSuccess?: OnSuccessMethod;
|
|
10
|
-
blockchain: CoinflowBlockchain;
|
|
11
9
|
webhookInfo?: object;
|
|
10
|
+
email?: string;
|
|
12
11
|
}
|
|
13
12
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
14
13
|
wallet: SolanaWalletContextState;
|
|
@@ -12,7 +12,7 @@ export function CoinflowPurchase(props) {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
function SolanaCoinflowPurchase(_a) {
|
|
15
|
-
var merchantId = _a.merchantId, amount = _a.amount, env = _a.env, onSuccess = _a.onSuccess, wallet = _a.wallet, transaction = _a.transaction, partialSigners = _a.partialSigners, debugTx = _a.debugTx, connection = _a.connection, webhookInfo = _a.webhookInfo;
|
|
15
|
+
var merchantId = _a.merchantId, amount = _a.amount, env = _a.env, onSuccess = _a.onSuccess, wallet = _a.wallet, transaction = _a.transaction, partialSigners = _a.partialSigners, debugTx = _a.debugTx, connection = _a.connection, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground;
|
|
16
16
|
var handlers = useSolanaIFrameMessageHandlers({
|
|
17
17
|
wallet: wallet,
|
|
18
18
|
connection: connection,
|
|
@@ -28,10 +28,10 @@ function SolanaCoinflowPurchase(_a) {
|
|
|
28
28
|
if (!wallet.publicKey)
|
|
29
29
|
return null;
|
|
30
30
|
var walletPubkey = wallet.publicKey.toString();
|
|
31
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, transaction: transactionStr, amount: amount, blockchain: 'solana', webhookInfo: webhookInfo }));
|
|
31
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, transaction: transactionStr, amount: amount, blockchain: 'solana', webhookInfo: webhookInfo, email: email, loaderBackground: loaderBackground }));
|
|
32
32
|
}
|
|
33
33
|
function NearCoinflowPurchase(_a) {
|
|
34
|
-
var merchantId = _a.merchantId, amount = _a.amount, env = _a.env, onSuccess = _a.onSuccess, wallet = _a.wallet, action = _a.action, webhookInfo = _a.webhookInfo;
|
|
34
|
+
var merchantId = _a.merchantId, amount = _a.amount, env = _a.env, onSuccess = _a.onSuccess, wallet = _a.wallet, action = _a.action, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground;
|
|
35
35
|
var handlers = useNearIFrameMessageHandlers({ wallet: wallet });
|
|
36
36
|
var IFrameRef = useIframeWallet(handlers, onSuccess).IFrameRef;
|
|
37
37
|
var transaction = useMemo(function () {
|
|
@@ -39,6 +39,6 @@ function NearCoinflowPurchase(_a) {
|
|
|
39
39
|
? Buffer.from(JSON.stringify(action)).toString('base64')
|
|
40
40
|
: undefined;
|
|
41
41
|
}, [action]);
|
|
42
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: wallet.accountId, IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, amount: amount, blockchain: 'near', transaction: transaction, webhookInfo: webhookInfo }));
|
|
42
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: wallet.accountId, IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, amount: amount, blockchain: 'near', transaction: transaction, webhookInfo: webhookInfo, email: email, loaderBackground: loaderBackground }));
|
|
43
43
|
}
|
|
44
44
|
//# 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;AAErC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAC7E,OAAO,
|
|
1
|
+
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EACL,aAAa,GAGd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAkB,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,4BAA4B,EAAC,MAAM,6BAA6B,CAAC;AAiCzE,MAAM,UAAU,gBAAgB,CAC9B,KAA8D;IAE9D,OAAO,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE;QAClD,MAAM,EAAE,CACN,oBAAC,sBAAsB,eAAM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V,MAAM,YAAA,EACN,GAAG,SAAA,EACH,SAAS,eAAA,EACT,MAAM,YAAA,EACN,MAAM,YAAA,EACN,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,gBAAgB,sBAAA;IAEhB,IAAM,QAAQ,GAAG,4BAA4B,CAAC,EAAC,MAAM,QAAA,EAAC,CAAC,CAAC;IACjD,IAAA,SAAS,GAAI,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,UAAxC,CAAyC;IAEzD,IAAM,WAAW,GAAG,OAAO,CACzB;QACE,OAAA,MAAM;YACJ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACxD,CAAC,CAAC,SAAS;IAFb,CAEa,EACf,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,CACL,oBAAC,cAAc,IACb,YAAY,EAAE,MAAM,CAAC,SAAS,EAC9B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAa,UAAU,CAAE,EAChC,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps } from './
|
|
2
|
+
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps } from './CommonCoinflowProps';
|
|
3
3
|
export declare function CoinflowPurchaseHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps): JSX.Element;
|
|
@@ -12,7 +12,7 @@ export function CoinflowPurchaseHistory(props) {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
function SolanaPurchaseHistory(_a) {
|
|
15
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, connection = _a.connection, env = _a.env;
|
|
15
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, connection = _a.connection, env = _a.env, loaderBackground = _a.loaderBackground;
|
|
16
16
|
var handlers = useSolanaIFrameMessageHandlers({
|
|
17
17
|
wallet: wallet,
|
|
18
18
|
connection: connection
|
|
@@ -21,10 +21,10 @@ function SolanaPurchaseHistory(_a) {
|
|
|
21
21
|
if (!wallet.publicKey)
|
|
22
22
|
return null;
|
|
23
23
|
var walletPubkey = wallet.publicKey.toString();
|
|
24
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/purchase/".concat(merchantId), env: env, blockchain: 'solana' }));
|
|
24
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/purchase/".concat(merchantId), env: env, blockchain: 'solana', loaderBackground: loaderBackground }));
|
|
25
25
|
}
|
|
26
26
|
function NearPurchaseHistory(_a) {
|
|
27
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env;
|
|
27
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, loaderBackground = _a.loaderBackground;
|
|
28
28
|
var handlers = useNearIFrameMessageHandlers({
|
|
29
29
|
wallet: wallet
|
|
30
30
|
});
|
|
@@ -32,6 +32,6 @@ function NearPurchaseHistory(_a) {
|
|
|
32
32
|
if (!wallet)
|
|
33
33
|
return null;
|
|
34
34
|
var walletPubkey = wallet.accountId;
|
|
35
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/purchase/".concat(merchantId), env: env, blockchain: 'near' }));
|
|
35
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/purchase/".concat(merchantId), env: env, blockchain: 'near', loaderBackground: loaderBackground }));
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=CoinflowPurchaseHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAC,4BAA4B,EAAC,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAM9C,MAAM,UAAU,uBAAuB,CACrC,KAA4D;IAE5D,OAAO,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE;QAClD,MAAM,EAAE,CACN,oBAAC,qBAAqB,eAAM,KAAoC,EAAI,CACrE;QACD,IAAI,EAAE,oBAAC,mBAAmB,eAAM,KAAkC,EAAI;KACvE,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,EAMF;QAL3B,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,gBAAgB,sBAAA;IAEhB,IAAM,QAAQ,GAAG,8BAA8B,CAAC;QAC9C,MAAM,QAAA;QACN,UAAU,YAAA;KACX,CAAC,CAAC;IACI,IAAA,SAAS,GAAI,eAAe,CAAC,QAAQ,CAAC,UAA7B,CAA8B;IAE9C,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IACnC,IAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IAEjD,OAAO,CACL,oBAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,4BAAqB,UAAU,CAAE,EACxC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,QAAQ,EACpB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,EAKF;QAJzB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,gBAAgB,sBAAA;IAEhB,IAAM,QAAQ,GAAG,4BAA4B,CAAC;QAC5C,MAAM,QAAA;KACP,CAAC,CAAC;IACI,IAAA,SAAS,GAAI,eAAe,CAAC,QAAQ,CAAC,UAA7B,CAA8B;IAE9C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC;IAEtC,OAAO,CACL,oBAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,4BAAqB,UAAU,CAAE,EACxC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKey, Transaction } from '@solana/web3.js';
|
|
2
2
|
import { WalletContextState } from '@solana/wallet-adapter-react';
|
|
3
|
-
export type CoinflowBlockchain = 'solana' | 'near';
|
|
3
|
+
export type CoinflowBlockchain = 'solana' | 'near' | 'eth';
|
|
4
4
|
export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
|
|
5
5
|
export type SolanaWalletContextState = Pick<WalletContextState, 'wallet' | 'signTransaction' | 'signMessage' | 'connected' | 'publicKey' | 'sendTransaction'>;
|
|
6
6
|
export type NearWallet = {
|
|
@@ -29,6 +29,35 @@ export type NearWallet = {
|
|
|
29
29
|
receipts_outcome: any;
|
|
30
30
|
}>;
|
|
31
31
|
};
|
|
32
|
+
type Bytes = ArrayLike<number>;
|
|
33
|
+
type BytesLike = Bytes | string;
|
|
34
|
+
type AccessList = Array<{
|
|
35
|
+
address: string;
|
|
36
|
+
storageKeys: Array<string>;
|
|
37
|
+
}>;
|
|
38
|
+
type AccessListish = AccessList | Array<[string, Array<string>]> | Record<string, Array<string>>;
|
|
39
|
+
export type EthWallet = {
|
|
40
|
+
address: string | null | undefined;
|
|
41
|
+
signMessage: (message: string) => Promise<string>;
|
|
42
|
+
sendTransaction: (transaction: {
|
|
43
|
+
to: string;
|
|
44
|
+
from?: string;
|
|
45
|
+
nonce?: Bytes | bigint | string | number;
|
|
46
|
+
gasLimit?: Bytes | bigint | string | number;
|
|
47
|
+
gasPrice?: Bytes | bigint | string | number;
|
|
48
|
+
data?: BytesLike;
|
|
49
|
+
value?: Bytes | bigint | string | number;
|
|
50
|
+
chainId?: number;
|
|
51
|
+
type?: number;
|
|
52
|
+
accessList?: AccessListish;
|
|
53
|
+
maxPriorityFeePerGas?: Bytes | bigint | string | number;
|
|
54
|
+
maxFeePerGas?: Bytes | bigint | string | number;
|
|
55
|
+
customData?: Record<string, any>;
|
|
56
|
+
ccipReadEnabled?: boolean;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
hash: string;
|
|
59
|
+
}>;
|
|
60
|
+
};
|
|
32
61
|
export declare class CoinflowUtils {
|
|
33
62
|
env: CoinflowEnvs;
|
|
34
63
|
url: string;
|
|
@@ -36,7 +65,7 @@ export declare class CoinflowUtils {
|
|
|
36
65
|
getFeePayer(merchantId: string): Promise<PublicKey>;
|
|
37
66
|
getCreditBalance(publicKey: string, blockchain: 'solana' | 'near'): Promise<number>;
|
|
38
67
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
39
|
-
static getCoinflowUrl({ walletPubkey, route, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, }: {
|
|
68
|
+
static getCoinflowUrl({ walletPubkey, route, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, token, email, loaderBackground, }: {
|
|
40
69
|
walletPubkey: string;
|
|
41
70
|
route: string;
|
|
42
71
|
env?: CoinflowEnvs;
|
|
@@ -45,11 +74,16 @@ export declare class CoinflowUtils {
|
|
|
45
74
|
supportsVersionedTransactions?: boolean;
|
|
46
75
|
blockchain: CoinflowBlockchain;
|
|
47
76
|
webhookInfo?: object;
|
|
77
|
+
token?: string;
|
|
78
|
+
email?: string;
|
|
79
|
+
loaderBackground?: string;
|
|
48
80
|
}): string;
|
|
49
81
|
static serializeSolanaTransaction(transaction: Transaction | undefined): string | undefined;
|
|
50
82
|
static solanaWalletSupportsVersionedTransactions(wallet: SolanaWalletContextState): boolean;
|
|
51
83
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
52
84
|
solana: T;
|
|
53
85
|
near: T;
|
|
86
|
+
eth?: T;
|
|
54
87
|
}): T;
|
|
55
88
|
}
|
|
89
|
+
export {};
|
|
@@ -51,7 +51,7 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
51
51
|
return "https://".concat(env, ".coinflow.cash");
|
|
52
52
|
};
|
|
53
53
|
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
54
|
-
var walletPubkey = _a.walletPubkey, route = _a.route, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo;
|
|
54
|
+
var walletPubkey = _a.walletPubkey, route = _a.route, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground;
|
|
55
55
|
var url = new URL("/".concat(blockchain) + route, CoinflowUtils.getCoinflowBaseUrl(env));
|
|
56
56
|
url.searchParams.append('pubkey', walletPubkey);
|
|
57
57
|
if (transaction) {
|
|
@@ -66,6 +66,15 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
66
66
|
if (webhookInfo) {
|
|
67
67
|
url.searchParams.append('webhookInfo', Buffer.from(JSON.stringify(webhookInfo)).toString('base64'));
|
|
68
68
|
}
|
|
69
|
+
if (email) {
|
|
70
|
+
url.searchParams.append('email', email);
|
|
71
|
+
}
|
|
72
|
+
if (token) {
|
|
73
|
+
url.searchParams.append('token', token);
|
|
74
|
+
}
|
|
75
|
+
if (loaderBackground) {
|
|
76
|
+
url.searchParams.append('loaderBackground', loaderBackground);
|
|
77
|
+
}
|
|
69
78
|
return url.toString();
|
|
70
79
|
};
|
|
71
80
|
CoinflowUtils.serializeSolanaTransaction = function (transaction) {
|
|
@@ -86,6 +95,10 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
86
95
|
return args.solana;
|
|
87
96
|
case 'near':
|
|
88
97
|
return args.near;
|
|
98
|
+
case 'eth':
|
|
99
|
+
if (args.eth === undefined)
|
|
100
|
+
throw new Error('blockchain not supported for this operation!');
|
|
101
|
+
return args.eth;
|
|
89
102
|
default:
|
|
90
103
|
throw new Error('blockchain not supported!');
|
|
91
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAEvD,OAAO,MAAM,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAEvD,OAAO,MAAM,MAAM,MAAM,CAAC;AAyE1B;IAIE,uBAAY,GAAkB;QAC5B,IAAI,CAAC,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IACxB,CAAC;IAEM,wCAA0B,GAAjC,UACE,WAAoC;QAEpC,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QAEnC,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,SAAS,CAAC;YACpB,oBAAoB,EAAE,KAAK;YAC3B,gBAAgB,EAAE,KAAK;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,uDAAyC,GAAhD,UACE,MAAgC;;QAEhC,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,0CAAE,4BAA4B,0CAAE,GAAG,CAAC,CAAC,CAAC,CAAA,CAAC;IACxE,CAAC;IAEM,0BAAY,GAAnB,UACE,UAA8B,EAC9B,IAAmC;QAEnC,QAAQ,UAAU,EAAE;YAClB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;oBACxB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBAClE,OAAO,IAAI,CAAC,GAAG,CAAC;YAClB;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAvID,IAuIC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Connection } from '@solana/web3.js';
|
|
3
|
-
import {
|
|
3
|
+
import { EthWallet, NearWallet, SolanaWalletContextState } from './CoinflowUtils';
|
|
4
4
|
import { OnSuccessMethod } from './useIframeWallet';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
env?: CoinflowEnvs;
|
|
5
|
+
import { CommonCoinflowProps } from './CommonCoinflowProps';
|
|
6
|
+
export interface CoinflowCommonWithdrawProps extends CommonCoinflowProps {
|
|
8
7
|
onSuccess?: OnSuccessMethod;
|
|
9
|
-
|
|
8
|
+
token?: string;
|
|
9
|
+
amount?: number;
|
|
10
|
+
email?: string;
|
|
10
11
|
}
|
|
11
12
|
export interface CoinflowSolanaWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
12
13
|
wallet: SolanaWalletContextState;
|
|
@@ -17,4 +18,8 @@ export interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
|
17
18
|
wallet: NearWallet;
|
|
18
19
|
blockchain: 'near';
|
|
19
20
|
}
|
|
20
|
-
export
|
|
21
|
+
export interface CoinflowEthWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
22
|
+
wallet: EthWallet;
|
|
23
|
+
blockchain: 'eth';
|
|
24
|
+
}
|
|
25
|
+
export declare function CoinflowWithdraw(props: CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps): JSX.Element;
|
|
@@ -5,14 +5,16 @@ import { CoinflowUtils, } from './CoinflowUtils';
|
|
|
5
5
|
import { useIframeWallet } from './useIframeWallet';
|
|
6
6
|
import { useSolanaIFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
7
7
|
import { useNearIFrameMessageHandlers } from './NearIFrameMessageHandlers';
|
|
8
|
+
import { useEthIFrameMessageHandlers } from './EthIFrameMessageHandlers';
|
|
8
9
|
export function CoinflowWithdraw(props) {
|
|
9
10
|
return CoinflowUtils.byBlockchain(props.blockchain, {
|
|
10
11
|
solana: (React.createElement(CoinflowSolanaWithdraw, __assign({}, props))),
|
|
11
|
-
near: React.createElement(CoinflowNearWithdraw, __assign({}, props))
|
|
12
|
+
near: React.createElement(CoinflowNearWithdraw, __assign({}, props)),
|
|
13
|
+
eth: React.createElement(CoinflowEthWithdraw, __assign({}, props))
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
function CoinflowSolanaWithdraw(_a) {
|
|
15
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess;
|
|
17
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess, email = _a.email, token = _a.token, amount = _a.amount, loaderBackground = _a.loaderBackground;
|
|
16
18
|
var handlers = useSolanaIFrameMessageHandlers({
|
|
17
19
|
wallet: wallet,
|
|
18
20
|
connection: connection
|
|
@@ -21,10 +23,10 @@ function CoinflowSolanaWithdraw(_a) {
|
|
|
21
23
|
if (!wallet.publicKey)
|
|
22
24
|
return null;
|
|
23
25
|
var walletPubkey = wallet.publicKey.toString();
|
|
24
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env, blockchain: 'solana' }));
|
|
26
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env, blockchain: 'solana', email: email, token: token, amount: amount, loaderBackground: loaderBackground }));
|
|
25
27
|
}
|
|
26
28
|
function CoinflowNearWithdraw(_a) {
|
|
27
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, onSuccess = _a.onSuccess;
|
|
29
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, onSuccess = _a.onSuccess, email = _a.email, token = _a.token, amount = _a.amount, loaderBackground = _a.loaderBackground;
|
|
28
30
|
var handlers = useNearIFrameMessageHandlers({
|
|
29
31
|
wallet: wallet
|
|
30
32
|
});
|
|
@@ -32,6 +34,17 @@ function CoinflowNearWithdraw(_a) {
|
|
|
32
34
|
if (!wallet)
|
|
33
35
|
return null;
|
|
34
36
|
var walletPubkey = wallet.accountId;
|
|
35
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env, blockchain: 'near' }));
|
|
37
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env, blockchain: 'near', token: token, amount: amount, email: email, loaderBackground: loaderBackground }));
|
|
38
|
+
}
|
|
39
|
+
function CoinflowEthWithdraw(_a) {
|
|
40
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, onSuccess = _a.onSuccess, email = _a.email, token = _a.token, amount = _a.amount, loaderBackground = _a.loaderBackground;
|
|
41
|
+
var handlers = useEthIFrameMessageHandlers({
|
|
42
|
+
wallet: wallet
|
|
43
|
+
});
|
|
44
|
+
var IFrameRef = useIframeWallet(handlers, onSuccess).IFrameRef;
|
|
45
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
46
|
+
return null;
|
|
47
|
+
var walletPubkey = wallet.address;
|
|
48
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env, blockchain: 'eth', token: token, amount: amount, email: email, loaderBackground: loaderBackground }));
|
|
36
49
|
}
|
|
37
50
|
//# sourceMappingURL=CoinflowWithdraw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,aAAa,GAId,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAkB,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAC,4BAA4B,EA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ChC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,KAAK,EACjB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface CoinflowHistoryProps {
|
|
5
|
-
merchantId: string;
|
|
6
|
-
env?: CoinflowEnvs;
|
|
7
|
-
blockchain: CoinflowBlockchain;
|
|
8
|
-
}
|
|
9
|
-
export interface CoinflowSolanaHistoryProps extends CoinflowHistoryProps {
|
|
10
|
-
wallet: SolanaWalletContextState;
|
|
11
|
-
connection: Connection;
|
|
12
|
-
blockchain: 'solana';
|
|
13
|
-
}
|
|
14
|
-
export interface CoinflowNearHistoryProps extends CoinflowHistoryProps {
|
|
15
|
-
wallet: NearWallet;
|
|
16
|
-
blockchain: 'near';
|
|
17
|
-
}
|
|
18
|
-
export declare function CoinflowWithdrawHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps): JSX.Element;
|
|
2
|
+
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps, CoinflowEthHistoryProps } from './CommonCoinflowProps';
|
|
3
|
+
export declare function CoinflowWithdrawHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowEthHistoryProps): JSX.Element;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { CoinflowUtils
|
|
2
|
+
import { CoinflowUtils } from './CoinflowUtils';
|
|
3
3
|
import { useIframeWallet } from './useIframeWallet';
|
|
4
4
|
import { CoinflowIFrame } from './CoinflowIFrame';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useSolanaIFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
7
7
|
import { useNearIFrameMessageHandlers } from './NearIFrameMessageHandlers';
|
|
8
|
+
import { useEthIFrameMessageHandlers } from './EthIFrameMessageHandlers';
|
|
8
9
|
export function CoinflowWithdrawHistory(props) {
|
|
9
10
|
return CoinflowUtils.byBlockchain(props.blockchain, {
|
|
10
11
|
solana: (React.createElement(SolanaWithdrawHistory, __assign({}, props))),
|
|
11
|
-
near: React.createElement(NearWithdrawHistory, __assign({}, props))
|
|
12
|
+
near: React.createElement(NearWithdrawHistory, __assign({}, props)),
|
|
13
|
+
eth: React.createElement(EthWithdrawHistory, __assign({}, props))
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
function SolanaWithdrawHistory(_a) {
|
|
15
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, connection = _a.connection, env = _a.env;
|
|
17
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, connection = _a.connection, env = _a.env, loaderBackground = _a.loaderBackground;
|
|
16
18
|
var handlers = useSolanaIFrameMessageHandlers({
|
|
17
19
|
wallet: wallet,
|
|
18
20
|
connection: connection
|
|
@@ -21,10 +23,10 @@ function SolanaWithdrawHistory(_a) {
|
|
|
21
23
|
if (!wallet.publicKey)
|
|
22
24
|
return null;
|
|
23
25
|
var walletPubkey = wallet.publicKey.toString();
|
|
24
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(merchantId), env: env, blockchain: 'solana' }));
|
|
26
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(merchantId), env: env, blockchain: 'solana', loaderBackground: loaderBackground }));
|
|
25
27
|
}
|
|
26
28
|
function NearWithdrawHistory(_a) {
|
|
27
|
-
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env;
|
|
29
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, loaderBackground = _a.loaderBackground;
|
|
28
30
|
var handlers = useNearIFrameMessageHandlers({
|
|
29
31
|
wallet: wallet
|
|
30
32
|
});
|
|
@@ -32,6 +34,16 @@ function NearWithdrawHistory(_a) {
|
|
|
32
34
|
if (!wallet)
|
|
33
35
|
return null;
|
|
34
36
|
var walletPubkey = wallet.accountId;
|
|
35
|
-
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(merchantId), env: env, blockchain: 'near' }));
|
|
37
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(merchantId), env: env, blockchain: 'near', loaderBackground: loaderBackground }));
|
|
38
|
+
}
|
|
39
|
+
function EthWithdrawHistory(_a) {
|
|
40
|
+
var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, loaderBackground = _a.loaderBackground;
|
|
41
|
+
var handlers = useEthIFrameMessageHandlers({
|
|
42
|
+
wallet: wallet
|
|
43
|
+
});
|
|
44
|
+
var IFrameRef = useIframeWallet(handlers).IFrameRef;
|
|
45
|
+
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
46
|
+
return null;
|
|
47
|
+
return (React.createElement(CoinflowIFrame, { walletPubkey: wallet.address, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(merchantId), env: env, blockchain: 'eth', loaderBackground: loaderBackground }));
|
|
36
48
|
}
|
|
37
49
|
//# sourceMappingURL=CoinflowWithdrawHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowWithdrawHistory.js","sourceRoot":"","sources":["../../src/CoinflowWithdrawHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CoinflowWithdrawHistory.js","sourceRoot":"","sources":["../../src/CoinflowWithdrawHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,kB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,gBAAgB,sBAAA;IAEhB,IAAM,QAAQ,GAAG,4BAA4B,CAAC;QAC5C,MAAM,QAAA;KACP,CAAC,CAAC;IACI,IAAA,SAAS,GAAI,eAAe,CAAC,QAAQ,CAAC,UAA7B,CAA8B;IAE9C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC;IAEtC,OAAO,CACL,oBAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,4BAAqB,UAAU,CAAE,EACxC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,EAKF;QAJxB,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,gBAAgB,sBAAA;IAEhB,IAAM,QAAQ,GAAG,2BAA2B,CAAC;QAC3C,MAAM,QAAA;KACP,CAAC,CAAC;IACI,IAAA,SAAS,GAAI,eAAe,CAAC,QAAQ,CAAC,UAA7B,CAA8B;IAE9C,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAA;QAAE,OAAO,IAAI,CAAC;IAElC,OAAO,CACL,oBAAC,cAAc,IACb,YAAY,EAAE,MAAM,CAAC,OAAO,EAC5B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,4BAAqB,UAAU,CAAE,EACxC,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,KAAK,EACjB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CoinflowBlockchain, CoinflowEnvs, EthWallet, NearWallet, SolanaWalletContextState } from './CoinflowUtils';
|
|
2
|
+
import { Connection } from '@solana/web3.js';
|
|
3
|
+
export interface CommonCoinflowProps {
|
|
4
|
+
merchantId: string;
|
|
5
|
+
env?: CoinflowEnvs;
|
|
6
|
+
loaderBackground?: string;
|
|
7
|
+
blockchain: CoinflowBlockchain;
|
|
8
|
+
}
|
|
9
|
+
export interface CoinflowSolanaHistoryProps extends CommonCoinflowProps {
|
|
10
|
+
wallet: SolanaWalletContextState;
|
|
11
|
+
connection: Connection;
|
|
12
|
+
blockchain: 'solana';
|
|
13
|
+
}
|
|
14
|
+
export interface CoinflowNearHistoryProps extends CommonCoinflowProps {
|
|
15
|
+
wallet: NearWallet;
|
|
16
|
+
blockchain: 'near';
|
|
17
|
+
}
|
|
18
|
+
export interface CoinflowEthHistoryProps extends CommonCoinflowProps {
|
|
19
|
+
wallet: EthWallet;
|
|
20
|
+
blockchain: 'eth';
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonCoinflowProps.js","sourceRoot":"","sources":["../../src/CommonCoinflowProps.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
export function useEthIFrameMessageHandlers(_a) {
|
|
4
|
+
var _this = this;
|
|
5
|
+
var wallet = _a.wallet;
|
|
6
|
+
var handleSignMessage = useCallback(function (_a) {
|
|
7
|
+
var message = _a.data;
|
|
8
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
9
|
+
var signedMessage;
|
|
10
|
+
return __generator(this, function (_b) {
|
|
11
|
+
switch (_b.label) {
|
|
12
|
+
case 0: return [4 /*yield*/, wallet.signMessage(message)];
|
|
13
|
+
case 1:
|
|
14
|
+
signedMessage = _b.sent();
|
|
15
|
+
if (!signedMessage)
|
|
16
|
+
throw new Error('Wallet did not sign');
|
|
17
|
+
return [2 /*return*/, signedMessage];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}, [wallet]);
|
|
22
|
+
var handleSendTransaction = useCallback(function (_a) {
|
|
23
|
+
var data = _a.data;
|
|
24
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
25
|
+
var transaction, hash;
|
|
26
|
+
return __generator(this, function (_b) {
|
|
27
|
+
switch (_b.label) {
|
|
28
|
+
case 0:
|
|
29
|
+
transaction = JSON.parse(Buffer.from(data, 'base64').toString());
|
|
30
|
+
return [4 /*yield*/, wallet.sendTransaction(transaction)];
|
|
31
|
+
case 1:
|
|
32
|
+
hash = (_b.sent()).hash;
|
|
33
|
+
return [2 /*return*/, hash];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}, [wallet]);
|
|
38
|
+
return {
|
|
39
|
+
handleSendTransaction: handleSendTransaction,
|
|
40
|
+
handleSignMessage: handleSignMessage
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=EthIFrameMessageHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthIFrameMessageHandlers.js","sourceRoot":"","sources":["../../src/EthIFrameMessageHandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,OAAO,CAAC;AAIlC,MAAM,UAAU,2BAA2B,CAAC,EAI3C;IAJD,iBA2BC;QA1BC,MAAM,YAAA;IAIN,IAAM,iBAAiB,GAAG,WAAW,CACnC,UAAO,EAA2B;YAApB,OAAO,UAAA;;;;;4BACG,qBAAM,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAA;;wBAAjD,aAAa,GAAG,SAAiC;wBACvD,IAAI,CAAC,aAAa;4BAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;wBAC3D,sBAAO,aAAa,EAAC;;;;KACtB,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,IAAM,qBAAqB,GAAG,WAAW,CACvC,UAAO,EAAkB;YAAjB,IAAI,UAAA;;;;;;wBACJ,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACxD,qBAAM,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,EAAA;;wBAAjD,IAAI,GAAI,CAAA,SAAyC,CAAA,KAA7C;wBACX,sBAAO,IAAI,EAAC;;;;KACb,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO;QACL,qBAAqB,uBAAA;QACrB,iBAAiB,mBAAA;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -13,7 +13,7 @@ export function useSolanaIFrameMessageHandlers(_a) {
|
|
|
13
13
|
switch (_b.label) {
|
|
14
14
|
case 0:
|
|
15
15
|
if (!wallet.signMessage)
|
|
16
|
-
throw new Error('Wallet does not support message signing');
|
|
16
|
+
throw new Error('Wallet does not support message signing');
|
|
17
17
|
return [4 /*yield*/, wallet.signMessage(base58.decode(data))];
|
|
18
18
|
case 1:
|
|
19
19
|
signature = _b.sent();
|