northstar-eva-sdk 0.7.0 → 0.8.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?)`, `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)`, `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
 
@@ -389,8 +389,13 @@ export declare class NorthstarEva {
389
389
  * `const ix = await sdk.buildEnsureSessionIx(); if (ix) tx.add(ix);`
390
390
  */
391
391
  buildEnsureSessionIx(): Promise<TransactionInstruction | null>;
392
- /** Portal DepositFee instruction (L1) — "fund fee to ER payer". (Caller must ensure a session exists.) */
393
- buildDepositFeeIx(lamports: bigint, recipient?: PublicKey): TransactionInstruction;
392
+ /**
393
+ * Portal DepositFee instruction (L1) "fund fee to ER payer". (Caller must ensure a session exists.)
394
+ * `sender` is the **depositor** — the account that pays the SOL on L1 and **must sign** the tx;
395
+ * defaults to the SDK signer, but pass it explicitly for user-signed flows (don't rely on the default).
396
+ * `recipient` is the account credited on the ER (defaults to the SDK signer).
397
+ */
398
+ buildDepositFeeIx(lamports: bigint, recipient?: PublicKey, sender?: PublicKey): TransactionInstruction;
394
399
  /** "Withdraw fee from ER" instruction (ER) — system transfer from `sender` (default: the signer) → its WithdrawalSink. (Portal SOL bridge; distinct from the eva `withdraw` instruction.) */
395
400
  buildWithdrawFeeFromErIx(p: {
396
401
  lamports: bigint;
@@ -2478,9 +2478,14 @@ export class NorthstarEva {
2478
2478
  return null; // already created
2479
2479
  return this.buildOpenSessionIx();
2480
2480
  }
2481
- /** Portal DepositFee instruction (L1) — "fund fee to ER payer". (Caller must ensure a session exists.) */
2482
- buildDepositFeeIx(lamports, recipient = this.payer) {
2483
- return portal.depositFeeIx({ programId: this.cfg.portalProgramId, depositor: this.payer, recipient, lamports });
2481
+ /**
2482
+ * Portal DepositFee instruction (L1) "fund fee to ER payer". (Caller must ensure a session exists.)
2483
+ * `sender` is the **depositor** the account that pays the SOL on L1 and **must sign** the tx;
2484
+ * defaults to the SDK signer, but pass it explicitly for user-signed flows (don't rely on the default).
2485
+ * `recipient` is the account credited on the ER (defaults to the SDK signer).
2486
+ */
2487
+ buildDepositFeeIx(lamports, recipient = this.payer, sender = this.payer) {
2488
+ return portal.depositFeeIx({ programId: this.cfg.portalProgramId, depositor: sender, recipient, lamports });
2484
2489
  }
2485
2490
  /** "Withdraw fee from ER" instruction (ER) — system transfer from `sender` (default: the signer) → its WithdrawalSink. (Portal SOL bridge; distinct from the eva `withdraw` instruction.) */
2486
2491
  buildWithdrawFeeFromErIx(p) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "northstar-eva-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.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",