@ember-finance/sdk 2.3.0 → 2.4.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.
@@ -0,0 +1,269 @@
1
+ {
2
+ "contractName": "OpenCoverInsuredVault",
3
+ "sourceName": "OpenCover Insured Vault (ERC-7540 cover vault shares)",
4
+ "abi": [
5
+ {
6
+ "inputs": [
7
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
8
+ { "internalType": "address", "name": "controller", "type": "address" },
9
+ { "internalType": "address", "name": "owner", "type": "address" }
10
+ ],
11
+ "name": "requestDeposit",
12
+ "outputs": [
13
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" }
14
+ ],
15
+ "stateMutability": "nonpayable",
16
+ "type": "function"
17
+ },
18
+ {
19
+ "inputs": [
20
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
21
+ { "internalType": "address", "name": "receiver", "type": "address" },
22
+ { "internalType": "address", "name": "controller", "type": "address" }
23
+ ],
24
+ "name": "deposit",
25
+ "outputs": [
26
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
27
+ ],
28
+ "stateMutability": "nonpayable",
29
+ "type": "function"
30
+ },
31
+ {
32
+ "inputs": [
33
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
34
+ { "internalType": "address", "name": "receiver", "type": "address" },
35
+ { "internalType": "address", "name": "controller", "type": "address" }
36
+ ],
37
+ "name": "mint",
38
+ "outputs": [
39
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
40
+ ],
41
+ "stateMutability": "nonpayable",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [
46
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
47
+ { "internalType": "address", "name": "controller", "type": "address" },
48
+ { "internalType": "address", "name": "owner", "type": "address" }
49
+ ],
50
+ "name": "requestRedeem",
51
+ "outputs": [
52
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" }
53
+ ],
54
+ "stateMutability": "nonpayable",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [
59
+ { "internalType": "uint256", "name": "shares", "type": "uint256" },
60
+ { "internalType": "address", "name": "receiver", "type": "address" },
61
+ { "internalType": "address", "name": "controller", "type": "address" }
62
+ ],
63
+ "name": "redeem",
64
+ "outputs": [
65
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
66
+ ],
67
+ "stateMutability": "nonpayable",
68
+ "type": "function"
69
+ },
70
+ {
71
+ "inputs": [
72
+ { "internalType": "uint256", "name": "assets", "type": "uint256" },
73
+ { "internalType": "address", "name": "receiver", "type": "address" },
74
+ { "internalType": "address", "name": "controller", "type": "address" }
75
+ ],
76
+ "name": "withdraw",
77
+ "outputs": [
78
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
79
+ ],
80
+ "stateMutability": "nonpayable",
81
+ "type": "function"
82
+ },
83
+ {
84
+ "inputs": [
85
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" }
86
+ ],
87
+ "name": "settleMaturedRedemption",
88
+ "outputs": [],
89
+ "stateMutability": "nonpayable",
90
+ "type": "function"
91
+ },
92
+ {
93
+ "inputs": [
94
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" },
95
+ { "internalType": "address", "name": "controller", "type": "address" }
96
+ ],
97
+ "name": "pendingDepositRequest",
98
+ "outputs": [
99
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
100
+ ],
101
+ "stateMutability": "view",
102
+ "type": "function"
103
+ },
104
+ {
105
+ "inputs": [
106
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" },
107
+ { "internalType": "address", "name": "controller", "type": "address" }
108
+ ],
109
+ "name": "claimableDepositRequest",
110
+ "outputs": [
111
+ { "internalType": "uint256", "name": "assets", "type": "uint256" }
112
+ ],
113
+ "stateMutability": "view",
114
+ "type": "function"
115
+ },
116
+ {
117
+ "inputs": [
118
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" },
119
+ { "internalType": "address", "name": "controller", "type": "address" }
120
+ ],
121
+ "name": "pendingRedeemRequest",
122
+ "outputs": [
123
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
124
+ ],
125
+ "stateMutability": "view",
126
+ "type": "function"
127
+ },
128
+ {
129
+ "inputs": [
130
+ { "internalType": "uint256", "name": "requestId", "type": "uint256" },
131
+ { "internalType": "address", "name": "controller", "type": "address" }
132
+ ],
133
+ "name": "claimableRedeemRequest",
134
+ "outputs": [
135
+ { "internalType": "uint256", "name": "shares", "type": "uint256" }
136
+ ],
137
+ "stateMutability": "view",
138
+ "type": "function"
139
+ },
140
+ {
141
+ "inputs": [],
142
+ "name": "asset",
143
+ "outputs": [
144
+ {
145
+ "internalType": "address",
146
+ "name": "assetTokenAddress",
147
+ "type": "address"
148
+ }
149
+ ],
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ },
153
+ {
154
+ "inputs": [
155
+ { "internalType": "address", "name": "account", "type": "address" }
156
+ ],
157
+ "name": "balanceOf",
158
+ "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
159
+ "stateMutability": "view",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "inputs": [
164
+ { "internalType": "address", "name": "controller", "type": "address" }
165
+ ],
166
+ "name": "maxRedeem",
167
+ "outputs": [
168
+ { "internalType": "uint256", "name": "maxShares", "type": "uint256" }
169
+ ],
170
+ "stateMutability": "view",
171
+ "type": "function"
172
+ },
173
+ {
174
+ "inputs": [
175
+ { "internalType": "address", "name": "controller", "type": "address" }
176
+ ],
177
+ "name": "maxWithdraw",
178
+ "outputs": [
179
+ { "internalType": "uint256", "name": "maxAssets", "type": "uint256" }
180
+ ],
181
+ "stateMutability": "view",
182
+ "type": "function"
183
+ },
184
+ {
185
+ "inputs": [
186
+ { "internalType": "address", "name": "spender", "type": "address" },
187
+ { "internalType": "uint256", "name": "value", "type": "uint256" }
188
+ ],
189
+ "name": "approve",
190
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
191
+ "stateMutability": "nonpayable",
192
+ "type": "function"
193
+ },
194
+ {
195
+ "anonymous": false,
196
+ "inputs": [
197
+ {
198
+ "indexed": true,
199
+ "internalType": "address",
200
+ "name": "controller",
201
+ "type": "address"
202
+ },
203
+ {
204
+ "indexed": true,
205
+ "internalType": "address",
206
+ "name": "owner",
207
+ "type": "address"
208
+ },
209
+ {
210
+ "indexed": true,
211
+ "internalType": "uint256",
212
+ "name": "requestId",
213
+ "type": "uint256"
214
+ },
215
+ {
216
+ "indexed": false,
217
+ "internalType": "address",
218
+ "name": "sender",
219
+ "type": "address"
220
+ },
221
+ {
222
+ "indexed": false,
223
+ "internalType": "uint256",
224
+ "name": "assets",
225
+ "type": "uint256"
226
+ }
227
+ ],
228
+ "name": "DepositRequest",
229
+ "type": "event"
230
+ },
231
+ {
232
+ "anonymous": false,
233
+ "inputs": [
234
+ {
235
+ "indexed": true,
236
+ "internalType": "address",
237
+ "name": "controller",
238
+ "type": "address"
239
+ },
240
+ {
241
+ "indexed": true,
242
+ "internalType": "address",
243
+ "name": "owner",
244
+ "type": "address"
245
+ },
246
+ {
247
+ "indexed": true,
248
+ "internalType": "uint256",
249
+ "name": "requestId",
250
+ "type": "uint256"
251
+ },
252
+ {
253
+ "indexed": false,
254
+ "internalType": "address",
255
+ "name": "sender",
256
+ "type": "address"
257
+ },
258
+ {
259
+ "indexed": false,
260
+ "internalType": "uint256",
261
+ "name": "shares",
262
+ "type": "uint256"
263
+ }
264
+ ],
265
+ "name": "RedeemRequest",
266
+ "type": "event"
267
+ }
268
+ ]
269
+ }
@@ -2,10 +2,12 @@ import EmberVaultABI from "./EmberVault.json";
2
2
  import EmberProtocolConfigABI from "./EmberProtocolConfig.json";
3
3
  import ERC20TokenABI from "./ERC20Token.json";
4
4
  import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json";
5
+ import OpenCoverVaultABI from "./OpenCoverVault.json";
5
6
  import { Interface } from "ethers";
6
7
  declare const EmberVault: Interface;
7
8
  declare const EmberProtocolConfig: Interface;
8
9
  declare const ERC20Token: Interface;
9
10
  declare const EmberETHVault: Interface;
10
11
  declare const EmberVaultOFTAdapter: Interface;
11
- export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter };
12
+ declare const OpenCoverVault: Interface;
13
+ export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
@@ -3,10 +3,12 @@ import EmberProtocolConfigABI from "./EmberProtocolConfig.json" with { type: "js
3
3
  import ERC20TokenABI from "./ERC20Token.json" with { type: "json" };
4
4
  import EmberETHVaultABI from "./EmberETHVault.json" with { type: "json" };
5
5
  import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
6
+ import OpenCoverVaultABI from "./OpenCoverVault.json" with { type: "json" };
6
7
  import { Interface } from "ethers";
7
8
  const EmberVault = new Interface(EmberVaultABI.abi);
8
9
  const EmberProtocolConfig = new Interface(EmberProtocolConfigABI.abi);
9
10
  const ERC20Token = new Interface(ERC20TokenABI.abi);
10
11
  const EmberETHVault = new Interface(EmberETHVaultABI.abi);
11
12
  const EmberVaultOFTAdapter = new Interface(EmberVaultOFTAdapterABI.abi);
12
- export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter };
13
+ const OpenCoverVault = new Interface(OpenCoverVaultABI.abi);
14
+ export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
@@ -90,6 +90,12 @@ export interface ChainVaultDetails {
90
90
  * @memberof ChainVaultDetails
91
91
  */
92
92
  maxDepositsAllowed: string;
93
+ /**
94
+ * True if this on-chain vault is insured via OpenCover (cover vault shares) — i.e. its yield-bearing shares can be wrapped into an OpenCover insured metavault to activate coverage. Currently only true for EVM vaults; false for Sui and for uninsured vaults.
95
+ * @type {boolean}
96
+ * @memberof ChainVaultDetails
97
+ */
98
+ covered: boolean;
93
99
  /**
94
100
  * True if this on-chain vault gates deposits through a parking lot (async deposits) — i.e. it has an active deposit parking lot. Only set for EVM vaults; always false/absent for Sui. Convenience flag equivalent to `parkingLot != null`.
95
101
  * @type {boolean}
@@ -45,4 +45,10 @@ export interface RewardToken {
45
45
  * @memberof RewardToken
46
46
  */
47
47
  decimals: number;
48
+ /**
49
+ * Optional remark describing how this reward is disbursed (e.g. \"Distributed via Merkl\"). Rendered by the frontend as a tooltip in the vault rewards table. Absent when there is no remark.
50
+ * @type {string}
51
+ * @memberof RewardToken
52
+ */
53
+ disbursementRemarks?: string;
48
54
  }
@@ -1,6 +1,7 @@
1
1
  import { Signer, Provider, TransactionResponse, TransactionReceipt, Log, LogDescription } from "ethers";
2
2
  import type { EvmProtocolInfo as ApiEvmProtocolInfo } from "../../api/v2/models/evm-protocol-info.js";
3
3
  import { Chain } from "../../api/v2/index.js";
4
+ import { NumStr } from "../../common/types.js";
4
5
  /**
5
6
  * Minimal chain metadata used to map LayerZero chain IDs to Ember chain identifiers.
6
7
  */
@@ -198,6 +199,33 @@ export interface IUserCallOptions extends IEvmCallOptions {
198
199
  */
199
200
  depositToParkingLot?: boolean;
200
201
  }
202
+ /**
203
+ * Optional parameters for OpenCover cover-vault (insured vault / cover vault
204
+ * shares) calls. Cover vaults follow the ERC-7540 async lifecycle: a deposit or
205
+ * redemption is first *requested*, settles after a short delay, then *claimed*.
206
+ *
207
+ * `controller` and `owner` default to the caller's wallet address, matching the
208
+ * common self-service flow. `receiver` (from IUserCallOptions) is who ultimately
209
+ * receives the cover shares (on deposit claim) or the underlying yield-vault
210
+ * shares (on redeem claim); it also defaults to the caller.
211
+ */
212
+ export interface ICoverVaultCallOptions extends IUserCallOptions {
213
+ /**
214
+ * The controller that owns and aggregates the async request in the cover
215
+ * vault. Defaults to the caller's wallet address.
216
+ */
217
+ controller?: string;
218
+ /**
219
+ * The owner supplying the assets (yield-vault shares) on deposit, or the
220
+ * cover shares on redeem. Defaults to the caller's wallet address.
221
+ */
222
+ owner?: string;
223
+ /**
224
+ * Request id for claim/settle actions. OpenCover aggregates by controller so
225
+ * this is 0 in the common case; defaults to 0 when omitted.
226
+ */
227
+ requestId?: NumStr;
228
+ }
201
229
  /**
202
230
  * Optional parameters for high-level OFT bridge send calls.
203
231
  */
@@ -387,6 +387,77 @@ export declare class EVMTxBuilder {
387
387
  * @returns Transaction call object
388
388
  */
389
389
  cancelPendingWithdrawalRequest(vaultAddress: string, requestSequenceNumber: NumStr, isETHVault?: boolean): ITransactionCall;
390
+ /**
391
+ * Requests an async deposit into an OpenCover cover vault: escrows `assets`
392
+ * (yield-vault shares) and queues them for settlement, after which cover
393
+ * shares can be claimed. The `owner`'s yield-vault shares must be approved to
394
+ * the cover vault first.
395
+ * @param coverVaultAddress Address of the OpenCover insured vault
396
+ * @param assets Amount of underlying yield-vault shares to cover
397
+ * @param controller Controller that owns/aggregates the request
398
+ * @param owner Address supplying the yield-vault shares
399
+ * @returns Transaction call object
400
+ */
401
+ requestCoverDeposit(coverVaultAddress: string, assets: NumStr, controller: string, owner: string): ITransactionCall;
402
+ /**
403
+ * Claims cover shares from a settled deposit request, by asset amount
404
+ * (ERC-7540 `deposit(assets, receiver, controller)`).
405
+ * @param coverVaultAddress Address of the OpenCover insured vault
406
+ * @param assets Settled asset amount to claim cover shares for
407
+ * @param receiver Address to receive the minted cover shares
408
+ * @param controller Controller that owns the settled request
409
+ * @returns Transaction call object
410
+ */
411
+ claimCoverDeposit(coverVaultAddress: string, assets: NumStr, receiver: string, controller: string): ITransactionCall;
412
+ /**
413
+ * Claims cover shares from a settled deposit request, by exact share amount
414
+ * (ERC-7540 `mint(shares, receiver, controller)`).
415
+ * @param coverVaultAddress Address of the OpenCover insured vault
416
+ * @param shares Exact number of cover shares to claim
417
+ * @param receiver Address to receive the minted cover shares
418
+ * @param controller Controller that owns the settled request
419
+ * @returns Transaction call object
420
+ */
421
+ mintCoverShares(coverVaultAddress: string, shares: NumStr, receiver: string, controller: string): ITransactionCall;
422
+ /**
423
+ * Requests an async redemption from an OpenCover cover vault: burns/locks
424
+ * `shares` (cover shares) and queues them for settlement, after which the
425
+ * underlying yield-vault shares can be claimed.
426
+ * @param coverVaultAddress Address of the OpenCover insured vault
427
+ * @param shares Amount of cover shares to redeem
428
+ * @param controller Controller that owns/aggregates the request
429
+ * @param owner Address holding the cover shares
430
+ * @returns Transaction call object
431
+ */
432
+ requestCoverRedeem(coverVaultAddress: string, shares: NumStr, controller: string, owner: string): ITransactionCall;
433
+ /**
434
+ * Claims the underlying yield-vault shares from a settled redemption request,
435
+ * by cover-share amount (ERC-7540 `redeem(shares, receiver, controller)`).
436
+ * @param coverVaultAddress Address of the OpenCover insured vault
437
+ * @param shares Amount of cover shares to redeem for underlying shares
438
+ * @param receiver Address to receive the underlying yield-vault shares
439
+ * @param controller Controller that owns the settled request
440
+ * @returns Transaction call object
441
+ */
442
+ claimCoverRedeem(coverVaultAddress: string, shares: NumStr, receiver: string, controller: string): ITransactionCall;
443
+ /**
444
+ * Claims the underlying yield-vault shares from a settled redemption request,
445
+ * by exact asset amount (ERC-7540 `withdraw(assets, receiver, controller)`).
446
+ * @param coverVaultAddress Address of the OpenCover insured vault
447
+ * @param assets Exact amount of underlying yield-vault shares to withdraw
448
+ * @param receiver Address to receive the underlying yield-vault shares
449
+ * @param controller Controller that owns the settled request
450
+ * @returns Transaction call object
451
+ */
452
+ withdrawCoverAssets(coverVaultAddress: string, assets: NumStr, receiver: string, controller: string): ITransactionCall;
453
+ /**
454
+ * Permissionlessly settles a matured redemption request (callable by anyone
455
+ * once the request has matured, e.g. after 24h) so the controller can claim.
456
+ * @param coverVaultAddress Address of the OpenCover insured vault
457
+ * @param requestId The redemption request id to settle
458
+ * @returns Transaction call object
459
+ */
460
+ settleMaturedCoverRedemption(coverVaultAddress: string, requestId: NumStr): ITransactionCall;
390
461
  /**
391
462
  * Approves a token for spending by the vault
392
463
  * @param tokenAddress Address of the token
@@ -5,6 +5,7 @@ import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with {
5
5
  import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
6
6
  import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
7
7
  import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
8
+ import OpenCoverVaultABI from "../../abis/OpenCoverVault.json" with { type: "json" };
8
9
  /**
9
10
  * EVM Transaction Builder for Ember Protocol (ERC-4626 Compatible)
10
11
  *
@@ -810,6 +811,151 @@ export class EVMTxBuilder {
810
811
  };
811
812
  }
812
813
  // ============================================
814
+ // OpenCover Cover Vault Methods (ERC-7540 async)
815
+ //
816
+ // A "covered" vault wraps its yield-bearing shares into an OpenCover insured
817
+ // metavault to activate coverage. The cover vault's *asset* is the underlying
818
+ // yield-vault share token; its *share* is the cover share (e.g. OC-eEARN).
819
+ // The lifecycle is async: request -> settle -> claim.
820
+ // - deposit: requestCoverDeposit -> (settles) -> claimCoverDeposit / mintCoverShares
821
+ // - withdraw: requestCoverRedeem -> (settles) -> claimCoverRedeem / withdrawCoverAssets
822
+ // Approval is on the underlying yield-vault share token, spender = cover vault.
823
+ // ============================================
824
+ /**
825
+ * Requests an async deposit into an OpenCover cover vault: escrows `assets`
826
+ * (yield-vault shares) and queues them for settlement, after which cover
827
+ * shares can be claimed. The `owner`'s yield-vault shares must be approved to
828
+ * the cover vault first.
829
+ * @param coverVaultAddress Address of the OpenCover insured vault
830
+ * @param assets Amount of underlying yield-vault shares to cover
831
+ * @param controller Controller that owns/aggregates the request
832
+ * @param owner Address supplying the yield-vault shares
833
+ * @returns Transaction call object
834
+ */
835
+ requestCoverDeposit(coverVaultAddress, assets, controller, owner) {
836
+ return {
837
+ to: coverVaultAddress,
838
+ functionName: "requestDeposit",
839
+ args: [BigInt(assets), controller, owner],
840
+ abi: OpenCoverVaultABI.abi,
841
+ value: 0n,
842
+ chainId: this.getChainId()
843
+ };
844
+ }
845
+ /**
846
+ * Claims cover shares from a settled deposit request, by asset amount
847
+ * (ERC-7540 `deposit(assets, receiver, controller)`).
848
+ * @param coverVaultAddress Address of the OpenCover insured vault
849
+ * @param assets Settled asset amount to claim cover shares for
850
+ * @param receiver Address to receive the minted cover shares
851
+ * @param controller Controller that owns the settled request
852
+ * @returns Transaction call object
853
+ */
854
+ claimCoverDeposit(coverVaultAddress, assets, receiver, controller) {
855
+ return {
856
+ to: coverVaultAddress,
857
+ functionName: "deposit",
858
+ args: [BigInt(assets), receiver, controller],
859
+ abi: OpenCoverVaultABI.abi,
860
+ value: 0n,
861
+ chainId: this.getChainId()
862
+ };
863
+ }
864
+ /**
865
+ * Claims cover shares from a settled deposit request, by exact share amount
866
+ * (ERC-7540 `mint(shares, receiver, controller)`).
867
+ * @param coverVaultAddress Address of the OpenCover insured vault
868
+ * @param shares Exact number of cover shares to claim
869
+ * @param receiver Address to receive the minted cover shares
870
+ * @param controller Controller that owns the settled request
871
+ * @returns Transaction call object
872
+ */
873
+ mintCoverShares(coverVaultAddress, shares, receiver, controller) {
874
+ return {
875
+ to: coverVaultAddress,
876
+ functionName: "mint",
877
+ args: [BigInt(shares), receiver, controller],
878
+ abi: OpenCoverVaultABI.abi,
879
+ value: 0n,
880
+ chainId: this.getChainId()
881
+ };
882
+ }
883
+ /**
884
+ * Requests an async redemption from an OpenCover cover vault: burns/locks
885
+ * `shares` (cover shares) and queues them for settlement, after which the
886
+ * underlying yield-vault shares can be claimed.
887
+ * @param coverVaultAddress Address of the OpenCover insured vault
888
+ * @param shares Amount of cover shares to redeem
889
+ * @param controller Controller that owns/aggregates the request
890
+ * @param owner Address holding the cover shares
891
+ * @returns Transaction call object
892
+ */
893
+ requestCoverRedeem(coverVaultAddress, shares, controller, owner) {
894
+ return {
895
+ to: coverVaultAddress,
896
+ functionName: "requestRedeem",
897
+ args: [BigInt(shares), controller, owner],
898
+ abi: OpenCoverVaultABI.abi,
899
+ value: 0n,
900
+ chainId: this.getChainId()
901
+ };
902
+ }
903
+ /**
904
+ * Claims the underlying yield-vault shares from a settled redemption request,
905
+ * by cover-share amount (ERC-7540 `redeem(shares, receiver, controller)`).
906
+ * @param coverVaultAddress Address of the OpenCover insured vault
907
+ * @param shares Amount of cover shares to redeem for underlying shares
908
+ * @param receiver Address to receive the underlying yield-vault shares
909
+ * @param controller Controller that owns the settled request
910
+ * @returns Transaction call object
911
+ */
912
+ claimCoverRedeem(coverVaultAddress, shares, receiver, controller) {
913
+ return {
914
+ to: coverVaultAddress,
915
+ functionName: "redeem",
916
+ args: [BigInt(shares), receiver, controller],
917
+ abi: OpenCoverVaultABI.abi,
918
+ value: 0n,
919
+ chainId: this.getChainId()
920
+ };
921
+ }
922
+ /**
923
+ * Claims the underlying yield-vault shares from a settled redemption request,
924
+ * by exact asset amount (ERC-7540 `withdraw(assets, receiver, controller)`).
925
+ * @param coverVaultAddress Address of the OpenCover insured vault
926
+ * @param assets Exact amount of underlying yield-vault shares to withdraw
927
+ * @param receiver Address to receive the underlying yield-vault shares
928
+ * @param controller Controller that owns the settled request
929
+ * @returns Transaction call object
930
+ */
931
+ withdrawCoverAssets(coverVaultAddress, assets, receiver, controller) {
932
+ return {
933
+ to: coverVaultAddress,
934
+ functionName: "withdraw",
935
+ args: [BigInt(assets), receiver, controller],
936
+ abi: OpenCoverVaultABI.abi,
937
+ value: 0n,
938
+ chainId: this.getChainId()
939
+ };
940
+ }
941
+ /**
942
+ * Permissionlessly settles a matured redemption request (callable by anyone
943
+ * once the request has matured, e.g. after 24h) so the controller can claim.
944
+ * @param coverVaultAddress Address of the OpenCover insured vault
945
+ * @param requestId The redemption request id to settle
946
+ * @returns Transaction call object
947
+ */
948
+ settleMaturedCoverRedemption(coverVaultAddress, requestId) {
949
+ return {
950
+ to: coverVaultAddress,
951
+ functionName: "settleMaturedRedemption",
952
+ args: [BigInt(requestId)],
953
+ abi: OpenCoverVaultABI.abi,
954
+ value: 0n,
955
+ chainId: this.getChainId()
956
+ };
957
+ }
958
+ // ============================================
813
959
  // ERC20 Helper Methods
814
960
  // ============================================
815
961
  /**
@@ -1,6 +1,6 @@
1
1
  import { Signer, Provider } from "ethers";
2
2
  import { EVMOnChainCalls } from "./onchain-calls.js";
3
- import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote } from "../interfaces/index.js";
3
+ import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, ICoverVaultCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote } from "../interfaces/index.js";
4
4
  import { NumStr } from "../../common/types.js";
5
5
  import { Chain } from "../../api/v2/index.js";
6
6
  /**
@@ -223,6 +223,174 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
223
223
  * @returns EvmOnChainCallResponse
224
224
  */
225
225
  cancelPendingWithdrawalRequest(vaultAddress: string, requestSequenceNumber: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
226
+ /**
227
+ * Requests a deposit into an OpenCover cover vault (covered vault), escrowing
228
+ * the given amount of underlying yield-vault shares so coverage can be
229
+ * activated. This is the async ERC-7540 `requestDeposit`; cover shares are
230
+ * claimed afterwards via {@link claimCoverVaultShares} / {@link mintCoverVaultShares}
231
+ * (or delivered by a keeper).
232
+ *
233
+ * The `owner`'s yield-vault shares must be approved to the cover vault first
234
+ * (see {@link approveCoverVaultAsset}).
235
+ *
236
+ * @param coverVaultAddress Address of the OpenCover insured vault
237
+ * @param assets Amount of underlying yield-vault shares to cover
238
+ * @param options Optional controller/owner/receiver + tx execution params
239
+ * @returns EvmOnChainCallResponse
240
+ */
241
+ depositToCoverVault(coverVaultAddress: string, assets: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
242
+ /**
243
+ * Claims cover shares from a settled deposit request, by asset amount
244
+ * (ERC-7540 `deposit`). Use after {@link depositToCoverVault} has settled and
245
+ * when a keeper has not already pushed the shares.
246
+ * @param coverVaultAddress Address of the OpenCover insured vault
247
+ * @param assets Settled asset amount to claim cover shares for
248
+ * @param options Optional controller/receiver + tx execution params
249
+ * @returns EvmOnChainCallResponse
250
+ */
251
+ claimCoverVaultShares(coverVaultAddress: string, assets: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
252
+ /**
253
+ * Claims cover shares from a settled deposit request, by exact share amount
254
+ * (ERC-7540 `mint`).
255
+ * @param coverVaultAddress Address of the OpenCover insured vault
256
+ * @param shares Exact number of cover shares to claim
257
+ * @param options Optional controller/receiver + tx execution params
258
+ * @returns EvmOnChainCallResponse
259
+ */
260
+ mintCoverVaultShares(coverVaultAddress: string, shares: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
261
+ /**
262
+ * Requests a withdrawal from an OpenCover cover vault (covered vault) by
263
+ * redeeming cover shares. This is the async ERC-7540 `requestRedeem`; the
264
+ * underlying yield-vault shares are claimed afterwards via
265
+ * {@link claimCoverVaultAssets} / {@link withdrawCoverVaultAssets} (or
266
+ * delivered by a keeper).
267
+ * @param coverVaultAddress Address of the OpenCover insured vault
268
+ * @param shares Amount of cover shares to redeem
269
+ * @param options Optional controller/owner + tx execution params
270
+ * @returns EvmOnChainCallResponse
271
+ */
272
+ withdrawFromCoverVault(coverVaultAddress: string, shares: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
273
+ /**
274
+ * Claims the underlying yield-vault shares from a settled redemption request,
275
+ * by cover-share amount (ERC-7540 `redeem`). Use after
276
+ * {@link withdrawFromCoverVault} has settled.
277
+ * @param coverVaultAddress Address of the OpenCover insured vault
278
+ * @param shares Amount of cover shares to redeem for underlying shares
279
+ * @param options Optional controller/receiver + tx execution params
280
+ * @returns EvmOnChainCallResponse
281
+ */
282
+ claimCoverVaultAssets(coverVaultAddress: string, shares: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
283
+ /**
284
+ * Claims the underlying yield-vault shares from a settled redemption request,
285
+ * by exact asset amount (ERC-7540 `withdraw`).
286
+ * @param coverVaultAddress Address of the OpenCover insured vault
287
+ * @param assets Exact amount of underlying yield-vault shares to withdraw
288
+ * @param options Optional controller/receiver + tx execution params
289
+ * @returns EvmOnChainCallResponse
290
+ */
291
+ withdrawCoverVaultAssets(coverVaultAddress: string, assets: NumStr, options?: ICoverVaultCallOptions): Promise<EvmOnChainCallResponse>;
292
+ /**
293
+ * Permissionlessly settles a matured cover-vault redemption request so it
294
+ * becomes claimable (callable by anyone once matured, e.g. after 24h).
295
+ * @param coverVaultAddress Address of the OpenCover insured vault
296
+ * @param requestId The redemption request id to settle
297
+ * @param options Optional tx execution params
298
+ * @returns EvmOnChainCallResponse
299
+ */
300
+ settleMaturedCoverRedemption(coverVaultAddress: string, requestId: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
301
+ /**
302
+ * Approves the cover vault to spend the caller's underlying yield-vault
303
+ * shares (the cover vault's `asset()`), which is required before
304
+ * {@link depositToCoverVault}. Reads the asset token from the cover vault.
305
+ * @param coverVaultAddress Address of the OpenCover insured vault
306
+ * @param amount Amount to approve
307
+ * @param options Optional tx execution params
308
+ * @returns EvmOnChainCallResponse
309
+ */
310
+ approveCoverVaultAsset(coverVaultAddress: string, amount: NumStr, options?: IEvmCallOptions): Promise<EvmOnChainCallResponse>;
311
+ /**
312
+ * Gets the cover vault's underlying asset token address — i.e. the
313
+ * yield-vault share token that gets wrapped into cover shares.
314
+ * @param coverVaultAddress Address of the OpenCover insured vault
315
+ */
316
+ getCoverVaultAsset(coverVaultAddress: string): Promise<string>;
317
+ /**
318
+ * Gets the caller's (or a given account's) cover share balance.
319
+ * @param coverVaultAddress Address of the OpenCover insured vault
320
+ * @param account Optional account address (defaults to caller's wallet)
321
+ */
322
+ getCoverVaultShares(coverVaultAddress: string, account?: string): Promise<bigint>;
323
+ /**
324
+ * Gets the amount of a deposit request that has settled and is claimable as
325
+ * cover shares for the given controller.
326
+ * @param coverVaultAddress Address of the OpenCover insured vault
327
+ * @param controller Optional controller address (defaults to caller's wallet)
328
+ * @param requestId Optional request id (defaults to 0 — OpenCover aggregates by controller)
329
+ */
330
+ getClaimableCoverDeposit(coverVaultAddress: string, controller?: string, requestId?: NumStr): Promise<bigint>;
331
+ /**
332
+ * Gets the amount of a deposit request still pending settlement for the given
333
+ * controller.
334
+ * @param coverVaultAddress Address of the OpenCover insured vault
335
+ * @param controller Optional controller address (defaults to caller's wallet)
336
+ * @param requestId Optional request id (defaults to 0)
337
+ */
338
+ getPendingCoverDeposit(coverVaultAddress: string, controller?: string, requestId?: NumStr): Promise<bigint>;
339
+ /**
340
+ * Gets the amount of a redemption request that has settled and is claimable
341
+ * as underlying yield-vault shares for the given controller.
342
+ *
343
+ * NOTE: unlike deposits (which aggregate under request id 0), OpenCover
344
+ * assigns a **non-zero, unique request id** to each redemption. Pass the id
345
+ * returned by `requestRedeem` (emitted in the `RedeemRequest` event) as
346
+ * `requestId` — the default of 0 will read an empty request for redeems.
347
+ * @param coverVaultAddress Address of the OpenCover insured vault
348
+ * @param controller Optional controller address (defaults to caller's wallet)
349
+ * @param requestId Redemption request id from requestRedeem (default 0 — see note)
350
+ */
351
+ getClaimableCoverRedeem(coverVaultAddress: string, controller?: string, requestId?: NumStr): Promise<bigint>;
352
+ /**
353
+ * Gets the amount of a redemption request still pending settlement for the
354
+ * given controller.
355
+ *
356
+ * NOTE: redemptions use a **non-zero, unique request id** (unlike deposits,
357
+ * which aggregate under id 0). Pass the id returned by `requestRedeem`
358
+ * (emitted in the `RedeemRequest` event); the default 0 reads an empty
359
+ * request for redeems.
360
+ * @param coverVaultAddress Address of the OpenCover insured vault
361
+ * @param controller Optional controller address (defaults to caller's wallet)
362
+ * @param requestId Redemption request id from requestRedeem (default 0 — see note)
363
+ */
364
+ getPendingCoverRedeem(coverVaultAddress: string, controller?: string, requestId?: NumStr): Promise<bigint>;
365
+ /**
366
+ * Gets the total cover shares the controller can currently redeem — i.e. the
367
+ * aggregate *settled/claimable* amount across all of the controller's matured
368
+ * redemption requests (ERC-7540 `maxRedeem`).
369
+ *
370
+ * This is the **request-id-free** way to size a claim: read it, then pass the
371
+ * result to {@link claimCoverVaultAssets}. A redemption request id is only
372
+ * needed for the per-request {@link getClaimableCoverRedeem} read and for the
373
+ * permissionless {@link settleMaturedCoverRedemption} fallback.
374
+ * @param coverVaultAddress Address of the OpenCover insured vault
375
+ * @param controller Optional controller address (defaults to caller's wallet)
376
+ */
377
+ getMaxCoverRedeem(coverVaultAddress: string, controller?: string): Promise<bigint>;
378
+ /**
379
+ * Gets the total underlying yield-vault shares the controller can currently
380
+ * withdraw — the aggregate *settled/claimable* asset amount across the
381
+ * controller's matured redemption requests (ERC-7540 `maxWithdraw`).
382
+ *
383
+ * Request-id-free; pair with {@link withdrawCoverVaultAssets} to claim by
384
+ * asset amount without tracking a request id.
385
+ * @param coverVaultAddress Address of the OpenCover insured vault
386
+ * @param controller Optional controller address (defaults to caller's wallet)
387
+ */
388
+ getMaxCoverWithdraw(coverVaultAddress: string, controller?: string): Promise<bigint>;
389
+ /**
390
+ * Gets an OpenCover cover vault contract instance for read operations.
391
+ * @param coverVaultAddress Address of the OpenCover insured vault
392
+ */
393
+ private getCoverVaultContract;
226
394
  /**
227
395
  * Approve a token for spending by a spender (typically the vault)
228
396
  * @param tokenAddress The address of the token
@@ -2,6 +2,7 @@ import { Contract, ethers } from "ethers";
2
2
  import { EVMOnChainCalls } from "./onchain-calls.js";
3
3
  import EmberVaultABI from "../../abis/EmberVault.json" with { type: "json" };
4
4
  import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json" };
5
+ import OpenCoverVaultABI from "../../abis/OpenCoverVault.json" with { type: "json" };
5
6
  import { addressToBytes32 } from "../index.js";
6
7
  /**
7
8
  * User Calls for Ember Protocol on EVM (ERC-4626 Compatible)
@@ -289,6 +290,275 @@ export class EVMUserCalls extends EVMOnChainCalls {
289
290
  return this.execCall(txCall, options);
290
291
  }
291
292
  // ============================================
293
+ // OpenCover Cover Vault Methods (covered vaults)
294
+ //
295
+ // A "covered" vault is one whose yield-bearing shares can be wrapped into an
296
+ // OpenCover insured metavault (cover vault shares) to activate coverage. The
297
+ // cover vault is an ERC-7540 async vault whose *asset* is the underlying
298
+ // yield-vault share token and whose *share* is the cover share (e.g.
299
+ // OC-eEARN). Both deposit and withdraw are two-step: request -> claim.
300
+ //
301
+ // Typical deposit flow:
302
+ // 1. approveCoverVaultAsset(coverVaultAddress, amount) // or approveToken(...)
303
+ // 2. depositToCoverVault(coverVaultAddress, assets) // requestDeposit
304
+ // 3. (wait for settlement, ~seconds)
305
+ // 4. claimCoverVaultShares(coverVaultAddress, assets) // deposit() claim
306
+ // (a keeper may push the shares instead, making step 4 unnecessary)
307
+ //
308
+ // Typical withdraw flow:
309
+ // 1. withdrawFromCoverVault(coverVaultAddress, shares) // requestRedeem
310
+ // 2. (wait for settlement)
311
+ // 3. claimCoverVaultAssets(coverVaultAddress, shares) // redeem() claim
312
+ //
313
+ // controller / owner / receiver all default to the caller's wallet.
314
+ // ============================================
315
+ /**
316
+ * Requests a deposit into an OpenCover cover vault (covered vault), escrowing
317
+ * the given amount of underlying yield-vault shares so coverage can be
318
+ * activated. This is the async ERC-7540 `requestDeposit`; cover shares are
319
+ * claimed afterwards via {@link claimCoverVaultShares} / {@link mintCoverVaultShares}
320
+ * (or delivered by a keeper).
321
+ *
322
+ * The `owner`'s yield-vault shares must be approved to the cover vault first
323
+ * (see {@link approveCoverVaultAsset}).
324
+ *
325
+ * @param coverVaultAddress Address of the OpenCover insured vault
326
+ * @param assets Amount of underlying yield-vault shares to cover
327
+ * @param options Optional controller/owner/receiver + tx execution params
328
+ * @returns EvmOnChainCallResponse
329
+ */
330
+ async depositToCoverVault(coverVaultAddress, assets, options) {
331
+ const wallet = await this.getWalletAddress();
332
+ const owner = options?.owner ?? wallet;
333
+ const controller = options?.controller ?? wallet;
334
+ const txCall = this.txBuilder.requestCoverDeposit(coverVaultAddress, assets, controller, owner);
335
+ return this.execCall(txCall, options);
336
+ }
337
+ /**
338
+ * Claims cover shares from a settled deposit request, by asset amount
339
+ * (ERC-7540 `deposit`). Use after {@link depositToCoverVault} has settled and
340
+ * when a keeper has not already pushed the shares.
341
+ * @param coverVaultAddress Address of the OpenCover insured vault
342
+ * @param assets Settled asset amount to claim cover shares for
343
+ * @param options Optional controller/receiver + tx execution params
344
+ * @returns EvmOnChainCallResponse
345
+ */
346
+ async claimCoverVaultShares(coverVaultAddress, assets, options) {
347
+ const wallet = await this.getWalletAddress();
348
+ const receiver = options?.receiver ?? wallet;
349
+ const controller = options?.controller ?? wallet;
350
+ const txCall = this.txBuilder.claimCoverDeposit(coverVaultAddress, assets, receiver, controller);
351
+ return this.execCall(txCall, options);
352
+ }
353
+ /**
354
+ * Claims cover shares from a settled deposit request, by exact share amount
355
+ * (ERC-7540 `mint`).
356
+ * @param coverVaultAddress Address of the OpenCover insured vault
357
+ * @param shares Exact number of cover shares to claim
358
+ * @param options Optional controller/receiver + tx execution params
359
+ * @returns EvmOnChainCallResponse
360
+ */
361
+ async mintCoverVaultShares(coverVaultAddress, shares, options) {
362
+ const wallet = await this.getWalletAddress();
363
+ const receiver = options?.receiver ?? wallet;
364
+ const controller = options?.controller ?? wallet;
365
+ const txCall = this.txBuilder.mintCoverShares(coverVaultAddress, shares, receiver, controller);
366
+ return this.execCall(txCall, options);
367
+ }
368
+ /**
369
+ * Requests a withdrawal from an OpenCover cover vault (covered vault) by
370
+ * redeeming cover shares. This is the async ERC-7540 `requestRedeem`; the
371
+ * underlying yield-vault shares are claimed afterwards via
372
+ * {@link claimCoverVaultAssets} / {@link withdrawCoverVaultAssets} (or
373
+ * delivered by a keeper).
374
+ * @param coverVaultAddress Address of the OpenCover insured vault
375
+ * @param shares Amount of cover shares to redeem
376
+ * @param options Optional controller/owner + tx execution params
377
+ * @returns EvmOnChainCallResponse
378
+ */
379
+ async withdrawFromCoverVault(coverVaultAddress, shares, options) {
380
+ const wallet = await this.getWalletAddress();
381
+ const owner = options?.owner ?? wallet;
382
+ const controller = options?.controller ?? wallet;
383
+ const txCall = this.txBuilder.requestCoverRedeem(coverVaultAddress, shares, controller, owner);
384
+ return this.execCall(txCall, options);
385
+ }
386
+ /**
387
+ * Claims the underlying yield-vault shares from a settled redemption request,
388
+ * by cover-share amount (ERC-7540 `redeem`). Use after
389
+ * {@link withdrawFromCoverVault} has settled.
390
+ * @param coverVaultAddress Address of the OpenCover insured vault
391
+ * @param shares Amount of cover shares to redeem for underlying shares
392
+ * @param options Optional controller/receiver + tx execution params
393
+ * @returns EvmOnChainCallResponse
394
+ */
395
+ async claimCoverVaultAssets(coverVaultAddress, shares, options) {
396
+ const wallet = await this.getWalletAddress();
397
+ const receiver = options?.receiver ?? wallet;
398
+ const controller = options?.controller ?? wallet;
399
+ const txCall = this.txBuilder.claimCoverRedeem(coverVaultAddress, shares, receiver, controller);
400
+ return this.execCall(txCall, options);
401
+ }
402
+ /**
403
+ * Claims the underlying yield-vault shares from a settled redemption request,
404
+ * by exact asset amount (ERC-7540 `withdraw`).
405
+ * @param coverVaultAddress Address of the OpenCover insured vault
406
+ * @param assets Exact amount of underlying yield-vault shares to withdraw
407
+ * @param options Optional controller/receiver + tx execution params
408
+ * @returns EvmOnChainCallResponse
409
+ */
410
+ async withdrawCoverVaultAssets(coverVaultAddress, assets, options) {
411
+ const wallet = await this.getWalletAddress();
412
+ const receiver = options?.receiver ?? wallet;
413
+ const controller = options?.controller ?? wallet;
414
+ const txCall = this.txBuilder.withdrawCoverAssets(coverVaultAddress, assets, receiver, controller);
415
+ return this.execCall(txCall, options);
416
+ }
417
+ /**
418
+ * Permissionlessly settles a matured cover-vault redemption request so it
419
+ * becomes claimable (callable by anyone once matured, e.g. after 24h).
420
+ * @param coverVaultAddress Address of the OpenCover insured vault
421
+ * @param requestId The redemption request id to settle
422
+ * @param options Optional tx execution params
423
+ * @returns EvmOnChainCallResponse
424
+ */
425
+ async settleMaturedCoverRedemption(coverVaultAddress, requestId, options) {
426
+ const txCall = this.txBuilder.settleMaturedCoverRedemption(coverVaultAddress, requestId);
427
+ return this.execCall(txCall, options);
428
+ }
429
+ /**
430
+ * Approves the cover vault to spend the caller's underlying yield-vault
431
+ * shares (the cover vault's `asset()`), which is required before
432
+ * {@link depositToCoverVault}. Reads the asset token from the cover vault.
433
+ * @param coverVaultAddress Address of the OpenCover insured vault
434
+ * @param amount Amount to approve
435
+ * @param options Optional tx execution params
436
+ * @returns EvmOnChainCallResponse
437
+ */
438
+ async approveCoverVaultAsset(coverVaultAddress, amount, options) {
439
+ const assetAddress = await this.getCoverVaultAsset(coverVaultAddress);
440
+ return this.approveToken(assetAddress, coverVaultAddress, amount, options);
441
+ }
442
+ /**
443
+ * Gets the cover vault's underlying asset token address — i.e. the
444
+ * yield-vault share token that gets wrapped into cover shares.
445
+ * @param coverVaultAddress Address of the OpenCover insured vault
446
+ */
447
+ async getCoverVaultAsset(coverVaultAddress) {
448
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
449
+ return coverVault.asset();
450
+ }
451
+ /**
452
+ * Gets the caller's (or a given account's) cover share balance.
453
+ * @param coverVaultAddress Address of the OpenCover insured vault
454
+ * @param account Optional account address (defaults to caller's wallet)
455
+ */
456
+ async getCoverVaultShares(coverVaultAddress, account) {
457
+ const userAddress = account ?? (await this.getWalletAddress());
458
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
459
+ return coverVault.balanceOf(userAddress);
460
+ }
461
+ /**
462
+ * Gets the amount of a deposit request that has settled and is claimable as
463
+ * cover shares for the given controller.
464
+ * @param coverVaultAddress Address of the OpenCover insured vault
465
+ * @param controller Optional controller address (defaults to caller's wallet)
466
+ * @param requestId Optional request id (defaults to 0 — OpenCover aggregates by controller)
467
+ */
468
+ async getClaimableCoverDeposit(coverVaultAddress, controller, requestId = 0) {
469
+ const controllerAddress = controller ?? (await this.getWalletAddress());
470
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
471
+ return coverVault.claimableDepositRequest(BigInt(requestId), controllerAddress);
472
+ }
473
+ /**
474
+ * Gets the amount of a deposit request still pending settlement for the given
475
+ * controller.
476
+ * @param coverVaultAddress Address of the OpenCover insured vault
477
+ * @param controller Optional controller address (defaults to caller's wallet)
478
+ * @param requestId Optional request id (defaults to 0)
479
+ */
480
+ async getPendingCoverDeposit(coverVaultAddress, controller, requestId = 0) {
481
+ const controllerAddress = controller ?? (await this.getWalletAddress());
482
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
483
+ return coverVault.pendingDepositRequest(BigInt(requestId), controllerAddress);
484
+ }
485
+ /**
486
+ * Gets the amount of a redemption request that has settled and is claimable
487
+ * as underlying yield-vault shares for the given controller.
488
+ *
489
+ * NOTE: unlike deposits (which aggregate under request id 0), OpenCover
490
+ * assigns a **non-zero, unique request id** to each redemption. Pass the id
491
+ * returned by `requestRedeem` (emitted in the `RedeemRequest` event) as
492
+ * `requestId` — the default of 0 will read an empty request for redeems.
493
+ * @param coverVaultAddress Address of the OpenCover insured vault
494
+ * @param controller Optional controller address (defaults to caller's wallet)
495
+ * @param requestId Redemption request id from requestRedeem (default 0 — see note)
496
+ */
497
+ async getClaimableCoverRedeem(coverVaultAddress, controller, requestId = 0) {
498
+ const controllerAddress = controller ?? (await this.getWalletAddress());
499
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
500
+ return coverVault.claimableRedeemRequest(BigInt(requestId), controllerAddress);
501
+ }
502
+ /**
503
+ * Gets the amount of a redemption request still pending settlement for the
504
+ * given controller.
505
+ *
506
+ * NOTE: redemptions use a **non-zero, unique request id** (unlike deposits,
507
+ * which aggregate under id 0). Pass the id returned by `requestRedeem`
508
+ * (emitted in the `RedeemRequest` event); the default 0 reads an empty
509
+ * request for redeems.
510
+ * @param coverVaultAddress Address of the OpenCover insured vault
511
+ * @param controller Optional controller address (defaults to caller's wallet)
512
+ * @param requestId Redemption request id from requestRedeem (default 0 — see note)
513
+ */
514
+ async getPendingCoverRedeem(coverVaultAddress, controller, requestId = 0) {
515
+ const controllerAddress = controller ?? (await this.getWalletAddress());
516
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
517
+ return coverVault.pendingRedeemRequest(BigInt(requestId), controllerAddress);
518
+ }
519
+ /**
520
+ * Gets the total cover shares the controller can currently redeem — i.e. the
521
+ * aggregate *settled/claimable* amount across all of the controller's matured
522
+ * redemption requests (ERC-7540 `maxRedeem`).
523
+ *
524
+ * This is the **request-id-free** way to size a claim: read it, then pass the
525
+ * result to {@link claimCoverVaultAssets}. A redemption request id is only
526
+ * needed for the per-request {@link getClaimableCoverRedeem} read and for the
527
+ * permissionless {@link settleMaturedCoverRedemption} fallback.
528
+ * @param coverVaultAddress Address of the OpenCover insured vault
529
+ * @param controller Optional controller address (defaults to caller's wallet)
530
+ */
531
+ async getMaxCoverRedeem(coverVaultAddress, controller) {
532
+ const controllerAddress = controller ?? (await this.getWalletAddress());
533
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
534
+ return coverVault.maxRedeem(controllerAddress);
535
+ }
536
+ /**
537
+ * Gets the total underlying yield-vault shares the controller can currently
538
+ * withdraw — the aggregate *settled/claimable* asset amount across the
539
+ * controller's matured redemption requests (ERC-7540 `maxWithdraw`).
540
+ *
541
+ * Request-id-free; pair with {@link withdrawCoverVaultAssets} to claim by
542
+ * asset amount without tracking a request id.
543
+ * @param coverVaultAddress Address of the OpenCover insured vault
544
+ * @param controller Optional controller address (defaults to caller's wallet)
545
+ */
546
+ async getMaxCoverWithdraw(coverVaultAddress, controller) {
547
+ const controllerAddress = controller ?? (await this.getWalletAddress());
548
+ const coverVault = this.getCoverVaultContract(coverVaultAddress);
549
+ return coverVault.maxWithdraw(controllerAddress);
550
+ }
551
+ /**
552
+ * Gets an OpenCover cover vault contract instance for read operations.
553
+ * @param coverVaultAddress Address of the OpenCover insured vault
554
+ */
555
+ getCoverVaultContract(coverVaultAddress) {
556
+ if (!this.provider) {
557
+ throw new Error("Provider required for read operations");
558
+ }
559
+ return new Contract(coverVaultAddress, OpenCoverVaultABI.abi, this.provider);
560
+ }
561
+ // ============================================
292
562
  // ERC20 Token Helpers
293
563
  // ============================================
294
564
  /**
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.3.0",
4
+ "version": "2.4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
7
7
  "main": "./dist/index.js",