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,72 @@
1
+ //debug
2
+ const API_URL_DEBUG = 'https://test-sdk1.pluto.vision/';
3
+ const PAYLOAD_URL_DEBUG = 'https://test-bc1.pluto.vision/api/ton/getTokenPayload';
4
+ const TON_CENTER_URL_DEBUG = 'https://testnet.toncenter.com/api/v3/jetton/wallets';
5
+ const TOKENS_JETTON_ADDRESS_DEBUG = {
6
+ NOT: 'kQBUTS4ag2sK2kdB34PmxtNnD2pgLEhpb6aZPh-x8HGdy_1S',
7
+ CATI: 'kQAHDaT2GnuX5GNrrtenrzmGeMbE7VCldSHovfEXA19FtyRl',
8
+ USDT: 'kQB0rxb4k-xFwXVzBpvJwt4_ChPvqMScDAKMBfQZw2Od8MFB'
9
+ };
10
+ const MANIFEST_URL_DEBUG = 'https://games.pluto.vision/sdk/manifest/test/';
11
+ //release
12
+ const API_URL_RELEASE = 'https://sdk1.pluto.vision/';
13
+ const PAYLOAD_URL_RELEASE = 'https://bc1.pluto.vision/api/ton/getTokenPayload';
14
+ const TON_CENTER_URL_RELEASE = 'https://toncenter.com/api/v3/jetton/wallets';
15
+ const TOKENS_JETTON_ADDRESS_RELEASE = {
16
+ NOT: 'EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT',
17
+ CATI: 'kQAHDaT2GnuX5GNrrtenrzmGeMbE7VCldSHovfEXA19FtyRl',
18
+ USDT: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'
19
+ };
20
+ const MANIFEST_URL_RELEASE = 'https://games.pluto.vision/sdk/manifest/release/';
21
+ /**
22
+ *
23
+ */
24
+ export default class Config {
25
+ /**
26
+ *
27
+ * @param initConfig
28
+ */
29
+ static init() {
30
+ if (process.env.NODE_ENV == 'development') {
31
+ Config.TEST_MODE = true;
32
+ Config.GAME_ID = process.env.REACT_APP_GAME_ID;
33
+ Config.BOT_NAME = process.env.REACT_APP_BOT_NAME;
34
+ Config.INIT_DATA = process.env.REACT_APP_INIT_DATA;
35
+ }
36
+ else {
37
+ let urlParams = new URLSearchParams(location.search);
38
+ Config.TEST_MODE = urlParams.get('debug') == '1';
39
+ Config.GAME_ID = urlParams.get('gameid');
40
+ Config.BOT_NAME = urlParams.get('botname');
41
+ Config.INIT_DATA = urlParams.get('initdata');
42
+ //
43
+ if (!Config.INIT_DATA) {
44
+ Config.INIT_DATA = Telegram.WebApp.initData;
45
+ }
46
+ }
47
+ //
48
+ if (Config.TEST_MODE) {
49
+ Config.API_URL = API_URL_DEBUG;
50
+ Config.PAYLOAD_URL = PAYLOAD_URL_DEBUG;
51
+ Config.TON_CENTER_URL = TON_CENTER_URL_DEBUG;
52
+ Config.TOKENS_JETTON_ADDRESS = TOKENS_JETTON_ADDRESS_DEBUG;
53
+ Config.MANIFEST_URL = `${MANIFEST_URL_DEBUG}manifest-${Config.GAME_ID}.json`;
54
+ }
55
+ else {
56
+ Config.MANIFEST_URL = `${MANIFEST_URL_RELEASE}manifest-${Config.GAME_ID}.json`;
57
+ }
58
+ }
59
+ }
60
+ Config.APP_VERSION = process.env.REACT_APP_VERSION;
61
+ Config.RES_URL = process.env.REACT_APP_RES_URL;
62
+ //
63
+ Config.API_URL = API_URL_RELEASE;
64
+ Config.PAYLOAD_URL = PAYLOAD_URL_RELEASE;
65
+ Config.TON_CENTER_URL = TON_CENTER_URL_RELEASE;
66
+ Config.TOKENS_JETTON_ADDRESS = TOKENS_JETTON_ADDRESS_RELEASE;
67
+ Config.MANIFEST_URL = '';
68
+ //
69
+ Config.TEST_MODE = false;
70
+ Config.GAME_ID = '';
71
+ Config.BOT_NAME = '';
72
+ Config.INIT_DATA = '';
@@ -0,0 +1,38 @@
1
+ export declare const EVENT_GAME_INFO_LOADED = "event_game_info_loaded";
2
+ export declare const EVENT_GAME_READY = "event_game_ready";
3
+ export declare const EVENT_SWITCH_PAGE = "event_switch_page";
4
+ export declare const EVENT_WALLET_CONNECT = "event_wallet_connect";
5
+ export declare const EVENT_PURCHASE_COMPLETED = "event_purchase_completed";
6
+ export declare enum CODE {
7
+ Success = 0,
8
+ NetError = 1,
9
+ WalletError = 2,
10
+ InsufficientFunds = 3,
11
+ NotInit = 4,
12
+ InitError = 5,
13
+ NotLogin = 6,
14
+ Logined = 7,
15
+ Purchaseing = 8,
16
+ ClipboardError = 9
17
+ }
18
+ export declare enum PAGE_ID {
19
+ None = 0,
20
+ Index = 1,
21
+ Login = 2,
22
+ Purchase = 3
23
+ }
24
+ export declare enum PAY_TYPE {
25
+ star = 1,
26
+ tonConnect = 2
27
+ }
28
+ export declare enum CURRENCY {
29
+ ton = "TON",
30
+ not = "NOT",
31
+ usdt = "USDT",
32
+ star = "STAR"
33
+ }
34
+ export declare enum TOKEN_NAME {
35
+ not = "NOT",
36
+ cati = "CATI",
37
+ usdt = "USDT"
38
+ }
@@ -0,0 +1,43 @@
1
+ export const EVENT_GAME_INFO_LOADED = 'event_game_info_loaded';
2
+ export const EVENT_GAME_READY = 'event_game_ready';
3
+ export const EVENT_SWITCH_PAGE = 'event_switch_page';
4
+ export const EVENT_WALLET_CONNECT = 'event_wallet_connect';
5
+ export const EVENT_PURCHASE_COMPLETED = 'event_purchase_completed';
6
+ export var CODE;
7
+ (function (CODE) {
8
+ CODE[CODE["Success"] = 0] = "Success";
9
+ CODE[CODE["NetError"] = 1] = "NetError";
10
+ CODE[CODE["WalletError"] = 2] = "WalletError";
11
+ CODE[CODE["InsufficientFunds"] = 3] = "InsufficientFunds";
12
+ CODE[CODE["NotInit"] = 4] = "NotInit";
13
+ CODE[CODE["InitError"] = 5] = "InitError";
14
+ CODE[CODE["NotLogin"] = 6] = "NotLogin";
15
+ CODE[CODE["Logined"] = 7] = "Logined";
16
+ CODE[CODE["Purchaseing"] = 8] = "Purchaseing";
17
+ CODE[CODE["ClipboardError"] = 9] = "ClipboardError";
18
+ })(CODE || (CODE = {}));
19
+ export var PAGE_ID;
20
+ (function (PAGE_ID) {
21
+ PAGE_ID[PAGE_ID["None"] = 0] = "None";
22
+ PAGE_ID[PAGE_ID["Index"] = 1] = "Index";
23
+ PAGE_ID[PAGE_ID["Login"] = 2] = "Login";
24
+ PAGE_ID[PAGE_ID["Purchase"] = 3] = "Purchase";
25
+ })(PAGE_ID || (PAGE_ID = {}));
26
+ export var PAY_TYPE;
27
+ (function (PAY_TYPE) {
28
+ PAY_TYPE[PAY_TYPE["star"] = 1] = "star";
29
+ PAY_TYPE[PAY_TYPE["tonConnect"] = 2] = "tonConnect";
30
+ })(PAY_TYPE || (PAY_TYPE = {}));
31
+ export var CURRENCY;
32
+ (function (CURRENCY) {
33
+ CURRENCY["ton"] = "TON";
34
+ CURRENCY["not"] = "NOT";
35
+ CURRENCY["usdt"] = "USDT";
36
+ CURRENCY["star"] = "STAR";
37
+ })(CURRENCY || (CURRENCY = {}));
38
+ export var TOKEN_NAME;
39
+ (function (TOKEN_NAME) {
40
+ TOKEN_NAME["not"] = "NOT";
41
+ TOKEN_NAME["cati"] = "CATI";
42
+ TOKEN_NAME["usdt"] = "USDT";
43
+ })(TOKEN_NAME || (TOKEN_NAME = {}));
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "plutosdk",
3
+ "version": "0.0.8-beta.1",
4
+ "author": "pluto",
5
+ "main": "./lib/index.js",
6
+ "files": [
7
+ "lib",
8
+ "dist/pluto-sdk.js",
9
+ "dist/pluto-sdk.js.map"
10
+ ],
11
+ "dependencies": {
12
+ "@emotion/react": "^11.13.0",
13
+ "@emotion/styled": "^11.13.0",
14
+ "@mui/icons-material": "^5.16.4",
15
+ "@mui/material": "^5.16.4",
16
+ "@tonconnect/ui": "^2.0.6",
17
+ "@types/telegram-web-app": "^7.3.1",
18
+ "@types/ua-parser-js": "^0.7.39",
19
+ "axios": "^1.7.2",
20
+ "pubsub-js": "^1.9.4",
21
+ "react": "^18.3.1",
22
+ "react-dom": "^18.3.1",
23
+ "react-scripts": "^5.0.1",
24
+ "ua-parser-js": "^1.0.38"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
28
+ "@types/pubsub-js": "^1.8.6",
29
+ "@types/react": "^18.3.3",
30
+ "@types/react-dom": "^18.3.0",
31
+ "react-app-rewired": "^2.2.1",
32
+ "typescript": "^4.9.5"
33
+ },
34
+ "scripts": {
35
+ "start": "react-app-rewired start",
36
+ "build": "react-app-rewired build && tsc",
37
+ "eject": "react-scripts eject"
38
+ },
39
+ "browserslist": {
40
+ "production": [
41
+ ">0.2%",
42
+ "not dead",
43
+ "not op_mini all"
44
+ ],
45
+ "development": [
46
+ "last 1 chrome version",
47
+ "last 1 firefox version",
48
+ "last 1 safari version"
49
+ ]
50
+ }
51
+ }