odin-connect 1.0.2 → 1.0.3

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 (39) hide show
  1. package/.github/workflows/pr.yml +24 -0
  2. package/demo/package-lock.json +6 -2
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/models/achievement.d.ts +20 -0
  6. package/dist/models/achievement.d.ts.map +1 -0
  7. package/dist/models/achievement.js +1 -0
  8. package/dist/models/token.d.ts +5 -0
  9. package/dist/models/token.d.ts.map +1 -1
  10. package/dist/services/api.d.ts +26 -0
  11. package/dist/services/api.d.ts.map +1 -1
  12. package/dist/services/api.js +93 -0
  13. package/dist/services/api.test.d.ts +2 -0
  14. package/dist/services/api.test.d.ts.map +1 -0
  15. package/dist/services/api.test.js +70 -0
  16. package/dist/services/connect.d.ts +15 -1
  17. package/dist/services/connect.d.ts.map +1 -1
  18. package/dist/services/connect.js +71 -18
  19. package/dist/services/connect.test.d.ts +2 -0
  20. package/dist/services/connect.test.d.ts.map +1 -0
  21. package/dist/services/connect.test.js +306 -0
  22. package/dist/services/http.d.ts +6 -2
  23. package/dist/services/http.d.ts.map +1 -1
  24. package/dist/services/http.js +30 -0
  25. package/dist/services/http.test.d.ts +2 -0
  26. package/dist/services/http.test.d.ts.map +1 -0
  27. package/dist/services/http.test.js +37 -0
  28. package/dist/utils/conver-to-odin-amount.test.d.ts +2 -0
  29. package/dist/utils/conver-to-odin-amount.test.d.ts.map +1 -0
  30. package/dist/utils/conver-to-odin-amount.test.js +36 -0
  31. package/dist/utils/index.d.ts +4 -1
  32. package/dist/utils/index.d.ts.map +1 -1
  33. package/dist/utils/index.js +108 -0
  34. package/dist/utils/token-field-validators.test.d.ts +2 -0
  35. package/dist/utils/token-field-validators.test.d.ts.map +1 -0
  36. package/dist/utils/token-field-validators.test.js +31 -0
  37. package/package.json +7 -2
  38. package/readme.md +26 -3
  39. package/vitest.config.ts +7 -0
package/readme.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # OdinConnect
2
2
 
3
- ### Demo
3
+ ## Demo
4
4
 
5
5
  This repository includes a demo. See `demo/` folder
6
+
6
7
  To run it, simply do `npm run demo`
7
8
 
9
+ ## Examples
10
+
8
11
  ### Initializing new instance
9
12
 
10
13
  Instantiate the OdinConnect class with some information about your application
@@ -22,6 +25,7 @@ const user = await odinConnect.connect({
22
25
  target: "_blank",
23
26
  settings: "height=800,width=400",
24
27
  },
28
+ // flag to weather or not api keys are required
25
29
  requires_api: true,
26
30
  });
27
31
  ```
@@ -87,6 +91,25 @@ await odinConnect.removeLiquidity({
87
91
  });
88
92
  ```
89
93
 
94
+ ### Request for creating new token
95
+
96
+ Note: require_api must be set set to true
97
+
98
+ ```typescript
99
+ await odinConnect.createToken({
100
+ image: file, // instance of a file
101
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
102
+ name: "Test Token",
103
+ ticker: "TEST",
104
+ description: "Test Description", // optional
105
+ website: "http://test-website.com", // optional
106
+ telegram: "", // optional
107
+ twitter: "", // optional
108
+ buy: 20_000_000n, // 20K sats
109
+ discount: "",
110
+ });
111
+ ```
112
+
90
113
  ### API Methods
91
114
 
92
115
  ```typescript
@@ -104,13 +127,13 @@ const user = await odinConnect.getUser(
104
127
  "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe"
105
128
  );
106
129
 
107
- // Get balance
130
+ // Get user balance
108
131
  const balances = await odinConnect.getBalances({
109
132
  principal: user.principal,
110
133
  pagination: { page: 1, limit: 20 },
111
134
  });
112
135
 
113
- // Get activities
136
+ // Get user activities
114
137
  const activity = await odinConnect.getUserActivity({
115
138
  principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
116
139
  pagination: { page: 1, limit: 10 },
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "vitest/config";
2
+ export default defineConfig({
3
+ test: {
4
+ globals: true,
5
+ environment: "jsdom", // or 'jsdom' for frontend
6
+ },
7
+ });