solotto 1.1.4 → 1.1.5

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 CHANGED
@@ -494,7 +494,7 @@ const ticket = await lottery.GetTicket(authority, lotteryId, ticketNumber);
494
494
 
495
495
  #### GetTickets
496
496
 
497
- Fetches all tickets for a lottery, optionally filtered by buyer, grouped by owner, and/or enriched with purchase timestamps.
497
+ Fetches all tickets for a lottery, optionally filtered by buyer, grouped by owner, and/or enriched with purchase timestamps and transaction signatures.
498
498
 
499
499
  ```js
500
500
  // Get all tickets
@@ -508,6 +508,9 @@ const grouped = await lottery.GetTickets(authority, lotteryId, false, true);
508
508
 
509
509
  // Get all tickets with purchase timestamps
510
510
  const withTime = await lottery.GetTickets(authority, lotteryId, false, false, true);
511
+
512
+ // Get all tickets with timestamps and signatures
513
+ const full = await lottery.GetTickets(authority, lotteryId, false, false, true, true);
511
514
  ```
512
515
 
513
516
  | Parameter | Type | Default | Description |
@@ -516,7 +519,10 @@ const withTime = await lottery.GetTickets(authority, lotteryId, false, false, tr
516
519
  | `lotteryId` | `Number` | — | The lottery ID. |
517
520
  | `buyer` | `{publicKey} \| false` | `false` | Optional buyer to filter by. |
518
521
  | `group` | `Boolean` | `false` | If `true`, groups tickets by owner. |
519
- | `time` | `Boolean` | `false` | If `true`, fetches the block timestamp for each ticket (slower — requires extra RPC calls). |
522
+ | `time` | `Boolean` | `false` | If `true`, includes the block timestamp for each ticket. |
523
+ | `signature` | `Boolean` | `false` | If `true`, includes the transaction signature for each ticket. |
524
+
525
+ > **Note:** The `time` and `signature` options share a single RPC call per ticket, so enabling both does not double the number of requests.
520
526
 
521
527
  **Returns (ungrouped):**
522
528
 
@@ -534,6 +540,7 @@ const withTime = await lottery.GetTickets(authority, lotteryId, false, false, tr
534
540
  ticketNumber: 42,
535
541
  ticketPda: "Pubkey...",
536
542
  time: null, // Unix timestamp when time=true, null otherwise
543
+ signature: "TxSig...", // Present only when signature=true
537
544
  },
538
545
  // ... sorted descending by ticket number
539
546
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solotto",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Solana lottery client",
5
5
  "type": "module",
6
6
  "types": "./solotto.d.ts",
package/solotto.d.ts CHANGED
@@ -107,6 +107,8 @@ declare module "solotto" {
107
107
  ticketPda: string;
108
108
  /** Unix block timestamp of ticket purchase, or `null` when `time=false`. */
109
109
  time: number | null;
110
+ /** Transaction signature. Present only when `signature=true`. */
111
+ signature?: string;
110
112
  }
111
113
 
112
114
  interface GroupedTicketOwner {
@@ -323,13 +325,14 @@ declare module "solotto" {
323
325
  ticket: number
324
326
  ): Promise<TicketInfo>;
325
327
 
326
- /** Fetch all tickets for a lottery, optionally filtered by buyer, grouped by owner, and/or with timestamps. */
328
+ /** Fetch all tickets for a lottery, optionally filtered by buyer, grouped by owner, and/or with timestamps and signatures. */
327
329
  GetTickets(
328
330
  authority: HasPublicKey,
329
331
  lotteryId: number,
330
332
  buyer?: HasPublicKey | false,
331
333
  group?: boolean,
332
- time?: boolean
334
+ time?: boolean,
335
+ signature?: boolean
333
336
  ): Promise<TicketListResult>;
334
337
 
335
338
  /**
package/solotto.js CHANGED
@@ -441,7 +441,7 @@ class Lottery extends EventEmitter {
441
441
  * @param {Number} lotteryId - Lottery Id
442
442
  * @param {PublicKey} buyer - Ticket Buyer Optional
443
443
  */
444
- async GetTickets(authority, lotteryId, buyer = false, group = false, time = false) {
444
+ async GetTickets(authority, lotteryId, buyer = false, group = false, time = false, signature = false) {
445
445
  const [lotteryPDA] = await this.DeriveLotteryPDA(authority.publicKey, lotteryId);
446
446
  const filters = [];
447
447
  filters.push({dataSize: 104});
@@ -460,10 +460,10 @@ class Lottery extends EventEmitter {
460
460
  newTicket.ticketNumber = parseInt(new BN(decoded.ticketNumber, 10, "le"));
461
461
  newTicket.ticketPda = data.pubkey.toString();
462
462
  newTicket.time = null;
463
- if(time){
464
- const dat = await this.connection.getSignaturesForAddress(data.pubkey, "finalized");
465
- newTicket.time = dat[0].blockTime;
466
- }
463
+ let dat = null;
464
+ if(time || signature){dat = await this.connection.getSignaturesForAddress(data.pubkey, "finalized");}
465
+ if(time){newTicket.time = dat[0].blockTime;}
466
+ if(signature){newTicket.signature = dat[0].signature;}
467
467
  tickets.push(newTicket);
468
468
  i++;
469
469
  }