@pooflabs/web 0.0.37 → 0.0.39
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/auth/providers/mock-auth-provider.d.ts +7 -0
- package/dist/auth/providers/offchain-auth-provider.d.ts +13 -4
- package/dist/auth/providers/phantom-wallet-provider.d.ts +28 -1
- package/dist/auth/providers/privy-wallet-provider.d.ts +45 -1
- package/dist/{index-B3jRsGVB.js → index-BaNlnYmn.js} +1937 -349
- package/dist/index-BaNlnYmn.js.map +1 -0
- package/dist/{index-B08xJEBy.js → index-C-_15_Cq.js} +2 -2
- package/dist/{index-B08xJEBy.js.map → index-C-_15_Cq.js.map} +1 -1
- package/dist/{index-BshwKDlr.esm.js → index-CK_KC-Oy.esm.js} +1936 -351
- package/dist/index-CK_KC-Oy.esm.js.map +1 -0
- package/dist/{index-DD_zltED.esm.js → index-CfbGteXj.esm.js} +2 -2
- package/dist/{index-DD_zltED.esm.js.map → index-CfbGteXj.esm.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/index-B3jRsGVB.js.map +0 -1
- package/dist/index-BshwKDlr.esm.js.map +0 -1
|
@@ -22,10 +22,17 @@ export declare class MockAuthProvider implements AuthProvider {
|
|
|
22
22
|
* Mock message signing
|
|
23
23
|
*/
|
|
24
24
|
signMessage(message: string): Promise<string>;
|
|
25
|
+
signMessageMock(message: string): Promise<string>;
|
|
25
26
|
/**
|
|
26
27
|
* Mock transaction signing - returns the transaction as-is (no actual signing)
|
|
27
28
|
*/
|
|
28
29
|
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
30
|
+
/**
|
|
31
|
+
* Sign and submit transaction - not supported in mock environment.
|
|
32
|
+
* See the real providers (PhantomWalletProvider, PrivyWalletProvider, SolanaKeypairProvider)
|
|
33
|
+
* for the full implementation with blockhash handling and feePayer support.
|
|
34
|
+
*/
|
|
35
|
+
signAndSubmitTransaction(_transaction: Transaction | VersionedTransaction, _feePayer?: any): Promise<string>;
|
|
29
36
|
/**
|
|
30
37
|
* Restore session - only restores if user previously called login() explicitly.
|
|
31
38
|
* This prevents auto-login on first page load, but allows session persistence after login.
|
|
@@ -7,11 +7,11 @@ export interface OffchainAuthProviderConfig {
|
|
|
7
7
|
onSigningError?: (error: Error) => void;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* OffchainAuthProvider wraps a real auth provider (e.g., Privy)
|
|
11
|
-
* transaction signing via a custom modal for the poofnet environment.
|
|
10
|
+
* OffchainAuthProvider wraps a real auth provider (e.g., Privy, Phantom) for the poofnet environment.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* For signMessageMock, this shows a custom confirmation modal and generates a mock signature.
|
|
13
|
+
* This is used for offchain transaction signing. For real wallet signing, use signMessage
|
|
14
|
+
* which delegates to the wrapped provider.
|
|
15
15
|
*/
|
|
16
16
|
export declare class OffchainAuthProvider implements AuthProvider {
|
|
17
17
|
private wrappedProvider;
|
|
@@ -23,8 +23,17 @@ export declare class OffchainAuthProvider implements AuthProvider {
|
|
|
23
23
|
restoreSession(): Promise<User | null>;
|
|
24
24
|
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
25
25
|
signTransaction(tx: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
26
|
+
/**
|
|
27
|
+
* Sign and submit transaction - not supported in poofnet environment.
|
|
28
|
+
* See the real providers (PhantomWalletProvider, PrivyWalletProvider, SolanaKeypairProvider)
|
|
29
|
+
* for the full implementation with blockhash handling and feePayer support.
|
|
30
|
+
*/
|
|
31
|
+
signAndSubmitTransaction(_transaction: Transaction | VersionedTransaction, _feePayer?: any): Promise<string>;
|
|
26
32
|
getNativeMethods(): Promise<any>;
|
|
27
33
|
signMessage(message: string): Promise<string>;
|
|
34
|
+
signMessageMock(message: string): Promise<string>;
|
|
35
|
+
private showUnsupportedTransactionModal;
|
|
36
|
+
private getUnsupportedModalHTML;
|
|
28
37
|
private showTransactionModal;
|
|
29
38
|
private closeModal;
|
|
30
39
|
private formatPath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
|
|
2
|
-
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
3
|
export type PhantomProviderType = 'injected' | 'google' | 'apple' | 'phantom';
|
|
4
4
|
export interface PhantomWalletConfig {
|
|
5
5
|
appId?: string;
|
|
@@ -50,10 +50,37 @@ export declare class PhantomWalletProvider implements AuthProvider {
|
|
|
50
50
|
restoreSession(): Promise<User | null>;
|
|
51
51
|
address(): Promise<string | null>;
|
|
52
52
|
runTransaction(_evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Signs a Solana transaction without submitting it.
|
|
55
|
+
*
|
|
56
|
+
* This method handles blockhash automatically if not set - you do NOT need to
|
|
57
|
+
* set recentBlockhash on the transaction before calling this method.
|
|
58
|
+
* The network/RPC URL is derived from the provider's configuration (set during initialization).
|
|
59
|
+
*
|
|
60
|
+
* @param transaction - The transaction to sign (Transaction or VersionedTransaction)
|
|
61
|
+
* @returns The signed transaction
|
|
62
|
+
*/
|
|
53
63
|
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
64
|
+
/**
|
|
65
|
+
* Signs and submits a Solana transaction to the network.
|
|
66
|
+
*
|
|
67
|
+
* This method handles blockhash and transaction confirmation automatically - you do NOT need to
|
|
68
|
+
* set recentBlockhash or lastValidBlockHeight on the transaction before calling this method.
|
|
69
|
+
* The network/RPC URL is derived from the provider's configuration (set during initialization).
|
|
70
|
+
*
|
|
71
|
+
* @param transaction - The transaction to sign and submit (Transaction or VersionedTransaction)
|
|
72
|
+
* @param feePayer - Optional fee payer public key. If not provided and the transaction doesn't
|
|
73
|
+
* already have a feePayer set, the connected wallet address will be used.
|
|
74
|
+
* Useful for co-signing scenarios where a different account pays the fees.
|
|
75
|
+
* @returns The transaction signature
|
|
76
|
+
*/
|
|
77
|
+
signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
54
78
|
signMessage(message: string): Promise<string>;
|
|
55
79
|
logout(): Promise<void>;
|
|
56
80
|
getNativeMethods(): Promise<any>;
|
|
81
|
+
private getRpcUrl;
|
|
82
|
+
private submitSignedTransaction;
|
|
83
|
+
private submitSignedTransactionWithBlockhash;
|
|
57
84
|
}
|
|
58
85
|
declare global {
|
|
59
86
|
interface Window {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
|
|
2
|
-
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
3
|
export declare class PrivyWalletProvider implements AuthProvider {
|
|
4
4
|
private static instance;
|
|
5
5
|
private containerElement;
|
|
@@ -12,6 +12,7 @@ export declare class PrivyWalletProvider implements AuthProvider {
|
|
|
12
12
|
private pendingTransaction;
|
|
13
13
|
private pendingSignTransaction;
|
|
14
14
|
private pendingSignMessage;
|
|
15
|
+
private pendingSignAndSubmitTransaction;
|
|
15
16
|
constructor(appName: string | null, appLogoUrl: string | null, privyConfig?: {
|
|
16
17
|
appId: string;
|
|
17
18
|
config: any;
|
|
@@ -22,7 +23,50 @@ export declare class PrivyWalletProvider implements AuthProvider {
|
|
|
22
23
|
getNativeMethods(): Promise<any>;
|
|
23
24
|
logout(): Promise<void>;
|
|
24
25
|
runTransaction(_evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Signs a Solana transaction without submitting it.
|
|
28
|
+
*
|
|
29
|
+
* This method handles blockhash automatically if not set - you do NOT need to
|
|
30
|
+
* set recentBlockhash on the transaction before calling this method.
|
|
31
|
+
* The network/RPC URL is derived from the provider's configuration (set during initialization).
|
|
32
|
+
*
|
|
33
|
+
* @param transaction - The transaction to sign (Transaction or VersionedTransaction)
|
|
34
|
+
* @returns The signed transaction
|
|
35
|
+
*/
|
|
25
36
|
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
37
|
+
/**
|
|
38
|
+
* Signs and submits a Solana transaction to the network.
|
|
39
|
+
*
|
|
40
|
+
* This method handles blockhash and transaction confirmation automatically - you do NOT need to
|
|
41
|
+
* set recentBlockhash or lastValidBlockHeight on the transaction before calling this method.
|
|
42
|
+
* The network/RPC URL is derived from the provider's configuration (set during initialization).
|
|
43
|
+
*
|
|
44
|
+
* @param transaction - The transaction to sign and submit (Transaction or VersionedTransaction)
|
|
45
|
+
* @param feePayer - Optional fee payer public key. If not provided and the transaction doesn't
|
|
46
|
+
* already have a feePayer set, the connected wallet address will be used.
|
|
47
|
+
* Useful for co-signing scenarios where a different account pays the fees.
|
|
48
|
+
* @returns The transaction signature
|
|
49
|
+
*/
|
|
50
|
+
signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
51
|
+
private getRpcUrl;
|
|
52
|
+
/**
|
|
53
|
+
* Internal sign transaction - serializes and signs via Privy
|
|
54
|
+
* Returns the raw result from Privy (Uint8Array)
|
|
55
|
+
* This mirrors exactly what runTransaction was doing
|
|
56
|
+
*/
|
|
57
|
+
private signTransactionRaw;
|
|
58
|
+
/**
|
|
59
|
+
* Deserialize a signed transaction from Uint8Array to Transaction object
|
|
60
|
+
*/
|
|
61
|
+
private deserializeSignedTransaction;
|
|
62
|
+
/**
|
|
63
|
+
* Internal sign and submit - handles Surfnet vs non-Surfnet logic
|
|
64
|
+
* This is the core submission logic used by both signAndSubmitTransaction and runTransaction
|
|
65
|
+
*
|
|
66
|
+
* For Surfnet: sign with signTransactionRaw, then sendRawTransaction
|
|
67
|
+
* For non-Surfnet: use Privy's signAndSendTransaction (combined operation)
|
|
68
|
+
*/
|
|
69
|
+
private signAndSubmitInternal;
|
|
26
70
|
signMessage(message: string): Promise<string>;
|
|
27
71
|
restoreSession(): Promise<User | null>;
|
|
28
72
|
private createSession;
|