@pear-protocol/symmio-client 0.1.0 → 0.1.1
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/index.d.mts +150 -25
- package/dist/index.d.ts +150 -25
- package/dist/index.js +213 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +212 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +623 -0
- package/dist/react/index.d.ts +623 -0
- package/dist/react/index.js +25014 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +24988 -0
- package/dist/react/index.mjs.map +1 -0
- package/package.json +30 -3
package/dist/index.d.mts
CHANGED
|
@@ -31,6 +31,8 @@ type SymmioSDKConfig = {
|
|
|
31
31
|
signatureStoreAddress?: Address;
|
|
32
32
|
muonBaseUrls?: string[];
|
|
33
33
|
muonAppName?: string;
|
|
34
|
+
/** Base URL for the hedger API (required for instant trading). */
|
|
35
|
+
hedgerBaseUrl?: string;
|
|
34
36
|
};
|
|
35
37
|
declare enum PositionType {
|
|
36
38
|
LONG = 0,
|
|
@@ -65,30 +67,6 @@ declare enum SoftLiquidationLevel {
|
|
|
65
67
|
EMERGENCY = 3
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
type Account = {
|
|
69
|
-
accountAddress: Address;
|
|
70
|
-
name: string;
|
|
71
|
-
};
|
|
72
|
-
type AccountBalance = {
|
|
73
|
-
collateralBalance: bigint;
|
|
74
|
-
allocatedBalance: bigint;
|
|
75
|
-
availableBalance: bigint;
|
|
76
|
-
lockedCVA: bigint;
|
|
77
|
-
lockedLF: bigint;
|
|
78
|
-
lockedPartyAMM: bigint;
|
|
79
|
-
lockedPartyBMM: bigint;
|
|
80
|
-
pendingLockedCVA: bigint;
|
|
81
|
-
pendingLockedLF: bigint;
|
|
82
|
-
pendingLockedPartyAMM: bigint;
|
|
83
|
-
pendingLockedPartyBMM: bigint;
|
|
84
|
-
positionsCount: number;
|
|
85
|
-
pendingCount: number;
|
|
86
|
-
nonces: number;
|
|
87
|
-
};
|
|
88
|
-
type AddAccountParams = {
|
|
89
|
-
name: string;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
70
|
type SchnorrSign = {
|
|
93
71
|
signature: bigint;
|
|
94
72
|
owner: Address;
|
|
@@ -200,6 +178,70 @@ type CancelQuoteParams = {
|
|
|
200
178
|
quoteId: bigint;
|
|
201
179
|
};
|
|
202
180
|
|
|
181
|
+
type CreateSiweMessageParams = {
|
|
182
|
+
address: Address;
|
|
183
|
+
statement: string;
|
|
184
|
+
chainId: number;
|
|
185
|
+
nonce: string;
|
|
186
|
+
domain: string;
|
|
187
|
+
uri: string;
|
|
188
|
+
version?: string;
|
|
189
|
+
};
|
|
190
|
+
type SiweMessageResult = {
|
|
191
|
+
message: string;
|
|
192
|
+
issuedAt: string;
|
|
193
|
+
expirationTime: string;
|
|
194
|
+
};
|
|
195
|
+
type InstantLoginParams = {
|
|
196
|
+
accountAddress: Address;
|
|
197
|
+
signature: string;
|
|
198
|
+
expirationTime: string;
|
|
199
|
+
issuedAt: string;
|
|
200
|
+
nonce: string;
|
|
201
|
+
};
|
|
202
|
+
type InstantAuthToken = {
|
|
203
|
+
accessToken: string;
|
|
204
|
+
expirationTime: string;
|
|
205
|
+
issuedAt: string;
|
|
206
|
+
};
|
|
207
|
+
type InstantOpenParams = {
|
|
208
|
+
symbolId: number;
|
|
209
|
+
positionType: number;
|
|
210
|
+
orderType: number;
|
|
211
|
+
price: string;
|
|
212
|
+
quantity: string;
|
|
213
|
+
cva: string;
|
|
214
|
+
lf: string;
|
|
215
|
+
partyAmm: string;
|
|
216
|
+
partyBmm: string;
|
|
217
|
+
maxFundingRate: string;
|
|
218
|
+
deadline: number;
|
|
219
|
+
};
|
|
220
|
+
type InstantOpenResponse = {
|
|
221
|
+
successful: string;
|
|
222
|
+
message: string;
|
|
223
|
+
};
|
|
224
|
+
type InstantCloseParams = {
|
|
225
|
+
quoteId: string;
|
|
226
|
+
quantityToClose: string;
|
|
227
|
+
closePrice: string;
|
|
228
|
+
};
|
|
229
|
+
type InstantCloseResponse = {
|
|
230
|
+
successful: string;
|
|
231
|
+
message: string;
|
|
232
|
+
};
|
|
233
|
+
declare enum InstantCloseStatus {
|
|
234
|
+
STARTED = 0,
|
|
235
|
+
PROCESSING = 1,
|
|
236
|
+
FAILED = 2,
|
|
237
|
+
FINISHED = 3
|
|
238
|
+
}
|
|
239
|
+
type InstantErrorResponse = {
|
|
240
|
+
error_code: number;
|
|
241
|
+
error_message: string;
|
|
242
|
+
error_detail: string[];
|
|
243
|
+
};
|
|
244
|
+
|
|
203
245
|
declare class MuonClient {
|
|
204
246
|
private baseUrls;
|
|
205
247
|
private appName;
|
|
@@ -352,6 +394,7 @@ declare class SymmioSDK {
|
|
|
352
394
|
private _collateral;
|
|
353
395
|
private _clearingHouse?;
|
|
354
396
|
private _signatureStore?;
|
|
397
|
+
private _hedgerBaseUrl?;
|
|
355
398
|
constructor(options: {
|
|
356
399
|
chainId: number;
|
|
357
400
|
publicClient: PublicClient;
|
|
@@ -439,10 +482,51 @@ declare class SymmioSDK {
|
|
|
439
482
|
grantRole: (role: Hex, grantee: Address) => Promise<`0x${string}`>;
|
|
440
483
|
revokeRole: (role: Hex, revokee: Address) => Promise<`0x${string}`>;
|
|
441
484
|
};
|
|
485
|
+
private _requireHedgerUrl;
|
|
486
|
+
get instant(): {
|
|
487
|
+
/** Creates a SIWE message for instant trading authentication. */
|
|
488
|
+
createSiweMessage: (params: CreateSiweMessageParams) => SiweMessageResult;
|
|
489
|
+
/** Fetches a nonce from the hedger for SIWE authentication. */
|
|
490
|
+
getNonce: (subAccount: Address) => Promise<string>;
|
|
491
|
+
/** Exchanges a signed SIWE message for an access token. */
|
|
492
|
+
login: (params: InstantLoginParams) => Promise<InstantAuthToken>;
|
|
493
|
+
/** Opens a position instantly via the hedger (off-chain). */
|
|
494
|
+
open: (params: InstantOpenParams, accessToken: string) => Promise<InstantOpenResponse>;
|
|
495
|
+
/** Closes a position instantly via the hedger (off-chain). */
|
|
496
|
+
close: (params: InstantCloseParams, accessToken: string) => Promise<InstantCloseResponse>;
|
|
497
|
+
/** Cancels a pending instant close request. */
|
|
498
|
+
cancelClose: (quoteId: string, accessToken: string) => Promise<void>;
|
|
499
|
+
/** Fetches the list of open instant close requests for an account. */
|
|
500
|
+
getOpenCloses: (account: Address, accessToken: string) => Promise<unknown[]>;
|
|
501
|
+
};
|
|
442
502
|
getQuoteSig(partyA: Address, symbolId: number): Promise<MuonSingleUpnlAndPriceSig>;
|
|
443
503
|
getDeallocateSig(partyA: Address): Promise<MuonSingleUpnlSig>;
|
|
444
504
|
}
|
|
445
505
|
|
|
506
|
+
type Account = {
|
|
507
|
+
accountAddress: Address;
|
|
508
|
+
name: string;
|
|
509
|
+
};
|
|
510
|
+
type AccountBalance = {
|
|
511
|
+
collateralBalance: bigint;
|
|
512
|
+
allocatedBalance: bigint;
|
|
513
|
+
availableBalance: bigint;
|
|
514
|
+
lockedCVA: bigint;
|
|
515
|
+
lockedLF: bigint;
|
|
516
|
+
lockedPartyAMM: bigint;
|
|
517
|
+
lockedPartyBMM: bigint;
|
|
518
|
+
pendingLockedCVA: bigint;
|
|
519
|
+
pendingLockedLF: bigint;
|
|
520
|
+
pendingLockedPartyAMM: bigint;
|
|
521
|
+
pendingLockedPartyBMM: bigint;
|
|
522
|
+
positionsCount: number;
|
|
523
|
+
pendingCount: number;
|
|
524
|
+
nonces: number;
|
|
525
|
+
};
|
|
526
|
+
type AddAccountParams = {
|
|
527
|
+
name: string;
|
|
528
|
+
};
|
|
529
|
+
|
|
446
530
|
type Quote = {
|
|
447
531
|
id: number;
|
|
448
532
|
partyBsWhiteList: Address[];
|
|
@@ -19768,6 +19852,47 @@ declare namespace admin {
|
|
|
19768
19852
|
export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
|
|
19769
19853
|
}
|
|
19770
19854
|
|
|
19855
|
+
/**
|
|
19856
|
+
* Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
|
|
19857
|
+
* Follows EIP-4361 format. Token is valid for 30 days.
|
|
19858
|
+
*/
|
|
19859
|
+
declare function createSiweMessage(params: CreateSiweMessageParams): SiweMessageResult;
|
|
19860
|
+
/**
|
|
19861
|
+
* Fetches a nonce from the hedger for SIWE authentication.
|
|
19862
|
+
*/
|
|
19863
|
+
declare function getNonce(hedgerBaseUrl: string, subAccount: Address): Promise<string>;
|
|
19864
|
+
/**
|
|
19865
|
+
* Exchanges a signed SIWE message for an access token from the hedger.
|
|
19866
|
+
*/
|
|
19867
|
+
declare function login(hedgerBaseUrl: string, params: InstantLoginParams): Promise<InstantAuthToken>;
|
|
19868
|
+
/**
|
|
19869
|
+
* Opens a position instantly via the hedger's off-chain endpoint.
|
|
19870
|
+
*/
|
|
19871
|
+
declare function instantOpen(hedgerBaseUrl: string, params: InstantOpenParams, accessToken: string): Promise<InstantOpenResponse>;
|
|
19872
|
+
/**
|
|
19873
|
+
* Closes a position instantly via the hedger's off-chain endpoint.
|
|
19874
|
+
*/
|
|
19875
|
+
declare function instantClose(hedgerBaseUrl: string, params: InstantCloseParams, accessToken: string): Promise<InstantCloseResponse>;
|
|
19876
|
+
/**
|
|
19877
|
+
* Cancels a pending instant close request.
|
|
19878
|
+
*/
|
|
19879
|
+
declare function cancelInstantClose(hedgerBaseUrl: string, quoteId: string, accessToken: string): Promise<void>;
|
|
19880
|
+
/**
|
|
19881
|
+
* Fetches the list of open (pending) instant close requests for an account.
|
|
19882
|
+
*/
|
|
19883
|
+
declare function getOpenInstantCloses(hedgerBaseUrl: string, account: Address, accessToken: string): Promise<unknown[]>;
|
|
19884
|
+
|
|
19885
|
+
declare const instant_cancelInstantClose: typeof cancelInstantClose;
|
|
19886
|
+
declare const instant_createSiweMessage: typeof createSiweMessage;
|
|
19887
|
+
declare const instant_getNonce: typeof getNonce;
|
|
19888
|
+
declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
|
|
19889
|
+
declare const instant_instantClose: typeof instantClose;
|
|
19890
|
+
declare const instant_instantOpen: typeof instantOpen;
|
|
19891
|
+
declare const instant_login: typeof login;
|
|
19892
|
+
declare namespace instant {
|
|
19893
|
+
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19894
|
+
}
|
|
19895
|
+
|
|
19771
19896
|
/**
|
|
19772
19897
|
* Adds a gas margin buffer to the estimated gas.
|
|
19773
19898
|
* Default buffer is 20% above the estimation.
|
|
@@ -19832,4 +19957,4 @@ declare function formatPrice(price: bigint, decimals: number, precision?: number
|
|
|
19832
19957
|
*/
|
|
19833
19958
|
declare function applySlippage(price: bigint, slippagePercent: number, isLong: boolean): bigint;
|
|
19834
19959
|
|
|
19835
|
-
export { type ADLAssurance, ALL_TRADING_SELECTORS, type Account, type AccountBalance, type AccumulatedFundingRate, type AddAccountParams, type AffiliateFeeConfig, AffiliateFeeLevel, type AggregatedPosition, type AllocateParams, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, type CancelQuoteParams, type ChainId, ClearingHouseABI, type ClearingHouseLiquidation, ClearingHouseLiquidationStatus, type ClosePositionParams, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, type DeallocateParams, type DepositAndAllocateParams, type DepositParams, ERC20ABI, FALLBACK_CHAIN_ID, type InsuranceVaultConfig, type InternalTransferParams, LIMIT_ORDER_DEADLINE, LiquidationStatus, MARKET_ORDER_DEADLINE, MARKET_PRICE_COEFFICIENT, MAX_LEVERAGE, MULTI_ACCOUNT_ADDRESS, MUON_APP_NAME, MUON_BASE_URLS, type Market, MultiAccountABI, type MuonBatchParams, type MuonBatchSig, MuonClient, type MuonClientConfig, type MuonDeallocateParams, type MuonQuoteParams, type MuonSingleUpnlAndPriceSig, type MuonSingleUpnlSig, type MuonSingleUpnlWithPendingBalanceSig, MuonVerifierABI, OrderType, PositionType, type PreparedTransaction, type Quote, QuoteStatus, type RegisterAffiliateParams, SEND_QUOTE_WITH_AFFILIATE_SELECTOR, SIGNATURE_STORE_ADDRESS, STANDARD_WITHDRAW_COOLDOWN, SYMMIO_DIAMOND_ADDRESS, type SchnorrSign, type SendQuoteParams, type SetAffiliateFeeParams, SignatureStoreABI, SoftLiquidationLevel, type SoftLiquidationThreshold, SupportedChainId, type SymbolCategory, type SymbolType, SymmioDiamondABI, SymmioSDK, type SymmioSDKConfig, SymmioSDKError, type TransactionConfig, type TransactionReceipt, type TransactionResult, V3_CHAIN_IDS, type WithdrawParams, account as accountActions, admin as adminActions, allocate$1 as allocateActions, applySlippage, approval as approvalActions, calculateGasMargin, cancel as cancelActions, close as closeActions, delegation as delegationActions, deposit$1 as depositActions, encodeCall, formatPrice, fromWei, getAddress, signature as signatureActions, toWei, trade as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw$1 as withdrawActions, wrapInProxyCall };
|
|
19960
|
+
export { type ADLAssurance, ALL_TRADING_SELECTORS, type Account, type AccountBalance, type AccumulatedFundingRate, type AddAccountParams, type AffiliateFeeConfig, AffiliateFeeLevel, type AggregatedPosition, type AllocateParams, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, type CancelQuoteParams, type ChainId, ClearingHouseABI, type ClearingHouseLiquidation, ClearingHouseLiquidationStatus, type ClosePositionParams, type CreateSiweMessageParams, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, type DeallocateParams, type DepositAndAllocateParams, type DepositParams, ERC20ABI, FALLBACK_CHAIN_ID, type InstantAuthToken, type InstantCloseParams, type InstantCloseResponse, InstantCloseStatus, type InstantErrorResponse, type InstantLoginParams, type InstantOpenParams, type InstantOpenResponse, type InsuranceVaultConfig, type InternalTransferParams, LIMIT_ORDER_DEADLINE, LiquidationStatus, MARKET_ORDER_DEADLINE, MARKET_PRICE_COEFFICIENT, MAX_LEVERAGE, MULTI_ACCOUNT_ADDRESS, MUON_APP_NAME, MUON_BASE_URLS, type Market, MultiAccountABI, type MuonBatchParams, type MuonBatchSig, MuonClient, type MuonClientConfig, type MuonDeallocateParams, type MuonQuoteParams, type MuonSingleUpnlAndPriceSig, type MuonSingleUpnlSig, type MuonSingleUpnlWithPendingBalanceSig, MuonVerifierABI, OrderType, PositionType, type PreparedTransaction, type Quote, QuoteStatus, type RegisterAffiliateParams, SEND_QUOTE_WITH_AFFILIATE_SELECTOR, SIGNATURE_STORE_ADDRESS, STANDARD_WITHDRAW_COOLDOWN, SYMMIO_DIAMOND_ADDRESS, type SchnorrSign, type SendQuoteParams, type SetAffiliateFeeParams, SignatureStoreABI, type SiweMessageResult, SoftLiquidationLevel, type SoftLiquidationThreshold, SupportedChainId, type SymbolCategory, type SymbolType, SymmioDiamondABI, SymmioSDK, type SymmioSDKConfig, SymmioSDKError, type TransactionConfig, type TransactionReceipt, type TransactionResult, V3_CHAIN_IDS, type WithdrawParams, account as accountActions, admin as adminActions, allocate$1 as allocateActions, applySlippage, approval as approvalActions, calculateGasMargin, cancel as cancelActions, close as closeActions, delegation as delegationActions, deposit$1 as depositActions, encodeCall, formatPrice, fromWei, getAddress, instant as instantActions, signature as signatureActions, toWei, trade as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw$1 as withdrawActions, wrapInProxyCall };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ type SymmioSDKConfig = {
|
|
|
31
31
|
signatureStoreAddress?: Address;
|
|
32
32
|
muonBaseUrls?: string[];
|
|
33
33
|
muonAppName?: string;
|
|
34
|
+
/** Base URL for the hedger API (required for instant trading). */
|
|
35
|
+
hedgerBaseUrl?: string;
|
|
34
36
|
};
|
|
35
37
|
declare enum PositionType {
|
|
36
38
|
LONG = 0,
|
|
@@ -65,30 +67,6 @@ declare enum SoftLiquidationLevel {
|
|
|
65
67
|
EMERGENCY = 3
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
type Account = {
|
|
69
|
-
accountAddress: Address;
|
|
70
|
-
name: string;
|
|
71
|
-
};
|
|
72
|
-
type AccountBalance = {
|
|
73
|
-
collateralBalance: bigint;
|
|
74
|
-
allocatedBalance: bigint;
|
|
75
|
-
availableBalance: bigint;
|
|
76
|
-
lockedCVA: bigint;
|
|
77
|
-
lockedLF: bigint;
|
|
78
|
-
lockedPartyAMM: bigint;
|
|
79
|
-
lockedPartyBMM: bigint;
|
|
80
|
-
pendingLockedCVA: bigint;
|
|
81
|
-
pendingLockedLF: bigint;
|
|
82
|
-
pendingLockedPartyAMM: bigint;
|
|
83
|
-
pendingLockedPartyBMM: bigint;
|
|
84
|
-
positionsCount: number;
|
|
85
|
-
pendingCount: number;
|
|
86
|
-
nonces: number;
|
|
87
|
-
};
|
|
88
|
-
type AddAccountParams = {
|
|
89
|
-
name: string;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
70
|
type SchnorrSign = {
|
|
93
71
|
signature: bigint;
|
|
94
72
|
owner: Address;
|
|
@@ -200,6 +178,70 @@ type CancelQuoteParams = {
|
|
|
200
178
|
quoteId: bigint;
|
|
201
179
|
};
|
|
202
180
|
|
|
181
|
+
type CreateSiweMessageParams = {
|
|
182
|
+
address: Address;
|
|
183
|
+
statement: string;
|
|
184
|
+
chainId: number;
|
|
185
|
+
nonce: string;
|
|
186
|
+
domain: string;
|
|
187
|
+
uri: string;
|
|
188
|
+
version?: string;
|
|
189
|
+
};
|
|
190
|
+
type SiweMessageResult = {
|
|
191
|
+
message: string;
|
|
192
|
+
issuedAt: string;
|
|
193
|
+
expirationTime: string;
|
|
194
|
+
};
|
|
195
|
+
type InstantLoginParams = {
|
|
196
|
+
accountAddress: Address;
|
|
197
|
+
signature: string;
|
|
198
|
+
expirationTime: string;
|
|
199
|
+
issuedAt: string;
|
|
200
|
+
nonce: string;
|
|
201
|
+
};
|
|
202
|
+
type InstantAuthToken = {
|
|
203
|
+
accessToken: string;
|
|
204
|
+
expirationTime: string;
|
|
205
|
+
issuedAt: string;
|
|
206
|
+
};
|
|
207
|
+
type InstantOpenParams = {
|
|
208
|
+
symbolId: number;
|
|
209
|
+
positionType: number;
|
|
210
|
+
orderType: number;
|
|
211
|
+
price: string;
|
|
212
|
+
quantity: string;
|
|
213
|
+
cva: string;
|
|
214
|
+
lf: string;
|
|
215
|
+
partyAmm: string;
|
|
216
|
+
partyBmm: string;
|
|
217
|
+
maxFundingRate: string;
|
|
218
|
+
deadline: number;
|
|
219
|
+
};
|
|
220
|
+
type InstantOpenResponse = {
|
|
221
|
+
successful: string;
|
|
222
|
+
message: string;
|
|
223
|
+
};
|
|
224
|
+
type InstantCloseParams = {
|
|
225
|
+
quoteId: string;
|
|
226
|
+
quantityToClose: string;
|
|
227
|
+
closePrice: string;
|
|
228
|
+
};
|
|
229
|
+
type InstantCloseResponse = {
|
|
230
|
+
successful: string;
|
|
231
|
+
message: string;
|
|
232
|
+
};
|
|
233
|
+
declare enum InstantCloseStatus {
|
|
234
|
+
STARTED = 0,
|
|
235
|
+
PROCESSING = 1,
|
|
236
|
+
FAILED = 2,
|
|
237
|
+
FINISHED = 3
|
|
238
|
+
}
|
|
239
|
+
type InstantErrorResponse = {
|
|
240
|
+
error_code: number;
|
|
241
|
+
error_message: string;
|
|
242
|
+
error_detail: string[];
|
|
243
|
+
};
|
|
244
|
+
|
|
203
245
|
declare class MuonClient {
|
|
204
246
|
private baseUrls;
|
|
205
247
|
private appName;
|
|
@@ -352,6 +394,7 @@ declare class SymmioSDK {
|
|
|
352
394
|
private _collateral;
|
|
353
395
|
private _clearingHouse?;
|
|
354
396
|
private _signatureStore?;
|
|
397
|
+
private _hedgerBaseUrl?;
|
|
355
398
|
constructor(options: {
|
|
356
399
|
chainId: number;
|
|
357
400
|
publicClient: PublicClient;
|
|
@@ -439,10 +482,51 @@ declare class SymmioSDK {
|
|
|
439
482
|
grantRole: (role: Hex, grantee: Address) => Promise<`0x${string}`>;
|
|
440
483
|
revokeRole: (role: Hex, revokee: Address) => Promise<`0x${string}`>;
|
|
441
484
|
};
|
|
485
|
+
private _requireHedgerUrl;
|
|
486
|
+
get instant(): {
|
|
487
|
+
/** Creates a SIWE message for instant trading authentication. */
|
|
488
|
+
createSiweMessage: (params: CreateSiweMessageParams) => SiweMessageResult;
|
|
489
|
+
/** Fetches a nonce from the hedger for SIWE authentication. */
|
|
490
|
+
getNonce: (subAccount: Address) => Promise<string>;
|
|
491
|
+
/** Exchanges a signed SIWE message for an access token. */
|
|
492
|
+
login: (params: InstantLoginParams) => Promise<InstantAuthToken>;
|
|
493
|
+
/** Opens a position instantly via the hedger (off-chain). */
|
|
494
|
+
open: (params: InstantOpenParams, accessToken: string) => Promise<InstantOpenResponse>;
|
|
495
|
+
/** Closes a position instantly via the hedger (off-chain). */
|
|
496
|
+
close: (params: InstantCloseParams, accessToken: string) => Promise<InstantCloseResponse>;
|
|
497
|
+
/** Cancels a pending instant close request. */
|
|
498
|
+
cancelClose: (quoteId: string, accessToken: string) => Promise<void>;
|
|
499
|
+
/** Fetches the list of open instant close requests for an account. */
|
|
500
|
+
getOpenCloses: (account: Address, accessToken: string) => Promise<unknown[]>;
|
|
501
|
+
};
|
|
442
502
|
getQuoteSig(partyA: Address, symbolId: number): Promise<MuonSingleUpnlAndPriceSig>;
|
|
443
503
|
getDeallocateSig(partyA: Address): Promise<MuonSingleUpnlSig>;
|
|
444
504
|
}
|
|
445
505
|
|
|
506
|
+
type Account = {
|
|
507
|
+
accountAddress: Address;
|
|
508
|
+
name: string;
|
|
509
|
+
};
|
|
510
|
+
type AccountBalance = {
|
|
511
|
+
collateralBalance: bigint;
|
|
512
|
+
allocatedBalance: bigint;
|
|
513
|
+
availableBalance: bigint;
|
|
514
|
+
lockedCVA: bigint;
|
|
515
|
+
lockedLF: bigint;
|
|
516
|
+
lockedPartyAMM: bigint;
|
|
517
|
+
lockedPartyBMM: bigint;
|
|
518
|
+
pendingLockedCVA: bigint;
|
|
519
|
+
pendingLockedLF: bigint;
|
|
520
|
+
pendingLockedPartyAMM: bigint;
|
|
521
|
+
pendingLockedPartyBMM: bigint;
|
|
522
|
+
positionsCount: number;
|
|
523
|
+
pendingCount: number;
|
|
524
|
+
nonces: number;
|
|
525
|
+
};
|
|
526
|
+
type AddAccountParams = {
|
|
527
|
+
name: string;
|
|
528
|
+
};
|
|
529
|
+
|
|
446
530
|
type Quote = {
|
|
447
531
|
id: number;
|
|
448
532
|
partyBsWhiteList: Address[];
|
|
@@ -19768,6 +19852,47 @@ declare namespace admin {
|
|
|
19768
19852
|
export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
|
|
19769
19853
|
}
|
|
19770
19854
|
|
|
19855
|
+
/**
|
|
19856
|
+
* Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
|
|
19857
|
+
* Follows EIP-4361 format. Token is valid for 30 days.
|
|
19858
|
+
*/
|
|
19859
|
+
declare function createSiweMessage(params: CreateSiweMessageParams): SiweMessageResult;
|
|
19860
|
+
/**
|
|
19861
|
+
* Fetches a nonce from the hedger for SIWE authentication.
|
|
19862
|
+
*/
|
|
19863
|
+
declare function getNonce(hedgerBaseUrl: string, subAccount: Address): Promise<string>;
|
|
19864
|
+
/**
|
|
19865
|
+
* Exchanges a signed SIWE message for an access token from the hedger.
|
|
19866
|
+
*/
|
|
19867
|
+
declare function login(hedgerBaseUrl: string, params: InstantLoginParams): Promise<InstantAuthToken>;
|
|
19868
|
+
/**
|
|
19869
|
+
* Opens a position instantly via the hedger's off-chain endpoint.
|
|
19870
|
+
*/
|
|
19871
|
+
declare function instantOpen(hedgerBaseUrl: string, params: InstantOpenParams, accessToken: string): Promise<InstantOpenResponse>;
|
|
19872
|
+
/**
|
|
19873
|
+
* Closes a position instantly via the hedger's off-chain endpoint.
|
|
19874
|
+
*/
|
|
19875
|
+
declare function instantClose(hedgerBaseUrl: string, params: InstantCloseParams, accessToken: string): Promise<InstantCloseResponse>;
|
|
19876
|
+
/**
|
|
19877
|
+
* Cancels a pending instant close request.
|
|
19878
|
+
*/
|
|
19879
|
+
declare function cancelInstantClose(hedgerBaseUrl: string, quoteId: string, accessToken: string): Promise<void>;
|
|
19880
|
+
/**
|
|
19881
|
+
* Fetches the list of open (pending) instant close requests for an account.
|
|
19882
|
+
*/
|
|
19883
|
+
declare function getOpenInstantCloses(hedgerBaseUrl: string, account: Address, accessToken: string): Promise<unknown[]>;
|
|
19884
|
+
|
|
19885
|
+
declare const instant_cancelInstantClose: typeof cancelInstantClose;
|
|
19886
|
+
declare const instant_createSiweMessage: typeof createSiweMessage;
|
|
19887
|
+
declare const instant_getNonce: typeof getNonce;
|
|
19888
|
+
declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
|
|
19889
|
+
declare const instant_instantClose: typeof instantClose;
|
|
19890
|
+
declare const instant_instantOpen: typeof instantOpen;
|
|
19891
|
+
declare const instant_login: typeof login;
|
|
19892
|
+
declare namespace instant {
|
|
19893
|
+
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19894
|
+
}
|
|
19895
|
+
|
|
19771
19896
|
/**
|
|
19772
19897
|
* Adds a gas margin buffer to the estimated gas.
|
|
19773
19898
|
* Default buffer is 20% above the estimation.
|
|
@@ -19832,4 +19957,4 @@ declare function formatPrice(price: bigint, decimals: number, precision?: number
|
|
|
19832
19957
|
*/
|
|
19833
19958
|
declare function applySlippage(price: bigint, slippagePercent: number, isLong: boolean): bigint;
|
|
19834
19959
|
|
|
19835
|
-
export { type ADLAssurance, ALL_TRADING_SELECTORS, type Account, type AccountBalance, type AccumulatedFundingRate, type AddAccountParams, type AffiliateFeeConfig, AffiliateFeeLevel, type AggregatedPosition, type AllocateParams, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, type CancelQuoteParams, type ChainId, ClearingHouseABI, type ClearingHouseLiquidation, ClearingHouseLiquidationStatus, type ClosePositionParams, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, type DeallocateParams, type DepositAndAllocateParams, type DepositParams, ERC20ABI, FALLBACK_CHAIN_ID, type InsuranceVaultConfig, type InternalTransferParams, LIMIT_ORDER_DEADLINE, LiquidationStatus, MARKET_ORDER_DEADLINE, MARKET_PRICE_COEFFICIENT, MAX_LEVERAGE, MULTI_ACCOUNT_ADDRESS, MUON_APP_NAME, MUON_BASE_URLS, type Market, MultiAccountABI, type MuonBatchParams, type MuonBatchSig, MuonClient, type MuonClientConfig, type MuonDeallocateParams, type MuonQuoteParams, type MuonSingleUpnlAndPriceSig, type MuonSingleUpnlSig, type MuonSingleUpnlWithPendingBalanceSig, MuonVerifierABI, OrderType, PositionType, type PreparedTransaction, type Quote, QuoteStatus, type RegisterAffiliateParams, SEND_QUOTE_WITH_AFFILIATE_SELECTOR, SIGNATURE_STORE_ADDRESS, STANDARD_WITHDRAW_COOLDOWN, SYMMIO_DIAMOND_ADDRESS, type SchnorrSign, type SendQuoteParams, type SetAffiliateFeeParams, SignatureStoreABI, SoftLiquidationLevel, type SoftLiquidationThreshold, SupportedChainId, type SymbolCategory, type SymbolType, SymmioDiamondABI, SymmioSDK, type SymmioSDKConfig, SymmioSDKError, type TransactionConfig, type TransactionReceipt, type TransactionResult, V3_CHAIN_IDS, type WithdrawParams, account as accountActions, admin as adminActions, allocate$1 as allocateActions, applySlippage, approval as approvalActions, calculateGasMargin, cancel as cancelActions, close as closeActions, delegation as delegationActions, deposit$1 as depositActions, encodeCall, formatPrice, fromWei, getAddress, signature as signatureActions, toWei, trade as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw$1 as withdrawActions, wrapInProxyCall };
|
|
19960
|
+
export { type ADLAssurance, ALL_TRADING_SELECTORS, type Account, type AccountBalance, type AccumulatedFundingRate, type AddAccountParams, type AffiliateFeeConfig, AffiliateFeeLevel, type AggregatedPosition, type AllocateParams, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, type CancelQuoteParams, type ChainId, ClearingHouseABI, type ClearingHouseLiquidation, ClearingHouseLiquidationStatus, type ClosePositionParams, type CreateSiweMessageParams, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, type DeallocateParams, type DepositAndAllocateParams, type DepositParams, ERC20ABI, FALLBACK_CHAIN_ID, type InstantAuthToken, type InstantCloseParams, type InstantCloseResponse, InstantCloseStatus, type InstantErrorResponse, type InstantLoginParams, type InstantOpenParams, type InstantOpenResponse, type InsuranceVaultConfig, type InternalTransferParams, LIMIT_ORDER_DEADLINE, LiquidationStatus, MARKET_ORDER_DEADLINE, MARKET_PRICE_COEFFICIENT, MAX_LEVERAGE, MULTI_ACCOUNT_ADDRESS, MUON_APP_NAME, MUON_BASE_URLS, type Market, MultiAccountABI, type MuonBatchParams, type MuonBatchSig, MuonClient, type MuonClientConfig, type MuonDeallocateParams, type MuonQuoteParams, type MuonSingleUpnlAndPriceSig, type MuonSingleUpnlSig, type MuonSingleUpnlWithPendingBalanceSig, MuonVerifierABI, OrderType, PositionType, type PreparedTransaction, type Quote, QuoteStatus, type RegisterAffiliateParams, SEND_QUOTE_WITH_AFFILIATE_SELECTOR, SIGNATURE_STORE_ADDRESS, STANDARD_WITHDRAW_COOLDOWN, SYMMIO_DIAMOND_ADDRESS, type SchnorrSign, type SendQuoteParams, type SetAffiliateFeeParams, SignatureStoreABI, type SiweMessageResult, SoftLiquidationLevel, type SoftLiquidationThreshold, SupportedChainId, type SymbolCategory, type SymbolType, SymmioDiamondABI, SymmioSDK, type SymmioSDKConfig, SymmioSDKError, type TransactionConfig, type TransactionReceipt, type TransactionResult, V3_CHAIN_IDS, type WithdrawParams, account as accountActions, admin as adminActions, allocate$1 as allocateActions, applySlippage, approval as approvalActions, calculateGasMargin, cancel as cancelActions, close as closeActions, delegation as delegationActions, deposit$1 as depositActions, encodeCall, formatPrice, fromWei, getAddress, instant as instantActions, signature as signatureActions, toWei, trade as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw$1 as withdrawActions, wrapInProxyCall };
|