@phantom/browser-sdk 1.0.0-beta.5 → 1.0.0-beta.7
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 +29 -8
- package/dist/index.js +13 -10
- package/dist/index.mjs +13 -10
- package/package.json +9 -9
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/
|
|
4
|
-
export { EthTransactionRequest, IEthereumChain, ISolanaChain } from '@phantom/
|
|
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';
|
|
@@ -52,23 +52,44 @@ declare const DebugCategory: {
|
|
|
52
52
|
readonly SESSION: "Session";
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
declare global {
|
|
56
|
+
interface Window {
|
|
57
|
+
phantom?: {
|
|
58
|
+
solana?: unknown;
|
|
59
|
+
ethereum?: unknown;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
interface InjectedProviderConfig {
|
|
64
|
+
addressTypes: AddressType[];
|
|
65
|
+
}
|
|
66
|
+
|
|
55
67
|
interface DebugConfig {
|
|
56
68
|
enabled?: boolean;
|
|
57
69
|
level?: DebugLevel;
|
|
58
70
|
callback?: DebugCallback;
|
|
59
71
|
}
|
|
60
|
-
|
|
61
|
-
providerType: "injected" | "embedded" | (string & Record<never, never>);
|
|
62
|
-
addressTypes: [AddressType, ...AddressType[]];
|
|
63
|
-
apiBaseUrl?: string;
|
|
64
|
-
appId?: string;
|
|
65
|
-
embeddedWalletType?: "app-wallet" | "user-wallet" | (string & Record<never, never>);
|
|
72
|
+
type BrowserSDKConfig = Prettify<(ExtendedEmbeddedProviderConfig | ExtendedInjectedProviderConfig) & {
|
|
66
73
|
autoConnect?: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
type Prettify<T> = {
|
|
76
|
+
[K in keyof T]: T[K];
|
|
77
|
+
} & {};
|
|
78
|
+
interface ExtendedEmbeddedProviderConfig extends Omit<EmbeddedProviderConfig, "authOptions" | "apiBaseUrl" | "embeddedWalletType"> {
|
|
79
|
+
providerType: "embedded";
|
|
80
|
+
apiBaseUrl?: string;
|
|
81
|
+
embeddedWalletType?: "app-wallet" | "user-wallet";
|
|
67
82
|
authOptions?: {
|
|
68
83
|
authUrl?: string;
|
|
69
84
|
redirectUrl?: string;
|
|
70
85
|
};
|
|
71
86
|
}
|
|
87
|
+
interface ExtendedInjectedProviderConfig extends InjectedProviderConfig {
|
|
88
|
+
providerType: "injected";
|
|
89
|
+
appId?: never;
|
|
90
|
+
authOptions?: never;
|
|
91
|
+
embeddedWalletType?: never;
|
|
92
|
+
}
|
|
72
93
|
|
|
73
94
|
interface Provider {
|
|
74
95
|
connect(authOptions?: AuthOptions): Promise<ConnectResult>;
|
package/dist/index.js
CHANGED
|
@@ -654,10 +654,7 @@ var InjectedProvider = class {
|
|
|
654
654
|
};
|
|
655
655
|
const cleanupConnect = this.phantom.solana.addEventListener("connect", handleSolanaConnect);
|
|
656
656
|
const cleanupDisconnect = this.phantom.solana.addEventListener("disconnect", handleSolanaDisconnect);
|
|
657
|
-
const cleanupAccountChanged = this.phantom.solana.addEventListener(
|
|
658
|
-
"accountChanged",
|
|
659
|
-
handleSolanaAccountChanged
|
|
660
|
-
);
|
|
657
|
+
const cleanupAccountChanged = this.phantom.solana.addEventListener("accountChanged", handleSolanaAccountChanged);
|
|
661
658
|
this.browserInjectedCleanupFunctions.push(cleanupConnect, cleanupDisconnect, cleanupAccountChanged);
|
|
662
659
|
}
|
|
663
660
|
setupEthereumEvents() {
|
|
@@ -697,11 +694,16 @@ var InjectedProvider = class {
|
|
|
697
694
|
address
|
|
698
695
|
}))
|
|
699
696
|
);
|
|
697
|
+
this.emit("connect", {
|
|
698
|
+
addresses: this.addresses,
|
|
699
|
+
source: "injected-extension-account-change"
|
|
700
|
+
});
|
|
701
|
+
} else {
|
|
702
|
+
this.connected = this.addresses.length > 0;
|
|
703
|
+
this.emit("disconnect", {
|
|
704
|
+
source: "injected-extension-account-change"
|
|
705
|
+
});
|
|
700
706
|
}
|
|
701
|
-
this.emit("connect", {
|
|
702
|
-
addresses: this.addresses,
|
|
703
|
-
source: "injected-extension-account-change"
|
|
704
|
-
});
|
|
705
707
|
};
|
|
706
708
|
const cleanupConnect = this.phantom.ethereum.addEventListener("connect", handleEthereumConnect);
|
|
707
709
|
const cleanupDisconnect = this.phantom.ethereum.addEventListener("disconnect", handleEthereumDisconnect);
|
|
@@ -863,7 +865,8 @@ var BrowserAuthProvider = class {
|
|
|
863
865
|
app_id: phantomOptions.appId,
|
|
864
866
|
redirect_uri: phantomOptions.redirectUrl || (typeof window !== "undefined" ? this.getValidatedCurrentUrl() : ""),
|
|
865
867
|
session_id: phantomOptions.sessionId,
|
|
866
|
-
clear_previous_session: true.toString()
|
|
868
|
+
clear_previous_session: true.toString(),
|
|
869
|
+
sdk_version: "1.0.0-beta.7"
|
|
867
870
|
});
|
|
868
871
|
if (phantomOptions.provider) {
|
|
869
872
|
debug.log(DebugCategory.PHANTOM_CONNECT_AUTH, "Provider specified, will skip selection", {
|
|
@@ -1141,7 +1144,7 @@ var EmbeddedProvider = class extends import_embedded_provider_core.EmbeddedProvi
|
|
|
1141
1144
|
// Full user agent for more detailed info
|
|
1142
1145
|
[import_constants2.ANALYTICS_HEADERS.APP_ID]: config.appId,
|
|
1143
1146
|
[import_constants2.ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
|
|
1144
|
-
[import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.
|
|
1147
|
+
[import_constants2.ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.7"
|
|
1145
1148
|
// Replaced at build time
|
|
1146
1149
|
}
|
|
1147
1150
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -618,10 +618,7 @@ var InjectedProvider = class {
|
|
|
618
618
|
};
|
|
619
619
|
const cleanupConnect = this.phantom.solana.addEventListener("connect", handleSolanaConnect);
|
|
620
620
|
const cleanupDisconnect = this.phantom.solana.addEventListener("disconnect", handleSolanaDisconnect);
|
|
621
|
-
const cleanupAccountChanged = this.phantom.solana.addEventListener(
|
|
622
|
-
"accountChanged",
|
|
623
|
-
handleSolanaAccountChanged
|
|
624
|
-
);
|
|
621
|
+
const cleanupAccountChanged = this.phantom.solana.addEventListener("accountChanged", handleSolanaAccountChanged);
|
|
625
622
|
this.browserInjectedCleanupFunctions.push(cleanupConnect, cleanupDisconnect, cleanupAccountChanged);
|
|
626
623
|
}
|
|
627
624
|
setupEthereumEvents() {
|
|
@@ -661,11 +658,16 @@ var InjectedProvider = class {
|
|
|
661
658
|
address
|
|
662
659
|
}))
|
|
663
660
|
);
|
|
661
|
+
this.emit("connect", {
|
|
662
|
+
addresses: this.addresses,
|
|
663
|
+
source: "injected-extension-account-change"
|
|
664
|
+
});
|
|
665
|
+
} else {
|
|
666
|
+
this.connected = this.addresses.length > 0;
|
|
667
|
+
this.emit("disconnect", {
|
|
668
|
+
source: "injected-extension-account-change"
|
|
669
|
+
});
|
|
664
670
|
}
|
|
665
|
-
this.emit("connect", {
|
|
666
|
-
addresses: this.addresses,
|
|
667
|
-
source: "injected-extension-account-change"
|
|
668
|
-
});
|
|
669
671
|
};
|
|
670
672
|
const cleanupConnect = this.phantom.ethereum.addEventListener("connect", handleEthereumConnect);
|
|
671
673
|
const cleanupDisconnect = this.phantom.ethereum.addEventListener("disconnect", handleEthereumDisconnect);
|
|
@@ -827,7 +829,8 @@ var BrowserAuthProvider = class {
|
|
|
827
829
|
app_id: phantomOptions.appId,
|
|
828
830
|
redirect_uri: phantomOptions.redirectUrl || (typeof window !== "undefined" ? this.getValidatedCurrentUrl() : ""),
|
|
829
831
|
session_id: phantomOptions.sessionId,
|
|
830
|
-
clear_previous_session: true.toString()
|
|
832
|
+
clear_previous_session: true.toString(),
|
|
833
|
+
sdk_version: "1.0.0-beta.7"
|
|
831
834
|
});
|
|
832
835
|
if (phantomOptions.provider) {
|
|
833
836
|
debug.log(DebugCategory.PHANTOM_CONNECT_AUTH, "Provider specified, will skip selection", {
|
|
@@ -1105,7 +1108,7 @@ var EmbeddedProvider = class extends CoreEmbeddedProvider {
|
|
|
1105
1108
|
// Full user agent for more detailed info
|
|
1106
1109
|
[ANALYTICS_HEADERS.APP_ID]: config.appId,
|
|
1107
1110
|
[ANALYTICS_HEADERS.WALLET_TYPE]: config.embeddedWalletType,
|
|
1108
|
-
[ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.
|
|
1111
|
+
[ANALYTICS_HEADERS.SDK_VERSION]: "1.0.0-beta.7"
|
|
1109
1112
|
// Replaced at build time
|
|
1110
1113
|
}
|
|
1111
1114
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phantom/browser-sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
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.
|
|
32
|
-
"@phantom/browser-injected-sdk": "^1.0.0-beta.
|
|
33
|
-
"@phantom/
|
|
34
|
-
"@phantom/client": "^1.0.0-beta.
|
|
35
|
-
"@phantom/constants": "^1.0.0-beta.
|
|
36
|
-
"@phantom/embedded-provider-core": "^1.0.0-beta.
|
|
31
|
+
"@phantom/base64url": "^1.0.0-beta.6",
|
|
32
|
+
"@phantom/browser-injected-sdk": "^1.0.0-beta.4",
|
|
33
|
+
"@phantom/chain-interfaces": "^1.0.0-beta.6",
|
|
34
|
+
"@phantom/client": "^1.0.0-beta.7",
|
|
35
|
+
"@phantom/constants": "^1.0.0-beta.6",
|
|
36
|
+
"@phantom/embedded-provider-core": "^1.0.0-beta.7",
|
|
37
37
|
"@phantom/indexed-db-stamper": "^1.0.0-beta.1",
|
|
38
|
-
"@phantom/parsers": "^1.0.0-beta.
|
|
39
|
-
"@phantom/sdk-types": "^1.0.0-beta.
|
|
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",
|