@phantom/browser-sdk 1.0.0-beta.4 → 1.0.0-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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { EmbeddedProviderConfig, AuthOptions, ConnectResult, WalletAddress, EmbeddedProviderEvent, EventCallback } from '@phantom/embedded-provider-core';
2
2
  export { AuthOptions, ConnectResult, SignAndSendTransactionParams, SignMessageParams, SignMessageResult, SignedTransaction, WalletAddress } from '@phantom/embedded-provider-core';
3
- import { ISolanaChain, IEthereumChain } from '@phantom/chains';
4
- export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/chains';
3
+ import { ISolanaChain, IEthereumChain } from '@phantom/chain-interfaces';
4
+ export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/chain-interfaces';
5
5
  import { AddressType } from '@phantom/client';
6
6
  export { AddressType } from '@phantom/client';
7
7
  import { AutoConfirmEnableParams, AutoConfirmResult, AutoConfirmSupportedChainsResult } from '@phantom/browser-injected-sdk/auto-confirm';
package/dist/index.js CHANGED
@@ -36,8 +36,11 @@ __export(src_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(src_exports);
38
38
 
39
+ // src/types.ts
40
+ var import_client = require("@phantom/client");
41
+
39
42
  // src/providers/injected/index.ts
40
- var import_client3 = require("@phantom/client");
43
+ var import_client4 = require("@phantom/client");
41
44
  var import_browser_injected_sdk = require("@phantom/browser-injected-sdk");
42
45
  var import_solana = require("@phantom/browser-injected-sdk/solana");
43
46
  var import_ethereum = require("@phantom/browser-injected-sdk/ethereum");
@@ -119,7 +122,7 @@ var DebugCategory = {
119
122
 
120
123
  // src/providers/injected/chains/SolanaChain.ts
121
124
  var import_eventemitter3 = require("eventemitter3");
122
- var import_client = require("@phantom/client");
125
+ var import_client2 = require("@phantom/client");
123
126
  var import_buffer = require("buffer");
124
127
  var InjectedSolanaChain = class {
125
128
  constructor(phantom, callbacks) {
@@ -144,7 +147,7 @@ var InjectedSolanaChain = class {
144
147
  return Promise.reject(new Error("Provider not connected. Call provider connect first."));
145
148
  }
146
149
  const addresses = this.callbacks.getAddresses();
147
- const solanaAddress = addresses.find((addr) => addr.addressType === import_client.AddressType.solana);
150
+ const solanaAddress = addresses.find((addr) => addr.addressType === import_client2.AddressType.solana);
148
151
  if (!solanaAddress) {
149
152
  return Promise.reject(new Error("Solana not enabled for this provider"));
150
153
  }
@@ -224,7 +227,7 @@ var InjectedSolanaChain = class {
224
227
  this.eventEmitter.emit("accountChanged", publicKey);
225
228
  });
226
229
  this.callbacks.on("connect", (data) => {
227
- const solanaAddress = data.addresses?.find((addr) => addr.addressType === import_client.AddressType.solana);
230
+ const solanaAddress = data.addresses?.find((addr) => addr.addressType === import_client2.AddressType.solana);
228
231
  if (solanaAddress) {
229
232
  this.updateConnectionState(true, solanaAddress.address);
230
233
  }
@@ -235,7 +238,7 @@ var InjectedSolanaChain = class {
235
238
  }
236
239
  syncInitialState() {
237
240
  if (this.callbacks.isConnected()) {
238
- const solanaAddress = this.callbacks.getAddresses().find((addr) => addr.addressType === import_client.AddressType.solana);
241
+ const solanaAddress = this.callbacks.getAddresses().find((addr) => addr.addressType === import_client2.AddressType.solana);
239
242
  if (solanaAddress) {
240
243
  this.updateConnectionState(true, solanaAddress.address);
241
244
  }
@@ -256,7 +259,7 @@ var InjectedSolanaChain = class {
256
259
 
257
260
  // src/providers/injected/chains/EthereumChain.ts
258
261
  var import_eventemitter32 = require("eventemitter3");
259
- var import_client2 = require("@phantom/client");
262
+ var import_client3 = require("@phantom/client");
260
263
  var InjectedEthereumChain = class {
261
264
  constructor(phantom, callbacks) {
262
265
  this._connected = false;
@@ -294,7 +297,7 @@ var InjectedEthereumChain = class {
294
297
  return Promise.reject(new Error("Provider not connected. Call provider connect first."));
295
298
  }
296
299
  const addresses = this.callbacks.getAddresses();
297
- const ethAddresses = addresses.filter((addr) => addr.addressType === import_client2.AddressType.ethereum).map((addr) => addr.address);
300
+ const ethAddresses = addresses.filter((addr) => addr.addressType === import_client3.AddressType.ethereum).map((addr) => addr.address);
298
301
  this.updateConnectionState(true, ethAddresses);
299
302
  return Promise.resolve(ethAddresses);
300
303
  }
@@ -349,7 +352,7 @@ var InjectedEthereumChain = class {
349
352
  this.eventEmitter.emit("chainChanged", chainId);
350
353
  });
351
354
  this.callbacks.on("connect", (data) => {
352
- const ethAddresses = data.addresses?.filter((addr) => addr.addressType === import_client2.AddressType.ethereum)?.map((addr) => addr.address) || [];
355
+ const ethAddresses = data.addresses?.filter((addr) => addr.addressType === import_client3.AddressType.ethereum)?.map((addr) => addr.address) || [];
353
356
  if (ethAddresses.length > 0) {
354
357
  this.updateConnectionState(true, ethAddresses);
355
358
  }
@@ -360,7 +363,7 @@ var InjectedEthereumChain = class {
360
363
  }
361
364
  syncInitialState() {
362
365
  if (this.callbacks.isConnected()) {
363
- const ethAddresses = this.callbacks.getAddresses().filter((addr) => addr.addressType === import_client2.AddressType.ethereum).map((addr) => addr.address);
366
+ const ethAddresses = this.callbacks.getAddresses().filter((addr) => addr.addressType === import_client3.AddressType.ethereum).map((addr) => addr.address);
364
367
  if (ethAddresses.length > 0) {
365
368
  this.updateConnectionState(true, ethAddresses);
366
369
  }
@@ -392,11 +395,11 @@ var InjectedProvider = class {
392
395
  this.addressTypes = config.addressTypes;
393
396
  debug.log(DebugCategory.INJECTED_PROVIDER, "Address types configured", { addressTypes: this.addressTypes });
394
397
  const plugins = [(0, import_browser_injected_sdk.createExtensionPlugin)()];
395
- if (this.addressTypes.includes(import_client3.AddressType.solana)) {
398
+ if (this.addressTypes.includes(import_client4.AddressType.solana)) {
396
399
  plugins.push((0, import_solana.createSolanaPlugin)());
397
400
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana plugin added");
398
401
  }
399
- if (this.addressTypes.includes(import_client3.AddressType.ethereum)) {
402
+ if (this.addressTypes.includes(import_client4.AddressType.ethereum)) {
400
403
  plugins.push((0, import_ethereum.createEthereumPlugin)());
401
404
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum plugin added");
402
405
  }
@@ -407,10 +410,10 @@ var InjectedProvider = class {
407
410
  });
408
411
  this.phantom = (0, import_browser_injected_sdk.createPhantom)({ plugins });
409
412
  const callbacks = this.createCallbacks();
410
- if (this.addressTypes.includes(import_client3.AddressType.solana)) {
413
+ if (this.addressTypes.includes(import_client4.AddressType.solana)) {
411
414
  this._solanaChain = new InjectedSolanaChain(this.phantom, callbacks);
412
415
  }
413
- if (this.addressTypes.includes(import_client3.AddressType.ethereum)) {
416
+ if (this.addressTypes.includes(import_client4.AddressType.ethereum)) {
414
417
  this._ethereumChain = new InjectedEthereumChain(this.phantom, callbacks);
415
418
  }
416
419
  debug.info(DebugCategory.INJECTED_PROVIDER, "InjectedProvider initialized");
@@ -419,7 +422,7 @@ var InjectedProvider = class {
419
422
  * Access to Solana chain operations
420
423
  */
421
424
  get solana() {
422
- if (!this.addressTypes.includes(import_client3.AddressType.solana)) {
425
+ if (!this.addressTypes.includes(import_client4.AddressType.solana)) {
423
426
  throw new Error("Solana not enabled for this provider");
424
427
  }
425
428
  if (!this._solanaChain) {
@@ -431,7 +434,7 @@ var InjectedProvider = class {
431
434
  * Access to Ethereum chain operations
432
435
  */
433
436
  get ethereum() {
434
- if (!this.addressTypes.includes(import_client3.AddressType.ethereum)) {
437
+ if (!this.addressTypes.includes(import_client4.AddressType.ethereum)) {
435
438
  throw new Error("Ethereum not enabled for this provider");
436
439
  }
437
440
  if (!this._ethereumChain) {
@@ -461,13 +464,13 @@ var InjectedProvider = class {
461
464
  }
462
465
  debug.log(DebugCategory.INJECTED_PROVIDER, "Phantom extension detected");
463
466
  const connectedAddresses = [];
464
- if (this.addressTypes.includes(import_client3.AddressType.solana)) {
467
+ if (this.addressTypes.includes(import_client4.AddressType.solana)) {
465
468
  debug.log(DebugCategory.INJECTED_PROVIDER, "Attempting Solana connection");
466
469
  try {
467
470
  const publicKey = await this.phantom.solana.connect();
468
471
  if (publicKey) {
469
472
  connectedAddresses.push({
470
- addressType: import_client3.AddressType.solana,
473
+ addressType: import_client4.AddressType.solana,
471
474
  address: publicKey
472
475
  });
473
476
  debug.info(DebugCategory.INJECTED_PROVIDER, "Solana connected successfully", { address: publicKey });
@@ -476,13 +479,13 @@ var InjectedProvider = class {
476
479
  debug.warn(DebugCategory.INJECTED_PROVIDER, "Failed to connect Solana", { error: err });
477
480
  }
478
481
  }
479
- if (this.addressTypes.includes(import_client3.AddressType.ethereum)) {
482
+ if (this.addressTypes.includes(import_client4.AddressType.ethereum)) {
480
483
  try {
481
484
  const accounts = await this.phantom.ethereum.connect();
482
485
  if (accounts && accounts.length > 0) {
483
486
  connectedAddresses.push(
484
487
  ...accounts.map((address) => ({
485
- addressType: import_client3.AddressType.ethereum,
488
+ addressType: import_client4.AddressType.ethereum,
486
489
  address
487
490
  }))
488
491
  );
@@ -524,7 +527,7 @@ var InjectedProvider = class {
524
527
  }
525
528
  async disconnect() {
526
529
  debug.info(DebugCategory.INJECTED_PROVIDER, "Starting injected provider disconnect");
527
- if (this.addressTypes.includes(import_client3.AddressType.solana)) {
530
+ if (this.addressTypes.includes(import_client4.AddressType.solana)) {
528
531
  try {
529
532
  await this.phantom.solana.disconnect();
530
533
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana disconnected successfully");
@@ -532,7 +535,7 @@ var InjectedProvider = class {
532
535
  debug.warn(DebugCategory.INJECTED_PROVIDER, "Failed to disconnect Solana", { error: err });
533
536
  }
534
537
  }
535
- if (this.addressTypes.includes(import_client3.AddressType.ethereum)) {
538
+ if (this.addressTypes.includes(import_client4.AddressType.ethereum)) {
536
539
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum disconnected (no-op)");
537
540
  }
538
541
  this.browserInjectedCleanupFunctions.forEach((cleanup) => cleanup());
@@ -607,10 +610,10 @@ var InjectedProvider = class {
607
610
  }
608
611
  setupBrowserInjectedEvents() {
609
612
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up browser-injected-sdk event listeners");
610
- if (this.addressTypes.includes(import_client3.AddressType.solana)) {
613
+ if (this.addressTypes.includes(import_client4.AddressType.solana)) {
611
614
  this.setupSolanaEvents();
612
615
  }
613
- if (this.addressTypes.includes(import_client3.AddressType.ethereum)) {
616
+ if (this.addressTypes.includes(import_client4.AddressType.ethereum)) {
614
617
  this.setupEthereumEvents();
615
618
  }
616
619
  }
@@ -618,8 +621,8 @@ var InjectedProvider = class {
618
621
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up Solana event listeners");
619
622
  const handleSolanaConnect = (publicKey) => {
620
623
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana connect event received", { publicKey });
621
- const solanaAddress = { addressType: import_client3.AddressType.solana, address: publicKey };
622
- if (!this.addresses.find((addr) => addr.addressType === import_client3.AddressType.solana)) {
624
+ const solanaAddress = { addressType: import_client4.AddressType.solana, address: publicKey };
625
+ if (!this.addresses.find((addr) => addr.addressType === import_client4.AddressType.solana)) {
623
626
  this.addresses.push(solanaAddress);
624
627
  }
625
628
  this.connected = true;
@@ -630,7 +633,7 @@ var InjectedProvider = class {
630
633
  };
631
634
  const handleSolanaDisconnect = () => {
632
635
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana disconnect event received");
633
- this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client3.AddressType.solana);
636
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client4.AddressType.solana);
634
637
  this.connected = this.addresses.length > 0;
635
638
  this.emit("disconnect", {
636
639
  source: "injected-extension"
@@ -638,11 +641,11 @@ var InjectedProvider = class {
638
641
  };
639
642
  const handleSolanaAccountChanged = (publicKey) => {
640
643
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana account changed event received", { publicKey });
641
- const solanaIndex = this.addresses.findIndex((addr) => addr.addressType === import_client3.AddressType.solana);
644
+ const solanaIndex = this.addresses.findIndex((addr) => addr.addressType === import_client4.AddressType.solana);
642
645
  if (solanaIndex >= 0) {
643
- this.addresses[solanaIndex] = { addressType: import_client3.AddressType.solana, address: publicKey };
646
+ this.addresses[solanaIndex] = { addressType: import_client4.AddressType.solana, address: publicKey };
644
647
  } else {
645
- this.addresses.push({ addressType: import_client3.AddressType.solana, address: publicKey });
648
+ this.addresses.push({ addressType: import_client4.AddressType.solana, address: publicKey });
646
649
  }
647
650
  this.emit("connect", {
648
651
  addresses: this.addresses,
@@ -661,11 +664,11 @@ var InjectedProvider = class {
661
664
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up Ethereum event listeners");
662
665
  const handleEthereumConnect = (accounts) => {
663
666
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum connect event received", { accounts });
664
- this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client3.AddressType.ethereum);
667
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client4.AddressType.ethereum);
665
668
  if (accounts && accounts.length > 0) {
666
669
  this.addresses.push(
667
670
  ...accounts.map((address) => ({
668
- addressType: import_client3.AddressType.ethereum,
671
+ addressType: import_client4.AddressType.ethereum,
669
672
  address
670
673
  }))
671
674
  );
@@ -678,7 +681,7 @@ var InjectedProvider = class {
678
681
  };
679
682
  const handleEthereumDisconnect = () => {
680
683
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum disconnect event received");
681
- this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client3.AddressType.ethereum);
684
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client4.AddressType.ethereum);
682
685
  this.connected = this.addresses.length > 0;
683
686
  this.emit("disconnect", {
684
687
  source: "injected-extension"
@@ -686,11 +689,11 @@ var InjectedProvider = class {
686
689
  };
687
690
  const handleEthereumAccountsChanged = (accounts) => {
688
691
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum accounts changed event received", { accounts });
689
- this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client3.AddressType.ethereum);
692
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== import_client4.AddressType.ethereum);
690
693
  if (accounts && accounts.length > 0) {
691
694
  this.addresses.push(
692
695
  ...accounts.map((address) => ({
693
- addressType: import_client3.AddressType.ethereum,
696
+ addressType: import_client4.AddressType.ethereum,
694
697
  address
695
698
  }))
696
699
  );
@@ -848,7 +851,6 @@ var BrowserAuthProvider = class {
848
851
  const phantomOptions = options;
849
852
  debug.info(DebugCategory.PHANTOM_CONNECT_AUTH, "Starting Phantom Connect authentication", {
850
853
  organizationId: phantomOptions.organizationId,
851
- parentOrganizationId: phantomOptions.parentOrganizationId,
852
854
  appId: phantomOptions.appId,
853
855
  provider: phantomOptions.provider,
854
856
  authUrl: phantomOptions.authUrl,
@@ -858,7 +860,6 @@ var BrowserAuthProvider = class {
858
860
  debug.log(DebugCategory.PHANTOM_CONNECT_AUTH, "Using auth URL", { baseUrl });
859
861
  const params = new URLSearchParams({
860
862
  organization_id: phantomOptions.organizationId,
861
- parent_organization_id: phantomOptions.parentOrganizationId,
862
863
  app_id: phantomOptions.appId,
863
864
  redirect_uri: phantomOptions.redirectUrl || (typeof window !== "undefined" ? this.getValidatedCurrentUrl() : ""),
864
865
  session_id: phantomOptions.sessionId,
@@ -879,7 +880,6 @@ var BrowserAuthProvider = class {
879
880
  }
880
881
  const authContext = {
881
882
  organizationId: phantomOptions.organizationId,
882
- parentOrganizationId: phantomOptions.parentOrganizationId,
883
883
  appId: phantomOptions.appId,
884
884
  provider: phantomOptions.provider,
885
885
  sessionId: phantomOptions.sessionId
@@ -1120,7 +1120,7 @@ var EmbeddedProvider = class extends import_embedded_provider_core.EmbeddedProvi
1120
1120
  debug.log(DebugCategory.EMBEDDED_PROVIDER, "Initializing Browser EmbeddedProvider", { config });
1121
1121
  const urlParamsAccessor = new BrowserURLParamsAccessor();
1122
1122
  const stamper = new import_indexed_db_stamper.IndexedDbStamper({
1123
- dbName: `phantom-embedded-sdk-${config.organizationId}`,
1123
+ dbName: `phantom-embedded-sdk-${config.appId}`,
1124
1124
  storeName: "crypto-keys",
1125
1125
  keyName: "signing-key"
1126
1126
  });
@@ -1141,7 +1141,7 @@ var EmbeddedProvider = class extends import_embedded_provider_core.EmbeddedProvi
1141
1141
  // Full user agent for more detailed info
1142
1142
  [import_constants2.ANALYTICS_HEADERS.APP_ID]: config.appId,
1143
1143
  [import_constants2.ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
1144
- [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.4"
1144
+ [import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.6"
1145
1145
  // Replaced at build time
1146
1146
  }
1147
1147
  };
@@ -1373,7 +1373,7 @@ var ProviderManager = class {
1373
1373
  let provider;
1374
1374
  if (type === "injected") {
1375
1375
  provider = new InjectedProvider({
1376
- addressTypes: this.config.addressTypes
1376
+ addressTypes: this.config.addressTypes || [import_client.AddressType.solana]
1377
1377
  });
1378
1378
  } else if (type === "embedded") {
1379
1379
  if (!this.config.appId) {
@@ -1383,7 +1383,6 @@ var ProviderManager = class {
1383
1383
  const authUrl = this.config.authOptions?.authUrl || import_constants3.DEFAULT_AUTH_URL;
1384
1384
  provider = new EmbeddedProvider({
1385
1385
  apiBaseUrl,
1386
- organizationId: this.config.appId,
1387
1386
  appId: this.config.appId,
1388
1387
  authOptions: {
1389
1388
  ...this.config.authOptions || {},
@@ -1391,7 +1390,7 @@ var ProviderManager = class {
1391
1390
  redirectUrl: this.config.authOptions?.redirectUrl || this.getValidatedCurrentUrl()
1392
1391
  },
1393
1392
  embeddedWalletType: embeddedWalletType || import_constants3.DEFAULT_EMBEDDED_WALLET_TYPE,
1394
- addressTypes: this.config.addressTypes
1393
+ addressTypes: this.config.addressTypes || [import_client.AddressType.solana]
1395
1394
  });
1396
1395
  } else {
1397
1396
  throw new Error(`Unsupported provider type: ${type}`);
@@ -1765,9 +1764,6 @@ var BrowserSDK = class {
1765
1764
  }
1766
1765
  };
1767
1766
 
1768
- // src/types.ts
1769
- var import_client4 = require("@phantom/client");
1770
-
1771
1767
  // src/utils/deeplink.ts
1772
1768
  function getDeeplinkToPhantom(ref) {
1773
1769
  if (!window.location.href.startsWith("http:") && !window.location.href.startsWith("https:")) {
package/dist/index.mjs CHANGED
@@ -1,5 +1,8 @@
1
+ // src/types.ts
2
+ import { AddressType } from "@phantom/client";
3
+
1
4
  // src/providers/injected/index.ts
2
- import { AddressType as AddressType3 } from "@phantom/client";
5
+ import { AddressType as AddressType4 } from "@phantom/client";
3
6
  import { createPhantom, createExtensionPlugin } from "@phantom/browser-injected-sdk";
4
7
  import { createSolanaPlugin } from "@phantom/browser-injected-sdk/solana";
5
8
  import { createEthereumPlugin } from "@phantom/browser-injected-sdk/ethereum";
@@ -83,7 +86,7 @@ var DebugCategory = {
83
86
 
84
87
  // src/providers/injected/chains/SolanaChain.ts
85
88
  import { EventEmitter } from "eventemitter3";
86
- import { AddressType } from "@phantom/client";
89
+ import { AddressType as AddressType2 } from "@phantom/client";
87
90
  import { Buffer } from "buffer";
88
91
  var InjectedSolanaChain = class {
89
92
  constructor(phantom, callbacks) {
@@ -108,7 +111,7 @@ var InjectedSolanaChain = class {
108
111
  return Promise.reject(new Error("Provider not connected. Call provider connect first."));
109
112
  }
110
113
  const addresses = this.callbacks.getAddresses();
111
- const solanaAddress = addresses.find((addr) => addr.addressType === AddressType.solana);
114
+ const solanaAddress = addresses.find((addr) => addr.addressType === AddressType2.solana);
112
115
  if (!solanaAddress) {
113
116
  return Promise.reject(new Error("Solana not enabled for this provider"));
114
117
  }
@@ -188,7 +191,7 @@ var InjectedSolanaChain = class {
188
191
  this.eventEmitter.emit("accountChanged", publicKey);
189
192
  });
190
193
  this.callbacks.on("connect", (data) => {
191
- const solanaAddress = data.addresses?.find((addr) => addr.addressType === AddressType.solana);
194
+ const solanaAddress = data.addresses?.find((addr) => addr.addressType === AddressType2.solana);
192
195
  if (solanaAddress) {
193
196
  this.updateConnectionState(true, solanaAddress.address);
194
197
  }
@@ -199,7 +202,7 @@ var InjectedSolanaChain = class {
199
202
  }
200
203
  syncInitialState() {
201
204
  if (this.callbacks.isConnected()) {
202
- const solanaAddress = this.callbacks.getAddresses().find((addr) => addr.addressType === AddressType.solana);
205
+ const solanaAddress = this.callbacks.getAddresses().find((addr) => addr.addressType === AddressType2.solana);
203
206
  if (solanaAddress) {
204
207
  this.updateConnectionState(true, solanaAddress.address);
205
208
  }
@@ -220,7 +223,7 @@ var InjectedSolanaChain = class {
220
223
 
221
224
  // src/providers/injected/chains/EthereumChain.ts
222
225
  import { EventEmitter as EventEmitter2 } from "eventemitter3";
223
- import { AddressType as AddressType2 } from "@phantom/client";
226
+ import { AddressType as AddressType3 } from "@phantom/client";
224
227
  var InjectedEthereumChain = class {
225
228
  constructor(phantom, callbacks) {
226
229
  this._connected = false;
@@ -258,7 +261,7 @@ var InjectedEthereumChain = class {
258
261
  return Promise.reject(new Error("Provider not connected. Call provider connect first."));
259
262
  }
260
263
  const addresses = this.callbacks.getAddresses();
261
- const ethAddresses = addresses.filter((addr) => addr.addressType === AddressType2.ethereum).map((addr) => addr.address);
264
+ const ethAddresses = addresses.filter((addr) => addr.addressType === AddressType3.ethereum).map((addr) => addr.address);
262
265
  this.updateConnectionState(true, ethAddresses);
263
266
  return Promise.resolve(ethAddresses);
264
267
  }
@@ -313,7 +316,7 @@ var InjectedEthereumChain = class {
313
316
  this.eventEmitter.emit("chainChanged", chainId);
314
317
  });
315
318
  this.callbacks.on("connect", (data) => {
316
- const ethAddresses = data.addresses?.filter((addr) => addr.addressType === AddressType2.ethereum)?.map((addr) => addr.address) || [];
319
+ const ethAddresses = data.addresses?.filter((addr) => addr.addressType === AddressType3.ethereum)?.map((addr) => addr.address) || [];
317
320
  if (ethAddresses.length > 0) {
318
321
  this.updateConnectionState(true, ethAddresses);
319
322
  }
@@ -324,7 +327,7 @@ var InjectedEthereumChain = class {
324
327
  }
325
328
  syncInitialState() {
326
329
  if (this.callbacks.isConnected()) {
327
- const ethAddresses = this.callbacks.getAddresses().filter((addr) => addr.addressType === AddressType2.ethereum).map((addr) => addr.address);
330
+ const ethAddresses = this.callbacks.getAddresses().filter((addr) => addr.addressType === AddressType3.ethereum).map((addr) => addr.address);
328
331
  if (ethAddresses.length > 0) {
329
332
  this.updateConnectionState(true, ethAddresses);
330
333
  }
@@ -356,11 +359,11 @@ var InjectedProvider = class {
356
359
  this.addressTypes = config.addressTypes;
357
360
  debug.log(DebugCategory.INJECTED_PROVIDER, "Address types configured", { addressTypes: this.addressTypes });
358
361
  const plugins = [createExtensionPlugin()];
359
- if (this.addressTypes.includes(AddressType3.solana)) {
362
+ if (this.addressTypes.includes(AddressType4.solana)) {
360
363
  plugins.push(createSolanaPlugin());
361
364
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana plugin added");
362
365
  }
363
- if (this.addressTypes.includes(AddressType3.ethereum)) {
366
+ if (this.addressTypes.includes(AddressType4.ethereum)) {
364
367
  plugins.push(createEthereumPlugin());
365
368
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum plugin added");
366
369
  }
@@ -371,10 +374,10 @@ var InjectedProvider = class {
371
374
  });
372
375
  this.phantom = createPhantom({ plugins });
373
376
  const callbacks = this.createCallbacks();
374
- if (this.addressTypes.includes(AddressType3.solana)) {
377
+ if (this.addressTypes.includes(AddressType4.solana)) {
375
378
  this._solanaChain = new InjectedSolanaChain(this.phantom, callbacks);
376
379
  }
377
- if (this.addressTypes.includes(AddressType3.ethereum)) {
380
+ if (this.addressTypes.includes(AddressType4.ethereum)) {
378
381
  this._ethereumChain = new InjectedEthereumChain(this.phantom, callbacks);
379
382
  }
380
383
  debug.info(DebugCategory.INJECTED_PROVIDER, "InjectedProvider initialized");
@@ -383,7 +386,7 @@ var InjectedProvider = class {
383
386
  * Access to Solana chain operations
384
387
  */
385
388
  get solana() {
386
- if (!this.addressTypes.includes(AddressType3.solana)) {
389
+ if (!this.addressTypes.includes(AddressType4.solana)) {
387
390
  throw new Error("Solana not enabled for this provider");
388
391
  }
389
392
  if (!this._solanaChain) {
@@ -395,7 +398,7 @@ var InjectedProvider = class {
395
398
  * Access to Ethereum chain operations
396
399
  */
397
400
  get ethereum() {
398
- if (!this.addressTypes.includes(AddressType3.ethereum)) {
401
+ if (!this.addressTypes.includes(AddressType4.ethereum)) {
399
402
  throw new Error("Ethereum not enabled for this provider");
400
403
  }
401
404
  if (!this._ethereumChain) {
@@ -425,13 +428,13 @@ var InjectedProvider = class {
425
428
  }
426
429
  debug.log(DebugCategory.INJECTED_PROVIDER, "Phantom extension detected");
427
430
  const connectedAddresses = [];
428
- if (this.addressTypes.includes(AddressType3.solana)) {
431
+ if (this.addressTypes.includes(AddressType4.solana)) {
429
432
  debug.log(DebugCategory.INJECTED_PROVIDER, "Attempting Solana connection");
430
433
  try {
431
434
  const publicKey = await this.phantom.solana.connect();
432
435
  if (publicKey) {
433
436
  connectedAddresses.push({
434
- addressType: AddressType3.solana,
437
+ addressType: AddressType4.solana,
435
438
  address: publicKey
436
439
  });
437
440
  debug.info(DebugCategory.INJECTED_PROVIDER, "Solana connected successfully", { address: publicKey });
@@ -440,13 +443,13 @@ var InjectedProvider = class {
440
443
  debug.warn(DebugCategory.INJECTED_PROVIDER, "Failed to connect Solana", { error: err });
441
444
  }
442
445
  }
443
- if (this.addressTypes.includes(AddressType3.ethereum)) {
446
+ if (this.addressTypes.includes(AddressType4.ethereum)) {
444
447
  try {
445
448
  const accounts = await this.phantom.ethereum.connect();
446
449
  if (accounts && accounts.length > 0) {
447
450
  connectedAddresses.push(
448
451
  ...accounts.map((address) => ({
449
- addressType: AddressType3.ethereum,
452
+ addressType: AddressType4.ethereum,
450
453
  address
451
454
  }))
452
455
  );
@@ -488,7 +491,7 @@ var InjectedProvider = class {
488
491
  }
489
492
  async disconnect() {
490
493
  debug.info(DebugCategory.INJECTED_PROVIDER, "Starting injected provider disconnect");
491
- if (this.addressTypes.includes(AddressType3.solana)) {
494
+ if (this.addressTypes.includes(AddressType4.solana)) {
492
495
  try {
493
496
  await this.phantom.solana.disconnect();
494
497
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana disconnected successfully");
@@ -496,7 +499,7 @@ var InjectedProvider = class {
496
499
  debug.warn(DebugCategory.INJECTED_PROVIDER, "Failed to disconnect Solana", { error: err });
497
500
  }
498
501
  }
499
- if (this.addressTypes.includes(AddressType3.ethereum)) {
502
+ if (this.addressTypes.includes(AddressType4.ethereum)) {
500
503
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum disconnected (no-op)");
501
504
  }
502
505
  this.browserInjectedCleanupFunctions.forEach((cleanup) => cleanup());
@@ -571,10 +574,10 @@ var InjectedProvider = class {
571
574
  }
572
575
  setupBrowserInjectedEvents() {
573
576
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up browser-injected-sdk event listeners");
574
- if (this.addressTypes.includes(AddressType3.solana)) {
577
+ if (this.addressTypes.includes(AddressType4.solana)) {
575
578
  this.setupSolanaEvents();
576
579
  }
577
- if (this.addressTypes.includes(AddressType3.ethereum)) {
580
+ if (this.addressTypes.includes(AddressType4.ethereum)) {
578
581
  this.setupEthereumEvents();
579
582
  }
580
583
  }
@@ -582,8 +585,8 @@ var InjectedProvider = class {
582
585
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up Solana event listeners");
583
586
  const handleSolanaConnect = (publicKey) => {
584
587
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana connect event received", { publicKey });
585
- const solanaAddress = { addressType: AddressType3.solana, address: publicKey };
586
- if (!this.addresses.find((addr) => addr.addressType === AddressType3.solana)) {
588
+ const solanaAddress = { addressType: AddressType4.solana, address: publicKey };
589
+ if (!this.addresses.find((addr) => addr.addressType === AddressType4.solana)) {
587
590
  this.addresses.push(solanaAddress);
588
591
  }
589
592
  this.connected = true;
@@ -594,7 +597,7 @@ var InjectedProvider = class {
594
597
  };
595
598
  const handleSolanaDisconnect = () => {
596
599
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana disconnect event received");
597
- this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType3.solana);
600
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType4.solana);
598
601
  this.connected = this.addresses.length > 0;
599
602
  this.emit("disconnect", {
600
603
  source: "injected-extension"
@@ -602,11 +605,11 @@ var InjectedProvider = class {
602
605
  };
603
606
  const handleSolanaAccountChanged = (publicKey) => {
604
607
  debug.log(DebugCategory.INJECTED_PROVIDER, "Solana account changed event received", { publicKey });
605
- const solanaIndex = this.addresses.findIndex((addr) => addr.addressType === AddressType3.solana);
608
+ const solanaIndex = this.addresses.findIndex((addr) => addr.addressType === AddressType4.solana);
606
609
  if (solanaIndex >= 0) {
607
- this.addresses[solanaIndex] = { addressType: AddressType3.solana, address: publicKey };
610
+ this.addresses[solanaIndex] = { addressType: AddressType4.solana, address: publicKey };
608
611
  } else {
609
- this.addresses.push({ addressType: AddressType3.solana, address: publicKey });
612
+ this.addresses.push({ addressType: AddressType4.solana, address: publicKey });
610
613
  }
611
614
  this.emit("connect", {
612
615
  addresses: this.addresses,
@@ -625,11 +628,11 @@ var InjectedProvider = class {
625
628
  debug.log(DebugCategory.INJECTED_PROVIDER, "Setting up Ethereum event listeners");
626
629
  const handleEthereumConnect = (accounts) => {
627
630
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum connect event received", { accounts });
628
- this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType3.ethereum);
631
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType4.ethereum);
629
632
  if (accounts && accounts.length > 0) {
630
633
  this.addresses.push(
631
634
  ...accounts.map((address) => ({
632
- addressType: AddressType3.ethereum,
635
+ addressType: AddressType4.ethereum,
633
636
  address
634
637
  }))
635
638
  );
@@ -642,7 +645,7 @@ var InjectedProvider = class {
642
645
  };
643
646
  const handleEthereumDisconnect = () => {
644
647
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum disconnect event received");
645
- this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType3.ethereum);
648
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType4.ethereum);
646
649
  this.connected = this.addresses.length > 0;
647
650
  this.emit("disconnect", {
648
651
  source: "injected-extension"
@@ -650,11 +653,11 @@ var InjectedProvider = class {
650
653
  };
651
654
  const handleEthereumAccountsChanged = (accounts) => {
652
655
  debug.log(DebugCategory.INJECTED_PROVIDER, "Ethereum accounts changed event received", { accounts });
653
- this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType3.ethereum);
656
+ this.addresses = this.addresses.filter((addr) => addr.addressType !== AddressType4.ethereum);
654
657
  if (accounts && accounts.length > 0) {
655
658
  this.addresses.push(
656
659
  ...accounts.map((address) => ({
657
- addressType: AddressType3.ethereum,
660
+ addressType: AddressType4.ethereum,
658
661
  address
659
662
  }))
660
663
  );
@@ -812,7 +815,6 @@ var BrowserAuthProvider = class {
812
815
  const phantomOptions = options;
813
816
  debug.info(DebugCategory.PHANTOM_CONNECT_AUTH, "Starting Phantom Connect authentication", {
814
817
  organizationId: phantomOptions.organizationId,
815
- parentOrganizationId: phantomOptions.parentOrganizationId,
816
818
  appId: phantomOptions.appId,
817
819
  provider: phantomOptions.provider,
818
820
  authUrl: phantomOptions.authUrl,
@@ -822,7 +824,6 @@ var BrowserAuthProvider = class {
822
824
  debug.log(DebugCategory.PHANTOM_CONNECT_AUTH, "Using auth URL", { baseUrl });
823
825
  const params = new URLSearchParams({
824
826
  organization_id: phantomOptions.organizationId,
825
- parent_organization_id: phantomOptions.parentOrganizationId,
826
827
  app_id: phantomOptions.appId,
827
828
  redirect_uri: phantomOptions.redirectUrl || (typeof window !== "undefined" ? this.getValidatedCurrentUrl() : ""),
828
829
  session_id: phantomOptions.sessionId,
@@ -843,7 +844,6 @@ var BrowserAuthProvider = class {
843
844
  }
844
845
  const authContext = {
845
846
  organizationId: phantomOptions.organizationId,
846
- parentOrganizationId: phantomOptions.parentOrganizationId,
847
847
  appId: phantomOptions.appId,
848
848
  provider: phantomOptions.provider,
849
849
  sessionId: phantomOptions.sessionId
@@ -1084,7 +1084,7 @@ var EmbeddedProvider = class extends CoreEmbeddedProvider {
1084
1084
  debug.log(DebugCategory.EMBEDDED_PROVIDER, "Initializing Browser EmbeddedProvider", { config });
1085
1085
  const urlParamsAccessor = new BrowserURLParamsAccessor();
1086
1086
  const stamper = new IndexedDbStamper({
1087
- dbName: `phantom-embedded-sdk-${config.organizationId}`,
1087
+ dbName: `phantom-embedded-sdk-${config.appId}`,
1088
1088
  storeName: "crypto-keys",
1089
1089
  keyName: "signing-key"
1090
1090
  });
@@ -1105,7 +1105,7 @@ var EmbeddedProvider = class extends CoreEmbeddedProvider {
1105
1105
  // Full user agent for more detailed info
1106
1106
  [ANALYTICS_HEADERS.APP_ID]: config.appId,
1107
1107
  [ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
1108
- [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.4"
1108
+ [ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.6"
1109
1109
  // Replaced at build time
1110
1110
  }
1111
1111
  };
@@ -1337,7 +1337,7 @@ var ProviderManager = class {
1337
1337
  let provider;
1338
1338
  if (type === "injected") {
1339
1339
  provider = new InjectedProvider({
1340
- addressTypes: this.config.addressTypes
1340
+ addressTypes: this.config.addressTypes || [AddressType.solana]
1341
1341
  });
1342
1342
  } else if (type === "embedded") {
1343
1343
  if (!this.config.appId) {
@@ -1347,7 +1347,6 @@ var ProviderManager = class {
1347
1347
  const authUrl = this.config.authOptions?.authUrl || DEFAULT_AUTH_URL2;
1348
1348
  provider = new EmbeddedProvider({
1349
1349
  apiBaseUrl,
1350
- organizationId: this.config.appId,
1351
1350
  appId: this.config.appId,
1352
1351
  authOptions: {
1353
1352
  ...this.config.authOptions || {},
@@ -1355,7 +1354,7 @@ var ProviderManager = class {
1355
1354
  redirectUrl: this.config.authOptions?.redirectUrl || this.getValidatedCurrentUrl()
1356
1355
  },
1357
1356
  embeddedWalletType: embeddedWalletType || DEFAULT_EMBEDDED_WALLET_TYPE,
1358
- addressTypes: this.config.addressTypes
1357
+ addressTypes: this.config.addressTypes || [AddressType.solana]
1359
1358
  });
1360
1359
  } else {
1361
1360
  throw new Error(`Unsupported provider type: ${type}`);
@@ -1729,9 +1728,6 @@ var BrowserSDK = class {
1729
1728
  }
1730
1729
  };
1731
1730
 
1732
- // src/types.ts
1733
- import { AddressType as AddressType4 } from "@phantom/client";
1734
-
1735
1731
  // src/utils/deeplink.ts
1736
1732
  function getDeeplinkToPhantom(ref) {
1737
1733
  if (!window.location.href.startsWith("http:") && !window.location.href.startsWith("https:")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantom/browser-sdk",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Browser SDK for Phantom Wallet",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,15 +28,15 @@
28
28
  "prettier": "prettier --write \"src/**/*.{ts,tsx}\""
29
29
  },
30
30
  "dependencies": {
31
- "@phantom/base64url": "^1.0.0-beta.4",
31
+ "@phantom/base64url": "^1.0.0-beta.6",
32
32
  "@phantom/browser-injected-sdk": "^1.0.0-beta.3",
33
- "@phantom/chains": "^1.0.0-beta.4",
34
- "@phantom/client": "^1.0.0-beta.4",
35
- "@phantom/constants": "^1.0.0-beta.4",
36
- "@phantom/embedded-provider-core": "^1.0.0-beta.4",
33
+ "@phantom/chain-interfaces": "^1.0.0-beta.6",
34
+ "@phantom/client": "^1.0.0-beta.6",
35
+ "@phantom/constants": "^1.0.0-beta.6",
36
+ "@phantom/embedded-provider-core": "^1.0.0-beta.6",
37
37
  "@phantom/indexed-db-stamper": "^1.0.0-beta.1",
38
- "@phantom/parsers": "^1.0.0-beta.4",
39
- "@phantom/sdk-types": "^1.0.0-beta.4",
38
+ "@phantom/parsers": "^1.0.0-beta.6",
39
+ "@phantom/sdk-types": "^1.0.0-beta.6",
40
40
  "axios": "^1.10.0",
41
41
  "bs58": "^6.0.0",
42
42
  "buffer": "^6.0.3",