@morpho-dev/router 0.0.19 → 0.0.20

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.
@@ -4,6 +4,7 @@ import { base, mainnet, optimism, foundry, abstractTestnet, acala, ancient8, anc
4
4
  import { z } from 'zod/v4';
5
5
  import { createDocument } from 'zod-openapi';
6
6
  import { parseUnits, defineChain, hexToBytes as hexToBytes$1, bytesToHex as bytesToHex$1, maxUint256, formatUnits, keccak256 as keccak256$2, toHex, parseEther as parseEther$1, concatHex, pad, createClient, publicActions, walletActions, testActions, parseAbi as parseAbi$1, createTransport, withRetry, numberToHex as numberToHex$2, hexToBigInt as hexToBigInt$1, stringToHex as stringToHex$1, numberToBytes, encodeFunctionData as encodeFunctionData$1, createPublicClient, InternalRpcError, decodeFunctionResult as decodeFunctionResult$1 } from 'viem';
7
+ import { Base64 } from 'js-base64';
7
8
  import { serve as serve$1 } from '@hono/node-server';
8
9
  import { Hono } from 'hono';
9
10
  import fs from 'fs';
@@ -8231,8 +8232,6 @@ function* batch(array, batchSize) {
8231
8232
  yield array.slice(i, i + batchSize);
8232
8233
  }
8233
8234
  }
8234
-
8235
- // src/utils/cursor.ts
8236
8235
  function validateCursor(cursor) {
8237
8236
  if (!cursor || typeof cursor !== "object") {
8238
8237
  throw new Error("Cursor must be an object");
@@ -8303,11 +8302,11 @@ function validateCursor(cursor) {
8303
8302
  return true;
8304
8303
  }
8305
8304
  function encodeCursor(c) {
8306
- return Buffer.from(JSON.stringify(c)).toString("base64url");
8305
+ return Base64.encodeURL(JSON.stringify(c));
8307
8306
  }
8308
8307
  function decodeCursor(token) {
8309
8308
  if (!token) return null;
8310
- const decoded = JSON.parse(Buffer.from(token, "base64url").toString());
8309
+ const decoded = JSON.parse(Base64.decode(token));
8311
8310
  validateCursor(decoded);
8312
8311
  return decoded;
8313
8312
  }
@@ -9075,12 +9074,12 @@ async function getApi(config, url) {
9075
9074
  const pathname = url.pathname;
9076
9075
  let action;
9077
9076
  switch (true) {
9078
- case pathname.includes("/v1/offers"):
9079
- action = "get_offers";
9080
- break;
9081
9077
  case pathname.includes("/v1/offers/match"):
9082
9078
  action = "match_offers";
9083
9079
  break;
9080
+ case pathname.includes("/v1/offers"):
9081
+ action = "get_offers";
9082
+ break;
9084
9083
  default:
9085
9084
  throw new HttpGetOffersFailedError("Unknown endpoint", {
9086
9085
  details: `Unsupported path: ${pathname}`