@tatumio/tron 2.0.1-alpha.330 → 2.0.1-alpha.332
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/package.json +7 -7
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/lib/services/tron.custodial.d.ts +12 -7
- package/src/lib/services/tron.custodial.js +16 -6
- package/src/lib/services/tron.custodial.js.map +1 -1
- package/src/lib/services/tron.trc10.d.ts +9 -5
- package/src/lib/services/tron.trc10.js +20 -12
- package/src/lib/services/tron.trc10.js.map +1 -1
- package/src/lib/services/tron.trc20.d.ts +9 -5
- package/src/lib/services/tron.trc20.js +19 -11
- package/src/lib/services/tron.trc20.js.map +1 -1
- package/src/lib/services/tron.trc721.d.ts +22 -33
- package/src/lib/services/tron.trc721.js +77 -48
- package/src/lib/services/tron.trc721.js.map +1 -1
- package/src/lib/services/tron.tx.d.ts +111 -65
- package/src/lib/services/tron.tx.js +35 -69
- package/src/lib/services/tron.tx.js.map +1 -1
- package/src/lib/services/tron.virtualAccount.d.ts +42 -0
- package/src/lib/services/tron.virtualAccount.js +108 -0
- package/src/lib/services/tron.virtualAccount.js.map +1 -0
- package/src/lib/services/tron.wallet.d.ts +22 -6
- package/src/lib/tron.sdk.d.ts +178 -58
- package/src/lib/tron.sdk.js +14 -2
- package/src/lib/tron.sdk.js.map +1 -1
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tronTx = 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 shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
|
|
8
7
|
const tron_trc10_1 = require("./tron.trc10");
|
|
9
8
|
const tron_trc20_1 = require("./tron.trc20");
|
|
10
9
|
const tron_trc721_1 = require("./tron.trc721");
|
|
10
|
+
// TODO: do a balance check before sending tx - https://app.clickup.com/t/24443045/TT-3496
|
|
11
11
|
const prepareSignedTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
const { to, amount } = body;
|
|
13
13
|
const client = tronWeb.getClient(provider);
|
|
14
|
-
if (
|
|
14
|
+
if (body.signatureId) {
|
|
15
15
|
const tx = yield client.transactionBuilder.sendTrx(to, client.toSun(amount), body.from);
|
|
16
16
|
return JSON.stringify(tx);
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ const prepareSignedTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(
|
|
|
23
23
|
const prepareFreezeTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
24
|
const { receiver, amount, resource, duration } = body;
|
|
25
25
|
const client = tronWeb.getClient(provider);
|
|
26
|
-
if (
|
|
26
|
+
if (body.signatureId) {
|
|
27
27
|
const tx = yield client.transactionBuilder.freezeBalance(client.toSun(parseFloat(amount)), duration, resource, body.from, receiver);
|
|
28
28
|
return JSON.stringify(tx);
|
|
29
29
|
}
|
|
@@ -32,24 +32,21 @@ const prepareFreezeTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(
|
|
|
32
32
|
return JSON.stringify(yield client.trx.sign(tx, body.fromPrivateKey));
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
function isCallSmartContractMethodKMS(input) {
|
|
36
|
-
return input.signatureId !== undefined;
|
|
37
|
-
}
|
|
38
35
|
const prepareSmartContractInvocation = (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
36
|
var _a;
|
|
40
37
|
const { amount, contractAddress, methodName, params } = body;
|
|
41
38
|
const client = tronWeb.getClient(provider);
|
|
42
39
|
client.setAddress(contractAddress);
|
|
43
40
|
const contractAddressHex = client.address.toHex(contractAddress);
|
|
44
|
-
const sender =
|
|
45
|
-
? body.
|
|
41
|
+
const sender = body.signatureId
|
|
42
|
+
? (body === null || body === void 0 ? void 0 : body.account) || (body === null || body === void 0 ? void 0 : body.from)
|
|
46
43
|
: client.address.fromHex(client.address.fromPrivateKey(body.fromPrivateKey));
|
|
47
44
|
const { transaction } = yield client.transactionBuilder.triggerSmartContract(contractAddressHex, methodName, {
|
|
48
45
|
feeLimit: client.toSun((_a = body.fee) === null || _a === void 0 ? void 0 : _a.gasLimit),
|
|
49
46
|
from: sender,
|
|
50
47
|
callValue: client.toSun(amount || 0),
|
|
51
48
|
}, params, sender);
|
|
52
|
-
if (
|
|
49
|
+
if (body.signatureId) {
|
|
53
50
|
return JSON.stringify(transaction);
|
|
54
51
|
}
|
|
55
52
|
return JSON.stringify(yield client.trx.sign(transaction, body.fromPrivateKey));
|
|
@@ -82,8 +79,8 @@ const prepareCustodialTransferBatch = (body, tronWeb, provider) => tslib_1.__awa
|
|
|
82
79
|
const client = tronWeb.getClient(provider);
|
|
83
80
|
client.setAddress(contractAddress);
|
|
84
81
|
const contractAddressHex = client.address.toHex(contractAddress);
|
|
85
|
-
const sender =
|
|
86
|
-
? body.
|
|
82
|
+
const sender = body.signatureId
|
|
83
|
+
? (body === null || body === void 0 ? void 0 : body.from) || (body === null || body === void 0 ? void 0 : body.account)
|
|
87
84
|
: client.address.fromHex(client.address.fromPrivateKey(body.fromPrivateKey));
|
|
88
85
|
const methodName = 'transferBatch(address[],uint256[],address[],uint256[],uint256[])';
|
|
89
86
|
const { transaction } = yield client.transactionBuilder.triggerSmartContract(contractAddressHex, methodName, {
|
|
@@ -96,7 +93,7 @@ const prepareCustodialTransferBatch = (body, tronWeb, provider) => tslib_1.__awa
|
|
|
96
93
|
{ type: 'uint256[]', value: body.params[3] },
|
|
97
94
|
{ type: 'uint256[]', value: body.params[4] },
|
|
98
95
|
], sender);
|
|
99
|
-
if (
|
|
96
|
+
if (body.signatureId) {
|
|
100
97
|
return JSON.stringify(transaction);
|
|
101
98
|
}
|
|
102
99
|
return JSON.stringify(yield client.trx.sign(transaction, body.fromPrivateKey));
|
|
@@ -105,7 +102,7 @@ const prepareGenerateCustodialWalletSignedTransaction = (body, tronWeb, provider
|
|
|
105
102
|
const client = tronWeb.getClient(provider);
|
|
106
103
|
// TODO: implement obtainCustodialAddressType
|
|
107
104
|
const { abi, code } = {};
|
|
108
|
-
const sender =
|
|
105
|
+
const sender = body.signatureId ? body.from : client.address.fromPrivateKey(body.fromPrivateKey);
|
|
109
106
|
const tx = yield client.transactionBuilder.createSmartContract({
|
|
110
107
|
feeLimit: client.toSun(body.feeLimit || 100),
|
|
111
108
|
callValue: 0,
|
|
@@ -116,25 +113,7 @@ const prepareGenerateCustodialWalletSignedTransaction = (body, tronWeb, provider
|
|
|
116
113
|
parameters: [],
|
|
117
114
|
name: 'CustodialWallet',
|
|
118
115
|
}, sender);
|
|
119
|
-
if (
|
|
120
|
-
return JSON.stringify(tx);
|
|
121
|
-
}
|
|
122
|
-
return JSON.stringify(yield client.trx.sign(tx, body.fromPrivateKey));
|
|
123
|
-
});
|
|
124
|
-
const prepareDeployMarketplaceListingSignedTransaction = (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
-
const client = tronWeb.getClient(provider);
|
|
126
|
-
const sender = (0, shared_abstract_sdk_1.isWithSignatureId)(body) ? body.from : client.address.fromPrivateKey(body.fromPrivateKey);
|
|
127
|
-
const tx = yield client.transactionBuilder.createSmartContract({
|
|
128
|
-
feeLimit: client.toSun(body.feeLimit || 300),
|
|
129
|
-
callValue: 0,
|
|
130
|
-
userFeePercentage: 100,
|
|
131
|
-
originEnergyLimit: 1,
|
|
132
|
-
abi: JSON.stringify(shared_blockchain_evm_based_1.ListingSmartContract.abi),
|
|
133
|
-
bytecode: shared_blockchain_evm_based_1.ListingSmartContract.bytecode,
|
|
134
|
-
parameters: [body.marketplaceFee, body.feeRecipient],
|
|
135
|
-
name: 'CustodialWallet',
|
|
136
|
-
}, sender);
|
|
137
|
-
if ((0, shared_abstract_sdk_1.isWithSignatureId)(body)) {
|
|
116
|
+
if (body.signatureId) {
|
|
138
117
|
return JSON.stringify(tx);
|
|
139
118
|
}
|
|
140
119
|
return JSON.stringify(yield client.trx.sign(tx, body.fromPrivateKey));
|
|
@@ -169,10 +148,14 @@ const tronTx = (args) => {
|
|
|
169
148
|
* @returns transaction id of the transaction in the blockchain
|
|
170
149
|
*/
|
|
171
150
|
signedTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
if (body.signatureId) {
|
|
152
|
+
return api_client_1.ApiServices.blockchain.tron.tronTransfer(body);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return api_client_1.TronService.tronBroadcast({
|
|
156
|
+
txData: yield prepareSignedTransaction(body, args.tronWeb, provider),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
176
159
|
}),
|
|
177
160
|
/**
|
|
178
161
|
* Send Tron Freeze balance transaction to the blockchain. This method broadcasts signed transaction to the blockchain.
|
|
@@ -181,10 +164,14 @@ const tronTx = (args) => {
|
|
|
181
164
|
* @returns transaction id of the transaction in the blockchain
|
|
182
165
|
*/
|
|
183
166
|
freezeTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
167
|
+
if (body.signatureId) {
|
|
168
|
+
return api_client_1.ApiServices.blockchain.tron.tronFreeze(body);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
return api_client_1.TronService.tronBroadcast({
|
|
172
|
+
txData: yield prepareFreezeTransaction(body, args.tronWeb, provider),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
188
175
|
}),
|
|
189
176
|
},
|
|
190
177
|
},
|
|
@@ -224,10 +211,14 @@ const tronTx = (args) => {
|
|
|
224
211
|
* @returns transaction id of the transaction in the blockchain
|
|
225
212
|
*/
|
|
226
213
|
generateCustodialWalletSignedTransaction: (body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
214
|
+
if (body.signatureId) {
|
|
215
|
+
return api_client_1.ApiServices.custodial.custodialCreateWallet(body);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
return api_client_1.TronService.tronBroadcast({
|
|
219
|
+
txData: yield prepareGenerateCustodialWalletSignedTransaction(body, args.tronWeb, provider),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
231
222
|
}),
|
|
232
223
|
},
|
|
233
224
|
},
|
|
@@ -236,31 +227,6 @@ const tronTx = (args) => {
|
|
|
236
227
|
prepareGasPumpBatch: (testnet, body, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return prepareGasPumpBatch(body, args.tronWeb, provider, testnet); }),
|
|
237
228
|
},
|
|
238
229
|
},
|
|
239
|
-
marketplace: {
|
|
240
|
-
prepare: {
|
|
241
|
-
/**
|
|
242
|
-
* Sign TRON deploy new smart contract for NFT marketplace transaction. Smart contract enables marketplace operator to create new listing for NFT (ERC-721/1155).
|
|
243
|
-
* @param body request data
|
|
244
|
-
* @param provider optional provider to enter. if not present, Tatum provider will be used.
|
|
245
|
-
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
|
|
246
|
-
*/
|
|
247
|
-
deployMarketplaceListingSignedTransaction: (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return prepareDeployMarketplaceListingSignedTransaction(body, args.tronWeb, provider); }),
|
|
248
|
-
},
|
|
249
|
-
send: {
|
|
250
|
-
/**
|
|
251
|
-
* Deploy new smart contract for NFT marketplace logic. Smart contract enables marketplace operator to create new listing for NFT (ERC-721/1155).
|
|
252
|
-
* @param body request data
|
|
253
|
-
* @param provider optional provider to enter. if not present, Tatum provider will be used.
|
|
254
|
-
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
|
|
255
|
-
*/
|
|
256
|
-
deployMarketplaceListingSignedTransaction: (body, tronWeb, provider) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
257
|
-
return api_client_1.TronService.tronBroadcast({
|
|
258
|
-
txData: yield prepareDeployMarketplaceListingSignedTransaction(body, args.tronWeb, provider),
|
|
259
|
-
// TODO: SignatureID is missing in OpenApi
|
|
260
|
-
});
|
|
261
|
-
}),
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
230
|
};
|
|
265
231
|
};
|
|
266
232
|
exports.tronTx = tronTx;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tron.tx.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.tx.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"tron.tx.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.tx.ts"],"names":[],"mappings":";;;;AAAA,oDAU4B;AAE5B,sFAAwF;AACxF,6CAAwC;AACxC,6CAAwC;AACxC,+CAA0C;AAQ1C,0FAA0F;AAC1F,MAAM,wBAAwB,GAAG,CAAO,IAAkB,EAAE,OAAiB,EAAE,QAAiB,EAAE,EAAE;IAClG,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IAE1C,IAAI,IAAI,CAAC,WAAW,EAAE;QACpB,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAEvF,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;KAC1B;SAAM;QACL,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAChD,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CAAC,CAAA,GAAA;gBAC7D;;;;;mBAKG;gBACH,wCAAwC,EAAE,CACxC,IAAiC,EACjC,QAAiB,EACjB,EAAE,0DAAC,OAAA,+CAA+C,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA,GAAA;aACnF;YACD,IAAI,EAAE;gBACJ;;;;;mBAKG;gBACH,wCAAwC,EAAE,CACxC,IAAiC,EACjC,QAAiB,EACjB,EAAE;oBACF,IAAI,IAAI,CAAC,WAAW,EAAE;wBACpB,OAAO,wBAAW,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAsC,CAAC,CAAA;qBAC3F;yBAAM;wBACL,OAAO,wBAAW,CAAC,aAAa,CAAC;4BAC/B,MAAM,EAAE,MAAM,+CAA+C,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;yBAC5F,CAAC,CAAA;qBACH;gBACH,CAAC,CAAA;aACF;SACF;QACD,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,mBAAmB,EAAE,CAAO,OAAgB,EAAE,IAAS,EAAE,QAAiB,EAAE,EAAE,0DAC5E,OAAA,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA,GAAA;aAC7D;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAtHY,QAAA,MAAM,UAsHlB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TransferTron } from '@tatumio/api-client';
|
|
2
|
+
import { FromPrivateKeyOrSignatureIdOrMnemonic } from '@tatumio/shared-blockchain-abstract';
|
|
3
|
+
import { Blockchain } from '@tatumio/shared-core';
|
|
4
|
+
import { ITronWeb } from './tron.web';
|
|
5
|
+
export declare enum TrcType {
|
|
6
|
+
TRC10 = "TRC10",
|
|
7
|
+
TRC20 = "TRC20"
|
|
8
|
+
}
|
|
9
|
+
declare type TransferVirtualAccountTron = FromPrivateKeyOrSignatureIdOrMnemonic<TransferTron>;
|
|
10
|
+
declare type VirtualAccountResponse = {
|
|
11
|
+
id?: string;
|
|
12
|
+
txId?: string;
|
|
13
|
+
completed?: boolean;
|
|
14
|
+
} | void;
|
|
15
|
+
export declare const virtualAccountService: (args: {
|
|
16
|
+
blockchain: Blockchain;
|
|
17
|
+
tronWeb: ITronWeb;
|
|
18
|
+
}) => {
|
|
19
|
+
/**
|
|
20
|
+
* Send Tron transaction from Tatum Ledger account to the blockchain. This method broadcasts signed transaction to the blockchain.
|
|
21
|
+
* This operation is irreversible.
|
|
22
|
+
* @param body content of the transaction to broadcast
|
|
23
|
+
* @returns transaction id of the transaction in the blockchain or id of the withdrawal, if it was not cancelled automatically
|
|
24
|
+
*/
|
|
25
|
+
send: (body: TransferVirtualAccountTron) => Promise<VirtualAccountResponse | import("@tatumio/api-client").OffchainTransactionSignatureResult>;
|
|
26
|
+
depositAddress: {
|
|
27
|
+
checkExists: (address: string, index?: number) => Promise<any>;
|
|
28
|
+
create: any;
|
|
29
|
+
createMultiple: any;
|
|
30
|
+
assign: any;
|
|
31
|
+
remove: any;
|
|
32
|
+
getByAccount: any;
|
|
33
|
+
};
|
|
34
|
+
withdrawal: {
|
|
35
|
+
getAll: (status?: "InProgress" | "Done" | "Cancelled", pageSize?: number, offset?: number) => Promise<any[]>;
|
|
36
|
+
broadcast: any;
|
|
37
|
+
create: any;
|
|
38
|
+
complete: any;
|
|
39
|
+
};
|
|
40
|
+
storeTokenAddress: any;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.virtualAccountService = exports.TrcType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const api_client_1 = require("@tatumio/api-client");
|
|
6
|
+
const shared_blockchain_abstract_1 = require("@tatumio/shared-blockchain-abstract");
|
|
7
|
+
const shared_core_1 = require("@tatumio/shared-core");
|
|
8
|
+
const tron_wallet_1 = require("./tron.wallet");
|
|
9
|
+
const tron_tx_1 = require("./tron.tx");
|
|
10
|
+
var TrcType;
|
|
11
|
+
(function (TrcType) {
|
|
12
|
+
TrcType["TRC10"] = "TRC10";
|
|
13
|
+
TrcType["TRC20"] = "TRC20";
|
|
14
|
+
})(TrcType = exports.TrcType || (exports.TrcType = {}));
|
|
15
|
+
const TRON_BASED_CURRENCIES = [api_client_1.Currency.USDT_TRON.toString(), api_client_1.Currency.INRT_TRON.toString()];
|
|
16
|
+
const sendTronVirtualAccountTransaction = (body, tronWeb) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const { mnemonic, index, fromPrivateKey } = body, withdrawal = tslib_1.__rest(body, ["mnemonic", "index", "fromPrivateKey"]);
|
|
18
|
+
const { amount, address, senderAccountId } = withdrawal;
|
|
19
|
+
const wallet = (0, tron_wallet_1.tronWallet)({ tronWeb });
|
|
20
|
+
const txService = (0, tron_tx_1.tronTx)({ tronWeb });
|
|
21
|
+
let fromPrivKey;
|
|
22
|
+
let txData;
|
|
23
|
+
if (mnemonic && index !== undefined) {
|
|
24
|
+
fromPrivKey = (yield wallet.generatePrivateKeyFromMnemonic(mnemonic, index));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
fromPrivKey = body.fromPrivateKey;
|
|
28
|
+
}
|
|
29
|
+
const withdrawalFee = (withdrawal === null || withdrawal === void 0 ? void 0 : withdrawal.fee) || '2.5';
|
|
30
|
+
const withdrawalBody = Object.assign(Object.assign({}, withdrawal), { fee: withdrawalFee });
|
|
31
|
+
const account = yield api_client_1.AccountService.getAccountByAccountId(senderAccountId);
|
|
32
|
+
if (account.currency === api_client_1.Currency.TRON) {
|
|
33
|
+
txData = yield txService.native.send.signedTransaction({
|
|
34
|
+
amount,
|
|
35
|
+
fromPrivateKey: fromPrivKey,
|
|
36
|
+
to: address,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else if (TRON_BASED_CURRENCIES.includes(account.currency)) {
|
|
40
|
+
txData = yield txService.trc20.prepare.signedTransaction({
|
|
41
|
+
amount,
|
|
42
|
+
fromPrivateKey: fromPrivKey,
|
|
43
|
+
to: address,
|
|
44
|
+
tokenAddress: shared_core_1.CONTRACT_ADDRESSES[account.currency],
|
|
45
|
+
feeLimit: parseFloat(withdrawalFee),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const vc = yield api_client_1.VirtualCurrencyService.getCurrency(account.currency);
|
|
50
|
+
if (vc.trcType === TrcType.TRC10) {
|
|
51
|
+
txData = yield txService.trc10.prepare.signedTransaction({
|
|
52
|
+
amount,
|
|
53
|
+
fromPrivateKey: fromPrivKey,
|
|
54
|
+
to: address,
|
|
55
|
+
tokenId: vc.erc20Address,
|
|
56
|
+
}, vc.precision);
|
|
57
|
+
}
|
|
58
|
+
else if (vc.trcType === TrcType.TRC20) {
|
|
59
|
+
txData = yield txService.trc20.prepare.signedTransaction({
|
|
60
|
+
amount,
|
|
61
|
+
feeLimit: parseFloat(withdrawalFee),
|
|
62
|
+
fromPrivateKey: fromPrivKey,
|
|
63
|
+
to: address,
|
|
64
|
+
tokenAddress: vc.erc20Address,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
throw new Error('Unsupported account.');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const { id } = yield api_client_1.WithdrawalService.storeWithdrawal(withdrawalBody);
|
|
72
|
+
try {
|
|
73
|
+
return Object.assign(Object.assign({}, (yield api_client_1.WithdrawalService.broadcastBlockchainTransaction({
|
|
74
|
+
txData,
|
|
75
|
+
withdrawalId: id,
|
|
76
|
+
currency: api_client_1.Currency.TRON,
|
|
77
|
+
}))), { id });
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.error(e);
|
|
81
|
+
try {
|
|
82
|
+
return yield api_client_1.WithdrawalService.cancelInProgressWithdrawal(id);
|
|
83
|
+
}
|
|
84
|
+
catch (e1) {
|
|
85
|
+
console.log(e);
|
|
86
|
+
return { id };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const virtualAccountService = (args) => {
|
|
91
|
+
return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainOffchain)(args)), {
|
|
92
|
+
/**
|
|
93
|
+
* Send Tron transaction from Tatum Ledger account to the blockchain. This method broadcasts signed transaction to the blockchain.
|
|
94
|
+
* This operation is irreversible.
|
|
95
|
+
* @param body content of the transaction to broadcast
|
|
96
|
+
* @returns transaction id of the transaction in the blockchain or id of the withdrawal, if it was not cancelled automatically
|
|
97
|
+
*/
|
|
98
|
+
send: (body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
if (body.signatureId) {
|
|
100
|
+
return api_client_1.ApiServices.offChain.blockchain.tronTransferOffchain(body);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return yield sendTronVirtualAccountTransaction(body, args.tronWeb);
|
|
104
|
+
}
|
|
105
|
+
}) });
|
|
106
|
+
};
|
|
107
|
+
exports.virtualAccountService = virtualAccountService;
|
|
108
|
+
//# sourceMappingURL=tron.virtualAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tron.virtualAccount.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.virtualAccount.ts"],"names":[],"mappings":";;;;AAAA,oDAQ4B;AAC5B,oFAG4C;AAC5C,sDAAqE;AACrE,+CAA0C;AAE1C,uCAAkC;AAElC,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;AACjB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB;AAED,MAAM,qBAAqB,GAAG,CAAC,qBAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,qBAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAA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AAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAChB,IAAI;YACF,OAAO,MAAM,8BAAiB,CAAC,0BAA0B,CAAC,EAAG,CAAC,CAAA;SAC/D;QAAC,OAAO,EAAE,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;YACd,OAAO,EAAE,EAAE,EAAE,CAAA;SACd;KACF;AACH,CAAC,CAAA,CAAA;AAEM,MAAM,qBAAqB,GAAG,CAAC,IAAmD,EAAE,EAAE;IAC3F,uCACK,IAAA,uDAA0B,EAAC,IAAI,CAAC;QACnC;;;;;WAKG;QACH,IAAI,EAAE,CAAO,IAAgC,EAAE,EAAE;YAC/C,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,OAAO,wBAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,IAAuB,CAAC,CAAA;aACrF;iBAAM;gBACL,OAAO,MAAM,iCAAiC,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;aACnE;QACH,CAAC,CAAA,IACF;AACH,CAAC,CAAA;AAjBY,QAAA,qBAAqB,yBAiBjC"}
|
|
@@ -36,14 +36,30 @@ export declare const tronWallet: (args: {
|
|
|
36
36
|
generateAddressFromPrivatekey(privateKey: string): string;
|
|
37
37
|
custodial: {
|
|
38
38
|
prepare: {
|
|
39
|
-
custodialWallet: (body: import("
|
|
40
|
-
transferFromCustodialWallet: (body: import("@tatumio/api-client").TransferCustodialWalletTron
|
|
41
|
-
|
|
39
|
+
custodialWallet: (body: import("./tron.tx").TronGenerateCustodialWallet, provider?: string) => Promise<string>;
|
|
40
|
+
transferFromCustodialWallet: (body: Omit<import("@tatumio/api-client").TransferCustodialWalletTron, "fromPrivateKey"> & Partial<import("@tatumio/api-client").SignatureId & {
|
|
41
|
+
index: number;
|
|
42
|
+
account: string;
|
|
43
|
+
from: string;
|
|
44
|
+
}> & Partial<Pick<import("@tatumio/api-client").TransferCustodialWalletTron, "fromPrivateKey">>, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
|
|
45
|
+
batchTransferFromCustodialWallet: (body: Omit<import("@tatumio/api-client").TransferCustodialWalletBatchTron, "fromPrivateKey"> & Partial<import("@tatumio/api-client").SignatureId & {
|
|
46
|
+
index: number;
|
|
47
|
+
account: string;
|
|
48
|
+
from: string;
|
|
49
|
+
}> & Partial<Pick<import("@tatumio/api-client").TransferCustodialWalletBatchTron, "fromPrivateKey">>, getContractDecimals: (contractAddress: string, provider?: string, testnet?: boolean) => Promise<number>, provider?: string, decimals?: number, testnet?: boolean) => Promise<string>;
|
|
42
50
|
};
|
|
43
51
|
send: {
|
|
44
|
-
custodialWallet: (body: import("
|
|
45
|
-
transferFromCustodialWallet: (body: import("@tatumio/api-client").TransferCustodialWalletTron
|
|
46
|
-
|
|
52
|
+
custodialWallet: (body: import("./tron.tx").TronGenerateCustodialWallet, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash | import("@tatumio/api-client").CustodialManagedAddress>;
|
|
53
|
+
transferFromCustodialWallet: (body: Omit<import("@tatumio/api-client").TransferCustodialWalletTron, "fromPrivateKey"> & Partial<import("@tatumio/api-client").SignatureId & {
|
|
54
|
+
index: number;
|
|
55
|
+
account: string;
|
|
56
|
+
from: string;
|
|
57
|
+
}> & Partial<Pick<import("@tatumio/api-client").TransferCustodialWalletTron, "fromPrivateKey">>, 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
|
+
batchTransferFromCustodialWallet: (body: Omit<import("@tatumio/api-client").TransferCustodialWalletBatchTron, "fromPrivateKey"> & Partial<import("@tatumio/api-client").SignatureId & {
|
|
59
|
+
index: number;
|
|
60
|
+
account: string;
|
|
61
|
+
from: string;
|
|
62
|
+
}> & Partial<Pick<import("@tatumio/api-client").TransferCustodialWalletBatchTron, "fromPrivateKey">>, 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>;
|
|
47
63
|
};
|
|
48
64
|
};
|
|
49
65
|
gasPump: {
|