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
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # Pluto SDK for Telegram
2
+
3
+ # Getting started
4
+
5
+ ## Add the configuration required by sdk, and installation telegram web app sdk with cdn.
6
+ Add the script to your HTML file:
7
+ ```html
8
+ <meta name="viewport" content="initial-scale=1, width=device-width" />
9
+ <meta name="theme-color" content="#000000" />
10
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
11
+ <script src="https://telegram.org/js/telegram-web-app.js"></script>
12
+ ```
13
+
14
+ ## Installation pluto sdk with cdn
15
+ Add the script inside the body tag of your HTML file:
16
+ ```html
17
+ <script src="https://unpkg.com/plutosdk@latest/dist/pluto-sdk.js"></script>
18
+ ```
19
+
20
+ ℹ️ If you don't want auto-update the library, pass concrete version instead of `latest`, e.g.
21
+ ```html
22
+ <script src="https://unpkg.com/plutosdk@0.0.1/dist/pluto-sdk.js"></script>
23
+ ```
24
+
25
+ # Usage
26
+
27
+ You can use global variable `PlutoSDK`
28
+
29
+ ## init
30
+ ```js
31
+ PlutoSDK.init()
32
+ ```
33
+ It returns a promise that resolves after init success.
34
+
35
+ ## login
36
+ ```js
37
+ PlutoSDK.login()
38
+ ```
39
+ It returns a promise that resolves after login success.
40
+
41
+ ## ready
42
+ ```js
43
+ PlutoSDK.ready()
44
+ ```
45
+ This method is called after login is complete. Call this method at the appropriate time to notify the SDK to delete the loading animation.
46
+
47
+ ## share
48
+ ```js
49
+ PlutoSDK.share()
50
+ ```
51
+ This method is shared in telegram.
52
+
53
+ ## purchase
54
+ ```js
55
+ PlutoSDK.purchase(name, orderId, amount, customData, callback)
56
+ ```
57
+ This method accepts the `name orderId amount customData callback` as parameters. `customData` and `callback` are optional parameters.
58
+ Please note that the this pointer of the callback method `callback` will be changed.
59
+
60
+ ## connectWallet
61
+ ```js
62
+ PlutoSDK.connectWallet()
63
+ ```
64
+ This method is to link the user's wallet. It returns a promise that resolves after wallet connected.
65
+
66
+ ## disconnectWallet
67
+ ```js
68
+ PlutoSDK.disconnectWallet()
69
+ ```
70
+ This method is to disconnect the user's connected wallet.
71
+
72
+ ## getWalletConnected
73
+ ```js
74
+ PlutoSDK.getWalletConnected()
75
+ ```
76
+ This method is to get whether the wallet is connected.
77
+