@puul/partner-sdk 1.3.0 → 1.4.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/dist/index.d.mts CHANGED
@@ -63,6 +63,10 @@ interface PlacePredictionParams {
63
63
  stakeAmount: number;
64
64
  stakeCurrency: Currency;
65
65
  idempotencyKey: string;
66
+ /** Linked Puul user UUID (provide userId or userExternalId) */
67
+ userId?: string;
68
+ /** Your linked external user ID (provide userId or userExternalId) */
69
+ userExternalId?: string;
66
70
  /** Optional quote ID for slippage protection */
67
71
  quoteId?: string;
68
72
  /** Optional FX quote ID */
@@ -75,6 +79,10 @@ interface CreateQuoteParams {
75
79
  outcomeId: string;
76
80
  stakeAmount: number;
77
81
  stakeCurrency: Currency;
82
+ /** Linked Puul user UUID (provide userId or userExternalId) */
83
+ userId?: string;
84
+ /** Your linked external user ID (provide userId or userExternalId) */
85
+ userExternalId?: string;
78
86
  }
79
87
  interface QuoteResponse {
80
88
  quoteId: string;
@@ -153,6 +161,10 @@ interface DepositParams {
153
161
  currency?: string;
154
162
  idempotency_key: string;
155
163
  reference?: string;
164
+ /** Linked Puul user UUID (provide userId or userExternalId) */
165
+ userId?: string;
166
+ /** Your linked external user ID (provide userId or userExternalId) */
167
+ userExternalId?: string;
156
168
  }
157
169
  type WithdrawMethod = 'bank' | 'crypto';
158
170
  interface WithdrawParams {
@@ -220,13 +232,13 @@ interface LotteryEntriesResponse {
220
232
  total: number;
221
233
  }
222
234
  interface BuyTicketParams {
223
- /** Puul user ID of the linked user */
224
- userId: string;
235
+ /** Puul user UUID (provide userId or userExternalId) */
236
+ userId?: string;
225
237
  /** Unique key to prevent duplicate purchases */
226
238
  idempotencyKey: string;
227
239
  /** Number of tickets (default: 1) */
228
240
  quantity?: number;
229
- /** Your external user ID (for tracking) */
241
+ /** Your linked external user ID (provide userId or userExternalId) */
230
242
  userExternalId?: string;
231
243
  }
232
244
  interface BuyTicketResponse {
@@ -473,6 +485,8 @@ declare class PredictionsAPI {
473
485
  list(options?: {
474
486
  status?: PredictionStatus;
475
487
  limit?: number;
488
+ userId?: string;
489
+ userExternalId?: string;
476
490
  }): Promise<PredictionListResponse>;
477
491
  /** Create a pending prediction (JIT funding flow) */
478
492
  createPending(params: CreatePendingPredictionParams): Promise<PendingPrediction>;
package/dist/index.d.ts CHANGED
@@ -63,6 +63,10 @@ interface PlacePredictionParams {
63
63
  stakeAmount: number;
64
64
  stakeCurrency: Currency;
65
65
  idempotencyKey: string;
66
+ /** Linked Puul user UUID (provide userId or userExternalId) */
67
+ userId?: string;
68
+ /** Your linked external user ID (provide userId or userExternalId) */
69
+ userExternalId?: string;
66
70
  /** Optional quote ID for slippage protection */
67
71
  quoteId?: string;
68
72
  /** Optional FX quote ID */
@@ -75,6 +79,10 @@ interface CreateQuoteParams {
75
79
  outcomeId: string;
76
80
  stakeAmount: number;
77
81
  stakeCurrency: Currency;
82
+ /** Linked Puul user UUID (provide userId or userExternalId) */
83
+ userId?: string;
84
+ /** Your linked external user ID (provide userId or userExternalId) */
85
+ userExternalId?: string;
78
86
  }
79
87
  interface QuoteResponse {
80
88
  quoteId: string;
@@ -153,6 +161,10 @@ interface DepositParams {
153
161
  currency?: string;
154
162
  idempotency_key: string;
155
163
  reference?: string;
164
+ /** Linked Puul user UUID (provide userId or userExternalId) */
165
+ userId?: string;
166
+ /** Your linked external user ID (provide userId or userExternalId) */
167
+ userExternalId?: string;
156
168
  }
157
169
  type WithdrawMethod = 'bank' | 'crypto';
158
170
  interface WithdrawParams {
@@ -220,13 +232,13 @@ interface LotteryEntriesResponse {
220
232
  total: number;
221
233
  }
222
234
  interface BuyTicketParams {
223
- /** Puul user ID of the linked user */
224
- userId: string;
235
+ /** Puul user UUID (provide userId or userExternalId) */
236
+ userId?: string;
225
237
  /** Unique key to prevent duplicate purchases */
226
238
  idempotencyKey: string;
227
239
  /** Number of tickets (default: 1) */
228
240
  quantity?: number;
229
- /** Your external user ID (for tracking) */
241
+ /** Your linked external user ID (provide userId or userExternalId) */
230
242
  userExternalId?: string;
231
243
  }
232
244
  interface BuyTicketResponse {
@@ -473,6 +485,8 @@ declare class PredictionsAPI {
473
485
  list(options?: {
474
486
  status?: PredictionStatus;
475
487
  limit?: number;
488
+ userId?: string;
489
+ userExternalId?: string;
476
490
  }): Promise<PredictionListResponse>;
477
491
  /** Create a pending prediction (JIT funding flow) */
478
492
  createPending(params: CreatePendingPredictionParams): Promise<PendingPrediction>;
package/dist/index.js CHANGED
@@ -190,11 +190,21 @@ var PredictionsAPI = class {
190
190
  }
191
191
  /** Create a binding quote for slippage protection (expires in 10s) */
192
192
  async createQuote(params) {
193
- return this.client.request("POST", "/partner/predictions/quote", params);
193
+ const { userId, userExternalId, ...rest } = params;
194
+ return this.client.request("POST", "/partner/predictions/quote", {
195
+ ...rest,
196
+ user_id: userId,
197
+ user_external_id: userExternalId
198
+ });
194
199
  }
195
200
  /** Place a prediction on a market outcome */
196
201
  async place(params) {
197
- return this.client.request("POST", "/partner/predictions", params);
202
+ const { userId, userExternalId, ...rest } = params;
203
+ return this.client.request("POST", "/partner/predictions", {
204
+ ...rest,
205
+ user_id: userId,
206
+ user_external_id: userExternalId
207
+ });
198
208
  }
199
209
  /** Get a specific prediction by ID */
200
210
  async get(predictionId) {
@@ -205,6 +215,8 @@ var PredictionsAPI = class {
205
215
  const params = new URLSearchParams();
206
216
  if (options?.status) params.set("status", options.status);
207
217
  if (options?.limit) params.set("limit", String(options.limit));
218
+ if (options?.userId) params.set("user_id", options.userId);
219
+ if (options?.userExternalId) params.set("user_external_id", options.userExternalId);
208
220
  const query = params.toString() ? `?${params.toString()}` : "";
209
221
  return this.client.request("GET", `/partner/predictions${query}`);
210
222
  }
@@ -236,7 +248,12 @@ var WalletAPI = class {
236
248
  }
237
249
  /** Deposit funds to a linked user wallet */
238
250
  async deposit(params) {
239
- return this.client.request("POST", "/partner/wallet/deposit", params);
251
+ const { userId, userExternalId, ...rest } = params;
252
+ return this.client.request("POST", "/partner/wallet/deposit", {
253
+ ...rest,
254
+ user_id: userId,
255
+ user_external_id: userExternalId
256
+ });
240
257
  }
241
258
  /** Get withdrawal fee estimate */
242
259
  async getWithdrawalFees(currency, amount) {
package/dist/index.mjs CHANGED
@@ -147,11 +147,21 @@ var PredictionsAPI = class {
147
147
  }
148
148
  /** Create a binding quote for slippage protection (expires in 10s) */
149
149
  async createQuote(params) {
150
- return this.client.request("POST", "/partner/predictions/quote", params);
150
+ const { userId, userExternalId, ...rest } = params;
151
+ return this.client.request("POST", "/partner/predictions/quote", {
152
+ ...rest,
153
+ user_id: userId,
154
+ user_external_id: userExternalId
155
+ });
151
156
  }
152
157
  /** Place a prediction on a market outcome */
153
158
  async place(params) {
154
- return this.client.request("POST", "/partner/predictions", params);
159
+ const { userId, userExternalId, ...rest } = params;
160
+ return this.client.request("POST", "/partner/predictions", {
161
+ ...rest,
162
+ user_id: userId,
163
+ user_external_id: userExternalId
164
+ });
155
165
  }
156
166
  /** Get a specific prediction by ID */
157
167
  async get(predictionId) {
@@ -162,6 +172,8 @@ var PredictionsAPI = class {
162
172
  const params = new URLSearchParams();
163
173
  if (options?.status) params.set("status", options.status);
164
174
  if (options?.limit) params.set("limit", String(options.limit));
175
+ if (options?.userId) params.set("user_id", options.userId);
176
+ if (options?.userExternalId) params.set("user_external_id", options.userExternalId);
165
177
  const query = params.toString() ? `?${params.toString()}` : "";
166
178
  return this.client.request("GET", `/partner/predictions${query}`);
167
179
  }
@@ -193,7 +205,12 @@ var WalletAPI = class {
193
205
  }
194
206
  /** Deposit funds to a linked user wallet */
195
207
  async deposit(params) {
196
- return this.client.request("POST", "/partner/wallet/deposit", params);
208
+ const { userId, userExternalId, ...rest } = params;
209
+ return this.client.request("POST", "/partner/wallet/deposit", {
210
+ ...rest,
211
+ user_id: userId,
212
+ user_external_id: userExternalId
213
+ });
197
214
  }
198
215
  /** Get withdrawal fee estimate */
199
216
  async getWithdrawalFees(currency, amount) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puul/partner-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Official TypeScript SDK for the Puul Partner API — integrate prediction markets into your platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -42,4 +42,4 @@
42
42
  "engines": {
43
43
  "node": ">=18.0.0"
44
44
  }
45
- }
45
+ }