decentraland-dapps 13.9.0 → 13.10.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/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.container.d.ts +18 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.container.js +22 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.container.js.map +1 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.d.ts +17 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.js +107 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.js.map +1 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.types.d.ts +26 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.types.js +3 -0
- package/dist/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.types.js.map +1 -0
- package/dist/containers/BuyManaWithFiatModal/index.d.ts +2 -0
- package/dist/containers/BuyManaWithFiatModal/index.js +8 -0
- package/dist/containers/BuyManaWithFiatModal/index.js.map +1 -0
- package/dist/lib/api.js +3 -4
- package/dist/lib/api.js.map +1 -1
- package/dist/modules/location/sagas.d.ts +1 -0
- package/dist/modules/location/sagas.js +18 -0
- package/dist/modules/location/sagas.js.map +1 -0
- package/dist/modules/location/types.d.ts +9 -0
- package/dist/modules/location/types.js +3 -0
- package/dist/modules/location/types.js.map +1 -0
- package/dist/modules/locations.d.ts +4 -0
- package/dist/modules/locations.js +8 -0
- package/dist/modules/locations.js.map +1 -0
- package/dist/modules/mana/actions.d.ts +6 -0
- package/dist/modules/mana/actions.js +9 -0
- package/dist/modules/mana/actions.js.map +1 -0
- package/dist/modules/mana/types.d.ts +17 -0
- package/dist/modules/mana/types.js +11 -0
- package/dist/modules/mana/types.js.map +1 -0
- package/dist/modules/manaFiatGateway/actions.d.ts +30 -0
- package/dist/modules/manaFiatGateway/actions.js +30 -0
- package/dist/modules/manaFiatGateway/actions.js.map +1 -0
- package/dist/modules/manaFiatGateway/moonpay/MoonPay.d.ts +24 -0
- package/dist/modules/manaFiatGateway/moonpay/MoonPay.js +66 -0
- package/dist/modules/manaFiatGateway/moonpay/MoonPay.js.map +1 -0
- package/dist/modules/manaFiatGateway/moonpay/index.d.ts +1 -0
- package/dist/modules/manaFiatGateway/moonpay/index.js +6 -0
- package/dist/modules/manaFiatGateway/moonpay/index.js.map +1 -0
- package/dist/modules/manaFiatGateway/moonpay/types.d.ts +94 -0
- package/dist/modules/manaFiatGateway/moonpay/types.js +12 -0
- package/dist/modules/manaFiatGateway/moonpay/types.js.map +1 -0
- package/dist/modules/manaFiatGateway/reducer.d.ts +12 -0
- package/dist/modules/manaFiatGateway/reducer.js +24 -0
- package/dist/modules/manaFiatGateway/reducer.js.map +1 -0
- package/dist/modules/manaFiatGateway/sagas.d.ts +3 -0
- package/dist/modules/manaFiatGateway/sagas.js +78 -0
- package/dist/modules/manaFiatGateway/sagas.js.map +1 -0
- package/dist/modules/manaFiatGateway/selectors.d.ts +10 -0
- package/dist/modules/manaFiatGateway/selectors.js +20 -0
- package/dist/modules/manaFiatGateway/selectors.js.map +1 -0
- package/dist/modules/manaFiatGateway/transak/Transak.d.ts +25 -0
- package/dist/modules/manaFiatGateway/transak/Transak.js +82 -0
- package/dist/modules/manaFiatGateway/transak/Transak.js.map +1 -0
- package/dist/modules/manaFiatGateway/transak/index.d.ts +1 -0
- package/dist/modules/manaFiatGateway/transak/index.js +6 -0
- package/dist/modules/manaFiatGateway/transak/index.js.map +1 -0
- package/dist/modules/manaFiatGateway/transak/types.d.ts +40 -0
- package/dist/modules/manaFiatGateway/transak/types.js +3 -0
- package/dist/modules/manaFiatGateway/transak/types.js.map +1 -0
- package/dist/modules/manaFiatGateway/types.d.ts +15 -0
- package/dist/modules/manaFiatGateway/types.js +4 -0
- package/dist/modules/manaFiatGateway/types.js.map +1 -0
- package/dist/modules/manaFiatGateway/utils.d.ts +1 -0
- package/dist/modules/manaFiatGateway/utils.js +6 -0
- package/dist/modules/manaFiatGateway/utils.js.map +1 -0
- package/dist/modules/toast/sagas.d.ts +1 -1
- package/dist/modules/translation/defaults/en.json +45 -0
- package/dist/modules/translation/defaults/es.json +45 -0
- package/dist/modules/translation/defaults/zh.json +45 -0
- package/package.json +11 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Network } from '@dcl/schemas';
|
|
3
|
+
import { NetworkGatewayType } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/Network';
|
|
4
|
+
import BuyManaWithFiatModal from './BuyManaWithFiatModal';
|
|
5
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof BuyManaWithFiatModal, import("react-redux").Omit<Pick<import("react").ClassAttributes<BuyManaWithFiatModal> & import("./BuyManaWithFiatModal.types").DefaultProps & Omit<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks"> & Partial<Pick<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks">> & {
|
|
6
|
+
selectedNetwork?: Network | undefined;
|
|
7
|
+
networks?: (import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalNetworkProps & import("decentraland-ui/dist/components/BuyManaWithFiatModal/Network").BuyWithFiatNetworkProps)[] | undefined;
|
|
8
|
+
hasTranslations?: boolean | undefined;
|
|
9
|
+
widgetUrl?: string | undefined;
|
|
10
|
+
onContinue?: ((network: Network, gateway: NetworkGatewayType) => void) | undefined;
|
|
11
|
+
}, "open" | "message" | "loading" | "i18n" | "className" | "onClose" | "hasTranslations" | "hasError" | "onInfo" | "onContinue" | "networks" | "widgetUrl" | "selectedNetwork" | keyof import("react").ClassAttributes<BuyManaWithFiatModal>> & Partial<Pick<import("react").ClassAttributes<BuyManaWithFiatModal> & import("./BuyManaWithFiatModal.types").DefaultProps & Omit<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks"> & Partial<Pick<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks">> & {
|
|
12
|
+
selectedNetwork?: Network | undefined;
|
|
13
|
+
networks?: (import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalNetworkProps & import("decentraland-ui/dist/components/BuyManaWithFiatModal/Network").BuyWithFiatNetworkProps)[] | undefined;
|
|
14
|
+
hasTranslations?: boolean | undefined;
|
|
15
|
+
widgetUrl?: string | undefined;
|
|
16
|
+
onContinue?: ((network: Network, gateway: NetworkGatewayType) => void) | undefined;
|
|
17
|
+
}, "isLoading">> & Partial<Pick<import("./BuyManaWithFiatModal.types").DefaultProps, never>>, "open" | "message" | "loading" | "i18n" | "className" | "onClose" | "hasError" | "onInfo" | "networks"> & Omit<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks"> & Partial<Pick<import("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal").BuyManaWithFiatModalProps, "networks">>>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const actions_1 = require("../../modules/manaFiatGateway/actions");
|
|
8
|
+
const selectors_1 = require("../../modules/manaFiatGateway/selectors");
|
|
9
|
+
const selectors_2 = require("../../modules/translation/selectors");
|
|
10
|
+
const BuyManaWithFiatModal_1 = __importDefault(require("./BuyManaWithFiatModal"));
|
|
11
|
+
const mapState = (state) => ({
|
|
12
|
+
hasError: !!selectors_1.getError(state),
|
|
13
|
+
isLoading: selectors_1.isRenderingWidget(state) || selectors_1.isFinishingPurchase(state),
|
|
14
|
+
hasTranslations: selectors_2.isEnabled(state),
|
|
15
|
+
widgetUrl: selectors_1.getWidgetUrl(state)
|
|
16
|
+
});
|
|
17
|
+
const mapDispatch = (dispatch) => ({
|
|
18
|
+
onContinue: (network, gateway) => dispatch(actions_1.openManaFiatGateway(network, gateway))
|
|
19
|
+
});
|
|
20
|
+
const mergeProps = (stateProps, dispatchProps, ownProps) => (Object.assign(Object.assign(Object.assign({}, stateProps), dispatchProps), ownProps));
|
|
21
|
+
exports.default = react_redux_1.connect(mapState, mapDispatch, mergeProps)(BuyManaWithFiatModal_1.default);
|
|
22
|
+
//# sourceMappingURL=BuyManaWithFiatModal.container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuyManaWithFiatModal.container.js","sourceRoot":"","sources":["../../../src/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.container.ts"],"names":[],"mappings":";;;;;AAAA,6CAAqC;AAGrC,mEAA2E;AAC3E,uEAKgD;AAChD,mEAA+D;AAO/D,kFAAyD;AAEzD,MAAM,QAAQ,GAAG,CAAC,KAAU,EAAiB,EAAE,CAAC,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,oBAAQ,CAAC,KAAK,CAAC;IAC3B,SAAS,EAAE,6BAAiB,CAAC,KAAK,CAAC,IAAI,+BAAmB,CAAC,KAAK,CAAC;IACjE,eAAe,EAAE,qBAAS,CAAC,KAAK,CAAC;IACjC,SAAS,EAAE,wBAAY,CAAC,KAAK,CAAC;CAC/B,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,CAAC,QAAqB,EAAoB,EAAE,CAAC,CAAC;IAChE,UAAU,EAAE,CAAC,OAAgB,EAAE,OAA2B,EAAE,EAAE,CAC5D,QAAQ,CAAC,6BAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CAClD,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,CACjB,UAAyB,EACzB,aAA+B,EAC/B,QAAmC,EACR,EAAE,CAAC,+CAC3B,UAAU,GACV,aAAa,GACb,QAAQ,EACX,CAAA;AAEF,kBAAe,qBAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,8BAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Network } from '@dcl/schemas';
|
|
3
|
+
import { BuyManaWithFiatModalI18N, BuyManaWithFiatModalNetworkI18N, BuyManaWithFiatModalNetworkProps } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal';
|
|
4
|
+
import { BuyWithFiatNetworkProps, NetworkGatewayI18N, NetworkGatewayType, NetworkI18N } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/Network';
|
|
5
|
+
import { DefaultProps, Props, State } from './BuyManaWithFiatModal.types';
|
|
6
|
+
export default class BuyManaWithFiatModal extends React.PureComponent<Props, State> {
|
|
7
|
+
static defaultProps: DefaultProps;
|
|
8
|
+
constructor(props: Props);
|
|
9
|
+
componentDidUpdate(prevProps: Props): void;
|
|
10
|
+
private getDefaultTranslations;
|
|
11
|
+
getDefaultModalTranslations: () => BuyManaWithFiatModalI18N | undefined;
|
|
12
|
+
getDefaultNetworkTranslations: (network: Network) => (BuyManaWithFiatModalNetworkI18N & NetworkI18N) | undefined;
|
|
13
|
+
getDefaultGatewayTranslations: (network: Network, gateway: NetworkGatewayType) => NetworkGatewayI18N | undefined;
|
|
14
|
+
getDefaultNetworks(): (BuyManaWithFiatModalNetworkProps & BuyWithFiatNetworkProps)[];
|
|
15
|
+
handleOnContinue(network: Network, gateway: NetworkGatewayType): void;
|
|
16
|
+
render(): JSX.Element;
|
|
17
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const React = __importStar(require("react"));
|
|
23
|
+
const schemas_1 = require("@dcl/schemas");
|
|
24
|
+
const BuyManaWithFiatModal_1 = require("decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal");
|
|
25
|
+
const Network_1 = require("decentraland-ui/dist/components/BuyManaWithFiatModal/Network");
|
|
26
|
+
const utils_1 = require("../../modules/translation/utils");
|
|
27
|
+
class BuyManaWithFiatModal extends React.PureComponent {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
this.getDefaultModalTranslations = () => {
|
|
31
|
+
return this.getDefaultTranslations('@dapps.buyManaWithFiat.modal', [
|
|
32
|
+
'title',
|
|
33
|
+
'subtitle',
|
|
34
|
+
'error'
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
this.getDefaultNetworkTranslations = (network) => {
|
|
38
|
+
return this.getDefaultTranslations(`@dapps.buyManaWithFiat.network.${network.toLowerCase()}`, ['cta', 'ctaSubtitle', 'title', 'error']);
|
|
39
|
+
};
|
|
40
|
+
this.getDefaultGatewayTranslations = (network, gateway) => {
|
|
41
|
+
return this.getDefaultTranslations(`@dapps.buyManaWithFiat.network.${network.toLowerCase()}.${gateway}`, ['title', 'subtitle', 'continueButtonText', 'learnMoreText']);
|
|
42
|
+
};
|
|
43
|
+
this.state = {
|
|
44
|
+
hasError: false,
|
|
45
|
+
gatewayIsOpen: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
componentDidUpdate(prevProps) {
|
|
49
|
+
if (!prevProps.hasError && this.props.hasError) {
|
|
50
|
+
this.setState({
|
|
51
|
+
hasError: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else if (prevProps.hasError && !this.props.hasError) {
|
|
55
|
+
this.setState({
|
|
56
|
+
hasError: false
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
getDefaultTranslations(basePath, props) {
|
|
61
|
+
if (!this.props.hasTranslations) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return Object.fromEntries(props.map(it => [it, utils_1.t(`${basePath}.${it}`)]));
|
|
65
|
+
}
|
|
66
|
+
getDefaultNetworks() {
|
|
67
|
+
const networks = [schemas_1.Network.MATIC, schemas_1.Network.ETHEREUM];
|
|
68
|
+
const gateways = [Network_1.NetworkGatewayType.MOON_PAY, Network_1.NetworkGatewayType.TRANSAK];
|
|
69
|
+
const gatewayLearnMoreLink = {
|
|
70
|
+
[Network_1.NetworkGatewayType.MOON_PAY]: 'https://www.moonpay.com/',
|
|
71
|
+
[Network_1.NetworkGatewayType.TRANSAK]: 'https://transak.com/'
|
|
72
|
+
};
|
|
73
|
+
const isDisabled = (network, gateway) => network === schemas_1.Network.MATIC && gateway === Network_1.NetworkGatewayType.MOON_PAY;
|
|
74
|
+
return networks.map(network => ({
|
|
75
|
+
type: network,
|
|
76
|
+
i18n: this.getDefaultNetworkTranslations(network),
|
|
77
|
+
gateways: gateways.map(gateway => ({
|
|
78
|
+
type: gateway,
|
|
79
|
+
i18n: this.getDefaultGatewayTranslations(network, gateway),
|
|
80
|
+
disabled: isDisabled(network, gateway),
|
|
81
|
+
learnMoreLink: gatewayLearnMoreLink[gateway],
|
|
82
|
+
onContinue: () => this.handleOnContinue(network, gateway)
|
|
83
|
+
}))
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
handleOnContinue(network, gateway) {
|
|
87
|
+
this.setState(Object.assign(Object.assign({}, this.state), { gatewayIsOpen: true }));
|
|
88
|
+
this.props.onContinue && this.props.onContinue(network, gateway);
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
const { open, i18n, className, isLoading, widgetUrl, selectedNetwork, onClose, onInfo } = this.props;
|
|
92
|
+
const { hasError, gatewayIsOpen } = this.state;
|
|
93
|
+
const networks = this.props.networks || this.getDefaultNetworks();
|
|
94
|
+
if (widgetUrl) {
|
|
95
|
+
window.location.href = widgetUrl;
|
|
96
|
+
}
|
|
97
|
+
return (React.createElement(React.Fragment, null,
|
|
98
|
+
React.createElement(BuyManaWithFiatModal_1.BuyManaWithFiatModal, { open: open && !gatewayIsOpen, className: className, i18n: i18n || this.getDefaultModalTranslations(), networks: selectedNetwork
|
|
99
|
+
? networks.filter(network => network.type === selectedNetwork)
|
|
100
|
+
: networks, loading: isLoading, hasError: hasError, onClose: onClose, onInfo: onInfo })));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.default = BuyManaWithFiatModal;
|
|
104
|
+
BuyManaWithFiatModal.defaultProps = {
|
|
105
|
+
isLoading: false
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=BuyManaWithFiatModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuyManaWithFiatModal.js","sourceRoot":"","sources":["../../../src/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.tsx"],"names":[],"mappings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E,MAAM,GACd,CACD,CACJ,CAAA;IACH,CAAC;;AAxIH,uCAyIC;AArIQ,iCAAY,GAAiB;IAClC,SAAS,EAAE,KAAK;CACjB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import { Network } from '@dcl/schemas';
|
|
3
|
+
import { BuyManaWithFiatModalI18N, BuyManaWithFiatModalNetworkI18N, BuyManaWithFiatModalNetworkProps, BuyManaWithFiatModalProps as BaseBuyManaWithFiatModalProps } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/BuyManaWithFiatModal';
|
|
4
|
+
import { BuyWithFiatNetworkProps, NetworkGatewayI18N, NetworkGatewayType, NetworkI18N } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/Network';
|
|
5
|
+
import { OpenManaFiatGatewayAction } from '../../modules/manaFiatGateway/actions';
|
|
6
|
+
declare type MakeOptional<Type, Key extends keyof Type> = Omit<Type, Key> & Partial<Pick<Type, Key>>;
|
|
7
|
+
export declare type BuyManaWithFiatModalProps = MakeOptional<BaseBuyManaWithFiatModalProps, 'networks'>;
|
|
8
|
+
export declare type DefaultProps = {
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare type Props = DefaultProps & BuyManaWithFiatModalProps & {
|
|
12
|
+
selectedNetwork?: Network;
|
|
13
|
+
networks?: (BuyManaWithFiatModalNetworkProps & BuyWithFiatNetworkProps)[] | undefined;
|
|
14
|
+
hasTranslations?: boolean;
|
|
15
|
+
widgetUrl?: string;
|
|
16
|
+
onContinue?: (network: Network, gateway: NetworkGatewayType) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare type State = {
|
|
19
|
+
hasError: boolean;
|
|
20
|
+
gatewayIsOpen: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare type MapStateProps = Pick<Props, 'widgetUrl' | 'hasTranslations' | 'isLoading' | 'hasError'>;
|
|
23
|
+
export declare type MapDispatchProps = Pick<Props, 'onContinue' | 'onInfo'>;
|
|
24
|
+
export declare type MapDispatch = Dispatch<OpenManaFiatGatewayAction>;
|
|
25
|
+
export declare type Translations = BuyManaWithFiatModalI18N | (BuyManaWithFiatModalNetworkI18N & NetworkI18N) | NetworkGatewayI18N;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuyManaWithFiatModal.types.js","sourceRoot":"","sources":["../../../src/containers/BuyManaWithFiatModal/BuyManaWithFiatModal.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BuyManaWithFiatModal_container_1 = __importDefault(require("./BuyManaWithFiatModal.container"));
|
|
7
|
+
exports.default = BuyManaWithFiatModal_container_1.default;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/containers/BuyManaWithFiatModal/index.ts"],"names":[],"mappings":";;;;;AAAA,sGAAmE;AACnE,kBAAe,wCAAoB,CAAA"}
|
package/dist/lib/api.js
CHANGED
|
@@ -19,7 +19,7 @@ class BaseAPI {
|
|
|
19
19
|
constructor(url, retry = { attempts: 0, delay: 1000 }) {
|
|
20
20
|
this.url = url;
|
|
21
21
|
this.retry = retry;
|
|
22
|
-
this.sleep = (delay) => new Promise(
|
|
22
|
+
this.sleep = (delay) => new Promise(resolve => {
|
|
23
23
|
setTimeout(resolve, delay);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ class BaseAPI {
|
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
let options = Object.assign(Object.assign({}, axiosRequestConfig), { method, url: this.getUrl(path) });
|
|
29
29
|
if (params) {
|
|
30
|
-
if (method === 'get') {
|
|
30
|
+
if ((method === null || method === void 0 ? void 0 : method.toLowerCase()) === 'get') {
|
|
31
31
|
options.params = params;
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
@@ -37,8 +37,7 @@ class BaseAPI {
|
|
|
37
37
|
let attempts = 0;
|
|
38
38
|
while (true) {
|
|
39
39
|
try {
|
|
40
|
-
const axiosResponse = yield httpClient
|
|
41
|
-
.request(options);
|
|
40
|
+
const axiosResponse = yield httpClient.request(options);
|
|
42
41
|
const { ok, data, error } = this.parseResponse(axiosResponse);
|
|
43
42
|
return !ok || error ? Promise.reject({ message: error, data }) : data;
|
|
44
43
|
}
|
package/dist/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAgE;AAEhE,MAAM,UAAU,GAAG,eAAK,CAAC,MAAM,EAAE,CAAA;AAmBjC,MAAa,OAAO;IAClB,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAgE;AAEhE,MAAM,UAAU,GAAG,eAAK,CAAC,MAAM,EAAE,CAAA;AAmBjC,MAAa,OAAO;IAClB,YACS,GAAW,EACV,QAAqB,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;QADlD,QAAG,GAAH,GAAG,CAAQ;QACV,UAAK,GAAL,KAAK,CAA4C;QAGnD,UAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAChC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YACpB,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IALD,CAAC;IAOE,OAAO,CACX,MAAiB,EACjB,IAAY,EACZ,SAA0B,IAAI,EAC9B,qBAAyC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GAAG,aAAa,CAAC,IAAI,CAAA;QAEnC,IAAI,OAAO,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;YACpC,OAAO,QAAQ,CAAA;SAChB;QAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAChD,CAAC;CACF;AAhED,0BAgEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function locationSaga(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.locationSaga = void 0;
|
|
4
|
+
const effects_1 = require("redux-saga/effects");
|
|
5
|
+
const connected_react_router_1 = require("connected-react-router");
|
|
6
|
+
const actions_1 = require("../manaFiatGateway/actions");
|
|
7
|
+
function* locationSaga() {
|
|
8
|
+
yield effects_1.takeEvery(connected_react_router_1.LOCATION_CHANGE, handleLocationChange);
|
|
9
|
+
}
|
|
10
|
+
exports.locationSaga = locationSaga;
|
|
11
|
+
function* handleLocationChange(_action) {
|
|
12
|
+
const { query } = yield effects_1.select(connected_react_router_1.getLocation);
|
|
13
|
+
const { network, gateway, transactionId, transactionStatus } = query;
|
|
14
|
+
if (transactionId && transactionStatus && network && gateway) {
|
|
15
|
+
yield effects_1.put(actions_1.manaFiatGatewayPurchaseCompleted(network, gateway, transactionId, transactionStatus));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=sagas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sagas.js","sourceRoot":"","sources":["../../../src/modules/location/sagas.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAC3D,mEAI+B;AAC/B,wDAA6E;AAG7E,QAAe,CAAC,CAAC,YAAY;IAC3B,MAAM,mBAAS,CAAC,wCAAe,EAAE,oBAAoB,CAAC,CAAA;AACxD,CAAC;AAFD,oCAEC;AAED,QAAQ,CAAC,CAAC,oBAAoB,CAAC,OAA6B;IAC1D,MAAM,EAAE,KAAK,EAAE,GAAmC,MAAM,gBAAM,CAAC,oCAAW,CAAC,CAAA;IAC3E,MAAM,EACJ,OAAO,EACP,OAAO,EACP,aAAa,EACb,iBAAiB,EAClB,GAAG,KAAiC,CAAA;IAErC,IAAI,aAAa,IAAI,iBAAiB,IAAI,OAAO,IAAI,OAAO,EAAE;QAC5D,MAAM,aAAG,CACP,0CAAgC,CAC9B,OAAO,EACP,OAAO,EACP,aAAa,EACb,iBAAiB,CAClB,CACF,CAAA;KACF;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Network } from '@dcl/schemas';
|
|
2
|
+
import { NetworkGatewayType } from 'decentraland-ui';
|
|
3
|
+
import { MoonPayTransactionStatus } from '../manaFiatGateway/moonpay/types';
|
|
4
|
+
export declare type RedirectTransactionQuery = {
|
|
5
|
+
network?: Network;
|
|
6
|
+
gateway?: NetworkGatewayType;
|
|
7
|
+
transactionId?: string;
|
|
8
|
+
transactionStatus?: MoonPayTransactionStatus;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/location/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locations.js","sourceRoot":"","sources":["../../src/modules/locations.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG;IACf,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU;CACzB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Purchase } from './types';
|
|
2
|
+
export declare const SET_PURCHASE = "Set Purchase";
|
|
3
|
+
export declare const setPurchase: (purchase: Purchase) => import("typesafe-actions/dist/types").PayloadAction<"Set Purchase", {
|
|
4
|
+
purchase: Purchase;
|
|
5
|
+
}>;
|
|
6
|
+
export declare type SetPurchaseAction = ReturnType<typeof setPurchase>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setPurchase = exports.SET_PURCHASE = void 0;
|
|
4
|
+
const typesafe_actions_1 = require("typesafe-actions");
|
|
5
|
+
// Set Purchase
|
|
6
|
+
exports.SET_PURCHASE = 'Set Purchase';
|
|
7
|
+
const setPurchase = (purchase) => typesafe_actions_1.action(exports.SET_PURCHASE, { purchase });
|
|
8
|
+
exports.setPurchase = setPurchase;
|
|
9
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/modules/mana/actions.ts"],"names":[],"mappings":";;;AAAA,uDAAyC;AAGzC,eAAe;AACF,QAAA,YAAY,GAAG,cAAc,CAAA;AACnC,MAAM,WAAW,GAAG,CAAC,QAAkB,EAAE,EAAE,CAChD,yBAAM,CAAC,oBAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;AADvB,QAAA,WAAW,eACY"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Network } from '@dcl/schemas';
|
|
2
|
+
import { NetworkGatewayType } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/Network';
|
|
3
|
+
export declare enum PurchaseStatus {
|
|
4
|
+
PENDING = "pending",
|
|
5
|
+
FAILED = "failed",
|
|
6
|
+
CANCELLED = "cancelled",
|
|
7
|
+
COMPLETE = "complete"
|
|
8
|
+
}
|
|
9
|
+
export declare type Purchase = {
|
|
10
|
+
id: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
network: Network;
|
|
13
|
+
gateway: NetworkGatewayType;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
status: PurchaseStatus;
|
|
16
|
+
address: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PurchaseStatus = void 0;
|
|
4
|
+
var PurchaseStatus;
|
|
5
|
+
(function (PurchaseStatus) {
|
|
6
|
+
PurchaseStatus["PENDING"] = "pending";
|
|
7
|
+
PurchaseStatus["FAILED"] = "failed";
|
|
8
|
+
PurchaseStatus["CANCELLED"] = "cancelled";
|
|
9
|
+
PurchaseStatus["COMPLETE"] = "complete";
|
|
10
|
+
})(PurchaseStatus = exports.PurchaseStatus || (exports.PurchaseStatus = {}));
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/mana/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;AACvB,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Network } from '@dcl/schemas';
|
|
2
|
+
import { NetworkGatewayType } from 'decentraland-ui/dist/components/BuyManaWithFiatModal/Network';
|
|
3
|
+
import { MoonPayTransactionStatus } from './moonpay/types';
|
|
4
|
+
export declare const OPEN_MANA_FIAT_GATEWAY = "Open MANA-FIAT Gateway";
|
|
5
|
+
export declare const openManaFiatGateway: (network: Network, gateway: NetworkGatewayType) => import("typesafe-actions/dist/types").PayloadAction<"Open MANA-FIAT Gateway", {
|
|
6
|
+
network: Network;
|
|
7
|
+
gateway: NetworkGatewayType;
|
|
8
|
+
}>;
|
|
9
|
+
export declare type OpenManaFiatGatewayAction = ReturnType<typeof openManaFiatGateway>;
|
|
10
|
+
export declare const SET_WIDGET_URL = "Set Widget Url";
|
|
11
|
+
export declare const setWidgetUrl: (widgetUrl: string) => import("typesafe-actions/dist/types").PayloadAction<"Set Widget Url", {
|
|
12
|
+
widgetUrl: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare type SetWidgetUrlAction = ReturnType<typeof setWidgetUrl>;
|
|
15
|
+
export declare const MANA_FIAT_GATEWAY_PURCHASE_COMPLETED = "[Request] MANA-FIAT Gateway Purchase Completed";
|
|
16
|
+
export declare const MANA_FIAT_GATEWAY_PURCHASE_COMPLETED_FAILURE = "[Failure] MANA-FIAT Gateway Purchase Completed";
|
|
17
|
+
export declare const manaFiatGatewayPurchaseCompleted: (network: Network, gateway: NetworkGatewayType, transactionId: string, status: MoonPayTransactionStatus) => import("typesafe-actions/dist/types").PayloadAction<"[Request] MANA-FIAT Gateway Purchase Completed", {
|
|
18
|
+
network: Network;
|
|
19
|
+
gateway: NetworkGatewayType;
|
|
20
|
+
transactionId: string;
|
|
21
|
+
status: MoonPayTransactionStatus;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const manaFiatGatewayPurchaseCompletedFailure: (network: Network, gateway: NetworkGatewayType, transactionId: string, error: string) => import("typesafe-actions/dist/types").PayloadAction<"[Failure] MANA-FIAT Gateway Purchase Completed", {
|
|
24
|
+
network: Network;
|
|
25
|
+
gateway: NetworkGatewayType;
|
|
26
|
+
transactionId: string;
|
|
27
|
+
error: string;
|
|
28
|
+
}>;
|
|
29
|
+
export declare type ManaFiatGatewayPurchaseCompletedAction = ReturnType<typeof manaFiatGatewayPurchaseCompleted>;
|
|
30
|
+
export declare type ManaFiatGatewayPurchaseCompletedFailureAction = ReturnType<typeof manaFiatGatewayPurchaseCompletedFailure>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.manaFiatGatewayPurchaseCompletedFailure = exports.manaFiatGatewayPurchaseCompleted = exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED_FAILURE = exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED = exports.setWidgetUrl = exports.SET_WIDGET_URL = exports.openManaFiatGateway = exports.OPEN_MANA_FIAT_GATEWAY = void 0;
|
|
4
|
+
const typesafe_actions_1 = require("typesafe-actions");
|
|
5
|
+
// Open MANA-FIAT Gateway
|
|
6
|
+
exports.OPEN_MANA_FIAT_GATEWAY = 'Open MANA-FIAT Gateway';
|
|
7
|
+
const openManaFiatGateway = (network, gateway) => typesafe_actions_1.action(exports.OPEN_MANA_FIAT_GATEWAY, { network, gateway });
|
|
8
|
+
exports.openManaFiatGateway = openManaFiatGateway;
|
|
9
|
+
// Set Widget Url
|
|
10
|
+
exports.SET_WIDGET_URL = 'Set Widget Url';
|
|
11
|
+
const setWidgetUrl = (widgetUrl) => typesafe_actions_1.action(exports.SET_WIDGET_URL, { widgetUrl });
|
|
12
|
+
exports.setWidgetUrl = setWidgetUrl;
|
|
13
|
+
// MANA-FIAT Gateway Purchase Completed
|
|
14
|
+
exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED = '[Request] MANA-FIAT Gateway Purchase Completed';
|
|
15
|
+
exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED_FAILURE = '[Failure] MANA-FIAT Gateway Purchase Completed';
|
|
16
|
+
const manaFiatGatewayPurchaseCompleted = (network, gateway, transactionId, status) => typesafe_actions_1.action(exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED, {
|
|
17
|
+
network,
|
|
18
|
+
gateway,
|
|
19
|
+
transactionId,
|
|
20
|
+
status
|
|
21
|
+
});
|
|
22
|
+
exports.manaFiatGatewayPurchaseCompleted = manaFiatGatewayPurchaseCompleted;
|
|
23
|
+
const manaFiatGatewayPurchaseCompletedFailure = (network, gateway, transactionId, error) => typesafe_actions_1.action(exports.MANA_FIAT_GATEWAY_PURCHASE_COMPLETED_FAILURE, {
|
|
24
|
+
network,
|
|
25
|
+
gateway,
|
|
26
|
+
transactionId,
|
|
27
|
+
error
|
|
28
|
+
});
|
|
29
|
+
exports.manaFiatGatewayPurchaseCompletedFailure = manaFiatGatewayPurchaseCompletedFailure;
|
|
30
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/modules/manaFiatGateway/actions.ts"],"names":[],"mappings":";;;AACA,uDAAyC;AAIzC,yBAAyB;AACZ,QAAA,sBAAsB,GAAG,wBAAwB,CAAA;AAEvD,MAAM,mBAAmB,GAAG,CACjC,OAAgB,EAChB,OAA2B,EAC3B,EAAE,CAAC,yBAAM,CAAC,8BAAsB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;AAH5C,QAAA,mBAAmB,uBAGyB;AAIzD,iBAAiB;AACJ,QAAA,cAAc,GAAG,gBAAgB,CAAA;AAEvC,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,EAAE,CAChD,yBAAM,CAAC,sBAAc,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;AAD1B,QAAA,YAAY,gBACc;AAIvC,uCAAuC;AAC1B,QAAA,oCAAoC,GAC/C,gDAAgD,CAAA;AACrC,QAAA,4CAA4C,GACvD,gDAAgD,CAAA;AAE3C,MAAM,gCAAgC,GAAG,CAC9C,OAAgB,EAChB,OAA2B,EAC3B,aAAqB,EACrB,MAAgC,EAChC,EAAE,CACF,yBAAM,CAAC,4CAAoC,EAAE;IAC3C,OAAO;IACP,OAAO;IACP,aAAa;IACb,MAAM;CACP,CAAC,CAAA;AAXS,QAAA,gCAAgC,oCAWzC;AACG,MAAM,uCAAuC,GAAG,CACrD,OAAgB,EAChB,OAA2B,EAC3B,aAAqB,EACrB,KAAa,EACb,EAAE,CACF,yBAAM,CAAC,oDAA4C,EAAE;IACnD,OAAO;IACP,OAAO;IACP,aAAa;IACb,KAAK;CACN,CAAC,CAAA;AAXS,QAAA,uCAAuC,2CAWhD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Network } from '@dcl/schemas';
|
|
2
|
+
import { Purchase } from '../../mana/types';
|
|
3
|
+
import { MoonPayConfig } from '../types';
|
|
4
|
+
import { MoonPayTransaction } from './types';
|
|
5
|
+
export declare class MoonPay {
|
|
6
|
+
private readonly apiKey;
|
|
7
|
+
private readonly widgetBaseUrl;
|
|
8
|
+
private readonly moonPayAPI;
|
|
9
|
+
constructor(config: MoonPayConfig);
|
|
10
|
+
private getPurchaseStatus;
|
|
11
|
+
/**
|
|
12
|
+
* Given the transaction id, returns the MoonPay Transaction.
|
|
13
|
+
*
|
|
14
|
+
* @param transactionId - MoonPay Transaction ID.
|
|
15
|
+
*/
|
|
16
|
+
getTransaction(transactionId: string): Promise<MoonPayTransaction>;
|
|
17
|
+
/**
|
|
18
|
+
* Given the transaction, returns a Promise of an object with the relevant information of the purchase.
|
|
19
|
+
*
|
|
20
|
+
* @param transaction - MoonPay Transaction.
|
|
21
|
+
*/
|
|
22
|
+
createPurchase(transaction: MoonPayTransaction, network: Network): Purchase;
|
|
23
|
+
widgetUrl(address: string, network: Network): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MoonPay = void 0;
|
|
13
|
+
const Network_1 = require("decentraland-ui/dist/components/BuyManaWithFiatModal/Network");
|
|
14
|
+
const api_1 = require("../../../lib/api");
|
|
15
|
+
const types_1 = require("../../mana/types");
|
|
16
|
+
const types_2 = require("./types");
|
|
17
|
+
class MoonPay {
|
|
18
|
+
constructor(config) {
|
|
19
|
+
const { apiKey, apiBaseUrl, widgetBaseUrl } = config;
|
|
20
|
+
this.apiKey = apiKey;
|
|
21
|
+
this.widgetBaseUrl = widgetBaseUrl;
|
|
22
|
+
this.moonPayAPI = new api_1.BaseAPI(apiBaseUrl);
|
|
23
|
+
}
|
|
24
|
+
getPurchaseStatus(status) {
|
|
25
|
+
return {
|
|
26
|
+
[types_2.MoonPayTransactionStatus.WAITING_PAYMENT]: types_1.PurchaseStatus.PENDING,
|
|
27
|
+
[types_2.MoonPayTransactionStatus.PENDING]: types_1.PurchaseStatus.PENDING,
|
|
28
|
+
[types_2.MoonPayTransactionStatus.WAITING_AUTHORIZATION]: types_1.PurchaseStatus.PENDING,
|
|
29
|
+
[types_2.MoonPayTransactionStatus.FAILED]: types_1.PurchaseStatus.FAILED,
|
|
30
|
+
[types_2.MoonPayTransactionStatus.COMPLETED]: types_1.PurchaseStatus.COMPLETE
|
|
31
|
+
}[status];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Given the transaction id, returns the MoonPay Transaction.
|
|
35
|
+
*
|
|
36
|
+
* @param transactionId - MoonPay Transaction ID.
|
|
37
|
+
*/
|
|
38
|
+
getTransaction(transactionId) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return yield this.moonPayAPI.request('GET', `/v1/transactions/${transactionId}`, { apiKey: this.apiKey });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Given the transaction, returns a Promise of an object with the relevant information of the purchase.
|
|
45
|
+
*
|
|
46
|
+
* @param transaction - MoonPay Transaction.
|
|
47
|
+
*/
|
|
48
|
+
createPurchase(transaction, network) {
|
|
49
|
+
const { id, quoteCurrencyAmount, createdAt, status, walletAddress } = transaction;
|
|
50
|
+
return {
|
|
51
|
+
id,
|
|
52
|
+
amount: quoteCurrencyAmount,
|
|
53
|
+
network,
|
|
54
|
+
timestamp: +new Date(createdAt),
|
|
55
|
+
status: this.getPurchaseStatus(status),
|
|
56
|
+
address: walletAddress,
|
|
57
|
+
gateway: Network_1.NetworkGatewayType.MOON_PAY
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
widgetUrl(address, network) {
|
|
61
|
+
const redirectURL = `${window.location.origin}?network=${network}&gateway=${Network_1.NetworkGatewayType.MOON_PAY}`;
|
|
62
|
+
return `${this.widgetBaseUrl}?apiKey=${this.apiKey}¤cyCode=MANA&walletAddres=${address}&redirectURL=${encodeURIComponent(redirectURL)}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.MoonPay = MoonPay;
|
|
66
|
+
//# sourceMappingURL=MoonPay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoonPay.js","sourceRoot":"","sources":["../../../../src/modules/manaFiatGateway/moonpay/MoonPay.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0FAAiG;AACjG,0CAA0C;AAC1C,4CAA2D;AAE3D,mCAAsE;AAEtE,MAAa,OAAO;IAKlB,YAAY,MAAqB;QAC/B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,MAAM,CAAA;QAEpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,aAAO,CAAC,UAAU,CAAC,CAAA;IAC3C,CAAC;IAEO,iBAAiB,CAAC,MAAgC;QACxD,OAAO;YACL,CAAC,gCAAwB,CAAC,eAAe,CAAC,EAAE,sBAAc,CAAC,OAAO;YAClE,CAAC,gCAAwB,CAAC,OAAO,CAAC,EAAE,sBAAc,CAAC,OAAO;YAC1D,CAAC,gCAAwB,CAAC,qBAAqB,CAAC,EAAE,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esModule", { value: true });
|
|
3
|
+
exports.MoonPay = void 0;
|
|
4
|
+
var MoonPay_1 = require("./MoonPay");
|
|
5
|
+
Object.defineProperty(exports, "MoonPay", { enumerable: true, get: function () { return MoonPay_1.MoonPay; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/manaFiatGateway/moonpay/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
|