@pear-protocol/symmio-client 0.3.25 → 0.3.27
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 +4 -0
- package/dist/index.d.mts +326 -7
- package/dist/index.d.ts +326 -7
- package/dist/index.js +360 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +353 -22
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +385 -1
- package/dist/react/index.d.ts +385 -1
- package/dist/react/index.js +829 -49
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +819 -51
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/provider.js +7 -1
- package/dist/react/provider.js.map +1 -1
- package/dist/react/provider.mjs +7 -1
- package/dist/react/provider.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -46,6 +46,55 @@ var SoftLiquidationLevel = /* @__PURE__ */ ((SoftLiquidationLevel2) => {
|
|
|
46
46
|
return SoftLiquidationLevel2;
|
|
47
47
|
})(SoftLiquidationLevel || {});
|
|
48
48
|
|
|
49
|
+
// src/types/instant-withdrawal.ts
|
|
50
|
+
var BridgeState = /* @__PURE__ */ ((BridgeState2) => {
|
|
51
|
+
BridgeState2["PENDING"] = "pending";
|
|
52
|
+
BridgeState2["EXECUTED"] = "executed";
|
|
53
|
+
BridgeState2["SETTLED"] = "settled";
|
|
54
|
+
BridgeState2["SUSPEND"] = "suspend";
|
|
55
|
+
return BridgeState2;
|
|
56
|
+
})(BridgeState || {});
|
|
57
|
+
var BridgeType = /* @__PURE__ */ ((BridgeType2) => {
|
|
58
|
+
BridgeType2["INSTANT"] = "instant";
|
|
59
|
+
BridgeType2["AFTER_COOL_DOWN"] = "after_cool_down";
|
|
60
|
+
BridgeType2["NO_POLICY"] = "no_policy";
|
|
61
|
+
return BridgeType2;
|
|
62
|
+
})(BridgeType || {});
|
|
63
|
+
var InstantWithdrawalErrorCode = /* @__PURE__ */ ((InstantWithdrawalErrorCode2) => {
|
|
64
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["UNHANDLED"] = 1] = "UNHANDLED";
|
|
65
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["COULD_NOT_GET_EXPECTED_RESPONSE"] = 2] = "COULD_NOT_GET_EXPECTED_RESPONSE";
|
|
66
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["MODEL_VALIDATION"] = 3] = "MODEL_VALIDATION";
|
|
67
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["NOT_FOUND"] = 4] = "NOT_FOUND";
|
|
68
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["ALREADY_HAS_PENDING"] = 5] = "ALREADY_HAS_PENDING";
|
|
69
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["NOT_ENOUGH_BALANCE"] = 6] = "NOT_ENOUGH_BALANCE";
|
|
70
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["INVALID_BRIDGE_TRANSACTION"] = 7] = "INVALID_BRIDGE_TRANSACTION";
|
|
71
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["INVALID_BRIDGE_POLICY_OPTION"] = 8] = "INVALID_BRIDGE_POLICY_OPTION";
|
|
72
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["ALREADY_HAS_WITHDRAWAL_OPTION_OR_EXECUTED"] = 9] = "ALREADY_HAS_WITHDRAWAL_OPTION_OR_EXECUTED";
|
|
73
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["LOW_AMOUNT_TO_BRIDGE"] = 10] = "LOW_AMOUNT_TO_BRIDGE";
|
|
74
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["UNAUTHORIZED"] = 11] = "UNAUTHORIZED";
|
|
75
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["INVALID_SIGNATURE"] = 12] = "INVALID_SIGNATURE";
|
|
76
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["SIGNATURE_MISMATCH"] = 13] = "SIGNATURE_MISMATCH";
|
|
77
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["EXPIRED_NONCE"] = 14] = "EXPIRED_NONCE";
|
|
78
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["NOT_AUTHENTICATED"] = 15] = "NOT_AUTHENTICATED";
|
|
79
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["CONTRACT_VALIDATION_FAILED"] = 16] = "CONTRACT_VALIDATION_FAILED";
|
|
80
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["RPC_CONNECTION_FAILED"] = 17] = "RPC_CONNECTION_FAILED";
|
|
81
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["NONCE_MISMATCH"] = 18] = "NONCE_MISMATCH";
|
|
82
|
+
InstantWithdrawalErrorCode2[InstantWithdrawalErrorCode2["USER_CREATION_IN_PROGRESS"] = 19] = "USER_CREATION_IN_PROGRESS";
|
|
83
|
+
return InstantWithdrawalErrorCode2;
|
|
84
|
+
})(InstantWithdrawalErrorCode || {});
|
|
85
|
+
var InstantWithdrawalError = class extends Error {
|
|
86
|
+
code;
|
|
87
|
+
status;
|
|
88
|
+
detail;
|
|
89
|
+
constructor(message, options) {
|
|
90
|
+
super(message);
|
|
91
|
+
this.name = "InstantWithdrawalError";
|
|
92
|
+
this.code = options?.code;
|
|
93
|
+
this.status = options?.status;
|
|
94
|
+
this.detail = options?.detail;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
49
98
|
// src/types/affiliate.ts
|
|
50
99
|
var AffiliateFeeLevel = /* @__PURE__ */ ((AffiliateFeeLevel2) => {
|
|
51
100
|
AffiliateFeeLevel2[AffiliateFeeLevel2["USER_SYMBOL"] = 0] = "USER_SYMBOL";
|
|
@@ -23187,6 +23236,17 @@ var ERC20ABI = [
|
|
|
23187
23236
|
}
|
|
23188
23237
|
];
|
|
23189
23238
|
|
|
23239
|
+
// src/abis/InstantWithdrawal.ts
|
|
23240
|
+
var InstantWithdrawalABI = [
|
|
23241
|
+
{
|
|
23242
|
+
inputs: [{ internalType: "uint256", name: "bridgeId", type: "uint256" }],
|
|
23243
|
+
name: "processWithdrawal",
|
|
23244
|
+
outputs: [],
|
|
23245
|
+
stateMutability: "nonpayable",
|
|
23246
|
+
type: "function"
|
|
23247
|
+
}
|
|
23248
|
+
];
|
|
23249
|
+
|
|
23190
23250
|
// src/constants/chains.ts
|
|
23191
23251
|
var SupportedChainId = /* @__PURE__ */ ((SupportedChainId2) => {
|
|
23192
23252
|
SupportedChainId2[SupportedChainId2["ARBITRUM"] = 42161] = "ARBITRUM";
|
|
@@ -23230,6 +23290,9 @@ var SIGNATURE_STORE_ADDRESS = {
|
|
|
23230
23290
|
[42161 /* ARBITRUM */]: "0x94eEa58De1C8945c342dB4bE9670301638E403e2",
|
|
23231
23291
|
[8453 /* BASE */]: "0xC19e66D08350Eb88A41377b16C8Ab93EE0FB4996"
|
|
23232
23292
|
};
|
|
23293
|
+
var INSTANT_WITHDRAWAL_ADDRESS = {
|
|
23294
|
+
[8453 /* BASE */]: "0xE0650873D8DadB54a6AC7c666BC98ab45f827b6D"
|
|
23295
|
+
};
|
|
23233
23296
|
var DEFAULT_PARTY_B_ADDRESS = {
|
|
23234
23297
|
[42161 /* ARBITRUM */]: "0x00c069d68bc7420740460DBC3cc3fFF9b3742421",
|
|
23235
23298
|
[8453 /* BASE */]: "0x1EcAbF0Eba136920677C9575FAccee36f30592cf"
|
|
@@ -23274,6 +23337,9 @@ var HEDGER_BASE_URLS = {
|
|
|
23274
23337
|
[42161 /* ARBITRUM */]: "https://www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/",
|
|
23275
23338
|
[8453 /* BASE */]: "https://www.perps-streaming.com/v1/8453a/0xE43166cE17d3511B09438a359dAa53513225101D/"
|
|
23276
23339
|
};
|
|
23340
|
+
var INSTANT_WITHDRAWAL_BASE_URLS = {
|
|
23341
|
+
[8453 /* BASE */]: "https://instant-withdrawal-base.symmio.foundation/v1/"
|
|
23342
|
+
};
|
|
23277
23343
|
var SymmioSDKError = class extends Error {
|
|
23278
23344
|
constructor(message, code) {
|
|
23279
23345
|
super(message);
|
|
@@ -23682,9 +23748,36 @@ async function depositAndAllocate(walletClient, publicClient, multiAccount, para
|
|
|
23682
23748
|
// src/actions/withdraw.ts
|
|
23683
23749
|
var withdraw_exports = {};
|
|
23684
23750
|
__export(withdraw_exports, {
|
|
23751
|
+
bridgeWithdraw: () => bridgeWithdraw,
|
|
23752
|
+
prepareBridgeWithdraw: () => prepareBridgeWithdraw,
|
|
23753
|
+
prepareProcessWithdrawal: () => prepareProcessWithdrawal,
|
|
23754
|
+
prepareTransferToBridge: () => prepareTransferToBridge,
|
|
23685
23755
|
prepareWithdraw: () => prepareWithdraw,
|
|
23756
|
+
processWithdrawal: () => processWithdrawal,
|
|
23757
|
+
transferToBridge: () => transferToBridge,
|
|
23686
23758
|
withdraw: () => withdraw
|
|
23687
23759
|
});
|
|
23760
|
+
function encodeCall(abi, functionName, args) {
|
|
23761
|
+
return encodeFunctionData({
|
|
23762
|
+
abi,
|
|
23763
|
+
functionName,
|
|
23764
|
+
args
|
|
23765
|
+
});
|
|
23766
|
+
}
|
|
23767
|
+
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23768
|
+
const data = encodeFunctionData({
|
|
23769
|
+
abi: accountDiamondAbi,
|
|
23770
|
+
functionName: "_call",
|
|
23771
|
+
args: [subAccount, callDatas]
|
|
23772
|
+
});
|
|
23773
|
+
return {
|
|
23774
|
+
functionName: "_call",
|
|
23775
|
+
args: [subAccount, callDatas],
|
|
23776
|
+
data
|
|
23777
|
+
};
|
|
23778
|
+
}
|
|
23779
|
+
|
|
23780
|
+
// src/actions/withdraw.ts
|
|
23688
23781
|
function prepareWithdraw(multiAccount, account, params) {
|
|
23689
23782
|
validateAmount(params.amount, "withdraw amount");
|
|
23690
23783
|
validateAddress(params.account, "account");
|
|
@@ -23710,6 +23803,102 @@ async function withdraw(walletClient, publicClient, multiAccount, params) {
|
|
|
23710
23803
|
chain: walletClient.chain
|
|
23711
23804
|
});
|
|
23712
23805
|
}
|
|
23806
|
+
function encodeDeallocate(amount, upnlSig) {
|
|
23807
|
+
validateAmount(amount, "deallocate amount");
|
|
23808
|
+
const muonSig = {
|
|
23809
|
+
reqId: upnlSig.reqId,
|
|
23810
|
+
timestamp: upnlSig.timestamp,
|
|
23811
|
+
upnl: upnlSig.upnl,
|
|
23812
|
+
gatewaySignature: upnlSig.gatewaySignature,
|
|
23813
|
+
sigs: {
|
|
23814
|
+
signature: upnlSig.sigs.signature,
|
|
23815
|
+
owner: upnlSig.sigs.owner,
|
|
23816
|
+
nonce: upnlSig.sigs.nonce
|
|
23817
|
+
}
|
|
23818
|
+
};
|
|
23819
|
+
return encodeFunctionData({
|
|
23820
|
+
abi: SymmioDiamondABI,
|
|
23821
|
+
functionName: "deallocate",
|
|
23822
|
+
args: [amount, muonSig]
|
|
23823
|
+
});
|
|
23824
|
+
}
|
|
23825
|
+
function encodeTransferToBridge(amount, bridgeAddress) {
|
|
23826
|
+
validateAmount(amount, "bridge amount");
|
|
23827
|
+
validateAddress(bridgeAddress, "bridgeAddress");
|
|
23828
|
+
return encodeFunctionData({
|
|
23829
|
+
abi: SymmioDiamondABI,
|
|
23830
|
+
functionName: "transferToBridge",
|
|
23831
|
+
args: [amount, bridgeAddress]
|
|
23832
|
+
});
|
|
23833
|
+
}
|
|
23834
|
+
function prepareTransferToBridge(symmioDiamond, account, params) {
|
|
23835
|
+
const data = encodeTransferToBridge(params.amount, params.bridgeAddress);
|
|
23836
|
+
return {
|
|
23837
|
+
functionName: "transferToBridge",
|
|
23838
|
+
args: [params.amount, params.bridgeAddress],
|
|
23839
|
+
config: { account, to: symmioDiamond, data, value: 0n }
|
|
23840
|
+
};
|
|
23841
|
+
}
|
|
23842
|
+
function prepareBridgeWithdraw(multiAccount, account, subAccount, params) {
|
|
23843
|
+
const callDatas = [];
|
|
23844
|
+
if (params.deallocate) {
|
|
23845
|
+
callDatas.push(
|
|
23846
|
+
encodeDeallocate(params.deallocate.amount, params.deallocate.upnlSig)
|
|
23847
|
+
);
|
|
23848
|
+
}
|
|
23849
|
+
callDatas.push(encodeTransferToBridge(params.amount, params.bridgeAddress));
|
|
23850
|
+
const proxy = wrapInProxyCall(MultiAccountABI, subAccount, callDatas);
|
|
23851
|
+
return {
|
|
23852
|
+
functionName: "_call",
|
|
23853
|
+
args: proxy.args,
|
|
23854
|
+
config: { account, to: multiAccount, data: proxy.data, value: 0n }
|
|
23855
|
+
};
|
|
23856
|
+
}
|
|
23857
|
+
async function transferToBridge(walletClient, publicClient, symmioDiamond, params) {
|
|
23858
|
+
const account = walletClient.account?.address;
|
|
23859
|
+
if (!account) throw new Error("Wallet client has no account");
|
|
23860
|
+
const prepared = prepareTransferToBridge(symmioDiamond, account, params);
|
|
23861
|
+
const gas = await publicClient.estimateGas(prepared.config);
|
|
23862
|
+
return walletClient.sendTransaction({
|
|
23863
|
+
...prepared.config,
|
|
23864
|
+
gas: calculateGasMargin(gas),
|
|
23865
|
+
chain: walletClient.chain
|
|
23866
|
+
});
|
|
23867
|
+
}
|
|
23868
|
+
async function bridgeWithdraw(walletClient, publicClient, multiAccount, subAccount, params) {
|
|
23869
|
+
const account = walletClient.account?.address;
|
|
23870
|
+
if (!account) throw new Error("Wallet client has no account");
|
|
23871
|
+
const prepared = prepareBridgeWithdraw(multiAccount, account, subAccount, params);
|
|
23872
|
+
const gas = await publicClient.estimateGas(prepared.config);
|
|
23873
|
+
return walletClient.sendTransaction({
|
|
23874
|
+
...prepared.config,
|
|
23875
|
+
gas: calculateGasMargin(gas),
|
|
23876
|
+
chain: walletClient.chain
|
|
23877
|
+
});
|
|
23878
|
+
}
|
|
23879
|
+
function prepareProcessWithdrawal(instantWithdrawal, account, params) {
|
|
23880
|
+
const data = encodeFunctionData({
|
|
23881
|
+
abi: InstantWithdrawalABI,
|
|
23882
|
+
functionName: "processWithdrawal",
|
|
23883
|
+
args: [params.bridgeId]
|
|
23884
|
+
});
|
|
23885
|
+
return {
|
|
23886
|
+
functionName: "processWithdrawal",
|
|
23887
|
+
args: [params.bridgeId],
|
|
23888
|
+
config: { account, to: instantWithdrawal, data, value: 0n }
|
|
23889
|
+
};
|
|
23890
|
+
}
|
|
23891
|
+
async function processWithdrawal(walletClient, publicClient, instantWithdrawal, params) {
|
|
23892
|
+
const account = walletClient.account?.address;
|
|
23893
|
+
if (!account) throw new Error("Wallet client has no account");
|
|
23894
|
+
const prepared = prepareProcessWithdrawal(instantWithdrawal, account, params);
|
|
23895
|
+
const gas = await publicClient.estimateGas(prepared.config);
|
|
23896
|
+
return walletClient.sendTransaction({
|
|
23897
|
+
...prepared.config,
|
|
23898
|
+
gas: calculateGasMargin(gas),
|
|
23899
|
+
chain: walletClient.chain
|
|
23900
|
+
});
|
|
23901
|
+
}
|
|
23713
23902
|
|
|
23714
23903
|
// src/actions/allocate.ts
|
|
23715
23904
|
var allocate_exports = {};
|
|
@@ -23721,27 +23910,6 @@ __export(allocate_exports, {
|
|
|
23721
23910
|
prepareDeallocate: () => prepareDeallocate,
|
|
23722
23911
|
prepareInternalTransfer: () => prepareInternalTransfer
|
|
23723
23912
|
});
|
|
23724
|
-
function encodeCall(abi, functionName, args) {
|
|
23725
|
-
return encodeFunctionData({
|
|
23726
|
-
abi,
|
|
23727
|
-
functionName,
|
|
23728
|
-
args
|
|
23729
|
-
});
|
|
23730
|
-
}
|
|
23731
|
-
function wrapInProxyCall(accountDiamondAbi, subAccount, callDatas) {
|
|
23732
|
-
const data = encodeFunctionData({
|
|
23733
|
-
abi: accountDiamondAbi,
|
|
23734
|
-
functionName: "_call",
|
|
23735
|
-
args: [subAccount, callDatas]
|
|
23736
|
-
});
|
|
23737
|
-
return {
|
|
23738
|
-
functionName: "_call",
|
|
23739
|
-
args: [subAccount, callDatas],
|
|
23740
|
-
data
|
|
23741
|
-
};
|
|
23742
|
-
}
|
|
23743
|
-
|
|
23744
|
-
// src/actions/allocate.ts
|
|
23745
23913
|
function prepareAllocate(multiAccount, account, subAccount, params) {
|
|
23746
23914
|
validateAmount(params.amount, "allocate amount");
|
|
23747
23915
|
const innerData = encodeFunctionData({
|
|
@@ -24631,6 +24799,169 @@ async function getOpenInstantCloses(chainId, account, accessToken) {
|
|
|
24631
24799
|
return response.json();
|
|
24632
24800
|
}
|
|
24633
24801
|
|
|
24802
|
+
// src/actions/instant-withdrawal.ts
|
|
24803
|
+
var instant_withdrawal_exports = {};
|
|
24804
|
+
__export(instant_withdrawal_exports, {
|
|
24805
|
+
getBridges: () => getBridges,
|
|
24806
|
+
getFeeOptions: () => getFeeOptions,
|
|
24807
|
+
getInstantWithdrawalBaseUrl: () => getInstantWithdrawalBaseUrl,
|
|
24808
|
+
getMaxInstantValue: () => getMaxInstantValue,
|
|
24809
|
+
getMe: () => getMe,
|
|
24810
|
+
getNonce: () => getNonce2,
|
|
24811
|
+
getPendingFeePolicy: () => getPendingFeePolicy,
|
|
24812
|
+
getSelectReceiverMessage: () => getSelectReceiverMessage,
|
|
24813
|
+
getSignInMessage: () => getSignInMessage,
|
|
24814
|
+
getWithdrawalConfig: () => getWithdrawalConfig,
|
|
24815
|
+
login: () => login2,
|
|
24816
|
+
selectFeePolicy: () => selectFeePolicy,
|
|
24817
|
+
unlockAccount: () => unlockAccount
|
|
24818
|
+
});
|
|
24819
|
+
function getInstantWithdrawalBaseUrl(chainId) {
|
|
24820
|
+
const baseUrl = INSTANT_WITHDRAWAL_BASE_URLS[chainId];
|
|
24821
|
+
if (!baseUrl) {
|
|
24822
|
+
throw new Error(
|
|
24823
|
+
`Instant withdrawal is not available on chain ${chainId}.`
|
|
24824
|
+
);
|
|
24825
|
+
}
|
|
24826
|
+
return baseUrl;
|
|
24827
|
+
}
|
|
24828
|
+
function buildUrl(chainId, path, query) {
|
|
24829
|
+
const url = new URL(path, getInstantWithdrawalBaseUrl(chainId));
|
|
24830
|
+
if (query) {
|
|
24831
|
+
for (const [key, value] of Object.entries(query)) {
|
|
24832
|
+
if (value !== void 0) url.searchParams.set(key, String(value));
|
|
24833
|
+
}
|
|
24834
|
+
}
|
|
24835
|
+
return url.href;
|
|
24836
|
+
}
|
|
24837
|
+
async function iwFetch(url, options) {
|
|
24838
|
+
const headers = {};
|
|
24839
|
+
if (options?.body !== void 0) {
|
|
24840
|
+
headers["Content-Type"] = "application/json";
|
|
24841
|
+
}
|
|
24842
|
+
if (options?.token) {
|
|
24843
|
+
headers.Authorization = `Bearer ${options.token}`;
|
|
24844
|
+
}
|
|
24845
|
+
const response = await fetch(url, {
|
|
24846
|
+
method: options?.method ?? "GET",
|
|
24847
|
+
headers,
|
|
24848
|
+
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
24849
|
+
});
|
|
24850
|
+
if (!response.ok) {
|
|
24851
|
+
const raw = await response.text().catch(() => "");
|
|
24852
|
+
let code;
|
|
24853
|
+
let message = "";
|
|
24854
|
+
let detail;
|
|
24855
|
+
if (raw) {
|
|
24856
|
+
try {
|
|
24857
|
+
const parsed = JSON.parse(raw);
|
|
24858
|
+
code = parsed.error_code;
|
|
24859
|
+
message = parsed.error_message ?? parsed.message ?? (typeof parsed.detail === "string" ? parsed.detail : "") ?? "";
|
|
24860
|
+
detail = parsed.error_detail ?? parsed.detail;
|
|
24861
|
+
} catch {
|
|
24862
|
+
message = raw;
|
|
24863
|
+
}
|
|
24864
|
+
}
|
|
24865
|
+
throw new InstantWithdrawalError(
|
|
24866
|
+
message || response.statusText || "Instant withdrawal request failed",
|
|
24867
|
+
{ code, status: response.status, detail }
|
|
24868
|
+
);
|
|
24869
|
+
}
|
|
24870
|
+
if (response.status === 204) return void 0;
|
|
24871
|
+
return response.json();
|
|
24872
|
+
}
|
|
24873
|
+
async function getNonce2(chainId, address) {
|
|
24874
|
+
const data = await iwFetch(
|
|
24875
|
+
buildUrl(chainId, "auth/nonce"),
|
|
24876
|
+
{ method: "POST", body: { address } }
|
|
24877
|
+
);
|
|
24878
|
+
return data.nonce;
|
|
24879
|
+
}
|
|
24880
|
+
async function getSignInMessage(chainId, params) {
|
|
24881
|
+
return iwFetch(
|
|
24882
|
+
buildUrl(chainId, "auth/sign-in-message", {
|
|
24883
|
+
address: params.address,
|
|
24884
|
+
domain: params.domain,
|
|
24885
|
+
uri: params.uri,
|
|
24886
|
+
statement: params.statement,
|
|
24887
|
+
version: params.version
|
|
24888
|
+
})
|
|
24889
|
+
);
|
|
24890
|
+
}
|
|
24891
|
+
async function login2(chainId, message, signature) {
|
|
24892
|
+
return iwFetch(buildUrl(chainId, "auth/login"), {
|
|
24893
|
+
method: "POST",
|
|
24894
|
+
body: { message, signature }
|
|
24895
|
+
});
|
|
24896
|
+
}
|
|
24897
|
+
async function getMe(chainId, token) {
|
|
24898
|
+
const data = await iwFetch(
|
|
24899
|
+
buildUrl(chainId, "auth/me"),
|
|
24900
|
+
{ token }
|
|
24901
|
+
);
|
|
24902
|
+
return data.address;
|
|
24903
|
+
}
|
|
24904
|
+
async function getFeeOptions(chainId, account, amount, token) {
|
|
24905
|
+
return iwFetch(
|
|
24906
|
+
buildUrl(chainId, "fee-options", {
|
|
24907
|
+
account,
|
|
24908
|
+
amount: amount.toString()
|
|
24909
|
+
}),
|
|
24910
|
+
{ method: "POST", token }
|
|
24911
|
+
);
|
|
24912
|
+
}
|
|
24913
|
+
async function unlockAccount(chainId, account, token) {
|
|
24914
|
+
return iwFetch(
|
|
24915
|
+
buildUrl(chainId, `unlock/${account}`),
|
|
24916
|
+
{ method: "POST", token }
|
|
24917
|
+
);
|
|
24918
|
+
}
|
|
24919
|
+
async function getPendingFeePolicy(chainId, account, token) {
|
|
24920
|
+
return iwFetch(
|
|
24921
|
+
buildUrl(chainId, `pending-fee-policy/${account}`),
|
|
24922
|
+
{ token }
|
|
24923
|
+
);
|
|
24924
|
+
}
|
|
24925
|
+
async function getMaxInstantValue(chainId, account, token) {
|
|
24926
|
+
const data = await iwFetch(
|
|
24927
|
+
buildUrl(chainId, `max-instant-value/${account}`),
|
|
24928
|
+
{ token }
|
|
24929
|
+
);
|
|
24930
|
+
return BigInt(data.amount);
|
|
24931
|
+
}
|
|
24932
|
+
async function getWithdrawalConfig(chainId) {
|
|
24933
|
+
const data = await iwFetch(
|
|
24934
|
+
buildUrl(chainId, "withdrawal-config")
|
|
24935
|
+
);
|
|
24936
|
+
return {
|
|
24937
|
+
operatorFee: data.operator_fee,
|
|
24938
|
+
maxInstantAmount: data.max_instant_amount,
|
|
24939
|
+
instantFeeRate: data.instant_fee_rate,
|
|
24940
|
+
policyValidTime: data.policy_valid_time,
|
|
24941
|
+
minWithdrawalCooldown: data.min_withdrawal_cooldown
|
|
24942
|
+
};
|
|
24943
|
+
}
|
|
24944
|
+
async function getSelectReceiverMessage(chainId, receiver, bridgeId) {
|
|
24945
|
+
return iwFetch(
|
|
24946
|
+
buildUrl(chainId, "get-select-receiver-message", {
|
|
24947
|
+
receiver,
|
|
24948
|
+
bridgeId
|
|
24949
|
+
})
|
|
24950
|
+
);
|
|
24951
|
+
}
|
|
24952
|
+
async function selectFeePolicy(chainId, body, token) {
|
|
24953
|
+
return iwFetch(
|
|
24954
|
+
buildUrl(chainId, "select-fee-policy"),
|
|
24955
|
+
{ method: "POST", token, body }
|
|
24956
|
+
);
|
|
24957
|
+
}
|
|
24958
|
+
async function getBridges(chainId, account, start, size, filters, token) {
|
|
24959
|
+
return iwFetch(
|
|
24960
|
+
buildUrl(chainId, `bridges/${account}/${start}/${size}`),
|
|
24961
|
+
{ method: "POST", token, body: filters }
|
|
24962
|
+
);
|
|
24963
|
+
}
|
|
24964
|
+
|
|
24634
24965
|
// src/actions/stats.ts
|
|
24635
24966
|
var stats_exports = {};
|
|
24636
24967
|
__export(stats_exports, {
|
|
@@ -25102,6 +25433,6 @@ function normalizeSymmUpnlWebSocketMessage(raw) {
|
|
|
25102
25433
|
};
|
|
25103
25434
|
}
|
|
25104
25435
|
|
|
25105
|
-
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 };
|
|
25436
|
+
export { ALL_TRADING_SELECTORS, AffiliateFeeLevel, ApprovalState, BridgeState, BridgeType, CHAIN_NAMES, CLEARING_HOUSE_ADDRESS, CLOSE_QUOTE_SELECTOR, COLLATERAL_ADDRESS, COLLATERAL_DECIMALS, ClearingHouseABI, ClearingHouseLiquidationStatus, DEFAULT_PARTY_B_ADDRESS, DEFAULT_PRECISION, ERC20ABI, FALLBACK_CHAIN_ID, INSTANT_WITHDRAWAL_ADDRESS, INSTANT_WITHDRAWAL_BASE_URLS, InstantCloseStatus, InstantWithdrawalABI, InstantWithdrawalError, InstantWithdrawalErrorCode, 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, instant_withdrawal_exports as instantWithdrawalActions, normalizeSymmUpnlWebSocketMessage, signature_exports as signatureActions, stats_exports as statsActions, toWei, trade_exports as tradeActions, validateAddress, validateAmount, validateChainId, validateDeadline, validateQuantity, withdraw_exports as withdrawActions, wrapInProxyCall };
|
|
25106
25437
|
//# sourceMappingURL=index.mjs.map
|
|
25107
25438
|
//# sourceMappingURL=index.mjs.map
|