@hiero-ledger/sdk 2.73.1 → 2.74.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 +279 -96
- 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/AccountId.cjs +4 -4
- package/lib/account/AccountId.js +1 -1
- package/lib/account/AccountId.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 +20 -3
- package/lib/client/Client.d.ts +17 -3
- 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/query/MirrorNodeContractQuery.cjs +16 -9
- package/lib/query/MirrorNodeContractQuery.js +1 -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 +12 -8
- package/src/MirrorNode.js +49 -0
- package/src/account/AccountAllowanceApproveTransaction.js +11 -11
- package/src/account/AccountId.js +6 -10
- package/src/account/TokenAllowance.js +5 -2
- package/src/account/TokenTransferMap.js +7 -2
- package/src/client/Client.js +20 -3
- 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/query/MirrorNodeContractQuery.js +17 -19
- 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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* @namespace proto
|
|
3
6
|
* @typedef {import("@hashgraph/proto").proto.ICustomFee} HieroProto.proto.ICustomFee
|
|
@@ -17,13 +20,13 @@ export default class CustomFixedFee extends CustomFee {
|
|
|
17
20
|
* @param {AccountId | string} [props.feeCollectorAccountId]
|
|
18
21
|
* @param {boolean} [props.allCollectorsAreExempt]
|
|
19
22
|
* @param {TokenId | string} [props.denominatingTokenId]
|
|
20
|
-
* @param {Long | number} [props.amount]
|
|
23
|
+
* @param {Long | number | BigNumber | bigint} [props.amount]
|
|
21
24
|
*/
|
|
22
25
|
constructor(props?: {
|
|
23
26
|
feeCollectorAccountId?: string | AccountId | undefined;
|
|
24
27
|
allCollectorsAreExempt?: boolean | undefined;
|
|
25
28
|
denominatingTokenId?: string | TokenId | undefined;
|
|
26
|
-
amount?: number |
|
|
29
|
+
amount?: number | bigint | import("long") | import("bignumber.js").BigNumber | undefined;
|
|
27
30
|
});
|
|
28
31
|
/**
|
|
29
32
|
* @type {?TokenId}
|
|
@@ -60,10 +63,10 @@ export default class CustomFixedFee extends CustomFee {
|
|
|
60
63
|
*/
|
|
61
64
|
get amount(): Long | null;
|
|
62
65
|
/**
|
|
63
|
-
* @param {Long | number} amount
|
|
66
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
64
67
|
* @returns {CustomFixedFee}
|
|
65
68
|
*/
|
|
66
|
-
setAmount(amount: Long | number): CustomFixedFee;
|
|
69
|
+
setAmount(amount: Long | number | BigNumber | bigint): CustomFixedFee;
|
|
67
70
|
/**
|
|
68
71
|
* @internal
|
|
69
72
|
* @abstract
|
|
@@ -71,6 +74,7 @@ export default class CustomFixedFee extends CustomFee {
|
|
|
71
74
|
*/
|
|
72
75
|
_toTopicFeeProtobuf(): HieroProto.proto.IFixedCustomFee;
|
|
73
76
|
}
|
|
77
|
+
export type BigNumber = import("bignumber.js").default;
|
|
74
78
|
export namespace HieroProto {
|
|
75
79
|
namespace proto {
|
|
76
80
|
type ICustomFee = import("@hashgraph/proto").proto.ICustomFee;
|
|
@@ -80,6 +84,5 @@ export namespace HieroProto {
|
|
|
80
84
|
}
|
|
81
85
|
import CustomFee from "./CustomFee.js";
|
|
82
86
|
import TokenId from "./TokenId.js";
|
|
83
|
-
import Long from "long";
|
|
84
87
|
import Hbar from "../Hbar.js";
|
|
85
88
|
import AccountId from "../account/AccountId.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import n from"./TokenId.js";import o from"./CustomFee.js";import t from"../account/AccountId.js";import e from"
|
|
1
|
+
import n from"./TokenId.js";import o from"./CustomFee.js";import t from"../account/AccountId.js";import e from"../Hbar.js";import{convertAmountToLong as i}from"../util.js";class l extends o{constructor(n={}){super(n),this._denominatingTokenId=null,null!=n.denominatingTokenId&&this.setDenominatingTokenId(n.denominatingTokenId),this._amount=null,null!=n.amount&&this.setAmount(n.amount)}setHbarAmount(n){return this._amount=n.toTinybars(),this._denominatingTokenId=null,this}get hbarAmount(){return null!=this._denominatingTokenId?null:e.fromTinybars(null!=this._amount?this._amount:0)}setDenominatingTokenToSameToken(){return this._denominatingTokenId=new n(0,0,0),this}get denominatingTokenId(){return this._denominatingTokenId}setDenominatingTokenId(o){return this._denominatingTokenId="string"==typeof o?n.fromString(o):o,this}get amount(){return this._amount}setAmount(n){return this._amount=i(n),this}static _fromProtobuf(o){const e=o.fixedFee;return new l({feeCollectorAccountId:null!=o.feeCollectorAccountId?t._fromProtobuf(o.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=o.allCollectorsAreExempt?o.allCollectorsAreExempt:void 0,denominatingTokenId:null!=e.denominatingTokenId?n._fromProtobuf(e.denominatingTokenId):void 0,amount:null!=e.amount?e.amount:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}_toTopicFeeProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}}export{l as default};
|
|
2
2
|
//# sourceMappingURL=CustomFixedFee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFixedFee.js","sources":["../../src/token/CustomFixedFee.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport CustomFee from \"./CustomFee.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport
|
|
1
|
+
{"version":3,"file":"CustomFixedFee.js","sources":["../../src/token/CustomFixedFee.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport CustomFee from \"./CustomFee.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Hbar from \"../Hbar.js\";\nimport { convertAmountToLong } from \"../util.js\";\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ICustomFee} HieroProto.proto.ICustomFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFixedFee} HieroProto.proto.IFixedFee\n * @typedef {import(\"@hashgraph/proto\").proto.IFixedCustomFee} HieroProto.proto.IFixedCustomFee\n */\n\nexport default class CustomFixedFee extends CustomFee {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.feeCollectorAccountId]\n * @param {boolean} [props.allCollectorsAreExempt]\n * @param {TokenId | string} [props.denominatingTokenId]\n * @param {Long | number | BigNumber | bigint} [props.amount]\n */\n constructor(props = {}) {\n super(props);\n\n /**\n * @type {?TokenId}\n */\n this._denominatingTokenId = null;\n\n if (props.denominatingTokenId != null) {\n this.setDenominatingTokenId(props.denominatingTokenId);\n }\n\n /**\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n }\n\n /**\n * @param {Hbar} amount\n * @returns {CustomFixedFee}\n */\n setHbarAmount(amount) {\n this._amount = amount.toTinybars();\n this._denominatingTokenId = null;\n return this;\n }\n\n /**\n * @returns {TokenId | Hbar | null}\n */\n get hbarAmount() {\n return this._denominatingTokenId != null\n ? null\n : Hbar.fromTinybars(this._amount != null ? this._amount : 0);\n }\n\n /**\n * @returns {CustomFixedFee}\n */\n setDenominatingTokenToSameToken() {\n this._denominatingTokenId = new TokenId(0, 0, 0);\n return this;\n }\n\n /**\n * @returns {?TokenId}\n */\n get denominatingTokenId() {\n return this._denominatingTokenId;\n }\n\n /**\n * @param {TokenId | string} denominatingTokenId\n * @returns {CustomFixedFee}\n */\n setDenominatingTokenId(denominatingTokenId) {\n this._denominatingTokenId =\n typeof denominatingTokenId === \"string\"\n ? TokenId.fromString(denominatingTokenId)\n : denominatingTokenId;\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 {CustomFixedFee}\n */\n setAmount(amount) {\n this._amount = convertAmountToLong(amount);\n return this;\n }\n\n /**\n * @internal\n * @override\n * @param {HieroProto.proto.ICustomFee} info\n * @returns {CustomFixedFee}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _fromProtobuf(info) {\n const fee = /** @type {HieroProto.proto.IFixedFee} */ (info.fixedFee);\n\n return new CustomFixedFee({\n feeCollectorAccountId:\n info.feeCollectorAccountId != null\n ? AccountId._fromProtobuf(info.feeCollectorAccountId)\n : undefined,\n allCollectorsAreExempt:\n info.allCollectorsAreExempt != null\n ? info.allCollectorsAreExempt\n : undefined,\n denominatingTokenId:\n fee.denominatingTokenId != null\n ? TokenId._fromProtobuf(fee.denominatingTokenId)\n : undefined,\n amount: fee.amount != null ? fee.amount : undefined,\n });\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HieroProto.proto.ICustomFee}\n */\n _toProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n allCollectorsAreExempt: this.allCollectorsAreExempt,\n fixedFee: {\n denominatingTokenId:\n this._denominatingTokenId != null\n ? this._denominatingTokenId._toProtobuf()\n : null,\n amount: this._amount,\n },\n };\n }\n\n /**\n * @internal\n * @abstract\n * @returns {HieroProto.proto.IFixedCustomFee}\n */\n _toTopicFeeProtobuf() {\n return {\n feeCollectorAccountId:\n this.feeCollectorAccountId != null\n ? this.feeCollectorAccountId._toProtobuf()\n : null,\n fixedFee: {\n denominatingTokenId:\n this._denominatingTokenId != null\n ? this._denominatingTokenId._toProtobuf()\n : null,\n amount: this._amount,\n },\n };\n }\n}\n"],"names":["CustomFixedFee","CustomFee","constructor","props","super","this","_denominatingTokenId","denominatingTokenId","setDenominatingTokenId","_amount","amount","setAmount","setHbarAmount","toTinybars","hbarAmount","Hbar","fromTinybars","setDenominatingTokenToSameToken","TokenId","fromString","convertAmountToLong","_fromProtobuf","info","fee","feeCollectorAccountId","AccountId","undefined","allCollectorsAreExempt","_toProtobuf","fixedFee","_toTopicFeeProtobuf"],"mappings":"4KAmBe,MAAMA,UAAuBC,EAQxC,WAAAC,CAAYC,EAAQ,IAChBC,MAAMD,GAKNE,KAAKC,qBAAuB,KAEK,MAA7BH,EAAMI,qBACNF,KAAKG,uBAAuBL,EAAMI,qBAMtCF,KAAKI,QAAU,KAEK,MAAhBN,EAAMO,QACNL,KAAKM,UAAUR,EAAMO,OAEjC,CAMI,aAAAE,CAAcF,GAGV,OAFAL,KAAKI,QAAUC,EAAOG,aACtBR,KAAKC,qBAAuB,KACrBD,IACf,CAKI,cAAIS,GACA,OAAoC,MAA7BT,KAAKC,qBACN,KACAS,EAAKC,aAA6B,MAAhBX,KAAKI,QAAkBJ,KAAKI,QAAU,EACtE,CAKI,+BAAAQ,GAEI,OADAZ,KAAKC,qBAAuB,IAAIY,EAAQ,EAAG,EAAG,GACvCb,IACf,CAKI,uBAAIE,GACA,OAAOF,KAAKC,oBACpB,CAMI,sBAAAE,CAAuBD,GAKnB,OAJAF,KAAKC,qBAC8B,iBAAxBC,EACDW,EAAQC,WAAWZ,GACnBA,EACHF,IACf,CAKI,UAAIK,GACA,OAAOL,KAAKI,OACpB,CAMI,SAAAE,CAAUD,GAEN,OADAL,KAAKI,QAAUW,EAAoBV,GAC5BL,IACf,CASI,oBAAOgB,CAAcC,GACjB,MAAMC,EAAiDD,EAAa,SAEpE,OAAO,IAAItB,EAAe,CACtBwB,sBACkC,MAA9BF,EAAKE,sBACCC,EAAUJ,cAAcC,EAAKE,4BAC7BE,EACVC,uBACmC,MAA/BL,EAAKK,uBACCL,EAAKK,4BACLD,EACVnB,oBAC+B,MAA3BgB,EAAIhB,oBACEW,EAAQG,cAAcE,EAAIhB,0BAC1BmB,EACVhB,OAAsB,MAAda,EAAIb,OAAiBa,EAAIb,YAASgB,GAEtD,CAOI,WAAAE,GACI,MAAO,CACHJ,sBACkC,MAA9BnB,KAAKmB,sBACCnB,KAAKmB,sBAAsBI,cAC3B,KACVD,uBAAwBtB,KAAKsB,uBAC7BE,SAAU,CACNtB,oBACiC,MAA7BF,KAAKC,qBACCD,KAAKC,qBAAqBsB,cAC1B,KACVlB,OAAQL,KAAKI,SAG7B,CAOI,mBAAAqB,GACI,MAAO,CACHN,sBACkC,MAA9BnB,KAAKmB,sBACCnB,KAAKmB,sBAAsBI,cAC3B,KACVC,SAAU,CACNtB,oBACiC,MAA7BF,KAAKC,qBACCD,KAAKC,qBAAqBsB,cAC1B,KACVlB,OAAQL,KAAKI,SAG7B"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _long = _interopRequireDefault(require("long"));
|
|
8
8
|
var _PendingAirdropId = _interopRequireDefault(require("./PendingAirdropId.cjs"));
|
|
9
|
+
var _util = require("../util.cjs");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
12
|
/**
|
|
@@ -13,15 +14,19 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
13
14
|
* @typedef {import("@hashgraph/proto").proto.PendingAirdropRecord} HieroProto.proto.PendingAirdropRecord
|
|
14
15
|
*/
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
19
|
+
*/
|
|
20
|
+
|
|
16
21
|
class PendingAirdropRecord {
|
|
17
22
|
/**
|
|
18
23
|
* @param {object} props
|
|
19
24
|
* @param {PendingAirdropId} props.airdropId
|
|
20
|
-
* @param {Long} props.amount
|
|
25
|
+
* @param {Long | number | BigNumber | bigint} props.amount
|
|
21
26
|
*/
|
|
22
27
|
constructor(props) {
|
|
23
28
|
this.airdropId = props.airdropId;
|
|
24
|
-
this.amount = props.amount;
|
|
29
|
+
this.amount = (0, _util.convertAmountToLong)(props.amount);
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
/**
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
3
|
+
*/
|
|
1
4
|
export default class PendingAirdropRecord {
|
|
2
5
|
/**
|
|
3
6
|
* @param {HieroProto.proto.PendingAirdropRecord} pb
|
|
@@ -7,11 +10,11 @@ export default class PendingAirdropRecord {
|
|
|
7
10
|
/**
|
|
8
11
|
* @param {object} props
|
|
9
12
|
* @param {PendingAirdropId} props.airdropId
|
|
10
|
-
* @param {Long} props.amount
|
|
13
|
+
* @param {Long | number | BigNumber | bigint} props.amount
|
|
11
14
|
*/
|
|
12
15
|
constructor(props: {
|
|
13
16
|
airdropId: PendingAirdropId;
|
|
14
|
-
amount: Long;
|
|
17
|
+
amount: Long | number | BigNumber | bigint;
|
|
15
18
|
});
|
|
16
19
|
airdropId: PendingAirdropId;
|
|
17
20
|
amount: Long;
|
|
@@ -25,5 +28,6 @@ export namespace HieroProto {
|
|
|
25
28
|
type PendingAirdropRecord = import("@hashgraph/proto").proto.PendingAirdropRecord;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
export type BigNumber = import("bignumber.js").default;
|
|
28
32
|
import PendingAirdropId from "./PendingAirdropId.js";
|
|
29
33
|
import Long from "long";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"long";import o from"./PendingAirdropId.js";class
|
|
1
|
+
import r from"long";import o from"./PendingAirdropId.js";import{convertAmountToLong as i}from"../util.js";class t{constructor(r){this.airdropId=r.airdropId,this.amount=i(r.amount)}toBytes(){return{pendingAirdropId:this.airdropId.toBytes(),pendingAirdropValue:{amount:this.amount}}}static fromBytes(i){if(null==i.pendingAirdropId)throw new Error("pendingAirdropId is required");const d=o.fromBytes(i.pendingAirdropId),n=i.pendingAirdropValue?.amount;return new t({airdropId:d,amount:n||r.ZERO})}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=PendingAirdropRecord.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PendingAirdropRecord.js","sources":["../../src/token/PendingAirdropRecord.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.PendingAirdropRecord} HieroProto.proto.PendingAirdropRecord\n */\n\nimport Long from \"long\";\nimport PendingAirdropId from \"./PendingAirdropId.js\";\n\nexport default class PendingAirdropRecord {\n /**\n * @param {object} props\n * @param {PendingAirdropId} props.airdropId\n * @param {Long} props.amount\n */\n constructor(props) {\n this.airdropId = props.airdropId;\n this.amount = props.amount;\n }\n\n /**\n * @returns {HieroProto.proto.PendingAirdropRecord}\n */\n toBytes() {\n return {\n pendingAirdropId: this.airdropId.toBytes(),\n pendingAirdropValue: {\n amount: this.amount,\n },\n };\n }\n\n /**\n * @param {HieroProto.proto.PendingAirdropRecord} pb\n * @returns {PendingAirdropRecord}\n */\n static fromBytes(pb) {\n if (pb.pendingAirdropId == null) {\n throw new Error(\"pendingAirdropId is required\");\n }\n\n const airdropId = PendingAirdropId.fromBytes(pb.pendingAirdropId);\n const amount = pb.pendingAirdropValue?.amount;\n\n return new PendingAirdropRecord({\n airdropId: airdropId,\n amount: amount ? amount : Long.ZERO,\n });\n }\n}\n"],"names":["PendingAirdropRecord","constructor","props","this","airdropId","amount","toBytes","pendingAirdropId","pendingAirdropValue","fromBytes","pb","Error","PendingAirdropId","Long","ZERO"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PendingAirdropRecord.js","sources":["../../src/token/PendingAirdropRecord.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.PendingAirdropRecord} HieroProto.proto.PendingAirdropRecord\n */\n\nimport Long from \"long\";\nimport PendingAirdropId from \"./PendingAirdropId.js\";\nimport { convertAmountToLong } from \"../util.js\";\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\nexport default class PendingAirdropRecord {\n /**\n * @param {object} props\n * @param {PendingAirdropId} props.airdropId\n * @param {Long | number | BigNumber | bigint} props.amount\n */\n constructor(props) {\n this.airdropId = props.airdropId;\n this.amount = convertAmountToLong(props.amount);\n }\n\n /**\n * @returns {HieroProto.proto.PendingAirdropRecord}\n */\n toBytes() {\n return {\n pendingAirdropId: this.airdropId.toBytes(),\n pendingAirdropValue: {\n amount: this.amount,\n },\n };\n }\n\n /**\n * @param {HieroProto.proto.PendingAirdropRecord} pb\n * @returns {PendingAirdropRecord}\n */\n static fromBytes(pb) {\n if (pb.pendingAirdropId == null) {\n throw new Error(\"pendingAirdropId is required\");\n }\n\n const airdropId = PendingAirdropId.fromBytes(pb.pendingAirdropId);\n const amount = pb.pendingAirdropValue?.amount;\n\n return new PendingAirdropRecord({\n airdropId: airdropId,\n amount: amount ? amount : Long.ZERO,\n });\n }\n}\n"],"names":["PendingAirdropRecord","constructor","props","this","airdropId","amount","convertAmountToLong","toBytes","pendingAirdropId","pendingAirdropValue","fromBytes","pb","Error","PendingAirdropId","Long","ZERO"],"mappings":"0GAce,MAAMA,EAMjB,WAAAC,CAAYC,GACRC,KAAKC,UAAYF,EAAME,UACvBD,KAAKE,OAASC,EAAoBJ,EAAMG,OAChD,CAKI,OAAAE,GACI,MAAO,CACHC,iBAAkBL,KAAKC,UAAUG,UACjCE,oBAAqB,CACjBJ,OAAQF,KAAKE,QAG7B,CAMI,gBAAOK,CAAUC,GACb,GAA2B,MAAvBA,EAAGH,iBACH,MAAM,IAAII,MAAM,gCAGpB,MAAMR,EAAYS,EAAiBH,UAAUC,EAAGH,kBAC1CH,EAASM,EAAGF,qBAAqBJ,OAEvC,OAAO,IAAIL,EAAqB,CAC5BI,UAAWA,EACXC,OAAQA,GAAkBS,EAAKC,MAE3C"}
|
|
@@ -30,6 +30,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
30
30
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
31
31
|
* @typedef {import("./NftId.js").default} NftId
|
|
32
32
|
* @typedef {import("./TokenId.js").default} TokenId
|
|
33
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
33
34
|
*/
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -112,7 +113,7 @@ class TokenAirdropTransaction extends _AbstractTokenTransferTransaction.default
|
|
|
112
113
|
*
|
|
113
114
|
* @param {TokenId} tokenId
|
|
114
115
|
* @param {AccountId} accountId
|
|
115
|
-
* @param {Long} amount
|
|
116
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
116
117
|
* @param {number} expectedDecimals
|
|
117
118
|
* @returns {this}
|
|
118
119
|
*/
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
16
16
|
* @typedef {import("./NftId.js").default} NftId
|
|
17
17
|
* @typedef {import("./TokenId.js").default} TokenId
|
|
18
|
+
* @typedef {import("bignumber.js").default} BigNumber
|
|
18
19
|
*/
|
|
19
20
|
/**
|
|
20
21
|
* Airdrop one or more tokens to one or more accounts.
|
|
@@ -91,11 +92,11 @@ export default class TokenAirdropTransaction extends AbstractTokenTransferTransa
|
|
|
91
92
|
*
|
|
92
93
|
* @param {TokenId} tokenId
|
|
93
94
|
* @param {AccountId} accountId
|
|
94
|
-
* @param {Long} amount
|
|
95
|
+
* @param {Long | number | BigNumber | bigint} amount
|
|
95
96
|
* @param {number} expectedDecimals
|
|
96
97
|
* @returns {this}
|
|
97
98
|
*/
|
|
98
|
-
addApprovedTokenTransferWithDecimals(tokenId: TokenId, accountId: AccountId, amount: Long, expectedDecimals: number): this;
|
|
99
|
+
addApprovedTokenTransferWithDecimals(tokenId: TokenId, accountId: AccountId, amount: Long | number | BigNumber | bigint, expectedDecimals: number): this;
|
|
99
100
|
}
|
|
100
101
|
export namespace HieroProto {
|
|
101
102
|
namespace proto {
|
|
@@ -114,6 +115,7 @@ export type TransactionId = import("../transaction/TransactionId.js").default;
|
|
|
114
115
|
export type AccountId = import("../account/AccountId.js").default;
|
|
115
116
|
export type NftId = import("./NftId.js").default;
|
|
116
117
|
export type TokenId = import("./TokenId.js").default;
|
|
118
|
+
export type BigNumber = import("bignumber.js").default;
|
|
117
119
|
import AbstractTokenTransferTransaction from "./AbstractTokenTransferTransaction.js";
|
|
118
120
|
import TokenTransfer from "./TokenTransfer.js";
|
|
119
121
|
import NftTransfer from "./TokenNftTransfer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenAirdropTransaction.js","sources":["../../src/token/TokenAirdropTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport TokenTransfer from \"./TokenTransfer.js\";\nimport NftTransfer from \"./TokenNftTransfer.js\";\nimport AbstractTokenTransferTransaction from \"./AbstractTokenTransferTransaction.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenAirdropTransactionBody} HieroProto.proto.ITokenAirdropTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionID} HieroProto.proto.TransactionID\n * @typedef {import(\"@hashgraph/proto\").proto.AccountID} HieroProto.proto.AccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"./NftId.js\").default} NftId\n * @typedef {import(\"./TokenId.js\").default} TokenId\n */\n\n/**\n * Airdrop one or more tokens to one or more accounts.\n *\n * ### Effects\n * This distributes tokens from the balance of one or more sending account(s)\n * to the balance of one or more recipient accounts. Accounts MAY receive the\n * tokens in one of four ways.\n *\n * - An account already associated to the token to be distributed SHALL\n * receive the airdropped tokens immediately to the recipient account\n * balance.<br/>\n * The fee for this transfer SHALL include the transfer, the airdrop fee,\n * and any custom fees.\n * - An account with available automatic association slots SHALL be\n * automatically associated to the token, and SHALL immediately receive\n * the airdropped tokens to the recipient account balance.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and\n * any custom fees.\n * - An account with \"receiver signature required\" set SHALL have a\n * \"Pending Airdrop\" created and must claim that airdrop with a\n * `claimAirdrop` transaction.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and\n * any custom fees.<br/>\n * If the pending airdrop is not claimed immediately, the `sender` SHALL\n * pay the cost to renew the token association, and the cost to maintain\n * the pending airdrop, until the pending airdrop is claimed or cancelled.\n * - An account with no available automatic association slots SHALL have a\n * \"Pending Airdrop\" created and must claim that airdrop with a\n * `claimAirdrop` transaction.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and any custom\n * fees.<br/>\n * If the pending airdrop is not claimed immediately, the `sender` SHALL\n * pay the cost to renew the token association, and the cost to maintain\n * the pending airdrop, until the pending airdrop is claimed or cancelled.\n *\n * If an airdrop would create a pending airdrop for a fungible/common token,\n * and a pending airdrop for the same sender, receiver, and token already\n * exists, the existing pending airdrop SHALL be updated to add the new\n * amount to the existing airdrop, rather than creating\n * a new pending airdrop.<br/>\n * Any airdrop that completes immediately SHALL be irreversible. Any airdrop\n * that results in a \"Pending Airdrop\" MAY be canceled via a `cancelAirdrop`\n * transaction.<br/>\n * All transfer fees (including custom fees and royalties), as well as the\n * rent cost for the first auto-renewal period for any automatic-association\n * slot occupied by the airdropped tokens, SHALL be charged to the account\n * paying for this transaction.<br/>\n */\nexport default class TokenAirdropTransaction extends AbstractTokenTransferTransaction {\n /**\n * @param {object} props\n * @param {TokenTransfer[]} [props.tokenTransfers]\n * @param {NftTransfer[]} [props.nftTransfers]\n */\n constructor(props = {}) {\n super();\n\n if (props.tokenTransfers != null) {\n for (const tokenTransfer of props.tokenTransfers) {\n this._addTokenTransfer(\n tokenTransfer.tokenId,\n tokenTransfer.accountId,\n tokenTransfer.amount,\n tokenTransfer.isApproved,\n tokenTransfer.expectedDecimals,\n );\n }\n }\n /**\n * @private\n * @type {NftTransfer[]}\n */\n this._nftTransfers = [];\n if (props.nftTransfers != null) {\n for (const nftTransfer of props.nftTransfers) {\n this._addNftTransfer(\n nftTransfer.isApproved,\n nftTransfer.tokenId,\n nftTransfer.serialNumber,\n nftTransfer.senderAccountId,\n nftTransfer.receiverAccountId,\n );\n }\n }\n }\n\n /**\n *\n * @param {TokenId} tokenId\n * @param {AccountId} accountId\n * @param {Long} amount\n * @param {number} expectedDecimals\n * @returns {this}\n */\n addApprovedTokenTransferWithDecimals(\n tokenId,\n accountId,\n amount,\n expectedDecimals,\n ) {\n this._requireNotFrozen();\n this._addTokenTransfer(\n tokenId,\n accountId,\n amount,\n true,\n expectedDecimals,\n );\n return this;\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 {TokenAirdropTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const tokenAirdrop =\n /** @type {HieroProto.proto.ITokenAirdropTransactionBody} */ (\n body.tokenAirdrop\n );\n\n const tokenTransfers = TokenTransfer._fromProtobuf(\n tokenAirdrop.tokenTransfers ?? [],\n );\n const nftTransfers = NftTransfer._fromProtobuf(\n tokenAirdrop.tokenTransfers ?? [],\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenAirdropTransaction({\n nftTransfers: nftTransfers,\n tokenTransfers: tokenTransfers,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\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.airdropTokens(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenAirdrop\";\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 `TokenAirdropTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenAirdrop\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenAirdropTransaction._fromProtobuf,\n);\n"],"names":["TokenAirdropTransaction","AbstractTokenTransferTransaction","constructor","props","super","tokenTransfers","tokenTransfer","this","_addTokenTransfer","tokenId","accountId","amount","isApproved","expectedDecimals","_nftTransfers","nftTransfers","nftTransfer","_addNftTransfer","serialNumber","senderAccountId","receiverAccountId","addApprovedTokenTransferWithDecimals","_requireNotFrozen","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","tokenAirdrop","TokenTransfer","NftTransfer","Transaction","_fromProtobufTransactions","_execute","channel","request","token","airdropTokens","_getTransactionDataCase","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"oMA+Ee,MAAMA,UAAgCC,EAMjD,WAAAC,CAAYC,EAAQ,IAGhB,GAFAC,QAE4B,MAAxBD,EAAME,eACN,IAAK,MAAMC,KAAiBH,EAAME,eAC9BE,KAAKC,kBACDF,EAAcG,QACdH,EAAcI,UACdJ,EAAcK,OACdL,EAAcM,WACdN,EAAcO,kBAS1B,GADAN,KAAKO,cAAgB,GACK,MAAtBX,EAAMY,aACN,IAAK,MAAMC,KAAeb,EAAMY,aAC5BR,KAAKU,gBACDD,EAAYJ,WACZI,EAAYP,QACZO,EAAYE,aACZF,EAAYG,gBACZH,EAAYI,kBAIhC,CAUI,oCAAAC,CACIZ,EACAC,EACAC,EACAE,GAUA,OARAN,KAAKe,oBACLf,KAAKC,kBACDC,EACAC,EACAC,GACA,EACAE,GAEGN,IACf,CAWI,oBAAOgB,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,aAECvB,EAAiByB,EAAcP,cACjCM,EAAaxB,gBAAkB,IAE7BU,EAAegB,EAAYR,cAC7BM,EAAaxB,gBAAkB,IAGnC,OAAO2B,EAAYC,0BACf,IAAIjC,EAAwB,CACxBe,aAAcA,EACdV,eAAgBA,IAEpBmB,EACAC,EACAC,EACAC,EACAC,EAEZ,CASI,QAAAM,CAASC,EAASC,GACd,OAAOD,EAAQE,MAAMC,cAAcF,EAC3C,CAOI,uBAAAG,GACI,MAAO,cACf,CAKI,SAAAC,GAII,MAAO,2BAFHjC,KAAKkC,gBAAgBC,QACxB,WAC2CC,YACpD,EAGAC,EAAqBC,IACjB,eAEA7C,EAAwBuB"}
|
|
1
|
+
{"version":3,"file":"TokenAirdropTransaction.js","sources":["../../src/token/TokenAirdropTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport TokenTransfer from \"./TokenTransfer.js\";\nimport NftTransfer from \"./TokenNftTransfer.js\";\nimport AbstractTokenTransferTransaction from \"./AbstractTokenTransferTransaction.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenAirdropTransactionBody} HieroProto.proto.ITokenAirdropTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionID} HieroProto.proto.TransactionID\n * @typedef {import(\"@hashgraph/proto\").proto.AccountID} HieroProto.proto.AccountID\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n * @typedef {import(\"./NftId.js\").default} NftId\n * @typedef {import(\"./TokenId.js\").default} TokenId\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * Airdrop one or more tokens to one or more accounts.\n *\n * ### Effects\n * This distributes tokens from the balance of one or more sending account(s)\n * to the balance of one or more recipient accounts. Accounts MAY receive the\n * tokens in one of four ways.\n *\n * - An account already associated to the token to be distributed SHALL\n * receive the airdropped tokens immediately to the recipient account\n * balance.<br/>\n * The fee for this transfer SHALL include the transfer, the airdrop fee,\n * and any custom fees.\n * - An account with available automatic association slots SHALL be\n * automatically associated to the token, and SHALL immediately receive\n * the airdropped tokens to the recipient account balance.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and\n * any custom fees.\n * - An account with \"receiver signature required\" set SHALL have a\n * \"Pending Airdrop\" created and must claim that airdrop with a\n * `claimAirdrop` transaction.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and\n * any custom fees.<br/>\n * If the pending airdrop is not claimed immediately, the `sender` SHALL\n * pay the cost to renew the token association, and the cost to maintain\n * the pending airdrop, until the pending airdrop is claimed or cancelled.\n * - An account with no available automatic association slots SHALL have a\n * \"Pending Airdrop\" created and must claim that airdrop with a\n * `claimAirdrop` transaction.<br/>\n * The fee for this transfer SHALL include the transfer, the association,\n * the cost to renew that association once, the airdrop fee, and any custom\n * fees.<br/>\n * If the pending airdrop is not claimed immediately, the `sender` SHALL\n * pay the cost to renew the token association, and the cost to maintain\n * the pending airdrop, until the pending airdrop is claimed or cancelled.\n *\n * If an airdrop would create a pending airdrop for a fungible/common token,\n * and a pending airdrop for the same sender, receiver, and token already\n * exists, the existing pending airdrop SHALL be updated to add the new\n * amount to the existing airdrop, rather than creating\n * a new pending airdrop.<br/>\n * Any airdrop that completes immediately SHALL be irreversible. Any airdrop\n * that results in a \"Pending Airdrop\" MAY be canceled via a `cancelAirdrop`\n * transaction.<br/>\n * All transfer fees (including custom fees and royalties), as well as the\n * rent cost for the first auto-renewal period for any automatic-association\n * slot occupied by the airdropped tokens, SHALL be charged to the account\n * paying for this transaction.<br/>\n */\nexport default class TokenAirdropTransaction extends AbstractTokenTransferTransaction {\n /**\n * @param {object} props\n * @param {TokenTransfer[]} [props.tokenTransfers]\n * @param {NftTransfer[]} [props.nftTransfers]\n */\n constructor(props = {}) {\n super();\n\n if (props.tokenTransfers != null) {\n for (const tokenTransfer of props.tokenTransfers) {\n this._addTokenTransfer(\n tokenTransfer.tokenId,\n tokenTransfer.accountId,\n tokenTransfer.amount,\n tokenTransfer.isApproved,\n tokenTransfer.expectedDecimals,\n );\n }\n }\n /**\n * @private\n * @type {NftTransfer[]}\n */\n this._nftTransfers = [];\n if (props.nftTransfers != null) {\n for (const nftTransfer of props.nftTransfers) {\n this._addNftTransfer(\n nftTransfer.isApproved,\n nftTransfer.tokenId,\n nftTransfer.serialNumber,\n nftTransfer.senderAccountId,\n nftTransfer.receiverAccountId,\n );\n }\n }\n }\n\n /**\n *\n * @param {TokenId} tokenId\n * @param {AccountId} accountId\n * @param {Long | number | BigNumber | bigint} amount\n * @param {number} expectedDecimals\n * @returns {this}\n */\n addApprovedTokenTransferWithDecimals(\n tokenId,\n accountId,\n amount,\n expectedDecimals,\n ) {\n this._requireNotFrozen();\n this._addTokenTransfer(\n tokenId,\n accountId,\n amount,\n true,\n expectedDecimals,\n );\n return this;\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 {TokenAirdropTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const tokenAirdrop =\n /** @type {HieroProto.proto.ITokenAirdropTransactionBody} */ (\n body.tokenAirdrop\n );\n\n const tokenTransfers = TokenTransfer._fromProtobuf(\n tokenAirdrop.tokenTransfers ?? [],\n );\n const nftTransfers = NftTransfer._fromProtobuf(\n tokenAirdrop.tokenTransfers ?? [],\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenAirdropTransaction({\n nftTransfers: nftTransfers,\n tokenTransfers: tokenTransfers,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\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.airdropTokens(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenAirdrop\";\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 `TokenAirdropTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenAirdrop\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenAirdropTransaction._fromProtobuf,\n);\n"],"names":["TokenAirdropTransaction","AbstractTokenTransferTransaction","constructor","props","super","tokenTransfers","tokenTransfer","this","_addTokenTransfer","tokenId","accountId","amount","isApproved","expectedDecimals","_nftTransfers","nftTransfers","nftTransfer","_addNftTransfer","serialNumber","senderAccountId","receiverAccountId","addApprovedTokenTransferWithDecimals","_requireNotFrozen","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","tokenAirdrop","TokenTransfer","NftTransfer","Transaction","_fromProtobufTransactions","_execute","channel","request","token","airdropTokens","_getTransactionDataCase","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"oMAgFe,MAAMA,UAAgCC,EAMjD,WAAAC,CAAYC,EAAQ,IAGhB,GAFAC,QAE4B,MAAxBD,EAAME,eACN,IAAK,MAAMC,KAAiBH,EAAME,eAC9BE,KAAKC,kBACDF,EAAcG,QACdH,EAAcI,UACdJ,EAAcK,OACdL,EAAcM,WACdN,EAAcO,kBAS1B,GADAN,KAAKO,cAAgB,GACK,MAAtBX,EAAMY,aACN,IAAK,MAAMC,KAAeb,EAAMY,aAC5BR,KAAKU,gBACDD,EAAYJ,WACZI,EAAYP,QACZO,EAAYE,aACZF,EAAYG,gBACZH,EAAYI,kBAIhC,CAUI,oCAAAC,CACIZ,EACAC,EACAC,EACAE,GAUA,OARAN,KAAKe,oBACLf,KAAKC,kBACDC,EACAC,EACAC,GACA,EACAE,GAEGN,IACf,CAWI,oBAAOgB,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,aAECvB,EAAiByB,EAAcP,cACjCM,EAAaxB,gBAAkB,IAE7BU,EAAegB,EAAYR,cAC7BM,EAAaxB,gBAAkB,IAGnC,OAAO2B,EAAYC,0BACf,IAAIjC,EAAwB,CACxBe,aAAcA,EACdV,eAAgBA,IAEpBmB,EACAC,EACAC,EACAC,EACAC,EAEZ,CASI,QAAAM,CAASC,EAASC,GACd,OAAOD,EAAQE,MAAMC,cAAcF,EAC3C,CAOI,uBAAAG,GACI,MAAO,cACf,CAKI,SAAAC,GAII,MAAO,2BAFHjC,KAAKkC,gBAAgBC,QACxB,WAC2CC,YACpD,EAGAC,EAAqBC,IACjB,eAEA7C,EAAwBuB"}
|
|
@@ -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,KAAKE,QAAU,KAMfF,KAAKG,SAAW,GAEK,MAAjBL,EAAMM,SACNJ,KAAKK,WAAWP,EAAMM,SAGN,MAAhBN,EAAMQ,QACNN,KAAKO,UAAUT,EAAMQ,QAGJ,MAAjBR,EAAMU,SACNR,KAAKS,WAAWX,EAAMU,QAElC,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,UAEL,OAAOnB,EAAYqB,0BACf,IAAItB,EAAqB,CACrBS,QACuB,MAAnBY,EAAUE,MACJC,EAAQT,cAAcM,EAAUE,YAChCE,EACVd,OAA4B,MAApBU,EAAUV,OAAiBU,EAAUV,YAASc,EACtDZ,QAC+B,MAA3BQ,EAAUK,cACJL,EAAUK,mBACVD,IAEdT,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,WAAIX,GACA,OAAOJ,KAAKC,QACpB,CAMI,UAAAI,CAAWD,GAOP,OANAJ,KAAKsB,oBACLtB,KAAKC,SACkB,iBAAZG,EACDe,EAAQI,WAAWnB,GACnBA,EAAQoB,QAEXxB,IACf,CAKI,UAAIM,GACA,OAAON,KAAKE,OACpB,CAMI,SAAAK,CAAUD,GAIN,OAHAN,KAAKsB,oBACLtB,KAAKE,QAAUuB,EAAoBnB,GAE5BN,IACf,CAKI,kBAAA0B,CAAmBC,GACM,MAAjB3B,KAAKC,UACLD,KAAKC,SAAS2B,iBAAiBD,EAE3C,CAKI,WAAInB,GACA,OAAOR,KAAKG,QACpB,CAMI,UAAAM,CAAWD,GAMP,OALAR,KAAKsB,oBACLtB,KAAKG,SAAWK,EAAQqB,IAAKC,GACzBA,aAAkBC,EAAOD,EAASC,EAAKC,UAAUF,IAG9C9B,IACf,CASI,QAAAiC,CAASC,EAASC,GACd,OAAOD,EAAQhB,MAAMF,UAAUmB,EACvC,CAOI,uBAAAC,GACI,MAAO,WACf,CAOI,oBAAAC,GACI,MAAO,CACH/B,OAAQN,KAAKE,QACbmB,cAAerB,KAAKG,SACpBe,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
|