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/demo/README.md +69 -0
- package/demo/eslint.config.js +23 -0
- package/demo/index.html +13 -0
- package/demo/package-lock.json +3395 -0
- package/demo/package.json +30 -0
- package/demo/public/icon.svg +6 -0
- package/demo/tsconfig.app.json +27 -0
- package/demo/tsconfig.node.json +25 -0
- package/demo/vite.config.ts +7 -0
- package/dist/api.d.ts +11 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +14 -0
- package/dist/http.d.ts +6 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +11 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/models/balance.d.ts +6 -0
- package/dist/models/balance.d.ts.map +1 -0
- package/dist/models/balance.js +1 -0
- package/dist/models/token.d.ts +10 -0
- package/dist/models/token.d.ts.map +1 -0
- package/dist/models/token.js +1 -0
- package/dist/models/user.d.ts +10 -0
- package/dist/models/user.d.ts.map +1 -0
- package/dist/models/user.js +1 -0
- package/dist/services/api.d.ts +18 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/api.js +37 -0
- package/dist/services/connect.d.ts +83 -0
- package/dist/services/connect.d.ts.map +1 -0
- package/dist/services/connect.js +204 -0
- package/dist/services/http.d.ts +6 -0
- package/dist/services/http.d.ts.map +1 -0
- package/dist/services/http.js +11 -0
- package/package.json +33 -0
- package/readme.md +85 -0
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
|
+
```
|