Skip to content
PortunaPortunaPortunaDocsTestnet

Objects

The objects the API returns and accepts. Fields that are not required are left out of a response when they have no value.

FieldTypeDescription
error requiredobject
error.code requiredstringWhat went wrong. Stable, so branch on it.
error.message requiredstringThe details, for people. It may change.

A 0x-hex address, in any case in requests and checksummed (EIP-55) in responses.

Type: string. Format: ^0x[0-9a-fA-F]{40}$. Example: 0x2Cd50979a8A33e8CA37DA85F8517fb148a67b769.

An integer in the smallest units, as a string.

Type: string. Format: ^[0-9]+$. Example: 1000000.

The chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.

Type: integer (int64). Example: 11155111, 97.

An amount of gas.

Type: integer (int64).

The cursor of the next page; null on the last page.

Type: string \| null.

gas: the gas of a transaction of your gas wallet; fee: the fee for a sweep; fee_charge: a charge made under your agreement; fee_credit: a credit made under your agreement, which reduces the fees due; withdrawal: fees withdrawn from the gas wallet, together with the withdrawal’s gas; topup: a top-up of the gas wallet, found by the balance reconciliation.

Type: string.

A change of your gas wallet’s balance, or of the fees it holds.

FieldTypeDescription
id requiredinteger (int64)
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
kind requiredLedgerKindgas: the gas of a transaction of your gas wallet; fee: the fee for a sweep; fee_charge: a charge made under your agreement; fee_credit: a credit made under your agreement, which reduces the fees due; withdrawal: fees withdrawn from the gas wallet, together with the withdrawal’s gas; topup: a top-up of the gas wallet, found by the balance reconciliation. One of: gas, fee, fee_charge, fee_credit, withdrawal, topup.
amount requiredstringWei with a sign: plus for topup and fee_credit, minus for gas, fees, charges and withdrawals. Format: ^-?[0-9]+$.
tx_hash requiredstring | nullThe transaction of the entry; null for top-ups, charges and credits.
sweep_id requiredstring | null (uuid)The sweep a fee is for; null for other kinds.
note requiredstring | nullA note on charges and credits; for top-ups, the blocks the reconciliation covered.
created_at requiredstring (date-time)

Your activity on one chain in one UTC day.

FieldTypeDescription
date requiredstring (date)The UTC day.
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
sweeps_done requiredintegerSweeps created that day that ended swept.
sweeps_failed requiredintegerSweeps created that day that ended failed, having reverted on chain or run out of attempts.
sweeps_rejected requiredintegerSweeps created that day that ended rejected: they were never sent, because a check before sending kept failing.
revocations_done requiredintegerRevocations created that day that ended revoked.
gas_spent requiredAmountThe gas of your gas wallet’s transactions that day, in wei, fee withdrawals aside.
fees requiredstringFees and charges accrued that day minus credits, in wei; below zero when the credits exceed them. Format: ^-?[0-9]+$.

A webhook event and how its delivery went.

FieldTypeDescription
id requiredstring (uuid)The event’s id, as in the delivery.
event requiredstringThe event type.
status requiredstringpending: being delivered, or waiting for the next attempt; delivered: your endpoint answered with a 2xx; failed: the attempts ran out, or the webhook was deleted. One of: pending, delivered, failed.
attempts requiredintegerAttempts made so far.
last_status_code requiredinteger | nullThe HTTP status your endpoint answered the last attempt with; null if it did not answer.
last_error requiredstring | nullWhy the last attempt failed; null if it did not. status <code>: your endpoint answered with another status. timeout, connection refused, connection reset, connection closed, DNS lookup failed, TLS error, connection failed: it did not answer; private address refused: its host resolves to an address that is not public. webhook removed: the webhook was deleted. internal: a failure on our side.
created_at requiredstring (date-time)When the event happened.
delivered_at requiredstring | null (date-time)When the event was delivered; null until then.
next_attempt_at requiredstring | null (date-time)When the next attempt is due; only for pending.

Your gas wallet and its balance on each chain.

FieldTypeDescription
gas_wallet requiredAddressYour gas wallet, the same address on every chain.
chains requiredarray of object
chains[].chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
chains[].name requiredstringThe chain’s name.
chains[].native requiredstringThe ticker of the chain’s native coin.
chains[].balanceAmountThe gas wallet’s balance, in wei; absent when error is set.
chains[].fees_accrued requiredAmountAll fees and charges accrued on this chain minus credits, in wei.
chains[].fees_withdrawn requiredAmountFees withdrawn so far, with the gas of their withdrawals, in wei.
chains[].fees_due requiredAmountFees accrued and not withdrawn yet, in wei. They stay on the gas wallet in reserve.
chains[].availableAmountWhat is left for gas, in wei: balance minus fees_due, but not below zero. Absent when error is set.
chains[].errorstringchain_unavailable: the chain’s node did not answer, so there is no balance. One of: chain_unavailable.

Your rates and the gas benchmarks on one chain.

FieldTypeDescription
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
name requiredstringThe chain’s name.
rate_bps requiredintegerX for token sweeps, in basis points, 7000 = 70%; 0 means no fee.
rate requiredstringrate_bps in percent.
native_markup_bps requiredintegerThe markup on gas for native coin sweeps, in basis points.
native_markup requiredstringnative_markup_bps in percent.
classic_gasmap of objectThe classic benchmark of each asset, by the token’s ticker or the native coin’s: the gas of topping up a deposit address and transferring from it. Absent on a chain without benchmarks.
classic_gas.<key>.new requiredGasGas for an address without an account on the chain, which the top-up creates (tokens only).
classic_gas.<key>.existing requiredGasGas for an address with an account.
extra_gasobjectThe batch gas a first sweep of an address bears on top of a repeat one. Absent on a chain without benchmarks.
extra_gas.delegation requiredGasSetting the address’s delegate by its authorization.
extra_gas.account requiredGasCreating the address’s account as well, for an address that held only tokens.
FieldTypeDescription
keep_one_unitbooleanToken sweeps leave 1 smallest unit on the deposit address, which makes your user’s next deposit cheaper. A sweep request can override it. Off by default.

A hot wallet on one chain and its delegate.

FieldTypeDescription
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
address requiredAddressThe hot wallet, where sweeps send the funds.
delegate requiredAddressThe hot wallet’s delegate, the address deposit addresses sign their authorizations for.
status requiredstringpending: the delegate is being deployed; active: it is deployed, and sweeps can go; failed: the deployment failed, and registering the hot wallet again retries it. One of: pending, active, failed.
errorstringWhy the deployment failed; only with failed. Most often insufficient_gas_balance: top up the gas wallet and register the hot wallet again. not_deployed: the deployment went through, but the delegate is not there. The other codes are the causes of a failed attempt, as in a sweep’s reason. One of: not_deployed, insufficient_gas_balance, gas_limit_exceeded, transaction_reverted, nonce_conflict, chain_unavailable, internal.
tx_hashstringThe transaction that deployed the delegate.
created_at requiredstring (date-time)When the hot wallet was registered.

An EIP-7702 authorization signed by the deposit address’s key: on chain chain_id, the deposit address runs the code at address. How to sign it, also in an HSM, a KMS or an MPC wallet: the Signing authorizations guide in the developer documentation.

FieldTypeDescription
chain_id requiredinteger (int64)The chain of the request; 0 (any chain) is refused.
address requiredAddressThe hot wallet’s delegate from POST /v1/hot-wallets; the zero address for a revocation.
nonce requiredinteger (int64)The deposit address’s current nonce.
y_parity requiredintegerThe signature’s y parity. One of: 0, 1.
r requiredstringThe signature’s r, 0x-hex of up to 32 bytes. Format: ^0x[0-9a-fA-F]{1,64}$.
s requiredstringThe signature’s s, 0x-hex of up to 32 bytes, in the lower half of the curve order (EIP-2). Format: ^0x[0-9a-fA-F]{1,64}$.

What to sweep, from where and to where.

FieldTypeDescription
external_idstringYour id for the sweep, unique in your account: a request with an external_id that is already taken returns that sweep instead of creating another, so retries are safe. Up to 128 characters.
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
hot_wallet requiredAddressYour hot wallet on this chain; its delegate must be active.
account requiredAddressThe deposit address.
token requiredstringA token’s ticker listed on the chain (in any case), the contract address of a listed token, or native (or the native coin’s ticker) for the native coin.
amountAmountHow much to sweep, above zero; without it, the whole balance.
keep_one_unitbooleanLeave 1 smallest unit of the token on the deposit address; defaults to your settings. Ignored for the native coin.
authorizationAuthorizationNeeded until the deposit address is delegated to this hot wallet’s delegate. After that it is not used, though one that is sent must still be valid.

A sweep and its outcome.

FieldTypeDescription
id requiredstring (uuid)
external_idstringYour id for the sweep, if the request had one.
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
hot_wallet requiredAddressThe hot wallet.
account requiredAddressThe deposit address.
token requiredstringThe token’s ticker, or the native coin’s.
token_addressAddressThe token’s contract address; absent for the native coin.
amountAmountThe amount requested; absent when the request was for the whole balance.
keep_one_unitbooleanPresent and true when the sweep leaves 1 smallest unit of the token on the deposit address.
status requiredstringqueued: waiting for a batch or a retry; processing: in a batch being prepared, sent or confirmed; swept: done, the funds are in the hot wallet; failed: reverted on chain, or ran out of attempts; rejected: never sent. The last three are final. One of: queued, processing, swept, failed, rejected.
reasonstringWhy the sweep ended rejected or failed, or, while it is queued for a retry, why the last attempt did not go through. A stable code: the node’s own messages stay in our logs.

- rejected, a check before sending kept failing: not_upgraded, stale_authorization, would_fail or nothing_to_sweep. - failed on chain, inside a batch that went through: the contract error the transfer reverted with, TokenTransferFailed, NativeTransferFailed, NothingToSweep or Unauthorized, or reverted without one. - The cause of a failed attempt, which is retried, and final with failed once the attempts run out: insufficient_gas_balance (top up the gas wallet), gas_limit_exceeded, transaction_reverted, nonce_conflict, chain_unavailable or internal. One of: not_upgraded, stale_authorization, would_fail, nothing_to_sweep, reverted, TokenTransferFailed, NativeTransferFailed, NothingToSweep, Unauthorized, insufficient_gas_balance, gas_limit_exceeded, transaction_reverted, nonce_conflict, chain_unavailable, internal.
attempts requiredintegerHow many times the sweep was tried.
swept_amountAmountHow much reached the hot wallet; only with swept.
tx_hashstringThe batch transaction that carried the sweep.
kindstringWhat the deposit address needed in the batch, which decides its share of the gas and the benchmark. repeat: nothing, it was already delegated. first: its delegation; it already had an account on the chain. first_new: its delegation, which also created its account, as it held only tokens. One of: repeat, first, first_new.
gasGasThe sweep’s share of the batch gas.
gas_costAmountThe same in wei.
feeAmountThe fee in wei; only with swept.
classic_gasGasThe benchmark the fee was computed with.
rate_bpsintegerThe rate the fee was computed with; for the native coin, the markup on gas.
created_at requiredstring (date-time)When the sweep was requested.
updated_at requiredstring (date-time)When the sweep last changed.

Which deposit address to revoke, with its authorization of the zero address.

FieldTypeDescription
external_idstringYour id for the revocation, unique in your account: a request with an external_id that is already taken returns that revocation instead of creating another, so retries are safe. Up to 128 characters.
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
account requiredAddressThe deposit address.
authorization requiredAuthorizationThe deposit address’s authorization with address = 0x0000000000000000000000000000000000000000.

A revocation and its outcome.

FieldTypeDescription
id requiredstring (uuid)
external_idstringYour id for the revocation, if the request had one.
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
account requiredAddressThe deposit address.
status requiredstringqueued and processing: as for a sweep; revoked: the deposit address has no delegation any more; failed: the transaction went through but the chain skipped the authorization, or the attempts ran out; rejected: never sent. The last three are final. One of: queued, processing, revoked, failed, rejected.
reasonstringWhy the revocation ended rejected or failed, or, while it is queued for a retry, why the last attempt did not go through. For rejected: not_delegated (there is no delegation to remove), stale_authorization (the deposit address’s nonce has changed) or invalid_authorization. For failed: not_applied (the chain skipped the authorization). The other codes are the causes of a failed attempt, as in a sweep’s reason. One of: not_delegated, stale_authorization, invalid_authorization, not_applied, insufficient_gas_balance, gas_limit_exceeded, transaction_reverted, nonce_conflict, chain_unavailable, internal.
attempts requiredintegerHow many times the revocation was tried.
tx_hashstringThe transaction that carried the revocation.
gasGasThe revocation’s share of its transaction’s gas.
gas_costAmountThe same in wei.
created_at requiredstring (date-time)When the revocation was requested.
updated_at requiredstring (date-time)When the revocation last changed.

Your webhook settings.

FieldTypeDescription
url requiredstring (uri)Where events go.
secret requiredstringThe signing secret, whsec_…. Keep it on your backend.
low_balance requiredarray of objectLow balance alerts of your gas wallet, one per chain.
low_balance[].chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
low_balance[].threshold requiredAmountThe threshold, in wei.
low_balance[].low requiredbooleanThe balance is below the threshold, and the alert was sent; it re-arms once the balance recovers.

The body of a webhook delivery. type tells what happened and what data is: a sweep as in GET /v1/sweeps/{id}, a revocation as in GET /v1/revocations/{id}, a hot wallet as in GET /v1/hot-wallets, a low balance alert or a test event. Sweeps, revocations and hot wallets are shown as they are when the event is delivered.

One of SweepEvent, RevocationEvent, HotWalletEvent, BalanceLowEvent, WebhookTestEvent; type tells which.

A sweep ended. sweep.swept: it moved the funds; sweep.failed: it reverted on chain or ran out of attempts; sweep.rejected: it was never sent.

FieldTypeDescription
id requiredstring (uuid)The event’s id, the same in every attempt.
type requiredstringThe event type. One of: sweep.swept, sweep.failed, sweep.rejected.
created_at requiredstring (date-time)When the event happened.
data requiredSweepA sweep and its outcome.

A revocation ended. revocation.revoked: the delegation is removed; revocation.failed: the chain skipped the authorization, or the attempts ran out; revocation.rejected: it was never sent.

FieldTypeDescription
id requiredstring (uuid)The event’s id, the same in every attempt.
type requiredstringThe event type. One of: revocation.revoked, revocation.failed, revocation.rejected.
created_at requiredstring (date-time)When the event happened.
data requiredRevocationA revocation and its outcome.

A hot wallet’s delegate deployment ended. hot_wallet.active: the delegate is deployed; hot_wallet.failed: the deployment failed.

FieldTypeDescription
id requiredstring (uuid)The event’s id, the same in every attempt.
type requiredstringThe event type. One of: hot_wallet.active, hot_wallet.failed.
created_at requiredstring (date-time)When the event happened.
data requiredHotWalletA hot wallet on one chain and its delegate.

Your gas wallet fell below a low balance threshold. One event each time it falls below; the alert re-arms once the balance recovers.

FieldTypeDescription
id requiredstring (uuid)The event’s id, the same in every attempt.
type requiredstringThe event type. One of: balance.low.
created_at requiredstring (date-time)When the event happened.
data requiredBalanceLowA low balance alert.

The test event you asked for with POST /v1/webhook/test.

FieldTypeDescription
id requiredstring (uuid)The event’s id, the same in every attempt.
type requiredstringThe event type. One of: webhook.test.
created_at requiredstring (date-time)When the event happened.
data requiredWebhookTestThe data of a test event.

A low balance alert.

FieldTypeDescription
chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
gas_wallet requiredAddressYour gas wallet.
balance requiredAmountIts balance on this chain when the alert fired, in wei.
threshold requiredAmountThe threshold it fell below, in wei.

The data of a test event.

FieldTypeDescription
message requiredstring