@oobe-protocol-labs/synapse-sap-sdk 0.11.0 → 0.12.6

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.
Files changed (64) hide show
  1. package/dist/cjs/constants/payments.js +51 -1
  2. package/dist/cjs/constants/payments.js.map +1 -1
  3. package/dist/cjs/idl/synapse_agent_sap.json +156 -4
  4. package/dist/cjs/index.js +3 -2
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/modules/escrow-v2.js +62 -3
  7. package/dist/cjs/modules/escrow-v2.js.map +1 -1
  8. package/dist/cjs/modules/escrow.js +13 -3
  9. package/dist/cjs/modules/escrow.js.map +1 -1
  10. package/dist/cjs/modules/receipt.js +4 -0
  11. package/dist/cjs/modules/receipt.js.map +1 -1
  12. package/dist/cjs/modules/staking.js +30 -0
  13. package/dist/cjs/modules/staking.js.map +1 -1
  14. package/dist/cjs/registries/x402.js +10 -4
  15. package/dist/cjs/registries/x402.js.map +1 -1
  16. package/dist/cjs/utils/index.js +2 -1
  17. package/dist/cjs/utils/index.js.map +1 -1
  18. package/dist/cjs/utils/priority-fee.js +52 -0
  19. package/dist/cjs/utils/priority-fee.js.map +1 -1
  20. package/dist/esm/constants/payments.js +49 -0
  21. package/dist/esm/constants/payments.js.map +1 -1
  22. package/dist/esm/idl/synapse_agent_sap.json +156 -4
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/modules/escrow-v2.js +63 -4
  26. package/dist/esm/modules/escrow-v2.js.map +1 -1
  27. package/dist/esm/modules/escrow.js +14 -4
  28. package/dist/esm/modules/escrow.js.map +1 -1
  29. package/dist/esm/modules/receipt.js +5 -1
  30. package/dist/esm/modules/receipt.js.map +1 -1
  31. package/dist/esm/modules/staking.js +30 -0
  32. package/dist/esm/modules/staking.js.map +1 -1
  33. package/dist/esm/registries/x402.js +11 -5
  34. package/dist/esm/registries/x402.js.map +1 -1
  35. package/dist/esm/utils/index.js +1 -1
  36. package/dist/esm/utils/index.js.map +1 -1
  37. package/dist/esm/utils/priority-fee.js +51 -0
  38. package/dist/esm/utils/priority-fee.js.map +1 -1
  39. package/dist/types/constants/payments.d.ts +43 -0
  40. package/dist/types/constants/payments.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +1 -1
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/modules/escrow-v2.d.ts +2 -2
  44. package/dist/types/modules/escrow-v2.d.ts.map +1 -1
  45. package/dist/types/modules/escrow.d.ts.map +1 -1
  46. package/dist/types/modules/receipt.d.ts.map +1 -1
  47. package/dist/types/modules/staking.d.ts +19 -0
  48. package/dist/types/modules/staking.d.ts.map +1 -1
  49. package/dist/types/registries/x402.d.ts.map +1 -1
  50. package/dist/types/utils/index.d.ts +1 -1
  51. package/dist/types/utils/index.d.ts.map +1 -1
  52. package/dist/types/utils/priority-fee.d.ts +20 -0
  53. package/dist/types/utils/priority-fee.d.ts.map +1 -1
  54. package/package.json +1 -1
  55. package/src/constants/payments.ts +53 -0
  56. package/src/idl/synapse_agent_sap.json +156 -4
  57. package/src/index.ts +1 -0
  58. package/src/modules/escrow-v2.ts +68 -3
  59. package/src/modules/escrow.ts +14 -3
  60. package/src/modules/receipt.ts +5 -0
  61. package/src/modules/staking.ts +35 -0
  62. package/src/registries/x402.ts +11 -4
  63. package/src/utils/index.ts +1 -0
  64. package/src/utils/priority-fee.ts +55 -0
@@ -1 +1 @@
1
- {"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../../../src/registries/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAuB,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAA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,GAAG,mBAAmB,GAAG,IAAI,CAAC;IAS1D;;;;;OAKG;IAEH,OAAO,KAAK,OAAO,GAGlB;IAED;;;;;;;OAOG;YAEW,aAAa;IAK3B;;;;;OAKG;YACW,aAAa;CA0B5B"}
@@ -22,7 +22,7 @@ export type { ValidateEndpointOptions } from "./endpoint-validator";
22
22
  export { getRpcUrl, getFallbackRpcUrl, createDualConnection, findATA, classifyAnchorError, extractAnchorErrorCode, } from "./rpc-strategy";
23
23
  export type { RpcConfig, DualConnection, AtaResult } from "./rpc-strategy";
24
24
  export { createEnvSchema, createEndpointDescriptorSchema, createHealthCheckSchema, createToolManifestEntrySchema, createAgentManifestSchema, createPreparePaymentSchema, createRegisterAgentSchema, createCallArgsSchema, validateOrThrow, } from "./schemas";
25
- export { buildPriorityFeeIxs, buildRpcOptions, FAST_SETTLE_OPTIONS, FAST_BATCH_SETTLE_OPTIONS, DEFAULT_SETTLE_PRIORITY_FEE, DEFAULT_SETTLE_COMPUTE_UNITS, DEFAULT_BATCH_SETTLE_COMPUTE_UNITS, } from "./priority-fee";
25
+ export { buildPriorityFeeIxs, buildRpcOptions, FAST_SETTLE_OPTIONS, FAST_BATCH_SETTLE_OPTIONS, DEFAULT_SETTLE_PRIORITY_FEE, DEFAULT_SETTLE_COMPUTE_UNITS, DEFAULT_BATCH_SETTLE_COMPUTE_UNITS, computeBatchSettleCu, } from "./priority-fee";
26
26
  export type { PriorityFeeConfig, SettleOptions, } from "./priority-fee";
27
27
  export { validateEscrowState, attachSplAccounts, toAccountMetas, MissingEscrowAtaError, } from "./escrow-validation";
28
28
  export type { SplAccountMeta, EscrowValidationResult, } from "./escrow-validation";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,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O,EACL,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,cAAc,EACd,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
@@ -47,6 +47,26 @@ export declare const DEFAULT_SETTLE_COMPUTE_UNITS = 100000;
47
47
  * @since v0.6.2
48
48
  */
49
49
  export declare const DEFAULT_BATCH_SETTLE_COMPUTE_UNITS = 300000;
50
+ /**
51
+ * @name computeBatchSettleCu
52
+ * @description Compute the CU limit needed by `settle_batch` for a
53
+ * given entry count. Returned value is safe to pass to
54
+ * `ComputeBudgetProgram.setComputeUnitLimit`.
55
+ *
56
+ * Formula: `60_000 + n * 25_000`, clamped to 1.2M.
57
+ *
58
+ * @param entryCount - Number of settlements in the batch (1..N).
59
+ * @returns CU limit suitable for `setComputeUnitLimit`.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const cu = computeBatchSettleCu(20); // 560_000
64
+ * ```
65
+ *
66
+ * @category Utils
67
+ * @since v0.11.0
68
+ */
69
+ export declare function computeBatchSettleCu(entryCount: number): number;
50
70
  /**
51
71
  * @interface PriorityFeeConfig
52
72
  * @description Configuration for building compute budget instructions.
@@ -1 +1 @@
1
- {"version":3,"file":"priority-fee.d.ts","sourceRoot":"","sources":["../../../src/utils/priority-fee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAC;AAMzB;;;;;GAKG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HANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oobe-protocol-labs/synapse-sap-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.6",
4
4
  "description": "TypeScript SDK for the Synapse Agent Protocol (SAP v2) on Solana Mainnet/Devnet",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -55,6 +55,59 @@ export const USDC_MINT_DEVNET = new PublicKey(
55
55
  */
56
56
  export const MIN_AGENT_STAKE_LAMPORTS = BigInt(100_000_000);
57
57
 
58
+ /**
59
+ * Slash share applied on a lost dispute, in basis points.
60
+ * Mirrors `AgentStake::SLASH_BPS` on-chain (`5_000` = 50%).
61
+ *
62
+ * @name SLASH_BPS
63
+ * @category Constants
64
+ * @since v0.11.0
65
+ */
66
+ export const SLASH_BPS = 5_000n;
67
+
68
+ /**
69
+ * Stake coverage ratio enforced at `createEscrowV2` (basis points).
70
+ * Mirrors `AgentStake::STAKE_COVERAGE_BPS` on-chain. Currently equal to
71
+ * {@link SLASH_BPS} so the slash on a lost dispute is fully collateralised.
72
+ *
73
+ * @name STAKE_COVERAGE_BPS
74
+ * @category Constants
75
+ * @since v0.11.0
76
+ */
77
+ export const STAKE_COVERAGE_BPS = SLASH_BPS;
78
+
79
+ /**
80
+ * Unstake cooldown in seconds. Mirrors `AgentStake::UNSTAKE_COOLDOWN_SECONDS`
81
+ * on-chain (`604_800` = 7 days). Replaces the misnamed pre-v0.11
82
+ * `UNSTAKE_COOLDOWN_SLOTS` constant which was never used by handlers.
83
+ *
84
+ * @name UNSTAKE_COOLDOWN_SECONDS
85
+ * @category Constants
86
+ * @since v0.11.0
87
+ */
88
+ export const UNSTAKE_COOLDOWN_SECONDS = 604_800;
89
+
90
+ /**
91
+ * Required `staked_amount` (lamports) for an agent to accept an escrow of
92
+ * `escrowLamports`. Equal to `max(MIN_AGENT_STAKE_LAMPORTS,
93
+ * escrowLamports * STAKE_COVERAGE_BPS / 10_000)`.
94
+ *
95
+ * Mirrors the on-chain check enforced in `create_escrow_v2` (v0.11 H-1).
96
+ * Use this to preflight an escrow create call and surface an actionable
97
+ * error before paying tx fees.
98
+ *
99
+ * @name computeRequiredStakeLamports
100
+ * @category Constants
101
+ * @since v0.11.0
102
+ */
103
+ export function computeRequiredStakeLamports(escrowLamports: bigint): bigint {
104
+ if (escrowLamports < 0n) {
105
+ throw new RangeError("escrowLamports must be ≥ 0");
106
+ }
107
+ const coverage = (escrowLamports * STAKE_COVERAGE_BPS) / 10_000n;
108
+ return coverage > MIN_AGENT_STAKE_LAMPORTS ? coverage : MIN_AGENT_STAKE_LAMPORTS;
109
+ }
110
+
58
111
  /**
59
112
  * Maximum delegate duration (seconds) accepted by `add_vault_delegate`.
60
113
  * Mirrors `VaultDelegate::MAX_DELEGATE_DURATION_SECS` on-chain
@@ -598,6 +598,38 @@
598
598
  }
599
599
  ]
600
600
  }
601
+ },
602
+ {
603
+ "name": "agent_stake",
604
+ "docs": [
605
+ "v0.11 H-3: AgentStake is now a typed required account so the slash on",
606
+ "DepositorWins outcomes is guaranteed instead of silently skipped when",
607
+ "the caller forgets to pass it via remaining_accounts."
608
+ ],
609
+ "writable": true,
610
+ "pda": {
611
+ "seeds": [
612
+ {
613
+ "kind": "const",
614
+ "value": [
615
+ 115,
616
+ 97,
617
+ 112,
618
+ 95,
619
+ 115,
620
+ 116,
621
+ 97,
622
+ 107,
623
+ 101
624
+ ]
625
+ },
626
+ {
627
+ "kind": "account",
628
+ "path": "escrow.agent",
629
+ "account": "EscrowAccountV2"
630
+ }
631
+ ]
632
+ }
601
633
  }
602
634
  ],
603
635
  "args": []
@@ -2504,10 +2536,16 @@
2504
2536
  {
2505
2537
  "name": "wallet",
2506
2538
  "writable": true,
2507
- "signer": true
2539
+ "signer": true,
2540
+ "relations": [
2541
+ "agent"
2542
+ ]
2508
2543
  },
2509
2544
  {
2510
2545
  "name": "agent",
2546
+ "docs": [
2547
+ "v0.11 M-2: typed agent account."
2548
+ ],
2511
2549
  "pda": {
2512
2550
  "seeds": [
2513
2551
  {
@@ -3647,10 +3685,16 @@
3647
3685
  {
3648
3686
  "name": "wallet",
3649
3687
  "writable": true,
3650
- "signer": true
3688
+ "signer": true,
3689
+ "relations": [
3690
+ "agent"
3691
+ ]
3651
3692
  },
3652
3693
  {
3653
3694
  "name": "agent",
3695
+ "docs": [
3696
+ "v0.11 M-2: typed agent account."
3697
+ ],
3654
3698
  "pda": {
3655
3699
  "seeds": [
3656
3700
  {
@@ -4671,10 +4715,16 @@
4671
4715
  {
4672
4716
  "name": "wallet",
4673
4717
  "writable": true,
4674
- "signer": true
4718
+ "signer": true,
4719
+ "relations": [
4720
+ "agent"
4721
+ ]
4675
4722
  },
4676
4723
  {
4677
4724
  "name": "agent",
4725
+ "docs": [
4726
+ "v0.11 M-2: typed agent account — stake cannot be opened for a non-existent agent."
4727
+ ],
4678
4728
  "pda": {
4679
4729
  "seeds": [
4680
4730
  {
@@ -6476,10 +6526,16 @@
6476
6526
  "accounts": [
6477
6527
  {
6478
6528
  "name": "wallet",
6479
- "signer": true
6529
+ "signer": true,
6530
+ "relations": [
6531
+ "agent"
6532
+ ]
6480
6533
  },
6481
6534
  {
6482
6535
  "name": "agent",
6536
+ "docs": [
6537
+ "v0.11 M-2: typed agent account."
6538
+ ],
6483
6539
  "pda": {
6484
6540
  "seeds": [
6485
6541
  {
@@ -9256,6 +9312,19 @@
9256
9312
  198
9257
9313
  ]
9258
9314
  },
9315
+ {
9316
+ "name": "StakeClosedEvent",
9317
+ "discriminator": [
9318
+ 212,
9319
+ 204,
9320
+ 207,
9321
+ 181,
9322
+ 185,
9323
+ 249,
9324
+ 134,
9325
+ 59
9326
+ ]
9327
+ },
9259
9328
  {
9260
9329
  "name": "StakeDepositedEvent",
9261
9330
  "discriminator": [
@@ -9412,6 +9481,19 @@
9412
9481
  57
9413
9482
  ]
9414
9483
  },
9484
+ {
9485
+ "name": "UnstakeCancelledEvent",
9486
+ "discriminator": [
9487
+ 57,
9488
+ 228,
9489
+ 7,
9490
+ 42,
9491
+ 227,
9492
+ 64,
9493
+ 93,
9494
+ 51
9495
+ ]
9496
+ },
9415
9497
  {
9416
9498
  "name": "UnstakeCompletedEvent",
9417
9499
  "discriminator": [
@@ -10211,6 +10293,21 @@
10211
10293
  "code": 6143,
10212
10294
  "name": "DuplicateServiceHash",
10213
10295
  "msg": "dup service hash"
10296
+ },
10297
+ {
10298
+ "code": 6144,
10299
+ "name": "StakeBelowCoverage",
10300
+ "msg": "stake under coverage"
10301
+ },
10302
+ {
10303
+ "code": 6145,
10304
+ "name": "StakeNotClosable",
10305
+ "msg": "stake not closable"
10306
+ },
10307
+ {
10308
+ "code": 6146,
10309
+ "name": "AgentStakeAccountMissing",
10310
+ "msg": "agent stake account missing"
10214
10311
  }
10215
10312
  ],
10216
10313
  "types": [
@@ -13436,6 +13533,33 @@
13436
13533
  ]
13437
13534
  }
13438
13535
  },
13536
+ {
13537
+ "name": "StakeClosedEvent",
13538
+ "docs": [
13539
+ "v0.11 L-3: emitted when an agent's stake account is closed and rent reclaimed."
13540
+ ],
13541
+ "type": {
13542
+ "kind": "struct",
13543
+ "fields": [
13544
+ {
13545
+ "name": "agent",
13546
+ "type": "pubkey"
13547
+ },
13548
+ {
13549
+ "name": "wallet",
13550
+ "type": "pubkey"
13551
+ },
13552
+ {
13553
+ "name": "returned_lamports",
13554
+ "type": "u64"
13555
+ },
13556
+ {
13557
+ "name": "timestamp",
13558
+ "type": "i64"
13559
+ }
13560
+ ]
13561
+ }
13562
+ },
13439
13563
  {
13440
13564
  "name": "StakeDepositedEvent",
13441
13565
  "docs": [
@@ -14196,6 +14320,34 @@
14196
14320
  ]
14197
14321
  }
14198
14322
  },
14323
+ {
14324
+ "name": "UnstakeCancelledEvent",
14325
+ "docs": [
14326
+ "v0.11 L-2: emitted when a `deposit_stake` clears a previously requested",
14327
+ "unstake (top-up = implicit cancel of the pending withdrawal)."
14328
+ ],
14329
+ "type": {
14330
+ "kind": "struct",
14331
+ "fields": [
14332
+ {
14333
+ "name": "agent",
14334
+ "type": "pubkey"
14335
+ },
14336
+ {
14337
+ "name": "wallet",
14338
+ "type": "pubkey"
14339
+ },
14340
+ {
14341
+ "name": "cancelled_amount",
14342
+ "type": "u64"
14343
+ },
14344
+ {
14345
+ "name": "timestamp",
14346
+ "type": "i64"
14347
+ }
14348
+ ]
14349
+ }
14350
+ },
14199
14351
  {
14200
14352
  "name": "UnstakeCompletedEvent",
14201
14353
  "docs": [
package/src/index.ts CHANGED
@@ -252,6 +252,7 @@ export {
252
252
  DEFAULT_SETTLE_PRIORITY_FEE,
253
253
  DEFAULT_SETTLE_COMPUTE_UNITS,
254
254
  DEFAULT_BATCH_SETTLE_COMPUTE_UNITS,
255
+ computeBatchSettleCu,
255
256
  } from "./utils";
256
257
  export type {
257
258
  PriorityFeeConfig,
@@ -14,6 +14,7 @@ import {
14
14
  type PublicKey,
15
15
  type TransactionSignature,
16
16
  type AccountMeta,
17
+ type Signer,
17
18
  } from "@solana/web3.js";
18
19
  import { BN } from "@coral-xyz/anchor";
19
20
  import { BaseModule } from "./base";
@@ -37,7 +38,7 @@ import {
37
38
  buildRpcOptions,
38
39
  } from "../utils/priority-fee";
39
40
  import type { SettleOptions } from "../utils/priority-fee";
40
- import { isAcceptedPaymentToken } from "../constants/payments";
41
+ import { isAcceptedPaymentToken, computeRequiredStakeLamports } from "../constants/payments";
41
42
 
42
43
  /**
43
44
  * @name EscrowV2Module
@@ -97,6 +98,54 @@ export class EscrowV2Module extends BaseModule {
97
98
  const [agentPda] = deriveAgent(agentWallet);
98
99
  const [escrowPda] = this.deriveEscrow(agentPda, undefined, args.escrowNonce);
99
100
  const [stakePda] = deriveStake(agentPda);
101
+ // v0.11 H-1 preflight: surface an actionable error if the agent's stake
102
+ // does not cover the slashable share of the new escrow. Saves a failed
103
+ // tx fee and gives the caller a clear top-up amount.
104
+ try {
105
+ const stakeAccount = await this.fetchAccountNullable<{ stakedAmount: BN }>("agentStake", stakePda);
106
+ if (stakeAccount) {
107
+ const escrowLamports = BigInt(this.bn(args.initialDeposit).toString());
108
+ const required = computeRequiredStakeLamports(escrowLamports);
109
+ const have = BigInt(stakeAccount.stakedAmount.toString());
110
+ if (have < required) {
111
+ throw new Error(
112
+ `createEscrowV2: agent stake ${have} lamports < required ${required} ` +
113
+ `lamports for escrow of ${escrowLamports} lamports. Top up via stakingModule.deposit.`,
114
+ );
115
+ }
116
+ }
117
+ // If no stake account exists at all, on-chain will reject with
118
+ // AccountNotInitialized — we let that bubble up unchanged.
119
+ } catch (err) {
120
+ // Preflight is advisory; rethrow only the explicit coverage error.
121
+ if (err instanceof Error && err.message.startsWith("createEscrowV2: agent stake")) {
122
+ throw err;
123
+ }
124
+ }
125
+ // v0.11 H-1 preflight: surface an actionable error if the agent's stake
126
+ // does not cover the slashable share of the new escrow. Saves a failed
127
+ // tx fee and gives the caller a clear top-up amount.
128
+ try {
129
+ const stakeAccount = await this.fetchAccountNullable<{ stakedAmount: BN }>("agentStake", stakePda);
130
+ if (stakeAccount) {
131
+ const escrowLamports = BigInt(this.bn(args.initialDeposit).toString());
132
+ const required = computeRequiredStakeLamports(escrowLamports);
133
+ const have = BigInt(stakeAccount.stakedAmount.toString());
134
+ if (have < required) {
135
+ throw new Error(
136
+ `createEscrowV2: agent stake ${have} lamports < required ${required} ` +
137
+ `lamports for escrow of ${escrowLamports} lamports. Top up via stakingModule.deposit.`,
138
+ );
139
+ }
140
+ }
141
+ // If no stake account exists at all, on-chain will reject with
142
+ // AccountNotInitialized — we let that bubble up unchanged.
143
+ } catch (err) {
144
+ // Preflight is advisory; rethrow only the explicit coverage error.
145
+ if (err instanceof Error && err.message.startsWith("createEscrowV2: agent stake")) {
146
+ throw err;
147
+ }
148
+ }
100
149
 
101
150
  return this.methods
102
151
  .createEscrowV2(
@@ -151,6 +200,7 @@ export class EscrowV2Module extends BaseModule {
151
200
  serviceHash: number[],
152
201
  splAccounts: AccountMeta[] = [],
153
202
  opts?: SettleOptions,
203
+ coSigner?: Signer,
154
204
  ): Promise<TransactionSignature> {
155
205
  const [agentPda] = deriveAgent(this.walletPubkey);
156
206
  const [escrowPda] = this.deriveEscrow(agentPda, depositorWallet, nonce);
@@ -160,9 +210,20 @@ export class EscrowV2Module extends BaseModule {
160
210
  const preIxs = buildPriorityFeeIxs(opts);
161
211
  const rpcOpts = buildRpcOptions(opts);
162
212
 
213
+ // CoSigned escrows require the co-signer to appear in
214
+ // remaining_accounts with `is_signer = true` AND to actually sign
215
+ // the transaction (Anchor on-chain checks `acc.is_signer`).
216
+ // We dedupe so callers can also pass it manually via splAccounts.
217
+ const remaining: AccountMeta[] = coSigner
218
+ ? [
219
+ ...splAccounts.filter((a) => !a.pubkey.equals(coSigner.publicKey)),
220
+ { pubkey: coSigner.publicKey, isSigner: true, isWritable: false },
221
+ ]
222
+ : splAccounts;
223
+
163
224
  let builder = this.methods
164
225
  .settleCallsV2(this.bn(nonce), this.bn(callsToSettle), serviceHash)
165
- .accounts({
226
+ .accountsPartial({
166
227
  wallet: this.walletPubkey,
167
228
  agent: agentPda,
168
229
  agentStats: statsPda,
@@ -170,7 +231,11 @@ export class EscrowV2Module extends BaseModule {
170
231
  settlementReceipt: receiptPda,
171
232
  systemProgram: SystemProgram.programId,
172
233
  })
173
- .remainingAccounts(splAccounts);
234
+ .remainingAccounts(remaining);
235
+
236
+ if (coSigner) {
237
+ builder = builder.signers([coSigner]);
238
+ }
174
239
 
175
240
  if (preIxs.length > 0) {
176
241
  builder = builder.preInstructions(preIxs);
@@ -33,6 +33,7 @@ import type {
33
33
  } from "../types";
34
34
  import {
35
35
  buildPriorityFeeIxs,
36
+ computeBatchSettleCu,
36
37
  buildRpcOptions,
37
38
  } from "../utils/priority-fee";
38
39
  import type { SettleOptions } from "../utils/priority-fee";
@@ -305,12 +306,22 @@ export class EscrowModule extends BaseModule {
305
306
  const rootArr = hashToArray(rootBytes);
306
307
  const [receiptPda] = deriveSettlementReceipt(escrowPda, rootBytes);
307
308
 
308
- const preIxs = buildPriorityFeeIxs(opts);
309
- const rpcOpts = buildRpcOptions(opts);
309
+ // Auto-size CU to the batch length so callers don't have to think
310
+ // about it. The default Solana cap (200k) overflows past ~8
311
+ // settlements; we compute a tight ceiling and let the caller
312
+ // override via `opts.computeUnits` if they want.
313
+ // Setting the CU limit is FREE — it doesn't add lamports, only
314
+ // caps the maximum the runtime is allowed to charge.
315
+ const effectiveOpts: SettleOptions = {
316
+ ...opts,
317
+ computeUnits: opts?.computeUnits ?? computeBatchSettleCu(settlements.length),
318
+ };
319
+ const preIxs = buildPriorityFeeIxs(effectiveOpts);
320
+ const rpcOpts = buildRpcOptions(effectiveOpts);
310
321
 
311
322
  let builder = this.methods
312
323
  .settleBatch(settlements, rootArr)
313
- .accounts({
324
+ .accountsPartial({
314
325
  wallet: this.walletPubkey,
315
326
  agent: agentPda,
316
327
  agentStats: statsPda,
@@ -25,6 +25,7 @@ import {
25
25
  derivePendingSettlement as derivePendingPda,
26
26
  deriveDispute as deriveDisputePda,
27
27
  deriveReceiptBatch as deriveReceiptPda,
28
+ deriveStake,
28
29
  } from "../pda";
29
30
  import type { ReceiptBatchData } from "../types";
30
31
 
@@ -172,6 +173,9 @@ export class ReceiptModule extends BaseModule {
172
173
  const [pendingPda] = derivePendingPda(escrowPda, this.toNum(settlementIndex));
173
174
  const [disputePda] = deriveDisputePda(pendingPda);
174
175
  const [statsPda] = deriveAgentStats(agentPda);
176
+ // v0.11 H-3: AgentStake is now a typed required account so the slash on
177
+ // DepositorWins is guaranteed instead of silently skipped.
178
+ const [stakePda] = deriveStake(agentPda);
175
179
 
176
180
  return this.methods
177
181
  .autoResolveDispute()
@@ -183,6 +187,7 @@ export class ReceiptModule extends BaseModule {
183
187
  pendingSettlement: pendingPda,
184
188
  dispute: disputePda,
185
189
  agentStats: statsPda,
190
+ agentStake: stakePda,
186
191
  })
187
192
  .rpc();
188
193
  }
@@ -17,6 +17,10 @@ import { BN } from "@coral-xyz/anchor";
17
17
  import { BaseModule } from "./base";
18
18
  import { deriveAgent, deriveStake } from "../pda";
19
19
  import type { AgentStakeData } from "../types";
20
+ import {
21
+ MIN_AGENT_STAKE_LAMPORTS,
22
+ computeRequiredStakeLamports,
23
+ } from "../constants/payments";
20
24
 
21
25
  /**
22
26
  * @name StakingModule
@@ -119,4 +123,35 @@ export class StakingModule extends BaseModule {
119
123
  async fetchByPda(stakePda: PublicKey): Promise<AgentStakeData> {
120
124
  return this.fetchAccount<AgentStakeData>("agentStake", stakePda);
121
125
  }
126
+
127
+ // ── v0.11 helpers ────────────────────────────────────────────
128
+
129
+ /**
130
+ * Compute the maximum amount that can be requested via `requestUnstake`
131
+ * without breaching the on-chain {@link MIN_AGENT_STAKE_LAMPORTS} floor.
132
+ *
133
+ * Returns 0 if the agent is already at (or below) the floor.
134
+ *
135
+ * @since v0.11.0
136
+ */
137
+ getMaxUnstakeLamports(stake: AgentStakeData): bigint {
138
+ const staked = BigInt(stake.stakedAmount.toString());
139
+ if (staked <= MIN_AGENT_STAKE_LAMPORTS) return 0n;
140
+ return staked - MIN_AGENT_STAKE_LAMPORTS;
141
+ }
142
+
143
+ /**
144
+ * Returns the lamport delta the agent must `deposit` to satisfy the
145
+ * per-escrow stake-coverage requirement for `escrowLamports`. 0 if already
146
+ * sufficient. Useful for a UI "top up to open this escrow" button.
147
+ *
148
+ * Mirrors the on-chain check in `create_escrow_v2` (v0.11 H-1).
149
+ *
150
+ * @since v0.11.0
151
+ */
152
+ getRequiredTopUp(stake: AgentStakeData, escrowLamports: bigint): bigint {
153
+ const required = computeRequiredStakeLamports(escrowLamports);
154
+ const have = BigInt(stake.stakedAmount.toString());
155
+ return have >= required ? 0n : required - have;
156
+ }
122
157
  }
@@ -88,6 +88,7 @@ import type {
88
88
  } from "../types";
89
89
  import {
90
90
  buildPriorityFeeIxs,
91
+ computeBatchSettleCu,
91
92
  buildRpcOptions,
92
93
  } from "../utils/priority-fee";
93
94
  import type { SettleOptions } from "../utils/priority-fee";
@@ -856,13 +857,19 @@ export class X402Registry {
856
857
  totalCalls,
857
858
  );
858
859
 
859
- // Build priority fee instructions (empty array if no opts)
860
- const preIxs = buildPriorityFeeIxs(opts);
861
- const rpcOpts = buildRpcOptions(opts);
860
+ // Auto-size CU to the batch length when the caller didn't pin one.
861
+ // Default Solana cap (200k) is tight past ~8 entries; a CU limit
862
+ // costs nothing extra (only caps the maximum charge).
863
+ const effectiveOpts: SettleOptions = {
864
+ ...opts,
865
+ computeUnits: opts?.computeUnits ?? computeBatchSettleCu(settlements.length),
866
+ };
867
+ const preIxs = buildPriorityFeeIxs(effectiveOpts);
868
+ const rpcOpts = buildRpcOptions(effectiveOpts);
862
869
 
863
870
  let builder = this.methods
864
871
  .settleBatch(settlements)
865
- .accounts({
872
+ .accountsPartial({
866
873
  wallet: this.wallet,
867
874
  agent: agentPda,
868
875
  agentStats: statsPda,
@@ -66,6 +66,7 @@ export {
66
66
  DEFAULT_SETTLE_PRIORITY_FEE,
67
67
  DEFAULT_SETTLE_COMPUTE_UNITS,
68
68
  DEFAULT_BATCH_SETTLE_COMPUTE_UNITS,
69
+ computeBatchSettleCu,
69
70
  } from "./priority-fee";
70
71
  export type {
71
72
  PriorityFeeConfig,