@hiero-ledger/sdk 2.70.0 → 2.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/umd.js +158 -40
- package/dist/umd.min.js +2 -2
- package/lib/LedgerId.cjs +4 -4
- package/lib/LedgerId.js +1 -1
- package/lib/LedgerId.js.map +1 -1
- package/lib/channel/NativeChannel.cjs +3 -2
- package/lib/channel/NativeChannel.js +1 -1
- package/lib/channel/NativeChannel.js.map +1 -1
- package/lib/channel/NodeMirrorChannel.cjs +0 -2
- package/lib/channel/NodeMirrorChannel.js +1 -1
- package/lib/channel/NodeMirrorChannel.js.map +1 -1
- package/lib/client/Client.cjs +3 -2
- package/lib/client/Client.d.ts +2 -2
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/NativeClient.cjs +141 -44
- package/lib/client/NativeClient.d.ts +48 -16
- package/lib/client/NativeClient.js +1 -1
- package/lib/client/NativeClient.js.map +1 -1
- package/lib/client/NodeClient.cjs +63 -2
- package/lib/client/NodeClient.d.ts +42 -0
- package/lib/client/NodeClient.js +1 -1
- package/lib/client/NodeClient.js.map +1 -1
- package/lib/client/WebClient.cjs +64 -34
- package/lib/client/WebClient.d.ts +35 -15
- package/lib/client/WebClient.js +1 -1
- package/lib/client/WebClient.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/constants/ClientConstants.cjs +22 -7
- package/lib/constants/ClientConstants.d.ts +12 -6
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.js.map +1 -1
- package/lib/contract/ContractCreateTransaction.cjs +5 -0
- package/lib/contract/ContractCreateTransaction.js +1 -1
- package/lib/contract/ContractCreateTransaction.js.map +1 -1
- package/lib/contract/ContractDeleteTransaction.cjs +35 -2
- package/lib/contract/ContractDeleteTransaction.d.ts +18 -0
- package/lib/contract/ContractDeleteTransaction.js +1 -1
- package/lib/contract/ContractDeleteTransaction.js.map +1 -1
- package/lib/contract/ContractInfo.cjs +11 -2
- package/lib/contract/ContractInfo.d.ts +6 -0
- package/lib/contract/ContractInfo.js +1 -1
- package/lib/contract/ContractInfo.js.map +1 -1
- package/lib/contract/ContractUpdateTransaction.cjs +2 -1
- package/lib/contract/ContractUpdateTransaction.js +1 -1
- package/lib/contract/ContractUpdateTransaction.js.map +1 -1
- package/lib/encoding/hex.cjs +11 -0
- package/lib/encoding/hex.js +1 -1
- package/lib/encoding/hex.js.map +1 -1
- package/lib/native.cjs +2 -2
- package/lib/native.d.ts +1 -1
- package/lib/native.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/LedgerId.js +4 -4
- package/src/channel/NativeChannel.js +9 -1
- package/src/channel/NodeMirrorChannel.js +0 -2
- package/src/client/Client.js +4 -2
- package/src/client/NativeClient.js +151 -47
- package/src/client/NodeClient.js +56 -3
- package/src/client/WebClient.js +63 -44
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/constants/ClientConstants.js +26 -8
- package/src/contract/ContractCreateTransaction.js +5 -3
- package/src/contract/ContractDeleteTransaction.js +34 -0
- package/src/contract/ContractInfo.js +16 -0
- package/src/contract/ContractUpdateTransaction.js +4 -1
- package/src/encoding/hex.js +20 -0
- package/src/native.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractCreateTransaction.js","sources":["../../src/contract/ContractCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport FileId from \"../file/FileId.js\";\nimport ContractFunctionParameters from \"./ContractFunctionParameters.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractCreateTransactionBody} HieroProto.proto.IContractCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HieroProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a new smart contract.\n *\n * If this transaction succeeds, the `ContractID` for the new smart contract\n * SHALL be set in the transaction receipt.<br/>\n * The contract is defined by the initial bytecode (or `initcode`). The\n * `initcode` SHALL be stored either in a previously created file, or in the\n * transaction body itself for very small contracts.\n *\n * As part of contract creation, the constructor defined for the new smart\n * contract SHALL run with the parameters provided in the\n * `constructorParameters` field.<br/>\n * The gas to \"power\" that constructor MUST be provided via the `gas` field,\n * and SHALL be charged to the payer for this transaction.<br/>\n * If the contract _constructor_ stores information, it is charged gas for that\n * storage. There is a separate fee in HBAR to maintain that storage until the\n * expiration, and that fee SHALL be added to this transaction as part of the\n * _transaction fee_, rather than gas.\n *\n */\n\nexport default class ContractCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.bytecodeFileId]\n * @param {Uint8Array} [props.bytecode]\n * @param {Key} [props.adminKey]\n * @param {number | Long} [props.gas]\n * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance]\n * @param {AccountId | string} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {Uint8Array} [props.constructorParameters]\n * @param {string} [props.contractMemo]\n * @param {number} [props.maxAutomaticTokenAssociations]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n * @param {AccountId} [props.autoRenewAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._bytecodeFileId = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._bytecode = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._gas = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._initialBalance = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._constructorParameters = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._contractMemo = null;\n\n /**\n * @private\n * @type {?number}\n */\n this._maxAutomaticTokenAssociations = null;\n\n this._defaultMaxTransactionFee = new Hbar(20);\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._declineStakingReward = false;\n\n /**\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n if (props.bytecodeFileId != null) {\n this.setBytecodeFileId(props.bytecodeFileId);\n }\n\n if (props.bytecode != null) {\n this.setBytecode(props.bytecode);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.gas != null) {\n this.setGas(props.gas);\n }\n\n if (props.initialBalance != null) {\n this.setInitialBalance(props.initialBalance);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.constructorParameters != null) {\n this.setConstructorParameters(props.constructorParameters);\n }\n\n if (props.contractMemo != null) {\n this.setContractMemo(props.contractMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations,\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ContractCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IContractCreateTransactionBody} */ (\n body.contractCreateInstance\n );\n\n return Transaction._fromProtobufTransactions(\n new ContractCreateTransaction({\n bytecodeFileId:\n create.fileID != null\n ? FileId._fromProtobuf(\n /** @type {HieroProto.proto.IFileID} */ (\n create.fileID\n ),\n )\n : undefined,\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n gas: create.gas != null ? create.gas : undefined,\n initialBalance:\n create.initialBalance != null\n ? Hbar.fromTinybars(create.initialBalance)\n : undefined,\n proxyAccountId:\n create.proxyAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n create.proxyAccountID\n ),\n )\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n constructorParameters:\n create.constructorParameters != null\n ? create.constructorParameters\n : undefined,\n contractMemo: create.memo != null ? create.memo : undefined,\n maxAutomaticTokenAssociations:\n create.maxAutomaticTokenAssociations != null\n ? create.maxAutomaticTokenAssociations\n : undefined,\n stakedAccountId:\n create.stakedAccountId != null\n ? AccountId._fromProtobuf(create.stakedAccountId)\n : undefined,\n stakedNodeId:\n create.stakedNodeId != null\n ? create.stakedNodeId\n : undefined,\n declineStakingReward: create.declineReward == true,\n autoRenewAccountId:\n create.autoRenewAccountId != null\n ? AccountId._fromProtobuf(create.autoRenewAccountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get bytecodeFileId() {\n return this._bytecodeFileId;\n }\n\n /**\n * @param {FileId | string} bytecodeFileId\n * @returns {this}\n */\n setBytecodeFileId(bytecodeFileId) {\n this._requireNotFrozen();\n this._bytecodeFileId =\n typeof bytecodeFileId === \"string\"\n ? FileId.fromString(bytecodeFileId)\n : bytecodeFileId.clone();\n this._bytecode = null;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get bytecode() {\n return this._bytecode;\n }\n\n /**\n * @param {Uint8Array} bytecode\n * @returns {this}\n */\n setBytecode(bytecode) {\n this._requireNotFrozen();\n this._bytecode = bytecode;\n this._bytecodeFileId = null;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._gas;\n }\n\n /**\n * @param {number | Long} gas\n * @returns {this}\n */\n setGas(gas) {\n this._requireNotFrozen();\n this._gas = gas instanceof Long ? gas : Long.fromValue(gas);\n\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get initialBalance() {\n return this._initialBalance;\n }\n\n /**\n * Set the initial amount to transfer into this contract.\n *\n * @param {number | string | Long | BigNumber | Hbar} initialBalance\n * @returns {this}\n */\n setInitialBalance(initialBalance) {\n this._requireNotFrozen();\n this._initialBalance =\n initialBalance instanceof Hbar\n ? initialBalance\n : new Hbar(initialBalance);\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId =\n proxyAccountId instanceof AccountId\n ? proxyAccountId\n : AccountId.fromString(proxyAccountId);\n\n return this;\n }\n\n /**\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * An account to charge for auto-renewal of this contract. If not set, or set to an\n * account with zero hbar balance, the contract's own hbar balance will be used to\n * cover auto-renewal fees.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof Duration\n ? autoRenewPeriod\n : new Duration(autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get constructorParameters() {\n return this._constructorParameters;\n }\n\n /**\n * @param {Uint8Array | ContractFunctionParameters} constructorParameters\n * @returns {this}\n */\n setConstructorParameters(constructorParameters) {\n this._requireNotFrozen();\n this._constructorParameters =\n constructorParameters instanceof ContractFunctionParameters\n ? constructorParameters._build()\n : constructorParameters;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get contractMemo() {\n return this._contractMemo;\n }\n\n /**\n * @param {string} contractMemo\n * @returns {this}\n */\n setContractMemo(contractMemo) {\n this._requireNotFrozen();\n this._contractMemo = contractMemo;\n\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? AccountId.fromString(stakedAccountId)\n : stakedAccountId;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = Long.fromValue(stakedNodeId);\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {string | AccountId} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n typeof autoRenewAccountId === \"string\"\n ? AccountId.fromString(autoRenewAccountId)\n : autoRenewAccountId;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._bytecodeFileId != null) {\n this._bytecodeFileId.validateChecksum(client);\n }\n\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.smartContract.createContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"contractCreateInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IContractCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID:\n this._bytecodeFileId != null\n ? this._bytecodeFileId._toProtobuf()\n : null,\n initcode: this._bytecode,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n gas: this._gas,\n initialBalance:\n this._initialBalance != null\n ? this._initialBalance.toTinybars()\n : null,\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n constructorParameters: this._constructorParameters,\n memo: this._contractMemo,\n maxAutomaticTokenAssociations: this._maxAutomaticTokenAssociations,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward: this.declineStakingRewards,\n autoRenewAccountId:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"contractCreateInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractCreateTransaction._fromProtobuf,\n);\n"],"names":["ContractCreateTransaction","Transaction","constructor","props","super","this","_bytecodeFileId","_bytecode","_adminKey","_gas","_initialBalance","_proxyAccountId","_autoRenewPeriod","Duration","DEFAULT_AUTO_RENEW_PERIOD","_constructorParameters","_contractMemo","_maxAutomaticTokenAssociations","_defaultMaxTransactionFee","Hbar","_stakedAccountId","_stakedNodeId","_declineStakingReward","_autoRenewAccountId","bytecodeFileId","setBytecodeFileId","bytecode","setBytecode","adminKey","setAdminKey","gas","setGas","initialBalance","setInitialBalance","proxyAccountId","setProxyAccountId","autoRenewPeriod","setAutoRenewPeriod","constructorParameters","setConstructorParameters","contractMemo","setContractMemo","maxAutomaticTokenAssociations","setMaxAutomaticTokenAssociations","stakedAccountId","setStakedAccountId","stakedNodeId","setStakedNodeId","declineStakingReward","setDeclineStakingReward","autoRenewAccountId","setAutoRenewAccountId","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","fileID","FileId","undefined","Key","_fromProtobufKey","fromTinybars","proxyAccountID","AccountId","seconds","memo","declineReward","_requireNotFrozen","fromString","clone","Long","fromValue","ContractFunctionParameters","_build","declineStakingRewards","_validateChecksums","client","validateChecksum","_execute","channel","request","smartContract","createContract","_getTransactionDataCase","_makeTransactionData","_toProtobuf","initcode","_toProtobufKey","toTinybars","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"mUAsDe,MAAMA,UAAkCC,EAkBnD,WAAAC,CAAYC,EAAQ,IAChBC,Q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gB8E,cACrB,KACVrD,gBAAiB/B,KAAKO,iBAAiB6E,cACvCnD,sBAAuBjC,KAAKU,uBAC5BsD,KAAMhE,KAAKW,cACX0B,8BAA+BrC,KAAKY,+BACpC2B,gBAC4B,MAAxBvC,KAAKuC,gBACCvC,KAAKuC,gBAAgB6C,cACrB,KACV3C,aAAczC,KAAKyC,aACnBwB,cAAejE,KAAKyE,sBACpB5B,mBACgC,MAA5B7C,KAAKkB,oBACClB,KAAKkB,oBAAoBkE,cACzB,KAEtB,CAKI,SAAAI,GAII,MAAO,6BAFHxF,KAAKyF,gBAAgBC,QACxB,WAC6CC,YACtD,EAGAC,EAAqBC,IACjB,yBAEAlG,EAA0BoD"}
|
|
1
|
+
{"version":3,"file":"ContractCreateTransaction.js","sources":["../../src/contract/ContractCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport FileId from \"../file/FileId.js\";\nimport ContractFunctionParameters from \"./ContractFunctionParameters.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractCreateTransactionBody} HieroProto.proto.IContractCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n * @typedef {import(\"@hashgraph/proto\").proto.IFileID} HieroProto.proto.IFileID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a new smart contract.\n *\n * If this transaction succeeds, the `ContractID` for the new smart contract\n * SHALL be set in the transaction receipt.<br/>\n * The contract is defined by the initial bytecode (or `initcode`). The\n * `initcode` SHALL be stored either in a previously created file, or in the\n * transaction body itself for very small contracts.\n *\n * As part of contract creation, the constructor defined for the new smart\n * contract SHALL run with the parameters provided in the\n * `constructorParameters` field.<br/>\n * The gas to \"power\" that constructor MUST be provided via the `gas` field,\n * and SHALL be charged to the payer for this transaction.<br/>\n * If the contract _constructor_ stores information, it is charged gas for that\n * storage. There is a separate fee in HBAR to maintain that storage until the\n * expiration, and that fee SHALL be added to this transaction as part of the\n * _transaction fee_, rather than gas.\n *\n */\n\nexport default class ContractCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {FileId | string} [props.bytecodeFileId]\n * @param {Uint8Array} [props.bytecode]\n * @param {Key} [props.adminKey]\n * @param {number | Long} [props.gas]\n * @param {number | string | Long | BigNumber | Hbar} [props.initialBalance]\n * @param {AccountId | string} [props.proxyAccountId]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {Uint8Array} [props.constructorParameters]\n * @param {string} [props.contractMemo]\n * @param {number} [props.maxAutomaticTokenAssociations]\n * @param {AccountId | string} [props.stakedAccountId]\n * @param {Long | number} [props.stakedNodeId]\n * @param {boolean} [props.declineStakingReward]\n * @param {AccountId} [props.autoRenewAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?FileId}\n */\n this._bytecodeFileId = null;\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._bytecode = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._gas = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._initialBalance = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._proxyAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._constructorParameters = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._contractMemo = null;\n\n /**\n * @private\n * @type {?number}\n */\n this._maxAutomaticTokenAssociations = null;\n\n this._defaultMaxTransactionFee = new Hbar(20);\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._stakedAccountId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._stakedNodeId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._declineStakingReward = false;\n\n /**\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n if (props.bytecodeFileId != null) {\n this.setBytecodeFileId(props.bytecodeFileId);\n }\n\n if (props.bytecode != null) {\n this.setBytecode(props.bytecode);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.gas != null) {\n this.setGas(props.gas);\n }\n\n if (props.initialBalance != null) {\n this.setInitialBalance(props.initialBalance);\n }\n\n if (props.proxyAccountId != null) {\n // eslint-disable-next-line deprecation/deprecation\n this.setProxyAccountId(props.proxyAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.constructorParameters != null) {\n this.setConstructorParameters(props.constructorParameters);\n }\n\n if (props.contractMemo != null) {\n this.setContractMemo(props.contractMemo);\n }\n\n if (props.maxAutomaticTokenAssociations != null) {\n this.setMaxAutomaticTokenAssociations(\n props.maxAutomaticTokenAssociations,\n );\n }\n\n if (props.stakedAccountId != null) {\n this.setStakedAccountId(props.stakedAccountId);\n }\n\n if (props.stakedNodeId != null) {\n this.setStakedNodeId(props.stakedNodeId);\n }\n\n if (props.declineStakingReward != null) {\n this.setDeclineStakingReward(props.declineStakingReward);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ContractCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IContractCreateTransactionBody} */ (\n body.contractCreateInstance\n );\n\n return Transaction._fromProtobufTransactions(\n new ContractCreateTransaction({\n bytecodeFileId:\n create.fileID != null\n ? FileId._fromProtobuf(\n /** @type {HieroProto.proto.IFileID} */ (\n create.fileID\n ),\n )\n : undefined,\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n gas: create.gas != null ? create.gas : undefined,\n initialBalance:\n create.initialBalance != null\n ? Hbar.fromTinybars(create.initialBalance)\n : undefined,\n proxyAccountId:\n create.proxyAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n create.proxyAccountID\n ),\n )\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n constructorParameters:\n create.constructorParameters != null\n ? create.constructorParameters\n : undefined,\n contractMemo: create.memo != null ? create.memo : undefined,\n maxAutomaticTokenAssociations:\n create.maxAutomaticTokenAssociations != null\n ? create.maxAutomaticTokenAssociations\n : undefined,\n stakedAccountId:\n create.stakedAccountId != null\n ? AccountId._fromProtobuf(create.stakedAccountId)\n : undefined,\n stakedNodeId:\n create.stakedNodeId != null\n ? create.stakedNodeId\n : undefined,\n declineStakingReward: create.declineReward == true,\n autoRenewAccountId:\n create.autoRenewAccountId != null\n ? AccountId._fromProtobuf(create.autoRenewAccountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?FileId}\n */\n get bytecodeFileId() {\n return this._bytecodeFileId;\n }\n\n /**\n * @param {FileId | string} bytecodeFileId\n * @returns {this}\n */\n setBytecodeFileId(bytecodeFileId) {\n this._requireNotFrozen();\n this._bytecodeFileId =\n typeof bytecodeFileId === \"string\"\n ? FileId.fromString(bytecodeFileId)\n : bytecodeFileId.clone();\n this._bytecode = null;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get bytecode() {\n return this._bytecode;\n }\n\n /**\n * @param {Uint8Array} bytecode\n * @returns {this}\n */\n setBytecode(bytecode) {\n this._requireNotFrozen();\n this._bytecode = bytecode;\n this._bytecodeFileId = null;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get gas() {\n return this._gas;\n }\n\n /**\n * @param {number | Long} gas\n * @returns {this}\n */\n setGas(gas) {\n this._requireNotFrozen();\n this._gas = gas instanceof Long ? gas : Long.fromValue(gas);\n if (this._gas.lessThan(0)) {\n throw new Error(\"Gas cannot be negative number\");\n }\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get initialBalance() {\n return this._initialBalance;\n }\n\n /**\n * Set the initial amount to transfer into this contract.\n *\n * @param {number | string | Long | BigNumber | Hbar} initialBalance\n * @returns {this}\n */\n setInitialBalance(initialBalance) {\n this._requireNotFrozen();\n this._initialBalance =\n initialBalance instanceof Hbar\n ? initialBalance\n : new Hbar(initialBalance);\n\n return this;\n }\n\n /**\n * @deprecated\n * @returns {?AccountId}\n */\n get proxyAccountId() {\n return this._proxyAccountId;\n }\n\n /**\n * @deprecated\n * @param {AccountId | string} proxyAccountId\n * @returns {this}\n */\n setProxyAccountId(proxyAccountId) {\n this._requireNotFrozen();\n this._proxyAccountId =\n proxyAccountId instanceof AccountId\n ? proxyAccountId\n : AccountId.fromString(proxyAccountId);\n\n return this;\n }\n\n /**\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * An account to charge for auto-renewal of this contract. If not set, or set to an\n * account with zero hbar balance, the contract's own hbar balance will be used to\n * cover auto-renewal fees.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof Duration\n ? autoRenewPeriod\n : new Duration(autoRenewPeriod);\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get constructorParameters() {\n return this._constructorParameters;\n }\n\n /**\n * @param {Uint8Array | ContractFunctionParameters} constructorParameters\n * @returns {this}\n */\n setConstructorParameters(constructorParameters) {\n this._requireNotFrozen();\n this._constructorParameters =\n constructorParameters instanceof ContractFunctionParameters\n ? constructorParameters._build()\n : constructorParameters;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get contractMemo() {\n return this._contractMemo;\n }\n\n /**\n * @param {string} contractMemo\n * @returns {this}\n */\n setContractMemo(contractMemo) {\n this._requireNotFrozen();\n this._contractMemo = contractMemo;\n\n return this;\n }\n\n /**\n * @returns {?number}\n */\n get maxAutomaticTokenAssociations() {\n return this._maxAutomaticTokenAssociations;\n }\n\n /**\n * @param {number} maxAutomaticTokenAssociations\n * @returns {this}\n */\n setMaxAutomaticTokenAssociations(maxAutomaticTokenAssociations) {\n this._maxAutomaticTokenAssociations = maxAutomaticTokenAssociations;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get stakedAccountId() {\n return this._stakedAccountId;\n }\n\n /**\n * @param {AccountId | string} stakedAccountId\n * @returns {this}\n */\n setStakedAccountId(stakedAccountId) {\n this._requireNotFrozen();\n this._stakedAccountId =\n typeof stakedAccountId === \"string\"\n ? AccountId.fromString(stakedAccountId)\n : stakedAccountId;\n this._stakedNodeId = null;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get stakedNodeId() {\n return this._stakedNodeId;\n }\n\n /**\n * @param {Long | number} stakedNodeId\n * @returns {this}\n */\n setStakedNodeId(stakedNodeId) {\n this._requireNotFrozen();\n this._stakedNodeId = Long.fromValue(stakedNodeId);\n this._stakedAccountId = null;\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get declineStakingRewards() {\n return this._declineStakingReward;\n }\n\n /**\n * @param {boolean} declineStakingReward\n * @returns {this}\n */\n setDeclineStakingReward(declineStakingReward) {\n this._requireNotFrozen();\n this._declineStakingReward = declineStakingReward;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {string | AccountId} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n typeof autoRenewAccountId === \"string\"\n ? AccountId.fromString(autoRenewAccountId)\n : autoRenewAccountId;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._bytecodeFileId != null) {\n this._bytecodeFileId.validateChecksum(client);\n }\n\n if (this._proxyAccountId != null) {\n this._proxyAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.smartContract.createContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"contractCreateInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IContractCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n fileID:\n this._bytecodeFileId != null\n ? this._bytecodeFileId._toProtobuf()\n : null,\n initcode: this._bytecode,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n gas: this._gas,\n initialBalance:\n this._initialBalance != null\n ? this._initialBalance.toTinybars()\n : null,\n proxyAccountID:\n this._proxyAccountId != null\n ? this._proxyAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n constructorParameters: this._constructorParameters,\n memo: this._contractMemo,\n maxAutomaticTokenAssociations: this._maxAutomaticTokenAssociations,\n stakedAccountId:\n this.stakedAccountId != null\n ? this.stakedAccountId._toProtobuf()\n : null,\n stakedNodeId: this.stakedNodeId,\n declineReward: this.declineStakingRewards,\n autoRenewAccountId:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"contractCreateInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractCreateTransaction._fromProtobuf,\n);\n"],"names":["ContractCreateTransaction","Transaction","constructor","props","super","this","_bytecodeFileId","_bytecode","_adminKey","_gas","_initialBalance","_proxyAccountId","_autoRenewPeriod","Duration","DEFAULT_AUTO_RENEW_PERIOD","_constructorParameters","_contractMemo","_maxAutomaticTokenAssociations","_defaultMaxTransactionFee","Hbar","_stakedAccountId","_stakedNodeId","_declineStakingReward","_autoRenewAccountId","bytecodeFileId","setBytecodeFileId","bytecode","setBytecode","adminKey","setAdminKey","gas","setGas","initialBalance","setInitialBalance","proxyAccountId","setProxyAccountId","autoRenewPeriod","setAutoRenewPeriod","constructorParameters","setConstructorParameters","contractMemo","setContractMemo","maxAutomaticTokenAssociations","setMaxAutomaticTokenAssociations","stakedAccountId","setStakedAccountId","stakedNodeId","setStakedNodeId","declineStakingReward","setDeclineStakingReward","autoRenewAccountId","setAutoRenewAccountId","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","fileID","FileId","undefined","Key","_fromProtobufKey","fromTinybars","proxyAccountID","AccountId","seconds","memo","declineReward","_requireNotFrozen","fromString","clone","Long","fromValue","lessThan","Error","ContractFunctionParameters","_build","declineStakingRewards","_validateChecksums","client","validateChecksum","_execute","channel","request","smartContract","createContract","_getTransactionDataCase","_makeTransactionData","_toProtobuf","initcode","_toProtobufKey","toTinybars","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"mUAsDe,MAAMA,UAAkCC,EAkBnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,gBAAkB,KAMvBD,KAAKE,UAAY,KAMjBF,KAAKG,UAAY,KAMjBH,KAAKI,KAAO,KAMZJ,KAAKK,gBAAkB,KAMvBL,KAAKM,gBAAkB,KAMvBN,KAAKO,iBAAmB,IAAIC,EAASC,GAMrCT,KAAKU,uBAAyB,KAM9BV,KAAKW,cAAgB,KAMrBX,KAAKY,+BAAiC,KAEtCZ,KAAKa,0BAA4B,IAAIC,EAAK,IAM1Cd,KAAKe,iBAAmB,KAMxBf,KAAKgB,cAAgB,KAMrBhB,KAAKiB,uBAAwB,EAK7BjB,KAAKkB,oBAAsB,KAEC,MAAxBpB,EAAMqB,gBACNnB,KAAKoB,kBAAkBtB,EAAMqB,gBAGX,MAAlBrB,EAAMuB,UACNrB,KAAKsB,YAAYxB,EAAMuB,UAGL,MAAlBvB,EAAMyB,UACNvB,KAAKwB,YAAY1B,EAAMyB,UAGV,MAAbzB,EAAM2B,KACNzB,KAAK0B,OAAO5B,EAAM2B,KAGM,MAAxB3B,EAAM6B,gBACN3B,KAAK4B,kBAAkB9B,EAAM6B,gBAGL,MAAxB7B,EAAM+B,gBAEN7B,KAAK8B,kBAAk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,oBAC6B,iBAAvB2B,EACDiB,EAAUK,WAAWtB,GACrBA,EAEH7C,IACf,CAKI,kBAAA4E,CAAmBC,GACa,MAAxB7E,KAAKC,iBACLD,KAAKC,gBAAgB6E,iBAAiBD,GAGd,MAAxB7E,KAAKM,iBACLN,KAAKM,gBAAgBwE,iBAAiBD,EAElD,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,cAAcC,eAAeF,EACpD,CAOI,uBAAAG,GACI,MAAO,wBACf,CAOI,oBAAAC,GACI,MAAO,CACH9B,OAC4B,MAAxBvD,KAAKC,gBACCD,KAAKC,gBAAgBqF,cACrB,KACVC,SAAUvF,KAAKE,UACfqB,SACsB,MAAlBvB,KAAKG,UAAoBH,KAAKG,UAAUqF,iBAAmB,KAC/D/D,IAAKzB,KAAKI,KACVuB,eAC4B,MAAxB3B,KAAKK,gBACCL,KAAKK,gBAAgBoF,aACrB,KACV5B,eAC4B,MAAxB7D,KAAKM,gBACCN,KAAKM,gBAAgBgF,cACrB,KACVvD,gBAAiB/B,KAAKO,iBAAiB+E,cACvCrD,sBAAuBjC,KAAKU,uBAC5BsD,KAAMhE,KAAKW,cACX0B,8BAA+BrC,KAAKY,+BACpC2B,gBAC4B,MAAxBvC,KAAKuC,gBACCvC,KAAKuC,gBAAgB+C,cACrB,KACV7C,aAAczC,KAAKyC,aACnBwB,cAAejE,KAAK2E,sBACpB9B,mBACgC,MAA5B7C,KAAKkB,oBACClB,KAAKkB,oBAAoBoE,cACzB,KAEtB,CAKI,SAAAI,GAII,MAAO,6BAFH1F,KAAK2F,gBAAgBC,QACxB,WAC6CC,YACtD,EAGAC,EAAqBC,IACjB,yBAEApG,EAA0BoD"}
|
|
@@ -60,6 +60,7 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
60
60
|
* @param {ContractId | string} [props.contractId]
|
|
61
61
|
* @param {ContractId | string} [props.transferContractId]
|
|
62
62
|
* @param {AccountId | string} [props.transferAccountId]
|
|
63
|
+
* @param {boolean} [props.permanentRemoval]
|
|
63
64
|
*/
|
|
64
65
|
constructor(props = {}) {
|
|
65
66
|
super();
|
|
@@ -81,6 +82,12 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
81
82
|
* @type {?ContractId}
|
|
82
83
|
*/
|
|
83
84
|
this._transferContractId = null;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @private
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
*/
|
|
90
|
+
this._permanentRemoval = false;
|
|
84
91
|
if (props.contractId != null) {
|
|
85
92
|
this.setContractId(props.contractId);
|
|
86
93
|
}
|
|
@@ -90,6 +97,9 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
90
97
|
if (props.transferContractId != null) {
|
|
91
98
|
this.setTransferContractId(props.transferContractId);
|
|
92
99
|
}
|
|
100
|
+
if (props.permanentRemoval != null) {
|
|
101
|
+
this.setPermanentRemoval(props.permanentRemoval);
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
/**
|
|
@@ -111,7 +121,8 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
111
121
|
transferAccountId: contractDelete.transferAccountID != null ? _AccountId.default._fromProtobuf(/** @type {HieroProto.proto.IAccountID} */
|
|
112
122
|
contractDelete.transferAccountID) : undefined,
|
|
113
123
|
transferContractId: contractDelete.transferContractID != null ? _ContractId.default._fromProtobuf(/** @type {HieroProto.proto.IContractID} */
|
|
114
|
-
contractDelete.transferContractID) : undefined
|
|
124
|
+
contractDelete.transferContractID) : undefined,
|
|
125
|
+
permanentRemoval: contractDelete.permanentRemoval ?? false
|
|
115
126
|
}), transactions, signedTransactions, transactionIds, nodeIds, bodies);
|
|
116
127
|
}
|
|
117
128
|
|
|
@@ -150,6 +161,7 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
150
161
|
setTransferContractId(transferContractId) {
|
|
151
162
|
this._requireNotFrozen();
|
|
152
163
|
this._transferContractId = transferContractId instanceof _ContractId.default ? transferContractId : _ContractId.default.fromString(transferContractId);
|
|
164
|
+
this._transferAccountId = null;
|
|
153
165
|
return this;
|
|
154
166
|
}
|
|
155
167
|
|
|
@@ -169,6 +181,26 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
169
181
|
setTransferAccountId(transferAccountId) {
|
|
170
182
|
this._requireNotFrozen();
|
|
171
183
|
this._transferAccountId = transferAccountId instanceof _AccountId.default ? transferAccountId : _AccountId.default.fromString(transferAccountId);
|
|
184
|
+
this._transferContractId = null;
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @returns {boolean}
|
|
190
|
+
*/
|
|
191
|
+
get permanentRemoval() {
|
|
192
|
+
return this._permanentRemoval;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Sets the permanent removal flag.
|
|
197
|
+
*
|
|
198
|
+
* @param {boolean} permanentRemoval
|
|
199
|
+
* @returns {ContractDeleteTransaction}
|
|
200
|
+
*/
|
|
201
|
+
setPermanentRemoval(permanentRemoval) {
|
|
202
|
+
this._requireNotFrozen();
|
|
203
|
+
this._permanentRemoval = permanentRemoval;
|
|
172
204
|
return this;
|
|
173
205
|
}
|
|
174
206
|
|
|
@@ -216,7 +248,8 @@ class ContractDeleteTransaction extends _Transaction.default {
|
|
|
216
248
|
return {
|
|
217
249
|
contractID: this._contractId != null ? this._contractId._toProtobuf() : null,
|
|
218
250
|
transferAccountID: this._transferAccountId ? this._transferAccountId._toProtobuf() : null,
|
|
219
|
-
transferContractID: this._transferContractId != null ? this._transferContractId._toProtobuf() : null
|
|
251
|
+
transferContractID: this._transferContractId != null ? this._transferContractId._toProtobuf() : null,
|
|
252
|
+
permanentRemoval: this._permanentRemoval
|
|
220
253
|
};
|
|
221
254
|
}
|
|
222
255
|
|
|
@@ -54,11 +54,13 @@ export default class ContractDeleteTransaction extends Transaction {
|
|
|
54
54
|
* @param {ContractId | string} [props.contractId]
|
|
55
55
|
* @param {ContractId | string} [props.transferContractId]
|
|
56
56
|
* @param {AccountId | string} [props.transferAccountId]
|
|
57
|
+
* @param {boolean} [props.permanentRemoval]
|
|
57
58
|
*/
|
|
58
59
|
constructor(props?: {
|
|
59
60
|
contractId?: string | ContractId | undefined;
|
|
60
61
|
transferContractId?: string | ContractId | undefined;
|
|
61
62
|
transferAccountId?: string | AccountId | undefined;
|
|
63
|
+
permanentRemoval?: boolean | undefined;
|
|
62
64
|
});
|
|
63
65
|
/**
|
|
64
66
|
* @private
|
|
@@ -75,6 +77,11 @@ export default class ContractDeleteTransaction extends Transaction {
|
|
|
75
77
|
* @type {?ContractId}
|
|
76
78
|
*/
|
|
77
79
|
private _transferContractId;
|
|
80
|
+
/**
|
|
81
|
+
* @private
|
|
82
|
+
* @type {boolean}
|
|
83
|
+
*/
|
|
84
|
+
private _permanentRemoval;
|
|
78
85
|
/**
|
|
79
86
|
* @returns {?ContractId}
|
|
80
87
|
*/
|
|
@@ -108,6 +115,17 @@ export default class ContractDeleteTransaction extends Transaction {
|
|
|
108
115
|
* @returns {ContractDeleteTransaction}
|
|
109
116
|
*/
|
|
110
117
|
setTransferAccountId(transferAccountId: AccountId | string): ContractDeleteTransaction;
|
|
118
|
+
/**
|
|
119
|
+
* @returns {boolean}
|
|
120
|
+
*/
|
|
121
|
+
get permanentRemoval(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Sets the permanent removal flag.
|
|
124
|
+
*
|
|
125
|
+
* @param {boolean} permanentRemoval
|
|
126
|
+
* @returns {ContractDeleteTransaction}
|
|
127
|
+
*/
|
|
128
|
+
setPermanentRemoval(permanentRemoval: boolean): ContractDeleteTransaction;
|
|
111
129
|
/**
|
|
112
130
|
* @override
|
|
113
131
|
* @protected
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t,{TRANSACTION_REGISTRY as r}from"../transaction/Transaction.js";import n from"./ContractId.js";import
|
|
1
|
+
import t,{TRANSACTION_REGISTRY as r}from"../transaction/Transaction.js";import n from"./ContractId.js";import e from"../account/AccountId.js";class a extends t{constructor(t={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=t.contractId&&this.setContractId(t.contractId),null!=t.transferAccountId&&this.setTransferAccountId(t.transferAccountId),null!=t.transferContractId&&this.setTransferContractId(t.transferContractId),null!=t.permanentRemoval&&this.setPermanentRemoval(t.permanentRemoval)}static _fromProtobuf(r,o,c,s,u){const i=u[0].contractDeleteInstance;return t._fromProtobufTransactions(new a({contractId:null!=i.contractID?n._fromProtobuf(i.contractID):void 0,transferAccountId:null!=i.transferAccountID?e._fromProtobuf(i.transferAccountID):void 0,transferContractId:null!=i.transferContractID?n._fromProtobuf(i.transferContractID):void 0,permanentRemoval:i.permanentRemoval??!1}),r,o,c,s,u)}get contractId(){return this._contractId}setContractId(t){return this._requireNotFrozen(),this._contractId="string"==typeof t?n.fromString(t):t.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(t){return this._requireNotFrozen(),this._transferContractId=t instanceof n?t:n.fromString(t),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(t){return this._requireNotFrozen(),this._transferAccountId=t instanceof e?t:e.fromString(t),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(t){return this._requireNotFrozen(),this._permanentRemoval=t,this}_validateChecksums(t){null!=this._contractId&&this._contractId.validateChecksum(t),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(t),null!=this._transferContractId&&this._transferContractId.validateChecksum(t)}_execute(t,r){return t.smartContract.deleteContract(r)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}r.set("contractDeleteInstance",a._fromProtobuf);export{a as default};
|
|
2
2
|
//# sourceMappingURL=ContractDeleteTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractDeleteTransaction.js","sources":["../../src/contract/ContractDeleteTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport ContractId from \"./ContractId.js\";\nimport AccountId from \"../account/AccountId.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractDeleteTransactionBody} HieroProto.proto.IContractDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HieroProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Delete a smart contract, and transfer any remaining HBAR balance to a\n * designated account.\n *\n * If this call succeeds then all subsequent calls to that smart contract\n * SHALL execute the `0x0` opcode, as required for EVM equivalence.\n *\n * ### Requirements\n * - An account or smart contract MUST be designated to receive all remaining\n * account balances.\n * - The smart contract MUST have an admin key set. If the contract does not\n * have `admin_key` set, then this transaction SHALL fail and response code\n * `MODIFYING_IMMUTABLE_CONTRACT` SHALL be set.\n * - If `admin_key` is, or contains, an empty `KeyList` key, it SHALL be\n * treated the same as an admin key that is not set.\n * - The `Key` set for `admin_key` on the smart contract MUST have a valid\n * signature set on this transaction.\n * - The designated receiving account MAY have `receiver_sig_required` set. If\n * that field is set, the receiver account MUST also sign this transaction.\n * - The field `permanent_removal` MUST NOT be set. That field is reserved for\n * internal system use when purging the smart contract from state. Any user\n * transaction with that field set SHALL be rejected and a response code\n * `PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION` SHALL be set.\n */\nexport default class ContractDeleteTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n * @param {ContractId | string} [props.transferContractId]\n * @param {AccountId | string} [props.transferAccountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._transferAccountId = null;\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._transferContractId = null;\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.transferAccountId != null) {\n this.setTransferAccountId(props.transferAccountId);\n }\n\n if (props.transferContractId != null) {\n this.setTransferContractId(props.transferContractId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ContractDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const contractDelete =\n /** @type {HieroProto.proto.IContractDeleteTransactionBody} */ (\n body.contractDeleteInstance\n );\n\n return Transaction._fromProtobufTransactions(\n new ContractDeleteTransaction({\n contractId:\n contractDelete.contractID != null\n ? ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (\n contractDelete.contractID\n ),\n )\n : undefined,\n transferAccountId:\n contractDelete.transferAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n contractDelete.transferAccountID\n ),\n )\n : undefined,\n transferContractId:\n contractDelete.transferContractID != null\n ? ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (\n contractDelete.transferContractID\n ),\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Sets the contract ID which is being deleted in this transaction.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractDeleteTransaction}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n typeof contractId === \"string\"\n ? ContractId.fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get transferContractId() {\n return this._transferContractId;\n }\n\n /**\n * Sets the contract ID which will receive all remaining hbars.\n *\n * @param {ContractId | string} transferContractId\n * @returns {ContractDeleteTransaction}\n */\n setTransferContractId(transferContractId) {\n this._requireNotFrozen();\n this._transferContractId =\n transferContractId instanceof ContractId\n ? transferContractId\n : ContractId.fromString(transferContractId);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get transferAccountId() {\n return this._transferAccountId;\n }\n\n /**\n * Sets the account ID which will receive all remaining hbars.\n *\n * @param {AccountId | string} transferAccountId\n * @returns {ContractDeleteTransaction}\n */\n setTransferAccountId(transferAccountId) {\n this._requireNotFrozen();\n this._transferAccountId =\n transferAccountId instanceof AccountId\n ? transferAccountId\n : AccountId.fromString(transferAccountId);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n\n if (this._transferAccountId != null) {\n this._transferAccountId.validateChecksum(client);\n }\n\n if (this._transferContractId != null) {\n this._transferContractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.smartContract.deleteContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"contractDeleteInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IContractDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n transferAccountID: this._transferAccountId\n ? this._transferAccountId._toProtobuf()\n : null,\n transferContractID:\n this._transferContractId != null\n ? this._transferContractId._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"contractDeleteInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractDeleteTransaction._fromProtobuf,\n);\n"],"names":["ContractDeleteTransaction","Transaction","constructor","props","super","this","_contractId","_transferAccountId","_transferContractId","contractId","setContractId","transferAccountId","setTransferAccountId","transferContractId","setTransferContractId","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","contractDelete","_fromProtobufTransactions","contractID","ContractId","undefined","transferAccountID","AccountId","transferContractID","_requireNotFrozen","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","smartContract","deleteContract","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"8IAkDe,MAAMA,UAAkCC,EAOnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,YAAc,KAMnBD,KAAKE,mBAAqB,KAM1BF,KAAKG,oBAAsB,KAEH,MAApBL,EAAMM,YACNJ,KAAKK,cAAcP,EAAMM,YAGE,MAA3BN,EAAMQ,mBACNN,KAA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C,GACI,MAAO,CACHlB,WACwB,MAApBlB,KAAKC,YACCD,KAAKC,YAAYoC,cACjB,KACVhB,kBAAmBrB,KAAKE,mBAClBF,KAAKE,mBAAmBmC,cACxB,KACNd,mBACgC,MAA5BvB,KAAKG,oBACCH,KAAKG,oBAAoBkC,cACzB,KAEtB,CAKI,SAAAC,GAII,MAAO,6BAFHtC,KAAKuC,gBAAgBC,QACxB,WAC6CC,YACtD,EAGAC,EAAqBC,IACjB,yBAEAhD,EAA0Be"}
|
|
1
|
+
{"version":3,"file":"ContractDeleteTransaction.js","sources":["../../src/contract/ContractDeleteTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport ContractId from \"./ContractId.js\";\nimport AccountId from \"../account/AccountId.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IContractDeleteTransactionBody} HieroProto.proto.IContractDeleteTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HieroProto.proto.IContractID\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Delete a smart contract, and transfer any remaining HBAR balance to a\n * designated account.\n *\n * If this call succeeds then all subsequent calls to that smart contract\n * SHALL execute the `0x0` opcode, as required for EVM equivalence.\n *\n * ### Requirements\n * - An account or smart contract MUST be designated to receive all remaining\n * account balances.\n * - The smart contract MUST have an admin key set. If the contract does not\n * have `admin_key` set, then this transaction SHALL fail and response code\n * `MODIFYING_IMMUTABLE_CONTRACT` SHALL be set.\n * - If `admin_key` is, or contains, an empty `KeyList` key, it SHALL be\n * treated the same as an admin key that is not set.\n * - The `Key` set for `admin_key` on the smart contract MUST have a valid\n * signature set on this transaction.\n * - The designated receiving account MAY have `receiver_sig_required` set. If\n * that field is set, the receiver account MUST also sign this transaction.\n * - The field `permanent_removal` MUST NOT be set. That field is reserved for\n * internal system use when purging the smart contract from state. Any user\n * transaction with that field set SHALL be rejected and a response code\n * `PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION` SHALL be set.\n */\nexport default class ContractDeleteTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {ContractId | string} [props.contractId]\n * @param {ContractId | string} [props.transferContractId]\n * @param {AccountId | string} [props.transferAccountId]\n * @param {boolean} [props.permanentRemoval]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._contractId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._transferAccountId = null;\n\n /**\n * @private\n * @type {?ContractId}\n */\n this._transferContractId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this._permanentRemoval = false;\n\n if (props.contractId != null) {\n this.setContractId(props.contractId);\n }\n\n if (props.transferAccountId != null) {\n this.setTransferAccountId(props.transferAccountId);\n }\n\n if (props.transferContractId != null) {\n this.setTransferContractId(props.transferContractId);\n }\n\n if (props.permanentRemoval != null) {\n this.setPermanentRemoval(props.permanentRemoval);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ContractDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const contractDelete =\n /** @type {HieroProto.proto.IContractDeleteTransactionBody} */ (\n body.contractDeleteInstance\n );\n\n return Transaction._fromProtobufTransactions(\n new ContractDeleteTransaction({\n contractId:\n contractDelete.contractID != null\n ? ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (\n contractDelete.contractID\n ),\n )\n : undefined,\n transferAccountId:\n contractDelete.transferAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n contractDelete.transferAccountID\n ),\n )\n : undefined,\n transferContractId:\n contractDelete.transferContractID != null\n ? ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (\n contractDelete.transferContractID\n ),\n )\n : undefined,\n permanentRemoval: contractDelete.permanentRemoval ?? false,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?ContractId}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * Sets the contract ID which is being deleted in this transaction.\n *\n * @param {ContractId | string} contractId\n * @returns {ContractDeleteTransaction}\n */\n setContractId(contractId) {\n this._requireNotFrozen();\n this._contractId =\n typeof contractId === \"string\"\n ? ContractId.fromString(contractId)\n : contractId.clone();\n\n return this;\n }\n\n /**\n * @returns {?ContractId}\n */\n get transferContractId() {\n return this._transferContractId;\n }\n\n /**\n * Sets the contract ID which will receive all remaining hbars.\n *\n * @param {ContractId | string} transferContractId\n * @returns {ContractDeleteTransaction}\n */\n setTransferContractId(transferContractId) {\n this._requireNotFrozen();\n this._transferContractId =\n transferContractId instanceof ContractId\n ? transferContractId\n : ContractId.fromString(transferContractId);\n this._transferAccountId = null;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get transferAccountId() {\n return this._transferAccountId;\n }\n\n /**\n * Sets the account ID which will receive all remaining hbars.\n *\n * @param {AccountId | string} transferAccountId\n * @returns {ContractDeleteTransaction}\n */\n setTransferAccountId(transferAccountId) {\n this._requireNotFrozen();\n this._transferAccountId =\n transferAccountId instanceof AccountId\n ? transferAccountId\n : AccountId.fromString(transferAccountId);\n this._transferContractId = null;\n\n return this;\n }\n\n /**\n * @returns {boolean}\n */\n get permanentRemoval() {\n return this._permanentRemoval;\n }\n\n /**\n * Sets the permanent removal flag.\n *\n * @param {boolean} permanentRemoval\n * @returns {ContractDeleteTransaction}\n */\n setPermanentRemoval(permanentRemoval) {\n this._requireNotFrozen();\n this._permanentRemoval = permanentRemoval;\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._contractId != null) {\n this._contractId.validateChecksum(client);\n }\n\n if (this._transferAccountId != null) {\n this._transferAccountId.validateChecksum(client);\n }\n\n if (this._transferContractId != null) {\n this._transferContractId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.smartContract.deleteContract(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"contractDeleteInstance\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IContractDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n contractID:\n this._contractId != null\n ? this._contractId._toProtobuf()\n : null,\n transferAccountID: this._transferAccountId\n ? this._transferAccountId._toProtobuf()\n : null,\n transferContractID:\n this._transferContractId != null\n ? this._transferContractId._toProtobuf()\n : null,\n permanentRemoval: this._permanentRemoval,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ContractDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"contractDeleteInstance\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ContractDeleteTransaction._fromProtobuf,\n);\n"],"names":["ContractDeleteTransaction","Transaction","constructor","props","super","this","_contractId","_transferAccountId","_transferContractId","_permanentRemoval","contractId","setContractId","transferAccountId","setTransferAccountId","transferContractId","setTransferContractId","permanentRemoval","setPermanentRemoval","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","contractDelete","_fromProtobufTransactions","contractID","ContractId","undefined","transferAccountID","AccountId","transferContractID","_requireNotFrozen","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","smartContract","deleteContract","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"8IAkDe,MAAMA,UAAkCC,EAQnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,YAAc,KAMnBD,KAAKE,mBAAqB,KAM1BF,KAAKG,oBAAsB,KAM3BH,KAAKI,mBAAoB,EAED,MAApBN,EAAMO,YACNL,KAAKM,cAAcR,EAAMO,YAGE,MAA3BP,EAAMS,mBACNP,KAAKQ,qBAAqBV,EAAMS,mBAGJ,MAA5BT,EAAMW,oBACNT,KAAKU,sBAAsBZ,EAAMW,oBAGP,MAA1BX,EAAMa,kBACNX,KAAKY,oBAAoBd,EAAMa,iBAE3C,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,uBAEL,OAAOtB,EAAYwB,0BACf,IAAIzB,EAA0B,CAC1BU,WACiC,MAA7Bc,EAAeE,WACTC,EAAWT,cAEHM,EAClC,iBAE0BI,EACVhB,kBACwC,MAApCY,EAAeK,kBACTC,EAAUZ,cAEFM,EAClC,wBAE0BI,EACVd,mBACyC,MAArCU,EAAeO,mBACTJ,EAAWT,cAEHM,EAClC,yBAE0BI,EACVZ,iBAAkBQ,EAAeR,mBAAoB,IAEzDG,EACAC,EACAC,EACAC,EACA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AK0C,gBAAgBC,QACxB,WAC6CC,YACtD,EAGAC,EAAqBC,IACjB,yBAEAnD,EAA0BkB"}
|
|
@@ -49,6 +49,7 @@ class ContractInfo {
|
|
|
49
49
|
* @param {TokenRelationshipMap} props.tokenRelationships
|
|
50
50
|
* @param {LedgerId|null} props.ledgerId
|
|
51
51
|
* @param {?StakingInfo} props.stakingInfo
|
|
52
|
+
* @param {Long} props.maxAutomaticTokenAssociations
|
|
52
53
|
*/
|
|
53
54
|
constructor(props) {
|
|
54
55
|
/**
|
|
@@ -147,6 +148,12 @@ class ContractInfo {
|
|
|
147
148
|
*/
|
|
148
149
|
this.tokenRelationships = props.tokenRelationships;
|
|
149
150
|
|
|
151
|
+
/**
|
|
152
|
+
* The maximum number of automatic token associations allowed for this contract.
|
|
153
|
+
* @readonly
|
|
154
|
+
*/
|
|
155
|
+
this.maxAutomaticTokenAssociations = props.maxAutomaticTokenAssociations;
|
|
156
|
+
|
|
150
157
|
/**
|
|
151
158
|
* The ledger ID the response was returned from; please see <a href="https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md">HIP-198</a> for the network-specific IDs.
|
|
152
159
|
*/
|
|
@@ -182,7 +189,8 @@ class ContractInfo {
|
|
|
182
189
|
isDeleted: (/** @type {boolean} */info.deleted),
|
|
183
190
|
tokenRelationships: _TokenRelationshipMap.default._fromProtobuf(info.tokenRelationships != null ? info.tokenRelationships : []),
|
|
184
191
|
ledgerId: info.ledgerId != null ? _LedgerId.default.fromBytes(info.ledgerId) : null,
|
|
185
|
-
stakingInfo: info.stakingInfo != null ? _StakingInfo.default._fromProtobuf(info.stakingInfo) : null
|
|
192
|
+
stakingInfo: info.stakingInfo != null ? _StakingInfo.default._fromProtobuf(info.stakingInfo) : null,
|
|
193
|
+
maxAutomaticTokenAssociations: info.maxAutomaticTokenAssociations != null ? _long.default.isLong(info.maxAutomaticTokenAssociations) ? info.maxAutomaticTokenAssociations : _long.default.fromValue(info.maxAutomaticTokenAssociations) : _long.default.ZERO
|
|
186
194
|
});
|
|
187
195
|
}
|
|
188
196
|
|
|
@@ -205,7 +213,8 @@ class ContractInfo {
|
|
|
205
213
|
deleted: this.isDeleted,
|
|
206
214
|
tokenRelationships: this.tokenRelationships != null ? this.tokenRelationships._toProtobuf() : null,
|
|
207
215
|
ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,
|
|
208
|
-
stakingInfo: this.stakingInfo != null ? this.stakingInfo._toProtobuf() : null
|
|
216
|
+
stakingInfo: this.stakingInfo != null ? this.stakingInfo._toProtobuf() : null,
|
|
217
|
+
maxAutomaticTokenAssociations: this.maxAutomaticTokenAssociations.toNumber()
|
|
209
218
|
};
|
|
210
219
|
}
|
|
211
220
|
|
|
@@ -33,6 +33,7 @@ export default class ContractInfo {
|
|
|
33
33
|
* @param {TokenRelationshipMap} props.tokenRelationships
|
|
34
34
|
* @param {LedgerId|null} props.ledgerId
|
|
35
35
|
* @param {?StakingInfo} props.stakingInfo
|
|
36
|
+
* @param {Long} props.maxAutomaticTokenAssociations
|
|
36
37
|
*/
|
|
37
38
|
private constructor();
|
|
38
39
|
/**
|
|
@@ -119,6 +120,11 @@ export default class ContractInfo {
|
|
|
119
120
|
* @readonly
|
|
120
121
|
*/
|
|
121
122
|
readonly tokenRelationships: TokenRelationshipMap;
|
|
123
|
+
/**
|
|
124
|
+
* The maximum number of automatic token associations allowed for this contract.
|
|
125
|
+
* @readonly
|
|
126
|
+
*/
|
|
127
|
+
readonly maxAutomaticTokenAssociations: Long;
|
|
122
128
|
/**
|
|
123
129
|
* The ledger ID the response was returned from; please see <a href="https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md">HIP-198</a> for the network-specific IDs.
|
|
124
130
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./ContractId.js";import o from"../account/AccountId.js";import n from"../StakingInfo.js";import e from"../Timestamp.js";import
|
|
1
|
+
import t from"./ContractId.js";import o from"../account/AccountId.js";import n from"../StakingInfo.js";import e from"../Timestamp.js";import i from"../Duration.js";import a from"../Hbar.js";import s from"long";import*as r from"@hashgraph/proto";import c from"../account/TokenRelationshipMap.js";import u from"../Key.js";import l from"../LedgerId.js";const{proto:m}=r;class d{constructor(t){this.contractId=t.contractId,this.accountId=t.accountId,this.contractAccountId=t.contractAccountId,this.adminKey=null!=t.adminKey?t.adminKey:null,this.expirationTime=t.expirationTime,this.autoRenewPeriod=t.autoRenewPeriod,this.autoRenewAccountId=t.autoRenewAccountId,this.storage=t.storage,this.contractMemo=t.contractMemo,this.balance=t.balance,this.isDeleted=t.isDeleted,this.tokenRelationships=t.tokenRelationships,this.maxAutomaticTokenAssociations=t.maxAutomaticTokenAssociations,this.ledgerId=t.ledgerId,this.stakingInfo=t.stakingInfo,Object.freeze(this)}static _fromProtobuf(r){const m=r.autoRenewPeriod.seconds;return new d({contractId:t._fromProtobuf(r.contractID),accountId:o._fromProtobuf(r.accountID),contractAccountId:null!=r.contractAccountID?r.contractAccountID:"",adminKey:null!=r.adminKey?u._fromProtobufKey(r.adminKey):null,expirationTime:e._fromProtobuf(r.expirationTime),autoRenewPeriod:new i(m),autoRenewAccountId:null!=r.autoRenewAccountId?o._fromProtobuf(r.autoRenewAccountId):null,storage:null!=r.storage?r.storage instanceof s?r.storage:s.fromValue(r.storage):s.ZERO,contractMemo:null!=r.memo?r.memo:"",balance:a.fromTinybars(null!=r.balance?r.balance:0),isDeleted:r.deleted,tokenRelationships:c._fromProtobuf(null!=r.tokenRelationships?r.tokenRelationships:[]),ledgerId:null!=r.ledgerId?l.fromBytes(r.ledgerId):null,stakingInfo:null!=r.stakingInfo?n._fromProtobuf(r.stakingInfo):null,maxAutomaticTokenAssociations:null!=r.maxAutomaticTokenAssociations?s.isLong(r.maxAutomaticTokenAssociations)?r.maxAutomaticTokenAssociations:s.fromValue(r.maxAutomaticTokenAssociations):s.ZERO})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccountId:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,storage:this.storage,memo:this.contractMemo,balance:this.balance.toTinybars(),deleted:this.isDeleted,tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toNumber()}}static fromBytes(t){return d._fromProtobuf(m.ContractGetInfoResponse.ContractInfo.decode(t))}toBytes(){return m.ContractGetInfoResponse.ContractInfo.encode(this._toProtobuf()).finish()}}export{d as default};
|
|
2
2
|
//# sourceMappingURL=ContractInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractInfo.js","sources":["../../src/contract/ContractInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ContractId from \"./ContractId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport StakingInfo from \"../StakingInfo.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Duration from \"../Duration.js\";\nimport Hbar from \"../Hbar.js\";\nimport Long from \"long\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TokenRelationshipMap from \"../account/TokenRelationshipMap.js\";\nimport Key from \"../Key.js\";\nimport LedgerId from \"../LedgerId.js\";\n\nconst { proto } = HieroProto;\n\n/**\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * Response when the client sends the node CryptoGetInfoQuery.\n */\nexport default class ContractInfo {\n /**\n * @private\n * @param {object} props\n * @param {ContractId} props.contractId\n * @param {AccountId} props.accountId\n * @param {string} props.contractAccountId\n * @param {?Key} props.adminKey\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {Long} props.storage\n * @param {string} props.contractMemo\n * @param {Hbar} props.balance\n * @param {boolean} props.isDeleted\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {LedgerId|null} props.ledgerId\n * @param {?StakingInfo} props.stakingInfo\n */\n constructor(props) {\n /**\n * ID of the contract instance, in the format used in transactions.\n *\n * @readonly\n */\n this.contractId = props.contractId;\n\n /**\n * ID of the cryptocurrency account owned by the contract instance,\n * in the format used in transactions.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * ID of both the contract instance and the cryptocurrency account owned by the contract\n * instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * The state of the instance and its fields can be modified arbitrarily if this key signs a\n * transaction to modify it. If this is null, then such modifications are not possible,\n * and there is no administrator that can override the normal operation of this smart\n * contract instance. Note that if it is created with no admin keys, then there is no\n * administrator to authorize changing the admin keys, so there can never be any admin keys\n * for that instance.\n *\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * The current time at which this contract instance (and its account) is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The expiration time will extend every this many seconds. If there are insufficient funds,\n * then it extends as long as possible. If the account is empty when it expires,\n * then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * ID of the an account to charge for auto-renewal of this contract. If not set, or set\n * to an account with zero hbar balance, the contract's own hbar balance will be used\n * to cover auto-renewal fees.\n *\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * Number of bytes of storage being used by this instance (which affects the cost to\n * extend the expiration time).\n *\n * @readonly\n */\n this.storage = props.storage;\n\n /**\n * The memo associated with the contract (max 100 bytes).\n *\n * @readonly\n */\n this.contractMemo = props.contractMemo;\n\n /**\n * The current balance of the contract.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * Whether the contract has been deleted\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * The tokens associated to the contract\n *\n * @readonly\n */\n this.tokenRelationships = props.tokenRelationships;\n\n /**\n * The ledger ID the response was returned from; please see <a href=\"https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md\">HIP-198</a> for the network-specific IDs.\n */\n this.ledgerId = props.ledgerId;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ContractGetInfoResponse.IContractInfo} info\n * @returns {ContractInfo}\n */\n static _fromProtobuf(info) {\n const autoRenewPeriod = /** @type {Long | number} */ (\n /** @type {HieroProto.proto.IDuration} */ (info.autoRenewPeriod)\n .seconds\n );\n\n return new ContractInfo({\n contractId: ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (info.contractID),\n ),\n accountId: AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (info.accountID),\n ),\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : \"\",\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n expirationTime: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n ),\n autoRenewPeriod: new Duration(autoRenewPeriod),\n autoRenewAccountId:\n info.autoRenewAccountId != null\n ? AccountId._fromProtobuf(info.autoRenewAccountId)\n : null,\n storage:\n info.storage != null\n ? info.storage instanceof Long\n ? info.storage\n : Long.fromValue(info.storage)\n : Long.ZERO,\n contractMemo: info.memo != null ? info.memo : \"\",\n balance: Hbar.fromTinybars(info.balance != null ? info.balance : 0),\n isDeleted: /** @type {boolean} */ (info.deleted),\n tokenRelationships: TokenRelationshipMap._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : [],\n ),\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n stakingInfo:\n info.stakingInfo != null\n ? StakingInfo._fromProtobuf(info.stakingInfo)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.ContractGetInfoResponse.IContractInfo}\n */\n _toProtobuf() {\n return {\n contractID: this.contractId._toProtobuf(),\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccountId:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n storage: this.storage,\n memo: this.contractMemo,\n balance: this.balance.toTinybars(),\n deleted: this.isDeleted,\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ContractInfo}\n */\n static fromBytes(bytes) {\n return ContractInfo._fromProtobuf(\n proto.ContractGetInfoResponse.ContractInfo.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return proto.ContractGetInfoResponse.ContractInfo.encode(\n this._toProtobuf(),\n ).finish();\n }\n}\n"],"names":["proto","HieroProto","ContractInfo","constructor","props","this","contractId","accountId","contractAccountId","adminKey","expirationTime","autoRenewPeriod","autoRenewAccountId","storage","contractMemo","balance","isDeleted","tokenRelationships","ledgerId","stakingInfo","Object","freeze","_fromProtobuf","info","ContractId","AccountId","contractAccountID","Key","_fromProtobufKey","Timestamp","Duration","Long","fromValue","ZERO","memo","Hbar","fromTinybars","TokenRelationshipMap","LedgerId","fromBytes","StakingInfo","_toProtobuf","contractID","accountID","_toProtobufKey","toTinybars","deleted","toBytes","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AAKR,QAAkBQ,EAAKR,QAAU,GACjEC,UAAmCO,EAAY,QAC/CN,mBAAoBoB,EAAqBf,cACV,MAA3BC,EAAKN,mBAA6BM,EAAKN,mBAAqB,IAEhEC,SACqB,MAAjBK,EAAKL,SACCoB,EAASC,UAAUhB,EAAKL,UACxB,KACVC,YACwB,MAApBI,EAAKJ,YACCqB,EAAYlB,cAAcC,EAAKJ,aAC/B,MAEtB,CAMI,WAAAsB,GACI,MAAO,CACHC,WAAYrC,KAAKC,WAAWmC,cAC5BE,UAAWtC,KAAKE,UAAUkC,cAC1Bf,kBAAmBrB,KAAKG,kBACxBC,SACqB,MAAjBJ,KAAKI,SAAmBJ,KAAKI,SAASmC,iBAAmB,KAC7DlC,eAAgBL,KAAKK,eAAe+B,cACpC9B,gBAC4B,MAAxBN,KAAKM,gBACCN,KAAKM,gBAAgB8B,cACrB,KACV7B,mBAC+B,MAA3BP,KAAKO,mBACCP,KAAKO,mBAAmB6B,cACxB,KACV5B,QAASR,KAAKQ,QACdqB,KAAM7B,KAAKS,aACXC,QAASV,KAAKU,QAAQ8B,aACtBC,QAASzC,KAAKW,UACdC,mBAC+B,MAA3BZ,KAAKY,mBACCZ,KAAKY,mBAAmBwB,cACxB,KACVvB,SAA2B,MAAjBb,KAAKa,SAAmBb,KAAKa,SAAS6B,UAAY,KAC5D5B,YACwB,MAApBd,KAAKc,YACCd,KAAKc,YAAYsB,cACjB,KAEtB,CAMI,gBAAOF,CAAUS,GACb,OAAO9C,EAAaoB,cAChBtB,EAAMiD,wBAAwB/C,aAAagD,OAAOF,GAE9D,CAKI,OAAAD,GACI,OAAO/C,EAAMiD,wBAAwB/C,aAAaiD,OAC9C9C,KAAKoC,eACPW,QACV"}
|
|
1
|
+
{"version":3,"file":"ContractInfo.js","sources":["../../src/contract/ContractInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ContractId from \"./ContractId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport StakingInfo from \"../StakingInfo.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Duration from \"../Duration.js\";\nimport Hbar from \"../Hbar.js\";\nimport Long from \"long\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TokenRelationshipMap from \"../account/TokenRelationshipMap.js\";\nimport Key from \"../Key.js\";\nimport LedgerId from \"../LedgerId.js\";\n\nconst { proto } = HieroProto;\n\n/**\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * Response when the client sends the node CryptoGetInfoQuery.\n */\nexport default class ContractInfo {\n /**\n * @private\n * @param {object} props\n * @param {ContractId} props.contractId\n * @param {AccountId} props.accountId\n * @param {string} props.contractAccountId\n * @param {?Key} props.adminKey\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {Long} props.storage\n * @param {string} props.contractMemo\n * @param {Hbar} props.balance\n * @param {boolean} props.isDeleted\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {LedgerId|null} props.ledgerId\n * @param {?StakingInfo} props.stakingInfo\n * @param {Long} props.maxAutomaticTokenAssociations\n */\n constructor(props) {\n /**\n * ID of the contract instance, in the format used in transactions.\n *\n * @readonly\n */\n this.contractId = props.contractId;\n\n /**\n * ID of the cryptocurrency account owned by the contract instance,\n * in the format used in transactions.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * ID of both the contract instance and the cryptocurrency account owned by the contract\n * instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * The state of the instance and its fields can be modified arbitrarily if this key signs a\n * transaction to modify it. If this is null, then such modifications are not possible,\n * and there is no administrator that can override the normal operation of this smart\n * contract instance. Note that if it is created with no admin keys, then there is no\n * administrator to authorize changing the admin keys, so there can never be any admin keys\n * for that instance.\n *\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * The current time at which this contract instance (and its account) is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The expiration time will extend every this many seconds. If there are insufficient funds,\n * then it extends as long as possible. If the account is empty when it expires,\n * then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * ID of the an account to charge for auto-renewal of this contract. If not set, or set\n * to an account with zero hbar balance, the contract's own hbar balance will be used\n * to cover auto-renewal fees.\n *\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * Number of bytes of storage being used by this instance (which affects the cost to\n * extend the expiration time).\n *\n * @readonly\n */\n this.storage = props.storage;\n\n /**\n * The memo associated with the contract (max 100 bytes).\n *\n * @readonly\n */\n this.contractMemo = props.contractMemo;\n\n /**\n * The current balance of the contract.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * Whether the contract has been deleted\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * The tokens associated to the contract\n *\n * @readonly\n */\n this.tokenRelationships = props.tokenRelationships;\n\n /**\n * The maximum number of automatic token associations allowed for this contract.\n * @readonly\n */\n this.maxAutomaticTokenAssociations =\n props.maxAutomaticTokenAssociations;\n\n /**\n * The ledger ID the response was returned from; please see <a href=\"https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md\">HIP-198</a> for the network-specific IDs.\n */\n this.ledgerId = props.ledgerId;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ContractGetInfoResponse.IContractInfo} info\n * @returns {ContractInfo}\n */\n static _fromProtobuf(info) {\n const autoRenewPeriod = /** @type {Long | number} */ (\n /** @type {HieroProto.proto.IDuration} */ (info.autoRenewPeriod)\n .seconds\n );\n\n return new ContractInfo({\n contractId: ContractId._fromProtobuf(\n /** @type {HieroProto.proto.IContractID} */ (info.contractID),\n ),\n accountId: AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (info.accountID),\n ),\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : \"\",\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n expirationTime: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n ),\n autoRenewPeriod: new Duration(autoRenewPeriod),\n autoRenewAccountId:\n info.autoRenewAccountId != null\n ? AccountId._fromProtobuf(info.autoRenewAccountId)\n : null,\n storage:\n info.storage != null\n ? info.storage instanceof Long\n ? info.storage\n : Long.fromValue(info.storage)\n : Long.ZERO,\n contractMemo: info.memo != null ? info.memo : \"\",\n balance: Hbar.fromTinybars(info.balance != null ? info.balance : 0),\n isDeleted: /** @type {boolean} */ (info.deleted),\n tokenRelationships: TokenRelationshipMap._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : [],\n ),\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n stakingInfo:\n info.stakingInfo != null\n ? StakingInfo._fromProtobuf(info.stakingInfo)\n : null,\n maxAutomaticTokenAssociations:\n info.maxAutomaticTokenAssociations != null\n ? Long.isLong(info.maxAutomaticTokenAssociations)\n ? info.maxAutomaticTokenAssociations\n : Long.fromValue(info.maxAutomaticTokenAssociations)\n : Long.ZERO,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.ContractGetInfoResponse.IContractInfo}\n */\n _toProtobuf() {\n return {\n contractID: this.contractId._toProtobuf(),\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccountId:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n storage: this.storage,\n memo: this.contractMemo,\n balance: this.balance.toTinybars(),\n deleted: this.isDeleted,\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toNumber(),\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ContractInfo}\n */\n static fromBytes(bytes) {\n return ContractInfo._fromProtobuf(\n proto.ContractGetInfoResponse.ContractInfo.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return proto.ContractGetInfoResponse.ContractInfo.encode(\n this._toProtobuf(),\n ).finish();\n }\n}\n"],"names":["proto","HieroProto","ContractInfo","constructor","props","this","contractId","accountId","contractAccountId","adminKey","expirationTime","autoRenewPeriod","autoRenewAccountId","storage","contractMemo","balance","isDeleted","tokenRelationships","maxAutomaticTokenAssociations","ledgerId","stakingInfo","Object","freeze","_fromProtobuf","info","ContractId","AccountId","contractAccountID","Key","_fromProtobufKey","Timestamp","Duration","Long","fromValue","ZERO","memo","Hbar","fromTinybars","TokenRelationshipMap","LedgerId","fromBytes","StakingInfo","isLong","_toProtobuf","contractID","accountID","_toProtobufKey","toTinybars","deleted","toBytes","toNumber","bytes","ContractGetInfoResponse","decode","encode","finish"],"mappings":"8VAcA,MAAMA,MAAEA,GAAUC,EASH,MAAMC,EAoBjB,WAAAC,CAAYC,GAMRC,KAAKC,WAAaF,EAAME,WAQxBD,KAAKE,UAAYH,EAAMG,UAQvBF,KAAKG,kBAAoBJ,EAAMI,kBAY/BH,KAAKI,SAA6B,MAAlBL,EAAMK,SAAmBL,EAAMK,SAAW,KAO1DJ,KAAKK,eAAiBN,EAAMM,eAS5BL,KAAKM,gBAAkBP,EAAMO,gBAS7BN,KAAKO,mBAAqBR,EAAMQ,mBAQhCP,KAAKQ,QAAUT,EAAMS,QAOrBR,KAAKS,aAAeV,EAA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,CAMI,WAAAS,GACI,MAAO,CACHC,WAAYvC,KAAKC,WAAWqC,cAC5BE,UAAWxC,KAAKE,UAAUoC,cAC1BhB,kBAAmBtB,KAAKG,kBACxBC,SACqB,MAAjBJ,KAAKI,SAAmBJ,KAAKI,SAASqC,iBAAmB,KAC7DpC,eAAgBL,KAAKK,eAAeiC,cACpChC,gBAC4B,MAAxBN,KAAKM,gBACCN,KAAKM,gBAAgBgC,cACrB,KACV/B,mBAC+B,MAA3BP,KAAKO,mBACCP,KAAKO,mBAAmB+B,cACxB,KACV9B,QAASR,KAAKQ,QACdsB,KAAM9B,KAAKS,aACXC,QAASV,KAAKU,QAAQgC,aACtBC,QAAS3C,KAAKW,UACdC,mBAC+B,MAA3BZ,KAAKY,mBACCZ,KAAKY,mBAAmB0B,cACxB,KACVxB,SAA2B,MAAjBd,KAAKc,SAAmBd,KAAKc,SAAS8B,UAAY,KAC5D7B,YACwB,MAApBf,KAAKe,YACCf,KAAKe,YAAYuB,cACjB,KACVzB,8BACIb,KAAKa,8BAA8BgC,WAEnD,CAMI,gBAAOV,CAAUW,GACb,OAAOjD,EAAaqB,cAChBvB,EAAMoD,wBAAwBlD,aAAamD,OAAOF,GAE9D,CAKI,OAAAF,GACI,OAAOjD,EAAMoD,wBAAwBlD,aAAaoD,OAC9CjD,KAAKsC,eACPY,QACV"}
|
|
@@ -12,6 +12,7 @@ var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
|
12
12
|
var _Timestamp = _interopRequireDefault(require("../Timestamp.cjs"));
|
|
13
13
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
14
14
|
var _long = _interopRequireDefault(require("long"));
|
|
15
|
+
var Proto = _interopRequireWildcard(require("@hashgraph/proto"));
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -506,7 +507,7 @@ class ContractUpdateTransaction extends _Transaction.default {
|
|
|
506
507
|
declineReward: this.declineStakingRewards != null ? {
|
|
507
508
|
value: this.declineStakingRewards
|
|
508
509
|
} : null,
|
|
509
|
-
autoRenewAccountId: this._autoRenewAccountId != null ? this._autoRenewAccountId._toProtobuf() : null
|
|
510
|
+
autoRenewAccountId: this._autoRenewAccountId != null ? this._autoRenewAccountId.toString() == "0.0.0" ? Proto.proto.AccountID.create() : this._autoRenewAccountId._toProtobuf() : null
|
|
510
511
|
};
|
|
511
512
|
}
|
|
512
513
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../account/AccountId.js";import e from"./ContractId.js";import o from"../file/FileId.js";import n,{TRANSACTION_REGISTRY as i}from"../transaction/Transaction.js";import r from"../Duration.js";import a from"../Timestamp.js";import
|
|
1
|
+
import t from"../account/AccountId.js";import e from"./ContractId.js";import o from"../file/FileId.js";import n,{TRANSACTION_REGISTRY as i}from"../transaction/Transaction.js";import r from"../Duration.js";import a from"../Timestamp.js";import c from"../Key.js";import s from"long";import*as u from"@hashgraph/proto";class d extends n{constructor(t={}){super(),this._contractId=null,this._expirationTime=null,this._adminKey=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._bytecodeFileId=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._autoRenewAccountId=null,null!=t.contractId&&this.setContractId(t.contractId),null!=t.expirationTime&&this.setExpirationTime(t.expirationTime),null!=t.adminKey&&this.setAdminKey(t.adminKey),null!=t.proxyAccountId&&this.setProxyAccountId(t.proxyAccountId),null!=t.autoRenewPeriod&&this.setAutoRenewPeriod(t.autoRenewPeriod),null!=t.bytecodeFileId&&this.setBytecodeFileId(t.bytecodeFileId),null!=t.contractMemo&&this.setContractMemo(t.contractMemo),null!=t.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(t.maxAutomaticTokenAssociations),null!=t.stakedAccountId&&this.setStakedAccountId(t.stakedAccountId),null!=t.stakedNodeId&&this.setStakedNodeId(t.stakedNodeId),null!=t.declineStakingReward&&this.setDeclineStakingReward(t.declineStakingReward),null!=t.autoRenewAccountId&&this.setAutoRenewAccountId(t.autoRenewAccountId)}static _fromProtobuf(i,r,s,u,l){const m=l[0].contractUpdateInstance;let h,I,_;return null!=m.autoRenewPeriod&&null!=m.autoRenewPeriod.seconds&&(h=m.autoRenewPeriod.seconds),null!=m.memoWrapper&&Object.hasOwn(m.memoWrapper,"value")&&null!=m.memoWrapper.value&&(I=m.memoWrapper.value),null!=m.maxAutomaticTokenAssociations&&null!=m.maxAutomaticTokenAssociations.value&&(_=m.maxAutomaticTokenAssociations.value),n._fromProtobufTransactions(new d({contractId:null!=m.contractID?e._fromProtobuf(m.contractID):void 0,bytecodeFileId:null!=m.fileID?o._fromProtobuf(m.fileID):void 0,expirationTime:null!=m.expirationTime?a._fromProtobuf(m.expirationTime):void 0,adminKey:null!=m.adminKey?c._fromProtobufKey(m.adminKey):void 0,proxyAccountId:null!=m.proxyAccountID?t._fromProtobuf(m.proxyAccountID):void 0,autoRenewPeriod:h,contractMemo:I,maxAutomaticTokenAssociations:_,stakedAccountId:null!=m.stakedAccountId?t._fromProtobuf(m.stakedAccountId):void 0,stakedNodeId:null!=m.stakedNodeId?m.stakedNodeId:void 0,declineStakingReward:null!=m.declineReward&&1==Boolean(m.declineReward),autoRenewAccountId:null!=m.autoRenewAccountId?t._fromProtobuf(m.autoRenewAccountId):void 0}),i,r,s,u,l)}get contractId(){return this._contractId}setContractId(t){return this._requireNotFrozen(),this._contractId="string"==typeof t?e.fromString(t):t.clone(),this}get expirationTime(){return this._expirationTime}setExpirationTime(t){return this._requireNotFrozen(),this._expirationTime=t instanceof a?t:a.fromDate(t),this}get adminKey(){return this._adminKey}setAdminKey(t){return this._requireNotFrozen(),this._adminKey=t,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId="string"==typeof e?t.fromString(e):e.clone(),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(t){return this._requireNotFrozen(),this._autoRenewPeriod=t instanceof r?t:new r(t),this}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(t){return console.warn("Deprecated: there is no replacement"),this._requireNotFrozen(),this._bytecodeFileId="string"==typeof t?o.fromString(t):t.clone(),this}get contractMemo(){return this._contractMemo}setContractMemo(t){return this._requireNotFrozen(),this._contractMemo=t,this}clearContractMemo(){return this._requireNotFrozen(),this._contractMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(t){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations=t,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?t.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(t){return this._requireNotFrozen(),this._stakedNodeId=s.fromValue(t),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(t){return this._requireNotFrozen(),this._declineStakingReward=t,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?t.fromString(e):e,this}clearAutoRenewAccountId(){return this._autoRenewAccountId=new t(0),this}_validateChecksums(t){null!=this._contractId&&this._contractId.validateChecksum(t),null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(t),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(t)}_execute(t,e){return t.smartContract.updateContract(e)}_getTransactionDataCase(){return"contractUpdateInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,fileID:this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,memoWrapper:null!=this._contractMemo?{value:this._contractMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,autoRenewAccountId:null!=this._autoRenewAccountId?"0.0.0"==this._autoRenewAccountId.toString()?u.proto.AccountID.create():this._autoRenewAccountId._toProtobuf():null}}_getLogId(){return`ContractUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}i.set("contractUpdateInstance",d._fromProtobuf);export{d as default};
|
|
2
2
|
//# sourceMappingURL=ContractUpdateTransaction.js.map
|