Skip to content

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

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

Methods

Bank.transaction(options)

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

ParameterTypeDescription
options.amountnumberAmount to transfer
options.descriptionstringTransaction description shown in bank history
options.from{ IBAN: string; name: string }?Sender info (optional)
options.tostring?Recipient IBAN (defaults to player)
typescript
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).

ParameterTypeDescription
options.amountnumberAmount to withdraw
options.descriptionstringTransaction description shown in bank history
options.tostring?Recipient IBAN (defaults to "MERCHANT")
typescript
Bank.withdraw({
    amount: 200,
    description: "Bought VPN subscription",
});

Bank.getPlayerAccount()

Get the player's bank account information.

Returns: BankAccountInfo

typescript
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

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

Types

BankTransactionOptions

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

BankAccountInfo

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

HotBunny Interactive Entertainment Inc.