/** * @file Hive operation type definitions. * @author Johan Nordberg * @license * Copyright (c) 2017 Johan Nordberg. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * You acknowledge that this software is not designed, licensed or intended for use * in the design, construction, operation or maintenance of any military facility. */ import { PublicKey } from "../crypto.js"; import { AuthorityType } from "./account.js"; import { Asset, PriceType } from "./asset.js"; import { SignedBlockHeader } from "./block.js"; import { BeneficiaryRoute } from "./comment.js"; import { ChainProperties, HexBuffer } from "./misc.js"; /** * Name of a broadcastable Hive operation. * * @remarks * The comments beside each union member preserve the protocol operation id used * by the binary serializer. Pollen operation tuples use this string in position * `0` and the operation payload in position `1`. * * @example * ```ts * const name: OperationName = 'transfer' * ``` * * @see https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/include/hive/protocol/operations.hpp */ export type OperationName = "vote" | "comment" | "transfer" | "transfer_to_vesting" | "withdraw_vesting" | "limit_order_create" | "limit_order_cancel" | "feed_publish" | "convert" | "account_create" | "account_update" | "witness_update" | "account_witness_vote" | "account_witness_proxy" | "custom" | "report_over_production" | "delete_comment" | "custom_json" | "comment_options" | "set_withdraw_vesting_route" | "limit_order_create2" | "claim_account" | "create_claimed_account" | "request_account_recovery" | "recover_account" | "change_recovery_account" | "escrow_transfer" | "escrow_dispute" | "escrow_release" | "escrow_approve" | "transfer_to_savings" | "transfer_from_savings" | "cancel_transfer_from_savings" | "custom_binary" | "decline_voting_rights" | "reset_account" | "set_reset_account" | "claim_reward_balance" | "delegate_vesting_shares" | "account_create_with_delegation" | "witness_set_properties" | "account_update2" | "create_proposal" | "update_proposal_votes" | "remove_proposal" | "update_proposal" | "collateralized_convert" | "recurrent_transfer"; /** * Name of a virtual operation emitted by chain processing. * * @remarks * Virtual operations cannot be broadcast directly. They appear in account and * block operation history when the chain materializes rewards, fills orders, * processes power-downs, or records system events. * * @example * ```ts * const virtualName: VirtualOperationName = 'author_reward' * ``` */ export type VirtualOperationName = "fill_convert_request" | "author_reward" | "curation_reward" | "comment_reward" | "liquidity_reward" | "interest" | "fill_vesting_withdraw" | "fill_order" | "shutdown_witness" | "fill_transfer_from_savings" | "hardfork" | "comment_payout_update" | "return_vesting_delegation" | "comment_benefactor_reward" | "producer_reward" | "clear_null_account_balance" | "proposal_pay" | "sps_fund" | "hardfork_hive" | "hardfork_hive_restore" | "delayed_voting" | "consolidate_treasury_balance" | "effective_comment_vote" | "ineffective_delete_comment" | "sps_convert" | "expired_account_notification" | "changed_recovery_account" | "transfer_to_vesting_completed" | "pow_reward" | "vesting_shares_split" | "account_created" | "fill_collateralized_convert_request" | "system_warning" | "fill_recurrent_transfer" | "failed_recurrent_transfer" | "limit_order_cancelled" | "producer_missed" | "proposal_fee" | "collateralized_convert_immediate_conversion" | "escrow_approved" | "escrow_rejected" | "proxy_cleared" | "declined_voting_rights"; /** * Generic Hive operation tuple. * * @remarks * Position `0` is the operation name; position `1` is the payload object. Use * the specific operation interfaces when constructing transactions so TypeScript * can validate the payload shape. * * @example * ```ts * const op: Operation = ['transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'Pollen' * }] * ``` */ export interface OperationTuple { 0: OperationName | VirtualOperationName; 1: { [key: string]: any; }; } export type Operation = VoteOperation | CommentOperation | TransferOperation | TransferToVestingOperation | WithdrawVestingOperation | LimitOrderCreateOperation | LimitOrderCancelOperation | FeedPublishOperation | ConvertOperation | AccountCreateOperation | AccountUpdateOperation | WitnessUpdateOperation | AccountWitnessVoteOperation | AccountWitnessProxyOperation | CustomOperation | ReportOverProductionOperation | DeleteCommentOperation | CustomJsonOperation | CommentOptionsOperation | SetWithdrawVestingRouteOperation | LimitOrderCreate2Operation | ClaimAccountOperation | CreateClaimedAccountOperation | RequestAccountRecoveryOperation | RecoverAccountOperation | ChangeRecoveryAccountOperation | EscrowTransferOperation | EscrowDisputeOperation | EscrowReleaseOperation | EscrowApproveOperation | TransferToSavingsOperation | TransferFromSavingsOperation | CancelTransferFromSavingsOperation | CustomBinaryOperation | DeclineVotingRightsOperation | ResetAccountOperation | SetResetAccountOperation | ClaimRewardBalanceOperation | DelegateVestingSharesOperation | AccountCreateWithDelegationOperation | WitnessSetPropertiesOperation | AccountUpdate2Operation | CreateProposalOperation | UpdateProposalVotesOperation | RemoveProposalOperation | UpdateProposalOperation | CollateralizedConvertOperation | RecurrentTransferOperation | FillConvertRequestOperation | AuthorRewardOperation | CurationRewardOperation | CommentRewardOperation | LiquidityRewardOperation | InterestOperation | FillVestingWithdrawOperation | FillOrderOperation | ShutdownWitnessOperation | FillTransferFromSavingsOperation | HardforkOperation | CommentPayoutUpdateOperation | ReturnVestingDelegationOperation | CommentBenefactorRewardOperation | ProducerRewardOperation | ClearNullAccountBalanceOperation | ProposalPayOperation | SpsFundOperation | HardforkHiveOperation | HardforkHiveRestoreOperation | DelayedVotingOperation | ConsolidateTreasuryBalanceOperation | EffectiveCommentVoteOperation | IneffectiveDeleteCommentOperation | SpsConvertOperation | ExpiredAccountNotificationOperation | ChangedRecoveryAccountOperation | TransferToVestingCompletedOperation | PowRewardOperation | VestingSharesSplitOperation | AccountCreatedOperation | FillCollateralizedConvertRequestOperation | SystemWarningOperation | FillRecurrentTransferOperation | FailedRecurrentTransferOperation | LimitOrderCancelledOperation | ProducerMissedOperation | ProposalFeeOperation | CollateralizedConvertImmediateConversionOperation | EscrowApprovedOperation | EscrowRejectedOperation | ProxyClearedOperation | DeclinedVotingRightsOperation | [string, Record]; /** * Operation record annotated with block and transaction position. * * @remarks * `get_ops_in_block` and account-history calls return applied operations so * indexers can preserve exact chain order and distinguish virtual operations. * * @example * ```ts * const operations = await client.database.getOperations(90_000_000) * console.log(operations[0].block, operations[0].op[0]) * ``` */ export interface AppliedOperation { trx_id: string; block: number; trx_in_block: number; op_in_trx: number; virtual_op: number; timestamp: string; op: Operation; } /** * Legacy paid account creation operation. * * @remarks * This operation creates an account by paying `fee` directly. Modern Hive * account creation often uses claimed account tickets through * {@link ClaimAccountOperation} and {@link CreateClaimedAccountOperation}. * * @example * ```ts * const op: AccountCreateOperation = ['account_create', { * fee: '3.000 HIVE', * creator: 'srbde', * new_account_name: 'new-user', * owner, * active, * posting, * memo_key, * json_metadata: '{}' * }] * ``` */ export interface AccountCreateOperation extends OperationTuple { 0: "account_create"; 1: { fee: string | Asset; creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; }; } /** * Account creation operation that also delegates initial VESTS. * * @remarks * Delegation gives a new account immediate resource capacity without * transferring ownership of the underlying vesting shares. */ export interface AccountCreateWithDelegationOperation extends OperationTuple { 0: "account_create_with_delegation"; 1: { fee: string | Asset; delegation: string | Asset; creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Updates account authorities, memo key, or legacy JSON metadata. * * @remarks * Authority changes require the appropriate owner or active signatures. Use * {@link AccountUpdate2Operation} when posting JSON metadata is needed. * * @example * ```ts * const op: AccountUpdateOperation = ['account_update', { * account: 'srbde', * memo_key, * json_metadata: '{}' * }] * ``` */ export interface AccountUpdateOperation extends OperationTuple { 0: "account_update"; 1: { account: string; owner?: AuthorityType; active?: AuthorityType; posting?: AuthorityType; memo_key: string | PublicKey; json_metadata: string; }; } /** * Sets or clears the witness voting proxy for an account. * * @remarks * When a proxy is set, the account delegates witness-vote influence to another * account instead of voting witnesses directly. */ export interface AccountWitnessProxyOperation extends OperationTuple { 0: "account_witness_proxy"; 1: { account: string; proxy: string; }; } /** * Approves or removes a witness vote. * * @example * ```ts * const op: AccountWitnessVoteOperation = ['account_witness_vote', { * account: 'srbde', * witness: 'some-witness', * approve: true * }] * ``` */ export interface AccountWitnessVoteOperation extends OperationTuple { 0: "account_witness_vote"; 1: { account: string; witness: string; approve: boolean; }; } /** * Cancels a pending savings withdrawal request. */ export interface CancelTransferFromSavingsOperation extends OperationTuple { 0: "cancel_transfer_from_savings"; 1: { from: string; request_id: number; }; } /** * Each account lists another account as their recovery account. * The recovery account has the ability to create account_recovery_requests * for the account to recover. An account can change their recovery account * at any time with a 30 day delay. This delay is to prevent * an attacker from changing the recovery account to a malicious account * during an attack. These 30 days match the 30 days that an * owner authority is valid for recovery purposes. * * On account creation the recovery account is set either to the creator of * the account (The account that pays the creation fee and is a signer on the transaction) * or to the empty string if the account was mined. An account with no recovery * has the top voted witness as a recovery account, at the time the recover * request is created. Note: This does mean the effective recovery account * of an account with no listed recovery account can change at any time as * witness vote weights. The top voted witness is explicitly the most trusted * witness according to stake. */ export interface ChangeRecoveryAccountOperation extends OperationTuple { 0: "change_recovery_account"; 1: { /** * The account that would be recovered in case of compromise. */ account_to_recover: string; /** * The account that creates the recover request. */ new_recovery_account: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Claims pending author, curation, and vesting rewards. * * @remarks * Any reward field may be `0.000` in its respective asset. Hive requires the * operation to name all three reward buckets explicitly. */ export interface ClaimRewardBalanceOperation extends OperationTuple { 0: "claim_reward_balance"; 1: { account: string; reward_hive: string | Asset; reward_hbd: string | Asset; reward_vests: string | Asset; }; } /** * Claims a discounted account creation ticket. * * @remarks * Claimed tickets can later be consumed by * {@link CreateClaimedAccountOperation}. A zero fee is valid when the chain has * free account subsidies available. */ export interface ClaimAccountOperation extends OperationTuple { 0: "claim_account"; 1: { creator: string; fee: string | Asset; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Creates or updates a post or reply. * * @remarks * Empty `parent_author` creates a top-level post. Non-empty `parent_author` * creates a reply under the parent author/permlink pair. * * @example * ```ts * const op: CommentOperation = ['comment', { * parent_author: '', * parent_permlink: 'hive-139531', * author: 'srbde', * permlink: 'hello-pollen', * title: 'Hello Pollen', * body: 'Posted with Pollen.', * json_metadata: JSON.stringify({ tags: ['hive-139531'] }) * }] * ``` */ export interface CommentOperation extends OperationTuple { 0: "comment"; 1: { parent_author: string; parent_permlink: string; author: string; permlink: string; title: string; body: string; json_metadata: string; }; } /** * Sets payout, vote, curation, and beneficiary options for a comment. * * @remarks * This usually travels in the same transaction as {@link CommentOperation} so a * new post never exists with unintended payout settings. */ export interface CommentOptionsOperation extends OperationTuple { 0: "comment_options"; 1: { author: string; permlink: string; /** HBD value of the maximum payout this post will receive. */ max_accepted_payout: Asset | string; /** The percent of Hive Dollars to key, unkept amounts will be received as Hive Power. */ percent_hbd: number; /** Whether to allow post to receive votes. */ allow_votes: boolean; /** Whether to allow post to recieve curation rewards. */ allow_curation_rewards: boolean; extensions: [0, { beneficiaries: BeneficiaryRoute[]; }][]; }; } /** * Converts HBD to HIVE through the standard conversion request flow. */ export interface ConvertOperation extends OperationTuple { 0: "convert"; 1: { owner: string; requestid: number; amount: Asset | string; }; } /** * Consumes a claimed account ticket to create a new account. */ export interface CreateClaimedAccountOperation extends OperationTuple { 0: "create_claimed_account"; 1: { creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Legacy binary custom operation requiring active authority. */ export interface CustomOperation extends OperationTuple { 0: "custom"; 1: { required_auths: string[]; id: number; data: Uint8Array | HexBuffer | number[]; }; } /** * Binary custom operation supporting owner, active, posting, and authority auths. */ export interface CustomBinaryOperation extends OperationTuple { 0: "custom_binary"; 1: { required_owner_auths: string[]; required_active_auths: string[]; required_posting_auths: string[]; required_auths: AuthorityType[]; /** * ID string, must be less than 32 characters long. */ id: string; data: Uint8Array | HexBuffer | number[]; }; } /** * JSON custom operation used by Hive application protocols. * * @remarks * The `json` field must already be serialized. Posting authority is common for * social protocols; active authority is used for protocols with financial or * account-control implications. * * @example * ```ts * const op: CustomJsonOperation = ['custom_json', { * required_auths: [], * required_posting_auths: ['srbde'], * id: 'pollen.demo', * json: JSON.stringify({ ok: true }) * }] * ``` */ export interface CustomJsonOperation extends OperationTuple { 0: "custom_json"; 1: { required_auths: string[]; required_posting_auths: string[]; /** * ID string, must be less than 32 characters long. */ id: string; /** * JSON encoded string, must be valid JSON. */ json: string; }; } /** * Enables or disables an account's ability to vote. */ export interface DeclineVotingRightsOperation extends OperationTuple { 0: "decline_voting_rights"; 1: { account: string; decline: boolean; }; } /** * Delegates vesting shares from one account to another. * * @remarks * Set `vesting_shares` to `0.000000 VESTS` to remove an existing delegation. */ export interface DelegateVestingSharesOperation extends OperationTuple { 0: "delegate_vesting_shares"; 1: { /** * The account delegating vesting shares. */ delegator: string; /** * The account receiving vesting shares. */ delegatee: string; /** * The amount of vesting shares delegated. */ vesting_shares: string | Asset; }; } /** * Deletes a comment or post when chain rules allow it. */ export interface DeleteCommentOperation extends OperationTuple { 0: "delete_comment"; 1: { author: string; permlink: string; }; } /** * The agent and to accounts must approve an escrow transaction for it to be valid on * the blockchain. Once a part approves the escrow, the cannot revoke their approval. * Subsequent escrow approve operations, regardless of the approval, will be rejected. */ export interface EscrowApproveOperation extends OperationTuple { 0: "escrow_approve"; 1: { from: string; to: string; agent: string; /** * Either to or agent. */ who: string; escrow_id: number; approve: boolean; }; } /** * If either the sender or receiver of an escrow payment has an issue, they can * raise it for dispute. Once a payment is in dispute, the agent has authority over * who gets what. */ export interface EscrowDisputeOperation extends OperationTuple { 0: "escrow_dispute"; 1: { from: string; to: string; agent: string; who: string; escrow_id: number; }; } /** * This operation can be used by anyone associated with the escrow transfer to * release funds if they have permission. * * The permission scheme is as follows: * If there is no dispute and escrow has not expired, either party can release funds to the other. * If escrow expires and there is no dispute, either party can release funds to either party. * If there is a dispute regardless of expiration, the agent can release funds to either party * following whichever agreement was in place between the parties. */ export interface EscrowReleaseOperation extends OperationTuple { 0: "escrow_release"; 1: { from: string; /** * The original 'to'. */ to: string; agent: string; /** * The account that is attempting to release the funds, determines valid 'receiver'. */ who: string; /** * The account that should receive funds (might be from, might be to). */ receiver: string; escrow_id: number; /** * The amount of hbd to release. */ hbd_amount: Asset | string; /** * The amount of hive to release. */ hive_amount: Asset | string; }; } /** * The purpose of this operation is to enable someone to send money contingently to * another individual. The funds leave the *from* account and go into a temporary balance * where they are held until *from* releases it to *to* or *to* refunds it to *from*. * * In the event of a dispute the *agent* can divide the funds between the to/from account. * Disputes can be raised any time before or on the dispute deadline time, after the escrow * has been approved by all parties. * * This operation only creates a proposed escrow transfer. Both the *agent* and *to* must * agree to the terms of the arrangement by approving the escrow. * * The escrow agent is paid the fee on approval of all parties. It is up to the escrow agent * to determine the fee. * * Escrow transactions are uniquely identified by 'from' and 'escrow_id', the 'escrow_id' is defined * by the sender. */ export interface EscrowTransferOperation extends OperationTuple { 0: "escrow_transfer"; 1: { from: string; to: string; agent: string; escrow_id: number; hbd_amount: Asset | string; hive_amount: Asset | string; fee: Asset | string; ratification_deadline: string; escrow_expiration: string; json_meta: string; }; } /** * Publishes a witness price feed. * * @remarks * Witness feeds influence the median HIVE/HBD price used by conversions and * debt-ratio mechanics. */ export interface FeedPublishOperation extends OperationTuple { 0: "feed_publish"; 1: { publisher: string; exchange_rate: PriceType; }; } /** * Cancels an order and returns the balance to owner. */ export interface LimitOrderCancelOperation extends OperationTuple { 0: "limit_order_cancel"; 1: { owner: string; orderid: number; }; } /** * This operation creates a limit order and matches it against existing open orders. */ export interface LimitOrderCreateOperation extends OperationTuple { 0: "limit_order_create"; 1: { owner: string; orderid: number; amount_to_sell: Asset | string; min_to_receive: Asset | string; fill_or_kill: boolean; expiration: string; }; } /** * This operation is identical to limit_order_create except it serializes the price rather * than calculating it from other fields. */ export interface LimitOrderCreate2Operation extends OperationTuple { 0: "limit_order_create2"; 1: { owner: string; orderid: number; amount_to_sell: Asset | string; exchange_rate: PriceType; fill_or_kill: boolean; expiration: string; }; } /** * Recover an account to a new authority using a previous authority and verification * of the recovery account as proof of identity. This operation can only succeed * if there was a recovery request sent by the account's recover account. * * In order to recover the account, the account holder must provide proof * of past ownership and proof of identity to the recovery account. Being able * to satisfy an owner authority that was used in the past 30 days is sufficient * to prove past ownership. The get_owner_history function in the database API * returns past owner authorities that are valid for account recovery. * * Proving identity is an off chain contract between the account holder and * the recovery account. The recovery request contains a new authority which * must be satisfied by the account holder to regain control. The actual process * of verifying authority may become complicated, but that is an application * level concern, not a blockchain concern. * * This operation requires both the past and future owner authorities in the * operation because neither of them can be derived from the current chain state. * The operation must be signed by keys that satisfy both the new owner authority * and the recent owner authority. Failing either fails the operation entirely. * * If a recovery request was made inadvertantly, the account holder should * contact the recovery account to have the request deleted. * * The two setp combination of the account recovery request and recover is * safe because the recovery account never has access to secrets of the account * to recover. They simply act as an on chain endorsement of off chain identity. * In other systems, a fork would be required to enforce such off chain state. * Additionally, an account cannot be permanently recovered to the wrong account. * While any owner authority from the past 30 days can be used, including a compromised * authority, the account can be continually recovered until the recovery account * is confident a combination of uncompromised authorities were used to * recover the account. The actual process of verifying authority may become * complicated, but that is an application level concern, not the blockchain's * concern. */ export interface RecoverAccountOperation extends OperationTuple { 0: "recover_account"; 1: { /** * The account to be recovered. */ account_to_recover: string; /** * The new owner authority as specified in the request account recovery operation. */ new_owner_authority: AuthorityType; /** * A previous owner authority that the account holder will use to prove * past ownership of the account to be recovered. */ recent_owner_authority: AuthorityType; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * This operation is used to report a miner who signs two blocks * at the same time. To be valid, the violation must be reported within * MAX_WITNESSES blocks of the head block (1 round) and the * producer must be in the ACTIVE witness set. * * Users not in the ACTIVE witness set should not have to worry about their * key getting compromised and being used to produced multiple blocks so * the attacker can report it and steel their vesting hive. * * The result of the operation is to transfer the full VESTING HIVE balance * of the block producer to the reporter. */ export interface ReportOverProductionOperation extends OperationTuple { 0: "report_over_production"; 1: { reporter: string; first_block: SignedBlockHeader; second_block: SignedBlockHeader; }; } /** * All account recovery requests come from a listed recovery account. This * is secure based on the assumption that only a trusted account should be * a recovery account. It is the responsibility of the recovery account to * verify the identity of the account holder of the account to recover by * whichever means they have agreed upon. The blockchain assumes identity * has been verified when this operation is broadcast. * * This operation creates an account recovery request which the account to * recover has 24 hours to respond to before the request expires and is * invalidated. * * There can only be one active recovery request per account at any one time. * Pushing this operation for an account to recover when it already has * an active request will either update the request to a new new owner authority * and extend the request expiration to 24 hours from the current head block * time or it will delete the request. To cancel a request, simply set the * weight threshold of the new owner authority to 0, making it an open authority. * * Additionally, the new owner authority must be satisfiable. In other words, * the sum of the key weights must be greater than or equal to the weight * threshold. * * This operation only needs to be signed by the the recovery account. * The account to recover confirms its identity to the blockchain in * the recover account operation. */ export interface RequestAccountRecoveryOperation extends OperationTuple { 0: "request_account_recovery"; 1: { /** * The recovery account is listed as the recovery account on the account to recover. */ recovery_account: string; /** * The account to recover. This is likely due to a compromised owner authority. */ account_to_recover: string; /** * The new owner authority the account to recover wishes to have. This is secret * known by the account to recover and will be confirmed in a recover_account_operation. */ new_owner_authority: AuthorityType; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * This operation allows recovery_account to change account_to_reset's owner authority to * new_owner_authority after 60 days of inactivity. */ export interface ResetAccountOperation extends OperationTuple { 0: "reset_account"; 1: { reset_account: string; account_to_reset: string; new_owner_authority: AuthorityType; }; } /** * This operation allows 'account' owner to control which account has the power * to execute the 'reset_account_operation' after 60 days. */ export interface SetResetAccountOperation extends OperationTuple { 0: "set_reset_account"; 1: { account: string; current_reset_account: string; reset_account: string; }; } /** * Allows an account to setup a vesting withdraw but with the additional * request for the funds to be transferred directly to another account's * balance rather than the withdrawing account. In addition, those funds * can be immediately vested again, circumventing the conversion from * vests to hive and back, guaranteeing they maintain their value. */ export interface SetWithdrawVestingRouteOperation extends OperationTuple { 0: "set_withdraw_vesting_route"; 1: { from_account: string; to_account: string; percent: number; auto_vest: boolean; }; } /** * Transfers asset from one account to another. * * @remarks * Transfers require active authority from `from`. Use `Memo.encode` before * broadcasting when the memo should be encrypted for the recipient. * * @example * ```ts * const op: TransferOperation = ['transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'Invoice 42' * }] * ``` */ export interface TransferOperation extends OperationTuple { 0: "transfer"; 1: { /** * Sending account name. */ from: string; /** * Receiving account name. */ to: string; /** * Amount of HIVE or HBD to send. */ amount: string | Asset; /** * Plain-text note attached to transaction. */ memo: string; }; } /** * Withdraws funds from savings to liquid balance after the savings delay. * * @remarks * The request can be cancelled with {@link CancelTransferFromSavingsOperation} * before it completes. */ export interface TransferFromSavingsOperation extends OperationTuple { 0: "transfer_from_savings"; 1: { from: string; request_id: number; to: string; amount: string | Asset; memo: string; }; } /** * Moves liquid HIVE or HBD into an account's savings balance. */ export interface TransferToSavingsOperation extends OperationTuple { 0: "transfer_to_savings"; 1: { amount: string | Asset; from: string; memo: string; request_id: number; to: string; }; } /** * This operation converts HIVE into VFS (Vesting Fund Shares) at * the current exchange rate. With this operation it is possible to * give another account vesting shares so that faucets can * pre-fund new accounts with vesting shares. * (A.k.a. Powering Up) */ export interface TransferToVestingOperation extends OperationTuple { 0: "transfer_to_vesting"; 1: { from: string; to: string; /** * Amount to power up, must be HIVE */ amount: string | Asset; }; } /** * Casts, updates, or removes a vote on a post or comment. * * @remarks * Weight is a signed integer where `10000` is a full upvote, `0` removes the * vote, and negative values are downvotes. * * @example * ```ts * const op: VoteOperation = ['vote', { * voter: 'srbde', * author: 'alice', * permlink: 'field-notes', * weight: 10_000 * }] * ``` */ export interface VoteOperation extends OperationTuple { 0: "vote"; 1: { voter: string; author: string; permlink: string; /** * Voting weight, 100% = 10000 (100_PERCENT). */ weight: number; }; } /** * At any given point in time an account can be withdrawing from their * vesting shares. A user may change the number of shares they wish to * cash out at any time between 0 and their total vesting stake. * * After applying this operation, vesting_shares will be withdrawn * at a rate of vesting_shares/104 per week for two years starting * one week after this operation is included in the blockchain. * * This operation is not valid if the user has no vesting shares. * (A.k.a. Powering Down) */ export interface WithdrawVestingOperation extends OperationTuple { 0: "withdraw_vesting"; 1: { account: string; /** * Amount to power down, must be VESTS. */ vesting_shares: string | Asset; }; } /** * Users who wish to become a witness must pay a fee acceptable to * the current witnesses to apply for the position and allow voting * to begin. * * If the owner isn't a witness they will become a witness. Witnesses * are charged a fee equal to 1 weeks worth of witness pay which in * turn is derived from the current share supply. The fee is * only applied if the owner is not already a witness. * * If the block_signing_key is null then the witness is removed from * contention. The network will pick the top 21 witnesses for * producing blocks. */ export interface WitnessUpdateOperation extends OperationTuple { 0: "witness_update"; 1: { owner: string; /** * URL for witness, usually a link to a post in the witness-category tag. */ url: string; block_signing_key: string | PublicKey | null; props: ChainProperties; /** * The fee paid to register a new witness, should be 10x current block production pay. */ fee: string | Asset; }; } export interface WitnessSetPropertiesOperation extends OperationTuple { 0: "witness_set_properties"; 1: { owner: string; props: [string, string][]; extensions: any[]; }; } /** * Modern account update operation with posting JSON metadata. * * @remarks * This operation extends the legacy account update shape by allowing separate * profile/application metadata in `posting_json_metadata`. */ export interface AccountUpdate2Operation extends OperationTuple { 0: "account_update2"; 1: { account: string; owner?: AuthorityType; active?: AuthorityType; posting?: AuthorityType; memo_key?: string | PublicKey; json_metadata: string; posting_json_metadata: string; extensions: any[]; }; } /** * Creates a Decentralized Hive Fund proposal. * * @remarks * Proposal payments are made to `receiver` between `start_date` and `end_date` * when the proposal receives sufficient stake-weighted approval. */ export interface CreateProposalOperation extends OperationTuple { 0: "create_proposal"; 1: { creator: string; receiver: string; start_date: string; end_date: string; daily_pay: Asset | string; subject: string; permlink: string; extensions: any[]; }; } /** * Approves or removes approvals for DHF proposal ids. */ export interface UpdateProposalVotesOperation extends OperationTuple { 0: "update_proposal_votes"; 1: { voter: string; proposal_ids: number[]; approve: boolean; extensions: any[]; }; } /** * Removes DHF proposals owned by an account. */ export interface RemoveProposalOperation extends OperationTuple { 0: "remove_proposal"; 1: { proposal_owner: string; proposal_ids: number[]; extensions: any[]; }; } /** * Updates mutable fields on an existing DHF proposal. */ export interface UpdateProposalOperation extends OperationTuple { 0: "update_proposal"; 1: { proposal_id: number; creator: string; daily_pay: Asset | string; subject: string; permlink: string; extensions: any[]; }; } /** * Converts HIVE to HBD through the collateralized conversion flow. */ export interface CollateralizedConvertOperation extends OperationTuple { 0: "collateralized_convert"; 1: { owner: string; requestid: number; amount: Asset | string; }; } /** * Schedules a recurring transfer. * * @remarks * `recurrence` is the interval in hours and `executions` is the number of * times the transfer should execute. * * @example * ```ts * const op: RecurrentTransferOperation = ['recurrent_transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'monthly support', * recurrence: 720, * executions: 3, * extensions: [] * }] * ``` */ export interface RecurrentTransferOperation extends OperationTuple { 0: "recurrent_transfer"; 1: { from: string; to: string; amount: Asset | string; memo: string; recurrence: number; executions: number; extensions: any[]; }; } export interface FillConvertRequestOperation extends OperationTuple { 0: "fill_convert_request"; 1: { owner: string; requestid: number; amount_in: string | Asset; amount_out: string | Asset; }; } export interface AuthorRewardOperation extends OperationTuple { 0: "author_reward"; 1: { author: string; permlink: string; hbd_payout: string | Asset; hive_payout: string | Asset; vesting_payout: string | Asset; curators_vesting_payout: string | Asset; payout_must_be_claimed: boolean; }; } export interface CurationRewardOperation extends OperationTuple { 0: "curation_reward"; 1: { curator: string; reward: string | Asset; author: string; permlink: string; payout_must_be_claimed: boolean; }; } export interface CommentRewardOperation extends OperationTuple { 0: "comment_reward"; 1: { author: string; permlink: string; payout: string | Asset; author_rewards: number | string; total_payout_value: string | Asset; curator_payout_value: string | Asset; beneficiary_payout_value: string | Asset; }; } export interface LiquidityRewardOperation extends OperationTuple { 0: "liquidity_reward"; 1: { owner: string; payout: string | Asset; }; } export interface InterestOperation extends OperationTuple { 0: "interest"; 1: { owner: string; interest: string | Asset; is_saved_into_hbd_balance: boolean; }; } export interface FillVestingWithdrawOperation extends OperationTuple { 0: "fill_vesting_withdraw"; 1: { from_account: string; to_account: string; withdrawn: string | Asset; deposited: string | Asset; }; } export interface FillOrderOperation extends OperationTuple { 0: "fill_order"; 1: { current_owner: string; current_orderid: number; current_pays: string | Asset; open_owner: string; open_orderid: number; open_pays: string | Asset; }; } export interface ShutdownWitnessOperation extends OperationTuple { 0: "shutdown_witness"; 1: { owner: string; }; } export interface FillTransferFromSavingsOperation extends OperationTuple { 0: "fill_transfer_from_savings"; 1: { from: string; to: string; amount: string | Asset; request_id: number; memo: string; }; } export interface HardforkOperation extends OperationTuple { 0: "hardfork"; 1: { hardfork_id: number; }; } export interface CommentPayoutUpdateOperation extends OperationTuple { 0: "comment_payout_update"; 1: { author: string; permlink: string; }; } export interface ReturnVestingDelegationOperation extends OperationTuple { 0: "return_vesting_delegation"; 1: { account: string; vesting_shares: string | Asset; }; } export interface CommentBenefactorRewardOperation extends OperationTuple { 0: "comment_benefactor_reward"; 1: { benefactor: string; author: string; permlink: string; hbd_payout: string | Asset; hive_payout: string | Asset; vesting_payout: string | Asset; payout_must_be_claimed: boolean; }; } export interface ProducerRewardOperation extends OperationTuple { 0: "producer_reward"; 1: { producer: string; vesting_shares: string | Asset; }; } export interface ClearNullAccountBalanceOperation extends OperationTuple { 0: "clear_null_account_balance"; 1: { total_cleared: (string | Asset)[]; }; } export interface ProposalPayOperation extends OperationTuple { 0: "proposal_pay"; 1: { proposal_id: number; receiver: string; payer: string; payment: string | Asset; }; } export interface SpsFundOperation extends OperationTuple { 0: "sps_fund"; 1: { treasury: string; additional_funds: string | Asset; }; } export interface HardforkHiveOperation extends OperationTuple { 0: "hardfork_hive"; 1: { account: string; treasury: string; other_affected_accounts: string[]; hbd_transferred: string | Asset; hive_transferred: string | Asset; vests_converted: string | Asset; total_hive_from_vests: string | Asset; }; } export interface HardforkHiveRestoreOperation extends OperationTuple { 0: "hardfork_hive_restore"; 1: { account: string; treasury: string; hbd_transferred: string | Asset; hive_transferred: string | Asset; }; } export interface DelayedVotingOperation extends OperationTuple { 0: "delayed_voting"; 1: { voter: string; votes: number | string; }; } export interface ConsolidateTreasuryBalanceOperation extends OperationTuple { 0: "consolidate_treasury_balance"; 1: { total_cleared?: (string | Asset)[]; total_moved?: (string | Asset)[]; }; } export interface EffectiveCommentVoteOperation extends OperationTuple { 0: "effective_comment_vote"; 1: { voter: string; author: string; permlink: string; weight: number | string; rshares: number | string; total_vote_weight: number | string; pending_payout: string | Asset; }; } export interface IneffectiveDeleteCommentOperation extends OperationTuple { 0: "ineffective_delete_comment"; 1: { author: string; permlink: string; }; } export interface SpsConvertOperation extends OperationTuple { 0: "sps_convert"; 1: { treasury: string; hive_amount_in: string | Asset; hbd_amount_out: string | Asset; }; } export interface ExpiredAccountNotificationOperation extends OperationTuple { 0: "expired_account_notification"; 1: { account: string; }; } export interface ChangedRecoveryAccountOperation extends OperationTuple { 0: "changed_recovery_account"; 1: { account: string; old_recovery_account: string; new_recovery_account: string; }; } export interface TransferToVestingCompletedOperation extends OperationTuple { 0: "transfer_to_vesting_completed"; 1: { from_account: string; to_account: string; hive_vested: string | Asset; vesting_shares_received: string | Asset; }; } export interface PowRewardOperation extends OperationTuple { 0: "pow_reward"; 1: { worker: string; reward: string | Asset; }; } export interface VestingSharesSplitOperation extends OperationTuple { 0: "vesting_shares_split"; 1: { owner: string; vesting_shares_before_split: string | Asset; vesting_shares_after_split: string | Asset; }; } export interface AccountCreatedOperation extends OperationTuple { 0: "account_created"; 1: { new_account_name: string; creator: string; initial_vesting_shares: string | Asset; initial_delegation: string | Asset; }; } export interface FillCollateralizedConvertRequestOperation extends OperationTuple { 0: "fill_collateralized_convert_request"; 1: { owner: string; requestid: number; amount_in: string | Asset; amount_out: string | Asset; excess_collateral: string | Asset; }; } export interface SystemWarningOperation extends OperationTuple { 0: "system_warning"; 1: { message: string; }; } export interface FillRecurrentTransferOperation extends OperationTuple { 0: "fill_recurrent_transfer"; 1: { from: string; to: string; amount: string | Asset; memo: string; remaining_executions: number; extensions: any[]; }; } export interface FailedRecurrentTransferOperation extends OperationTuple { 0: "failed_recurrent_transfer"; 1: { from: string; to: string; amount: string | Asset; memo: string; consecutive_failures: number; remaining_executions: number; deleted: boolean; extensions: any[]; }; } export interface LimitOrderCancelledOperation extends OperationTuple { 0: "limit_order_cancelled"; 1: { seller: string; orderid: number; amount_back: string | Asset; }; } export interface ProducerMissedOperation extends OperationTuple { 0: "producer_missed"; 1: { producer: string; }; } export interface ProposalFeeOperation extends OperationTuple { 0: "proposal_fee"; 1: { creator: string; treasury: string; proposal_id: number; fee: string | Asset; }; } export interface CollateralizedConvertImmediateConversionOperation extends OperationTuple { 0: "collateralized_convert_immediate_conversion"; 1: { owner: string; requestid: number; hbd_out: string | Asset; }; } export interface EscrowApprovedOperation extends OperationTuple { 0: "escrow_approved"; 1: { from: string; to: string; agent: string; escrow_id: number; fee: string | Asset; }; } export interface EscrowRejectedOperation extends OperationTuple { 0: "escrow_rejected"; 1: { from: string; to: string; agent: string; escrow_id: number; hbd_amount: string | Asset; hive_amount: string | Asset; fee: string | Asset; }; } export interface ProxyClearedOperation extends OperationTuple { 0: "proxy_cleared"; 1: { account: string; proxy: string; }; } export interface DeclinedVotingRightsOperation extends OperationTuple { 0: "declined_voting_rights"; 1: { account: string; }; }