northstar-eva-sdk 0.8.0 → 0.9.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 CHANGED
@@ -69,7 +69,7 @@ tx.sign(myKeypair); // or wallet.signTransaction(tx)
69
69
  await connection.sendRawTransaction(tx.serialize());
70
70
  ```
71
71
 
72
- Builders (each mirrors the send-method's inputs): `buildOpenSessionIx()`, `buildCloseSessionIx()`, `buildDepositFeeIx(lamports, recipient?, sender?)` (sender = the depositor/signer; defaults to the SDK signer), `buildWithdrawFeeFromErIx({ lamports, sender?, toL1? })` (Portal SOL bridge), `buildInitializeIx(p)`, `buildUpdateConfigIx(p)`, `buildCreateTrenchIx({ trenchId?, initialVirtualTokenReserves? })`, `buildDepositIx(p)`, `buildWithdrawIx({ trenchId, amount, thinkId? })` (eva trench withdraw), `buildFinalizeIx(p)`, `buildUserAtaIx(p)`, `buildBuyIx(p)`, `buildSellIx(p)`, `buildClosePoolIx(p)`, `buildClaimTokensIx(p)`, `buildDistributePrizeIx(p)`, plus `buildTransaction(ixs, { lane?, feePayer? })`, `nextTrenchId()`, and the `agentPda(id, user?)` PDA helper.
72
+ Builders (each mirrors the send-method's inputs): `buildOpenSessionIx()`, `buildCloseSessionIx()`, `buildDepositFeeIx(lamports, recipient?, sender?)` (sender = the depositor/signer; defaults to the SDK signer), `buildWithdrawFeeFromErIx({ lamports, sender?, toL1? })` (Portal SOL bridge), `buildInitializeIx(p)`, `buildUpdateConfigIx(p)`, `buildCreateTrenchIx({ trenchId?, initialVirtualTokenReserves? })`, `buildDepositIx(p)`, `buildWithdrawIx({ trenchId, amount, thinkId? })` (eva trench withdraw), `buildFinalizeIx(p)`, `buildUserAtaIx(p)`, `buildBuyIx(p)`, `buildSellIx(p)`, `buildClosePoolIx(p)`, `buildCloseTrenchIx({ trenchId, creator? })`, `buildClaimTokensIx(p)`, `buildDistributePrizeIx(p)`, plus `buildTransaction(ixs, { lane?, feePayer? })`, `nextTrenchId()`, and the `agentPda(id, user?)` PDA helper.
73
73
 
74
74
  > The existing send-methods (`buy`, `sell`, `fundFeeToErPayer`, …) are unchanged — they now just call these builders internally. Builders perform the same state **reads** to resolve accounts (e.g. `buildBuyIx` reads global for `feeRecipient`) but never **send**.
75
75
 
@@ -462,6 +462,15 @@ export declare class NorthstarEva {
462
462
  buildClosePoolIx(p: {
463
463
  trenchId: bigint;
464
464
  }): Promise<TransactionInstruction>;
465
+ /**
466
+ * eva closeTrench instruction (ER) — close an **Ended** trench (post close_pool + distribute_prize),
467
+ * refunding the remaining lamports (rent + undistributed prize dust) to the trench **creator**.
468
+ * The trench's stored `creator` must sign (`has_one = creator`); defaults to the SDK signer.
469
+ */
470
+ buildCloseTrenchIx(p: {
471
+ trenchId: bigint;
472
+ creator?: PublicKey;
473
+ }): Promise<TransactionInstruction>;
465
474
  /** eva claimTokens instruction (ER, admin) — release `user`'s tokens from the trench vault to their ATA. */
466
475
  buildClaimTokensIx(p: {
467
476
  trenchId: bigint;
@@ -633,6 +642,11 @@ export declare class NorthstarEva {
633
642
  closePool(p: {
634
643
  trenchId: bigint;
635
644
  }): Promise<string>;
645
+ /** eva closeTrench (ER) — close an **Ended** trench, refunding remaining lamports to the creator (who signs). */
646
+ closeTrench(p: {
647
+ trenchId: bigint;
648
+ creator?: PublicKey;
649
+ }): Promise<string>;
636
650
  /** eva claimTokens (ER, admin) — release `user`'s tokens from the trench vault to their ATA. */
637
651
  claimTokens(p: {
638
652
  trenchId: bigint;
@@ -14,7 +14,7 @@ const __EVA_IDL__ = {
14
14
  "address": "CQru6EauVg2UwepFCvY5qWuqCPEWYC4ta43wBbkFYtmo",
15
15
  "metadata": {
16
16
  "name": "eva_arena",
17
- "version": "0.1.4",
17
+ "version": "0.1.6",
18
18
  "spec": "0.1.0",
19
19
  "description": "Created with Anchor"
20
20
  },
@@ -381,6 +381,31 @@ const __EVA_IDL__ = {
381
381
  ],
382
382
  "args": []
383
383
  },
384
+ {
385
+ "name": "close_trench",
386
+ "discriminator": [
387
+ 249,
388
+ 176,
389
+ 185,
390
+ 73,
391
+ 24,
392
+ 59,
393
+ 234,
394
+ 84
395
+ ],
396
+ "accounts": [
397
+ {
398
+ "name": "trench",
399
+ "writable": true
400
+ },
401
+ {
402
+ "name": "creator",
403
+ "writable": true,
404
+ "signer": true
405
+ }
406
+ ],
407
+ "args": []
408
+ },
384
409
  {
385
410
  "name": "create_trench",
386
411
  "discriminator": [
@@ -2546,6 +2571,14 @@ export class NorthstarEva {
2546
2571
  const g = await this.requireGlobal();
2547
2572
  return this.methods.closePool().accounts({ trench: this.trenchPda(p.trenchId), globalState: this.globalStatePda(), feeRecipient: new PublicKey(g.feeRecipient), admin: this.payer }).instruction();
2548
2573
  }
2574
+ /**
2575
+ * eva closeTrench instruction (ER) — close an **Ended** trench (post close_pool + distribute_prize),
2576
+ * refunding the remaining lamports (rent + undistributed prize dust) to the trench **creator**.
2577
+ * The trench's stored `creator` must sign (`has_one = creator`); defaults to the SDK signer.
2578
+ */
2579
+ buildCloseTrenchIx(p) {
2580
+ return this.methods.closeTrench().accounts({ trench: this.trenchPda(p.trenchId), creator: p.creator ?? this.payer }).instruction();
2581
+ }
2549
2582
  /** eva claimTokens instruction (ER, admin) — release `user`'s tokens from the trench vault to their ATA. */
2550
2583
  buildClaimTokensIx(p) {
2551
2584
  const user = p.user ?? this.payer;
@@ -2780,6 +2813,10 @@ export class NorthstarEva {
2780
2813
  async closePool(p) {
2781
2814
  return this.sendEva(await this.buildClosePoolIx(p), "closePool");
2782
2815
  }
2816
+ /** eva closeTrench (ER) — close an **Ended** trench, refunding remaining lamports to the creator (who signs). */
2817
+ async closeTrench(p) {
2818
+ return this.sendEva(await this.buildCloseTrenchIx(p), "closeTrench");
2819
+ }
2783
2820
  /** eva claimTokens (ER, admin) — release `user`'s tokens from the trench vault to their ATA. */
2784
2821
  async claimTokens(p) {
2785
2822
  return this.sendEva(await this.buildClaimTokensIx(p), "claimTokens");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "northstar-eva-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Run the eva program on a NorthStar ephemeral rollup (zero-fee hot path). A high-level class SDK over the NorthStar Portal/ER protocol + the eva Anchor program. Works localnet & devnet.",
5
5
  "type": "module",
6
6
  "license": "MIT",