@argonprotocol/mainchain 0.0.17 → 0.0.18

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.
Files changed (57) hide show
  1. package/README.md +46 -0
  2. package/lib/cjs/WageProtector.d.ts +37 -0
  3. package/lib/cjs/WageProtector.js +63 -0
  4. package/lib/cjs/WageProtector.js.map +1 -0
  5. package/lib/cjs/__test__/WageProtector.test.d.ts +1 -0
  6. package/lib/cjs/__test__/WageProtector.test.js +28 -0
  7. package/lib/cjs/__test__/WageProtector.test.js.map +1 -0
  8. package/lib/cjs/index.d.ts +16 -1
  9. package/lib/cjs/index.js +22 -7
  10. package/lib/cjs/index.js.map +1 -1
  11. package/lib/cjs/interfaces/augment-api-consts.d.ts +34 -7
  12. package/lib/cjs/interfaces/augment-api-errors.d.ts +115 -4
  13. package/lib/cjs/interfaces/augment-api-events.d.ts +172 -14
  14. package/lib/cjs/interfaces/augment-api-query.d.ts +160 -29
  15. package/lib/cjs/interfaces/augment-api-tx.d.ts +140 -13
  16. package/lib/cjs/interfaces/augment-types.d.ts +4 -1
  17. package/lib/cjs/interfaces/lookup.d.ts +809 -307
  18. package/lib/cjs/interfaces/lookup.js +840 -338
  19. package/lib/cjs/interfaces/lookup.js.map +1 -1
  20. package/lib/cjs/interfaces/registry.d.ts +55 -9
  21. package/lib/cjs/interfaces/types-lookup.d.ts +792 -328
  22. package/lib/esm/WageProtector.d.ts +37 -0
  23. package/lib/esm/WageProtector.js +59 -0
  24. package/lib/esm/WageProtector.js.map +1 -0
  25. package/lib/esm/__test__/WageProtector.test.d.ts +1 -0
  26. package/lib/esm/__test__/WageProtector.test.js +26 -0
  27. package/lib/esm/__test__/WageProtector.test.js.map +1 -0
  28. package/lib/esm/index.d.ts +16 -1
  29. package/lib/esm/index.js +16 -2
  30. package/lib/esm/index.js.map +1 -1
  31. package/lib/esm/interfaces/augment-api-consts.d.ts +34 -7
  32. package/lib/esm/interfaces/augment-api-errors.d.ts +115 -4
  33. package/lib/esm/interfaces/augment-api-events.d.ts +172 -14
  34. package/lib/esm/interfaces/augment-api-query.d.ts +160 -29
  35. package/lib/esm/interfaces/augment-api-tx.d.ts +140 -13
  36. package/lib/esm/interfaces/augment-types.d.ts +4 -1
  37. package/lib/esm/interfaces/lookup.d.ts +809 -307
  38. package/lib/esm/interfaces/lookup.js +840 -338
  39. package/lib/esm/interfaces/lookup.js.map +1 -1
  40. package/lib/esm/interfaces/registry.d.ts +55 -9
  41. package/lib/esm/interfaces/types-lookup.d.ts +792 -328
  42. package/lib/tsconfig-cjs.tsbuildinfo +1 -1
  43. package/lib/tsconfig-types.tsbuildinfo +1 -1
  44. package/lib/tsconfig.tsbuildinfo +1 -1
  45. package/lib/types/WageProtector.d.ts +37 -0
  46. package/lib/types/__test__/WageProtector.test.d.ts +1 -0
  47. package/lib/types/index.d.ts +16 -1
  48. package/lib/types/interfaces/augment-api-consts.d.ts +34 -7
  49. package/lib/types/interfaces/augment-api-errors.d.ts +115 -4
  50. package/lib/types/interfaces/augment-api-events.d.ts +172 -14
  51. package/lib/types/interfaces/augment-api-query.d.ts +160 -29
  52. package/lib/types/interfaces/augment-api-tx.d.ts +140 -13
  53. package/lib/types/interfaces/augment-types.d.ts +4 -1
  54. package/lib/types/interfaces/lookup.d.ts +809 -307
  55. package/lib/types/interfaces/registry.d.ts +55 -9
  56. package/lib/types/interfaces/types-lookup.d.ts +792 -328
  57. package/package.json +28 -7
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ This is a Node.js client for the Argon Protocol (https://argonprotocol.org). It is mostly autogenerated from the
2
+ polkadot.js api (https://polkadot.js.org/api/).
3
+
4
+ ## Usage
5
+
6
+ To create a client, you can use the `getClient(host)` function in the main module. This will return a client object that
7
+ is typed to the argon apis.
8
+
9
+ ## Wage Protector
10
+
11
+ If you want to protect wages against inflation or deflation of the Argon, there is a `WageProtector` class that can be
12
+ used. You can use it a single time:
13
+
14
+ ```javascript
15
+ const {WageProtector} = require('@argonprotocol/mainchain');
16
+ const basePrice = 1_000_000n; // 1 Argon
17
+ const protector = await WageProtector.create(client);
18
+ const protectedPrice = protector.getProtectedWage(basePrice);
19
+ ```
20
+
21
+ Or you can subscribe to changes (for instance, to track a series of valid cpi adjustments):
22
+
23
+ ```javascript
24
+
25
+ const {WageProtector} = require('@argonprotocol/mainchain');
26
+ const basePrice = 1_000_000n; // 1 Argon
27
+ const {unsubscribe} = await WageProtector.subscribe(client, (protectedPrice) => {
28
+ console.log(`Protected price: ${protectedPrice.getProtectedWage(basePrice)}`);
29
+ });
30
+ ```
31
+
32
+ Each `WageProtector` instance has the details of the Argon Target Price and USD price at the time of creation.
33
+
34
+ ```typescript
35
+
36
+ interface IArgonCpiSnapshot {
37
+ // The target price of the argon as a fixed point number (18 decimals)
38
+ argonUsdTargetPrice: bigint;
39
+ // The current price of the argon as a fixed point number (18 decimals)
40
+ argonUsdPrice: bigint;
41
+ // The block hash in which the cpi was finalized
42
+ finalizedBlock: Uint8Array;
43
+ // The tick that the cpi applies to
44
+ tick: bigint;
45
+ }
46
+ ```
@@ -0,0 +1,37 @@
1
+ import { ArgonClient } from "./index";
2
+ export interface IArgonCpiSnapshot {
3
+ argonUsdTargetPrice: bigint;
4
+ argonUsdPrice: bigint;
5
+ finalizedBlock: Uint8Array;
6
+ tick: bigint;
7
+ }
8
+ /**
9
+ * The WageProtector class is used to protect wages from inflation by using the current Argon Price Index to adjust the
10
+ * baseAmount to current conditions. This ensures that the wage is always stable and does not lose or gain value based on
11
+ * demand for the argon or fiat monetary supply changes.
12
+ */
13
+ export declare class WageProtector {
14
+ latestCpi: IArgonCpiSnapshot;
15
+ constructor(latestCpi: IArgonCpiSnapshot);
16
+ /**
17
+ * Converts the base wage to the current wage using the latest CPI snapshot
18
+ *
19
+ * @param baseWage The base wage to convert
20
+ * @returns The protected wage
21
+ */
22
+ getProtectedWage(baseWage: bigint): bigint;
23
+ /**
24
+ * Subscribes to the current CPI and calls the callback function whenever the CPI changes
25
+ * @param client The ArgonClient to use
26
+ * @param callback The callback function to call when the CPI changes
27
+ * @returns An object with an unsubscribe function that can be called to stop the subscription
28
+ */
29
+ static subscribe(client: ArgonClient, callback: (cpi: WageProtector) => void): Promise<{
30
+ unsubscribe: () => void;
31
+ }>;
32
+ /**
33
+ * Creates a new WageProtector instance by subscribing to the current CPI and waiting for the first value
34
+ * @param client The ArgonClient to use
35
+ */
36
+ static create(client: ArgonClient): Promise<WageProtector>;
37
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WageProtector = void 0;
4
+ /**
5
+ * The WageProtector class is used to protect wages from inflation by using the current Argon Price Index to adjust the
6
+ * baseAmount to current conditions. This ensures that the wage is always stable and does not lose or gain value based on
7
+ * demand for the argon or fiat monetary supply changes.
8
+ */
9
+ class WageProtector {
10
+ latestCpi;
11
+ constructor(latestCpi) {
12
+ this.latestCpi = latestCpi;
13
+ }
14
+ /**
15
+ * Converts the base wage to the current wage using the latest CPI snapshot
16
+ *
17
+ * @param baseWage The base wage to convert
18
+ * @returns The protected wage
19
+ */
20
+ getProtectedWage(baseWage) {
21
+ return baseWage * this.latestCpi.argonUsdTargetPrice / this.latestCpi.argonUsdPrice;
22
+ }
23
+ /**
24
+ * Subscribes to the current CPI and calls the callback function whenever the CPI changes
25
+ * @param client The ArgonClient to use
26
+ * @param callback The callback function to call when the CPI changes
27
+ * @returns An object with an unsubscribe function that can be called to stop the subscription
28
+ */
29
+ static async subscribe(client, callback) {
30
+ const unsubscribe = await client.query.priceIndex.current(async (cpi) => {
31
+ if (cpi.isNone) {
32
+ return;
33
+ }
34
+ const finalizedBlock = await client.rpc.chain.getFinalizedHead();
35
+ callback(new WageProtector({
36
+ argonUsdTargetPrice: cpi.value.argonUsdTargetPrice.toBigInt(),
37
+ argonUsdPrice: cpi.value.argonUsdPrice.toBigInt(),
38
+ finalizedBlock: finalizedBlock.toU8a(),
39
+ tick: cpi.value.tick.toBigInt(),
40
+ }));
41
+ });
42
+ return { unsubscribe };
43
+ }
44
+ /**
45
+ * Creates a new WageProtector instance by subscribing to the current CPI and waiting for the first value
46
+ * @param client The ArgonClient to use
47
+ */
48
+ static async create(client) {
49
+ return new Promise(async (resolve, reject) => {
50
+ try {
51
+ const { unsubscribe } = await WageProtector.subscribe(client, (x) => {
52
+ resolve(x);
53
+ unsubscribe();
54
+ });
55
+ }
56
+ catch (e) {
57
+ reject(e);
58
+ }
59
+ });
60
+ }
61
+ }
62
+ exports.WageProtector = WageProtector;
63
+ //# sourceMappingURL=WageProtector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WageProtector.js","sourceRoot":"","sources":["../../src/WageProtector.ts"],"names":[],"mappings":";;;AAYA;;;;GAIG;AACH,MAAa,aAAa;IACH;IAAnB,YAAmB,SAA4B;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAC/C,CAAC;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,QAAgB;QACpC,OAAO,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAmB,EAAE,QAAsC;QAGrF,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACpE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAEjE,QAAQ,CAAC,IAAI,aAAa,CAAC;gBACvB,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE;gBAC7D,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;gBACjD,cAAc,EAAE,cAAc,CAAC,KAAK,EAAE;gBACtC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE;aAClC,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;QACH,OAAO,EAAC,WAAW,EAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAmB;QAC1C,OAAO,IAAI,OAAO,CAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACxD,IAAI,CAAC;gBACD,MAAM,EAAC,WAAW,EAAC,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;oBAC9D,OAAO,CAAC,CAAC,CAAC,CAAC;oBACX,WAAW,EAAE,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,MAAM,CAAC,CAAC,CAAC,CAAC;YACd,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAvDD,sCAuDC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../index");
4
+ it('adjusts the price of a wage for inflation', async () => {
5
+ await (0, index_1.waitForLoad)();
6
+ const wageProtector = new index_1.WageProtector({
7
+ argonUsdTargetPrice: 1010000000000000000n,
8
+ argonUsdPrice: 1000000000000000000n,
9
+ tick: 1n,
10
+ finalizedBlock: Buffer.from([])
11
+ });
12
+ // if price of argon is below the target price, we have argon inflation, which means we need to increase the wage
13
+ // to keep the value of the wage stable. It will take 1.01 argon to buy the same amount of goods.
14
+ expect(wageProtector.getProtectedWage(2500n)).toBe(BigInt(2500 * 1.01));
15
+ });
16
+ it('adjusts the price of a wage for deflation', async () => {
17
+ await (0, index_1.waitForLoad)();
18
+ const wageProtector = new index_1.WageProtector({
19
+ argonUsdTargetPrice: 1000000000000000000n,
20
+ argonUsdPrice: 1010000000000000000n,
21
+ tick: 1n,
22
+ finalizedBlock: Buffer.from([])
23
+ });
24
+ // if price of argon is below the target price, we have argon deflation, which means we need to decrease the wages to
25
+ // match the argon's market value.
26
+ expect(wageProtector.getProtectedWage(2500n)).toBe(BigInt(2500 * 0.99));
27
+ });
28
+ //# sourceMappingURL=WageProtector.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WageProtector.test.js","sourceRoot":"","sources":["../../../src/__test__/WageProtector.test.ts"],"names":[],"mappings":";;AAAA,oCAAoD;AAGpD,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;IACvD,MAAM,IAAA,mBAAW,GAAE,CAAC;IACpB,MAAM,aAAa,GAAG,IAAI,qBAAa,CAAC;QACpC,mBAAmB,EAAE,oBAA0B;QAC/C,aAAa,EAAE,oBAA0B;QACzC,IAAI,EAAE,EAAE;QACR,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;KAClC,CAAC,CAAC;IAEH,iHAAiH;IACjH,iGAAiG;IACjG,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;IACvD,MAAM,IAAA,mBAAW,GAAE,CAAC;IACpB,MAAM,aAAa,GAAG,IAAI,qBAAa,CAAC;QACpC,mBAAmB,EAAE,oBAA0B;QAC/C,aAAa,EAAE,oBAA0B;QACzC,IAAI,EAAE,EAAE;QACR,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;KAClC,CAAC,CAAC;IAEH,qHAAqH;IACrH,kCAAkC;IAClC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
@@ -3,15 +3,30 @@ import "./interfaces/augment-types.js";
3
3
  import "./interfaces/types-lookup.js";
4
4
  import { KeyringPair, KeyringPair$Json } from "@polkadot/keyring/types";
5
5
  import { ApiPromise, Keyring } from '@polkadot/api';
6
- import { mnemonicGenerate, decodeAddress } from '@polkadot/util-crypto';
6
+ import { decodeAddress, mnemonicGenerate } from '@polkadot/util-crypto';
7
7
  import { EventRecord } from "@polkadot/types/interfaces/system";
8
8
  import { InterfaceTypes } from '@polkadot/types/types/registry';
9
9
  import { KeypairType } from "@polkadot/util-crypto/types";
10
+ export { WageProtector } from "./WageProtector";
10
11
  export { Keyring, KeyringPair, KeyringPair$Json, KeypairType, mnemonicGenerate, decodeAddress };
11
12
  export * from "@polkadot/types";
12
13
  export * from '@polkadot/types/lookup';
13
14
  export { InterfaceTypes as interfaces };
14
15
  export type ArgonClient = ApiPromise;
16
+ /**
17
+ * Wait for the crypto library to be ready (requires wasm, which needs async loading in commonjs)
18
+ */
15
19
  export declare function waitForLoad(): Promise<void>;
20
+ /**
21
+ * Get a client for the given host
22
+ * @param host The host to connect to
23
+ * @returns The client
24
+ */
16
25
  export declare function getClient(host: string): Promise<ArgonClient>;
26
+ /**
27
+ * Check for an extrinsic success event in the given events. Helpful to validate the result of an extrinsic inclusion in a block (it will be included even if it fails)
28
+ * @param events The events to check
29
+ * @param client The client to use
30
+ * @returns A promise that resolves if the extrinsic was successful, and rejects if it failed
31
+ */
17
32
  export declare function checkForExtrinsicSuccess(events: EventRecord[], client: ArgonClient): Promise<void>;
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkForExtrinsicSuccess = exports.getClient = exports.waitForLoad = exports.decodeAddress = exports.mnemonicGenerate = exports.Keyring = void 0;
3
+ exports.decodeAddress = exports.mnemonicGenerate = exports.Keyring = exports.WageProtector = void 0;
4
+ exports.waitForLoad = waitForLoad;
5
+ exports.getClient = getClient;
6
+ exports.checkForExtrinsicSuccess = checkForExtrinsicSuccess;
4
7
  const tslib_1 = require("tslib");
5
8
  require("./interfaces/augment-api.js");
6
9
  require("./interfaces/augment-types.js");
@@ -8,20 +11,33 @@ require("./interfaces/types-lookup.js");
8
11
  const api_1 = require("@polkadot/api");
9
12
  Object.defineProperty(exports, "Keyring", { enumerable: true, get: function () { return api_1.Keyring; } });
10
13
  const util_crypto_1 = require("@polkadot/util-crypto");
11
- Object.defineProperty(exports, "mnemonicGenerate", { enumerable: true, get: function () { return util_crypto_1.mnemonicGenerate; } });
12
14
  Object.defineProperty(exports, "decodeAddress", { enumerable: true, get: function () { return util_crypto_1.decodeAddress; } });
13
- const util_crypto_2 = require("@polkadot/util-crypto");
15
+ Object.defineProperty(exports, "mnemonicGenerate", { enumerable: true, get: function () { return util_crypto_1.mnemonicGenerate; } });
16
+ var WageProtector_1 = require("./WageProtector");
17
+ Object.defineProperty(exports, "WageProtector", { enumerable: true, get: function () { return WageProtector_1.WageProtector; } });
14
18
  tslib_1.__exportStar(require("@polkadot/types"), exports);
15
19
  tslib_1.__exportStar(require("@polkadot/types/lookup"), exports);
20
+ /**
21
+ * Wait for the crypto library to be ready (requires wasm, which needs async loading in commonjs)
22
+ */
16
23
  async function waitForLoad() {
17
- await (0, util_crypto_2.cryptoWaitReady)();
24
+ await (0, util_crypto_1.cryptoWaitReady)();
18
25
  }
19
- exports.waitForLoad = waitForLoad;
26
+ /**
27
+ * Get a client for the given host
28
+ * @param host The host to connect to
29
+ * @returns The client
30
+ */
20
31
  async function getClient(host) {
21
32
  const provider = new api_1.WsProvider(host);
22
33
  return await api_1.ApiPromise.create({ provider, noInitWarn: true });
23
34
  }
24
- exports.getClient = getClient;
35
+ /**
36
+ * Check for an extrinsic success event in the given events. Helpful to validate the result of an extrinsic inclusion in a block (it will be included even if it fails)
37
+ * @param events The events to check
38
+ * @param client The client to use
39
+ * @returns A promise that resolves if the extrinsic was successful, and rejects if it failed
40
+ */
25
41
  function checkForExtrinsicSuccess(events, client) {
26
42
  return new Promise((resolve, reject) => {
27
43
  for (const { event } of events) {
@@ -41,5 +57,4 @@ function checkForExtrinsicSuccess(events, client) {
41
57
  }
42
58
  });
43
59
  }
44
- exports.checkForExtrinsicSuccess = checkForExtrinsicSuccess;
45
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,uCAAqC;AACrC,yCAAuC;AACvC,wCAAsC;AAEtC,uCAA8D;AAOtD,wFAPY,aAAO,OAOZ;AANf,uDAAsE;AAMT,iGANrD,8BAAgB,OAMqD;AAAE,8FANrD,2BAAa,OAMqD;AAF5F,uDAAsD;AAItD,0DAAgC;AAChC,iEAAuC;AAKhC,KAAK,UAAU,WAAW;IAC7B,MAAM,IAAA,6BAAe,GAAE,CAAC;AAC5B,CAAC;AAFD,kCAEC;AAEM,KAAK,UAAU,SAAS,CAAC,IAAY;IACxC,MAAM,QAAQ,GAAG,IAAI,gBAAU,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,gBAAU,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC;AACjE,CAAC;AAHD,8BAGC;AAED,SAAgB,wBAAwB,CAAC,MAAqB,EAAE,MAAmB;IAC/E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,KAAK,MAAM,EAAC,KAAK,EAAC,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,OAAO,EAAE,CAAC;YACd,CAAC;iBAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxD,kCAAkC;gBAClC,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;gBACnC,IAAI,SAAS,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;gBAEzC,IAAI,aAAa,CAAC,QAAQ,EAAE,CAAC;oBACzB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACtE,SAAS,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACrD,CAAC;gBAED,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3F,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAnBD,4DAmBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAwBA,kCAEC;AAOD,8BAGC;AAQD,4DAmBC;;AA/DD,uCAAqC;AACrC,yCAAuC;AACvC,wCAAsC;AAEtC,uCAA8D;AAQtD,wFARY,aAAO,OAQZ;AAPf,uDAAuF;AAOR,8FAPtD,2BAAa,OAOsD;AAA/B,iGAPrB,8BAAgB,OAOqB;AAF7E,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AAIrB,0DAAgC;AAChC,iEAAuC;AAMvC;;GAEG;AACI,KAAK,UAAU,WAAW;IAC7B,MAAM,IAAA,6BAAe,GAAE,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,SAAS,CAAC,IAAY;IACxC,MAAM,QAAQ,GAAG,IAAI,gBAAU,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,gBAAU,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,MAAqB,EAAE,MAAmB;IAC/E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,KAAK,MAAM,EAAC,KAAK,EAAC,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,OAAO,EAAE,CAAC;YACd,CAAC;iBAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxD,kCAAkC;gBAClC,MAAM,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;gBACnC,IAAI,SAAS,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;gBAEzC,IAAI,aAAa,CAAC,QAAQ,EAAE,CAAC;oBACzB,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACtE,SAAS,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;gBACrD,CAAC;gBAED,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC;YAC3F,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import '@polkadot/api-base/types/consts';
2
2
  import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';
3
3
  import type { u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
4
+ import type { ITuple } from '@polkadot/types-codec/types';
4
5
  import type { FrameSupportPalletId, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight } from '@polkadot/types/lookup';
5
6
  export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
6
7
  declare module '@polkadot/api-base/types/consts' {
@@ -47,13 +48,17 @@ declare module '@polkadot/api-base/types/consts' {
47
48
  };
48
49
  blockRewards: {
49
50
  /**
50
- * Number of argons minted per block
51
+ * The block number at which the halving begins for ownership shares
51
52
  **/
52
- argonsPerBlock: u128 & AugmentedConst<ApiType>;
53
+ halvingBeginBlock: u32 & AugmentedConst<ApiType>;
53
54
  /**
54
55
  * Number of blocks for halving of ownership share rewards
55
56
  **/
56
57
  halvingBlocks: u32 & AugmentedConst<ApiType>;
58
+ /**
59
+ * The growth path for both ownership and argons before halving
60
+ **/
61
+ incrementalGrowth: ITuple<[u128, u32, u128]> & AugmentedConst<ApiType>;
57
62
  /**
58
63
  * Blocks until a block reward is mature
59
64
  **/
@@ -62,17 +67,29 @@ declare module '@polkadot/api-base/types/consts' {
62
67
  * Percent as a number out of 100 of the block reward that goes to the miner.
63
68
  **/
64
69
  minerPayoutPercent: u128 & AugmentedConst<ApiType>;
70
+ /**
71
+ * Number of argons minted per block
72
+ **/
73
+ startingArgonsPerBlock: u128 & AugmentedConst<ApiType>;
65
74
  /**
66
75
  * Number of ownership tokens minted per block
67
76
  **/
68
77
  startingOwnershipTokensPerBlock: u128 & AugmentedConst<ApiType>;
69
78
  };
70
79
  blockSealSpec: {
80
+ /**
81
+ * The frequency we should update the compute difficulty
82
+ **/
83
+ computeDifficultyChangePeriod: u32 & AugmentedConst<ApiType>;
71
84
  /**
72
85
  * The number of historical compute times to use to calculate the rolling compute average
73
86
  * (for adjustment)
74
87
  **/
75
- changePeriod: u32 & AugmentedConst<ApiType>;
88
+ historicalComputeBlocksForAverage: u32 & AugmentedConst<ApiType>;
89
+ /**
90
+ * The number of historical vote blocks to use to calculate the rolling vote average
91
+ **/
92
+ historicalVoteBlocksForAverage: u32 & AugmentedConst<ApiType>;
76
93
  /**
77
94
  * The maximum active notaries allowed
78
95
  **/
@@ -124,7 +141,7 @@ declare module '@polkadot/api-base/types/consts' {
124
141
  * How long a transfer should remain in storage before returning. NOTE: there is a 2 tick
125
142
  * grace period where we will still allow a transfer
126
143
  **/
127
- transferExpirationTicks: u32 & AugmentedConst<ApiType>;
144
+ transferExpirationTicks: u64 & AugmentedConst<ApiType>;
128
145
  };
129
146
  grandpa: {
130
147
  /**
@@ -154,6 +171,10 @@ declare module '@polkadot/api-base/types/consts' {
154
171
  * The maximum number of Miners that the pallet can hold.
155
172
  **/
156
173
  maxMiners: u32 & AugmentedConst<ApiType>;
174
+ /**
175
+ * The minimum bond amount possible
176
+ **/
177
+ minimumBondAmount: u128 & AugmentedConst<ApiType>;
157
178
  /**
158
179
  * The max percent swing for the ownership bond amount per slot (from the last percent
159
180
  **/
@@ -214,7 +235,7 @@ declare module '@polkadot/api-base/types/consts' {
214
235
  * Number of ticks to delay changing a notaries' meta (this is to allow a window for
215
236
  * notaries to switch to new keys after a new key is finalized)
216
237
  **/
217
- metaChangesTickDelay: u32 & AugmentedConst<ApiType>;
238
+ metaChangesTickDelay: u64 & AugmentedConst<ApiType>;
218
239
  };
219
240
  ownership: {
220
241
  /**
@@ -256,11 +277,11 @@ declare module '@polkadot/api-base/types/consts' {
256
277
  /**
257
278
  * The maximum number of ticks to preserve a price index
258
279
  **/
259
- maxDowntimeTicksBeforeReset: u32 & AugmentedConst<ApiType>;
280
+ maxDowntimeTicksBeforeReset: u64 & AugmentedConst<ApiType>;
260
281
  /**
261
282
  * The oldest history to keep
262
283
  **/
263
- maxPriceAgeInTicks: u32 & AugmentedConst<ApiType>;
284
+ maxPriceAgeInTicks: u64 & AugmentedConst<ApiType>;
264
285
  };
265
286
  proxy: {
266
287
  /**
@@ -342,6 +363,12 @@ declare module '@polkadot/api-base/types/consts' {
342
363
  **/
343
364
  minimumPeriod: u64 & AugmentedConst<ApiType>;
344
365
  };
366
+ tokenGateway: {
367
+ /**
368
+ * The decimals of the native currency
369
+ **/
370
+ decimals: u8 & AugmentedConst<ApiType>;
371
+ };
345
372
  transactionPayment: {
346
373
  /**
347
374
  * A fee multiplier for `Operational` extrinsics to compute "virtual tip" to boost their
@@ -121,14 +121,14 @@ declare module '@polkadot/api-base/types/errors' {
121
121
  * The block vote did not reach the minimum voting power at time of the grandparent block
122
122
  **/
123
123
  InsufficientVotingPower: AugmentedError<ApiType>;
124
- /**
125
- * Message was not signed by a registered miner
126
- **/
127
- InvalidAuthoritySignature: AugmentedError<ApiType>;
128
124
  /**
129
125
  * The merkle proof of vote inclusion in the notebook is invalid
130
126
  **/
131
127
  InvalidBlockVoteProof: AugmentedError<ApiType>;
128
+ /**
129
+ * Invalid fork power parent
130
+ **/
131
+ InvalidForkPowerParent: AugmentedError<ApiType>;
132
132
  /**
133
133
  * Vote not submitted by the right miner
134
134
  **/
@@ -269,6 +269,56 @@ declare module '@polkadot/api-base/types/errors' {
269
269
  **/
270
270
  NotebookIncludesExpiredLocalchainTransfer: AugmentedError<ApiType>;
271
271
  };
272
+ digests: {
273
+ /**
274
+ * Failed to decode digests
275
+ **/
276
+ CouldNotDecodeDigest: AugmentedError<ApiType>;
277
+ /**
278
+ * Duplicate AuthorDigest found
279
+ **/
280
+ DuplicateAuthorDigest: AugmentedError<ApiType>;
281
+ /**
282
+ * Duplicate BlockVoteDigest found
283
+ **/
284
+ DuplicateBlockVoteDigest: AugmentedError<ApiType>;
285
+ /**
286
+ * Duplicate ForkPowerDigest found
287
+ **/
288
+ DuplicateForkPowerDigest: AugmentedError<ApiType>;
289
+ /**
290
+ * Duplicate NotebookDigest found
291
+ **/
292
+ DuplicateNotebookDigest: AugmentedError<ApiType>;
293
+ /**
294
+ * Duplicate ParentVotingKeyDigest found
295
+ **/
296
+ DuplicateParentVotingKeyDigest: AugmentedError<ApiType>;
297
+ /**
298
+ * Duplicate TickDigest found
299
+ **/
300
+ DuplicateTickDigest: AugmentedError<ApiType>;
301
+ /**
302
+ * Missing AuthorDigest
303
+ **/
304
+ MissingAuthorDigest: AugmentedError<ApiType>;
305
+ /**
306
+ * Missing BlockVoteDigest
307
+ **/
308
+ MissingBlockVoteDigest: AugmentedError<ApiType>;
309
+ /**
310
+ * Missing NotebookDigest
311
+ **/
312
+ MissingNotebookDigest: AugmentedError<ApiType>;
313
+ /**
314
+ * Missing ParentVotingKeyDigest
315
+ **/
316
+ MissingParentVotingKeyDigest: AugmentedError<ApiType>;
317
+ /**
318
+ * Missing TickDigest
319
+ **/
320
+ MissingTickDigest: AugmentedError<ApiType>;
321
+ };
272
322
  domains: {
273
323
  /**
274
324
  * Error decoding account from notary
@@ -323,6 +373,29 @@ declare module '@polkadot/api-base/types/errors' {
323
373
  **/
324
374
  TooSoon: AugmentedError<ApiType>;
325
375
  };
376
+ hyperbridge: {};
377
+ ismp: {
378
+ /**
379
+ * Couldn't update challenge period
380
+ **/
381
+ ChallengePeriodUpdateFailed: AugmentedError<ApiType>;
382
+ /**
383
+ * Encountered an error while creating the consensus client.
384
+ **/
385
+ ConsensusClientCreationFailed: AugmentedError<ApiType>;
386
+ /**
387
+ * Invalid ISMP message
388
+ **/
389
+ InvalidMessage: AugmentedError<ApiType>;
390
+ /**
391
+ * Requested message was not found
392
+ **/
393
+ MessageNotFound: AugmentedError<ApiType>;
394
+ /**
395
+ * Couldn't update unbonding period
396
+ **/
397
+ UnbondingPeriodUpdateFailed: AugmentedError<ApiType>;
398
+ };
326
399
  miningSlot: {
327
400
  AccountWouldBeBelowMinimum: AugmentedError<ApiType>;
328
401
  BidTooLow: AugmentedError<ApiType>;
@@ -663,6 +736,44 @@ declare module '@polkadot/api-base/types/errors' {
663
736
  Unauthorized: AugmentedError<ApiType>;
664
737
  };
665
738
  ticks: {};
739
+ tokenGateway: {
740
+ /**
741
+ * Asset Id creation failed
742
+ **/
743
+ AssetCreationError: AugmentedError<ApiType>;
744
+ /**
745
+ * Asset decimals not found
746
+ **/
747
+ AssetDecimalsNotFound: AugmentedError<ApiType>;
748
+ /**
749
+ * Error while teleporting asset
750
+ **/
751
+ AssetTeleportError: AugmentedError<ApiType>;
752
+ /**
753
+ * Coprocessor was not configured in the runtime
754
+ **/
755
+ CoprocessorNotConfigured: AugmentedError<ApiType>;
756
+ /**
757
+ * Asset or update Dispatch Error
758
+ **/
759
+ DispatchError: AugmentedError<ApiType>;
760
+ /**
761
+ * Only root or asset owner can update asset
762
+ **/
763
+ NotAssetOwner: AugmentedError<ApiType>;
764
+ /**
765
+ * Protocol Params have not been initialized
766
+ **/
767
+ NotInitialized: AugmentedError<ApiType>;
768
+ /**
769
+ * Unknown Asset
770
+ **/
771
+ UnknownAsset: AugmentedError<ApiType>;
772
+ /**
773
+ * A asset that has not been registered
774
+ **/
775
+ UnregisteredAsset: AugmentedError<ApiType>;
776
+ };
666
777
  txPause: {
667
778
  /**
668
779
  * The call is paused.