@solana/client 1.4.1 → 1.6.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.
@@ -3,7 +3,10 @@ import { createBlockHeightExceedencePromiseFactory, createRecentSignatureConfirm
3
3
  import { fetchAddressLookupTable, fetchAllAddressLookupTable } from '@solana-program/address-lookup-table';
4
4
  import { getTransferSolInstruction, getCreateAccountInstruction, fetchNonce } from '@solana-program/system';
5
5
  import { getBase58Decoder, getBase58Encoder } from '@solana/codecs-strings';
6
- import { TOKEN_PROGRAM_ADDRESS, fetchMint, findAssociatedTokenPda, getCreateAssociatedTokenInstruction, getTransferCheckedInstruction, getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction, getCloseAccountInstruction } from '@solana-program/token';
6
+ import { TOKEN_PROGRAM_ADDRESS, fetchMint as fetchMint$1, findAssociatedTokenPda, getCreateAssociatedTokenInstruction, getTransferCheckedInstruction as getTransferCheckedInstruction$1, getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction, getCloseAccountInstruction } from '@solana-program/token';
7
+ export { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
8
+ import { TOKEN_2022_PROGRAM_ADDRESS, fetchMint, getTransferCheckedInstruction } from '@solana-program/token-2022';
9
+ export { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
7
10
  import { getInitializeInstruction, getDelegateStakeInstruction, getDeactivateInstruction, getWithdrawInstruction } from '@solana-program/stake';
8
11
  import { getSetComputeUnitLimitInstruction, getSetComputeUnitPriceInstruction, COMPUTE_BUDGET_PROGRAM_ADDRESS, ComputeBudgetInstruction } from '@solana-program/compute-budget';
9
12
  import { createStore } from 'zustand/vanilla';
@@ -541,14 +544,14 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
541
544
  }
542
545
  }
543
546
  __name(disconnectWallet3, "disconnectWallet");
544
- async function fetchBalance2(address6, commitment) {
545
- const key = address6.toString();
547
+ async function fetchBalance2(address7, commitment) {
548
+ const key = address7.toString();
546
549
  store.setState((state) => ({
547
550
  ...state,
548
551
  accounts: {
549
552
  ...state.accounts,
550
553
  [key]: {
551
- address: address6,
554
+ address: address7,
552
555
  data: state.accounts[key]?.data,
553
556
  error: void 0,
554
557
  executable: state.accounts[key]?.executable ?? null,
@@ -562,14 +565,14 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
562
565
  lastUpdatedAt: now()
563
566
  }));
564
567
  try {
565
- const response = await runtime.rpc.getBalance(address6, { commitment: getCommitment(commitment) }).send({ abortSignal: AbortSignal.timeout(1e4) });
568
+ const response = await runtime.rpc.getBalance(address7, { commitment: getCommitment(commitment) }).send({ abortSignal: AbortSignal.timeout(1e4) });
566
569
  const lamports2 = response.value;
567
570
  store.setState((state) => ({
568
571
  ...state,
569
572
  accounts: {
570
573
  ...state.accounts,
571
574
  [key]: {
572
- address: address6,
575
+ address: address7,
573
576
  data: state.accounts[key]?.data,
574
577
  error: void 0,
575
578
  executable: state.accounts[key]?.executable ?? null,
@@ -589,7 +592,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
589
592
  accounts: {
590
593
  ...state.accounts,
591
594
  [key]: {
592
- address: address6,
595
+ address: address7,
593
596
  data: state.accounts[key]?.data,
594
597
  error,
595
598
  executable: state.accounts[key]?.executable ?? null,
@@ -611,14 +614,14 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
611
614
  }
612
615
  }
613
616
  __name(fetchBalance2, "fetchBalance");
614
- async function fetchAccount2(address6, commitment) {
615
- const key = address6.toString();
617
+ async function fetchAccount2(address7, commitment) {
618
+ const key = address7.toString();
616
619
  store.setState((state) => ({
617
620
  ...state,
618
621
  accounts: {
619
622
  ...state.accounts,
620
623
  [key]: {
621
- address: address6,
624
+ address: address7,
622
625
  data: state.accounts[key]?.data,
623
626
  error: void 0,
624
627
  executable: state.accounts[key]?.executable ?? null,
@@ -632,7 +635,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
632
635
  lastUpdatedAt: now()
633
636
  }));
634
637
  try {
635
- const response = await runtime.rpc.getAccountInfo(address6, { commitment: getCommitment(commitment), encoding: "base64" }).send({ abortSignal: AbortSignal.timeout(1e4) });
638
+ const response = await runtime.rpc.getAccountInfo(address7, { commitment: getCommitment(commitment), encoding: "base64" }).send({ abortSignal: AbortSignal.timeout(1e4) });
636
639
  const value = response.value;
637
640
  const lamports2 = value?.lamports ?? null;
638
641
  const executable = value?.executable ?? null;
@@ -642,7 +645,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
642
645
  accounts: {
643
646
  ...state.accounts,
644
647
  [key]: {
645
- address: address6,
648
+ address: address7,
646
649
  data: value,
647
650
  error: void 0,
648
651
  executable,
@@ -662,7 +665,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
662
665
  accounts: {
663
666
  ...state.accounts,
664
667
  [key]: {
665
- address: address6,
668
+ address: address7,
666
669
  data: state.accounts[key]?.data,
667
670
  error,
668
671
  executable: state.accounts[key]?.executable ?? null,
@@ -791,7 +794,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
791
794
  }
792
795
  }
793
796
  __name(sendTransaction2, "sendTransaction");
794
- async function requestAirdrop2(address6, lamports2) {
797
+ async function requestAirdrop2(address7, lamports2) {
795
798
  try {
796
799
  const factory = airdropFactory({
797
800
  rpc: runtime.rpc,
@@ -800,17 +803,17 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
800
803
  const signature6 = await factory({
801
804
  commitment: getCommitment("confirmed"),
802
805
  lamports: lamports2,
803
- recipientAddress: address6
806
+ recipientAddress: address7
804
807
  });
805
808
  logger({
806
- data: { address: address6.toString(), lamports: lamports2.toString(), signature: signature6 },
809
+ data: { address: address7.toString(), lamports: lamports2.toString(), signature: signature6 },
807
810
  level: "info",
808
811
  message: "airdrop requested"
809
812
  });
810
813
  return signature6;
811
814
  } catch (error) {
812
815
  logger({
813
- data: { address: address6.toString(), lamports: lamports2.toString(), ...formatError(error) },
816
+ data: { address: address7.toString(), lamports: lamports2.toString(), ...formatError(error) },
814
817
  level: "error",
815
818
  message: "airdrop request failed"
816
819
  });
@@ -1214,11 +1217,11 @@ function isWalletSession(value) {
1214
1217
  __name(isWalletSession, "isWalletSession");
1215
1218
  function createWalletTransactionSigner(session, config = {}) {
1216
1219
  const { commitment } = config;
1217
- const address6 = session.account.address;
1220
+ const address7 = session.account.address;
1218
1221
  if (session.signTransaction) {
1219
1222
  const signTransaction = session.signTransaction.bind(session);
1220
1223
  const modifyingSigner = Object.freeze({
1221
- address: address6,
1224
+ address: address7,
1222
1225
  async modifyAndSignTransactions(transactions) {
1223
1226
  const signedTransactions = [];
1224
1227
  for (const transaction of transactions) {
@@ -1226,7 +1229,7 @@ function createWalletTransactionSigner(session, config = {}) {
1226
1229
  const signed = await signTransaction(
1227
1230
  castTransaction
1228
1231
  );
1229
- const signature6 = signed.signatures[address6];
1232
+ const signature6 = signed.signatures[address7];
1230
1233
  if (!signature6) {
1231
1234
  throw new Error("Wallet did not populate the expected fee payer signature.");
1232
1235
  }
@@ -1246,11 +1249,11 @@ function createWalletTransactionSigner(session, config = {}) {
1246
1249
  const signedTransactions = await this.modifyAndSignTransactions(transactions);
1247
1250
  return Object.freeze(
1248
1251
  signedTransactions.map((signedTransaction) => {
1249
- const signature6 = signedTransaction.signatures[address6];
1252
+ const signature6 = signedTransaction.signatures[address7];
1250
1253
  if (!signature6) {
1251
1254
  throw new Error("Expected signer to produce a signature for the provided address.");
1252
1255
  }
1253
- return Object.freeze({ [address6]: signature6 });
1256
+ return Object.freeze({ [address7]: signature6 });
1254
1257
  })
1255
1258
  );
1256
1259
  }
@@ -1264,7 +1267,7 @@ function createWalletTransactionSigner(session, config = {}) {
1264
1267
  const base58Encoder = getBase58Encoder();
1265
1268
  const sendTransaction2 = session.sendTransaction.bind(session);
1266
1269
  const sendingSigner = Object.freeze({
1267
- address: address6,
1270
+ address: address7,
1268
1271
  async signAndSendTransactions(transactions) {
1269
1272
  const signatures = [];
1270
1273
  for (const transaction of transactions) {
@@ -1396,6 +1399,37 @@ function createSolTransferHelper(runtime) {
1396
1399
  };
1397
1400
  }
1398
1401
  __name(createSolTransferHelper, "createSolTransferHelper");
1402
+ var TOKEN_PROGRAMS = {
1403
+ token: TOKEN_PROGRAM_ADDRESS,
1404
+ "token-2022": TOKEN_2022_PROGRAM_ADDRESS
1405
+ };
1406
+ async function detectTokenProgram(runtime, mint, commitment) {
1407
+ const { value: accountInfo } = await runtime.rpc.getAccountInfo(mint, {
1408
+ commitment,
1409
+ encoding: "base64"
1410
+ }).send();
1411
+ if (!accountInfo) {
1412
+ throw new Error(
1413
+ `Mint account ${mint} does not exist. Provide an explicit tokenProgram when working with non-existent mints.`
1414
+ );
1415
+ }
1416
+ const owner = accountInfo.owner;
1417
+ if (owner === TOKEN_PROGRAM_ADDRESS) {
1418
+ return { programId: "token", programAddress: address(TOKEN_PROGRAM_ADDRESS) };
1419
+ }
1420
+ if (owner === TOKEN_2022_PROGRAM_ADDRESS) {
1421
+ return { programId: "token-2022", programAddress: address(TOKEN_2022_PROGRAM_ADDRESS) };
1422
+ }
1423
+ throw new Error(`Mint ${mint} is owned by unknown program ${owner}. Expected Token Program or Token 2022 Program.`);
1424
+ }
1425
+ __name(detectTokenProgram, "detectTokenProgram");
1426
+ function isKnownTokenProgram(programAddress) {
1427
+ const addrStr = typeof programAddress === "string" ? programAddress : programAddress;
1428
+ return addrStr === TOKEN_PROGRAM_ADDRESS || addrStr === TOKEN_2022_PROGRAM_ADDRESS;
1429
+ }
1430
+ __name(isKnownTokenProgram, "isKnownTokenProgram");
1431
+
1432
+ // src/features/spl.ts
1399
1433
  function ensureAddress2(value, fallback) {
1400
1434
  if (value) {
1401
1435
  return typeof value === "string" ? address(value) : value;
@@ -1424,14 +1458,32 @@ function resolveSigner2(authority, commitment) {
1424
1458
  __name(resolveSigner2, "resolveSigner");
1425
1459
  function createSplTokenHelper(runtime, config) {
1426
1460
  const mintAddress = ensureAddress2(config.mint);
1427
- const tokenProgram = ensureAddress2(config.tokenProgram, address(TOKEN_PROGRAM_ADDRESS));
1428
1461
  let cachedDecimals = config.decimals;
1429
1462
  let cachedMath;
1463
+ let resolvedTokenProgram = config.tokenProgram && config.tokenProgram !== "auto" ? ensureAddress2(config.tokenProgram) : void 0;
1464
+ let isToken2022 = config.tokenProgram === "auto" ? void 0 : config.tokenProgram ? config.tokenProgram === TOKEN_2022_PROGRAM_ADDRESS || typeof config.tokenProgram === "string" && config.tokenProgram === TOKEN_2022_PROGRAM_ADDRESS : false;
1465
+ async function resolveTokenProgram(commitment) {
1466
+ if (resolvedTokenProgram) {
1467
+ return resolvedTokenProgram;
1468
+ }
1469
+ if (config.tokenProgram === "auto") {
1470
+ const result = await detectTokenProgram(runtime, mintAddress, commitment);
1471
+ resolvedTokenProgram = result.programAddress;
1472
+ isToken2022 = result.programId === "token-2022";
1473
+ } else {
1474
+ resolvedTokenProgram = address(TOKEN_PROGRAM_ADDRESS);
1475
+ isToken2022 = false;
1476
+ }
1477
+ return resolvedTokenProgram;
1478
+ }
1479
+ __name(resolveTokenProgram, "resolveTokenProgram");
1430
1480
  async function resolveDecimals(commitment) {
1431
1481
  if (cachedDecimals !== void 0) {
1432
1482
  return cachedDecimals;
1433
1483
  }
1434
- const account = await fetchMint(runtime.rpc, mintAddress, { commitment });
1484
+ const tokenProgram = await resolveTokenProgram(commitment);
1485
+ const fetchMint$2 = tokenProgram === TOKEN_2022_PROGRAM_ADDRESS ? fetchMint : fetchMint$1;
1486
+ const account = await fetchMint$2(runtime.rpc, mintAddress, { commitment });
1435
1487
  cachedDecimals = account.data.decimals;
1436
1488
  return cachedDecimals;
1437
1489
  }
@@ -1445,7 +1497,8 @@ function createSplTokenHelper(runtime, config) {
1445
1497
  return cachedMath;
1446
1498
  }
1447
1499
  __name(getTokenMath, "getTokenMath");
1448
- async function deriveAssociatedTokenAddress(owner) {
1500
+ async function deriveAssociatedTokenAddress(owner, commitment) {
1501
+ const tokenProgram = await resolveTokenProgram(commitment);
1449
1502
  const [ata] = await findAssociatedTokenPda({
1450
1503
  mint: mintAddress,
1451
1504
  owner: ensureAddress2(owner),
@@ -1455,7 +1508,7 @@ function createSplTokenHelper(runtime, config) {
1455
1508
  }
1456
1509
  __name(deriveAssociatedTokenAddress, "deriveAssociatedTokenAddress");
1457
1510
  async function fetchBalance2(owner, commitment) {
1458
- const ataAddress = await deriveAssociatedTokenAddress(owner);
1511
+ const ataAddress = await deriveAssociatedTokenAddress(owner, commitment);
1459
1512
  const decimals = await resolveDecimals(commitment);
1460
1513
  try {
1461
1514
  const { value } = await runtime.rpc.getTokenAccountBalance(ataAddress, { commitment }).send();
@@ -1482,14 +1535,18 @@ function createSplTokenHelper(runtime, config) {
1482
1535
  __name(fetchBalance2, "fetchBalance");
1483
1536
  async function prepareTransfer(config2) {
1484
1537
  const commitment = config2.commitment;
1538
+ const tokenProgram = await resolveTokenProgram(commitment);
1485
1539
  const lifetime = await resolveLifetime2(runtime, commitment, config2.lifetime);
1486
1540
  const { signer, mode } = resolveSigner2(config2.authority, commitment);
1487
1541
  const sourceOwner = ensureAddress2(config2.sourceOwner, signer.address);
1488
1542
  const destinationOwner = ensureAddress2(config2.destinationOwner);
1489
- const sourceAta = ensureAddress2(config2.sourceToken, await deriveAssociatedTokenAddress(sourceOwner));
1543
+ const sourceAta = ensureAddress2(
1544
+ config2.sourceToken,
1545
+ await deriveAssociatedTokenAddress(sourceOwner, commitment)
1546
+ );
1490
1547
  const destinationAta = ensureAddress2(
1491
1548
  config2.destinationToken,
1492
- await deriveAssociatedTokenAddress(destinationOwner)
1549
+ await deriveAssociatedTokenAddress(destinationOwner, commitment)
1493
1550
  );
1494
1551
  const math = await getTokenMath(commitment);
1495
1552
  const decimals = await resolveDecimals(commitment);
@@ -1513,8 +1570,9 @@ function createSplTokenHelper(runtime, config) {
1513
1570
  );
1514
1571
  }
1515
1572
  }
1573
+ const getTransferCheckedInstruction$2 = isToken2022 ? getTransferCheckedInstruction : getTransferCheckedInstruction$1;
1516
1574
  instructionList.push(
1517
- getTransferCheckedInstruction({
1575
+ getTransferCheckedInstruction$2({
1518
1576
  amount,
1519
1577
  authority: signer,
1520
1578
  decimals,
@@ -2059,11 +2117,11 @@ function resolveFeePayerAddress(feePayer, authoritySigner) {
2059
2117
  return { address: feePayer.address, signer: feePayer };
2060
2118
  }
2061
2119
  if (feePayer) {
2062
- const address6 = toAddress(feePayer);
2063
- if (authoritySigner && authoritySigner.address === address6) {
2064
- return { address: address6, signer: authoritySigner };
2120
+ const address7 = toAddress(feePayer);
2121
+ if (authoritySigner && authoritySigner.address === address7) {
2122
+ return { address: address7, signer: authoritySigner };
2065
2123
  }
2066
- return { address: address6 };
2124
+ return { address: address7 };
2067
2125
  }
2068
2126
  if (!authoritySigner) {
2069
2127
  throw new Error("Unable to resolve authority signer for the fee payer.");
@@ -3178,6 +3236,11 @@ function filterByName(name) {
3178
3236
  return (wallet) => wallet.name.toLowerCase().includes(lower);
3179
3237
  }
3180
3238
  __name(filterByName, "filterByName");
3239
+ function filterByNames(...names) {
3240
+ const lowerNames = names.map((n) => n.toLowerCase());
3241
+ return (wallet) => lowerNames.some((name) => wallet.name.toLowerCase().includes(name));
3242
+ }
3243
+ __name(filterByNames, "filterByNames");
3181
3244
  function phantom(options) {
3182
3245
  return autoDiscover({
3183
3246
  filter: filterByName("phantom"),
@@ -3739,7 +3802,7 @@ function insertReferenceKeys(references, transaction) {
3739
3802
  const targetInstruction = transaction.instructions[index];
3740
3803
  const accounts = [
3741
3804
  ...targetInstruction.accounts ?? [],
3742
- ...references.map((address6) => ({ address: address6, role: AccountRole.READONLY }))
3805
+ ...references.map((address7) => ({ address: address7, role: AccountRole.READONLY }))
3743
3806
  ];
3744
3807
  const updatedInstructions = [...transaction.instructions];
3745
3808
  updatedInstructions.splice(index, 1, { ...targetInstruction, accounts });
@@ -4009,6 +4072,6 @@ function stableStringify(value) {
4009
4072
  }
4010
4073
  __name(stableStringify, "stableStringify");
4011
4074
 
4012
- export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, WRAPPED_SOL_MINT, applyRatio, applySerializableState, assertDecimals, assertNonNegative, autoDiscover, backpack, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, connectWallet, createAsyncState, createClient, createClientStore, createDefaultClient, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createStakeController, createStakeHelper, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, createWsolController, createWsolHelper, defaultWalletConnectors, deriveConfirmationStatus, deserializeSolanaState, disconnectWallet, fetchAccount, fetchBalance, fetchLookupTable, fetchLookupTables, fetchNonceAccount, getInitialSerializableState, getWalletStandardConnectors, injected, insertReferenceKey, insertReferenceKeys, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, metamask, normalizeSignature, phantom, pow10, prepareTransaction, requestAirdrop, resolveClientConfig, resolveCluster, sendTransaction, serializeSolanaState, setCluster, solflare, stableStringify, subscribeSolanaState, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
4075
+ export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, TOKEN_PROGRAMS, WRAPPED_SOL_MINT, applyRatio, applySerializableState, assertDecimals, assertNonNegative, autoDiscover, backpack, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, connectWallet, createAsyncState, createClient, createClientStore, createDefaultClient, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createStakeController, createStakeHelper, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, createWsolController, createWsolHelper, defaultWalletConnectors, deriveConfirmationStatus, deserializeSolanaState, detectTokenProgram, disconnectWallet, fetchAccount, fetchBalance, fetchLookupTable, fetchLookupTables, fetchNonceAccount, filterByNames, getInitialSerializableState, getWalletStandardConnectors, injected, insertReferenceKey, insertReferenceKeys, isKnownTokenProgram, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, metamask, normalizeSignature, phantom, pow10, prepareTransaction, requestAirdrop, resolveClientConfig, resolveCluster, sendTransaction, serializeSolanaState, setCluster, solflare, stableStringify, subscribeSolanaState, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
4013
4076
  //# sourceMappingURL=index.node.mjs.map
4014
4077
  //# sourceMappingURL=index.node.mjs.map
@@ -38,8 +38,12 @@ export type SplTokenHelperConfig = Readonly<{
38
38
  decimals?: number;
39
39
  /** The SPL token mint address. */
40
40
  mint: Address | string;
41
- /** Token Program address. Defaults to standard Token Program. */
42
- tokenProgram?: Address | string;
41
+ /**
42
+ * Token Program address. Defaults to standard Token Program.
43
+ * Set to 'auto' to automatically detect based on mint account owner.
44
+ * Note: Auto-detection requires the mint to already exist on-chain.
45
+ */
46
+ tokenProgram?: Address | string | 'auto';
43
47
  }>;
44
48
  /**
45
49
  * SPL token balance information for an owner's Associated Token Account.
@@ -159,9 +163,10 @@ type PreparedSplTransfer = Readonly<{
159
163
  export type SplTokenHelper = Readonly<{
160
164
  /**
161
165
  * Derives the Associated Token Account (ATA) address for an owner.
162
- * The ATA is a deterministic address based on the owner and mint.
166
+ * The ATA is a deterministic address based on the owner, mint, and token program.
167
+ * When using tokenProgram: 'auto', the commitment is used for program detection.
163
168
  */
164
- deriveAssociatedTokenAddress(owner: Address | string): Promise<Address>;
169
+ deriveAssociatedTokenAddress(owner: Address | string, commitment?: Commitment): Promise<Address>;
165
170
  /**
166
171
  * Fetches the token balance for an owner's Associated Token Account.
167
172
  * Returns balance info including whether the account exists.
@@ -1 +1 @@
1
- {"version":3,"file":"spl.d.ts","sourceRoot":"","sources":["../../../src/features/spl.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,UAAU,EAWf,SAAS,EACT,iCAAiC,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD;;;GAGG;AACH,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH;;;GAGG;AACH,KAAK,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC;AAEnE,KAAK,6BAA6B,GAAG,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC3C,0EAA0E;IAC1E,sBAAsB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1C,sCAAsC;IACtC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,iEAAiE;IACjE,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACtC,0DAA0D;IAC1D,MAAM,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BAA8B;IAC9B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,IAAI,CAAC,EAAE,eAAe,CAAC;CACvB,CAAC,CAAC;AAmCH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACrC;;;;OAIG;IACH,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjG;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACzF;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChF;;;OAGG;IACH,oBAAoB,CACnB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,YAAY,CACX,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAkP/G"}
@@ -0,0 +1,53 @@
1
+ import { type Address, type Commitment } from '@solana/kit';
2
+ import { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
3
+ import { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
4
+ import type { SolanaClientRuntime } from '../rpc/types';
5
+ /**
6
+ * Identifier for supported token programs.
7
+ */
8
+ export type TokenProgramId = 'token' | 'token-2022';
9
+ /**
10
+ * Result of detecting which token program owns a mint.
11
+ */
12
+ export type TokenProgramDetectionResult = Readonly<{
13
+ /** The program identifier ('token' or 'token-2022'). */
14
+ programId: TokenProgramId;
15
+ /** The program address. */
16
+ programAddress: Address;
17
+ }>;
18
+ /**
19
+ * Map of token program IDs to their addresses.
20
+ */
21
+ export declare const TOKEN_PROGRAMS: {
22
+ readonly token: Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
23
+ readonly 'token-2022': Address<"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb">;
24
+ };
25
+ export { TOKEN_PROGRAM_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS };
26
+ /**
27
+ * Detects which token program owns a mint account by examining its owner.
28
+ *
29
+ * @param runtime - The Solana client runtime with RPC connection.
30
+ * @param mint - The mint account address to check.
31
+ * @param commitment - Optional commitment level for the RPC call.
32
+ * @returns The detected token program information.
33
+ * @throws If the mint account doesn't exist or is owned by an unknown program.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { detectTokenProgram } from '@solana/client';
38
+ *
39
+ * const result = await detectTokenProgram(runtime, mintAddress);
40
+ * if (result.programId === 'token-2022') {
41
+ * console.log('This is a Token 2022 mint');
42
+ * }
43
+ * ```
44
+ */
45
+ export declare function detectTokenProgram(runtime: SolanaClientRuntime, mint: Address, commitment?: Commitment): Promise<TokenProgramDetectionResult>;
46
+ /**
47
+ * Checks if an address is a known token program (Token or Token 2022).
48
+ *
49
+ * @param programAddress - The program address to check.
50
+ * @returns True if the address is a known token program.
51
+ */
52
+ export declare function isKnownTokenProgram(programAddress: Address | string): boolean;
53
+ //# sourceMappingURL=tokenPrograms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenPrograms.d.ts","sourceRoot":"","sources":["../../../src/features/tokenPrograms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,wDAAwD;IACxD,SAAS,EAAE,cAAc,CAAC;IAC1B,2BAA2B;IAC3B,cAAc,EAAE,OAAO,CAAC;CACxB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAGX,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,CAAC;AAE7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,UAAU,GACrB,OAAO,CAAC,2BAA2B,CAAC,CA0BtC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAG7E"}
@@ -9,6 +9,7 @@ export { createWsolController, type WsolController, type WsolControllerConfig, t
9
9
  export { createSolTransferHelper, type SolTransferHelper, type SolTransferPrepareConfig, type SolTransferSendOptions, } from './features/sol';
10
10
  export { createSplTokenHelper, type SplTokenBalance, type SplTokenHelper, type SplTokenHelperConfig, type SplTransferPrepareConfig, } from './features/spl';
11
11
  export { createStakeHelper, type StakeAccount, type StakeHelper, type StakePrepareConfig, type StakeSendOptions, type UnstakePrepareConfig, type UnstakeSendOptions, type WithdrawPrepareConfig, type WithdrawSendOptions, } from './features/stake';
12
+ export { detectTokenProgram, isKnownTokenProgram, TOKEN_2022_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, TOKEN_PROGRAMS, type TokenProgramDetectionResult, type TokenProgramId, } from './features/tokenPrograms';
12
13
  export { createTransactionHelper, createTransactionRecipe, type TransactionHelper, type TransactionInstructionInput, type TransactionPrepareAndSendRequest, type TransactionPrepared, type TransactionPrepareRequest, type TransactionRecipe, type TransactionRecipeContext, type TransactionSendOptions, type TransactionSignOptions, } from './features/transactions';
13
14
  export { createWsolHelper, WRAPPED_SOL_MINT, type WsolBalance, type WsolHelper, type WsolUnwrapPrepareConfig, type WsolWrapPrepareConfig, } from './features/wsol';
14
15
  export { createTokenAmount, type FormatAmountOptions, type ParseAmountOptions, type TokenAmountMath, } from './numeric/amounts';
@@ -29,7 +30,7 @@ export type { AccountCache, AccountCacheEntry, AccountWatcherConfig, AddressLook
29
30
  export { type AddressLike, toAddress, toAddressString } from './utils/addressLike';
30
31
  export { type ClusterMoniker, resolveCluster } from './utils/cluster';
31
32
  export { stableStringify } from './utils/stableStringify';
32
- export { autoDiscover, backpack, injected, metamask, phantom, solflare } from './wallet/connectors';
33
+ export { autoDiscover, backpack, filterByNames, injected, metamask, phantom, solflare } from './wallet/connectors';
33
34
  export { createWalletRegistry } from './wallet/registry';
34
35
  export { createWalletStandardConnector, getWalletStandardConnectors, watchWalletStandardConnectors, } from './wallet/standard';
35
36
  export type { WalletConnector, WalletConnectorMetadata, WalletRegistry, WalletSession, WalletStatus, } from './wallet/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EA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,MAAM,qBAAqB,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACN,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,GAC7B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,YAAY,GACZ,MAAM,gBAAgB,CAAC"}
@@ -13,6 +13,19 @@ export declare function autoDiscover(options?: DiscoveryOptions): readonly Walle
13
13
  * Creates a connector for any Wallet Standard wallet that supports connect.
14
14
  */
15
15
  export declare function injected(options?: Parameters<typeof createWalletStandardConnector>[1]): WalletConnector;
16
+ /**
17
+ * Creates a filter function for autoDiscover that matches wallets by name.
18
+ * Useful for filtering to specific wallets without using wallet-specific connector functions.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * // Filter to only Phantom and Solflare wallets
23
+ * const connectors = autoDiscover({
24
+ * filter: filterByNames('phantom', 'solflare')
25
+ * });
26
+ * ```
27
+ */
28
+ export declare function filterByNames(...names: string[]): (wallet: Wallet) => boolean;
16
29
  /**
17
30
  * Factory for a Phantom-only connector.
18
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../../src/wallet/connectors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,KAAK,gBAAgB,GAAG,QAAQ,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CACrC,CAAC,CAAC;AAEH;;GAEG;AACH,wBAA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;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,eAAe,EAAE,CAYvF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAuBvG;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,IAEvC,QAAQ,MAAM,aACtB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,eAAe,EAAE,CAKjH;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,eAAe,EAAE,CAKlH;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,eAAe,EAAE,CAKlH;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,eAAe,EAAE,CAKlH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/client",
3
- "version": "1.4.1",
3
+ "version": "1.6.0",
4
4
  "description": "Framework-agnostic Solana client orchestration layer powering higher-level experiences",
5
5
  "exports": {
6
6
  ".": {
@@ -55,9 +55,10 @@
55
55
  "@solana/kit": "^5.0.0",
56
56
  "@solana/transactions": "^5.0.0",
57
57
  "@solana/transaction-confirmation": "^5.0.0",
58
- "@solana-program/system": "^0.9.0",
59
- "@solana-program/compute-budget": "^0.9.0",
60
- "@solana-program/token": "^0.5.1",
58
+ "@solana-program/system": "^0.10.0",
59
+ "@solana-program/compute-budget": "^0.11.0",
60
+ "@solana-program/token": "^0.9.0",
61
+ "@solana-program/token-2022": "^0.7.0",
61
62
  "@solana-program/address-lookup-table": "^0.10.0",
62
63
  "@wallet-standard/app": "^1.0.1",
63
64
  "@wallet-standard/base": "^1.1.0",