Bank

The Bank namespace provides access to the in-game banking system. Send money to the player, withdraw from their account, check balance, and read account details.

Required permission: bank

Import

import { Bank } from "@hotbunny/hackhub-content-sdk";

Methods

Bank.transaction(options)

Create a bank transaction (deposit money to the player’s account).

Parameter Type Description
options.amount number Amount to transfer
options.description string Transaction description shown in bank history
options.from { IBAN: string; name: string }? Sender info (optional)
options.to string? Recipient IBAN (defaults to player)
Bank.transaction({
    amount: 5000,
    description: "Quest reward: Hack the Planet",
    from: {
        IBAN: "DE89370400440532013000",
        name: "Anonymous Employer",
    },
});

Bank.withdraw(options)

Withdraw money from the player’s account (e.g. for purchases).

Parameter Type Description
options.amount number Amount to withdraw
options.description string Transaction description shown in bank history
options.to string? Recipient IBAN (defaults to "MERCHANT")
Bank.withdraw({
    amount: 200,
    description: "Bought VPN subscription",
});

Bank.getPlayerAccount()

Get the player’s bank account information.

Returns: BankAccountInfo

const account = Bank.getPlayerAccount();
console.log(`IBAN: ${account.IBAN}`);
console.log(`Balance: $${account.balance}`);
console.log(`Owner: ${account.owner}`);

Bank.getBalance()

Get the player’s current balance as a number.

Returns: number

if (Bank.getBalance() >= 10000) {
    console.log("Player is rich!");
}

Types

BankTransactionOptions

interface BankTransactionOptions {
    amount: number;
    description: string;
    from?: {
        IBAN: string;
        name: string;
    };
    to?: string;
}

BankAccountInfo

interface BankAccountInfo {
    id: string;
    IBAN: string;
    balance: number;
    owner: string;
}