@solana-mobile/wallet-adapter-mobile 0.0.1-alpha.3 → 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.
@@ -63,7 +63,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
63
63
  }
64
64
  get publicKey() {
65
65
  if (this._publicKey == null && this._authorizationResult != null) {
66
- this._publicKey = new web3_js.PublicKey(this._authorizationResult.publicKey);
66
+ this._publicKey = new web3_js.PublicKey(this._authorizationResult.pub_key);
67
67
  }
68
68
  return this._publicKey ? this._publicKey : null;
69
69
  }
@@ -98,8 +98,8 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
98
98
  return;
99
99
  }
100
100
  try {
101
- yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
102
- const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield walletAPI({ method: 'authorize', identity: this._appIdentity });
101
+ yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
102
+ const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield wallet.authorize({ identity: this._appIdentity });
103
103
  try {
104
104
  this._publicKey = new web3_js.PublicKey(base58PublicKey);
105
105
  }
@@ -107,9 +107,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
107
107
  throw new walletAdapterBase.WalletPublicKeyError((e instanceof Error && (e === null || e === void 0 ? void 0 : e.message)) || 'Unknown error', e);
108
108
  }
109
109
  this.handleAuthorizationResult({
110
- authToken: auth_token,
111
- publicKey: base58PublicKey,
112
- walletUriBase: wallet_uri_base,
110
+ auth_token,
111
+ pub_key: base58PublicKey,
112
+ wallet_uri_base: wallet_uri_base,
113
113
  }); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
114
114
  this.emit('connect',
115
115
  // Having just set an `authorizationResult`, `this.publicKey` is definitely non-null
@@ -131,15 +131,14 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
131
131
  yield this._authorizationResultCache.set(authorizationResult);
132
132
  });
133
133
  }
134
- performReauthorization(walletAPI, currentAuthorizationResult) {
134
+ performReauthorization(wallet, currentAuthorizationResult) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
136
  try {
137
- const { auth_token } = yield walletAPI({
138
- method: 'reauthorize',
139
- auth_token: currentAuthorizationResult.authToken,
137
+ const { auth_token } = yield wallet.reauthorize({
138
+ auth_token: currentAuthorizationResult.auth_token,
140
139
  });
141
- if (currentAuthorizationResult.authToken !== auth_token) {
142
- this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { authToken: auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
140
+ if (currentAuthorizationResult.auth_token !== auth_token) {
141
+ this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
143
142
  }
144
143
  return auth_token;
145
144
  }
@@ -160,7 +159,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
160
159
  transact(callback) {
161
160
  var _a;
162
161
  return __awaiter(this, void 0, void 0, function* () {
163
- const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.walletUriBase;
162
+ const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
164
163
  const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
165
164
  return yield mobileWalletAdapterProtocolWeb3js.transact(callback, config);
166
165
  });
@@ -176,10 +175,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
176
175
  try {
177
176
  const authorizationResult = this.assertIsAuthorized();
178
177
  try {
179
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
180
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
181
- const signedTransactions = yield walletAPI({
182
- method: 'sign_transaction',
178
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
179
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
180
+ const signedTransactions = yield wallet.signTransaction({
183
181
  auth_token: freshAuthToken,
184
182
  transactions,
185
183
  });
@@ -201,10 +199,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
201
199
  try {
202
200
  const authorizationResult = this.assertIsAuthorized();
203
201
  try {
204
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
205
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
206
- const signatures = yield walletAPI({
207
- method: 'sign_and_send_transaction',
202
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
203
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
204
+ const signatures = yield wallet.signAndSendTransaction({
208
205
  auth_token: freshAuthToken,
209
206
  fee_payer: this.publicKey || undefined,
210
207
  connection,
@@ -240,12 +237,11 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
240
237
  try {
241
238
  const authorizationResult = this.assertIsAuthorized();
242
239
  try {
243
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
244
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
245
- const [signedMessage] = yield walletAPI({
246
- method: 'sign_message',
240
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
241
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
242
+ const [signedMessage] = yield wallet.signMessage({
247
243
  auth_token: freshAuthToken,
248
- byteArrays: [message],
244
+ payloads: [message],
249
245
  });
250
246
  const signature = signedMessage.slice(-SIGNATURE_LENGTH_IN_BYTES);
251
247
  return signature;
package/lib/cjs/index.js CHANGED
@@ -63,7 +63,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
63
63
  }
64
64
  get publicKey() {
65
65
  if (this._publicKey == null && this._authorizationResult != null) {
66
- this._publicKey = new web3_js.PublicKey(this._authorizationResult.publicKey);
66
+ this._publicKey = new web3_js.PublicKey(this._authorizationResult.pub_key);
67
67
  }
68
68
  return this._publicKey ? this._publicKey : null;
69
69
  }
@@ -98,8 +98,8 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
98
98
  return;
99
99
  }
100
100
  try {
101
- yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
102
- const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield walletAPI({ method: 'authorize', identity: this._appIdentity });
101
+ yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
102
+ const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield wallet.authorize({ identity: this._appIdentity });
103
103
  try {
104
104
  this._publicKey = new web3_js.PublicKey(base58PublicKey);
105
105
  }
@@ -107,9 +107,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
107
107
  throw new walletAdapterBase.WalletPublicKeyError((e instanceof Error && (e === null || e === void 0 ? void 0 : e.message)) || 'Unknown error', e);
108
108
  }
109
109
  this.handleAuthorizationResult({
110
- authToken: auth_token,
111
- publicKey: base58PublicKey,
112
- walletUriBase: wallet_uri_base,
110
+ auth_token,
111
+ pub_key: base58PublicKey,
112
+ wallet_uri_base: wallet_uri_base,
113
113
  }); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
114
114
  this.emit('connect',
115
115
  // Having just set an `authorizationResult`, `this.publicKey` is definitely non-null
@@ -131,15 +131,14 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
131
131
  yield this._authorizationResultCache.set(authorizationResult);
132
132
  });
133
133
  }
134
- performReauthorization(walletAPI, currentAuthorizationResult) {
134
+ performReauthorization(wallet, currentAuthorizationResult) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
136
  try {
137
- const { auth_token } = yield walletAPI({
138
- method: 'reauthorize',
139
- auth_token: currentAuthorizationResult.authToken,
137
+ const { auth_token } = yield wallet.reauthorize({
138
+ auth_token: currentAuthorizationResult.auth_token,
140
139
  });
141
- if (currentAuthorizationResult.authToken !== auth_token) {
142
- this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { authToken: auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
140
+ if (currentAuthorizationResult.auth_token !== auth_token) {
141
+ this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
143
142
  }
144
143
  return auth_token;
145
144
  }
@@ -160,7 +159,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
160
159
  transact(callback) {
161
160
  var _a;
162
161
  return __awaiter(this, void 0, void 0, function* () {
163
- const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.walletUriBase;
162
+ const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
164
163
  const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
165
164
  return yield mobileWalletAdapterProtocolWeb3js.transact(callback, config);
166
165
  });
@@ -176,10 +175,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
176
175
  try {
177
176
  const authorizationResult = this.assertIsAuthorized();
178
177
  try {
179
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
180
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
181
- const signedTransactions = yield walletAPI({
182
- method: 'sign_transaction',
178
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
179
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
180
+ const signedTransactions = yield wallet.signTransaction({
183
181
  auth_token: freshAuthToken,
184
182
  transactions,
185
183
  });
@@ -201,10 +199,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
201
199
  try {
202
200
  const authorizationResult = this.assertIsAuthorized();
203
201
  try {
204
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
205
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
206
- const signatures = yield walletAPI({
207
- method: 'sign_and_send_transaction',
202
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
203
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
204
+ const signatures = yield wallet.signAndSendTransaction({
208
205
  auth_token: freshAuthToken,
209
206
  fee_payer: this.publicKey || undefined,
210
207
  connection,
@@ -240,12 +237,11 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
240
237
  try {
241
238
  const authorizationResult = this.assertIsAuthorized();
242
239
  try {
243
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
244
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
245
- const [signedMessage] = yield walletAPI({
246
- method: 'sign_message',
240
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
241
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
242
+ const [signedMessage] = yield wallet.signMessage({
247
243
  auth_token: freshAuthToken,
248
- byteArrays: [message],
244
+ payloads: [message],
249
245
  });
250
246
  const signature = signedMessage.slice(-SIGNATURE_LENGTH_IN_BYTES);
251
247
  return signature;
@@ -66,7 +66,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
66
66
  }
67
67
  get publicKey() {
68
68
  if (this._publicKey == null && this._authorizationResult != null) {
69
- this._publicKey = new web3_js.PublicKey(this._authorizationResult.publicKey);
69
+ this._publicKey = new web3_js.PublicKey(this._authorizationResult.pub_key);
70
70
  }
71
71
  return this._publicKey ? this._publicKey : null;
72
72
  }
@@ -101,8 +101,8 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
101
101
  return;
102
102
  }
103
103
  try {
104
- yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
105
- const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield walletAPI({ method: 'authorize', identity: this._appIdentity });
104
+ yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
105
+ const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield wallet.authorize({ identity: this._appIdentity });
106
106
  try {
107
107
  this._publicKey = new web3_js.PublicKey(base58PublicKey);
108
108
  }
@@ -110,9 +110,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
110
110
  throw new walletAdapterBase.WalletPublicKeyError((e instanceof Error && (e === null || e === void 0 ? void 0 : e.message)) || 'Unknown error', e);
111
111
  }
112
112
  this.handleAuthorizationResult({
113
- authToken: auth_token,
114
- publicKey: base58PublicKey,
115
- walletUriBase: wallet_uri_base,
113
+ auth_token,
114
+ pub_key: base58PublicKey,
115
+ wallet_uri_base: wallet_uri_base,
116
116
  }); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
117
117
  this.emit('connect',
118
118
  // Having just set an `authorizationResult`, `this.publicKey` is definitely non-null
@@ -134,15 +134,14 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
134
134
  yield this._authorizationResultCache.set(authorizationResult);
135
135
  });
136
136
  }
137
- performReauthorization(walletAPI, currentAuthorizationResult) {
137
+ performReauthorization(wallet, currentAuthorizationResult) {
138
138
  return __awaiter(this, void 0, void 0, function* () {
139
139
  try {
140
- const { auth_token } = yield walletAPI({
141
- method: 'reauthorize',
142
- auth_token: currentAuthorizationResult.authToken,
140
+ const { auth_token } = yield wallet.reauthorize({
141
+ auth_token: currentAuthorizationResult.auth_token,
143
142
  });
144
- if (currentAuthorizationResult.authToken !== auth_token) {
145
- this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { authToken: auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
143
+ if (currentAuthorizationResult.auth_token !== auth_token) {
144
+ this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
146
145
  }
147
146
  return auth_token;
148
147
  }
@@ -163,7 +162,7 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
163
162
  transact(callback) {
164
163
  var _a;
165
164
  return __awaiter(this, void 0, void 0, function* () {
166
- const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.walletUriBase;
165
+ const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
167
166
  const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
168
167
  return yield mobileWalletAdapterProtocolWeb3js.transact(callback, config);
169
168
  });
@@ -179,10 +178,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
179
178
  try {
180
179
  const authorizationResult = this.assertIsAuthorized();
181
180
  try {
182
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
183
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
184
- const signedTransactions = yield walletAPI({
185
- method: 'sign_transaction',
181
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
182
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
183
+ const signedTransactions = yield wallet.signTransaction({
186
184
  auth_token: freshAuthToken,
187
185
  transactions,
188
186
  });
@@ -204,10 +202,9 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
204
202
  try {
205
203
  const authorizationResult = this.assertIsAuthorized();
206
204
  try {
207
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
208
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
209
- const signatures = yield walletAPI({
210
- method: 'sign_and_send_transaction',
205
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
206
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
207
+ const signatures = yield wallet.signAndSendTransaction({
211
208
  auth_token: freshAuthToken,
212
209
  fee_payer: this.publicKey || undefined,
213
210
  connection,
@@ -243,12 +240,11 @@ class SolanaMobileWalletAdapter extends walletAdapterBase.BaseMessageSignerWalle
243
240
  try {
244
241
  const authorizationResult = this.assertIsAuthorized();
245
242
  try {
246
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
247
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
248
- const [signedMessage] = yield walletAPI({
249
- method: 'sign_message',
243
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
244
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
245
+ const [signedMessage] = yield wallet.signMessage({
250
246
  auth_token: freshAuthToken,
251
- byteArrays: [message],
247
+ payloads: [message],
252
248
  });
253
249
  const signature = signedMessage.slice(-SIGNATURE_LENGTH_IN_BYTES);
254
250
  return signature;
@@ -59,7 +59,7 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
59
59
  }
60
60
  get publicKey() {
61
61
  if (this._publicKey == null && this._authorizationResult != null) {
62
- this._publicKey = new PublicKey(this._authorizationResult.publicKey);
62
+ this._publicKey = new PublicKey(this._authorizationResult.pub_key);
63
63
  }
64
64
  return this._publicKey ? this._publicKey : null;
65
65
  }
@@ -94,8 +94,8 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
94
94
  return;
95
95
  }
96
96
  try {
97
- yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
98
- const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield walletAPI({ method: 'authorize', identity: this._appIdentity });
97
+ yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
98
+ const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield wallet.authorize({ identity: this._appIdentity });
99
99
  try {
100
100
  this._publicKey = new PublicKey(base58PublicKey);
101
101
  }
@@ -103,9 +103,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
103
103
  throw new WalletPublicKeyError((e instanceof Error && (e === null || e === void 0 ? void 0 : e.message)) || 'Unknown error', e);
104
104
  }
105
105
  this.handleAuthorizationResult({
106
- authToken: auth_token,
107
- publicKey: base58PublicKey,
108
- walletUriBase: wallet_uri_base,
106
+ auth_token,
107
+ pub_key: base58PublicKey,
108
+ wallet_uri_base: wallet_uri_base,
109
109
  }); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
110
110
  this.emit('connect',
111
111
  // Having just set an `authorizationResult`, `this.publicKey` is definitely non-null
@@ -127,15 +127,14 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
127
127
  yield this._authorizationResultCache.set(authorizationResult);
128
128
  });
129
129
  }
130
- performReauthorization(walletAPI, currentAuthorizationResult) {
130
+ performReauthorization(wallet, currentAuthorizationResult) {
131
131
  return __awaiter(this, void 0, void 0, function* () {
132
132
  try {
133
- const { auth_token } = yield walletAPI({
134
- method: 'reauthorize',
135
- auth_token: currentAuthorizationResult.authToken,
133
+ const { auth_token } = yield wallet.reauthorize({
134
+ auth_token: currentAuthorizationResult.auth_token,
136
135
  });
137
- if (currentAuthorizationResult.authToken !== auth_token) {
138
- this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { authToken: auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
136
+ if (currentAuthorizationResult.auth_token !== auth_token) {
137
+ this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
139
138
  }
140
139
  return auth_token;
141
140
  }
@@ -156,7 +155,7 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
156
155
  transact(callback) {
157
156
  var _a;
158
157
  return __awaiter(this, void 0, void 0, function* () {
159
- const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.walletUriBase;
158
+ const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
160
159
  const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
161
160
  return yield transact(callback, config);
162
161
  });
@@ -172,10 +171,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
172
171
  try {
173
172
  const authorizationResult = this.assertIsAuthorized();
174
173
  try {
175
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
176
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
177
- const signedTransactions = yield walletAPI({
178
- method: 'sign_transaction',
174
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
175
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
176
+ const signedTransactions = yield wallet.signTransaction({
179
177
  auth_token: freshAuthToken,
180
178
  transactions,
181
179
  });
@@ -197,10 +195,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
197
195
  try {
198
196
  const authorizationResult = this.assertIsAuthorized();
199
197
  try {
200
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
201
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
202
- const signatures = yield walletAPI({
203
- method: 'sign_and_send_transaction',
198
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
199
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
200
+ const signatures = yield wallet.signAndSendTransaction({
204
201
  auth_token: freshAuthToken,
205
202
  fee_payer: this.publicKey || undefined,
206
203
  connection,
@@ -236,12 +233,11 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
236
233
  try {
237
234
  const authorizationResult = this.assertIsAuthorized();
238
235
  try {
239
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
240
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
241
- const [signedMessage] = yield walletAPI({
242
- method: 'sign_message',
236
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
237
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
238
+ const [signedMessage] = yield wallet.signMessage({
243
239
  auth_token: freshAuthToken,
244
- byteArrays: [message],
240
+ payloads: [message],
245
241
  });
246
242
  const signature = signedMessage.slice(-SIGNATURE_LENGTH_IN_BYTES);
247
243
  return signature;
package/lib/esm/index.mjs CHANGED
@@ -59,7 +59,7 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
59
59
  }
60
60
  get publicKey() {
61
61
  if (this._publicKey == null && this._authorizationResult != null) {
62
- this._publicKey = new PublicKey(this._authorizationResult.publicKey);
62
+ this._publicKey = new PublicKey(this._authorizationResult.pub_key);
63
63
  }
64
64
  return this._publicKey ? this._publicKey : null;
65
65
  }
@@ -94,8 +94,8 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
94
94
  return;
95
95
  }
96
96
  try {
97
- yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
98
- const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield walletAPI({ method: 'authorize', identity: this._appIdentity });
97
+ yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
98
+ const { auth_token, pub_key: base58PublicKey, wallet_uri_base, } = yield wallet.authorize({ identity: this._appIdentity });
99
99
  try {
100
100
  this._publicKey = new PublicKey(base58PublicKey);
101
101
  }
@@ -103,9 +103,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
103
103
  throw new WalletPublicKeyError((e instanceof Error && (e === null || e === void 0 ? void 0 : e.message)) || 'Unknown error', e);
104
104
  }
105
105
  this.handleAuthorizationResult({
106
- authToken: auth_token,
107
- publicKey: base58PublicKey,
108
- walletUriBase: wallet_uri_base,
106
+ auth_token,
107
+ pub_key: base58PublicKey,
108
+ wallet_uri_base: wallet_uri_base,
109
109
  }); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
110
110
  this.emit('connect',
111
111
  // Having just set an `authorizationResult`, `this.publicKey` is definitely non-null
@@ -127,15 +127,14 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
127
127
  yield this._authorizationResultCache.set(authorizationResult);
128
128
  });
129
129
  }
130
- performReauthorization(walletAPI, currentAuthorizationResult) {
130
+ performReauthorization(wallet, currentAuthorizationResult) {
131
131
  return __awaiter(this, void 0, void 0, function* () {
132
132
  try {
133
- const { auth_token } = yield walletAPI({
134
- method: 'reauthorize',
135
- auth_token: currentAuthorizationResult.authToken,
133
+ const { auth_token } = yield wallet.reauthorize({
134
+ auth_token: currentAuthorizationResult.auth_token,
136
135
  });
137
- if (currentAuthorizationResult.authToken !== auth_token) {
138
- this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { authToken: auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
136
+ if (currentAuthorizationResult.auth_token !== auth_token) {
137
+ this.handleAuthorizationResult(Object.assign(Object.assign({}, currentAuthorizationResult), { auth_token })); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
139
138
  }
140
139
  return auth_token;
141
140
  }
@@ -156,7 +155,7 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
156
155
  transact(callback) {
157
156
  var _a;
158
157
  return __awaiter(this, void 0, void 0, function* () {
159
- const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.walletUriBase;
158
+ const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
160
159
  const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
161
160
  return yield transact(callback, config);
162
161
  });
@@ -172,10 +171,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
172
171
  try {
173
172
  const authorizationResult = this.assertIsAuthorized();
174
173
  try {
175
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
176
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
177
- const signedTransactions = yield walletAPI({
178
- method: 'sign_transaction',
174
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
175
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
176
+ const signedTransactions = yield wallet.signTransaction({
179
177
  auth_token: freshAuthToken,
180
178
  transactions,
181
179
  });
@@ -197,10 +195,9 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
197
195
  try {
198
196
  const authorizationResult = this.assertIsAuthorized();
199
197
  try {
200
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
201
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
202
- const signatures = yield walletAPI({
203
- method: 'sign_and_send_transaction',
198
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
199
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
200
+ const signatures = yield wallet.signAndSendTransaction({
204
201
  auth_token: freshAuthToken,
205
202
  fee_payer: this.publicKey || undefined,
206
203
  connection,
@@ -236,12 +233,11 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
236
233
  try {
237
234
  const authorizationResult = this.assertIsAuthorized();
238
235
  try {
239
- return yield this.transact((walletAPI) => __awaiter(this, void 0, void 0, function* () {
240
- const freshAuthToken = yield this.performReauthorization(walletAPI, authorizationResult);
241
- const [signedMessage] = yield walletAPI({
242
- method: 'sign_message',
236
+ return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
237
+ const freshAuthToken = yield this.performReauthorization(wallet, authorizationResult);
238
+ const [signedMessage] = yield wallet.signMessage({
243
239
  auth_token: freshAuthToken,
244
- byteArrays: [message],
240
+ payloads: [message],
245
241
  });
246
242
  const signature = signedMessage.slice(-SIGNATURE_LENGTH_IN_BYTES);
247
243
  return signature;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solana-mobile/wallet-adapter-mobile",
3
3
  "description": "An adapter for mobile wallet apps that conform to the Solana Mobile Wallet Adapter protocol",
4
- "version": "0.0.1-alpha.3",
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",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@react-native-async-storage/async-storage": "^1.17.7",
44
- "@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^0.0.1-alpha.3",
44
+ "@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^0.0.1-alpha.6",
45
45
  "@solana/wallet-adapter-base": "^0.9.8",
46
46
  "@solana/web3.js": "^1.20.0"
47
47
  },
@@ -49,5 +49,5 @@
49
49
  "agadoo": "^2.0.0",
50
50
  "shx": "^0.3.4"
51
51
  },
52
- "gitHead": "33b0d8a9bdac3960a95bde4012b66a2ee0f02695"
52
+ "gitHead": "8cef0e0dd72e01cd522b16b6e486a26abe1e032b"
53
53
  }