@ab-org/predicate-market-sdk 2.2.0-beta.2 → 2.2.0-beta.5

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.
@@ -1,5 +1,5 @@
1
- import { chainConfig } from './chunk-6YQEHB6P.js';
2
- import { getSDKConfig } from './chunk-WHTI52FI.js';
1
+ import { chainConfig } from './chunk-SV3NR2LW.js';
2
+ import { getSDKConfig } from './chunk-UPMVYXZ6.js';
3
3
  import { getChainInfo } from './chunk-YX56ZGDB.js';
4
4
  import { sessionStore, getSupportedChainFromEvmChainId } from '@ab-org/sdk-core';
5
5
  import { CubeSignerAuth, createCubistEvmWalletProvider } from '@ab-org/sdk-core/social/auth';
@@ -86,15 +86,11 @@ var CubistWalletAccount = class {
86
86
  const params = payload.params ?? [];
87
87
  switch (payload.method) {
88
88
  case "wallet_switchEthereumChain":
89
- return await this.wallet_switchEthereumChain(
90
- params
91
- );
89
+ return await this.wallet_switchEthereumChain(params);
92
90
  case "eth_getBalance":
93
91
  return await this.eth_getBalance(params);
94
92
  case "eth_getTransactionCount":
95
- return await this.eth_getTransactionCount(
96
- params
97
- );
93
+ return await this.eth_getTransactionCount(params);
98
94
  default:
99
95
  return this.provider.request(payload);
100
96
  }
@@ -133,10 +129,7 @@ var CubistWalletAccount = class {
133
129
  if (blockTag !== "latest" && blockTag !== "pending") {
134
130
  throw new Error("type is not supported");
135
131
  }
136
- const nonceHex = await this.rpcRequest(
137
- "eth_getTransactionCount",
138
- [address, blockTag]
139
- );
132
+ const nonceHex = await this.rpcRequest("eth_getTransactionCount", [address, blockTag]);
140
133
  return Number(BigInt(nonceHex));
141
134
  }
142
135
  async personal_sign(params) {
@@ -161,7 +154,7 @@ var CubistWalletAccount = class {
161
154
  await this.provider.disconnect();
162
155
  }
163
156
  };
164
- var _WalletAccount = class _WalletAccount {
157
+ var WalletAccount = class _WalletAccount {
165
158
  /** Clear cached instance so next login creates a fresh CubeSigner session. */
166
159
  static clearInstance() {
167
160
  const current = _WalletAccount.instance;
@@ -180,20 +173,15 @@ var _WalletAccount = class _WalletAccount {
180
173
  const auth = new CubeSignerAuth(resolveCubeSignerConfig());
181
174
  const cubeSignerSession = await auth.loginWithOidcToken(oidcToken);
182
175
  const address = await resolveEvmAddress(cubeSignerSession);
183
- const walletAccount = new CubistWalletAccount(
184
- auth,
185
- cubeSignerSession,
186
- address,
187
- resolveDefaultChain()
188
- );
176
+ const walletAccount = new CubistWalletAccount(auth, cubeSignerSession, address, resolveDefaultChain());
189
177
  _WalletAccount.instance = walletAccount;
190
178
  _WalletAccount.instanceToken = oidcToken;
191
179
  return walletAccount;
192
180
  }
193
181
  };
194
- _WalletAccount.instance = null;
195
- _WalletAccount.instanceToken = null;
196
- var WalletAccount = _WalletAccount;
182
+ WalletAccount.instance = null;
183
+ WalletAccount.instanceToken = null;
184
+ var account_default = WalletAccount;
197
185
  function clearSocialAccountInstance() {
198
186
  WalletAccount.clearInstance();
199
187
  try {
@@ -201,7 +189,8 @@ function clearSocialAccountInstance() {
201
189
  const adapterId = storage?.getItem("ab:wallet:adapterId");
202
190
  const session = sessionStore.getState().session;
203
191
  const isSocialSession = session?.walletType === "social" || session?.authSource === "google" || session?.authSource === "twitter" || adapterId === "cubist";
204
- if (!isSocialSession) return;
192
+ if (!isSocialSession)
193
+ return;
205
194
  sessionStore.clearSession();
206
195
  storage?.removeItem("ab:wallet:session");
207
196
  storage?.removeItem("ab:wallet:adapterId");
@@ -210,4 +199,4 @@ function clearSocialAccountInstance() {
210
199
  }
211
200
  }
212
201
 
213
- export { clearSocialAccountInstance, WalletAccount as default };
202
+ export { clearSocialAccountInstance, account_default as default };
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { G as GoogleCredential, T as TwitterAuthResult } from './signInTypes-DESvmgWG.js';
1
+ export { G as GoogleCredential, T as TwitterAuthResult } from './signInTypes.d-DESvmgWG.js';
2
2
  import 'react';
3
3
  import '@ab-org/sdk-core';
4
4
 
package/dist/auth.js CHANGED
@@ -1 +1 @@
1
- export { notifyTwitterCallback } from './chunk-UAXKA6QC.js';
1
+ export { notifyTwitterCallback } from './chunk-ZS6FNG2D.js';
@@ -1,6 +1,6 @@
1
- import { getSDKConfig } from './chunk-55FTUSW7.js';
2
- import './chunk-ITLN6GHC.js';
3
- import './chunk-WHTI52FI.js';
1
+ import { getSDKConfig } from './chunk-BWKDIOBB.js';
2
+ import './chunk-CGP7TSLF.js';
3
+ import './chunk-UPMVYXZ6.js';
4
4
  import { sessionStore, createDefaultInjectedWalletRegistry, WalletConnector } from '@ab-org/sdk-core';
5
5
  import { CubistSocialProvider } from '@ab-org/sdk-core/social/provider';
6
6
 
@@ -1,6 +1,6 @@
1
1
  // src/core.ts
2
2
  function tryAutoReconnect() {
3
- return import('./autoReconnect-UEPGLSA7.js').then(({ tryAutoReconnect: reconnect }) => reconnect());
3
+ return import('./autoReconnect-STOYP7SX.js').then(({ tryAutoReconnect: reconnect }) => reconnect());
4
4
  }
5
5
 
6
6
  export { tryAutoReconnect };
@@ -1,5 +1,5 @@
1
- import { getOptionalEnv, setMerchantBaseUrl } from './chunk-ITLN6GHC.js';
2
- import { getSDKConfig, initSDK } from './chunk-WHTI52FI.js';
1
+ import { getOptionalEnv, setMerchantBaseUrl } from './chunk-CGP7TSLF.js';
2
+ import { getSDKConfig, initSDK } from './chunk-UPMVYXZ6.js';
3
3
  import { sessionStore } from '@ab-org/sdk-core';
4
4
  import { refreshCubeSignerSessionData } from '@ab-org/sdk-core/social/auth';
5
5
  import axios from 'axios';
@@ -9,13 +9,19 @@ function getBundledAuthConfig() {
9
9
  const relayOrigin = getOptionalEnv("RELAY_ORIGIN");
10
10
  const cubeEnv = getOptionalEnv("CUBE_SIGNER_ENV");
11
11
  const cubeOrgId = getOptionalEnv("CUBE_SIGNER_ORG_ID");
12
+ const cubeLifetimes = getOptionalEnv("CUBE_SIGNER_LIFETIMES");
12
13
  return {
13
14
  googleClientId: getOptionalEnv("GOOGLE_CLIENT_ID"),
14
15
  twitterClientId: getOptionalEnv("X_CLIENT_ID"),
15
16
  twitterRedirectUri: relayOrigin ? `${relayOrigin}/auth/twitter-callback` : void 0,
16
17
  cubeSigner: cubeEnv && cubeOrgId ? {
17
18
  env: cubeEnv,
18
- orgId: cubeOrgId
19
+ orgId: cubeOrgId,
20
+ lifetimes: cubeLifetimes == void 0 ? void 0 : {
21
+ session: parseInt(cubeLifetimes),
22
+ auth: parseInt(cubeLifetimes),
23
+ refresh: parseInt(cubeLifetimes) * 2
24
+ }
19
25
  } : void 0
20
26
  };
21
27
  }
@@ -87,19 +93,7 @@ async function defaultRegisterUser(oidcToken) {
87
93
  // src/auth/config.ts
88
94
  function getFixedAuthConfig() {
89
95
  const bundled = getBundledAuthConfig();
90
- const envGoogle = getOptionalEnv("GOOGLE_CLIENT_ID");
91
- const envTwitter = getOptionalEnv("X_CLIENT_ID");
92
- const relayOrigin = getOptionalEnv("RELAY_ORIGIN");
93
- const envRedirect = relayOrigin ? `${relayOrigin}/auth/twitter-callback` : void 0;
94
- const cubeEnv = getOptionalEnv("CUBE_SIGNER_ENV");
95
- const cubeOrgId = getOptionalEnv("CUBE_SIGNER_ORG_ID");
96
- const cubeSignerFromEnv = cubeEnv && cubeOrgId ? { env: cubeEnv, orgId: cubeOrgId } : void 0;
97
- return {
98
- googleClientId: envGoogle || bundled.googleClientId,
99
- twitterClientId: envTwitter || bundled.twitterClientId,
100
- twitterRedirectUri: envRedirect || bundled.twitterRedirectUri,
101
- cubeSigner: cubeSignerFromEnv ?? bundled.cubeSigner
102
- };
96
+ return bundled;
103
97
  }
104
98
  var CUBE_KEEPALIVE_INTERVAL_MS = 5 * 60 * 1e3;
105
99
  function getCubistKeepAliveIntervalMs() {
@@ -136,7 +130,7 @@ async function refreshActiveCubistSession() {
136
130
  }
137
131
  function scheduleAutoReconnect() {
138
132
  if (typeof window === "undefined") return;
139
- void import('./autoReconnect-UEPGLSA7.js').then(({ tryAutoReconnect }) => tryAutoReconnect()).catch(() => {
133
+ void import('./autoReconnect-STOYP7SX.js').then(({ tryAutoReconnect }) => tryAutoReconnect()).catch(() => {
140
134
  });
141
135
  }
142
136
  function scheduleCubistKeepAlive() {
@@ -23,6 +23,8 @@ function readProcessEnvStatic(key) {
23
23
  return pick(process.env.NEXT_PUBLIC_CUBE_SIGNER_ENV, process.env.CUBE_SIGNER_ENV);
24
24
  case "CUBE_SIGNER_ORG_ID":
25
25
  return pick(process.env.NEXT_PUBLIC_CUBE_SIGNER_ORG_ID, process.env.CUBE_SIGNER_ORG_ID);
26
+ case "CUBE_SIGNER_LIFETIMES":
27
+ return pick(process.env.NEXT_PUBLIC_CUBE_SIGNER_LIFETIMES, process.env.CUBE_SIGNER_LIFETIMES);
26
28
  case "CUBE_REG":
27
29
  return pick(process.env.NEXT_PUBLIC_CUBE_REG, process.env.CUBE_REG);
28
30
  case "RELAY_ORIGIN":