UNPKG

@defuse-protocol/one-click-sdk-typescript

Version:
1,413 lines (1,351 loc) 51.2 kB
var __typeError = (msg) => { throw TypeError(msg); }; var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); // src/core/ApiError.ts var ApiError = class extends Error { constructor(request2, response, message) { super(message); this.name = "ApiError"; this.url = response.url; this.status = response.status; this.statusText = response.statusText; this.body = response.body; this.request = request2; } }; // src/core/CancelablePromise.ts var CancelError = class extends Error { constructor(message) { super(message); this.name = "CancelError"; } get isCancelled() { return true; } }; var _isResolved, _isRejected, _isCancelled, _cancelHandlers, _promise, _resolve, _reject; var CancelablePromise = class { constructor(executor) { __privateAdd(this, _isResolved); __privateAdd(this, _isRejected); __privateAdd(this, _isCancelled); __privateAdd(this, _cancelHandlers); __privateAdd(this, _promise); __privateAdd(this, _resolve); __privateAdd(this, _reject); __privateSet(this, _isResolved, false); __privateSet(this, _isRejected, false); __privateSet(this, _isCancelled, false); __privateSet(this, _cancelHandlers, []); __privateSet(this, _promise, new Promise((resolve2, reject) => { __privateSet(this, _resolve, resolve2); __privateSet(this, _reject, reject); const onResolve = (value) => { if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { return; } __privateSet(this, _isResolved, true); if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, value); }; const onReject = (reason) => { if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { return; } __privateSet(this, _isRejected, true); if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, reason); }; const onCancel = (cancelHandler) => { if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { return; } __privateGet(this, _cancelHandlers).push(cancelHandler); }; Object.defineProperty(onCancel, "isResolved", { get: () => __privateGet(this, _isResolved) }); Object.defineProperty(onCancel, "isRejected", { get: () => __privateGet(this, _isRejected) }); Object.defineProperty(onCancel, "isCancelled", { get: () => __privateGet(this, _isCancelled) }); return executor(onResolve, onReject, onCancel); })); } get [Symbol.toStringTag]() { return "Cancellable Promise"; } then(onFulfilled, onRejected) { return __privateGet(this, _promise).then(onFulfilled, onRejected); } catch(onRejected) { return __privateGet(this, _promise).catch(onRejected); } finally(onFinally) { return __privateGet(this, _promise).finally(onFinally); } cancel() { if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) { return; } __privateSet(this, _isCancelled, true); if (__privateGet(this, _cancelHandlers).length) { try { for (const cancelHandler of __privateGet(this, _cancelHandlers)) { cancelHandler(); } } catch (error) { console.warn("Cancellation threw an error", error); return; } } __privateGet(this, _cancelHandlers).length = 0; if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, new CancelError("Request aborted")); } get isCancelled() { return __privateGet(this, _isCancelled); } }; _isResolved = new WeakMap(); _isRejected = new WeakMap(); _isCancelled = new WeakMap(); _cancelHandlers = new WeakMap(); _promise = new WeakMap(); _resolve = new WeakMap(); _reject = new WeakMap(); // src/core/OpenAPI.ts var OpenAPI = { BASE: "https://1click.chaindefuser.com", VERSION: "0.1.10", WITH_CREDENTIALS: false, CREDENTIALS: "include", TOKEN: void 0, USERNAME: void 0, PASSWORD: void 0, HEADERS: void 0, ENCODE_PATH: void 0 }; // src/models/AnyInputQuoteWithdrawal.ts var AnyInputQuoteWithdrawal; ((AnyInputQuoteWithdrawal2) => { let status; ((status2) => { status2["SUCCESS"] = "SUCCESS"; status2["FAILED"] = "FAILED"; })(status = AnyInputQuoteWithdrawal2.status || (AnyInputQuoteWithdrawal2.status = {})); })(AnyInputQuoteWithdrawal || (AnyInputQuoteWithdrawal = {})); // src/models/AuthCall.ts var AuthCall; ((AuthCall2) => { let version; ((version2) => { version2["V1"] = "v1"; })(version = AuthCall2.version || (AuthCall2.version = {})); })(AuthCall || (AuthCall = {})); // src/models/BalanceEntry.ts var BalanceEntry; ((BalanceEntry2) => { let source; ((source2) => { source2["PRIVATE"] = "private"; })(source = BalanceEntry2.source || (BalanceEntry2.source = {})); })(BalanceEntry || (BalanceEntry = {})); // src/models/ChainDepositAddress.ts var ChainDepositAddress; ((ChainDepositAddress2) => { let blockchain; ((blockchain2) => { blockchain2["NEAR"] = "near"; blockchain2["ETH"] = "eth"; blockchain2["BASE"] = "base"; blockchain2["ARB"] = "arb"; blockchain2["BTC"] = "btc"; blockchain2["SOL"] = "sol"; blockchain2["TON"] = "ton"; blockchain2["DASH"] = "dash"; blockchain2["DOGE"] = "doge"; blockchain2["XRP"] = "xrp"; blockchain2["ZEC"] = "zec"; blockchain2["GNOSIS"] = "gnosis"; blockchain2["BERA"] = "bera"; blockchain2["BSC"] = "bsc"; blockchain2["POL"] = "pol"; blockchain2["TRON"] = "tron"; blockchain2["SUI"] = "sui"; blockchain2["MOVEMENT"] = "movement"; blockchain2["OP"] = "op"; blockchain2["AVAX"] = "avax"; blockchain2["STELLAR"] = "stellar"; blockchain2["APTOS"] = "aptos"; blockchain2["CARDANO"] = "cardano"; blockchain2["LTC"] = "ltc"; blockchain2["XLAYER"] = "xlayer"; blockchain2["MONAD"] = "monad"; blockchain2["BCH"] = "bch"; blockchain2["ADI"] = "adi"; blockchain2["PLASMA"] = "plasma"; blockchain2["SCROLL"] = "scroll"; blockchain2["STARKNET"] = "starknet"; blockchain2["ALEO"] = "aleo"; blockchain2["HYPERCORE"] = "hypercore"; })(blockchain = ChainDepositAddress2.blockchain || (ChainDepositAddress2.blockchain = {})); })(ChainDepositAddress || (ChainDepositAddress = {})); // src/models/GenerateSwapTransferIntentRequest.ts var GenerateSwapTransferIntentRequest; ((GenerateSwapTransferIntentRequest2) => { let type; ((type2) => { type2["SWAP_TRANSFER"] = "swap_transfer"; })(type = GenerateSwapTransferIntentRequest2.type || (GenerateSwapTransferIntentRequest2.type = {})); })(GenerateSwapTransferIntentRequest || (GenerateSwapTransferIntentRequest = {})); // src/models/GetExecutionStatusResponse.ts var GetExecutionStatusResponse; ((GetExecutionStatusResponse2) => { let status; ((status2) => { status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX"; status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT"; status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT"; status2["PROCESSING"] = "PROCESSING"; status2["SUCCESS"] = "SUCCESS"; status2["REFUNDED"] = "REFUNDED"; status2["FAILED"] = "FAILED"; })(status = GetExecutionStatusResponse2.status || (GetExecutionStatusResponse2.status = {})); })(GetExecutionStatusResponse || (GetExecutionStatusResponse = {})); // src/models/HistoryItem.ts var HistoryItem; ((HistoryItem2) => { let status; ((status2) => { status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT"; status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT"; status2["PROCESSING"] = "PROCESSING"; status2["SUCCESS"] = "SUCCESS"; status2["REFUNDED"] = "REFUNDED"; status2["FAILED"] = "FAILED"; })(status = HistoryItem2.status || (HistoryItem2.status = {})); let depositType; ((depositType2) => { depositType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN"; depositType2["INTENTS"] = "INTENTS"; depositType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(depositType = HistoryItem2.depositType || (HistoryItem2.depositType = {})); let recipientType; ((recipientType2) => { recipientType2["DESTINATION_CHAIN"] = "DESTINATION_CHAIN"; recipientType2["INTENTS"] = "INTENTS"; recipientType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(recipientType = HistoryItem2.recipientType || (HistoryItem2.recipientType = {})); let refundType; ((refundType2) => { refundType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN"; refundType2["INTENTS"] = "INTENTS"; refundType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(refundType = HistoryItem2.refundType || (HistoryItem2.refundType = {})); })(HistoryItem || (HistoryItem = {})); // src/models/Intent.ts var Intent; ((Intent2) => { let intent; ((intent2) => { intent2["ADD_PUBLIC_KEY"] = "add_public_key"; })(intent = Intent2.intent || (Intent2.intent = {})); let version; ((version2) => { version2["V1"] = "v1"; })(version = Intent2.version || (Intent2.version = {})); })(Intent || (Intent = {})); // src/models/IntentAddPublicKey.ts var IntentAddPublicKey; ((IntentAddPublicKey2) => { let intent; ((intent2) => { intent2["ADD_PUBLIC_KEY"] = "add_public_key"; })(intent = IntentAddPublicKey2.intent || (IntentAddPublicKey2.intent = {})); })(IntentAddPublicKey || (IntentAddPublicKey = {})); // src/models/IntentAuthCall.ts var IntentAuthCall; ((IntentAuthCall2) => { let intent; ((intent2) => { intent2["AUTH_CALL"] = "auth_call"; })(intent = IntentAuthCall2.intent || (IntentAuthCall2.intent = {})); let version; ((version2) => { version2["V1"] = "v1"; })(version = IntentAuthCall2.version || (IntentAuthCall2.version = {})); })(IntentAuthCall || (IntentAuthCall = {})); // src/models/IntentFtWithdraw.ts var IntentFtWithdraw; ((IntentFtWithdraw2) => { let intent; ((intent2) => { intent2["FT_WITHDRAW"] = "ft_withdraw"; })(intent = IntentFtWithdraw2.intent || (IntentFtWithdraw2.intent = {})); })(IntentFtWithdraw || (IntentFtWithdraw = {})); // src/models/IntentImtBurn.ts var IntentImtBurn; ((IntentImtBurn2) => { let intent; ((intent2) => { intent2["IMT_BURN"] = "imt_burn"; })(intent = IntentImtBurn2.intent || (IntentImtBurn2.intent = {})); })(IntentImtBurn || (IntentImtBurn = {})); // src/models/IntentImtMint.ts var IntentImtMint; ((IntentImtMint2) => { let intent; ((intent2) => { intent2["IMT_MINT"] = "imt_mint"; })(intent = IntentImtMint2.intent || (IntentImtMint2.intent = {})); let version; ((version2) => { version2["V1"] = "v1"; })(version = IntentImtMint2.version || (IntentImtMint2.version = {})); })(IntentImtMint || (IntentImtMint = {})); // src/models/IntentMtWithdraw.ts var IntentMtWithdraw; ((IntentMtWithdraw2) => { let intent; ((intent2) => { intent2["MT_WITHDRAW"] = "mt_withdraw"; })(intent = IntentMtWithdraw2.intent || (IntentMtWithdraw2.intent = {})); })(IntentMtWithdraw || (IntentMtWithdraw = {})); // src/models/IntentNativeWithdraw.ts var IntentNativeWithdraw; ((IntentNativeWithdraw2) => { let intent; ((intent2) => { intent2["NATIVE_WITHDRAW"] = "native_withdraw"; })(intent = IntentNativeWithdraw2.intent || (IntentNativeWithdraw2.intent = {})); })(IntentNativeWithdraw || (IntentNativeWithdraw = {})); // src/models/IntentNftWithdraw.ts var IntentNftWithdraw; ((IntentNftWithdraw2) => { let intent; ((intent2) => { intent2["NFT_WITHDRAW"] = "nft_withdraw"; })(intent = IntentNftWithdraw2.intent || (IntentNftWithdraw2.intent = {})); })(IntentNftWithdraw || (IntentNftWithdraw = {})); // src/models/IntentRemovePublicKey.ts var IntentRemovePublicKey; ((IntentRemovePublicKey2) => { let intent; ((intent2) => { intent2["REMOVE_PUBLIC_KEY"] = "remove_public_key"; })(intent = IntentRemovePublicKey2.intent || (IntentRemovePublicKey2.intent = {})); })(IntentRemovePublicKey || (IntentRemovePublicKey = {})); // src/models/IntentSetAuthByPredecessorId.ts var IntentSetAuthByPredecessorId; ((IntentSetAuthByPredecessorId2) => { let intent; ((intent2) => { intent2["SET_AUTH_BY_PREDECESSOR_ID"] = "set_auth_by_predecessor_id"; })(intent = IntentSetAuthByPredecessorId2.intent || (IntentSetAuthByPredecessorId2.intent = {})); })(IntentSetAuthByPredecessorId || (IntentSetAuthByPredecessorId = {})); // src/models/IntentStandardEnum.ts var IntentStandardEnum = /* @__PURE__ */ ((IntentStandardEnum2) => { IntentStandardEnum2["NEP413"] = "nep413"; IntentStandardEnum2["ERC191"] = "erc191"; IntentStandardEnum2["RAW_ED25519"] = "raw_ed25519"; IntentStandardEnum2["WEBAUTHN"] = "webauthn"; IntentStandardEnum2["TON_CONNECT"] = "ton_connect"; IntentStandardEnum2["SEP53"] = "sep53"; IntentStandardEnum2["TIP191"] = "tip191"; return IntentStandardEnum2; })(IntentStandardEnum || {}); // src/models/IntentStorageDeposit.ts var IntentStorageDeposit; ((IntentStorageDeposit2) => { let intent; ((intent2) => { intent2["STORAGE_DEPOSIT"] = "storage_deposit"; })(intent = IntentStorageDeposit2.intent || (IntentStorageDeposit2.intent = {})); })(IntentStorageDeposit || (IntentStorageDeposit = {})); // src/models/IntentTokenDiff.ts var IntentTokenDiff; ((IntentTokenDiff2) => { let intent; ((intent2) => { intent2["TOKEN_DIFF"] = "token_diff"; })(intent = IntentTokenDiff2.intent || (IntentTokenDiff2.intent = {})); })(IntentTokenDiff || (IntentTokenDiff = {})); // src/models/IntentTransfer.ts var IntentTransfer; ((IntentTransfer2) => { let intent; ((intent2) => { intent2["TRANSFER"] = "transfer"; })(intent = IntentTransfer2.intent || (IntentTransfer2.intent = {})); let version; ((version2) => { version2["V1"] = "v1"; })(version = IntentTransfer2.version || (IntentTransfer2.version = {})); })(IntentTransfer || (IntentTransfer = {})); // src/models/InvariantViolated.ts var InvariantViolated; ((InvariantViolated2) => { let error; ((error2) => { error2["UNMATCHED_DELTAS"] = "unmatched_deltas"; })(error = InvariantViolated2.error || (InvariantViolated2.error = {})); })(InvariantViolated || (InvariantViolated = {})); // src/models/InvariantViolatedOverflow.ts var InvariantViolatedOverflow; ((InvariantViolatedOverflow2) => { let error; ((error2) => { error2["OVERFLOW"] = "overflow"; })(error = InvariantViolatedOverflow2.error || (InvariantViolatedOverflow2.error = {})); })(InvariantViolatedOverflow || (InvariantViolatedOverflow = {})); // src/models/InvariantViolatedUnmatchedDeltas.ts var InvariantViolatedUnmatchedDeltas; ((InvariantViolatedUnmatchedDeltas2) => { let error; ((error2) => { error2["UNMATCHED_DELTAS"] = "unmatched_deltas"; })(error = InvariantViolatedUnmatchedDeltas2.error || (InvariantViolatedUnmatchedDeltas2.error = {})); })(InvariantViolatedUnmatchedDeltas || (InvariantViolatedUnmatchedDeltas = {})); // src/models/MultiPayload.ts var MultiPayload; ((MultiPayload2) => { let standard; ((standard2) => { standard2["NEP413"] = "nep413"; })(standard = MultiPayload2.standard || (MultiPayload2.standard = {})); let type; ((type2) => { type2["TEXT"] = "text"; })(type = MultiPayload2.type || (MultiPayload2.type = {})); })(MultiPayload || (MultiPayload = {})); // src/models/MultiPayload__Parsed.ts var MultiPayload__Parsed; ((MultiPayload__Parsed2) => { let standard; ((standard2) => { standard2["NEP413"] = "nep413"; })(standard = MultiPayload__Parsed2.standard || (MultiPayload__Parsed2.standard = {})); let type; ((type2) => { type2["TEXT"] = "text"; })(type = MultiPayload__Parsed2.type || (MultiPayload__Parsed2.type = {})); })(MultiPayload__Parsed || (MultiPayload__Parsed = {})); // src/models/MultiPayloadErc191.ts var MultiPayloadErc191; ((MultiPayloadErc1912) => { let standard; ((standard2) => { standard2["ERC191"] = "erc191"; })(standard = MultiPayloadErc1912.standard || (MultiPayloadErc1912.standard = {})); })(MultiPayloadErc191 || (MultiPayloadErc191 = {})); // src/models/MultiPayloadErc191__Parsed.ts var MultiPayloadErc191__Parsed; ((MultiPayloadErc191__Parsed2) => { let standard; ((standard2) => { standard2["ERC191"] = "erc191"; })(standard = MultiPayloadErc191__Parsed2.standard || (MultiPayloadErc191__Parsed2.standard = {})); })(MultiPayloadErc191__Parsed || (MultiPayloadErc191__Parsed = {})); // src/models/MultiPayloadNarrowed__Parsed.ts var MultiPayloadNarrowed__Parsed; ((MultiPayloadNarrowed__Parsed2) => { let standard; ((standard2) => { standard2["NEP413"] = "nep413"; })(standard = MultiPayloadNarrowed__Parsed2.standard || (MultiPayloadNarrowed__Parsed2.standard = {})); let type; ((type2) => { type2["TEXT"] = "text"; })(type = MultiPayloadNarrowed__Parsed2.type || (MultiPayloadNarrowed__Parsed2.type = {})); })(MultiPayloadNarrowed__Parsed || (MultiPayloadNarrowed__Parsed = {})); // src/models/MultiPayloadNep413.ts var MultiPayloadNep413; ((MultiPayloadNep4132) => { let standard; ((standard2) => { standard2["NEP413"] = "nep413"; })(standard = MultiPayloadNep4132.standard || (MultiPayloadNep4132.standard = {})); })(MultiPayloadNep413 || (MultiPayloadNep413 = {})); // src/models/MultiPayloadNep413__Parsed.ts var MultiPayloadNep413__Parsed; ((MultiPayloadNep413__Parsed2) => { let standard; ((standard2) => { standard2["NEP413"] = "nep413"; })(standard = MultiPayloadNep413__Parsed2.standard || (MultiPayloadNep413__Parsed2.standard = {})); })(MultiPayloadNep413__Parsed || (MultiPayloadNep413__Parsed = {})); // src/models/MultiPayloadRawEd25519.ts var MultiPayloadRawEd25519; ((MultiPayloadRawEd255192) => { let standard; ((standard2) => { standard2["RAW_ED25519"] = "raw_ed25519"; })(standard = MultiPayloadRawEd255192.standard || (MultiPayloadRawEd255192.standard = {})); })(MultiPayloadRawEd25519 || (MultiPayloadRawEd25519 = {})); // src/models/MultiPayloadRawEd25519__Parsed.ts var MultiPayloadRawEd25519__Parsed; ((MultiPayloadRawEd25519__Parsed2) => { let standard; ((standard2) => { standard2["RAW_ED25519"] = "raw_ed25519"; })(standard = MultiPayloadRawEd25519__Parsed2.standard || (MultiPayloadRawEd25519__Parsed2.standard = {})); })(MultiPayloadRawEd25519__Parsed || (MultiPayloadRawEd25519__Parsed = {})); // src/models/MultiPayloadSep53.ts var MultiPayloadSep53; ((MultiPayloadSep532) => { let standard; ((standard2) => { standard2["SEP53"] = "sep53"; })(standard = MultiPayloadSep532.standard || (MultiPayloadSep532.standard = {})); })(MultiPayloadSep53 || (MultiPayloadSep53 = {})); // src/models/MultiPayloadSep53__Parsed.ts var MultiPayloadSep53__Parsed; ((MultiPayloadSep53__Parsed2) => { let standard; ((standard2) => { standard2["SEP53"] = "sep53"; })(standard = MultiPayloadSep53__Parsed2.standard || (MultiPayloadSep53__Parsed2.standard = {})); })(MultiPayloadSep53__Parsed || (MultiPayloadSep53__Parsed = {})); // src/models/MultiPayloadTip191.ts var MultiPayloadTip191; ((MultiPayloadTip1912) => { let standard; ((standard2) => { standard2["TIP191"] = "tip191"; })(standard = MultiPayloadTip1912.standard || (MultiPayloadTip1912.standard = {})); })(MultiPayloadTip191 || (MultiPayloadTip191 = {})); // src/models/MultiPayloadTip191__Parsed.ts var MultiPayloadTip191__Parsed; ((MultiPayloadTip191__Parsed2) => { let standard; ((standard2) => { standard2["TIP191"] = "tip191"; })(standard = MultiPayloadTip191__Parsed2.standard || (MultiPayloadTip191__Parsed2.standard = {})); })(MultiPayloadTip191__Parsed || (MultiPayloadTip191__Parsed = {})); // src/models/MultiPayloadTonConnect.ts var MultiPayloadTonConnect; ((MultiPayloadTonConnect2) => { let type; ((type2) => { type2["TEXT"] = "text"; })(type = MultiPayloadTonConnect2.type || (MultiPayloadTonConnect2.type = {})); let standard; ((standard2) => { standard2["TON_CONNECT"] = "ton_connect"; })(standard = MultiPayloadTonConnect2.standard || (MultiPayloadTonConnect2.standard = {})); })(MultiPayloadTonConnect || (MultiPayloadTonConnect = {})); // src/models/MultiPayloadTonConnect__Parsed.ts var MultiPayloadTonConnect__Parsed; ((MultiPayloadTonConnect__Parsed2) => { let type; ((type2) => { type2["TEXT"] = "text"; })(type = MultiPayloadTonConnect__Parsed2.type || (MultiPayloadTonConnect__Parsed2.type = {})); let standard; ((standard2) => { standard2["TON_CONNECT"] = "ton_connect"; })(standard = MultiPayloadTonConnect__Parsed2.standard || (MultiPayloadTonConnect__Parsed2.standard = {})); })(MultiPayloadTonConnect__Parsed || (MultiPayloadTonConnect__Parsed = {})); // src/models/MultiPayloadWebauthnEd25519.ts var MultiPayloadWebauthnEd25519; ((MultiPayloadWebauthnEd255192) => { let standard; ((standard2) => { standard2["WEBAUTHN"] = "webauthn"; })(standard = MultiPayloadWebauthnEd255192.standard || (MultiPayloadWebauthnEd255192.standard = {})); })(MultiPayloadWebauthnEd25519 || (MultiPayloadWebauthnEd25519 = {})); // src/models/MultiPayloadWebauthnEd25519__Parsed.ts var MultiPayloadWebauthnEd25519__Parsed; ((MultiPayloadWebauthnEd25519__Parsed2) => { let standard; ((standard2) => { standard2["WEBAUTHN"] = "webauthn"; })(standard = MultiPayloadWebauthnEd25519__Parsed2.standard || (MultiPayloadWebauthnEd25519__Parsed2.standard = {})); })(MultiPayloadWebauthnEd25519__Parsed || (MultiPayloadWebauthnEd25519__Parsed = {})); // src/models/MultiPayloadWebauthnP256.ts var MultiPayloadWebauthnP256; ((MultiPayloadWebauthnP2562) => { let standard; ((standard2) => { standard2["WEBAUTHN"] = "webauthn"; })(standard = MultiPayloadWebauthnP2562.standard || (MultiPayloadWebauthnP2562.standard = {})); })(MultiPayloadWebauthnP256 || (MultiPayloadWebauthnP256 = {})); // src/models/MultiPayloadWebauthnP256__Parsed.ts var MultiPayloadWebauthnP256__Parsed; ((MultiPayloadWebauthnP256__Parsed2) => { let standard; ((standard2) => { standard2["WEBAUTHN"] = "webauthn"; })(standard = MultiPayloadWebauthnP256__Parsed2.standard || (MultiPayloadWebauthnP256__Parsed2.standard = {})); })(MultiPayloadWebauthnP256__Parsed || (MultiPayloadWebauthnP256__Parsed = {})); // src/models/QuoteRequest.ts var QuoteRequest; ((QuoteRequest2) => { let depositMode; ((depositMode2) => { depositMode2["SIMPLE"] = "SIMPLE"; depositMode2["MEMO"] = "MEMO"; })(depositMode = QuoteRequest2.depositMode || (QuoteRequest2.depositMode = {})); let swapType; ((swapType2) => { swapType2["EXACT_INPUT"] = "EXACT_INPUT"; swapType2["EXACT_OUTPUT"] = "EXACT_OUTPUT"; swapType2["FLEX_INPUT"] = "FLEX_INPUT"; swapType2["ANY_INPUT"] = "ANY_INPUT"; })(swapType = QuoteRequest2.swapType || (QuoteRequest2.swapType = {})); let depositType; ((depositType2) => { depositType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN"; depositType2["INTENTS"] = "INTENTS"; depositType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(depositType = QuoteRequest2.depositType || (QuoteRequest2.depositType = {})); let refundType; ((refundType2) => { refundType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN"; refundType2["INTENTS"] = "INTENTS"; refundType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(refundType = QuoteRequest2.refundType || (QuoteRequest2.refundType = {})); let recipientType; ((recipientType2) => { recipientType2["DESTINATION_CHAIN"] = "DESTINATION_CHAIN"; recipientType2["INTENTS"] = "INTENTS"; recipientType2["CONFIDENTIAL_INTENTS"] = "CONFIDENTIAL_INTENTS"; })(recipientType = QuoteRequest2.recipientType || (QuoteRequest2.recipientType = {})); let confidentiality; ((confidentiality2) => { confidentiality2["PUBLIC"] = "public"; confidentiality2["BASIC"] = "basic"; confidentiality2["ADVANCED"] = "advanced"; })(confidentiality = QuoteRequest2.confidentiality || (QuoteRequest2.confidentiality = {})); })(QuoteRequest || (QuoteRequest = {})); // src/models/SimulationOutput.ts var SimulationOutput; ((SimulationOutput2) => { let error; ((error2) => { error2["UNMATCHED_DELTAS"] = "unmatched_deltas"; })(error = SimulationOutput2.error || (SimulationOutput2.error = {})); })(SimulationOutput || (SimulationOutput = {})); // src/models/StateInit.ts var StateInit; ((StateInit2) => { let version; ((version2) => { version2["V1"] = "v1"; })(version = StateInit2.version || (StateInit2.version = {})); })(StateInit || (StateInit = {})); // src/models/StateInitV1.ts var StateInitV1; ((StateInitV12) => { let version; ((version2) => { version2["V1"] = "v1"; })(version = StateInitV12.version || (StateInitV12.version = {})); })(StateInitV1 || (StateInitV1 = {})); // src/models/SubmitDepositTxResponse.ts var SubmitDepositTxResponse; ((SubmitDepositTxResponse2) => { let status; ((status2) => { status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX"; status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT"; status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT"; status2["PROCESSING"] = "PROCESSING"; status2["SUCCESS"] = "SUCCESS"; status2["REFUNDED"] = "REFUNDED"; status2["FAILED"] = "FAILED"; })(status = SubmitDepositTxResponse2.status || (SubmitDepositTxResponse2.status = {})); })(SubmitDepositTxResponse || (SubmitDepositTxResponse = {})); // src/models/SubmitSwapTransferIntentRequest.ts var SubmitSwapTransferIntentRequest; ((SubmitSwapTransferIntentRequest2) => { let type; ((type2) => { type2["SWAP_TRANSFER"] = "swap_transfer"; })(type = SubmitSwapTransferIntentRequest2.type || (SubmitSwapTransferIntentRequest2.type = {})); })(SubmitSwapTransferIntentRequest || (SubmitSwapTransferIntentRequest = {})); // src/models/TokenResponse.ts var TokenResponse; ((TokenResponse2) => { let blockchain; ((blockchain2) => { blockchain2["NEAR"] = "near"; blockchain2["ETH"] = "eth"; blockchain2["BASE"] = "base"; blockchain2["ARB"] = "arb"; blockchain2["BTC"] = "btc"; blockchain2["SOL"] = "sol"; blockchain2["TON"] = "ton"; blockchain2["DASH"] = "dash"; blockchain2["DOGE"] = "doge"; blockchain2["XRP"] = "xrp"; blockchain2["ZEC"] = "zec"; blockchain2["GNOSIS"] = "gnosis"; blockchain2["BERA"] = "bera"; blockchain2["BSC"] = "bsc"; blockchain2["POL"] = "pol"; blockchain2["TRON"] = "tron"; blockchain2["SUI"] = "sui"; blockchain2["MOVEMENT"] = "movement"; blockchain2["OP"] = "op"; blockchain2["AVAX"] = "avax"; blockchain2["STELLAR"] = "stellar"; blockchain2["APTOS"] = "aptos"; blockchain2["CARDANO"] = "cardano"; blockchain2["LTC"] = "ltc"; blockchain2["XLAYER"] = "xlayer"; blockchain2["MONAD"] = "monad"; blockchain2["BCH"] = "bch"; blockchain2["ADI"] = "adi"; blockchain2["PLASMA"] = "plasma"; blockchain2["SCROLL"] = "scroll"; blockchain2["STARKNET"] = "starknet"; blockchain2["ALEO"] = "aleo"; blockchain2["HYPERCORE"] = "hypercore"; })(blockchain = TokenResponse2.blockchain || (TokenResponse2.blockchain = {})); })(TokenResponse || (TokenResponse = {})); // src/models/TonConnectPayloadSchema.ts var TonConnectPayloadSchema; ((TonConnectPayloadSchema2) => { let type; ((type2) => { type2["TEXT"] = "text"; })(type = TonConnectPayloadSchema2.type || (TonConnectPayloadSchema2.type = {})); })(TonConnectPayloadSchema || (TonConnectPayloadSchema = {})); // src/models/TonConnectPayloadSchema__Parsed.ts var TonConnectPayloadSchema__Parsed; ((TonConnectPayloadSchema__Parsed2) => { let type; ((type2) => { type2["TEXT"] = "text"; })(type = TonConnectPayloadSchema__Parsed2.type || (TonConnectPayloadSchema__Parsed2.type = {})); })(TonConnectPayloadSchema__Parsed || (TonConnectPayloadSchema__Parsed = {})); // src/models/TonConnectPayloadSchemaText.ts var TonConnectPayloadSchemaText; ((TonConnectPayloadSchemaText2) => { let type; ((type2) => { type2["TEXT"] = "text"; })(type = TonConnectPayloadSchemaText2.type || (TonConnectPayloadSchemaText2.type = {})); })(TonConnectPayloadSchemaText || (TonConnectPayloadSchemaText = {})); // src/core/request.ts import axios from "axios"; import FormData from "form-data"; var isDefined = (value) => { return value !== void 0 && value !== null; }; var isString = (value) => { return typeof value === "string"; }; var isStringWithValue = (value) => { return isString(value) && value !== ""; }; var isBlob = (value) => { return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]); }; var isFormData = (value) => { return value instanceof FormData; }; var isSuccess = (status) => { return status >= 200 && status < 300; }; var base64 = (str) => { try { return btoa(str); } catch (err) { return Buffer.from(str).toString("base64"); } }; var getQueryString = (params) => { const qs = []; const append = (key, value) => { qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); }; const process = (key, value) => { if (isDefined(value)) { if (Array.isArray(value)) { value.forEach((v) => { process(key, v); }); } else if (typeof value === "object") { Object.entries(value).forEach(([k, v]) => { process(`${key}[${k}]`, v); }); } else { append(key, value); } } }; Object.entries(params).forEach(([key, value]) => { process(key, value); }); if (qs.length > 0) { return `?${qs.join("&")}`; } return ""; }; var getUrl = (config, options) => { const encoder = config.ENCODE_PATH || encodeURI; const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => { if (options.path?.hasOwnProperty(group)) { return encoder(String(options.path[group])); } return substring; }); const url = `${config.BASE}${path}`; if (options.query) { return `${url}${getQueryString(options.query)}`; } return url; }; var getFormData = (options) => { if (options.formData) { const formData = new FormData(); const process = (key, value) => { if (isString(value) || isBlob(value)) { formData.append(key, value); } else { formData.append(key, JSON.stringify(value)); } }; Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => { if (Array.isArray(value)) { value.forEach((v) => process(key, v)); } else { process(key, value); } }); return formData; } return void 0; }; var resolve = async (options, resolver) => { if (typeof resolver === "function") { return resolver(options); } return resolver; }; var getHeaders = async (config, options, formData) => { const [token, username, password, additionalHeaders] = await Promise.all([ resolve(options, config.TOKEN), resolve(options, config.USERNAME), resolve(options, config.PASSWORD), resolve(options, config.HEADERS) ]); const formHeaders = typeof formData?.getHeaders === "function" && formData?.getHeaders() || {}; const headers = Object.entries({ Accept: "application/json", ...additionalHeaders, ...options.headers, ...formHeaders }).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({ ...headers2, [key]: String(value) }), {}); if (isStringWithValue(token)) { headers["Authorization"] = `Bearer ${token}`; } if (isStringWithValue(username) && isStringWithValue(password)) { const credentials = base64(`${username}:${password}`); headers["Authorization"] = `Basic ${credentials}`; } if (options.body !== void 0) { if (options.mediaType) { headers["Content-Type"] = options.mediaType; } else if (isBlob(options.body)) { headers["Content-Type"] = options.body.type || "application/octet-stream"; } else if (isString(options.body)) { headers["Content-Type"] = "text/plain"; } else if (!isFormData(options.body)) { headers["Content-Type"] = "application/json"; } } return headers; }; var getRequestBody = (options) => { if (options.body) { return options.body; } return void 0; }; var sendRequest = async (config, options, url, body, formData, headers, onCancel, axiosClient) => { const source = axios.CancelToken.source(); const requestConfig = { url, headers, data: body ?? formData, method: options.method, withCredentials: config.WITH_CREDENTIALS, withXSRFToken: config.CREDENTIALS === "include" ? config.WITH_CREDENTIALS : false, cancelToken: source.token }; onCancel(() => source.cancel("The user aborted a request.")); try { return await axiosClient.request(requestConfig); } catch (error) { const axiosError = error; if (axiosError.response) { return axiosError.response; } throw error; } }; var getResponseHeader = (response, responseHeader) => { if (responseHeader) { const content = response.headers[responseHeader]; if (isString(content)) { return content; } } return void 0; }; var getResponseBody = (response) => { if (response.status !== 204) { return response.data; } return void 0; }; var catchErrorCodes = (options, result) => { const errors = { 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", 500: "Internal Server Error", 502: "Bad Gateway", 503: "Service Unavailable", ...options.errors }; const error = errors[result.status]; if (error) { throw new ApiError(options, result, error); } if (!result.ok) { const errorStatus = result.status ?? "unknown"; const errorStatusText = result.statusText ?? "unknown"; const errorBody = (() => { try { return JSON.stringify(result.body, null, 2); } catch (e) { return void 0; } })(); throw new ApiError( options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` ); } }; var request = (config, options, axiosClient = axios) => { return new CancelablePromise(async (resolve2, reject, onCancel) => { try { const url = getUrl(config, options); const formData = getFormData(options); const body = getRequestBody(options); const headers = await getHeaders(config, options, formData); if (!onCancel.isCancelled) { const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient); const responseBody = getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); const result = { url, ok: isSuccess(response.status), status: response.status, statusText: response.statusText, body: responseHeader ?? responseBody }; catchErrorCodes(options, result); resolve2(result.body); } } catch (error) { reject(error); } }); }; // src/services/AccountService.ts var AccountService = class { /** * Get user token balances * Returns token balances for the authenticated user from private balance sources * @param tokenIds Comma-separated list of token IDs to query. If empty, returns all non-zero balances. * @returns GetBalancesResponse * @throws ApiError */ static getBalances(tokenIds) { return request(OpenAPI, { method: "GET", url: "/v0/account/balances", query: { "tokenIds": tokenIds }, errors: { 401: `Unauthorized - User session token is invalid or expired` } }); } /** * Get transaction history * Returns paginated public and confidential transaction history. For the initial request, omit both nextCursor and prevCursor to retrieve the latest history. For subsequent requests, pass either nextCursor or prevCursor from the previous response. * @param prevCursor Pass the prevCursor value from a previous response to fetch older items. Omit both cursors for the initial request. Do not pass together with nextCursor. * @param nextCursor Pass the nextCursor value from a previous response to poll for newer items. Omit both cursors for the initial request. Do not pass together with prevCursor. * @param status Filter by statuses * @param limit Maximum number of items to return per page * @param depositAddress Filter by deposit address * @param depositMemo Filter by deposit memo. Only has effect when depositAddress is also provided. * @param search Search by deposit address, recipient, sender, or tx hash * @param depositType Correlated deposit type filter. Index-aligned with recipientType and refundType. Use "null" as a wildcard for that position. Multiple values form OR conditions. * @param recipientType Correlated recipient type filter. Index-aligned with depositType and refundType. Use "null" as a wildcard for that position. * @param refundType Correlated refund type filter. Index-aligned with depositType and recipientType. Use "null" as a wildcard for that position. * @returns HistoryResponse * @throws ApiError */ static getHistory(prevCursor, nextCursor, status, limit = 20, depositAddress, depositMemo, search, depositType, recipientType, refundType) { return request(OpenAPI, { method: "GET", url: "/v0/account/history", query: { "prevCursor": prevCursor, "nextCursor": nextCursor, "status": status, "limit": limit, "depositAddress": depositAddress, "depositMemo": depositMemo, "search": search, "depositType": depositType, "recipientType": recipientType, "refundType": refundType }, errors: { 401: `Unauthorized - supplied user session token is invalid or expired` } }); } }; // src/services/OneClickService.ts var OneClickService = class { /** * Get supported tokens * Retrieves a list of tokens currently supported by the 1Click API for asset swaps. * * Each token entry includes its blockchain, contract address (if available), price in USD, and other metadata such as symbol and decimals. * @returns TokenResponse * @throws ApiError */ static getTokens() { return request(OpenAPI, { method: "GET", url: "/v0/tokens" }); } /** * Request a swap quote * Generates a swap quote based on input parameters such as the assets, amount, slippage tolerance, and recipient/refund information. * * Returns pricing details, estimated time, and a unique **deposit address** to which tokens must be transferred to initiate the swap. * * You can set the `dry` parameter to `true` to simulate the quote request **without generating a deposit address** or initiating the swap process. This is useful for previewing swap parameters or validating input data without committing to an actual swap. * * This endpoint is the first required step in the swap process. * @param requestBody * @returns QuoteResponse * @throws ApiError */ static getQuote(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/quote", body: requestBody, mediaType: "application/json", errors: { 400: `Bad Request - Invalid input data`, 401: `Unauthorized - API key or JWT token is invalid` } }); } /** * Check swap execution status * Retrieves the current status of a swap using the unique deposit address from the quote, if quote response included deposit memo, it is required as well. * * The response includes the state of the swap (e.g., pending, processing, success, refunded) and any associated swap and transaction details. * @param depositAddress * @param depositMemo * @returns GetExecutionStatusResponse * @throws ApiError */ static getExecutionStatus(depositAddress, depositMemo) { return request(OpenAPI, { method: "GET", url: "/v0/status", query: { "depositAddress": depositAddress, "depositMemo": depositMemo }, errors: { 401: `Unauthorized - API key or JWT token is invalid`, 404: `Deposit address not found` } }); } /** * Get ANY_INPUT withdrawals * Retrieves all withdrawals by ANY_INPUT quote with filtering, pagination and sorting * @param depositAddress * @param depositMemo * @param timestampFrom Filter withdrawals from this timestamp (ISO string) * @param page Page number for pagination (default: 1) * @param limit Number of withdrawals per page (max: 50, default: 50) * @param sortOrder Sort order * @returns GetAnyInputQuoteWithdrawals * @throws ApiError */ static getAnyInputQuoteWithdrawals(depositAddress, depositMemo, timestampFrom, page, limit, sortOrder) { return request(OpenAPI, { method: "GET", url: "/v0/any-input/withdrawals", query: { "depositAddress": depositAddress, "depositMemo": depositMemo, "timestampFrom": timestampFrom, "page": page, "limit": limit, "sortOrder": sortOrder }, errors: { 401: `Unauthorized - API key or JWT token is invalid`, 404: `Deposit address not found` } }); } /** * Submit deposit transaction hash * Optionally notifies the 1Click service that a deposit has been sent to the specified address, using the blockchain transaction hash. * * This step can speed up swap processing by allowing the system to preemptively verify the deposit. * @param requestBody * @returns SubmitDepositTxResponse * @throws ApiError */ static submitDepositTx(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/deposit/submit", body: requestBody, mediaType: "application/json", errors: { 400: `Bad Request - Invalid input data`, 401: `Unauthorized - API key or JWT token is invalid` } }); } /** * Generate an intent for signing * Generates an unsigned intent payload that needs to be signed by the user. * * This endpoint takes a quote's deposit address and other parameters, validates the quote state, and returns an intent payload formatted according to the specified signing standard (e.g., NEP413, ERC191). * * The generated intent must be signed by the user's wallet and then submitted via the `/submit-intent` endpoint to complete the action (e.g. swap). * * **Request Type Variants:** * - `swap_transfer`: Generate an intent for a swap operation (requires depositAddress, signerId, standard) * @param requestBody * @returns GenerateIntentResponse Successfully generated intent payload * @throws ApiError */ static generateIntent(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/generate-intent", body: requestBody, mediaType: "application/json", errors: { 400: `Bad Request - Invalid input or quote state`, 401: `Unauthorized - API key or JWT token is invalid` } }); } /** * Submit a signed intent * Submits a signed intent to execute. * * After generating an intent via `/generate-intent` and having the user sign it with their wallet, submit the signed intent through this endpoint. * * The system validates the signature, processes the intent, and returns the intent hash upon successful submission. * * **Request Type Variants:** * - `swap_transfer`: Submit a signed swap intent (requires signedData object) * @param requestBody * @returns SubmitIntentResponse Successfully submitted intent * @throws ApiError */ static submitIntent(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/submit-intent", body: requestBody, mediaType: "application/json", errors: { 400: `Bad Request - Invalid signature or intent data`, 401: `Unauthorized - API key or JWT token is invalid` } }); } }; // src/services/UserAuthService.ts var UserAuthService = class { /** * Authenticate user with signed data * Verifies wallet signature and issues session tokens * @param requestBody * @returns AuthenticateResponseDto * @throws ApiError */ static authenticate(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/auth/authenticate", body: requestBody, mediaType: "application/json", errors: { 400: `Invalid signed data`, 401: `Signature verification failed` } }); } /** * Refresh access token * Exchange refresh token for a new access token * @param requestBody * @returns RefreshResponseDto * @throws ApiError */ static refresh(requestBody) { return request(OpenAPI, { method: "POST", url: "/v0/auth/refresh", body: requestBody, mediaType: "application/json", errors: { 401: `Invalid or expired refresh token` } }); } }; // src/quote-signature.ts import { sha256 } from "@noble/hashes/sha2"; import { base58 } from "@scure/base"; import stringify from "json-stable-stringify"; import nacl from "tweetnacl"; var ED25519_PREFIX = "ed25519:"; var ONE_CLICK_MANAGER_PUB_KEY = "ed25519:reYaWhvwu8Jzo3WUM3zhn6VrhuMEF4eADL17qtRVifc"; function buildSignedQuoteRequest(response) { const { quoteRequest } = response; return { dry: quoteRequest.dry, swapType: quoteRequest.swapType, slippageTolerance: quoteRequest.slippageTolerance, originAsset: quoteRequest.originAsset, depositType: quoteRequest.depositType, destinationAsset: quoteRequest.destinationAsset, amount: quoteRequest.amount, refundTo: quoteRequest.refundTo, refundType: quoteRequest.refundType, recipient: quoteRequest.recipient, recipientType: quoteRequest.recipientType, deadline: quoteRequest.deadline, quoteWaitingTimeMs: quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : void 0, referral: quoteRequest.referral ? quoteRequest.referral : void 0, virtualChainRecipient: quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : void 0, virtualChainRefundRecipient: quoteRequest.virtualChainRefundRecipient ? quoteRequest.virtualChainRefundRecipient : void 0, customRecipientMsg: quoteRequest.customRecipientMsg ? quoteRequest.customRecipientMsg : void 0, sessionId: void 0, connectedWallets: void 0, correlationId: void 0, appFees: void 0, partnerId: void 0, userAccountId: void 0, depositMode: void 0 }; } function buildSignedQuote(response) { const { quote } = response; const dry = response.quoteRequest.dry; if (dry) { return { amountIn: quote.amountIn, amountInFormatted: quote.amountInFormatted, amountInUsd: quote.amountInUsd, minAmountIn: quote.minAmountIn, amountOut: quote.amountOut, amountOutFormatted: quote.amountOutFormatted, amountOutUsd: quote.amountOutUsd, minAmountOut: quote.minAmountOut }; } return { amountIn: quote.amountIn, amountInFormatted: quote.amountInFormatted, amountInUsd: quote.amountInUsd, minAmountIn: quote.minAmountIn, amountOut: quote.amountOut, amountOutFormatted: quote.amountOutFormatted, amountOutUsd: quote.amountOutUsd, minAmountOut: quote.minAmountOut, depositAddress: quote.depositAddress || void 0, depositMemo: quote.depositMemo || void 0, deadline: quote.deadline || void 0, timeWhenInactive: quote.timeWhenInactive || void 0, timeEstimate: quote.timeEstimate || void 0, virtualChainRecipient: quote.virtualChainRecipient || void 0, virtualChainRefundRecipient: quote.virtualChainRefundRecipient || void 0, customRecipientMsg: quote.customRecipientMsg || void 0, refundFee: quote.refundFee || void 0, withdrawFee: quote.withdrawFee || void 0 }; } function hashQuote(request2, quote, timestamp) { const dataString = stringify({ ...request2, ...quote, timestamp }); return base58.encode(sha256(new TextEncoder().encode(dataString))); } function quoteHash(response) { return hashQuote( buildSignedQuoteRequest(response), buildSignedQuote(response), response.timestamp ); } function verifyQuoteSignature(response, managerPublicKey = ONE_CLICK_MANAGER_PUB_KEY) { try { const signatureBytes = decodeEd25519Base58(response.signature); const publicKeyBytes = decodeEd25519Base58(managerPublicKey); const message = new TextEncoder().encode(quoteHash(response)); return nacl.sign.detached.verify(message, signatureBytes, publicKeyBytes); } catch { return false; } } function decodeEd25519Base58(value) { const encoded = value.startsWith(ED25519_PREFIX) ? value.slice(ED25519_PREFIX.length) : value; return base58.decode(encoded); } export { AccountService, AnyInputQuoteWithdrawal, ApiError, AuthCall, BalanceEntry, CancelError, CancelablePromise, ChainDepositAddress, GenerateSwapTransferIntentRequest, GetExecutionStatusResponse, HistoryItem, Intent, IntentAddPublicKey, IntentAuthCall, IntentFtWithdraw, Int