@ember-finance/sdk 1.2.1 → 1.2.3
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.
|
@@ -29,7 +29,7 @@ export interface VaultDetail {
|
|
|
29
29
|
*/
|
|
30
30
|
id: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Short name/symbol of the vault
|
|
33
33
|
* @type {string}
|
|
34
34
|
* @memberof VaultDetail
|
|
35
35
|
*/
|
|
@@ -133,17 +133,17 @@ export interface VaultDetail {
|
|
|
133
133
|
*/
|
|
134
134
|
weeklyPerformanceFeeBpsE9: string;
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* The management fee percentage of the vault in e18 form
|
|
137
137
|
* @type {string}
|
|
138
138
|
* @memberof VaultDetail
|
|
139
139
|
*/
|
|
140
140
|
managementFeePercentE18: string;
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
142
|
+
* The rate of the vault in e18 form
|
|
143
143
|
* @type {string}
|
|
144
144
|
* @memberof VaultDetail
|
|
145
145
|
*/
|
|
146
|
-
rateE18
|
|
146
|
+
rateE18: string;
|
|
147
147
|
/**
|
|
148
148
|
* The maximum deposits allowed of the vault in e18 form
|
|
149
149
|
* @type {string}
|
|
@@ -151,7 +151,7 @@ export interface VaultDetail {
|
|
|
151
151
|
*/
|
|
152
152
|
maxDepositsAllowedE18?: string;
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* The withdrawal period in days
|
|
155
155
|
* @type {number}
|
|
156
156
|
* @memberof VaultDetail
|
|
157
157
|
*/
|
|
@@ -169,13 +169,13 @@ export interface VaultDetail {
|
|
|
169
169
|
*/
|
|
170
170
|
rewards: Array<RewardToken>;
|
|
171
171
|
/**
|
|
172
|
-
* The
|
|
172
|
+
* The aggregated total deposits of the vault equivalent to USD in e9
|
|
173
173
|
* @type {string}
|
|
174
174
|
* @memberof VaultDetail
|
|
175
175
|
*/
|
|
176
176
|
totalDepositsInUsdE9: string;
|
|
177
177
|
/**
|
|
178
|
-
* The aggregated total deposits of the vault in
|
|
178
|
+
* The aggregated total deposits of the vault in e9 form
|
|
179
179
|
* @type {string}
|
|
180
180
|
* @memberof VaultDetail
|
|
181
181
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer } from "ethers";
|
|
1
|
+
import { Provider, Signer } from "ethers";
|
|
2
2
|
import { IPermitSignature } from "../interfaces";
|
|
3
3
|
import { NumStr } from "../../common/types";
|
|
4
4
|
/**
|
|
@@ -79,6 +79,28 @@ export declare function getPermitVersion(tokenAddress: string, provider: import(
|
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
export declare function supportsEIP5267(tokenAddress: string, provider: import("ethers").Provider): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to check if a token supports EIP-2612
|
|
84
|
+
*
|
|
85
|
+
* EIP-2612 defines a standard way to retrieve EIP-712 domain information
|
|
86
|
+
* via the DOMAIN_SEPARATOR() method. This is useful for tokens that want to
|
|
87
|
+
* expose their domain separator parameters in a standardized way.
|
|
88
|
+
*
|
|
89
|
+
* @param tokenAddress The address of the ERC20 token
|
|
90
|
+
* @param provider An ethers.js provider
|
|
91
|
+
* @returns True if the token supports EIP-2612, false otherwise
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { supportsERC2612 } from "@ember-finance/sdk";
|
|
96
|
+
*
|
|
97
|
+
* const supports = await supportsERC2612(tokenAddress, provider);
|
|
98
|
+
* if (supports) {
|
|
99
|
+
* console.log("Token supports EIP-2612");
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function supportsERC2612(tokenAddress: string, provider: Provider): Promise<boolean>;
|
|
82
104
|
/**
|
|
83
105
|
* Helper function to get the current nonce for a user from an EIP-2612 token
|
|
84
106
|
*
|
|
@@ -36,8 +36,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.signPermit = signPermit;
|
|
37
37
|
exports.getPermitVersion = getPermitVersion;
|
|
38
38
|
exports.supportsEIP5267 = supportsEIP5267;
|
|
39
|
+
exports.supportsERC2612 = supportsERC2612;
|
|
39
40
|
exports.getPermitNonce = getPermitNonce;
|
|
40
41
|
exports.signPermitSimple = signPermitSimple;
|
|
42
|
+
const ethers_1 = require("ethers");
|
|
41
43
|
/**
|
|
42
44
|
* Signs an EIP-2612 permit message
|
|
43
45
|
*
|
|
@@ -190,6 +192,42 @@ async function supportsEIP5267(tokenAddress, provider) {
|
|
|
190
192
|
return false;
|
|
191
193
|
}
|
|
192
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Helper function to check if a token supports EIP-2612
|
|
197
|
+
*
|
|
198
|
+
* EIP-2612 defines a standard way to retrieve EIP-712 domain information
|
|
199
|
+
* via the DOMAIN_SEPARATOR() method. This is useful for tokens that want to
|
|
200
|
+
* expose their domain separator parameters in a standardized way.
|
|
201
|
+
*
|
|
202
|
+
* @param tokenAddress The address of the ERC20 token
|
|
203
|
+
* @param provider An ethers.js provider
|
|
204
|
+
* @returns True if the token supports EIP-2612, false otherwise
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* import { supportsERC2612 } from "@ember-finance/sdk";
|
|
209
|
+
*
|
|
210
|
+
* const supports = await supportsERC2612(tokenAddress, provider);
|
|
211
|
+
* if (supports) {
|
|
212
|
+
* console.log("Token supports EIP-2612");
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
async function supportsERC2612(tokenAddress, provider) {
|
|
217
|
+
const abi = [
|
|
218
|
+
"function nonces(address) view returns (uint256)",
|
|
219
|
+
"function DOMAIN_SEPARATOR() view returns (bytes32)"
|
|
220
|
+
];
|
|
221
|
+
try {
|
|
222
|
+
const token = new ethers_1.Contract(tokenAddress, abi, provider);
|
|
223
|
+
await token.nonces(ethers_1.ZeroAddress);
|
|
224
|
+
await token.DOMAIN_SEPARATOR();
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
193
231
|
/**
|
|
194
232
|
* Helper function to get the current nonce for a user from an EIP-2612 token
|
|
195
233
|
*
|