@owney/sdk 0.6.6-beta.5 → 0.6.6-beta.6

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
@@ -641,6 +641,10 @@ var WETH_ADDRESS_BY_CHAIN = {
641
641
  1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
642
642
  };
643
643
  var VIEM_CHAIN = { 8453: import_chains.base, 42161: import_chains.arbitrum, 1: import_chains.mainnet };
644
+ function isAlreadyActiveSessionKeyError(error) {
645
+ const message = error instanceof Error ? error.message : String(error);
646
+ return /already has an active session key/i.test(message);
647
+ }
644
648
  var ZyfaiAgent = class {
645
649
  id = "zyfai";
646
650
  supportedChainIds = [8453, 42161, 1];
@@ -914,7 +918,12 @@ var ZyfaiAgent = class {
914
918
  if (wasSessionKeyActivated(address, chainId)) return;
915
919
  const internals = this.sdk;
916
920
  internals.hasActiveSessionKey = false;
917
- await this.sdk.createSessionKey(address, chainId);
921
+ try {
922
+ await this.sdk.createSessionKey(address, chainId);
923
+ } catch (error) {
924
+ if (!isAlreadyActiveSessionKeyError(error)) throw error;
925
+ internals.hasActiveSessionKey = true;
926
+ }
918
927
  markSessionKeyActivated(address, chainId);
919
928
  }
920
929
  /** Connect + resolve smart wallet address for read operations. */
package/dist/index.js CHANGED
@@ -609,6 +609,10 @@ var WETH_ADDRESS_BY_CHAIN = {
609
609
  1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
610
610
  };
611
611
  var VIEM_CHAIN = { 8453: base, 42161: arbitrum, 1: mainnet };
612
+ function isAlreadyActiveSessionKeyError(error) {
613
+ const message = error instanceof Error ? error.message : String(error);
614
+ return /already has an active session key/i.test(message);
615
+ }
612
616
  var ZyfaiAgent = class {
613
617
  id = "zyfai";
614
618
  supportedChainIds = [8453, 42161, 1];
@@ -882,7 +886,12 @@ var ZyfaiAgent = class {
882
886
  if (wasSessionKeyActivated(address, chainId)) return;
883
887
  const internals = this.sdk;
884
888
  internals.hasActiveSessionKey = false;
885
- await this.sdk.createSessionKey(address, chainId);
889
+ try {
890
+ await this.sdk.createSessionKey(address, chainId);
891
+ } catch (error) {
892
+ if (!isAlreadyActiveSessionKeyError(error)) throw error;
893
+ internals.hasActiveSessionKey = true;
894
+ }
886
895
  markSessionKeyActivated(address, chainId);
887
896
  }
888
897
  /** Connect + resolve smart wallet address for read operations. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.6.6-beta.5",
3
+ "version": "0.6.6-beta.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",