@ember-finance/sdk 2.34.0 → 2.36.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.
@@ -1,5 +1,12 @@
1
1
  import { Provider } from "ethers";
2
2
  import { FeeMultiplierTier, InstantWithdrawQuote } from "../../atomic/instant-withdraw.js";
3
+ /** One queued holdback entry, as stored by AtomicLiquidity. */
4
+ export interface EVMHoldbackEntry {
5
+ receiver: string;
6
+ amount: bigint;
7
+ createdAt: bigint;
8
+ sequenceNumber: bigint;
9
+ }
3
10
  /**
4
11
  * Read-only views for the Atomic Liquidity Vault (BFE-817/818).
5
12
  *
@@ -60,6 +67,17 @@ export declare class EVMAtomicLiquidityReader {
60
67
  emberShareConfigs(vaultAddress: string, share: string): Promise<unknown>;
61
68
  /** Remaining swap capacity for a source share in the current epoch. */
62
69
  availableEmberShareCapacity(vaultAddress: string, share: string): Promise<bigint>;
70
+ /**
71
+ * The pending holdback queue for one source share, oldest first.
72
+ * @param vaultAddress The atomic vault
73
+ * @param share The source share (its vault address)
74
+ * @param maxEntries Read at most this many entries from the head
75
+ * @returns The number of pending entries and the entries read
76
+ */
77
+ getHoldbackQueue(vaultAddress: string, share: string, maxEntries: number): Promise<{
78
+ length: bigint;
79
+ entries: EVMHoldbackEntry[];
80
+ }>;
63
81
  /** Length of the holdback FIFO for a source share. */
64
82
  getHoldbackQueueLength(vaultAddress: string, share: string): Promise<bigint>;
65
83
  /**
@@ -97,6 +97,31 @@ export class EVMAtomicLiquidityReader {
97
97
  async availableEmberShareCapacity(vaultAddress, share) {
98
98
  return this.contract(vaultAddress).availableEmberShareCapacity(share);
99
99
  }
100
+ /**
101
+ * The pending holdback queue for one source share, oldest first.
102
+ * @param vaultAddress The atomic vault
103
+ * @param share The source share (its vault address)
104
+ * @param maxEntries Read at most this many entries from the head
105
+ * @returns The number of pending entries and the entries read
106
+ */
107
+ async getHoldbackQueue(vaultAddress, share, maxEntries) {
108
+ const vault = this.contract(vaultAddress);
109
+ const [start, pending] = await Promise.all([
110
+ vault.holdbackQueueStartIndex(share),
111
+ vault.getPendingHoldbackEntries(share)
112
+ ]);
113
+ const count = pending < BigInt(maxEntries) ? Number(pending) : maxEntries;
114
+ const entries = await Promise.all(Array.from({ length: count }, async (_, i) => {
115
+ const e = await vault.getHoldbackEntry(share, start + BigInt(i));
116
+ return {
117
+ receiver: e.recipient,
118
+ amount: BigInt(e.amount),
119
+ createdAt: BigInt(e.createdAt),
120
+ sequenceNumber: BigInt(e.sequenceNumber)
121
+ };
122
+ }));
123
+ return { length: pending, entries };
124
+ }
100
125
  /** Length of the holdback FIFO for a source share. */
101
126
  async getHoldbackQueueLength(vaultAddress, share) {
102
127
  return this.contract(vaultAddress).getHoldbackQueueLength(share);
@@ -115,6 +115,22 @@ export declare class EVMOperatorCalls extends EVMOnChainCalls {
115
115
  * @returns EvmOnChainCallResponse
116
116
  */
117
117
  setDepositAllowList(vaultAddress: string, user: string, status: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
118
+ /**
119
+ * Add or remove a user on a vault's withdrawal-fee exemption list.
120
+ *
121
+ * Operator-gated, unlike the fee percentages themselves which are the admin's:
122
+ * `EmberVaultValidator.setFeeExemptionListStatus` rejects any caller that is not
123
+ * `roles().operator`. Adding also rejects the vault's three role addresses and any
124
+ * protocol-blacklisted account; removing has neither restriction, so an address can always
125
+ * be taken back off the list. Setting the value it already has reverts `SameValue`.
126
+ *
127
+ * @param vaultAddress The address of the vault
128
+ * @param user The account whose exemption is changing
129
+ * @param status True to exempt from withdrawal fees, false to remove the exemption
130
+ * @param options Optional tx execution params
131
+ * @returns EvmOnChainCallResponse
132
+ */
133
+ setFeeExemptionList(vaultAddress: string, user: string, status: boolean, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
118
134
  /** Atomic vault: supply `assets` of idle collateral into the external ERC-4626 strategy. */
119
135
  supplyToStrategy(vaultAddress: string, assets: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
120
136
  /** Atomic vault: withdraw `assets` of collateral back from the strategy into the vault. */
@@ -156,6 +156,25 @@ export class EVMOperatorCalls extends EVMOnChainCalls {
156
156
  const txCall = this.txBuilder.setVaultDepositAllowList(vaultAddress, user, status);
157
157
  return this.execCall(txCall, options);
158
158
  }
159
+ /**
160
+ * Add or remove a user on a vault's withdrawal-fee exemption list.
161
+ *
162
+ * Operator-gated, unlike the fee percentages themselves which are the admin's:
163
+ * `EmberVaultValidator.setFeeExemptionListStatus` rejects any caller that is not
164
+ * `roles().operator`. Adding also rejects the vault's three role addresses and any
165
+ * protocol-blacklisted account; removing has neither restriction, so an address can always
166
+ * be taken back off the list. Setting the value it already has reverts `SameValue`.
167
+ *
168
+ * @param vaultAddress The address of the vault
169
+ * @param user The account whose exemption is changing
170
+ * @param status True to exempt from withdrawal fees, false to remove the exemption
171
+ * @param options Optional tx execution params
172
+ * @returns EvmOnChainCallResponse
173
+ */
174
+ async setFeeExemptionList(vaultAddress, user, status, options) {
175
+ const txCall = this.txBuilder.setVaultFeeExemptionList(vaultAddress, user, status);
176
+ return this.execCall(txCall, options);
177
+ }
159
178
  // ============================================
160
179
  // Atomic Liquidity Vault — operator actions (BFE-817/818)
161
180
  // ============================================
@@ -250,6 +250,21 @@ export declare class EVMTxBuilder {
250
250
  * @returns Transaction call object
251
251
  */
252
252
  setVaultDepositAllowList(vaultAddress: string, user: string, status: boolean): ITransactionCall;
253
+ /**
254
+ * Sets withdrawal-fee exemption for a user on a vault (called via ProtocolConfig)
255
+ *
256
+ * Operator-gated on chain, unlike the fee percentages themselves which are the admin's:
257
+ * `EmberVaultValidator.setFeeExemptionListStatus` rejects any caller that is not
258
+ * `roles().operator`. Adding also rejects the vault's three role addresses and any
259
+ * protocol-blacklisted account; removing has neither restriction, so an address can always
260
+ * be taken back off the list.
261
+ *
262
+ * @param vaultAddress Address of the vault
263
+ * @param user User address to update
264
+ * @param status True to exempt the user from withdrawal fees, false to remove the exemption
265
+ * @returns Transaction call object
266
+ */
267
+ setVaultFeeExemptionList(vaultAddress: string, user: string, status: boolean): ITransactionCall;
253
268
  /**
254
269
  * Updates the maximum TVL of a vault (called via ProtocolConfig)
255
270
  * @param vaultAddress Address of the vault
@@ -498,6 +498,30 @@ export class EVMTxBuilder {
498
498
  chainId: this.getChainId()
499
499
  };
500
500
  }
501
+ /**
502
+ * Sets withdrawal-fee exemption for a user on a vault (called via ProtocolConfig)
503
+ *
504
+ * Operator-gated on chain, unlike the fee percentages themselves which are the admin's:
505
+ * `EmberVaultValidator.setFeeExemptionListStatus` rejects any caller that is not
506
+ * `roles().operator`. Adding also rejects the vault's three role addresses and any
507
+ * protocol-blacklisted account; removing has neither restriction, so an address can always
508
+ * be taken back off the list.
509
+ *
510
+ * @param vaultAddress Address of the vault
511
+ * @param user User address to update
512
+ * @param status True to exempt the user from withdrawal fees, false to remove the exemption
513
+ * @returns Transaction call object
514
+ */
515
+ setVaultFeeExemptionList(vaultAddress, user, status) {
516
+ return {
517
+ to: this.parser.getProtocolConfigAddress(),
518
+ functionName: "setVaultFeeExemptionList",
519
+ args: [vaultAddress, user, status],
520
+ abi: EmberProtocolConfigABI.abi,
521
+ value: 0n,
522
+ chainId: this.getChainId()
523
+ };
524
+ }
501
525
  /**
502
526
  * Updates the maximum TVL of a vault (called via ProtocolConfig)
503
527
  * @param vaultAddress Address of the vault
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-finance/sdk",
3
3
  "description": "Ember Protocol SDK",
4
- "version": "2.34.0",
4
+ "version": "2.36.0",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
7
7
  "main": "./dist/index.js",