@owney/sdk 0.8.2 → 0.8.4

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
@@ -1017,11 +1017,14 @@ var BrowserSessionStore = class {
1017
1017
  function buildAutoSelectUpdate(current, asset, chainId) {
1018
1018
  const chains = current.chains ?? [];
1019
1019
  const chainMissing = chainId !== void 0 && !chains.includes(chainId);
1020
- if (current.autoSelectProtocols === true && !chainMissing) return null;
1020
+ const explicitlyOff = current.autoSelectProtocols === false;
1021
+ const enable = current.autoSelectProtocols == null;
1022
+ if (!enable && !chainMissing) return null;
1021
1023
  const nextChains = chainMissing ? [...chains, chainId] : chains;
1024
+ if (explicitlyOff && !nextChains.length) return null;
1022
1025
  return {
1023
1026
  asset,
1024
- autoSelectProtocols: true,
1027
+ ...explicitlyOff ? {} : { autoSelectProtocols: true },
1025
1028
  ...nextChains.length ? { chains: nextChains } : {}
1026
1029
  };
1027
1030
  }
@@ -1041,9 +1044,7 @@ function buildProtocolMergeUpdate(available, current, asset, excluded = []) {
1041
1044
  const enabled = current.protocols ?? [];
1042
1045
  const kept = enabled.filter((id) => !isExcludedId(id));
1043
1046
  const keptSet = new Set(kept);
1044
- const missing = available.filter(
1045
- (p) => !keptSet.has(p.id) && !isExcluded(p)
1046
- );
1047
+ const missing = current.autoSelectProtocols === false ? [] : available.filter((p) => !keptSet.has(p.id) && !isExcluded(p));
1047
1048
  const fixAutoSelect = excluded.length > 0 && current.autoSelectProtocols !== false;
1048
1049
  const removedAny = kept.length !== enabled.length;
1049
1050
  if (missing.length === 0 && !removedAny && !fixAutoSelect) return null;
package/dist/index.js CHANGED
@@ -976,11 +976,14 @@ var BrowserSessionStore = class {
976
976
  function buildAutoSelectUpdate(current, asset, chainId) {
977
977
  const chains = current.chains ?? [];
978
978
  const chainMissing = chainId !== void 0 && !chains.includes(chainId);
979
- if (current.autoSelectProtocols === true && !chainMissing) return null;
979
+ const explicitlyOff = current.autoSelectProtocols === false;
980
+ const enable = current.autoSelectProtocols == null;
981
+ if (!enable && !chainMissing) return null;
980
982
  const nextChains = chainMissing ? [...chains, chainId] : chains;
983
+ if (explicitlyOff && !nextChains.length) return null;
981
984
  return {
982
985
  asset,
983
- autoSelectProtocols: true,
986
+ ...explicitlyOff ? {} : { autoSelectProtocols: true },
984
987
  ...nextChains.length ? { chains: nextChains } : {}
985
988
  };
986
989
  }
@@ -1000,9 +1003,7 @@ function buildProtocolMergeUpdate(available, current, asset, excluded = []) {
1000
1003
  const enabled = current.protocols ?? [];
1001
1004
  const kept = enabled.filter((id) => !isExcludedId(id));
1002
1005
  const keptSet = new Set(kept);
1003
- const missing = available.filter(
1004
- (p) => !keptSet.has(p.id) && !isExcluded(p)
1005
- );
1006
+ const missing = current.autoSelectProtocols === false ? [] : available.filter((p) => !keptSet.has(p.id) && !isExcluded(p));
1006
1007
  const fixAutoSelect = excluded.length > 0 && current.autoSelectProtocols !== false;
1007
1008
  const removedAny = kept.length !== enabled.length;
1008
1009
  if (missing.length === 0 && !removedAny && !fixAutoSelect) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",