@coinflowlabs/react 4.1.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 +1 -0
- package/build/cjs/CoinflowApplePayButton.d.ts +3 -5
- package/build/cjs/CoinflowApplePayButton.js +42 -38
- 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 -67
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.d.ts +2 -2
- package/build/cjs/CoinflowPurchaseHistory.js +10 -42
- 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 -45
- package/build/cjs/CoinflowWithdraw.js.map +1 -1
- package/build/cjs/CoinflowWithdrawHistory.d.ts +2 -2
- package/build/cjs/CoinflowWithdrawHistory.js +10 -43
- 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} +36 -41
- 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} +37 -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 -36
- 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 -65
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.d.ts +2 -2
- package/build/esm/CoinflowPurchaseHistory.js +10 -42
- 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 -45
- package/build/esm/CoinflowWithdraw.js.map +1 -1
- package/build/esm/CoinflowWithdrawHistory.d.ts +2 -2
- package/build/esm/CoinflowWithdrawHistory.js +10 -43
- 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} +36 -41
- 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} +37 -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 -22
- 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 -22
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseProtection.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseProtection.tsx"],"names":[],"mappings":";;;AAAA,+BAAmD;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchasePro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AAW,CAAC,mBAAmB,CAAC,CAAC;QAE/C,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACtD,YAAY,CAAC,GAAG,GAAG,MAAM,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACxC,OAAO;YACL,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YACxC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAE1C,OAAO,IAAI,CAAC;AACd,CAAC;AAtDD,gEAsDC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { CoinflowWithdrawProps } from "./
|
|
3
|
-
export declare function CoinflowWithdraw(
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CoinflowWithdrawProps } from "./common";
|
|
3
|
+
export declare function CoinflowWithdraw(withdrawProps: CoinflowWithdrawProps): React.JSX.Element;
|
|
@@ -2,52 +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
|
-
base: (react_1.default.createElement(CoinflowEthWithdraw, tslib_1.__assign({}, props))),
|
|
19
|
-
});
|
|
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));
|
|
20
17
|
}
|
|
21
18
|
exports.CoinflowWithdraw = CoinflowWithdraw;
|
|
22
|
-
function CoinflowSolanaWithdraw(props) {
|
|
23
|
-
var _a;
|
|
24
|
-
var handlers = (0, SolanaIFrameMessageHandlers_1.useSolanaIFrameMessageHandlers)(props);
|
|
25
|
-
var wallet = props.wallet;
|
|
26
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, (_a = wallet.publicKey) === null || _a === void 0 ? void 0 : _a.toString()).IFrameRef;
|
|
27
|
-
if (!wallet.publicKey)
|
|
28
|
-
return null;
|
|
29
|
-
var walletPubkey = wallet.publicKey.toString();
|
|
30
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId), supportsVersionedTransactions: props.supportsVersionedTransactions !== false });
|
|
31
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
32
|
-
}
|
|
33
|
-
function CoinflowNearWithdraw(props) {
|
|
34
|
-
var handlers = (0, NearIFrameMessageHandlers_1.useNearIFrameMessageHandlers)(props);
|
|
35
|
-
var wallet = props.wallet;
|
|
36
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.accountId).IFrameRef;
|
|
37
|
-
if (!wallet)
|
|
38
|
-
return null;
|
|
39
|
-
var walletPubkey = wallet.accountId;
|
|
40
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId) });
|
|
41
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
42
|
-
}
|
|
43
|
-
function CoinflowEthWithdraw(props) {
|
|
44
|
-
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
45
|
-
var wallet = props.wallet;
|
|
46
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.address).IFrameRef;
|
|
47
|
-
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
48
|
-
return null;
|
|
49
|
-
var walletPubkey = wallet.address;
|
|
50
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/withdraw/".concat(props.merchantId) });
|
|
51
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
52
|
-
}
|
|
53
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, CoinflowBaseHistoryProps } from "./
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CoinflowNearHistoryProps, CoinflowSolanaHistoryProps, CoinflowEthHistoryProps, CoinflowPolygonHistoryProps, CoinflowBaseHistoryProps } from "./common";
|
|
3
3
|
export declare function CoinflowWithdrawHistory(props: CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowEthHistoryProps | CoinflowPolygonHistoryProps | CoinflowBaseHistoryProps): React.JSX.Element;
|
|
@@ -2,51 +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
|
-
|
|
19
|
-
});
|
|
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));
|
|
20
17
|
}
|
|
21
18
|
exports.CoinflowWithdrawHistory = CoinflowWithdrawHistory;
|
|
22
|
-
function SolanaWithdrawHistory(props) {
|
|
23
|
-
var _a;
|
|
24
|
-
var handlers = (0, SolanaIFrameMessageHandlers_1.useSolanaIFrameMessageHandlers)(props);
|
|
25
|
-
var wallet = props.wallet;
|
|
26
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, (_a = wallet.publicKey) === null || _a === void 0 ? void 0 : _a.toString()).IFrameRef;
|
|
27
|
-
if (!wallet.publicKey)
|
|
28
|
-
return null;
|
|
29
|
-
var walletPubkey = wallet.publicKey.toString();
|
|
30
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
31
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
32
|
-
}
|
|
33
|
-
function NearWithdrawHistory(props) {
|
|
34
|
-
var handlers = (0, NearIFrameMessageHandlers_1.useNearIFrameMessageHandlers)(props);
|
|
35
|
-
var wallet = props.wallet;
|
|
36
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.accountId).IFrameRef;
|
|
37
|
-
if (!wallet)
|
|
38
|
-
return null;
|
|
39
|
-
var walletPubkey = wallet.accountId;
|
|
40
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
41
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
42
|
-
}
|
|
43
|
-
function EthWithdrawHistory(props) {
|
|
44
|
-
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
45
|
-
var wallet = props.wallet;
|
|
46
|
-
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.address).IFrameRef;
|
|
47
|
-
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.address))
|
|
48
|
-
return null;
|
|
49
|
-
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: wallet.address, IFrameRef: IFrameRef, route: "/history/withdraw/".concat(props.merchantId) });
|
|
50
|
-
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
51
|
-
}
|
|
52
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/CoinflowLib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C,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;
|
|
@@ -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>;
|
|
@@ -106,33 +111,6 @@ export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
106
111
|
blockchain: 'base';
|
|
107
112
|
}
|
|
108
113
|
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps;
|
|
109
|
-
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'> {
|
|
110
|
-
walletPubkey: string;
|
|
111
|
-
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
112
|
-
route: string;
|
|
113
|
-
routePrefix?: string;
|
|
114
|
-
transaction?: string;
|
|
115
|
-
token?: string | PublicKey;
|
|
116
|
-
tokens?: string[] | PublicKey[];
|
|
117
|
-
lockDefaultToken?: boolean;
|
|
118
|
-
email?: string;
|
|
119
|
-
supportsVersionedTransactions?: boolean;
|
|
120
|
-
nearDeposit?: string;
|
|
121
|
-
merchantCss?: string;
|
|
122
|
-
color?: 'white' | 'black';
|
|
123
|
-
rent?: {
|
|
124
|
-
lamports: string | number;
|
|
125
|
-
};
|
|
126
|
-
nativeSolToConvert?: {
|
|
127
|
-
lamports: string | number;
|
|
128
|
-
};
|
|
129
|
-
planCode?: string;
|
|
130
|
-
disableApplePay?: boolean;
|
|
131
|
-
disableGooglePay?: boolean;
|
|
132
|
-
settlementType?: SettlementType;
|
|
133
|
-
theme?: MerchantTheme;
|
|
134
|
-
usePermit?: boolean;
|
|
135
|
-
}
|
|
136
114
|
/** Transactions **/
|
|
137
115
|
export type NearFtTransferCallAction = {
|
|
138
116
|
methodName: 'ft_transfer_call';
|
|
@@ -168,7 +146,7 @@ export interface ChargebackProtectionItem {
|
|
|
168
146
|
};
|
|
169
147
|
}
|
|
170
148
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
171
|
-
amount?: number;
|
|
149
|
+
amount?: number | string;
|
|
172
150
|
onSuccess?: OnSuccessMethod;
|
|
173
151
|
webhookInfo?: object;
|
|
174
152
|
email?: string;
|
|
@@ -179,6 +157,8 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
179
157
|
customerInfo?: CustomerInfo;
|
|
180
158
|
settlementType?: SettlementType;
|
|
181
159
|
authOnly?: boolean;
|
|
160
|
+
deviceId?: string;
|
|
161
|
+
jwtToken?: string;
|
|
182
162
|
}
|
|
183
163
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
184
164
|
wallet: SolanaWallet;
|
|
@@ -289,4 +269,19 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
|
289
269
|
items: ReservoirItems;
|
|
290
270
|
}
|
|
291
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
|
+
}
|
|
292
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"}
|
|
@@ -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
|
+
}
|