@solana-mobile/wallet-adapter-mobile 0.9.4 → 0.9.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 +19 -7
- package/lib/cjs/index.browser.js +105 -53
- package/lib/cjs/index.js +105 -53
- package/lib/cjs/index.native.js +99 -47
- package/lib/esm/index.browser.mjs +105 -54
- package/lib/esm/index.mjs +105 -54
- package/lib/types/index.browser.d.mts +10 -1
- package/lib/types/index.browser.d.mts.map +1 -1
- package/lib/types/index.browser.d.ts +10 -1
- package/lib/types/index.browser.d.ts.map +1 -1
- package/lib/types/index.d.mts +10 -1
- package/lib/types/index.d.mts.map +1 -1
- package/lib/types/index.d.ts +10 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.native.d.ts +10 -1
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +3 -3
package/lib/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { transact } from '@solana-mobile/mobile-wallet-adapter-protocol-web3js';
|
|
1
2
|
import { BaseMessageSignerWalletAdapter, WalletReadyState, WalletPublicKeyError, WalletNotReadyError, WalletConnectionError, WalletDisconnectedError, WalletNotConnectedError, WalletSignTransactionError, WalletSendTransactionError, WalletSignMessageError } from '@solana/wallet-adapter-base';
|
|
2
3
|
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { transact } from '@solana-mobile/mobile-wallet-adapter-protocol-web3js';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -27,13 +27,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function getIsSupported() {
|
|
31
|
-
return (typeof window !== 'undefined' &&
|
|
32
|
-
window.isSecureContext &&
|
|
33
|
-
typeof document !== 'undefined' &&
|
|
34
|
-
/android/i.test(navigator.userAgent));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
30
|
function toUint8Array(base64EncodedByteArray) {
|
|
38
31
|
return new Uint8Array(window
|
|
39
32
|
.atob(base64EncodedByteArray)
|
|
@@ -41,12 +34,22 @@ function toUint8Array(base64EncodedByteArray) {
|
|
|
41
34
|
.map((c) => c.charCodeAt(0)));
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
function getIsSupported() {
|
|
38
|
+
return (typeof window !== 'undefined' &&
|
|
39
|
+
window.isSecureContext &&
|
|
40
|
+
typeof document !== 'undefined' &&
|
|
41
|
+
/android/i.test(navigator.userAgent));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SolanaMobileWalletAdapterWalletName = 'Mobile Wallet Adapter';
|
|
45
45
|
const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
46
46
|
function getPublicKeyFromAddress(address) {
|
|
47
47
|
const publicKeyByteArray = toUint8Array(address);
|
|
48
48
|
return new PublicKey(publicKeyByteArray);
|
|
49
49
|
}
|
|
50
|
+
function isVersionedTransaction(transaction) {
|
|
51
|
+
return 'version' in transaction;
|
|
52
|
+
}
|
|
50
53
|
class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
51
54
|
constructor(config) {
|
|
52
55
|
super();
|
|
@@ -54,14 +57,21 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
54
57
|
// FIXME(#244): We can't actually know what versions are supported until we know which wallet we're talking to.
|
|
55
58
|
['legacy', 0]);
|
|
56
59
|
this.name = SolanaMobileWalletAdapterWalletName;
|
|
57
|
-
this.url = 'https://solanamobile.com';
|
|
60
|
+
this.url = 'https://solanamobile.com/wallets';
|
|
58
61
|
this.icon = 'data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI4IiB3aWR0aD0iMjgiIHZpZXdCb3g9Ii0zIDAgMjggMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI0RDQjhGRiI+PHBhdGggZD0iTTE3LjQgMTcuNEgxNXYyLjRoMi40di0yLjRabTEuMi05LjZoLTIuNHYyLjRoMi40VjcuOFoiLz48cGF0aCBkPSJNMjEuNiAzVjBoLTIuNHYzaC0zLjZWMGgtMi40djNoLTIuNHY2LjZINC41YTIuMSAyLjEgMCAxIDEgMC00LjJoMi43VjNINC41QTQuNSA0LjUgMCAwIDAgMCA3LjVWMjRoMjEuNnYtNi42aC0yLjR2NC4ySDIuNFYxMS41Yy41LjMgMS4yLjQgMS44LjVoNy41QTYuNiA2LjYgMCAwIDAgMjQgOVYzaC0yLjRabTAgNS43YTQuMiA0LjIgMCAxIDEtOC40IDBWNS40aDguNHYzLjNaIi8+PC9nPjwvc3ZnPg==';
|
|
59
62
|
this._connecting = false;
|
|
63
|
+
/**
|
|
64
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
65
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
66
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
67
|
+
*/
|
|
68
|
+
this._connectionGeneration = 0;
|
|
60
69
|
this._readyState = getIsSupported() ? WalletReadyState.Loadable : WalletReadyState.Unsupported;
|
|
61
70
|
this._authorizationResultCache = config.authorizationResultCache;
|
|
62
71
|
this._addressSelector = config.addressSelector;
|
|
63
72
|
this._appIdentity = config.appIdentity;
|
|
64
73
|
this._cluster = config.cluster;
|
|
74
|
+
this._onWalletNotFound = config.onWalletNotFound;
|
|
65
75
|
if (this._readyState !== WalletReadyState.Unsupported) {
|
|
66
76
|
this._authorizationResultCache.get().then((authorizationResult) => {
|
|
67
77
|
if (authorizationResult) {
|
|
@@ -219,6 +229,8 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
219
229
|
disconnect() {
|
|
220
230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
221
231
|
this._authorizationResultCache.clear(); // TODO: Evaluate whether there's any threat to not `awaiting` this expression
|
|
232
|
+
this._connecting = false;
|
|
233
|
+
this._connectionGeneration++;
|
|
222
234
|
delete this._authorizationResult;
|
|
223
235
|
delete this._publicKey;
|
|
224
236
|
delete this._selectedAddress;
|
|
@@ -230,7 +242,21 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
230
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
243
|
const walletUriBase = (_a = this._authorizationResult) === null || _a === void 0 ? void 0 : _a.wallet_uri_base;
|
|
232
244
|
const config = walletUriBase ? { baseUri: walletUriBase } : undefined;
|
|
233
|
-
|
|
245
|
+
const currentConnectionGeneration = this._connectionGeneration;
|
|
246
|
+
try {
|
|
247
|
+
return yield transact(callback, config);
|
|
248
|
+
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
if (this._connectionGeneration !== currentConnectionGeneration) {
|
|
251
|
+
yield new Promise(() => { }); // Never resolve.
|
|
252
|
+
}
|
|
253
|
+
if (e instanceof Error &&
|
|
254
|
+
e.name === 'SolanaMobileWalletAdapterError' &&
|
|
255
|
+
e.code === 'ERROR_WALLET_NOT_FOUND') {
|
|
256
|
+
yield this._onWalletNotFound(this);
|
|
257
|
+
}
|
|
258
|
+
throw e;
|
|
259
|
+
}
|
|
234
260
|
});
|
|
235
261
|
}
|
|
236
262
|
assertIsAuthorized() {
|
|
@@ -265,9 +291,43 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
265
291
|
const minContextSlot = options === null || options === void 0 ? void 0 : options.minContextSlot;
|
|
266
292
|
try {
|
|
267
293
|
return yield this.transact((wallet) => __awaiter(this, void 0, void 0, function* () {
|
|
268
|
-
|
|
294
|
+
function getTargetCommitment() {
|
|
295
|
+
let targetCommitment;
|
|
296
|
+
switch (connection.commitment) {
|
|
297
|
+
case 'confirmed':
|
|
298
|
+
case 'finalized':
|
|
299
|
+
case 'processed':
|
|
300
|
+
targetCommitment = connection.commitment;
|
|
301
|
+
break;
|
|
302
|
+
default:
|
|
303
|
+
targetCommitment = 'finalized';
|
|
304
|
+
}
|
|
305
|
+
let targetPreflightCommitment;
|
|
306
|
+
switch (options === null || options === void 0 ? void 0 : options.preflightCommitment) {
|
|
307
|
+
case 'confirmed':
|
|
308
|
+
case 'finalized':
|
|
309
|
+
case 'processed':
|
|
310
|
+
targetPreflightCommitment = options.preflightCommitment;
|
|
311
|
+
break;
|
|
312
|
+
case undefined:
|
|
313
|
+
targetPreflightCommitment = targetCommitment;
|
|
314
|
+
default:
|
|
315
|
+
targetPreflightCommitment = 'finalized';
|
|
316
|
+
}
|
|
317
|
+
const preflightCommitmentScore = targetPreflightCommitment === 'finalized'
|
|
318
|
+
? 2
|
|
319
|
+
: targetPreflightCommitment === 'confirmed'
|
|
320
|
+
? 1
|
|
321
|
+
: 0;
|
|
322
|
+
const targetCommitmentScore = targetCommitment === 'finalized' ? 2 : targetCommitment === 'confirmed' ? 1 : 0;
|
|
323
|
+
return preflightCommitmentScore < targetCommitmentScore
|
|
324
|
+
? targetPreflightCommitment
|
|
325
|
+
: targetCommitment;
|
|
326
|
+
}
|
|
327
|
+
const [capabilities, _1, _2] = yield Promise.all([
|
|
328
|
+
wallet.getCapabilities(),
|
|
269
329
|
this.performReauthorization(wallet, authToken),
|
|
270
|
-
|
|
330
|
+
isVersionedTransaction(transaction)
|
|
271
331
|
? null
|
|
272
332
|
: /**
|
|
273
333
|
* Unlike versioned transactions, legacy `Transaction` objects
|
|
@@ -278,52 +338,32 @@ class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
278
338
|
var _a;
|
|
279
339
|
transaction.feePayer || (transaction.feePayer = (_a = this.publicKey) !== null && _a !== void 0 ? _a : undefined);
|
|
280
340
|
if (transaction.recentBlockhash == null) {
|
|
281
|
-
let targetCommitment;
|
|
282
|
-
switch (connection.commitment) {
|
|
283
|
-
case 'confirmed':
|
|
284
|
-
case 'finalized':
|
|
285
|
-
case 'processed':
|
|
286
|
-
targetCommitment = connection.commitment;
|
|
287
|
-
break;
|
|
288
|
-
default:
|
|
289
|
-
targetCommitment = 'finalized';
|
|
290
|
-
}
|
|
291
|
-
let targetPreflightCommitment;
|
|
292
|
-
switch (options === null || options === void 0 ? void 0 : options.preflightCommitment) {
|
|
293
|
-
case 'confirmed':
|
|
294
|
-
case 'finalized':
|
|
295
|
-
case 'processed':
|
|
296
|
-
targetPreflightCommitment = options.preflightCommitment;
|
|
297
|
-
break;
|
|
298
|
-
case undefined:
|
|
299
|
-
targetPreflightCommitment = targetCommitment;
|
|
300
|
-
default:
|
|
301
|
-
targetPreflightCommitment = 'finalized';
|
|
302
|
-
}
|
|
303
|
-
const preflightCommitmentScore = targetPreflightCommitment === 'finalized'
|
|
304
|
-
? 2
|
|
305
|
-
: targetPreflightCommitment === 'confirmed'
|
|
306
|
-
? 1
|
|
307
|
-
: 0;
|
|
308
|
-
const targetCommitmentScore = targetCommitment === 'finalized'
|
|
309
|
-
? 2
|
|
310
|
-
: targetCommitment === 'confirmed'
|
|
311
|
-
? 1
|
|
312
|
-
: 0;
|
|
313
341
|
const { blockhash } = yield connection.getLatestBlockhash({
|
|
314
|
-
commitment:
|
|
315
|
-
? targetPreflightCommitment
|
|
316
|
-
: targetCommitment,
|
|
342
|
+
commitment: getTargetCommitment(),
|
|
317
343
|
});
|
|
318
344
|
transaction.recentBlockhash = blockhash;
|
|
319
345
|
}
|
|
320
346
|
}))(),
|
|
321
347
|
]);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
348
|
+
if (capabilities.supports_sign_and_send_transactions) {
|
|
349
|
+
const signatures = yield wallet.signAndSendTransactions({
|
|
350
|
+
minContextSlot,
|
|
351
|
+
transactions: [transaction],
|
|
352
|
+
});
|
|
353
|
+
return signatures[0];
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
const [signedTransaction] = yield wallet.signTransactions({
|
|
357
|
+
transactions: [transaction],
|
|
358
|
+
});
|
|
359
|
+
if (isVersionedTransaction(signedTransaction)) {
|
|
360
|
+
return yield connection.sendTransaction(signedTransaction);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
const serializedTransaction = signedTransaction.serialize();
|
|
364
|
+
return yield connection.sendRawTransaction(serializedTransaction, Object.assign(Object.assign({}, options), { preflightCommitment: getTargetCommitment() }));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
327
367
|
}));
|
|
328
368
|
}
|
|
329
369
|
catch (error) {
|
|
@@ -429,4 +469,15 @@ function createDefaultAuthorizationResultCache() {
|
|
|
429
469
|
};
|
|
430
470
|
}
|
|
431
471
|
|
|
432
|
-
|
|
472
|
+
function defaultWalletNotFoundHandler(mobileWalletAdapter) {
|
|
473
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
474
|
+
if (typeof window !== 'undefined') {
|
|
475
|
+
window.location.assign(mobileWalletAdapter.url);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function createDefaultWalletNotFoundHandler() {
|
|
480
|
+
return defaultWalletNotFoundHandler;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export { SolanaMobileWalletAdapter, SolanaMobileWalletAdapterWalletName, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
@@ -21,7 +21,14 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
21
21
|
private _authorizationResult;
|
|
22
22
|
private _authorizationResultCache;
|
|
23
23
|
private _connecting;
|
|
24
|
+
/**
|
|
25
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
26
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
27
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
28
|
+
*/
|
|
29
|
+
private _connectionGeneration;
|
|
24
30
|
private _cluster;
|
|
31
|
+
private _onWalletNotFound;
|
|
25
32
|
private _publicKey;
|
|
26
33
|
private _readyState;
|
|
27
34
|
private _selectedAddress;
|
|
@@ -30,6 +37,7 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
30
37
|
appIdentity: AppIdentity;
|
|
31
38
|
authorizationResultCache: AuthorizationResultCache;
|
|
32
39
|
cluster: Cluster;
|
|
40
|
+
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
33
41
|
});
|
|
34
42
|
get publicKey(): PublicKey | null;
|
|
35
43
|
get connected(): boolean;
|
|
@@ -52,5 +60,6 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
52
60
|
}
|
|
53
61
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
54
62
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
55
|
-
|
|
63
|
+
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
64
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
56
65
|
//# sourceMappingURL=index.browser.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.browser.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
|
@@ -21,7 +21,14 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
21
21
|
private _authorizationResult;
|
|
22
22
|
private _authorizationResultCache;
|
|
23
23
|
private _connecting;
|
|
24
|
+
/**
|
|
25
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
26
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
27
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
28
|
+
*/
|
|
29
|
+
private _connectionGeneration;
|
|
24
30
|
private _cluster;
|
|
31
|
+
private _onWalletNotFound;
|
|
25
32
|
private _publicKey;
|
|
26
33
|
private _readyState;
|
|
27
34
|
private _selectedAddress;
|
|
@@ -30,6 +37,7 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
30
37
|
appIdentity: AppIdentity;
|
|
31
38
|
authorizationResultCache: AuthorizationResultCache;
|
|
32
39
|
cluster: Cluster;
|
|
40
|
+
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
33
41
|
});
|
|
34
42
|
get publicKey(): PublicKey | null;
|
|
35
43
|
get connected(): boolean;
|
|
@@ -52,5 +60,6 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
52
60
|
}
|
|
53
61
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
54
62
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
55
|
-
|
|
63
|
+
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
64
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
56
65
|
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
package/lib/types/index.d.mts
CHANGED
|
@@ -21,7 +21,14 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
21
21
|
private _authorizationResult;
|
|
22
22
|
private _authorizationResultCache;
|
|
23
23
|
private _connecting;
|
|
24
|
+
/**
|
|
25
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
26
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
27
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
28
|
+
*/
|
|
29
|
+
private _connectionGeneration;
|
|
24
30
|
private _cluster;
|
|
31
|
+
private _onWalletNotFound;
|
|
25
32
|
private _publicKey;
|
|
26
33
|
private _readyState;
|
|
27
34
|
private _selectedAddress;
|
|
@@ -30,6 +37,7 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
30
37
|
appIdentity: AppIdentity;
|
|
31
38
|
authorizationResultCache: AuthorizationResultCache;
|
|
32
39
|
cluster: Cluster;
|
|
40
|
+
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
33
41
|
});
|
|
34
42
|
get publicKey(): PublicKey | null;
|
|
35
43
|
get connected(): boolean;
|
|
@@ -52,5 +60,6 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
52
60
|
}
|
|
53
61
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
54
62
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
55
|
-
|
|
63
|
+
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
64
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
56
65
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -21,7 +21,14 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
21
21
|
private _authorizationResult;
|
|
22
22
|
private _authorizationResultCache;
|
|
23
23
|
private _connecting;
|
|
24
|
+
/**
|
|
25
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
26
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
27
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
28
|
+
*/
|
|
29
|
+
private _connectionGeneration;
|
|
24
30
|
private _cluster;
|
|
31
|
+
private _onWalletNotFound;
|
|
25
32
|
private _publicKey;
|
|
26
33
|
private _readyState;
|
|
27
34
|
private _selectedAddress;
|
|
@@ -30,6 +37,7 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
30
37
|
appIdentity: AppIdentity;
|
|
31
38
|
authorizationResultCache: AuthorizationResultCache;
|
|
32
39
|
cluster: Cluster;
|
|
40
|
+
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
33
41
|
});
|
|
34
42
|
get publicKey(): PublicKey | null;
|
|
35
43
|
get connected(): boolean;
|
|
@@ -52,5 +60,6 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
52
60
|
}
|
|
53
61
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
54
62
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
55
|
-
|
|
63
|
+
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
64
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
56
65
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts"],"names":[],"mappings":""}
|
|
@@ -21,7 +21,14 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
21
21
|
private _authorizationResult;
|
|
22
22
|
private _authorizationResultCache;
|
|
23
23
|
private _connecting;
|
|
24
|
+
/**
|
|
25
|
+
* Every time the connection is recycled in some way (eg. `disconnect()` is called)
|
|
26
|
+
* increment this and use it to make sure that `transact` calls from the previous
|
|
27
|
+
* 'generation' don't continue to do work and throw exceptions.
|
|
28
|
+
*/
|
|
29
|
+
private _connectionGeneration;
|
|
24
30
|
private _cluster;
|
|
31
|
+
private _onWalletNotFound;
|
|
25
32
|
private _publicKey;
|
|
26
33
|
private _readyState;
|
|
27
34
|
private _selectedAddress;
|
|
@@ -30,6 +37,7 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
30
37
|
appIdentity: AppIdentity;
|
|
31
38
|
authorizationResultCache: AuthorizationResultCache;
|
|
32
39
|
cluster: Cluster;
|
|
40
|
+
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
33
41
|
});
|
|
34
42
|
get publicKey(): PublicKey | null;
|
|
35
43
|
get connected(): boolean;
|
|
@@ -52,5 +60,6 @@ declare class SolanaMobileWalletAdapter extends BaseMessageSignerWalletAdapter {
|
|
|
52
60
|
}
|
|
53
61
|
declare function createDefaultAddressSelector(): AddressSelector;
|
|
54
62
|
declare function createDefaultAuthorizationResultCache(): AuthorizationResultCache;
|
|
55
|
-
|
|
63
|
+
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapter) => Promise<void>;
|
|
64
|
+
export { AuthorizationResultCache, AddressSelector, SolanaMobileWalletAdapterWalletName, SolanaMobileWalletAdapter, createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler };
|
|
56
65
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/getIsSupported.ts","../../src/adapter.ts","../../src/createDefaultAddressSelector.ts","../../src/createDefaultAuthorizationResultCache.ts","../../src/createDefaultWalletNotFoundHandler.ts","../../src/__forks__/react-native/createDefaultAuthorizationResultCache.ts","../../src/__forks__/react-native/getIsSupported.ts"],"names":[],"mappings":""}
|
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.9.
|
|
4
|
+
"version": "0.9.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.9.
|
|
44
|
+
"@solana-mobile/mobile-wallet-adapter-protocol-web3js": "^0.9.6",
|
|
45
45
|
"@solana/wallet-adapter-base": "^0.9.17",
|
|
46
46
|
"js-base64": "^3.7.2"
|
|
47
47
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"cross-env": "^7.0.3",
|
|
52
52
|
"shx": "^0.3.4"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "a5baca70e3ab481bf85dbd29aac13b769e317045"
|
|
55
55
|
}
|