odin-connect 1.0.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/readme.md ADDED
@@ -0,0 +1,85 @@
1
+ # OdinConnect
2
+
3
+ ### Demo
4
+
5
+ This repository includes a demo. See `demo/` folder
6
+ To run it, simply do `npm run demo`
7
+
8
+ ### Initializing new instance
9
+
10
+ ```typescript
11
+ const odin = new OdinConnect({ name: "Demo App" });
12
+ ```
13
+
14
+ ### Request for user connection
15
+
16
+ ```typescript
17
+ const user = await odinConnect.connect({
18
+ open: {
19
+ target: "_blank",
20
+ settings: "height=800,width=400",
21
+ },
22
+ requires_api: true,
23
+ });
24
+ ```
25
+
26
+ ### Request for user balances
27
+
28
+ ```typescript
29
+ const balances = await odinConnect.getBalances({
30
+ principal: user.principal,
31
+ pagination: { page: 1, limit: 20 },
32
+ });
33
+ ```
34
+
35
+ ### Request for token transfer
36
+
37
+ ```typescript
38
+ await odinConnect.transfer({
39
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
40
+ destination:
41
+ "vv5jb-7sm7u-vn3nq-6nflf-dghis-fd7ji-cx764-xunni-zosog-eqvpw-oae",
42
+ token: "2jjj",
43
+ amount: 200_000_000n,
44
+ });
45
+ ```
46
+
47
+ ### Request for buy authorization
48
+
49
+ ```typescript
50
+ await odinConnect.buy({
51
+ btcAmount: 200_000_000n,
52
+ token: "2jjj",
53
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
54
+ });
55
+ ```
56
+
57
+ ### Request for sell authorization
58
+
59
+ ```typescript
60
+ await odinConnect.sell({
61
+ tokenAmount: 200_000_000n,
62
+ token: "2jjj",
63
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
64
+ });
65
+ ```
66
+
67
+ ### Request for add liquidity authorization
68
+
69
+ ```typescript
70
+ await odinConnect.addLiquidity({
71
+ btcAmount: 200_000_000n,
72
+ token: "2jj",
73
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
74
+ });
75
+ ```
76
+
77
+ ### Request for remove liquidity authorization
78
+
79
+ ```typescript
80
+ await odinConnect.removeLiquidity({
81
+ btcAmount: 200_000_000n,
82
+ token: "2jj",
83
+ principal: "veyov-kjgrf-hke6v-6d63i-sdwae-oldgg-huau6-ke5g3-rllp2-5jhca-uqe",
84
+ });
85
+ ```