@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.
@@ -5,6 +5,7 @@ var chains$1 = require('viem/chains');
5
5
  var v4 = require('zod/v4');
6
6
  var zodOpenapi = require('zod-openapi');
7
7
  var viem = require('viem');
8
+ var jsBase64 = require('js-base64');
8
9
  var nodeServer = require('@hono/node-server');
9
10
  var hono = require('hono');
10
11
  var fs = require('fs');
@@ -8256,8 +8257,6 @@ function* batch(array, batchSize) {
8256
8257
  yield array.slice(i, i + batchSize);
8257
8258
  }
8258
8259
  }
8259
-
8260
- // src/utils/cursor.ts
8261
8260
  function validateCursor(cursor) {
8262
8261
  if (!cursor || typeof cursor !== "object") {
8263
8262
  throw new Error("Cursor must be an object");
@@ -8328,11 +8327,11 @@ function validateCursor(cursor) {
8328
8327
  return true;
8329
8328
  }
8330
8329
  function encodeCursor(c) {
8331
- return Buffer.from(JSON.stringify(c)).toString("base64url");
8330
+ return jsBase64.Base64.encodeURL(JSON.stringify(c));
8332
8331
  }
8333
8332
  function decodeCursor(token) {
8334
8333
  if (!token) return null;
8335
- const decoded = JSON.parse(Buffer.from(token, "base64url").toString());
8334
+ const decoded = JSON.parse(jsBase64.Base64.decode(token));
8336
8335
  validateCursor(decoded);
8337
8336
  return decoded;
8338
8337
  }
@@ -9100,12 +9099,12 @@ async function getApi(config, url) {
9100
9099
  const pathname = url.pathname;
9101
9100
  let action;
9102
9101
  switch (true) {
9103
- case pathname.includes("/v1/offers"):
9104
- action = "get_offers";
9105
- break;
9106
9102
  case pathname.includes("/v1/offers/match"):
9107
9103
  action = "match_offers";
9108
9104
  break;
9105
+ case pathname.includes("/v1/offers"):
9106
+ action = "get_offers";
9107
+ break;
9109
9108
  default:
9110
9109
  throw new HttpGetOffersFailedError("Unknown endpoint", {
9111
9110
  details: `Unsupported path: ${pathname}`