@onekeyfe/cardano-coin-selection-asmjs 1.1.3 → 1.1.4

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.
@@ -0,0 +1 @@
1
+ export declare const hasSetTagWithBody: (txBodyHex: string) => boolean;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.hasSetTagWithBody = void 0;
27
+ const CardanoWasm = __importStar(require("@emurgo/cardano-serialization-lib-asmjs"));
28
+ const hasSetTagWithBody = (txBodyHex) => {
29
+ const txBody = CardanoWasm.TransactionBody.from_bytes(Uint8Array.from(Buffer.from(txBodyHex, 'hex')));
30
+ const witnesses = CardanoWasm.TransactionWitnessSet.new();
31
+ const tx = CardanoWasm.Transaction.new(txBody, witnesses);
32
+ let tagCborSets = false;
33
+ try {
34
+ const tagCBOR = CardanoWasm.has_transaction_set_tag(tx.to_bytes()).valueOf();
35
+ tagCborSets =
36
+ tagCBOR === CardanoWasm.TransactionSetsState.AllSetsHaveTag.valueOf() ||
37
+ tagCBOR === CardanoWasm.TransactionSetsState.MixedSets.valueOf();
38
+ }
39
+ catch (error) {
40
+ // ignore
41
+ }
42
+ return tagCborSets;
43
+ };
44
+ exports.hasSetTagWithBody = hasSetTagWithBody;
@@ -45,5 +45,6 @@ declare const onekeyUtils: {
45
45
  referenceInputs: null;
46
46
  tagCborSets: boolean;
47
47
  }>;
48
+ hasSetTagWithBody: (txBodyHex: string) => boolean;
48
49
  };
49
50
  export { onekeyUtils, dAppUtils };
@@ -6,10 +6,12 @@ const signTx_1 = require("./signTx");
6
6
  const dapp_1 = require("./dapp");
7
7
  Object.defineProperty(exports, "dAppUtils", { enumerable: true, get: function () { return dapp_1.dAppUtils; } });
8
8
  const txToOneKey_1 = require("./txToOneKey");
9
+ const hasSetTag_1 = require("./hasSetTag");
9
10
  const onekeyUtils = {
10
11
  composeTxPlan: transaction_1.composeTxPlan,
11
12
  signTransaction: signTx_1.signTransaction,
12
13
  signTx: signTx_1.signTx,
13
14
  txToOneKey: txToOneKey_1.txToOneKey,
15
+ hasSetTagWithBody: hasSetTag_1.hasSetTagWithBody,
14
16
  };
15
17
  exports.onekeyUtils = onekeyUtils;
@@ -0,0 +1 @@
1
+ export declare const hasSetTagWithBody: (txBodyHex: string) => boolean;
@@ -0,0 +1,17 @@
1
+ import * as CardanoWasm from '@emurgo/cardano-serialization-lib-asmjs';
2
+ export const hasSetTagWithBody = (txBodyHex) => {
3
+ const txBody = CardanoWasm.TransactionBody.from_bytes(Uint8Array.from(Buffer.from(txBodyHex, 'hex')));
4
+ const witnesses = CardanoWasm.TransactionWitnessSet.new();
5
+ const tx = CardanoWasm.Transaction.new(txBody, witnesses);
6
+ let tagCborSets = false;
7
+ try {
8
+ const tagCBOR = CardanoWasm.has_transaction_set_tag(tx.to_bytes()).valueOf();
9
+ tagCborSets =
10
+ tagCBOR === CardanoWasm.TransactionSetsState.AllSetsHaveTag.valueOf() ||
11
+ tagCBOR === CardanoWasm.TransactionSetsState.MixedSets.valueOf();
12
+ }
13
+ catch (error) {
14
+ // ignore
15
+ }
16
+ return tagCborSets;
17
+ };
@@ -45,5 +45,6 @@ declare const onekeyUtils: {
45
45
  referenceInputs: null;
46
46
  tagCborSets: boolean;
47
47
  }>;
48
+ hasSetTagWithBody: (txBodyHex: string) => boolean;
48
49
  };
49
50
  export { onekeyUtils, dAppUtils };
@@ -2,10 +2,12 @@ import { composeTxPlan } from './transaction';
2
2
  import { signTransaction, signTx } from './signTx';
3
3
  import { dAppUtils } from './dapp';
4
4
  import { txToOneKey } from './txToOneKey';
5
+ import { hasSetTagWithBody } from './hasSetTag';
5
6
  const onekeyUtils = {
6
7
  composeTxPlan,
7
8
  signTransaction,
8
9
  signTx,
9
10
  txToOneKey,
11
+ hasSetTagWithBody,
10
12
  };
11
13
  export { onekeyUtils, dAppUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/cardano-coin-selection-asmjs",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "coin selection"