@solana-mobile/mobile-wallet-adapter-protocol 2.2.6 → 2.2.8

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.
@@ -1,270 +0,0 @@
1
- import { TransactionVersion } from "@solana/web3.js";
2
- import { SolanaSignInInput } from "@solana/wallet-standard-features";
3
- import { IdentifierArray, IdentifierString, WalletAccount, WalletIcon } from "@wallet-standard/core";
4
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
5
- declare const SolanaMobileWalletAdapterErrorCode: {
6
- readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
7
- readonly ERROR_REFLECTOR_ID_OUT_OF_RANGE: "ERROR_REFLECTOR_ID_OUT_OF_RANGE";
8
- readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
9
- readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
10
- readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
11
- readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT";
12
- readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
13
- readonly ERROR_INVALID_PROTOCOL_VERSION: "ERROR_INVALID_PROTOCOL_VERSION";
14
- readonly ERROR_BROWSER_NOT_SUPPORTED: "ERROR_BROWSER_NOT_SUPPORTED";
15
- readonly ERROR_LOOPBACK_ACCESS_BLOCKED: "ERROR_LOOPBACK_ACCESS_BLOCKED";
16
- readonly ERROR_ASSOCIATION_CANCELLED: "ERROR_ASSOCIATION_CANCELLED";
17
- };
18
- type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
19
- type ErrorDataTypeMap = {
20
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE]: {
21
- port: number;
22
- };
23
- [SolanaMobileWalletAdapterErrorCode.ERROR_REFLECTOR_ID_OUT_OF_RANGE]: {
24
- id: number;
25
- };
26
- [SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL]: undefined;
27
- [SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED]: undefined;
28
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
29
- closeEvent: CloseEvent;
30
- };
31
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined;
32
- [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
33
- [SolanaMobileWalletAdapterErrorCode.ERROR_INVALID_PROTOCOL_VERSION]: undefined;
34
- [SolanaMobileWalletAdapterErrorCode.ERROR_BROWSER_NOT_SUPPORTED]: undefined;
35
- [SolanaMobileWalletAdapterErrorCode.ERROR_LOOPBACK_ACCESS_BLOCKED]: undefined;
36
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_CANCELLED]: {
37
- event: Event | undefined;
38
- };
39
- };
40
- declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
41
- data: ErrorDataTypeMap[TErrorCode] | undefined;
42
- code: TErrorCode;
43
- constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
44
- code: TErrorCode,
45
- message: string,
46
- data: ErrorDataTypeMap[TErrorCode]
47
- ] : [
48
- code: TErrorCode,
49
- message: string
50
- ]);
51
- }
52
- type JSONRPCErrorCode = number;
53
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
54
- declare const SolanaMobileWalletAdapterProtocolErrorCode: {
55
- readonly ERROR_AUTHORIZATION_FAILED: -1;
56
- readonly ERROR_INVALID_PAYLOADS: -2;
57
- readonly ERROR_NOT_SIGNED: -3;
58
- readonly ERROR_NOT_SUBMITTED: -4;
59
- readonly ERROR_TOO_MANY_PAYLOADS: -5;
60
- readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
61
- };
62
- type SolanaMobileWalletAdapterProtocolErrorCodeEnum = (typeof SolanaMobileWalletAdapterProtocolErrorCode)[keyof typeof SolanaMobileWalletAdapterProtocolErrorCode];
63
- type ProtocolErrorDataTypeMap = {
64
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
65
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
66
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
67
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
68
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
69
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
70
- attest_origin_uri: string;
71
- challenge: string;
72
- context: string;
73
- };
74
- };
75
- declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMobileWalletAdapterProtocolErrorCodeEnum> extends Error {
76
- data: ProtocolErrorDataTypeMap[TErrorCode] | undefined;
77
- code: TErrorCode | JSONRPCErrorCode;
78
- jsonRpcMessageId: number;
79
- constructor(...args: ProtocolErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
80
- jsonRpcMessageId: number,
81
- code: TErrorCode | JSONRPCErrorCode,
82
- message: string,
83
- data: ProtocolErrorDataTypeMap[TErrorCode]
84
- ] : [
85
- jsonRpcMessageId: number,
86
- code: TErrorCode | JSONRPCErrorCode,
87
- message: string
88
- ]);
89
- }
90
- type Account = Readonly<{
91
- address: Base64EncodedAddress;
92
- label?: string;
93
- icon?: WalletIcon;
94
- chains?: IdentifierArray;
95
- features?: IdentifierArray;
96
- }> | WalletAccount;
97
- /**
98
- * Properties that wallets may present to users when an app
99
- * asks for authorization to execute privileged methods (see
100
- * {@link PrivilegedMethods}).
101
- */
102
- type AppIdentity = Readonly<{
103
- uri?: string;
104
- icon?: string;
105
- name?: string;
106
- }>;
107
- /**
108
- * An ephemeral elliptic-curve keypair on the P-256 curve.
109
- * This public key is used to create the association token.
110
- * The private key is used during session establishment.
111
- */
112
- type AssociationKeypair = CryptoKeyPair;
113
- type ProtocolVersion = "v1" | "legacy";
114
- type SessionProperties = Readonly<{
115
- protocol_version: ProtocolVersion;
116
- }>;
117
- /**
118
- * The context returned from a wallet after having authorized a given
119
- * account for use with a given application. You can cache this and
120
- * use it later to invoke privileged methods.
121
- */
122
- type AuthorizationResult = Readonly<{
123
- accounts: Account[];
124
- auth_token: AuthToken;
125
- wallet_uri_base: string;
126
- sign_in_result?: SignInResult;
127
- }>;
128
- type AuthToken = string;
129
- type Base64EncodedAddress = string;
130
- type Base64EncodedSignature = string;
131
- type Base64EncodedMessage = string;
132
- type Base64EncodedSignedMessage = string;
133
- type Base64EncodedSignedTransaction = string;
134
- type Base64EncodedTransaction = string;
135
- /**
136
- * @deprecated Replaced by the 'chain' parameter, which adds multi-chain capability as per MWA 2.0 spec.
137
- */
138
- type Cluster = "devnet" | "testnet" | "mainnet-beta";
139
- type Chain = IdentifierString | Cluster;
140
- type Finality = "confirmed" | "finalized" | "processed";
141
- type WalletAssociationConfig = Readonly<{
142
- baseUri?: string;
143
- }>;
144
- type RemoteWalletAssociationConfig = WalletAssociationConfig & Readonly<{
145
- remoteHostAuthority: string;
146
- }>;
147
- interface AuthorizeAPI {
148
- /**
149
- * @deprecated Replaced by updated authorize() method, which adds MWA 2.0 spec support.
150
- */
151
- authorize(params: {
152
- cluster: Cluster;
153
- identity: AppIdentity;
154
- }): Promise<AuthorizationResult>;
155
- authorize(params: {
156
- identity: AppIdentity;
157
- chain?: Chain;
158
- features?: IdentifierArray;
159
- addresses?: string[];
160
- auth_token?: AuthToken;
161
- sign_in_payload?: SignInPayload;
162
- }): Promise<AuthorizationResult>;
163
- }
164
- interface CloneAuthorizationAPI {
165
- cloneAuthorization(params: {
166
- auth_token: AuthToken;
167
- }): Promise<Readonly<{
168
- auth_token: AuthToken;
169
- }>>;
170
- }
171
- interface DeauthorizeAPI {
172
- deauthorize(params: {
173
- auth_token: AuthToken;
174
- }): Promise<Readonly<Record<string, never>>>;
175
- }
176
- interface GetCapabilitiesAPI {
177
- getCapabilities(): Promise<Readonly<{
178
- max_transactions_per_request: number;
179
- max_messages_per_request: number;
180
- supported_transaction_versions: ReadonlyArray<TransactionVersion>;
181
- features: IdentifierArray;
182
- /**
183
- * @deprecated Replaced by features array.
184
- */
185
- supports_clone_authorization: boolean;
186
- /**
187
- * @deprecated Replaced by features array.
188
- */
189
- supports_sign_and_send_transactions: boolean;
190
- }>>;
191
- }
192
- interface ReauthorizeAPI {
193
- reauthorize(params: {
194
- auth_token: AuthToken;
195
- identity: AppIdentity;
196
- }): Promise<AuthorizationResult>;
197
- }
198
- interface SignMessagesAPI {
199
- signMessages(params: {
200
- addresses: Base64EncodedAddress[];
201
- payloads: Base64EncodedMessage[];
202
- }): Promise<Readonly<{
203
- signed_payloads: Base64EncodedSignedMessage[];
204
- }>>;
205
- }
206
- interface SignTransactionsAPI {
207
- signTransactions(params: {
208
- payloads: Base64EncodedTransaction[];
209
- }): Promise<Readonly<{
210
- signed_payloads: Base64EncodedSignedTransaction[];
211
- }>>;
212
- }
213
- interface SignAndSendTransactionsAPI {
214
- signAndSendTransactions(params: {
215
- options?: Readonly<{
216
- min_context_slot?: number;
217
- commitment?: string;
218
- skip_preflight?: boolean;
219
- max_retries?: number;
220
- wait_for_commitment_to_send_next_transaction?: boolean;
221
- }>;
222
- payloads: Base64EncodedTransaction[];
223
- }): Promise<Readonly<{
224
- signatures: Base64EncodedSignature[];
225
- }>>;
226
- }
227
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
228
- }
229
- interface TerminateSessionAPI {
230
- terminateSession(): void;
231
- }
232
- interface RemoteMobileWallet extends MobileWallet, TerminateSessionAPI {
233
- }
234
- // optional features
235
- declare const SolanaSignTransactions = "solana:signTransactions";
236
- declare const SolanaCloneAuthorization = "solana:cloneAuthorization";
237
- declare const SolanaSignInWithSolana = "solana:signInWithSolana";
238
- type SignInPayload = Readonly<{
239
- domain?: string;
240
- address?: string;
241
- statement?: string;
242
- uri?: string;
243
- version?: string;
244
- chainId?: string;
245
- nonce?: string;
246
- issuedAt?: string;
247
- expirationTime?: string;
248
- notBefore?: string;
249
- requestId?: string;
250
- resources?: readonly string[];
251
- }> | SolanaSignInInput;
252
- type SignInPayloadWithRequiredFields = Partial<SignInPayload> & Required<Pick<SignInPayload, "domain" | "address">>;
253
- type SignInResult = Readonly<{
254
- address: Base64EncodedAddress;
255
- signed_message: Base64EncodedSignedMessage;
256
- signature: Base64EncodedSignature;
257
- signature_type?: string;
258
- }>;
259
- type Scenario = Readonly<{
260
- wallet: Promise<MobileWallet>;
261
- close: () => void;
262
- }>;
263
- type RemoteScenario = Scenario & Readonly<{
264
- associationUrl: URL;
265
- }>;
266
- declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
267
- declare function startScenario(config?: WalletAssociationConfig): Promise<Scenario>;
268
- declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<RemoteScenario>;
269
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, startScenario, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
270
- //# sourceMappingURL=index.browser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/base64Utils.ts","../../src/createHelloReq.ts","../../src/types.ts","../../src/createSIWSMessage.ts","../../src/base58Utils.ts","../../src/createMobileWalletProxy.ts","../../src/createSequenceNumberVector.ts","../../src/parseHelloRsp.ts","../../src/encryptedMessage.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/arrayBufferToBase64String.ts","../../src/associationPort.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/jsonRpcMessage.ts","../../src/parseSessionProps.ts","../../src/startSession.ts","../../src/transact.ts"],"names":[],"mappings":""}
@@ -1,270 +0,0 @@
1
- import { TransactionVersion } from "@solana/web3.js";
2
- import { SolanaSignInInput } from "@solana/wallet-standard-features";
3
- import { IdentifierArray, IdentifierString, WalletAccount, WalletIcon } from "@wallet-standard/core";
4
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
5
- declare const SolanaMobileWalletAdapterErrorCode: {
6
- readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
7
- readonly ERROR_REFLECTOR_ID_OUT_OF_RANGE: "ERROR_REFLECTOR_ID_OUT_OF_RANGE";
8
- readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
9
- readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
10
- readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
11
- readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT";
12
- readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
13
- readonly ERROR_INVALID_PROTOCOL_VERSION: "ERROR_INVALID_PROTOCOL_VERSION";
14
- readonly ERROR_BROWSER_NOT_SUPPORTED: "ERROR_BROWSER_NOT_SUPPORTED";
15
- readonly ERROR_LOOPBACK_ACCESS_BLOCKED: "ERROR_LOOPBACK_ACCESS_BLOCKED";
16
- readonly ERROR_ASSOCIATION_CANCELLED: "ERROR_ASSOCIATION_CANCELLED";
17
- };
18
- type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
19
- type ErrorDataTypeMap = {
20
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE]: {
21
- port: number;
22
- };
23
- [SolanaMobileWalletAdapterErrorCode.ERROR_REFLECTOR_ID_OUT_OF_RANGE]: {
24
- id: number;
25
- };
26
- [SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL]: undefined;
27
- [SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED]: undefined;
28
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
29
- closeEvent: CloseEvent;
30
- };
31
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined;
32
- [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
33
- [SolanaMobileWalletAdapterErrorCode.ERROR_INVALID_PROTOCOL_VERSION]: undefined;
34
- [SolanaMobileWalletAdapterErrorCode.ERROR_BROWSER_NOT_SUPPORTED]: undefined;
35
- [SolanaMobileWalletAdapterErrorCode.ERROR_LOOPBACK_ACCESS_BLOCKED]: undefined;
36
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_CANCELLED]: {
37
- event: Event | undefined;
38
- };
39
- };
40
- declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
41
- data: ErrorDataTypeMap[TErrorCode] | undefined;
42
- code: TErrorCode;
43
- constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
44
- code: TErrorCode,
45
- message: string,
46
- data: ErrorDataTypeMap[TErrorCode]
47
- ] : [
48
- code: TErrorCode,
49
- message: string
50
- ]);
51
- }
52
- type JSONRPCErrorCode = number;
53
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
54
- declare const SolanaMobileWalletAdapterProtocolErrorCode: {
55
- readonly ERROR_AUTHORIZATION_FAILED: -1;
56
- readonly ERROR_INVALID_PAYLOADS: -2;
57
- readonly ERROR_NOT_SIGNED: -3;
58
- readonly ERROR_NOT_SUBMITTED: -4;
59
- readonly ERROR_TOO_MANY_PAYLOADS: -5;
60
- readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
61
- };
62
- type SolanaMobileWalletAdapterProtocolErrorCodeEnum = (typeof SolanaMobileWalletAdapterProtocolErrorCode)[keyof typeof SolanaMobileWalletAdapterProtocolErrorCode];
63
- type ProtocolErrorDataTypeMap = {
64
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
65
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
66
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
67
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
68
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
69
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
70
- attest_origin_uri: string;
71
- challenge: string;
72
- context: string;
73
- };
74
- };
75
- declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMobileWalletAdapterProtocolErrorCodeEnum> extends Error {
76
- data: ProtocolErrorDataTypeMap[TErrorCode] | undefined;
77
- code: TErrorCode | JSONRPCErrorCode;
78
- jsonRpcMessageId: number;
79
- constructor(...args: ProtocolErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
80
- jsonRpcMessageId: number,
81
- code: TErrorCode | JSONRPCErrorCode,
82
- message: string,
83
- data: ProtocolErrorDataTypeMap[TErrorCode]
84
- ] : [
85
- jsonRpcMessageId: number,
86
- code: TErrorCode | JSONRPCErrorCode,
87
- message: string
88
- ]);
89
- }
90
- type Account = Readonly<{
91
- address: Base64EncodedAddress;
92
- label?: string;
93
- icon?: WalletIcon;
94
- chains?: IdentifierArray;
95
- features?: IdentifierArray;
96
- }> | WalletAccount;
97
- /**
98
- * Properties that wallets may present to users when an app
99
- * asks for authorization to execute privileged methods (see
100
- * {@link PrivilegedMethods}).
101
- */
102
- type AppIdentity = Readonly<{
103
- uri?: string;
104
- icon?: string;
105
- name?: string;
106
- }>;
107
- /**
108
- * An ephemeral elliptic-curve keypair on the P-256 curve.
109
- * This public key is used to create the association token.
110
- * The private key is used during session establishment.
111
- */
112
- type AssociationKeypair = CryptoKeyPair;
113
- type ProtocolVersion = "v1" | "legacy";
114
- type SessionProperties = Readonly<{
115
- protocol_version: ProtocolVersion;
116
- }>;
117
- /**
118
- * The context returned from a wallet after having authorized a given
119
- * account for use with a given application. You can cache this and
120
- * use it later to invoke privileged methods.
121
- */
122
- type AuthorizationResult = Readonly<{
123
- accounts: Account[];
124
- auth_token: AuthToken;
125
- wallet_uri_base: string;
126
- sign_in_result?: SignInResult;
127
- }>;
128
- type AuthToken = string;
129
- type Base64EncodedAddress = string;
130
- type Base64EncodedSignature = string;
131
- type Base64EncodedMessage = string;
132
- type Base64EncodedSignedMessage = string;
133
- type Base64EncodedSignedTransaction = string;
134
- type Base64EncodedTransaction = string;
135
- /**
136
- * @deprecated Replaced by the 'chain' parameter, which adds multi-chain capability as per MWA 2.0 spec.
137
- */
138
- type Cluster = "devnet" | "testnet" | "mainnet-beta";
139
- type Chain = IdentifierString | Cluster;
140
- type Finality = "confirmed" | "finalized" | "processed";
141
- type WalletAssociationConfig = Readonly<{
142
- baseUri?: string;
143
- }>;
144
- type RemoteWalletAssociationConfig = WalletAssociationConfig & Readonly<{
145
- remoteHostAuthority: string;
146
- }>;
147
- interface AuthorizeAPI {
148
- /**
149
- * @deprecated Replaced by updated authorize() method, which adds MWA 2.0 spec support.
150
- */
151
- authorize(params: {
152
- cluster: Cluster;
153
- identity: AppIdentity;
154
- }): Promise<AuthorizationResult>;
155
- authorize(params: {
156
- identity: AppIdentity;
157
- chain?: Chain;
158
- features?: IdentifierArray;
159
- addresses?: string[];
160
- auth_token?: AuthToken;
161
- sign_in_payload?: SignInPayload;
162
- }): Promise<AuthorizationResult>;
163
- }
164
- interface CloneAuthorizationAPI {
165
- cloneAuthorization(params: {
166
- auth_token: AuthToken;
167
- }): Promise<Readonly<{
168
- auth_token: AuthToken;
169
- }>>;
170
- }
171
- interface DeauthorizeAPI {
172
- deauthorize(params: {
173
- auth_token: AuthToken;
174
- }): Promise<Readonly<Record<string, never>>>;
175
- }
176
- interface GetCapabilitiesAPI {
177
- getCapabilities(): Promise<Readonly<{
178
- max_transactions_per_request: number;
179
- max_messages_per_request: number;
180
- supported_transaction_versions: ReadonlyArray<TransactionVersion>;
181
- features: IdentifierArray;
182
- /**
183
- * @deprecated Replaced by features array.
184
- */
185
- supports_clone_authorization: boolean;
186
- /**
187
- * @deprecated Replaced by features array.
188
- */
189
- supports_sign_and_send_transactions: boolean;
190
- }>>;
191
- }
192
- interface ReauthorizeAPI {
193
- reauthorize(params: {
194
- auth_token: AuthToken;
195
- identity: AppIdentity;
196
- }): Promise<AuthorizationResult>;
197
- }
198
- interface SignMessagesAPI {
199
- signMessages(params: {
200
- addresses: Base64EncodedAddress[];
201
- payloads: Base64EncodedMessage[];
202
- }): Promise<Readonly<{
203
- signed_payloads: Base64EncodedSignedMessage[];
204
- }>>;
205
- }
206
- interface SignTransactionsAPI {
207
- signTransactions(params: {
208
- payloads: Base64EncodedTransaction[];
209
- }): Promise<Readonly<{
210
- signed_payloads: Base64EncodedSignedTransaction[];
211
- }>>;
212
- }
213
- interface SignAndSendTransactionsAPI {
214
- signAndSendTransactions(params: {
215
- options?: Readonly<{
216
- min_context_slot?: number;
217
- commitment?: string;
218
- skip_preflight?: boolean;
219
- max_retries?: number;
220
- wait_for_commitment_to_send_next_transaction?: boolean;
221
- }>;
222
- payloads: Base64EncodedTransaction[];
223
- }): Promise<Readonly<{
224
- signatures: Base64EncodedSignature[];
225
- }>>;
226
- }
227
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
228
- }
229
- interface TerminateSessionAPI {
230
- terminateSession(): void;
231
- }
232
- interface RemoteMobileWallet extends MobileWallet, TerminateSessionAPI {
233
- }
234
- // optional features
235
- declare const SolanaSignTransactions = "solana:signTransactions";
236
- declare const SolanaCloneAuthorization = "solana:cloneAuthorization";
237
- declare const SolanaSignInWithSolana = "solana:signInWithSolana";
238
- type SignInPayload = Readonly<{
239
- domain?: string;
240
- address?: string;
241
- statement?: string;
242
- uri?: string;
243
- version?: string;
244
- chainId?: string;
245
- nonce?: string;
246
- issuedAt?: string;
247
- expirationTime?: string;
248
- notBefore?: string;
249
- requestId?: string;
250
- resources?: readonly string[];
251
- }> | SolanaSignInInput;
252
- type SignInPayloadWithRequiredFields = Partial<SignInPayload> & Required<Pick<SignInPayload, "domain" | "address">>;
253
- type SignInResult = Readonly<{
254
- address: Base64EncodedAddress;
255
- signed_message: Base64EncodedSignedMessage;
256
- signature: Base64EncodedSignature;
257
- signature_type?: string;
258
- }>;
259
- type Scenario = Readonly<{
260
- wallet: Promise<MobileWallet>;
261
- close: () => void;
262
- }>;
263
- type RemoteScenario = Scenario & Readonly<{
264
- associationUrl: URL;
265
- }>;
266
- declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
267
- declare function startScenario(config?: WalletAssociationConfig): Promise<Scenario>;
268
- declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<RemoteScenario>;
269
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, startScenario, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
270
- //# sourceMappingURL=index.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/base64Utils.ts","../../src/createHelloReq.ts","../../src/types.ts","../../src/createSIWSMessage.ts","../../src/base58Utils.ts","../../src/createMobileWalletProxy.ts","../../src/createSequenceNumberVector.ts","../../src/parseHelloRsp.ts","../../src/encryptedMessage.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/arrayBufferToBase64String.ts","../../src/associationPort.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/jsonRpcMessage.ts","../../src/parseSessionProps.ts","../../src/startSession.ts","../../src/transact.ts","../../src/codegenSpec/NativeSolanaMobileWalletAdapter.ts","../../src/__forks__/react-native/transact.ts"],"names":[],"mappings":""}