HiveXPH SDKhivexph-sdk
NPM
Developer toolkit for Hive Custom JSON and Hive Engine transactions.

Payments

Native HIVE and HBD payments

Layer 1 transfers are final the moment they are included in a block. The memo carries the standardized { action, metadata } trigger, so the payment and the instruction travel together.

Backend transfers

TypeScript
const result = await hive.payments.hive.transfer({
  from: hive.accounts.treasury,   // key-free account reference
  account: "bob",                 // recipient
  amount: "10.000",               // decimal string
  symbol: "HIVE",                 // "HIVE" or "HBD"
  action: "reward",
  metadata: { campaign: "launch" },
});

result.transactionId; // string | undefined
hive.payments.hive.transfer(input)
ParameterTypeRequiredDescription
fromAccountReferenceNohive.accounts.<alias> — never a raw alias string.
accountstringNoRecipient Hive account.
amountstringNoDecimal string, e.g. "10.000".
symbol"HIVE" | "HBD"NoNative asset symbol.
actionstringNoStandardized trigger action name.
metadataobject | nullNoOptional structured payload. Defaults to null.

Offline preview

build() resolves the alias and returns the exact operation without resolving a private key and without touching the network.

TypeScript
const preview = hive.payments.hive.build({
  from: hive.accounts.treasury,
  account: "bob",
  amount: "1",
  symbol: "HBD",
  action: "refund",
});

preview.operation;
// ["transfer", { from: "treasury-account", to: "bob", amount: "1.000 HBD",
//                memo: '{"action":"refund","metadata":null}' }]

Keychain transfers

In the browser, native transfers use Hive Keychain's dedicated transfer request — not a custom_json. The SDK never sees a key.

TypeScript
await hive.keychain.payments.hive.transfer({
  username: "alice",
  account: "bob",
  amount: "5",
  symbol: "HIVE",
  action: "tip",
  metadata: { postId: 42 },
});

Amounts and precision

Important

Amounts are strings. Passing a number throws a validation error, because floating point silently destroys precision. "10" is normalized to "10.000 HIVE"; more than three decimals is rejected.
TypeScript
import { formatNativeAsset, quantitiesEqual } from "hivexph-sdk";

formatNativeAsset("10", "HIVE");      // "10.000 HIVE"
quantitiesEqual("100", "100.000");    // true — compared as digits, not floats