@swivy/node 0.0.0-stage → 1.0.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/README.md +39 -2
- package/dist/packages/node/src/index.d.ts +600 -0
- package/dist/packages/node/src/index.js +1248 -0
- package/package.json +37 -4
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @swivy/node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Swivy node SDK. Testnet preview; production onboarding is gated on the Swop canary.
|
|
4
|
+
|
|
5
|
+
Public npm distribution is being prepared. Before first publication, use all SDK tarballs
|
|
6
|
+
from one operator-supplied release and verify its SHA256SUMS. After publication:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @swivy/node@next
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use an environment app ID and publishable key for browser/mobile apps. Keep environment
|
|
13
|
+
secret keys on the backend and deployment bootstrap credentials with the deployment operator.
|
|
14
|
+
Choose email or SMS in your environment policy; SMS recovery alone does not enable SMS login.
|
|
15
|
+
Never log login codes, runtime sessions or signing material.
|
|
16
|
+
|
|
17
|
+
Browser apps currently need a same-origin reverse proxy for `/v1/runtime/*`; the API
|
|
18
|
+
does not advertise cross-origin browser access. Backend and native clients can use the API directly.
|
|
19
|
+
|
|
20
|
+
The client exposes `requestSmsCode(phoneNumber)` and `verifySmsCode(challengeId, code)`. Supply phone numbers in E.164 format.
|
|
21
|
+
|
|
22
|
+
Create a separate client per customer request/session; its session token is mutable. Requires Node 22 or newer.
|
|
23
|
+
|
|
24
|
+
## Preview dependency policy
|
|
25
|
+
|
|
26
|
+
Before installing this preview, merge the following into your application's root
|
|
27
|
+
package.json. The legacy trading client's provider pins an older WebSocket release;
|
|
28
|
+
npm does not apply overrides declared by installed libraries.
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"overrides": {
|
|
33
|
+
"ws@>=8.0.0 <9.0.0": "^8.21.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Commit the resulting lockfile and run your integration tests and `npm audit --omit=dev`.
|
|
39
|
+
The release consumer smoke verifies installation with this policy; bare installation
|
|
40
|
+
without it is not claimed advisory-clean. WebSocket 7 dependencies keep their own major.
|
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { Chain as PolymarketChain, SignatureTypeV2 as PolymarketSignatureType, type ApiKeyCreds as PolymarketApiKeyCreds } from "@polymarket/clob-client-v2";
|
|
2
|
+
import type { AbstractWallet } from "@nktkas/hyperliquid/signing";
|
|
3
|
+
import type { Chain, ChainCapabilities, CustodyMode, EnvironmentChainRpcConfig, ExecutionResult, IdentityDescriptor, IntentPayload, LinkedWalletDescriptor, ManagedAccountDescriptor, OrganizationOverview, OrganizationAdminCredentialDescriptor, OrganizationInviteDescriptor, OrganizationMemberDescriptor, SessionGrantDescriptor, SessionGrantScope, TransactionIntent, TypedDataDescriptor, WalletPurpose, WebhookDescriptor, WebhookSecretReveal } from "@swivy/core";
|
|
4
|
+
export interface SwivyNodeClientConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
adminToken?: string;
|
|
7
|
+
controlPlaneKey?: string;
|
|
8
|
+
appId?: string;
|
|
9
|
+
publishableKey?: string;
|
|
10
|
+
secretKey?: string;
|
|
11
|
+
environmentId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Legacy alias for secretKey while Swop migrates off x-env-id/x-api-key.
|
|
14
|
+
*/
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
sessionToken?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SwivyNodeListAccountsPayload {
|
|
19
|
+
managedAccounts: ManagedAccountDescriptor[];
|
|
20
|
+
linkedWallets: LinkedWalletDescriptor[];
|
|
21
|
+
}
|
|
22
|
+
export interface SwivyNodeIdentityLookupPayload {
|
|
23
|
+
identity: IdentityDescriptor;
|
|
24
|
+
managedAccounts: ManagedAccountDescriptor[];
|
|
25
|
+
linkedWallets: LinkedWalletDescriptor[];
|
|
26
|
+
}
|
|
27
|
+
export interface SwivyNodeWaitForIntentOptions {
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
pollIntervalMs?: number;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
export interface SwivyNodeManagedAccountResolution {
|
|
33
|
+
account: ManagedAccountDescriptor;
|
|
34
|
+
existing: boolean;
|
|
35
|
+
attestation?: unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface SwivyNodeManagedAccountCreateOptions {
|
|
38
|
+
label?: string;
|
|
39
|
+
purpose?: WalletPurpose;
|
|
40
|
+
custodyMode?: CustodyMode;
|
|
41
|
+
splitCustody?: {
|
|
42
|
+
deviceShare: {
|
|
43
|
+
commitment: string;
|
|
44
|
+
encryptedPayload?: string;
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
};
|
|
47
|
+
recoveryShare?: {
|
|
48
|
+
commitment: string;
|
|
49
|
+
encryptedPayload?: string;
|
|
50
|
+
metadata?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface SwivyNodeExportedAccountPayload {
|
|
55
|
+
accountId: string;
|
|
56
|
+
chain: Chain;
|
|
57
|
+
privateKey: string;
|
|
58
|
+
attestation: unknown;
|
|
59
|
+
}
|
|
60
|
+
export interface SwivyNodeRawSignPayload {
|
|
61
|
+
result: ExecutionResult;
|
|
62
|
+
}
|
|
63
|
+
export interface SwivyNodeSigningPayload {
|
|
64
|
+
accountId: string;
|
|
65
|
+
chain: Chain;
|
|
66
|
+
challengeId?: string;
|
|
67
|
+
payload: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export interface SwivyNodeTypedDataSigningPayload {
|
|
70
|
+
accountId: string;
|
|
71
|
+
challengeId?: string;
|
|
72
|
+
typedData: TypedDataDescriptor;
|
|
73
|
+
}
|
|
74
|
+
export interface SwivyNodeSessionKeyPair {
|
|
75
|
+
curve: "ed25519";
|
|
76
|
+
publicKeyPem: string;
|
|
77
|
+
privateKeyPem: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SwivyNodeSessionGrantCreatePayload {
|
|
80
|
+
accountId: string;
|
|
81
|
+
publicKey: string;
|
|
82
|
+
label?: string;
|
|
83
|
+
challengeId?: string;
|
|
84
|
+
expiresInSeconds?: number;
|
|
85
|
+
scope?: Partial<SessionGrantScope>;
|
|
86
|
+
}
|
|
87
|
+
export interface SwivyNodeSessionGrantAuthorization {
|
|
88
|
+
nonce: string;
|
|
89
|
+
expiresAt: string;
|
|
90
|
+
signatureBase64: string;
|
|
91
|
+
}
|
|
92
|
+
export interface SwivyNodeLifiQuotePayload {
|
|
93
|
+
accountId: string;
|
|
94
|
+
fromChain: number;
|
|
95
|
+
toChain: number;
|
|
96
|
+
fromToken: string;
|
|
97
|
+
toToken: string;
|
|
98
|
+
fromAmount: string;
|
|
99
|
+
requestedValueUsd?: number | null;
|
|
100
|
+
toAddress?: string;
|
|
101
|
+
slippage?: number;
|
|
102
|
+
allowBridges?: string[];
|
|
103
|
+
denyBridges?: string[];
|
|
104
|
+
allowExchanges?: string[];
|
|
105
|
+
denyExchanges?: string[];
|
|
106
|
+
}
|
|
107
|
+
export interface SwivyNodeJupiterQuotePayload {
|
|
108
|
+
accountId: string;
|
|
109
|
+
inputMint: string;
|
|
110
|
+
outputMint: string;
|
|
111
|
+
amount: string;
|
|
112
|
+
requestedValueUsd?: number | null;
|
|
113
|
+
slippageBps?: number;
|
|
114
|
+
swapMode?: "ExactIn" | "ExactOut";
|
|
115
|
+
buildTransaction?: boolean;
|
|
116
|
+
dynamicComputeUnitLimit?: boolean;
|
|
117
|
+
dynamicSlippage?: boolean;
|
|
118
|
+
prioritizationFeeLamports?: number | Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
export type SwivyNodeSwapQuotePayload = (SwivyNodeLifiQuotePayload & {
|
|
121
|
+
provider: "lifi";
|
|
122
|
+
buildTransaction?: boolean;
|
|
123
|
+
}) | (SwivyNodeJupiterQuotePayload & {
|
|
124
|
+
provider: "jupiter";
|
|
125
|
+
});
|
|
126
|
+
export interface SwivyPolymarketClientOptions {
|
|
127
|
+
host?: string;
|
|
128
|
+
chain?: PolymarketChain;
|
|
129
|
+
signatureType?: PolymarketSignatureType;
|
|
130
|
+
funderAddress?: string;
|
|
131
|
+
useServerTime?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface SwivyPolymarketOrderPayload {
|
|
134
|
+
accountId: string;
|
|
135
|
+
accountAddress?: string;
|
|
136
|
+
tokenId: string;
|
|
137
|
+
conditionId?: string;
|
|
138
|
+
side: "buy" | "sell";
|
|
139
|
+
price: number;
|
|
140
|
+
size: number;
|
|
141
|
+
requestedValueUsd?: number | null;
|
|
142
|
+
orderType?: "GTC" | "GTD" | "FOK" | "FAK";
|
|
143
|
+
jurisdiction?: string;
|
|
144
|
+
agent?: boolean;
|
|
145
|
+
builderCode?: string;
|
|
146
|
+
metadata?: string;
|
|
147
|
+
expiration?: number;
|
|
148
|
+
challengeId?: string;
|
|
149
|
+
wait?: SwivyNodeWaitForIntentOptions;
|
|
150
|
+
}
|
|
151
|
+
export interface SwivyPolymarketStopLimitPayload {
|
|
152
|
+
accountId: string;
|
|
153
|
+
tokenId: string;
|
|
154
|
+
conditionId?: string;
|
|
155
|
+
side: "buy" | "sell";
|
|
156
|
+
triggerPrice: number;
|
|
157
|
+
triggerDirection: "above" | "below";
|
|
158
|
+
limitPrice: number;
|
|
159
|
+
size: number;
|
|
160
|
+
requestedValueUsd?: number | null;
|
|
161
|
+
jurisdiction?: string;
|
|
162
|
+
agent?: boolean;
|
|
163
|
+
expiresAt?: string | null;
|
|
164
|
+
}
|
|
165
|
+
export interface SwivyPolymarketStopLimitEvaluateResult {
|
|
166
|
+
triggered: boolean;
|
|
167
|
+
expired: boolean;
|
|
168
|
+
stopLimitOrder: Record<string, unknown>;
|
|
169
|
+
orderPayload: SwivyPolymarketOrderPayload | null;
|
|
170
|
+
}
|
|
171
|
+
export interface SwivyPolymarketOrderPreview {
|
|
172
|
+
provider: "polymarket";
|
|
173
|
+
network: "polygon-mainnet";
|
|
174
|
+
order: {
|
|
175
|
+
tokenId: string;
|
|
176
|
+
conditionId: string | null;
|
|
177
|
+
side: "buy" | "sell";
|
|
178
|
+
price: number;
|
|
179
|
+
size: number;
|
|
180
|
+
requestedValueUsd: number;
|
|
181
|
+
orderType: "GTC" | "GTD" | "FOK" | "FAK";
|
|
182
|
+
builderCode: string | null;
|
|
183
|
+
};
|
|
184
|
+
execution: {
|
|
185
|
+
ready: boolean;
|
|
186
|
+
requiresTypedDataSignature: boolean;
|
|
187
|
+
hint: string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
export type SwivyHyperliquidNetwork = "mainnet" | "testnet";
|
|
191
|
+
export interface SwivyHyperliquidClientOptions {
|
|
192
|
+
network?: SwivyHyperliquidNetwork;
|
|
193
|
+
apiUrl?: string;
|
|
194
|
+
timeoutMs?: number | null;
|
|
195
|
+
}
|
|
196
|
+
export interface SwivyHyperliquidOrderPayload {
|
|
197
|
+
asset: number;
|
|
198
|
+
isBuy: boolean;
|
|
199
|
+
price: string;
|
|
200
|
+
size: string;
|
|
201
|
+
reduceOnly?: boolean;
|
|
202
|
+
tif?: "Gtc" | "Ioc" | "Alo" | "FrontendMarket";
|
|
203
|
+
grouping?: "na" | "normalTpsl" | "positionTpsl";
|
|
204
|
+
clientOrderId?: `0x${string}`;
|
|
205
|
+
}
|
|
206
|
+
export interface SwivyHyperliquidPlaceOrderPayload extends SwivyHyperliquidOrderPayload {
|
|
207
|
+
wallet: AbstractWallet;
|
|
208
|
+
expiresAfter?: number;
|
|
209
|
+
}
|
|
210
|
+
export interface SwivyHyperliquidSwivyOrderPayload extends SwivyHyperliquidOrderPayload {
|
|
211
|
+
accountId: string;
|
|
212
|
+
accountAddress?: string;
|
|
213
|
+
challengeId?: string;
|
|
214
|
+
expiresAfter?: number;
|
|
215
|
+
wait?: SwivyNodeWaitForIntentOptions;
|
|
216
|
+
}
|
|
217
|
+
export interface SwivyHyperliquidOrderPreview {
|
|
218
|
+
provider: "hyperliquid";
|
|
219
|
+
network: SwivyHyperliquidNetwork;
|
|
220
|
+
order: {
|
|
221
|
+
asset: number;
|
|
222
|
+
side: "buy" | "sell";
|
|
223
|
+
price: string;
|
|
224
|
+
size: string;
|
|
225
|
+
reduceOnly: boolean;
|
|
226
|
+
tif: "Gtc" | "Ioc" | "Alo" | "FrontendMarket";
|
|
227
|
+
grouping: "na" | "normalTpsl" | "positionTpsl";
|
|
228
|
+
clientOrderId?: string;
|
|
229
|
+
};
|
|
230
|
+
execution: {
|
|
231
|
+
ready: boolean;
|
|
232
|
+
requiresSwivyWallet: boolean;
|
|
233
|
+
hint: string;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export interface SwivyHyperliquidAccountStatus {
|
|
237
|
+
provider: "hyperliquid";
|
|
238
|
+
network: SwivyHyperliquidNetwork;
|
|
239
|
+
address: `0x${string}`;
|
|
240
|
+
initialized: boolean;
|
|
241
|
+
funded: boolean;
|
|
242
|
+
accountValue: string | null;
|
|
243
|
+
withdrawable: string | null;
|
|
244
|
+
marginSummary?: unknown;
|
|
245
|
+
state?: unknown;
|
|
246
|
+
next: string;
|
|
247
|
+
error?: string;
|
|
248
|
+
}
|
|
249
|
+
export declare function buildHyperliquidOrderPreview(order: SwivyHyperliquidOrderPayload, options?: SwivyHyperliquidClientOptions): SwivyHyperliquidOrderPreview;
|
|
250
|
+
export declare function getHyperliquidMids(options?: SwivyHyperliquidClientOptions): Promise<Record<string, string>>;
|
|
251
|
+
export declare function getHyperliquidPerpMarkets(options?: SwivyHyperliquidClientOptions): Promise<unknown>;
|
|
252
|
+
export declare function getHyperliquidAccountStatus(address: string, options?: SwivyHyperliquidClientOptions): Promise<SwivyHyperliquidAccountStatus>;
|
|
253
|
+
export declare function placeHyperliquidOrder(payload: SwivyHyperliquidPlaceOrderPayload, options?: SwivyHyperliquidClientOptions): Promise<{
|
|
254
|
+
preview: SwivyHyperliquidOrderPreview;
|
|
255
|
+
response: unknown;
|
|
256
|
+
}>;
|
|
257
|
+
export declare function getPolymarketObservedPriceFromOrderbook(orderbook: unknown): number | null;
|
|
258
|
+
export declare function generateSessionKeyPair(): SwivyNodeSessionKeyPair;
|
|
259
|
+
export declare function createSessionGrantAuthorization(params: {
|
|
260
|
+
grantId: string;
|
|
261
|
+
accountId: string;
|
|
262
|
+
chain: Chain;
|
|
263
|
+
kind: "sign_message" | "sign_digest" | "sign_typed_data" | "sign_transaction" | "execute_transaction";
|
|
264
|
+
payload: IntentPayload;
|
|
265
|
+
privateKeyPem: string;
|
|
266
|
+
nonce?: string;
|
|
267
|
+
expiresInSeconds?: number;
|
|
268
|
+
}): SwivyNodeSessionGrantAuthorization;
|
|
269
|
+
export interface SwivyNodeServerWallet {
|
|
270
|
+
id: string;
|
|
271
|
+
accountId: string;
|
|
272
|
+
chain: Chain;
|
|
273
|
+
address: string;
|
|
274
|
+
publicKey: string;
|
|
275
|
+
label: string | null;
|
|
276
|
+
custodyMode: string;
|
|
277
|
+
idempotencyKey: string | null;
|
|
278
|
+
authorizationKeyRequired: boolean;
|
|
279
|
+
createdAt: string;
|
|
280
|
+
}
|
|
281
|
+
export interface SwivyNodeServerWalletCreateOptions {
|
|
282
|
+
label?: string;
|
|
283
|
+
idempotencyKey?: string;
|
|
284
|
+
/** Ed25519 SPKI PEM. When set, every intent must be signed with the matching private key. */
|
|
285
|
+
authorizationPublicKeyPem?: string;
|
|
286
|
+
}
|
|
287
|
+
export interface SwivyNodeServerIntentOptions {
|
|
288
|
+
/** Ed25519 PKCS8 PEM for wallets created with an authorization key. */
|
|
289
|
+
authorizationPrivateKeyPem?: string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Verify a Swivy webhook: `x-swivy-signature` is hex HMAC-SHA256 of the raw body.
|
|
293
|
+
* Reject events whose `createdAt` is older than you are willing to accept.
|
|
294
|
+
*/
|
|
295
|
+
export declare function verifySwivyWebhookSignature(params: {
|
|
296
|
+
rawBody: string;
|
|
297
|
+
signature: string | undefined;
|
|
298
|
+
secret: string;
|
|
299
|
+
}): boolean;
|
|
300
|
+
export declare class SwivyNodeClient {
|
|
301
|
+
private readonly config;
|
|
302
|
+
private sessionToken?;
|
|
303
|
+
constructor(config: SwivyNodeClientConfig);
|
|
304
|
+
setSessionToken(token: string): void;
|
|
305
|
+
clearSessionToken(): void;
|
|
306
|
+
createOrganization(name: string): Promise<any>;
|
|
307
|
+
createProject(organizationId: string, name: string): Promise<any>;
|
|
308
|
+
updateProject(projectId: string, name: string): Promise<any>;
|
|
309
|
+
createEnvironment(projectId: string, name: string): Promise<any>;
|
|
310
|
+
updateEnvironment(environmentId: string, name: string): Promise<any>;
|
|
311
|
+
getOrganizationOverview(organizationId: string): Promise<{
|
|
312
|
+
overview: OrganizationOverview;
|
|
313
|
+
capabilities: ChainCapabilities[];
|
|
314
|
+
}>;
|
|
315
|
+
listEnvironmentCredentials(environmentId: string): Promise<any>;
|
|
316
|
+
createEnvironmentCredential(environmentId: string, label?: string): Promise<any>;
|
|
317
|
+
revokeEnvironmentCredential(environmentId: string, credentialId: string): Promise<any>;
|
|
318
|
+
rotateWebhookSecret(environmentId: string, webhookId: string): Promise<{
|
|
319
|
+
webhook: WebhookSecretReveal;
|
|
320
|
+
}>;
|
|
321
|
+
listWebhooks(environmentId: string): Promise<{
|
|
322
|
+
webhooks: WebhookDescriptor[];
|
|
323
|
+
}>;
|
|
324
|
+
revokeWebhook(environmentId: string, webhookId: string): Promise<any>;
|
|
325
|
+
listOrganizationAdminCredentials(organizationId: string): Promise<{
|
|
326
|
+
organization: {
|
|
327
|
+
id: string;
|
|
328
|
+
name: string;
|
|
329
|
+
slug: string;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
};
|
|
332
|
+
credentials: OrganizationAdminCredentialDescriptor[];
|
|
333
|
+
}>;
|
|
334
|
+
createOrganizationAdminCredential(organizationId: string, body?: {
|
|
335
|
+
label?: string;
|
|
336
|
+
role?: "owner" | "admin" | "developer" | "viewer";
|
|
337
|
+
}): Promise<{
|
|
338
|
+
organization: {
|
|
339
|
+
id: string;
|
|
340
|
+
name: string;
|
|
341
|
+
slug: string;
|
|
342
|
+
createdAt: string;
|
|
343
|
+
};
|
|
344
|
+
credential: OrganizationAdminCredentialDescriptor;
|
|
345
|
+
adminKey: string;
|
|
346
|
+
}>;
|
|
347
|
+
revokeOrganizationAdminCredential(organizationId: string, credentialId: string): Promise<any>;
|
|
348
|
+
listOrganizationMembers(organizationId: string): Promise<{
|
|
349
|
+
organization: {
|
|
350
|
+
id: string;
|
|
351
|
+
name: string;
|
|
352
|
+
slug: string;
|
|
353
|
+
createdAt: string;
|
|
354
|
+
};
|
|
355
|
+
members: OrganizationMemberDescriptor[];
|
|
356
|
+
}>;
|
|
357
|
+
revokeOrganizationMember(organizationId: string, memberId: string): Promise<any>;
|
|
358
|
+
updateOrganizationMemberRole(organizationId: string, memberId: string, role: "owner" | "admin" | "developer" | "viewer"): Promise<{
|
|
359
|
+
organizationId: string;
|
|
360
|
+
member: OrganizationMemberDescriptor;
|
|
361
|
+
credentials: OrganizationAdminCredentialDescriptor[];
|
|
362
|
+
}>;
|
|
363
|
+
listOrganizationInvites(organizationId: string): Promise<{
|
|
364
|
+
organization: {
|
|
365
|
+
id: string;
|
|
366
|
+
name: string;
|
|
367
|
+
slug: string;
|
|
368
|
+
createdAt: string;
|
|
369
|
+
};
|
|
370
|
+
invites: OrganizationInviteDescriptor[];
|
|
371
|
+
}>;
|
|
372
|
+
createOrganizationInvite(organizationId: string, body: {
|
|
373
|
+
email: string;
|
|
374
|
+
role?: "owner" | "admin" | "developer" | "viewer";
|
|
375
|
+
expiresInHours?: number;
|
|
376
|
+
}): Promise<{
|
|
377
|
+
organization: {
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
slug: string;
|
|
381
|
+
createdAt: string;
|
|
382
|
+
};
|
|
383
|
+
invite: OrganizationInviteDescriptor;
|
|
384
|
+
inviteToken: string;
|
|
385
|
+
}>;
|
|
386
|
+
revokeOrganizationInvite(organizationId: string, inviteId: string): Promise<any>;
|
|
387
|
+
acceptOrganizationInvite(inviteId: string, body: {
|
|
388
|
+
token: string;
|
|
389
|
+
name?: string;
|
|
390
|
+
label?: string;
|
|
391
|
+
}): Promise<{
|
|
392
|
+
organization: {
|
|
393
|
+
id: string;
|
|
394
|
+
name: string;
|
|
395
|
+
slug: string;
|
|
396
|
+
createdAt: string;
|
|
397
|
+
};
|
|
398
|
+
invite: OrganizationInviteDescriptor;
|
|
399
|
+
member: OrganizationMemberDescriptor;
|
|
400
|
+
credential: OrganizationAdminCredentialDescriptor;
|
|
401
|
+
adminKey: string;
|
|
402
|
+
}>;
|
|
403
|
+
updateEnvironmentPolicy(environmentId: string, policy: Record<string, unknown>): Promise<any>;
|
|
404
|
+
listEnvironmentChainRpcConfigs(environmentId: string): Promise<{
|
|
405
|
+
chains: EnvironmentChainRpcConfig[];
|
|
406
|
+
}>;
|
|
407
|
+
upsertEnvironmentChainRpcConfig(environmentId: string, chain: Chain, config: {
|
|
408
|
+
network?: string;
|
|
409
|
+
rpcUrl: string;
|
|
410
|
+
wsUrl?: string | null;
|
|
411
|
+
headers?: Array<{
|
|
412
|
+
name: string;
|
|
413
|
+
value: string;
|
|
414
|
+
}>;
|
|
415
|
+
commitment?: "processed" | "confirmed" | "finalized" | null;
|
|
416
|
+
skipPreflight?: boolean;
|
|
417
|
+
maxRetries?: number | null;
|
|
418
|
+
enabled?: boolean;
|
|
419
|
+
}): Promise<{
|
|
420
|
+
chain: EnvironmentChainRpcConfig;
|
|
421
|
+
}>;
|
|
422
|
+
requestEmailCode(email: string, externalUserId?: string): Promise<any>;
|
|
423
|
+
verifyEmailCode(email: string, code: string, externalUserId?: string): Promise<any>;
|
|
424
|
+
/** Request a primary login code. The environment must enable SMS login. */
|
|
425
|
+
requestSmsCode(phoneNumber: string): Promise<{
|
|
426
|
+
challengeId: string;
|
|
427
|
+
phoneNumber: string;
|
|
428
|
+
expiresAt: string;
|
|
429
|
+
}>;
|
|
430
|
+
verifySmsCode(challengeId: string, code: string): Promise<any>;
|
|
431
|
+
getMe(): Promise<any>;
|
|
432
|
+
claimUsername(username: string): Promise<{
|
|
433
|
+
identity: IdentityDescriptor;
|
|
434
|
+
}>;
|
|
435
|
+
lookupUsername(username: string): Promise<SwivyNodeIdentityLookupPayload>;
|
|
436
|
+
startTotp(label?: string): Promise<any>;
|
|
437
|
+
verifyTotp(authMethodId: string, code: string): Promise<any>;
|
|
438
|
+
createChallenge(authMethodId: string, purpose: string): Promise<any>;
|
|
439
|
+
verifyChallenge(challengeId: string, payload: Record<string, unknown>): Promise<any>;
|
|
440
|
+
createManagedAccount(chain: Chain, options?: string | SwivyNodeManagedAccountCreateOptions): Promise<any>;
|
|
441
|
+
listAccounts(): Promise<SwivyNodeListAccountsPayload>;
|
|
442
|
+
listWalletTools(): Promise<any>;
|
|
443
|
+
createLifiQuote(body: SwivyNodeLifiQuotePayload): Promise<any>;
|
|
444
|
+
createJupiterQuote(body: SwivyNodeJupiterQuotePayload): Promise<any>;
|
|
445
|
+
listPolymarketMarkets(nextCursor?: string): Promise<any>;
|
|
446
|
+
getPolymarketOrderbook(tokenId: string): Promise<any>;
|
|
447
|
+
previewPolymarketOrder(body: SwivyPolymarketOrderPayload): Promise<any>;
|
|
448
|
+
createPolymarketStopLimitOrder(body: SwivyPolymarketStopLimitPayload): Promise<any>;
|
|
449
|
+
listPolymarketStopLimitOrders(status?: "active" | "triggered" | "cancelled" | "expired" | "all"): Promise<any>;
|
|
450
|
+
cancelPolymarketStopLimitOrder(orderId: string): Promise<any>;
|
|
451
|
+
evaluatePolymarketStopLimitOrder(orderId: string, body: {
|
|
452
|
+
observedPrice: number;
|
|
453
|
+
triggeredOrderId?: string;
|
|
454
|
+
}): Promise<SwivyPolymarketStopLimitEvaluateResult>;
|
|
455
|
+
createSwapQuote(body: SwivyNodeSwapQuotePayload): Promise<any>;
|
|
456
|
+
getHyperliquidMids(options?: SwivyHyperliquidClientOptions): Promise<Record<string, string>>;
|
|
457
|
+
createOrDerivePolymarketApiKeyWithSwivyWallet(payload: {
|
|
458
|
+
accountId: string;
|
|
459
|
+
accountAddress: string;
|
|
460
|
+
nonce?: number;
|
|
461
|
+
challengeId?: string;
|
|
462
|
+
wait?: SwivyNodeWaitForIntentOptions;
|
|
463
|
+
}, options?: SwivyPolymarketClientOptions): Promise<PolymarketApiKeyCreds>;
|
|
464
|
+
placePolymarketOrderWithSwivyWallet(payload: SwivyPolymarketOrderPayload & {
|
|
465
|
+
apiCreds: PolymarketApiKeyCreds;
|
|
466
|
+
postOnly?: boolean;
|
|
467
|
+
deferExec?: boolean;
|
|
468
|
+
}, options?: SwivyPolymarketClientOptions): Promise<{
|
|
469
|
+
preview: SwivyPolymarketOrderPreview;
|
|
470
|
+
signedOrder: unknown;
|
|
471
|
+
response: unknown;
|
|
472
|
+
}>;
|
|
473
|
+
evaluateAndPlacePolymarketStopLimitOrder(stopLimitOrder: SwivyPolymarketStopLimitPayload & {
|
|
474
|
+
id: string;
|
|
475
|
+
accountAddress: string;
|
|
476
|
+
apiCreds: PolymarketApiKeyCreds;
|
|
477
|
+
challengeId?: string;
|
|
478
|
+
builderCode?: string;
|
|
479
|
+
metadata?: string;
|
|
480
|
+
expiration?: number;
|
|
481
|
+
wait?: SwivyNodeWaitForIntentOptions;
|
|
482
|
+
}, options?: SwivyPolymarketClientOptions): Promise<{
|
|
483
|
+
observedPrice: number;
|
|
484
|
+
triggered: boolean;
|
|
485
|
+
evaluation: SwivyPolymarketStopLimitEvaluateResult;
|
|
486
|
+
order?: Awaited<ReturnType<SwivyNodeClient["placePolymarketOrderWithSwivyWallet"]>>;
|
|
487
|
+
}>;
|
|
488
|
+
getHyperliquidPerpMarkets(options?: SwivyHyperliquidClientOptions): Promise<unknown>;
|
|
489
|
+
getHyperliquidAccountStatus(address: string, options?: SwivyHyperliquidClientOptions): Promise<SwivyHyperliquidAccountStatus>;
|
|
490
|
+
buildHyperliquidOrderPreview(order: SwivyHyperliquidOrderPayload, options?: SwivyHyperliquidClientOptions): SwivyHyperliquidOrderPreview;
|
|
491
|
+
placeHyperliquidOrder(payload: SwivyHyperliquidPlaceOrderPayload, options?: SwivyHyperliquidClientOptions): Promise<{
|
|
492
|
+
preview: SwivyHyperliquidOrderPreview;
|
|
493
|
+
response: unknown;
|
|
494
|
+
}>;
|
|
495
|
+
placeHyperliquidOrderWithSwivyWallet(payload: SwivyHyperliquidSwivyOrderPayload, options?: SwivyHyperliquidClientOptions): Promise<{
|
|
496
|
+
preview: SwivyHyperliquidOrderPreview;
|
|
497
|
+
response: unknown;
|
|
498
|
+
}>;
|
|
499
|
+
listEmbeddedWallets(): Promise<ManagedAccountDescriptor[]>;
|
|
500
|
+
getManagedAccount(chain: Chain, options?: {
|
|
501
|
+
purpose?: WalletPurpose;
|
|
502
|
+
}): Promise<ManagedAccountDescriptor | null>;
|
|
503
|
+
getEmbeddedWallet(chain: Chain): Promise<ManagedAccountDescriptor | null>;
|
|
504
|
+
ensureManagedAccount(chain: Chain, options?: string | SwivyNodeManagedAccountCreateOptions): Promise<SwivyNodeManagedAccountResolution>;
|
|
505
|
+
ensureEmbeddedWallet(chain: Chain, options?: string | SwivyNodeManagedAccountCreateOptions): Promise<SwivyNodeManagedAccountResolution>;
|
|
506
|
+
linkWallet(body: Record<string, unknown>): Promise<any>;
|
|
507
|
+
createSigningIntent(body: Record<string, unknown>): Promise<any>;
|
|
508
|
+
createTransactionIntent(body: Record<string, unknown>): Promise<any>;
|
|
509
|
+
getIntent(intentId: string): Promise<any>;
|
|
510
|
+
waitForIntent(intentId: string, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
511
|
+
createSigningIntentAndWait(body: Record<string, unknown>, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
512
|
+
signMessageAndWait(body: SwivyNodeSigningPayload & {
|
|
513
|
+
payload: {
|
|
514
|
+
message?: string;
|
|
515
|
+
messageHex?: string;
|
|
516
|
+
messageBase64?: string;
|
|
517
|
+
};
|
|
518
|
+
}, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
519
|
+
signTypedDataAndWait(body: SwivyNodeTypedDataSigningPayload, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
520
|
+
signTransactionAndWait(body: SwivyNodeSigningPayload & {
|
|
521
|
+
payload: {
|
|
522
|
+
transaction?: Record<string, unknown>;
|
|
523
|
+
serializedTransactionBase64?: string;
|
|
524
|
+
};
|
|
525
|
+
}, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
526
|
+
createTransactionIntentAndWait(body: Record<string, unknown>, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
527
|
+
executeTransactionAndWait(body: Record<string, unknown>, options?: SwivyNodeWaitForIntentOptions): Promise<TransactionIntent>;
|
|
528
|
+
exportManagedAccount(accountId: string, challengeId: string): Promise<SwivyNodeExportedAccountPayload>;
|
|
529
|
+
rawSign(accountId: string, challengeId: string, payload: Record<string, unknown>): Promise<SwivyNodeRawSignPayload>;
|
|
530
|
+
getAccountCustody(accountId: string): Promise<any>;
|
|
531
|
+
enableSplitCustody(accountId: string, splitCustody: NonNullable<SwivyNodeManagedAccountCreateOptions["splitCustody"]>): Promise<any>;
|
|
532
|
+
createSessionGrant(body: SwivyNodeSessionGrantCreatePayload): Promise<{
|
|
533
|
+
sessionGrant: SessionGrantDescriptor;
|
|
534
|
+
}>;
|
|
535
|
+
listSessionGrants(): Promise<{
|
|
536
|
+
sessionGrants: SessionGrantDescriptor[];
|
|
537
|
+
}>;
|
|
538
|
+
revokeSessionGrant(grantId: string): Promise<{
|
|
539
|
+
sessionGrant: SessionGrantDescriptor;
|
|
540
|
+
}>;
|
|
541
|
+
createSigningIntentWithSessionGrant(grant: SessionGrantDescriptor, privateKeyPem: string, payload: IntentPayload): Promise<{
|
|
542
|
+
intent: TransactionIntent;
|
|
543
|
+
}>;
|
|
544
|
+
createTransactionIntentWithSessionGrant(grant: SessionGrantDescriptor, privateKeyPem: string, payload: IntentPayload): Promise<{
|
|
545
|
+
intent: TransactionIntent;
|
|
546
|
+
}>;
|
|
547
|
+
createServerWallet(chain: Chain, options?: SwivyNodeServerWalletCreateOptions): Promise<{
|
|
548
|
+
wallet: SwivyNodeServerWallet;
|
|
549
|
+
existing: boolean;
|
|
550
|
+
}>;
|
|
551
|
+
listServerWallets(): Promise<{
|
|
552
|
+
wallets: SwivyNodeServerWallet[];
|
|
553
|
+
}>;
|
|
554
|
+
getServerWallet(walletId: string): Promise<{
|
|
555
|
+
wallet: SwivyNodeServerWallet;
|
|
556
|
+
}>;
|
|
557
|
+
createServerWalletSigningIntent(wallet: Pick<SwivyNodeServerWallet, "id" | "accountId" | "chain">, payload: IntentPayload, options?: SwivyNodeServerIntentOptions): Promise<{
|
|
558
|
+
intent: TransactionIntent;
|
|
559
|
+
}>;
|
|
560
|
+
createServerWalletTransactionIntent(wallet: Pick<SwivyNodeServerWallet, "id" | "accountId" | "chain">, payload: IntentPayload, options?: SwivyNodeServerIntentOptions): Promise<{
|
|
561
|
+
intent: TransactionIntent;
|
|
562
|
+
}>;
|
|
563
|
+
getServerWalletIntent(walletId: string, intentId: string): Promise<{
|
|
564
|
+
intent: TransactionIntent;
|
|
565
|
+
}>;
|
|
566
|
+
getUser(userId: string): Promise<any>;
|
|
567
|
+
getUserByEmail(email: string): Promise<any>;
|
|
568
|
+
/** Create (or find by email) a user and optionally give it wallets before first login. */
|
|
569
|
+
createUser(email: string, options?: {
|
|
570
|
+
externalUserId?: string;
|
|
571
|
+
createWallets?: Chain[];
|
|
572
|
+
}): Promise<any>;
|
|
573
|
+
createUserWallet(userId: string, chain: Chain, label?: string): Promise<any>;
|
|
574
|
+
listUsers(options?: {
|
|
575
|
+
limit?: number;
|
|
576
|
+
cursor?: string;
|
|
577
|
+
}): Promise<any>;
|
|
578
|
+
/** Remove a user's personal data and access. Their wallets are kept. */
|
|
579
|
+
deleteUser(userId: string): Promise<{
|
|
580
|
+
deleted: boolean;
|
|
581
|
+
userId: string;
|
|
582
|
+
}>;
|
|
583
|
+
/** Server-side check of a user's session token (Privy verifyAccessToken equivalent). */
|
|
584
|
+
verifySessionToken(sessionToken: string): Promise<{
|
|
585
|
+
session: {
|
|
586
|
+
id: string;
|
|
587
|
+
userId: string;
|
|
588
|
+
environmentId: string;
|
|
589
|
+
createdAt: string;
|
|
590
|
+
expiresAt: string;
|
|
591
|
+
};
|
|
592
|
+
}>;
|
|
593
|
+
listWebhookDeliveries(options?: {
|
|
594
|
+
status?: "pending" | "delivering" | "delivered" | "failed";
|
|
595
|
+
limit?: number;
|
|
596
|
+
}): Promise<any>;
|
|
597
|
+
replayWebhookDelivery(deliveryId: string): Promise<any>;
|
|
598
|
+
private request;
|
|
599
|
+
private delay;
|
|
600
|
+
}
|