@hiero-ledger/sdk 2.73.2 → 2.75.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/dist/umd.js +368 -202
- package/dist/umd.min.js +3 -3
- package/lib/MirrorNode.cjs +46 -0
- package/lib/MirrorNode.d.ts +16 -0
- package/lib/MirrorNode.js +1 -1
- package/lib/MirrorNode.js.map +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.cjs +11 -5
- package/lib/account/AccountAllowanceApproveTransaction.d.ts +4 -5
- package/lib/account/AccountAllowanceApproveTransaction.js +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
- package/lib/account/TokenAllowance.cjs +4 -2
- package/lib/account/TokenAllowance.d.ts +4 -2
- package/lib/account/TokenAllowance.js +1 -1
- package/lib/account/TokenAllowance.js.map +1 -1
- package/lib/account/TokenTransferMap.cjs +7 -2
- package/lib/account/TokenTransferMap.d.ts +6 -2
- package/lib/account/TokenTransferMap.js +1 -1
- package/lib/account/TokenTransferMap.js.map +1 -1
- package/lib/client/Client.cjs +13 -44
- package/lib/client/Client.d.ts +12 -12
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/MirrorNetwork.cjs +16 -0
- package/lib/client/MirrorNetwork.d.ts +7 -0
- package/lib/client/MirrorNetwork.js +1 -1
- package/lib/client/MirrorNetwork.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 +4 -1
- package/lib/constants/ClientConstants.d.ts +2 -0
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.js.map +1 -1
- package/lib/contract/ContractId.cjs +2 -5
- package/lib/contract/ContractId.js +1 -1
- package/lib/contract/ContractId.js.map +1 -1
- package/lib/network/AddressBookQueryWeb.cjs +88 -60
- package/lib/network/AddressBookQueryWeb.d.ts +7 -37
- package/lib/network/AddressBookQueryWeb.js +1 -1
- package/lib/network/AddressBookQueryWeb.js.map +1 -1
- package/lib/query/MirrorNodeContractQuery.cjs +2 -1
- package/lib/query/MirrorNodeContractQuery.js.map +1 -1
- package/lib/token/AbstractTokenTransferTransaction.cjs +12 -8
- package/lib/token/AbstractTokenTransferTransaction.d.ts +14 -11
- package/lib/token/AbstractTokenTransferTransaction.js +1 -1
- package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
- package/lib/token/AssessedCustomFee.cjs +8 -4
- package/lib/token/AssessedCustomFee.d.ts +8 -5
- package/lib/token/AssessedCustomFee.js +1 -1
- package/lib/token/AssessedCustomFee.js.map +1 -1
- package/lib/token/CustomFixedFee.cjs +8 -4
- package/lib/token/CustomFixedFee.d.ts +8 -5
- package/lib/token/CustomFixedFee.js +1 -1
- package/lib/token/CustomFixedFee.js.map +1 -1
- package/lib/token/PendingAirdropRecord.cjs +7 -2
- package/lib/token/PendingAirdropRecord.d.ts +6 -2
- package/lib/token/PendingAirdropRecord.js +1 -1
- package/lib/token/PendingAirdropRecord.js.map +1 -1
- package/lib/token/TokenAirdropTransaction.cjs +2 -1
- package/lib/token/TokenAirdropTransaction.d.ts +4 -2
- package/lib/token/TokenAirdropTransaction.js.map +1 -1
- package/lib/token/TokenBurnTransaction.cjs +5 -3
- package/lib/token/TokenBurnTransaction.d.ts +6 -4
- package/lib/token/TokenBurnTransaction.js +1 -1
- package/lib/token/TokenBurnTransaction.js.map +1 -1
- package/lib/token/TokenCreateTransaction.cjs +7 -6
- package/lib/token/TokenCreateTransaction.d.ts +8 -8
- package/lib/token/TokenCreateTransaction.js +1 -1
- package/lib/token/TokenCreateTransaction.js.map +1 -1
- package/lib/token/TokenMintTransaction.cjs +5 -4
- package/lib/token/TokenMintTransaction.d.ts +6 -5
- package/lib/token/TokenMintTransaction.js +1 -1
- package/lib/token/TokenMintTransaction.js.map +1 -1
- package/lib/token/TokenTransfer.cjs +3 -2
- package/lib/token/TokenTransfer.d.ts +2 -2
- package/lib/token/TokenTransfer.js +1 -1
- package/lib/token/TokenTransfer.js.map +1 -1
- package/lib/token/TokenWipeTransaction.cjs +5 -3
- package/lib/token/TokenWipeTransaction.d.ts +6 -4
- package/lib/token/TokenWipeTransaction.js +1 -1
- package/lib/token/TokenWipeTransaction.js.map +1 -1
- package/lib/transaction/Transaction.cjs +54 -0
- package/lib/transaction/Transaction.d.ts +10 -0
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/util.cjs +25 -0
- package/lib/util.d.ts +8 -0
- package/lib/util.js +1 -1
- package/lib/util.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +16 -12
- package/src/MirrorNode.js +49 -0
- package/src/account/AccountAllowanceApproveTransaction.js +11 -11
- package/src/account/TokenAllowance.js +5 -2
- package/src/account/TokenTransferMap.js +7 -2
- package/src/client/Client.js +13 -51
- package/src/client/MirrorNetwork.js +18 -0
- 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 +3 -0
- package/src/contract/ContractId.js +2 -10
- package/src/network/AddressBookQueryWeb.js +122 -91
- package/src/query/MirrorNodeContractQuery.js +2 -1
- package/src/token/AbstractTokenTransferTransaction.js +12 -8
- package/src/token/AssessedCustomFee.js +8 -5
- package/src/token/CustomFixedFee.js +8 -5
- package/src/token/PendingAirdropRecord.js +7 -2
- package/src/token/TokenAirdropTransaction.js +2 -1
- package/src/token/TokenBurnTransaction.js +5 -3
- package/src/token/TokenCreateTransaction.js +7 -9
- package/src/token/TokenMintTransaction.js +5 -4
- package/src/token/TokenTransfer.js +3 -2
- package/src/token/TokenWipeTransaction.js +5 -3
- package/src/transaction/Transaction.js +63 -0
- package/src/util.js +26 -0
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _TokenId = _interopRequireDefault(require("./TokenId.cjs"));
|
|
8
8
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
9
9
|
var _long = _interopRequireDefault(require("long"));
|
|
10
|
+
var _util = require("../util.cjs");
|
|
10
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -27,6 +28,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
27
28
|
* @typedef {import("../client/Client.js").default<*, *>} Client
|
|
28
29
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
29
30
|
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
|
|
31
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
30
32
|
*/
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -36,7 +38,7 @@ class TokenBurnTransaction extends _Transaction.default {
|
|
|
36
38
|
/**
|
|
37
39
|
* @param {object} [props]
|
|
38
40
|
* @param {TokenId | string} [props.tokenId]
|
|
39
|
-
* @param {Long | number} [props.amount]
|
|
41
|
+
* @param {Long | number | BigNumber | bigint} [props.amount]
|
|
40
42
|
* @param {(Long | number)[]} [props.serials]
|
|
41
43
|
*/
|
|
42
44
|
constructor(props = {}) {
|
|
@@ -115,12 +117,12 @@ class TokenBurnTransaction extends _Transaction.default {
|
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
/**
|
|
118
|
-
* @param {Long | number} amount
|
|
120
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
119
121
|
* @returns {this}
|
|
120
122
|
*/
|
|
121
123
|
setAmount(amount) {
|
|
122
124
|
this._requireNotFrozen();
|
|
123
|
-
this._amount =
|
|
125
|
+
this._amount = (0, _util.convertAmountToLong)(amount);
|
|
124
126
|
return this;
|
|
125
127
|
}
|
|
126
128
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @typedef {import("../client/Client.js").default<*, *>} Client
|
|
14
14
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
15
15
|
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
|
|
16
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
16
17
|
*/
|
|
17
18
|
/**
|
|
18
19
|
* Burn a new Hedera™ crypto-currency token.
|
|
@@ -31,12 +32,12 @@ export default class TokenBurnTransaction extends Transaction {
|
|
|
31
32
|
/**
|
|
32
33
|
* @param {object} [props]
|
|
33
34
|
* @param {TokenId | string} [props.tokenId]
|
|
34
|
-
* @param {Long | number} [props.amount]
|
|
35
|
+
* @param {Long | number | BigNumber | bigint} [props.amount]
|
|
35
36
|
* @param {(Long | number)[]} [props.serials]
|
|
36
37
|
*/
|
|
37
38
|
constructor(props?: {
|
|
38
39
|
tokenId?: string | TokenId | undefined;
|
|
39
|
-
amount?: number | Long | undefined;
|
|
40
|
+
amount?: number | bigint | Long | import("bignumber.js").BigNumber | undefined;
|
|
40
41
|
serials?: (number | Long)[] | undefined;
|
|
41
42
|
});
|
|
42
43
|
/**
|
|
@@ -68,10 +69,10 @@ export default class TokenBurnTransaction extends Transaction {
|
|
|
68
69
|
*/
|
|
69
70
|
get amount(): Long | null;
|
|
70
71
|
/**
|
|
71
|
-
* @param {Long | number} amount
|
|
72
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
72
73
|
* @returns {this}
|
|
73
74
|
*/
|
|
74
|
-
setAmount(amount: Long | number): this;
|
|
75
|
+
setAmount(amount: Long | number | BigNumber | bigint): this;
|
|
75
76
|
/**
|
|
76
77
|
* @returns {Long[]}
|
|
77
78
|
*/
|
|
@@ -103,6 +104,7 @@ export type Channel = import("../channel/Channel.js").default;
|
|
|
103
104
|
export type Client = import("../client/Client.js").default<any, any>;
|
|
104
105
|
export type AccountId = import("../account/AccountId.js").default;
|
|
105
106
|
export type TransactionId = import("../transaction/TransactionId.js").default;
|
|
107
|
+
export type BigNumber = import("bignumber.js").default;
|
|
106
108
|
import Transaction from "../transaction/Transaction.js";
|
|
107
109
|
import TokenId from "./TokenId.js";
|
|
108
110
|
import Long from "long";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./TokenId.js";import n,{TRANSACTION_REGISTRY as e}from"../transaction/Transaction.js";import
|
|
1
|
+
import t from"./TokenId.js";import n,{TRANSACTION_REGISTRY as e}from"../transaction/Transaction.js";import r from"long";import{convertAmountToLong as o}from"../util.js";class s extends n{constructor(t={}){super(),this._tokenId=null,this._amount=null,this._serials=[],null!=t.tokenId&&this.setTokenId(t.tokenId),null!=t.amount&&this.setAmount(t.amount),null!=t.serials&&this.setSerials(t.serials)}static _fromProtobuf(e,r,o,i,u){const a=u[0].tokenBurn;return n._fromProtobufTransactions(new s({tokenId:null!=a.token?t._fromProtobuf(a.token):void 0,amount:null!=a.amount?a.amount:void 0,serials:null!=a.serialNumbers?a.serialNumbers:void 0}),e,r,o,i,u)}get tokenId(){return this._tokenId}setTokenId(n){return this._requireNotFrozen(),this._tokenId="string"==typeof n?t.fromString(n):n.clone(),this}get amount(){return this._amount}setAmount(t){return this._requireNotFrozen(),this._amount=o(t),this}_validateChecksums(t){null!=this._tokenId&&this._tokenId.validateChecksum(t)}get serials(){return this._serials}setSerials(t){return this._requireNotFrozen(),this._serials=t.map(t=>t instanceof r?t:r.fromValue(t)),this}_execute(t,n){return t.token.burnToken(n)}_getTransactionDataCase(){return"tokenBurn"}_makeTransactionData(){return{amount:this._amount,serialNumbers:this._serials,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenBurnTransaction:${this._transactionIds.current.validStart.toString()}`}}e.set("tokenBurn",s._fromProtobuf);export{s as default};
|
|
2
2
|
//# sourceMappingURL=TokenBurnTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenBurnTransaction.js","sources":["../../src/token/TokenBurnTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\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.ITokenBurnTransactionBody} HieroProto.proto.ITokenBurnTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Burn a new Hedera™ crypto-currency token.\n */\nexport default class TokenBurnTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {Long | number} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n /**\n * @private\n * @type {Long[]}\n */\n this._serials = [];\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\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 {TokenBurnTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const burnToken =\n /** @type {HieroProto.proto.ITokenBurnTransactionBody} */ (\n body.tokenBurn\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenBurnTransaction({\n tokenId:\n burnToken.token != null\n ? TokenId._fromProtobuf(burnToken.token)\n : undefined,\n amount: burnToken.amount != null ? burnToken.amount : undefined,\n serials:\n burnToken.serialNumbers != null\n ? burnToken.serialNumbers\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? TokenId.fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount =
|
|
1
|
+
{"version":3,"file":"TokenBurnTransaction.js","sources":["../../src/token/TokenBurnTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\nimport { convertAmountToLong } from \"../util.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.ITokenBurnTransactionBody} HieroProto.proto.ITokenBurnTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * Burn a new Hedera™ crypto-currency token.\n */\nexport default class TokenBurnTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {Long | number | BigNumber | bigint} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n /**\n * @private\n * @type {Long[]}\n */\n this._serials = [];\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\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 {TokenBurnTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const burnToken =\n /** @type {HieroProto.proto.ITokenBurnTransactionBody} */ (\n body.tokenBurn\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenBurnTransaction({\n tokenId:\n burnToken.token != null\n ? TokenId._fromProtobuf(burnToken.token)\n : undefined,\n amount: burnToken.amount != null ? burnToken.amount : undefined,\n serials:\n burnToken.serialNumbers != null\n ? burnToken.serialNumbers\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? TokenId.fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number | BigNumber | bigint} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = convertAmountToLong(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {Long[]}\n */\n get serials() {\n return this._serials;\n }\n\n /**\n * @param {(Long | number)[]} serials\n * @returns {this}\n */\n setSerials(serials) {\n this._requireNotFrozen();\n this._serials = serials.map((serial) =>\n serial instanceof Long ? serial : Long.fromValue(serial),\n );\n\n return this;\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.token.burnToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenBurn\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ITokenBurnTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n serialNumbers: this._serials,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : 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 `TokenBurnTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenBurn\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenBurnTransaction._fromProtobuf,\n);\n"],"names":["TokenBurnTransaction","Transaction","constructor","props","super","this","_tokenId","_amount","_serials","tokenId","setTokenId","amount","setAmount","serials","setSerials","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","burnToken","_fromProtobufTransactions","token","TokenId","undefined","serialNumbers","_requireNotFrozen","fromString","clone","convertAmountToLong","_validateChecksums","client","validateChecksum","map","serial","Long","fromValue","_execute","channel","request","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"yKA+Be,MAAMA,UAA6BC,EAO9C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,SAAW,KAMhBD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ACpBe,MAAwB,MAAjBlB,KAAKC,SAAmBD,KAAKC,SAASqC,cAAgB,KAEzE,CAKI,SAAAC,GAII,MAAO,wBAFHvC,KAAKwC,gBAAgBC,QACxB,WACwCC,YACjD,EAGAC,EAAqBC,IACjB,YAEAjD,EAAqBe"}
|
|
@@ -8,6 +8,7 @@ var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
|
|
|
8
8
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
9
9
|
var _long = _interopRequireDefault(require("long"));
|
|
10
10
|
var _AccountId = _interopRequireDefault(require("../account/AccountId.cjs"));
|
|
11
|
+
var _util = require("../util.cjs");
|
|
11
12
|
var _Timestamp = _interopRequireDefault(require("../Timestamp.cjs"));
|
|
12
13
|
var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
13
14
|
var _CustomFixedFee = _interopRequireDefault(require("./CustomFixedFee.cjs"));
|
|
@@ -48,7 +49,7 @@ class TokenCreateTransaction extends _Transaction.default {
|
|
|
48
49
|
* @param {string} [props.tokenName]
|
|
49
50
|
* @param {string} [props.tokenSymbol]
|
|
50
51
|
* @param {Long | number} [props.decimals]
|
|
51
|
-
* @param {Long | number} [props.initialSupply]
|
|
52
|
+
* @param {Long | number | BigNumber | bigint} [props.initialSupply]
|
|
52
53
|
* @param {AccountId | string} [props.treasuryAccountId]
|
|
53
54
|
* @param {Key} [props.adminKey]
|
|
54
55
|
* @param {Key} [props.kycKey]
|
|
@@ -65,7 +66,7 @@ class TokenCreateTransaction extends _Transaction.default {
|
|
|
65
66
|
* @param {CustomFee[]} [props.customFees]
|
|
66
67
|
* @param {TokenType} [props.tokenType]
|
|
67
68
|
* @param {TokenSupplyType} [props.supplyType]
|
|
68
|
-
* @param {Long | number} [props.maxSupply]
|
|
69
|
+
* @param {Long | number | BigNumber | bigint} [props.maxSupply]
|
|
69
70
|
* @param {Key} [props.metadataKey]
|
|
70
71
|
* @param {Uint8Array} [props.metadata]
|
|
71
72
|
*/
|
|
@@ -389,12 +390,12 @@ class TokenCreateTransaction extends _Transaction.default {
|
|
|
389
390
|
}
|
|
390
391
|
|
|
391
392
|
/**
|
|
392
|
-
* @param {Long | number} initialSupply
|
|
393
|
+
* @param {Long | number | BigNumber | bigint} initialSupply
|
|
393
394
|
* @returns {this}
|
|
394
395
|
*/
|
|
395
396
|
setInitialSupply(initialSupply) {
|
|
396
397
|
this._requireNotFrozen();
|
|
397
|
-
this._initialSupply =
|
|
398
|
+
this._initialSupply = (0, _util.convertAmountToLong)(initialSupply);
|
|
398
399
|
return this;
|
|
399
400
|
}
|
|
400
401
|
|
|
@@ -694,11 +695,11 @@ class TokenCreateTransaction extends _Transaction.default {
|
|
|
694
695
|
}
|
|
695
696
|
|
|
696
697
|
/**
|
|
697
|
-
* @param {Long | number} maxSupply
|
|
698
|
+
* @param {Long | number | BigNumber | bigint} maxSupply
|
|
698
699
|
* @returns {this}
|
|
699
700
|
*/
|
|
700
701
|
setMaxSupply(maxSupply) {
|
|
701
|
-
this._maxSupply =
|
|
702
|
+
this._maxSupply = (0, _util.convertAmountToLong)(maxSupply);
|
|
702
703
|
return this;
|
|
703
704
|
}
|
|
704
705
|
|
|
@@ -34,7 +34,7 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
34
34
|
* @param {string} [props.tokenName]
|
|
35
35
|
* @param {string} [props.tokenSymbol]
|
|
36
36
|
* @param {Long | number} [props.decimals]
|
|
37
|
-
* @param {Long | number} [props.initialSupply]
|
|
37
|
+
* @param {Long | number | BigNumber | bigint} [props.initialSupply]
|
|
38
38
|
* @param {AccountId | string} [props.treasuryAccountId]
|
|
39
39
|
* @param {Key} [props.adminKey]
|
|
40
40
|
* @param {Key} [props.kycKey]
|
|
@@ -51,7 +51,7 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
51
51
|
* @param {CustomFee[]} [props.customFees]
|
|
52
52
|
* @param {TokenType} [props.tokenType]
|
|
53
53
|
* @param {TokenSupplyType} [props.supplyType]
|
|
54
|
-
* @param {Long | number} [props.maxSupply]
|
|
54
|
+
* @param {Long | number | BigNumber | bigint} [props.maxSupply]
|
|
55
55
|
* @param {Key} [props.metadataKey]
|
|
56
56
|
* @param {Uint8Array} [props.metadata]
|
|
57
57
|
*/
|
|
@@ -59,7 +59,7 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
59
59
|
tokenName?: string | undefined;
|
|
60
60
|
tokenSymbol?: string | undefined;
|
|
61
61
|
decimals?: number | Long | undefined;
|
|
62
|
-
initialSupply?: number | Long | undefined;
|
|
62
|
+
initialSupply?: number | bigint | Long | import("bignumber.js").BigNumber | undefined;
|
|
63
63
|
treasuryAccountId?: string | AccountId | undefined;
|
|
64
64
|
adminKey?: Key | undefined;
|
|
65
65
|
kycKey?: Key | undefined;
|
|
@@ -76,7 +76,7 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
76
76
|
customFees?: import("./CustomFee.js").default[] | undefined;
|
|
77
77
|
tokenType?: TokenType | undefined;
|
|
78
78
|
supplyType?: TokenSupplyType | undefined;
|
|
79
|
-
maxSupply?: number | Long | undefined;
|
|
79
|
+
maxSupply?: number | bigint | Long | import("bignumber.js").BigNumber | undefined;
|
|
80
80
|
metadataKey?: Key | undefined;
|
|
81
81
|
metadata?: Uint8Array<ArrayBufferLike> | undefined;
|
|
82
82
|
});
|
|
@@ -228,10 +228,10 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
228
228
|
*/
|
|
229
229
|
get initialSupply(): Long | null;
|
|
230
230
|
/**
|
|
231
|
-
* @param {Long | number} initialSupply
|
|
231
|
+
* @param {Long | number | BigNumber | bigint} initialSupply
|
|
232
232
|
* @returns {this}
|
|
233
233
|
*/
|
|
234
|
-
setInitialSupply(initialSupply: Long | number): this;
|
|
234
|
+
setInitialSupply(initialSupply: Long | number | BigNumber | bigint): this;
|
|
235
235
|
/**
|
|
236
236
|
* @returns {?AccountId}
|
|
237
237
|
*/
|
|
@@ -391,10 +391,10 @@ export default class TokenCreateTransaction extends Transaction {
|
|
|
391
391
|
*/
|
|
392
392
|
get maxSupply(): Long | null;
|
|
393
393
|
/**
|
|
394
|
-
* @param {Long | number} maxSupply
|
|
394
|
+
* @param {Long | number | BigNumber | bigint} maxSupply
|
|
395
395
|
* @returns {this}
|
|
396
396
|
*/
|
|
397
|
-
setMaxSupply(maxSupply: Long | number): this;
|
|
397
|
+
setMaxSupply(maxSupply: Long | number | BigNumber | bigint): this;
|
|
398
398
|
/**
|
|
399
399
|
* @returns {?Key}
|
|
400
400
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../Hbar.js";import t,{TRANSACTION_REGISTRY as o,DEFAULT_AUTO_RENEW_PERIOD as u}from"../transaction/Transaction.js";import i from"long";import n from"../account/AccountId.js";import s from"../Timestamp.js";import
|
|
1
|
+
import e from"../Hbar.js";import t,{TRANSACTION_REGISTRY as o,DEFAULT_AUTO_RENEW_PERIOD as u}from"../transaction/Transaction.js";import i from"long";import n from"../account/AccountId.js";import{convertAmountToLong as s}from"../util.js";import r from"../Timestamp.js";import l from"../Duration.js";import a from"./CustomFixedFee.js";import y from"./CustomFractionalFee.js";import h from"./CustomRoyaltyFee.js";import p from"./TokenType.js";import m from"./TokenSupplyType.js";import _ from"../Key.js";class c extends t{constructor(t={}){super(),this._tokenName=null,this._tokenSymbol=null,this._decimals=null,this._initialSupply=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._pauseKey=null,this._wipeKey=null,this._supplyKey=null,this._feeScheduleKey=null,this._freezeDefault=null,this._autoRenewAccountId=null,this._expirationTime=new r(Math.floor(Date.now()/1e3+u.toNumber()),0),this._autoRenewPeriod=new l(u),this._tokenMemo=null,this._customFees=[],this._tokenType=null,this._supplyType=null,this._maxSupply=null,this._defaultMaxTransactionFee=new e(30),this._metadataKey=null,this._metadata=null,null!=t.tokenName&&this.setTokenName(t.tokenName),null!=t.tokenSymbol&&this.setTokenSymbol(t.tokenSymbol),null!=t.decimals&&this.setDecimals(t.decimals),null!=t.initialSupply&&this.setInitialSupply(t.initialSupply),null!=t.treasuryAccountId&&this.setTreasuryAccountId(t.treasuryAccountId),null!=t.adminKey&&this.setAdminKey(t.adminKey),null!=t.kycKey&&this.setKycKey(t.kycKey),null!=t.freezeKey&&this.setFreezeKey(t.freezeKey),null!=t.pauseKey&&this.setPauseKey(t.pauseKey),null!=t.wipeKey&&this.setWipeKey(t.wipeKey),null!=t.supplyKey&&this.setSupplyKey(t.supplyKey),null!=t.feeScheduleKey&&this.setFeeScheduleKey(t.feeScheduleKey),null!=t.freezeDefault&&this.setFreezeDefault(t.freezeDefault),null!=t.autoRenewAccountId&&this.setAutoRenewAccountId(t.autoRenewAccountId),null!=t.expirationTime&&this.setExpirationTime(t.expirationTime),null!=t.autoRenewPeriod&&this.setAutoRenewPeriod(t.autoRenewPeriod),null!=t.tokenMemo&&this.setTokenMemo(t.tokenMemo),null!=t.customFees&&this.setCustomFees(t.customFees),null!=t.tokenType&&this.setTokenType(t.tokenType),null!=t.supplyType&&this.setSupplyType(t.supplyType),null!=t.maxSupply&&this.setMaxSupply(t.maxSupply),null!=t.metadataKey&&this.setMetadataKey(t.metadataKey),null!=t.metadata&&this.setMetadata(t.metadata)}static _fromProtobuf(e,o,u,i,s){const d=s[0].tokenCreation;return t._fromProtobufTransactions(new c({tokenName:null!=d.name?d.name:void 0,tokenSymbol:null!=d.symbol?d.symbol:void 0,decimals:null!=d.decimals?d.decimals:void 0,initialSupply:null!=d.initialSupply?d.initialSupply:void 0,treasuryAccountId:null!=d.treasury?n._fromProtobuf(d.treasury):void 0,adminKey:null!=d.adminKey?_._fromProtobufKey(d.adminKey):void 0,kycKey:null!=d.kycKey?_._fromProtobufKey(d.kycKey):void 0,freezeKey:null!=d.freezeKey?_._fromProtobufKey(d.freezeKey):void 0,pauseKey:null!=d.pauseKey?_._fromProtobufKey(d.pauseKey):void 0,wipeKey:null!=d.wipeKey?_._fromProtobufKey(d.wipeKey):void 0,supplyKey:null!=d.supplyKey?_._fromProtobufKey(d.supplyKey):void 0,feeScheduleKey:null!=d.feeScheduleKey?_._fromProtobufKey(d.feeScheduleKey):void 0,freezeDefault:null!=d.freezeDefault?d.freezeDefault:void 0,autoRenewAccountId:null!=d.autoRenewAccount?n._fromProtobuf(d.autoRenewAccount):void 0,expirationTime:null!=d.expiry?r._fromProtobuf(d.expiry):void 0,autoRenewPeriod:null!=d.autoRenewPeriod?l._fromProtobuf(d.autoRenewPeriod):void 0,tokenMemo:null!=d.memo?d.memo:void 0,customFees:null!=d.customFees?d.customFees.map(e=>null!=e.fixedFee?a._fromProtobuf(e):null!=e.fractionalFee?y._fromProtobuf(e):h._fromProtobuf(e)):void 0,tokenType:null!=d.tokenType?p._fromCode(d.tokenType):void 0,supplyType:null!=d.supplyType?m._fromCode(d.supplyType):void 0,maxSupply:null!=d.maxSupply?d.maxSupply:void 0,metadataKey:null!=d.metadataKey?_._fromProtobufKey(d.metadataKey):void 0,metadata:null!=d.metadata?d.metadata:void 0}),e,o,u,i,s)}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get decimals(){return this._decimals}setDecimals(e){return this._requireNotFrozen(),this._decimals=e instanceof i?e:i.fromValue(e),this}get initialSupply(){return this._initialSupply}setInitialSupply(e){return this._requireNotFrozen(),this._initialSupply=s(e),this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?n.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId&&null!=this.autoRenewPeriod?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&null!=this.autoRenewPeriod&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get freezeDefault(){return this._freezeDefault}setFreezeDefault(e){return this._requireNotFrozen(),this._freezeDefault=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof r?e:r.fromDate(e),this._autoRenewPeriod=null,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof n?e:n.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof l?e:new l(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get customFees(){return this._customFees}setCustomFees(e){return this._customFees=e,this}get tokenType(){return this._tokenType}setTokenType(e){return this._tokenType=e,this}get supplyType(){return this._supplyType}setSupplyType(e){return this._supplyType=e,this}get maxSupply(){return this._maxSupply}setMaxSupply(e){return this._maxSupply=s(e),this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.createToken(t)}_getTransactionDataCase(){return"tokenCreation"}_makeTransactionData(){return{name:this._tokenName,symbol:this._tokenSymbol,decimals:null!=this._decimals?this._decimals.toInt():null,initialSupply:this._initialSupply,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,freezeDefault:this._freezeDefault,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:this._tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this._tokenType?this._tokenType._code:null,supplyType:null!=this._supplyType?this._supplyType._code:null,maxSupply:this.maxSupply,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?this._metadata:void 0}}_getLogId(){return`TokenCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}o.set("tokenCreation",c._fromProtobuf);export{c as default};
|
|
2
2
|
//# sourceMappingURL=TokenCreateTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCreateTransaction.js","sources":["../../src/token/TokenCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"../Hbar.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\nimport AccountId from \"../account/AccountId.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Duration from \"../Duration.js\";\nimport CustomFixedFee from \"./CustomFixedFee.js\";\nimport CustomFractionalFee from \"./CustomFractionalFee.js\";\nimport CustomRoyaltyFee from \"./CustomRoyaltyFee.js\";\nimport TokenType from \"./TokenType.js\";\nimport TokenSupplyType from \"./TokenSupplyType.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.ITokenCreateTransactionBody} HieroProto.proto.ITokenCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\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 * @typedef {import(\"./CustomFee.js\").default} CustomFee\n */\n\n/**\n * Create a new Hedera™ crypto-currency token.\n */\nexport default class TokenCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {string} [props.tokenName]\n * @param {string} [props.tokenSymbol]\n * @param {Long | number} [props.decimals]\n * @param {Long | number} [props.initialSupply]\n * @param {AccountId | string} [props.treasuryAccountId]\n * @param {Key} [props.adminKey]\n * @param {Key} [props.kycKey]\n * @param {Key} [props.freezeKey]\n * @param {Key} [props.pauseKey]\n * @param {Key} [props.wipeKey]\n * @param {Key} [props.supplyKey]\n * @param {Key} [props.feeScheduleKey]\n * @param {boolean} [props.freezeDefault]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.tokenMemo]\n * @param {CustomFee[]} [props.customFees]\n * @param {TokenType} [props.tokenType]\n * @param {TokenSupplyType} [props.supplyType]\n * @param {Long | number} [props.maxSupply]\n * @param {Key} [props.metadataKey]\n * @param {Uint8Array} [props.metadata]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenName = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenSymbol = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._decimals = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._initialSupply = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._treasuryAccountId = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._kycKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._freezeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._pauseKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._wipeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._supplyKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._freezeDefault = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = new Timestamp(\n Math.floor(\n Date.now() / 1000 + DEFAULT_AUTO_RENEW_PERIOD.toNumber(),\n ),\n 0,\n );\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenMemo = null;\n\n /**\n * @private\n * @type {CustomFee[]}\n */\n this._customFees = [];\n\n /**\n * @private\n * @type {?TokenType}\n */\n this._tokenType = null;\n\n /**\n * @private\n * @type {?TokenSupplyType}\n */\n this._supplyType = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxSupply = null;\n\n this._defaultMaxTransactionFee = new Hbar(30);\n\n /**\n * @private\n * @type {?Key}\n */\n this._metadataKey = null;\n\n /**\n * @private\n * @description Metadata of the created token definition.\n * @type {?Uint8Array}\n */\n this._metadata = null;\n\n if (props.tokenName != null) {\n this.setTokenName(props.tokenName);\n }\n\n if (props.tokenSymbol != null) {\n this.setTokenSymbol(props.tokenSymbol);\n }\n\n if (props.decimals != null) {\n this.setDecimals(props.decimals);\n }\n\n if (props.initialSupply != null) {\n this.setInitialSupply(props.initialSupply);\n }\n\n if (props.treasuryAccountId != null) {\n this.setTreasuryAccountId(props.treasuryAccountId);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.kycKey != null) {\n this.setKycKey(props.kycKey);\n }\n\n if (props.freezeKey != null) {\n this.setFreezeKey(props.freezeKey);\n }\n\n if (props.pauseKey != null) {\n this.setPauseKey(props.pauseKey);\n }\n\n if (props.wipeKey != null) {\n this.setWipeKey(props.wipeKey);\n }\n\n if (props.supplyKey != null) {\n this.setSupplyKey(props.supplyKey);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.freezeDefault != null) {\n this.setFreezeDefault(props.freezeDefault);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.tokenMemo != null) {\n this.setTokenMemo(props.tokenMemo);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n\n if (props.tokenType != null) {\n this.setTokenType(props.tokenType);\n }\n\n if (props.supplyType != null) {\n this.setSupplyType(props.supplyType);\n }\n\n if (props.maxSupply != null) {\n this.setMaxSupply(props.maxSupply);\n }\n\n if (props.metadataKey != null) {\n this.setMetadataKey(props.metadataKey);\n }\n\n if (props.metadata != null) {\n this.setMetadata(props.metadata);\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 {TokenCreateTransaction}\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.ITokenCreateTransactionBody} */ (\n body.tokenCreation\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenCreateTransaction({\n tokenName: create.name != null ? create.name : undefined,\n tokenSymbol: create.symbol != null ? create.symbol : undefined,\n decimals: create.decimals != null ? create.decimals : undefined,\n initialSupply:\n create.initialSupply != null\n ? create.initialSupply\n : undefined,\n treasuryAccountId:\n create.treasury != null\n ? AccountId._fromProtobuf(create.treasury)\n : undefined,\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n kycKey:\n create.kycKey != null\n ? Key._fromProtobufKey(create.kycKey)\n : undefined,\n freezeKey:\n create.freezeKey != null\n ? Key._fromProtobufKey(create.freezeKey)\n : undefined,\n pauseKey:\n create.pauseKey != null\n ? Key._fromProtobufKey(create.pauseKey)\n : undefined,\n wipeKey:\n create.wipeKey != null\n ? Key._fromProtobufKey(create.wipeKey)\n : undefined,\n supplyKey:\n create.supplyKey != null\n ? Key._fromProtobufKey(create.supplyKey)\n : undefined,\n feeScheduleKey:\n create.feeScheduleKey != null\n ? Key._fromProtobufKey(create.feeScheduleKey)\n : undefined,\n freezeDefault:\n create.freezeDefault != null\n ? create.freezeDefault\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? AccountId._fromProtobuf(create.autoRenewAccount)\n : undefined,\n expirationTime:\n create.expiry != null\n ? Timestamp._fromProtobuf(create.expiry)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? Duration._fromProtobuf(create.autoRenewPeriod)\n : undefined,\n tokenMemo: create.memo != null ? create.memo : undefined,\n customFees:\n create.customFees != null\n ? create.customFees.map((fee) => {\n if (fee.fixedFee != null) {\n return CustomFixedFee._fromProtobuf(fee);\n } else if (fee.fractionalFee != null) {\n return CustomFractionalFee._fromProtobuf(fee);\n } else {\n return CustomRoyaltyFee._fromProtobuf(fee);\n }\n })\n : undefined,\n tokenType:\n create.tokenType != null\n ? TokenType._fromCode(create.tokenType)\n : undefined,\n supplyType:\n create.supplyType != null\n ? TokenSupplyType._fromCode(create.supplyType)\n : undefined,\n maxSupply:\n create.maxSupply != null ? create.maxSupply : undefined,\n metadataKey:\n create.metadataKey != null\n ? Key._fromProtobufKey(create.metadataKey)\n : undefined,\n metadata: create.metadata != null ? create.metadata : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?string}\n */\n get tokenName() {\n return this._tokenName;\n }\n\n /**\n * @param {string} name\n * @returns {this}\n */\n setTokenName(name) {\n this._requireNotFrozen();\n this._tokenName = name;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenSymbol() {\n return this._tokenSymbol;\n }\n\n /**\n * @param {string} symbol\n * @returns {this}\n */\n setTokenSymbol(symbol) {\n this._requireNotFrozen();\n this._tokenSymbol = symbol;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get decimals() {\n return this._decimals;\n }\n\n /**\n * @param {Long | number} decimals\n * @returns {this}\n */\n setDecimals(decimals) {\n this._requireNotFrozen();\n this._decimals =\n decimals instanceof Long ? decimals : Long.fromValue(decimals);\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get initialSupply() {\n return this._initialSupply;\n }\n\n /**\n * @param {Long | number} initialSupply\n * @returns {this}\n */\n setInitialSupply(initialSupply) {\n this._requireNotFrozen();\n this._initialSupply = Long.fromValue(initialSupply);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get treasuryAccountId() {\n return this._treasuryAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setTreasuryAccountId(id) {\n this._requireNotFrozen();\n this._treasuryAccountId =\n typeof id === \"string\" ? AccountId.fromString(id) : id.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get kycKey() {\n return this._kycKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setKycKey(key) {\n this._requireNotFrozen();\n this._kycKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get freezeKey() {\n return this._freezeKey;\n }\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (\n !this._autoRenewAccountId &&\n this.transactionId?.accountId &&\n this.autoRenewPeriod != null\n ) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (\n !this._autoRenewAccountId &&\n client?.operatorAccountId &&\n this.autoRenewPeriod != null\n ) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFreezeKey(key) {\n this._requireNotFrozen();\n this._freezeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get pauseKey() {\n return this._pauseKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setPauseKey(key) {\n this._requireNotFrozen();\n this._pauseKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get wipeKey() {\n return this._wipeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setWipeKey(key) {\n this._requireNotFrozen();\n this._wipeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get supplyKey() {\n return this._supplyKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setSupplyKey(key) {\n this._requireNotFrozen();\n this._supplyKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get feeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFeeScheduleKey(key) {\n this._requireNotFrozen();\n this._feeScheduleKey = key;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get freezeDefault() {\n return this._freezeDefault;\n }\n\n /**\n * @param {boolean} freeze\n * @returns {this}\n */\n setFreezeDefault(freeze) {\n this._requireNotFrozen();\n this._freezeDefault = freeze;\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * If autoRenewPeriod is set - this value will be ignored and the expiration time will be calculated based on the autoRenewPeriod + time.now()\n * Setting this value will clear the autoRenewPeriod as the autoRenewPeriod period has default value of 7890000 seconds and leaving it set will override the expiration time\n * @param {Timestamp | Date} time\n * @returns {this}\n */\n setExpirationTime(time) {\n this._requireNotFrozen();\n this._expirationTime =\n time instanceof Timestamp ? time : Timestamp.fromDate(time);\n this._autoRenewPeriod = null;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setAutoRenewAccountId(id) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n id instanceof AccountId ? id : AccountId.fromString(id);\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * If expirationTime is set - autoRenewPeriod will be effectively ignored and it's effect will be replaced by expirationTime\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 {?string}\n */\n get tokenMemo() {\n return this._tokenMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setTokenMemo(memo) {\n this._requireNotFrozen();\n this._tokenMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {CustomFee[]}\n */\n get customFees() {\n return this._customFees;\n }\n\n /**\n * @param {CustomFee[]} customFees\n * @returns {this}\n */\n setCustomFees(customFees) {\n this._customFees = customFees;\n return this;\n }\n\n /**\n * @returns {?TokenType}\n */\n get tokenType() {\n return this._tokenType;\n }\n\n /**\n * @param {TokenType} tokenType\n * @returns {this}\n */\n setTokenType(tokenType) {\n this._tokenType = tokenType;\n return this;\n }\n\n /**\n * @returns {?TokenSupplyType}\n */\n get supplyType() {\n return this._supplyType;\n }\n\n /**\n * @param {TokenSupplyType} supplyType\n * @returns {this}\n */\n setSupplyType(supplyType) {\n this._supplyType = supplyType;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get maxSupply() {\n return this._maxSupply;\n }\n\n /**\n * @param {Long | number} maxSupply\n * @returns {this}\n */\n setMaxSupply(maxSupply) {\n this._maxSupply =\n typeof maxSupply === \"number\"\n ? Long.fromNumber(maxSupply)\n : maxSupply;\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get metadataKey() {\n return this._metadataKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setMetadataKey(key) {\n this._requireNotFrozen();\n this._metadataKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get metadata() {\n return this._metadata;\n }\n\n /**\n * @param {Uint8Array} metadata\n * @returns {this}\n */\n setMetadata(metadata) {\n this._requireNotFrozen();\n this._metadata = metadata;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._treasuryAccountId != null) {\n this._treasuryAccountId.validateChecksum(client);\n }\n\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.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.token.createToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenCreation\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ITokenCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n name: this._tokenName,\n symbol: this._tokenSymbol,\n decimals: this._decimals != null ? this._decimals.toInt() : null,\n initialSupply: this._initialSupply,\n treasury:\n this._treasuryAccountId != null\n ? this._treasuryAccountId._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null,\n freezeKey:\n this._freezeKey != null\n ? this._freezeKey._toProtobufKey()\n : null,\n pauseKey:\n this._pauseKey != null ? this._pauseKey._toProtobufKey() : null,\n wipeKey:\n this._wipeKey != null ? this._wipeKey._toProtobufKey() : null,\n supplyKey:\n this._supplyKey != null\n ? this._supplyKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n freezeDefault: this._freezeDefault,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n expiry:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n memo: this._tokenMemo,\n customFees: this.customFees.map((fee) => fee._toProtobuf()),\n tokenType: this._tokenType != null ? this._tokenType._code : null,\n supplyType:\n this._supplyType != null ? this._supplyType._code : null,\n maxSupply: this.maxSupply,\n metadataKey:\n this._metadataKey != null\n ? this._metadataKey._toProtobufKey()\n : null,\n metadata: this._metadata != null ? this._metadata : undefined,\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 `TokenCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenCreation\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenCreateTransaction._fromProtobuf,\n);\n"],"names":["TokenCreateTransaction","Transaction","constructor","props","super","this","_tokenName","_tokenSymbol","_decimals","_initialSupply","_treasuryAccountId","_adminKey","_kycKey","_freezeKey","_pauseKey","_wipeKey","_supplyKey","_feeScheduleKey","_freezeDefault","_autoRenewAccountId","_expirationTime","Timestamp","Math","floor","Date","now","DEFAULT_AUTO_RENEW_PERIOD","toNumber","_autoRenewPeriod","Duration","_tokenMemo","_customFees","_tokenType","_supplyType","_maxSupply","_defaultMaxTransactionFee","Hbar","_metadataKey","_metadata","tokenName","setTokenName","tokenSymbol","setTokenSymbol","decimals","setDecimals","initialSupply","setInitialSupply","treasuryAccountId","setTreasuryAccountId","adminKey","setAdminKey","kycKey","setKycKey","freezeKey","setFreezeKey","pauseKey","setPauseKey","wipeKey","setWipeKey","supplyKey","setSupplyKey","feeScheduleKey","setFeeScheduleKey","freezeDefault","setFreezeDefault","autoRenewAccountId","setAutoRenewAccountId","expirationTime","setExpirationTime","autoRenewPeriod","setAutoRenewPeriod","tokenMemo","setTokenMemo","customFees","setCustomFees","tokenType","setTokenType","supplyType","setSupplyType","maxSupply","setMaxSupply","metadataKey","setMetadataKey","metadata","setMetadata","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","name","undefined","symbol","treasury","AccountId","Key","_fromProtobufKey","autoRenewAccount","expiry","memo","map","fee","fixedFee","CustomFixedFee","fractionalFee","CustomFractionalFee","CustomRoyaltyFee","TokenType","_fromCode","TokenSupplyType","_requireNotFrozen","Long","fromValue","id","fromString","clone","key","freezeWith","client","transactionId","accountId","operatorAccountId","freeze","time","fromDate","fromNumber","_validateChecksums","validateChecksum","_execute","channel","request","token","createToken","_getTransactionDataCase","_makeTransactionData","toInt","_toProtobuf","_toProtobufKey","_code","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"ocAwCe,MAAMA,UAA+BC,EA2BhD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,WAAa,KAMlBD,KAAKE,aAAe,KAMpBF,KAAKG,UAAY,KAMjBH,KAAKI,eAAiB,KAMtBJ,KAAKK,mBAAqB,KAM1BL,KAAKM,UAAY,KAMjBN,KAAKO,QAAU,KAMfP,KAAKQ,WAAa,KAMlBR,KAAKS,UAAY,KAMjBT,KAAKU,SAAW,KAMhBV,KAAKW,WAAa,KAMlBX,KAAKY,gBAAkB,KAMvBZ,KAAKa,eAAiB,KAMtBb,KAAKc,oBAAsB,KAM3Bd,KAAKe,gBAAkB,IAAIC,EACvBC,KAAKC,MACDC,KAAKC,MAAQ,IAAOC,EAA0BC,YAElD,GAOJtB,KAAKuB,iBAAmB,IAAIC,EAASH,GAMrCrB,KAAKyB,WAAa,KAMlBzB,KAAK0B,YAAc,GAMnB1B,KAAK2B,WAAa,KAMlB3B,KAAK4B,YAAc,KAMnB5B,KAAK6B,WAAa,KAElB7B,KAAK8B,0BAA4B,IAAIC,EAAK,IAM1C/B,KAAKgC,aAAe,KAOpBhC,KAAKiC,UAAY,KAEM,MAAnBnC,EAAMoC,WACNlC,KAAKmC,aAAarC,EAAMoC,WAGH,MAArBpC,EAAMsC,aACNpC,KAAKqC,eAAevC,EAAMsC,aAGR,MAAlBtC,EAAMwC,UACNtC,KAAKuC,YAAYzC,EAAMwC,UAGA,MAAvBxC,EAAM0C,eACNxC,KAAKyC,iBAAiB3C,EAAM0C,eAGD,MAA3B1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ACX2C,WAAYpE,KAAKoE,WAAW8B,IAAKC,GAAQA,EAAImC,eAC7ChE,UAA8B,MAAnBtE,KAAK2B,WAAqB3B,KAAK2B,WAAW6G,MAAQ,KAC7DhE,WACwB,MAApBxE,KAAK4B,YAAsB5B,KAAK4B,YAAY4G,MAAQ,KACxD9D,UAAW1E,KAAK0E,UAChBE,YACyB,MAArB5E,KAAKgC,aACChC,KAAKgC,aAAauG,iBAClB,KACVzD,SAA4B,MAAlB9E,KAAKiC,UAAoBjC,KAAKiC,eAAYwD,EAEhE,CAKI,SAAAgD,GAII,MAAO,0BAFHzI,KAAK0I,gBAAgBC,QACxB,WAC0CC,YACnD,EAGAC,EAAqBC,IACjB,gBAEAnJ,EAAuBqF"}
|
|
1
|
+
{"version":3,"file":"TokenCreateTransaction.js","sources":["../../src/token/TokenCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"../Hbar.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\nimport AccountId from \"../account/AccountId.js\";\nimport { convertAmountToLong } from \"../util.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Duration from \"../Duration.js\";\nimport CustomFixedFee from \"./CustomFixedFee.js\";\nimport CustomFractionalFee from \"./CustomFractionalFee.js\";\nimport CustomRoyaltyFee from \"./CustomRoyaltyFee.js\";\nimport TokenType from \"./TokenType.js\";\nimport TokenSupplyType from \"./TokenSupplyType.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.ITokenCreateTransactionBody} HieroProto.proto.ITokenCreateTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\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 * @typedef {import(\"./CustomFee.js\").default} CustomFee\n */\n\n/**\n * Create a new Hedera™ crypto-currency token.\n */\nexport default class TokenCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {string} [props.tokenName]\n * @param {string} [props.tokenSymbol]\n * @param {Long | number} [props.decimals]\n * @param {Long | number | BigNumber | bigint} [props.initialSupply]\n * @param {AccountId | string} [props.treasuryAccountId]\n * @param {Key} [props.adminKey]\n * @param {Key} [props.kycKey]\n * @param {Key} [props.freezeKey]\n * @param {Key} [props.pauseKey]\n * @param {Key} [props.wipeKey]\n * @param {Key} [props.supplyKey]\n * @param {Key} [props.feeScheduleKey]\n * @param {boolean} [props.freezeDefault]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {Timestamp | Date} [props.expirationTime]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {string} [props.tokenMemo]\n * @param {CustomFee[]} [props.customFees]\n * @param {TokenType} [props.tokenType]\n * @param {TokenSupplyType} [props.supplyType]\n * @param {Long | number | BigNumber | bigint} [props.maxSupply]\n * @param {Key} [props.metadataKey]\n * @param {Uint8Array} [props.metadata]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenName = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenSymbol = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._decimals = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._initialSupply = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._treasuryAccountId = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._kycKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._freezeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._pauseKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._wipeKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._supplyKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._freezeDefault = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = new Timestamp(\n Math.floor(\n Date.now() / 1000 + DEFAULT_AUTO_RENEW_PERIOD.toNumber(),\n ),\n 0,\n );\n\n /**\n * @private\n * @type {?Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {?string}\n */\n this._tokenMemo = null;\n\n /**\n * @private\n * @type {CustomFee[]}\n */\n this._customFees = [];\n\n /**\n * @private\n * @type {?TokenType}\n */\n this._tokenType = null;\n\n /**\n * @private\n * @type {?TokenSupplyType}\n */\n this._supplyType = null;\n\n /**\n * @private\n * @type {?Long}\n */\n this._maxSupply = null;\n\n this._defaultMaxTransactionFee = new Hbar(30);\n\n /**\n * @private\n * @type {?Key}\n */\n this._metadataKey = null;\n\n /**\n * @private\n * @description Metadata of the created token definition.\n * @type {?Uint8Array}\n */\n this._metadata = null;\n\n if (props.tokenName != null) {\n this.setTokenName(props.tokenName);\n }\n\n if (props.tokenSymbol != null) {\n this.setTokenSymbol(props.tokenSymbol);\n }\n\n if (props.decimals != null) {\n this.setDecimals(props.decimals);\n }\n\n if (props.initialSupply != null) {\n this.setInitialSupply(props.initialSupply);\n }\n\n if (props.treasuryAccountId != null) {\n this.setTreasuryAccountId(props.treasuryAccountId);\n }\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.kycKey != null) {\n this.setKycKey(props.kycKey);\n }\n\n if (props.freezeKey != null) {\n this.setFreezeKey(props.freezeKey);\n }\n\n if (props.pauseKey != null) {\n this.setPauseKey(props.pauseKey);\n }\n\n if (props.wipeKey != null) {\n this.setWipeKey(props.wipeKey);\n }\n\n if (props.supplyKey != null) {\n this.setSupplyKey(props.supplyKey);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.freezeDefault != null) {\n this.setFreezeDefault(props.freezeDefault);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.expirationTime != null) {\n this.setExpirationTime(props.expirationTime);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.tokenMemo != null) {\n this.setTokenMemo(props.tokenMemo);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n\n if (props.tokenType != null) {\n this.setTokenType(props.tokenType);\n }\n\n if (props.supplyType != null) {\n this.setSupplyType(props.supplyType);\n }\n\n if (props.maxSupply != null) {\n this.setMaxSupply(props.maxSupply);\n }\n\n if (props.metadataKey != null) {\n this.setMetadataKey(props.metadataKey);\n }\n\n if (props.metadata != null) {\n this.setMetadata(props.metadata);\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 {TokenCreateTransaction}\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.ITokenCreateTransactionBody} */ (\n body.tokenCreation\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenCreateTransaction({\n tokenName: create.name != null ? create.name : undefined,\n tokenSymbol: create.symbol != null ? create.symbol : undefined,\n decimals: create.decimals != null ? create.decimals : undefined,\n initialSupply:\n create.initialSupply != null\n ? create.initialSupply\n : undefined,\n treasuryAccountId:\n create.treasury != null\n ? AccountId._fromProtobuf(create.treasury)\n : undefined,\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n kycKey:\n create.kycKey != null\n ? Key._fromProtobufKey(create.kycKey)\n : undefined,\n freezeKey:\n create.freezeKey != null\n ? Key._fromProtobufKey(create.freezeKey)\n : undefined,\n pauseKey:\n create.pauseKey != null\n ? Key._fromProtobufKey(create.pauseKey)\n : undefined,\n wipeKey:\n create.wipeKey != null\n ? Key._fromProtobufKey(create.wipeKey)\n : undefined,\n supplyKey:\n create.supplyKey != null\n ? Key._fromProtobufKey(create.supplyKey)\n : undefined,\n feeScheduleKey:\n create.feeScheduleKey != null\n ? Key._fromProtobufKey(create.feeScheduleKey)\n : undefined,\n freezeDefault:\n create.freezeDefault != null\n ? create.freezeDefault\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? AccountId._fromProtobuf(create.autoRenewAccount)\n : undefined,\n expirationTime:\n create.expiry != null\n ? Timestamp._fromProtobuf(create.expiry)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? Duration._fromProtobuf(create.autoRenewPeriod)\n : undefined,\n tokenMemo: create.memo != null ? create.memo : undefined,\n customFees:\n create.customFees != null\n ? create.customFees.map((fee) => {\n if (fee.fixedFee != null) {\n return CustomFixedFee._fromProtobuf(fee);\n } else if (fee.fractionalFee != null) {\n return CustomFractionalFee._fromProtobuf(fee);\n } else {\n return CustomRoyaltyFee._fromProtobuf(fee);\n }\n })\n : undefined,\n tokenType:\n create.tokenType != null\n ? TokenType._fromCode(create.tokenType)\n : undefined,\n supplyType:\n create.supplyType != null\n ? TokenSupplyType._fromCode(create.supplyType)\n : undefined,\n maxSupply:\n create.maxSupply != null ? create.maxSupply : undefined,\n metadataKey:\n create.metadataKey != null\n ? Key._fromProtobufKey(create.metadataKey)\n : undefined,\n metadata: create.metadata != null ? create.metadata : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?string}\n */\n get tokenName() {\n return this._tokenName;\n }\n\n /**\n * @param {string} name\n * @returns {this}\n */\n setTokenName(name) {\n this._requireNotFrozen();\n this._tokenName = name;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get tokenSymbol() {\n return this._tokenSymbol;\n }\n\n /**\n * @param {string} symbol\n * @returns {this}\n */\n setTokenSymbol(symbol) {\n this._requireNotFrozen();\n this._tokenSymbol = symbol;\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get decimals() {\n return this._decimals;\n }\n\n /**\n * @param {Long | number} decimals\n * @returns {this}\n */\n setDecimals(decimals) {\n this._requireNotFrozen();\n this._decimals =\n decimals instanceof Long ? decimals : Long.fromValue(decimals);\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get initialSupply() {\n return this._initialSupply;\n }\n\n /**\n * @param {Long | number | BigNumber | bigint} initialSupply\n * @returns {this}\n */\n setInitialSupply(initialSupply) {\n this._requireNotFrozen();\n this._initialSupply = convertAmountToLong(initialSupply);\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get treasuryAccountId() {\n return this._treasuryAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setTreasuryAccountId(id) {\n this._requireNotFrozen();\n this._treasuryAccountId =\n typeof id === \"string\" ? AccountId.fromString(id) : id.clone();\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get kycKey() {\n return this._kycKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setKycKey(key) {\n this._requireNotFrozen();\n this._kycKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get freezeKey() {\n return this._freezeKey;\n }\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (\n !this._autoRenewAccountId &&\n this.transactionId?.accountId &&\n this.autoRenewPeriod != null\n ) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (\n !this._autoRenewAccountId &&\n client?.operatorAccountId &&\n this.autoRenewPeriod != null\n ) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFreezeKey(key) {\n this._requireNotFrozen();\n this._freezeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get pauseKey() {\n return this._pauseKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setPauseKey(key) {\n this._requireNotFrozen();\n this._pauseKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get wipeKey() {\n return this._wipeKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setWipeKey(key) {\n this._requireNotFrozen();\n this._wipeKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get supplyKey() {\n return this._supplyKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setSupplyKey(key) {\n this._requireNotFrozen();\n this._supplyKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get feeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setFeeScheduleKey(key) {\n this._requireNotFrozen();\n this._feeScheduleKey = key;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get freezeDefault() {\n return this._freezeDefault;\n }\n\n /**\n * @param {boolean} freeze\n * @returns {this}\n */\n setFreezeDefault(freeze) {\n this._requireNotFrozen();\n this._freezeDefault = freeze;\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n return this._expirationTime;\n }\n\n /**\n * If autoRenewPeriod is set - this value will be ignored and the expiration time will be calculated based on the autoRenewPeriod + time.now()\n * Setting this value will clear the autoRenewPeriod as the autoRenewPeriod period has default value of 7890000 seconds and leaving it set will override the expiration time\n * @param {Timestamp | Date} time\n * @returns {this}\n */\n setExpirationTime(time) {\n this._requireNotFrozen();\n this._expirationTime =\n time instanceof Timestamp ? time : Timestamp.fromDate(time);\n this._autoRenewPeriod = null;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} id\n * @returns {this}\n */\n setAutoRenewAccountId(id) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n id instanceof AccountId ? id : AccountId.fromString(id);\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * If expirationTime is set - autoRenewPeriod will be effectively ignored and it's effect will be replaced by expirationTime\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 {?string}\n */\n get tokenMemo() {\n return this._tokenMemo;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setTokenMemo(memo) {\n this._requireNotFrozen();\n this._tokenMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {CustomFee[]}\n */\n get customFees() {\n return this._customFees;\n }\n\n /**\n * @param {CustomFee[]} customFees\n * @returns {this}\n */\n setCustomFees(customFees) {\n this._customFees = customFees;\n return this;\n }\n\n /**\n * @returns {?TokenType}\n */\n get tokenType() {\n return this._tokenType;\n }\n\n /**\n * @param {TokenType} tokenType\n * @returns {this}\n */\n setTokenType(tokenType) {\n this._tokenType = tokenType;\n return this;\n }\n\n /**\n * @returns {?TokenSupplyType}\n */\n get supplyType() {\n return this._supplyType;\n }\n\n /**\n * @param {TokenSupplyType} supplyType\n * @returns {this}\n */\n setSupplyType(supplyType) {\n this._supplyType = supplyType;\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get maxSupply() {\n return this._maxSupply;\n }\n\n /**\n * @param {Long | number | BigNumber | bigint} maxSupply\n * @returns {this}\n */\n setMaxSupply(maxSupply) {\n this._maxSupply = convertAmountToLong(maxSupply);\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get metadataKey() {\n return this._metadataKey;\n }\n\n /**\n * @param {Key} key\n * @returns {this}\n */\n setMetadataKey(key) {\n this._requireNotFrozen();\n this._metadataKey = key;\n\n return this;\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get metadata() {\n return this._metadata;\n }\n\n /**\n * @param {Uint8Array} metadata\n * @returns {this}\n */\n setMetadata(metadata) {\n this._requireNotFrozen();\n this._metadata = metadata;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._treasuryAccountId != null) {\n this._treasuryAccountId.validateChecksum(client);\n }\n\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.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.token.createToken(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenCreation\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ITokenCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n name: this._tokenName,\n symbol: this._tokenSymbol,\n decimals: this._decimals != null ? this._decimals.toInt() : null,\n initialSupply: this._initialSupply,\n treasury:\n this._treasuryAccountId != null\n ? this._treasuryAccountId._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n kycKey: this._kycKey != null ? this._kycKey._toProtobufKey() : null,\n freezeKey:\n this._freezeKey != null\n ? this._freezeKey._toProtobufKey()\n : null,\n pauseKey:\n this._pauseKey != null ? this._pauseKey._toProtobufKey() : null,\n wipeKey:\n this._wipeKey != null ? this._wipeKey._toProtobufKey() : null,\n supplyKey:\n this._supplyKey != null\n ? this._supplyKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n freezeDefault: this._freezeDefault,\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n expiry:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n autoRenewPeriod:\n this._autoRenewPeriod != null\n ? this._autoRenewPeriod._toProtobuf()\n : null,\n memo: this._tokenMemo,\n customFees: this.customFees.map((fee) => fee._toProtobuf()),\n tokenType: this._tokenType != null ? this._tokenType._code : null,\n supplyType:\n this._supplyType != null ? this._supplyType._code : null,\n maxSupply: this.maxSupply,\n metadataKey:\n this._metadataKey != null\n ? this._metadataKey._toProtobufKey()\n : null,\n metadata: this._metadata != null ? this._metadata : undefined,\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 `TokenCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenCreation\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenCreateTransaction._fromProtobuf,\n);\n"],"names":["TokenCreateTransaction","Transaction","constructor","props","super","this","_tokenName","_tokenSymbol","_decimals","_initialSupply","_treasuryAccountId","_adminKey","_kycKey","_freezeKey","_pauseKey","_wipeKey","_supplyKey","_feeScheduleKey","_freezeDefault","_autoRenewAccountId","_expirationTime","Timestamp","Math","floor","Date","now","DEFAULT_AUTO_RENEW_PERIOD","toNumber","_autoRenewPeriod","Duration","_tokenMemo","_customFees","_tokenType","_supplyType","_maxSupply","_defaultMaxTransactionFee","Hbar","_metadataKey","_metadata","tokenName","setTokenName","tokenSymbol","setTokenSymbol","decimals","setDecimals","initialSupply","setInitialSupply","treasuryAccountId","setTreasuryAccountId","adminKey","setAdminKey","kycKey","setKycKey","freezeKey","setFreezeKey","pauseKey","setPauseKey","wipeKey","setWipeKey","supplyKey","setSupplyKey","feeScheduleKey","setFeeScheduleKey","freezeDefault","setFreezeDefault","autoRenewAccountId","setAutoRenewAccountId","expirationTime","setExpirationTime","autoRenewPeriod","setAutoRenewPeriod","tokenMemo","setTokenMemo","customFees","setCustomFees","tokenType","setTokenType","supplyType","setSupplyType","maxSupply","setMaxSupply","metadataKey","setMetadataKey","metadata","setMetadata","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","name","undefined","symbol","treasury","AccountId","Key","_fromProtobufKey","autoRenewAccount","expiry","memo","map","fee","fixedFee","CustomFixedFee","fractionalFee","CustomFractionalFee","CustomRoyaltyFee","TokenType","_fromCode","TokenSupplyType","_requireNotFrozen","Long","fromValue","convertAmountToLong","id","fromString","clone","key","freezeWith","client","transactionId","accountId","operatorAccountId","freeze","time","fromDate","_validateChecksums","validateChecksum","_execute","channel","request","token","createToken","_getTransactionDataCase","_makeTransactionData","toInt","_toProtobuf","_toProtobufKey","_code","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"qfAyCe,MAAMA,UAA+BC,EA2BhD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,WAAa,KAMlBD,KAAKE,aAAe,KAMpBF,KAAKG,UAAY,KAMjBH,KAAKI,eAAiB,KAMtBJ,KAAKK,mBAAqB,KAM1BL,KAAKM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|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _TokenId = _interopRequireDefault(require("./TokenId.cjs"));
|
|
8
8
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
9
|
-
var _long = _interopRequireDefault(require("long"));
|
|
10
9
|
var hex = _interopRequireWildcard(require("../encoding/hex.cjs"));
|
|
10
|
+
var _util = require("../util.cjs");
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -28,6 +28,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
28
28
|
* @typedef {import("../client/Client.js").default<*, *>} Client
|
|
29
29
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
30
30
|
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
|
|
31
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
31
32
|
*/
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -37,7 +38,7 @@ class TokenMintTransaction extends _Transaction.default {
|
|
|
37
38
|
/**
|
|
38
39
|
* @param {object} [props]
|
|
39
40
|
* @param {TokenId | string} [props.tokenId]
|
|
40
|
-
* @param {Long | number} [props.amount]
|
|
41
|
+
* @param {Long | number | BigNumber | bigint} [props.amount]
|
|
41
42
|
* @param {Uint8Array[]} [props.metadata]
|
|
42
43
|
*/
|
|
43
44
|
constructor(props = {}) {
|
|
@@ -116,12 +117,12 @@ class TokenMintTransaction extends _Transaction.default {
|
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
/**
|
|
119
|
-
* @param {Long | number} amount
|
|
120
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
120
121
|
* @returns {this}
|
|
121
122
|
*/
|
|
122
123
|
setAmount(amount) {
|
|
123
124
|
this._requireNotFrozen();
|
|
124
|
-
this._amount =
|
|
125
|
+
this._amount = (0, _util.convertAmountToLong)(amount);
|
|
125
126
|
return this;
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @typedef {import("../client/Client.js").default<*, *>} Client
|
|
14
14
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
15
15
|
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
|
|
16
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
16
17
|
*/
|
|
17
18
|
/**
|
|
18
19
|
* Mint a new Hedera™ crypto-currency token.
|
|
@@ -31,12 +32,12 @@ export default class TokenMintTransaction extends Transaction {
|
|
|
31
32
|
/**
|
|
32
33
|
* @param {object} [props]
|
|
33
34
|
* @param {TokenId | string} [props.tokenId]
|
|
34
|
-
* @param {Long | number} [props.amount]
|
|
35
|
+
* @param {Long | number | BigNumber | bigint} [props.amount]
|
|
35
36
|
* @param {Uint8Array[]} [props.metadata]
|
|
36
37
|
*/
|
|
37
38
|
constructor(props?: {
|
|
38
39
|
tokenId?: string | TokenId | undefined;
|
|
39
|
-
amount?: number |
|
|
40
|
+
amount?: number | bigint | import("long") | import("bignumber.js").BigNumber | undefined;
|
|
40
41
|
metadata?: Uint8Array<ArrayBufferLike>[] | undefined;
|
|
41
42
|
});
|
|
42
43
|
/**
|
|
@@ -68,10 +69,10 @@ export default class TokenMintTransaction extends Transaction {
|
|
|
68
69
|
*/
|
|
69
70
|
get amount(): Long | null;
|
|
70
71
|
/**
|
|
71
|
-
* @param {Long | number} amount
|
|
72
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
72
73
|
* @returns {this}
|
|
73
74
|
*/
|
|
74
|
-
setAmount(amount: Long | number): this;
|
|
75
|
+
setAmount(amount: Long | number | BigNumber | bigint): this;
|
|
75
76
|
/**
|
|
76
77
|
* @returns {Uint8Array[]}
|
|
77
78
|
*/
|
|
@@ -108,6 +109,6 @@ export type Channel = import("../channel/Channel.js").default;
|
|
|
108
109
|
export type Client = import("../client/Client.js").default<any, any>;
|
|
109
110
|
export type AccountId = import("../account/AccountId.js").default;
|
|
110
111
|
export type TransactionId = import("../transaction/TransactionId.js").default;
|
|
112
|
+
export type BigNumber = import("bignumber.js").default;
|
|
111
113
|
import Transaction from "../transaction/Transaction.js";
|
|
112
114
|
import TokenId from "./TokenId.js";
|
|
113
|
-
import Long from "long";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./TokenId.js";import e,{TRANSACTION_REGISTRY as n}from"../transaction/Transaction.js";import a
|
|
1
|
+
import t from"./TokenId.js";import e,{TRANSACTION_REGISTRY as n}from"../transaction/Transaction.js";import{decode as a}from"../encoding/hex.js";import{convertAmountToLong as o}from"../util.js";class r extends e{constructor(t={}){super(),this._tokenId=null,this._amount=null,this._metadata=[],null!=t.tokenId&&this.setTokenId(t.tokenId),null!=t.amount&&this.setAmount(t.amount),null!=t.metadata&&this.setMetadata(t.metadata)}static _fromProtobuf(n,a,o,s,i){const d=i[0].tokenMint;return e._fromProtobufTransactions(new r({tokenId:null!=d.token?t._fromProtobuf(d.token):void 0,amount:null!=d.amount?d.amount:void 0,metadata:null!=d.metadata?d.metadata:void 0}),n,a,o,s,i)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?t.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(t){return this._requireNotFrozen(),this._amount=o(t),this}_validateChecksums(t){null!=this._tokenId&&this._tokenId.validateChecksum(t)}get metadata(){return this._metadata}addMetadata(t){return this._requireNotFrozen(),"string"==typeof t&&console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead."),this._metadata.push("string"==typeof t?a(t):t),this}setMetadata(t){this._requireNotFrozen();for(const e of t)if("string"==typeof e){console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.");break}return this._metadata=t.map(t=>"string"==typeof t?a(t):t),this}_execute(t,e){return t.token.mintToken(e)}_getTransactionDataCase(){return"tokenMint"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,metadata:this._metadata}}_getLogId(){return`TokenMintTransaction:${this._transactionIds.current.validStart.toString()}`}}n.set("tokenMint",r._fromProtobuf);export{r as default};
|
|
2
2
|
//# sourceMappingURL=TokenMintTransaction.js.map
|