@settlemint/dalp-cli 3.1.19-main.36458349696 → 3.1.19-main.36472209091

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/dist/dalp.js CHANGED
@@ -41068,6 +41068,7 @@ var SDK_LOCAL_ERROR_CODES = new Set([
41068
41068
  "sdk.transport.UNVERIFIED_ERROR_CODE",
41069
41069
  "sdk.response.MALFORMED_SUCCESS",
41070
41070
  "sdk.stream.FAILED",
41071
+ "sdk.stream.UNREADABLE_BODY",
41071
41072
  "sdk.scalar.BIG_DECIMAL_INVALID",
41072
41073
  "sdk.scalar.EVM_ADDRESS_INVALID",
41073
41074
  "sdk.scalar.ORGANIZATION_ID_INVALID",
@@ -41162,6 +41163,32 @@ function normalizeDalpBaseUrl(url) {
41162
41163
  return `${parsed.origin}${parsed.pathname.replace(/\/+$/, "")}`;
41163
41164
  }
41164
41165
 
41166
+ // ../sdk/src/runtime.ts
41167
+ var REACT_NATIVE_NAVIGATOR_PRODUCT = "ReactNative";
41168
+ function detectDalpRuntime() {
41169
+ if (Reflect.get(globalThis, "navigator") !== undefined && Reflect.get(navigator, "product") === REACT_NATIVE_NAVIGATOR_PRODUCT) {
41170
+ return "react-native";
41171
+ }
41172
+ return globalThis.window === undefined ? "server" : "browser";
41173
+ }
41174
+ function runtimeCredentials(runtime) {
41175
+ return runtime === "browser" ? "include" : "omit";
41176
+ }
41177
+ var WHATWG_FETCH_POLYFILL_FLAG = "polyfill";
41178
+ function isBufferingFetch(fetchImpl) {
41179
+ return typeof fetchImpl === "function" && Reflect.get(fetchImpl, WHATWG_FETCH_POLYFILL_FLAG) === true;
41180
+ }
41181
+ function refuseBundledApiKey(runtime) {
41182
+ if (runtime === "server") {
41183
+ return;
41184
+ }
41185
+ throw createDalpSdkConfigurationError({
41186
+ message: `DALP SDK: API keys are server/CLI-only credentials and cannot configure a ${runtime} client.`,
41187
+ why: "An API key placed in a browser or app bundle ships the credential to every visitor or device.",
41188
+ fix: "Keep the API key on the server or CLI process; browser and app clients authenticate with the session cookie."
41189
+ });
41190
+ }
41191
+
41165
41192
  // ../sdk/src/client/query-serializer.ts
41166
41193
  function appendQueryValue(search, path, value) {
41167
41194
  if (value === undefined || value === null) {
@@ -41489,10 +41516,10 @@ async function captureSuccessfulGet(store, key, response) {
41489
41516
  store.delete(key);
41490
41517
  return response;
41491
41518
  }
41492
- const body = new Uint8Array(await response.arrayBuffer());
41519
+ const body = await response.blob();
41493
41520
  const headers = new Headers(response.headers);
41494
41521
  headers.set("etag", etag);
41495
- if (body.byteLength <= CONDITIONAL_RESPONSE_MAX_BODY_BYTES) {
41522
+ if (body.size <= CONDITIONAL_RESPONSE_MAX_BODY_BYTES) {
41496
41523
  remember(store, key, { body, etag, headers });
41497
41524
  }
41498
41525
  return new Response(body, {
@@ -41540,7 +41567,7 @@ function withConditionalRequests(base) {
41540
41567
  const retried = await base(requestWithoutIfNoneMatch(sent));
41541
41568
  return retried.status === 304 ? retried : captureSuccessfulGet(state.store, key, retried);
41542
41569
  }
41543
- return new Response(new Uint8Array(entry.body), { status: 200, statusText: "OK", headers: entry.headers });
41570
+ return new Response(entry.body, { status: 200, statusText: "OK", headers: entry.headers });
41544
41571
  };
41545
41572
  return {
41546
41573
  fetch: decorated,
@@ -41666,9 +41693,9 @@ function preferDirective(timeoutMs) {
41666
41693
  }
41667
41694
  function createTransport(options) {
41668
41695
  const baseUrl = normalizeDalpBaseUrl(String(options.baseUrl));
41669
- const runtime = options.runtime ?? (globalThis.window === undefined ? "server" : "browser");
41696
+ const runtime = options.runtime ?? detectDalpRuntime();
41670
41697
  const baseFetch = options.fetch ?? globalThis.fetch;
41671
- const transportFetch = runtime === "browser" ? baseFetch : withRequestBodyCompression(baseFetch);
41698
+ const transportFetch = runtime === "server" ? withRequestBodyCompression(baseFetch) : baseFetch;
41672
41699
  const { apiKey: apiKeyOption } = options;
41673
41700
  let apiKey;
41674
41701
  if (apiKeyOption === undefined) {
@@ -41678,12 +41705,8 @@ function createTransport(options) {
41678
41705
  } else {
41679
41706
  apiKey = secret(apiKeyOption.trim());
41680
41707
  }
41681
- if (runtime === "browser" && apiKey !== undefined) {
41682
- throw createDalpSdkConfigurationError({
41683
- message: "DALP SDK: API keys are server/CLI-only credentials and cannot configure a browser client.",
41684
- why: "An API key placed in a browser client ships the credential to every visitor's bundle.",
41685
- fix: "Keep the API key on the server or CLI process; browser clients authenticate with the session cookie."
41686
- });
41708
+ if (apiKey !== undefined) {
41709
+ refuseBundledApiKey(runtime);
41687
41710
  }
41688
41711
  const sessionFetch = options.ssr === undefined ? transportFetch : createSsrFetch({
41689
41712
  allowedOrigins: options.ssr.allowedOrigins,
@@ -41696,14 +41719,18 @@ function createTransport(options) {
41696
41719
  if (options.authSurface !== undefined) {
41697
41720
  contextHeaders.set(DALP_AUTH_SURFACE_HEADER, options.authSurface);
41698
41721
  }
41722
+ if (runtime === "react-native") {
41723
+ contextHeaders.set("Origin", new URL(baseUrl).origin);
41724
+ }
41699
41725
  return {
41700
41726
  baseUrl,
41701
41727
  fetch: conditional.fetch,
41702
41728
  conditionalRequests: conditional.store,
41703
- credentials: runtime === "browser" ? "include" : "omit",
41729
+ credentials: runtimeCredentials(runtime),
41704
41730
  apiKey,
41705
41731
  contextHeaders,
41706
- settlementTimeoutMs: options.settlementTimeoutMs
41732
+ settlementTimeoutMs: options.settlementTimeoutMs,
41733
+ streamsResponseBody: !isBufferingFetch(baseFetch)
41707
41734
  };
41708
41735
  }
41709
41736
  function callHeaders(transport, options) {
@@ -42302,6 +42329,21 @@ async function loadResponseDecoder() {
42302
42329
  // ../sdk/src/proxy/sse.ts
42303
42330
  var RESERVED_STREAM_FAILURE_EVENT = "effect/httpapi/stream/failure";
42304
42331
  var STREAM_FAILED_ERROR_CODE = "sdk.stream.FAILED";
42332
+ var STREAM_UNREADABLE_BODY_ERROR_CODE = "sdk.stream.UNREADABLE_BODY";
42333
+ function isReadableBody(body) {
42334
+ return typeof body === "object" && body !== null && typeof Reflect.get(body, "getReader") === "function";
42335
+ }
42336
+ function unreadableBodyError(routeId) {
42337
+ return makeDalpApiError(new DalpSdkError({
42338
+ code: STREAM_UNREADABLE_BODY_ERROR_CODE,
42339
+ routeId,
42340
+ category: "sdk.configuration",
42341
+ retryable: false,
42342
+ message: "The fetch this client uses cannot stream a response body.",
42343
+ why: "React Native's built-in fetch resolves only after the whole response has arrived and exposes no `response.body`, so a stream never yields a frame.",
42344
+ fix: 'Pass a streaming fetch as `fetch`; on React Native that is `fetch` from "expo/fetch", wrapped with the cookie store.'
42345
+ }));
42346
+ }
42305
42347
  function parseFrame(raw) {
42306
42348
  try {
42307
42349
  return JSON.parse(raw.data);
@@ -42382,6 +42424,9 @@ async function* decodeEventStream(body, decodeFrame, routeId) {
42382
42424
  }
42383
42425
  }
42384
42426
  async function* openEventStream(transport, route, routeId, input, options, signal, closed) {
42427
+ if (!transport.streamsResponseBody) {
42428
+ throw unreadableBodyError(routeId);
42429
+ }
42385
42430
  const prepared = prepareRequest(transport, route, input, options);
42386
42431
  prepared.headers.set("Accept", "text/event-stream");
42387
42432
  const response = await transport.fetch(prepared.url, {
@@ -42394,13 +42439,16 @@ async function* openEventStream(transport, route, routeId, input, options, signa
42394
42439
  if (!response.ok) {
42395
42440
  await raiseResponseError(response, routeId);
42396
42441
  }
42397
- if (response.body === null) {
42442
+ const { body, status } = response;
42443
+ if (body === null) {
42398
42444
  return;
42399
42445
  }
42446
+ if (!isReadableBody(body)) {
42447
+ throw unreadableBodyError(routeId);
42448
+ }
42400
42449
  const decoder = await loadResponseDecoder();
42401
- const { status } = response;
42402
42450
  try {
42403
- yield* decodeEventStream(response.body, (frame) => decoder.decode(routeId, status, frame), routeId);
42451
+ yield* decodeEventStream(body, (frame) => decoder.decode(routeId, status, frame), routeId);
42404
42452
  } catch (error) {
42405
42453
  if (!closed.byConsumer) {
42406
42454
  throw error;
@@ -42477,14 +42525,644 @@ var canonicalText = (value, omitted = null) => {
42477
42525
  return `{${presentEntries(Object.entries(value), omitted).map(([key, field]) => `${JSON.stringify(key)}:${canonicalText(field)}`).join(",")}}`;
42478
42526
  };
42479
42527
  var stepUpPayloadText = (body) => canonicalText(body, PROOF_FIELD);
42528
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/errors/version.js
42529
+ var version3 = "2.56.8";
42530
+
42531
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/errors/base.js
42532
+ var errorConfig = {
42533
+ getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : undefined,
42534
+ version: `viem@${version3}`
42535
+ };
42536
+ class BaseError2 extends Error {
42537
+ constructor(shortMessage, args = {}) {
42538
+ const details = (() => {
42539
+ if (args.cause instanceof BaseError2)
42540
+ return args.cause.details;
42541
+ if (args.cause?.message)
42542
+ return args.cause.message;
42543
+ return args.details;
42544
+ })();
42545
+ const docsPath = (() => {
42546
+ if (args.cause instanceof BaseError2)
42547
+ return args.cause.docsPath || args.docsPath;
42548
+ return args.docsPath;
42549
+ })();
42550
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
42551
+ const message = [
42552
+ shortMessage || "An error occurred.",
42553
+ "",
42554
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
42555
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
42556
+ ...details ? [`Details: ${details}`] : [],
42557
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
42558
+ ].join(`
42559
+ `);
42560
+ super(message, args.cause ? { cause: args.cause } : undefined);
42561
+ Object.defineProperty(this, "details", {
42562
+ enumerable: true,
42563
+ configurable: true,
42564
+ writable: true,
42565
+ value: undefined
42566
+ });
42567
+ Object.defineProperty(this, "docsPath", {
42568
+ enumerable: true,
42569
+ configurable: true,
42570
+ writable: true,
42571
+ value: undefined
42572
+ });
42573
+ Object.defineProperty(this, "metaMessages", {
42574
+ enumerable: true,
42575
+ configurable: true,
42576
+ writable: true,
42577
+ value: undefined
42578
+ });
42579
+ Object.defineProperty(this, "shortMessage", {
42580
+ enumerable: true,
42581
+ configurable: true,
42582
+ writable: true,
42583
+ value: undefined
42584
+ });
42585
+ Object.defineProperty(this, "version", {
42586
+ enumerable: true,
42587
+ configurable: true,
42588
+ writable: true,
42589
+ value: undefined
42590
+ });
42591
+ Object.defineProperty(this, "name", {
42592
+ enumerable: true,
42593
+ configurable: true,
42594
+ writable: true,
42595
+ value: "BaseError"
42596
+ });
42597
+ this.details = details;
42598
+ this.docsPath = docsPath;
42599
+ this.metaMessages = args.metaMessages;
42600
+ this.name = args.name ?? this.name;
42601
+ this.shortMessage = shortMessage;
42602
+ this.version = version3;
42603
+ }
42604
+ walk(fn) {
42605
+ return walk3(this, fn);
42606
+ }
42607
+ }
42608
+ function walk3(err, fn) {
42609
+ if (fn?.(err))
42610
+ return err;
42611
+ if (err && typeof err === "object" && "cause" in err && err.cause !== undefined)
42612
+ return walk3(err.cause, fn);
42613
+ return fn ? null : err;
42614
+ }
42615
+
42616
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/data/isHex.js
42617
+ function isHex(value, { strict = true } = {}) {
42618
+ if (!value)
42619
+ return false;
42620
+ if (typeof value !== "string")
42621
+ return false;
42622
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
42623
+ }
42624
+
42625
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/errors/data.js
42626
+ class SizeExceedsPaddingSizeError extends BaseError2 {
42627
+ constructor({ size, targetSize, type }) {
42628
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
42629
+ }
42630
+ }
42631
+
42632
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/data/pad.js
42633
+ function pad(hexOrBytes, { dir, size = 32 } = {}) {
42634
+ if (typeof hexOrBytes === "string")
42635
+ return padHex(hexOrBytes, { dir, size });
42636
+ return padBytes(hexOrBytes, { dir, size });
42637
+ }
42638
+ function padHex(hex_, { dir, size = 32 } = {}) {
42639
+ if (size === null)
42640
+ return hex_;
42641
+ const hex = hex_.replace("0x", "");
42642
+ if (hex.length > size * 2)
42643
+ throw new SizeExceedsPaddingSizeError({
42644
+ size: Math.ceil(hex.length / 2),
42645
+ targetSize: size,
42646
+ type: "hex"
42647
+ });
42648
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size * 2, "0")}`;
42649
+ }
42650
+ function padBytes(bytes, { dir, size = 32 } = {}) {
42651
+ if (size === null)
42652
+ return bytes;
42653
+ if (bytes.length > size)
42654
+ throw new SizeExceedsPaddingSizeError({
42655
+ size: bytes.length,
42656
+ targetSize: size,
42657
+ type: "bytes"
42658
+ });
42659
+ const paddedBytes = new Uint8Array(size);
42660
+ for (let i = 0;i < size; i++) {
42661
+ const padEnd = dir === "right";
42662
+ paddedBytes[padEnd ? i : size - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
42663
+ }
42664
+ return paddedBytes;
42665
+ }
42666
+
42667
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/errors/encoding.js
42668
+ class IntegerOutOfRangeError extends BaseError2 {
42669
+ constructor({ max, min, signed, size, value }) {
42670
+ super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
42671
+ }
42672
+ }
42673
+ class SizeOverflowError extends BaseError2 {
42674
+ constructor({ givenSize, maxSize }) {
42675
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
42676
+ }
42677
+ }
42678
+
42679
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/data/size.js
42680
+ function size(value) {
42681
+ if (isHex(value, { strict: false }))
42682
+ return Math.ceil((value.length - 2) / 2);
42683
+ return value.length;
42684
+ }
42685
+
42686
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/encoding/fromHex.js
42687
+ function assertSize(hexOrBytes, { size: size2 }) {
42688
+ if (size(hexOrBytes) > size2)
42689
+ throw new SizeOverflowError({
42690
+ givenSize: size(hexOrBytes),
42691
+ maxSize: size2
42692
+ });
42693
+ }
42694
+
42695
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/encoding/toHex.js
42696
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
42697
+ function toHex(value, opts = {}) {
42698
+ if (typeof value === "number" || typeof value === "bigint")
42699
+ return numberToHex(value, opts);
42700
+ if (typeof value === "string") {
42701
+ return stringToHex(value, opts);
42702
+ }
42703
+ if (typeof value === "boolean")
42704
+ return boolToHex(value, opts);
42705
+ return bytesToHex(value, opts);
42706
+ }
42707
+ function boolToHex(value, opts = {}) {
42708
+ const hex = `0x${Number(value)}`;
42709
+ if (typeof opts.size === "number") {
42710
+ assertSize(hex, { size: opts.size });
42711
+ return pad(hex, { size: opts.size });
42712
+ }
42713
+ return hex;
42714
+ }
42715
+ function bytesToHex(value, opts = {}) {
42716
+ let string = "";
42717
+ for (let i = 0;i < value.length; i++) {
42718
+ string += hexes[value[i]];
42719
+ }
42720
+ const hex = `0x${string}`;
42721
+ if (typeof opts.size === "number") {
42722
+ assertSize(hex, { size: opts.size });
42723
+ return pad(hex, { dir: "right", size: opts.size });
42724
+ }
42725
+ return hex;
42726
+ }
42727
+ function numberToHex(value_, opts = {}) {
42728
+ const { signed, size } = opts;
42729
+ const value = BigInt(value_);
42730
+ let maxValue;
42731
+ if (size) {
42732
+ if (signed)
42733
+ maxValue = (1n << BigInt(size) * 8n - 1n) - 1n;
42734
+ else
42735
+ maxValue = 2n ** (BigInt(size) * 8n) - 1n;
42736
+ } else if (typeof value_ === "number") {
42737
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
42738
+ }
42739
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
42740
+ if (maxValue && value > maxValue || value < minValue) {
42741
+ const suffix = typeof value_ === "bigint" ? "n" : "";
42742
+ throw new IntegerOutOfRangeError({
42743
+ max: maxValue ? `${maxValue}${suffix}` : undefined,
42744
+ min: `${minValue}${suffix}`,
42745
+ signed,
42746
+ size,
42747
+ value: `${value_}${suffix}`
42748
+ });
42749
+ }
42750
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;
42751
+ if (size)
42752
+ return pad(hex, { size });
42753
+ return hex;
42754
+ }
42755
+ var encoder = /* @__PURE__ */ new TextEncoder;
42756
+ function stringToHex(value_, opts = {}) {
42757
+ const value = encoder.encode(value_);
42758
+ return bytesToHex(value, opts);
42759
+ }
42480
42760
 
42761
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/encoding/toBytes.js
42762
+ var encoder2 = /* @__PURE__ */ new TextEncoder;
42763
+ function toBytes(value, opts = {}) {
42764
+ if (typeof value === "number" || typeof value === "bigint")
42765
+ return numberToBytes(value, opts);
42766
+ if (typeof value === "boolean")
42767
+ return boolToBytes(value, opts);
42768
+ if (isHex(value))
42769
+ return hexToBytes(value, opts);
42770
+ return stringToBytes(value, opts);
42771
+ }
42772
+ function boolToBytes(value, opts = {}) {
42773
+ const bytes = new Uint8Array(1);
42774
+ bytes[0] = Number(value);
42775
+ if (typeof opts.size === "number") {
42776
+ assertSize(bytes, { size: opts.size });
42777
+ return pad(bytes, { size: opts.size });
42778
+ }
42779
+ return bytes;
42780
+ }
42781
+ var charCodeMap = {
42782
+ zero: 48,
42783
+ nine: 57,
42784
+ A: 65,
42785
+ F: 70,
42786
+ a: 97,
42787
+ f: 102
42788
+ };
42789
+ function charCodeToBase16(char) {
42790
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
42791
+ return char - charCodeMap.zero;
42792
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
42793
+ return char - (charCodeMap.A - 10);
42794
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
42795
+ return char - (charCodeMap.a - 10);
42796
+ return;
42797
+ }
42798
+ function hexToBytes(hex_, opts = {}) {
42799
+ let hex = hex_;
42800
+ if (opts.size) {
42801
+ assertSize(hex, { size: opts.size });
42802
+ hex = pad(hex, { dir: "right", size: opts.size });
42803
+ }
42804
+ let hexString = hex.slice(2);
42805
+ if (hexString.length % 2)
42806
+ hexString = `0${hexString}`;
42807
+ const length = hexString.length / 2;
42808
+ const bytes = new Uint8Array(length);
42809
+ for (let index = 0, j = 0;index < length; index++) {
42810
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
42811
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
42812
+ if (nibbleLeft === undefined || nibbleRight === undefined) {
42813
+ throw new BaseError2(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
42814
+ }
42815
+ bytes[index] = nibbleLeft * 16 + nibbleRight;
42816
+ }
42817
+ return bytes;
42818
+ }
42819
+ function numberToBytes(value, opts) {
42820
+ const hex = numberToHex(value, opts);
42821
+ return hexToBytes(hex);
42822
+ }
42823
+ function stringToBytes(value, opts = {}) {
42824
+ const bytes = encoder2.encode(value);
42825
+ if (typeof opts.size === "number") {
42826
+ assertSize(bytes, { size: opts.size });
42827
+ return pad(bytes, { dir: "right", size: opts.size });
42828
+ }
42829
+ return bytes;
42830
+ }
42831
+ // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
42832
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
42833
+ function isBytes(a) {
42834
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
42835
+ }
42836
+ function abytes(b, ...lengths) {
42837
+ if (!isBytes(b))
42838
+ throw new Error("Uint8Array expected");
42839
+ if (lengths.length > 0 && !lengths.includes(b.length))
42840
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
42841
+ }
42842
+ function aexists(instance, checkFinished = true) {
42843
+ if (instance.destroyed)
42844
+ throw new Error("Hash instance has been destroyed");
42845
+ if (checkFinished && instance.finished)
42846
+ throw new Error("Hash#digest() has already been called");
42847
+ }
42848
+ function aoutput(out, instance) {
42849
+ abytes(out);
42850
+ const min = instance.outputLen;
42851
+ if (out.length < min) {
42852
+ throw new Error("digestInto() expects output buffer of length at least " + min);
42853
+ }
42854
+ }
42855
+ function clean(...arrays) {
42856
+ for (let i = 0;i < arrays.length; i++) {
42857
+ arrays[i].fill(0);
42858
+ }
42859
+ }
42860
+ function createView(arr) {
42861
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
42862
+ }
42863
+ function rotr(word, shift) {
42864
+ return word << 32 - shift | word >>> shift;
42865
+ }
42866
+ function utf8ToBytes(str) {
42867
+ if (typeof str !== "string")
42868
+ throw new Error("string expected");
42869
+ return new Uint8Array(new TextEncoder().encode(str));
42870
+ }
42871
+ function toBytes2(data) {
42872
+ if (typeof data === "string")
42873
+ data = utf8ToBytes(data);
42874
+ abytes(data);
42875
+ return data;
42876
+ }
42877
+ class Hash {
42878
+ }
42879
+ function createHasher(hashCons) {
42880
+ const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
42881
+ const tmp = hashCons();
42882
+ hashC.outputLen = tmp.outputLen;
42883
+ hashC.blockLen = tmp.blockLen;
42884
+ hashC.create = () => hashCons();
42885
+ return hashC;
42886
+ }
42887
+
42888
+ // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js
42889
+ function setBigUint64(view, byteOffset, value, isLE) {
42890
+ if (typeof view.setBigUint64 === "function")
42891
+ return view.setBigUint64(byteOffset, value, isLE);
42892
+ const _32n = BigInt(32);
42893
+ const _u32_max = BigInt(4294967295);
42894
+ const wh = Number(value >> _32n & _u32_max);
42895
+ const wl = Number(value & _u32_max);
42896
+ const h = isLE ? 4 : 0;
42897
+ const l = isLE ? 0 : 4;
42898
+ view.setUint32(byteOffset + h, wh, isLE);
42899
+ view.setUint32(byteOffset + l, wl, isLE);
42900
+ }
42901
+ function Chi(a, b, c) {
42902
+ return a & b ^ ~a & c;
42903
+ }
42904
+ function Maj(a, b, c) {
42905
+ return a & b ^ a & c ^ b & c;
42906
+ }
42907
+
42908
+ class HashMD extends Hash {
42909
+ constructor(blockLen, outputLen, padOffset, isLE) {
42910
+ super();
42911
+ this.finished = false;
42912
+ this.length = 0;
42913
+ this.pos = 0;
42914
+ this.destroyed = false;
42915
+ this.blockLen = blockLen;
42916
+ this.outputLen = outputLen;
42917
+ this.padOffset = padOffset;
42918
+ this.isLE = isLE;
42919
+ this.buffer = new Uint8Array(blockLen);
42920
+ this.view = createView(this.buffer);
42921
+ }
42922
+ update(data) {
42923
+ aexists(this);
42924
+ data = toBytes2(data);
42925
+ abytes(data);
42926
+ const { view, buffer, blockLen } = this;
42927
+ const len = data.length;
42928
+ for (let pos = 0;pos < len; ) {
42929
+ const take = Math.min(blockLen - this.pos, len - pos);
42930
+ if (take === blockLen) {
42931
+ const dataView = createView(data);
42932
+ for (;blockLen <= len - pos; pos += blockLen)
42933
+ this.process(dataView, pos);
42934
+ continue;
42935
+ }
42936
+ buffer.set(data.subarray(pos, pos + take), this.pos);
42937
+ this.pos += take;
42938
+ pos += take;
42939
+ if (this.pos === blockLen) {
42940
+ this.process(view, 0);
42941
+ this.pos = 0;
42942
+ }
42943
+ }
42944
+ this.length += data.length;
42945
+ this.roundClean();
42946
+ return this;
42947
+ }
42948
+ digestInto(out) {
42949
+ aexists(this);
42950
+ aoutput(out, this);
42951
+ this.finished = true;
42952
+ const { buffer, view, blockLen, isLE } = this;
42953
+ let { pos } = this;
42954
+ buffer[pos++] = 128;
42955
+ clean(this.buffer.subarray(pos));
42956
+ if (this.padOffset > blockLen - pos) {
42957
+ this.process(view, 0);
42958
+ pos = 0;
42959
+ }
42960
+ for (let i = pos;i < blockLen; i++)
42961
+ buffer[i] = 0;
42962
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
42963
+ this.process(view, 0);
42964
+ const oview = createView(out);
42965
+ const len = this.outputLen;
42966
+ if (len % 4)
42967
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
42968
+ const outLen = len / 4;
42969
+ const state = this.get();
42970
+ if (outLen > state.length)
42971
+ throw new Error("_sha2: outputLen bigger than state");
42972
+ for (let i = 0;i < outLen; i++)
42973
+ oview.setUint32(4 * i, state[i], isLE);
42974
+ }
42975
+ digest() {
42976
+ const { buffer, outputLen } = this;
42977
+ this.digestInto(buffer);
42978
+ const res = buffer.slice(0, outputLen);
42979
+ this.destroy();
42980
+ return res;
42981
+ }
42982
+ _cloneInto(to) {
42983
+ to || (to = new this.constructor);
42984
+ to.set(...this.get());
42985
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
42986
+ to.destroyed = destroyed;
42987
+ to.finished = finished;
42988
+ to.length = length;
42989
+ to.pos = pos;
42990
+ if (length % blockLen)
42991
+ to.buffer.set(buffer);
42992
+ return to;
42993
+ }
42994
+ clone() {
42995
+ return this._cloneInto();
42996
+ }
42997
+ }
42998
+ var SHA256_IV = /* @__PURE__ */ Uint32Array.from([
42999
+ 1779033703,
43000
+ 3144134277,
43001
+ 1013904242,
43002
+ 2773480762,
43003
+ 1359893119,
43004
+ 2600822924,
43005
+ 528734635,
43006
+ 1541459225
43007
+ ]);
43008
+
43009
+ // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js
43010
+ var SHA256_K = /* @__PURE__ */ Uint32Array.from([
43011
+ 1116352408,
43012
+ 1899447441,
43013
+ 3049323471,
43014
+ 3921009573,
43015
+ 961987163,
43016
+ 1508970993,
43017
+ 2453635748,
43018
+ 2870763221,
43019
+ 3624381080,
43020
+ 310598401,
43021
+ 607225278,
43022
+ 1426881987,
43023
+ 1925078388,
43024
+ 2162078206,
43025
+ 2614888103,
43026
+ 3248222580,
43027
+ 3835390401,
43028
+ 4022224774,
43029
+ 264347078,
43030
+ 604807628,
43031
+ 770255983,
43032
+ 1249150122,
43033
+ 1555081692,
43034
+ 1996064986,
43035
+ 2554220882,
43036
+ 2821834349,
43037
+ 2952996808,
43038
+ 3210313671,
43039
+ 3336571891,
43040
+ 3584528711,
43041
+ 113926993,
43042
+ 338241895,
43043
+ 666307205,
43044
+ 773529912,
43045
+ 1294757372,
43046
+ 1396182291,
43047
+ 1695183700,
43048
+ 1986661051,
43049
+ 2177026350,
43050
+ 2456956037,
43051
+ 2730485921,
43052
+ 2820302411,
43053
+ 3259730800,
43054
+ 3345764771,
43055
+ 3516065817,
43056
+ 3600352804,
43057
+ 4094571909,
43058
+ 275423344,
43059
+ 430227734,
43060
+ 506948616,
43061
+ 659060556,
43062
+ 883997877,
43063
+ 958139571,
43064
+ 1322822218,
43065
+ 1537002063,
43066
+ 1747873779,
43067
+ 1955562222,
43068
+ 2024104815,
43069
+ 2227730452,
43070
+ 2361852424,
43071
+ 2428436474,
43072
+ 2756734187,
43073
+ 3204031479,
43074
+ 3329325298
43075
+ ]);
43076
+ var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
43077
+
43078
+ class SHA256 extends HashMD {
43079
+ constructor(outputLen = 32) {
43080
+ super(64, outputLen, 8, false);
43081
+ this.A = SHA256_IV[0] | 0;
43082
+ this.B = SHA256_IV[1] | 0;
43083
+ this.C = SHA256_IV[2] | 0;
43084
+ this.D = SHA256_IV[3] | 0;
43085
+ this.E = SHA256_IV[4] | 0;
43086
+ this.F = SHA256_IV[5] | 0;
43087
+ this.G = SHA256_IV[6] | 0;
43088
+ this.H = SHA256_IV[7] | 0;
43089
+ }
43090
+ get() {
43091
+ const { A, B, C, D, E, F, G, H } = this;
43092
+ return [A, B, C, D, E, F, G, H];
43093
+ }
43094
+ set(A, B, C, D, E, F, G, H) {
43095
+ this.A = A | 0;
43096
+ this.B = B | 0;
43097
+ this.C = C | 0;
43098
+ this.D = D | 0;
43099
+ this.E = E | 0;
43100
+ this.F = F | 0;
43101
+ this.G = G | 0;
43102
+ this.H = H | 0;
43103
+ }
43104
+ process(view, offset) {
43105
+ for (let i = 0;i < 16; i++, offset += 4)
43106
+ SHA256_W[i] = view.getUint32(offset, false);
43107
+ for (let i = 16;i < 64; i++) {
43108
+ const W15 = SHA256_W[i - 15];
43109
+ const W2 = SHA256_W[i - 2];
43110
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
43111
+ const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10;
43112
+ SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
43113
+ }
43114
+ let { A, B, C, D, E, F, G, H } = this;
43115
+ for (let i = 0;i < 64; i++) {
43116
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
43117
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
43118
+ const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
43119
+ const T2 = sigma0 + Maj(A, B, C) | 0;
43120
+ H = G;
43121
+ G = F;
43122
+ F = E;
43123
+ E = D + T1 | 0;
43124
+ D = C;
43125
+ C = B;
43126
+ B = A;
43127
+ A = T1 + T2 | 0;
43128
+ }
43129
+ A = A + this.A | 0;
43130
+ B = B + this.B | 0;
43131
+ C = C + this.C | 0;
43132
+ D = D + this.D | 0;
43133
+ E = E + this.E | 0;
43134
+ F = F + this.F | 0;
43135
+ G = G + this.G | 0;
43136
+ H = H + this.H | 0;
43137
+ this.set(A, B, C, D, E, F, G, H);
43138
+ }
43139
+ roundClean() {
43140
+ clean(SHA256_W);
43141
+ }
43142
+ destroy() {
43143
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
43144
+ clean(this.buffer);
43145
+ }
43146
+ }
43147
+ var sha256 = /* @__PURE__ */ createHasher(() => new SHA256);
43148
+
43149
+ // ../node_modules/.bun/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
43150
+ var sha2562 = sha256;
43151
+
43152
+ // ../node_modules/.bun/viem@2.56.8+17ce2293f28dc2b8/node_modules/viem/_esm/utils/hash/sha256.js
43153
+ function sha2563(value, to_) {
43154
+ const to = to_ || "hex";
43155
+ const bytes = sha2562(isHex(value, { strict: false }) ? toBytes(value) : value);
43156
+ if (to === "bytes")
43157
+ return bytes;
43158
+ return toHex(bytes);
43159
+ }
42481
43160
  // ../sdk/src/client/step-up-challenge.ts
42482
43161
  var STEP_UP_CHALLENGE_HEADER = "X-Step-Up-Challenge";
42483
43162
  var WALLET_VERIFICATION_HEADER = "X-Wallet-Verification";
42484
43163
  var STEP_UP_CHALLENGE_PATH = "/api/v2/step-up-challenges";
42485
43164
  var PROOF_FIELD2 = "walletVerification";
42486
- var HEX_RADIX = 16;
42487
- var HEX_BYTE_WIDTH = 2;
43165
+ var HEX_PREFIX = "0x";
42488
43166
  function carriesWalletProof(body) {
42489
43167
  if (body === null || typeof body !== "object" || Array.isArray(body)) {
42490
43168
  return false;
@@ -42493,8 +43171,7 @@ function carriesWalletProof(body) {
42493
43171
  return proof !== null && proof !== undefined;
42494
43172
  }
42495
43173
  async function stepUpChallengeRequest(operation, target, body) {
42496
- const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(stepUpPayloadText(body)));
42497
- const payloadDigest = Array.from(new Uint8Array(digest), (byte) => byte.toString(HEX_RADIX).padStart(HEX_BYTE_WIDTH, "0")).join("");
43174
+ const payloadDigest = sha2563(stringToBytes(stepUpPayloadText(body))).slice(HEX_PREFIX.length);
42498
43175
  return { operation, target, payloadDigest };
42499
43176
  }
42500
43177
 
@@ -42625,7 +43302,7 @@ var WEBHOOK_MANIFEST_VERSION = Webhook.MANIFEST_VERSION;
42625
43302
  // ../sdk/package.json
42626
43303
  var package_default = {
42627
43304
  name: "@settlemint/dalp-sdk",
42628
- version: "3.1.19-main.36458349696",
43305
+ version: "3.1.19-main.36472209091",
42629
43306
  private: false,
42630
43307
  description: "Fully typed SDK for the DALP tokenization platform API",
42631
43308
  homepage: "https://settlemint.com",
@@ -42752,10 +43429,12 @@ var package_default = {
42752
43429
  "@tools/typescript-config": "workspace:*",
42753
43430
  "@tools/vitest-config": "workspace:*",
42754
43431
  "@types/bun": "1.4.2",
43432
+ "abort-controller": "3.0.0",
42755
43433
  effect: "4.0.0-rc.117",
42756
43434
  publint: "0.3.24",
42757
43435
  typescript: "7.0.2",
42758
43436
  vitest: "5.0.1",
43437
+ "whatwg-fetch": "3.6.20",
42759
43438
  zod: "4.6.5"
42760
43439
  },
42761
43440
  peerDependencies: {
@@ -96792,7 +97471,7 @@ async function runCommand(context, operation, errorContext = UNKNOWN_COMMAND_ERR
96792
97471
  // package.json
96793
97472
  var package_default2 = {
96794
97473
  name: "@settlemint/dalp-cli",
96795
- version: "3.1.19-main.36458349696",
97474
+ version: "3.1.19-main.36472209091",
96796
97475
  private: false,
96797
97476
  description: "CLI for the Digital Asset Lifecycle Platform \u2014 manage tokens, identities, compliance, and more from the command line.",
96798
97477
  homepage: "https://settlemint.com",
@@ -98155,4 +98834,4 @@ if (false) {}
98155
98834
  // src/bin.ts
98156
98835
  await cli.serve();
98157
98836
 
98158
- //# debugId=99BDF7D2D329261364756E2164756E21
98837
+ //# debugId=1DCEF7CADEDEEAFF64756E2164756E21