@tatumio/tron 2.0.1-alpha.322 → 2.0.1-alpha.324

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 CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@tatumio/tron",
3
- "version": "2.0.1-alpha.322",
3
+ "version": "2.0.1-alpha.324",
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": "0.0.0",
10
- "@tatumio/api-client": "0.0.0",
9
+ "@tatumio/shared-testing-common": "2.0.1-alpha.324",
10
+ "@tatumio/api-client": "2.0.1-alpha.324",
11
11
  "axios": "^0.26.0",
12
12
  "form-data": "^4.0.0",
13
- "@tatumio/shared-blockchain-evm-based": "0.0.0",
14
- "@tatumio/shared-abstract-sdk": "0.0.0",
13
+ "@tatumio/shared-blockchain-evm-based": "2.0.1-alpha.324",
14
+ "@tatumio/shared-abstract-sdk": "2.0.1-alpha.324",
15
15
  "bignumber.js": "^9.0.2",
16
- "@tatumio/shared-core": "0.0.0",
17
- "@tatumio/shared-blockchain-abstract": "0.0.0",
16
+ "@tatumio/shared-core": "2.0.1-alpha.324",
17
+ "@tatumio/shared-blockchain-abstract": "2.0.1-alpha.324",
18
18
  "ethereumjs-wallet": "^1.0.2",
19
19
  "bip39": "^3.0.2",
20
20
  "web3": "^1.7.4",
@@ -0,0 +1,18 @@
1
+ import { PendingTransaction } from '@tatumio/api-client';
2
+ import { Blockchain } from '@tatumio/shared-core';
3
+ export declare const tronKmsService: (args: {
4
+ blockchain: Blockchain;
5
+ }) => {
6
+ /**
7
+ * Sign pending transaction from Tatum KMS
8
+ * @param tx pending transaction from KMS
9
+ * @param fromPrivateKey private key to sign transaction with.
10
+ * @param provider url of the blockchain server to connect to. If not set, default public server will be used.
11
+ * @returns transaction data to be broadcast to blockchain.
12
+ */
13
+ sign(tx: PendingTransaction, fromPrivateKey: string, provider?: string): Promise<string>;
14
+ getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<PendingTransaction[]>;
15
+ get: typeof import("@tatumio/api-client").KeyManagementSystemService.getPendingTransactionToSign;
16
+ complete: typeof import("@tatumio/api-client").KeyManagementSystemService.completePendingSignature;
17
+ delete: typeof import("@tatumio/api-client").KeyManagementSystemService.deletePendingTransactionToSign;
18
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tronKmsService = 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 tron_web_1 = require("./tron.web");
8
+ const shared_blockchain_evm_based_1 = require("@tatumio/shared-blockchain-evm-based");
9
+ const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk");
10
+ const tronKmsService = (args) => {
11
+ return Object.assign(Object.assign({}, (0, shared_blockchain_abstract_1.abstractBlockchainKms)(args)), {
12
+ /**
13
+ * Sign pending transaction from Tatum KMS
14
+ * @param tx pending transaction from KMS
15
+ * @param fromPrivateKey private key to sign transaction with.
16
+ * @param provider url of the blockchain server to connect to. If not set, default public server will be used.
17
+ * @returns transaction data to be broadcast to blockchain.
18
+ */
19
+ sign(tx, fromPrivateKey, provider) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ if (tx.chain !== api_client_1.Currency.TRON) {
22
+ throw new shared_blockchain_evm_based_1.EvmBasedSdkError({ code: shared_abstract_sdk_1.SdkErrorCode.KMS_CHAIN_MISMATCH });
23
+ }
24
+ const client = (0, tron_web_1.tronWeb)().getClient(provider);
25
+ const transactionConfig = JSON.parse(tx.serializedTransaction);
26
+ transactionConfig.nonce = yield client.wallet().nonce;
27
+ return JSON.stringify(yield client.trx.sign(transactionConfig, fromPrivateKey));
28
+ });
29
+ } });
30
+ };
31
+ exports.tronKmsService = tronKmsService;
32
+ //# sourceMappingURL=tron.kms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tron.kms.js","sourceRoot":"","sources":["../../../../../../../packages/blockchain/tron/src/lib/services/tron.kms.ts"],"names":[],"mappings":";;;;AAAA,oDAAkE;AAClE,oFAA2E;AAC3E,yCAAoC;AACpC,sFAAuE;AACvE,sEAA2D;AAGpD,MAAM,cAAc,GAAG,CAAC,IAAgC,EAAE,EAAE;IACjE,uCACK,IAAA,kDAAqB,EAAC,IAAI,CAAC;QAC9B;;;;;;WAMG;QACG,IAAI,CAAC,EAAsB,EAAE,cAAsB,EAAE,QAAiB;;gBAC1E,IAAI,EAAE,CAAC,KAAK,KAAK,qBAAQ,CAAC,IAAI,EAAE;oBAC9B,MAAM,IAAI,8CAAgB,CAAC,EAAE,IAAI,EAAE,kCAAY,CAAC,kBAAkB,EAAE,CAAC,CAAA;iBACtE;gBACD,MAAM,MAAM,GAAG,IAAA,kBAAO,GAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;gBAC5C,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAA;gBAC9D,iBAAiB,CAAC,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAA;gBACrD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAA;YACjF,CAAC;SAAA,IACF;AACH,CAAC,CAAA;AApBY,QAAA,cAAc,kBAoB1B"}
@@ -33,6 +33,13 @@ export declare const TatumTronSDK: (args: SDKArguments) => {
33
33
  createSignedTransaction: (body: import("@tatumio/api-client").CreateTronTrc20Blockchain | import("@tatumio/api-client").CreateTronTrc20BlockchainKMS, provider?: string) => Promise<import("@tatumio/api-client").TransactionHash>;
34
34
  };
35
35
  };
36
+ kms: {
37
+ sign(tx: import("@tatumio/api-client").PendingTransaction, fromPrivateKey: string, provider?: string): Promise<string>;
38
+ getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction[]>;
39
+ get: typeof import("@tatumio/api-client").KeyManagementSystemService.getPendingTransactionToSign;
40
+ complete: typeof import("@tatumio/api-client").KeyManagementSystemService.completePendingSignature;
41
+ delete: typeof import("@tatumio/api-client").KeyManagementSystemService.deletePendingTransactionToSign;
42
+ };
36
43
  nft: {
37
44
  deployNFTSmartContract: typeof import("@tatumio/api-client").NftErc721OrCompatibleService.nftDeployErc721;
38
45
  mintNFT: typeof import("@tatumio/api-client").NftErc721OrCompatibleService.nftMintErc721;
@@ -152,12 +159,6 @@ export declare const TatumTronSDK: (args: SDKArguments) => {
152
159
  getTransaction: typeof TronService.tronGetTransaction;
153
160
  sendTransaction: typeof TronService.tronTransfer;
154
161
  };
155
- kms: {
156
- getAllPending(signatures?: string): import("@tatumio/api-client").CancelablePromise<import("@tatumio/api-client").PendingTransaction[]>;
157
- get: typeof import("@tatumio/api-client").KeyManagementSystemService.getPendingTransactionToSign;
158
- complete: typeof import("@tatumio/api-client").KeyManagementSystemService.completePendingSignature;
159
- delete: typeof import("@tatumio/api-client").KeyManagementSystemService.deletePendingTransactionToSign;
160
- };
161
162
  offchain: {
162
163
  depositAddress: {
163
164
  checkExists: (address: string, index?: number) => Promise<import("@tatumio/api-client").Account>;
@@ -9,13 +9,14 @@ const tron_web_1 = require("./services/tron.web");
9
9
  const tron_tx_1 = require("./services/tron.tx");
10
10
  const tron_wallet_1 = require("./services/tron.wallet");
11
11
  const tron_record_1 = require("./services/tron.record");
12
+ const tron_kms_1 = require("./services/tron.kms");
12
13
  const blockchain = shared_core_1.Blockchain.TRON;
13
14
  const TatumTronSDK = (args) => {
14
15
  const web = (0, tron_web_1.tronWeb)();
15
16
  const txService = (0, tron_tx_1.tronTx)({ tronWeb: web });
16
17
  const _a = (0, shared_blockchain_abstract_1.abstractBlockchainSdk)(Object.assign(Object.assign({}, args), { blockchain })), { nft } = _a, abstractSdk = tslib_1.__rest(_a, ["nft"]);
17
18
  const { deployNFTSmartContract, mintNFT, transferNFT, mintMultipleNFTs, burnNFT, updateNFTRoyalty, getNFTTransaction, getNFTAccountBalance, getNFTMetadataURI, getNFTRoyalty, } = nft;
18
- return Object.assign(Object.assign({}, abstractSdk), { transaction: txService.native, trc10: txService.trc10, trc20: txService.trc20, nft: Object.assign(Object.assign({}, txService.trc721), { deployNFTSmartContract,
19
+ return Object.assign(Object.assign({}, abstractSdk), { transaction: txService.native, trc10: txService.trc10, trc20: txService.trc20, kms: (0, tron_kms_1.tronKmsService)({ blockchain }), nft: Object.assign(Object.assign({}, txService.trc721), { deployNFTSmartContract,
19
20
  mintNFT,
20
21
  transferNFT,
21
22
  mintMultipleNFTs,
@@ -1 +1 @@
1
- {"version":3,"file":"tron.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/tron/src/lib/tron.sdk.ts"],"names":[],"mappings":";;;;AAAA,oDAAiD;AACjD,sDAAiD;AAEjD,oFAA2E;AAC3E,kDAA6C;AAC7C,gDAA2C;AAC3C,wDAAmD;AACnD,wDAAmD;AAEnD,MAAM,UAAU,GAAG,wBAAU,CAAC,IAAI,CAAA;AAE3B,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,EAAE;IACjD,MAAM,GAAG,GAAG,IAAA,kBAAO,GAAE,CAAA;IACrB,MAAM,SAAS,GAAG,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;IAC1C,MAAM,KAA0B,IAAA,kDAAqB,kCAAM,IAAI,KAAE,UAAU,IAAG,EAAxE,EAAE,GAAG,OAAmE,EAA9D,WAAW,sBAArB,OAAuB,CAAiD,CAAA;IAE9E,MAAM,EACJ,sBAAsB,EACtB,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,GACd,GAAG,GAAG,CAAA;IAEP,uCACK,WAAW,KACd,WAAW,EAAE,SAAS,CAAC,MAAM,EAC7B,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,GAAG,kCACE,SAAS,CAAC,MAAM,KACnB,sBAAsB;YACtB,OAAO;YACP,WAAW;YACX,gBAAgB;YAChB,OAAO;YACP,gBAAgB;YAChB,iBAAiB;YACjB,oBAAoB;YACpB,iBAAiB;YACjB,aAAa,KAEf,WAAW,EAAE,SAAS,CAAC,WAAW,EAClC,aAAa,EAAE,SAAS,CAAC,aAAa,EACtC,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,MAAM,EAAE,IAAA,wBAAU,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EACpC,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,IAAA,wBAAU,GAAE,EACpB,UAAU,EAAE;YACV,SAAS,EAAE,wBAAW,CAAC,aAAa;YACpC,eAAe,EAAE,wBAAW,CAAC,mBAAmB;YAChD,QAAQ,EAAE,wBAAW,CAAC,YAAY;YAClC,cAAc,EAAE,wBAAW,CAAC,eAAe;YAC3C,UAAU,EAAE,wBAAW,CAAC,cAAc;YACtC,cAAc,EAAE,wBAAW,CAAC,kBAAkB;YAC9C,eAAe,EAAE,wBAAW,CAAC,YAAY;SAC1C,IACF;AACH,CAAC,CAAA;AApDY,QAAA,YAAY,gBAoDxB"}
1
+ {"version":3,"file":"tron.sdk.js","sourceRoot":"","sources":["../../../../../../packages/blockchain/tron/src/lib/tron.sdk.ts"],"names":[],"mappings":";;;;AAAA,oDAAiD;AACjD,sDAAiD;AAEjD,oFAA2E;AAC3E,kDAA6C;AAC7C,gDAA2C;AAC3C,wDAAmD;AACnD,wDAAmD;AACnD,kDAAoD;AAEpD,MAAM,UAAU,GAAG,wBAAU,CAAC,IAAI,CAAA;AAE3B,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,EAAE;IAC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