@vue-solana/core 0.4.1 → 0.5.0

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.
@@ -19,24 +19,43 @@ interface AdaptSolanaIosWalletOptions {
19
19
  cluster?: SolanaCluster;
20
20
  onChange?: () => void;
21
21
  }
22
+ interface IosWalletDefinition {
23
+ id: string;
24
+ name: string;
25
+ icon: string;
26
+ appUrl: string;
27
+ installUrl: string;
28
+ encryptionPublicKeyParam: string;
29
+ connectUrl: string;
30
+ signTransactionUrl?: string;
31
+ signAllTransactionsUrl?: string;
32
+ signAndSendTransactionUrl?: string;
33
+ }
22
34
  type IosWalletMethod = "connect" | "signTransaction" | "signAllTransactions" | "signAndSendTransaction";
23
- declare function getSolanaIosWallets(options?: GetSolanaIosWalletsOptions): SolanaWalletInfo[];
24
- declare function adaptSolanaIosWallet(walletInfo: SolanaWalletInfo, options?: AdaptSolanaIosWalletOptions): SolanaWallet;
25
- declare function handleSolanaIosWalletCallback(options?: {
26
- clearUrl?: boolean;
27
- }): {
35
+ type IosWalletCallbackResult = {
28
36
  walletId: string;
29
37
  method: IosWalletMethod;
30
38
  publicKey?: string;
31
39
  signature?: string;
32
40
  transaction?: Uint8Array;
33
41
  transactions?: Uint8Array[];
34
- } | null;
35
- declare function isSolanaIosWalletInfo(walletInfo: SolanaWalletInfo): boolean;
42
+ };
43
+ type IosWalletInfo = SolanaWalletInfo & {
44
+ wallet: IosWalletDefinition;
45
+ };
46
+
47
+ declare function getSolanaIosWallets(options?: GetSolanaIosWalletsOptions): SolanaWalletInfo[];
48
+ declare function adaptSolanaIosWallet(walletInfo: SolanaWalletInfo, options?: AdaptSolanaIosWalletOptions): SolanaWallet;
49
+ declare function isSolanaIosWalletInfo(walletInfo: SolanaWalletInfo): walletInfo is IosWalletInfo;
50
+
36
51
  declare function isSolanaIosBrowserWalletSupported(): boolean;
37
52
  declare function isIosBrowser(): boolean;
38
53
  declare function getDefaultIosWalletAppIdentity(): SolanaIosWalletAppIdentity;
39
54
  declare function getDefaultIosWalletRedirectUrl(): string;
40
55
 
56
+ declare function handleSolanaIosWalletCallback(options?: {
57
+ clearUrl?: boolean;
58
+ }): IosWalletCallbackResult | null;
59
+
41
60
  export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo };
42
- export type { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, SolanaIosWalletAppIdentity };
61
+ export type { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity };
@@ -1,517 +1,4 @@
1
- import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3-compat';
2
- import bs58 from 'bs58';
3
- import * as naclModule from 'tweetnacl';
4
-
5
- const nacl = resolveTweetNaCl();
6
- function resolveTweetNaCl() {
7
- const moduleDefault = naclModule.default;
8
- const globalNacl = globalThis.nacl;
9
- return "box" in naclModule ? naclModule : moduleDefault ?? globalNacl;
10
- }
11
- const DEFAULT_IOS_WALLET_CHAINS = ["solana:mainnet", "solana:devnet"];
12
- const PENDING_REQUEST_KEY = "vue-solana:ios-wallet:pending";
13
- const SESSION_PREFIX = "vue-solana:ios-wallet:session:";
14
- const CALLBACK_PARAMS = /* @__PURE__ */ new Set([
15
- "data",
16
- "nonce",
17
- "errorCode",
18
- "errorMessage",
19
- "phantom_encryption_public_key",
20
- "solflare_encryption_public_key",
21
- "wallet_encryption_public_key"
22
- ]);
23
- const IOS_WALLETS = [
24
- {
25
- id: "phantom",
26
- name: "Phantom",
27
- icon: "https://phantom.app/img/phantom-logo.svg",
28
- appUrl: "https://phantom.app",
29
- installUrl: "https://phantom.app/download",
30
- encryptionPublicKeyParam: "phantom_encryption_public_key",
31
- connectUrl: "https://phantom.app/ul/v1/connect",
32
- signTransactionUrl: "https://phantom.app/ul/v1/signTransaction",
33
- signAllTransactionsUrl: "https://phantom.app/ul/v1/signAllTransactions"
34
- },
35
- {
36
- id: "solflare",
37
- name: "Solflare",
38
- icon: "https://solflare.com/favicon.ico",
39
- appUrl: "https://solflare.com",
40
- installUrl: "https://solflare.com/download",
41
- encryptionPublicKeyParam: "solflare_encryption_public_key",
42
- connectUrl: "https://solflare.com/ul/v1/connect",
43
- signTransactionUrl: "https://solflare.com/ul/v1/signTransaction",
44
- signAllTransactionsUrl: "https://solflare.com/ul/v1/signAllTransactions",
45
- signAndSendTransactionUrl: "https://solflare.com/ul/v1/signAndSendTransaction"
46
- },
47
- {
48
- id: "backpack",
49
- name: "Backpack",
50
- icon: "https://backpack.app/favicon.ico",
51
- appUrl: "https://backpack.app",
52
- installUrl: "https://backpack.app/download",
53
- encryptionPublicKeyParam: "wallet_encryption_public_key",
54
- connectUrl: "https://backpack.app/ul/v1/connect",
55
- signTransactionUrl: "https://backpack.app/ul/v1/signTransaction",
56
- signAllTransactionsUrl: "https://backpack.app/ul/v1/signAllTransactions",
57
- signAndSendTransactionUrl: "https://backpack.app/ul/v1/signAndSendTransaction"
58
- }
59
- ];
60
- function getSolanaIosWallets(options = {}) {
61
- if (!isSolanaIosBrowserWalletSupported()) {
62
- return [];
63
- }
64
- const chains = options.chains?.length ? options.chains : DEFAULT_IOS_WALLET_CHAINS;
65
- const callbackUrl = options.redirectUrl ?? getDefaultIosWalletRedirectUrl();
66
- return IOS_WALLETS.map((wallet) => ({
67
- name: wallet.name,
68
- icon: wallet.icon,
69
- chains,
70
- platform: "mobile",
71
- source: "deep-link",
72
- appUrl: wallet.appUrl,
73
- installUrl: wallet.installUrl,
74
- callbackUrl,
75
- capabilities: {
76
- connect: true,
77
- signTransaction: Boolean(wallet.signTransactionUrl),
78
- signAllTransactions: Boolean(wallet.signAllTransactionsUrl),
79
- signAndSendTransaction: Boolean(wallet.signAndSendTransactionUrl)
80
- },
81
- accounts: getStoredIosWalletAccount(wallet.id, chains),
82
- wallet
83
- }));
84
- }
85
- function adaptSolanaIosWallet(walletInfo, options = {}) {
86
- const definition = getIosWalletDefinition(walletInfo);
87
- let connecting = false;
88
- let disconnecting = false;
89
- let session = getStoredSession(definition.id);
90
- function refreshSession() {
91
- session = getStoredSession(definition.id);
92
- options.onChange?.();
93
- }
94
- return {
95
- get publicKey() {
96
- return session?.publicKey ? new PublicKey(session.publicKey) : null;
97
- },
98
- get connected() {
99
- return Boolean(session?.publicKey && session.session);
100
- },
101
- get connecting() {
102
- return connecting;
103
- },
104
- get disconnecting() {
105
- return disconnecting;
106
- },
107
- async connect() {
108
- const callback = handleSolanaIosWalletCallback({ clearUrl: true });
109
- if (callback?.walletId === definition.id) {
110
- refreshSession();
111
- return;
112
- }
113
- connecting = true;
114
- options.onChange?.();
115
- try {
116
- launchConnect(definition, options);
117
- await waitForRedirect();
118
- } finally {
119
- connecting = false;
120
- options.onChange?.();
121
- }
122
- },
123
- async disconnect() {
124
- disconnecting = true;
125
- options.onChange?.();
126
- try {
127
- removeStoredSession(definition.id);
128
- refreshSession();
129
- } finally {
130
- disconnecting = false;
131
- options.onChange?.();
132
- }
133
- },
134
- signTransaction: definition.signTransactionUrl ? async (transaction) => {
135
- const signedTransaction = await launchSignTransaction(definition, transaction, options);
136
- return deserializeTransaction(transaction, signedTransaction);
137
- } : void 0,
138
- signAllTransactions: definition.signAllTransactionsUrl ? async (transactions) => {
139
- const signedTransactions = await launchSignAllTransactions(
140
- definition,
141
- transactions,
142
- options
143
- );
144
- return signedTransactions.map(
145
- (transaction, index) => deserializeTransaction(transactions[index], transaction)
146
- );
147
- } : void 0,
148
- signAndSendTransaction: definition.signAndSendTransactionUrl ? async (transaction, sendOptions) => launchSignAndSendTransaction(definition, transaction, sendOptions, options) : void 0
149
- };
150
- }
151
- function handleSolanaIosWalletCallback(options = {}) {
152
- if (typeof window === "undefined") {
153
- return null;
154
- }
155
- const url = new URL(window.location.href);
156
- if (!hasIosWalletCallbackParams(url)) {
157
- return null;
158
- }
159
- const errorCode = url.searchParams.get("errorCode");
160
- const errorMessage = url.searchParams.get("errorMessage");
161
- if (errorCode || errorMessage) {
162
- clearPendingRequest();
163
- cleanCallbackUrl(url, options.clearUrl);
164
- throw new Error(errorMessage || `iOS wallet request failed: ${errorCode}`);
165
- }
166
- const pending = getPendingRequest();
167
- if (!pending) {
168
- cleanCallbackUrl(url, options.clearUrl);
169
- throw new Error("Received an iOS wallet callback without a pending request");
170
- }
171
- const definition = getIosWalletDefinitionById(pending.walletId);
172
- const walletEncryptionPublicKey = url.searchParams.get(definition.encryptionPublicKeyParam);
173
- const nonce = url.searchParams.get("nonce");
174
- const data = url.searchParams.get("data");
175
- if (!nonce || !data) {
176
- throw new Error("Received an incomplete iOS wallet callback");
177
- }
178
- const sharedSecret = getSharedSecret(
179
- walletEncryptionPublicKey ?? getStoredSession(pending.walletId)?.walletEncryptionPublicKey,
180
- pending.dappEncryptionSecretKey
181
- );
182
- const payload = decryptPayload(data, nonce, sharedSecret);
183
- const result = createCallbackResult(pending, payload);
184
- if (pending.method === "connect") {
185
- if (!walletEncryptionPublicKey) {
186
- throw new Error("iOS wallet connect callback did not include an encryption public key");
187
- }
188
- storeSession({
189
- walletId: pending.walletId,
190
- publicKey: getStringField(payload, "public_key"),
191
- session: getStringField(payload, "session"),
192
- dappEncryptionPublicKey: pending.dappEncryptionPublicKey,
193
- dappEncryptionSecretKey: pending.dappEncryptionSecretKey,
194
- walletEncryptionPublicKey,
195
- sharedSecret: bs58.encode(sharedSecret)
196
- });
197
- }
198
- clearPendingRequest();
199
- cleanCallbackUrl(url, options.clearUrl);
200
- return result;
201
- }
202
- function isSolanaIosWalletInfo(walletInfo) {
203
- return walletInfo.source === "deep-link" && isIosWalletDefinition(walletInfo.wallet);
204
- }
205
- function isSolanaIosBrowserWalletSupported() {
206
- return isIosBrowser();
207
- }
208
- function isIosBrowser() {
209
- if (typeof window === "undefined" || typeof navigator === "undefined") {
210
- return false;
211
- }
212
- const userAgent = navigator.userAgent;
213
- const platform = navigator.platform;
214
- const maxTouchPoints = navigator.maxTouchPoints ?? 0;
215
- return /iPad|iPhone|iPod/i.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
216
- }
217
- function getDefaultIosWalletAppIdentity() {
218
- if (typeof window === "undefined") {
219
- return {
220
- name: "Vue Solana App",
221
- uri: "https://localhost"
222
- };
223
- }
224
- return {
225
- name: document.title || "Vue Solana App",
226
- uri: window.location.origin,
227
- icon: getDocumentIconUrl()
228
- };
229
- }
230
- function getDefaultIosWalletRedirectUrl() {
231
- if (typeof window === "undefined") {
232
- return "https://localhost";
233
- }
234
- const url = new URL(window.location.href);
235
- for (const param of CALLBACK_PARAMS) {
236
- url.searchParams.delete(param);
237
- }
238
- return url.toString();
239
- }
240
- function launchConnect(definition, options) {
241
- const keyPair = nacl.box.keyPair();
242
- const pending = createPendingRequest(definition.id, "connect", keyPair, options.redirectUrl);
243
- const appIdentity = options.appIdentity ?? getDefaultIosWalletAppIdentity();
244
- const url = new URL(definition.connectUrl);
245
- url.searchParams.set("app_url", appIdentity.uri);
246
- url.searchParams.set("dapp_encryption_public_key", pending.dappEncryptionPublicKey);
247
- url.searchParams.set("redirect_link", pending.redirectUrl);
248
- if (options.cluster && options.cluster !== "localnet") {
249
- url.searchParams.set("cluster", options.cluster);
250
- }
251
- storePendingRequest(pending);
252
- openIosWalletUrl(url.toString());
253
- }
254
- async function launchSignTransaction(definition, transaction, options) {
255
- const response = await launchEncryptedWalletRequest(definition, "signTransaction", options, {
256
- transaction: bs58.encode(serializeTransaction(transaction))
257
- });
258
- if (!response.transaction) {
259
- throw new Error("iOS wallet did not return a signed transaction");
260
- }
261
- return response.transaction;
262
- }
263
- async function launchSignAllTransactions(definition, transactions, options) {
264
- const response = await launchEncryptedWalletRequest(definition, "signAllTransactions", options, {
265
- transactions: transactions.map((transaction) => bs58.encode(serializeTransaction(transaction)))
266
- });
267
- if (!response.transactions) {
268
- throw new Error("iOS wallet did not return signed transactions");
269
- }
270
- return response.transactions;
271
- }
272
- async function launchSignAndSendTransaction(definition, transaction, sendOptions, options) {
273
- const response = await launchEncryptedWalletRequest(
274
- definition,
275
- "signAndSendTransaction",
276
- options,
277
- {
278
- transaction: bs58.encode(serializeTransaction(transaction)),
279
- sendOptions
280
- }
281
- );
282
- if (!response.signature) {
283
- throw new Error("iOS wallet did not return a transaction signature");
284
- }
285
- return { signature: response.signature };
286
- }
287
- async function launchEncryptedWalletRequest(definition, method, options, payload) {
288
- const session = getStoredSession(definition.id);
289
- if (!session) {
290
- throw new Error("Connect the iOS wallet before signing");
291
- }
292
- const methodUrl = getIosWalletMethodUrl(definition, method);
293
- const pending = createPendingRequest(
294
- definition.id,
295
- method,
296
- {
297
- publicKey: bs58.decode(session.dappEncryptionPublicKey),
298
- secretKey: bs58.decode(session.dappEncryptionSecretKey)
299
- },
300
- options.redirectUrl
301
- );
302
- const nonce = nacl.randomBytes(nacl.box.nonceLength);
303
- const encryptedPayload = encryptPayload(
304
- { ...payload, session: session.session },
305
- nonce,
306
- bs58.decode(session.sharedSecret)
307
- );
308
- const url = new URL(methodUrl);
309
- url.searchParams.set("dapp_encryption_public_key", session.dappEncryptionPublicKey);
310
- url.searchParams.set("nonce", bs58.encode(nonce));
311
- url.searchParams.set("redirect_link", pending.redirectUrl);
312
- url.searchParams.set("payload", encryptedPayload);
313
- storePendingRequest(pending);
314
- openIosWalletUrl(url.toString());
315
- return waitForRedirect();
316
- }
317
- function createPendingRequest(walletId, method, keyPair, redirectUrl) {
318
- return {
319
- id: createRequestId(),
320
- walletId,
321
- method,
322
- dappEncryptionPublicKey: bs58.encode(keyPair.publicKey),
323
- dappEncryptionSecretKey: bs58.encode(keyPair.secretKey),
324
- redirectUrl: redirectUrl ?? getDefaultIosWalletRedirectUrl(),
325
- createdAt: Date.now()
326
- };
327
- }
328
- function createCallbackResult(pending, payload) {
329
- if (pending.method === "connect") {
330
- return {
331
- walletId: pending.walletId,
332
- method: pending.method,
333
- publicKey: getStringField(payload, "public_key")
334
- };
335
- }
336
- if (pending.method === "signTransaction") {
337
- return {
338
- walletId: pending.walletId,
339
- method: pending.method,
340
- transaction: bs58.decode(getStringField(payload, "transaction"))
341
- };
342
- }
343
- if (pending.method === "signAllTransactions") {
344
- const transactions = payload.transactions;
345
- if (!Array.isArray(transactions) || transactions.some((transaction) => typeof transaction !== "string")) {
346
- throw new Error("iOS wallet returned invalid signed transactions");
347
- }
348
- return {
349
- walletId: pending.walletId,
350
- method: pending.method,
351
- transactions: transactions.map((transaction) => bs58.decode(transaction))
352
- };
353
- }
354
- return {
355
- walletId: pending.walletId,
356
- method: pending.method,
357
- signature: getStringField(payload, "signature")
358
- };
359
- }
360
- function getIosWalletMethodUrl(definition, method) {
361
- const url = definition[`${method}Url`];
362
- if (!url) {
363
- throw new Error(`${definition.name} does not support ${method} through iOS deeplinks`);
364
- }
365
- return url;
366
- }
367
- function getSharedSecret(walletEncryptionPublicKey, dappSecretKey) {
368
- if (!walletEncryptionPublicKey) {
369
- throw new Error("Missing iOS wallet encryption public key");
370
- }
371
- return nacl.box.before(bs58.decode(walletEncryptionPublicKey), bs58.decode(dappSecretKey));
372
- }
373
- function encryptPayload(payload, nonce, sharedSecret) {
374
- return bs58.encode(nacl.box.after(encodeJson(payload), nonce, sharedSecret));
375
- }
376
- function decryptPayload(data, nonce, sharedSecret) {
377
- const decrypted = nacl.box.open.after(bs58.decode(data), bs58.decode(nonce), sharedSecret);
378
- if (!decrypted) {
379
- throw new Error("Unable to decrypt iOS wallet callback");
380
- }
381
- return JSON.parse(new TextDecoder().decode(decrypted));
382
- }
383
- function encodeJson(value) {
384
- return new TextEncoder().encode(JSON.stringify(value));
385
- }
386
- function serializeTransaction(transaction) {
387
- if (transaction instanceof Transaction) {
388
- return transaction.serialize({ requireAllSignatures: false, verifySignatures: false });
389
- }
390
- return transaction.serialize();
391
- }
392
- function deserializeTransaction(source, bytes) {
393
- if (source instanceof Transaction) {
394
- return Transaction.from(bytes);
395
- }
396
- return VersionedTransaction.deserialize(bytes);
397
- }
398
- function getStoredIosWalletAccount(walletId, chains) {
399
- const session = getStoredSession(walletId);
400
- if (!session) {
401
- return [];
402
- }
403
- return [
404
- {
405
- address: session.publicKey,
406
- publicKey: new PublicKey(session.publicKey).toBytes(),
407
- chains
408
- }
409
- ];
410
- }
411
- function getStoredSession(walletId) {
412
- const value = getStorage()?.getItem(`${SESSION_PREFIX}${walletId}`);
413
- if (!value) {
414
- return null;
415
- }
416
- try {
417
- return JSON.parse(value);
418
- } catch {
419
- removeStoredSession(walletId);
420
- return null;
421
- }
422
- }
423
- function storeSession(session) {
424
- getStorage()?.setItem(`${SESSION_PREFIX}${session.walletId}`, JSON.stringify(session));
425
- }
426
- function removeStoredSession(walletId) {
427
- getStorage()?.removeItem(`${SESSION_PREFIX}${walletId}`);
428
- }
429
- function getPendingRequest() {
430
- const value = getStorage()?.getItem(PENDING_REQUEST_KEY);
431
- if (!value) {
432
- return null;
433
- }
434
- try {
435
- return JSON.parse(value);
436
- } catch {
437
- clearPendingRequest();
438
- return null;
439
- }
440
- }
441
- function storePendingRequest(request) {
442
- getStorage()?.setItem(PENDING_REQUEST_KEY, JSON.stringify(request));
443
- }
444
- function clearPendingRequest() {
445
- getStorage()?.removeItem(PENDING_REQUEST_KEY);
446
- }
447
- function getStorage() {
448
- if (typeof window === "undefined") {
449
- return null;
450
- }
451
- try {
452
- return window.sessionStorage;
453
- } catch {
454
- return null;
455
- }
456
- }
457
- function openIosWalletUrl(url) {
458
- if (typeof window === "undefined") {
459
- throw new Error("iOS wallet links are only available in browser runtimes");
460
- }
461
- window.location.assign(url);
462
- }
463
- function waitForRedirect() {
464
- return new Promise(() => {
465
- });
466
- }
467
- function hasIosWalletCallbackParams(url) {
468
- for (const param of CALLBACK_PARAMS) {
469
- if (url.searchParams.has(param)) {
470
- return true;
471
- }
472
- }
473
- return false;
474
- }
475
- function cleanCallbackUrl(url, clearUrl) {
476
- if (!clearUrl || typeof window === "undefined") {
477
- return;
478
- }
479
- for (const param of CALLBACK_PARAMS) {
480
- url.searchParams.delete(param);
481
- }
482
- window.history.replaceState(window.history.state, document.title, url.toString());
483
- }
484
- function createRequestId() {
485
- return bs58.encode(nacl.randomBytes(16));
486
- }
487
- function getStringField(payload, field) {
488
- const value = payload[field];
489
- if (typeof value !== "string" || !value) {
490
- throw new Error(`iOS wallet callback is missing ${field}`);
491
- }
492
- return value;
493
- }
494
- function getIosWalletDefinition(walletInfo) {
495
- if (!isIosWalletDefinition(walletInfo.wallet)) {
496
- throw new Error("Solana wallet info is not an iOS wallet");
497
- }
498
- return walletInfo.wallet;
499
- }
500
- function getIosWalletDefinitionById(walletId) {
501
- const definition = IOS_WALLETS.find((wallet) => wallet.id === walletId);
502
- if (!definition) {
503
- throw new Error(`Unknown iOS wallet: ${walletId}`);
504
- }
505
- return definition;
506
- }
507
- function isIosWalletDefinition(value) {
508
- return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string" && IOS_WALLETS.some((wallet) => wallet.id === value.id);
509
- }
510
- function getDocumentIconUrl() {
511
- const icon = document.querySelector(
512
- 'link[rel="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]'
513
- );
514
- return icon?.href;
515
- }
516
-
517
- export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo };
1
+ export { a as adaptSolanaIosWallet, g as getDefaultIosWalletAppIdentity, b as getDefaultIosWalletRedirectUrl, c as getSolanaIosWallets, h as handleSolanaIosWalletCallback, i as isIosBrowser, d as isSolanaIosBrowserWalletSupported, e as isSolanaIosWalletInfo } from './shared/core.DSI7vIfT.mjs';
2
+ import '@solana/web3-compat';
3
+ import 'bs58';
4
+ import 'tweetnacl';
package/dist/rpc.cjs CHANGED
@@ -20,10 +20,7 @@ function createSolanaContext(config = {}) {
20
20
  cluster,
21
21
  endpoint,
22
22
  wsEndpoint,
23
- connection: new web3Compat.Connection(endpoint, {
24
- commitment: config.commitment,
25
- wsEndpoint
26
- })
23
+ connection: createSolanaConnection(config)
27
24
  };
28
25
  }
29
26
 
package/dist/rpc.mjs CHANGED
@@ -18,10 +18,7 @@ function createSolanaContext(config = {}) {
18
18
  cluster,
19
19
  endpoint,
20
20
  wsEndpoint,
21
- connection: new Connection(endpoint, {
22
- commitment: config.commitment,
23
- wsEndpoint
24
- })
21
+ connection: createSolanaConnection(config)
25
22
  };
26
23
  }
27
24