antelopeql 2.0.0-rc.29 → 2.0.0-rc.32

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.
@@ -3,7 +3,7 @@ import { GraphQLError, GraphQLNonNull, GraphQLString } from "graphql";
3
3
  import bytes_type from "../eosio_types/bytes_type.mjs";
4
4
  import name_type from "../eosio_types/name_type.mjs";
5
5
 
6
- const deserialize_action_data = {
6
+ const abi_bin_to_json = {
7
7
  description: "Returns a JSON object containing deserialized action data.",
8
8
  type: GraphQLString,
9
9
  args: {
@@ -42,4 +42,4 @@ const deserialize_action_data = {
42
42
  }
43
43
  };
44
44
 
45
- export default deserialize_action_data;
45
+ export default abi_bin_to_json;
@@ -44,12 +44,20 @@ const get_ram_price = {
44
44
  if (data.rows) {
45
45
  // Connector Balance / (Smart Token’s Outstanding supply × Connector Weight)
46
46
  const [RAM] = data.rows;
47
- const CORE_TOKEN = RAM.quote.balance.match(/[\sA-Z]+/gmu);
47
+
48
+ const CORE_ASSET = RAM.quote.balance;
49
+ const CORE_TOKEN = CORE_ASSET.match(/[\sA-Z]+/gmu);
50
+
51
+ const [, decimal] = String(
52
+ CORE_ASSET.replace(/[A-Za-z\s]+/gmu, "")
53
+ ).split(".");
54
+
55
+ const precision = decimal?.length ?? 0;
48
56
 
49
57
  const supply = RAM.base.balance.replace(" RAM", "");
50
58
  const total_value = RAM.quote.balance.replace(CORE_TOKEN, "");
51
59
  const byte_price = quantity * (total_value / supply);
52
- return byte_price + CORE_TOKEN;
60
+ return parseFloat(byte_price).toFixed(precision) + CORE_TOKEN;
53
61
  }
54
62
  }
55
63
  };
@@ -103,6 +103,7 @@ const get_table = {
103
103
  );
104
104
 
105
105
  const uri = `${rpc_url}/v1/chain/get_table_by_scope`;
106
+
106
107
  const data = await fetch(uri, {
107
108
  method: "POST",
108
109
  ...fetchOptions,
@@ -1,6 +1,6 @@
1
1
  import { GraphQLError, GraphQLObjectType } from "graphql";
2
2
 
3
- import deserialize_action_data from "./blockchain/deserialize_action_data.mjs";
3
+ import abi_bin_to_json from "./blockchain/abi_bin_to_json.mjs";
4
4
  import get_abi from "./blockchain/get_abi.mjs";
5
5
  import get_account from "./blockchain/get_account.mjs";
6
6
  import get_accounts_by_authorizers from "./blockchain/get_accounts_by_authorizers.mjs";
@@ -31,7 +31,7 @@ const blockchain_query_field = {
31
31
  get_producers,
32
32
  get_table,
33
33
  get_ram_price,
34
- deserialize_action_data
34
+ abi_bin_to_json
35
35
  }
36
36
  }),
37
37
  resolve(root, arg, getContext, info) {
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "antelopeql",
3
- "version": "2.0.0-rc.29",
3
+ "version": "2.0.0-rc.32",
4
4
  "description": "A GraphQL implementation for interacting with Antelope based blockchains.",
5
- "repository": "github:pur3miish/antelopeql",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/pur3miish/antelopeql.git"
8
+ },
6
9
  "bugs": "https://github.com/pur3miish/antelopeql/issues",
7
10
  "homepage": "https://github.com/pur3miish/antelopeql#readme",
8
11
  "author": "pur3miish",
@@ -16,7 +19,7 @@
16
19
  "snapshot": "SAVE_SNAPSHOTS=1 coverage-node test/index.test.mjs",
17
20
  "coverage": "coverage-node test/index.test.mjs",
18
21
  "tests": "node test/index.test.mjs",
19
- "test": "npm run eslint && npm run prettier && npm run types && npm run tests",
22
+ "test": "npm run eslint",
20
23
  "prepublishOnly": "npm test"
21
24
  },
22
25
  "engines": {