@phantom/react-native-sdk 1.0.6 → 2.0.0-beta.0

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/README.md CHANGED
@@ -267,6 +267,7 @@ interface PhantomSDKConfig {
267
267
  authOptions?: {
268
268
  authUrl?: string; // Custom auth URL (optional)
269
269
  redirectUrl?: string; // Custom redirect URL (optional)
270
+ authApiBaseUrl?: string; // Custom OAuth URL (optional)
270
271
  };
271
272
  }
272
273
  ```
@@ -489,6 +490,42 @@ The SDK automatically handles deep link redirects. Ensure your app's URL scheme
489
490
 
490
491
  **Redirect URL format:** `{scheme}://phantom-auth-callback?wallet_id=...&session_id=...`
491
492
 
493
+ ## Dapp-Sponsored Transactions (presignTransaction)
494
+
495
+ Pass `presignTransaction` directly to `signAndSendTransaction` for calls that need co-signing. Calls without it proceed normally — it is never applied globally.
496
+
497
+ > **Important:** Phantom embedded wallets do not accept pre-signed transactions. If your use case requires a second signer (e.g. your app as the fee payer), that signing must happen via this option, after Phantom has constructed and validated the transaction. This restriction does not apply to injected providers (e.g. the Phantom browser extension).
498
+
499
+ > **Note:** `presignTransaction` only fires for Solana transactions via the embedded provider. EVM transactions are unaffected.
500
+
501
+ ```tsx
502
+ import { useSolana, base64urlDecode, base64urlEncode } from "@phantom/react-native-sdk";
503
+ import { Keypair, VersionedTransaction } from "@solana/web3.js";
504
+
505
+ const feePayerKeypair = Keypair.fromSecretKey(/* your fee payer secret key */);
506
+
507
+ function SendWithFeeSponsor() {
508
+ const { solana } = useSolana();
509
+
510
+ const sendSponsored = async () => {
511
+ // This call co-signs as fee payer
512
+ const result = await solana.signAndSendTransaction(transaction, {
513
+ presignTransaction: async (tx, context) => {
514
+ const txBytes = base64urlDecode(tx);
515
+ const versionedTx = VersionedTransaction.deserialize(txBytes);
516
+ versionedTx.sign([feePayerKeypair]);
517
+ return base64urlEncode(versionedTx.serialize());
518
+ },
519
+ });
520
+ };
521
+
522
+ const sendNormal = async () => {
523
+ // This call has no co-signer
524
+ const result = await solana.signAndSendTransaction(transaction);
525
+ };
526
+ }
527
+ ```
528
+
492
529
  ## Security Features
493
530
 
494
531
  ### Secure Storage
package/dist/index.d.ts CHANGED
@@ -6,8 +6,10 @@ export { ConnectErrorEventData, ConnectEventData, ConnectResult, ConnectStartEve
6
6
  import { PhantomTheme } from '@phantom/wallet-sdk-ui';
7
7
  export { PhantomTheme, darkTheme, lightTheme } from '@phantom/wallet-sdk-ui';
8
8
  import { ISolanaChain, IEthereumChain } from '@phantom/chain-interfaces';
9
- export { AddressType } from '@phantom/client';
9
+ export { SignAndSendTransactionOptions } from '@phantom/chain-interfaces';
10
+ export { AddressType, PresignTransactionContext } from '@phantom/client';
10
11
  export { NetworkId } from '@phantom/constants';
12
+ export { base64urlDecode, base64urlEncode } from '@phantom/base64url';
11
13
 
12
14
  interface PhantomDebugConfig {
13
15
  /** Enable debug logging */
@@ -24,11 +26,7 @@ interface PhantomSDKConfig extends Omit<EmbeddedProviderConfig, "apiBaseUrl" | "
24
26
  authOptions?: {
25
27
  authUrl?: string;
26
28
  redirectUrl?: string;
27
- };
28
- /** When also provided, the Auth2 PKCE flow is used instead of the legacy Phantom Connect flow. */
29
- unstable__auth2Options?: {
30
- authApiBaseUrl: string;
31
- clientId: string;
29
+ authApiBaseUrl?: string;
32
30
  };
33
31
  }
34
32
  interface ConnectOptions {