@calimero-network/mero-js 15.3.4 → 16.1.0

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/index.mjs CHANGED
@@ -2802,16 +2802,10 @@ function borshString(value) {
2802
2802
  const bytes = new TextEncoder().encode(value);
2803
2803
  return concat(u32le(bytes.length), bytes);
2804
2804
  }
2805
- function encodeAdmitterHint(hint) {
2806
- if ("multiaddr" in hint) {
2807
- return concat(new Uint8Array([0]), borshString(hint.multiaddr));
2808
- }
2809
- return concat(new Uint8Array([1]), borshString(hint.url));
2810
- }
2811
2805
  function encodeSignedInvitation(signed) {
2812
2806
  const body = signed.invitation;
2813
2807
  const admitters = body.admitters ?? [];
2814
- const hints = signed.admitter_hints ?? [];
2808
+ const admitterAddrs = signed.admitter_addrs ?? [];
2815
2809
  return concat(
2816
2810
  // GroupInvitationFromAdmin.
2817
2811
  //
@@ -2826,12 +2820,17 @@ function encodeSignedInvitation(signed) {
2826
2820
  u32le(admitters.length),
2827
2821
  ...admitters.map((a, i) => fromHex(a, `admitters[${i}]`, 32)),
2828
2822
  // ...then the enclosing SignedGroupOpenInvitation, in declaration order.
2829
- // `inviter_account` sits between the signature and the hints; putting it
2823
+ // `inviter_account` sits between the signature and the addresses; putting it
2830
2824
  // anywhere else still encodes 32 bytes and still verifies as nothing.
2831
2825
  borshString(signed.inviter_signature),
2832
2826
  signed.inviter_account ? concat(new Uint8Array([1]), fromHex(signed.inviter_account, "inviter_account", 32)) : new Uint8Array([0]),
2833
- u32le(hints.length),
2834
- ...hints.map(encodeAdmitterHint),
2827
+ // A `Vec<String>`, so each entry is a bare borsh string. This carried an
2828
+ // enum until core dropped the URL variant, and an enum writes a
2829
+ // discriminant byte ahead of each entry — encoding one here now would shift
2830
+ // every following byte and fail as `invalid invitation signature`, pointing
2831
+ // nowhere near this line.
2832
+ u32le(admitterAddrs.length),
2833
+ ...admitterAddrs.map(borshString),
2835
2834
  optionalBytes32(signed.application_id, "application_id"),
2836
2835
  // Borsh order follows core's field order, where this is `bytecode_id`; the
2837
2836
  // JSON key is `app_key`, a rename covering both directions that core pins in