@dynamic-labs/solana-core 4.98.0 → 4.99.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [4.99.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.98.0...v4.99.0) (2026-09-10)
3
+
4
+
5
+ ### Features
6
+
7
+ * **solana-core:** standalone sponsored ATA creation [v4 backport] ([#12366](https://github.com/dynamic-labs/dynamic-auth/issues/12366)) ([46d86c9](https://github.com/dynamic-labs/dynamic-auth/commit/46d86c9a1a04c45bf045acc5c6df792dcd4b3590))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * do not report wallets installed from a provider selection router (v4) ([#12341](https://github.com/dynamic-labs/dynamic-auth/issues/12341)) ([6b02087](https://github.com/dynamic-labs/dynamic-auth/commit/6b02087685545bb6f672eb9040316d01489c82f4))
13
+ * **screening:** soften the blocked-wallet copy to be provider-neutral (v4) ([#12359](https://github.com/dynamic-labs/dynamic-auth/issues/12359)) ([d6772df](https://github.com/dynamic-labs/dynamic-auth/commit/d6772dfc1419811bfbc1d9cb1db58fe12274d397))
14
+ * **waas:** detach the superseded WaaS client from the iframe reverse channel (v4) ([#12349](https://github.com/dynamic-labs/dynamic-auth/issues/12349)) ([393253d](https://github.com/dynamic-labs/dynamic-auth/commit/393253d9e5934e039e21b85ed6ceded760e0f225)), closes [#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766) [#12348](https://github.com/dynamic-labs/dynamic-auth/issues/12348)
15
+
2
16
  ## [4.98.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.97.0...v4.98.0) (2026-09-02)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.98.0";
6
+ var version = "4.99.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.98.0";
2
+ var version = "4.99.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/solana-core",
3
- "version": "4.98.0",
3
+ "version": "4.99.0",
4
4
  "description": "Core package for utilities and types for solana",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -19,14 +19,14 @@
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
21
  "@dynamic-labs/sdk-api-core": "0.12.0",
22
- "@dynamic-labs/utils": "4.98.0",
22
+ "@dynamic-labs/utils": "4.99.0",
23
23
  "@solana/web3.js": "1.98.1",
24
24
  "@solana/spl-token": "0.4.14",
25
- "@dynamic-labs/assert-package-version": "4.98.0",
26
- "@dynamic-labs/rpc-providers": "4.98.0",
27
- "@dynamic-labs/types": "4.98.0",
28
- "@dynamic-labs/wallet-book": "4.98.0",
29
- "@dynamic-labs/wallet-connector-core": "4.98.0",
25
+ "@dynamic-labs/assert-package-version": "4.99.0",
26
+ "@dynamic-labs/rpc-providers": "4.99.0",
27
+ "@dynamic-labs/types": "4.99.0",
28
+ "@dynamic-labs/wallet-book": "4.99.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.99.0",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "peerDependencies": {}
package/src/index.cjs CHANGED
@@ -17,6 +17,7 @@ var getGenesisHashLSKey = require('./utils/getGenesisHashLSKey/getGenesisHashLSK
17
17
  var isTransactionSigned = require('./utils/isTransactionSigned/isTransactionSigned.cjs');
18
18
  var getOverrideRpcUrlForNetwork = require('./utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.cjs');
19
19
  var createNonNativeTokenTransfer = require('./utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.cjs');
20
+ var createAssociatedTokenAccountTransaction = require('./utils/createAssociatedTokenAccountTransaction/createAssociatedTokenAccountTransaction.cjs');
20
21
  var createSolTransfer = require('./utils/createSolTransfer/createSolTransfer.cjs');
21
22
  var getBackwardsCompatibleSolNetworks = require('./utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.cjs');
22
23
  var serializeTransactionForScreening = require('./utils/serializeTransactionForScreening/serializeTransactionForScreening.cjs');
@@ -38,6 +39,7 @@ exports.getGenesisHashLSKey = getGenesisHashLSKey.getGenesisHashLSKey;
38
39
  exports.isTxAlreadySigned = isTransactionSigned.isTxAlreadySigned;
39
40
  exports.getOverrideRpcUrlForNetwork = getOverrideRpcUrlForNetwork.getOverrideRpcUrlForNetwork;
40
41
  exports.createNonNativeTokenTransfer = createNonNativeTokenTransfer.createNonNativeTokenTransfer;
42
+ exports.createAssociatedTokenAccountTransaction = createAssociatedTokenAccountTransaction.createAssociatedTokenAccountTransaction;
41
43
  exports.createSolTransfer = createSolTransfer.createSolTransfer;
42
44
  exports.getBackwardsCompatibleSolNetworks = getBackwardsCompatibleSolNetworks.getBackwardsCompatibleSolNetworks;
43
45
  exports.serializeTransactionForScreening = serializeTransactionForScreening.serializeTransactionForScreening;
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ export { getGenesisHashLSKey } from './utils/getGenesisHashLSKey/getGenesisHashL
13
13
  export { isTxAlreadySigned } from './utils/isTransactionSigned/isTransactionSigned.js';
14
14
  export { getOverrideRpcUrlForNetwork } from './utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.js';
15
15
  export { createNonNativeTokenTransfer } from './utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.js';
16
+ export { createAssociatedTokenAccountTransaction } from './utils/createAssociatedTokenAccountTransaction/createAssociatedTokenAccountTransaction.js';
16
17
  export { createSolTransfer } from './utils/createSolTransfer/createSolTransfer.js';
17
18
  export { getBackwardsCompatibleSolNetworks } from './utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.js';
18
19
  export { serializeTransactionForScreening } from './utils/serializeTransactionForScreening/serializeTransactionForScreening.js';
@@ -0,0 +1,40 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var splToken = require('@solana/spl-token');
8
+ var web3_js = require('@solana/web3.js');
9
+
10
+ /**
11
+ * Builds a standalone transaction that creates the owner's associated token
12
+ * account for the given mint, if it doesn't already exist — returns
13
+ * undefined (no transaction to send) when it's already there. Kept separate
14
+ * from any transfer/swap instructions so it can be sponsored and sent on its
15
+ * own, without competing for space in an already-large transaction.
16
+ */
17
+ const createAssociatedTokenAccountTransaction = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ connection, ownerAddress, tokenAddress, blockhash, lastValidBlockHeight, }) {
18
+ const ownerPublicKey = new web3_js.PublicKey(ownerAddress);
19
+ const tokenPublicKey = new web3_js.PublicKey(tokenAddress);
20
+ const mintAccountInfo = yield connection.getAccountInfo(tokenPublicKey);
21
+ const tokenProgramId = mintAccountInfo && mintAccountInfo.owner.equals(splToken.TOKEN_2022_PROGRAM_ID)
22
+ ? splToken.TOKEN_2022_PROGRAM_ID
23
+ : splToken.TOKEN_PROGRAM_ID;
24
+ const associatedTokenAddress = yield splToken.getAssociatedTokenAddress(tokenPublicKey, ownerPublicKey, false, tokenProgramId);
25
+ try {
26
+ yield connection.getTokenAccountBalance(associatedTokenAddress);
27
+ // Already exists — nothing to do.
28
+ return undefined;
29
+ }
30
+ catch (_b) {
31
+ // Doesn't exist yet — build the create instruction below.
32
+ }
33
+ const transaction = new web3_js.Transaction().add(splToken.createAssociatedTokenAccountIdempotentInstruction(ownerPublicKey, associatedTokenAddress, ownerPublicKey, tokenPublicKey, tokenProgramId));
34
+ transaction.recentBlockhash = blockhash;
35
+ transaction.lastValidBlockHeight = lastValidBlockHeight;
36
+ transaction.feePayer = ownerPublicKey;
37
+ return transaction;
38
+ });
39
+
40
+ exports.createAssociatedTokenAccountTransaction = createAssociatedTokenAccountTransaction;
@@ -0,0 +1,15 @@
1
+ import { Connection, Transaction } from '@solana/web3.js';
2
+ /**
3
+ * Builds a standalone transaction that creates the owner's associated token
4
+ * account for the given mint, if it doesn't already exist — returns
5
+ * undefined (no transaction to send) when it's already there. Kept separate
6
+ * from any transfer/swap instructions so it can be sponsored and sent on its
7
+ * own, without competing for space in an already-large transaction.
8
+ */
9
+ export declare const createAssociatedTokenAccountTransaction: ({ connection, ownerAddress, tokenAddress, blockhash, lastValidBlockHeight, }: {
10
+ connection: Connection;
11
+ ownerAddress: string;
12
+ tokenAddress: string;
13
+ blockhash: string;
14
+ lastValidBlockHeight: number;
15
+ }) => Promise<Transaction | undefined>;
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddress, createAssociatedTokenAccountIdempotentInstruction } from '@solana/spl-token';
4
+ import { PublicKey, Transaction } from '@solana/web3.js';
5
+
6
+ /**
7
+ * Builds a standalone transaction that creates the owner's associated token
8
+ * account for the given mint, if it doesn't already exist — returns
9
+ * undefined (no transaction to send) when it's already there. Kept separate
10
+ * from any transfer/swap instructions so it can be sponsored and sent on its
11
+ * own, without competing for space in an already-large transaction.
12
+ */
13
+ const createAssociatedTokenAccountTransaction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connection, ownerAddress, tokenAddress, blockhash, lastValidBlockHeight, }) {
14
+ const ownerPublicKey = new PublicKey(ownerAddress);
15
+ const tokenPublicKey = new PublicKey(tokenAddress);
16
+ const mintAccountInfo = yield connection.getAccountInfo(tokenPublicKey);
17
+ const tokenProgramId = mintAccountInfo && mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID)
18
+ ? TOKEN_2022_PROGRAM_ID
19
+ : TOKEN_PROGRAM_ID;
20
+ const associatedTokenAddress = yield getAssociatedTokenAddress(tokenPublicKey, ownerPublicKey, false, tokenProgramId);
21
+ try {
22
+ yield connection.getTokenAccountBalance(associatedTokenAddress);
23
+ // Already exists — nothing to do.
24
+ return undefined;
25
+ }
26
+ catch (_b) {
27
+ // Doesn't exist yet — build the create instruction below.
28
+ }
29
+ const transaction = new Transaction().add(createAssociatedTokenAccountIdempotentInstruction(ownerPublicKey, associatedTokenAddress, ownerPublicKey, tokenPublicKey, tokenProgramId));
30
+ transaction.recentBlockhash = blockhash;
31
+ transaction.lastValidBlockHeight = lastValidBlockHeight;
32
+ transaction.feePayer = ownerPublicKey;
33
+ return transaction;
34
+ });
35
+
36
+ export { createAssociatedTokenAccountTransaction };
@@ -0,0 +1 @@
1
+ export { createAssociatedTokenAccountTransaction } from './createAssociatedTokenAccountTransaction';
@@ -6,6 +6,7 @@ export { getGenesisHashLSKey } from './getGenesisHashLSKey';
6
6
  export { isTxAlreadySigned } from './isTransactionSigned';
7
7
  export { getOverrideRpcUrlForNetwork } from './getOverrideRpcUrlForNetwork';
8
8
  export { createNonNativeTokenTransfer } from './createNonNativeTokenTransfer';
9
+ export { createAssociatedTokenAccountTransaction } from './createAssociatedTokenAccountTransaction';
9
10
  export { createSolTransfer } from './createSolTransfer';
10
11
  export { getBackwardsCompatibleSolNetworks } from './getBackwardsCompatibleSolNetworks';
11
12
  export { serializeTransactionForScreening } from './serializeTransactionForScreening';
@@ -9,6 +9,7 @@ var utils = require('@dynamic-labs/utils');
9
9
  require('@solana/web3.js');
10
10
  require('@solana/spl-token');
11
11
  var createNonNativeTokenTransfer = require('../utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.cjs');
12
+ var createAssociatedTokenAccountTransaction = require('../utils/createAssociatedTokenAccountTransaction/createAssociatedTokenAccountTransaction.cjs');
12
13
  var createSolTransfer = require('../utils/createSolTransfer/createSolTransfer.cjs');
13
14
  var screenSolanaTransactions = require('../utils/screenSolanaTransactions/screenSolanaTransactions.cjs');
14
15
 
@@ -49,6 +50,34 @@ class SolanaWallet extends walletConnectorCore.Wallet {
49
50
  return signature;
50
51
  });
51
52
  }
53
+ /**
54
+ * Creates the wallet's associated token account for the given mint, as its
55
+ * own standalone (sponsorable) transaction, if it doesn't already exist —
56
+ * returns undefined without signing or sending anything when it's already
57
+ * there. Kept separate from sendBalance/swap flows so it doesn't compete
58
+ * for space with other instructions in an already-large transaction.
59
+ * @param tokenAddress - The mint address to create the associated token account for.
60
+ * @returns The signature of the sent transaction, or undefined if the account already existed.
61
+ */
62
+ createAssociatedTokenAccount(_a) {
63
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ tokenAddress, }) {
64
+ const connection = yield this.getConnection();
65
+ const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash('confirmed');
66
+ const transaction = yield createAssociatedTokenAccountTransaction.createAssociatedTokenAccountTransaction({
67
+ blockhash,
68
+ connection,
69
+ lastValidBlockHeight,
70
+ ownerAddress: this.address,
71
+ tokenAddress,
72
+ });
73
+ if (!transaction) {
74
+ return undefined;
75
+ }
76
+ const signer = yield this.getSigner();
77
+ const { signature } = yield signer.signAndSendTransaction(transaction);
78
+ return signature;
79
+ });
80
+ }
52
81
  /**
53
82
  * Retrieves the RPC connection
54
83
  * @returns A promise that resolves to the RPC connection
@@ -17,6 +17,18 @@ export declare class SolanaWallet extends Wallet<SolanaWalletConnector> {
17
17
  decimals?: number;
18
18
  };
19
19
  }): Promise<string | undefined>;
20
+ /**
21
+ * Creates the wallet's associated token account for the given mint, as its
22
+ * own standalone (sponsorable) transaction, if it doesn't already exist —
23
+ * returns undefined without signing or sending anything when it's already
24
+ * there. Kept separate from sendBalance/swap flows so it doesn't compete
25
+ * for space with other instructions in an already-large transaction.
26
+ * @param tokenAddress - The mint address to create the associated token account for.
27
+ * @returns The signature of the sent transaction, or undefined if the account already existed.
28
+ */
29
+ createAssociatedTokenAccount({ tokenAddress, }: {
30
+ tokenAddress: string;
31
+ }): Promise<string | undefined>;
20
32
  /**
21
33
  * Retrieves the RPC connection
22
34
  * @returns A promise that resolves to the RPC connection
@@ -5,6 +5,7 @@ import { cloneObjectWithOverrides } from '@dynamic-labs/utils';
5
5
  import '@solana/web3.js';
6
6
  import '@solana/spl-token';
7
7
  import { createNonNativeTokenTransfer } from '../utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.js';
8
+ import { createAssociatedTokenAccountTransaction } from '../utils/createAssociatedTokenAccountTransaction/createAssociatedTokenAccountTransaction.js';
8
9
  import { createSolTransfer } from '../utils/createSolTransfer/createSolTransfer.js';
9
10
  import { screenSolanaTransactions } from '../utils/screenSolanaTransactions/screenSolanaTransactions.js';
10
11
 
@@ -45,6 +46,34 @@ class SolanaWallet extends Wallet {
45
46
  return signature;
46
47
  });
47
48
  }
49
+ /**
50
+ * Creates the wallet's associated token account for the given mint, as its
51
+ * own standalone (sponsorable) transaction, if it doesn't already exist —
52
+ * returns undefined without signing or sending anything when it's already
53
+ * there. Kept separate from sendBalance/swap flows so it doesn't compete
54
+ * for space with other instructions in an already-large transaction.
55
+ * @param tokenAddress - The mint address to create the associated token account for.
56
+ * @returns The signature of the sent transaction, or undefined if the account already existed.
57
+ */
58
+ createAssociatedTokenAccount(_a) {
59
+ return __awaiter(this, arguments, void 0, function* ({ tokenAddress, }) {
60
+ const connection = yield this.getConnection();
61
+ const { blockhash, lastValidBlockHeight } = yield connection.getLatestBlockhash('confirmed');
62
+ const transaction = yield createAssociatedTokenAccountTransaction({
63
+ blockhash,
64
+ connection,
65
+ lastValidBlockHeight,
66
+ ownerAddress: this.address,
67
+ tokenAddress,
68
+ });
69
+ if (!transaction) {
70
+ return undefined;
71
+ }
72
+ const signer = yield this.getSigner();
73
+ const { signature } = yield signer.signAndSendTransaction(transaction);
74
+ return signature;
75
+ });
76
+ }
48
77
  /**
49
78
  * Retrieves the RPC connection
50
79
  * @returns A promise that resolves to the RPC connection