plutosdk 0.0.8-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +77 -0
  2. package/dist/pluto-sdk.js +2 -0
  3. package/lib/App.d.ts +24 -0
  4. package/lib/App.js +61 -0
  5. package/lib/components/BlurMask/index.d.ts +10 -0
  6. package/lib/components/BlurMask/index.js +14 -0
  7. package/lib/components/CatAni/index.d.ts +30 -0
  8. package/lib/components/CatAni/index.js +243 -0
  9. package/lib/components/GameInfo/index.d.ts +10 -0
  10. package/lib/components/GameInfo/index.js +17 -0
  11. package/lib/components/Index/index.d.ts +10 -0
  12. package/lib/components/Index/index.js +15 -0
  13. package/lib/components/Login/index.d.ts +10 -0
  14. package/lib/components/Login/index.js +28 -0
  15. package/lib/components/NetLoading/index.d.ts +7 -0
  16. package/lib/components/NetLoading/index.js +12 -0
  17. package/lib/components/PayButton/index.d.ts +16 -0
  18. package/lib/components/PayButton/index.js +18 -0
  19. package/lib/components/PlayButton/index.d.ts +29 -0
  20. package/lib/components/PlayButton/index.js +56 -0
  21. package/lib/components/Purchase/index.d.ts +61 -0
  22. package/lib/components/Purchase/index.js +183 -0
  23. package/lib/components/ShareButton/index.d.ts +14 -0
  24. package/lib/components/ShareButton/index.js +29 -0
  25. package/lib/components/StrokeText/index.d.ts +18 -0
  26. package/lib/components/StrokeText/index.js +32 -0
  27. package/lib/components/WalletInfo/index.d.ts +36 -0
  28. package/lib/components/WalletInfo/index.js +107 -0
  29. package/lib/index.d.ts +1 -0
  30. package/lib/index.js +4 -0
  31. package/lib/interface.d.ts +42 -0
  32. package/lib/interface.js +1 -0
  33. package/lib/main.d.ts +5 -0
  34. package/lib/main.js +19 -0
  35. package/lib/sdk.d.ts +46 -0
  36. package/lib/sdk.js +306 -0
  37. package/lib/utils/Api.d.ts +32 -0
  38. package/lib/utils/Api.js +122 -0
  39. package/lib/utils/Net.d.ts +33 -0
  40. package/lib/utils/Net.js +94 -0
  41. package/lib/utils/Platform.d.ts +63 -0
  42. package/lib/utils/Platform.js +142 -0
  43. package/lib/utils/User.d.ts +62 -0
  44. package/lib/utils/User.js +78 -0
  45. package/lib/utils/Utils.d.ts +10 -0
  46. package/lib/utils/Utils.js +72 -0
  47. package/lib/utils/WalletManager.d.ts +52 -0
  48. package/lib/utils/WalletManager.js +236 -0
  49. package/lib/utils/config.d.ts +25 -0
  50. package/lib/utils/config.js +72 -0
  51. package/lib/utils/constant.d.ts +38 -0
  52. package/lib/utils/constant.js +43 -0
  53. package/package.json +51 -0
@@ -0,0 +1,61 @@
1
+ import { PureComponent } from 'react';
2
+ import { ITransaction } from '../../interface';
3
+ /**
4
+ *
5
+ */
6
+ export default class Purchase extends PureComponent {
7
+ private _timer;
8
+ private _status;
9
+ state: {
10
+ showLoading: boolean;
11
+ };
12
+ /**
13
+ *
14
+ */
15
+ componentWillUnmount(): void;
16
+ /**
17
+ *
18
+ */
19
+ render(): import("react/jsx-runtime").JSX.Element;
20
+ /**
21
+ *
22
+ */
23
+ connectWallet(): Promise<void>;
24
+ /**
25
+ *
26
+ * @param transaction
27
+ */
28
+ sendTransaction(transaction: ITransaction): void;
29
+ /**
30
+ *
31
+ */
32
+ startLoading(): void;
33
+ /**
34
+ *
35
+ */
36
+ stopLoading(): void;
37
+ /**
38
+ *
39
+ */
40
+ clearTimer(): void;
41
+ /**
42
+ *
43
+ */
44
+ onClickTon: () => void;
45
+ /**
46
+ *
47
+ */
48
+ onClickNot: () => void;
49
+ /**
50
+ *
51
+ */
52
+ onClickUsdt: () => void;
53
+ /**
54
+ *
55
+ */
56
+ onClickStar: () => void;
57
+ /**
58
+ *
59
+ */
60
+ onClickClose: () => void;
61
+ }
@@ -0,0 +1,183 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PureComponent } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Slide from '@mui/material/Slide';
5
+ import Stack from '@mui/material/Stack';
6
+ import PubSub from 'pubsub-js';
7
+ import { CURRENCY, EVENT_PURCHASE_COMPLETED, EVENT_SWITCH_PAGE, PAGE_ID, PAY_TYPE, TOKEN_NAME } from '../../utils/constant';
8
+ import { getRes } from '../../utils/Utils';
9
+ import user from '../../utils/User';
10
+ import platform from '../../utils/Platform';
11
+ import walletManager from '../../utils/WalletManager';
12
+ import WalletInfo from '../WalletInfo';
13
+ import NetLoading from '../NetLoading';
14
+ import StrokeText from '../StrokeText';
15
+ import PayButton from '../PayButton';
16
+ /**
17
+ *
18
+ */
19
+ export default class Purchase extends PureComponent {
20
+ constructor() {
21
+ super(...arguments);
22
+ //
23
+ this._status = false;
24
+ //
25
+ this.state = {
26
+ showLoading: false
27
+ };
28
+ /**
29
+ *
30
+ */
31
+ this.onClickTon = () => {
32
+ this.connectWallet().then(() => {
33
+ this.startLoading();
34
+ return platform.reqOrder(PAY_TYPE.tonConnect, CURRENCY.ton);
35
+ }).then(data => {
36
+ this.stopLoading();
37
+ this.sendTransaction({
38
+ amount: data.amount,
39
+ address: data.walletAddress,
40
+ payload: data.payload
41
+ });
42
+ }).catch((error) => {
43
+ this.stopLoading();
44
+ console.log(error.message);
45
+ });
46
+ };
47
+ /**
48
+ *
49
+ */
50
+ this.onClickNot = () => {
51
+ this.connectWallet().then(() => {
52
+ this.startLoading();
53
+ return platform.reqOrder(PAY_TYPE.tonConnect, CURRENCY.not);
54
+ }).then(data => {
55
+ return walletManager.getTokenJettonPayInfo(TOKEN_NAME.not, data.amount, data.payload, data.walletAddress);
56
+ }).then(data => {
57
+ this.stopLoading();
58
+ this.sendTransaction({
59
+ amount: 0.1 * 1e9 + '',
60
+ address: data.address,
61
+ payload: data.payload
62
+ });
63
+ }).catch((error) => {
64
+ this.stopLoading();
65
+ console.log(error.message);
66
+ });
67
+ };
68
+ /**
69
+ *
70
+ */
71
+ this.onClickUsdt = () => {
72
+ this.connectWallet().then(() => {
73
+ this.startLoading();
74
+ return platform.reqOrder(PAY_TYPE.tonConnect, CURRENCY.usdt);
75
+ }).then(data => {
76
+ return walletManager.getTokenJettonPayInfo(TOKEN_NAME.usdt, data.amount, data.payload, data.walletAddress);
77
+ }).then(data => {
78
+ this.stopLoading();
79
+ this.sendTransaction({
80
+ amount: 0.1 * 1e9 + '',
81
+ address: data.address,
82
+ payload: data.payload
83
+ });
84
+ }).catch((error) => {
85
+ this.stopLoading();
86
+ console.log(error.message);
87
+ });
88
+ };
89
+ /**
90
+ *
91
+ */
92
+ this.onClickStar = () => {
93
+ this.startLoading();
94
+ platform.reqOrder(PAY_TYPE.star, CURRENCY.star).then(data => {
95
+ this.stopLoading();
96
+ platform.openInvoice(data.payLink).then(() => {
97
+ this._status = true;
98
+ this.onClickClose();
99
+ });
100
+ });
101
+ };
102
+ /**
103
+ *
104
+ */
105
+ this.onClickClose = () => {
106
+ PubSub.publish(EVENT_SWITCH_PAGE, PAGE_ID.None);
107
+ };
108
+ }
109
+ /**
110
+ *
111
+ */
112
+ componentWillUnmount() {
113
+ this.clearTimer();
114
+ PubSub.publish(EVENT_PURCHASE_COMPLETED, this._status);
115
+ }
116
+ /**
117
+ *
118
+ */
119
+ render() {
120
+ const { name, usdt, ton, not, star } = user.purchaseData;
121
+ const { showLoading } = this.state;
122
+ return (_jsxs(Box, Object.assign({ sx: { width: '100%', height: '100%', position: 'relative' } }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', left: 0, top: 0, background: 'rgba(0,0,0,0.4)', backgroundSize: "cover", backdropFilter: 'blur(10px)', WebkitBackdropFilter: 'blur(10px)' }, onClick: this.onClickClose }), _jsx(Box, Object.assign({ sx: { width: '100%', bottom: 10, position: 'absolute' } }, { children: _jsx(Slide, Object.assign({ direction: 'up', in: true, mountOnEnter: true, unmountOnExit: true }, { children: _jsxs(Box, Object.assign({ sx: { width: '96%', maxWidth: 430, margin: '0 auto', position: 'relative' } }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', borderImage: `url(${getRes('bg2.png')})`, borderWidth: 40, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '40 fill' } }), _jsx(Box, Object.assign({ sx: { width: '100%', height: 70, position: 'relative' } }, { children: _jsxs(Box, Object.assign({ sx: { width: '100%', height: 70, paddingTop: 1, position: 'absolute', display: 'flex', justifyContent: 'center', alignItems: 'center' } }, { children: [_jsx(Box, Object.assign({ sx: { width: 36, height: 70, display: 'inline-block', position: 'relative' } }, { children: _jsx("img", { style: { position: 'absolute', left: 0, bottom: '18px' }, src: getRes('dot.png'), alt: "" }) })), _jsx(Box, Object.assign({ sx: { fontSize: 32, fontWeight: 'bold', color: '#ca996e', display: 'inline-block' } }, { children: "Purchase" })), _jsx(Box, Object.assign({ sx: { width: 36, height: 70, display: 'inline-block', position: 'relative' } }, { children: _jsx("img", { style: { position: 'absolute', right: 0, top: '16px' }, src: getRes('dot.png'), alt: "" }) }))] })) })), _jsx(Box, { sx: { marginLeft: 5, marginRight: 5, borderBottom: '3px solid #a8774d', position: 'relative' } }), _jsxs(Box, Object.assign({ sx: { width: '100%', height: 120, position: 'relative' } }, { children: [_jsxs(Box, Object.assign({ sx: { top: 0, left: 0, width: '100%', textAlign: 'center', position: 'absolute', zIndex: 1 } }, { children: [_jsx(Box, Object.assign({ sx: { fontSize: 24, fontWeight: 800, paddingTop: 3, color: '#7c4b30' } }, { children: name })), _jsx(Box, Object.assign({ sx: { width: '100%', height: 30, display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'absolute' } }, { children: _jsx(StrokeText, { content: `= $${usdt.toFixed(2)}`, fontSize: 18, color: '#fff', strokeColor: '#ba4f25', strokeWidth: 3 }) }))] })), _jsx(Box, Object.assign({ sx: { marginLeft: 5, marginRight: 5, position: 'relative', zIndex: 2 } }, { children: _jsx(Box, { children: _jsx(WalletInfo, {}) }) }))] })), _jsxs(Stack, Object.assign({ spacing: 2, sx: { marginLeft: 5, marginRight: 5, paddingBottom: 4 } }, { children: [_jsx(PayButton, { content: `${ton.toFixed(2)} TON`, icon: getRes('coin_ton.png'), onClick: this.onClickTon }), _jsx(PayButton, { content: `${not.toFixed(2)} NOT`, icon: getRes('coin_not.png'), onClick: this.onClickNot }), _jsx(PayButton, { content: `${usdt.toFixed(2)} USDT`, icon: getRes('coin_usdt.png'), onClick: this.onClickUsdt }), _jsx(PayButton, { content: `${star} Star`, icon: getRes('coin_star.png'), onClick: this.onClickStar })] })), showLoading ? _jsx(NetLoading, {}) : null] })) })) }))] })));
123
+ }
124
+ /**
125
+ *
126
+ */
127
+ connectWallet() {
128
+ return new Promise((resolve, reject) => {
129
+ if (walletManager.connected) {
130
+ return resolve();
131
+ }
132
+ //
133
+ walletManager.connect().then(result => {
134
+ resolve();
135
+ }).catch(error => {
136
+ reject(error);
137
+ });
138
+ });
139
+ }
140
+ /**
141
+ *
142
+ * @param transaction
143
+ */
144
+ sendTransaction(transaction) {
145
+ walletManager.sendTransaction(transaction).then(data => {
146
+ this._status = true;
147
+ this.onClickClose();
148
+ }).catch((error) => {
149
+ console.log(error.message);
150
+ });
151
+ }
152
+ /**
153
+ *
154
+ */
155
+ startLoading() {
156
+ if (this._timer) {
157
+ return;
158
+ }
159
+ //
160
+ this._timer = window.setTimeout(() => {
161
+ this.clearTimer();
162
+ this.setState({ showLoading: true });
163
+ }, 600);
164
+ }
165
+ /**
166
+ *
167
+ */
168
+ stopLoading() {
169
+ this.clearTimer();
170
+ this.setState({ showLoading: false });
171
+ }
172
+ /**
173
+ *
174
+ */
175
+ clearTimer() {
176
+ if (!this._timer) {
177
+ return;
178
+ }
179
+ //
180
+ window.clearTimeout(this._timer);
181
+ this._timer = null;
182
+ }
183
+ }
@@ -0,0 +1,14 @@
1
+ import { PureComponent } from 'react';
2
+ /**
3
+ *
4
+ */
5
+ export default class ShareButton extends PureComponent {
6
+ /**
7
+ *
8
+ */
9
+ render(): import("react/jsx-runtime").JSX.Element;
10
+ /**
11
+ *
12
+ */
13
+ onclickShare: () => void;
14
+ }
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PureComponent } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Button from '@mui/material/Button';
5
+ import TelegramIcon from '@mui/icons-material/Telegram';
6
+ import { getRes } from '../../utils/Utils';
7
+ import platform from '../../utils/Platform';
8
+ import user from '../../utils/User';
9
+ import StrokeText from '../StrokeText';
10
+ /**
11
+ *
12
+ */
13
+ export default class ShareButton extends PureComponent {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ *
18
+ */
19
+ this.onclickShare = () => {
20
+ platform.share(user.gameInfo.describe);
21
+ };
22
+ }
23
+ /**
24
+ *
25
+ */
26
+ render() {
27
+ return (_jsx(Box, Object.assign({ sx: { height: 50, position: 'relative' } }, { children: _jsxs(Button, Object.assign({ sx: { width: '100%', height: '100%', borderRadius: 3 }, variant: 'contained', onClick: this.onclickShare }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', top: 0, borderImage: `url(${getRes('button_2.png')})`, borderWidth: 20, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '20 fill' } }), _jsxs(Box, Object.assign({ sx: { height: '100%', position: 'absolute', top: 0, display: 'flex', alignItems: 'center' } }, { children: [_jsx(Box, Object.assign({ sx: { width: 26, height: 26, paddingRight: 4 } }, { children: _jsx(TelegramIcon, { sx: { color: '#fff', width: 26, height: 26 } }) })), _jsx(StrokeText, { content: 'Share', fontSize: 22, color: '#fff', strokeColor: '#4a7408', strokeWidth: 3 })] }))] })) })));
28
+ }
29
+ }
@@ -0,0 +1,18 @@
1
+ import { PureComponent } from 'react';
2
+ interface IProps {
3
+ content: string;
4
+ fontSize: number;
5
+ color: string;
6
+ strokeColor: string;
7
+ strokeWidth: number;
8
+ }
9
+ /**
10
+ *
11
+ */
12
+ export default class index extends PureComponent<IProps> {
13
+ /**
14
+ *
15
+ */
16
+ render(): import("react/jsx-runtime").JSX.Element;
17
+ }
18
+ export {};
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PureComponent } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ /**
5
+ *
6
+ */
7
+ export default class index extends PureComponent {
8
+ /**
9
+ *
10
+ */
11
+ render() {
12
+ const { content, fontSize, color, strokeColor, strokeWidth } = this.props;
13
+ const sx = {
14
+ color: color,
15
+ fontSize: fontSize,
16
+ fontWeight: 'bold',
17
+ position: 'relative',
18
+ zIndex: 0,
19
+ textTransform: 'none',
20
+ '&:after': {
21
+ content: 'attr(content)',
22
+ WebkitTextStrokeColor: strokeColor,
23
+ WebkitTextStrokeWidth: strokeWidth,
24
+ zIndex: -1,
25
+ position: 'absolute',
26
+ left: 0,
27
+ top: 0
28
+ }
29
+ };
30
+ return (_jsx(Box, Object.assign({ content: content, sx: sx }, { children: content })));
31
+ }
32
+ }
@@ -0,0 +1,36 @@
1
+ import { PureComponent } from 'react';
2
+ /**
3
+ *
4
+ */
5
+ export default class WalletInfo extends PureComponent {
6
+ state: {
7
+ address: any;
8
+ showDisconnect: boolean;
9
+ };
10
+ /**
11
+ *
12
+ */
13
+ componentDidMount(): void;
14
+ /**
15
+ *
16
+ */
17
+ componentWillUnmount(): void;
18
+ /**
19
+ *
20
+ */
21
+ render(): import("react/jsx-runtime").JSX.Element;
22
+ /**
23
+ *
24
+ * @param _
25
+ * @param connected
26
+ */
27
+ onWalletConnect: (_: string, connected: boolean) => void;
28
+ /**
29
+ *
30
+ */
31
+ onClickWallet: () => void;
32
+ /**
33
+ *
34
+ */
35
+ onClickDisconnect: () => void;
36
+ }
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PureComponent } from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import { styled } from '@mui/material';
5
+ import Button from '@mui/material/Button';
6
+ import Stack from '@mui/material/Stack';
7
+ import PubSub from 'pubsub-js';
8
+ import { EVENT_WALLET_CONNECT } from '../../utils/constant';
9
+ import walletManager from '../../utils/WalletManager';
10
+ //
11
+ const WalletBtn = styled(Button)(() => ({
12
+ color: '#fff',
13
+ width: 100,
14
+ height: 30,
15
+ borderRadius: 13,
16
+ backgroundColor: '#e0c6a0',
17
+ borderColor: "#e0c6a0",
18
+ textTransform: "none",
19
+ '&:hover': {
20
+ backgroundColor: '#e0c6a0',
21
+ borderColor: "#e0c6a0",
22
+ }
23
+ }));
24
+ //
25
+ const DisconnectBtn = styled(Button)(() => ({
26
+ color: '#666666',
27
+ width: 100,
28
+ height: 30,
29
+ borderRadius: 13,
30
+ backgroundColor: '#fff',
31
+ borderColor: "#787772",
32
+ textTransform: "none",
33
+ '&:hover': {
34
+ backgroundColor: '#fff',
35
+ borderColor: "#787772"
36
+ }
37
+ }));
38
+ /**
39
+ *
40
+ */
41
+ export default class WalletInfo extends PureComponent {
42
+ constructor() {
43
+ super(...arguments);
44
+ //
45
+ this.state = {
46
+ address: null,
47
+ showDisconnect: false
48
+ };
49
+ /**
50
+ *
51
+ * @param _
52
+ * @param connected
53
+ */
54
+ this.onWalletConnect = (_, connected) => {
55
+ if (connected) {
56
+ this.setState({
57
+ address: walletManager.friendlyAddress
58
+ });
59
+ return;
60
+ }
61
+ //
62
+ this.setState({
63
+ address: null,
64
+ showDisconnect: false
65
+ });
66
+ };
67
+ /**
68
+ *
69
+ */
70
+ this.onClickWallet = () => {
71
+ const { showDisconnect } = this.state;
72
+ this.setState({ showDisconnect: !showDisconnect });
73
+ };
74
+ /**
75
+ *
76
+ */
77
+ this.onClickDisconnect = () => {
78
+ walletManager.disconnect();
79
+ };
80
+ }
81
+ /**
82
+ *
83
+ */
84
+ componentDidMount() {
85
+ this.setState({ address: walletManager.friendlyAddress });
86
+ PubSub.subscribe(EVENT_WALLET_CONNECT, this.onWalletConnect);
87
+ }
88
+ /**
89
+ *
90
+ */
91
+ componentWillUnmount() {
92
+ PubSub.unsubscribe(this.onWalletConnect);
93
+ }
94
+ /**
95
+ *
96
+ */
97
+ render() {
98
+ const { address, showDisconnect } = this.state;
99
+ if (!address) {
100
+ return null;
101
+ }
102
+ //
103
+ let length = address.length;
104
+ let showAddress = address.substring(0, 4) + '...' + address.substring(length - 4, length);
105
+ return (_jsx(Box, Object.assign({ sx: { float: 'right', width: 100, paddingTop: 0.5 } }, { children: _jsxs(Stack, Object.assign({ spacing: 1 }, { children: [_jsx(WalletBtn, Object.assign({ variant: 'outlined', onClick: this.onClickWallet }, { children: showAddress })), showDisconnect ? (_jsx(DisconnectBtn, Object.assign({ variant: 'outlined', onClick: this.onClickDisconnect }, { children: "Disconnect" }))) : (null)] })) })));
106
+ }
107
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './sdk';
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import run from './main';
2
+ export * from './sdk';
3
+ //
4
+ run();
@@ -0,0 +1,42 @@
1
+ export interface IError {
2
+ code: number;
3
+ message: string;
4
+ }
5
+ export interface IGame {
6
+ name: string;
7
+ describe: string;
8
+ icon: string;
9
+ }
10
+ export interface ILogin {
11
+ plutoId: string;
12
+ lastName: string;
13
+ firstName: string;
14
+ icon: string;
15
+ ticket: string;
16
+ }
17
+ export interface IPurchase {
18
+ name?: string;
19
+ productId?: string;
20
+ orderId?: string;
21
+ usdt?: number;
22
+ ton?: number;
23
+ not?: number;
24
+ star?: number;
25
+ customData?: string;
26
+ }
27
+ export interface IOrder {
28
+ amount: string;
29
+ orderNo: string;
30
+ payload: string;
31
+ payLink: string;
32
+ walletAddress: string;
33
+ }
34
+ export interface IJettonPayInfo {
35
+ address: string;
36
+ payload: string;
37
+ }
38
+ export interface ITransaction {
39
+ amount: string;
40
+ address: string;
41
+ payload: string;
42
+ }
@@ -0,0 +1 @@
1
+ export {};
package/lib/main.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ */
4
+ declare const run: () => void;
5
+ export default run;
package/lib/main.js ADDED
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createRoot } from 'react-dom/client';
3
+ import CssBaseline from '@mui/material/CssBaseline';
4
+ import Config from './utils/Config';
5
+ import App from './App';
6
+ /**
7
+ *
8
+ */
9
+ const run = () => {
10
+ console.log(`Pluto SDK version: ${Config.APP_VERSION}`);
11
+ //
12
+ const div = document.createElement('div');
13
+ div.id = 'pluto_root';
14
+ document.body.appendChild(div);
15
+ //
16
+ const root = createRoot(div);
17
+ root.render(_jsxs(_Fragment, { children: [_jsx(CssBaseline, {}), _jsx(App, {})] }));
18
+ };
19
+ export default run;
package/lib/sdk.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { ILogin } from './interface';
2
+ /**
3
+ *
4
+ */
5
+ export declare const init: () => Promise<void>;
6
+ /**
7
+ *
8
+ */
9
+ export declare const login: () => Promise<ILogin>;
10
+ /**
11
+ *
12
+ */
13
+ export declare const ready: () => void;
14
+ /**
15
+ *
16
+ */
17
+ export declare const share: () => void;
18
+ /**
19
+ *
20
+ */
21
+ export declare const getShareLink: () => string;
22
+ /**
23
+ *
24
+ */
25
+ export declare const copyShareLink: () => Promise<void>;
26
+ /**
27
+ *
28
+ * @param name
29
+ * @param orderId
30
+ * @param amount
31
+ * @param customData
32
+ * @param callback
33
+ */
34
+ export declare const purchase: (productId: string, name: string, orderId: string, amount: number, customData?: string, callback?: Function) => Promise<void>;
35
+ /**
36
+ *
37
+ */
38
+ export declare const connectWallet: () => Promise<string>;
39
+ /**
40
+ *
41
+ */
42
+ export declare const disconnectWallet: () => Promise<void>;
43
+ /**
44
+ *
45
+ */
46
+ export declare const getWalletConnected: () => boolean;