Socket
Socket
Sign inDemoInstall

@solana/spl-token

Package Overview
Dependencies
Maintainers
15
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/spl-token - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

lib/cjs/actions/createAssociatedTokenAccountIdempotent.js

1

lib/cjs/actions/index.js

@@ -25,2 +25,3 @@ "use strict";

__exportStar(require("./createAssociatedTokenAccount.js"), exports);
__exportStar(require("./createAssociatedTokenAccountIdempotent.js"), exports);
__exportStar(require("./createMint.js"), exports);

@@ -27,0 +28,0 @@ __exportStar(require("./createMultisig.js"), exports);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAssociatedTokenAccountInstruction = void 0;
exports.createAssociatedTokenAccountIdempotentInstruction = exports.createAssociatedTokenAccountInstruction = void 0;
const web3_js_1 = require("@solana/web3.js");
const constants_js_1 = require("../constants.js");
/**
* Construct an AssociatedTokenAccount instruction
* Construct a CreateAssociatedTokenAccount instruction
*

@@ -19,2 +19,22 @@ * @param payer Payer of the initialization fees

function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, Buffer.alloc(0), programId, associatedTokenProgramId);
}
exports.createAssociatedTokenAccountInstruction = createAssociatedTokenAccountInstruction;
/**
* Construct a CreateAssociatedTokenAccountIdempotent instruction
*
* @param payer Payer of the initialization fees
* @param associatedToken New associated token account
* @param owner Owner of the new account
* @param mint Token mint account
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
*
* @return Instruction to add to a transaction
*/
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, Buffer.from([1]), programId, associatedTokenProgramId);
}
exports.createAssociatedTokenAccountIdempotentInstruction = createAssociatedTokenAccountIdempotentInstruction;
function buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, instructionData, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
const keys = [

@@ -31,6 +51,5 @@ { pubkey: payer, isSigner: true, isWritable: true },

programId: associatedTokenProgramId,
data: Buffer.alloc(0),
data: instructionData,
});
}
exports.createAssociatedTokenAccountInstruction = createAssociatedTokenAccountInstruction;
//# sourceMappingURL=associatedTokenAccount.js.map

@@ -9,2 +9,3 @@ export * from './amountToUiAmount.js';

export * from './createAssociatedTokenAccount.js';
export * from './createAssociatedTokenAccountIdempotent.js';
export * from './createMint.js';

@@ -11,0 +12,0 @@ export * from './createMultisig.js';

import { SystemProgram, TransactionInstruction } from '@solana/web3.js';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';
/**
* Construct an AssociatedTokenAccount instruction
* Construct a CreateAssociatedTokenAccount instruction
*

@@ -16,2 +16,20 @@ * @param payer Payer of the initialization fees

export function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
return buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, Buffer.alloc(0), programId, associatedTokenProgramId);
}
/**
* Construct a CreateAssociatedTokenAccountIdempotent instruction
*
* @param payer Payer of the initialization fees
* @param associatedToken New associated token account
* @param owner Owner of the new account
* @param mint Token mint account
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
*
* @return Instruction to add to a transaction
*/
export function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
return buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, Buffer.from([1]), programId, associatedTokenProgramId);
}
function buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, instructionData, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
const keys = [

@@ -28,5 +46,5 @@ { pubkey: payer, isSigner: true, isWritable: true },

programId: associatedTokenProgramId,
data: Buffer.alloc(0),
data: instructionData,
});
}
//# sourceMappingURL=associatedTokenAccount.js.map

@@ -9,2 +9,3 @@ export * from './amountToUiAmount.js';

export * from './createAssociatedTokenAccount.js';
export * from './createAssociatedTokenAccountIdempotent.js';
export * from './createMint.js';

@@ -11,0 +12,0 @@ export * from './createMultisig.js';

import type { PublicKey } from '@solana/web3.js';
import { TransactionInstruction } from '@solana/web3.js';
/**
* Construct an AssociatedTokenAccount instruction
* Construct a CreateAssociatedTokenAccount instruction
*

@@ -16,2 +16,15 @@ * @param payer Payer of the initialization fees

export declare function createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
/**
* Construct a CreateAssociatedTokenAccountIdempotent instruction
*
* @param payer Payer of the initialization fees
* @param associatedToken New associated token account
* @param owner Owner of the new account
* @param mint Token mint account
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
*
* @return Instruction to add to a transaction
*/
export declare function createAssociatedTokenAccountIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction;
//# sourceMappingURL=associatedTokenAccount.d.ts.map

2

package.json
{
"name": "@solana/spl-token",
"description": "SPL Token Program JS API",
"version": "0.3.5",
"version": "0.3.6",
"author": "Solana Maintainers <maintainers@solana.foundation>",

@@ -6,0 +6,0 @@ "repository": "https://github.com/solana-labs/solana-program-library",

@@ -9,2 +9,3 @@ export * from './amountToUiAmount.js';

export * from './createAssociatedTokenAccount.js';
export * from './createAssociatedTokenAccountIdempotent.js';
export * from './createMint.js';

@@ -11,0 +12,0 @@ export * from './createMultisig.js';

@@ -6,3 +6,3 @@ import type { PublicKey } from '@solana/web3.js';

/**
* Construct an AssociatedTokenAccount instruction
* Construct a CreateAssociatedTokenAccount instruction
*

@@ -26,2 +26,53 @@ * @param payer Payer of the initialization fees

): TransactionInstruction {
return buildAssociatedTokenAccountInstruction(
payer,
associatedToken,
owner,
mint,
Buffer.alloc(0),
programId,
associatedTokenProgramId
);
}
/**
* Construct a CreateAssociatedTokenAccountIdempotent instruction
*
* @param payer Payer of the initialization fees
* @param associatedToken New associated token account
* @param owner Owner of the new account
* @param mint Token mint account
* @param programId SPL Token program account
* @param associatedTokenProgramId SPL Associated Token program account
*
* @return Instruction to add to a transaction
*/
export function createAssociatedTokenAccountIdempotentInstruction(
payer: PublicKey,
associatedToken: PublicKey,
owner: PublicKey,
mint: PublicKey,
programId = TOKEN_PROGRAM_ID,
associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID
): TransactionInstruction {
return buildAssociatedTokenAccountInstruction(
payer,
associatedToken,
owner,
mint,
Buffer.from([1]),
programId,
associatedTokenProgramId
);
}
function buildAssociatedTokenAccountInstruction(
payer: PublicKey,
associatedToken: PublicKey,
owner: PublicKey,
mint: PublicKey,
instructionData: Buffer,
programId = TOKEN_PROGRAM_ID,
associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID
): TransactionInstruction {
const keys = [

@@ -39,4 +90,4 @@ { pubkey: payer, isSigner: true, isWritable: true },

programId: associatedTokenProgramId,
data: Buffer.alloc(0),
data: instructionData,
});
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc