@hashgraph/sdk
Version:
310 lines (309 loc) • 9.82 kB
TypeScript
/**
* @typedef {import("bignumber.js").default} BigNumber
* @typedef {import("../channel/Channel.js").default} Channel
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../Timestamp.js").default} Timestamp
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
*/
/**
* Create a new Hedera™ crypto-currency account.
*/
export default class AccountCreateTransaction extends Transaction {
/**
* @internal
* @param {HieroProto.proto.ITransaction[]} transactions
* @param {HieroProto.proto.ISignedTransaction[]} signedTransactions
* @param {TransactionId[]} transactionIds
* @param {AccountId[]} nodeIds
* @param {HieroProto.proto.ITransactionBody[]} bodies
* @returns {AccountCreateTransaction}
*/
static _fromProtobuf(transactions: HieroProto.proto.ITransaction[], signedTransactions: HieroProto.proto.ISignedTransaction[], transactionIds: TransactionId[], nodeIds: AccountId[], bodies: HieroProto.proto.ITransactionBody[]): AccountCreateTransaction;
/**
* @param {object} [props]
* @param {Key} [props.key]
* @param {number | string | Long | BigNumber | Hbar} [props.initialBalance]
* @param {boolean} [props.receiverSignatureRequired]
* @param {AccountId} [props.proxyAccountId]
* @param {Duration | Long | number} [props.autoRenewPeriod]
* @param {string} [props.accountMemo]
* @param {Long | number} [props.maxAutomaticTokenAssociations]
* @param {AccountId | string} [props.stakedAccountId]
* @param {Long | number} [props.stakedNodeId]
* @param {boolean} [props.declineStakingReward]
* @param {EvmAddress} [props.alias]
*/
constructor(props?: {
key?: Key | undefined;
initialBalance?: string | number | Long | import("bignumber.js").BigNumber | Hbar | undefined;
receiverSignatureRequired?: boolean | undefined;
proxyAccountId?: AccountId | undefined;
autoRenewPeriod?: number | Long | Duration | undefined;
accountMemo?: string | undefined;
maxAutomaticTokenAssociations?: number | Long | undefined;
stakedAccountId?: string | AccountId | undefined;
stakedNodeId?: number | Long | undefined;
declineStakingReward?: boolean | undefined;
alias?: EvmAddress | undefined;
});
/**
* @private
* @type {?Key}
*/
private _key;
/**
* @private
* @type {?Hbar}
*/
private _initialBalance;
/**
* @private
* @type {Hbar}
*/
private _sendRecordThreshold;
/**
* @private
* @type {Hbar}
*/
private _receiveRecordThreshold;
/**
* @private
* @type {boolean}
*/
private _receiverSignatureRequired;
/**
* @private
* @type {?AccountId}
*/
private _proxyAccountId;
/**
* @private
* @type {Duration}
*/
private _autoRenewPeriod;
/**
* @private
* @type {?string}
*/
private _accountMemo;
/**
* @private
* @type {?Long}
*/
private _maxAutomaticTokenAssociations;
/**
* @private
* @type {?AccountId}
*/
private _stakedAccountId;
/**
* @private
* @type {?Long}
*/
private _stakedNodeId;
/**
* @private
* @type {boolean}
*/
private _declineStakingReward;
/**
* @private
* @type {?EvmAddress}
*/
private _alias;
/**
* @returns {?Key}
*/
get key(): Key | null;
/**
* Set the key for this account.
*
* This is the key that must sign each transfer out of the account.
*
* If `receiverSignatureRequired` is true, then the key must also sign
* any transfer into the account.
*
* @deprecated Use `setKeyWithoutAlias` instead.
* @param {Key} key
* @returns {this}
*/
setKey(key: Key): this;
/**
* Sets an ECDSA key (private or public) and a derived alias from this key in the background.
* @param {Key} key - An ECDSA key (private or public) used for signing transactions and alias derivation.
* @returns {this}
* @throws {Error} If the key is not an ECDSA key.
*/
setECDSAKeyWithAlias(key: Key): this;
/**
* Sets an account key and an alias derived from a separate ECDSA key.
* The transaction must be signed by both keys.
* @param {Key} key - The primary account key used for signing transactions.
* @param {Key} aliasKey - The ECDSA key (private or public) used to derive the EVM address.
* @returns {this}
* @throws {Error} If the aliasKey is not an ECDSA key.
*/
setKeyWithAlias(key: Key, aliasKey: Key): this;
/**
* Set the key for this account without an alias.
*
* This is the key that must sign each transfer out of the account.
*
* If `receiverSignatureRequired` is true, then the key must also sign
* any transfer into the account.
*
*
* @param {Key} key
* @returns {this}
*/
setKeyWithoutAlias(key: Key): this;
/**
* @returns {?Hbar}
*/
get initialBalance(): Hbar | null;
/**
* Set the initial amount to transfer into this account.
*
* @param {number | string | Long | BigNumber | Hbar} initialBalance
* @returns {this}
*/
setInitialBalance(initialBalance: number | string | Long | BigNumber | Hbar): this;
/**
* @returns {boolean}
*/
get receiverSignatureRequired(): boolean;
/**
* Set to true to require the key for this account to sign any transfer of
* hbars to this account.
*
* @param {boolean} receiverSignatureRequired
* @returns {this}
*/
setReceiverSignatureRequired(receiverSignatureRequired: boolean): this;
/**
* @deprecated
* @returns {?AccountId}
*/
get proxyAccountId(): AccountId | null;
/**
* @deprecated
*
* Set the ID of the account to which this account is proxy staked.
* @param {AccountId} proxyAccountId
* @returns {this}
*/
setProxyAccountId(proxyAccountId: AccountId): this;
/**
* @returns {Duration}
*/
get autoRenewPeriod(): Duration;
/**
* Set the auto renew period for this account.
*
* @param {Duration | Long | number} autoRenewPeriod
* @returns {this}
*/
setAutoRenewPeriod(autoRenewPeriod: Duration | Long | number): this;
/**
* @returns {?string}
*/
get accountMemo(): string | null;
/**
* @param {string} memo
* @returns {this}
*/
setAccountMemo(memo: string): this;
/**
* @returns {?Long}
*/
get maxAutomaticTokenAssociations(): Long | null;
/**
* @param {Long | number} maxAutomaticTokenAssociations
* @returns {this}
*/
setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations: Long | number): this;
/**
* @returns {?AccountId}
*/
get stakedAccountId(): AccountId | null;
/**
* @param {AccountId | string} stakedAccountId
* @returns {this}
*/
setStakedAccountId(stakedAccountId: AccountId | string): this;
/**
* @returns {?Long}
*/
get stakedNodeId(): Long | null;
/**
* @param {Long | number} stakedNodeId
* @returns {this}
*/
setStakedNodeId(stakedNodeId: Long | number): this;
/**
* @returns {boolean}
*/
get declineStakingRewards(): boolean;
/**
* @param {boolean} declineStakingReward
* @returns {this}
*/
setDeclineStakingReward(declineStakingReward: boolean): this;
/**
* The bytes to be used as the account's alias.
*
* The bytes must be formatted as the calcluated last 20 bytes of the
* keccak-256 of the ECDSA primitive key.
*
* All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and
* delegatable_contract_id, are not supported.
*
* At most only one account can ever have a given alias on the network.
*
* @returns {?EvmAddress}
*/
get alias(): EvmAddress | null;
/**
* The bytes to be used as the account's alias.
*
* The bytes must be formatted as the calcluated last 20 bytes of the
* keccak-256 of the ECDSA primitive key.
*
* All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and
* delegatable_contract_id, are not supported.
*
* At most only one account can ever have a given alias on the network.
*
* @param {string | EvmAddress} alias
* @returns {this}
*/
setAlias(alias: string | EvmAddress): this;
/**
* Derives an EVM alias from an ECDSA key.
* @private
* @internal
* @param {Key} key
* @returns {string}
* @throws {Error} If the key is not a ECDSA (secp256k1) PrivateKey or PublicKey.
*/
private _deriveECDSAKeyAlias;
/**
* @override
* @protected
* @returns {HieroProto.proto.ICryptoCreateTransactionBody}
*/
protected override _makeTransactionData(): HieroProto.proto.ICryptoCreateTransactionBody;
}
export type BigNumber = import("bignumber.js").default;
export type Channel = import("../channel/Channel.js").default;
export type Client = import("../client/Client.js").default<any, any>;
export type Timestamp = import("../Timestamp.js").default;
export type TransactionId = import("../transaction/TransactionId.js").default;
import Transaction from "../transaction/Transaction.js";
import Key from "../Key.js";
import Hbar from "../Hbar.js";
import Long from "long";
import AccountId from "./AccountId.js";
import Duration from "../Duration.js";
import EvmAddress from "../EvmAddress.js";
import * as HieroProto from "@hashgraph/proto";