@devizovaburza/txs-sdk 1.0.0-canary.42c64e830

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,132 @@
1
+ # Devizová Burza TXS SDK
2
+
3
+ This SDK provides TypeScript type definitions for integrating with the Devizova Burza TXS API Gateway. It enables external organizations to interact with the API in a type-safe manner.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @devizovaburza/txs-sdk
9
+ # or
10
+ yarn add @devizovaburza/txs-sdk
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Import the types you need in your application:
16
+
17
+ ```typescript
18
+ import type {
19
+ SubmitDraftRequestBody,
20
+ CreateAuthTokenPairRequestBody,
21
+ GetOrdersResponse,
22
+ GetCurrenciesResponse
23
+ // other types...
24
+ } from '@devizovaburza/txs-sdk/v1';
25
+ ```
26
+
27
+ ## Available Types
28
+
29
+ The SDK includes type definitions for:
30
+
31
+ - **Authentication** - Creating and refreshing auth token pairs
32
+ - **Oreders (Tickets)** - Creating, updating and retrieving orders
33
+ - **Users** - User creation and management
34
+ - **Codes & Configuration** - Banks, currencies, providers, and corporate bank accounts
35
+ - **Clients** - Client management and details
36
+ - **Traders** - Trader management and details
37
+ - **RBAC** - Role-based access control for users
38
+ - **
39
+ - **Observability** - Health check endpoints
40
+
41
+ ## Examples
42
+
43
+ ### Authentication
44
+
45
+ ```typescript
46
+ import type { CreateAuthTokenPairRequestBody } from '@devizovaburza/txs-sdk/v1';
47
+
48
+ const authPayload: CreateAuthTokenPairRequestBody = {
49
+ email: 'user@example.com',
50
+ password: 'secure-password',
51
+ // additional fields based on actual API requirements
52
+ };
53
+
54
+ // Use with your API client...
55
+ ```
56
+
57
+ ### Creating Orders
58
+
59
+ ```typescript
60
+ import type { SubmitDraftRequestBody } from '@devizovaburza/txs-sdk/v1';
61
+
62
+ const orderPayload: SubmitDraftRequestBody = {
63
+ // Order fields based on actual API requirements
64
+ };
65
+ ```
66
+
67
+ ### Getting Configuration Data
68
+
69
+ ```typescript
70
+ import type { GetCurrenciesResponse, GetBanksResponse } from '@devizovaburza/txs-sdk/v1';
71
+
72
+ // Type-safe responses for configuration endpoints
73
+ const currencies: GetCurrenciesResponse = await fetch('/api/v1/codes/currencies').then(r => r.json());
74
+ const banks: GetBanksResponse = await fetch('/api/v1/codes/banks').then(r => r.json());
75
+ ```
76
+
77
+ ## Cryptographic Helpers
78
+
79
+ ### Sign Payload
80
+
81
+ Signs a given string payload using a base64-encoded RSA private key.
82
+
83
+ ```typescript
84
+ import { signPayload } from '@devizovaburza/txs-sdk/v1';
85
+
86
+ const signature = await signPayload({
87
+ payload: JSON.stringify({ amount: 1000 }),
88
+ privateKey: 'BASE64_ENCODED_PRIVATE_KEY',
89
+ });
90
+ ```
91
+
92
+ ### Verify Payload Signature
93
+
94
+ Verifies the signature of a payload using a base64-encoded RSA public key.
95
+
96
+ ```typescript
97
+ import { verifyPayloadSignature } from '@devizovaburza/txs-sdk/v1';
98
+
99
+ const isValid = await verifyPayloadSignature({
100
+ payload: JSON.stringify({ amount: 1000 }),
101
+ signature: 'GENERATED_SIGNATURE',
102
+ publicKey: 'BASE64_ENCODED_PUBLIC_KEY',
103
+ });
104
+ ```
105
+
106
+ ## API Integration
107
+
108
+ This SDK is designed to work with any HTTP client. Here's an example using fetch:
109
+
110
+ ```typescript
111
+ import type { CreateAuthTokenPairRequestBody, CreateAuthTokenPairResponse } from '@devizovaburza/txs-sdk/v1';
112
+
113
+ async function authenticate(payload: CreateAuthTokenPairRequestBody): Promise<CreateAuthTokenPairResponse> {
114
+ const response = await fetch('/api/v1/tokens', {
115
+ method: 'POST',
116
+ headers: {
117
+ 'Content-Type': 'application/json',
118
+ },
119
+ body: JSON.stringify(payload),
120
+ });
121
+
122
+ return response.json();
123
+ }
124
+ ```
125
+
126
+ ## Development
127
+
128
+ This package is part of the DBU TXS monorepo. For development instructions, see the main project README.
129
+
130
+ ## License
131
+
132
+ ISC