@ember-finance/sdk 1.1.3 → 1.1.4

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.
@@ -83,4 +83,10 @@ export interface ChainVaultDetails {
83
83
  * @memberof ChainVaultDetails
84
84
  */
85
85
  supportedCoins: Array<Asset>;
86
+ /**
87
+ * The maximum deposits allowed of the vault in vault decimal form
88
+ * @type {string}
89
+ * @memberof ChainVaultDetails
90
+ */
91
+ maxDepositsAllowed: string;
86
92
  }
@@ -21,6 +21,12 @@ export interface VaultSlice {
21
21
  * @memberof VaultSlice
22
22
  */
23
23
  id?: string;
24
+ /**
25
+ * The address of the vault
26
+ * @type {string}
27
+ * @memberof VaultSlice
28
+ */
29
+ address?: string;
24
30
  /**
25
31
  * The name of the vault
26
32
  * @type {string}
@@ -14,7 +14,9 @@ import { EVMOperatorCalls } from "./evm-vaults/on-chain-calls/operator";
14
14
  import { EVMUserCalls } from "./evm-vaults/on-chain-calls/user";
15
15
  import { EVMVaultAdminCalls } from "./evm-vaults/on-chain-calls/vault-admin";
16
16
  import { EVMDeploymentParser } from "./evm-vaults/utils/deployment-parser";
17
+ import { EVMVaultReader } from "./evm-vaults/on-chain-calls/vault-reader";
17
18
  import { AccountsApi, VaultsApi } from "./api";
19
+ import { AccountsApi as AccountsV2Api, VaultsApi as VaultsV2Api } from "./api/v2";
18
20
  export type PlatformEnv = "prod" | "staging" | "dev";
19
21
  export type ChainType = "sui" | "evm";
20
22
  /**
@@ -29,6 +31,7 @@ export interface SuiInitOptions {
29
31
  deployment?: ISuiDeployment;
30
32
  basePath?: string;
31
33
  environment?: PlatformEnv;
34
+ chainIdentifier?: string;
32
35
  }
33
36
  /**
34
37
  * EVM-specific initialization options
@@ -41,6 +44,7 @@ export interface EvmInitOptions {
41
44
  deployment?: IEvmDeployment;
42
45
  basePath?: string;
43
46
  environment?: PlatformEnv;
47
+ chainIdentifier: string;
44
48
  }
45
49
  export type EmberVaultsInitOptions = SuiInitOptions | EvmInitOptions;
46
50
  /**
@@ -75,6 +79,7 @@ export interface EvmEmberVaults {
75
79
  vaultAdmin: EVMVaultAdminCalls;
76
80
  user: EVMUserCalls;
77
81
  deployment: IEvmDeployment;
82
+ reader: EVMVaultReader;
78
83
  }
79
84
  /**
80
85
  * EmberVaults - Unified interface for both SUI and EVM chains
@@ -106,6 +111,8 @@ export declare class EmberVaults {
106
111
  apiHost: string;
107
112
  api: AccountsApi;
108
113
  vaultsApi: VaultsApi;
114
+ accountsV2Api: AccountsV2Api;
115
+ vaultsV2Api: VaultsV2Api;
109
116
  private _suiClient?;
110
117
  private _suiSigner?;
111
118
  private _suiParser?;
@@ -125,7 +132,9 @@ export declare class EmberVaults {
125
132
  private _evmVaultAdmin?;
126
133
  private _evmUser?;
127
134
  private _evmDeployment?;
135
+ private _evmVaultReader?;
128
136
  private _walletAddress?;
137
+ private _chainIdentifier?;
129
138
  constructor(options: EmberVaultsInitOptions);
130
139
  private _initSui;
131
140
  private _initEvm;
@@ -13,8 +13,10 @@ const operator_2 = require("./evm-vaults/on-chain-calls/operator");
13
13
  const user_2 = require("./evm-vaults/on-chain-calls/user");
14
14
  const vault_admin_2 = require("./evm-vaults/on-chain-calls/vault-admin");
15
15
  const deployment_parser_2 = require("./evm-vaults/utils/deployment-parser");
16
+ const vault_reader_1 = require("./evm-vaults/on-chain-calls/vault-reader");
16
17
  // API imports
17
18
  const api_1 = require("./api");
19
+ const v2_1 = require("./api/v2");
18
20
  const environmentConfig = {
19
21
  prod: {
20
22
  apiHost: "https://vaults.api.sui-prod.bluefin.io"
@@ -54,11 +56,14 @@ const environmentConfig = {
54
56
  class EmberVaults {
55
57
  constructor(options) {
56
58
  this.chainType = options.chainType;
59
+ this._chainIdentifier = options.chainIdentifier;
57
60
  this._walletAddress = options.walletAddress;
58
61
  const environment = options.environment ?? "prod";
59
62
  this.apiHost = options.basePath || environmentConfig[environment].apiHost;
60
63
  this.api = new api_1.AccountsApi(new api_1.Configuration({ basePath: this.apiHost }));
61
64
  this.vaultsApi = new api_1.VaultsApi(new api_1.Configuration({ basePath: this.apiHost }));
65
+ this.accountsV2Api = new v2_1.AccountsApi(new v2_1.Configuration({ basePath: this.apiHost }));
66
+ this.vaultsV2Api = new v2_1.VaultsApi(new v2_1.Configuration({ basePath: this.apiHost }));
62
67
  if (options.chainType === "sui") {
63
68
  this._initSui(options);
64
69
  }
@@ -89,18 +94,31 @@ class EmberVaults {
89
94
  this._evmOperator = new operator_2.EVMOperatorCalls(this._evmDeployment, options.signer, options.provider, options.walletAddress);
90
95
  this._evmVaultAdmin = new vault_admin_2.EVMVaultAdminCalls(this._evmDeployment, options.signer, options.provider, options.walletAddress);
91
96
  this._evmUser = new user_2.EVMUserCalls(this._evmDeployment, options.signer, options.provider, options.walletAddress);
97
+ this._evmVaultReader = new vault_reader_1.EVMVaultReader(this._evmDeployment, options.provider);
92
98
  }
93
99
  /**
94
100
  * Initialize by fetching deployment from API (SUI only currently)
95
101
  */
96
102
  async init() {
97
- // Assuming that the vaults Api will return the correct deployment for the requested chain
98
- // TODO: We might need to provide an input to the vaults Api
99
- // so it knows for which chain the deployment is requested ??
100
- // Confirm above with Burhan/Shahzaib
101
- const deployment = await this.vaultsApi.getVaultsProtocolInfo();
102
- const deploymentData = deployment.data;
103
- this.updateDeployment(deploymentData);
103
+ const deployment = await this.vaultsV2Api.getVaultsProtocolInfo();
104
+ if (this.chainType === "sui") {
105
+ const deploymentData = deployment.data.find(d => d.chainType === "sui");
106
+ if (deploymentData) {
107
+ this.updateDeployment(deploymentData.config);
108
+ }
109
+ else {
110
+ throw new Error(`Deployment data not found for chain ${this._chainIdentifier}`);
111
+ }
112
+ }
113
+ else {
114
+ const deploymentData = deployment.data.find(d => d.chainType === "evm" && d.chain === this._chainIdentifier);
115
+ if (deploymentData) {
116
+ this.updateDeployment(deploymentData.config);
117
+ }
118
+ else {
119
+ throw new Error(`Deployment data not found for chain ${this._chainIdentifier}`);
120
+ }
121
+ }
104
122
  }
105
123
  /**
106
124
  * Updates the deployment configuration
@@ -126,6 +144,7 @@ class EmberVaults {
126
144
  this._evmOperator?.updateDeployment(evmDeployment);
127
145
  this._evmVaultAdmin?.updateDeployment(evmDeployment);
128
146
  this._evmUser?.updateDeployment(evmDeployment);
147
+ this._evmVaultReader?.updateDeployment(evmDeployment);
129
148
  }
130
149
  }
131
150
  // ============================================
@@ -232,7 +251,8 @@ class EmberVaults {
232
251
  operator: this._evmOperator,
233
252
  vaultAdmin: this._evmVaultAdmin,
234
253
  user: this._evmUser,
235
- deployment: this._evmDeployment
254
+ deployment: this._evmDeployment,
255
+ reader: this._evmVaultReader
236
256
  };
237
257
  }
238
258
  }
@@ -1,6 +1,6 @@
1
- export declare const BcsUpdateVaultStrategyRequest: import("@mysten/bcs").BcsType<{
2
- vaultId: string;
3
- strategies: {
1
+ export declare const BcsUpdateVaultStrategyRequest: import("@mysten/bcs").BcsStruct<{
2
+ vaultId: import("@mysten/bcs").BcsType<string, string, "string">;
3
+ strategies: import("@mysten/bcs").BcsType<{
4
4
  platformName: string;
5
5
  strategistAddress: string;
6
6
  strategyType: string;
@@ -8,14 +8,7 @@ export declare const BcsUpdateVaultStrategyRequest: import("@mysten/bcs").BcsTyp
8
8
  apyE9: string;
9
9
  pointsApyE9: string;
10
10
  snapshotAt: string;
11
- }[];
12
- targetApyE9: string;
13
- supplyApyE9: string;
14
- reportedApyE9: string;
15
- signedAt: string;
16
- }, {
17
- vaultId: string;
18
- strategies: Iterable<{
11
+ }[], Iterable<{
19
12
  platformName: string;
20
13
  strategistAddress: string;
21
14
  strategyType: string;
@@ -25,9 +18,9 @@ export declare const BcsUpdateVaultStrategyRequest: import("@mysten/bcs").BcsTyp
25
18
  snapshotAt: string | number | bigint;
26
19
  }> & {
27
20
  length: number;
28
- };
29
- targetApyE9: string;
30
- supplyApyE9: string;
31
- reportedApyE9: string;
32
- signedAt: string | number | bigint;
33
- }>;
21
+ }, string>;
22
+ targetApyE9: import("@mysten/bcs").BcsType<string, string, "string">;
23
+ supplyApyE9: import("@mysten/bcs").BcsType<string, string, "string">;
24
+ reportedApyE9: import("@mysten/bcs").BcsType<string, string, "string">;
25
+ signedAt: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
26
+ }, string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-finance/sdk",
3
3
  "description": "Ember Protocol SDK",
4
- "version": "1.1.3",
4
+ "version": "1.1.4",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -42,6 +42,11 @@
42
42
  "types": "./dist/src/abis/index.d.ts",
43
43
  "import": "./dist/src/abis/index.js",
44
44
  "require": "./dist/src/abis/index.js"
45
+ },
46
+ "./index": {
47
+ "types": "./dist/src/index.d.ts",
48
+ "import": "./dist/src/index.js",
49
+ "require": "./dist/src/index.js"
45
50
  }
46
51
  },
47
52
  "scripts": {
@@ -66,7 +71,7 @@
66
71
  "test": "tests"
67
72
  },
68
73
  "dependencies": {
69
- "@firefly-exchange/library-sui": "^2.8.22",
74
+ "@firefly-exchange/library-sui": "^2.12.1",
70
75
  "axios": "1.12.2",
71
76
  "ethers": "^6.13.4",
72
77
  "yarn": "^1.22.19"