@pear-protocol/core-sdk 2.1.0 → 2.3.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.
- package/dist/auth/index.d.ts +4 -4
- package/dist/core/index.d.ts +468 -322
- package/dist/core/index.js +42 -28
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/vaults/index.d.ts +419 -0
- package/dist/vaults/index.js +193 -0
- package/package.json +3 -3
package/dist/core/index.js
CHANGED
|
@@ -567,6 +567,7 @@ class Core {
|
|
|
567
567
|
const file = await gzipJson(body);
|
|
568
568
|
const formData = new FormData();
|
|
569
569
|
formData.append("file", file, "payload.json.gz");
|
|
570
|
+
formData.append("executionsUpdatedAtEpochMs", String(body.meta.executionsUpdatedAtEpochMs));
|
|
570
571
|
return await this.client.fetch(`/sync/fills/create/bulk`, {
|
|
571
572
|
method: "POST",
|
|
572
573
|
headers: {
|
|
@@ -719,52 +720,80 @@ class Core {
|
|
|
719
720
|
};
|
|
720
721
|
misc = {
|
|
721
722
|
lighter: {
|
|
723
|
+
...this.buildLighterMiscRoutes("/misc/lighter"),
|
|
724
|
+
/** Mints the Fun.xyz universal deposit addresses that credit a wallet's Lighter account. */
|
|
725
|
+
createUda: /* @__PURE__ */ __name(async (body, headers) => {
|
|
726
|
+
return await this.client.fetch(`/misc/lighter/uda`, {
|
|
727
|
+
method: "POST",
|
|
728
|
+
headers,
|
|
729
|
+
body
|
|
730
|
+
});
|
|
731
|
+
}, "createUda"),
|
|
732
|
+
/** Reads the deposits the Fun.xyz bridge has seen for one wallet. */
|
|
733
|
+
listUdaDeposits: /* @__PURE__ */ __name(async (walletAddress, headers) => {
|
|
734
|
+
return await this.client.fetch(`/misc/lighter/uda/${encodeURIComponent(walletAddress)}`, {
|
|
735
|
+
method: "GET",
|
|
736
|
+
headers
|
|
737
|
+
});
|
|
738
|
+
}, "listUdaDeposits")
|
|
739
|
+
},
|
|
740
|
+
// Lighter's Robinhood Chain deployment: the same signer surface bound to the RHC host and
|
|
741
|
+
// chain id. The Fun.xyz UDA routes stay zkLighter-only, so this client carries no deposit
|
|
742
|
+
// surface at all.
|
|
743
|
+
lighterRhc: this.buildLighterMiscRoutes("/misc/lighter-rhc")
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* The signer routes every Lighter deployment exposes, bound to one deployment's base path.
|
|
747
|
+
* zkLighter and Robinhood Chain share this whole surface; only the deployment behind it differs.
|
|
748
|
+
*/
|
|
749
|
+
buildLighterMiscRoutes(basePath) {
|
|
750
|
+
return {
|
|
722
751
|
createApiKey: /* @__PURE__ */ __name(async (body, headers) => {
|
|
723
|
-
return await this.client.fetch(
|
|
752
|
+
return await this.client.fetch(`${basePath}/create-api-key`, {
|
|
724
753
|
method: "POST",
|
|
725
754
|
headers,
|
|
726
755
|
body
|
|
727
756
|
});
|
|
728
757
|
}, "createApiKey"),
|
|
729
758
|
changePubKey: /* @__PURE__ */ __name(async (body, headers) => {
|
|
730
|
-
return await this.client.fetch(
|
|
759
|
+
return await this.client.fetch(`${basePath}/change-pub-key`, {
|
|
731
760
|
method: "POST",
|
|
732
761
|
headers,
|
|
733
762
|
body
|
|
734
763
|
});
|
|
735
764
|
}, "changePubKey"),
|
|
736
765
|
prepareApproveIntegrator: /* @__PURE__ */ __name(async (body, headers) => {
|
|
737
|
-
return await this.client.fetch(
|
|
766
|
+
return await this.client.fetch(`${basePath}/prepare-approve-integrator`, {
|
|
738
767
|
method: "POST",
|
|
739
768
|
headers,
|
|
740
769
|
body
|
|
741
770
|
});
|
|
742
771
|
}, "prepareApproveIntegrator"),
|
|
743
772
|
submitApproveIntegrator: /* @__PURE__ */ __name(async (body, headers) => {
|
|
744
|
-
return await this.client.fetch(
|
|
773
|
+
return await this.client.fetch(`${basePath}/submit-approve-integrator`, {
|
|
745
774
|
method: "POST",
|
|
746
775
|
headers,
|
|
747
776
|
body
|
|
748
777
|
});
|
|
749
778
|
}, "submitApproveIntegrator"),
|
|
750
779
|
createAuthToken: /* @__PURE__ */ __name(async (body, headers) => {
|
|
751
|
-
return await this.client.fetch(
|
|
780
|
+
return await this.client.fetch(`${basePath}/create-auth-token`, {
|
|
752
781
|
method: "POST",
|
|
753
782
|
headers,
|
|
754
783
|
body
|
|
755
784
|
});
|
|
756
785
|
}, "createAuthToken"),
|
|
757
|
-
/** Prepares a fast
|
|
786
|
+
/** Prepares a fast collateral withdrawal for L1 wallet authorization. */
|
|
758
787
|
prepareFastWithdraw: /* @__PURE__ */ __name(async (body, headers) => {
|
|
759
|
-
return await this.client.fetch(
|
|
788
|
+
return await this.client.fetch(`${basePath}/prepare-fast-withdraw`, {
|
|
760
789
|
method: "POST",
|
|
761
790
|
headers,
|
|
762
791
|
body
|
|
763
792
|
});
|
|
764
793
|
}, "prepareFastWithdraw"),
|
|
765
|
-
/** Submits a wallet-authorized fast
|
|
794
|
+
/** Submits a wallet-authorized fast collateral withdrawal. */
|
|
766
795
|
submitFastWithdraw: /* @__PURE__ */ __name(async (body, headers) => {
|
|
767
|
-
return await this.client.fetch(
|
|
796
|
+
return await this.client.fetch(`${basePath}/submit-fast-withdraw`, {
|
|
768
797
|
method: "POST",
|
|
769
798
|
headers,
|
|
770
799
|
body
|
|
@@ -772,29 +801,14 @@ class Core {
|
|
|
772
801
|
}, "submitFastWithdraw"),
|
|
773
802
|
/** Moves a Lighter account onto the standard, plus, or premium tier. */
|
|
774
803
|
changeAccountTier: /* @__PURE__ */ __name(async (body, headers) => {
|
|
775
|
-
return await this.client.fetch(
|
|
804
|
+
return await this.client.fetch(`${basePath}/change-account-tier`, {
|
|
776
805
|
method: "POST",
|
|
777
806
|
headers,
|
|
778
807
|
body
|
|
779
808
|
});
|
|
780
|
-
}, "changeAccountTier")
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
return await this.client.fetch(`/misc/lighter/uda`, {
|
|
784
|
-
method: "POST",
|
|
785
|
-
headers,
|
|
786
|
-
body
|
|
787
|
-
});
|
|
788
|
-
}, "createUda"),
|
|
789
|
-
/** Reads the deposits the Fun.xyz bridge has seen for one wallet. */
|
|
790
|
-
listUdaDeposits: /* @__PURE__ */ __name(async (walletAddress, headers) => {
|
|
791
|
-
return await this.client.fetch(`/misc/lighter/uda/${encodeURIComponent(walletAddress)}`, {
|
|
792
|
-
method: "GET",
|
|
793
|
-
headers
|
|
794
|
-
});
|
|
795
|
-
}, "listUdaDeposits")
|
|
796
|
-
}
|
|
797
|
-
};
|
|
809
|
+
}, "changeAccountTier")
|
|
810
|
+
};
|
|
811
|
+
}
|
|
798
812
|
statistics = {
|
|
799
813
|
volume: /* @__PURE__ */ __name(async (query, headers) => {
|
|
800
814
|
return await this.client.fetch(`/statistics/volume`, {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Core } from './core/index.js';
|
|
|
3
3
|
import { External } from './external/index.js';
|
|
4
4
|
import { SDKConfig } from './types.js';
|
|
5
5
|
export { AuthErrorContext } from './types.js';
|
|
6
|
+
import { Vaults } from './vaults/index.js';
|
|
6
7
|
export { ExternalTrigger, ExternalTriggerSource, HttpTypes, SearchTriggersParams, SearchTriggersResponse, TriggerOutcome } from '@pear-protocol/types';
|
|
7
8
|
export * from '@pear-protocol/utils';
|
|
8
9
|
export { FetchError } from './utils.js';
|
|
@@ -14,6 +15,7 @@ declare class PearSDK {
|
|
|
14
15
|
auth: Auth;
|
|
15
16
|
core: Core;
|
|
16
17
|
external: External;
|
|
18
|
+
vaults: Vaults;
|
|
17
19
|
constructor(config: SDKConfig);
|
|
18
20
|
}
|
|
19
21
|
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { External } from './external';
|
|
|
7
7
|
import { HttpClient } from './http';
|
|
8
8
|
import { FetchError } from './utils';
|
|
9
9
|
export { FetchError } from './utils';
|
|
10
|
+
import { Vaults } from './vaults';
|
|
10
11
|
|
|
11
12
|
var __defProp = Object.defineProperty;
|
|
12
13
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -18,6 +19,7 @@ class PearSDK {
|
|
|
18
19
|
auth;
|
|
19
20
|
core;
|
|
20
21
|
external;
|
|
22
|
+
vaults;
|
|
21
23
|
constructor(config) {
|
|
22
24
|
if (config.proxy) configureProxy(config.proxy);
|
|
23
25
|
const authMode = config.auth?.type ?? "session";
|
|
@@ -32,6 +34,7 @@ class PearSDK {
|
|
|
32
34
|
this.auth = new Auth(client);
|
|
33
35
|
this.core = new Core(client, config.clientId);
|
|
34
36
|
this.external = new External();
|
|
37
|
+
this.vaults = new Vaults(client);
|
|
35
38
|
if (authMode === "session") {
|
|
36
39
|
let refreshInFlight = null;
|
|
37
40
|
const retried = /* @__PURE__ */ new WeakSet();
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { HttpTypes } from '@pear-protocol/types';
|
|
2
|
+
import { HttpClient } from '../http.js';
|
|
3
|
+
import { ClientHeaders } from '../types.js';
|
|
4
|
+
import '@pear-protocol/utils';
|
|
5
|
+
|
|
6
|
+
/** Typed vaults client over the gateway base URL — one method per public vault-service route. */
|
|
7
|
+
|
|
8
|
+
/** Typed client for all vault-service routes. */
|
|
9
|
+
declare class Vaults {
|
|
10
|
+
private readonly client;
|
|
11
|
+
/** Bind the shared HTTP client this surface dispatches through. */
|
|
12
|
+
constructor(client: HttpClient);
|
|
13
|
+
/** POST /vaults — create a vault from the leader-signed envelope. */
|
|
14
|
+
create: (body: HttpTypes.CreateVaultInput, headers?: ClientHeaders) => Promise<{
|
|
15
|
+
result: {
|
|
16
|
+
success: true;
|
|
17
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
18
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
19
|
+
ownerAddress: HttpTypes.EthereumAddress;
|
|
20
|
+
status: "active" | "inactive" | "pending_activation";
|
|
21
|
+
maxWithdrawalPeriodDays: number;
|
|
22
|
+
txHash: string;
|
|
23
|
+
} | {
|
|
24
|
+
success: false;
|
|
25
|
+
status: "in_progress";
|
|
26
|
+
activityId: string;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
/** GET /vaults — list vaults with optional filter params. */
|
|
30
|
+
list: (query?: HttpTypes.VaultListParamsInput, headers?: ClientHeaders) => Promise<{
|
|
31
|
+
vaults: {
|
|
32
|
+
id: string;
|
|
33
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
34
|
+
ownerAddress: HttpTypes.EthereumAddress;
|
|
35
|
+
traderAddress: HttpTypes.EthereumAddress | null;
|
|
36
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
37
|
+
status: "active" | "inactive" | "pending_activation";
|
|
38
|
+
isApproved: boolean;
|
|
39
|
+
name: string | null;
|
|
40
|
+
about: string | null;
|
|
41
|
+
imageUrl: string | null;
|
|
42
|
+
transactionHash: string | null;
|
|
43
|
+
maxWithdrawalPeriodDays: number;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
}[];
|
|
47
|
+
}>;
|
|
48
|
+
/** GET /vaults/:vaultAddress — fetch a single vault by its on-chain address. */
|
|
49
|
+
get: (vaultAddress: string, headers?: ClientHeaders) => Promise<{
|
|
50
|
+
vault: {
|
|
51
|
+
id: string;
|
|
52
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
53
|
+
ownerAddress: HttpTypes.EthereumAddress;
|
|
54
|
+
traderAddress: HttpTypes.EthereumAddress | null;
|
|
55
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
56
|
+
status: "active" | "inactive" | "pending_activation";
|
|
57
|
+
isApproved: boolean;
|
|
58
|
+
name: string | null;
|
|
59
|
+
about: string | null;
|
|
60
|
+
imageUrl: string | null;
|
|
61
|
+
transactionHash: string | null;
|
|
62
|
+
maxWithdrawalPeriodDays: number;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
/** GET /vaults/overview — fetch aggregate overview stats across vaults. */
|
|
68
|
+
overview: (query?: HttpTypes.VaultsOverviewQueryParamsInput, headers?: ClientHeaders) => Promise<{
|
|
69
|
+
items: {
|
|
70
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
71
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
72
|
+
leaderAddress: HttpTypes.EthereumAddress;
|
|
73
|
+
name: string | null;
|
|
74
|
+
imageUrl: string | null;
|
|
75
|
+
latest: {
|
|
76
|
+
tvl: string;
|
|
77
|
+
sharePrice: string;
|
|
78
|
+
accountValue: string | null;
|
|
79
|
+
openInterest: string | null;
|
|
80
|
+
unrealizedPnl: string | null;
|
|
81
|
+
cumulativeRealizedPnl: string | null;
|
|
82
|
+
investorCount: number;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
} | null;
|
|
85
|
+
sparkline: {
|
|
86
|
+
timestamp: number;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
tvl: string;
|
|
89
|
+
sharePrice: string;
|
|
90
|
+
}[];
|
|
91
|
+
}[];
|
|
92
|
+
page: number;
|
|
93
|
+
pageSize: number;
|
|
94
|
+
total: number;
|
|
95
|
+
}>;
|
|
96
|
+
/** GET /vaults/investments — list investor positions across all vaults. */
|
|
97
|
+
investments: (query: HttpTypes.VaultInvestmentsQueryParamsInput, headers?: ClientHeaders) => Promise<{
|
|
98
|
+
totals: {
|
|
99
|
+
totalInvested: number;
|
|
100
|
+
totalCurrentValue: number;
|
|
101
|
+
totalPnl: number;
|
|
102
|
+
totalUnrealizedPnl: number;
|
|
103
|
+
};
|
|
104
|
+
investments: {
|
|
105
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
106
|
+
name: string | null;
|
|
107
|
+
imageUrl: string | null;
|
|
108
|
+
isLeader: boolean;
|
|
109
|
+
depositAmount: string;
|
|
110
|
+
currentValue: string;
|
|
111
|
+
allTimePnl: number;
|
|
112
|
+
unrealizedPnl: number;
|
|
113
|
+
shares: string;
|
|
114
|
+
}[];
|
|
115
|
+
partial: boolean;
|
|
116
|
+
failedVaults: {
|
|
117
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
118
|
+
name: string | null;
|
|
119
|
+
reason: string;
|
|
120
|
+
}[];
|
|
121
|
+
}>;
|
|
122
|
+
/** GET /vaults/:vaultAddress/stats — fetch performance stats for a vault. */
|
|
123
|
+
stats: (vaultAddress: string, query?: HttpTypes.VaultStatsQueryParamsInput, headers?: ClientHeaders) => Promise<{
|
|
124
|
+
tvl: string;
|
|
125
|
+
totalSupply: string;
|
|
126
|
+
sharePrice: string;
|
|
127
|
+
withdrawalFeeBps: number;
|
|
128
|
+
leaderInvestment: {
|
|
129
|
+
depositAmount: string;
|
|
130
|
+
currentValue: string;
|
|
131
|
+
shares: string;
|
|
132
|
+
percentageOfTVL: number;
|
|
133
|
+
};
|
|
134
|
+
totalPnl: number;
|
|
135
|
+
totalPnlPercentage: number | null;
|
|
136
|
+
thirtyDayPnl: number;
|
|
137
|
+
apr: number | null;
|
|
138
|
+
maxDrawdown: number | null;
|
|
139
|
+
winRate: number | null;
|
|
140
|
+
profitFactor: number | null;
|
|
141
|
+
unrealizedPnl: number;
|
|
142
|
+
investors: {
|
|
143
|
+
address: string;
|
|
144
|
+
depositAmount: string;
|
|
145
|
+
shares: string;
|
|
146
|
+
currentValue: string;
|
|
147
|
+
}[];
|
|
148
|
+
tradedVolume?: number | undefined;
|
|
149
|
+
userStats?: {
|
|
150
|
+
allTimePnl: number;
|
|
151
|
+
depositAmount: string;
|
|
152
|
+
currentValue: string;
|
|
153
|
+
shares: string;
|
|
154
|
+
unrealizedPnl: number;
|
|
155
|
+
} | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
snapshots: {
|
|
158
|
+
/** POST /vaults/snapshots/bulk — ingest a batch of vault snapshots. */
|
|
159
|
+
bulk: (body: HttpTypes.SnapshotsBulkInput, headers?: ClientHeaders) => Promise<{
|
|
160
|
+
snapshots: Record<string, {
|
|
161
|
+
timestamp: number;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
tvl?: string | undefined;
|
|
164
|
+
sharePrice?: string | undefined;
|
|
165
|
+
accountValue?: null | undefined;
|
|
166
|
+
unrealizedPnl?: null | undefined;
|
|
167
|
+
cumulativeRealizedPnl?: null | undefined;
|
|
168
|
+
leaderSharePct?: null | undefined;
|
|
169
|
+
}[]>;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
activity: {
|
|
173
|
+
/** GET /vaults/:vaultAddress/activity — list activity events for a vault. */
|
|
174
|
+
list: (vaultAddress: string, headers?: ClientHeaders) => Promise<{
|
|
175
|
+
vaultAddress: string;
|
|
176
|
+
activity: {
|
|
177
|
+
id: string;
|
|
178
|
+
type: "vault.create" | "vault.set_trader" | "vault.update_metadata" | "bridge.withdraw_to_evm";
|
|
179
|
+
status: "failed" | "pending" | "succeeded";
|
|
180
|
+
createdAt: string;
|
|
181
|
+
updatedAt: string;
|
|
182
|
+
vaultAddress?: string | undefined;
|
|
183
|
+
txHash?: string | undefined;
|
|
184
|
+
error?: string | undefined;
|
|
185
|
+
}[];
|
|
186
|
+
}>;
|
|
187
|
+
/** GET /vaults/activity/:id — fetch a single activity event by ID. */
|
|
188
|
+
get: (id: string, headers?: ClientHeaders) => Promise<{
|
|
189
|
+
activity: {
|
|
190
|
+
id: string;
|
|
191
|
+
type: "vault.create" | "vault.set_trader" | "vault.update_metadata" | "bridge.withdraw_to_evm";
|
|
192
|
+
status: "failed" | "pending" | "succeeded";
|
|
193
|
+
createdAt: string;
|
|
194
|
+
updatedAt: string;
|
|
195
|
+
vaultAddress?: string | undefined;
|
|
196
|
+
txHash?: string | undefined;
|
|
197
|
+
error?: string | undefined;
|
|
198
|
+
};
|
|
199
|
+
}>;
|
|
200
|
+
};
|
|
201
|
+
transactions: {
|
|
202
|
+
/** GET /vaults/:vaultAddress/transactions — list on-chain transactions for a vault. */
|
|
203
|
+
list: (vaultAddress: string, query?: HttpTypes.VaultEventListParamsInput, headers?: ClientHeaders) => Promise<{
|
|
204
|
+
events: {
|
|
205
|
+
id: string;
|
|
206
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
207
|
+
eventType: "DEPOSIT" | "WITHDRAWAL";
|
|
208
|
+
userAddress: HttpTypes.EthereumAddress;
|
|
209
|
+
receiver: HttpTypes.EthereumAddress;
|
|
210
|
+
assets: string;
|
|
211
|
+
shares: string;
|
|
212
|
+
fee: string;
|
|
213
|
+
withdrawalId: string | null;
|
|
214
|
+
txHash: string;
|
|
215
|
+
blockNumber: string;
|
|
216
|
+
logIndex: number;
|
|
217
|
+
createdAt: string;
|
|
218
|
+
}[];
|
|
219
|
+
}>;
|
|
220
|
+
};
|
|
221
|
+
metadata: {
|
|
222
|
+
/** PATCH /vaults/:vaultAddress — update mutable metadata fields on a vault. */
|
|
223
|
+
update: (vaultAddress: string, body: HttpTypes.UpdateVaultMetadataInput, headers?: ClientHeaders) => Promise<{
|
|
224
|
+
vault: {
|
|
225
|
+
id: string;
|
|
226
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
227
|
+
ownerAddress: HttpTypes.EthereumAddress;
|
|
228
|
+
traderAddress: HttpTypes.EthereumAddress | null;
|
|
229
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
230
|
+
status: "active" | "inactive" | "pending_activation";
|
|
231
|
+
isApproved: boolean;
|
|
232
|
+
name: string | null;
|
|
233
|
+
about: string | null;
|
|
234
|
+
imageUrl: string | null;
|
|
235
|
+
transactionHash: string | null;
|
|
236
|
+
maxWithdrawalPeriodDays: number;
|
|
237
|
+
createdAt: string;
|
|
238
|
+
updatedAt: string;
|
|
239
|
+
};
|
|
240
|
+
}>;
|
|
241
|
+
};
|
|
242
|
+
trader: {
|
|
243
|
+
/** POST /vaults/:vaultAddress/trader — assign a new trader to a vault. */
|
|
244
|
+
set: (vaultAddress: string, body: HttpTypes.SetTraderInput, headers?: ClientHeaders) => Promise<{
|
|
245
|
+
result: {
|
|
246
|
+
success: true;
|
|
247
|
+
vault: {
|
|
248
|
+
id: string;
|
|
249
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
250
|
+
ownerAddress: HttpTypes.EthereumAddress;
|
|
251
|
+
traderAddress: HttpTypes.EthereumAddress | null;
|
|
252
|
+
agentAddress: HttpTypes.EthereumAddress;
|
|
253
|
+
status: "active" | "inactive" | "pending_activation";
|
|
254
|
+
isApproved: boolean;
|
|
255
|
+
name: string | null;
|
|
256
|
+
about: string | null;
|
|
257
|
+
imageUrl: string | null;
|
|
258
|
+
transactionHash: string | null;
|
|
259
|
+
maxWithdrawalPeriodDays: number;
|
|
260
|
+
createdAt: string;
|
|
261
|
+
updatedAt: string;
|
|
262
|
+
};
|
|
263
|
+
} | {
|
|
264
|
+
success: false;
|
|
265
|
+
status: "in_progress";
|
|
266
|
+
activityId: string;
|
|
267
|
+
};
|
|
268
|
+
}>;
|
|
269
|
+
};
|
|
270
|
+
/** POST /vaults/:vaultAddress/withdraw-to-evm — initiate an EVM-side withdrawal from a vault. */
|
|
271
|
+
withdrawToEvm: (vaultAddress: string, body: HttpTypes.WithdrawToEvmInput, headers?: ClientHeaders) => Promise<{
|
|
272
|
+
result: {
|
|
273
|
+
success: true;
|
|
274
|
+
amount: string;
|
|
275
|
+
token: string;
|
|
276
|
+
tokenId: string;
|
|
277
|
+
destination: string;
|
|
278
|
+
vaultAddress: string;
|
|
279
|
+
activityId: string;
|
|
280
|
+
bridgeStatus: string;
|
|
281
|
+
bridgeSettleMs: number;
|
|
282
|
+
transferTxHash: string;
|
|
283
|
+
} | {
|
|
284
|
+
success: false;
|
|
285
|
+
status: "in_progress";
|
|
286
|
+
amount: string;
|
|
287
|
+
token: string;
|
|
288
|
+
tokenId: string;
|
|
289
|
+
destination: string;
|
|
290
|
+
vaultAddress: string;
|
|
291
|
+
activityId: string;
|
|
292
|
+
};
|
|
293
|
+
}>;
|
|
294
|
+
agent: {
|
|
295
|
+
/** GET /vaults/:vaultAddress/balances — fetch agent balances for a vault. */
|
|
296
|
+
balances: (vaultAddress: string, headers?: ClientHeaders) => Promise<{
|
|
297
|
+
agentAddress: string;
|
|
298
|
+
spot: Record<string, string>;
|
|
299
|
+
perp: {
|
|
300
|
+
accountValue: string;
|
|
301
|
+
withdrawable: string;
|
|
302
|
+
};
|
|
303
|
+
}>;
|
|
304
|
+
/** POST /vaults/:vaultAddress/agent/approve — approve an agent action for a vault. */
|
|
305
|
+
approve: (vaultAddress: string, body: HttpTypes.AgentApproveInput, headers?: ClientHeaders) => Promise<{
|
|
306
|
+
result: {
|
|
307
|
+
success: true;
|
|
308
|
+
transactionHash: string;
|
|
309
|
+
tokenAddress: string;
|
|
310
|
+
spender: string;
|
|
311
|
+
amount: string;
|
|
312
|
+
} | {
|
|
313
|
+
success: false;
|
|
314
|
+
status: "already_approved";
|
|
315
|
+
tokenAddress: string;
|
|
316
|
+
spender: string;
|
|
317
|
+
allowance: string;
|
|
318
|
+
};
|
|
319
|
+
}>;
|
|
320
|
+
/** POST /vaults/:vaultAddress/set-unified-account — configure the unified account for a vault agent. */
|
|
321
|
+
setUnifiedAccount: (vaultAddress: string, body: HttpTypes.SetUnifiedAccountInput, headers?: ClientHeaders) => Promise<{
|
|
322
|
+
success: boolean;
|
|
323
|
+
agentAddress: string;
|
|
324
|
+
}>;
|
|
325
|
+
};
|
|
326
|
+
nav: {
|
|
327
|
+
/** GET /vaults/:vaultAddress/nav/latest — fetch the most recent NAV snapshot for a vault. */
|
|
328
|
+
latest: (vaultAddress: string, headers?: ClientHeaders) => Promise<{
|
|
329
|
+
snapshot: {
|
|
330
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
331
|
+
takenAt: string;
|
|
332
|
+
totalAssets: string;
|
|
333
|
+
totalSupply: string;
|
|
334
|
+
sharePrice: string;
|
|
335
|
+
blockNumber: string;
|
|
336
|
+
};
|
|
337
|
+
}>;
|
|
338
|
+
/** GET /vaults/:vaultAddress/nav — fetch NAV snapshots over a time range for a vault. */
|
|
339
|
+
range: (vaultAddress: string, query: HttpTypes.NavRangeQueryParamsInput, headers?: ClientHeaders) => Promise<{
|
|
340
|
+
points: {
|
|
341
|
+
bucket: string;
|
|
342
|
+
totalAssets: string;
|
|
343
|
+
totalSupply: string;
|
|
344
|
+
sharePrice: string;
|
|
345
|
+
blockNumber: string;
|
|
346
|
+
}[];
|
|
347
|
+
}>;
|
|
348
|
+
/** GET /vaults/:vaultAddress/nav/stats — fetch NAV performance statistics for a vault. */
|
|
349
|
+
stats: (vaultAddress: string, query: HttpTypes.NavStatsQueryParams, headers?: ClientHeaders) => Promise<{
|
|
350
|
+
window: "24h" | "7d" | "30d";
|
|
351
|
+
samples: number;
|
|
352
|
+
returnPct: number | null;
|
|
353
|
+
sharePriceMin: string | null;
|
|
354
|
+
sharePriceMax: string | null;
|
|
355
|
+
sharePriceFirst: string | null;
|
|
356
|
+
sharePriceLast: string | null;
|
|
357
|
+
}>;
|
|
358
|
+
};
|
|
359
|
+
positions: {
|
|
360
|
+
/** GET /vaults/:vaultAddress/positions/open — list open positions held by a vault. */
|
|
361
|
+
open: (vaultAddress: string, query?: HttpTypes.VaultOpenPositionListParamsInput, headers?: ClientHeaders) => Promise<{
|
|
362
|
+
limit: number;
|
|
363
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
364
|
+
positions: {
|
|
365
|
+
status: "OPEN";
|
|
366
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter" | "lighter_rhc";
|
|
367
|
+
updatedAt: string;
|
|
368
|
+
positionId: string;
|
|
369
|
+
openedAt: string;
|
|
370
|
+
realizedGrossPnl: `-${string}` | `+${string}`;
|
|
371
|
+
netCashflow: `-${string}` | `+${string}`;
|
|
372
|
+
legs: {
|
|
373
|
+
side: "LONG" | "SHORT";
|
|
374
|
+
asset: string;
|
|
375
|
+
realized: {
|
|
376
|
+
quantity: string;
|
|
377
|
+
unpricedQuantity: string;
|
|
378
|
+
grossPnl: `-${string}` | `+${string}`;
|
|
379
|
+
netPnl: `-${string}` | `+${string}`;
|
|
380
|
+
exitVwap?: string | undefined;
|
|
381
|
+
};
|
|
382
|
+
remaining: {
|
|
383
|
+
quantity: `-${string}` | `+${string}`;
|
|
384
|
+
entryVwap?: string | undefined;
|
|
385
|
+
};
|
|
386
|
+
}[];
|
|
387
|
+
}[];
|
|
388
|
+
nextCursor?: string | undefined;
|
|
389
|
+
}>;
|
|
390
|
+
/** GET /vaults/:vaultAddress/positions/closed — list closed positions held by a vault. */
|
|
391
|
+
closed: (vaultAddress: string, query?: HttpTypes.VaultClosedPositionListParamsInput, headers?: ClientHeaders) => Promise<{
|
|
392
|
+
limit: number;
|
|
393
|
+
vaultAddress: HttpTypes.EthereumAddress;
|
|
394
|
+
positions: {
|
|
395
|
+
status: "CLOSED";
|
|
396
|
+
connector: "hyperliquid" | "binance" | "bybit" | "okx" | "lighter" | "lighter_rhc";
|
|
397
|
+
closedAt: string;
|
|
398
|
+
grossPnl: `-${string}` | `+${string}`;
|
|
399
|
+
netPnl: `-${string}` | `+${string}`;
|
|
400
|
+
positionId: string;
|
|
401
|
+
openedAt: string;
|
|
402
|
+
hasProvisionalFills: boolean;
|
|
403
|
+
legs: {
|
|
404
|
+
side: "LONG" | "SHORT";
|
|
405
|
+
asset: string;
|
|
406
|
+
grossPnl: `-${string}` | `+${string}`;
|
|
407
|
+
netPnl: `-${string}` | `+${string}`;
|
|
408
|
+
entryNotional: string;
|
|
409
|
+
entryVwap?: string | undefined;
|
|
410
|
+
exitVwap?: string | undefined;
|
|
411
|
+
}[];
|
|
412
|
+
closedReason?: "USER" | "NETTED" | "LIQUIDATED" | undefined;
|
|
413
|
+
}[];
|
|
414
|
+
nextCursor?: string | undefined;
|
|
415
|
+
}>;
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export { Vaults };
|