@pear-protocol/symmio-client 0.2.12 → 0.2.13
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/react/index.d.mts +40 -174
- package/dist/react/index.d.ts +40 -174
- package/dist/react/index.js +35 -143
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +35 -143
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1097,7 +1097,6 @@ async function getAccounts(publicClient, multiAccount, user, start = 0, size = 1
|
|
|
1097
1097
|
}
|
|
1098
1098
|
|
|
1099
1099
|
// src/react/hooks/use-symm-accounts.ts
|
|
1100
|
-
var EMPTY_ACCOUNTS = [];
|
|
1101
1100
|
function useSymmAccounts(params = {}, options) {
|
|
1102
1101
|
const { chainId, symmioConfig } = useSymmContext();
|
|
1103
1102
|
const { userAddress, publicClient, walletClient } = params;
|
|
@@ -1132,11 +1131,7 @@ function useSymmAccounts(params = {}, options) {
|
|
|
1132
1131
|
}
|
|
1133
1132
|
});
|
|
1134
1133
|
return {
|
|
1135
|
-
|
|
1136
|
-
count: accountsQuery.data?.length ?? 0,
|
|
1137
|
-
isLoading: accountsQuery.isLoading,
|
|
1138
|
-
error: accountsQuery.error,
|
|
1139
|
-
refetch: accountsQuery.refetch,
|
|
1134
|
+
query: accountsQuery,
|
|
1140
1135
|
createAccount,
|
|
1141
1136
|
editName
|
|
1142
1137
|
};
|
|
@@ -1156,10 +1151,7 @@ function useSymmAccountsApi(params) {
|
|
|
1156
1151
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
1157
1152
|
});
|
|
1158
1153
|
return {
|
|
1159
|
-
|
|
1160
|
-
total: query.data?.data?.total ?? 0,
|
|
1161
|
-
isLoading: query.isLoading,
|
|
1162
|
-
refetch: query.refetch
|
|
1154
|
+
query
|
|
1163
1155
|
};
|
|
1164
1156
|
}
|
|
1165
1157
|
function useSymmAccountsLength(params) {
|
|
@@ -1177,10 +1169,7 @@ function useSymmAccountsLength(params) {
|
|
|
1177
1169
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
1178
1170
|
});
|
|
1179
1171
|
return {
|
|
1180
|
-
|
|
1181
|
-
total: query.data?.data?.total ?? 0,
|
|
1182
|
-
isLoading: query.isLoading,
|
|
1183
|
-
refetch: query.refetch
|
|
1172
|
+
query
|
|
1184
1173
|
};
|
|
1185
1174
|
}
|
|
1186
1175
|
function useSymmAccountsWithPositions(params) {
|
|
@@ -1198,10 +1187,7 @@ function useSymmAccountsWithPositions(params) {
|
|
|
1198
1187
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
1199
1188
|
});
|
|
1200
1189
|
return {
|
|
1201
|
-
|
|
1202
|
-
total: query.data?.data?.total ?? 0,
|
|
1203
|
-
isLoading: query.isLoading,
|
|
1204
|
-
refetch: query.refetch
|
|
1190
|
+
query
|
|
1205
1191
|
};
|
|
1206
1192
|
}
|
|
1207
1193
|
|
|
@@ -1361,10 +1347,7 @@ function useSymmApproval(params) {
|
|
|
1361
1347
|
}
|
|
1362
1348
|
});
|
|
1363
1349
|
return {
|
|
1364
|
-
|
|
1365
|
-
allowance: approvalQuery.data?.allowance ?? 0n,
|
|
1366
|
-
balance: approvalQuery.data?.balance ?? 0n,
|
|
1367
|
-
isLoading: approvalQuery.isLoading,
|
|
1350
|
+
query: approvalQuery,
|
|
1368
1351
|
approve: approveMutation
|
|
1369
1352
|
};
|
|
1370
1353
|
}
|
|
@@ -24385,8 +24368,7 @@ function useSymmSignature(params = {}, options) {
|
|
|
24385
24368
|
}
|
|
24386
24369
|
});
|
|
24387
24370
|
return {
|
|
24388
|
-
|
|
24389
|
-
isLoading: signedQuery.isLoading,
|
|
24371
|
+
query: signedQuery,
|
|
24390
24372
|
signTerms
|
|
24391
24373
|
};
|
|
24392
24374
|
}
|
|
@@ -24416,25 +24398,6 @@ async function getPartyAStats(publicClient, symmioDiamond, partyA) {
|
|
|
24416
24398
|
nonces: 0
|
|
24417
24399
|
};
|
|
24418
24400
|
}
|
|
24419
|
-
function calculateAvailableForOrder(stats, upnl) {
|
|
24420
|
-
const {
|
|
24421
|
-
allocatedBalance,
|
|
24422
|
-
lockedCVA,
|
|
24423
|
-
lockedLF,
|
|
24424
|
-
lockedPartyAMM,
|
|
24425
|
-
pendingLockedCVA,
|
|
24426
|
-
pendingLockedLF,
|
|
24427
|
-
pendingLockedPartyAMM
|
|
24428
|
-
} = stats;
|
|
24429
|
-
const totalPendingLocked = pendingLockedCVA + pendingLockedLF + pendingLockedPartyAMM;
|
|
24430
|
-
if (upnl >= 0n) {
|
|
24431
|
-
const totalLocked = lockedCVA + lockedLF + lockedPartyAMM;
|
|
24432
|
-
return allocatedBalance + upnl - totalLocked - totalPendingLocked;
|
|
24433
|
-
}
|
|
24434
|
-
const absUpnl = -upnl;
|
|
24435
|
-
const consideringMm = absUpnl > lockedPartyAMM ? absUpnl : lockedPartyAMM;
|
|
24436
|
-
return allocatedBalance - lockedCVA - lockedLF - totalPendingLocked - consideringMm;
|
|
24437
|
-
}
|
|
24438
24401
|
|
|
24439
24402
|
// src/react/hooks/use-symm-available-margin.ts
|
|
24440
24403
|
function useSymmAvailableMargin(params) {
|
|
@@ -24445,8 +24408,7 @@ function useSymmAvailableMargin(params) {
|
|
|
24445
24408
|
const selectWithUpnl = react.useCallback(
|
|
24446
24409
|
(stats) => ({
|
|
24447
24410
|
...stats,
|
|
24448
|
-
upnl: resolvedUpnl
|
|
24449
|
-
availableForOrder: calculateAvailableForOrder(stats, resolvedUpnl)
|
|
24411
|
+
upnl: resolvedUpnl
|
|
24450
24412
|
}),
|
|
24451
24413
|
[resolvedUpnl]
|
|
24452
24414
|
);
|
|
@@ -24459,10 +24421,7 @@ function useSymmAvailableMargin(params) {
|
|
|
24459
24421
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24460
24422
|
});
|
|
24461
24423
|
return {
|
|
24462
|
-
|
|
24463
|
-
stats: query.data ?? null,
|
|
24464
|
-
isLoading: query.isLoading,
|
|
24465
|
-
refetch: query.refetch
|
|
24424
|
+
query
|
|
24466
24425
|
};
|
|
24467
24426
|
}
|
|
24468
24427
|
function useSymmAccountSummary(params) {
|
|
@@ -24480,10 +24439,7 @@ function useSymmAccountSummary(params) {
|
|
|
24480
24439
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24481
24440
|
});
|
|
24482
24441
|
return {
|
|
24483
|
-
|
|
24484
|
-
total: query.data?.data?.total ?? 0,
|
|
24485
|
-
isLoading: query.isLoading,
|
|
24486
|
-
refetch: query.refetch
|
|
24442
|
+
query
|
|
24487
24443
|
};
|
|
24488
24444
|
}
|
|
24489
24445
|
function useSymmAccountData(params) {
|
|
@@ -24502,9 +24458,7 @@ function useSymmAccountData(params) {
|
|
|
24502
24458
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24503
24459
|
});
|
|
24504
24460
|
return {
|
|
24505
|
-
|
|
24506
|
-
isLoading: query.isLoading,
|
|
24507
|
-
refetch: query.refetch
|
|
24461
|
+
query
|
|
24508
24462
|
};
|
|
24509
24463
|
}
|
|
24510
24464
|
function useSymmBalances(params) {
|
|
@@ -24523,9 +24477,7 @@ function useSymmBalances(params) {
|
|
|
24523
24477
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24524
24478
|
});
|
|
24525
24479
|
return {
|
|
24526
|
-
|
|
24527
|
-
isLoading: query.isLoading,
|
|
24528
|
-
refetch: query.refetch
|
|
24480
|
+
query
|
|
24529
24481
|
};
|
|
24530
24482
|
}
|
|
24531
24483
|
function useSymmTrade() {
|
|
@@ -24608,11 +24560,9 @@ function useSymmPositions(params) {
|
|
|
24608
24560
|
}),
|
|
24609
24561
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24610
24562
|
});
|
|
24611
|
-
console.log("positions query", { query });
|
|
24563
|
+
console.log("positions query", { data: query.data });
|
|
24612
24564
|
return {
|
|
24613
|
-
|
|
24614
|
-
isLoading: query.isLoading,
|
|
24615
|
-
refetch: query.refetch
|
|
24565
|
+
query
|
|
24616
24566
|
};
|
|
24617
24567
|
}
|
|
24618
24568
|
function useSymmOpenOrders(params) {
|
|
@@ -24635,9 +24585,7 @@ function useSymmOpenOrders(params) {
|
|
|
24635
24585
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24636
24586
|
});
|
|
24637
24587
|
return {
|
|
24638
|
-
|
|
24639
|
-
isLoading: query.isLoading,
|
|
24640
|
-
refetch: query.refetch
|
|
24588
|
+
query
|
|
24641
24589
|
};
|
|
24642
24590
|
}
|
|
24643
24591
|
function useSymmTradeHistory(params) {
|
|
@@ -24664,9 +24612,7 @@ function useSymmTradeHistory(params) {
|
|
|
24664
24612
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24665
24613
|
});
|
|
24666
24614
|
return {
|
|
24667
|
-
|
|
24668
|
-
isLoading: query.isLoading,
|
|
24669
|
-
refetch: query.refetch
|
|
24615
|
+
query
|
|
24670
24616
|
};
|
|
24671
24617
|
}
|
|
24672
24618
|
function useSymmTpsl() {
|
|
@@ -24721,10 +24667,7 @@ function useSymmTpslOrders(params) {
|
|
|
24721
24667
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24722
24668
|
});
|
|
24723
24669
|
return {
|
|
24724
|
-
|
|
24725
|
-
total: query.data?.data?.total ?? 0,
|
|
24726
|
-
isLoading: query.isLoading,
|
|
24727
|
-
refetch: query.refetch
|
|
24670
|
+
query
|
|
24728
24671
|
};
|
|
24729
24672
|
}
|
|
24730
24673
|
function useSymmTwap(params) {
|
|
@@ -24753,8 +24696,7 @@ function useSymmTwap(params) {
|
|
|
24753
24696
|
}
|
|
24754
24697
|
});
|
|
24755
24698
|
return {
|
|
24756
|
-
|
|
24757
|
-
isLoading: query.isLoading,
|
|
24699
|
+
query,
|
|
24758
24700
|
cancelTwap
|
|
24759
24701
|
};
|
|
24760
24702
|
}
|
|
@@ -24798,9 +24740,7 @@ function useSymmTriggerConfig(params) {
|
|
|
24798
24740
|
}
|
|
24799
24741
|
});
|
|
24800
24742
|
return {
|
|
24801
|
-
|
|
24802
|
-
isLoading: query.isLoading,
|
|
24803
|
-
refetch: query.refetch,
|
|
24743
|
+
query,
|
|
24804
24744
|
setTriggerConfig,
|
|
24805
24745
|
clearTriggerConfig
|
|
24806
24746
|
};
|
|
@@ -24832,12 +24772,7 @@ function useSymmTriggerOrders(params) {
|
|
|
24832
24772
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24833
24773
|
});
|
|
24834
24774
|
return {
|
|
24835
|
-
|
|
24836
|
-
total: query.data?.data?.total ?? 0,
|
|
24837
|
-
limit: query.data?.data?.limit ?? limit ?? 0,
|
|
24838
|
-
offset: query.data?.data?.offset ?? offset ?? 0,
|
|
24839
|
-
isLoading: query.isLoading,
|
|
24840
|
-
refetch: query.refetch
|
|
24775
|
+
query
|
|
24841
24776
|
};
|
|
24842
24777
|
}
|
|
24843
24778
|
function useSymmMarkets(params) {
|
|
@@ -24858,9 +24793,7 @@ function useSymmMarkets(params) {
|
|
|
24858
24793
|
enabled: internalEnabled && (params?.query?.enabled ?? true)
|
|
24859
24794
|
});
|
|
24860
24795
|
return {
|
|
24861
|
-
|
|
24862
|
-
isLoading: query.isLoading,
|
|
24863
|
-
refetch: query.refetch
|
|
24796
|
+
query
|
|
24864
24797
|
};
|
|
24865
24798
|
}
|
|
24866
24799
|
function useSymmHedgerMarketById(params) {
|
|
@@ -24875,10 +24808,7 @@ function useSymmHedgerMarketById(params) {
|
|
|
24875
24808
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24876
24809
|
});
|
|
24877
24810
|
return {
|
|
24878
|
-
|
|
24879
|
-
markets: query.data?.data?.markets ?? [],
|
|
24880
|
-
isLoading: query.isLoading,
|
|
24881
|
-
refetch: query.refetch
|
|
24811
|
+
query
|
|
24882
24812
|
};
|
|
24883
24813
|
}
|
|
24884
24814
|
function useSymmHedgerMarketBySymbol(params) {
|
|
@@ -24893,10 +24823,7 @@ function useSymmHedgerMarketBySymbol(params) {
|
|
|
24893
24823
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24894
24824
|
});
|
|
24895
24825
|
return {
|
|
24896
|
-
|
|
24897
|
-
markets: query.data?.data?.markets ?? [],
|
|
24898
|
-
isLoading: query.isLoading,
|
|
24899
|
-
refetch: query.refetch
|
|
24826
|
+
query
|
|
24900
24827
|
};
|
|
24901
24828
|
}
|
|
24902
24829
|
function useSymmLockedParams(params) {
|
|
@@ -24915,15 +24842,9 @@ function useSymmLockedParams(params) {
|
|
|
24915
24842
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
24916
24843
|
});
|
|
24917
24844
|
return {
|
|
24918
|
-
|
|
24919
|
-
isLoading: query.isLoading,
|
|
24920
|
-
refetch: query.refetch
|
|
24845
|
+
query
|
|
24921
24846
|
};
|
|
24922
24847
|
}
|
|
24923
|
-
var EMPTY_MARKETS = [];
|
|
24924
|
-
var EMPTY_SYMBOLS = [];
|
|
24925
|
-
var EMPTY_MAP_BY_ID = /* @__PURE__ */ new Map();
|
|
24926
|
-
var EMPTY_MAP_BY_SYMBOL = /* @__PURE__ */ new Map();
|
|
24927
24848
|
function useSymmHedgerMarkets(params) {
|
|
24928
24849
|
const { symmCoreClient, chainId: ctxChainId } = useSymmContext();
|
|
24929
24850
|
const chainId = params?.chainId ?? ctxChainId;
|
|
@@ -24942,21 +24863,8 @@ function useSymmHedgerMarkets(params) {
|
|
|
24942
24863
|
queryFn: () => symmCoreClient.markets.listSymmHedger(request),
|
|
24943
24864
|
enabled: internalEnabled && consumerEnabled
|
|
24944
24865
|
});
|
|
24945
|
-
const data = query.data ?? null;
|
|
24946
24866
|
return {
|
|
24947
|
-
|
|
24948
|
-
markets: data?.markets ?? EMPTY_MARKETS,
|
|
24949
|
-
rawMarkets: data?.rawMarkets ?? EMPTY_MARKETS,
|
|
24950
|
-
filteredMarkets: data?.filteredMarkets ?? EMPTY_MARKETS,
|
|
24951
|
-
allSymbols: data?.allSymbols ?? EMPTY_SYMBOLS,
|
|
24952
|
-
filteredSymbols: data?.filteredSymbols ?? EMPTY_SYMBOLS,
|
|
24953
|
-
marketsById: data?.marketsById ?? EMPTY_MAP_BY_ID,
|
|
24954
|
-
marketsBySymbol: data?.marketsBySymbol ?? EMPTY_MAP_BY_SYMBOL,
|
|
24955
|
-
category: data?.category ?? params?.category ?? "all",
|
|
24956
|
-
resolvedSearchText: data?.searchText ?? searchText ?? "",
|
|
24957
|
-
isLoading: query.isLoading,
|
|
24958
|
-
isFetching: query.isFetching,
|
|
24959
|
-
refetch: query.refetch
|
|
24867
|
+
query
|
|
24960
24868
|
};
|
|
24961
24869
|
}
|
|
24962
24870
|
function useSymmFunding(params) {
|
|
@@ -24970,8 +24878,7 @@ function useSymmFunding(params) {
|
|
|
24970
24878
|
enabled: internalEnabled && (params?.query?.enabled ?? true)
|
|
24971
24879
|
});
|
|
24972
24880
|
return {
|
|
24973
|
-
|
|
24974
|
-
isLoading: query.isLoading
|
|
24881
|
+
query
|
|
24975
24882
|
};
|
|
24976
24883
|
}
|
|
24977
24884
|
function useSymmFundingHistory(params) {
|
|
@@ -25002,9 +24909,7 @@ function useSymmFundingHistory(params) {
|
|
|
25002
24909
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25003
24910
|
});
|
|
25004
24911
|
return {
|
|
25005
|
-
|
|
25006
|
-
isLoading: query.isLoading,
|
|
25007
|
-
refetch: query.refetch
|
|
24912
|
+
query
|
|
25008
24913
|
};
|
|
25009
24914
|
}
|
|
25010
24915
|
function useSymmFundingPayments(params) {
|
|
@@ -25032,10 +24937,7 @@ function useSymmFundingPayments(params) {
|
|
|
25032
24937
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25033
24938
|
});
|
|
25034
24939
|
return {
|
|
25035
|
-
|
|
25036
|
-
total: query.data?.data?.total ?? 0,
|
|
25037
|
-
isLoading: query.isLoading,
|
|
25038
|
-
refetch: query.refetch
|
|
24940
|
+
query
|
|
25039
24941
|
};
|
|
25040
24942
|
}
|
|
25041
24943
|
function useSymmPortfolio(params) {
|
|
@@ -25062,9 +24964,7 @@ function useSymmPortfolio(params) {
|
|
|
25062
24964
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25063
24965
|
});
|
|
25064
24966
|
return {
|
|
25065
|
-
|
|
25066
|
-
isLoading: query.isLoading,
|
|
25067
|
-
refetch: query.refetch
|
|
24967
|
+
query
|
|
25068
24968
|
};
|
|
25069
24969
|
}
|
|
25070
24970
|
function useSymmNotifications(params) {
|
|
@@ -25112,11 +25012,9 @@ function useSymmNotifications(params) {
|
|
|
25112
25012
|
}
|
|
25113
25013
|
});
|
|
25114
25014
|
return {
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
markRead,
|
|
25119
|
-
refetch: notificationsQuery.refetch
|
|
25015
|
+
query: notificationsQuery,
|
|
25016
|
+
unreadQuery,
|
|
25017
|
+
markRead
|
|
25120
25018
|
};
|
|
25121
25019
|
}
|
|
25122
25020
|
function useSymmPendingIds(params) {
|
|
@@ -25134,9 +25032,7 @@ function useSymmPendingIds(params) {
|
|
|
25134
25032
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25135
25033
|
});
|
|
25136
25034
|
return {
|
|
25137
|
-
|
|
25138
|
-
isLoading: query.isLoading,
|
|
25139
|
-
refetch: query.refetch
|
|
25035
|
+
query
|
|
25140
25036
|
};
|
|
25141
25037
|
}
|
|
25142
25038
|
function useSymmPendingInstantOpens(params) {
|
|
@@ -25164,10 +25060,7 @@ function useSymmPendingInstantOpens(params) {
|
|
|
25164
25060
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25165
25061
|
});
|
|
25166
25062
|
return {
|
|
25167
|
-
|
|
25168
|
-
total: query.data?.data?.total ?? 0,
|
|
25169
|
-
isLoading: query.isLoading,
|
|
25170
|
-
refetch: query.refetch
|
|
25063
|
+
query
|
|
25171
25064
|
};
|
|
25172
25065
|
}
|
|
25173
25066
|
function useSymmTwapOrder(params) {
|
|
@@ -25181,9 +25074,7 @@ function useSymmTwapOrder(params) {
|
|
|
25181
25074
|
enabled: internalEnabled && (params.query?.enabled ?? true)
|
|
25182
25075
|
});
|
|
25183
25076
|
return {
|
|
25184
|
-
|
|
25185
|
-
isLoading: query.isLoading,
|
|
25186
|
-
refetch: query.refetch
|
|
25077
|
+
query
|
|
25187
25078
|
};
|
|
25188
25079
|
}
|
|
25189
25080
|
var useSymmWsStore = zustand.create((set) => ({
|
|
@@ -25977,6 +25868,7 @@ function useSymmTokenSelectionMetadata(selection, options = {}) {
|
|
|
25977
25868
|
const weightedRatio24h = computeWeightedRatio24h(metricInput) ?? 0;
|
|
25978
25869
|
const sumNetFunding = computeNetFundingSum(metricInput);
|
|
25979
25870
|
return {
|
|
25871
|
+
query,
|
|
25980
25872
|
isLoading,
|
|
25981
25873
|
isPriceDataReady,
|
|
25982
25874
|
isUnsupported,
|