@calimero-network/mero-js 16.0.0 → 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.cjs CHANGED
@@ -2879,16 +2879,10 @@ function borshString(value) {
2879
2879
  const bytes = new TextEncoder().encode(value);
2880
2880
  return concat(u32le(bytes.length), bytes);
2881
2881
  }
2882
- function encodeAdmitterHint(hint) {
2883
- if ("multiaddr" in hint) {
2884
- return concat(new Uint8Array([0]), borshString(hint.multiaddr));
2885
- }
2886
- return concat(new Uint8Array([1]), borshString(hint.url));
2887
- }
2888
2882
  function encodeSignedInvitation(signed) {
2889
2883
  const body = signed.invitation;
2890
2884
  const admitters = body.admitters ?? [];
2891
- const hints = signed.admitter_hints ?? [];
2885
+ const admitterAddrs = signed.admitter_addrs ?? [];
2892
2886
  return concat(
2893
2887
  // GroupInvitationFromAdmin.
2894
2888
  //
@@ -2903,12 +2897,17 @@ function encodeSignedInvitation(signed) {
2903
2897
  u32le(admitters.length),
2904
2898
  ...admitters.map((a, i) => fromHex(a, `admitters[${i}]`, 32)),
2905
2899
  // ...then the enclosing SignedGroupOpenInvitation, in declaration order.
2906
- // `inviter_account` sits between the signature and the hints; putting it
2900
+ // `inviter_account` sits between the signature and the addresses; putting it
2907
2901
  // anywhere else still encodes 32 bytes and still verifies as nothing.
2908
2902
  borshString(signed.inviter_signature),
2909
2903
  signed.inviter_account ? concat(new Uint8Array([1]), fromHex(signed.inviter_account, "inviter_account", 32)) : new Uint8Array([0]),
2910
- u32le(hints.length),
2911
- ...hints.map(encodeAdmitterHint),
2904
+ // A `Vec<String>`, so each entry is a bare borsh string. This carried an
2905
+ // enum until core dropped the URL variant, and an enum writes a
2906
+ // discriminant byte ahead of each entry — encoding one here now would shift
2907
+ // every following byte and fail as `invalid invitation signature`, pointing
2908
+ // nowhere near this line.
2909
+ u32le(admitterAddrs.length),
2910
+ ...admitterAddrs.map(borshString),
2912
2911
  optionalBytes32(signed.application_id, "application_id"),
2913
2912
  // Borsh order follows core's field order, where this is `bytecode_id`; the
2914
2913
  // JSON key is `app_key`, a rename covering both directions that core pins in