Hinkal API

Partner Transfer Address

A partner transfer address is a transfer address that your backend creates with only its Hinkal Partner secret key: no session and no wallet signature. You also choose a refundTo address, and payments that can't reach the recipient are refunded there.

EndpointPurpose
POST /partner/transfer-addressCreate a transfer address for a whole network
GET /partner/transfer-address/stuck-balancesList funds that weren't paid out or refunded, per chain and token
POST /partner/transfer-address/recoverRecover one of those balances to refundTo, signed by the refundTo wallet

Use these routes when your server hands out payment addresses and nobody on your side holds a Hinkal session. When the recipient or payer opens a session and signs, use POST /receive-address with recipientAddress instead.

The code below uses post and get from Examples.

Authentication

Every call sends your secret key in x-api-key, and nothing else:

x-api-key: hk_sk_live_…
  • Only the secret key works. A missing header, or a value that doesn't start with hk_, returns 401 A partner secret API key is required. An unknown, turned-off or malformed key returns 401 Invalid API key. A publishable key is rejected too, with 403 or 401. Never call these routes from browser or app code.
  • No sessionId and no x-hinkal-request-signature.
  • POST /partner/transfer-address/recover also needs a signature from the refundTo wallet. See Recover a stuck balance.
Warning

Use the same key for every call. An address's stuck funds can only be listed and recovered with the key that created it, and with the same refundTo. Don't revoke a key while its addresses still have stuck funds.

Create an address

const HINKAL_SECRET_KEY = process.env.HINKAL_SECRET_KEY;

const body = {
  networkType: "evm", // "evm" | "tron" | "solana"
  recipientAddress: "0xRecipient...",
  refundTo: "0xYourRefundWallet...",
};
const { record, acceptedChainIds } = await post("/partner/transfer-address", body, {
  "x-api-key": HINKAL_SECRET_KEY,
});

console.log(record.vaultAddress); // hand this out to the payer
console.log(acceptedChainIds); // chains the payer may send on
FieldRequiredDescription
networkTypeyesevm, tron or solana: the network the address is for. The chains it accepts payments on come back in acceptedChainIds.
recipientAddressyesPublic address each payment is paid out to: on destinationChainId when set, otherwise on the chain the payment arrived on.
refundToyesAddress on the same network that receives refunds. It is fixed for the address. On Tron, use the base58 form here and in every later call.
destinationChainIdnoBridge each payment to this chain instead of withdrawing it on the chain it arrived on.
destinationTokenAddresswith destinationChainIdToken the recipient receives on destinationChainId.
slippagePercentagenoMaximum bridge slippage in percent, for example "1". Only with destinationChainId.
refnoA fee discount code agreed with Hinkal. Not needed for attribution: your key handles that.

The response is { success, record, acceptedChainIds }:

  • record is { index, network, expiry, version, vaultAddress }, the same as for POST /receive-address. expiry is unix seconds, 14 days after creation.
  • acceptedChainIds lists the chains the payer can send on. With destinationChainId, it only includes chains that can bridge to it.
Important

Tell the payer to send only on a chain in acceptedChainIds. On EVM the address is the same on every EVM chain, so a payer can also send on a chain Hinkal doesn't support. Funds sent there can't be paid out, refunded or recovered.

Every call creates a new address. Overlapping calls can return 409; retry.

Each payment is paid out like any transfer address: the relayer fee, the Hinkal fee and your partner fee come out of the payment, and each payout is credited to your key with volume and commission. A payment too small to cover the fees may be neither paid out nor refunded. Without destinationChainId, an EVM payment is paid out on the chain it was sent on, so if the recipient address works on only one chain, the payer must send on that chain.

These addresses don't appear in GET /receive-vault-account or GET /stuck-balances. Use the routes below.

Refunds

When a payment can't be paid out, for example because its payout or bridge fails, it is refunded to refundTo automatically, on the chain it was sent on, minus network fees. You don't need to call anything.

When to recover manually

Some funds can't be refunded automatically. They stay stuck until you recover them:

  • payments sent to the address after it expired,
  • payments from a sender that failed Hinkal's compliance screening,
  • tokens Hinkal doesn't support,
  • balances left at the address that are too small to cover the fee of an automatic refund.

To find them, check GET /partner/transfer-address/stuck-balances regularly, for example once a day, and whenever a payer reports a payment the recipient didn't get. If a balance is still listed an hour later, it wasn't refunded automatically: recover it with POST /partner/transfer-address/recover. Leave newer balances alone, because they may still be paid out or refunded.

Warning

refundTo must be an address you control on every chain of the network. Refunds are paid on the chain the funds are on, and a manual recovery needs refundTo to sign the request and, for vault funds on Tron and Solana, to send the transaction and pay its gas. Don't use an exchange deposit address or a contract that exists on only one chain. On EVM, a smart contract wallet that supports ERC-1271 can sign.

List stuck balances

const params = new URLSearchParams({ refundTo: "0xYourRefundWallet..." });
const { chains } = await get("/partner/transfer-address/stuck-balances", params, {
  "x-api-key": HINKAL_SECRET_KEY,
});
// [{ chainId, balances: [{ tokenAddress, balance, sources: [{ kind: "utxo", amount }] }], error? }]

The response sums every address your key created with this refundTo, per chain and token. sources splits each balance by kind, which is what you pass to the recover route:

  • utxo - a payment that reached Hinkal but wasn't paid out,
  • bridge - a bridge payout that was refunded,
  • vault - funds still at the address.

The refundTo format picks the network: an EVM address lists EVM chains, a Tron address lists Tron, and a Solana address lists Solana. Chains with nothing stuck are left out. If one chain can't be read, it comes back with an error and the other chains are still listed.

Recover a stuck balance

For a balance that wasn't refunded automatically, the refundTo wallet signs a request for one token and one kind on one chain:

FieldDescription
refundToThe refund address. It signs the request and receives the funds.
chainIdChain the funds are on. It must belong to refundTo's network.
tokenAddressToken to recover, as listed by the stuck-balances route.
kindutxo, bridge or vault.
nonceA fresh UUID. Each nonce works once.
timestampCurrent time in milliseconds. It must be within 5 minutes of the server's clock.
signatureThe refundTo wallet's signature over the fields above.

Sign EIP-712 typed data with domain { name: "Hinkal Enclave", chainId } and primary type RefundToRecover. refundTo and tokenAddress are strings, signed exactly as you send them.

const RefundToRecover = [
  { name: "refundTo", type: "string" },
  { name: "chainId", type: "uint256" },
  { name: "tokenAddress", type: "string" },
  { name: "kind", type: "string" },
  { name: "nonce", type: "string" },
  { name: "timestamp", type: "uint256" },
];

const fields = {
  refundTo: await refundWallet.getAddress(),
  chainId: 8453, // Base
  tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
  kind: "utxo", // "utxo" | "bridge" | "vault"
  nonce: randomUUID(),
  timestamp: Date.now(),
};
const signature = await refundWallet.signTypedData(
  { name: "Hinkal Enclave", chainId: fields.chainId },
  { RefundToRecover },
  fields,
);

const { results } = await post(
  "/partner/transfer-address/recover",
  { ...fields, signature },
  { "x-api-key": HINKAL_SECRET_KEY },
);

On Tron, sign the same struct with tronWeb.trx._signTypedData(domain, types, value) and send refundTo in base58.

Sign this UTF-8 message with the refundTo keypair and send the ed25519 signature as hex. It has no Session ID line.

Hinkal Enclave

Primary Type: RefundToRecover
Chain ID: {chainId}
Refund To: {refundTo}
Token Address: {tokenAddress}
Kind: {kind}
Nonce: {nonce}
Timestamp: {timestamp}
const fields = {
  refundTo: refundKeypair.publicKey.toBase58(),
  chainId: 501,
  tokenAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
  kind: "vault",
  nonce: randomUUID(),
  timestamp: Date.now(),
};
const message =
  `Hinkal Enclave\n\nPrimary Type: RefundToRecover\nChain ID: ${fields.chainId}` +
  `\nRefund To: ${fields.refundTo}\nToken Address: ${fields.tokenAddress}` +
  `\nKind: ${fields.kind}\nNonce: ${fields.nonce}\nTimestamp: ${fields.timestamp}`;
const signature = signSolanaMessage(message, refundKeypair);

const { results } = await post(
  "/partner/transfer-address/recover",
  { ...fields, signature },
  { "x-api-key": HINKAL_SECRET_KEY },
);

signSolanaMessage is the helper from Authentication.

The call recovers that token from every address your key created with this refundTo. results has one entry per recovery:

kindEach entryWho sends it
utxo{ txHashes }The API relays it. Nothing to do.
bridge{ recoveredCount, recoveredAmount, failedCount, errors }The API relays it. Nothing to do.
vault{ txData }, one per address holding the tokenYou send it and pay the gas: from any wallet on EVM, from refundTo on Tron and Solana

A recovery that failed is { error }, and the call still returns 200. An empty results means nothing of that kind and token is stuck on this chain.

vault txData has the same format as from POST /receive-vault-recover: an EVM transaction request, a Tron transaction owned by refundTo, or a base64 Solana transaction with refundTo as the fee payer. The funds always go to refundTo, whoever sends it. Send it right away: its recovery signature is valid for 15 minutes, and a Tron or Solana transaction can expire sooner. If it expires, call the route again with a new nonce.

Errors

The body is { "success": false, "error": "…" }, except for nonce errors on the recover route (409 nonce already used, or 400 for a nonce that isn't a UUID), which return only { "error": "…" }.

StatusErrorRoute
400Transfer addresses are not available on network …create
400Invalid request parameter: refundTo must be a valid address on chain …create
400Bridge route, token or recipient errors, as for POST /receive-addresscreate
400Invalid ref: '…' is not a whitelisted referralcreate
400refundTo must be a valid EVM, Tron or Solana addressstuck balances
400Missing or invalid fieldsrecover
400refundTo has no transfer addresses on chain …recover
401A partner secret API key is requiredall
401Invalid API keyall
401Request timestamp expiredrecover
401Invalid signature or Signature verification failedrecover
403Origin not allowed for this publishable keyall
409A transfer address for this account is being created; retry in a few minutescreate
409nonce already usedrecover
503Partner key service unavailableall