@ar.io/sdk 4.0.0-solana.4 → 4.0.0-solana.5

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.
@@ -73,6 +73,8 @@ function toGeneratedFundingSourceSpec(s) {
73
73
  };
74
74
  return { kind: kindMap[s.kind], amount: s.amount };
75
75
  }
76
+ const token_1 = require("@solana-program/token");
77
+ const constants_js_1 = require("./constants.js");
76
78
  const syncAttributes_js_1 = require("./generated/ant/instructions/syncAttributes.js");
77
79
  const index_js_4 = require("./generated/core/instructions/index.js");
78
80
  const delegation_js_1 = require("./generated/gar/accounts/delegation.js");
@@ -277,18 +279,25 @@ class SolanaARIOWriteable extends io_readable_js_1.SolanaARIOReadable {
277
279
  const mint = await this.getMint();
278
280
  const fromATA = await (0, ata_js_1.getAssociatedTokenAddressKit)(mint, this.signer.address);
279
281
  const toATA = await (0, ata_js_1.getAssociatedTokenAddressKit)(mint, recipient);
280
- // The on-chain `Transfer` ix requires `to_token_account` to exist as a
281
- // valid SPL TokenAccount (`AccountNotInitialized` #3012 otherwise).
282
- // Bundle an idempotent CreateAssociatedTokenAccount so a fresh recipient
283
- // wallet just works — same pattern as `vaultedTransfer` below. Idempotent
284
- // means a second transfer to the same recipient is a no-op for this ix.
282
+ // SPL `transferChecked` requires the recipient ATA to exist; bundle
283
+ // an idempotent ATA-create so fresh recipients just work. Same
284
+ // pattern as `vaultedTransfer` below.
285
285
  const createToAtaIx = (0, ata_js_1.buildCreateAtaIdempotentIx)(this.signer.address, toATA, recipient, mint);
286
- const ix = (0, index_js_4.getTransferInstruction)({
287
- fromTokenAccount: fromATA,
288
- toTokenAccount: toATA,
286
+ // Standard SPL Token `transferChecked`. The custom `ario-core::transfer`
287
+ // ix is deprecated — it added no protocol-level accounting, just wrapped
288
+ // this same CPI plus a `TransferEvent` emission that no major Solana
289
+ // indexer needs (Helius, Solscan, etc. all track SPL transfers natively).
290
+ // See `docs/REMOVE_CUSTOM_TRANSFER_PLAN.md` in `ar-io/solana-ar-io`.
291
+ // `transferChecked` (vs `transfer`) validates the mint + decimals
292
+ // on-chain, preventing cross-mint mistakes.
293
+ const ix = (0, token_1.getTransferCheckedInstruction)({
294
+ source: fromATA,
295
+ mint,
296
+ destination: toATA,
289
297
  authority: this.signer,
290
298
  amount,
291
- }, { programAddress: this.coreProgram });
299
+ decimals: constants_js_1.TOKEN_DECIMALS,
300
+ });
292
301
  const sig = await this.sendTransaction([createToAtaIx, ix]);
293
302
  return { id: sig };
294
303
  }
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '4.0.0-solana.4';
20
+ exports.version = '4.0.0-solana.5';
@@ -36,8 +36,10 @@ function toGeneratedFundingSourceSpec(s) {
36
36
  };
37
37
  return { kind: kindMap[s.kind], amount: s.amount };
38
38
  }
39
+ import { getTransferCheckedInstruction } from '@solana-program/token';
40
+ import { TOKEN_DECIMALS } from './constants.js';
39
41
  import { getSyncAttributesInstruction } from './generated/ant/instructions/syncAttributes.js';
40
- import { getApprovePrimaryNameInstructionAsync, getCloseExpiredRequestInstruction, getCreateVaultInstructionAsync, getExtendVaultInstructionAsync, getIncreaseVaultInstructionAsync, getReleaseVaultInstructionAsync, getRequestAndSetPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameInstructionAsync, getRevokeVaultInstructionAsync, getTransferInstruction, getVaultedTransferInstructionAsync, } from './generated/core/instructions/index.js';
42
+ import { getApprovePrimaryNameInstructionAsync, getCloseExpiredRequestInstruction, getCreateVaultInstructionAsync, getExtendVaultInstructionAsync, getIncreaseVaultInstructionAsync, getReleaseVaultInstructionAsync, getRequestAndSetPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameFromFundingPlanInstructionAsync, getRequestPrimaryNameInstructionAsync, getRevokeVaultInstructionAsync, getVaultedTransferInstructionAsync, } from './generated/core/instructions/index.js';
41
43
  import { getDelegationDecoder } from './generated/gar/accounts/delegation.js';
42
44
  import { getGatewayDecoder } from './generated/gar/accounts/gateway.js';
43
45
  import { getAllowDelegateInstructionAsync, getCancelWithdrawalInstruction, getClaimDelegateFromLeavingGatewayInstructionAsync, getClaimWithdrawalInstructionAsync, getCloseDrainedWithdrawalInstruction, getCloseEmptyDelegationInstruction, getCloseEpochInstructionAsync, getCloseObservationInstructionAsync, getCreateEpochInstructionAsync, getDecreaseDelegateStakeInstructionAsync, getDecreaseOperatorStakeInstructionAsync, getDelegateStakeInstructionAsync, getDisallowDelegateInstructionAsync, getDistributeEpochInstructionAsync, getFinalizeGoneInstructionAsync, getIncreaseOperatorStakeInstructionAsync, getInstantWithdrawalInstructionAsync, getJoinNetworkInstructionAsync, getLeaveNetworkInstructionAsync, getPrescribeEpochInstructionAsync, getPruneGatewayInstructionAsync, getRedelegateStakeInstructionAsync, getSaveObservationsInstructionAsync, getSetAllowlistEnabledInstructionAsync, getTallyWeightsInstructionAsync, getUpdateGatewaySettingsInstructionAsync, } from './generated/gar/instructions/index.js';
@@ -240,18 +242,25 @@ export class SolanaARIOWriteable extends SolanaARIOReadable {
240
242
  const mint = await this.getMint();
241
243
  const fromATA = await getAssociatedTokenAddressKit(mint, this.signer.address);
242
244
  const toATA = await getAssociatedTokenAddressKit(mint, recipient);
243
- // The on-chain `Transfer` ix requires `to_token_account` to exist as a
244
- // valid SPL TokenAccount (`AccountNotInitialized` #3012 otherwise).
245
- // Bundle an idempotent CreateAssociatedTokenAccount so a fresh recipient
246
- // wallet just works — same pattern as `vaultedTransfer` below. Idempotent
247
- // means a second transfer to the same recipient is a no-op for this ix.
245
+ // SPL `transferChecked` requires the recipient ATA to exist; bundle
246
+ // an idempotent ATA-create so fresh recipients just work. Same
247
+ // pattern as `vaultedTransfer` below.
248
248
  const createToAtaIx = buildCreateAtaIdempotentIx(this.signer.address, toATA, recipient, mint);
249
- const ix = getTransferInstruction({
250
- fromTokenAccount: fromATA,
251
- toTokenAccount: toATA,
249
+ // Standard SPL Token `transferChecked`. The custom `ario-core::transfer`
250
+ // ix is deprecated — it added no protocol-level accounting, just wrapped
251
+ // this same CPI plus a `TransferEvent` emission that no major Solana
252
+ // indexer needs (Helius, Solscan, etc. all track SPL transfers natively).
253
+ // See `docs/REMOVE_CUSTOM_TRANSFER_PLAN.md` in `ar-io/solana-ar-io`.
254
+ // `transferChecked` (vs `transfer`) validates the mint + decimals
255
+ // on-chain, preventing cross-mint mistakes.
256
+ const ix = getTransferCheckedInstruction({
257
+ source: fromATA,
258
+ mint,
259
+ destination: toATA,
252
260
  authority: this.signer,
253
261
  amount,
254
- }, { programAddress: this.coreProgram });
262
+ decimals: TOKEN_DECIMALS,
263
+ });
255
264
  const sig = await this.sendTransaction([createToAtaIx, ix]);
256
265
  return { id: sig };
257
266
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '4.0.0-solana.4';
17
+ export const version = '4.0.0-solana.5';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "4.0.0-solana.3";
16
+ export declare const version = "4.0.0-solana.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "4.0.0-solana.4",
3
+ "version": "4.0.0-solana.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -9,6 +9,7 @@
9
9
  "module": "./lib/esm/node/index.js",
10
10
  "types": "./lib/types/node/index.d.ts",
11
11
  "type": "module",
12
+ "packageManager": "yarn@1.22.22",
12
13
  "engines": {
13
14
  "node": ">=18"
14
15
  },
@@ -133,6 +134,7 @@
133
134
  "@dha-team/arbundles": "^1.0.1",
134
135
  "@permaweb/aoconnect": "0.0.68",
135
136
  "@solana-program/compute-budget": "^0.15.0",
137
+ "@solana-program/token": "^0.13.0",
136
138
  "@solana/kit": "^6.8.0",
137
139
  "arweave": "1.15.5",
138
140
  "axios": "^1.13.2",