@solana-mobile/wallet-adapter-mobile 2.1.5 → 2.2.2
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 +119 -119
- package/lib/cjs/index.browser.js +355 -1180
- package/lib/cjs/index.js +355 -1180
- package/lib/cjs/index.native.js +352 -1126
- package/lib/esm/index.browser.js +356 -1177
- package/lib/esm/index.js +356 -1177
- package/lib/types/index.browser.d.ts +32 -100
- package/lib/types/index.browser.d.ts.map +1 -1
- package/lib/types/index.d.ts +32 -100
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.native.d.ts +32 -100
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +31 -20
|
@@ -3,144 +3,76 @@ import { Connection, PublicKey, SendOptions, TransactionSignature, TransactionVe
|
|
|
3
3
|
import { Transaction as LegacyTransaction } from "@solana/web3.js";
|
|
4
4
|
import { AppIdentity, AuthorizationResult, Base64EncodedAddress, Chain, Cluster, SignInPayload } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
5
5
|
import { SolanaSignInInput, SolanaSignInOutput } from "@solana/wallet-standard-features";
|
|
6
|
+
import { Authorization, LocalSolanaMobileWalletAdapterWallet, RemoteSolanaMobileWalletAdapterWallet } from "@solana-mobile/wallet-standard-mobile";
|
|
6
7
|
interface AuthorizationResultCache {
|
|
7
8
|
clear(): Promise<void>;
|
|
8
|
-
get(): Promise<AuthorizationResult | undefined>;
|
|
9
|
-
set(authorizationResult: AuthorizationResult): Promise<void>;
|
|
9
|
+
get(): Promise<AuthorizationResult | Authorization | undefined>;
|
|
10
|
+
set(authorizationResult: AuthorizationResult | Authorization): Promise<void>;
|
|
10
11
|
}
|
|
11
12
|
interface AddressSelector {
|
|
12
13
|
select(addresses: Base64EncodedAddress[]): Promise<Base64EncodedAddress>;
|
|
13
14
|
}
|
|
14
15
|
declare const SolanaMobileWalletAdapterWalletName: WalletName<string>;
|
|
15
|
-
declare class
|
|
16
|
+
declare abstract class BaseSolanaMobileWalletAdapter extends BaseSignInMessageSignerWalletAdapter {
|
|
17
|
+
#private;
|
|
16
18
|
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
17
19
|
name: WalletName<string>;
|
|
20
|
+
icon: `data:image/svg+xml;base64,${string}` | `data:image/webp;base64,${string}` | `data:image/png;base64,${string}` | `data:image/gif;base64,${string}`;
|
|
18
21
|
url: string;
|
|
19
|
-
|
|
20
|
-
private _addressSelector;
|
|
21
|
-
private _appIdentity;
|
|
22
|
-
private _authorizationResult;
|
|
23
|
-
private _authorizationResultCache;
|
|
24
|
-
private _connecting;
|
|
25
|
-
/**
|
|
26
|
-
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
27
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
28
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
29
|
-
*/
|
|
30
|
-
private _connectionGeneration;
|
|
31
|
-
private _chain;
|
|
32
|
-
private _onWalletNotFound;
|
|
33
|
-
private _publicKey;
|
|
34
|
-
private _readyState;
|
|
35
|
-
private _selectedAddress;
|
|
36
|
-
private _hostAuthority;
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
39
|
-
*/
|
|
40
|
-
constructor(config: {
|
|
41
|
-
addressSelector: AddressSelector;
|
|
42
|
-
appIdentity: AppIdentity;
|
|
43
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
44
|
-
cluster: Cluster;
|
|
45
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
46
|
-
});
|
|
47
|
-
constructor(config: {
|
|
48
|
-
addressSelector: AddressSelector;
|
|
49
|
-
appIdentity: AppIdentity;
|
|
50
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
-
chain: Chain;
|
|
52
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
-
});
|
|
54
|
-
constructor(config: {
|
|
22
|
+
protected constructor(wallet: LocalSolanaMobileWalletAdapterWallet | RemoteSolanaMobileWalletAdapterWallet, config: {
|
|
55
23
|
addressSelector: AddressSelector;
|
|
56
|
-
appIdentity: AppIdentity;
|
|
57
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
58
24
|
chain: Chain;
|
|
59
|
-
remoteHostAuthority: string;
|
|
60
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
61
25
|
});
|
|
62
26
|
get publicKey(): PublicKey | null;
|
|
63
27
|
get connected(): boolean;
|
|
64
28
|
get connecting(): boolean;
|
|
65
29
|
get readyState(): WalletReadyState;
|
|
66
|
-
private declareWalletAsInstalled;
|
|
67
|
-
private runWithGuard;
|
|
68
30
|
/** @deprecated Use `autoConnect()` instead. */
|
|
69
31
|
autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(): Promise<void>;
|
|
70
32
|
autoConnect(): Promise<void>;
|
|
71
33
|
connect(): Promise<void>;
|
|
34
|
+
/** @deprecated Use `connect()` or `autoConnect()` instead. */
|
|
72
35
|
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
73
|
-
private handleAuthorizationResult;
|
|
74
|
-
private performReauthorization;
|
|
75
36
|
disconnect(): Promise<void>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
private performSignTransactions;
|
|
37
|
+
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
38
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
79
39
|
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
80
40
|
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
81
41
|
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
82
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
83
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
84
42
|
}
|
|
85
|
-
declare
|
|
86
|
-
/**
|
|
87
|
-
* This burner wallet adapter is unsafe to use and is only included to provide an easy way for applications to test
|
|
88
|
-
* Wallet Adapter without using a third-party wallet.
|
|
89
|
-
*/
|
|
90
|
-
declare class SolanaMobileWalletAdapterRemote extends BaseSignInMessageSignerWalletAdapter {
|
|
91
|
-
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
92
|
-
name: WalletName<"MWA (Remote)">;
|
|
93
|
-
url: string;
|
|
94
|
-
icon: string;
|
|
95
|
-
private _addressSelector;
|
|
96
|
-
private _appIdentity;
|
|
97
|
-
private _authorizationResult;
|
|
98
|
-
private _authorizationResultCache;
|
|
99
|
-
private _connecting;
|
|
43
|
+
declare class LocalSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
100
44
|
/**
|
|
101
|
-
*
|
|
102
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
103
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
45
|
+
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
104
46
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
47
|
+
constructor(config: {
|
|
48
|
+
addressSelector: AddressSelector;
|
|
49
|
+
appIdentity: AppIdentity;
|
|
50
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
+
cluster: Cluster;
|
|
52
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
+
});
|
|
54
|
+
constructor(config: {
|
|
55
|
+
addressSelector: AddressSelector;
|
|
56
|
+
appIdentity: AppIdentity;
|
|
57
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
58
|
+
chain: Chain;
|
|
59
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
declare class RemoteSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
113
63
|
constructor(config: {
|
|
114
64
|
addressSelector: AddressSelector;
|
|
115
65
|
appIdentity: AppIdentity;
|
|
116
66
|
authorizationResultCache: AuthorizationResultCache;
|
|
117
67
|
chain: Chain;
|
|
118
68
|
remoteHostAuthority: string;
|
|
119
|
-
onWalletNotFound: (mobileWalletAdapter:
|
|
69
|
+
onWalletNotFound: (mobileWalletAdapter: RemoteSolanaMobileWalletAdapter) => Promise<void>;
|
|
120
70
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
get connecting(): boolean;
|
|
124
|
-
get readyState(): WalletReadyState;
|
|
125
|
-
private declareWalletAsInstalled;
|
|
126
|
-
private runWithGuard;
|
|
127
|
-
autoConnect(): Promise<void>;
|
|
128
|
-
connect(): Promise<void>;
|
|
129
|
-
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
130
|
-
private handleAuthorizationResult;
|
|
131
|
-
private performReauthorization;
|
|
132
|
-
disconnect(): Promise<void>;
|
|
133
|
-
private transact;
|
|
134
|
-
private assertIsAuthorized;
|
|
135
|
-
private performSignTransactions;
|
|
136
|
-
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
137
|
-
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
138
|
-
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
139
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
140
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
71
|
+
}
|
|
72
|
+
declare class SolanaMobileWalletAdapter extends LocalSolanaMobileWalletAdapter {
|
|
141
73
|
}
|
|
142
74
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
143
75
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
144
76
|
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
145
|
-
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName,
|
|
77
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, LocalSolanaMobileWalletAdapter, RemoteSolanaMobileWalletAdapter, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
146
78
|
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,144 +3,76 @@ import { Connection, PublicKey, SendOptions, TransactionSignature, TransactionVe
|
|
|
3
3
|
import { Transaction as LegacyTransaction } from "@solana/web3.js";
|
|
4
4
|
import { AppIdentity, AuthorizationResult, Base64EncodedAddress, Chain, Cluster, SignInPayload } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
5
5
|
import { SolanaSignInInput, SolanaSignInOutput } from "@solana/wallet-standard-features";
|
|
6
|
+
import { Authorization, LocalSolanaMobileWalletAdapterWallet, RemoteSolanaMobileWalletAdapterWallet } from "@solana-mobile/wallet-standard-mobile";
|
|
6
7
|
interface AuthorizationResultCache {
|
|
7
8
|
clear(): Promise<void>;
|
|
8
|
-
get(): Promise<AuthorizationResult | undefined>;
|
|
9
|
-
set(authorizationResult: AuthorizationResult): Promise<void>;
|
|
9
|
+
get(): Promise<AuthorizationResult | Authorization | undefined>;
|
|
10
|
+
set(authorizationResult: AuthorizationResult | Authorization): Promise<void>;
|
|
10
11
|
}
|
|
11
12
|
interface AddressSelector {
|
|
12
13
|
select(addresses: Base64EncodedAddress[]): Promise<Base64EncodedAddress>;
|
|
13
14
|
}
|
|
14
15
|
declare const SolanaMobileWalletAdapterWalletName: WalletName<string>;
|
|
15
|
-
declare class
|
|
16
|
+
declare abstract class BaseSolanaMobileWalletAdapter extends BaseSignInMessageSignerWalletAdapter {
|
|
17
|
+
#private;
|
|
16
18
|
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
17
19
|
name: WalletName<string>;
|
|
20
|
+
icon: `data:image/svg+xml;base64,${string}` | `data:image/webp;base64,${string}` | `data:image/png;base64,${string}` | `data:image/gif;base64,${string}`;
|
|
18
21
|
url: string;
|
|
19
|
-
|
|
20
|
-
private _addressSelector;
|
|
21
|
-
private _appIdentity;
|
|
22
|
-
private _authorizationResult;
|
|
23
|
-
private _authorizationResultCache;
|
|
24
|
-
private _connecting;
|
|
25
|
-
/**
|
|
26
|
-
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
27
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
28
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
29
|
-
*/
|
|
30
|
-
private _connectionGeneration;
|
|
31
|
-
private _chain;
|
|
32
|
-
private _onWalletNotFound;
|
|
33
|
-
private _publicKey;
|
|
34
|
-
private _readyState;
|
|
35
|
-
private _selectedAddress;
|
|
36
|
-
private _hostAuthority;
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
39
|
-
*/
|
|
40
|
-
constructor(config: {
|
|
41
|
-
addressSelector: AddressSelector;
|
|
42
|
-
appIdentity: AppIdentity;
|
|
43
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
44
|
-
cluster: Cluster;
|
|
45
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
46
|
-
});
|
|
47
|
-
constructor(config: {
|
|
48
|
-
addressSelector: AddressSelector;
|
|
49
|
-
appIdentity: AppIdentity;
|
|
50
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
-
chain: Chain;
|
|
52
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
-
});
|
|
54
|
-
constructor(config: {
|
|
22
|
+
protected constructor(wallet: LocalSolanaMobileWalletAdapterWallet | RemoteSolanaMobileWalletAdapterWallet, config: {
|
|
55
23
|
addressSelector: AddressSelector;
|
|
56
|
-
appIdentity: AppIdentity;
|
|
57
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
58
24
|
chain: Chain;
|
|
59
|
-
remoteHostAuthority: string;
|
|
60
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
61
25
|
});
|
|
62
26
|
get publicKey(): PublicKey | null;
|
|
63
27
|
get connected(): boolean;
|
|
64
28
|
get connecting(): boolean;
|
|
65
29
|
get readyState(): WalletReadyState;
|
|
66
|
-
private declareWalletAsInstalled;
|
|
67
|
-
private runWithGuard;
|
|
68
30
|
/** @deprecated Use `autoConnect()` instead. */
|
|
69
31
|
autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(): Promise<void>;
|
|
70
32
|
autoConnect(): Promise<void>;
|
|
71
33
|
connect(): Promise<void>;
|
|
34
|
+
/** @deprecated Use `connect()` or `autoConnect()` instead. */
|
|
72
35
|
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
73
|
-
private handleAuthorizationResult;
|
|
74
|
-
private performReauthorization;
|
|
75
36
|
disconnect(): Promise<void>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
private performSignTransactions;
|
|
37
|
+
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
38
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
79
39
|
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
80
40
|
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
81
41
|
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
82
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
83
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
84
42
|
}
|
|
85
|
-
declare
|
|
86
|
-
/**
|
|
87
|
-
* This burner wallet adapter is unsafe to use and is only included to provide an easy way for applications to test
|
|
88
|
-
* Wallet Adapter without using a third-party wallet.
|
|
89
|
-
*/
|
|
90
|
-
declare class SolanaMobileWalletAdapterRemote extends BaseSignInMessageSignerWalletAdapter {
|
|
91
|
-
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
92
|
-
name: WalletName<"MWA (Remote)">;
|
|
93
|
-
url: string;
|
|
94
|
-
icon: string;
|
|
95
|
-
private _addressSelector;
|
|
96
|
-
private _appIdentity;
|
|
97
|
-
private _authorizationResult;
|
|
98
|
-
private _authorizationResultCache;
|
|
99
|
-
private _connecting;
|
|
43
|
+
declare class LocalSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
100
44
|
/**
|
|
101
|
-
*
|
|
102
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
103
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
45
|
+
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
104
46
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
47
|
+
constructor(config: {
|
|
48
|
+
addressSelector: AddressSelector;
|
|
49
|
+
appIdentity: AppIdentity;
|
|
50
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
+
cluster: Cluster;
|
|
52
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
+
});
|
|
54
|
+
constructor(config: {
|
|
55
|
+
addressSelector: AddressSelector;
|
|
56
|
+
appIdentity: AppIdentity;
|
|
57
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
58
|
+
chain: Chain;
|
|
59
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
declare class RemoteSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
113
63
|
constructor(config: {
|
|
114
64
|
addressSelector: AddressSelector;
|
|
115
65
|
appIdentity: AppIdentity;
|
|
116
66
|
authorizationResultCache: AuthorizationResultCache;
|
|
117
67
|
chain: Chain;
|
|
118
68
|
remoteHostAuthority: string;
|
|
119
|
-
onWalletNotFound: (mobileWalletAdapter:
|
|
69
|
+
onWalletNotFound: (mobileWalletAdapter: RemoteSolanaMobileWalletAdapter) => Promise<void>;
|
|
120
70
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
get connecting(): boolean;
|
|
124
|
-
get readyState(): WalletReadyState;
|
|
125
|
-
private declareWalletAsInstalled;
|
|
126
|
-
private runWithGuard;
|
|
127
|
-
autoConnect(): Promise<void>;
|
|
128
|
-
connect(): Promise<void>;
|
|
129
|
-
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
130
|
-
private handleAuthorizationResult;
|
|
131
|
-
private performReauthorization;
|
|
132
|
-
disconnect(): Promise<void>;
|
|
133
|
-
private transact;
|
|
134
|
-
private assertIsAuthorized;
|
|
135
|
-
private performSignTransactions;
|
|
136
|
-
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
137
|
-
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
138
|
-
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
139
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
140
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
71
|
+
}
|
|
72
|
+
declare class SolanaMobileWalletAdapter extends LocalSolanaMobileWalletAdapter {
|
|
141
73
|
}
|
|
142
74
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
143
75
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
144
76
|
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
145
|
-
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName,
|
|
77
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, LocalSolanaMobileWalletAdapter, RemoteSolanaMobileWalletAdapter, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
146
78
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
|
@@ -3,144 +3,76 @@ import { Connection, PublicKey, SendOptions, TransactionSignature, TransactionVe
|
|
|
3
3
|
import { Transaction as LegacyTransaction } from "@solana/web3.js";
|
|
4
4
|
import { AppIdentity, AuthorizationResult, Base64EncodedAddress, Chain, Cluster, SignInPayload } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
5
5
|
import { SolanaSignInInput, SolanaSignInOutput } from "@solana/wallet-standard-features";
|
|
6
|
+
import { Authorization, LocalSolanaMobileWalletAdapterWallet, RemoteSolanaMobileWalletAdapterWallet } from "@solana-mobile/wallet-standard-mobile";
|
|
6
7
|
interface AuthorizationResultCache {
|
|
7
8
|
clear(): Promise<void>;
|
|
8
|
-
get(): Promise<AuthorizationResult | undefined>;
|
|
9
|
-
set(authorizationResult: AuthorizationResult): Promise<void>;
|
|
9
|
+
get(): Promise<AuthorizationResult | Authorization | undefined>;
|
|
10
|
+
set(authorizationResult: AuthorizationResult | Authorization): Promise<void>;
|
|
10
11
|
}
|
|
11
12
|
interface AddressSelector {
|
|
12
13
|
select(addresses: Base64EncodedAddress[]): Promise<Base64EncodedAddress>;
|
|
13
14
|
}
|
|
14
15
|
declare const SolanaMobileWalletAdapterWalletName: WalletName<string>;
|
|
15
|
-
declare class
|
|
16
|
+
declare abstract class BaseSolanaMobileWalletAdapter extends BaseSignInMessageSignerWalletAdapter {
|
|
17
|
+
#private;
|
|
16
18
|
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
17
19
|
name: WalletName<string>;
|
|
20
|
+
icon: `data:image/svg+xml;base64,${string}` | `data:image/webp;base64,${string}` | `data:image/png;base64,${string}` | `data:image/gif;base64,${string}`;
|
|
18
21
|
url: string;
|
|
19
|
-
|
|
20
|
-
private _addressSelector;
|
|
21
|
-
private _appIdentity;
|
|
22
|
-
private _authorizationResult;
|
|
23
|
-
private _authorizationResultCache;
|
|
24
|
-
private _connecting;
|
|
25
|
-
/**
|
|
26
|
-
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
27
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
28
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
29
|
-
*/
|
|
30
|
-
private _connectionGeneration;
|
|
31
|
-
private _chain;
|
|
32
|
-
private _onWalletNotFound;
|
|
33
|
-
private _publicKey;
|
|
34
|
-
private _readyState;
|
|
35
|
-
private _selectedAddress;
|
|
36
|
-
private _hostAuthority;
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
39
|
-
*/
|
|
40
|
-
constructor(config: {
|
|
41
|
-
addressSelector: AddressSelector;
|
|
42
|
-
appIdentity: AppIdentity;
|
|
43
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
44
|
-
cluster: Cluster;
|
|
45
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
46
|
-
});
|
|
47
|
-
constructor(config: {
|
|
48
|
-
addressSelector: AddressSelector;
|
|
49
|
-
appIdentity: AppIdentity;
|
|
50
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
-
chain: Chain;
|
|
52
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
-
});
|
|
54
|
-
constructor(config: {
|
|
22
|
+
protected constructor(wallet: LocalSolanaMobileWalletAdapterWallet | RemoteSolanaMobileWalletAdapterWallet, config: {
|
|
55
23
|
addressSelector: AddressSelector;
|
|
56
|
-
appIdentity: AppIdentity;
|
|
57
|
-
authorizationResultCache: AuthorizationResultCache;
|
|
58
24
|
chain: Chain;
|
|
59
|
-
remoteHostAuthority: string;
|
|
60
|
-
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
61
25
|
});
|
|
62
26
|
get publicKey(): PublicKey | null;
|
|
63
27
|
get connected(): boolean;
|
|
64
28
|
get connecting(): boolean;
|
|
65
29
|
get readyState(): WalletReadyState;
|
|
66
|
-
private declareWalletAsInstalled;
|
|
67
|
-
private runWithGuard;
|
|
68
30
|
/** @deprecated Use `autoConnect()` instead. */
|
|
69
31
|
autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(): Promise<void>;
|
|
70
32
|
autoConnect(): Promise<void>;
|
|
71
33
|
connect(): Promise<void>;
|
|
34
|
+
/** @deprecated Use `connect()` or `autoConnect()` instead. */
|
|
72
35
|
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
73
|
-
private handleAuthorizationResult;
|
|
74
|
-
private performReauthorization;
|
|
75
36
|
disconnect(): Promise<void>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
private performSignTransactions;
|
|
37
|
+
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
38
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
79
39
|
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
80
40
|
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
81
41
|
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
82
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
83
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
84
42
|
}
|
|
85
|
-
declare
|
|
86
|
-
/**
|
|
87
|
-
* This burner wallet adapter is unsafe to use and is only included to provide an easy way for applications to test
|
|
88
|
-
* Wallet Adapter without using a third-party wallet.
|
|
89
|
-
*/
|
|
90
|
-
declare class SolanaMobileWalletAdapterRemote extends BaseSignInMessageSignerWalletAdapter {
|
|
91
|
-
readonly supportedTransactionVersions: Set<TransactionVersion>;
|
|
92
|
-
name: WalletName<"MWA (Remote)">;
|
|
93
|
-
url: string;
|
|
94
|
-
icon: string;
|
|
95
|
-
private _addressSelector;
|
|
96
|
-
private _appIdentity;
|
|
97
|
-
private _authorizationResult;
|
|
98
|
-
private _authorizationResultCache;
|
|
99
|
-
private _connecting;
|
|
43
|
+
declare class LocalSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
100
44
|
/**
|
|
101
|
-
*
|
|
102
|
-
* increment this and use it to make sure that `transact` calls from the previous
|
|
103
|
-
* 'generation' don't continue to do work and throw exceptions.
|
|
45
|
+
* @deprecated @param cluster config paramter is deprecated, use @param chain instead
|
|
104
46
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
47
|
+
constructor(config: {
|
|
48
|
+
addressSelector: AddressSelector;
|
|
49
|
+
appIdentity: AppIdentity;
|
|
50
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
51
|
+
cluster: Cluster;
|
|
52
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
53
|
+
});
|
|
54
|
+
constructor(config: {
|
|
55
|
+
addressSelector: AddressSelector;
|
|
56
|
+
appIdentity: AppIdentity;
|
|
57
|
+
authorizationResultCache: AuthorizationResultCache;
|
|
58
|
+
chain: Chain;
|
|
59
|
+
onWalletNotFound: (mobileWalletAdapter: LocalSolanaMobileWalletAdapter) => Promise<void>;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
declare class RemoteSolanaMobileWalletAdapter extends BaseSolanaMobileWalletAdapter {
|
|
113
63
|
constructor(config: {
|
|
114
64
|
addressSelector: AddressSelector;
|
|
115
65
|
appIdentity: AppIdentity;
|
|
116
66
|
authorizationResultCache: AuthorizationResultCache;
|
|
117
67
|
chain: Chain;
|
|
118
68
|
remoteHostAuthority: string;
|
|
119
|
-
onWalletNotFound: (mobileWalletAdapter:
|
|
69
|
+
onWalletNotFound: (mobileWalletAdapter: RemoteSolanaMobileWalletAdapter) => Promise<void>;
|
|
120
70
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
get connecting(): boolean;
|
|
124
|
-
get readyState(): WalletReadyState;
|
|
125
|
-
private declareWalletAsInstalled;
|
|
126
|
-
private runWithGuard;
|
|
127
|
-
autoConnect(): Promise<void>;
|
|
128
|
-
connect(): Promise<void>;
|
|
129
|
-
performAuthorization(signInPayload?: SignInPayload): Promise<AuthorizationResult>;
|
|
130
|
-
private handleAuthorizationResult;
|
|
131
|
-
private performReauthorization;
|
|
132
|
-
disconnect(): Promise<void>;
|
|
133
|
-
private transact;
|
|
134
|
-
private assertIsAuthorized;
|
|
135
|
-
private performSignTransactions;
|
|
136
|
-
sendTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T, connection: Connection, options?: SendOptions): Promise<TransactionSignature>;
|
|
137
|
-
signTransaction<T extends LegacyTransaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
138
|
-
signAllTransactions<T extends LegacyTransaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
139
|
-
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
140
|
-
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
|
|
71
|
+
}
|
|
72
|
+
declare class SolanaMobileWalletAdapter extends LocalSolanaMobileWalletAdapter {
|
|
141
73
|
}
|
|
142
74
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
143
75
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
144
76
|
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
145
|
-
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName,
|
|
77
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, LocalSolanaMobileWalletAdapter, RemoteSolanaMobileWalletAdapter, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
146
78
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts","../../src/__forks__/react-native/createDefaultAuthorizationResultCache.ts","../../src/__forks__/react-native/getIsSupported.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/wallet-adapter-mobile",
|
|
3
3
|
"description": "An adapter for mobile wallet apps that conform to the Solana Mobile Wallet Adapter protocol",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/solana-mobile/mobile-wallet-adapter.git"
|
|
9
9
|
},
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
"exports": {
|
|
12
|
+
"edge-light": {
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"require": "./lib/cjs/index.js"
|
|
15
|
+
},
|
|
16
|
+
"workerd": {
|
|
17
|
+
"import": "./lib/esm/index.js",
|
|
18
|
+
"require": "./lib/cjs/index.js"
|
|
19
|
+
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"import": "./lib/cjs/index.browser.js",
|
|
22
|
+
"require": "./lib/esm/index.browser.js"
|
|
23
|
+
},
|
|
24
|
+
"node": {
|
|
25
|
+
"import": "./lib/esm/index.js",
|
|
26
|
+
"require": "./lib/cjs/index.js"
|
|
27
|
+
},
|
|
28
|
+
"react-native": "./lib/cjs/index.native.js",
|
|
29
|
+
"types": "./lib/types/index.d.ts"
|
|
30
|
+
},
|
|
17
31
|
"browser": {
|
|
18
32
|
"./lib/cjs/index.js": "./lib/cjs/index.browser.js",
|
|
19
33
|
"./lib/esm/index.js": "./lib/esm/index.browser.js"
|
|
20
34
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"types": "./lib/types/index.d.ts"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
35
|
+
"main": "lib/cjs/index.js",
|
|
36
|
+
"module": "lib/esm/index.js",
|
|
37
|
+
"react-native": "lib/cjs/index.native.js",
|
|
38
|
+
"types": "lib/types/index.d.ts",
|
|
39
|
+
"type": "module",
|
|
29
40
|
"files": [
|
|
30
41
|
"lib",
|
|
31
42
|
"LICENSE"
|
|
32
43
|
],
|
|
44
|
+
"sideEffects": false,
|
|
33
45
|
"publishConfig": {
|
|
34
46
|
"access": "public"
|
|
35
47
|
},
|
|
@@ -44,18 +56,17 @@
|
|
|
44
56
|
"@solana/web3.js": "^1.58.0"
|
|
45
57
|
},
|
|
46
58
|
"dependencies": {
|
|
47
|
-
"@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^2.
|
|
59
|
+
"@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^2.2.0",
|
|
60
|
+
"@solana-mobile/wallet-standard-mobile": "^0.2.0",
|
|
48
61
|
"@solana/wallet-adapter-base": "^0.9.23",
|
|
49
62
|
"@solana/wallet-standard-features": "^1.2.0",
|
|
50
|
-
"js-base64": "^3.7.5"
|
|
51
|
-
"qrcode": "^1.5.4"
|
|
63
|
+
"js-base64": "^3.7.5"
|
|
52
64
|
},
|
|
53
65
|
"optionalDependencies": {
|
|
54
66
|
"@react-native-async-storage/async-storage": "^1.17.7"
|
|
55
67
|
},
|
|
56
68
|
"devDependencies": {
|
|
57
|
-
"@solana/web3.js": "^1.
|
|
58
|
-
"@types/qrcode": "^1.5.5",
|
|
69
|
+
"@solana/web3.js": "^1.95.3",
|
|
59
70
|
"agadoo": "^3.0.0",
|
|
60
71
|
"cross-env": "^7.0.3",
|
|
61
72
|
"shx": "^0.3.4"
|