@ember-finance/sdk 2.34.0 → 2.35.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);
|