@bounded-sh/client 0.0.16 → 0.0.18
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 +2 -1
- package/dist/auth/index.d.ts +2 -4
- package/dist/auth/providers/phantom-wallet-provider.d.ts +3 -2
- package/dist/auth/providers/privy-wallet-provider.d.ts +10 -7
- package/dist/auth/providers/solana-mobile-wallet-provider.d.ts +3 -2
- package/dist/auth/solana-rpc.d.ts +8 -0
- package/dist/index.js +5597 -17488
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5419 -17330
- package/dist/index.mjs.map +1 -1
- package/dist/index.native-DahSrHrM.mjs +8117 -0
- package/dist/index.native-DahSrHrM.mjs.map +1 -0
- package/dist/index.native-Dr3FOz16.js +8179 -0
- package/dist/index.native-Dr3FOz16.js.map +1 -0
- package/dist/index.native.js +89 -68
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +4 -3
- package/dist/index.native.mjs.map +1 -1
- package/dist/{phantom-wallet-provider-MW2H0SFY.js → phantom-wallet-provider-CeLJEdcL.js} +23 -34
- package/dist/phantom-wallet-provider-CeLJEdcL.js.map +1 -0
- package/dist/{phantom-wallet-provider-DU4WPFPM.mjs → phantom-wallet-provider-l-CNnHPs.mjs} +8 -19
- package/dist/phantom-wallet-provider-l-CNnHPs.mjs.map +1 -0
- package/dist/{privy-wallet-provider-dFxuvDf4.js → privy-wallet-provider-BSwx78fY.js} +86 -107
- package/dist/privy-wallet-provider-BSwx78fY.js.map +1 -0
- package/dist/{privy-wallet-provider-D5Kdp3Qp.mjs → privy-wallet-provider-BWM8TNO9.mjs} +69 -90
- package/dist/privy-wallet-provider-BWM8TNO9.mjs.map +1 -0
- package/dist/{solana-mobile-wallet-provider-DAR0BLTQ.js → solana-mobile-wallet-provider-BvCrAgk8.js} +56 -42
- package/dist/solana-mobile-wallet-provider-BvCrAgk8.js.map +1 -0
- package/dist/{solana-mobile-wallet-provider-CLiflgPj.mjs → solana-mobile-wallet-provider-C78VWmM-.mjs} +40 -26
- package/dist/solana-mobile-wallet-provider-C78VWmM-.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/index.native-CAygEkU7.mjs +0 -20012
- package/dist/index.native-CAygEkU7.mjs.map +0 -1
- package/dist/index.native-zD2ZzCLO.js +0 -20137
- package/dist/index.native-zD2ZzCLO.js.map +0 -1
- package/dist/phantom-wallet-provider-DU4WPFPM.mjs.map +0 -1
- package/dist/phantom-wallet-provider-MW2H0SFY.js.map +0 -1
- package/dist/privy-wallet-provider-D5Kdp3Qp.mjs.map +0 -1
- package/dist/privy-wallet-provider-dFxuvDf4.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-CLiflgPj.mjs.map +0 -1
- package/dist/solana-mobile-wallet-provider-DAR0BLTQ.js.map +0 -1
package/dist/index.native.js
CHANGED
|
@@ -1,105 +1,126 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index_native = require('./index.native-
|
|
4
|
-
require('
|
|
3
|
+
var index_native = require('./index.native-Dr3FOz16.js');
|
|
4
|
+
var core = require('@bounded-sh/core');
|
|
5
5
|
require('@solana/web3.js');
|
|
6
|
-
require('@coral-xyz/anchor');
|
|
7
6
|
require('react');
|
|
7
|
+
require('@coral-xyz/anchor');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
exports.DEFAULT_TEST_ADDRESS = index_native.DEFAULT_TEST_ADDRESS;
|
|
12
|
-
exports.EFFECT_INTENT_ADDRESS = index_native.EFFECT_INTENT_ADDRESS;
|
|
13
|
-
exports.FunctionInvokeError = index_native.FunctionInvokeError;
|
|
14
|
-
exports.InsufficientBalanceError = index_native.InsufficientBalanceError;
|
|
15
|
-
exports.LiveIntentError = index_native.LiveIntentError;
|
|
16
12
|
exports.MockAuthProvider = index_native.MockAuthProvider;
|
|
17
13
|
exports.OffchainAuthProvider = index_native.OffchainAuthProvider;
|
|
18
14
|
exports.PrivyExpoProvider = index_native.PrivyExpoProvider;
|
|
19
|
-
exports.ReactNativeSessionManager = index_native.ReactNativeSessionManager;
|
|
20
|
-
exports.RealtimeStore = index_native.RealtimeStore;
|
|
21
|
-
exports.ServerSessionManager = index_native.ServerSessionManager;
|
|
22
|
-
exports.WebSessionManager = index_native.WebSessionManager;
|
|
23
|
-
exports.aggregate = index_native.aggregate;
|
|
24
|
-
exports.buildSetDocumentsTransaction = index_native.buildSetDocumentsTransaction;
|
|
25
|
-
exports.clearCache = index_native.clearCache;
|
|
26
|
-
exports.closeAllSubscriptions = index_native.closeAllSubscriptions;
|
|
27
15
|
exports.completeLoginFromRedirect = index_native.completeLoginFromRedirect;
|
|
28
16
|
exports.completeLoginInPopup = index_native.completeLoginInPopup;
|
|
29
|
-
exports.convertRemainingAccounts = index_native.convertRemainingAccounts;
|
|
30
|
-
exports.count = index_native.count;
|
|
31
|
-
exports.createSessionWithSignature = index_native.createSessionWithSignature;
|
|
32
|
-
exports.defineLiveModule = index_native.defineLiveModule;
|
|
33
|
-
exports.deriveUserIdentityFromIdToken = index_native.deriveUserIdentityFromIdToken;
|
|
34
17
|
exports.deserializeTransaction = index_native.deserializeTransaction;
|
|
35
|
-
exports.docId = index_native.docId;
|
|
36
|
-
exports.functions = index_native.functions;
|
|
37
|
-
exports.genAuthNonce = index_native.genAuthNonce;
|
|
38
|
-
exports.genSolanaMessage = index_native.genSolanaMessage;
|
|
39
|
-
exports.get = index_native.get;
|
|
40
|
-
exports.getActiveSessionManager = index_native.getActiveSessionManager;
|
|
41
18
|
exports.getAuthLoading = index_native.getAuthLoading;
|
|
42
19
|
exports.getAuthProvider = index_native.getAuthProvider;
|
|
43
|
-
exports.getCachedData = index_native.getCachedData;
|
|
44
|
-
exports.getConfig = index_native.getConfig;
|
|
45
20
|
exports.getCurrentUser = index_native.getCurrentUser;
|
|
46
|
-
exports.getFiles = index_native.getFiles;
|
|
47
21
|
exports.getIdToken = index_native.getIdToken;
|
|
48
|
-
exports.getMany = index_native.getMany;
|
|
49
22
|
exports.getPlatform = index_native.getPlatform;
|
|
50
|
-
exports.getRealtimeStore = index_native.getRealtimeStore;
|
|
51
|
-
exports.getWebhookKeysUrl = index_native.getWebhookKeysUrl;
|
|
52
|
-
exports.hasActiveConnection = index_native.hasActiveConnection;
|
|
53
|
-
exports.increment = index_native.increment;
|
|
54
23
|
exports.init = index_native.init;
|
|
55
|
-
exports.invokeFunction = index_native.invoke;
|
|
56
|
-
exports.isEffectResult = index_native.isEffectResult;
|
|
57
24
|
exports.linkEmail = index_native.linkEmail;
|
|
58
25
|
exports.linkWithRedirect = index_native.linkWithRedirect;
|
|
59
|
-
exports.live = index_native.live;
|
|
60
|
-
exports.liveIntent = index_native.intent;
|
|
61
|
-
exports.liveStatus = index_native.status;
|
|
62
26
|
exports.login = index_native.login;
|
|
63
27
|
exports.loginWithPopup = index_native.loginWithPopup;
|
|
64
28
|
exports.loginWithPrivy = index_native.loginWithPrivy;
|
|
65
29
|
exports.loginWithRedirect = index_native.loginWithRedirect;
|
|
66
30
|
exports.logout = index_native.logout;
|
|
67
|
-
exports.now = index_native.now;
|
|
68
31
|
exports.onAuthLoadingChanged = index_native.onAuthLoadingChanged;
|
|
69
32
|
exports.onAuthStateChanged = index_native.onAuthStateChanged;
|
|
70
|
-
exports.queryAggregate = index_native.queryAggregate;
|
|
71
|
-
exports.reconnectWithNewAuth = index_native.reconnectWithNewAuth;
|
|
72
|
-
exports.refreshSession = index_native.refreshSession;
|
|
73
|
-
exports.resetRealtimeStore = index_native.resetRealtimeStore;
|
|
74
|
-
exports.revokeSession = index_native.revokeSession;
|
|
75
|
-
exports.runExpression = index_native.runExpression;
|
|
76
|
-
exports.runExpressionMany = index_native.runExpressionMany;
|
|
77
|
-
exports.runQuery = index_native.runQuery;
|
|
78
|
-
exports.runQueryMany = index_native.runQueryMany;
|
|
79
|
-
exports.search = index_native.search;
|
|
80
33
|
exports.sendEmailOtp = index_native.sendEmailOtp;
|
|
81
34
|
exports.sendTextOtp = index_native.sendTextOtp;
|
|
82
|
-
exports.serverTimestamp = index_native.serverTimestamp;
|
|
83
|
-
exports.set = index_native.set;
|
|
84
|
-
exports.setFile = index_native.setFile;
|
|
85
|
-
exports.setMany = index_native.setMany;
|
|
86
35
|
exports.setPlatform = index_native.setPlatform;
|
|
87
|
-
exports.signAndSubmitTransaction = index_native.signAndSubmitTransaction;
|
|
88
36
|
exports.signInAnonymously = index_native.signInAnonymously;
|
|
89
|
-
exports.signMessage = index_native.signMessage;
|
|
90
|
-
exports.signSessionCreateMessage = index_native.signSessionCreateMessage;
|
|
91
|
-
exports.signTransaction = index_native.signTransaction;
|
|
92
|
-
exports.subscribe = index_native.subscribe;
|
|
93
|
-
exports.subscribeLiveView = index_native.subscribeView;
|
|
94
|
-
exports.toMillis = index_native.toMillis;
|
|
95
|
-
exports.toSeconds = index_native.toSeconds;
|
|
96
37
|
exports.useAuth = index_native.useAuth;
|
|
97
38
|
exports.verifyEmailOtp = index_native.verifyEmailOtp;
|
|
98
39
|
exports.verifyTextOtp = index_native.verifyTextOtp;
|
|
99
|
-
exports
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
exports
|
|
104
|
-
|
|
40
|
+
Object.defineProperty(exports, "aggregate", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return core.aggregate; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "count", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return core.count; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "docId", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return core.docId; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "get", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return core.get; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "getConfig", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return core.getConfig; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "getFiles", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return core.getFiles; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "getMany", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return core.getMany; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "queryAggregate", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return core.queryAggregate; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "runExpression", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return core.runExpression; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "runExpressionMany", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return core.runExpressionMany; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "runQuery", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return core.runQuery; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "runQueryMany", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return core.runQueryMany; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "search", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return core.search; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "set", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return core.set; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "setFile", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return core.setFile; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "setMany", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return core.setMany; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "signAndSubmitTransaction", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return core.signAndSubmitTransaction; }
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "signMessage", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () { return core.signMessage; }
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, "signTransaction", {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () { return core.signTransaction; }
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "subscribe", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () { return core.subscribe; }
|
|
119
|
+
});
|
|
120
|
+
Object.keys(core).forEach(function (k) {
|
|
121
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () { return core[k]; }
|
|
124
|
+
});
|
|
125
|
+
});
|
|
105
126
|
//# sourceMappingURL=index.native.js.map
|
package/dist/index.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.native.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export { J as DEFAULT_TEST_ADDRESS, M as MockAuthProvider, O as OffchainAuthProvider, P as PrivyExpoProvider, C as completeLoginFromRedirect, E as completeLoginInPopup, G as deserializeTransaction, l as getAuthLoading, q as getAuthProvider, j as getCurrentUser, H as getIdToken, g as getPlatform, i as init, y as linkEmail, B as linkWithRedirect, m as login, D as loginWithPopup, z as loginWithPrivy, A as loginWithRedirect, p as logout, k as onAuthLoadingChanged, o as onAuthStateChanged, u as sendEmailOtp, v as sendTextOtp, I as setPlatform, t as signInAnonymously, F as useAuth, w as verifyEmailOtp, x as verifyTextOtp } from './index.native-DahSrHrM.mjs';
|
|
2
|
+
export * from '@bounded-sh/core';
|
|
3
|
+
export { aggregate, count, docId, get, getConfig, getFiles, getMany, queryAggregate, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe } from '@bounded-sh/core';
|
|
3
4
|
import '@solana/web3.js';
|
|
4
|
-
import '@coral-xyz/anchor';
|
|
5
5
|
import 'react';
|
|
6
|
+
import '@coral-xyz/anchor';
|
|
6
7
|
//# sourceMappingURL=index.native.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.native.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index_native = require('./index.native-
|
|
3
|
+
var index_native = require('./index.native-Dr3FOz16.js');
|
|
4
|
+
var core = require('@bounded-sh/core');
|
|
4
5
|
var web3_js = require('@solana/web3.js');
|
|
5
6
|
var anchor = require('@coral-xyz/anchor');
|
|
6
|
-
require('axios');
|
|
7
7
|
require('react');
|
|
8
8
|
|
|
9
9
|
function _interopNamespaceDefault(e) {
|
|
@@ -109,7 +109,7 @@ class PhantomWalletProvider {
|
|
|
109
109
|
setLoginOverrides(opts) {
|
|
110
110
|
this.loginOverrides = opts;
|
|
111
111
|
}
|
|
112
|
-
constructor(networkUrl = null, config = {}) {
|
|
112
|
+
constructor(networkUrl = null, config = {}, configuredNetwork = null) {
|
|
113
113
|
this.containerElement = null;
|
|
114
114
|
this.root = null;
|
|
115
115
|
this.phantomMethods = null;
|
|
@@ -122,6 +122,7 @@ class PhantomWalletProvider {
|
|
|
122
122
|
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
123
123
|
this.onSwitchToMWA = null;
|
|
124
124
|
this.networkUrl = networkUrl;
|
|
125
|
+
this.configuredNetwork = configuredNetwork;
|
|
125
126
|
this.config = config;
|
|
126
127
|
if (typeof window === 'undefined') {
|
|
127
128
|
throw new Error('PhantomWalletProvider can only be instantiated in a browser environment');
|
|
@@ -148,9 +149,9 @@ class PhantomWalletProvider {
|
|
|
148
149
|
hasSocialProviders() {
|
|
149
150
|
return this.resolvedProviders.some(p => p !== 'injected');
|
|
150
151
|
}
|
|
151
|
-
static getInstance(networkUrl, config) {
|
|
152
|
+
static getInstance(networkUrl, config, configuredNetwork = null) {
|
|
152
153
|
if (!PhantomWalletProvider.instance) {
|
|
153
|
-
new PhantomWalletProvider(networkUrl, config);
|
|
154
|
+
new PhantomWalletProvider(networkUrl, config, configuredNetwork);
|
|
154
155
|
}
|
|
155
156
|
return PhantomWalletProvider.instance;
|
|
156
157
|
}
|
|
@@ -313,7 +314,7 @@ class PhantomWalletProvider {
|
|
|
313
314
|
}
|
|
314
315
|
const publicKey = solAddress.address;
|
|
315
316
|
// Check if we already have a valid session for this address
|
|
316
|
-
const existingSession = await
|
|
317
|
+
const existingSession = await core.WebSessionManager.getSession();
|
|
317
318
|
if (existingSession && existingSession.address === publicKey) {
|
|
318
319
|
// Already have a valid session, just set user
|
|
319
320
|
index_native.setCurrentUser({ provider: that, address: publicKey });
|
|
@@ -323,14 +324,14 @@ class PhantomWalletProvider {
|
|
|
323
324
|
that.autoLoginInProgress = true;
|
|
324
325
|
index_native.setAuthLoading(true);
|
|
325
326
|
try {
|
|
326
|
-
const nonce = await
|
|
327
|
-
const messageText = await
|
|
327
|
+
const nonce = await core.genAuthNonce();
|
|
328
|
+
const messageText = await core.genSolanaMessage(publicKey, nonce);
|
|
328
329
|
// signMessage returns { signature: Uint8Array, publicKey: string }
|
|
329
330
|
const signResult = await solana.signMessage(messageText);
|
|
330
331
|
// Convert Uint8Array signature to base64 string
|
|
331
332
|
const signatureBytes = signResult.signature;
|
|
332
333
|
const signature = index_native.bufferExports.Buffer.from(signatureBytes).toString('base64');
|
|
333
|
-
const createSessionResult = await
|
|
334
|
+
const createSessionResult = await core.createSessionWithSignature(publicKey, messageText, signature);
|
|
334
335
|
// Pre-write guard: MWA may have started a login while we were
|
|
335
336
|
// in flight. If MWA owns the auth method now, abort before we
|
|
336
337
|
// overwrite its session (or its in-flight session).
|
|
@@ -340,7 +341,7 @@ class PhantomWalletProvider {
|
|
|
340
341
|
}
|
|
341
342
|
}
|
|
342
343
|
catch (_c) { }
|
|
343
|
-
await
|
|
344
|
+
await core.WebSessionManager.storeSession(publicKey, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);
|
|
344
345
|
// Mark auth method so clearIncompatibleSession() doesn't wipe this session
|
|
345
346
|
try {
|
|
346
347
|
index_native.getPlatform().storage.setItem('bounded_last_auth_method', 'phantom');
|
|
@@ -421,7 +422,7 @@ class PhantomWalletProvider {
|
|
|
421
422
|
}
|
|
422
423
|
const publicKey = solAddress.address;
|
|
423
424
|
// Check if we already have a valid session
|
|
424
|
-
const existingSession = await
|
|
425
|
+
const existingSession = await core.WebSessionManager.getSession();
|
|
425
426
|
if (existingSession && existingSession.address === publicKey) {
|
|
426
427
|
const user = { provider: that, address: publicKey };
|
|
427
428
|
index_native.setCurrentUser(user);
|
|
@@ -430,15 +431,15 @@ class PhantomWalletProvider {
|
|
|
430
431
|
return;
|
|
431
432
|
}
|
|
432
433
|
// Create new session with signature
|
|
433
|
-
const nonce = await
|
|
434
|
-
const messageText = await
|
|
434
|
+
const nonce = await core.genAuthNonce();
|
|
435
|
+
const messageText = await core.genSolanaMessage(publicKey, nonce);
|
|
435
436
|
// signMessage returns { signature: Uint8Array, publicKey: string }
|
|
436
437
|
const signResult = await solana.signMessage(messageText);
|
|
437
438
|
// Convert Uint8Array signature to base64 string
|
|
438
439
|
const signatureBytes = signResult.signature;
|
|
439
440
|
const signature = index_native.bufferExports.Buffer.from(signatureBytes).toString('base64');
|
|
440
|
-
const createSessionResult = await
|
|
441
|
-
await
|
|
441
|
+
const createSessionResult = await core.createSessionWithSignature(publicKey, messageText, signature);
|
|
442
|
+
await core.WebSessionManager.storeSession(publicKey, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);
|
|
442
443
|
// Mark auth method so clearIncompatibleSession() doesn't wipe this session
|
|
443
444
|
try {
|
|
444
445
|
index_native.getPlatform().storage.setItem('bounded_last_auth_method', 'phantom');
|
|
@@ -919,7 +920,7 @@ class PhantomWalletProvider {
|
|
|
919
920
|
if (((_a = this.phantomMethods) === null || _a === void 0 ? void 0 : _a.isConnected) && ((_b = this.phantomMethods.addresses) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
920
921
|
const solAddress = this.phantomMethods.addresses.find((addr) => addr.addressType === phantomReactSdk.AddressType.solana);
|
|
921
922
|
if (solAddress) {
|
|
922
|
-
const session = await
|
|
923
|
+
const session = await core.WebSessionManager.getSession();
|
|
923
924
|
if (session && session.address === solAddress.address) {
|
|
924
925
|
const user = { provider: this, address: solAddress.address };
|
|
925
926
|
index_native.setCurrentUser(user);
|
|
@@ -954,7 +955,7 @@ class PhantomWalletProvider {
|
|
|
954
955
|
}
|
|
955
956
|
async restoreSession() {
|
|
956
957
|
await this.ensureReady();
|
|
957
|
-
const session = await
|
|
958
|
+
const session = await core.WebSessionManager.getSession();
|
|
958
959
|
if (session) {
|
|
959
960
|
return { provider: this, address: session.address };
|
|
960
961
|
}
|
|
@@ -1054,7 +1055,7 @@ class PhantomWalletProvider {
|
|
|
1054
1055
|
const connection = new web3_js.Connection(rpcUrl, 'confirmed');
|
|
1055
1056
|
const isSurfnet = rpcUrl === index_native.SURFNET_RPC_URL;
|
|
1056
1057
|
try {
|
|
1057
|
-
const remainingAccounts =
|
|
1058
|
+
const remainingAccounts = core.convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
|
|
1058
1059
|
const app_id = solTransactionData.appId;
|
|
1059
1060
|
if (!app_id) {
|
|
1060
1061
|
throw new Error("App ID is required");
|
|
@@ -1096,7 +1097,7 @@ class PhantomWalletProvider {
|
|
|
1096
1097
|
tx = web3_js.VersionedTransaction.deserialize(index_native.bufferExports.Buffer.from(solTransactionData.signedTransaction, 'base64'));
|
|
1097
1098
|
}
|
|
1098
1099
|
else {
|
|
1099
|
-
const result = await
|
|
1100
|
+
const result = await core.buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, anchorProvider, publicKey, {
|
|
1100
1101
|
app_id,
|
|
1101
1102
|
documents: solTransactionData.txArgs[0].setDocumentData,
|
|
1102
1103
|
delete_paths: solTransactionData.txArgs[0].deletePaths,
|
|
@@ -1396,7 +1397,7 @@ class PhantomWalletProvider {
|
|
|
1396
1397
|
console.error('Failed to disconnect from Phantom wallet', error);
|
|
1397
1398
|
}
|
|
1398
1399
|
// Always clear local state
|
|
1399
|
-
|
|
1400
|
+
core.WebSessionManager.clearSession();
|
|
1400
1401
|
index_native.setCurrentUser(null);
|
|
1401
1402
|
}
|
|
1402
1403
|
async getNativeMethods() {
|
|
@@ -1407,19 +1408,7 @@ class PhantomWalletProvider {
|
|
|
1407
1408
|
* Private Helpers
|
|
1408
1409
|
* ----------------------------------------------------------- */
|
|
1409
1410
|
getRpcUrl(network) {
|
|
1410
|
-
|
|
1411
|
-
return this.networkUrl;
|
|
1412
|
-
}
|
|
1413
|
-
if (network === 'solana_devnet') {
|
|
1414
|
-
return index_native.SOLANA_DEVNET_RPC_URL;
|
|
1415
|
-
}
|
|
1416
|
-
else if (network === 'solana_mainnet') {
|
|
1417
|
-
return index_native.SOLANA_MAINNET_RPC_URL;
|
|
1418
|
-
}
|
|
1419
|
-
else if (network === 'surfnet') {
|
|
1420
|
-
return index_native.SURFNET_RPC_URL;
|
|
1421
|
-
}
|
|
1422
|
-
return index_native.SOLANA_MAINNET_RPC_URL; // default to mainnet
|
|
1411
|
+
return index_native.resolveSolanaRpcUrl(this.networkUrl, network !== null && network !== void 0 ? network : this.configuredNetwork, "Phantom wallet Solana transaction");
|
|
1423
1412
|
}
|
|
1424
1413
|
async signAndSendViaPhantom(transaction) {
|
|
1425
1414
|
var _a, _b, _c;
|
|
@@ -1460,4 +1449,4 @@ class PhantomWalletProvider {
|
|
|
1460
1449
|
PhantomWalletProvider.instance = null;
|
|
1461
1450
|
|
|
1462
1451
|
exports.PhantomWalletProvider = PhantomWalletProvider;
|
|
1463
|
-
//# sourceMappingURL=phantom-wallet-provider-
|
|
1452
|
+
//# sourceMappingURL=phantom-wallet-provider-CeLJEdcL.js.map
|