telegram-wallet-p2p 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 +87 -0
- package/dist/analytics.d.ts +32 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +101 -0
- package/dist/analytics.js.map +1 -0
- package/dist/client.d.ts +56 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +144 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +60 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +126 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Telegram Wallet P2P SDK β Node.js / TypeScript
|
|
2
|
+
|
|
3
|
+
> β οΈ **Unofficial SDK** β This project is not affiliated with, endorsed by, or related to Telegram or Wallet.
|
|
4
|
+
|
|
5
|
+
A fully typed TypeScript SDK for the [Telegram Wallet P2P API](https://docs.wallet.tg/p2p).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- π· **TypeScript-first** β Full type safety with strict mode
|
|
10
|
+
- π **Zero dependencies** β Uses native `fetch` (Node.js 18+)
|
|
11
|
+
- π **Auto-retry** β Exponential backoff on rate limits and server errors
|
|
12
|
+
- π **Analytics** β Built-in utilities for price analysis and filtering
|
|
13
|
+
- π **Safe auth** β API key passed via constructor, never logged
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install telegram-wallet-p2p
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { WalletP2PClient, TradeSide } from "telegram-wallet-p2p";
|
|
25
|
+
|
|
26
|
+
const client = new WalletP2PClient({
|
|
27
|
+
apiKey: process.env.WALLET_P2P_API_KEY!,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const response = await client.getOnlineItems({
|
|
31
|
+
cryptoCurrency: "USDT",
|
|
32
|
+
fiatCurrency: "RUB",
|
|
33
|
+
side: TradeSide.SELL,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
for (const item of response.data) {
|
|
37
|
+
console.log(`${item.nickname}: ${item.price} ${item.fiatCurrency}`);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Analytics
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { bestPrice, priceSpread, marketSummary, TradeSide } from "telegram-wallet-p2p";
|
|
45
|
+
|
|
46
|
+
// Find the best sell price
|
|
47
|
+
const best = bestPrice(response.data, TradeSide.SELL);
|
|
48
|
+
|
|
49
|
+
// Get price statistics
|
|
50
|
+
const spread = priceSpread(response.data);
|
|
51
|
+
// => { min: "95.0000", max: "102.5000", avg: "98.7500", ... }
|
|
52
|
+
|
|
53
|
+
// Full market summary
|
|
54
|
+
const summary = marketSummary(response.data);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## API Reference
|
|
58
|
+
|
|
59
|
+
### `new WalletP2PClient(options)`
|
|
60
|
+
|
|
61
|
+
| Option | Type | Default | Description |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `apiKey` | `string` | required | Your Wallet P2P API key |
|
|
64
|
+
| `baseUrl` | `string` | `https://p2p.walletbot.me` | API base URL |
|
|
65
|
+
| `timeout` | `number` | `30000` | Request timeout in ms |
|
|
66
|
+
| `maxRetries` | `number` | `3` | Retry attempts on 429/5xx |
|
|
67
|
+
| `retryBaseDelay` | `number` | `1000` | Base delay in ms for exponential backoff |
|
|
68
|
+
|
|
69
|
+
### `client.getOnlineItems(params)`
|
|
70
|
+
|
|
71
|
+
Fetches active P2P ads. Returns `Promise<GetOnlineItemsResponse>`.
|
|
72
|
+
|
|
73
|
+
## Error Handling
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import {
|
|
77
|
+
BadRequestError, // 400 β unsupported currency
|
|
78
|
+
AuthenticationError, // 401 β invalid API key
|
|
79
|
+
AccessDeniedError, // 403 β access denied
|
|
80
|
+
RateLimitError, // 429 β rate limit exceeded
|
|
81
|
+
ServerError, // 5xx β server error
|
|
82
|
+
} from "telegram-wallet-p2p";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utilities for P2P market data.
|
|
3
|
+
*
|
|
4
|
+
* All functions are pure and operate on arrays of OnlineItem.
|
|
5
|
+
* They do not make any API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { TradeSide } from "./types.js";
|
|
8
|
+
import type { OnlineItem, PriceSpread, MarketSummary } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Find the ad with the best price for the given trade side.
|
|
11
|
+
*
|
|
12
|
+
* For BUY: the lowest price (cheapest to buy crypto).
|
|
13
|
+
* For SELL: the highest price (best rate to sell crypto).
|
|
14
|
+
*/
|
|
15
|
+
export declare function bestPrice(items: OnlineItem[], side: TradeSide): OnlineItem | null;
|
|
16
|
+
/**
|
|
17
|
+
* Calculate price spread statistics across all ads.
|
|
18
|
+
*/
|
|
19
|
+
export declare function priceSpread(items: OnlineItem[]): PriceSpread | null;
|
|
20
|
+
/**
|
|
21
|
+
* Filter ads that accept a specific payment method.
|
|
22
|
+
*/
|
|
23
|
+
export declare function filterByPayment(items: OnlineItem[], method: string): OnlineItem[];
|
|
24
|
+
/**
|
|
25
|
+
* Filter ads by merchant verification level.
|
|
26
|
+
*/
|
|
27
|
+
export declare function filterByMerchantLevel(items: OnlineItem[], level: string): OnlineItem[];
|
|
28
|
+
/**
|
|
29
|
+
* Generate a comprehensive market summary from a list of ads.
|
|
30
|
+
*/
|
|
31
|
+
export declare function marketSummary(items: OnlineItem[]): MarketSummary;
|
|
32
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,SAAS,CACrB,KAAK,EAAE,UAAU,EAAE,EACnB,IAAI,EAAE,SAAS,GAChB,UAAU,GAAG,IAAI,CAanB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,WAAW,GAAG,IAAI,CAuBnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EAAE,EACnB,MAAM,EAAE,MAAM,GACf,UAAU,EAAE,CAKd;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,MAAM,GACd,UAAU,EAAE,CAEd;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,aAAa,CAwChE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utilities for P2P market data.
|
|
3
|
+
*
|
|
4
|
+
* All functions are pure and operate on arrays of OnlineItem.
|
|
5
|
+
* They do not make any API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { TradeSide } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Find the ad with the best price for the given trade side.
|
|
10
|
+
*
|
|
11
|
+
* For BUY: the lowest price (cheapest to buy crypto).
|
|
12
|
+
* For SELL: the highest price (best rate to sell crypto).
|
|
13
|
+
*/
|
|
14
|
+
export function bestPrice(items, side) {
|
|
15
|
+
if (items.length === 0)
|
|
16
|
+
return null;
|
|
17
|
+
return items.reduce((best, item) => {
|
|
18
|
+
const bestVal = parseFloat(best.price);
|
|
19
|
+
const itemVal = parseFloat(item.price);
|
|
20
|
+
if (side === TradeSide.BUY) {
|
|
21
|
+
return itemVal < bestVal ? item : best;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return itemVal > bestVal ? item : best;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Calculate price spread statistics across all ads.
|
|
30
|
+
*/
|
|
31
|
+
export function priceSpread(items) {
|
|
32
|
+
if (items.length === 0)
|
|
33
|
+
return null;
|
|
34
|
+
const prices = items.map((item) => parseFloat(item.price)).sort((a, b) => a - b);
|
|
35
|
+
const min = prices[0];
|
|
36
|
+
const max = prices[prices.length - 1];
|
|
37
|
+
const avg = prices.reduce((sum, p) => sum + p, 0) / prices.length;
|
|
38
|
+
const mid = Math.floor(prices.length / 2);
|
|
39
|
+
const median = prices.length % 2 !== 0
|
|
40
|
+
? prices[mid]
|
|
41
|
+
: (prices[mid - 1] + prices[mid]) / 2;
|
|
42
|
+
return {
|
|
43
|
+
min: min.toFixed(4),
|
|
44
|
+
max: max.toFixed(4),
|
|
45
|
+
avg: avg.toFixed(4),
|
|
46
|
+
median: median.toFixed(4),
|
|
47
|
+
spread: (max - min).toFixed(4),
|
|
48
|
+
count: prices.length,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Filter ads that accept a specific payment method.
|
|
53
|
+
*/
|
|
54
|
+
export function filterByPayment(items, method) {
|
|
55
|
+
const methodLower = method.toLowerCase();
|
|
56
|
+
return items.filter((item) => item.payments.some((p) => p.toLowerCase() === methodLower));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Filter ads by merchant verification level.
|
|
60
|
+
*/
|
|
61
|
+
export function filterByMerchantLevel(items, level) {
|
|
62
|
+
return items.filter((item) => item.merchantLevel === level);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generate a comprehensive market summary from a list of ads.
|
|
66
|
+
*/
|
|
67
|
+
export function marketSummary(items) {
|
|
68
|
+
if (items.length === 0) {
|
|
69
|
+
return {
|
|
70
|
+
totalAds: 0,
|
|
71
|
+
priceStats: null,
|
|
72
|
+
onlineCount: 0,
|
|
73
|
+
autoAcceptCount: 0,
|
|
74
|
+
paymentMethods: {},
|
|
75
|
+
merchantDistribution: {},
|
|
76
|
+
avgCompletionRate: "0",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const paymentMethods = {};
|
|
80
|
+
for (const item of items) {
|
|
81
|
+
for (const method of item.payments) {
|
|
82
|
+
paymentMethods[method] = (paymentMethods[method] ?? 0) + 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const merchantDistribution = {};
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
merchantDistribution[item.merchantLevel] =
|
|
88
|
+
(merchantDistribution[item.merchantLevel] ?? 0) + 1;
|
|
89
|
+
}
|
|
90
|
+
const totalRate = items.reduce((sum, item) => sum + parseFloat(item.executeRate), 0);
|
|
91
|
+
return {
|
|
92
|
+
totalAds: items.length,
|
|
93
|
+
priceStats: priceSpread(items),
|
|
94
|
+
onlineCount: items.filter((item) => item.isOnline).length,
|
|
95
|
+
autoAcceptCount: items.filter((item) => item.isAutoAccept).length,
|
|
96
|
+
paymentMethods,
|
|
97
|
+
merchantDistribution,
|
|
98
|
+
avgCompletionRate: (totalRate / items.length).toFixed(4),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG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CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM;QACjE,cAAc;QACd,oBAAoB;QACpB,iBAAiB,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;KAC3D,CAAC;AACN,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the Telegram Wallet P2P API.
|
|
3
|
+
*
|
|
4
|
+
* This is an UNOFFICIAL SDK. Not affiliated with Telegram or Wallet.
|
|
5
|
+
*/
|
|
6
|
+
import type { ClientOptions, GetOnlineItemsResponse, TradeSide } from "./types.js";
|
|
7
|
+
export declare class WalletP2PClient {
|
|
8
|
+
private readonly apiKey;
|
|
9
|
+
private readonly baseUrl;
|
|
10
|
+
private readonly timeout;
|
|
11
|
+
private readonly maxRetries;
|
|
12
|
+
private readonly retryBaseDelay;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new Wallet P2P API client.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const client = new WalletP2PClient({
|
|
19
|
+
* apiKey: process.env.WALLET_P2P_API_KEY!,
|
|
20
|
+
* });
|
|
21
|
+
* const response = await client.getOnlineItems({
|
|
22
|
+
* cryptoCurrency: "USDT",
|
|
23
|
+
* fiatCurrency: "RUB",
|
|
24
|
+
* side: TradeSide.SELL,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
constructor(options: ClientOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Fetch active P2P ads from the market.
|
|
31
|
+
*
|
|
32
|
+
* @param params.cryptoCurrency - Cryptocurrency code (e.g., "USDT", "BTC")
|
|
33
|
+
* @param params.fiatCurrency - Fiat currency code (e.g., "RUB", "USD")
|
|
34
|
+
* @param params.side - Trade direction: BUY or SELL
|
|
35
|
+
* @param params.page - Page number (default: 1)
|
|
36
|
+
* @param params.pageSize - Items per page (1-50, default: 10)
|
|
37
|
+
* @returns Response with status and list of online items
|
|
38
|
+
*
|
|
39
|
+
* @throws {BadRequestError} If a currency is not supported
|
|
40
|
+
* @throws {AuthenticationError} If the API key is invalid
|
|
41
|
+
* @throws {AccessDeniedError} If access is denied
|
|
42
|
+
* @throws {RateLimitError} If the rate limit is exceeded
|
|
43
|
+
* @throws {ServerError} On server-side errors
|
|
44
|
+
*/
|
|
45
|
+
getOnlineItems(params: {
|
|
46
|
+
cryptoCurrency: string;
|
|
47
|
+
fiatCurrency: string;
|
|
48
|
+
side: TradeSide;
|
|
49
|
+
page?: number;
|
|
50
|
+
pageSize?: number;
|
|
51
|
+
}): Promise<GetOnlineItemsResponse>;
|
|
52
|
+
private requestWithRetry;
|
|
53
|
+
private doRequest;
|
|
54
|
+
private sleep;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EACR,aAAa,EACb,sBAAsB,EACtB,SAAS,EAEZ,MAAM,YAAY,CAAC;AAKpB,qBAAa,eAAe;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IAExC;;;;;;;;;;;;;;OAcG;gBACS,OAAO,EAAE,aAAa;IAYlC;;;;;;;;;;;;;;;OAeG;IACG,cAAc,CAAC,MAAM,EAAE;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,SAAS,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAerB,gBAAgB;YAsBhB,SAAS;IA+DvB,OAAO,CAAC,KAAK;CAGhB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the Telegram Wallet P2P API.
|
|
3
|
+
*
|
|
4
|
+
* This is an UNOFFICIAL SDK. Not affiliated with Telegram or Wallet.
|
|
5
|
+
*/
|
|
6
|
+
import { AccessDeniedError, AuthenticationError, BadRequestError, RateLimitError, ServerError, WalletP2PError, } from "./errors.js";
|
|
7
|
+
const DEFAULT_BASE_URL = "https://p2p.walletbot.me";
|
|
8
|
+
const ONLINE_ITEMS_PATH = "/p2p/integration-api/v1/item/online";
|
|
9
|
+
export class WalletP2PClient {
|
|
10
|
+
apiKey;
|
|
11
|
+
baseUrl;
|
|
12
|
+
timeout;
|
|
13
|
+
maxRetries;
|
|
14
|
+
retryBaseDelay;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new Wallet P2P API client.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const client = new WalletP2PClient({
|
|
21
|
+
* apiKey: process.env.WALLET_P2P_API_KEY!,
|
|
22
|
+
* });
|
|
23
|
+
* const response = await client.getOnlineItems({
|
|
24
|
+
* cryptoCurrency: "USDT",
|
|
25
|
+
* fiatCurrency: "RUB",
|
|
26
|
+
* side: TradeSide.SELL,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
constructor(options) {
|
|
31
|
+
if (!options.apiKey) {
|
|
32
|
+
throw new Error("apiKey must not be empty");
|
|
33
|
+
}
|
|
34
|
+
this.apiKey = options.apiKey;
|
|
35
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
36
|
+
this.timeout = options.timeout ?? 30_000;
|
|
37
|
+
this.maxRetries = options.maxRetries ?? 3;
|
|
38
|
+
this.retryBaseDelay = options.retryBaseDelay ?? 1_000;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fetch active P2P ads from the market.
|
|
42
|
+
*
|
|
43
|
+
* @param params.cryptoCurrency - Cryptocurrency code (e.g., "USDT", "BTC")
|
|
44
|
+
* @param params.fiatCurrency - Fiat currency code (e.g., "RUB", "USD")
|
|
45
|
+
* @param params.side - Trade direction: BUY or SELL
|
|
46
|
+
* @param params.page - Page number (default: 1)
|
|
47
|
+
* @param params.pageSize - Items per page (1-50, default: 10)
|
|
48
|
+
* @returns Response with status and list of online items
|
|
49
|
+
*
|
|
50
|
+
* @throws {BadRequestError} If a currency is not supported
|
|
51
|
+
* @throws {AuthenticationError} If the API key is invalid
|
|
52
|
+
* @throws {AccessDeniedError} If access is denied
|
|
53
|
+
* @throws {RateLimitError} If the rate limit is exceeded
|
|
54
|
+
* @throws {ServerError} On server-side errors
|
|
55
|
+
*/
|
|
56
|
+
async getOnlineItems(params) {
|
|
57
|
+
const body = {
|
|
58
|
+
cryptoCurrency: params.cryptoCurrency,
|
|
59
|
+
fiatCurrency: params.fiatCurrency,
|
|
60
|
+
side: params.side,
|
|
61
|
+
page: params.page ?? 1,
|
|
62
|
+
pageSize: params.pageSize ?? 10,
|
|
63
|
+
};
|
|
64
|
+
return this.requestWithRetry(`${this.baseUrl}${ONLINE_ITEMS_PATH}`, body);
|
|
65
|
+
}
|
|
66
|
+
async requestWithRetry(url, body) {
|
|
67
|
+
let lastError;
|
|
68
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
|
|
69
|
+
try {
|
|
70
|
+
return await this.doRequest(url, body);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
if (err instanceof RateLimitError || err instanceof ServerError) {
|
|
74
|
+
lastError = err;
|
|
75
|
+
if (attempt < this.maxRetries) {
|
|
76
|
+
const delay = this.retryBaseDelay * 2 ** attempt;
|
|
77
|
+
await this.sleep(delay);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
throw lastError;
|
|
86
|
+
}
|
|
87
|
+
async doRequest(url, body) {
|
|
88
|
+
const controller = new AbortController();
|
|
89
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
90
|
+
try {
|
|
91
|
+
const response = await fetch(url, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: {
|
|
94
|
+
"X-API-Key": this.apiKey,
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
Accept: "application/json",
|
|
97
|
+
},
|
|
98
|
+
body: JSON.stringify(body),
|
|
99
|
+
signal: controller.signal,
|
|
100
|
+
});
|
|
101
|
+
clearTimeout(timeoutId);
|
|
102
|
+
if (response.ok) {
|
|
103
|
+
return (await response.json());
|
|
104
|
+
}
|
|
105
|
+
let errorBody;
|
|
106
|
+
try {
|
|
107
|
+
errorBody = (await response.json());
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// ignore parse errors
|
|
111
|
+
}
|
|
112
|
+
const errorCode = errorBody?.errorCode ?? "";
|
|
113
|
+
const errorMessage = errorBody?.errorMessage ?? response.statusText ?? "Unknown error";
|
|
114
|
+
switch (response.status) {
|
|
115
|
+
case 400:
|
|
116
|
+
throw new BadRequestError(errorMessage, errorCode);
|
|
117
|
+
case 401:
|
|
118
|
+
throw new AuthenticationError(errorMessage);
|
|
119
|
+
case 403:
|
|
120
|
+
throw new AccessDeniedError(errorMessage, errorCode);
|
|
121
|
+
case 429:
|
|
122
|
+
throw new RateLimitError(errorMessage);
|
|
123
|
+
default:
|
|
124
|
+
if (response.status >= 500) {
|
|
125
|
+
throw new ServerError(errorMessage, response.status, errorCode);
|
|
126
|
+
}
|
|
127
|
+
throw new WalletP2PError(`Unexpected status ${response.status}: ${errorMessage}`, response.status);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
clearTimeout(timeoutId);
|
|
132
|
+
if (err instanceof WalletP2PError)
|
|
133
|
+
throw err;
|
|
134
|
+
if (err instanceof DOMException && err.name === "AbortError") {
|
|
135
|
+
throw new WalletP2PError("Request timed out", 408);
|
|
136
|
+
}
|
|
137
|
+
throw new WalletP2PError(`HTTP request failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
sleep(ms) {
|
|
141
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,WAAW,EACX,cAAc,GACjB,MAAM,aAAa,CAAC;AAQrB,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AACpD,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAEhE,MAAM,OAAO,eAAe;IACP,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,cAAc,CAAS;IAExC;;;;;;;;;;;;;;OAcG;IACH,YAAY,OAAsB;QAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OA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
|
|
4
|
+
/** Base error for all Wallet P2P SDK errors. */
|
|
5
|
+
export declare class WalletP2PError extends Error {
|
|
6
|
+
readonly statusCode?: number;
|
|
7
|
+
constructor(message: string, statusCode?: number);
|
|
8
|
+
}
|
|
9
|
+
/** Raised when the API key is invalid (HTTP 401). */
|
|
10
|
+
export declare class AuthenticationError extends WalletP2PError {
|
|
11
|
+
constructor(message?: string);
|
|
12
|
+
}
|
|
13
|
+
/** Raised when access is denied (HTTP 403). */
|
|
14
|
+
export declare class AccessDeniedError extends WalletP2PError {
|
|
15
|
+
readonly errorCode?: string;
|
|
16
|
+
constructor(message?: string, errorCode?: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Raised on invalid request parameters (HTTP 400).
|
|
20
|
+
*
|
|
21
|
+
* Contains the specific errorCode from the API, e.g.:
|
|
22
|
+
* - CRYPTO_CURRENCY_NOT_SUPPORTED
|
|
23
|
+
* - FIAT_CURRENCY_NOT_SUPPORTED
|
|
24
|
+
*/
|
|
25
|
+
export declare class BadRequestError extends WalletP2PError {
|
|
26
|
+
readonly errorCode?: string;
|
|
27
|
+
constructor(message: string, errorCode?: string);
|
|
28
|
+
}
|
|
29
|
+
/** Raised when the rate limit is exceeded (HTTP 429). */
|
|
30
|
+
export declare class RateLimitError extends WalletP2PError {
|
|
31
|
+
constructor(message?: string);
|
|
32
|
+
}
|
|
33
|
+
/** Raised on server-side errors (HTTP 5xx). */
|
|
34
|
+
export declare class ServerError extends WalletP2PError {
|
|
35
|
+
readonly errorCode?: string;
|
|
36
|
+
constructor(message?: string, statusCode?: number, errorCode?: string);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gDAAgD;AAChD,qBAAa,cAAe,SAAQ,KAAK;IACrC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAKnD;AAED,qDAAqD;AACrD,qBAAa,mBAAoB,SAAQ,cAAc;gBACvC,OAAO,SAAoB;CAI1C;AAED,+CAA+C;AAC/C,qBAAa,iBAAkB,SAAQ,cAAc;IACjD,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEvB,OAAO,SAAkB,EAAE,SAAS,CAAC,EAAE,MAAM;CAK5D;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IAC/C,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAKlD;AAED,yDAAyD;AACzD,qBAAa,cAAe,SAAQ,cAAc;gBAClC,OAAO,SAA0B;CAIhD;AAED,+CAA+C;AAC/C,qBAAa,WAAY,SAAQ,cAAc;IAC3C,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAG/B,OAAO,SAAoC,EAC3C,UAAU,SAAM,EAChB,SAAS,CAAC,EAAE,MAAM;CAMzB"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes for the Telegram Wallet P2P SDK.
|
|
3
|
+
*/
|
|
4
|
+
/** Base error for all Wallet P2P SDK errors. */
|
|
5
|
+
export class WalletP2PError extends Error {
|
|
6
|
+
statusCode;
|
|
7
|
+
constructor(message, statusCode) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "WalletP2PError";
|
|
10
|
+
this.statusCode = statusCode;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Raised when the API key is invalid (HTTP 401). */
|
|
14
|
+
export class AuthenticationError extends WalletP2PError {
|
|
15
|
+
constructor(message = "Invalid API key") {
|
|
16
|
+
super(message, 401);
|
|
17
|
+
this.name = "AuthenticationError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Raised when access is denied (HTTP 403). */
|
|
21
|
+
export class AccessDeniedError extends WalletP2PError {
|
|
22
|
+
errorCode;
|
|
23
|
+
constructor(message = "Access denied", errorCode) {
|
|
24
|
+
super(message, 403);
|
|
25
|
+
this.name = "AccessDeniedError";
|
|
26
|
+
this.errorCode = errorCode;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Raised on invalid request parameters (HTTP 400).
|
|
31
|
+
*
|
|
32
|
+
* Contains the specific errorCode from the API, e.g.:
|
|
33
|
+
* - CRYPTO_CURRENCY_NOT_SUPPORTED
|
|
34
|
+
* - FIAT_CURRENCY_NOT_SUPPORTED
|
|
35
|
+
*/
|
|
36
|
+
export class BadRequestError extends WalletP2PError {
|
|
37
|
+
errorCode;
|
|
38
|
+
constructor(message, errorCode) {
|
|
39
|
+
super(message, 400);
|
|
40
|
+
this.name = "BadRequestError";
|
|
41
|
+
this.errorCode = errorCode;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Raised when the rate limit is exceeded (HTTP 429). */
|
|
45
|
+
export class RateLimitError extends WalletP2PError {
|
|
46
|
+
constructor(message = "Request limit reached") {
|
|
47
|
+
super(message, 429);
|
|
48
|
+
this.name = "RateLimitError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Raised on server-side errors (HTTP 5xx). */
|
|
52
|
+
export class ServerError extends WalletP2PError {
|
|
53
|
+
errorCode;
|
|
54
|
+
constructor(message = "Service temporarily unavailable", statusCode = 503, errorCode) {
|
|
55
|
+
super(message, statusCode);
|
|
56
|
+
this.name = "ServerError";
|
|
57
|
+
this.errorCode = errorCode;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gDAAgD;AAChD,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AAO,GAAG,iCAAiC,EAC3C,UAAU,GAAG,GAAG,EAChB,SAAkB;QAElB,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram Wallet P2P SDK (Unofficial)
|
|
3
|
+
*
|
|
4
|
+
* A TypeScript SDK for the Telegram Wallet P2P API.
|
|
5
|
+
* This is an UNOFFICIAL project and is not affiliated with Telegram or Wallet.
|
|
6
|
+
*
|
|
7
|
+
* Provides read-only access to P2P market data for analytics and monitoring.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export { WalletP2PClient } from "./client.js";
|
|
12
|
+
export { WalletP2PError, AuthenticationError, AccessDeniedError, BadRequestError, RateLimitError, ServerError, } from "./errors.js";
|
|
13
|
+
export { TradeSide, MerchantLevel, ErrorCode, } from "./types.js";
|
|
14
|
+
export type { OnlineItem, GetOnlineItemsRequest, GetOnlineItemsResponse, WalletP2PErrorResponse, ClientOptions, PriceSpread, MarketSummary, } from "./types.js";
|
|
15
|
+
export { bestPrice, priceSpread, filterByPayment, filterByMerchantLevel, marketSummary, } from "./analytics.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,WAAW,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,SAAS,EACT,aAAa,EACb,SAAS,GACZ,MAAM,YAAY,CAAC;AAEpB,YAAY,EACR,UAAU,EACV,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,aAAa,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACH,SAAS,EACT,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,aAAa,GAChB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram Wallet P2P SDK (Unofficial)
|
|
3
|
+
*
|
|
4
|
+
* A TypeScript SDK for the Telegram Wallet P2P API.
|
|
5
|
+
* This is an UNOFFICIAL project and is not affiliated with Telegram or Wallet.
|
|
6
|
+
*
|
|
7
|
+
* Provides read-only access to P2P market data for analytics and monitoring.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export { WalletP2PClient } from "./client.js";
|
|
12
|
+
export { WalletP2PError, AuthenticationError, AccessDeniedError, BadRequestError, RateLimitError, ServerError, } from "./errors.js";
|
|
13
|
+
export { TradeSide, MerchantLevel, ErrorCode, } from "./types.js";
|
|
14
|
+
export { bestPrice, priceSpread, filterByPayment, filterByMerchantLevel, marketSummary, } from "./analytics.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,WAAW,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,SAAS,EACT,aAAa,EACb,SAAS,GACZ,MAAM,YAAY,CAAC;AAYpB,OAAO,EACH,SAAS,EACT,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,aAAa,GAChB,MAAM,gBAAgB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Telegram Wallet P2P API.
|
|
3
|
+
*
|
|
4
|
+
* Derived from the official OpenAPI specification.
|
|
5
|
+
* This is an UNOFFICIAL SDK β not affiliated with Telegram or Wallet.
|
|
6
|
+
*/
|
|
7
|
+
/** Trade direction. */
|
|
8
|
+
export declare enum TradeSide {
|
|
9
|
+
BUY = "BUY",
|
|
10
|
+
SELL = "SELL"
|
|
11
|
+
}
|
|
12
|
+
/** Merchant verification level. */
|
|
13
|
+
export declare enum MerchantLevel {
|
|
14
|
+
REGULAR_USER = "REGULAR_USER",
|
|
15
|
+
MERCHANT = "MERCHANT",
|
|
16
|
+
TRUSTED_MERCHANT = "TRUSTED_MERCHANT"
|
|
17
|
+
}
|
|
18
|
+
/** API error codes. */
|
|
19
|
+
export declare enum ErrorCode {
|
|
20
|
+
CRYPTO_CURRENCY_NOT_SUPPORTED = "CRYPTO_CURRENCY_NOT_SUPPORTED",
|
|
21
|
+
FIAT_CURRENCY_NOT_SUPPORTED = "FIAT_CURRENCY_NOT_SUPPORTED",
|
|
22
|
+
ACCESS_DENIED = "ACCESS_DENIED",
|
|
23
|
+
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A single P2P market ad (item).
|
|
27
|
+
* Price and quantity fields are strings to preserve decimal precision.
|
|
28
|
+
*/
|
|
29
|
+
export interface OnlineItem {
|
|
30
|
+
/** Item (ad) ID */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Item (ad) human-readable number */
|
|
33
|
+
number: string;
|
|
34
|
+
/** User ID of the item owner */
|
|
35
|
+
userId: number;
|
|
36
|
+
/** Nickname of the item owner */
|
|
37
|
+
nickname: string;
|
|
38
|
+
/** Cryptocurrency code */
|
|
39
|
+
cryptoCurrency: string;
|
|
40
|
+
/** Fiat currency code */
|
|
41
|
+
fiatCurrency: string;
|
|
42
|
+
/** Trade side: BUY or SELL */
|
|
43
|
+
side: TradeSide;
|
|
44
|
+
/** Price per unit of cryptocurrency */
|
|
45
|
+
price: string;
|
|
46
|
+
/** Available quantity */
|
|
47
|
+
lastQuantity: string;
|
|
48
|
+
/** Minimum order amount in fiat */
|
|
49
|
+
minAmount: string;
|
|
50
|
+
/** Maximum order amount in fiat. null if no maximum limit. */
|
|
51
|
+
maxAmount: string | null;
|
|
52
|
+
/** List of accepted payment method codes */
|
|
53
|
+
payments: string[];
|
|
54
|
+
/** Number of completed orders */
|
|
55
|
+
orderNum: number;
|
|
56
|
+
/** Order completion rate (0-1) */
|
|
57
|
+
executeRate: string;
|
|
58
|
+
/** Whether the user is currently online */
|
|
59
|
+
isOnline: boolean;
|
|
60
|
+
/** Merchant verification level */
|
|
61
|
+
merchantLevel: MerchantLevel;
|
|
62
|
+
/** Payment timeout in minutes */
|
|
63
|
+
paymentPeriod: number;
|
|
64
|
+
/** Whether the ad has auto-accept enabled */
|
|
65
|
+
isAutoAccept: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** Request body for fetching online P2P ads. */
|
|
68
|
+
export interface GetOnlineItemsRequest {
|
|
69
|
+
/** Cryptocurrency code (e.g., "USDT") */
|
|
70
|
+
cryptoCurrency: string;
|
|
71
|
+
/** Fiat currency code (e.g., "RUB") */
|
|
72
|
+
fiatCurrency: string;
|
|
73
|
+
/** Trade side: BUY or SELL */
|
|
74
|
+
side: TradeSide;
|
|
75
|
+
/** Page number (default: 1) */
|
|
76
|
+
page?: number;
|
|
77
|
+
/** Items per page (default: 10, max: 50) */
|
|
78
|
+
pageSize?: number;
|
|
79
|
+
}
|
|
80
|
+
/** Successful response from the online items endpoint. */
|
|
81
|
+
export interface GetOnlineItemsResponse {
|
|
82
|
+
/** Status of request execution */
|
|
83
|
+
status: "SUCCESS";
|
|
84
|
+
/** List of online items */
|
|
85
|
+
data: OnlineItem[];
|
|
86
|
+
}
|
|
87
|
+
/** Error response from the API. */
|
|
88
|
+
export interface WalletP2PErrorResponse {
|
|
89
|
+
/** Error code */
|
|
90
|
+
errorCode: string;
|
|
91
|
+
/** Error details */
|
|
92
|
+
errorMessage: string;
|
|
93
|
+
}
|
|
94
|
+
/** Client configuration options. */
|
|
95
|
+
export interface ClientOptions {
|
|
96
|
+
/** Your Wallet P2P API key. */
|
|
97
|
+
apiKey: string;
|
|
98
|
+
/** API base URL. Defaults to https://p2p.walletbot.me */
|
|
99
|
+
baseUrl?: string;
|
|
100
|
+
/** Request timeout in milliseconds. Default: 30000 */
|
|
101
|
+
timeout?: number;
|
|
102
|
+
/** Max retry attempts on transient errors. Default: 3 */
|
|
103
|
+
maxRetries?: number;
|
|
104
|
+
/** Base delay in ms for exponential backoff. Default: 1000 */
|
|
105
|
+
retryBaseDelay?: number;
|
|
106
|
+
}
|
|
107
|
+
/** Price spread statistics. */
|
|
108
|
+
export interface PriceSpread {
|
|
109
|
+
min: string;
|
|
110
|
+
max: string;
|
|
111
|
+
avg: string;
|
|
112
|
+
median: string;
|
|
113
|
+
spread: string;
|
|
114
|
+
count: number;
|
|
115
|
+
}
|
|
116
|
+
/** Comprehensive market summary. */
|
|
117
|
+
export interface MarketSummary {
|
|
118
|
+
totalAds: number;
|
|
119
|
+
priceStats: PriceSpread | null;
|
|
120
|
+
onlineCount: number;
|
|
121
|
+
autoAcceptCount: number;
|
|
122
|
+
paymentMethods: Record<string, number>;
|
|
123
|
+
merchantDistribution: Record<string, number>;
|
|
124
|
+
avgCompletionRate: string;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uBAAuB;AACvB,oBAAY,SAAS;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;CAChB;AAED,mCAAmC;AACnC,oBA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iB,EAAE,MAAM,CAAC;CAC7B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Telegram Wallet P2P API.
|
|
3
|
+
*
|
|
4
|
+
* Derived from the official OpenAPI specification.
|
|
5
|
+
* This is an UNOFFICIAL SDK β not affiliated with Telegram or Wallet.
|
|
6
|
+
*/
|
|
7
|
+
/** Trade direction. */
|
|
8
|
+
export var TradeSide;
|
|
9
|
+
(function (TradeSide) {
|
|
10
|
+
TradeSide["BUY"] = "BUY";
|
|
11
|
+
TradeSide["SELL"] = "SELL";
|
|
12
|
+
})(TradeSide || (TradeSide = {}));
|
|
13
|
+
/** Merchant verification level. */
|
|
14
|
+
export var MerchantLevel;
|
|
15
|
+
(function (MerchantLevel) {
|
|
16
|
+
MerchantLevel["REGULAR_USER"] = "REGULAR_USER";
|
|
17
|
+
MerchantLevel["MERCHANT"] = "MERCHANT";
|
|
18
|
+
MerchantLevel["TRUSTED_MERCHANT"] = "TRUSTED_MERCHANT";
|
|
19
|
+
})(MerchantLevel || (MerchantLevel = {}));
|
|
20
|
+
/** API error codes. */
|
|
21
|
+
export var ErrorCode;
|
|
22
|
+
(function (ErrorCode) {
|
|
23
|
+
ErrorCode["CRYPTO_CURRENCY_NOT_SUPPORTED"] = "CRYPTO_CURRENCY_NOT_SUPPORTED";
|
|
24
|
+
ErrorCode["FIAT_CURRENCY_NOT_SUPPORTED"] = "FIAT_CURRENCY_NOT_SUPPORTED";
|
|
25
|
+
ErrorCode["ACCESS_DENIED"] = "ACCESS_DENIED";
|
|
26
|
+
ErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
27
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
28
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uBAAuB;AACvB,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACjB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,mCAAmC;AACnC,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,8CAA6B,CAAA;IAC7B,sCAAqB,CAAA;IACrB,sDAAqC,CAAA;AACzC,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED,uBAAuB;AACvB,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACjB,4EAA+D,CAAA;IAC/D,wEAA2D,CAAA;IAC3D,4CAA+B,CAAA;IAC/B,8CAAiC,CAAA;AACrC,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "telegram-wallet-p2p",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Unofficial Node.js/TypeScript SDK for the Telegram Wallet P2P API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"lint": "eslint src/ tests/",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"telegram",
|
|
28
|
+
"wallet",
|
|
29
|
+
"p2p",
|
|
30
|
+
"crypto",
|
|
31
|
+
"api",
|
|
32
|
+
"sdk",
|
|
33
|
+
"typescript"
|
|
34
|
+
],
|
|
35
|
+
"author": "Furkan KΓΆykΔ±ran",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/furkankoykiran/telegram-wallet-p2p-sdk",
|
|
40
|
+
"directory": "packages/node"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"typescript": "^5.4.0",
|
|
47
|
+
"vitest": "^1.6.0",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
49
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
50
|
+
"eslint": "^8.57.0"
|
|
51
|
+
}
|
|
52
|
+
}
|