Skip to content

Commit

Permalink
chore(transactions): deprecate livehash, system delete and undelete
Browse files Browse the repository at this point in the history
In version 0.59.0 of the protobufs, the following APIs are deprecated:
 - LiveHash transactions and queries
 - SystemDelete and SystemUndelete transactions
 - proxyReceived in AccountInfo

Signed-off-by: venilinvasilev <[email protected]>
  • Loading branch information
venilinvasilev committed Feb 6, 2025
1 parent 0dba9d2 commit f32695b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/account/AccountInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ export default class AccountInfo {
this.proxyAccountId = props.proxyAccountId;

/**
* @deprecated
* The total number of tinybars proxy staked to this account.
*
* @readonly
*/
// eslint-disable-next-line deprecation/deprecation
this.proxyReceived = props.proxyReceived;

/**
Expand Down Expand Up @@ -351,6 +353,7 @@ export default class AccountInfo {
? // eslint-disable-next-line deprecation/deprecation
this.proxyAccountId._toProtobuf()
: null,
// eslint-disable-next-line deprecation/deprecation
proxyReceived: this.proxyReceived.toTinybars(),
key: this.key._toProtobufKey(),
balance: this.balance.toTinybars(),
Expand Down Expand Up @@ -427,6 +430,7 @@ export default class AccountInfo {
? // eslint-disable-next-line deprecation/deprecation
this.proxyAccountId.toString()
: null,
// eslint-disable-next-line deprecation/deprecation
proxyReceived: this.proxyReceived.toString(),
key: this.key != null ? this.key.toString() : null,
sendRecordThreshold: this.sendRecordThreshold.toString(),
Expand Down
7 changes: 6 additions & 1 deletion src/account/LiveHashAddTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import KeyList from "../KeyList.js";
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
*/

/**
* @deprecated
* This transaction is no longer supported.
*/
export default class LiveHashAddTransaction extends Transaction {
/**
* @param {object} [props]
Expand Down Expand Up @@ -121,6 +125,7 @@ export default class LiveHashAddTransaction extends Transaction {
);

return Transaction._fromProtobufTransactions(
// eslint-disable-next-line deprecation/deprecation
new LiveHashAddTransaction({
hash: liveHash_.hash != null ? liveHash_.hash : undefined,
keys:
Expand Down Expand Up @@ -297,6 +302,6 @@ export default class LiveHashAddTransaction extends Transaction {

TRANSACTION_REGISTRY.set(
"cryptoAddLiveHash",
// eslint-disable-next-line @typescript-eslint/unbound-method
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
LiveHashAddTransaction._fromProtobuf,
);
7 changes: 6 additions & 1 deletion src/account/LiveHashDeleteTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ import AccountId from "./AccountId.js";
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
*/

/**
* @deprecated
* This transaction is no longer supported.
*/
export default class LiveHashDeleteTransaction extends Transaction {
/**
* @param {object} [props]
Expand Down Expand Up @@ -92,6 +96,7 @@ export default class LiveHashDeleteTransaction extends Transaction {
);

return Transaction._fromProtobufTransactions(
// eslint-disable-next-line deprecation/deprecation
new LiveHashDeleteTransaction({
hash:
hashes.liveHashToDelete != null
Expand Down Expand Up @@ -204,6 +209,6 @@ export default class LiveHashDeleteTransaction extends Transaction {

TRANSACTION_REGISTRY.set(
"cryptoDeleteLiveHash",
// eslint-disable-next-line @typescript-eslint/unbound-method
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
LiveHashDeleteTransaction._fromProtobuf,
);
5 changes: 4 additions & 1 deletion src/account/LiveHashQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import LiveHash from "./LiveHash.js";

/**
* @augments {Query<LiveHash>}
* @deprecated
* Тhis query is no longer supported.
*/
export default class LiveHashQuery extends Query {
/**
Expand Down Expand Up @@ -82,6 +84,7 @@ export default class LiveHashQuery extends Query {
query.cryptoGetLiveHash
);

// eslint-disable-next-line deprecation/deprecation
return new LiveHashQuery({
accountId:
hash.accountID != null
Expand Down Expand Up @@ -221,5 +224,5 @@ export default class LiveHashQuery extends Query {
}

// @ts-ignore
// eslint-disable-next-line @typescript-eslint/unbound-method
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
QUERY_REGISTRY.set("cryptoGetLiveHash", LiveHashQuery._fromProtobuf);
7 changes: 6 additions & 1 deletion src/system/SystemDeleteTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import Timestamp from "../Timestamp.js";
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
*/

/**
* Deprecated: Do not use.
* @deprecated
*/
export default class SystemDeleteTransaction extends Transaction {
/**
* @param {object} [props]
Expand Down Expand Up @@ -107,6 +111,7 @@ export default class SystemDeleteTransaction extends Transaction {
);

return Transaction._fromProtobufTransactions(
// eslint-disable-next-line deprecation/deprecation
new SystemDeleteTransaction({
fileId:
systemDelete.fileID != null
Expand Down Expand Up @@ -248,5 +253,5 @@ export default class SystemDeleteTransaction extends Transaction {
}
}

// eslint-disable-next-line @typescript-eslint/unbound-method
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
TRANSACTION_REGISTRY.set("systemDelete", SystemDeleteTransaction._fromProtobuf);
7 changes: 6 additions & 1 deletion src/system/SystemUndeleteTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import ContractId from "../contract/ContractId.js";
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
*/

/**
* Deprecated: Do not use.
* @deprecated
*/
export default class SystemUndeleteTransaction extends Transaction {
/**
* @param {object} [props]
Expand Down Expand Up @@ -97,6 +101,7 @@ export default class SystemUndeleteTransaction extends Transaction {
);

return Transaction._fromProtobufTransactions(
// eslint-disable-next-line deprecation/deprecation
new SystemUndeleteTransaction({
fileId:
systemUndelete.fileID != null
Expand Down Expand Up @@ -215,6 +220,6 @@ export default class SystemUndeleteTransaction extends Transaction {

TRANSACTION_REGISTRY.set(
"systemUndelete",
// eslint-disable-next-line @typescript-eslint/unbound-method
// eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation
SystemUndeleteTransaction._fromProtobuf,
);

0 comments on commit f32695b

Please sign in to comment.