@solana-mobile/mobile-wallet-adapter-protocol 2.2.1 → 2.2.2-hotfix.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/android/build.gradle +2 -2
- package/android/src/main/java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterModule.kt +100 -83
- package/lib/cjs/index.native.js +8 -0
- package/package.json +28 -16
- package/.gitignore +0 -2
- package/android/.gitignore +0 -14
- package/src/__forks__/react-native/base64Utils.ts +0 -1
- package/src/__forks__/react-native/transact.ts +0 -91
- package/src/arrayBufferToBase64String.ts +0 -10
- package/src/associationPort.ts +0 -19
- package/src/base64Utils.ts +0 -22
- package/src/createHelloReq.ts +0 -12
- package/src/createMobileWalletProxy.ts +0 -182
- package/src/createSIWSMessage.ts +0 -14
- package/src/createSequenceNumberVector.ts +0 -11
- package/src/encryptedMessage.ts +0 -60
- package/src/errors.ts +0 -101
- package/src/generateAssociationKeypair.ts +0 -10
- package/src/generateECDHKeypair.ts +0 -10
- package/src/getAssociateAndroidIntentURL.ts +0 -77
- package/src/getJWS.ts +0 -19
- package/src/getStringWithURLUnsafeBase64CharactersReplaced.ts +0 -11
- package/src/index.ts +0 -3
- package/src/jsonRpcMessage.ts +0 -38
- package/src/parseHelloRsp.ts +0 -46
- package/src/parseSessionProps.ts +0 -33
- package/src/reflectorId.ts +0 -31
- package/src/startSession.ts +0 -98
- package/src/transact.ts +0 -593
- package/src/types.ts +0 -201
- package/tsconfig.cjs.json +0 -7
- package/tsconfig.json +0 -8
package/src/types.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import type { TransactionVersion } from '@solana/web3.js';
|
|
2
|
-
import type { SolanaSignInInput } from "@solana/wallet-standard";
|
|
3
|
-
import type { IdentifierArray, IdentifierString, WalletAccount, WalletIcon } from '@wallet-standard/core';
|
|
4
|
-
|
|
5
|
-
export type Account = Readonly<{
|
|
6
|
-
address: Base64EncodedAddress;
|
|
7
|
-
label?: string;
|
|
8
|
-
icon?: WalletIcon;
|
|
9
|
-
chains?: IdentifierArray;
|
|
10
|
-
features?: IdentifierArray;
|
|
11
|
-
}> | WalletAccount;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Properties that wallets may present to users when an app
|
|
15
|
-
* asks for authorization to execute privileged methods (see
|
|
16
|
-
* {@link PrivilegedMethods}).
|
|
17
|
-
*/
|
|
18
|
-
export type AppIdentity = Readonly<{
|
|
19
|
-
uri?: string;
|
|
20
|
-
icon?: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
}>;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* An ephemeral elliptic-curve keypair on the P-256 curve.
|
|
26
|
-
* This public key is used to create the association token.
|
|
27
|
-
* The private key is used during session establishment.
|
|
28
|
-
*/
|
|
29
|
-
export type AssociationKeypair = CryptoKeyPair;
|
|
30
|
-
|
|
31
|
-
export type ProtocolVersion = 'v1' | 'legacy';
|
|
32
|
-
|
|
33
|
-
export type SessionProperties = Readonly<{
|
|
34
|
-
protocol_version: ProtocolVersion;
|
|
35
|
-
}>;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The context returned from a wallet after having authorized a given
|
|
39
|
-
* account for use with a given application. You can cache this and
|
|
40
|
-
* use it later to invoke privileged methods.
|
|
41
|
-
*/
|
|
42
|
-
export type AuthorizationResult = Readonly<{
|
|
43
|
-
accounts: Account[];
|
|
44
|
-
auth_token: AuthToken;
|
|
45
|
-
wallet_uri_base: string;
|
|
46
|
-
sign_in_result?: SignInResult;
|
|
47
|
-
}>;
|
|
48
|
-
|
|
49
|
-
export type AuthToken = string;
|
|
50
|
-
|
|
51
|
-
export type Base64EncodedAddress = string;
|
|
52
|
-
|
|
53
|
-
type Base64EncodedSignature = string;
|
|
54
|
-
|
|
55
|
-
type Base64EncodedMessage = string;
|
|
56
|
-
|
|
57
|
-
type Base64EncodedSignedMessage = string;
|
|
58
|
-
|
|
59
|
-
type Base64EncodedSignedTransaction = string;
|
|
60
|
-
|
|
61
|
-
export type Base64EncodedTransaction = string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated Replaced by the 'chain' parameter, which adds multi-chain capability as per MWA 2.0 spec.
|
|
65
|
-
*/
|
|
66
|
-
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
67
|
-
|
|
68
|
-
export type Chain = IdentifierString | Cluster;
|
|
69
|
-
|
|
70
|
-
export type Finality = 'confirmed' | 'finalized' | 'processed';
|
|
71
|
-
|
|
72
|
-
export type WalletAssociationConfig = Readonly<{
|
|
73
|
-
baseUri?: string;
|
|
74
|
-
}>;
|
|
75
|
-
|
|
76
|
-
export type RemoteWalletAssociationConfig = WalletAssociationConfig & Readonly<{
|
|
77
|
-
remoteHostAuthority: string;
|
|
78
|
-
}>;
|
|
79
|
-
|
|
80
|
-
export interface AuthorizeAPI {
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated Replaced by updated authorize() method, which adds MWA 2.0 spec support.
|
|
83
|
-
*/
|
|
84
|
-
authorize(params: { cluster: Cluster; identity: AppIdentity }): Promise<AuthorizationResult>;
|
|
85
|
-
|
|
86
|
-
authorize(params: {
|
|
87
|
-
identity: AppIdentity;
|
|
88
|
-
chain?: Chain;
|
|
89
|
-
features?: IdentifierArray;
|
|
90
|
-
addresses?: string[];
|
|
91
|
-
auth_token?: AuthToken;
|
|
92
|
-
sign_in_payload?: SignInPayload;
|
|
93
|
-
}): Promise<AuthorizationResult>;
|
|
94
|
-
}
|
|
95
|
-
export interface CloneAuthorizationAPI {
|
|
96
|
-
cloneAuthorization(params: { auth_token: AuthToken }): Promise<Readonly<{ auth_token: AuthToken }>>;
|
|
97
|
-
}
|
|
98
|
-
export interface DeauthorizeAPI {
|
|
99
|
-
deauthorize(params: { auth_token: AuthToken }): Promise<Readonly<Record<string, never>>>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface GetCapabilitiesAPI {
|
|
103
|
-
getCapabilities(): Promise<
|
|
104
|
-
Readonly<{
|
|
105
|
-
max_transactions_per_request: number;
|
|
106
|
-
max_messages_per_request: number;
|
|
107
|
-
supported_transaction_versions: ReadonlyArray<TransactionVersion>;
|
|
108
|
-
features: IdentifierArray;
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated Replaced by features array.
|
|
111
|
-
*/
|
|
112
|
-
supports_clone_authorization: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated Replaced by features array.
|
|
115
|
-
*/
|
|
116
|
-
supports_sign_and_send_transactions: boolean;
|
|
117
|
-
}>
|
|
118
|
-
>;
|
|
119
|
-
}
|
|
120
|
-
export interface ReauthorizeAPI {
|
|
121
|
-
reauthorize(params: { auth_token: AuthToken; identity: AppIdentity }): Promise<AuthorizationResult>;
|
|
122
|
-
}
|
|
123
|
-
export interface SignMessagesAPI {
|
|
124
|
-
signMessages(params: {
|
|
125
|
-
addresses: Base64EncodedAddress[];
|
|
126
|
-
payloads: Base64EncodedMessage[];
|
|
127
|
-
}): Promise<Readonly<{ signed_payloads: Base64EncodedSignedMessage[] }>>;
|
|
128
|
-
}
|
|
129
|
-
export interface SignTransactionsAPI {
|
|
130
|
-
signTransactions(params: {
|
|
131
|
-
payloads: Base64EncodedTransaction[];
|
|
132
|
-
}): Promise<Readonly<{ signed_payloads: Base64EncodedSignedTransaction[] }>>;
|
|
133
|
-
}
|
|
134
|
-
export interface SignAndSendTransactionsAPI {
|
|
135
|
-
signAndSendTransactions(params: {
|
|
136
|
-
options?: Readonly<{
|
|
137
|
-
min_context_slot?: number;
|
|
138
|
-
commitment?: string;
|
|
139
|
-
skip_preflight?: boolean;
|
|
140
|
-
max_retries?: number;
|
|
141
|
-
wait_for_commitment_to_send_next_transaction?: boolean;
|
|
142
|
-
}>;
|
|
143
|
-
payloads: Base64EncodedTransaction[];
|
|
144
|
-
}): Promise<Readonly<{ signatures: Base64EncodedSignature[] }>>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface MobileWallet
|
|
148
|
-
extends AuthorizeAPI,
|
|
149
|
-
CloneAuthorizationAPI,
|
|
150
|
-
DeauthorizeAPI,
|
|
151
|
-
GetCapabilitiesAPI,
|
|
152
|
-
ReauthorizeAPI,
|
|
153
|
-
SignMessagesAPI,
|
|
154
|
-
SignTransactionsAPI,
|
|
155
|
-
SignAndSendTransactionsAPI {}
|
|
156
|
-
|
|
157
|
-
export interface TerminateSessionAPI {
|
|
158
|
-
terminateSession(): void
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface RemoteMobileWallet
|
|
162
|
-
extends MobileWallet, TerminateSessionAPI {}
|
|
163
|
-
|
|
164
|
-
// optional features
|
|
165
|
-
export const SolanaSignTransactions = 'solana:signTransactions'
|
|
166
|
-
export const SolanaCloneAuthorization = 'solana:cloneAuthorization'
|
|
167
|
-
export const SolanaSignInWithSolana = 'solana:signInWithSolana'
|
|
168
|
-
|
|
169
|
-
export type SignInPayload = Readonly<{
|
|
170
|
-
domain?: string;
|
|
171
|
-
address?: string;
|
|
172
|
-
statement?: string;
|
|
173
|
-
uri?: string;
|
|
174
|
-
version?: string;
|
|
175
|
-
chainId?: string;
|
|
176
|
-
nonce?: string;
|
|
177
|
-
issuedAt?: string;
|
|
178
|
-
expirationTime?: string;
|
|
179
|
-
notBefore?: string;
|
|
180
|
-
requestId?: string;
|
|
181
|
-
resources?: readonly string[];
|
|
182
|
-
}> | SolanaSignInInput;
|
|
183
|
-
|
|
184
|
-
export type SignInPayloadWithRequiredFields = Partial<SignInPayload> &
|
|
185
|
-
Required<Pick<SignInPayload, 'domain' | 'address'>>
|
|
186
|
-
|
|
187
|
-
export type SignInResult = Readonly<{
|
|
188
|
-
address: Base64EncodedAddress;
|
|
189
|
-
signed_message: Base64EncodedSignedMessage;
|
|
190
|
-
signature: Base64EncodedAddress;
|
|
191
|
-
signature_type?: string;
|
|
192
|
-
}>;
|
|
193
|
-
|
|
194
|
-
export type Scenario = Readonly<{
|
|
195
|
-
wallet: Promise<MobileWallet>;
|
|
196
|
-
close: () => void;
|
|
197
|
-
}>;
|
|
198
|
-
|
|
199
|
-
export type RemoteScenario = Scenario & Readonly<{
|
|
200
|
-
associationUrl: URL;
|
|
201
|
-
}>;
|
package/tsconfig.cjs.json
DELETED