@solana-mobile/wallet-adapter-mobile 0.0.1-alpha.4 → 0.0.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  }
@@ -131,11 +131,10 @@ 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',
137
+ const { auth_token } = yield wallet.reauthorize({
139
138
  auth_token: currentAuthorizationResult.auth_token,
140
139
  });
141
140
  if (currentAuthorizationResult.auth_token !== auth_token) {
@@ -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
@@ -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
  }
@@ -131,11 +131,10 @@ 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',
137
+ const { auth_token } = yield wallet.reauthorize({
139
138
  auth_token: currentAuthorizationResult.auth_token,
140
139
  });
141
140
  if (currentAuthorizationResult.auth_token !== auth_token) {
@@ -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;
@@ -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
  }
@@ -134,11 +134,10 @@ 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',
140
+ const { auth_token } = yield wallet.reauthorize({
142
141
  auth_token: currentAuthorizationResult.auth_token,
143
142
  });
144
143
  if (currentAuthorizationResult.auth_token !== auth_token) {
@@ -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;
@@ -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
  }
@@ -127,11 +127,10 @@ 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',
133
+ const { auth_token } = yield wallet.reauthorize({
135
134
  auth_token: currentAuthorizationResult.auth_token,
136
135
  });
137
136
  if (currentAuthorizationResult.auth_token !== auth_token) {
@@ -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
@@ -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
  }
@@ -127,11 +127,10 @@ 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',
133
+ const { auth_token } = yield wallet.reauthorize({
135
134
  auth_token: currentAuthorizationResult.auth_token,
136
135
  });
137
136
  if (currentAuthorizationResult.auth_token !== auth_token) {
@@ -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.4",
4
+ "version": "0.0.1-alpha.7",
5
5
  "author": "Steven Luscher <steven.luscher@solanamobile.com>",
6
6
  "repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
7
7
  "license": "Apache-2.0",
@@ -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.4",
44
+ "@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^0.0.1-alpha.7",
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": "d8a5244c5535b02f3dcf8144554a474ddac43f32"
52
+ "gitHead": "3af26689f4dddaa208fc32ea9c7cf4046c767c78"
53
53
  }