@coinflowlabs/react 4.0.0 → 4.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.
- package/README.md +7 -0
- package/build/cjs/CoinflowApplePayButton.d.ts +3 -5
- package/build/cjs/CoinflowApplePayButton.js +42 -37
- package/build/cjs/CoinflowApplePayButton.js.map +1 -1
- package/build/cjs/CoinflowCardForm.d.ts +2 -2
- package/build/cjs/CoinflowCardForm.js +35 -38
- package/build/cjs/CoinflowCardForm.js.map +1 -1
- package/build/cjs/CoinflowGooglePayButton.d.ts +1 -1
- package/build/cjs/CoinflowIFrame.d.ts +7 -2
- package/build/cjs/CoinflowIFrame.js +65 -6
- package/build/cjs/CoinflowIFrame.js.map +1 -1
- package/build/cjs/CoinflowPurchase.d.ts +2 -3
- package/build/cjs/CoinflowPurchase.js +11 -66
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.d.ts +2 -2
- package/build/cjs/CoinflowPurchaseHistory.js +10 -41
- package/build/cjs/CoinflowPurchaseHistory.js.map +1 -1
- package/build/cjs/CoinflowPurchaseProtection.d.ts +1 -1
- package/build/cjs/CoinflowPurchaseProtection.js +2 -2
- package/build/cjs/CoinflowPurchaseProtection.js.map +1 -1
- package/build/cjs/CoinflowWithdraw.d.ts +3 -3
- package/build/cjs/CoinflowWithdraw.js +11 -44
- package/build/cjs/CoinflowWithdraw.js.map +1 -1
- package/build/cjs/CoinflowWithdrawHistory.d.ts +3 -3
- package/build/cjs/CoinflowWithdrawHistory.js +10 -42
- package/build/cjs/CoinflowWithdrawHistory.js.map +1 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.d.ts +21 -0
- package/build/cjs/common/CoinflowLibMessageHandlers.js +186 -0
- package/build/cjs/common/CoinflowLibMessageHandlers.js.map +1 -0
- package/build/cjs/{CoinflowTypes.d.ts → common/CoinflowTypes.d.ts} +56 -47
- package/build/cjs/{CoinflowTypes.js → common/CoinflowTypes.js} +3 -2
- package/build/cjs/common/CoinflowTypes.js.map +1 -0
- package/build/cjs/common/CoinflowUtils.d.ts +21 -0
- package/build/cjs/{CoinflowUtils.js → common/CoinflowUtils.js} +43 -22
- package/build/cjs/common/CoinflowUtils.js.map +1 -0
- package/build/cjs/common/SolanaPeerDeps.d.ts +5 -0
- package/build/cjs/common/SolanaPeerDeps.js +22 -0
- package/build/cjs/common/SolanaPeerDeps.js.map +1 -0
- package/build/cjs/common/index.d.ts +3 -0
- package/build/cjs/common/index.js +7 -0
- package/build/cjs/common/index.js.map +1 -0
- package/build/cjs/index.d.ts +1 -3
- package/build/cjs/index.js +1 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/CoinflowApplePayButton.d.ts +3 -5
- package/build/esm/CoinflowApplePayButton.js +42 -35
- package/build/esm/CoinflowApplePayButton.js.map +1 -1
- package/build/esm/CoinflowCardForm.d.ts +2 -2
- package/build/esm/CoinflowCardForm.js +37 -40
- package/build/esm/CoinflowCardForm.js.map +1 -1
- package/build/esm/CoinflowGooglePayButton.d.ts +1 -1
- package/build/esm/CoinflowIFrame.d.ts +7 -2
- package/build/esm/CoinflowIFrame.js +66 -5
- package/build/esm/CoinflowIFrame.js.map +1 -1
- package/build/esm/CoinflowPurchase.d.ts +2 -3
- package/build/esm/CoinflowPurchase.js +10 -64
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.d.ts +2 -2
- package/build/esm/CoinflowPurchaseHistory.js +10 -41
- package/build/esm/CoinflowPurchaseHistory.js.map +1 -1
- package/build/esm/CoinflowPurchaseProtection.d.ts +1 -1
- package/build/esm/CoinflowPurchaseProtection.js +1 -1
- package/build/esm/CoinflowPurchaseProtection.js.map +1 -1
- package/build/esm/CoinflowWithdraw.d.ts +3 -3
- package/build/esm/CoinflowWithdraw.js +11 -44
- package/build/esm/CoinflowWithdraw.js.map +1 -1
- package/build/esm/CoinflowWithdrawHistory.d.ts +3 -3
- package/build/esm/CoinflowWithdrawHistory.js +10 -42
- package/build/esm/CoinflowWithdrawHistory.js.map +1 -1
- package/build/esm/common/CoinflowLibMessageHandlers.d.ts +21 -0
- package/build/esm/common/CoinflowLibMessageHandlers.js +180 -0
- package/build/esm/common/CoinflowLibMessageHandlers.js.map +1 -0
- package/build/esm/{CoinflowTypes.d.ts → common/CoinflowTypes.d.ts} +56 -47
- package/build/esm/{CoinflowTypes.js → common/CoinflowTypes.js} +2 -3
- package/build/esm/common/CoinflowTypes.js.map +1 -0
- package/build/esm/common/CoinflowUtils.d.ts +21 -0
- package/build/esm/{CoinflowUtils.js → common/CoinflowUtils.js} +43 -22
- package/build/esm/common/CoinflowUtils.js.map +1 -0
- package/build/esm/common/SolanaPeerDeps.d.ts +5 -0
- package/build/esm/common/SolanaPeerDeps.js +17 -0
- package/build/esm/common/SolanaPeerDeps.js.map +1 -0
- package/build/esm/common/index.d.ts +3 -0
- package/build/esm/common/index.js +4 -0
- package/build/esm/common/index.js.map +1 -0
- package/build/esm/index.d.ts +1 -3
- package/build/esm/index.js +1 -3
- package/build/esm/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -10
- package/build/cjs/CoinflowTypes.js.map +0 -1
- package/build/cjs/CoinflowUtils.d.ts +0 -21
- package/build/cjs/CoinflowUtils.js.map +0 -1
- package/build/cjs/useHandleHeightChange.d.ts +0 -2
- package/build/cjs/useHandleHeightChange.js +0 -24
- package/build/cjs/useHandleHeightChange.js.map +0 -1
- package/build/cjs/wallet/EthIFrameMessageHandlers.d.ts +0 -5
- package/build/cjs/wallet/EthIFrameMessageHandlers.js +0 -42
- package/build/cjs/wallet/EthIFrameMessageHandlers.js.map +0 -1
- package/build/cjs/wallet/NearIFrameMessageHandlers.d.ts +0 -5
- package/build/cjs/wallet/NearIFrameMessageHandlers.js +0 -31
- package/build/cjs/wallet/NearIFrameMessageHandlers.js.map +0 -1
- package/build/cjs/wallet/SocketService.d.ts +0 -5
- package/build/cjs/wallet/SocketService.js +0 -43
- package/build/cjs/wallet/SocketService.js.map +0 -1
- package/build/cjs/wallet/SolanaIFrameMessageHandlers.d.ts +0 -19
- package/build/cjs/wallet/SolanaIFrameMessageHandlers.js +0 -132
- package/build/cjs/wallet/SolanaIFrameMessageHandlers.js.map +0 -1
- package/build/cjs/wallet/useIframeWallet.d.ts +0 -15
- package/build/cjs/wallet/useIframeWallet.js +0 -137
- package/build/cjs/wallet/useIframeWallet.js.map +0 -1
- package/build/esm/CoinflowTypes.js.map +0 -1
- package/build/esm/CoinflowUtils.d.ts +0 -21
- package/build/esm/CoinflowUtils.js.map +0 -1
- package/build/esm/useHandleHeightChange.d.ts +0 -2
- package/build/esm/useHandleHeightChange.js +0 -19
- package/build/esm/useHandleHeightChange.js.map +0 -1
- package/build/esm/wallet/EthIFrameMessageHandlers.d.ts +0 -5
- package/build/esm/wallet/EthIFrameMessageHandlers.js +0 -38
- package/build/esm/wallet/EthIFrameMessageHandlers.js.map +0 -1
- package/build/esm/wallet/NearIFrameMessageHandlers.d.ts +0 -5
- package/build/esm/wallet/NearIFrameMessageHandlers.js +0 -27
- package/build/esm/wallet/NearIFrameMessageHandlers.js.map +0 -1
- package/build/esm/wallet/SocketService.d.ts +0 -5
- package/build/esm/wallet/SocketService.js +0 -35
- package/build/esm/wallet/SocketService.js.map +0 -1
- package/build/esm/wallet/SolanaIFrameMessageHandlers.d.ts +0 -19
- package/build/esm/wallet/SolanaIFrameMessageHandlers.js +0 -128
- package/build/esm/wallet/SolanaIFrameMessageHandlers.js.map +0 -1
- package/build/esm/wallet/useIframeWallet.d.ts +0 -15
- package/build/esm/wallet/useIframeWallet.js +0 -131
- package/build/esm/wallet/useIframeWallet.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoinflowPurchaseProtection = void 0;
|
|
4
4
|
var react_1 = require("react");
|
|
5
|
-
var
|
|
5
|
+
var common_1 = require("./common");
|
|
6
6
|
function CoinflowPurchaseProtection(_a) {
|
|
7
7
|
var coinflowEnv = _a.coinflowEnv, merchantId = _a.merchantId;
|
|
8
8
|
var sdkUrl = (0, react_1.useMemo)(function () {
|
|
@@ -15,7 +15,7 @@ function CoinflowPurchaseProtection(_a) {
|
|
|
15
15
|
}, [coinflowEnv]);
|
|
16
16
|
var _b = (0, react_1.useState)(undefined), partnerId = _b[0], setPartnerId = _b[1];
|
|
17
17
|
(0, react_1.useEffect)(function () {
|
|
18
|
-
new
|
|
18
|
+
new common_1.CoinflowUtils(coinflowEnv)
|
|
19
19
|
.getNSurePartnerId(merchantId)
|
|
20
20
|
.then(function (partnerId) { return setPartnerId(partnerId); });
|
|
21
21
|
}, [coinflowEnv, merchantId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseProtection.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseProtection.tsx"],"names":[],"mappings":";;;AAAA,+BAAmD;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchaseProtection.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseProtection.tsx"],"names":[],"mappings":";;;AAAA,+BAAmD;AACnD,mCAAqD;AAErD,SAAgB,0BAA0B,CAAC,EAM1C;QALC,WAAW,iBAAA,EACX,UAAU,gBAAA;IAKV,IAAM,MAAM,GAAG,IAAA,eAAO,EACpB;QACE,OAAA,WAAW,KAAK,MAAM;YACpB,CAAC,CAAC,iCAAiC;YACnC,CAAC,CAAC,yCAAyC;IAF7C,CAE6C,EAC/C,CAAC,WAAW,CAAC,CACd,CAAC;IACF,IAAM,aAAa,GAAG,IAAA,eAAO,EAC3B;QACE,OAAA,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,0BAA0B;IAAxE,CAAwE,EAC1E,CAAC,WAAW,CAAC,CACd,CAAC;IAEI,IAAA,KAA4B,IAAA,gBAAQ,EAAqB,SAAS,CAAC,EAAlE,SAAS,QAAA,EAAE,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w(
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CoinflowWithdrawProps } from "./common";
|
|
3
|
+
export declare function CoinflowWithdraw(withdrawProps: CoinflowWithdrawProps): React.JSX.Element;
|
|
@@ -2,51 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoinflowWithdraw = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = tslib_1.
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
var CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
polygon: (react_1.default.createElement(CoinflowEthWithdraw, tslib_1.__assign({}, props))),
|
|
18
|
-
});
|
|
7
|
+
var common_1 = require("./common");
|
|
8
|
+
function CoinflowWithdraw(withdrawProps) {
|
|
9
|
+
var iframeProps = (0, react_1.useMemo)(function () {
|
|
10
|
+
var walletPubkey = (0, common_1.getWalletPubkey)(withdrawProps);
|
|
11
|
+
return tslib_1.__assign(tslib_1.__assign({}, withdrawProps), { walletPubkey: walletPubkey, route: "/withdraw/".concat(withdrawProps.merchantId), transaction: undefined });
|
|
12
|
+
}, [withdrawProps]);
|
|
13
|
+
var messageHandlers = (0, react_1.useMemo)(function () {
|
|
14
|
+
return tslib_1.__assign(tslib_1.__assign({}, (0, common_1.getHandlers)(withdrawProps)), { handleHeightChange: withdrawProps.handleHeightChange });
|
|
15
|
+
}, [withdrawProps]);
|
|
16
|
+
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps, messageHandlers));
|
|
19
17
|
}
|
|
20
18
|
exports.CoinflowWithdraw = CoinflowWithdraw;
|
|
21
|
-
function CoinflowSolanaWithdraw(props) {
|
|
22
|
-
var _a;
|
|
23
|
-
var handlers = (0, SolanaIFrameMessageHandlers_1.useSolanaIFrameMessageHandlers)(props);
|
|
24
|
-
var wallet = props.wallet;
|
|
25
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, (_a = wallet.publicKey) === null || _a === void 0 ? void 0 : _a.toString()).IFrameRef;
|
|
26
|
-
if (!wallet.publicKey)
|
|
27
|
-
return null;
|
|
28
|
-
var walletPubkey = wallet.publicKey.toString();
|
|
29
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId), supportsVersionedTransactions: props.supportsVersionedTransactions !== false });
|
|
30
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
31
|
-
}
|
|
32
|
-
function CoinflowNearWithdraw(props) {
|
|
33
|
-
var handlers = (0, NearIFrameMessageHandlers_1.useNearIFrameMessageHandlers)(props);
|
|
34
|
-
var wallet = props.wallet;
|
|
35
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.accountId).IFrameRef;
|
|
36
|
-
if (!wallet)
|
|
37
|
-
return null;
|
|
38
|
-
var walletPubkey = wallet.accountId;
|
|
39
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId) });
|
|
40
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
41
|
-
}
|
|
42
|
-
function CoinflowEthWithdraw(props) {
|
|
43
|
-
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
44
|
-
var wallet = props.wallet;
|
|
45
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.address).IFrameRef;
|
|
46
|
-
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
47
|
-
return null;
|
|
48
|
-
var walletPubkey = wallet.address;
|
|
49
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId) });
|
|
50
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
51
|
-
}
|
|
52
19
|
//# sourceMappingURL=CoinflowWithdraw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":";;;;AAAA,qDAAuC;AACvC,mDAAgD;AAChD,mCAMkB;AAElB,SAAgB,gBAAgB,CAC9B,aAAoC;IAEpC,IAAM,WAAW,GAAG,IAAA,eAAO,EAAsB;QAC/C,IAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAC;QACpD,6CACK,aAAa,KAChB,YAAY,cAAA,EACZ,KAAK,EAAE,oBAAa,aAAa,CAAC,UAAU,CAAE,EAC9C,WAAW,EAAE,SAAS,IACtB;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,IAAM,eAAe,GAAG,IAAA,eAAO,EAAwB;QACrD,6CACK,IAAA,oBAAW,EAAC,aAAa,CAAC,KAC7B,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,IACpD;IACJ,CAAC,EAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAErB,OAAO,8BAAC,+BAAc,uBAAK,WAAW,EAAO,eAAe,EAAI,CAAC;AACnE,CAAC;AArBD,4CAqBC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps, CoinflowEthHistoryProps, CoinflowPolygonHistoryProps } from
|
|
3
|
-
export declare function CoinflowWithdrawHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowEthHistoryProps | CoinflowPolygonHistoryProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps, CoinflowEthHistoryProps, CoinflowPolygonHistoryProps, CoinflowBaseHistoryProps } from "./common";
|
|
3
|
+
export declare function CoinflowWithdrawHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowEthHistoryProps | CoinflowPolygonHistoryProps | CoinflowBaseHistoryProps): React.JSX.Element;
|
|
@@ -2,50 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoinflowWithdrawHistory = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var CoinflowUtils_1 = require("./CoinflowUtils");
|
|
6
|
-
var useIframeWallet_1 = require("./wallet/useIframeWallet");
|
|
7
5
|
var CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
8
|
-
var react_1 = tslib_1.
|
|
9
|
-
var
|
|
10
|
-
var NearIFrameMessageHandlers_1 = require("./wallet/NearIFrameMessageHandlers");
|
|
11
|
-
var EthIFrameMessageHandlers_1 = require("./wallet/EthIFrameMessageHandlers");
|
|
6
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var common_1 = require("./common");
|
|
12
8
|
function CoinflowWithdrawHistory(props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
var iframeProps = (0, react_1.useMemo)(function () {
|
|
10
|
+
var walletPubkey = (0, common_1.getWalletPubkey)(props);
|
|
11
|
+
return tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, route: "/history/withdraw/".concat(props.merchantId), transaction: undefined });
|
|
12
|
+
}, [props]);
|
|
13
|
+
var messageHandlers = (0, react_1.useMemo)(function () {
|
|
14
|
+
return tslib_1.__assign(tslib_1.__assign({}, (0, common_1.getHandlers)(props)), { handleHeightChange: props.handleHeightChange });
|
|
15
|
+
}, [props]);
|
|
16
|
+
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps, messageHandlers));
|
|
19
17
|
}
|
|
20
18
|
exports.CoinflowWithdrawHistory = CoinflowWithdrawHistory;
|
|
21
|
-
function SolanaWithdrawHistory(props) {
|
|
22
|
-
var _a;
|
|
23
|
-
var handlers = (0, SolanaIFrameMessageHandlers_1.useSolanaIFrameMessageHandlers)(props);
|
|
24
|
-
var wallet = props.wallet;
|
|
25
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, (_a = wallet.publicKey) === null || _a === void 0 ? void 0 : _a.toString()).IFrameRef;
|
|
26
|
-
if (!wallet.publicKey)
|
|
27
|
-
return null;
|
|
28
|
-
var walletPubkey = wallet.publicKey.toString();
|
|
29
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
30
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
31
|
-
}
|
|
32
|
-
function NearWithdrawHistory(props) {
|
|
33
|
-
var handlers = (0, NearIFrameMessageHandlers_1.useNearIFrameMessageHandlers)(props);
|
|
34
|
-
var wallet = props.wallet;
|
|
35
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.accountId).IFrameRef;
|
|
36
|
-
if (!wallet)
|
|
37
|
-
return null;
|
|
38
|
-
var walletPubkey = wallet.accountId;
|
|
39
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
40
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
41
|
-
}
|
|
42
|
-
function EthWithdrawHistory(props) {
|
|
43
|
-
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
44
|
-
var wallet = props.wallet;
|
|
45
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.address).IFrameRef;
|
|
46
|
-
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
47
|
-
return null;
|
|
48
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: wallet.address, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
49
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
50
|
-
}
|
|
51
19
|
//# sourceMappingURL=CoinflowWithdrawHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowWithdrawHistory.js","sourceRoot":"","sources":["../../src/CoinflowWithdrawHistory.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"CoinflowWithdrawHistory.js","sourceRoot":"","sources":["../../src/CoinflowWithdrawHistory.tsx"],"names":[],"mappings":";;;;AAAA,mDAAgD;AAChD,qDAAuC;AACvC,mCAUkB;AAElB,SAAgB,uBAAuB,CACrC,KAK4B;IAE5B,IAAM,WAAW,GAAG,IAAA,eAAO,EAAsB;QAC/C,IAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC;QAC5C,6CACK,KAAK,KACR,YAAY,cAAA,EACZ,KAAK,EAAE,4BAAqB,KAAK,CAAC,UAAU,CAAE,EAC9C,WAAW,EAAE,SAAS,IACtB;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAM,eAAe,GAAG,IAAA,eAAO,EAAwB;QACrD,6CACK,IAAA,oBAAW,EAAC,KAAK,CAAC,KACrB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,IAC5C;IACJ,CAAC,EAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAEb,OAAO,8BAAC,+BAAc,uBAAK,WAAW,EAAO,eAAe,EAAI,CAAC;AACnE,CAAC;AA1BD,0DA0BC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CoinflowPurchaseProps } from './CoinflowTypes';
|
|
2
|
+
export type WalletCall = {
|
|
3
|
+
method: IFrameMessageMethods;
|
|
4
|
+
data: string;
|
|
5
|
+
};
|
|
6
|
+
export interface IFrameMessageHandlers {
|
|
7
|
+
handleSendTransaction: (transaction: string) => Promise<string>;
|
|
8
|
+
handleSignMessage?: (message: string) => Promise<string>;
|
|
9
|
+
handleSignTransaction?: (transaction: string) => Promise<string>;
|
|
10
|
+
handleHeightChange?: (height: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare enum IFrameMessageMethods {
|
|
13
|
+
SignMessage = "signMessage",
|
|
14
|
+
SignTransaction = "signTransaction",
|
|
15
|
+
SendTransaction = "sendTransaction",
|
|
16
|
+
HeightChange = "heightChange"
|
|
17
|
+
}
|
|
18
|
+
export declare function getWalletPubkey({ wallet, }: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined;
|
|
19
|
+
export declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers): Promise<string> | void;
|
|
20
|
+
export declare function getHandlers({ wallet, blockchain, }: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHandlers = exports.handleIFrameMessage = exports.getWalletPubkey = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var CoinflowUtils_1 = require("./CoinflowUtils");
|
|
6
|
+
var SolanaPeerDeps_1 = require("./SolanaPeerDeps");
|
|
7
|
+
var IFrameMessageMethods;
|
|
8
|
+
(function (IFrameMessageMethods) {
|
|
9
|
+
IFrameMessageMethods["SignMessage"] = "signMessage";
|
|
10
|
+
IFrameMessageMethods["SignTransaction"] = "signTransaction";
|
|
11
|
+
IFrameMessageMethods["SendTransaction"] = "sendTransaction";
|
|
12
|
+
IFrameMessageMethods["HeightChange"] = "heightChange";
|
|
13
|
+
})(IFrameMessageMethods || (IFrameMessageMethods = {}));
|
|
14
|
+
function getWalletPubkey(_a) {
|
|
15
|
+
var wallet = _a.wallet;
|
|
16
|
+
if ('publicKey' in wallet) {
|
|
17
|
+
return wallet.publicKey.toString();
|
|
18
|
+
}
|
|
19
|
+
if ('address' in wallet) {
|
|
20
|
+
return wallet.address;
|
|
21
|
+
}
|
|
22
|
+
if ('accountId' in wallet) {
|
|
23
|
+
return wallet.accountId;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
exports.getWalletPubkey = getWalletPubkey;
|
|
28
|
+
function handleIFrameMessage(rawMessage, handlers) {
|
|
29
|
+
var walletCall;
|
|
30
|
+
try {
|
|
31
|
+
walletCall = JSON.parse(rawMessage);
|
|
32
|
+
if (!('method' in walletCall) || !('data' in walletCall))
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
console.error('handleIFrameMessage JSON parse', e);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
var data = walletCall.data, method = walletCall.method;
|
|
40
|
+
switch (method) {
|
|
41
|
+
case IFrameMessageMethods.SignMessage:
|
|
42
|
+
if (!handlers.handleSignMessage)
|
|
43
|
+
return;
|
|
44
|
+
return handlers.handleSignMessage(data);
|
|
45
|
+
case IFrameMessageMethods.SignTransaction:
|
|
46
|
+
if (!handlers.handleSignTransaction)
|
|
47
|
+
return;
|
|
48
|
+
return handlers.handleSignTransaction(data);
|
|
49
|
+
case IFrameMessageMethods.SendTransaction:
|
|
50
|
+
return handlers.handleSendTransaction(data);
|
|
51
|
+
case IFrameMessageMethods.HeightChange:
|
|
52
|
+
if (!handlers.handleHeightChange)
|
|
53
|
+
return;
|
|
54
|
+
return handlers.handleHeightChange(data);
|
|
55
|
+
}
|
|
56
|
+
console.warn("Didn't expect to get here, handleIFrameMessage method:".concat(method, " is not one of ").concat(Object.values(IFrameMessageMethods)));
|
|
57
|
+
}
|
|
58
|
+
exports.handleIFrameMessage = handleIFrameMessage;
|
|
59
|
+
function getHandlers(_a) {
|
|
60
|
+
var wallet = _a.wallet, blockchain = _a.blockchain;
|
|
61
|
+
return CoinflowUtils_1.CoinflowUtils.byBlockchain(blockchain, {
|
|
62
|
+
solana: function () { return getSolanaWalletHandlers({ wallet: wallet }); },
|
|
63
|
+
near: function () { return getNearWalletHandlers({ wallet: wallet }); },
|
|
64
|
+
eth: function () { return getEvmWalletHandlers({ wallet: wallet }); },
|
|
65
|
+
polygon: function () { return getEvmWalletHandlers({ wallet: wallet }); },
|
|
66
|
+
base: function () { return getEvmWalletHandlers({ wallet: wallet }); },
|
|
67
|
+
})();
|
|
68
|
+
}
|
|
69
|
+
exports.getHandlers = getHandlers;
|
|
70
|
+
function getSolanaWalletHandlers(_a) {
|
|
71
|
+
var _this = this;
|
|
72
|
+
var wallet = _a.wallet;
|
|
73
|
+
return {
|
|
74
|
+
handleSendTransaction: function (transaction) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
75
|
+
var tx;
|
|
76
|
+
return tslib_1.__generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
tx = getSolanaTransaction(transaction);
|
|
80
|
+
return [4 /*yield*/, wallet.sendTransaction(tx)];
|
|
81
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); },
|
|
85
|
+
handleSignMessage: function (message) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
86
|
+
var signMessage, signedMessage;
|
|
87
|
+
return tslib_1.__generator(this, function (_a) {
|
|
88
|
+
switch (_a.label) {
|
|
89
|
+
case 0:
|
|
90
|
+
signMessage = wallet.signMessage;
|
|
91
|
+
if (!signMessage) {
|
|
92
|
+
throw new Error('signMessage is not supported by this wallet');
|
|
93
|
+
}
|
|
94
|
+
return [4 /*yield*/, signMessage(new TextEncoder().encode(message))];
|
|
95
|
+
case 1:
|
|
96
|
+
signedMessage = _a.sent();
|
|
97
|
+
if (!SolanaPeerDeps_1.base58)
|
|
98
|
+
throw new Error('bs58 dependency is required');
|
|
99
|
+
return [2 /*return*/, SolanaPeerDeps_1.base58.encode(signedMessage)];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}); },
|
|
103
|
+
handleSignTransaction: function (transaction) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
104
|
+
var signTransaction, tx, signedTransaction;
|
|
105
|
+
return tslib_1.__generator(this, function (_a) {
|
|
106
|
+
switch (_a.label) {
|
|
107
|
+
case 0:
|
|
108
|
+
signTransaction = wallet.signTransaction;
|
|
109
|
+
if (!signTransaction) {
|
|
110
|
+
throw new Error('signTransaction is not supported by this wallet');
|
|
111
|
+
}
|
|
112
|
+
tx = getSolanaTransaction(transaction);
|
|
113
|
+
return [4 /*yield*/, signTransaction(tx)];
|
|
114
|
+
case 1:
|
|
115
|
+
signedTransaction = _a.sent();
|
|
116
|
+
if (!SolanaPeerDeps_1.base58)
|
|
117
|
+
throw new Error('bs58 dependency is required');
|
|
118
|
+
return [2 /*return*/, SolanaPeerDeps_1.base58.encode(signedTransaction.serialize({
|
|
119
|
+
requireAllSignatures: false,
|
|
120
|
+
verifySignatures: false,
|
|
121
|
+
}))];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}); },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function getSolanaTransaction(data) {
|
|
128
|
+
if (!SolanaPeerDeps_1.web3)
|
|
129
|
+
throw new Error('@solana/web3.js is not defined. Please install @solana/web3.js into your project');
|
|
130
|
+
if (!SolanaPeerDeps_1.base58)
|
|
131
|
+
throw new Error('bs58 is not defined. Please install bs58 into your project');
|
|
132
|
+
var parsedUInt8Array = SolanaPeerDeps_1.base58.decode(data);
|
|
133
|
+
var vtx = SolanaPeerDeps_1.web3.VersionedTransaction.deserialize(parsedUInt8Array);
|
|
134
|
+
if (vtx.version === 'legacy')
|
|
135
|
+
return SolanaPeerDeps_1.web3.Transaction.from(parsedUInt8Array);
|
|
136
|
+
return vtx;
|
|
137
|
+
}
|
|
138
|
+
function getNearWalletHandlers(_a) {
|
|
139
|
+
var _this = this;
|
|
140
|
+
var wallet = _a.wallet;
|
|
141
|
+
var nearWallet = wallet;
|
|
142
|
+
return {
|
|
143
|
+
handleSendTransaction: function (transaction) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
144
|
+
var action, executionOutcome, transactionResult;
|
|
145
|
+
return tslib_1.__generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
action = JSON.parse(Buffer.from(transaction, 'base64').toString());
|
|
149
|
+
return [4 /*yield*/, nearWallet.signAndSendTransaction(action)];
|
|
150
|
+
case 1:
|
|
151
|
+
executionOutcome = _a.sent();
|
|
152
|
+
if (!executionOutcome)
|
|
153
|
+
throw new Error('Transaction did not send');
|
|
154
|
+
transactionResult = executionOutcome.transaction;
|
|
155
|
+
return [2 /*return*/, transactionResult.hash];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}); },
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function getEvmWalletHandlers(_a) {
|
|
162
|
+
var _this = this;
|
|
163
|
+
var wallet = _a.wallet;
|
|
164
|
+
var evmWallet = wallet;
|
|
165
|
+
return {
|
|
166
|
+
handleSendTransaction: function (transaction) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
167
|
+
var tx, hash;
|
|
168
|
+
return tslib_1.__generator(this, function (_a) {
|
|
169
|
+
switch (_a.label) {
|
|
170
|
+
case 0:
|
|
171
|
+
tx = JSON.parse(Buffer.from(transaction, 'base64').toString());
|
|
172
|
+
return [4 /*yield*/, evmWallet.sendTransaction(tx)];
|
|
173
|
+
case 1:
|
|
174
|
+
hash = (_a.sent()).hash;
|
|
175
|
+
return [2 /*return*/, hash];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}); },
|
|
179
|
+
handleSignMessage: function (message) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
180
|
+
return tslib_1.__generator(this, function (_a) {
|
|
181
|
+
return [2 /*return*/, evmWallet.signMessage(message)];
|
|
182
|
+
});
|
|
183
|
+
}); },
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=CoinflowLibMessageHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";;;;AAMA,iDAA8C;AAE9C,mDAA8C;AAW9C,IAAK,oBAKJ;AALD,WAAK,oBAAoB;IACvB,mDAA2B,CAAA;IAC3B,2DAAmC,CAAA;IACnC,2DAAmC,CAAA;IACnC,qDAA6B,CAAA;AAC/B,CAAC,EALI,oBAAoB,KAApB,oBAAoB,QAKxB;AAED,SAAgB,eAAe,CAAC,EAEQ;QADtC,MAAM,YAAA;IAEN,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAU,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAA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AAO;QACL,qBAAqB,EAAE,UAAO,WAAmB;;;;;wBACzC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBAChD,qBAAM,UAAU,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAA;;wBAAlE,gBAAgB,GAAG,SAA+C;wBACxE,IAAI,CAAC,gBAAgB;4BAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;wBAC/C,iBAAiB,GAAI,gBAAgB,YAApB,CAAqB;wBAC1D,sBAAO,iBAAiB,CAAC,IAAI,EAAC;;;aAC/B;KACF,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,EAEU;IAFxC,iBAiBC;QAhBC,MAAM,YAAA;IAKN,IAAM,SAAS,GAAG,MAAmB,CAAC;IACtC,OAAO;QACL,qBAAqB,EAAE,UAAO,WAAmB;;;;;wBACzC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACtD,qBAAM,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,EAAA;;wBAA3C,IAAI,GAAI,CAAA,SAAmC,CAAA,KAAvC;wBACX,sBAAO,IAAI,EAAC;;;aACb;QACD,iBAAiB,EAAE,UAAO,OAAe;;gBACvC,sBAAO,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAC;;aACvC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { PublicKey, Signer, Transaction } from '@solana/web3.js';
|
|
4
|
-
import { WalletContextState } from '@solana/wallet-adapter-react';
|
|
5
|
-
import { Wallet } from '@near-wallet-selector/core';
|
|
6
|
-
declare enum SettlementType {
|
|
1
|
+
import type { Connection, VersionedTransaction, PublicKey, Signer, Transaction } from '@solana/web3.js';
|
|
2
|
+
export declare enum SettlementType {
|
|
7
3
|
Credits = "Credits",
|
|
8
4
|
USDC = "USDC",
|
|
9
5
|
Bank = "Bank"
|
|
10
6
|
}
|
|
11
|
-
declare enum MerchantStyle {
|
|
7
|
+
export declare enum MerchantStyle {
|
|
12
8
|
Rounded = "rounded",
|
|
13
9
|
Sharp = "sharp",
|
|
14
10
|
Pill = "pill"
|
|
15
11
|
}
|
|
16
|
-
type MerchantTheme = {
|
|
12
|
+
export type MerchantTheme = {
|
|
17
13
|
primary?: string;
|
|
18
14
|
background?: string;
|
|
19
15
|
backgroundAccent?: string;
|
|
@@ -24,7 +20,7 @@ type MerchantTheme = {
|
|
|
24
20
|
font?: string;
|
|
25
21
|
style?: MerchantStyle;
|
|
26
22
|
};
|
|
27
|
-
interface CustomerInfo {
|
|
23
|
+
export interface CustomerInfo {
|
|
28
24
|
name?: string;
|
|
29
25
|
verificationId?: string;
|
|
30
26
|
displayName?: string;
|
|
@@ -38,7 +34,7 @@ interface CustomerInfo {
|
|
|
38
34
|
lng?: string;
|
|
39
35
|
}
|
|
40
36
|
/** Coinflow Types **/
|
|
41
|
-
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon';
|
|
37
|
+
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';
|
|
42
38
|
export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
|
|
43
39
|
export interface CoinflowTypes {
|
|
44
40
|
merchantId: string;
|
|
@@ -46,16 +42,25 @@ export interface CoinflowTypes {
|
|
|
46
42
|
loaderBackground?: string;
|
|
47
43
|
blockchain: CoinflowBlockchain;
|
|
48
44
|
handleHeightChange?: (height: string) => void;
|
|
49
|
-
useSocket?: boolean;
|
|
50
45
|
theme?: MerchantTheme;
|
|
51
46
|
}
|
|
52
47
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
53
48
|
export type OnSuccessMethod = (params: string) => void | Promise<void>;
|
|
54
49
|
/** Wallets **/
|
|
55
|
-
export
|
|
56
|
-
|
|
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 {
|
|
57
57
|
accountId: string;
|
|
58
|
-
|
|
58
|
+
signAndSendTransaction: (transaction: unknown) => Promise<{
|
|
59
|
+
transaction: {
|
|
60
|
+
hash: string;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
59
64
|
type AccessList = Array<{
|
|
60
65
|
address: string;
|
|
61
66
|
storageKeys: Array<string>;
|
|
@@ -102,33 +107,10 @@ export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
102
107
|
export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
103
108
|
blockchain: 'polygon';
|
|
104
109
|
}
|
|
105
|
-
export
|
|
106
|
-
|
|
107
|
-
walletPubkey: string;
|
|
108
|
-
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
109
|
-
route: string;
|
|
110
|
-
routePrefix?: string;
|
|
111
|
-
transaction?: string;
|
|
112
|
-
token?: string | PublicKey;
|
|
113
|
-
tokens?: string[] | PublicKey[];
|
|
114
|
-
lockDefaultToken?: boolean;
|
|
115
|
-
email?: string;
|
|
116
|
-
supportsVersionedTransactions?: boolean;
|
|
117
|
-
nearDeposit?: string;
|
|
118
|
-
merchantCss?: string;
|
|
119
|
-
color?: 'white' | 'black';
|
|
120
|
-
rent?: {
|
|
121
|
-
lamports: string | number;
|
|
122
|
-
};
|
|
123
|
-
nativeSolToConvert?: {
|
|
124
|
-
lamports: string | number;
|
|
125
|
-
};
|
|
126
|
-
planCode?: string;
|
|
127
|
-
disableApplePay?: boolean;
|
|
128
|
-
disableGooglePay?: boolean;
|
|
129
|
-
settlementType?: SettlementType;
|
|
130
|
-
theme?: MerchantTheme;
|
|
110
|
+
export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
111
|
+
blockchain: 'base';
|
|
131
112
|
}
|
|
113
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps;
|
|
132
114
|
/** Transactions **/
|
|
133
115
|
export type NearFtTransferCallAction = {
|
|
134
116
|
methodName: 'ft_transfer_call';
|
|
@@ -164,7 +146,7 @@ export interface ChargebackProtectionItem {
|
|
|
164
146
|
};
|
|
165
147
|
}
|
|
166
148
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
167
|
-
amount?: number;
|
|
149
|
+
amount?: number | string;
|
|
168
150
|
onSuccess?: OnSuccessMethod;
|
|
169
151
|
webhookInfo?: object;
|
|
170
152
|
email?: string;
|
|
@@ -174,6 +156,9 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
174
156
|
disableGooglePay?: boolean;
|
|
175
157
|
customerInfo?: CustomerInfo;
|
|
176
158
|
settlementType?: SettlementType;
|
|
159
|
+
authOnly?: boolean;
|
|
160
|
+
deviceId?: string;
|
|
161
|
+
jwtToken?: string;
|
|
177
162
|
}
|
|
178
163
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
179
164
|
wallet: SolanaWallet;
|
|
@@ -208,7 +193,10 @@ export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
|
208
193
|
export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
209
194
|
blockchain: 'eth';
|
|
210
195
|
}
|
|
211
|
-
export
|
|
196
|
+
export interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {
|
|
197
|
+
blockchain: 'base';
|
|
198
|
+
}
|
|
199
|
+
export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps;
|
|
212
200
|
/** Withdraw **/
|
|
213
201
|
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
214
202
|
onSuccess?: OnSuccessMethod;
|
|
@@ -234,15 +222,21 @@ export interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
|
234
222
|
wallet: NearWallet;
|
|
235
223
|
blockchain: 'near';
|
|
236
224
|
}
|
|
237
|
-
export interface
|
|
238
|
-
wallet:
|
|
225
|
+
export interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
226
|
+
wallet: EthWallet;
|
|
227
|
+
usePermit?: boolean;
|
|
228
|
+
}
|
|
229
|
+
export interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
239
230
|
blockchain: 'eth';
|
|
231
|
+
usePermit?: boolean;
|
|
240
232
|
}
|
|
241
|
-
export interface CoinflowPolygonWithdrawProps extends
|
|
242
|
-
wallet: Omit<EthWallet, 'signMessage'>;
|
|
233
|
+
export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
243
234
|
blockchain: 'polygon';
|
|
244
235
|
}
|
|
245
|
-
export
|
|
236
|
+
export interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
237
|
+
blockchain: 'base';
|
|
238
|
+
}
|
|
239
|
+
export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps;
|
|
246
240
|
export interface CommonEvmRedeem {
|
|
247
241
|
waitForHash?: boolean;
|
|
248
242
|
}
|
|
@@ -275,4 +269,19 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
|
275
269
|
items: ReservoirItems;
|
|
276
270
|
}
|
|
277
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
|
+
}
|
|
278
287
|
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MerchantStyle = exports.SettlementType = void 0;
|
|
3
4
|
var SettlementType;
|
|
4
5
|
(function (SettlementType) {
|
|
5
6
|
SettlementType["Credits"] = "Credits";
|
|
6
7
|
SettlementType["USDC"] = "USDC";
|
|
7
8
|
SettlementType["Bank"] = "Bank";
|
|
8
|
-
})(SettlementType || (SettlementType = {}));
|
|
9
|
+
})(SettlementType || (exports.SettlementType = SettlementType = {}));
|
|
9
10
|
var MerchantStyle;
|
|
10
11
|
(function (MerchantStyle) {
|
|
11
12
|
MerchantStyle["Rounded"] = "rounded";
|
|
12
13
|
MerchantStyle["Sharp"] = "sharp";
|
|
13
14
|
MerchantStyle["Pill"] = "pill";
|
|
14
|
-
})(MerchantStyle || (MerchantStyle = {}));
|
|
15
|
+
})(MerchantStyle || (exports.MerchantStyle = MerchantStyle = {}));
|
|
15
16
|
//# sourceMappingURL=CoinflowTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":";;;AAQA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
|