@argonprotocol/mainchain 1.0.18 → 1.1.0-rc.2

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 (156) hide show
  1. package/README.md +110 -3
  2. package/lib/cli.cjs +3078 -0
  3. package/lib/cli.cjs.map +1 -0
  4. package/lib/cli.d.cts +1 -0
  5. package/lib/cli.d.ts +1 -0
  6. package/lib/cli.js +3073 -0
  7. package/lib/cli.js.map +1 -0
  8. package/lib/clis/index.cjs +3097 -0
  9. package/lib/clis/index.cjs.map +1 -0
  10. package/lib/clis/index.d.cts +26 -0
  11. package/lib/clis/index.d.ts +26 -0
  12. package/lib/clis/index.js +3077 -0
  13. package/lib/clis/index.js.map +1 -0
  14. package/lib/index.cjs +2402 -0
  15. package/lib/index.cjs.map +1 -0
  16. package/lib/index.d.cts +11542 -0
  17. package/lib/index.d.ts +11542 -0
  18. package/lib/index.js +2333 -0
  19. package/lib/index.js.map +1 -0
  20. package/lib/test-utils/index.cjs +2933 -0
  21. package/lib/test-utils/index.cjs.map +1 -0
  22. package/lib/test-utils/index.d.cts +180 -0
  23. package/lib/test-utils/index.d.ts +180 -0
  24. package/lib/test-utils/index.js +2915 -0
  25. package/lib/test-utils/index.js.map +1 -0
  26. package/package.json +50 -45
  27. package/lib/cjs/WageProtector.d.ts +0 -37
  28. package/lib/cjs/WageProtector.js +0 -64
  29. package/lib/cjs/WageProtector.js.map +0 -1
  30. package/lib/cjs/__test__/WageProtector.test.d.ts +0 -1
  31. package/lib/cjs/__test__/WageProtector.test.js +0 -28
  32. package/lib/cjs/__test__/WageProtector.test.js.map +0 -1
  33. package/lib/cjs/examples/decodePkcs.d.ts +0 -1
  34. package/lib/cjs/examples/decodePkcs.js +0 -48
  35. package/lib/cjs/examples/decodePkcs.js.map +0 -1
  36. package/lib/cjs/examples/findSs58Formats.d.ts +0 -1
  37. package/lib/cjs/examples/findSs58Formats.js +0 -42
  38. package/lib/cjs/examples/findSs58Formats.js.map +0 -1
  39. package/lib/cjs/index.d.ts +0 -32
  40. package/lib/cjs/index.js +0 -60
  41. package/lib/cjs/index.js.map +0 -1
  42. package/lib/cjs/interfaces/augment-api-consts.d.ts +0 -442
  43. package/lib/cjs/interfaces/augment-api-consts.js +0 -8
  44. package/lib/cjs/interfaces/augment-api-consts.js.map +0 -1
  45. package/lib/cjs/interfaces/augment-api-errors.d.ts +0 -919
  46. package/lib/cjs/interfaces/augment-api-errors.js +0 -8
  47. package/lib/cjs/interfaces/augment-api-errors.js.map +0 -1
  48. package/lib/cjs/interfaces/augment-api-events.d.ts +0 -1675
  49. package/lib/cjs/interfaces/augment-api-events.js +0 -8
  50. package/lib/cjs/interfaces/augment-api-events.js.map +0 -1
  51. package/lib/cjs/interfaces/augment-api-query.d.ts +0 -988
  52. package/lib/cjs/interfaces/augment-api-query.js +0 -8
  53. package/lib/cjs/interfaces/augment-api-query.js.map +0 -1
  54. package/lib/cjs/interfaces/augment-api-rpc.d.ts +0 -683
  55. package/lib/cjs/interfaces/augment-api-rpc.js +0 -8
  56. package/lib/cjs/interfaces/augment-api-rpc.js.map +0 -1
  57. package/lib/cjs/interfaces/augment-api-runtime.d.ts +0 -204
  58. package/lib/cjs/interfaces/augment-api-runtime.js +0 -8
  59. package/lib/cjs/interfaces/augment-api-runtime.js.map +0 -1
  60. package/lib/cjs/interfaces/augment-api-tx.d.ts +0 -1605
  61. package/lib/cjs/interfaces/augment-api-tx.js +0 -8
  62. package/lib/cjs/interfaces/augment-api-tx.js.map +0 -1
  63. package/lib/cjs/interfaces/augment-api.d.ts +0 -7
  64. package/lib/cjs/interfaces/augment-api.js +0 -12
  65. package/lib/cjs/interfaces/augment-api.js.map +0 -1
  66. package/lib/cjs/interfaces/augment-types.d.ts +0 -1316
  67. package/lib/cjs/interfaces/augment-types.js +0 -8
  68. package/lib/cjs/interfaces/augment-types.js.map +0 -1
  69. package/lib/cjs/interfaces/definitions.d.ts +0 -0
  70. package/lib/cjs/interfaces/definitions.js +0 -2
  71. package/lib/cjs/interfaces/definitions.js.map +0 -1
  72. package/lib/cjs/interfaces/lookup.d.ts +0 -2999
  73. package/lib/cjs/interfaces/lookup.js +0 -3262
  74. package/lib/cjs/interfaces/lookup.js.map +0 -1
  75. package/lib/cjs/interfaces/registry.d.ts +0 -250
  76. package/lib/cjs/interfaces/registry.js +0 -8
  77. package/lib/cjs/interfaces/registry.js.map +0 -1
  78. package/lib/cjs/interfaces/types-lookup.d.ts +0 -2974
  79. package/lib/cjs/interfaces/types-lookup.js +0 -8
  80. package/lib/cjs/interfaces/types-lookup.js.map +0 -1
  81. package/lib/cjs/package.json +0 -3
  82. package/lib/esm/WageProtector.d.ts +0 -37
  83. package/lib/esm/WageProtector.js +0 -60
  84. package/lib/esm/WageProtector.js.map +0 -1
  85. package/lib/esm/__test__/WageProtector.test.d.ts +0 -1
  86. package/lib/esm/__test__/WageProtector.test.js +0 -26
  87. package/lib/esm/__test__/WageProtector.test.js.map +0 -1
  88. package/lib/esm/examples/decodePkcs.d.ts +0 -1
  89. package/lib/esm/examples/decodePkcs.js +0 -45
  90. package/lib/esm/examples/decodePkcs.js.map +0 -1
  91. package/lib/esm/examples/findSs58Formats.d.ts +0 -1
  92. package/lib/esm/examples/findSs58Formats.js +0 -39
  93. package/lib/esm/examples/findSs58Formats.js.map +0 -1
  94. package/lib/esm/index.d.ts +0 -32
  95. package/lib/esm/index.js +0 -50
  96. package/lib/esm/index.js.map +0 -1
  97. package/lib/esm/interfaces/augment-api-consts.d.ts +0 -442
  98. package/lib/esm/interfaces/augment-api-consts.js +0 -6
  99. package/lib/esm/interfaces/augment-api-consts.js.map +0 -1
  100. package/lib/esm/interfaces/augment-api-errors.d.ts +0 -919
  101. package/lib/esm/interfaces/augment-api-errors.js +0 -6
  102. package/lib/esm/interfaces/augment-api-errors.js.map +0 -1
  103. package/lib/esm/interfaces/augment-api-events.d.ts +0 -1675
  104. package/lib/esm/interfaces/augment-api-events.js +0 -6
  105. package/lib/esm/interfaces/augment-api-events.js.map +0 -1
  106. package/lib/esm/interfaces/augment-api-query.d.ts +0 -988
  107. package/lib/esm/interfaces/augment-api-query.js +0 -6
  108. package/lib/esm/interfaces/augment-api-query.js.map +0 -1
  109. package/lib/esm/interfaces/augment-api-rpc.d.ts +0 -683
  110. package/lib/esm/interfaces/augment-api-rpc.js +0 -6
  111. package/lib/esm/interfaces/augment-api-rpc.js.map +0 -1
  112. package/lib/esm/interfaces/augment-api-runtime.d.ts +0 -204
  113. package/lib/esm/interfaces/augment-api-runtime.js +0 -6
  114. package/lib/esm/interfaces/augment-api-runtime.js.map +0 -1
  115. package/lib/esm/interfaces/augment-api-tx.d.ts +0 -1605
  116. package/lib/esm/interfaces/augment-api-tx.js +0 -6
  117. package/lib/esm/interfaces/augment-api-tx.js.map +0 -1
  118. package/lib/esm/interfaces/augment-api.d.ts +0 -7
  119. package/lib/esm/interfaces/augment-api.js +0 -10
  120. package/lib/esm/interfaces/augment-api.js.map +0 -1
  121. package/lib/esm/interfaces/augment-types.d.ts +0 -1316
  122. package/lib/esm/interfaces/augment-types.js +0 -6
  123. package/lib/esm/interfaces/augment-types.js.map +0 -1
  124. package/lib/esm/interfaces/definitions.d.ts +0 -0
  125. package/lib/esm/interfaces/definitions.js +0 -2
  126. package/lib/esm/interfaces/definitions.js.map +0 -1
  127. package/lib/esm/interfaces/lookup.d.ts +0 -2999
  128. package/lib/esm/interfaces/lookup.js +0 -3260
  129. package/lib/esm/interfaces/lookup.js.map +0 -1
  130. package/lib/esm/interfaces/registry.d.ts +0 -250
  131. package/lib/esm/interfaces/registry.js +0 -6
  132. package/lib/esm/interfaces/registry.js.map +0 -1
  133. package/lib/esm/interfaces/types-lookup.d.ts +0 -2974
  134. package/lib/esm/interfaces/types-lookup.js +0 -6
  135. package/lib/esm/interfaces/types-lookup.js.map +0 -1
  136. package/lib/tsconfig-cjs.tsbuildinfo +0 -1
  137. package/lib/tsconfig-types.tsbuildinfo +0 -1
  138. package/lib/tsconfig.tsbuildinfo +0 -1
  139. package/lib/types/WageProtector.d.ts +0 -37
  140. package/lib/types/__test__/WageProtector.test.d.ts +0 -1
  141. package/lib/types/examples/decodePkcs.d.ts +0 -1
  142. package/lib/types/examples/findSs58Formats.d.ts +0 -1
  143. package/lib/types/index.d.ts +0 -32
  144. package/lib/types/interfaces/augment-api-consts.d.ts +0 -442
  145. package/lib/types/interfaces/augment-api-errors.d.ts +0 -919
  146. package/lib/types/interfaces/augment-api-events.d.ts +0 -1675
  147. package/lib/types/interfaces/augment-api-query.d.ts +0 -988
  148. package/lib/types/interfaces/augment-api-rpc.d.ts +0 -683
  149. package/lib/types/interfaces/augment-api-runtime.d.ts +0 -204
  150. package/lib/types/interfaces/augment-api-tx.d.ts +0 -1605
  151. package/lib/types/interfaces/augment-api.d.ts +0 -7
  152. package/lib/types/interfaces/augment-types.d.ts +0 -1316
  153. package/lib/types/interfaces/definitions.d.ts +0 -0
  154. package/lib/types/interfaces/lookup.d.ts +0 -2999
  155. package/lib/types/interfaces/registry.d.ts +0 -250
  156. package/lib/types/interfaces/types-lookup.d.ts +0 -2974
@@ -1,8 +0,0 @@
1
- "use strict";
2
- // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
3
- /* eslint-disable */
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- // import type lookup before we augment - in some environments
6
- // this is required to allow for ambient/previous definitions
7
- require("@polkadot/types/lookup");
8
- //# sourceMappingURL=types-lookup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-lookup.js","sourceRoot":"","sources":["../../../src/interfaces/types-lookup.ts"],"names":[],"mappings":";AAAA,kEAAkE;AAClE,oBAAoB;;AAEpB,8DAA8D;AAC9D,6DAA6D;AAC7D,kCAAgC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,37 +0,0 @@
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
- }
@@ -1,60 +0,0 @@
1
- /**
2
- * The WageProtector class is used to protect wages from inflation by using the current Argon Price Index to adjust the
3
- * baseAmount to current conditions. This ensures that the wage is always stable and does not lose or gain value based on
4
- * demand for the argon or fiat monetary supply changes.
5
- */
6
- export class WageProtector {
7
- latestCpi;
8
- constructor(latestCpi) {
9
- this.latestCpi = latestCpi;
10
- }
11
- /**
12
- * Converts the base wage to the current wage using the latest CPI snapshot
13
- *
14
- * @param baseWage The base wage to convert
15
- * @returns The protected wage
16
- */
17
- getProtectedWage(baseWage) {
18
- return ((baseWage * this.latestCpi.argonUsdTargetPrice) /
19
- this.latestCpi.argonUsdPrice);
20
- }
21
- /**
22
- * Subscribes to the current CPI and calls the callback function whenever the CPI changes
23
- * @param client The ArgonClient to use
24
- * @param callback The callback function to call when the CPI changes
25
- * @returns An object with an unsubscribe function that can be called to stop the subscription
26
- */
27
- static async subscribe(client, callback) {
28
- const unsubscribe = await client.query.priceIndex.current(async (cpi) => {
29
- if (cpi.isNone) {
30
- return;
31
- }
32
- const finalizedBlock = await client.rpc.chain.getFinalizedHead();
33
- callback(new WageProtector({
34
- argonUsdTargetPrice: cpi.value.argonUsdTargetPrice.toBigInt(),
35
- argonUsdPrice: cpi.value.argonUsdPrice.toBigInt(),
36
- finalizedBlock: finalizedBlock.toU8a(),
37
- tick: cpi.value.tick.toBigInt(),
38
- }));
39
- });
40
- return { unsubscribe };
41
- }
42
- /**
43
- * Creates a new WageProtector instance by subscribing to the current CPI and waiting for the first value
44
- * @param client The ArgonClient to use
45
- */
46
- static async create(client) {
47
- return new Promise(async (resolve, reject) => {
48
- try {
49
- const { unsubscribe } = await WageProtector.subscribe(client, x => {
50
- resolve(x);
51
- unsubscribe();
52
- });
53
- }
54
- catch (e) {
55
- reject(e);
56
- }
57
- });
58
- }
59
- }
60
- //# sourceMappingURL=WageProtector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WageProtector.js","sourceRoot":"","sources":["../../src/WageProtector.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACL;IAAnB,YAAmB,SAA4B;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAEnD;;;;;OAKG;IACI,gBAAgB,CAAC,QAAgB;QACtC,OAAO,CACL,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;YAC/C,IAAI,CAAC,SAAS,CAAC,aAAa,CAC7B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC3B,MAAmB,EACnB,QAAsC;QAItC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAC,GAAG,EAAC,EAAE;YACpE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBACf,OAAO;YACT,CAAC;YACD,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAEjE,QAAQ,CACN,IAAI,aAAa,CAAC;gBAChB,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;aAChC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,WAAW,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAmB;QAC5C,OAAO,IAAI,OAAO,CAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1D,IAAI,CAAC;gBACH,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE;oBAChE,OAAO,CAAC,CAAC,CAAC,CAAC;oBACX,WAAW,EAAE,CAAC;gBAChB,CAAC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { WageProtector, waitForLoad } from '../index';
2
- it('adjusts the price of a wage for inflation', async () => {
3
- await waitForLoad();
4
- const wageProtector = new WageProtector({
5
- argonUsdTargetPrice: 1010000000000000000n,
6
- argonUsdPrice: 1000000000000000000n,
7
- tick: 1n,
8
- finalizedBlock: Buffer.from([]),
9
- });
10
- // if price of argon is below the target price, we have argon inflation, which means we need to increase the wage
11
- // to keep the value of the wage stable. It will take 1.01 argon to buy the same amount of goods.
12
- expect(wageProtector.getProtectedWage(2500n)).toBe(BigInt(2500 * 1.01));
13
- });
14
- it('adjusts the price of a wage for deflation', async () => {
15
- await waitForLoad();
16
- const wageProtector = new WageProtector({
17
- argonUsdTargetPrice: 1000000000000000000n,
18
- argonUsdPrice: 1010000000000000000n,
19
- tick: 1n,
20
- finalizedBlock: Buffer.from([]),
21
- });
22
- // if price of argon is below the target price, we have argon deflation, which means we need to decrease the wages to
23
- // match the argon's market value.
24
- expect(wageProtector.getProtectedWage(2500n)).toBe(BigInt(2500 * 0.99));
25
- });
26
- //# sourceMappingURL=WageProtector.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WageProtector.test.js","sourceRoot":"","sources":["../../../src/__test__/WageProtector.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtD,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;IACzD,MAAM,WAAW,EAAE,CAAC;IACpB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;QACtC,mBAAmB,EAAE,oBAA0B;QAC/C,aAAa,EAAE,oBAA0B;QACzC,IAAI,EAAE,EAAE;QACR,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;IAEH,iHAAiH;IACjH,iGAAiG;IACjG,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;IACzD,MAAM,WAAW,EAAE,CAAC;IACpB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;QACtC,mBAAmB,EAAE,oBAA0B;QAC/C,aAAa,EAAE,oBAA0B;QACzC,IAAI,EAAE,EAAE;QACR,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;IAEH,qHAAqH;IACrH,kCAAkC;IAClC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,45 +0,0 @@
1
- import { Keyring, waitForLoad } from '../index';
2
- import { readFileSync } from 'fs';
3
- import * as readline from 'readline';
4
- import * as util from 'node:util';
5
- import { decodePair } from '@polkadot/keyring/pair/decode';
6
- import * as utilCrypto from '@polkadot/util-crypto';
7
- import { base64Decode } from '@polkadot/util-crypto';
8
- const jsonFile = process.argv[2];
9
- if (!jsonFile) {
10
- console.error('Usage: node decodePkcs.js <jsonFile>');
11
- process.exit(1);
12
- }
13
- const json = JSON.parse(readFileSync(jsonFile, 'utf8'));
14
- (async () => {
15
- await waitForLoad();
16
- const keyring = new Keyring();
17
- const account = keyring.addFromJson(json);
18
- console.log(json);
19
- // prompt for password
20
- const rl = readline.createInterface({
21
- input: process.stdin,
22
- output: process.stdout,
23
- });
24
- rl.question('Enter password: ', async (password) => {
25
- account.decodePkcs8(password);
26
- let secretKey = new Uint8Array();
27
- const decoded = decodePair(password, base64Decode(json.encoded), json.encoding.type);
28
- if (decoded.secretKey.length === 64) {
29
- secretKey = decoded.secretKey;
30
- }
31
- else {
32
- const type = json.encoding.content[1];
33
- const pair = {
34
- ecdsa: utilCrypto.secp256k1PairFromSeed,
35
- ed25519: utilCrypto.ed25519PairFromSeed,
36
- sr25519: utilCrypto.sr25519PairFromSeed,
37
- }[type](decoded.secretKey);
38
- secretKey = pair.secretKey;
39
- }
40
- console.log('SecretKey: 0x%s', Buffer.from(secretKey).toString('hex'));
41
- console.log(util.inspect(account, true, null, true));
42
- rl.close();
43
- });
44
- })();
45
- //# sourceMapp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AC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC9B,IAAI,SAAS,GAAG,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,UAAU,CACxB,QAAQ,EACR,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CACnB,CAAC;QACF,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACpC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAoC,CAAC;YACzE,MAAM,IAAI,GAAG;gBACX,KAAK,EAAE,UAAU,CAAC,qBAAqB;gBACvC,OAAO,EAAE,UAAU,CAAC,mBAAmB;gBACvC,OAAO,EAAE,UAAU,CAAC,mBAAmB;aACxC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC3B,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAEvE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACrD,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,39 +0,0 @@
1
- import { Keyring } from '@polkadot/keyring';
2
- import { encodeAddress } from '@polkadot/util-crypto';
3
- import Registry from '@substrate/ss58-registry';
4
- const keyring = new Keyring();
5
- const address1 = keyring.createFromUri('//Alice').publicKey;
6
- const address2 = keyring.createFromUri('//Bob').publicKey;
7
- const maxSS58AddressPrefixesCount = 16383;
8
- const reservedSS58Formats = new Set();
9
- for (const entry of Registry) {
10
- reservedSS58Formats.add(entry.prefix);
11
- }
12
- // Find SS58 Address Prefixes that generate an SS58 Address Format that starts with the letter 'e'
13
- // Optionally add a filter to this function if you only want to return those not listed in the
14
- // the SS58 Registry https://github.com/paritytech/ss58-registry/blob/main/ss58-registry.json
15
- function findSS58AddressPrefixes() {
16
- const foundSS58AddressPrefixes = [];
17
- //
18
- for (let prefix = 0; prefix <= maxSS58AddressPrefixesCount; prefix++) {
19
- if (!reservedSS58Formats.has(prefix)) {
20
- const ss58Address1 = encodeAddress(address1, prefix);
21
- const ss58Address2 = encodeAddress(address2, prefix);
22
- const lower1 = ss58Address1.toLowerCase().slice(0, 2);
23
- const lower2 = ss58Address2.toLowerCase().slice(0, 2);
24
- if (lower1 === process.argv[2] && lower2 === process.argv[2]) {
25
- foundSS58AddressPrefixes.push([
26
- prefix,
27
- ss58Address1.slice(0),
28
- ss58Address2.slice(0, 2),
29
- ss58Address1,
30
- ]);
31
- }
32
- }
33
- }
34
- return foundSS58AddressPrefixes;
35
- }
36
- const foundSS58AddressPrefixes = findSS58AddressPrefixes();
37
- console.log('count: ', foundSS58AddressPrefixes.length);
38
- console.log('foundSS58AddressPrefixes: ', foundSS58AddressPrefixes);
39
- //# sourceMappingURL=findSs58Formats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"findSs58Formats.js","sourceRoot":"","sources":["../../../src/examples/findSs58Formats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAEhD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;AAC5D,MA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AED,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,MAAM,wBAAwB,GAAG,uBAAuB,EAAE,CAAC;AAC3D,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;AACxD,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,wBAAwB,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import './interfaces/augment-api.js';
2
- import './interfaces/augment-types.js';
3
- import './interfaces/types-lookup.js';
4
- import { KeyringPair, KeyringPair$Json } from '@polkadot/keyring/types';
5
- import { ApiPromise, Keyring } from '@polkadot/api';
6
- import { decodeAddress, mnemonicGenerate } from '@polkadot/util-crypto';
7
- import { EventRecord } from '@polkadot/types/interfaces/system';
8
- import { InterfaceTypes } from '@polkadot/types/types/registry';
9
- import { KeypairType } from '@polkadot/util-crypto/types';
10
- export { WageProtector } from './WageProtector';
11
- export { Keyring, KeyringPair, KeyringPair$Json, KeypairType, mnemonicGenerate, decodeAddress, };
12
- export * from '@polkadot/types';
13
- export * from '@polkadot/types/lookup';
14
- export { InterfaceTypes as interfaces };
15
- export type ArgonClient = ApiPromise;
16
- /**
17
- * Wait for the crypto library to be ready (requires wasm, which needs async loading in commonjs)
18
- */
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
- */
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
- */
32
- export declare function checkForExtrinsicSuccess(events: EventRecord[], client: ArgonClient): Promise<void>;
package/lib/esm/index.js DELETED
@@ -1,50 +0,0 @@
1
- import './interfaces/augment-api.js';
2
- import './interfaces/augment-types.js';
3
- import './interfaces/types-lookup.js';
4
- import { ApiPromise, Keyring, WsProvider } from '@polkadot/api';
5
- import { cryptoWaitReady, decodeAddress, mnemonicGenerate, } from '@polkadot/util-crypto';
6
- export { WageProtector } from './WageProtector';
7
- export { Keyring, mnemonicGenerate, decodeAddress, };
8
- export * from '@polkadot/types';
9
- export * from '@polkadot/types/lookup';
10
- /**
11
- * Wait for the crypto library to be ready (requires wasm, which needs async loading in commonjs)
12
- */
13
- export async function waitForLoad() {
14
- await cryptoWaitReady();
15
- }
16
- /**
17
- * Get a client for the given host
18
- * @param host The host to connect to
19
- * @returns The client
20
- */
21
- export async function getClient(host) {
22
- const provider = new WsProvider(host);
23
- return await ApiPromise.create({ provider, noInitWarn: true });
24
- }
25
- /**
26
- * 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)
27
- * @param events The events to check
28
- * @param client The client to use
29
- * @returns A promise that resolves if the extrinsic was successful, and rejects if it failed
30
- */
31
- export function checkForExtrinsicSuccess(events, client) {
32
- return new Promise((resolve, reject) => {
33
- for (const { event } of events) {
34
- if (client.events.system.ExtrinsicSuccess.is(event)) {
35
- resolve();
36
- }
37
- else if (client.events.system.ExtrinsicFailed.is(event)) {
38
- // extract the data for this event
39
- const [dispatchError] = event.data;
40
- let errorInfo = dispatchError.toString();
41
- if (dispatchError.isModule) {
42
- const decoded = client.registry.findMetaError(dispatchError.asModule);
43
- errorInfo = `${decoded.section}.${decoded.name}`;
44
- }
45
- reject(new Error(`${event.section}.${event.method}:: ExtrinsicFailed:: ${errorInfo}`));
46
- }
47
- }
48
- });
49
- }
50
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,+BAA+B,CAAC;AACvC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,eAAe,EACf,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