@solana-mobile/mobile-wallet-adapter-protocol 0.0.1-alpha.8 → 0.9.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.
@@ -25,7 +25,7 @@ const SolanaMobileWalletAdapterProtocolErrorCode = {
25
25
  ERROR_AUTHORIZATION_FAILED: -1,
26
26
  ERROR_INVALID_PAYLOADS: -2,
27
27
  ERROR_NOT_SIGNED: -3,
28
- ERROR_NOT_COMMITTED: -4,
28
+ ERROR_NOT_SUBMITTED: -4,
29
29
  ERROR_TOO_MANY_PAYLOADS: -5,
30
30
  ERROR_ATTEST_ORIGIN_ANDROID: -100,
31
31
  };
@@ -336,6 +336,18 @@ function assertSecureContext() {
336
336
  throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED, 'The mobile wallet adapter protocol must be used in a secure context (`https`).');
337
337
  }
338
338
  }
339
+ function assertSecureEndpointSpecificURI(walletUriBase) {
340
+ let url;
341
+ try {
342
+ url = new URL(walletUriBase);
343
+ }
344
+ catch (_a) {
345
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Invalid base URL supplied by wallet');
346
+ }
347
+ if (url.protocol !== 'https:') {
348
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Base URLs supplied by wallets must be valid `https` URLs');
349
+ }
350
+ }
339
351
  function getSequenceNumberFromByteArray(byteArray) {
340
352
  const view = new DataView(byteArray);
341
353
  return view.getUint32(0, /* littleEndian */ false);
@@ -443,7 +455,28 @@ function transact(callback, config) {
443
455
  params,
444
456
  }, sharedSecret));
445
457
  return new Promise((resolve, reject) => {
446
- jsonRpcResponsePromises[id] = { resolve, reject };
458
+ jsonRpcResponsePromises[id] = {
459
+ resolve(result) {
460
+ switch (p) {
461
+ case 'authorize':
462
+ case 'reauthorize': {
463
+ const { wallet_uri_base } = result;
464
+ if (wallet_uri_base != null) {
465
+ try {
466
+ assertSecureEndpointSpecificURI(wallet_uri_base);
467
+ }
468
+ catch (e) {
469
+ reject(e);
470
+ return;
471
+ }
472
+ }
473
+ break;
474
+ }
475
+ }
476
+ resolve(result);
477
+ },
478
+ reject,
479
+ };
447
480
  });
448
481
  });
449
482
  };
package/lib/cjs/index.js CHANGED
@@ -25,7 +25,7 @@ const SolanaMobileWalletAdapterProtocolErrorCode = {
25
25
  ERROR_AUTHORIZATION_FAILED: -1,
26
26
  ERROR_INVALID_PAYLOADS: -2,
27
27
  ERROR_NOT_SIGNED: -3,
28
- ERROR_NOT_COMMITTED: -4,
28
+ ERROR_NOT_SUBMITTED: -4,
29
29
  ERROR_TOO_MANY_PAYLOADS: -5,
30
30
  ERROR_ATTEST_ORIGIN_ANDROID: -100,
31
31
  };
@@ -336,6 +336,18 @@ function assertSecureContext() {
336
336
  throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED, 'The mobile wallet adapter protocol must be used in a secure context (`https`).');
337
337
  }
338
338
  }
339
+ function assertSecureEndpointSpecificURI(walletUriBase) {
340
+ let url;
341
+ try {
342
+ url = new URL(walletUriBase);
343
+ }
344
+ catch (_a) {
345
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Invalid base URL supplied by wallet');
346
+ }
347
+ if (url.protocol !== 'https:') {
348
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Base URLs supplied by wallets must be valid `https` URLs');
349
+ }
350
+ }
339
351
  function getSequenceNumberFromByteArray(byteArray) {
340
352
  const view = new DataView(byteArray);
341
353
  return view.getUint32(0, /* littleEndian */ false);
@@ -443,7 +455,28 @@ function transact(callback, config) {
443
455
  params,
444
456
  }, sharedSecret));
445
457
  return new Promise((resolve, reject) => {
446
- jsonRpcResponsePromises[id] = { resolve, reject };
458
+ jsonRpcResponsePromises[id] = {
459
+ resolve(result) {
460
+ switch (p) {
461
+ case 'authorize':
462
+ case 'reauthorize': {
463
+ const { wallet_uri_base } = result;
464
+ if (wallet_uri_base != null) {
465
+ try {
466
+ assertSecureEndpointSpecificURI(wallet_uri_base);
467
+ }
468
+ catch (e) {
469
+ reject(e);
470
+ return;
471
+ }
472
+ }
473
+ break;
474
+ }
475
+ }
476
+ resolve(result);
477
+ },
478
+ reject,
479
+ };
447
480
  });
448
481
  });
449
482
  };
@@ -27,7 +27,7 @@ const SolanaMobileWalletAdapterProtocolErrorCode = {
27
27
  ERROR_AUTHORIZATION_FAILED: -1,
28
28
  ERROR_INVALID_PAYLOADS: -2,
29
29
  ERROR_NOT_SIGNED: -3,
30
- ERROR_NOT_COMMITTED: -4,
30
+ ERROR_NOT_SUBMITTED: -4,
31
31
  ERROR_TOO_MANY_PAYLOADS: -5,
32
32
  ERROR_ATTEST_ORIGIN_ANDROID: -100,
33
33
  };
@@ -21,7 +21,7 @@ const SolanaMobileWalletAdapterProtocolErrorCode = {
21
21
  ERROR_AUTHORIZATION_FAILED: -1,
22
22
  ERROR_INVALID_PAYLOADS: -2,
23
23
  ERROR_NOT_SIGNED: -3,
24
- ERROR_NOT_COMMITTED: -4,
24
+ ERROR_NOT_SUBMITTED: -4,
25
25
  ERROR_TOO_MANY_PAYLOADS: -5,
26
26
  ERROR_ATTEST_ORIGIN_ANDROID: -100,
27
27
  };
@@ -332,6 +332,18 @@ function assertSecureContext() {
332
332
  throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED, 'The mobile wallet adapter protocol must be used in a secure context (`https`).');
333
333
  }
334
334
  }
335
+ function assertSecureEndpointSpecificURI(walletUriBase) {
336
+ let url;
337
+ try {
338
+ url = new URL(walletUriBase);
339
+ }
340
+ catch (_a) {
341
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Invalid base URL supplied by wallet');
342
+ }
343
+ if (url.protocol !== 'https:') {
344
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Base URLs supplied by wallets must be valid `https` URLs');
345
+ }
346
+ }
335
347
  function getSequenceNumberFromByteArray(byteArray) {
336
348
  const view = new DataView(byteArray);
337
349
  return view.getUint32(0, /* littleEndian */ false);
@@ -439,7 +451,28 @@ function transact(callback, config) {
439
451
  params,
440
452
  }, sharedSecret));
441
453
  return new Promise((resolve, reject) => {
442
- jsonRpcResponsePromises[id] = { resolve, reject };
454
+ jsonRpcResponsePromises[id] = {
455
+ resolve(result) {
456
+ switch (p) {
457
+ case 'authorize':
458
+ case 'reauthorize': {
459
+ const { wallet_uri_base } = result;
460
+ if (wallet_uri_base != null) {
461
+ try {
462
+ assertSecureEndpointSpecificURI(wallet_uri_base);
463
+ }
464
+ catch (e) {
465
+ reject(e);
466
+ return;
467
+ }
468
+ }
469
+ break;
470
+ }
471
+ }
472
+ resolve(result);
473
+ },
474
+ reject,
475
+ };
443
476
  });
444
477
  });
445
478
  };
package/lib/esm/index.mjs CHANGED
@@ -21,7 +21,7 @@ const SolanaMobileWalletAdapterProtocolErrorCode = {
21
21
  ERROR_AUTHORIZATION_FAILED: -1,
22
22
  ERROR_INVALID_PAYLOADS: -2,
23
23
  ERROR_NOT_SIGNED: -3,
24
- ERROR_NOT_COMMITTED: -4,
24
+ ERROR_NOT_SUBMITTED: -4,
25
25
  ERROR_TOO_MANY_PAYLOADS: -5,
26
26
  ERROR_ATTEST_ORIGIN_ANDROID: -100,
27
27
  };
@@ -332,6 +332,18 @@ function assertSecureContext() {
332
332
  throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_SECURE_CONTEXT_REQUIRED, 'The mobile wallet adapter protocol must be used in a secure context (`https`).');
333
333
  }
334
334
  }
335
+ function assertSecureEndpointSpecificURI(walletUriBase) {
336
+ let url;
337
+ try {
338
+ url = new URL(walletUriBase);
339
+ }
340
+ catch (_a) {
341
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Invalid base URL supplied by wallet');
342
+ }
343
+ if (url.protocol !== 'https:') {
344
+ throw new SolanaMobileWalletAdapterError(SolanaMobileWalletAdapterErrorCode.ERROR_FORBIDDEN_WALLET_BASE_URL, 'Base URLs supplied by wallets must be valid `https` URLs');
345
+ }
346
+ }
335
347
  function getSequenceNumberFromByteArray(byteArray) {
336
348
  const view = new DataView(byteArray);
337
349
  return view.getUint32(0, /* littleEndian */ false);
@@ -439,7 +451,28 @@ function transact(callback, config) {
439
451
  params,
440
452
  }, sharedSecret));
441
453
  return new Promise((resolve, reject) => {
442
- jsonRpcResponsePromises[id] = { resolve, reject };
454
+ jsonRpcResponsePromises[id] = {
455
+ resolve(result) {
456
+ switch (p) {
457
+ case 'authorize':
458
+ case 'reauthorize': {
459
+ const { wallet_uri_base } = result;
460
+ if (wallet_uri_base != null) {
461
+ try {
462
+ assertSecureEndpointSpecificURI(wallet_uri_base);
463
+ }
464
+ catch (e) {
465
+ reject(e);
466
+ return;
467
+ }
468
+ }
469
+ break;
470
+ }
471
+ }
472
+ resolve(result);
473
+ },
474
+ reject,
475
+ };
443
476
  });
444
477
  });
445
478
  };
@@ -36,7 +36,7 @@ declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
36
  readonly ERROR_AUTHORIZATION_FAILED: -1;
37
37
  readonly ERROR_INVALID_PAYLOADS: -2;
38
38
  readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_COMMITTED: -4;
39
+ readonly ERROR_NOT_SUBMITTED: -4;
40
40
  readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
41
  readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
42
  };
@@ -45,7 +45,7 @@ type ProtocolErrorDataTypeMap = {
45
45
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
46
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
47
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_COMMITTED]: undefined;
48
+ [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
49
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
50
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
51
  attest_origin_uri: string;
@@ -68,6 +68,10 @@ declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMo
68
68
  message: string
69
69
  ]);
70
70
  }
71
+ type Account = Readonly<{
72
+ address: Base64EncodedAddress;
73
+ label?: string;
74
+ }>;
71
75
  /**
72
76
  * Properties that wallets may present to users when an app
73
77
  * asks for authorization to execute privileged methods (see
@@ -90,7 +94,7 @@ type AssociationKeypair = CryptoKeyPair;
90
94
  * use it later to invoke privileged methods.
91
95
  */
92
96
  type AuthorizationResult = Readonly<{
93
- addresses: Base64EncodedAddress[];
97
+ accounts: Account[];
94
98
  auth_token: AuthToken;
95
99
  wallet_uri_base: string;
96
100
  }>;
@@ -131,6 +135,7 @@ interface ReauthorizeAPI {
131
135
  }
132
136
  interface SignMessagesAPI {
133
137
  signMessages(params: {
138
+ addresses: Base64EncodedAddress[];
134
139
  payloads: Base64EncodedMessage[];
135
140
  }): Promise<Readonly<{
136
141
  signed_payloads: Base64EncodedSignedMessage[];
@@ -145,9 +150,10 @@ interface SignTransactionsAPI {
145
150
  }
146
151
  interface SignAndSendTransactionsAPI {
147
152
  signAndSendTransactions(params: {
148
- commitment: Finality;
153
+ options?: Readonly<{
154
+ min_context_slot?: number;
155
+ }>;
149
156
  payloads: Base64EncodedTransaction[];
150
- preflight_commitment: Finality;
151
157
  }): Promise<Readonly<{
152
158
  signatures: Base64EncodedSignature[];
153
159
  }>>;
@@ -155,5 +161,5 @@ interface SignAndSendTransactionsAPI {
155
161
  interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
156
162
  }
157
163
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
158
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
164
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
159
165
  //# sourceMappingURL=index.browser.d.mts.map
@@ -36,7 +36,7 @@ declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
36
  readonly ERROR_AUTHORIZATION_FAILED: -1;
37
37
  readonly ERROR_INVALID_PAYLOADS: -2;
38
38
  readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_COMMITTED: -4;
39
+ readonly ERROR_NOT_SUBMITTED: -4;
40
40
  readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
41
  readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
42
  };
@@ -45,7 +45,7 @@ type ProtocolErrorDataTypeMap = {
45
45
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
46
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
47
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_COMMITTED]: undefined;
48
+ [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
49
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
50
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
51
  attest_origin_uri: string;
@@ -68,6 +68,10 @@ declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMo
68
68
  message: string
69
69
  ]);
70
70
  }
71
+ type Account = Readonly<{
72
+ address: Base64EncodedAddress;
73
+ label?: string;
74
+ }>;
71
75
  /**
72
76
  * Properties that wallets may present to users when an app
73
77
  * asks for authorization to execute privileged methods (see
@@ -90,7 +94,7 @@ type AssociationKeypair = CryptoKeyPair;
90
94
  * use it later to invoke privileged methods.
91
95
  */
92
96
  type AuthorizationResult = Readonly<{
93
- addresses: Base64EncodedAddress[];
97
+ accounts: Account[];
94
98
  auth_token: AuthToken;
95
99
  wallet_uri_base: string;
96
100
  }>;
@@ -131,6 +135,7 @@ interface ReauthorizeAPI {
131
135
  }
132
136
  interface SignMessagesAPI {
133
137
  signMessages(params: {
138
+ addresses: Base64EncodedAddress[];
134
139
  payloads: Base64EncodedMessage[];
135
140
  }): Promise<Readonly<{
136
141
  signed_payloads: Base64EncodedSignedMessage[];
@@ -145,9 +150,10 @@ interface SignTransactionsAPI {
145
150
  }
146
151
  interface SignAndSendTransactionsAPI {
147
152
  signAndSendTransactions(params: {
148
- commitment: Finality;
153
+ options?: Readonly<{
154
+ min_context_slot?: number;
155
+ }>;
149
156
  payloads: Base64EncodedTransaction[];
150
- preflight_commitment: Finality;
151
157
  }): Promise<Readonly<{
152
158
  signatures: Base64EncodedSignature[];
153
159
  }>>;
@@ -155,5 +161,5 @@ interface SignAndSendTransactionsAPI {
155
161
  interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
156
162
  }
157
163
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
158
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
164
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
159
165
  //# sourceMappingURL=index.browser.d.ts.map
@@ -36,7 +36,7 @@ declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
36
  readonly ERROR_AUTHORIZATION_FAILED: -1;
37
37
  readonly ERROR_INVALID_PAYLOADS: -2;
38
38
  readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_COMMITTED: -4;
39
+ readonly ERROR_NOT_SUBMITTED: -4;
40
40
  readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
41
  readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
42
  };
@@ -45,7 +45,7 @@ type ProtocolErrorDataTypeMap = {
45
45
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
46
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
47
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_COMMITTED]: undefined;
48
+ [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
49
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
50
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
51
  attest_origin_uri: string;
@@ -68,6 +68,10 @@ declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMo
68
68
  message: string
69
69
  ]);
70
70
  }
71
+ type Account = Readonly<{
72
+ address: Base64EncodedAddress;
73
+ label?: string;
74
+ }>;
71
75
  /**
72
76
  * Properties that wallets may present to users when an app
73
77
  * asks for authorization to execute privileged methods (see
@@ -90,7 +94,7 @@ type AssociationKeypair = CryptoKeyPair;
90
94
  * use it later to invoke privileged methods.
91
95
  */
92
96
  type AuthorizationResult = Readonly<{
93
- addresses: Base64EncodedAddress[];
97
+ accounts: Account[];
94
98
  auth_token: AuthToken;
95
99
  wallet_uri_base: string;
96
100
  }>;
@@ -131,6 +135,7 @@ interface ReauthorizeAPI {
131
135
  }
132
136
  interface SignMessagesAPI {
133
137
  signMessages(params: {
138
+ addresses: Base64EncodedAddress[];
134
139
  payloads: Base64EncodedMessage[];
135
140
  }): Promise<Readonly<{
136
141
  signed_payloads: Base64EncodedSignedMessage[];
@@ -145,9 +150,10 @@ interface SignTransactionsAPI {
145
150
  }
146
151
  interface SignAndSendTransactionsAPI {
147
152
  signAndSendTransactions(params: {
148
- commitment: Finality;
153
+ options?: Readonly<{
154
+ min_context_slot?: number;
155
+ }>;
149
156
  payloads: Base64EncodedTransaction[];
150
- preflight_commitment: Finality;
151
157
  }): Promise<Readonly<{
152
158
  signatures: Base64EncodedSignature[];
153
159
  }>>;
@@ -155,5 +161,5 @@ interface SignAndSendTransactionsAPI {
155
161
  interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
156
162
  }
157
163
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
158
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
164
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
159
165
  //# sourceMappingURL=index.d.mts.map
@@ -36,7 +36,7 @@ declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
36
  readonly ERROR_AUTHORIZATION_FAILED: -1;
37
37
  readonly ERROR_INVALID_PAYLOADS: -2;
38
38
  readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_COMMITTED: -4;
39
+ readonly ERROR_NOT_SUBMITTED: -4;
40
40
  readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
41
  readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
42
  };
@@ -45,7 +45,7 @@ type ProtocolErrorDataTypeMap = {
45
45
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
46
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
47
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_COMMITTED]: undefined;
48
+ [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
49
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
50
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
51
  attest_origin_uri: string;
@@ -68,6 +68,10 @@ declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMo
68
68
  message: string
69
69
  ]);
70
70
  }
71
+ type Account = Readonly<{
72
+ address: Base64EncodedAddress;
73
+ label?: string;
74
+ }>;
71
75
  /**
72
76
  * Properties that wallets may present to users when an app
73
77
  * asks for authorization to execute privileged methods (see
@@ -90,7 +94,7 @@ type AssociationKeypair = CryptoKeyPair;
90
94
  * use it later to invoke privileged methods.
91
95
  */
92
96
  type AuthorizationResult = Readonly<{
93
- addresses: Base64EncodedAddress[];
97
+ accounts: Account[];
94
98
  auth_token: AuthToken;
95
99
  wallet_uri_base: string;
96
100
  }>;
@@ -131,6 +135,7 @@ interface ReauthorizeAPI {
131
135
  }
132
136
  interface SignMessagesAPI {
133
137
  signMessages(params: {
138
+ addresses: Base64EncodedAddress[];
134
139
  payloads: Base64EncodedMessage[];
135
140
  }): Promise<Readonly<{
136
141
  signed_payloads: Base64EncodedSignedMessage[];
@@ -145,9 +150,10 @@ interface SignTransactionsAPI {
145
150
  }
146
151
  interface SignAndSendTransactionsAPI {
147
152
  signAndSendTransactions(params: {
148
- commitment: Finality;
153
+ options?: Readonly<{
154
+ min_context_slot?: number;
155
+ }>;
149
156
  payloads: Base64EncodedTransaction[];
150
- preflight_commitment: Finality;
151
157
  }): Promise<Readonly<{
152
158
  signatures: Base64EncodedSignature[];
153
159
  }>>;
@@ -155,5 +161,5 @@ interface SignAndSendTransactionsAPI {
155
161
  interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
156
162
  }
157
163
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
158
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
164
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
159
165
  //# sourceMappingURL=index.d.ts.map
@@ -36,7 +36,7 @@ declare const SolanaMobileWalletAdapterProtocolErrorCode: {
36
36
  readonly ERROR_AUTHORIZATION_FAILED: -1;
37
37
  readonly ERROR_INVALID_PAYLOADS: -2;
38
38
  readonly ERROR_NOT_SIGNED: -3;
39
- readonly ERROR_NOT_COMMITTED: -4;
39
+ readonly ERROR_NOT_SUBMITTED: -4;
40
40
  readonly ERROR_TOO_MANY_PAYLOADS: -5;
41
41
  readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
42
42
  };
@@ -45,7 +45,7 @@ type ProtocolErrorDataTypeMap = {
45
45
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_AUTHORIZATION_FAILED]: undefined;
46
46
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_INVALID_PAYLOADS]: undefined;
47
47
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SIGNED]: undefined;
48
- [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_COMMITTED]: undefined;
48
+ [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_NOT_SUBMITTED]: undefined;
49
49
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_TOO_MANY_PAYLOADS]: undefined;
50
50
  [SolanaMobileWalletAdapterProtocolErrorCode.ERROR_ATTEST_ORIGIN_ANDROID]: {
51
51
  attest_origin_uri: string;
@@ -68,6 +68,10 @@ declare class SolanaMobileWalletAdapterProtocolError<TErrorCode extends SolanaMo
68
68
  message: string
69
69
  ]);
70
70
  }
71
+ type Account = Readonly<{
72
+ address: Base64EncodedAddress;
73
+ label?: string;
74
+ }>;
71
75
  /**
72
76
  * Properties that wallets may present to users when an app
73
77
  * asks for authorization to execute privileged methods (see
@@ -90,7 +94,7 @@ type AssociationKeypair = CryptoKeyPair;
90
94
  * use it later to invoke privileged methods.
91
95
  */
92
96
  type AuthorizationResult = Readonly<{
93
- addresses: Base64EncodedAddress[];
97
+ accounts: Account[];
94
98
  auth_token: AuthToken;
95
99
  wallet_uri_base: string;
96
100
  }>;
@@ -131,6 +135,7 @@ interface ReauthorizeAPI {
131
135
  }
132
136
  interface SignMessagesAPI {
133
137
  signMessages(params: {
138
+ addresses: Base64EncodedAddress[];
134
139
  payloads: Base64EncodedMessage[];
135
140
  }): Promise<Readonly<{
136
141
  signed_payloads: Base64EncodedSignedMessage[];
@@ -145,9 +150,10 @@ interface SignTransactionsAPI {
145
150
  }
146
151
  interface SignAndSendTransactionsAPI {
147
152
  signAndSendTransactions(params: {
148
- commitment: Finality;
153
+ options?: Readonly<{
154
+ min_context_slot?: number;
155
+ }>;
149
156
  payloads: Base64EncodedTransaction[];
150
- preflight_commitment: Finality;
151
157
  }): Promise<Readonly<{
152
158
  signatures: Base64EncodedSignature[];
153
159
  }>>;
@@ -155,5 +161,5 @@ interface SignAndSendTransactionsAPI {
155
161
  interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI {
156
162
  }
157
163
  declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
158
- export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
164
+ export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, Account, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, Base64EncodedAddress, Cluster, Finality, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet };
159
165
  //# 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.0.1-alpha.8",
4
+ "version": "0.9.0",
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",
@@ -35,7 +35,7 @@
35
35
  "clean": "shx rm -rf lib/*",
36
36
  "build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
37
37
  "build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
38
- "postbuild": "echo '{\"type\":\"commonjs\"}' | npx json > lib/cjs/package.json && echo '{\"type\":\"module\"} ' | npx json > lib/esm/package.json",
38
+ "postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json",
39
39
  "prepublishOnly": "agadoo"
40
40
  },
41
41
  "dependencies": {
@@ -43,7 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react-native": "^0.69.3",
46
- "agadoo": "^2.0.0"
46
+ "agadoo": "^2.0.0",
47
+ "cross-env": "^7.0.3"
47
48
  },
48
- "gitHead": "35529bd4ea1195ff7587f79105f2fb49d0e394b0"
49
+ "gitHead": "e8d08469864173ec8480e4cf069849d663500883"
49
50
  }