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