@solana-mobile/mobile-wallet-adapter-protocol 0.0.1-alpha.5 → 0.0.1-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,7 @@ The callback you provide will be called once a session has been established with
20
20
 
21
21
  ```typescript
22
22
  const signedPayloads = await transact(async (wallet) => {
23
- const {signed_payloads} = await wallet('sign_message', {
23
+ const {signed_payloads} = await wallet.signMessage({
24
24
  auth_token,
25
25
  payloads: [/* ... */],
26
26
  });
@@ -38,11 +38,11 @@ You can catch exceptions at any level. See `errors.ts` for a list of exceptions
38
38
  try {
39
39
  await transact(async (wallet) => {
40
40
  try {
41
- await wallet('sign_transaction', /* ... */);
41
+ await wallet.signTransaction(/* ... */);
42
42
  } catch (e) {
43
43
  if (e instanceof SolanaMobileWalletAdapterProtocolReauthorizeError) {
44
44
  console.error('The auth token has gone stale');
45
- await wallet('reauthorize', {auth_token});
45
+ await wallet.reauthorize({auth_token});
46
46
  // Retry...
47
47
  }
48
48
  throw e;
@@ -416,20 +416,39 @@ function transact(callback, config) {
416
416
  case 'hello_req_sent': {
417
417
  const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
418
418
  state = { __type: 'connected', sharedSecret };
419
- const walletAPI = (method, params) => __awaiter(this, void 0, void 0, function* () {
420
- const id = nextJsonRpcMessageId++;
421
- socket.send(yield encryptJsonRpcMessage({
422
- id,
423
- jsonrpc: '2.0',
424
- method,
425
- params,
426
- }, sharedSecret));
427
- return new Promise((resolve, reject) => {
428
- jsonRpcResponsePromises[id] = { resolve, reject };
429
- });
419
+ const wallet = new Proxy({}, {
420
+ get(target, p) {
421
+ if (target[p] == null) {
422
+ const method = p
423
+ .toString()
424
+ .replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
425
+ .toLowerCase();
426
+ target[p] = function (params) {
427
+ return __awaiter(this, void 0, void 0, function* () {
428
+ const id = nextJsonRpcMessageId++;
429
+ socket.send(yield encryptJsonRpcMessage({
430
+ id,
431
+ jsonrpc: '2.0',
432
+ method,
433
+ params,
434
+ }, sharedSecret));
435
+ return new Promise((resolve, reject) => {
436
+ jsonRpcResponsePromises[id] = { resolve, reject };
437
+ });
438
+ });
439
+ };
440
+ }
441
+ return target[p];
442
+ },
443
+ defineProperty() {
444
+ return false;
445
+ },
446
+ deleteProperty() {
447
+ return false;
448
+ },
430
449
  });
431
450
  try {
432
- resolve(yield callback(walletAPI));
451
+ resolve(yield callback(wallet));
433
452
  }
434
453
  catch (e) {
435
454
  reject(e);
package/lib/cjs/index.js CHANGED
@@ -416,20 +416,39 @@ function transact(callback, config) {
416
416
  case 'hello_req_sent': {
417
417
  const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
418
418
  state = { __type: 'connected', sharedSecret };
419
- const walletAPI = (method, params) => __awaiter(this, void 0, void 0, function* () {
420
- const id = nextJsonRpcMessageId++;
421
- socket.send(yield encryptJsonRpcMessage({
422
- id,
423
- jsonrpc: '2.0',
424
- method,
425
- params,
426
- }, sharedSecret));
427
- return new Promise((resolve, reject) => {
428
- jsonRpcResponsePromises[id] = { resolve, reject };
429
- });
419
+ const wallet = new Proxy({}, {
420
+ get(target, p) {
421
+ if (target[p] == null) {
422
+ const method = p
423
+ .toString()
424
+ .replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
425
+ .toLowerCase();
426
+ target[p] = function (params) {
427
+ return __awaiter(this, void 0, void 0, function* () {
428
+ const id = nextJsonRpcMessageId++;
429
+ socket.send(yield encryptJsonRpcMessage({
430
+ id,
431
+ jsonrpc: '2.0',
432
+ method,
433
+ params,
434
+ }, sharedSecret));
435
+ return new Promise((resolve, reject) => {
436
+ jsonRpcResponsePromises[id] = { resolve, reject };
437
+ });
438
+ });
439
+ };
440
+ }
441
+ return target[p];
442
+ },
443
+ defineProperty() {
444
+ return false;
445
+ },
446
+ deleteProperty() {
447
+ return false;
448
+ },
430
449
  });
431
450
  try {
432
- resolve(yield callback(walletAPI));
451
+ resolve(yield callback(wallet));
433
452
  }
434
453
  catch (e) {
435
454
  reject(e);
@@ -110,18 +110,38 @@ function transact(callback, config) {
110
110
  return __awaiter(this, void 0, void 0, function* () {
111
111
  try {
112
112
  yield SolanaMobileWalletAdapter.startSession(config);
113
- return yield callback((method, params) => __awaiter(this, void 0, void 0, function* () {
114
- try {
115
- return yield SolanaMobileWalletAdapter.invoke(method, params);
116
- }
117
- catch (e) {
118
- if (e instanceof Error && e.code === 'JSON_RPC_ERROR') {
119
- const details = e.userInfo;
120
- throw new SolanaMobileWalletAdapterProtocolJsonRpcError(0 /* jsonRpcMessageId */, details.jsonRpcErrorCode, e.message);
113
+ const wallet = new Proxy({}, {
114
+ get(target, p) {
115
+ if (target[p] == null) {
116
+ const method = p
117
+ .toString()
118
+ .replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
119
+ .toLowerCase();
120
+ target[p] = function (params) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ try {
123
+ return yield SolanaMobileWalletAdapter.invoke(method, params);
124
+ }
125
+ catch (e) {
126
+ if (e instanceof Error && e.code === 'JSON_RPC_ERROR') {
127
+ const details = e.userInfo;
128
+ throw new SolanaMobileWalletAdapterProtocolJsonRpcError(0 /* jsonRpcMessageId */, details.jsonRpcErrorCode, e.message);
129
+ }
130
+ throw e;
131
+ }
132
+ });
133
+ };
121
134
  }
122
- throw e;
123
- }
124
- }));
135
+ return target[p];
136
+ },
137
+ defineProperty() {
138
+ return false;
139
+ },
140
+ deleteProperty() {
141
+ return false;
142
+ },
143
+ });
144
+ return yield callback(wallet);
125
145
  }
126
146
  finally {
127
147
  yield SolanaMobileWalletAdapter.endSession();
@@ -412,20 +412,39 @@ function transact(callback, config) {
412
412
  case 'hello_req_sent': {
413
413
  const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
414
414
  state = { __type: 'connected', sharedSecret };
415
- const walletAPI = (method, params) => __awaiter(this, void 0, void 0, function* () {
416
- const id = nextJsonRpcMessageId++;
417
- socket.send(yield encryptJsonRpcMessage({
418
- id,
419
- jsonrpc: '2.0',
420
- method,
421
- params,
422
- }, sharedSecret));
423
- return new Promise((resolve, reject) => {
424
- jsonRpcResponsePromises[id] = { resolve, reject };
425
- });
415
+ const wallet = new Proxy({}, {
416
+ get(target, p) {
417
+ if (target[p] == null) {
418
+ const method = p
419
+ .toString()
420
+ .replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
421
+ .toLowerCase();
422
+ target[p] = function (params) {
423
+ return __awaiter(this, void 0, void 0, function* () {
424
+ const id = nextJsonRpcMessageId++;
425
+ socket.send(yield encryptJsonRpcMessage({
426
+ id,
427
+ jsonrpc: '2.0',
428
+ method,
429
+ params,
430
+ }, sharedSecret));
431
+ return new Promise((resolve, reject) => {
432
+ jsonRpcResponsePromises[id] = { resolve, reject };
433
+ });
434
+ });
435
+ };
436
+ }
437
+ return target[p];
438
+ },
439
+ defineProperty() {
440
+ return false;
441
+ },
442
+ deleteProperty() {
443
+ return false;
444
+ },
426
445
  });
427
446
  try {
428
- resolve(yield callback(walletAPI));
447
+ resolve(yield callback(wallet));
429
448
  }
430
449
  catch (e) {
431
450
  reject(e);
package/lib/esm/index.mjs CHANGED
@@ -412,20 +412,39 @@ function transact(callback, config) {
412
412
  case 'hello_req_sent': {
413
413
  const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
414
414
  state = { __type: 'connected', sharedSecret };
415
- const walletAPI = (method, params) => __awaiter(this, void 0, void 0, function* () {
416
- const id = nextJsonRpcMessageId++;
417
- socket.send(yield encryptJsonRpcMessage({
418
- id,
419
- jsonrpc: '2.0',
420
- method,
421
- params,
422
- }, sharedSecret));
423
- return new Promise((resolve, reject) => {
424
- jsonRpcResponsePromises[id] = { resolve, reject };
425
- });
415
+ const wallet = new Proxy({}, {
416
+ get(target, p) {
417
+ if (target[p] == null) {
418
+ const method = p
419
+ .toString()
420
+ .replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
421
+ .toLowerCase();
422
+ target[p] = function (params) {
423
+ return __awaiter(this, void 0, void 0, function* () {
424
+ const id = nextJsonRpcMessageId++;
425
+ socket.send(yield encryptJsonRpcMessage({
426
+ id,
427
+ jsonrpc: '2.0',
428
+ method,
429
+ params,
430
+ }, sharedSecret));
431
+ return new Promise((resolve, reject) => {
432
+ jsonRpcResponsePromises[id] = { resolve, reject };
433
+ });
434
+ });
435
+ };
436
+ }
437
+ return target[p];
438
+ },
439
+ defineProperty() {
440
+ return false;
441
+ },
442
+ deleteProperty() {
443
+ return false;
444
+ },
426
445
  });
427
446
  try {
428
- resolve(yield callback(walletAPI));
447
+ resolve(yield callback(wallet));
429
448
  }
430
449
  catch (e) {
431
450
  reject(e);
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
87
87
  type WalletAssociationConfig = Readonly<{
88
88
  baseUri?: string;
89
89
  }>;
90
- type AuthorizeAPI = (method: "authorize", params: {
91
- identity: AppIdentity;
92
- }) => Promise<AuthorizationResult>;
93
- type CloneAuthorizationAPI = (method: "clone_authorization", params: {
94
- auth_token: AuthToken;
95
- }) => Promise<Readonly<{
96
- auth_token: AuthToken;
97
- }>>;
98
- type DeauthorizeAPI = (method: "deauthorize", params: {
99
- auth_token: AuthToken;
100
- }) => Promise<Readonly<Record<string, never>>>;
101
- type ReauthorizeAPI = (method: "reauthorize", params: {
102
- auth_token: AuthToken;
103
- }) => Promise<Readonly<{
104
- auth_token: AuthToken;
105
- }>>;
106
- type SignMessageAPI = (method: "sign_message", params: {
107
- auth_token: AuthToken;
108
- payloads: Base64EncodedMessage[];
109
- }) => Promise<Readonly<{
110
- signed_payloads: Base64EncodedSignedMessage[];
111
- }>>;
112
- type SignTransactionAPI = (method: "sign_transaction", params: {
113
- auth_token: AuthToken;
114
- payloads: Base64EncodedTransaction[];
115
- }) => Promise<Readonly<{
116
- signed_payloads: Base64EncodedSignedTransaction[];
117
- }>>;
118
- type SignAndSendTransactionAPI = (method: "sign_and_send_transaction", params: {
119
- auth_token: AuthToken;
120
- commitment: "confirmed" | "finalized" | "processed";
121
- payloads: Base64EncodedTransaction[];
122
- }) => Promise<Readonly<{
123
- signatures: Base58EncodedSignature[];
124
- }>>;
125
- interface MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
126
- }
127
- declare function transact<TReturn>(callback: (walletAPI: MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
128
- export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWalletAPI };
90
+ interface AuthorizeAPI {
91
+ authorize(params: {
92
+ identity: AppIdentity;
93
+ }): Promise<AuthorizationResult>;
94
+ }
95
+ interface CloneAuthorizationAPI {
96
+ cloneAuthorization(params: {
97
+ auth_token: AuthToken;
98
+ }): Promise<Readonly<{
99
+ auth_token: AuthToken;
100
+ }>>;
101
+ }
102
+ interface DeauthorizeAPI {
103
+ deauthorize(params: {
104
+ auth_token: AuthToken;
105
+ }): Promise<Readonly<Record<string, never>>>;
106
+ }
107
+ interface ReauthorizeAPI {
108
+ reauthorize(params: {
109
+ auth_token: AuthToken;
110
+ }): Promise<Readonly<{
111
+ auth_token: AuthToken;
112
+ }>>;
113
+ }
114
+ interface SignMessageAPI {
115
+ signMessage(params: {
116
+ auth_token: AuthToken;
117
+ payloads: Base64EncodedMessage[];
118
+ }): Promise<Readonly<{
119
+ signed_payloads: Base64EncodedSignedMessage[];
120
+ }>>;
121
+ }
122
+ interface SignTransactionAPI {
123
+ signTransaction(params: {
124
+ auth_token: AuthToken;
125
+ payloads: Base64EncodedTransaction[];
126
+ }): Promise<Readonly<{
127
+ signed_payloads: Base64EncodedSignedTransaction[];
128
+ }>>;
129
+ }
130
+ interface SignAndSendTransactionAPI {
131
+ signAndSendTransaction(params: {
132
+ auth_token: AuthToken;
133
+ commitment: "confirmed" | "finalized" | "processed";
134
+ payloads: Base64EncodedTransaction[];
135
+ }): Promise<Readonly<{
136
+ signatures: Base58EncodedSignature[];
137
+ }>>;
138
+ }
139
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
140
+ }
141
+ declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
142
+ export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
129
143
  //# sourceMappingURL=index.browser.d.mts.map
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
87
87
  type WalletAssociationConfig = Readonly<{
88
88
  baseUri?: string;
89
89
  }>;
90
- type AuthorizeAPI = (method: "authorize", params: {
91
- identity: AppIdentity;
92
- }) => Promise<AuthorizationResult>;
93
- type CloneAuthorizationAPI = (method: "clone_authorization", params: {
94
- auth_token: AuthToken;
95
- }) => Promise<Readonly<{
96
- auth_token: AuthToken;
97
- }>>;
98
- type DeauthorizeAPI = (method: "deauthorize", params: {
99
- auth_token: AuthToken;
100
- }) => Promise<Readonly<Record<string, never>>>;
101
- type ReauthorizeAPI = (method: "reauthorize", params: {
102
- auth_token: AuthToken;
103
- }) => Promise<Readonly<{
104
- auth_token: AuthToken;
105
- }>>;
106
- type SignMessageAPI = (method: "sign_message", params: {
107
- auth_token: AuthToken;
108
- payloads: Base64EncodedMessage[];
109
- }) => Promise<Readonly<{
110
- signed_payloads: Base64EncodedSignedMessage[];
111
- }>>;
112
- type SignTransactionAPI = (method: "sign_transaction", params: {
113
- auth_token: AuthToken;
114
- payloads: Base64EncodedTransaction[];
115
- }) => Promise<Readonly<{
116
- signed_payloads: Base64EncodedSignedTransaction[];
117
- }>>;
118
- type SignAndSendTransactionAPI = (method: "sign_and_send_transaction", params: {
119
- auth_token: AuthToken;
120
- commitment: "confirmed" | "finalized" | "processed";
121
- payloads: Base64EncodedTransaction[];
122
- }) => Promise<Readonly<{
123
- signatures: Base58EncodedSignature[];
124
- }>>;
125
- interface MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
126
- }
127
- declare function transact<TReturn>(callback: (walletAPI: MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
128
- export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWalletAPI };
90
+ interface AuthorizeAPI {
91
+ authorize(params: {
92
+ identity: AppIdentity;
93
+ }): Promise<AuthorizationResult>;
94
+ }
95
+ interface CloneAuthorizationAPI {
96
+ cloneAuthorization(params: {
97
+ auth_token: AuthToken;
98
+ }): Promise<Readonly<{
99
+ auth_token: AuthToken;
100
+ }>>;
101
+ }
102
+ interface DeauthorizeAPI {
103
+ deauthorize(params: {
104
+ auth_token: AuthToken;
105
+ }): Promise<Readonly<Record<string, never>>>;
106
+ }
107
+ interface ReauthorizeAPI {
108
+ reauthorize(params: {
109
+ auth_token: AuthToken;
110
+ }): Promise<Readonly<{
111
+ auth_token: AuthToken;
112
+ }>>;
113
+ }
114
+ interface SignMessageAPI {
115
+ signMessage(params: {
116
+ auth_token: AuthToken;
117
+ payloads: Base64EncodedMessage[];
118
+ }): Promise<Readonly<{
119
+ signed_payloads: Base64EncodedSignedMessage[];
120
+ }>>;
121
+ }
122
+ interface SignTransactionAPI {
123
+ signTransaction(params: {
124
+ auth_token: AuthToken;
125
+ payloads: Base64EncodedTransaction[];
126
+ }): Promise<Readonly<{
127
+ signed_payloads: Base64EncodedSignedTransaction[];
128
+ }>>;
129
+ }
130
+ interface SignAndSendTransactionAPI {
131
+ signAndSendTransaction(params: {
132
+ auth_token: AuthToken;
133
+ commitment: "confirmed" | "finalized" | "processed";
134
+ payloads: Base64EncodedTransaction[];
135
+ }): Promise<Readonly<{
136
+ signatures: Base58EncodedSignature[];
137
+ }>>;
138
+ }
139
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
140
+ }
141
+ declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
142
+ export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
129
143
  //# sourceMappingURL=index.browser.d.ts.map
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
87
87
  type WalletAssociationConfig = Readonly<{
88
88
  baseUri?: string;
89
89
  }>;
90
- type AuthorizeAPI = (method: "authorize", params: {
91
- identity: AppIdentity;
92
- }) => Promise<AuthorizationResult>;
93
- type CloneAuthorizationAPI = (method: "clone_authorization", params: {
94
- auth_token: AuthToken;
95
- }) => Promise<Readonly<{
96
- auth_token: AuthToken;
97
- }>>;
98
- type DeauthorizeAPI = (method: "deauthorize", params: {
99
- auth_token: AuthToken;
100
- }) => Promise<Readonly<Record<string, never>>>;
101
- type ReauthorizeAPI = (method: "reauthorize", params: {
102
- auth_token: AuthToken;
103
- }) => Promise<Readonly<{
104
- auth_token: AuthToken;
105
- }>>;
106
- type SignMessageAPI = (method: "sign_message", params: {
107
- auth_token: AuthToken;
108
- payloads: Base64EncodedMessage[];
109
- }) => Promise<Readonly<{
110
- signed_payloads: Base64EncodedSignedMessage[];
111
- }>>;
112
- type SignTransactionAPI = (method: "sign_transaction", params: {
113
- auth_token: AuthToken;
114
- payloads: Base64EncodedTransaction[];
115
- }) => Promise<Readonly<{
116
- signed_payloads: Base64EncodedSignedTransaction[];
117
- }>>;
118
- type SignAndSendTransactionAPI = (method: "sign_and_send_transaction", params: {
119
- auth_token: AuthToken;
120
- commitment: "confirmed" | "finalized" | "processed";
121
- payloads: Base64EncodedTransaction[];
122
- }) => Promise<Readonly<{
123
- signatures: Base58EncodedSignature[];
124
- }>>;
125
- interface MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
126
- }
127
- declare function transact<TReturn>(callback: (walletAPI: MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
128
- export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWalletAPI };
90
+ interface AuthorizeAPI {
91
+ authorize(params: {
92
+ identity: AppIdentity;
93
+ }): Promise<AuthorizationResult>;
94
+ }
95
+ interface CloneAuthorizationAPI {
96
+ cloneAuthorization(params: {
97
+ auth_token: AuthToken;
98
+ }): Promise<Readonly<{
99
+ auth_token: AuthToken;
100
+ }>>;
101
+ }
102
+ interface DeauthorizeAPI {
103
+ deauthorize(params: {
104
+ auth_token: AuthToken;
105
+ }): Promise<Readonly<Record<string, never>>>;
106
+ }
107
+ interface ReauthorizeAPI {
108
+ reauthorize(params: {
109
+ auth_token: AuthToken;
110
+ }): Promise<Readonly<{
111
+ auth_token: AuthToken;
112
+ }>>;
113
+ }
114
+ interface SignMessageAPI {
115
+ signMessage(params: {
116
+ auth_token: AuthToken;
117
+ payloads: Base64EncodedMessage[];
118
+ }): Promise<Readonly<{
119
+ signed_payloads: Base64EncodedSignedMessage[];
120
+ }>>;
121
+ }
122
+ interface SignTransactionAPI {
123
+ signTransaction(params: {
124
+ auth_token: AuthToken;
125
+ payloads: Base64EncodedTransaction[];
126
+ }): Promise<Readonly<{
127
+ signed_payloads: Base64EncodedSignedTransaction[];
128
+ }>>;
129
+ }
130
+ interface SignAndSendTransactionAPI {
131
+ signAndSendTransaction(params: {
132
+ auth_token: AuthToken;
133
+ commitment: "confirmed" | "finalized" | "processed";
134
+ payloads: Base64EncodedTransaction[];
135
+ }): Promise<Readonly<{
136
+ signatures: Base58EncodedSignature[];
137
+ }>>;
138
+ }
139
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
140
+ }
141
+ declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
142
+ export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
129
143
  //# sourceMappingURL=index.d.mts.map
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
87
87
  type WalletAssociationConfig = Readonly<{
88
88
  baseUri?: string;
89
89
  }>;
90
- type AuthorizeAPI = (method: "authorize", params: {
91
- identity: AppIdentity;
92
- }) => Promise<AuthorizationResult>;
93
- type CloneAuthorizationAPI = (method: "clone_authorization", params: {
94
- auth_token: AuthToken;
95
- }) => Promise<Readonly<{
96
- auth_token: AuthToken;
97
- }>>;
98
- type DeauthorizeAPI = (method: "deauthorize", params: {
99
- auth_token: AuthToken;
100
- }) => Promise<Readonly<Record<string, never>>>;
101
- type ReauthorizeAPI = (method: "reauthorize", params: {
102
- auth_token: AuthToken;
103
- }) => Promise<Readonly<{
104
- auth_token: AuthToken;
105
- }>>;
106
- type SignMessageAPI = (method: "sign_message", params: {
107
- auth_token: AuthToken;
108
- payloads: Base64EncodedMessage[];
109
- }) => Promise<Readonly<{
110
- signed_payloads: Base64EncodedSignedMessage[];
111
- }>>;
112
- type SignTransactionAPI = (method: "sign_transaction", params: {
113
- auth_token: AuthToken;
114
- payloads: Base64EncodedTransaction[];
115
- }) => Promise<Readonly<{
116
- signed_payloads: Base64EncodedSignedTransaction[];
117
- }>>;
118
- type SignAndSendTransactionAPI = (method: "sign_and_send_transaction", params: {
119
- auth_token: AuthToken;
120
- commitment: "confirmed" | "finalized" | "processed";
121
- payloads: Base64EncodedTransaction[];
122
- }) => Promise<Readonly<{
123
- signatures: Base58EncodedSignature[];
124
- }>>;
125
- interface MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
126
- }
127
- declare function transact<TReturn>(callback: (walletAPI: MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
128
- export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWalletAPI };
90
+ interface AuthorizeAPI {
91
+ authorize(params: {
92
+ identity: AppIdentity;
93
+ }): Promise<AuthorizationResult>;
94
+ }
95
+ interface CloneAuthorizationAPI {
96
+ cloneAuthorization(params: {
97
+ auth_token: AuthToken;
98
+ }): Promise<Readonly<{
99
+ auth_token: AuthToken;
100
+ }>>;
101
+ }
102
+ interface DeauthorizeAPI {
103
+ deauthorize(params: {
104
+ auth_token: AuthToken;
105
+ }): Promise<Readonly<Record<string, never>>>;
106
+ }
107
+ interface ReauthorizeAPI {
108
+ reauthorize(params: {
109
+ auth_token: AuthToken;
110
+ }): Promise<Readonly<{
111
+ auth_token: AuthToken;
112
+ }>>;
113
+ }
114
+ interface SignMessageAPI {
115
+ signMessage(params: {
116
+ auth_token: AuthToken;
117
+ payloads: Base64EncodedMessage[];
118
+ }): Promise<Readonly<{
119
+ signed_payloads: Base64EncodedSignedMessage[];
120
+ }>>;
121
+ }
122
+ interface SignTransactionAPI {
123
+ signTransaction(params: {
124
+ auth_token: AuthToken;
125
+ payloads: Base64EncodedTransaction[];
126
+ }): Promise<Readonly<{
127
+ signed_payloads: Base64EncodedSignedTransaction[];
128
+ }>>;
129
+ }
130
+ interface SignAndSendTransactionAPI {
131
+ signAndSendTransaction(params: {
132
+ auth_token: AuthToken;
133
+ commitment: "confirmed" | "finalized" | "processed";
134
+ payloads: Base64EncodedTransaction[];
135
+ }): Promise<Readonly<{
136
+ signatures: Base58EncodedSignature[];
137
+ }>>;
138
+ }
139
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
140
+ }
141
+ declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
142
+ export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
129
143
  //# sourceMappingURL=index.d.ts.map
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
87
87
  type WalletAssociationConfig = Readonly<{
88
88
  baseUri?: string;
89
89
  }>;
90
- type AuthorizeAPI = (method: "authorize", params: {
91
- identity: AppIdentity;
92
- }) => Promise<AuthorizationResult>;
93
- type CloneAuthorizationAPI = (method: "clone_authorization", params: {
94
- auth_token: AuthToken;
95
- }) => Promise<Readonly<{
96
- auth_token: AuthToken;
97
- }>>;
98
- type DeauthorizeAPI = (method: "deauthorize", params: {
99
- auth_token: AuthToken;
100
- }) => Promise<Readonly<Record<string, never>>>;
101
- type ReauthorizeAPI = (method: "reauthorize", params: {
102
- auth_token: AuthToken;
103
- }) => Promise<Readonly<{
104
- auth_token: AuthToken;
105
- }>>;
106
- type SignMessageAPI = (method: "sign_message", params: {
107
- auth_token: AuthToken;
108
- payloads: Base64EncodedMessage[];
109
- }) => Promise<Readonly<{
110
- signed_payloads: Base64EncodedSignedMessage[];
111
- }>>;
112
- type SignTransactionAPI = (method: "sign_transaction", params: {
113
- auth_token: AuthToken;
114
- payloads: Base64EncodedTransaction[];
115
- }) => Promise<Readonly<{
116
- signed_payloads: Base64EncodedSignedTransaction[];
117
- }>>;
118
- type SignAndSendTransactionAPI = (method: "sign_and_send_transaction", params: {
119
- auth_token: AuthToken;
120
- commitment: "confirmed" | "finalized" | "processed";
121
- payloads: Base64EncodedTransaction[];
122
- }) => Promise<Readonly<{
123
- signatures: Base58EncodedSignature[];
124
- }>>;
125
- interface MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
126
- }
127
- declare function transact<TReturn>(callback: (walletAPI: MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
128
- export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWalletAPI };
90
+ interface AuthorizeAPI {
91
+ authorize(params: {
92
+ identity: AppIdentity;
93
+ }): Promise<AuthorizationResult>;
94
+ }
95
+ interface CloneAuthorizationAPI {
96
+ cloneAuthorization(params: {
97
+ auth_token: AuthToken;
98
+ }): Promise<Readonly<{
99
+ auth_token: AuthToken;
100
+ }>>;
101
+ }
102
+ interface DeauthorizeAPI {
103
+ deauthorize(params: {
104
+ auth_token: AuthToken;
105
+ }): Promise<Readonly<Record<string, never>>>;
106
+ }
107
+ interface ReauthorizeAPI {
108
+ reauthorize(params: {
109
+ auth_token: AuthToken;
110
+ }): Promise<Readonly<{
111
+ auth_token: AuthToken;
112
+ }>>;
113
+ }
114
+ interface SignMessageAPI {
115
+ signMessage(params: {
116
+ auth_token: AuthToken;
117
+ payloads: Base64EncodedMessage[];
118
+ }): Promise<Readonly<{
119
+ signed_payloads: Base64EncodedSignedMessage[];
120
+ }>>;
121
+ }
122
+ interface SignTransactionAPI {
123
+ signTransaction(params: {
124
+ auth_token: AuthToken;
125
+ payloads: Base64EncodedTransaction[];
126
+ }): Promise<Readonly<{
127
+ signed_payloads: Base64EncodedSignedTransaction[];
128
+ }>>;
129
+ }
130
+ interface SignAndSendTransactionAPI {
131
+ signAndSendTransaction(params: {
132
+ auth_token: AuthToken;
133
+ commitment: "confirmed" | "finalized" | "processed";
134
+ payloads: Base64EncodedTransaction[];
135
+ }): Promise<Readonly<{
136
+ signatures: Base58EncodedSignature[];
137
+ }>>;
138
+ }
139
+ interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
140
+ }
141
+ declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
142
+ export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
129
143
  //# 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.5",
4
+ "version": "0.0.1-alpha.6",
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",
@@ -45,5 +45,5 @@
45
45
  "@types/react-native": "^0.69.3",
46
46
  "agadoo": "^2.0.0"
47
47
  },
48
- "gitHead": "7df380859bd4a3e6acc4f4b7385e9604919c76a8"
48
+ "gitHead": "8cef0e0dd72e01cd522b16b6e486a26abe1e032b"
49
49
  }