@tatumio/tron 2.0.1-alpha.331 → 2.0.1-alpha.333

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@tatumio/tron",
3
- "version": "2.0.1-alpha.331",
3
+ "version": "2.0.1-alpha.333",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
8
8
  "dependencies": {
9
- "@tatumio/shared-testing-common": "2.0.1-alpha.331",
10
- "@tatumio/api-client": "2.0.1-alpha.331",
9
+ "@tatumio/shared-testing-common": "2.0.1-alpha.333",
10
+ "@tatumio/api-client": "2.0.1-alpha.333",
11
11
  "axios": "^0.26.0",
12
12
  "form-data": "^4.0.0",
13
- "@tatumio/shared-blockchain-evm-based": "2.0.1-alpha.331",
14
- "@tatumio/shared-abstract-sdk": "2.0.1-alpha.331",
13
+ "@tatumio/shared-blockchain-evm-based": "2.0.1-alpha.333",
14
+ "@tatumio/shared-abstract-sdk": "2.0.1-alpha.333",
15
15
  "bignumber.js": "^9.0.2",
16
- "@tatumio/shared-core": "2.0.1-alpha.331",
17
- "@tatumio/shared-blockchain-abstract": "2.0.1-alpha.331",
16
+ "@tatumio/shared-core": "2.0.1-alpha.333",
17
+ "@tatumio/shared-blockchain-abstract": "2.0.1-alpha.333",
18
18
  "ethereumjs-wallet": "^1.0.2",
19
19
  "bip39": "^3.0.2",
20
20
  "web3": "^1.7.4",
package/src/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export * from './lib/tron.sdk';
2
+ export * from './lib/services/tron.tx';
3
+ export * from './lib/services/tron.wallet';
4
+ export * from './lib/services/tron.trc20';
package/src/index.js CHANGED
@@ -2,4 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./lib/tron.sdk"), exports);
5
+ tslib_1.__exportStar(require("./lib/services/tron.tx"), exports);
6
+ tslib_1.__exportStar(require("./lib/services/tron.wallet"), exports);
7
+ tslib_1.__exportStar(require("./lib/services/tron.trc20"), exports);
5
8
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/tron/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/blockchain/tron/src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B;AAC9B,iEAAsC;AACtC,qEAA0C;AAC1C,oEAAyC"}
@@ -1,5 +1,9 @@
1
- import { GenerateCustodialWalletTron, GenerateCustodialWalletTronKMS, TransferCustodialWalletBatchTron, TransferCustodialWalletBatchTronKMS, TransferCustodialWalletTron, TransferCustodialWalletTronKMS } from '@tatumio/api-client';
1
+ import { TransferCustodialWalletBatchTron, TransferCustodialWalletTron } from '@tatumio/api-client';
2
2
  import { ITronWeb } from './tron.web';
3
+ import { FromPrivateKeyOrSignatureIdTron } from '@tatumio/shared-blockchain-abstract';
4
+ import { TronGenerateCustodialWallet } from './tron.tx';
5
+ declare type TronTransferCustodial = FromPrivateKeyOrSignatureIdTron<TransferCustodialWalletTron>;
6
+ declare type TronTransferBatchCustodial = FromPrivateKeyOrSignatureIdTron<TransferCustodialWalletBatchTron>;
3
7
  export declare const tronCustodial: (args: {
4
8
  tronWeb: ITronWeb;
5
9
  }) => {
@@ -12,7 +16,7 @@ export declare const tronCustodial: (args: {
12
16
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
13
17
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
14
18
  */
15
- custodialWallet: (body: GenerateCustodialWalletTron | GenerateCustodialWalletTronKMS, provider?: string) => Promise<string>;
19
+ custodialWallet: (body: TronGenerateCustodialWallet, provider?: string) => Promise<string>;
16
20
  /**
17
21
  * Prepare signed transaction from the custodial SC wallet.
18
22
  * @param testnet chain to work with
@@ -20,7 +24,7 @@ export declare const tronCustodial: (args: {
20
24
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
21
25
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
22
26
  */
23
- transferFromCustodialWallet: (body: TransferCustodialWalletTron | TransferCustodialWalletTronKMS, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
27
+ transferFromCustodialWallet: (body: TronTransferCustodial, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
24
28
  /**
25
29
  * Prepare signed batch transaction from the custodial SC wallet.
26
30
  * @param testnet chain to work with
@@ -28,7 +32,7 @@ export declare const tronCustodial: (args: {
28
32
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
29
33
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
30
34
  */
31
- batchTransferFromCustodialWallet: (body: TransferCustodialWalletBatchTron | TransferCustodialWalletBatchTronKMS, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
35
+ batchTransferFromCustodialWallet: (body: TronTransferBatchCustodial, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
32
36
  };
33
37
  send: {
34
38
  /**
@@ -38,7 +42,7 @@ export declare const tronCustodial: (args: {
38
42
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
39
43
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
40
44
  */
41
- custodialWallet: (body: GenerateCustodialWalletTron | GenerateCustodialWalletTronKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
45
+ custodialWallet: (body: TronGenerateCustodialWallet, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").CustodialManagedAddress>;
42
46
  /**
43
47
  * Send signed transaction from the custodial SC wallet.
44
48
  * @param testnet chain to work with
@@ -46,7 +50,7 @@ export declare const tronCustodial: (args: {
46
50
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
47
51
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
48
52
  */
49
- transferFromCustodialWallet: (body: TransferCustodialWalletTron | TransferCustodialWalletTronKMS, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<import("@tatumio/api-client").TransactionHash>;
53
+ transferFromCustodialWallet: (body: TronTransferCustodial, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
50
54
  /**
51
55
  * Send signed batch transaction from the custodial SC wallet.
52
56
  * @param testnet chain to work with
@@ -54,6 +58,7 @@ export declare const tronCustodial: (args: {
54
58
  * @param provider optional provider to enter. if not present, Tatum Web3 will be used.
55
59
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
56
60
  */
57
- batchTransferFromCustodialWallet: (body: TransferCustodialWalletBatchTron | TransferCustodialWalletBatchTronKMS, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<import("@tatumio/api-client").TransactionHash>;
61
+ batchTransferFromCustodialWallet: (body: TronTransferBatchCustodial, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
58
62
  };
59
63
  };
64
+ export {};
@@ -108,9 +108,14 @@ const tronCustodial = (args) => {
108
108
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
109
109
  */
110
110
  transferFromCustodialWallet: (body, getContractDecimals, provider, decimals = 18, testnet = false) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
111
- return api_client_1.TronService.tronBroadcast({
112
- txData: yield prepareTransferFromCustodialWallet(body, getContractDecimals, args.tronWeb, provider, decimals, testnet),
113
- });
111
+ if (body.signatureId) {
112
+ return api_client_1.GasPumpService.transferCustodialWallet(body);
113
+ }
114
+ else {
115
+ return api_client_1.TronService.tronBroadcast({
116
+ txData: yield prepareTransferFromCustodialWallet(body, getContractDecimals, args.tronWeb, provider, decimals, testnet),
117
+ });
118
+ }
114
119
  }),
115
120
  /**
116
121
  * Send signed batch transaction from the custodial SC wallet.
@@ -120,9 +125,14 @@ const tronCustodial = (args) => {
120
125
  * @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
121
126
  */
122
127
  batchTransferFromCustodialWallet: (body, getContractDecimals, provider, decimals = 6, testnet = false) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
123
- return api_client_1.TronService.tronBroadcast({
124
- txData: yield prepareBatchTransferFromCustodialWallet(body, getContractDecimals, args.tronWeb, provider, decimals, testnet),
125
- });
128
+ if (body.signatureId) {
129
+ return api_client_1.GasPumpService.transferCustodialWalletBatch(body);
130
+ }
131
+ else {
132
+ return api_client_1.TronService.tronBroadcast({
133
+ txData: yield prepareBatchTransferFromCustodialWallet(body, getContractDecimals, args.tronWeb, provider, decimals, testnet),
134
+ });
135
+ }
126
136
  }),
127
137
  },
128
138
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tron.custodial.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.custodial.ts"],"names":[],"mappings":";;;;AAAA,oDAU4B;AAE5B,uCAAkC;AAClC,sFAA+E;AAC/E,wEAAoC;AAEpC,MAAM,0BAA0B,GAAG,CAAC,CAAA;AACpC,MAAM,gCAAgC,GAAG,CAAC,CAAA;AAC1C,MAAM,4BAA4B,GAAG,CAAC,CAAA;AAEtC,MAAM,kCAAkC,GAAG,CACzC,IAAkE,EAClE,mB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AAI,CAAC,OAAO,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;iBACF,CAAC,CAAA;cAAA;YACJ;;;;;;eAMG;YACH,gCAAgC,EAAE,CAChC,IAA4E,EAC5E,mBAIoB,EACpB,QAAiB,EACjB,QAAQ,GAAG,CAAC,EACZ,OAAO,GAAG,KAAK,EACf,EAAE;gBACF,OAAA,wBAAW,CAAC,aAAa,CAAC;oBACxB,MAAM,EAAE,MAAM,uCAAuC,CACnD,IAAI,EACJ,mBAAmB,EACnB,IAAI,CAAC,OAAO,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;iBACF,CAAC,CAAA;cAAA;SACL;KACF,CAAA;AACH,CAAC,CAAA;AA1IY,QAAA,aAAa,iBA0IzB"}
1
+ {"version":3,"file":"tron.custodial.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.custodial.ts"],"names":[],"mappings":";;;;AAAA,oDAO4B;AAE5B,uCAAkC;AAClC,sFAA+E;AAC/E,wEAAoC;AAIpC,MAAM,0BAA0B,GAAG,CAAC,CAAA;AACpC,MAAM,gCAAgC,GAAG,CAAC,CAAA;AAC1C,MAAM,4BAA4B,GAAG,CAAC,CAAA;AAKtC,MAAM,kCAAkC,GAAG,CACzC,IAA2B,EAC3B,mBAAuG,EACvG,OAAiB,EACjB,QAAiB,EACjB,QAAQ,GAAG,EAAE,EACb,OAAO,GAAG,KAAK,EACf,EAAE;;IACF,MAAM,UAAU,GAAG,UAAU,CAAA;IAE7B,IAAI,OAAO,GAAG,IAAI,sBAAS,CAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,CAAC,CAAC,CAAA;IAC9C,IAAI,MAAM,GAAG,IAAI,sBAAS,CAAC,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,CAAC,CAAA;IAC5C,IAAI,IAAI,CAAC,YAAY,KAAK,0BAA0B,EAAE;QACpD,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,sBAAS,CAAC,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IAA2C,CAAC,CAAA;iBAChG;qBAAM;oBACL,OAAO,wBAAW,CAAC,aAAa,CAAC;wBAC/B,MAAM,EAAE,MAAM,uCAAuC,CACnD,IAAI,EACJ,mBAAmB,EACnB,IAAI,CAAC,OAAO,EACZ,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;qBACF,CAAC,CAAA;iBACH;YACH,CAAC,CAAA;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAjJY,QAAA,aAAa,iBAiJzB"}
@@ -1,5 +1,8 @@
1
- import { CreateTronTrc10Blockchain, CreateTronTrc10BlockchainKMS, TransferTronTrc10Blockchain, TransferTronTrc10BlockchainKMS } from '@tatumio/api-client';
1
+ import { CreateTronTrc10Blockchain, TransferTronTrc10Blockchain } from '@tatumio/api-client';
2
+ import { FromPrivateKeyOrSignatureIdTron } from '@tatumio/shared-blockchain-abstract';
2
3
  import { ITronWeb } from './tron.web';
4
+ declare type TronTransferTrc10 = FromPrivateKeyOrSignatureIdTron<TransferTronTrc10Blockchain>;
5
+ declare type TronCreateTrc10 = FromPrivateKeyOrSignatureIdTron<CreateTronTrc10Blockchain>;
3
6
  export declare const tronTrc10: (args: {
4
7
  tronWeb: ITronWeb;
5
8
  }) => {
@@ -11,13 +14,13 @@ export declare const tronTrc10: (args: {
11
14
  * @param precision
12
15
  * @returns transaction data to be broadcast to blockchain.
13
16
  */
14
- signedTransaction: (body: TransferTronTrc10Blockchain | TransferTronTrc10BlockchainKMS, precision?: number, provider?: string) => Promise<string>;
17
+ signedTransaction: (body: TronTransferTrc10, precision?: number, provider?: string) => Promise<string>;
15
18
  /**
16
19
  * Sign create Tron TRC10 transaction with private keys locally. Nothing is broadcast to the blockchain.
17
20
  * @param body content of the transaction to broadcast
18
21
  * @returns transaction data to be broadcast to blockchain.
19
22
  */
20
- createSignedTransaction: (body: CreateTronTrc10Blockchain | CreateTronTrc10BlockchainKMS, provider?: string) => Promise<string>;
23
+ createSignedTransaction: (body: TronCreateTrc10, provider?: string) => Promise<string>;
21
24
  };
22
25
  send: {
23
26
  /**
@@ -27,13 +30,14 @@ export declare const tronTrc10: (args: {
27
30
  * @param body content of the transaction to broadcast
28
31
  * @returns transaction id of the transaction in the blockchain
29
32
  */
30
- signedTransaction: (body: TransferTronTrc10Blockchain | TransferTronTrc10BlockchainKMS, precision?: number, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
33
+ signedTransaction: (body: TronTransferTrc10, precision?: number, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
31
34
  /**
32
35
  * Create Tron TRC10 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
33
36
  * This operation is irreversible.
34
37
  * @param body content of the transaction to broadcast
35
38
  * @returns transaction id of the transaction in the blockchain
36
39
  */
37
- createSignedTransaction: (body: CreateTronTrc10Blockchain | CreateTronTrc10BlockchainKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
40
+ createSignedTransaction: (body: TronCreateTrc10, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
38
41
  };
39
42
  };
43
+ export {};
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tronTrc10 = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const api_client_1 = require("@tatumio/api-client");
6
- const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk");
7
6
  const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
7
+ // TODO: do a balance check before sending tx - https://app.clickup.com/t/24443045/TT-3496
8
8
  const prepareSignedTransaction = (body, tronWeb, precision, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
9
  const { to, tokenId, amount } = body;
10
10
  const client = tronWeb.getClient(provider);
11
- const definedPrecision = precision !== null && precision !== void 0 ? precision : (yield api_client_1.TronService.tronTrc10Detail(Number.parseInt(tokenId))).precision;
11
+ const definedPrecision = precision !== null && precision !== void 0 ? precision : (yield api_client_1.TronService.tronTrc10Detail(tokenId)).precision;
12
12
  if (!definedPrecision) {
13
13
  throw new Error('Unable to obtain precision');
14
14
  }
15
- if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
15
+ if (body.signatureId) {
16
16
  const tx = yield client.transactionBuilder.sendToken(to, new bignumber_js_1.default(amount).multipliedBy(new bignumber_js_1.default(10).pow(definedPrecision)), tokenId, body.from);
17
17
  return JSON.stringify(tx);
18
18
  }
@@ -40,7 +40,7 @@ const prepareCreateSignedTransaction = (body, tronWeb, provider) => tslib_1.__aw
40
40
  frozenDuration: 0,
41
41
  precision: decimals,
42
42
  };
43
- if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
43
+ if (body.signatureId) {
44
44
  const tx = yield client.transactionBuilder.createToken(createTokenParams, body.from);
45
45
  return JSON.stringify(tx);
46
46
  }
@@ -76,10 +76,14 @@ const tronTrc10 = (args) => {
76
76
  * @returns transaction id of the transaction in the blockchain
77
77
  */
78
78
  signedTransaction: (body, precision, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
79
- return api_client_1.TronService.tronBroadcast({
80
- txData: yield prepareSignedTransaction(body, args.tronWeb, precision, provider),
81
- // TODO: SignatureID is missing in OpenApi
82
- });
79
+ if (body.signatureId) {
80
+ return api_client_1.TronService.tronTransferTrc10(body);
81
+ }
82
+ else {
83
+ return api_client_1.TronService.tronBroadcast({
84
+ txData: yield prepareSignedTransaction(body, args.tronWeb, precision, provider),
85
+ });
86
+ }
83
87
  }),
84
88
  /**
85
89
  * Create Tron TRC10 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
@@ -88,10 +92,14 @@ const tronTrc10 = (args) => {
88
92
  * @returns transaction id of the transaction in the blockchain
89
93
  */
90
94
  createSignedTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
91
- return api_client_1.TronService.tronBroadcast({
92
- txData: yield prepareCreateSignedTransaction(body, args.tronWeb, provider),
93
- // TODO: SignatureID is missing in OpenApi
94
- });
95
+ if (body.signatureId) {
96
+ return api_client_1.TronService.tronCreateTrc10(body);
97
+ }
98
+ else {
99
+ return api_client_1.TronService.tronBroadcast({
100
+ txData: yield prepareCreateSignedTransaction(body, args.tronWeb, provider),
101
+ });
102
+ }
95
103
  }),
96
104
  },
97
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tron.trc10.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.trc10.ts"],"names":[],"mappings":";;;;AAAA,oDAM4B;AAC5B,sEAAgE;AAChE,wEAAoC;AAGpC,MAAM,wBAAwB,GAAG,CAC/B,IAAkE,EAClE,OAAiB,EACjB,SAAkB,EAClB,QAAiB,EACjB,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAEpC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAE1C,MAAM,gBAAgB,GACpB,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,CAAC,MAAM,wBAAW,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEtF,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;KAC9C;IAED,IAAI,IAAA,uCAAiB,EAAC,IAAI,CAAC,EAAE;QAC3B,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAClD,EAAE,EACF,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAC3E,OAAO,EACP,IAAI,CAAC,IAAI,CACV,CAAA;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;KAC1B;SAAM;QACL,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAClD,EAAE,EACF,I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ACvB,IAA8D,EAC9D,QAAiB,EACjB,EAAE;gBACF,OAAA,wBAAW,CAAC,aAAa,CAAC;oBACxB,MAAM,EAAE,MAAM,8BAA8B,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;oBAC1E,0CAA0C;iBAC3C,CAAC,CAAA;cAAA;SACL;KACF,CAAA;AACH,CAAC,CAAA;AA1DY,QAAA,SAAS,aA0DrB"}
1
+ {"version":3,"file":"tron.trc10.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.trc10.ts"],"names":[],"mappings":";;;;AAAA,oDAM4B;AAE5B,wEAAoC;AAMpC,0FAA0F;AAC1F,MAAM,wBAAwB,GAAG,CAC/B,IAAuB,EACvB,OAAiB,EACjB,SAAkB,EAClB,QAAiB,EACjB,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAEpC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAE1C,MAAM,gBAAgB,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,CAAC,MAAM,wBAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;IAE5F,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;KAC9C;IAED,IAAI,IAAI,CAAC,WAAW,EAAE;QACpB,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAClD,EAAE,EACF,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,IAAI,sBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAC3E,OAAO,EACP,IAAI,CAAC,IAAI,CACV,CAAA;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;KAC1B;SAAM;QACL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B,MAAM,EAAE,MAAM,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;qBAChF,CAAC,CAAA;iBACH;YACH,CAAC,CAAA;YACD;;;;;eAKG;YACH,uBAAuB,EAAE,CAAO,IAAqB,EAAE,QAAiB,EAAE,EAAE;gBAC1E,IAAI,IAAI,CAAC,WAAW,EAAE;oBACpB,OAAO,wBAAW,CAAC,eAAe,CAAC,IAAoC,CAAC,CAAA;iBACzE;qBAAM;oBACL,OAAO,wBAAW,CAAC,aAAa,CAAC;wBAC/B,MAAM,EAAE,MAAM,8BAA8B,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;qBAC3E,CAAC,CAAA;iBACH;YACH,CAAC,CAAA;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAtDY,QAAA,SAAS,aAsDrB"}
@@ -1,5 +1,8 @@
1
- import { CreateTronTrc20Blockchain, CreateTronTrc20BlockchainKMS, TransferTronTrc20Blockchain, TransferTronTrc20BlockchainKMS } from '@tatumio/api-client';
1
+ import { CreateTronTrc20Blockchain, TransferTronTrc20Blockchain } from '@tatumio/api-client';
2
2
  import { ITronWeb } from './tron.web';
3
+ import { FromPrivateKeyOrSignatureIdTron } from '@tatumio/shared-blockchain-abstract';
4
+ declare type TransferTronTrc20 = FromPrivateKeyOrSignatureIdTron<TransferTronTrc20Blockchain>;
5
+ declare type CreateTronTrc20 = FromPrivateKeyOrSignatureIdTron<CreateTronTrc20Blockchain>;
3
6
  export declare const tronTrc20: (args: {
4
7
  tronWeb: ITronWeb;
5
8
  }) => {
@@ -17,14 +20,14 @@ export declare const tronTrc20: (args: {
17
20
  * @param body content of the transaction to broadcast
18
21
  * @returns transaction data to be broadcast to blockchain.
19
22
  */
20
- signedTransaction: (body: TransferTronTrc20Blockchain | TransferTronTrc20BlockchainKMS, provider?: string) => Promise<string>;
23
+ signedTransaction: (body: TransferTronTrc20, provider?: string) => Promise<string>;
21
24
  /**
22
25
  * Prepare create Tron TRC20 transaction for KMS. Nothing is broadcast to the blockchain.
23
26
  * @param body content of the transaction to broadcast
24
27
  * @param provider
25
28
  * @returns transaction data to be broadcast to blockchain.
26
29
  */
27
- createSignedTransaction: (body: CreateTronTrc20Blockchain | CreateTronTrc20BlockchainKMS, provider?: string) => Promise<string>;
30
+ createSignedTransaction: (body: CreateTronTrc20, provider?: string) => Promise<string>;
28
31
  };
29
32
  send: {
30
33
  /**
@@ -33,13 +36,14 @@ export declare const tronTrc20: (args: {
33
36
  * @param body content of the transaction to broadcast
34
37
  * @returns transaction id of the transaction in the blockchain
35
38
  */
36
- signedTransaction: (body: TransferTronTrc20Blockchain | TransferTronTrc20BlockchainKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
39
+ signedTransaction: (body: TransferTronTrc20, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
37
40
  /**
38
41
  * Create Tron TRC20 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
39
42
  * This operation is irreversible.
40
43
  * @param body content of the transaction to broadcast
41
44
  * @returns transaction id of the transaction in the blockchain
42
45
  */
43
- createSignedTransaction: (body: CreateTronTrc20Blockchain | CreateTronTrc20BlockchainKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
46
+ createSignedTransaction: (body: CreateTronTrc20, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
44
47
  };
45
48
  };
49
+ export {};
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const api_client_1 = require("@tatumio/api-client");
6
6
  const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
7
7
  const shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
8
- const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk");
8
+ // TODO: do a balance check before sending tx - https://app.clickup.com/t/24443045/TT-3496
9
9
  const prepareSignedTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
10
10
  const { to, tokenAddress, amount, feeLimit } = body;
11
11
  const client = tronWeb.getClient(provider);
@@ -22,7 +22,7 @@ const prepareSignedTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(
22
22
  },
23
23
  ];
24
24
  const feeLimitSun = client.toSun(feeLimit);
25
- if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
25
+ if (body.signatureId) {
26
26
  const { transaction } = yield client.transactionBuilder.triggerSmartContract(tokenAddressHex, methodName, {
27
27
  feeLimit: feeLimitSun,
28
28
  from: body.from,
@@ -50,7 +50,7 @@ const prepareCreateSignedTransaction = (body, tronWeb, provider) => tslib_1.__aw
50
50
  parameters: [name, symbol, decimals, client.address.toHex(recipient), totalSupply],
51
51
  name,
52
52
  };
53
- if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
53
+ if (body.signatureId) {
54
54
  const tx = yield client.transactionBuilder.createSmartContract(params, body.from);
55
55
  return JSON.stringify(tx);
56
56
  }
@@ -104,10 +104,14 @@ const tronTrc20 = (args) => {
104
104
  * @returns transaction id of the transaction in the blockchain
105
105
  */
106
106
  signedTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
107
- return api_client_1.TronService.tronBroadcast({
108
- txData: yield prepareSignedTransaction(body, args.tronWeb, provider),
109
- // TODO: SignatureID is missing in OpenApi
110
- });
107
+ if (body.signatureId) {
108
+ return api_client_1.TronService.tronTransferTrc20(body);
109
+ }
110
+ else {
111
+ return api_client_1.TronService.tronBroadcast({
112
+ txData: yield prepareSignedTransaction(body, args.tronWeb, provider),
113
+ });
114
+ }
111
115
  }),
112
116
  /**
113
117
  * Create Tron TRC20 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
@@ -116,10 +120,14 @@ const tronTrc20 = (args) => {
116
120
  * @returns transaction id of the transaction in the blockchain
117
121
  */
118
122
  createSignedTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
119
- return api_client_1.TronService.tronBroadcast({
120
- txData: yield prepareCreateSignedTransaction(body, args.tronWeb, provider),
121
- // TODO: SignatureID is missing in OpenApi
122
- });
123
+ if (body.signatureId) {
124
+ return api_client_1.TronService.tronCreateTrc20(body);
125
+ }
126
+ else {
127
+ return api_client_1.TronService.tronBroadcast({
128
+ txData: yield prepareCreateSignedTransaction(body, args.tronWeb, provider),
129
+ });
130
+ }
123
131
  }),
124
132
  },
125
133
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tron.trc20.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.trc20.ts"],"names":[],"mappings":";;;;AAAA,oDAM4B;AAC5B,wEAAoC;AAEpC,sFAAiE;AACjE,sEAAgE;AAEhE,MAAM,wBAAwB,GAAG,CAC/B,IAAkE,EAClE,OAAiB,EACjB,QAAiB,EACjB,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;IAEnD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC1C,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;IAC/B,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,CAAA;IACjE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IAEzD,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1D,MAAM,UAAU,GAAG,2BAA2B,CAAA;IAC9C,MAAM,MAAM,GAAG;QACb,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;QACpD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,KAAK,IAAI,sBAAS,CAAC,MAAM,CAAC,CAAC,YAAY,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CAAC,aAAa,CAAC;wBAC/B,MAAM,EAAE,MAAM,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;qBACrE,CAAC,CAAA;iBACH;YACH,CAAC,CAAA;YACD;;;;;eAKG;YACH,uBAAuB,EAAE,CAAO,IAAqB,EAAE,QAAiB,EAAE,EAAE;gBAC1E,IAAI,IAAI,CAAC,WAAW,EAAE;oBACpB,OAAO,wBAAW,CAAC,eAAe,CAAC,IAAoC,CAAC,CAAA;iBACzE;qBAAM;oBACL,OAAO,wBAAW,CAAC,aAAa,CAAC;wBAC/B,MAAM,EAAE,MAAM,8BAA8B,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;qBAC3E,CAAC,CAAA;iBACH;YACH,CAAC,CAAA;SACF;KACF,CAAA;AACH,CAAC,CAAA;AA1EY,QAAA,SAAS,aA0ErB"}
@@ -1,23 +1,12 @@
1
- import { BurnNftKMSTron as ApiBurnNftKMSTron, BurnNftTron, DeployNftTron, DeployNftTronKMS as ApiDeployNftTronKMS, MintMultipleNftKMSTron as ApiMintMultipleNftKMSTron, MintMultipleNftTron, MintNftKMSTron as ApiMintNftKMSTron, MintNftTron, TransferNftKMSTron as ApiTransferNftKMSTron, TransferNftTron, UpdateCashbackValueForAuthorNftKMSTron as ApiUpdateCashbackValueForAuthorNftKMSTron, UpdateCashbackValueForAuthorNftTron } from '@tatumio/api-client';
1
+ import { BurnNftTron, DeployNftTron, MintMultipleNftTron, MintNftTron, TransferNftTron, UpdateCashbackValueForAuthorNftTron } from '@tatumio/api-client';
2
+ import { FromPrivateKeyOrSignatureIdTron } from '@tatumio/shared-blockchain-abstract';
2
3
  import { ITronWeb } from './tron.web';
3
- declare type DeployNftTronKMS = ApiDeployNftTronKMS & {
4
- from: string;
5
- };
6
- declare type MintNftKMSTron = ApiMintNftKMSTron & {
7
- from: string;
8
- };
9
- declare type TransferNftKMSTron = ApiTransferNftKMSTron & {
10
- from: string;
11
- };
12
- declare type BurnNftKMSTron = ApiBurnNftKMSTron & {
13
- from: string;
14
- };
15
- declare type MintMultipleNftKMSTron = ApiMintMultipleNftKMSTron & {
16
- from: string;
17
- };
18
- declare type UpdateCashbackValueForAuthorNftKMSTron = ApiUpdateCashbackValueForAuthorNftKMSTron & {
19
- from: string;
20
- };
4
+ declare type DeployTronNft = FromPrivateKeyOrSignatureIdTron<DeployNftTron>;
5
+ declare type MintTronNft = FromPrivateKeyOrSignatureIdTron<MintNftTron>;
6
+ declare type TransferTronNft = FromPrivateKeyOrSignatureIdTron<TransferNftTron>;
7
+ declare type BurnTronNft = FromPrivateKeyOrSignatureIdTron<BurnNftTron>;
8
+ declare type MintTronMultipleNft = FromPrivateKeyOrSignatureIdTron<MintMultipleNftTron>;
9
+ declare type UpdateTronCashbackValues = FromPrivateKeyOrSignatureIdTron<UpdateCashbackValueForAuthorNftTron>;
21
10
  export declare const tronTrc721: (args: {
22
11
  tronWeb: ITronWeb;
23
12
  }) => {
@@ -28,49 +17,49 @@ export declare const tronTrc721: (args: {
28
17
  * @param provider
29
18
  * @returns transaction data to be broadcast to blockchain.
30
19
  */
31
- deploySignedTransaction: (body: DeployNftTron | DeployNftTronKMS, provider?: string) => Promise<string>;
20
+ deploySignedTransaction: (body: DeployTronNft, provider?: string) => Promise<string>;
32
21
  /**
33
22
  * Sign Tron deploy trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
34
23
  * @param body content of the transaction to broadcast
35
24
  * @param provider
36
25
  * @returns transaction data to be broadcast to blockchain.
37
26
  */
38
- mintCashbackSignedTransaction: (body: MintNftTron | MintNftKMSTron, provider?: string) => Promise<string>;
27
+ mintCashbackSignedTransaction: (body: MintTronNft, provider?: string) => Promise<string>;
39
28
  /**
40
29
  * Sign Tron deploy trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
41
30
  * @param body content of the transaction to broadcast
42
31
  * @param provider
43
32
  * @returns transaction data to be broadcast to blockchain.
44
33
  */
45
- mintSignedTransaction: (body: MintNftTron | MintNftKMSTron, provider?: string) => Promise<string>;
34
+ mintSignedTransaction: (body: MintTronNft, provider?: string) => Promise<string>;
46
35
  /**
47
36
  * Sign Tron transfer trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
48
37
  * @param body content of the transaction to broadcast
49
38
  * @param provider
50
39
  * @returns transaction data to be broadcast to blockchain.
51
40
  */
52
- transferSignedTransaction: (body: TransferNftTron | TransferNftKMSTron, provider?: string) => Promise<string>;
41
+ transferSignedTransaction: (body: TransferTronNft, provider?: string) => Promise<string>;
53
42
  /**
54
43
  * Sign Tron burn trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
55
44
  * @param body content of the transaction to broadcast
56
45
  * @param provider
57
46
  * @returns transaction data to be broadcast to blockchain.
58
47
  */
59
- burnSignedTransaction: (body: BurnNftTron | BurnNftKMSTron, provider?: string) => Promise<string>;
48
+ burnSignedTransaction: (body: BurnTronNft, provider?: string) => Promise<string>;
60
49
  /**
61
50
  * Sign Tron mint multiple trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
62
51
  * @param body content of the transaction to broadcast
63
52
  * @param provider
64
53
  * @returns transaction data to be broadcast to blockchain.
65
54
  */
66
- mintMultipleSignedTransaction: (body: MintMultipleNftTron | MintMultipleNftKMSTron, provider?: string) => Promise<string>;
55
+ mintMultipleSignedTransaction: (body: MintTronMultipleNft, provider?: string) => Promise<string>;
67
56
  /**
68
57
  * Sign Tron update cashback for author trc721 transaction with private keys locally. Nothing is broadcast to the blockchain.
69
58
  * @param body content of the transaction to broadcast
70
59
  * @param provider
71
60
  * @returns transaction data to be broadcast to blockchain.
72
61
  */
73
- updateCashbackValueForAuthorSignedTransaction: (body: UpdateCashbackValueForAuthorNftTron | UpdateCashbackValueForAuthorNftKMSTron, provider?: string) => Promise<string>;
62
+ updateCashbackValueForAuthorSignedTransaction: (body: UpdateTronCashbackValues, provider?: string) => Promise<string>;
74
63
  };
75
64
  send: {
76
65
  /**
@@ -79,49 +68,49 @@ export declare const tronTrc721: (args: {
79
68
  * @param body content of the transaction to broadcast
80
69
  * @returns transaction id of the transaction in the blockchain
81
70
  */
82
- deploySignedTransaction: (body: DeployNftTron | DeployNftTronKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
71
+ deploySignedTransaction: (body: DeployTronNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
83
72
  /**
84
73
  * Send Tron mint cashback trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
85
74
  * This operation is irreversible.
86
75
  * @param body content of the transaction to broadcast
87
76
  * @returns transaction id of the transaction in the blockchain
88
77
  */
89
- mintCashbackSignedTransaction: (body: MintNftTron | MintNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
78
+ mintCashbackSignedTransaction: (body: MintTronNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").FlowMintedResult | import("@tatumio/api-client").SolanaMintedResult | import("@tatumio/api-client").AlgorandMintedResult>;
90
79
  /**
91
80
  * Send Tron mint cashback trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
92
81
  * This operation is irreversible.
93
82
  * @param body content of the transaction to broadcast
94
83
  * @returns transaction id of the transaction in the blockchain
95
84
  */
96
- mintSignedTransaction: (body: MintNftTron | MintNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
85
+ mintSignedTransaction: (body: MintTronNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").FlowMintedResult | import("@tatumio/api-client").SolanaMintedResult | import("@tatumio/api-client").AlgorandMintedResult>;
97
86
  /**
98
87
  * Send Tron transfer trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
99
88
  * This operation is irreversible.
100
89
  * @param body content of the transaction to broadcast
101
90
  * @returns transaction id of the transaction in the blockchain
102
91
  */
103
- transferSignedTransaction: (body: TransferNftTron | TransferNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
92
+ transferSignedTransaction: (body: TransferTronNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
104
93
  /**
105
94
  * Send Tron burn trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
106
95
  * This operation is irreversible.
107
96
  * @param body content of the transaction to broadcast
108
97
  * @returns transaction id of the transaction in the blockchain
109
98
  */
110
- burnSignedTransaction: (body: BurnNftTron | BurnNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
99
+ burnSignedTransaction: (body: BurnTronNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
111
100
  /**
112
101
  * Send Tron mint multiple trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
113
102
  * This operation is irreversible.
114
103
  * @param body content of the transaction to broadcast
115
104
  * @returns transaction id of the transaction in the blockchain
116
105
  */
117
- mintMultipleSignedTransaction: (body: MintMultipleNftTron | MintMultipleNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
106
+ mintMultipleSignedTransaction: (body: MintTronMultipleNft, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").FlowMintedMultipleResult>;
118
107
  /**
119
108
  * Send Tron update cashback for author trc721 transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
120
109
  * This operation is irreversible.
121
110
  * @param body content of the transaction to broadcast
122
111
  * @returns transaction id of the transaction in the blockchain
123
112
  */
124
- updateCashbackValueForAuthorSignedTransaction: (body: UpdateCashbackValueForAuthorNftTron | UpdateCashbackValueForAuthorNftKMSTron, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
113
+ updateCashbackValueForAuthorSignedTransaction: (body: UpdateTronCashbackValues, provider?: string) => Promise<import("@tatumio/api-client").SignatureId | import("@tatumio/api-client").TransactionHash>;
125
114
  };
126
115
  };
127
116
  export {};