@autonomys/auto-consensus 1.5.15 → 1.5.17

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.
@@ -1,4 +1,4 @@
1
- import { Api } from '@autonomys/auto-utils';
1
+ import { Api, type DomainParams } from '@autonomys/auto-utils';
2
2
  import type { BalanceData } from './types/balance';
3
3
  /**
4
4
  * Retrieves the total token issuance of the network.
@@ -6,7 +6,7 @@ import type { BalanceData } from './types/balance';
6
6
  * This function queries the blockchain to get the total amount of tokens that have been issued
7
7
  * across the entire network. This includes all tokens in circulation, staked, reserved, and frozen.
8
8
  *
9
- * @param networkId - Optional network identifier. If not provided, uses the default network
9
+ * @param networkId - Either a networkId string for consensus, or { networkId, domainId } to query a domain
10
10
  * @returns Promise that resolves to a Codec containing the total issuance value as a hex string
11
11
  * @throws Error if the network connection fails or the query is unsuccessful
12
12
  *
@@ -19,11 +19,14 @@ import type { BalanceData } from './types/balance';
19
19
  * const totalTokens = BigInt(issuance.toString())
20
20
  * console.log(`Total tokens issued: ${totalTokens}`)
21
21
  *
22
- * // Query for specific network
23
- * const taurusIssuance = await totalIssuance('taurus')
22
+ * // Query for specific network (consensus)
23
+ * const chronosIssuance = await totalIssuance('chronos')
24
+ *
25
+ * // Query Auto-EVM domain on Chronos
26
+ * const evmIssuance = await totalIssuance({ networkId: 'chronos', domainId: '0' })
24
27
  * ```
25
28
  */
26
- export declare const totalIssuance: (networkId?: string) => Promise<import("@autonomys/auto-utils").Codec>;
29
+ export declare const totalIssuance: (networkId?: string | DomainParams) => Promise<import("@autonomys/auto-utils").Codec>;
27
30
  /**
28
31
  * Retrieves the balance information for a specific account.
29
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../src/balances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,GAAU,YAAY,MAAM,mDAQrD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,GAAU,KAAK,GAAG,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,WAAW,CAY5E,CAAA"}
1
+ {"version":3,"file":"balances.d.ts","sourceRoot":"","sources":["../src/balances.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAExF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,GAAU,YAAY,MAAM,GAAG,YAAY,mDASpE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,GAAU,KAAK,GAAG,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,WAAW,CAY5E,CAAA"}
package/dist/balances.js CHANGED
@@ -18,7 +18,7 @@ const account_1 = require("./account");
18
18
  * This function queries the blockchain to get the total amount of tokens that have been issued
19
19
  * across the entire network. This includes all tokens in circulation, staked, reserved, and frozen.
20
20
  *
21
- * @param networkId - Optional network identifier. If not provided, uses the default network
21
+ * @param networkId - Either a networkId string for consensus, or { networkId, domainId } to query a domain
22
22
  * @returns Promise that resolves to a Codec containing the total issuance value as a hex string
23
23
  * @throws Error if the network connection fails or the query is unsuccessful
24
24
  *
@@ -31,14 +31,19 @@ const account_1 = require("./account");
31
31
  * const totalTokens = BigInt(issuance.toString())
32
32
  * console.log(`Total tokens issued: ${totalTokens}`)
33
33
  *
34
- * // Query for specific network
35
- * const taurusIssuance = await totalIssuance('taurus')
34
+ * // Query for specific network (consensus)
35
+ * const chronosIssuance = await totalIssuance('chronos')
36
+ *
37
+ * // Query Auto-EVM domain on Chronos
38
+ * const evmIssuance = await totalIssuance({ networkId: 'chronos', domainId: '0' })
36
39
  * ```
37
40
  */
38
41
  const totalIssuance = (networkId) => __awaiter(void 0, void 0, void 0, function* () {
39
- // Get the api instance for the network
40
- const api = yield (0, auto_utils_1.activate)({ networkId });
41
- // Get the current total token issuance
42
+ // Determine whether to connect to consensus or a domain
43
+ const isDomain = typeof networkId === 'object' && networkId !== null && 'domainId' in networkId;
44
+ const api = yield (isDomain
45
+ ? (0, auto_utils_1.activateDomain)(networkId)
46
+ : (0, auto_utils_1.activate)(networkId ? { networkId } : undefined));
42
47
  const totalIssuance = yield api.query.balances.totalIssuance();
43
48
  return totalIssuance;
44
49
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autonomys/auto-consensus",
3
- "version": "1.5.15",
3
+ "version": "1.5.17",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "README.md"
26
26
  ],
27
27
  "dependencies": {
28
- "@autonomys/auto-utils": "^1.5.15"
28
+ "@autonomys/auto-utils": "^1.5.17"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/jest": "^29.5.14",
@@ -35,5 +35,5 @@
35
35
  "ts-jest": "^29.3.1",
36
36
  "typescript": "^5.8.3"
37
37
  },
38
- "gitHead": "0404d3d11744da950db8bab243fa2f5d9883edbd"
38
+ "gitHead": "890e12b9cc437f3f4409b74663a77b854bf048aa"
39
39
  }