@structbuild/sdk 0.2.9 → 0.2.10
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 +22 -0
- package/dist/generated/polymarket.d.ts +18 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,28 @@ function handleWebhook(payload: FirstTradePayload) {
|
|
|
139
139
|
|
|
140
140
|
Available payload types: `FirstTradePayload`, `GlobalPnlPayload`, `MarketPnlPayload`, `EventPnlPayload`, `PositionPnlPayload`, `ConditionMetricsPayload`, `EventMetricsPayload`, `PositionMetricsPayload`, `VolumeMilestonePayload`, `EventVolumeMilestonePayload`, `PositionVolumeMilestonePayload`, `ProbabilitySpikePayload`.
|
|
141
141
|
|
|
142
|
+
## JWT Auth
|
|
143
|
+
|
|
144
|
+
Let your end users authenticate directly using JWTs from their own auth provider (Privy, Auth0, Google, Turnkey, etc.) without exposing your `sk_*` API key client-side.
|
|
145
|
+
|
|
146
|
+
Create a JWT public key (`pk_jwt_*`) in your [Struct dashboard](https://struct.to), then pass it alongside the user's JWT:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { StructClient, StructWebSocket } from "@structbuild/sdk";
|
|
150
|
+
|
|
151
|
+
const client = new StructClient({
|
|
152
|
+
apiKey: "pk_jwt_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
|
|
153
|
+
jwt: userAccessToken,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const ws = new StructWebSocket({
|
|
157
|
+
apiKey: "pk_jwt_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
|
|
158
|
+
jwt: userAccessToken,
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The `pk_jwt_*` key is safe to hardcode in frontend bundles — it is useless without a valid JWT from your configured auth provider.
|
|
163
|
+
|
|
142
164
|
## Pagination
|
|
143
165
|
|
|
144
166
|
Use the `paginate` helper to iterate through all results:
|
|
@@ -103,7 +103,7 @@ export interface paths {
|
|
|
103
103
|
patch?: never;
|
|
104
104
|
trace?: never;
|
|
105
105
|
};
|
|
106
|
-
"/polymarket/events/slug/{
|
|
106
|
+
"/polymarket/events/slug/{event_slug}": {
|
|
107
107
|
parameters: {
|
|
108
108
|
query?: never;
|
|
109
109
|
header?: never;
|
|
@@ -403,7 +403,7 @@ export interface paths {
|
|
|
403
403
|
patch?: never;
|
|
404
404
|
trace?: never;
|
|
405
405
|
};
|
|
406
|
-
"/polymarket/market/slug/{
|
|
406
|
+
"/polymarket/market/slug/{market_slug}": {
|
|
407
407
|
parameters: {
|
|
408
408
|
query?: never;
|
|
409
409
|
header?: never;
|
|
@@ -961,6 +961,18 @@ export interface components {
|
|
|
961
961
|
rewards_daily_rate?: number | null;
|
|
962
962
|
start_date?: string | null;
|
|
963
963
|
end_date?: string | null;
|
|
964
|
+
/** Format: double */
|
|
965
|
+
rewards_max_spread?: number | null;
|
|
966
|
+
/** Format: double */
|
|
967
|
+
rewards_min_size?: number | null;
|
|
968
|
+
/** Format: double */
|
|
969
|
+
native_daily_rate?: number | null;
|
|
970
|
+
/** Format: double */
|
|
971
|
+
sponsored_daily_rate?: number | null;
|
|
972
|
+
/** Format: double */
|
|
973
|
+
total_daily_rate?: number | null;
|
|
974
|
+
/** Format: int32 */
|
|
975
|
+
sponsors_count?: number | null;
|
|
964
976
|
};
|
|
965
977
|
/** @description Response type for condition metrics query */
|
|
966
978
|
ConditionMetricsResponse: {
|
|
@@ -2221,6 +2233,8 @@ export interface operations {
|
|
|
2221
2233
|
* @example 10
|
|
2222
2234
|
*/
|
|
2223
2235
|
limit?: number;
|
|
2236
|
+
/** @description Cursor from previous response for keyset pagination. Pass the pagination_key from the previous page to fetch the next page. */
|
|
2237
|
+
pagination_key?: string;
|
|
2224
2238
|
};
|
|
2225
2239
|
header?: never;
|
|
2226
2240
|
path?: never;
|
|
@@ -2439,7 +2453,7 @@ export interface operations {
|
|
|
2439
2453
|
header?: never;
|
|
2440
2454
|
path: {
|
|
2441
2455
|
/** @description Event slug */
|
|
2442
|
-
|
|
2456
|
+
event_slug: string;
|
|
2443
2457
|
};
|
|
2444
2458
|
cookie?: never;
|
|
2445
2459
|
};
|
|
@@ -3013,7 +3027,7 @@ export interface operations {
|
|
|
3013
3027
|
header?: never;
|
|
3014
3028
|
path: {
|
|
3015
3029
|
/** @description Market slug (e.g. `will-trump-win`) */
|
|
3016
|
-
|
|
3030
|
+
market_slug: string;
|
|
3017
3031
|
};
|
|
3018
3032
|
cookie?: never;
|
|
3019
3033
|
};
|