@one_deploy/sdk 1.0.1 → 1.0.3

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.js CHANGED
@@ -13,15 +13,17 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
13
  var React2__default = /*#__PURE__*/_interopDefault(React2);
14
14
 
15
15
  // src/config/index.ts
16
+ var DEFAULT_ENGINE_URL = "https://api.one23.io";
17
+ var DEFAULT_CLIENT_ID = "one_pk_e8f647bfa643fdcfaa3a23f760488e49be09f929296eed4a6c399d437d907f60";
16
18
  var config = null;
17
19
  function initOneSDK(options) {
18
- if (!options.oneEngineUrl) {
19
- throw new Error("oneEngineUrl is required");
20
- }
21
- if (!options.oneClientId) {
22
- throw new Error("oneClientId is required");
23
- }
24
- config = options;
20
+ const engineUrl = options.oneEngineUrl || DEFAULT_ENGINE_URL;
21
+ const clientId = options.oneClientId || DEFAULT_CLIENT_ID;
22
+ config = {
23
+ ...options,
24
+ oneEngineUrl: engineUrl,
25
+ oneClientId: clientId
26
+ };
25
27
  }
26
28
  function getConfig() {
27
29
  if (!config) {
@@ -33,7 +35,7 @@ function isInitialized() {
33
35
  return config !== null;
34
36
  }
35
37
  function getEngineUrl() {
36
- return config?.oneEngineUrl || process.env.NEXT_PUBLIC_ONE_ENGINE_URL || "http://localhost:4000/api";
38
+ return config?.oneEngineUrl || process.env.NEXT_PUBLIC_ONE_ENGINE_URL || DEFAULT_ENGINE_URL;
37
39
  }
38
40
  var chainsCache = null;
39
41
  var chainsCacheTimestamp = 0;
@@ -1988,7 +1990,7 @@ function createWalletConfig(config2) {
1988
1990
  }
1989
1991
  return [inApp];
1990
1992
  }
1991
- var DEFAULT_ENGINE_URL = process.env.NEXT_PUBLIC_ONE_ENGINE_URL || "/api";
1993
+ var DEFAULT_ENGINE_URL2 = process.env.NEXT_PUBLIC_ONE_ENGINE_URL || "/api";
1992
1994
  function OneThirdwebProvider({
1993
1995
  children,
1994
1996
  config: config2 = {}
@@ -1999,7 +2001,7 @@ function OneThirdwebProvider({
1999
2001
  React2.useEffect(() => {
2000
2002
  const fetchClientConfig = async () => {
2001
2003
  try {
2002
- const engineUrl = config2.engineUrl || DEFAULT_ENGINE_URL;
2004
+ const engineUrl = config2.engineUrl || DEFAULT_ENGINE_URL2;
2003
2005
  const response = await fetch(`${engineUrl}/v1/config/thirdweb`);
2004
2006
  if (response.ok) {
2005
2007
  const data = await response.json();