@wahoopredict/trading-sdk 0.0.1
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/LICENSE +21 -0
- package/README.md +309 -0
- package/dist/cjs/client.js +129 -0
- package/dist/cjs/client.spec.js +153 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/schema.d.js +4 -0
- package/dist/esm/client.js +59 -0
- package/dist/esm/client.spec.js +108 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/schema.d.js +433 -0
- package/dist/types/client.d.ts +48 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Middleware } from "openapi-fetch";
|
|
2
|
+
import type { paths } from "./schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* Default base URL for the WahooPredict API
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_BASE_URL = "https://api.wahoopredict.com/oapi/v2";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for the WahooPredict client
|
|
9
|
+
*/
|
|
10
|
+
export interface WahooClientConfig {
|
|
11
|
+
/** Your API key from WahooPredict */
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/** Your secret key for signing requests */
|
|
14
|
+
secretKey: string;
|
|
15
|
+
/** Optional custom base URL (defaults to production API) */
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates HMAC-SHA256 signature for API authentication
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateSignature(apiKey: string, secretKey: string, timestamp: number, requestBody: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an authentication middleware for the WahooPredict API
|
|
24
|
+
*/
|
|
25
|
+
export declare function createAuthMiddleware(apiKey: string, secretKey: string): Middleware;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a type-safe WahooPredict API client
|
|
28
|
+
*
|
|
29
|
+
* @param config - Configuration options including API credentials
|
|
30
|
+
* @returns A configured openapi-fetch client with authentication
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { createWahooClient } from '@wahoopredict/trading-sdk';
|
|
35
|
+
*
|
|
36
|
+
* const client = createWahooClient({
|
|
37
|
+
* apiKey: 'your-api-key',
|
|
38
|
+
* secretKey: 'your-secret-key',
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Get user profile
|
|
42
|
+
* const { data, error } = await client.GET('/user/profile', {
|
|
43
|
+
* params: { query: { fields: ['balance'] } },
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export default function createWahooClient(config: WahooClientConfig): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
48
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC;;GAEG;AACH,eAAO,MAAM,gBAAgB,yCAAyC,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,CAMR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,UAAU,CAwBZ;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,gEAUlE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WahooPredict Trading SDK
|
|
3
|
+
*
|
|
4
|
+
* TypeScript SDK for the WahooPredict trading API.
|
|
5
|
+
* Built on top of openapi-fetch for type-safe API calls.
|
|
6
|
+
*/
|
|
7
|
+
export { default as createWahooClient, generateSignature, createAuthMiddleware, DEFAULT_BASE_URL, } from "./client.js";
|
|
8
|
+
export type { WahooClientConfig } from "./client.js";
|
|
9
|
+
export type { paths, components, operations } from "./schema.js";
|
|
10
|
+
export type { Middleware } from "openapi-fetch";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGjE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wahoopredict/trading-sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript SDK for the WahooPredict trading API",
|
|
5
|
+
"author": "WahooPredict",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/cjs/index.js",
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js",
|
|
16
|
+
"node": "./dist/cjs/index.js",
|
|
17
|
+
"default": "./dist/cjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"generate": "openapi-typescript ./docs/openapi:3.0.public.yml -o ./src/schema.d.ts",
|
|
27
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:types",
|
|
28
|
+
"build:esm": "swc --config-file esm.swcrc ./src -d dist/esm --strip-leading-paths && node -e \"require('fs').writeFileSync('dist/esm/package.json', JSON.stringify({type: 'module'}))\"",
|
|
29
|
+
"build:cjs": "swc --config-file cjs.swcrc ./src -d dist/cjs --strip-leading-paths",
|
|
30
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
31
|
+
"lint": "eslint src/",
|
|
32
|
+
"lint:types": "tsc --noEmit",
|
|
33
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://gitlab.wahoopredict.com/wahoopredict-docs/backend-docs.git"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"wahoopredict",
|
|
42
|
+
"trading",
|
|
43
|
+
"sdk",
|
|
44
|
+
"api",
|
|
45
|
+
"prediction-market"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"openapi-fetch": "^0.15.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@swc/cli": "^0.7.7",
|
|
55
|
+
"@swc/core": "^1.10.9",
|
|
56
|
+
"@swc/jest": "^0.2.37",
|
|
57
|
+
"@types/jest": "^29.5.14",
|
|
58
|
+
"@types/node": "^25.0.9",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
60
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
61
|
+
"eslint": "^9.18.0",
|
|
62
|
+
"jest": "^29.7.0",
|
|
63
|
+
"openapi-typescript": "^7.10.1",
|
|
64
|
+
"typescript": "^5.7.3"
|
|
65
|
+
}
|
|
66
|
+
}
|