@pear-protocol/symmio-client 0.3.18 → 0.3.19
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 +15 -480
- package/dist/index.d.ts +15 -480
- package/dist/index.js +48 -345
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -341
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +11 -146
- package/dist/react/index.d.ts +11 -146
- package/dist/react/index.js +42 -467
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +44 -465
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -46,34 +46,6 @@ var SoftLiquidationLevel = /* @__PURE__ */ ((SoftLiquidationLevel2) => {
|
|
|
46
46
|
return SoftLiquidationLevel2;
|
|
47
47
|
})(SoftLiquidationLevel || {});
|
|
48
48
|
|
|
49
|
-
// src/types/withdraw.ts
|
|
50
|
-
var WithdrawStatus = /* @__PURE__ */ ((WithdrawStatus2) => {
|
|
51
|
-
WithdrawStatus2[WithdrawStatus2["PENDING"] = 0] = "PENDING";
|
|
52
|
-
WithdrawStatus2[WithdrawStatus2["PROVIDER_ACCEPTED"] = 1] = "PROVIDER_ACCEPTED";
|
|
53
|
-
WithdrawStatus2[WithdrawStatus2["PROVIDER_REJECTED"] = 2] = "PROVIDER_REJECTED";
|
|
54
|
-
WithdrawStatus2[WithdrawStatus2["COMPLETED"] = 3] = "COMPLETED";
|
|
55
|
-
WithdrawStatus2[WithdrawStatus2["CANCEL_REQUESTED"] = 4] = "CANCEL_REQUESTED";
|
|
56
|
-
WithdrawStatus2[WithdrawStatus2["CANCELLED"] = 5] = "CANCELLED";
|
|
57
|
-
WithdrawStatus2[WithdrawStatus2["SUSPENDED"] = 6] = "SUSPENDED";
|
|
58
|
-
return WithdrawStatus2;
|
|
59
|
-
})(WithdrawStatus || {});
|
|
60
|
-
var WithdrawSpeed = /* @__PURE__ */ ((WithdrawSpeed2) => {
|
|
61
|
-
WithdrawSpeed2["STANDARD"] = "standard";
|
|
62
|
-
WithdrawSpeed2["INSTANT"] = "instant";
|
|
63
|
-
return WithdrawSpeed2;
|
|
64
|
-
})(WithdrawSpeed || {});
|
|
65
|
-
var InstantWithdrawStatus = /* @__PURE__ */ ((InstantWithdrawStatus2) => {
|
|
66
|
-
InstantWithdrawStatus2["IDLE"] = "idle";
|
|
67
|
-
InstantWithdrawStatus2["INITIATING"] = "initiating";
|
|
68
|
-
InstantWithdrawStatus2["AWAITING_PROVIDER"] = "awaitingProvider";
|
|
69
|
-
InstantWithdrawStatus2["AWAITING_COOLDOWN"] = "awaitingCooldown";
|
|
70
|
-
InstantWithdrawStatus2["FINALIZING"] = "finalizing";
|
|
71
|
-
InstantWithdrawStatus2["COMPLETED"] = "completed";
|
|
72
|
-
InstantWithdrawStatus2["FAILED"] = "failed";
|
|
73
|
-
return InstantWithdrawStatus2;
|
|
74
|
-
})(InstantWithdrawStatus || {});
|
|
75
|
-
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
76
|
-
|
|
77
49
|
// src/types/affiliate.ts
|
|
78
50
|
var AffiliateFeeLevel = /* @__PURE__ */ ((AffiliateFeeLevel2) => {
|
|
79
51
|
AffiliateFeeLevel2[AffiliateFeeLevel2["USER_SYMBOL"] = 0] = "USER_SYMBOL";
|
|
@@ -22892,181 +22864,6 @@ var SymmioDiamondABI = [
|
|
|
22892
22864
|
}
|
|
22893
22865
|
];
|
|
22894
22866
|
|
|
22895
|
-
// src/abis/WithdrawFacet.ts
|
|
22896
|
-
var WithdrawFacetABI = [
|
|
22897
|
-
// ─── Mutations ──────────────────────────────────────────────────
|
|
22898
|
-
{
|
|
22899
|
-
type: "function",
|
|
22900
|
-
name: "initiateWithdraw",
|
|
22901
|
-
stateMutability: "nonpayable",
|
|
22902
|
-
inputs: [
|
|
22903
|
-
{
|
|
22904
|
-
name: "parts",
|
|
22905
|
-
type: "tuple[]",
|
|
22906
|
-
internalType: "struct WithdrawReceiverPart[]",
|
|
22907
|
-
components: [
|
|
22908
|
-
{ name: "id", type: "uint256", internalType: "uint256" },
|
|
22909
|
-
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
22910
|
-
{ name: "chainId", type: "int256", internalType: "int256" },
|
|
22911
|
-
{ name: "receiver", type: "bytes", internalType: "bytes" },
|
|
22912
|
-
{ name: "virtualProvider", type: "address", internalType: "address" },
|
|
22913
|
-
{ name: "expressProvider", type: "address", internalType: "address" }
|
|
22914
|
-
]
|
|
22915
|
-
},
|
|
22916
|
-
{ name: "speedUp", type: "bool", internalType: "bool" },
|
|
22917
|
-
{ name: "data", type: "bytes", internalType: "bytes" }
|
|
22918
|
-
],
|
|
22919
|
-
outputs: [
|
|
22920
|
-
{ name: "requestId", type: "uint256", internalType: "uint256" },
|
|
22921
|
-
{ name: "cooldownEndTime", type: "uint256", internalType: "uint256" }
|
|
22922
|
-
]
|
|
22923
|
-
},
|
|
22924
|
-
{
|
|
22925
|
-
type: "function",
|
|
22926
|
-
name: "finalizeWithdrawRequest",
|
|
22927
|
-
stateMutability: "nonpayable",
|
|
22928
|
-
inputs: [
|
|
22929
|
-
{ name: "user", type: "address", internalType: "address" },
|
|
22930
|
-
{ name: "requestId", type: "uint256", internalType: "uint256" }
|
|
22931
|
-
],
|
|
22932
|
-
outputs: []
|
|
22933
|
-
},
|
|
22934
|
-
{
|
|
22935
|
-
type: "function",
|
|
22936
|
-
name: "requestCancelWithdraw",
|
|
22937
|
-
stateMutability: "nonpayable",
|
|
22938
|
-
inputs: [{ name: "requestId", type: "uint256", internalType: "uint256" }],
|
|
22939
|
-
outputs: []
|
|
22940
|
-
},
|
|
22941
|
-
// ─── Views ──────────────────────────────────────────────────────
|
|
22942
|
-
{
|
|
22943
|
-
type: "function",
|
|
22944
|
-
name: "getWithdrawableTime",
|
|
22945
|
-
stateMutability: "view",
|
|
22946
|
-
inputs: [{ name: "user", type: "address", internalType: "address" }],
|
|
22947
|
-
outputs: [{ name: "", type: "uint256", internalType: "uint256" }]
|
|
22948
|
-
},
|
|
22949
|
-
{
|
|
22950
|
-
type: "function",
|
|
22951
|
-
name: "getLastWithdrawRequestId",
|
|
22952
|
-
stateMutability: "view",
|
|
22953
|
-
inputs: [{ name: "user", type: "address", internalType: "address" }],
|
|
22954
|
-
outputs: [{ name: "", type: "uint256", internalType: "uint256" }]
|
|
22955
|
-
},
|
|
22956
|
-
{
|
|
22957
|
-
type: "function",
|
|
22958
|
-
name: "isSpeedUpEligible",
|
|
22959
|
-
stateMutability: "view",
|
|
22960
|
-
inputs: [{ name: "user", type: "address", internalType: "address" }],
|
|
22961
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }]
|
|
22962
|
-
},
|
|
22963
|
-
{
|
|
22964
|
-
type: "function",
|
|
22965
|
-
name: "isExpressProviderRegistered",
|
|
22966
|
-
stateMutability: "view",
|
|
22967
|
-
inputs: [{ name: "provider", type: "address", internalType: "address" }],
|
|
22968
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }]
|
|
22969
|
-
},
|
|
22970
|
-
{
|
|
22971
|
-
type: "function",
|
|
22972
|
-
name: "isVirtualProviderRegistered",
|
|
22973
|
-
stateMutability: "view",
|
|
22974
|
-
inputs: [{ name: "provider", type: "address", internalType: "address" }],
|
|
22975
|
-
outputs: [{ name: "", type: "bool", internalType: "bool" }]
|
|
22976
|
-
},
|
|
22977
|
-
// ─── Events ─────────────────────────────────────────────────────
|
|
22978
|
-
{
|
|
22979
|
-
type: "event",
|
|
22980
|
-
name: "WithdrawInitiated",
|
|
22981
|
-
anonymous: false,
|
|
22982
|
-
inputs: [
|
|
22983
|
-
{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
22984
|
-
{ name: "user", type: "address", indexed: true, internalType: "address" },
|
|
22985
|
-
{
|
|
22986
|
-
name: "parts",
|
|
22987
|
-
type: "tuple[]",
|
|
22988
|
-
indexed: false,
|
|
22989
|
-
internalType: "struct WithdrawReceiverPart[]",
|
|
22990
|
-
components: [
|
|
22991
|
-
{ name: "id", type: "uint256", internalType: "uint256" },
|
|
22992
|
-
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
22993
|
-
{ name: "chainId", type: "int256", internalType: "int256" },
|
|
22994
|
-
{ name: "receiver", type: "bytes", internalType: "bytes" },
|
|
22995
|
-
{ name: "virtualProvider", type: "address", internalType: "address" },
|
|
22996
|
-
{ name: "expressProvider", type: "address", internalType: "address" }
|
|
22997
|
-
]
|
|
22998
|
-
},
|
|
22999
|
-
{ name: "speedUp", type: "bool", indexed: false, internalType: "bool" },
|
|
23000
|
-
{ name: "providerData", type: "bytes", indexed: false, internalType: "bytes" },
|
|
23001
|
-
{ name: "cooldownEndTime", type: "uint256", indexed: false, internalType: "uint256" }
|
|
23002
|
-
]
|
|
23003
|
-
},
|
|
23004
|
-
{
|
|
23005
|
-
type: "event",
|
|
23006
|
-
name: "WithdrawAccepted",
|
|
23007
|
-
anonymous: false,
|
|
23008
|
-
inputs: [
|
|
23009
|
-
{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
23010
|
-
{ name: "user", type: "address", indexed: true, internalType: "address" }
|
|
23011
|
-
]
|
|
23012
|
-
},
|
|
23013
|
-
{
|
|
23014
|
-
type: "event",
|
|
23015
|
-
name: "WithdrawFinalized",
|
|
23016
|
-
anonymous: false,
|
|
23017
|
-
inputs: [
|
|
23018
|
-
{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
23019
|
-
{ name: "user", type: "address", indexed: true, internalType: "address" }
|
|
23020
|
-
]
|
|
23021
|
-
},
|
|
23022
|
-
{
|
|
23023
|
-
type: "event",
|
|
23024
|
-
name: "WithdrawCancelRequested",
|
|
23025
|
-
anonymous: false,
|
|
23026
|
-
inputs: [
|
|
23027
|
-
{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
23028
|
-
{ name: "user", type: "address", indexed: true, internalType: "address" }
|
|
23029
|
-
]
|
|
23030
|
-
},
|
|
23031
|
-
{
|
|
23032
|
-
type: "event",
|
|
23033
|
-
name: "WithdrawCancelled",
|
|
23034
|
-
anonymous: false,
|
|
23035
|
-
inputs: [
|
|
23036
|
-
{ name: "requestId", type: "uint256", indexed: true, internalType: "uint256" },
|
|
23037
|
-
{ name: "user", type: "address", indexed: true, internalType: "address" }
|
|
23038
|
-
]
|
|
23039
|
-
},
|
|
23040
|
-
{
|
|
23041
|
-
type: "event",
|
|
23042
|
-
name: "WithdrawRejected",
|
|
23043
|
-
anonymous: false,
|
|
23044
|
-
inputs: [
|
|
23045
|
-
{ name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
|
|
23046
|
-
{ name: "user", type: "address", indexed: false, internalType: "address" }
|
|
23047
|
-
]
|
|
23048
|
-
},
|
|
23049
|
-
{
|
|
23050
|
-
type: "event",
|
|
23051
|
-
name: "WithdrawSuspended",
|
|
23052
|
-
anonymous: false,
|
|
23053
|
-
inputs: [
|
|
23054
|
-
{ name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
|
|
23055
|
-
{ name: "user", type: "address", indexed: false, internalType: "address" }
|
|
23056
|
-
]
|
|
23057
|
-
},
|
|
23058
|
-
{
|
|
23059
|
-
type: "event",
|
|
23060
|
-
name: "WithdrawSpeedUpAccepted",
|
|
23061
|
-
anonymous: false,
|
|
23062
|
-
inputs: [
|
|
23063
|
-
{ name: "requestId", type: "uint256", indexed: false, internalType: "uint256" },
|
|
23064
|
-
{ name: "user", type: "address", indexed: false, internalType: "address" },
|
|
23065
|
-
{ name: "newCooldown", type: "uint256", indexed: false, internalType: "uint256" }
|
|
23066
|
-
]
|
|
23067
|
-
}
|
|
23068
|
-
];
|
|
23069
|
-
|
|
23070
22867
|
// src/abis/ClearingHouse.ts
|
|
23071
22868
|
var ClearingHouseABI = [
|
|
23072
22869
|
// ─── Liquidation Lifecycle ────────────────────────────────────
|
|
@@ -23495,6 +23292,12 @@ function validateAddress(address, name) {
|
|
|
23495
23292
|
return address;
|
|
23496
23293
|
}
|
|
23497
23294
|
function validateAmount(amount, name) {
|
|
23295
|
+
if (typeof amount !== "bigint") {
|
|
23296
|
+
throw new SymmioSDKError(
|
|
23297
|
+
`${name} must be a bigint, got ${amount === void 0 ? "undefined" : typeof amount} (${amount})`,
|
|
23298
|
+
"INVALID_AMOUNT"
|
|
23299
|
+
);
|
|
23300
|
+
}
|
|
23498
23301
|
if (amount <= 0n) {
|
|
23499
23302
|
throw new SymmioSDKError(
|
|
23500
23303
|
`${name} must be a positive amount, got ${amount}`,
|
|
@@ -23520,6 +23323,12 @@ function validateDeadline(deadline) {
|
|
|
23520
23323
|
}
|
|
23521
23324
|
}
|
|
23522
23325
|
function validateQuantity(quantity) {
|
|
23326
|
+
if (typeof quantity !== "bigint") {
|
|
23327
|
+
throw new SymmioSDKError(
|
|
23328
|
+
`Quantity must be a bigint, got ${quantity === void 0 ? "undefined" : typeof quantity} (${quantity})`,
|
|
23329
|
+
"INVALID_QUANTITY"
|
|
23330
|
+
);
|
|
23331
|
+
}
|
|
23523
23332
|
if (quantity <= 0n) {
|
|
23524
23333
|
throw new SymmioSDKError(
|
|
23525
23334
|
`Quantity must be positive, got ${quantity}`,
|
|
@@ -23859,149 +23668,27 @@ async function depositAndAllocate(walletClient, publicClient, multiAccount, para
|
|
|
23859
23668
|
// src/actions/withdraw.ts
|
|
23860
23669
|
var withdraw_exports = {};
|
|
23861
23670
|
__export(withdraw_exports, {
|
|
23862
|
-
|
|
23863
|
-
|
|
23864
|
-
buildWithdrawPart: () => buildWithdrawPart,
|
|
23865
|
-
finalizeWithdraw: () => finalizeWithdraw,
|
|
23866
|
-
initiateWithdraw: () => initiateWithdraw,
|
|
23867
|
-
prepareFinalizeWithdraw: () => prepareFinalizeWithdraw,
|
|
23868
|
-
prepareInitiateWithdraw: () => prepareInitiateWithdraw,
|
|
23869
|
-
prepareRequestCancelWithdraw: () => prepareRequestCancelWithdraw,
|
|
23870
|
-
requestCancelWithdraw: () => requestCancelWithdraw
|
|
23671
|
+
prepareWithdraw: () => prepareWithdraw,
|
|
23672
|
+
withdraw: () => withdraw
|
|
23871
23673
|
});
|
|
23872
|
-
function
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
functionName,
|
|
23876
|
-
args
|
|
23877
|
-
});
|
|
23878
|
-
}
|
|
23879
|
-
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23674
|
+
function prepareWithdraw(multiAccount, account, params) {
|
|
23675
|
+
validateAmount(params.amount, "withdraw amount");
|
|
23676
|
+
validateAddress(params.account, "account");
|
|
23880
23677
|
const data = encodeFunctionData({
|
|
23881
|
-
abi:
|
|
23882
|
-
functionName: "
|
|
23883
|
-
args: [
|
|
23884
|
-
});
|
|
23885
|
-
return {
|
|
23886
|
-
functionName: "_call",
|
|
23887
|
-
args: [subAccount, callDatas],
|
|
23888
|
-
data
|
|
23889
|
-
};
|
|
23890
|
-
}
|
|
23891
|
-
|
|
23892
|
-
// src/actions/withdraw.ts
|
|
23893
|
-
function buildClassicWithdrawPart(amount, chainId, receiver, partId = 0n) {
|
|
23894
|
-
return {
|
|
23895
|
-
id: partId,
|
|
23896
|
-
amount,
|
|
23897
|
-
chainId,
|
|
23898
|
-
receiver,
|
|
23899
|
-
virtualProvider: ZERO_ADDRESS,
|
|
23900
|
-
expressProvider: ZERO_ADDRESS
|
|
23901
|
-
};
|
|
23902
|
-
}
|
|
23903
|
-
function buildExpressWithdrawPart(amount, chainId, receiver, expressProvider, partId = 0n) {
|
|
23904
|
-
return {
|
|
23905
|
-
id: partId,
|
|
23906
|
-
amount,
|
|
23907
|
-
chainId,
|
|
23908
|
-
receiver,
|
|
23909
|
-
virtualProvider: ZERO_ADDRESS,
|
|
23910
|
-
expressProvider
|
|
23911
|
-
};
|
|
23912
|
-
}
|
|
23913
|
-
function buildWithdrawPart(amount, chainId, receiver, option, partId = 0n) {
|
|
23914
|
-
if (option.speed === "instant" /* INSTANT */) {
|
|
23915
|
-
return buildExpressWithdrawPart(
|
|
23916
|
-
amount,
|
|
23917
|
-
chainId,
|
|
23918
|
-
receiver,
|
|
23919
|
-
option.expressProvider,
|
|
23920
|
-
partId
|
|
23921
|
-
);
|
|
23922
|
-
}
|
|
23923
|
-
return buildClassicWithdrawPart(amount, chainId, receiver, partId);
|
|
23924
|
-
}
|
|
23925
|
-
function validateParts(parts) {
|
|
23926
|
-
if (parts.length === 0) {
|
|
23927
|
-
throw new Error("initiateWithdraw: at least one withdraw part is required");
|
|
23928
|
-
}
|
|
23929
|
-
for (const part of parts) {
|
|
23930
|
-
validateAmount(part.amount, "withdraw part amount");
|
|
23931
|
-
if (part.expressProvider !== ZERO_ADDRESS && part.expressProvider === part.virtualProvider) {
|
|
23932
|
-
throw new Error(
|
|
23933
|
-
"initiateWithdraw: a single provider cannot be set as both express and virtual"
|
|
23934
|
-
);
|
|
23935
|
-
}
|
|
23936
|
-
}
|
|
23937
|
-
}
|
|
23938
|
-
function prepareInitiateWithdraw(multiAccount, account, subAccount, params) {
|
|
23939
|
-
validateParts(params.parts);
|
|
23940
|
-
const innerData = encodeFunctionData({
|
|
23941
|
-
abi: WithdrawFacetABI,
|
|
23942
|
-
functionName: "initiateWithdraw",
|
|
23943
|
-
args: [params.parts, params.speedUp, params.providerData]
|
|
23944
|
-
});
|
|
23945
|
-
const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
|
|
23946
|
-
return {
|
|
23947
|
-
functionName: "_call",
|
|
23948
|
-
args: proxy.args,
|
|
23949
|
-
config: { account, to: multiAccount, data: proxy.data, value: 0n }
|
|
23950
|
-
};
|
|
23951
|
-
}
|
|
23952
|
-
function prepareFinalizeWithdraw(multiAccount, account, subAccount, params) {
|
|
23953
|
-
validateAddress(params.user, "user");
|
|
23954
|
-
const innerData = encodeFunctionData({
|
|
23955
|
-
abi: WithdrawFacetABI,
|
|
23956
|
-
functionName: "finalizeWithdrawRequest",
|
|
23957
|
-
args: [params.user, params.requestId]
|
|
23958
|
-
});
|
|
23959
|
-
const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
|
|
23960
|
-
return {
|
|
23961
|
-
functionName: "_call",
|
|
23962
|
-
args: proxy.args,
|
|
23963
|
-
config: { account, to: multiAccount, data: proxy.data, value: 0n }
|
|
23964
|
-
};
|
|
23965
|
-
}
|
|
23966
|
-
function prepareRequestCancelWithdraw(multiAccount, account, subAccount, params) {
|
|
23967
|
-
const innerData = encodeFunctionData({
|
|
23968
|
-
abi: WithdrawFacetABI,
|
|
23969
|
-
functionName: "requestCancelWithdraw",
|
|
23970
|
-
args: [params.requestId]
|
|
23678
|
+
abi: MultiAccountABI,
|
|
23679
|
+
functionName: "withdrawFromAccount",
|
|
23680
|
+
args: [params.account, params.amount]
|
|
23971
23681
|
});
|
|
23972
|
-
const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
|
|
23973
23682
|
return {
|
|
23974
|
-
functionName: "
|
|
23975
|
-
args:
|
|
23976
|
-
config: { account, to: multiAccount, data
|
|
23683
|
+
functionName: "withdrawFromAccount",
|
|
23684
|
+
args: [params.account, params.amount],
|
|
23685
|
+
config: { account, to: multiAccount, data, value: 0n }
|
|
23977
23686
|
};
|
|
23978
23687
|
}
|
|
23979
|
-
async function
|
|
23980
|
-
const account = walletClient.account?.address;
|
|
23981
|
-
if (!account) throw new Error("Wallet client has no account");
|
|
23982
|
-
const prepared = prepareInitiateWithdraw(multiAccount, account, subAccount, params);
|
|
23983
|
-
const gas = await publicClient.estimateGas(prepared.config);
|
|
23984
|
-
return walletClient.sendTransaction({
|
|
23985
|
-
...prepared.config,
|
|
23986
|
-
gas: calculateGasMargin(gas),
|
|
23987
|
-
chain: walletClient.chain
|
|
23988
|
-
});
|
|
23989
|
-
}
|
|
23990
|
-
async function finalizeWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
|
|
23688
|
+
async function withdraw(walletClient, publicClient, multiAccount, params) {
|
|
23991
23689
|
const account = walletClient.account?.address;
|
|
23992
23690
|
if (!account) throw new Error("Wallet client has no account");
|
|
23993
|
-
const prepared =
|
|
23994
|
-
const gas = await publicClient.estimateGas(prepared.config);
|
|
23995
|
-
return walletClient.sendTransaction({
|
|
23996
|
-
...prepared.config,
|
|
23997
|
-
gas: calculateGasMargin(gas),
|
|
23998
|
-
chain: walletClient.chain
|
|
23999
|
-
});
|
|
24000
|
-
}
|
|
24001
|
-
async function requestCancelWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
|
|
24002
|
-
const account = walletClient.account?.address;
|
|
24003
|
-
if (!account) throw new Error("Wallet client has no account");
|
|
24004
|
-
const prepared = prepareRequestCancelWithdraw(multiAccount, account, subAccount, params);
|
|
23691
|
+
const prepared = prepareWithdraw(multiAccount, account, params);
|
|
24005
23692
|
const gas = await publicClient.estimateGas(prepared.config);
|
|
24006
23693
|
return walletClient.sendTransaction({
|
|
24007
23694
|
...prepared.config,
|
|
@@ -24020,6 +23707,27 @@ __export(allocate_exports, {
|
|
|
24020
23707
|
prepareDeallocate: () => prepareDeallocate,
|
|
24021
23708
|
prepareInternalTransfer: () => prepareInternalTransfer
|
|
24022
23709
|
});
|
|
23710
|
+
function encodeCall(abi, functionName, args) {
|
|
23711
|
+
return encodeFunctionData({
|
|
23712
|
+
abi,
|
|
23713
|
+
functionName,
|
|
23714
|
+
args
|
|
23715
|
+
});
|
|
23716
|
+
}
|
|
23717
|
+
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23718
|
+
const data = encodeFunctionData({
|
|
23719
|
+
abi: accountDiamondAbi,
|
|
23720
|
+
functionName: "_call",
|
|
23721
|
+
args: [subAccount, callDatas]
|
|
23722
|
+
});
|
|
23723
|
+
return {
|
|
23724
|
+
functionName: "_call",
|
|
23725
|
+
args: [subAccount, callDatas],
|
|
23726
|
+
data
|
|
23727
|
+
};
|
|
23728
|
+
}
|
|
23729
|
+
|
|
23730
|
+
// src/actions/allocate.ts
|
|
24023
23731
|
function prepareAllocate(multiAccount, account, subAccount, params) {
|
|
24024
23732
|
validateAmount(params.amount, "allocate amount");
|
|
24025
23733
|
const innerData = encodeFunctionData({
|
|
@@ -25218,8 +24926,8 @@ function computeSymmNetDeposited(totals, decimals = 6) {
|
|
|
25218
24926
|
return "0";
|
|
25219
24927
|
}
|
|
25220
24928
|
const deposit2 = parseRawCollateralUnits(totals.deposit);
|
|
25221
|
-
const
|
|
25222
|
-
const value = deposit2 -
|
|
24929
|
+
const withdraw2 = parseRawCollateralUnits(totals.withdraw);
|
|
24930
|
+
const value = deposit2 - withdraw2;
|
|
25223
24931
|
const negative = value < 0n;
|
|
25224
24932
|
const absolute = negative ? -value : value;
|
|
25225
24933
|
const scale = 10n ** BigInt(decimals);
|
|
@@ -25380,6 +25088,6 @@ function normalizeSymmUpnlWebSocketMessage(raw) {
|
|
|
25380
25088
|
};
|
|
25381
25089
|
}
|
|
25382
25090
|
|
|
25383
|
-
export { ALL_TRADING_SELECTORS, AffiliateFeeLevel, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, ClearingHouseABI, ClearingHouseLiquidationStatus, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, ERC20ABI, FALLBACK_CHAIN_ID, InstantCloseStatus,
|
|
25091
|
+
export { ALL_TRADING_SELECTORS, AffiliateFeeLevel, ApprovalState, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, ClearingHouseABI, ClearingHouseLiquidationStatus, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, ERC20ABI, FALLBACK_CHAIN_ID, InstantCloseStatus, LIMIT_ORDER_DEADLINE, LiquidationStatus, MARKET_ORDER_DEADLINE, MARKET_PRICE_COEFFICIENT, MAX_LEVERAGE, MULTI_ACCOUNT_ADDRESS, MUON_APP_NAME, MUON_BASE_URLS, MultiAccountABI, MuonClient, MuonVerifierABI, OrderType, PositionType, QuoteStatus, SEND_QUOTE_WITH_AFFILIATE_SELECTOR, SIGNATURE_STORE_ADDRESS, STANDARD_WITHDRAW_COOLDOWN, SYMMIO_DIAMOND_ADDRESS, SignatureStoreABI, SoftLiquidationLevel, SupportedChainId, SymmioDiamondABI, SymmioSDKError, V3_CHAIN_IDS, account_exports as accountActions, admin_exports as adminActions, allocate_exports as allocateActions, applySlippage, approval_exports as approvalActions, calculateGasMargin, cancel_exports as cancelActions, close_exports as closeActions, computeSymmAccountOverview, computeSymmAccountOverviewFromData, computeSymmNetDeposited, computeSymmPositionUpnl, computeSymmPositionsUpnl, delegation_exports as delegationActions, deposit_exports as depositActions, encodeCall, formatPrice, fromWei, getAddress, getSymmAccountBalanceInfo, getSymmAccountData, instant_exports as instantActions, normalizeSymmUpnlWebSocketMessage, signature_exports as signatureActions, stats_exports as statsActions, toWei, trade_exports as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw_exports as withdrawActions, wrapInProxyCall };
|
|
25384
25092
|
//# sourceMappingURL=index.mjs.map
|
|
25385
25093
|
//# sourceMappingURL=index.mjs.map
|