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.4.1 to 0.4.2

lib/cjs/extensions/tokenGroup/actions.js

4

lib/cjs/actions/amountToUiAmount.js

@@ -27,4 +27,4 @@ "use strict";

*/
function amountToUiAmount(connection, payer, mint, amount, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function amountToUiAmount(connection_1, payer_1, mint_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, amount, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, amountToUiAmount_js_1.createAmountToUiAmountInstruction)(mint, amount, programId));

@@ -31,0 +31,0 @@ const { returnData, err } = (yield connection.simulateTransaction(transaction, [payer], false)).value;

@@ -32,4 +32,4 @@ "use strict";

*/
function approve(connection, payer, account, delegate, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function approve(connection_1, payer_1, account_1, delegate_1, owner_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, delegate, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -36,0 +36,0 @@ const transaction = new web3_js_1.Transaction().add((0, approve_js_1.createApproveInstruction)(account, delegate, ownerPublicKey, amount, multiSigners, programId));

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

* @param payer Payer of the transaction fees
* @param mint Address of the mint
* @param account Address of the account

@@ -35,4 +36,4 @@ * @param delegate Account authorized to perform a transfer tokens from the source account

*/
function approveChecked(connection, payer, mint, account, delegate, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function approveChecked(connection_1, payer_1, mint_1, account_1, delegate_1, owner_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, account, delegate, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -39,0 +40,0 @@ const transaction = new web3_js_1.Transaction().add((0, approveChecked_js_1.createApproveCheckedInstruction)(account, mint, delegate, ownerPublicKey, amount, decimals, multiSigners, programId));

@@ -32,4 +32,4 @@ "use strict";

*/
function burn(connection, payer, account, mint, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function burn(connection_1, payer_1, account_1, mint_1, owner_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, mint, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -36,0 +36,0 @@ const transaction = new web3_js_1.Transaction().add((0, burn_js_1.createBurnInstruction)(account, mint, ownerPublicKey, amount, multiSigners, programId));

@@ -33,4 +33,4 @@ "use strict";

*/
function burnChecked(connection, payer, account, mint, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function burnChecked(connection_1, payer_1, account_1, mint_1, owner_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, mint, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -37,0 +37,0 @@ const transaction = new web3_js_1.Transaction().add((0, burnChecked_js_1.createBurnCheckedInstruction)(account, mint, ownerPublicKey, amount, decimals, multiSigners, programId));

@@ -31,4 +31,4 @@ "use strict";

*/
function closeAccount(connection, payer, account, destination, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function closeAccount(connection_1, payer_1, account_1, destination_1, authority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, destination, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -35,0 +35,0 @@ const transaction = new web3_js_1.Transaction().add((0, closeAccount_js_1.createCloseAccountInstruction)(account, destination, authorityPublicKey, multiSigners, programId));

@@ -32,4 +32,4 @@ "use strict";

*/
function createAccount(connection, payer, mint, owner, keypair, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createAccount(connection_1, payer_1, mint_1, owner_1, keypair_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, owner, keypair, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
// If a keypair isn't provided, create the associated token account and return its address

@@ -36,0 +36,0 @@ if (!keypair)

@@ -30,4 +30,4 @@ "use strict";

*/
function createAssociatedTokenAccount(connection, payer, mint, owner, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createAssociatedTokenAccount(connection_1, payer_1, mint_1, owner_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, owner, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
const associatedToken = (0, mint_js_1.getAssociatedTokenAddressSync)(mint, owner, false, programId, associatedTokenProgramId);

@@ -34,0 +34,0 @@ const transaction = new web3_js_1.Transaction().add((0, associatedTokenAccount_js_1.createAssociatedTokenAccountInstruction)(payer.publicKey, associatedToken, owner, mint, programId, associatedTokenProgramId));

@@ -31,4 +31,4 @@ "use strict";

*/
function createAssociatedTokenAccountIdempotent(connection, payer, mint, owner, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createAssociatedTokenAccountIdempotent(connection_1, payer_1, mint_1, owner_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, owner, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
const associatedToken = (0, mint_js_1.getAssociatedTokenAddressSync)(mint, owner, false, programId, associatedTokenProgramId);

@@ -35,0 +35,0 @@ const transaction = new web3_js_1.Transaction().add((0, associatedTokenAccount_js_1.createAssociatedTokenAccountIdempotentInstruction)(payer.publicKey, associatedToken, owner, mint, programId, associatedTokenProgramId));

@@ -31,4 +31,4 @@ "use strict";

*/
function createMint(connection, payer, mintAuthority, freezeAuthority, decimals, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createMint(connection_1, payer_1, mintAuthority_1, freezeAuthority_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mintAuthority, freezeAuthority, decimals, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const lamports = yield (0, mint_js_1.getMinimumBalanceForRentExemptMint)(connection);

@@ -35,0 +35,0 @@ const transaction = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.createAccount({

@@ -30,4 +30,4 @@ "use strict";

*/
function createMultisig(connection, payer, signers, m, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createMultisig(connection_1, payer_1, signers_1, m_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, signers, m, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const lamports = yield (0, multisig_js_1.getMinimumBalanceForRentExemptMultisig)(connection);

@@ -34,0 +34,0 @@ const transaction = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.createAccount({

@@ -25,4 +25,4 @@ "use strict";

*/
function createNativeMint(connection, payer, confirmOptions, nativeMint = constants_js_1.NATIVE_MINT_2022, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createNativeMint(connection_1, payer_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, confirmOptions, nativeMint = constants_js_1.NATIVE_MINT_2022, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, createNativeMint_js_1.createCreateNativeMintInstruction)(payer.publicKey, nativeMint, programId));

@@ -29,0 +29,0 @@ yield (0, web3_js_1.sendAndConfirmTransaction)(connection, transaction, [payer], confirmOptions);

@@ -34,4 +34,4 @@ "use strict";

*/
function createWrappedNativeAccount(connection, payer, owner, amount, keypair, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, nativeMint = constants_js_1.NATIVE_MINT) {
return __awaiter(this, void 0, void 0, function* () {
function createWrappedNativeAccount(connection_1, payer_1, owner_1, amount_1, keypair_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, owner, amount, keypair, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, nativeMint = constants_js_1.NATIVE_MINT) {
// If the amount provided is explicitly 0 or NaN, just create the account without funding it

@@ -38,0 +38,0 @@ if (!amount)

@@ -31,4 +31,4 @@ "use strict";

*/
function freezeAccount(connection, payer, account, mint, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function freezeAccount(connection_1, payer_1, account_1, mint_1, authority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, mint, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -35,0 +35,0 @@ const transaction = new web3_js_1.Transaction().add((0, freezeAccount_js_1.createFreezeAccountInstruction)(account, mint, authorityPublicKey, multiSigners, programId));

@@ -34,4 +34,4 @@ "use strict";

*/
function getOrCreateAssociatedTokenAccount(connection, payer, mint, owner, allowOwnerOffCurve = false, commitment, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getOrCreateAssociatedTokenAccount(connection_1, payer_1, mint_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, owner, allowOwnerOffCurve = false, commitment, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
const associatedToken = (0, mint_js_1.getAssociatedTokenAddressSync)(mint, owner, allowOwnerOffCurve, programId, associatedTokenProgramId);

@@ -38,0 +38,0 @@ // This is the optimal logic, considering TX fee, client-side computation, RPC roundtrips and guaranteed idempotent.

@@ -32,4 +32,4 @@ "use strict";

*/
function mintTo(connection, payer, mint, destination, authority, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function mintTo(connection_1, payer_1, mint_1, destination_1, authority_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, destination, authority, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -36,0 +36,0 @@ const transaction = new web3_js_1.Transaction().add((0, mintTo_js_1.createMintToInstruction)(mint, destination, authorityPublicKey, amount, multiSigners, programId));

@@ -33,4 +33,4 @@ "use strict";

*/
function mintToChecked(connection, payer, mint, destination, authority, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function mintToChecked(connection_1, payer_1, mint_1, destination_1, authority_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, destination, authority, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -37,0 +37,0 @@ const transaction = new web3_js_1.Transaction().add((0, mintToChecked_js_1.createMintToCheckedInstruction)(mint, destination, authorityPublicKey, amount, decimals, multiSigners, programId));

@@ -31,4 +31,4 @@ "use strict";

*/
function recoverNested(connection, payer, owner, mint, nestedMint, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function recoverNested(connection_1, payer_1, owner_1, mint_1, nestedMint_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, owner, mint, nestedMint, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
const ownerAssociatedToken = (0, mint_js_1.getAssociatedTokenAddressSync)(mint, owner.publicKey, false, programId, associatedTokenProgramId);

@@ -35,0 +35,0 @@ const destinationAssociatedToken = (0, mint_js_1.getAssociatedTokenAddressSync)(nestedMint, owner.publicKey, false, programId, associatedTokenProgramId);

@@ -30,4 +30,4 @@ "use strict";

*/
function revoke(connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function revoke(connection_1, payer_1, account_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -34,0 +34,0 @@ const transaction = new web3_js_1.Transaction().add((0, revoke_js_1.createRevokeInstruction)(account, ownerPublicKey, multiSigners, programId));

@@ -32,4 +32,4 @@ "use strict";

*/
function setAuthority(connection, payer, account, currentAuthority, authorityType, newAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function setAuthority(connection_1, payer_1, account_1, currentAuthority_1, authorityType_1, newAuthority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, currentAuthority, authorityType, newAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [currentAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(currentAuthority, multiSigners);

@@ -36,0 +36,0 @@ const transaction = new web3_js_1.Transaction().add((0, setAuthority_js_1.createSetAuthorityInstruction)(account, currentAuthorityPublicKey, authorityType, newAuthority, multiSigners, programId));

@@ -27,4 +27,4 @@ "use strict";

*/
function syncNative(connection, payer, account, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function syncNative(connection_1, payer_1, account_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, syncNative_js_1.createSyncNativeInstruction)(account, programId));

@@ -31,0 +31,0 @@ return yield (0, web3_js_1.sendAndConfirmTransaction)(connection, transaction, [payer], confirmOptions);

@@ -31,4 +31,4 @@ "use strict";

*/
function thawAccount(connection, payer, account, mint, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function thawAccount(connection_1, payer_1, account_1, mint_1, authority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, mint, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -35,0 +35,0 @@ const transaction = new web3_js_1.Transaction().add((0, thawAccount_js_1.createThawAccountInstruction)(account, mint, authorityPublicKey, multiSigners, programId));

@@ -32,4 +32,4 @@ "use strict";

*/
function transfer(connection, payer, source, destination, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function transfer(connection_1, payer_1, source_1, destination_1, owner_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, source, destination, owner, amount, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -36,0 +36,0 @@ const transaction = new web3_js_1.Transaction().add((0, transfer_js_1.createTransferInstruction)(source, destination, ownerPublicKey, amount, multiSigners, programId));

@@ -34,4 +34,4 @@ "use strict";

*/
function transferChecked(connection, payer, source, mint, destination, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function transferChecked(connection_1, payer_1, source_1, mint_1, destination_1, owner_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, source, mint, destination, owner, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -38,0 +38,0 @@ const transaction = new web3_js_1.Transaction().add((0, transferChecked_js_1.createTransferCheckedInstruction)(source, mint, destination, ownerPublicKey, amount, decimals, multiSigners, programId));

@@ -28,4 +28,4 @@ "use strict";

*/
function uiAmountToAmount(connection, payer, mint, amount, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function uiAmountToAmount(connection_1, payer_1, mint_1, amount_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, amount, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, uiAmountToAmount_js_1.createUiAmountToAmountInstruction)(mint, amount, programId));

@@ -32,0 +32,0 @@ const { returnData, err } = (yield connection.simulateTransaction(transaction, [payer], false)).value;

@@ -30,4 +30,4 @@ "use strict";

*/
function enableCpiGuard(connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function enableCpiGuard(connection_1, payer_1, account_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -52,4 +52,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createEnableCpiGuardInstruction)(account, ownerPublicKey, signers, programId));

*/
function disableCpiGuard(connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function disableCpiGuard(connection_1, payer_1, account_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -56,0 +56,0 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createDisableCpiGuardInstruction)(account, ownerPublicKey, signers, programId));

@@ -29,4 +29,4 @@ "use strict";

*/
function initializeDefaultAccountState(connection, payer, mint, state, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function initializeDefaultAccountState(connection_1, payer_1, mint_1, state_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, state, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createInitializeDefaultAccountStateInstruction)(mint, state, programId));

@@ -51,4 +51,4 @@ return yield (0, web3_js_1.sendAndConfirmTransaction)(connection, transaction, [payer], confirmOptions);

*/
function updateDefaultAccountState(connection, payer, mint, state, freezeAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function updateDefaultAccountState(connection_1, payer_1, mint_1, state_1, freezeAuthority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, state, freezeAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [freezeAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(freezeAuthority, multiSigners);

@@ -55,0 +55,0 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createUpdateDefaultAccountStateInstruction)(mint, state, freezeAuthorityPublicKey, signers, programId));

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

const index_js_2 = require("./defaultAccountState/index.js");
const index_js_3 = require("./tokenGroup/index.js");
const state_js_1 = require("./groupMemberPointer/state.js");

@@ -15,3 +16,3 @@ const state_js_2 = require("./groupPointer/state.js");

const state_js_3 = require("./interestBearingMint/state.js");
const index_js_3 = require("./memoTransfer/index.js");
const index_js_4 = require("./memoTransfer/index.js");
const state_js_4 = require("./metadataPointer/state.js");

@@ -21,4 +22,4 @@ const mintCloseAuthority_js_1 = require("./mintCloseAuthority.js");

const permanentDelegate_js_1 = require("./permanentDelegate.js");
const index_js_4 = require("./transferFee/index.js");
const index_js_5 = require("./transferHook/index.js");
const index_js_5 = require("./transferFee/index.js");
const index_js_6 = require("./transferHook/index.js");
const constants_js_1 = require("../constants.js");

@@ -49,5 +50,5 @@ // Sequence from https://github.com/solana-labs/solana-program-library/blob/master/token/program-2022/src/extension/mod.rs#L903

ExtensionType[ExtensionType["GroupPointer"] = 20] = "GroupPointer";
// TokenGroup = 21, // Not implemented yet
ExtensionType[ExtensionType["TokenGroup"] = 21] = "TokenGroup";
ExtensionType[ExtensionType["GroupMemberPointer"] = 22] = "GroupMemberPointer";
// TokenGroupMember = 23, // Not implemented yet
ExtensionType[ExtensionType["TokenGroupMember"] = 23] = "TokenGroupMember";
})(ExtensionType || (exports.ExtensionType = ExtensionType = {}));

@@ -74,5 +75,5 @@ exports.TYPE_SIZE = 2;

case ExtensionType.TransferFeeConfig:
return index_js_4.TRANSFER_FEE_CONFIG_SIZE;
return index_js_5.TRANSFER_FEE_CONFIG_SIZE;
case ExtensionType.TransferFeeAmount:
return index_js_4.TRANSFER_FEE_AMOUNT_SIZE;
return index_js_5.TRANSFER_FEE_AMOUNT_SIZE;
case ExtensionType.MintCloseAuthority:

@@ -91,3 +92,3 @@ return mintCloseAuthority_js_1.MINT_CLOSE_AUTHORITY_SIZE;

case ExtensionType.MemoTransfer:
return index_js_3.MEMO_TRANSFER_SIZE;
return index_js_4.MEMO_TRANSFER_SIZE;
case ExtensionType.MetadataPointer:

@@ -104,5 +105,5 @@ return state_js_4.METADATA_POINTER_SIZE;

case ExtensionType.TransferHook:
return index_js_5.TRANSFER_HOOK_SIZE;
return index_js_6.TRANSFER_HOOK_SIZE;
case ExtensionType.TransferHookAccount:
return index_js_5.TRANSFER_HOOK_ACCOUNT_SIZE;
return index_js_6.TRANSFER_HOOK_ACCOUNT_SIZE;
case ExtensionType.GroupPointer:

@@ -112,2 +113,6 @@ return state_js_2.GROUP_POINTER_SIZE;

return state_js_1.GROUP_MEMBER_POINTER_SIZE;
case ExtensionType.TokenGroup:
return index_js_3.TOKEN_GROUP_SIZE;
case ExtensionType.TokenGroupMember:
return index_js_3.TOKEN_GROUP_MEMBER_SIZE;
case ExtensionType.TokenMetadata:

@@ -134,2 +139,4 @@ throw Error(`Cannot get type length for variable extension type: ${e}`);

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return true;

@@ -173,2 +180,4 @@ case ExtensionType.Uninitialized:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return false;

@@ -206,2 +215,4 @@ default:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return ExtensionType.Uninitialized;

@@ -208,0 +219,0 @@ }

@@ -18,3 +18,3 @@ "use strict";

const { authority, memberAddress } = exports.GroupMemberPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -21,0 +21,0 @@ authority: authority.equals(web3_js_1.PublicKey.default) ? null : authority,

@@ -18,3 +18,3 @@ "use strict";

const { authority, groupAddress } = exports.GroupPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -21,0 +21,0 @@ authority: authority.equals(web3_js_1.PublicKey.default) ? null : authority,

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

__exportStar(require("./metadataPointer/index.js"), exports);
__exportStar(require("./tokenGroup/index.js"), exports);
__exportStar(require("./tokenMetadata/index.js"), exports);

@@ -29,0 +30,0 @@ __exportStar(require("./mintCloseAuthority.js"), exports);

@@ -35,4 +35,4 @@ "use strict";

*/
function createInterestBearingMint(connection, payer, mintAuthority, freezeAuthority, rateAuthority, rate, decimals, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createInterestBearingMint(connection_1, payer_1, mintAuthority_1, freezeAuthority_1, rateAuthority_1, rate_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mintAuthority, freezeAuthority, rateAuthority, rate, decimals, keypair = web3_js_1.Keypair.generate(), confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const mintLen = (0, extensionType_js_1.getMintLen)([extensionType_js_1.ExtensionType.InterestBearingConfig]);

@@ -66,4 +66,4 @@ const lamports = yield connection.getMinimumBalanceForRentExemption(mintLen);

*/
function updateRateInterestBearingMint(connection, payer, mint, rateAuthority, rate, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function updateRateInterestBearingMint(connection_1, payer_1, mint_1, rateAuthority_1, rate_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, rateAuthority, rate, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [rateAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(rateAuthority, multiSigners);

@@ -70,0 +70,0 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createUpdateRateInterestBearingMintInstruction)(mint, rateAuthorityPublicKey, rate, signers, programId));

@@ -30,4 +30,4 @@ "use strict";

*/
function enableRequiredMemoTransfers(connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function enableRequiredMemoTransfers(connection_1, payer_1, account_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -52,4 +52,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createEnableRequiredMemoTransfersInstruction)(account, ownerPublicKey, signers, programId));

*/
function disableRequiredMemoTransfers(connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function disableRequiredMemoTransfers(connection_1, payer_1, account_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, account, owner, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -56,0 +56,0 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createDisableRequiredMemoTransfersInstruction)(account, ownerPublicKey, signers, programId));

@@ -18,3 +18,3 @@ "use strict";

const { authority, metadataAddress } = exports.MetadataPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -21,0 +21,0 @@ authority: authority.equals(web3_js_1.PublicKey.default) ? null : authority,

@@ -21,4 +21,4 @@ "use strict";

const index_js_1 = require("../../state/index.js");
function getAdditionalRentForNewMetadata(connection, address, tokenMetadata, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getAdditionalRentForNewMetadata(connection_1, address_1, tokenMetadata_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, tokenMetadata, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const info = yield connection.getAccountInfo(address);

@@ -37,4 +37,4 @@ if (!info) {

}
function getAdditionalRentForUpdatedMetadata(connection, address, field, value, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getAdditionalRentForUpdatedMetadata(connection_1, address_1, field_1, value_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, field, value, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const info = yield connection.getAccountInfo(address);

@@ -76,4 +76,4 @@ if (!info) {

*/
function tokenMetadataInitialize(connection, payer, mint, updateAuthority, mintAuthority, name, symbol, uri, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataInitialize(connection_1, payer_1, mint_1, updateAuthority_1, mintAuthority_1, name_1, symbol_1, uri_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, mintAuthority, name, symbol, uri, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [mintAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(mintAuthority, multiSigners);

@@ -112,4 +112,4 @@ const transaction = new web3_js_1.Transaction().add((0, spl_token_metadata_1.createInitializeInstruction)({

*/
function tokenMetadataInitializeWithRentTransfer(connection, payer, mint, updateAuthority, mintAuthority, name, symbol, uri, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataInitializeWithRentTransfer(connection_1, payer_1, mint_1, updateAuthority_1, mintAuthority_1, name_1, symbol_1, uri_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, mintAuthority, name, symbol, uri, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [mintAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(mintAuthority, multiSigners);

@@ -161,4 +161,4 @@ const transaction = new web3_js_1.Transaction();

*/
function tokenMetadataUpdateField(connection, payer, mint, updateAuthority, field, value, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataUpdateField(connection_1, payer_1, mint_1, updateAuthority_1, field_1, value_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, field, value, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [updateAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(updateAuthority, multiSigners);

@@ -196,4 +196,4 @@ const transaction = new web3_js_1.Transaction().add((0, spl_token_metadata_1.createUpdateFieldInstruction)({

*/
function tokenMetadataUpdateFieldWithRentTransfer(connection, payer, mint, updateAuthority, field, value, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataUpdateFieldWithRentTransfer(connection_1, payer_1, mint_1, updateAuthority_1, field_1, value_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, field, value, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [updateAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(updateAuthority, multiSigners);

@@ -233,4 +233,4 @@ const transaction = new web3_js_1.Transaction();

*/
function tokenMetadataRemoveKey(connection, payer, mint, updateAuthority, key, idempotent, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataRemoveKey(connection_1, payer_1, mint_1, updateAuthority_1, key_1, idempotent_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, key, idempotent, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [updateAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(updateAuthority, multiSigners);

@@ -262,4 +262,4 @@ const transaction = new web3_js_1.Transaction().add((0, spl_token_metadata_1.createRemoveKeyInstruction)({

*/
function tokenMetadataUpdateAuthority(connection, payer, mint, updateAuthority, newAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function tokenMetadataUpdateAuthority(connection_1, payer_1, mint_1, updateAuthority_1, newAuthority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, updateAuthority, newAuthority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [updateAuthorityPublicKey, signers] = (0, internal_js_1.getSigners)(updateAuthority, multiSigners);

@@ -266,0 +266,0 @@ const transaction = new web3_js_1.Transaction().add((0, spl_token_metadata_1.createUpdateAuthorityInstruction)({

@@ -62,4 +62,4 @@ "use strict";

*/
function getTokenMetadata(connection, address, commitment, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getTokenMetadata(connection_1, address_1, commitment_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, commitment, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const mintInfo = yield (0, mint_js_1.getMint)(connection, address, commitment, programId);

@@ -66,0 +66,0 @@ const data = (0, extensionType_js_1.getExtensionData)(extensionType_js_1.ExtensionType.TokenMetadata, mintInfo.tlvData);

@@ -34,4 +34,4 @@ "use strict";

*/
function transferCheckedWithFee(connection, payer, source, mint, destination, owner, amount, decimals, fee, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function transferCheckedWithFee(connection_1, payer_1, source_1, mint_1, destination_1, owner_1, amount_1, decimals_1, fee_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, source, mint, destination, owner, amount, decimals, fee, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [ownerPublicKey, signers] = (0, internal_js_1.getSigners)(owner, multiSigners);

@@ -57,4 +57,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createTransferCheckedWithFeeInstruction)(source, mint, destination, ownerPublicKey, amount, decimals, fee, multiSigners, programId));

*/
function withdrawWithheldTokensFromMint(connection, payer, mint, destination, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function withdrawWithheldTokensFromMint(connection_1, payer_1, mint_1, destination_1, authority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, destination, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -81,4 +81,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createWithdrawWithheldTokensFromMintInstruction)(mint, destination, authorityPublicKey, signers, programId));

*/
function withdrawWithheldTokensFromAccounts(connection, payer, mint, destination, authority, multiSigners, sources, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function withdrawWithheldTokensFromAccounts(connection_1, payer_1, mint_1, destination_1, authority_1, multiSigners_1, sources_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, destination, authority, multiSigners, sources, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -102,4 +102,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createWithdrawWithheldTokensFromAccountsInstruction)(mint, destination, authorityPublicKey, signers, sources, programId));

*/
function harvestWithheldTokensToMint(connection, payer, mint, sources, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function harvestWithheldTokensToMint(connection_1, payer_1, mint_1, sources_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, sources, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createHarvestWithheldTokensToMintInstruction)(mint, sources, programId));

@@ -106,0 +106,0 @@ return yield (0, web3_js_1.sendAndConfirmTransaction)(connection, transaction, [payer], confirmOptions);

@@ -30,4 +30,4 @@ "use strict";

*/
function initializeTransferHook(connection, payer, mint, authority, transferHookProgramId, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function initializeTransferHook(connection_1, payer_1, mint_1, authority_1, transferHookProgramId_1, confirmOptions_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, authority, transferHookProgramId, confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createInitializeTransferHookInstruction)(mint, authority, transferHookProgramId, programId));

@@ -52,4 +52,4 @@ return yield (0, web3_js_1.sendAndConfirmTransaction)(connection, transaction, [payer], confirmOptions);

*/
function updateTransferHook(connection, payer, mint, transferHookProgramId, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function updateTransferHook(connection_1, payer_1, mint_1, transferHookProgramId_1, authority_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, mint, transferHookProgramId, authority, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_2022_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -78,4 +78,4 @@ const transaction = new web3_js_1.Transaction().add((0, instructions_js_1.createUpdateTransferHookInstruction)(mint, authorityPublicKey, transferHookProgramId, signers, programId));

*/
function transferCheckedWithTransferHook(connection, payer, source, mint, destination, authority, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function transferCheckedWithTransferHook(connection_1, payer_1, source_1, mint_1, destination_1, authority_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, source, mint, destination, authority, amount, decimals, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -105,4 +105,4 @@ const transaction = new web3_js_1.Transaction().add(yield (0, instructions_js_1.createTransferCheckedWithTransferHookInstruction)(connection, source, mint, destination, authorityPublicKey, amount, decimals, signers, confirmOptions === null || confirmOptions === void 0 ? void 0 : confirmOptions.commitment, programId));

*/
function transferCheckedWithFeeAndTransferHook(connection, payer, source, mint, destination, authority, amount, decimals, fee, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function transferCheckedWithFeeAndTransferHook(connection_1, payer_1, source_1, mint_1, destination_1, authority_1, amount_1, decimals_1, fee_1) {
return __awaiter(this, arguments, void 0, function* (connection, payer, source, mint, destination, authority, amount, decimals, fee, multiSigners = [], confirmOptions, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const [authorityPublicKey, signers] = (0, internal_js_1.getSigners)(authority, multiSigners);

@@ -109,0 +109,0 @@ const transaction = new web3_js_1.Transaction().add(yield (0, instructions_js_1.createTransferCheckedWithFeeAndTransferHookInstruction)(connection, source, mint, destination, authorityPublicKey, amount, decimals, fee, signers, confirmOptions === null || confirmOptions === void 0 ? void 0 : confirmOptions.commitment, programId));

@@ -191,4 +191,4 @@ "use strict";

*/
function createTransferCheckedWithTransferHookInstruction(connection, source, mint, destination, owner, amount, decimals, multiSigners = [], commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createTransferCheckedWithTransferHookInstruction(connection_1, source_1, mint_1, destination_1, owner_1, amount_1, decimals_1) {
return __awaiter(this, arguments, void 0, function* (connection, source, mint, destination, owner, amount, decimals, multiSigners = [], commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const instruction = (0, transferChecked_js_1.createTransferCheckedInstruction)(source, mint, destination, owner, amount, decimals, multiSigners, programId);

@@ -221,4 +221,4 @@ const mintInfo = yield (0, mint_js_1.getMint)(connection, mint, commitment, programId);

*/
function createTransferCheckedWithFeeAndTransferHookInstruction(connection, source, mint, destination, owner, amount, decimals, fee, multiSigners = [], commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function createTransferCheckedWithFeeAndTransferHookInstruction(connection_1, source_1, mint_1, destination_1, owner_1, amount_1, decimals_1, fee_1) {
return __awaiter(this, arguments, void 0, function* (connection, source, mint, destination, owner, amount, decimals, fee, multiSigners = [], commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const instruction = (0, instructions_js_1.createTransferCheckedWithFeeInstruction)(source, mint, destination, owner, amount, decimals, fee, multiSigners, programId);

@@ -225,0 +225,0 @@ const mintInfo = yield (0, mint_js_1.getMint)(connection, mint, commitment, programId);

@@ -17,3 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createEmitInstruction = exports.createUpdateAuthorityInstruction = exports.createRemoveKeyInstruction = exports.createUpdateFieldInstruction = exports.createInitializeInstruction = void 0;
exports.createInitializeMemberInstruction = exports.createUpdateGroupAuthorityInstruction = exports.createUpdateGroupMaxSizeInstruction = exports.createInitializeGroupInstruction = exports.createEmitInstruction = exports.createUpdateAuthorityInstruction = exports.createRemoveKeyInstruction = exports.createUpdateFieldInstruction = exports.createInitializeInstruction = void 0;
var spl_token_metadata_1 = require("@solana/spl-token-metadata");

@@ -25,2 +25,7 @@ Object.defineProperty(exports, "createInitializeInstruction", { enumerable: true, get: function () { return spl_token_metadata_1.createInitializeInstruction; } });

Object.defineProperty(exports, "createEmitInstruction", { enumerable: true, get: function () { return spl_token_metadata_1.createEmitInstruction; } });
var spl_token_group_1 = require("@solana/spl-token-group");
Object.defineProperty(exports, "createInitializeGroupInstruction", { enumerable: true, get: function () { return spl_token_group_1.createInitializeGroupInstruction; } });
Object.defineProperty(exports, "createUpdateGroupMaxSizeInstruction", { enumerable: true, get: function () { return spl_token_group_1.createUpdateGroupMaxSizeInstruction; } });
Object.defineProperty(exports, "createUpdateGroupAuthorityInstruction", { enumerable: true, get: function () { return spl_token_group_1.createUpdateGroupAuthorityInstruction; } });
Object.defineProperty(exports, "createInitializeMemberInstruction", { enumerable: true, get: function () { return spl_token_group_1.createInitializeMemberInstruction; } });
__exportStar(require("./associatedTokenAccount.js"), exports);

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

@@ -53,4 +53,4 @@ "use strict";

*/
function getAccount(connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getAccount(connection_1, address_1, commitment_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const info = yield connection.getAccountInfo(address, commitment);

@@ -71,4 +71,4 @@ return unpackAccount(address, info, programId);

*/
function getMultipleAccounts(connection, addresses, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getMultipleAccounts(connection_1, addresses_1, commitment_1) {
return __awaiter(this, arguments, void 0, function* (connection, addresses, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const infos = yield connection.getMultipleAccountsInfo(addresses, commitment);

@@ -75,0 +75,0 @@ return addresses.map((address, i) => unpackAccount(address, infos[i], programId));

@@ -44,4 +44,4 @@ "use strict";

*/
function getMint(connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getMint(connection_1, address_1, commitment_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const info = yield connection.getAccountInfo(address, commitment);

@@ -130,4 +130,4 @@ return unpackMint(address, info, programId);

*/
function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getAssociatedTokenAddress(mint_1, owner_1) {
return __awaiter(this, arguments, void 0, function* (mint, owner, allowOwnerOffCurve = false, programId = constants_js_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = constants_js_1.ASSOCIATED_TOKEN_PROGRAM_ID) {
if (!allowOwnerOffCurve && !web3_js_1.PublicKey.isOnCurve(owner.toBuffer()))

@@ -134,0 +134,0 @@ throw new errors_js_1.TokenOwnerOffCurveError();

@@ -46,4 +46,4 @@ "use strict";

*/
function getMultisig(connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
return __awaiter(this, void 0, void 0, function* () {
function getMultisig(connection_1, address_1, commitment_1) {
return __awaiter(this, arguments, void 0, function* (connection, address, commitment, programId = constants_js_1.TOKEN_PROGRAM_ID) {
const info = yield connection.getAccountInfo(address, commitment);

@@ -50,0 +50,0 @@ return unpackMultisig(address, info, programId);

@@ -11,2 +11,3 @@ import { sendAndConfirmTransaction, Transaction } from '@solana/web3.js';

* @param payer Payer of the transaction fees
* @param mint Address of the mint
* @param account Address of the account

@@ -13,0 +14,0 @@ * @param delegate Account authorized to perform a transfer tokens from the source account

@@ -7,2 +7,3 @@ import { ACCOUNT_SIZE } from '../state/account.js';

import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';
import { TOKEN_GROUP_SIZE, TOKEN_GROUP_MEMBER_SIZE } from './tokenGroup/index.js';
import { GROUP_MEMBER_POINTER_SIZE } from './groupMemberPointer/state.js';

@@ -44,5 +45,5 @@ import { GROUP_POINTER_SIZE } from './groupPointer/state.js';

ExtensionType[ExtensionType["GroupPointer"] = 20] = "GroupPointer";
// TokenGroup = 21, // Not implemented yet
ExtensionType[ExtensionType["TokenGroup"] = 21] = "TokenGroup";
ExtensionType[ExtensionType["GroupMemberPointer"] = 22] = "GroupMemberPointer";
// TokenGroupMember = 23, // Not implemented yet
ExtensionType[ExtensionType["TokenGroupMember"] = 23] = "TokenGroupMember";
})(ExtensionType || (ExtensionType = {}));

@@ -104,2 +105,6 @@ export const TYPE_SIZE = 2;

return GROUP_MEMBER_POINTER_SIZE;
case ExtensionType.TokenGroup:
return TOKEN_GROUP_SIZE;
case ExtensionType.TokenGroupMember:
return TOKEN_GROUP_MEMBER_SIZE;
case ExtensionType.TokenMetadata:

@@ -125,2 +130,4 @@ throw Error(`Cannot get type length for variable extension type: ${e}`);

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return true;

@@ -163,2 +170,4 @@ case ExtensionType.Uninitialized:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return false;

@@ -195,2 +204,4 @@ default:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return ExtensionType.Uninitialized;

@@ -197,0 +208,0 @@ }

@@ -15,3 +15,3 @@ import { struct } from '@solana/buffer-layout';

const { authority, memberAddress } = GroupMemberPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -18,0 +18,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

@@ -15,3 +15,3 @@ import { struct } from '@solana/buffer-layout';

const { authority, groupAddress } = GroupPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -18,0 +18,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

@@ -11,2 +11,3 @@ export * from './accountType.js';

export * from './metadataPointer/index.js';
export * from './tokenGroup/index.js';
export * from './tokenMetadata/index.js';

@@ -13,0 +14,0 @@ export * from './mintCloseAuthority.js';

@@ -15,3 +15,3 @@ import { struct } from '@solana/buffer-layout';

const { authority, metadataAddress } = MetadataPointerLayout.decode(extensionData);
// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -18,0 +18,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

export { createInitializeInstruction, createUpdateFieldInstruction, createRemoveKeyInstruction, createUpdateAuthorityInstruction, createEmitInstruction, } from '@solana/spl-token-metadata';
export { createInitializeGroupInstruction, createUpdateGroupMaxSizeInstruction, createUpdateGroupAuthorityInstruction, createInitializeMemberInstruction, } from '@solana/spl-token-group';
export * from './associatedTokenAccount.js';

@@ -3,0 +4,0 @@ export * from './decode.js';

@@ -8,2 +8,3 @@ import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';

* @param payer Payer of the transaction fees
* @param mint Address of the mint
* @param account Address of the account

@@ -10,0 +11,0 @@ * @param delegate Account authorized to perform a transfer tokens from the source account

@@ -24,3 +24,5 @@ /// <reference types="node" />

GroupPointer = 20,
GroupMemberPointer = 22
TokenGroup = 21,
GroupMemberPointer = 22,
TokenGroupMember = 23
}

@@ -27,0 +29,0 @@ export declare const TYPE_SIZE = 2;

@@ -11,2 +11,3 @@ export * from './accountType.js';

export * from './metadataPointer/index.js';
export * from './tokenGroup/index.js';
export * from './tokenMetadata/index.js';

@@ -13,0 +14,0 @@ export * from './mintCloseAuthority.js';

export { createInitializeInstruction, createUpdateFieldInstruction, createRemoveKeyInstruction, createUpdateAuthorityInstruction, createEmitInstruction, } from '@solana/spl-token-metadata';
export { createInitializeGroupInstruction, createUpdateGroupMaxSizeInstruction, createUpdateGroupAuthorityInstruction, createInitializeMemberInstruction, } from '@solana/spl-token-group';
export * from './associatedTokenAccount.js';

@@ -3,0 +4,0 @@ export * from './decode.js';

{
"name": "@solana/spl-token",
"description": "SPL Token Program JS API",
"version": "0.4.1",
"version": "0.4.2",
"author": "Solana Labs Maintainers <maintainers@solanalabs.com>",

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

"peerDependencies": {
"@solana/web3.js": "^1.90.0"
"@solana/web3.js": "^1.91.1"
},

@@ -37,2 +37,3 @@ "dependencies": {

"@solana/buffer-layout-utils": "^0.2.0",
"@solana/spl-token-group": "^0.0.1",
"@solana/spl-token-metadata": "^0.1.2",

@@ -42,15 +43,15 @@ "buffer": "^6.0.3"

"devDependencies": {
"@solana/codecs-strings": "2.0.0-experimental.9741939",
"@solana/codecs-strings": "2.0.0-preview.2",
"@solana/spl-memo": "0.2.3",
"@solana/web3.js": "^1.90.0",
"@solana/web3.js": "^1.91.1",
"@types/chai-as-promised": "^7.1.4",
"@types/chai": "^4.3.11",
"@types/chai": "^4.3.14",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.20",
"@types/node": "^20.11.30",
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"chai": "^5.1.0",
"chai-as-promised": "^7.1.1",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",

@@ -65,6 +66,5 @@ "eslint-plugin-prettier": "^5.1.3",

"start-server-and-test": "^2.0.3",
"tslib": "^2.3.1",
"ts-node": "^10.9.2",
"typedoc": "^0.25.8",
"typescript": "^5.3.3"
"typedoc": "^0.25.12",
"typescript": "^5.4.3"
},

@@ -71,0 +71,0 @@ "scripts": {

@@ -40,4 +40,6 @@ # `@solana/spl-token`

* Node 16+
* NPM 8+
* PNPM
If you have Node 16+, you can [activate PNPM with Corepack](https://pnpm.io/installation#using-corepack).
1. Clone the project:

@@ -48,5 +50,5 @@ ```shell

2. Navigate to the library:
2. Navigate to the root of the repository:
```shell
cd solana-program-library/token/js
cd solana-program-library
```

@@ -56,25 +58,30 @@

```shell
npm install
pnpm install
```
4. Build the library:
4. Build the libraries in the repository:
```shell
npm run build
pnpm run build
```
5. Build the on-chain programs:
5. Navigate to the SPL Token library:
```shell
npm run test:build-programs
cd token/js
```
6. Run the tests:
6. Build the on-chain programs:
```shell
npm run test
pnpm run test:build-programs
```
7. Run the example:
7. Run the tests:
```shell
npm run example
pnpm run test
```
8. Run the example:
```shell
pnpm run example
```
## Upgrading

@@ -81,0 +88,0 @@

@@ -13,2 +13,3 @@ import type { ConfirmOptions, Connection, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';

* @param payer Payer of the transaction fees
* @param mint Address of the mint
* @param account Address of the account

@@ -15,0 +16,0 @@ * @param delegate Account authorized to perform a transfer tokens from the source account

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

import { DEFAULT_ACCOUNT_STATE_SIZE } from './defaultAccountState/index.js';
import { TOKEN_GROUP_SIZE, TOKEN_GROUP_MEMBER_SIZE } from './tokenGroup/index.js';
import { GROUP_MEMBER_POINTER_SIZE } from './groupMemberPointer/state.js';

@@ -47,5 +48,5 @@ import { GROUP_POINTER_SIZE } from './groupPointer/state.js';

GroupPointer = 20,
// TokenGroup = 21, // Not implemented yet
TokenGroup = 21,
GroupMemberPointer = 22,
// TokenGroupMember = 23, // Not implemented yet
TokenGroupMember = 23,
}

@@ -111,2 +112,6 @@

return GROUP_MEMBER_POINTER_SIZE;
case ExtensionType.TokenGroup:
return TOKEN_GROUP_SIZE;
case ExtensionType.TokenGroupMember:
return TOKEN_GROUP_MEMBER_SIZE;
case ExtensionType.TokenMetadata:

@@ -133,2 +138,4 @@ throw Error(`Cannot get type length for variable extension type: ${e}`);

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return true;

@@ -172,2 +179,4 @@ case ExtensionType.Uninitialized:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return false;

@@ -205,2 +214,4 @@ default:

case ExtensionType.GroupMemberPointer:
case ExtensionType.TokenGroup:
case ExtensionType.TokenGroupMember:
return ExtensionType.Uninitialized;

@@ -207,0 +218,0 @@ }

@@ -28,3 +28,3 @@ import { struct } from '@solana/buffer-layout';

// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -31,0 +31,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

@@ -28,3 +28,3 @@ import { struct } from '@solana/buffer-layout';

// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -31,0 +31,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

@@ -11,2 +11,3 @@ export * from './accountType.js';

export * from './metadataPointer/index.js';
export * from './tokenGroup/index.js';
export * from './tokenMetadata/index.js';

@@ -13,0 +14,0 @@ export * from './mintCloseAuthority.js';

@@ -28,3 +28,3 @@ import { struct } from '@solana/buffer-layout';

// Explicity set None/Zero keys to null
// Explicitly set None/Zero keys to null
return {

@@ -31,0 +31,0 @@ authority: authority.equals(PublicKey.default) ? null : authority,

@@ -8,2 +8,8 @@ export {

} from '@solana/spl-token-metadata';
export {
createInitializeGroupInstruction,
createUpdateGroupMaxSizeInstruction,
createUpdateGroupAuthorityInstruction,
createInitializeMemberInstruction,
} from '@solana/spl-token-group';

@@ -10,0 +16,0 @@ export * from './associatedTokenAccount.js';

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

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

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

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

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

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

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

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc