PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@solana/spl-token/src/actions

Просмотр файла: syncNative.ts

import {
    ConfirmOptions,
    Connection,
    PublicKey,
    sendAndConfirmTransaction,
    Signer,
    Transaction,
    TransactionSignature,
} from '@solana/web3.js';
import { TOKEN_PROGRAM_ID } from '../constants';
import { createSyncNativeInstruction } from '../instructions/index';

/**
 * Sync the balance of a native SPL token account to the underlying system account's lamports
 *
 * @param connection     Connection to use
 * @param payer          Payer of the transaction fees
 * @param account        Native account to sync
 * @param confirmOptions Options for confirming the transaction
 * @param programId      SPL Token program account
 *
 * @return Signature of the confirmed transaction
 */
export async function syncNative(
    connection: Connection,
    payer: Signer,
    account: PublicKey,
    confirmOptions?: ConfirmOptions,
    programId = TOKEN_PROGRAM_ID
): Promise<TransactionSignature> {
    const transaction = new Transaction().add(createSyncNativeInstruction(account, programId));

    return await sendAndConfirmTransaction(connection, transaction, [payer], confirmOptions);
}

Выполнить команду


Для локальной разработки. Не используйте в интернете!