@vue-solana/core 1.2.0 → 2.0.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.
Files changed (73) hide show
  1. package/README.md +44 -35
  2. package/dist/address.cjs +10 -10
  3. package/dist/address.d.cts +11 -13
  4. package/dist/address.d.mts +11 -13
  5. package/dist/address.d.ts +11 -13
  6. package/dist/address.mjs +10 -10
  7. package/dist/buffer-polyfill.d.cts +0 -1
  8. package/dist/buffer-polyfill.d.mts +0 -1
  9. package/dist/buffer-polyfill.d.ts +0 -1
  10. package/dist/clusters.d.cts +1 -4
  11. package/dist/clusters.d.mts +1 -4
  12. package/dist/clusters.d.ts +1 -4
  13. package/dist/index.cjs +3 -19
  14. package/dist/index.d.cts +5 -9
  15. package/dist/index.d.mts +5 -9
  16. package/dist/index.d.ts +5 -9
  17. package/dist/index.mjs +4 -6
  18. package/dist/ios-wallet.cjs +2 -2
  19. package/dist/ios-wallet.d.cts +1 -4
  20. package/dist/ios-wallet.d.mts +1 -4
  21. package/dist/ios-wallet.d.ts +1 -4
  22. package/dist/ios-wallet.mjs +2 -2
  23. package/dist/kit.d.cts +2 -5
  24. package/dist/kit.d.mts +2 -5
  25. package/dist/kit.d.ts +2 -5
  26. package/dist/mobile-wallet.d.cts +1 -4
  27. package/dist/mobile-wallet.d.mts +1 -4
  28. package/dist/mobile-wallet.d.ts +1 -4
  29. package/dist/rpc.cjs +0 -12
  30. package/dist/rpc.d.cts +2 -11
  31. package/dist/rpc.d.mts +2 -11
  32. package/dist/rpc.d.ts +2 -11
  33. package/dist/rpc.mjs +1 -12
  34. package/dist/shared/{core.DjbtrJWl.mjs → core.BOHiMZiM.mjs} +7 -33
  35. package/dist/shared/{core.Ch_Z7_17.mjs → core.BwW4HVQI.mjs} +12 -28
  36. package/dist/shared/{core.BsekSwcZ.cjs → core.Cb48vQvC.cjs} +12 -28
  37. package/dist/shared/{core.BQoh-5Wu.cjs → core.Cu_gaUSn.cjs} +20 -46
  38. package/dist/shared/{core.DAUuCWrr.d.mts → core.DMgTrB_2.d.cts} +21 -17
  39. package/dist/shared/{core.DAUuCWrr.d.ts → core.DMgTrB_2.d.mts} +21 -17
  40. package/dist/shared/{core.DAUuCWrr.d.cts → core.DMgTrB_2.d.ts} +21 -17
  41. package/dist/token-accounts.cjs +44 -28
  42. package/dist/token-accounts.d.cts +20 -20
  43. package/dist/token-accounts.d.mts +20 -20
  44. package/dist/token-accounts.d.ts +20 -20
  45. package/dist/token-accounts.mjs +44 -28
  46. package/dist/transaction.cjs +50 -31
  47. package/dist/transaction.d.cts +9 -15
  48. package/dist/transaction.d.mts +9 -15
  49. package/dist/transaction.d.ts +9 -15
  50. package/dist/transaction.mjs +51 -32
  51. package/dist/types.d.cts +1 -4
  52. package/dist/types.d.mts +1 -4
  53. package/dist/types.d.ts +1 -4
  54. package/dist/wallet-standard.cjs +1 -4
  55. package/dist/wallet-standard.d.cts +1 -4
  56. package/dist/wallet-standard.d.mts +1 -4
  57. package/dist/wallet-standard.d.ts +1 -4
  58. package/dist/wallet-standard.mjs +1 -4
  59. package/dist/wallet.d.cts +1 -4
  60. package/dist/wallet.d.mts +1 -4
  61. package/dist/wallet.d.ts +1 -4
  62. package/package.json +1 -13
  63. package/dist/spl-token.cjs +0 -12
  64. package/dist/spl-token.d.cts +0 -4
  65. package/dist/spl-token.d.mts +0 -4
  66. package/dist/spl-token.d.ts +0 -4
  67. package/dist/spl-token.mjs +0 -1
  68. package/dist/web3.cjs +0 -13
  69. package/dist/web3.d.cts +0 -3
  70. package/dist/web3.d.mts +0 -3
  71. package/dist/web3.d.ts +0 -3
  72. package/dist/web3.mjs +0 -1
  73. package/types/web3-compat.d.ts +0 -140
@@ -1,7 +1,4 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { a as SolanaChain, c as SolanaCluster, i as SolanaWalletInfo, h as SolanaWallet } from './shared/core.DAUuCWrr.js';
4
- import '@solana/web3-compat';
1
+ import { a as SolanaChain, c as SolanaCluster, i as SolanaWalletInfo, h as SolanaWallet } from './shared/core.DMgTrB_2.js';
5
2
  import '@solana/kit';
6
3
 
7
4
  interface SolanaIosWalletAppIdentity {
@@ -1,4 +1,4 @@
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.Ch_Z7_17.mjs';
2
- import '@solana/web3-compat';
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.BwW4HVQI.mjs';
2
+ import '@solana/kit';
3
3
  import 'bs58';
4
4
  import 'tweetnacl';
package/dist/kit.d.cts CHANGED
@@ -1,5 +1,2 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { Address, Lamports, Rpc, SolanaRpcApi, address, lamports } from '@solana/kit';
4
- export { b as SolanaClient, j as createSolanaClient } from './shared/core.DAUuCWrr.cjs';
5
- import '@solana/web3-compat';
1
+ export { Address, Commitment, Lamports, Rpc, Signature, SolanaRpcApi, address, lamports } from '@solana/kit';
2
+ export { b as SolanaClient, k as createSolanaClient } from './shared/core.DMgTrB_2.cjs';
package/dist/kit.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { Address, Lamports, Rpc, SolanaRpcApi, address, lamports } from '@solana/kit';
4
- export { b as SolanaClient, j as createSolanaClient } from './shared/core.DAUuCWrr.mjs';
5
- import '@solana/web3-compat';
1
+ export { Address, Commitment, Lamports, Rpc, Signature, SolanaRpcApi, address, lamports } from '@solana/kit';
2
+ export { b as SolanaClient, k as createSolanaClient } from './shared/core.DMgTrB_2.mjs';
package/dist/kit.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { Address, Lamports, Rpc, SolanaRpcApi, address, lamports } from '@solana/kit';
4
- export { b as SolanaClient, j as createSolanaClient } from './shared/core.DAUuCWrr.js';
5
- import '@solana/web3-compat';
1
+ export { Address, Commitment, Lamports, Rpc, Signature, SolanaRpcApi, address, lamports } from '@solana/kit';
2
+ export { b as SolanaClient, k as createSolanaClient } from './shared/core.DMgTrB_2.js';
@@ -1,7 +1,4 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { a as SolanaChain } from './shared/core.DAUuCWrr.cjs';
4
- import '@solana/web3-compat';
1
+ import { a as SolanaChain } from './shared/core.DMgTrB_2.cjs';
5
2
  import '@solana/kit';
6
3
 
7
4
  interface SolanaMobileWalletAppIdentity {
@@ -1,7 +1,4 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { a as SolanaChain } from './shared/core.DAUuCWrr.mjs';
4
- import '@solana/web3-compat';
1
+ import { a as SolanaChain } from './shared/core.DMgTrB_2.mjs';
5
2
  import '@solana/kit';
6
3
 
7
4
  interface SolanaMobileWalletAppIdentity {
@@ -1,7 +1,4 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { a as SolanaChain } from './shared/core.DAUuCWrr.js';
4
- import '@solana/web3-compat';
1
+ import { a as SolanaChain } from './shared/core.DMgTrB_2.js';
5
2
  import '@solana/kit';
6
3
 
7
4
  interface SolanaMobileWalletAppIdentity {
package/dist/rpc.cjs CHANGED
@@ -1,20 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const web3Compat = require('@solana/web3-compat');
4
3
  const clusters = require('./clusters.cjs');
5
4
  const kit = require('./kit.cjs');
6
5
  require('@solana/kit');
7
6
  require('@solana/kit-plugin-rpc');
8
7
 
9
- function createSolanaConnection(config = {}) {
10
- const cluster = config.cluster ?? clusters.DEFAULT_CLUSTER;
11
- const endpoint = config.endpoint ?? clusters.getClusterEndpoint(cluster);
12
- const wsEndpoint = config.wsEndpoint ?? (config.endpoint ? clusters.getWebSocketEndpoint(endpoint) : clusters.getClusterWebSocketEndpoint(cluster));
13
- return new web3Compat.Connection(endpoint, {
14
- commitment: config.commitment,
15
- wsEndpoint
16
- });
17
- }
18
8
  function createSolanaContext(config = {}) {
19
9
  const cluster = config.cluster ?? clusters.DEFAULT_CLUSTER;
20
10
  const endpoint = config.endpoint ?? clusters.getClusterEndpoint(cluster);
@@ -23,10 +13,8 @@ function createSolanaContext(config = {}) {
23
13
  cluster,
24
14
  endpoint,
25
15
  wsEndpoint,
26
- connection: createSolanaConnection(config),
27
16
  client: kit.createSolanaClient(config)
28
17
  };
29
18
  }
30
19
 
31
- exports.createSolanaConnection = createSolanaConnection;
32
20
  exports.createSolanaContext = createSolanaContext;
package/dist/rpc.d.cts CHANGED
@@ -1,15 +1,6 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { Connection } from '@solana/web3-compat';
4
- import { d as SolanaConfig, e as SolanaContext } from './shared/core.DAUuCWrr.cjs';
1
+ import { d as SolanaConfig, e as SolanaContext } from './shared/core.DMgTrB_2.cjs';
5
2
  import '@solana/kit';
6
3
 
7
- /**
8
- * Create a legacy web3-compat `Connection`.
9
- *
10
- * @deprecated Use `createSolanaClient()` from `@vue-solana/core/kit` instead.
11
- */
12
- declare function createSolanaConnection(config?: SolanaConfig): Connection;
13
4
  declare function createSolanaContext(config?: SolanaConfig): SolanaContext;
14
5
 
15
- export { createSolanaConnection, createSolanaContext };
6
+ export { createSolanaContext };
package/dist/rpc.d.mts CHANGED
@@ -1,15 +1,6 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { Connection } from '@solana/web3-compat';
4
- import { d as SolanaConfig, e as SolanaContext } from './shared/core.DAUuCWrr.mjs';
1
+ import { d as SolanaConfig, e as SolanaContext } from './shared/core.DMgTrB_2.mjs';
5
2
  import '@solana/kit';
6
3
 
7
- /**
8
- * Create a legacy web3-compat `Connection`.
9
- *
10
- * @deprecated Use `createSolanaClient()` from `@vue-solana/core/kit` instead.
11
- */
12
- declare function createSolanaConnection(config?: SolanaConfig): Connection;
13
4
  declare function createSolanaContext(config?: SolanaConfig): SolanaContext;
14
5
 
15
- export { createSolanaConnection, createSolanaContext };
6
+ export { createSolanaContext };
package/dist/rpc.d.ts CHANGED
@@ -1,15 +1,6 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { Connection } from '@solana/web3-compat';
4
- import { d as SolanaConfig, e as SolanaContext } from './shared/core.DAUuCWrr.js';
1
+ import { d as SolanaConfig, e as SolanaContext } from './shared/core.DMgTrB_2.js';
5
2
  import '@solana/kit';
6
3
 
7
- /**
8
- * Create a legacy web3-compat `Connection`.
9
- *
10
- * @deprecated Use `createSolanaClient()` from `@vue-solana/core/kit` instead.
11
- */
12
- declare function createSolanaConnection(config?: SolanaConfig): Connection;
13
4
  declare function createSolanaContext(config?: SolanaConfig): SolanaContext;
14
5
 
15
- export { createSolanaConnection, createSolanaContext };
6
+ export { createSolanaContext };
package/dist/rpc.mjs CHANGED
@@ -1,18 +1,8 @@
1
- import { Connection } from '@solana/web3-compat';
2
1
  import { DEFAULT_CLUSTER, getClusterEndpoint, getWebSocketEndpoint, getClusterWebSocketEndpoint } from './clusters.mjs';
3
2
  import { createSolanaClient } from './kit.mjs';
4
3
  import '@solana/kit';
5
4
  import '@solana/kit-plugin-rpc';
6
5
 
7
- function createSolanaConnection(config = {}) {
8
- const cluster = config.cluster ?? DEFAULT_CLUSTER;
9
- const endpoint = config.endpoint ?? getClusterEndpoint(cluster);
10
- const wsEndpoint = config.wsEndpoint ?? (config.endpoint ? getWebSocketEndpoint(endpoint) : getClusterWebSocketEndpoint(cluster));
11
- return new Connection(endpoint, {
12
- commitment: config.commitment,
13
- wsEndpoint
14
- });
15
- }
16
6
  function createSolanaContext(config = {}) {
17
7
  const cluster = config.cluster ?? DEFAULT_CLUSTER;
18
8
  const endpoint = config.endpoint ?? getClusterEndpoint(cluster);
@@ -21,9 +11,8 @@ function createSolanaContext(config = {}) {
21
11
  cluster,
22
12
  endpoint,
23
13
  wsEndpoint,
24
- connection: createSolanaConnection(config),
25
14
  client: createSolanaClient(config)
26
15
  };
27
16
  }
28
17
 
29
- export { createSolanaConnection, createSolanaContext };
18
+ export { createSolanaContext };
@@ -1,8 +1,6 @@
1
1
  import { StandardEvents, StandardDisconnect, StandardConnect } from '@wallet-standard/features';
2
2
  import { SolanaSignAndSendTransaction, SolanaSignTransaction, SolanaSignMessage } from '@solana/wallet-standard-features';
3
- import { Transaction, VersionedTransaction, PublicKey } from '@solana/web3-compat';
4
3
  import bs58 from 'bs58';
5
- import { SolanaWalletError } from '../wallet.mjs';
6
4
  import { getWallets } from '@wallet-standard/app';
7
5
 
8
6
  const SOLANA_CHAINS = [
@@ -28,19 +26,6 @@ function hasSignMessage(wallet) {
28
26
  return SolanaSignMessage in wallet.features;
29
27
  }
30
28
 
31
- function serializeTransaction(transaction) {
32
- if (transaction instanceof Transaction) {
33
- return transaction.serialize({ requireAllSignatures: false, verifySignatures: false });
34
- }
35
- return transaction.serialize();
36
- }
37
- function deserializeTransaction(source, bytes) {
38
- if (source instanceof Transaction) {
39
- return Transaction.from(bytes);
40
- }
41
- return VersionedTransaction.deserialize(bytes);
42
- }
43
-
44
29
  function adaptSolanaStandardWallet(walletInfo, options = {}) {
45
30
  const wallet = walletInfo.wallet;
46
31
  let accounts = wallet.accounts;
@@ -61,10 +46,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
61
46
  platform: walletInfo.platform,
62
47
  source: walletInfo.source,
63
48
  get publicKey() {
64
- return account ? new PublicKey(account.publicKey) : null;
65
- },
66
- get address() {
67
- return account ? account.address : void 0;
49
+ return account ? account.address : null;
68
50
  },
69
51
  get connected() {
70
52
  return Boolean(account);
@@ -129,20 +111,20 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
129
111
  const activeAccount = getActiveAccount(account);
130
112
  const [result] = await wallet.features[SolanaSignTransaction].signTransaction({
131
113
  account: activeAccount,
132
- transaction: serializeTransaction(transaction),
114
+ transaction,
133
115
  chain: options.chain
134
116
  });
135
117
  if (!result) {
136
118
  throw new Error("Solana wallet did not return a signed transaction");
137
119
  }
138
- return deserializeTransaction(transaction, result.signedTransaction);
120
+ return result.signedTransaction;
139
121
  } : void 0,
140
122
  signAllTransactions: hasSignTransaction(wallet) ? async (transactions) => {
141
123
  const activeAccount = getActiveAccount(account);
142
124
  const results = await wallet.features[SolanaSignTransaction].signTransaction(
143
125
  ...transactions.map((transaction) => ({
144
126
  account: activeAccount,
145
- transaction: serializeTransaction(transaction),
127
+ transaction,
146
128
  chain: options.chain
147
129
  }))
148
130
  );
@@ -151,26 +133,18 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
151
133
  `Solana wallet returned ${results.length} signed transactions for ${transactions.length} requested transactions`
152
134
  );
153
135
  }
154
- return results.map((result, index) => {
136
+ return results.map((result) => {
155
137
  if (!result) {
156
138
  throw new Error("Solana wallet did not return a signed transaction");
157
139
  }
158
- const transaction = transactions[index];
159
- if (!transaction) {
160
- throw new SolanaWalletError(
161
- "WALLET_FEATURE_UNSUPPORTED",
162
- "Solana wallet returned a signed transaction without a matching request",
163
- { feature: "signTransaction" }
164
- );
165
- }
166
- return deserializeTransaction(transaction, result.signedTransaction);
140
+ return result.signedTransaction;
167
141
  });
168
142
  } : void 0,
169
143
  signAndSendTransaction: hasSignAndSendTransaction(wallet) ? async (transaction, sendOptions) => {
170
144
  const activeAccount = getActiveAccount(account);
171
145
  const [result] = await wallet.features[SolanaSignAndSendTransaction].signAndSendTransaction({
172
146
  account: activeAccount,
173
- transaction: serializeTransaction(transaction),
147
+ transaction,
174
148
  chain: options.chain ?? getSolanaAccountChain(activeAccount),
175
149
  options: sendOptions
176
150
  });
@@ -1,4 +1,4 @@
1
- import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3-compat';
1
+ import { isAddress } from '@solana/kit';
2
2
  import bs58 from 'bs58';
3
3
  import * as naclModule from 'tweetnacl';
4
4
 
@@ -206,7 +206,7 @@ function getStoredIosWalletAccount(walletId, chains) {
206
206
  return [
207
207
  {
208
208
  address: session.publicKey,
209
- publicKey: new PublicKey(session.publicKey).toBytes(),
209
+ publicKey: bs58.decode(session.publicKey),
210
210
  chains
211
211
  }
212
212
  ];
@@ -218,7 +218,9 @@ function getStoredSession(walletId) {
218
218
  }
219
219
  try {
220
220
  const session = JSON.parse(value);
221
- new PublicKey(session.publicKey);
221
+ if (!isAddress(session.publicKey)) {
222
+ throw new Error("Invalid stored public key");
223
+ }
222
224
  return session;
223
225
  } catch {
224
226
  removeStoredSession(walletId);
@@ -371,27 +373,12 @@ function getStringField(payload, field) {
371
373
  }
372
374
  function getPublicKeyField(payload, field) {
373
375
  const value = getStringField(payload, field);
374
- try {
375
- new PublicKey(value);
376
- } catch {
376
+ if (!isAddress(value)) {
377
377
  throw new Error(`iOS wallet callback returned an invalid ${field}`);
378
378
  }
379
379
  return value;
380
380
  }
381
381
 
382
- function serializeTransaction(transaction) {
383
- if (transaction instanceof Transaction) {
384
- return transaction.serialize({ requireAllSignatures: false, verifySignatures: false });
385
- }
386
- return transaction.serialize();
387
- }
388
- function deserializeTransaction(source, bytes) {
389
- if (source instanceof Transaction) {
390
- return Transaction.from(bytes);
391
- }
392
- return VersionedTransaction.deserialize(bytes);
393
- }
394
-
395
382
  function launchConnect(definition, options) {
396
383
  const keyPair = nacl.box.keyPair();
397
384
  const pending = createPendingRequest(definition.id, "connect", keyPair, options.redirectUrl);
@@ -408,7 +395,7 @@ function launchConnect(definition, options) {
408
395
  }
409
396
  async function launchSignTransaction(definition, transaction, options) {
410
397
  const response = await launchEncryptedWalletRequest(definition, "signTransaction", options, {
411
- transaction: bs58.encode(serializeTransaction(transaction))
398
+ transaction: bs58.encode(transaction)
412
399
  });
413
400
  if (!response.transaction) {
414
401
  throw new Error("iOS wallet did not return a signed transaction");
@@ -417,7 +404,7 @@ async function launchSignTransaction(definition, transaction, options) {
417
404
  }
418
405
  async function launchSignAllTransactions(definition, transactions, options) {
419
406
  const response = await launchEncryptedWalletRequest(definition, "signAllTransactions", options, {
420
- transactions: transactions.map((transaction) => bs58.encode(serializeTransaction(transaction)))
407
+ transactions: transactions.map((transaction) => bs58.encode(transaction))
421
408
  });
422
409
  if (!response.transactions) {
423
410
  throw new Error("iOS wallet did not return signed transactions");
@@ -430,7 +417,7 @@ async function launchSignAndSendTransaction(definition, transaction, sendOptions
430
417
  "signAndSendTransaction",
431
418
  options,
432
419
  {
433
- transaction: bs58.encode(serializeTransaction(transaction)),
420
+ transaction: bs58.encode(transaction),
434
421
  sendOptions
435
422
  }
436
423
  );
@@ -515,7 +502,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
515
502
  }
516
503
  return {
517
504
  get publicKey() {
518
- return session?.publicKey ? new PublicKey(session.publicKey) : null;
505
+ return session?.publicKey ? session.publicKey : null;
519
506
  },
520
507
  get connected() {
521
508
  return Boolean(session?.publicKey && session.session);
@@ -554,8 +541,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
554
541
  }
555
542
  },
556
543
  signTransaction: definition.signTransactionUrl ? async (transaction) => {
557
- const signedTransaction = await launchSignTransaction(definition, transaction, options);
558
- return deserializeTransaction(transaction, signedTransaction);
544
+ return launchSignTransaction(definition, transaction, options);
559
545
  } : void 0,
560
546
  signAllTransactions: definition.signAllTransactionsUrl ? async (transactions) => {
561
547
  const signedTransactions = await launchSignAllTransactions(
@@ -568,9 +554,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
568
554
  `iOS wallet returned ${signedTransactions.length} signed transactions for ${transactions.length} requested transactions`
569
555
  );
570
556
  }
571
- return signedTransactions.map(
572
- (transaction, index) => deserializeTransaction(transactions[index], transaction)
573
- );
557
+ return signedTransactions;
574
558
  } : void 0,
575
559
  signAndSendTransaction: definition.signAndSendTransactionUrl ? async (transaction, sendOptions) => launchSignAndSendTransaction(definition, transaction, sendOptions, options) : void 0
576
560
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const web3Compat = require('@solana/web3-compat');
3
+ const kit = require('@solana/kit');
4
4
  const bs58 = require('bs58');
5
5
  const naclModule = require('tweetnacl');
6
6
 
@@ -225,7 +225,7 @@ function getStoredIosWalletAccount(walletId, chains) {
225
225
  return [
226
226
  {
227
227
  address: session.publicKey,
228
- publicKey: new web3Compat.PublicKey(session.publicKey).toBytes(),
228
+ publicKey: bs58__default.decode(session.publicKey),
229
229
  chains
230
230
  }
231
231
  ];
@@ -237,7 +237,9 @@ function getStoredSession(walletId) {
237
237
  }
238
238
  try {
239
239
  const session = JSON.parse(value);
240
- new web3Compat.PublicKey(session.publicKey);
240
+ if (!kit.isAddress(session.publicKey)) {
241
+ throw new Error("Invalid stored public key");
242
+ }
241
243
  return session;
242
244
  } catch {
243
245
  removeStoredSession(walletId);
@@ -390,27 +392,12 @@ function getStringField(payload, field) {
390
392
  }
391
393
  function getPublicKeyField(payload, field) {
392
394
  const value = getStringField(payload, field);
393
- try {
394
- new web3Compat.PublicKey(value);
395
- } catch {
395
+ if (!kit.isAddress(value)) {
396
396
  throw new Error(`iOS wallet callback returned an invalid ${field}`);
397
397
  }
398
398
  return value;
399
399
  }
400
400
 
401
- function serializeTransaction(transaction) {
402
- if (transaction instanceof web3Compat.Transaction) {
403
- return transaction.serialize({ requireAllSignatures: false, verifySignatures: false });
404
- }
405
- return transaction.serialize();
406
- }
407
- function deserializeTransaction(source, bytes) {
408
- if (source instanceof web3Compat.Transaction) {
409
- return web3Compat.Transaction.from(bytes);
410
- }
411
- return web3Compat.VersionedTransaction.deserialize(bytes);
412
- }
413
-
414
401
  function launchConnect(definition, options) {
415
402
  const keyPair = nacl.box.keyPair();
416
403
  const pending = createPendingRequest(definition.id, "connect", keyPair, options.redirectUrl);
@@ -427,7 +414,7 @@ function launchConnect(definition, options) {
427
414
  }
428
415
  async function launchSignTransaction(definition, transaction, options) {
429
416
  const response = await launchEncryptedWalletRequest(definition, "signTransaction", options, {
430
- transaction: bs58__default.encode(serializeTransaction(transaction))
417
+ transaction: bs58__default.encode(transaction)
431
418
  });
432
419
  if (!response.transaction) {
433
420
  throw new Error("iOS wallet did not return a signed transaction");
@@ -436,7 +423,7 @@ async function launchSignTransaction(definition, transaction, options) {
436
423
  }
437
424
  async function launchSignAllTransactions(definition, transactions, options) {
438
425
  const response = await launchEncryptedWalletRequest(definition, "signAllTransactions", options, {
439
- transactions: transactions.map((transaction) => bs58__default.encode(serializeTransaction(transaction)))
426
+ transactions: transactions.map((transaction) => bs58__default.encode(transaction))
440
427
  });
441
428
  if (!response.transactions) {
442
429
  throw new Error("iOS wallet did not return signed transactions");
@@ -449,7 +436,7 @@ async function launchSignAndSendTransaction(definition, transaction, sendOptions
449
436
  "signAndSendTransaction",
450
437
  options,
451
438
  {
452
- transaction: bs58__default.encode(serializeTransaction(transaction)),
439
+ transaction: bs58__default.encode(transaction),
453
440
  sendOptions
454
441
  }
455
442
  );
@@ -534,7 +521,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
534
521
  }
535
522
  return {
536
523
  get publicKey() {
537
- return session?.publicKey ? new web3Compat.PublicKey(session.publicKey) : null;
524
+ return session?.publicKey ? session.publicKey : null;
538
525
  },
539
526
  get connected() {
540
527
  return Boolean(session?.publicKey && session.session);
@@ -573,8 +560,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
573
560
  }
574
561
  },
575
562
  signTransaction: definition.signTransactionUrl ? async (transaction) => {
576
- const signedTransaction = await launchSignTransaction(definition, transaction, options);
577
- return deserializeTransaction(transaction, signedTransaction);
563
+ return launchSignTransaction(definition, transaction, options);
578
564
  } : void 0,
579
565
  signAllTransactions: definition.signAllTransactionsUrl ? async (transactions) => {
580
566
  const signedTransactions = await launchSignAllTransactions(
@@ -587,9 +573,7 @@ function adaptSolanaIosWallet(walletInfo, options = {}) {
587
573
  `iOS wallet returned ${signedTransactions.length} signed transactions for ${transactions.length} requested transactions`
588
574
  );
589
575
  }
590
- return signedTransactions.map(
591
- (transaction, index) => deserializeTransaction(transactions[index], transaction)
592
- );
576
+ return signedTransactions;
593
577
  } : void 0,
594
578
  signAndSendTransaction: definition.signAndSendTransactionUrl ? async (transaction, sendOptions) => launchSignAndSendTransaction(definition, transaction, sendOptions, options) : void 0
595
579
  };
@@ -2,9 +2,7 @@
2
2
 
3
3
  const features = require('@wallet-standard/features');
4
4
  const walletStandardFeatures = require('@solana/wallet-standard-features');
5
- const web3Compat = require('@solana/web3-compat');
6
5
  const bs58 = require('bs58');
7
- const wallet = require('../wallet.cjs');
8
6
  const app = require('@wallet-standard/app');
9
7
 
10
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -34,28 +32,15 @@ function hasSignMessage(wallet) {
34
32
  return walletStandardFeatures.SolanaSignMessage in wallet.features;
35
33
  }
36
34
 
37
- function serializeTransaction(transaction) {
38
- if (transaction instanceof web3Compat.Transaction) {
39
- return transaction.serialize({ requireAllSignatures: false, verifySignatures: false });
40
- }
41
- return transaction.serialize();
42
- }
43
- function deserializeTransaction(source, bytes) {
44
- if (source instanceof web3Compat.Transaction) {
45
- return web3Compat.Transaction.from(bytes);
46
- }
47
- return web3Compat.VersionedTransaction.deserialize(bytes);
48
- }
49
-
50
35
  function adaptSolanaStandardWallet(walletInfo, options = {}) {
51
- const wallet$1 = walletInfo.wallet;
52
- let accounts = wallet$1.accounts;
36
+ const wallet = walletInfo.wallet;
37
+ let accounts = wallet.accounts;
53
38
  let account = options.account;
54
39
  let allowAccountUpdates = Boolean(options.account);
55
40
  let connecting = false;
56
41
  let disconnecting = false;
57
42
  let manuallyDisconnected = false;
58
- const eventsFeature = wallet$1.features[features.StandardEvents];
43
+ const eventsFeature = wallet.features[features.StandardEvents];
59
44
  eventsFeature?.on("change", (properties) => {
60
45
  if (properties.accounts) {
61
46
  accounts = properties.accounts;
@@ -67,10 +52,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
67
52
  platform: walletInfo.platform,
68
53
  source: walletInfo.source,
69
54
  get publicKey() {
70
- return account ? new web3Compat.PublicKey(account.publicKey) : null;
71
- },
72
- get address() {
73
- return account ? account.address : void 0;
55
+ return account ? account.address : null;
74
56
  },
75
57
  get connected() {
76
58
  return Boolean(account);
@@ -86,7 +68,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
86
68
  manuallyDisconnected = false;
87
69
  options.onChange?.();
88
70
  try {
89
- const feature = wallet$1.features[features.StandardConnect];
71
+ const feature = wallet.features[features.StandardConnect];
90
72
  const result = await feature.connect();
91
73
  accounts = result.accounts;
92
74
  allowAccountUpdates = true;
@@ -100,7 +82,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
100
82
  }
101
83
  },
102
84
  async disconnect() {
103
- const feature = wallet$1.features[features.StandardDisconnect];
85
+ const feature = wallet.features[features.StandardDisconnect];
104
86
  disconnecting = true;
105
87
  manuallyDisconnected = true;
106
88
  allowAccountUpdates = false;
@@ -120,9 +102,9 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
120
102
  options.onChange?.();
121
103
  }
122
104
  },
123
- signMessage: hasSignMessage(wallet$1) ? async (message) => {
105
+ signMessage: hasSignMessage(wallet) ? async (message) => {
124
106
  const activeAccount = getActiveAccount(account);
125
- const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignMessage].signMessage({
107
+ const [result] = await wallet.features[walletStandardFeatures.SolanaSignMessage].signMessage({
126
108
  account: activeAccount,
127
109
  message
128
110
  });
@@ -131,24 +113,24 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
131
113
  }
132
114
  return result;
133
115
  } : void 0,
134
- signTransaction: hasSignTransaction(wallet$1) ? async (transaction) => {
116
+ signTransaction: hasSignTransaction(wallet) ? async (transaction) => {
135
117
  const activeAccount = getActiveAccount(account);
136
- const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignTransaction].signTransaction({
118
+ const [result] = await wallet.features[walletStandardFeatures.SolanaSignTransaction].signTransaction({
137
119
  account: activeAccount,
138
- transaction: serializeTransaction(transaction),
120
+ transaction,
139
121
  chain: options.chain
140
122
  });
141
123
  if (!result) {
142
124
  throw new Error("Solana wallet did not return a signed transaction");
143
125
  }
144
- return deserializeTransaction(transaction, result.signedTransaction);
126
+ return result.signedTransaction;
145
127
  } : void 0,
146
- signAllTransactions: hasSignTransaction(wallet$1) ? async (transactions) => {
128
+ signAllTransactions: hasSignTransaction(wallet) ? async (transactions) => {
147
129
  const activeAccount = getActiveAccount(account);
148
- const results = await wallet$1.features[walletStandardFeatures.SolanaSignTransaction].signTransaction(
130
+ const results = await wallet.features[walletStandardFeatures.SolanaSignTransaction].signTransaction(
149
131
  ...transactions.map((transaction) => ({
150
132
  account: activeAccount,
151
- transaction: serializeTransaction(transaction),
133
+ transaction,
152
134
  chain: options.chain
153
135
  }))
154
136
  );
@@ -157,26 +139,18 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
157
139
  `Solana wallet returned ${results.length} signed transactions for ${transactions.length} requested transactions`
158
140
  );
159
141
  }
160
- return results.map((result, index) => {
142
+ return results.map((result) => {
161
143
  if (!result) {
162
144
  throw new Error("Solana wallet did not return a signed transaction");
163
145
  }
164
- const transaction = transactions[index];
165
- if (!transaction) {
166
- throw new wallet.SolanaWalletError(
167
- "WALLET_FEATURE_UNSUPPORTED",
168
- "Solana wallet returned a signed transaction without a matching request",
169
- { feature: "signTransaction" }
170
- );
171
- }
172
- return deserializeTransaction(transaction, result.signedTransaction);
146
+ return result.signedTransaction;
173
147
  });
174
148
  } : void 0,
175
- signAndSendTransaction: hasSignAndSendTransaction(wallet$1) ? async (transaction, sendOptions) => {
149
+ signAndSendTransaction: hasSignAndSendTransaction(wallet) ? async (transaction, sendOptions) => {
176
150
  const activeAccount = getActiveAccount(account);
177
- const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignAndSendTransaction].signAndSendTransaction({
151
+ const [result] = await wallet.features[walletStandardFeatures.SolanaSignAndSendTransaction].signAndSendTransaction({
178
152
  account: activeAccount,
179
- transaction: serializeTransaction(transaction),
153
+ transaction,
180
154
  chain: options.chain ?? getSolanaAccountChain(activeAccount),
181
155
  options: sendOptions
182
156
  });