@pear-protocol/symmio-client 0.3.16 → 0.3.18
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 +5 -5
- package/dist/index.d.mts +479 -14
- package/dist/index.d.ts +479 -14
- package/dist/index.js +346 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +342 -37
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +202 -28
- package/dist/react/index.d.ts +202 -28
- package/dist/react/index.js +528 -49
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +525 -51
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/provider.js +1 -0
- package/dist/react/provider.js.map +1 -1
- package/dist/react/provider.mjs +1 -0
- package/dist/react/provider.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -46,6 +46,34 @@ 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
|
+
|
|
49
77
|
// src/types/affiliate.ts
|
|
50
78
|
var AffiliateFeeLevel = /* @__PURE__ */ ((AffiliateFeeLevel2) => {
|
|
51
79
|
AffiliateFeeLevel2[AffiliateFeeLevel2["USER_SYMBOL"] = 0] = "USER_SYMBOL";
|
|
@@ -22864,6 +22892,181 @@ var SymmioDiamondABI = [
|
|
|
22864
22892
|
}
|
|
22865
22893
|
];
|
|
22866
22894
|
|
|
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
|
+
|
|
22867
23070
|
// src/abis/ClearingHouse.ts
|
|
22868
23071
|
var ClearingHouseABI = [
|
|
22869
23072
|
// ─── Liquidation Lifecycle ────────────────────────────────────
|
|
@@ -23280,6 +23483,7 @@ var SymmioSDKError = class extends Error {
|
|
|
23280
23483
|
this.code = code;
|
|
23281
23484
|
this.name = "SymmioSDKError";
|
|
23282
23485
|
}
|
|
23486
|
+
code;
|
|
23283
23487
|
};
|
|
23284
23488
|
function validateAddress(address, name) {
|
|
23285
23489
|
if (!isAddress(address)) {
|
|
@@ -23655,27 +23859,149 @@ async function depositAndAllocate(walletClient, publicClient, multiAccount, para
|
|
|
23655
23859
|
// src/actions/withdraw.ts
|
|
23656
23860
|
var withdraw_exports = {};
|
|
23657
23861
|
__export(withdraw_exports, {
|
|
23658
|
-
|
|
23659
|
-
|
|
23862
|
+
buildClassicWithdrawPart: () => buildClassicWithdrawPart,
|
|
23863
|
+
buildExpressWithdrawPart: () => buildExpressWithdrawPart,
|
|
23864
|
+
buildWithdrawPart: () => buildWithdrawPart,
|
|
23865
|
+
finalizeWithdraw: () => finalizeWithdraw,
|
|
23866
|
+
initiateWithdraw: () => initiateWithdraw,
|
|
23867
|
+
prepareFinalizeWithdraw: () => prepareFinalizeWithdraw,
|
|
23868
|
+
prepareInitiateWithdraw: () => prepareInitiateWithdraw,
|
|
23869
|
+
prepareRequestCancelWithdraw: () => prepareRequestCancelWithdraw,
|
|
23870
|
+
requestCancelWithdraw: () => requestCancelWithdraw
|
|
23660
23871
|
});
|
|
23661
|
-
function
|
|
23662
|
-
|
|
23663
|
-
|
|
23872
|
+
function encodeCall(abi, functionName, args) {
|
|
23873
|
+
return encodeFunctionData({
|
|
23874
|
+
abi,
|
|
23875
|
+
functionName,
|
|
23876
|
+
args
|
|
23877
|
+
});
|
|
23878
|
+
}
|
|
23879
|
+
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23664
23880
|
const data = encodeFunctionData({
|
|
23665
|
-
abi:
|
|
23666
|
-
functionName: "
|
|
23667
|
-
args: [
|
|
23881
|
+
abi: accountDiamondAbi,
|
|
23882
|
+
functionName: "_call",
|
|
23883
|
+
args: [subAccount, callDatas]
|
|
23668
23884
|
});
|
|
23669
23885
|
return {
|
|
23670
|
-
functionName: "
|
|
23671
|
-
args: [
|
|
23672
|
-
|
|
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
|
|
23673
23911
|
};
|
|
23674
23912
|
}
|
|
23675
|
-
|
|
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]
|
|
23971
|
+
});
|
|
23972
|
+
const proxy = wrapInProxyCall(MultiAccountABI, subAccount, [innerData]);
|
|
23973
|
+
return {
|
|
23974
|
+
functionName: "_call",
|
|
23975
|
+
args: proxy.args,
|
|
23976
|
+
config: { account, to: multiAccount, data: proxy.data, value: 0n }
|
|
23977
|
+
};
|
|
23978
|
+
}
|
|
23979
|
+
async function initiateWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
|
|
23676
23980
|
const account = walletClient.account?.address;
|
|
23677
23981
|
if (!account) throw new Error("Wallet client has no account");
|
|
23678
|
-
const prepared =
|
|
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) {
|
|
23991
|
+
const account = walletClient.account?.address;
|
|
23992
|
+
if (!account) throw new Error("Wallet client has no account");
|
|
23993
|
+
const prepared = prepareFinalizeWithdraw(multiAccount, account, subAccount, params);
|
|
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);
|
|
23679
24005
|
const gas = await publicClient.estimateGas(prepared.config);
|
|
23680
24006
|
return walletClient.sendTransaction({
|
|
23681
24007
|
...prepared.config,
|
|
@@ -23694,27 +24020,6 @@ __export(allocate_exports, {
|
|
|
23694
24020
|
prepareDeallocate: () => prepareDeallocate,
|
|
23695
24021
|
prepareInternalTransfer: () => prepareInternalTransfer
|
|
23696
24022
|
});
|
|
23697
|
-
function encodeCall(abi, functionName, args) {
|
|
23698
|
-
return encodeFunctionData({
|
|
23699
|
-
abi,
|
|
23700
|
-
functionName,
|
|
23701
|
-
args
|
|
23702
|
-
});
|
|
23703
|
-
}
|
|
23704
|
-
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23705
|
-
const data = encodeFunctionData({
|
|
23706
|
-
abi: accountDiamondAbi,
|
|
23707
|
-
functionName: "_call",
|
|
23708
|
-
args: [subAccount, callDatas]
|
|
23709
|
-
});
|
|
23710
|
-
return {
|
|
23711
|
-
functionName: "_call",
|
|
23712
|
-
args: [subAccount, callDatas],
|
|
23713
|
-
data
|
|
23714
|
-
};
|
|
23715
|
-
}
|
|
23716
|
-
|
|
23717
|
-
// src/actions/allocate.ts
|
|
23718
24023
|
function prepareAllocate(multiAccount, account, subAccount, params) {
|
|
23719
24024
|
validateAmount(params.amount, "allocate amount");
|
|
23720
24025
|
const innerData = encodeFunctionData({
|
|
@@ -24913,8 +25218,8 @@ function computeSymmNetDeposited(totals, decimals = 6) {
|
|
|
24913
25218
|
return "0";
|
|
24914
25219
|
}
|
|
24915
25220
|
const deposit2 = parseRawCollateralUnits(totals.deposit);
|
|
24916
|
-
const
|
|
24917
|
-
const value = deposit2 -
|
|
25221
|
+
const withdraw = parseRawCollateralUnits(totals.withdraw);
|
|
25222
|
+
const value = deposit2 - withdraw;
|
|
24918
25223
|
const negative = value < 0n;
|
|
24919
25224
|
const absolute = negative ? -value : value;
|
|
24920
25225
|
const scale = 10n ** BigInt(decimals);
|
|
@@ -25075,6 +25380,6 @@ function normalizeSymmUpnlWebSocketMessage(raw) {
|
|
|
25075
25380
|
};
|
|
25076
25381
|
}
|
|
25077
25382
|
|
|
25078
|
-
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 };
|
|
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, InstantWithdrawStatus, 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, WithdrawFacetABI, WithdrawSpeed, WithdrawStatus, ZERO_ADDRESS, 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 };
|
|
25079
25384
|
//# sourceMappingURL=index.mjs.map
|
|
25080
25385
|
//# sourceMappingURL=index.mjs.map
|