import { SystemProgram } from '@solarti/web3.js';
import { SystemClient } from './SystemClient.mjs';
import { createAccountOperation, createAccountOperationHandler } from './operations/createAccount.mjs';
import { transferSolOperation, transferSolOperationHandler } from './operations/transferSol.mjs';

/**
 * @group Plugins
 */
/** @group Plugins */
const systemModule = () => ({
  install(metaplex) {
    // Program.
    const systemProgram = {
      name: 'SystemProgram',
      address: SystemProgram.programId
    };
    metaplex.programs().register(systemProgram);
    metaplex.programs().getSystem = function (programs) {
      return this.get(systemProgram.name, programs);
    };

    // Operations.
    const op = metaplex.operations();
    op.register(createAccountOperation, createAccountOperationHandler);
    op.register(transferSolOperation, transferSolOperationHandler);
    metaplex.system = function () {
      return new SystemClient(this);
    };
  }
});

export { systemModule };
//# sourceMappingURL=plugin.mjs.map
