@solana-mobile/mobile-wallet-adapter-protocol 0.9.5 → 0.9.7

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.
@@ -8,6 +8,7 @@ const SolanaMobileWalletAdapterErrorCode = {
8
8
  ERROR_FORBIDDEN_WALLET_BASE_URL: 'ERROR_FORBIDDEN_WALLET_BASE_URL',
9
9
  ERROR_SECURE_CONTEXT_REQUIRED: 'ERROR_SECURE_CONTEXT_REQUIRED',
10
10
  ERROR_SESSION_CLOSED: 'ERROR_SESSION_CLOSED',
11
+ ERROR_SESSION_TIMEOUT: 'ERROR_SESSION_TIMEOUT',
11
12
  ERROR_WALLET_NOT_FOUND: 'ERROR_WALLET_NOT_FOUND',
12
13
  };
13
14
  class SolanaMobileWalletAdapterError extends Error {
@@ -40,7 +41,7 @@ class SolanaMobileWalletAdapterProtocolError extends Error {
40
41
  }
41
42
  }
42
43
 
43
- /*! *****************************************************************************
44
+ /******************************************************************************
44
45
  Copyright (c) Microsoft Corporation.
45
46
 
46
47
  Permission to use, copy, modify, and/or distribute this software for any
@@ -398,7 +399,7 @@ function transact(callback, config) {
398
399
  const handleError = (_evt) => __awaiter(this, void 0, void 0, function* () {
399
400
  disposeSocket();
400
401
  if (Date.now() - connectionStartTime >= WEBSOCKET_CONNECTION_CONFIG.timeoutMs) {
401
- reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
402
+ reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
402
403
  }
403
404
  else {
404
405
  yield new Promise((resolve) => {
@@ -452,7 +453,7 @@ function transact(callback, config) {
452
453
  id,
453
454
  jsonrpc: '2.0',
454
455
  method,
455
- params,
456
+ params: params !== null && params !== void 0 ? params : {},
456
457
  }, sharedSecret));
457
458
  return new Promise((resolve, reject) => {
458
459
  jsonRpcResponsePromises[id] = {
package/lib/cjs/index.js CHANGED
@@ -8,6 +8,7 @@ const SolanaMobileWalletAdapterErrorCode = {
8
8
  ERROR_FORBIDDEN_WALLET_BASE_URL: 'ERROR_FORBIDDEN_WALLET_BASE_URL',
9
9
  ERROR_SECURE_CONTEXT_REQUIRED: 'ERROR_SECURE_CONTEXT_REQUIRED',
10
10
  ERROR_SESSION_CLOSED: 'ERROR_SESSION_CLOSED',
11
+ ERROR_SESSION_TIMEOUT: 'ERROR_SESSION_TIMEOUT',
11
12
  ERROR_WALLET_NOT_FOUND: 'ERROR_WALLET_NOT_FOUND',
12
13
  };
13
14
  class SolanaMobileWalletAdapterError extends Error {
@@ -40,7 +41,7 @@ class SolanaMobileWalletAdapterProtocolError extends Error {
40
41
  }
41
42
  }
42
43
 
43
- /*! *****************************************************************************
44
+ /******************************************************************************
44
45
  Copyright (c) Microsoft Corporation.
45
46
 
46
47
  Permission to use, copy, modify, and/or distribute this software for any
@@ -398,7 +399,7 @@ function transact(callback, config) {
398
399
  const handleError = (_evt) => __awaiter(this, void 0, void 0, function* () {
399
400
  disposeSocket();
400
401
  if (Date.now() - connectionStartTime >= WEBSOCKET_CONNECTION_CONFIG.timeoutMs) {
401
- reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
402
+ reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
402
403
  }
403
404
  else {
404
405
  yield new Promise((resolve) => {
@@ -452,7 +453,7 @@ function transact(callback, config) {
452
453
  id,
453
454
  jsonrpc: '2.0',
454
455
  method,
455
- params,
456
+ params: params !== null && params !== void 0 ? params : {},
456
457
  }, sharedSecret));
457
458
  return new Promise((resolve, reject) => {
458
459
  jsonRpcResponsePromises[id] = {
@@ -10,6 +10,7 @@ const SolanaMobileWalletAdapterErrorCode = {
10
10
  ERROR_FORBIDDEN_WALLET_BASE_URL: 'ERROR_FORBIDDEN_WALLET_BASE_URL',
11
11
  ERROR_SECURE_CONTEXT_REQUIRED: 'ERROR_SECURE_CONTEXT_REQUIRED',
12
12
  ERROR_SESSION_CLOSED: 'ERROR_SESSION_CLOSED',
13
+ ERROR_SESSION_TIMEOUT: 'ERROR_SESSION_TIMEOUT',
13
14
  ERROR_WALLET_NOT_FOUND: 'ERROR_WALLET_NOT_FOUND',
14
15
  };
15
16
  class SolanaMobileWalletAdapterError extends Error {
@@ -42,7 +43,7 @@ class SolanaMobileWalletAdapterProtocolError extends Error {
42
43
  }
43
44
  }
44
45
 
45
- /*! *****************************************************************************
46
+ /******************************************************************************
46
47
  Copyright (c) Microsoft Corporation.
47
48
 
48
49
  Permission to use, copy, modify, and/or distribute this software for any
@@ -4,6 +4,7 @@ const SolanaMobileWalletAdapterErrorCode = {
4
4
  ERROR_FORBIDDEN_WALLET_BASE_URL: 'ERROR_FORBIDDEN_WALLET_BASE_URL',
5
5
  ERROR_SECURE_CONTEXT_REQUIRED: 'ERROR_SECURE_CONTEXT_REQUIRED',
6
6
  ERROR_SESSION_CLOSED: 'ERROR_SESSION_CLOSED',
7
+ ERROR_SESSION_TIMEOUT: 'ERROR_SESSION_TIMEOUT',
7
8
  ERROR_WALLET_NOT_FOUND: 'ERROR_WALLET_NOT_FOUND',
8
9
  };
9
10
  class SolanaMobileWalletAdapterError extends Error {
@@ -36,7 +37,7 @@ class SolanaMobileWalletAdapterProtocolError extends Error {
36
37
  }
37
38
  }
38
39
 
39
- /*! *****************************************************************************
40
+ /******************************************************************************
40
41
  Copyright (c) Microsoft Corporation.
41
42
 
42
43
  Permission to use, copy, modify, and/or distribute this software for any
@@ -394,7 +395,7 @@ function transact(callback, config) {
394
395
  const handleError = (_evt) => __awaiter(this, void 0, void 0, function* () {
395
396
  disposeSocket();
396
397
  if (Date.now() - connectionStartTime >= WEBSOCKET_CONNECTION_CONFIG.timeoutMs) {
397
- reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
398
+ reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
398
399
  }
399
400
  else {
400
401
  yield new Promise((resolve) => {
@@ -448,7 +449,7 @@ function transact(callback, config) {
448
449
  id,
449
450
  jsonrpc: '2.0',
450
451
  method,
451
- params,
452
+ params: params !== null && params !== void 0 ? params : {},
452
453
  }, sharedSecret));
453
454
  return new Promise((resolve, reject) => {
454
455
  jsonRpcResponsePromises[id] = {
@@ -4,6 +4,7 @@ const SolanaMobileWalletAdapterErrorCode = {
4
4
  ERROR_FORBIDDEN_WALLET_BASE_URL: 'ERROR_FORBIDDEN_WALLET_BASE_URL',
5
5
  ERROR_SECURE_CONTEXT_REQUIRED: 'ERROR_SECURE_CONTEXT_REQUIRED',
6
6
  ERROR_SESSION_CLOSED: 'ERROR_SESSION_CLOSED',
7
+ ERROR_SESSION_TIMEOUT: 'ERROR_SESSION_TIMEOUT',
7
8
  ERROR_WALLET_NOT_FOUND: 'ERROR_WALLET_NOT_FOUND',
8
9
  };
9
10
  class SolanaMobileWalletAdapterError extends Error {
@@ -36,7 +37,7 @@ class SolanaMobileWalletAdapterProtocolError extends Error {
36
37
  }
37
38
  }
38
39
 
39
- /*! *****************************************************************************
40
+ /******************************************************************************
40
41
  Copyright (c) Microsoft Corporation.
41
42
 
42
43
  Permission to use, copy, modify, and/or distribute this software for any
@@ -394,7 +395,7 @@ function transact(callback, config) {
394
395
  const handleError = (_evt) => __awaiter(this, void 0, void 0, function* () {
395
396
  disposeSocket();
396
397
  if (Date.now() - connectionStartTime >= WEBSOCKET_CONNECTION_CONFIG.timeoutMs) {
397
- reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
398
+ reject(new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT, `Failed to connect to the wallet websocket on port ${sessionPort}.`));
398
399
  }
399
400
  else {
400
401
  yield new Promise((resolve) => {
@@ -448,7 +449,7 @@ function transact(callback, config) {
448
449
  id,
449
450
  jsonrpc: '2.0',
450
451
  method,
451
- params,
452
+ params: params !== null && params !== void 0 ? params : {},
452
453
  }, sharedSecret));
453
454
  return new Promise((resolve, reject) => {
454
455
  jsonRpcResponsePromises[id] = {
@@ -1,9 +1,11 @@
1
+ import { TransactionVersion } from "@solana/web3.js";
1
2
  // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
2
3
  declare const SolanaMobileWalletAdapterErrorCode: {
3
4
  readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
4
5
  readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
5
6
  readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
6
7
  readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
8
+ readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT";
7
9
  readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
8
10
  };
9
11
  type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
@@ -16,6 +18,7 @@ type ErrorDataTypeMap = {
16
18
  [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
17
19
  closeEvent: CloseEvent;
18
20
  };
21
+ [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined;
19
22
  [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
20
23
  };
21
24
  declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
@@ -128,6 +131,15 @@ interface DeauthorizeAPI {
128
131
  auth_token: AuthToken;
129
132
  }): Promise<Readonly<Record<string, never>>>;
130
133
  }
134
+ interface GetCapabilitiesAPI {
135
+ getCapabilities(): Promise<Readonly<{
136
+ supports_clone_authorization: boolean;
137
+ supports_sign_and_send_transactions: boolean;
138
+ max_transactions_per_request: boolean;
139
+ max_messages_per_request: boolean;
140
+ supported_transaction_versions: ReadonlyArray<TransactionVersion>;
141
+ }>>;
142
+ }
131
143
  interface ReauthorizeAPI {
132
144
  reauthorize(params: {
133
145
  auth_token: AuthToken;
@@ -158,8 +170,8 @@ interface SignAndSendTransactionsAPI {
158
170
  signatures: Base64EncodedSignature[];
159
171
  }>>;
160
172
  }
161
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
173
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
162
174
  }
163
175
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
164
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
176
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
165
177
  //# sourceMappingURL=index.browser.d.ts.map
@@ -1,9 +1,11 @@
1
+ import { TransactionVersion } from "@solana/web3.js";
1
2
  // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
2
3
  declare const SolanaMobileWalletAdapterErrorCode: {
3
4
  readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
4
5
  readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
5
6
  readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
6
7
  readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
8
+ readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT";
7
9
  readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
8
10
  };
9
11
  type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
@@ -16,6 +18,7 @@ type ErrorDataTypeMap = {
16
18
  [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
17
19
  closeEvent: CloseEvent;
18
20
  };
21
+ [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined;
19
22
  [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
20
23
  };
21
24
  declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
@@ -128,6 +131,15 @@ interface DeauthorizeAPI {
128
131
  auth_token: AuthToken;
129
132
  }): Promise<Readonly<Record<string, never>>>;
130
133
  }
134
+ interface GetCapabilitiesAPI {
135
+ getCapabilities(): Promise<Readonly<{
136
+ supports_clone_authorization: boolean;
137
+ supports_sign_and_send_transactions: boolean;
138
+ max_transactions_per_request: boolean;
139
+ max_messages_per_request: boolean;
140
+ supported_transaction_versions: ReadonlyArray<TransactionVersion>;
141
+ }>>;
142
+ }
131
143
  interface ReauthorizeAPI {
132
144
  reauthorize(params: {
133
145
  auth_token: AuthToken;
@@ -158,8 +170,8 @@ interface SignAndSendTransactionsAPI {
158
170
  signatures: Base64EncodedSignature[];
159
171
  }>>;
160
172
  }
161
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
173
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
162
174
  }
163
175
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
164
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
176
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
165
177
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,11 @@
1
+ import { TransactionVersion } from "@solana/web3.js";
1
2
  // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
2
3
  declare const SolanaMobileWalletAdapterErrorCode: {
3
4
  readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
4
5
  readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
5
6
  readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
6
7
  readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
8
+ readonly ERROR_SESSION_TIMEOUT: "ERROR_SESSION_TIMEOUT";
7
9
  readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
8
10
  };
9
11
  type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
@@ -16,6 +18,7 @@ type ErrorDataTypeMap = {
16
18
  [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
17
19
  closeEvent: CloseEvent;
18
20
  };
21
+ [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_TIMEOUT]: undefined;
19
22
  [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
20
23
  };
21
24
  declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
@@ -128,6 +131,15 @@ interface DeauthorizeAPI {
128
131
  auth_token: AuthToken;
129
132
  }): Promise<Readonly<Record<string, never>>>;
130
133
  }
134
+ interface GetCapabilitiesAPI {
135
+ getCapabilities(): Promise<Readonly<{
136
+ supports_clone_authorization: boolean;
137
+ supports_sign_and_send_transactions: boolean;
138
+ max_transactions_per_request: boolean;
139
+ max_messages_per_request: boolean;
140
+ supported_transaction_versions: ReadonlyArray<TransactionVersion>;
141
+ }>>;
142
+ }
131
143
  interface ReauthorizeAPI {
132
144
  reauthorize(params: {
133
145
  auth_token: AuthToken;
@@ -158,8 +170,8 @@ interface SignAndSendTransactionsAPI {
158
170
  signatures: Base64EncodedSignature[];
159
171
  }>>;
160
172
  }
161
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
173
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
162
174
  }
163
175
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
164
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
176
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
165
177
  //# sourceMappingURL=index.native.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solana-mobile/mobile-wallet-adapter-protocol",
3
3
  "description": "An implementation of the Solana Mobile Mobile Wallet Adapter protocol. Use this to open a session with a mobile wallet app, and to issue API calls to it.",
4
- "version": "0.9.5",
4
+ "version": "0.9.7",
5
5
  "author": "Steven Luscher <steven.luscher@solanamobile.com>",
6
6
  "repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
7
7
  "license": "Apache-2.0",
@@ -9,16 +9,16 @@
9
9
  "sideEffects": false,
10
10
  "main": "lib/cjs/index.js",
11
11
  "react-native": "lib/cjs/index.native.js",
12
- "module": "lib/esm/index.mjs",
12
+ "module": "lib/esm/index.js",
13
13
  "types": "lib/types/index.d.ts",
14
14
  "browser": {
15
15
  "./lib/cjs/index.js": "./lib/cjs/index.browser.js",
16
- "./lib/esm/index.mjs": "./lib/esm/index.browser.mjs"
16
+ "./lib/esm/index.js": "./lib/esm/index.browser.js"
17
17
  },
18
18
  "exports": {
19
19
  "./package.json": "./package.json",
20
20
  ".": {
21
- "import": "./lib/esm/index.mjs",
21
+ "import": "./lib/esm/index.js",
22
22
  "require": "./lib/cjs/index.js"
23
23
  }
24
24
  },
@@ -39,6 +39,7 @@
39
39
  "prepublishOnly": "agadoo"
40
40
  },
41
41
  "devDependencies": {
42
+ "@solana/web3.js": "^1.58.0",
42
43
  "@types/react-native": "^0.69.3",
43
44
  "agadoo": "^2.0.0",
44
45
  "cross-env": "^7.0.3"
@@ -46,5 +47,5 @@
46
47
  "peerDependencies": {
47
48
  "react-native": ">0.69"
48
49
  },
49
- "gitHead": "d3da860526efa336e0bd4c4d680f0f38b1d8f146"
50
+ "gitHead": "91473dbc1754c0161994a22c2895c43c36f9377d"
50
51
  }
@@ -1,165 +0,0 @@
1
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
2
- declare const SolanaMobileWalletAdapterErrorCode: {
3
- readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
4
- readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
5
- readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
6
- readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
7
- readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
8
- };
9
- type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
10
- type ErrorDataTypeMap = {
11
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE]: {
12
- port: number;
13
- };
14
- [SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL]: undefined;
15
- [SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED]: undefined;
16
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
17
- closeEvent: CloseEvent;
18
- };
19
- [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
20
- };
21
- declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
22
- data: ErrorDataTypeMap[TErrorCode] | undefined;
23
- code: TErrorCode;
24
- constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
25
- code: TErrorCode,
26
- message: string,
27
- data: ErrorDataTypeMap[TErrorCode]
28
- ] : [
29
- code: TErrorCode,
30
- message: string
31
- ]);
32
- }
33
- type JSONRPCErrorCode = number;
34
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
35
- declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
- readonly ERROR_AUTHORIZATION_FAILED: -1;
37
- readonly ERROR_INVALID_PAYLOADS: -2;
38
- readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_SUBMITTED: -4;
40
- readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
- readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
- };
43
- type SolanaMobileWalletAdapterProtocolErrorCodeEnum = (typeof SolanaMobileWalletAdapterProtocolErrorCode)[keyof typeof SolanaMobileWalletAdapterProtocolErrorCode];
44
- type ProtocolErrorDataTypeMap = {
45
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
- attest_origin_uri: string;
52
- challenge: string;
53
- context: string;
54
- };
55
- };
56
- declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMobileWalletAdapterProtocolErrorCodeEnum> extends Error {
57
- data: ProtocolErrorDataTypeMap[TErrorCode] | undefined;
58
- code: TErrorCode | JSONRPCErrorCode;
59
- jsonRpcMessageId: number;
60
- constructor(...args: ProtocolErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
61
- jsonRpcMessageId: number,
62
- code: TErrorCode | JSONRPCErrorCode,
63
- message: string,
64
- data: ProtocolErrorDataTypeMap[TErrorCode]
65
- ] : [
66
- jsonRpcMessageId: number,
67
- code: TErrorCode | JSONRPCErrorCode,
68
- message: string
69
- ]);
70
- }
71
- type Account = Readonly<{
72
- address: Base64EncodedAddress;
73
- label?: string;
74
- }>;
75
- /**
76
- * Properties that wallets may present to users when an app
77
- * asks for authorization to execute privileged methods (see
78
- * {@link PrivilegedMethods}).
79
- */
80
- type AppIdentity = Readonly<{
81
- uri?: string;
82
- icon?: string;
83
- name?: string;
84
- }>;
85
- /**
86
- * An ephemeral elliptic-curve keypair on the P-256 curve.
87
- * This public key is used to create the association token.
88
- * The private key is used during session establishment.
89
- */
90
- type AssociationKeypair = CryptoKeyPair;
91
- /**
92
- * The context returned from a wallet after having authorized a given
93
- * account for use with a given application. You can cache this and
94
- * use it later to invoke privileged methods.
95
- */
96
- type AuthorizationResult = Readonly<{
97
- accounts: Account[];
98
- auth_token: AuthToken;
99
- wallet_uri_base: string;
100
- }>;
101
- type AuthToken = string;
102
- type Base64EncodedAddress = string;
103
- type Base64EncodedSignature = string;
104
- type Base64EncodedMessage = string;
105
- type Base64EncodedSignedMessage = string;
106
- type Base64EncodedSignedTransaction = string;
107
- type Base64EncodedTransaction = string;
108
- type Cluster = "devnet" | "testnet" | "mainnet-beta";
109
- type Finality = "confirmed" | "finalized" | "processed";
110
- type WalletAssociationConfig = Readonly<{
111
- baseUri?: string;
112
- }>;
113
- interface AuthorizeAPI {
114
- authorize(params: {
115
- cluster: Cluster;
116
- identity: AppIdentity;
117
- }): Promise<AuthorizationResult>;
118
- }
119
- interface CloneAuthorizationAPI {
120
- cloneAuthorization(params: {
121
- auth_token: AuthToken;
122
- }): Promise<Readonly<{
123
- auth_token: AuthToken;
124
- }>>;
125
- }
126
- interface DeauthorizeAPI {
127
- deauthorize(params: {
128
- auth_token: AuthToken;
129
- }): Promise<Readonly<Record<string, never>>>;
130
- }
131
- interface ReauthorizeAPI {
132
- reauthorize(params: {
133
- auth_token: AuthToken;
134
- }): Promise<AuthorizationResult>;
135
- }
136
- interface SignMessagesAPI {
137
- signMessages(params: {
138
- addresses: Base64EncodedAddress[];
139
- payloads: Base64EncodedMessage[];
140
- }): Promise<Readonly<{
141
- signed_payloads: Base64EncodedSignedMessage[];
142
- }>>;
143
- }
144
- interface SignTransactionsAPI {
145
- signTransactions(params: {
146
- payloads: Base64EncodedTransaction[];
147
- }): Promise<Readonly<{
148
- signed_payloads: Base64EncodedSignedTransaction[];
149
- }>>;
150
- }
151
- interface SignAndSendTransactionsAPI {
152
- signAndSendTransactions(params: {
153
- options?: Readonly<{
154
- min_context_slot?: number;
155
- }>;
156
- payloads: Base64EncodedTransaction[];
157
- }): Promise<Readonly<{
158
- signatures: Base64EncodedSignature[];
159
- }>>;
160
- }
161
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
162
- }
163
- declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
164
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
165
- //# sourceMappingURL=index.browser.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.browser.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/createHelloReq.ts","../../src/createSequenceNumberVector.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/parseHelloRsp.ts","../../src/jsonRpcMessage.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/types.ts","../../src/transact.ts"],"names":[],"mappings":""}
@@ -1,165 +0,0 @@
1
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
2
- declare const SolanaMobileWalletAdapterErrorCode: {
3
- readonly ERROR_ASSOCIATION_PORT_OUT_OF_RANGE: "ERROR_ASSOCIATION_PORT_OUT_OF_RANGE";
4
- readonly ERROR_FORBIDDEN_WALLET_BASE_URL: "ERROR_FORBIDDEN_WALLET_BASE_URL";
5
- readonly ERROR_SECURE_CONTEXT_REQUIRED: "ERROR_SECURE_CONTEXT_REQUIRED";
6
- readonly ERROR_SESSION_CLOSED: "ERROR_SESSION_CLOSED";
7
- readonly ERROR_WALLET_NOT_FOUND: "ERROR_WALLET_NOT_FOUND";
8
- };
9
- type SolanaMobileWalletAdapterErrorCodeEnum = (typeof SolanaMobileWalletAdapterErrorCode)[keyof typeof SolanaMobileWalletAdapterErrorCode];
10
- type ErrorDataTypeMap = {
11
- [SolanaMobileWalletAdapterErrorCode.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE]: {
12
- port: number;
13
- };
14
- [SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL]: undefined;
15
- [SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED]: undefined;
16
- [SolanaMobileWalletAdapterErrorCode.ERROR_SESSION_CLOSED]: {
17
- closeEvent: CloseEvent;
18
- };
19
- [SolanaMobileWalletAdapterErrorCode.ERROR_WALLET_NOT_FOUND]: undefined;
20
- };
21
- declare class SolanaMobileWalletAdapterError<TErrorCode extends SolanaMobileWalletAdapterErrorCodeEnum> extends Error {
22
- data: ErrorDataTypeMap[TErrorCode] | undefined;
23
- code: TErrorCode;
24
- constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
25
- code: TErrorCode,
26
- message: string,
27
- data: ErrorDataTypeMap[TErrorCode]
28
- ] : [
29
- code: TErrorCode,
30
- message: string
31
- ]);
32
- }
33
- type JSONRPCErrorCode = number;
34
- // Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
35
- declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
- readonly ERROR_AUTHORIZATION_FAILED: -1;
37
- readonly ERROR_INVALID_PAYLOADS: -2;
38
- readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_SUBMITTED: -4;
40
- readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
- readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
- };
43
- type SolanaMobileWalletAdapterProtocolErrorCodeEnum = (typeof SolanaMobileWalletAdapterProtocolErrorCode)[keyof typeof SolanaMobileWalletAdapterProtocolErrorCode];
44
- type ProtocolErrorDataTypeMap = {
45
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
- attest_origin_uri: string;
52
- challenge: string;
53
- context: string;
54
- };
55
- };
56
- declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMobileWalletAdapterProtocolErrorCodeEnum> extends Error {
57
- data: ProtocolErrorDataTypeMap[TErrorCode] | undefined;
58
- code: TErrorCode | JSONRPCErrorCode;
59
- jsonRpcMessageId: number;
60
- constructor(...args: ProtocolErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
61
- jsonRpcMessageId: number,
62
- code: TErrorCode | JSONRPCErrorCode,
63
- message: string,
64
- data: ProtocolErrorDataTypeMap[TErrorCode]
65
- ] : [
66
- jsonRpcMessageId: number,
67
- code: TErrorCode | JSONRPCErrorCode,
68
- message: string
69
- ]);
70
- }
71
- type Account = Readonly<{
72
- address: Base64EncodedAddress;
73
- label?: string;
74
- }>;
75
- /**
76
- * Properties that wallets may present to users when an app
77
- * asks for authorization to execute privileged methods (see
78
- * {@link PrivilegedMethods}).
79
- */
80
- type AppIdentity = Readonly<{
81
- uri?: string;
82
- icon?: string;
83
- name?: string;
84
- }>;
85
- /**
86
- * An ephemeral elliptic-curve keypair on the P-256 curve.
87
- * This public key is used to create the association token.
88
- * The private key is used during session establishment.
89
- */
90
- type AssociationKeypair = CryptoKeyPair;
91
- /**
92
- * The context returned from a wallet after having authorized a given
93
- * account for use with a given application. You can cache this and
94
- * use it later to invoke privileged methods.
95
- */
96
- type AuthorizationResult = Readonly<{
97
- accounts: Account[];
98
- auth_token: AuthToken;
99
- wallet_uri_base: string;
100
- }>;
101
- type AuthToken = string;
102
- type Base64EncodedAddress = string;
103
- type Base64EncodedSignature = string;
104
- type Base64EncodedMessage = string;
105
- type Base64EncodedSignedMessage = string;
106
- type Base64EncodedSignedTransaction = string;
107
- type Base64EncodedTransaction = string;
108
- type Cluster = "devnet" | "testnet" | "mainnet-beta";
109
- type Finality = "confirmed" | "finalized" | "processed";
110
- type WalletAssociationConfig = Readonly<{
111
- baseUri?: string;
112
- }>;
113
- interface AuthorizeAPI {
114
- authorize(params: {
115
- cluster: Cluster;
116
- identity: AppIdentity;
117
- }): Promise<AuthorizationResult>;
118
- }
119
- interface CloneAuthorizationAPI {
120
- cloneAuthorization(params: {
121
- auth_token: AuthToken;
122
- }): Promise<Readonly<{
123
- auth_token: AuthToken;
124
- }>>;
125
- }
126
- interface DeauthorizeAPI {
127
- deauthorize(params: {
128
- auth_token: AuthToken;
129
- }): Promise<Readonly<Record<string, never>>>;
130
- }
131
- interface ReauthorizeAPI {
132
- reauthorize(params: {
133
- auth_token: AuthToken;
134
- }): Promise<AuthorizationResult>;
135
- }
136
- interface SignMessagesAPI {
137
- signMessages(params: {
138
- addresses: Base64EncodedAddress[];
139
- payloads: Base64EncodedMessage[];
140
- }): Promise<Readonly<{
141
- signed_payloads: Base64EncodedSignedMessage[];
142
- }>>;
143
- }
144
- interface SignTransactionsAPI {
145
- signTransactions(params: {
146
- payloads: Base64EncodedTransaction[];
147
- }): Promise<Readonly<{
148
- signed_payloads: Base64EncodedSignedTransaction[];
149
- }>>;
150
- }
151
- interface SignAndSendTransactionsAPI {
152
- signAndSendTransactions(params: {
153
- options?: Readonly<{
154
- min_context_slot?: number;
155
- }>;
156
- payloads: Base64EncodedTransaction[];
157
- }): Promise<Readonly<{
158
- signatures: Base64EncodedSignature[];
159
- }>>;
160
- }
161
- interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
162
- }
163
- declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
164
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
165
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/errors.ts","../../src/createHelloReq.ts","../../src/createSequenceNumberVector.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/parseHelloRsp.ts","../../src/jsonRpcMessage.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/types.ts","../../src/transact.ts"],"names":[],"mappings":""}