@injectivelabs/sdk-ts 0.0.4 → 0.0.7

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 (45) hide show
  1. package/dist/classes/Address.d.ts +15 -10
  2. package/dist/classes/Address.d.ts.map +1 -1
  3. package/dist/classes/Address.js +11 -16
  4. package/dist/classes/Address.js.map +1 -1
  5. package/dist/classes/BaseAccount.d.ts +22 -0
  6. package/dist/classes/BaseAccount.d.ts.map +1 -0
  7. package/dist/classes/BaseAccount.js +29 -0
  8. package/dist/classes/BaseAccount.js.map +1 -0
  9. package/dist/classes/PrivateKey.d.ts +3 -6
  10. package/dist/classes/PrivateKey.d.ts.map +1 -1
  11. package/dist/classes/PrivateKey.js +4 -5
  12. package/dist/classes/PrivateKey.js.map +1 -1
  13. package/dist/classes/PublicKey.d.ts +14 -0
  14. package/dist/classes/PublicKey.d.ts.map +1 -0
  15. package/dist/classes/PublicKey.js +56 -0
  16. package/dist/classes/PublicKey.js.map +1 -0
  17. package/dist/classes/index.d.ts +2 -0
  18. package/dist/classes/index.d.ts.map +1 -1
  19. package/dist/classes/index.js +2 -0
  20. package/dist/classes/index.js.map +1 -1
  21. package/dist/client/BaseRestConsumer.d.ts +6 -0
  22. package/dist/client/BaseRestConsumer.d.ts.map +1 -0
  23. package/dist/client/BaseRestConsumer.js +10 -0
  24. package/dist/client/BaseRestConsumer.js.map +1 -0
  25. package/dist/client/chain/RestClient.d.ts +6 -0
  26. package/dist/client/chain/RestClient.d.ts.map +1 -0
  27. package/dist/client/chain/RestClient.js +11 -0
  28. package/dist/client/chain/RestClient.js.map +1 -0
  29. package/dist/client/chain/index.d.ts +2 -0
  30. package/dist/client/chain/index.d.ts.map +1 -1
  31. package/dist/client/chain/index.js +2 -1
  32. package/dist/client/chain/index.js.map +1 -1
  33. package/dist/client/chain/rest/AuthRestApi.d.ts +11 -0
  34. package/dist/client/chain/rest/AuthRestApi.d.ts.map +1 -0
  35. package/dist/client/chain/rest/AuthRestApi.js +31 -0
  36. package/dist/client/chain/rest/AuthRestApi.js.map +1 -0
  37. package/dist/client/chain/rest/index.d.ts +2 -1
  38. package/dist/client/chain/rest/index.d.ts.map +1 -1
  39. package/dist/client/chain/rest/index.js +14 -0
  40. package/dist/client/chain/rest/index.js.map +1 -1
  41. package/dist/client/chain/rest/types.d.ts +38 -0
  42. package/dist/client/chain/rest/types.d.ts.map +1 -0
  43. package/dist/client/chain/rest/types.js +3 -0
  44. package/dist/client/chain/rest/types.js.map +1 -0
  45. package/package.json +2 -2
@@ -1,8 +1,14 @@
1
1
  export declare class Address {
2
2
  address: string;
3
- number: number;
4
- sequence: number;
5
- private constructor();
3
+ baseAccount?: {
4
+ accountNumber: number;
5
+ sequence: number;
6
+ pubKey: {
7
+ '@type': string;
8
+ key: string;
9
+ };
10
+ };
11
+ constructor(address: string);
6
12
  compare(address: Address): boolean;
7
13
  /**
8
14
  * Create an address instance from a bech32-encoded address and a prefix
@@ -11,16 +17,15 @@ export declare class Address {
11
17
  * @return {Address}
12
18
  * @throws {Error} if bech is not a valid bech32-encoded address
13
19
  */
14
- static fromBech32(bech: string): Address;
20
+ static fromBech32(bech: string, prefix?: string): Address;
15
21
  /**
16
- * Create an address instance from a bech32-encoded account address
17
- * @param {string} bech32 bech32-encoded account address
22
+ * Create an address instance from an ethereum address
23
+ * @param {string} hex Ethereum address
24
+ * @param {string} prefix
18
25
  * @return {Address}
19
- * @throws {Error} if bech is not a valid bech32-encoded account address
26
+ * @throws {Error} if bech is not a valid bech32-encoded address
20
27
  */
21
- static fromAccountAddress(bech: string): Address;
22
- static fromValidatorAddress(bech: string): Address;
23
- static fromConsensusAddress(bech: string): Address;
28
+ static fromHex(hex: string, prefix?: string): Address;
24
29
  /**
25
30
  * Convert an address instance to a bech32-encoded account address
26
31
  * @param {string} prefix
@@ -1 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":"AAQA,q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,MAAM,EACZ,MAAM,GAAE,MAA+B,GACtC,OAAO;IASV;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,MAA+B,GACtC,OAAO;IAOV;;;;OAIG;IACH,QAAQ,CAAC,MAAM,GAAE,MAA+B,GAAG,MAAM;IAQzD;;;;SAIK;IACL,gBAAgB,IAAI,MAAM;IAI1B;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;IAI5B;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;IAI5B;;;;SAIK;IACL,KAAK,IAAI,MAAM;IAIf;;;;;SAKK;IACL,eAAe,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM;IAM1C;;;;SAIK;IACL,kBAAkB,IAAI,MAAM;CAG7B"}
@@ -7,8 +7,6 @@ const constants_1 = require("../utils/constants");
7
7
  class Address {
8
8
  constructor(address) {
9
9
  this.address = address;
10
- this.number = 0;
11
- this.sequence = 0;
12
10
  }
13
11
  compare(address) {
14
12
  return this.address.toLowerCase() === address.address.toLowerCase();
@@ -20,25 +18,22 @@ class Address {
20
18
  * @return {Address}
21
19
  * @throws {Error} if bech is not a valid bech32-encoded address
22
20
  */
23
- static fromBech32(bech) {
21
+ static fromBech32(bech, prefix = constants_1.BECH32_ADDR_ACC_PREFIX) {
24
22
  const address = Buffer.from(bech32_1.bech32.fromWords(bech32_1.bech32.decode(bech).words)).toString('hex');
25
23
  const addressInHex = address.startsWith('0x') ? address : `0x${address}`;
26
- return new Address(addressInHex);
24
+ return Address.fromHex(addressInHex, prefix);
27
25
  }
28
26
  /**
29
- * Create an address instance from a bech32-encoded account address
30
- * @param {string} bech32 bech32-encoded account address
27
+ * Create an address instance from an ethereum address
28
+ * @param {string} hex Ethereum address
29
+ * @param {string} prefix
31
30
  * @return {Address}
32
- * @throws {Error} if bech is not a valid bech32-encoded account address
31
+ * @throws {Error} if bech is not a valid bech32-encoded address
33
32
  */
34
- static fromAccountAddress(bech) {
35
- return Address.fromBech32(bech);
36
- }
37
- static fromValidatorAddress(bech) {
38
- return Address.fromBech32(bech);
39
- }
40
- static fromConsensusAddress(bech) {
41
- return Address.fromBech32(bech);
33
+ static fromHex(hex, prefix = constants_1.BECH32_ADDR_ACC_PREFIX) {
34
+ const addressBuffer = ethereumjs_util_1.Address.fromString(hex).toBuffer();
35
+ const address = bech32_1.bech32.encode(prefix, bech32_1.bech32.toWords(addressBuffer));
36
+ return new Address(address);
42
37
  }
43
38
  /**
44
39
  * Convert an address instance to a bech32-encoded account address
@@ -46,7 +41,7 @@ class Address {
46
41
  * @returns {string}
47
42
  */
48
43
  toBech32(prefix = constants_1.BECH32_ADDR_ACC_PREFIX) {
49
- const addressBuffer = ethereumjs_util_1.Address.fromString(this.address.toString()).toBuffer();
44
+ const addressBuffer = ethereumjs_util_1.Address.fromString(this.toHex()).toBuffer();
50
45
  return bech32_1.bech32.encode(prefix, bech32_1.bech32.toWords(addressBuffer));
51
46
  }
52
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Address.js","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAC/B,qDAAiE;AACjE,kDAI2B;AAE3B,MAAa,OAAO;IAOlB,YAAoB,OAAe;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;QACf,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IAED,OAAO,CAAC,OAAgB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;IACrE,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAY;QAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,eAAM,CAAC,SAAS,CAAC,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAC5C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AAM,EAAE,CAAA;IACnC,CAAC;IAED;;;;SAIK;IACL,kBAAkB;QAChB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;CACF;AA7HD,0BA6HC"}
@@ -0,0 +1,22 @@
1
+ import { Address } from './Address';
2
+ import { AccountResponse } from '../client/chain';
3
+ export declare class BaseAccount extends Address {
4
+ accountNumber: number;
5
+ sequence: number;
6
+ pubKey: {
7
+ type: string;
8
+ key: string;
9
+ };
10
+ constructor({ address, accountNumber, sequence, pubKey, }: {
11
+ address: string;
12
+ accountNumber: number;
13
+ sequence: number;
14
+ pubKey: {
15
+ type: string;
16
+ key: string;
17
+ };
18
+ });
19
+ static fromRestApi(accountResponse: AccountResponse): BaseAccount;
20
+ incrementSequence(): void;
21
+ }
22
+ //# sourceMappingURL=BaseAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAccount.d.ts","sourceRoot":"","sources":["../../src/classes/BaseAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,qBAAa,WAAY,SAAQ,OAAO;IACtC,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEhB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;gBAEW,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GACP,EAAE;QACD,OAAO,EAAE,MAAM,CAAA;QACf,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,GAAG,EAAE,MAAM,CAAA;SACZ,CAAA;KACF;IAOD,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe;IAcnD,iBAAiB;CAGlB"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseAccount = void 0;
4
+ const Address_1 = require("./Address");
5
+ class BaseAccount extends Address_1.Address {
6
+ constructor({ address, accountNumber, sequence, pubKey, }) {
7
+ super(address);
8
+ this.accountNumber = accountNumber;
9
+ this.sequence = sequence;
10
+ this.pubKey = pubKey;
11
+ }
12
+ static fromRestApi(accountResponse) {
13
+ const { base_account: baseAccount } = accountResponse.account;
14
+ return new BaseAccount({
15
+ address: baseAccount.address,
16
+ accountNumber: parseInt(baseAccount.account_number, 10),
17
+ sequence: parseInt(baseAccount.sequence, 10),
18
+ pubKey: {
19
+ type: baseAccount.pub_key['@type'],
20
+ key: baseAccount.pub_key.key,
21
+ },
22
+ });
23
+ }
24
+ incrementSequence() {
25
+ this.sequence += 1;
26
+ }
27
+ }
28
+ exports.BaseAccount = BaseAccount;
29
+ //# sourceMappingURL=BaseAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseAccount.js","sourceRoot":"","sources":["../../src/classes/BaseAccount.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAGnC,MAAa,WAAY,SAAQ,iBAAO;IAUtC,YAAY,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GASP;QACC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,eAAgC;QACjD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,OAAO,CAAA;QAE7D,OAAO,IAAI,WAAW,CAAC;YACrB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,CAAC;YACvD,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC5C,MAAM,EAAE;gBACN,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;gBAClC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG;aAC7B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAA;IACpB,CAAC;CACF;AA/CD,kCA+CC"}
@@ -1,3 +1,4 @@
1
+ import { PublicKey } from './PublicKey';
1
2
  /**
2
3
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
3
4
  */
@@ -34,14 +35,10 @@ export declare class PrivateKey {
34
35
  */
35
36
  toHex(): string;
36
37
  /**
37
- * TODO
38
38
  * Return the PublicKey associated with this private key.
39
39
  * @returns {PublicKey} a Private that can be used to verify the signatures made with this PrivateKey
40
-
41
- toPublicKey(): PublicKey {
42
- return PublicKey.fromPublicKey(this.wallet.publicKey)
43
- }
44
- */
40
+ **/
41
+ toPublicKey(): PublicKey;
45
42
  /**
46
43
  * Sign the given message using the edcsa sign_deterministic function.
47
44
  * @param {any} message: the message that will be hashed and signed
@@ -1 +1 @@
1
- {"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAU/D;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;OAGG;IACH,KAAK,IAAI,MAAM;IAIf;;;;;;;;OAQG;IAEH;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAS9C"}
1
+ {"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAU/D;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,UAAU;IAIb;;;OAGG;IACH,KAAK,IAAI,MAAM;IAIf;;;QAGI;IACJ,WAAW,IAAI,SAAS;IAIxB;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAS9C"}
@@ -18,6 +18,7 @@ const ethers_1 = require("ethers");
18
18
  const secp256k1_1 = __importDefault(require("secp256k1"));
19
19
  const keccak256_1 = __importDefault(require("keccak256"));
20
20
  const constants_1 = require("../utils/constants");
21
+ const PublicKey_1 = require("./PublicKey");
21
22
  /**
22
23
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
23
24
  */
@@ -65,14 +66,12 @@ class PrivateKey {
65
66
  return `0x${this.wallet.address}`;
66
67
  }
67
68
  /**
68
- * TODO
69
69
  * Return the PublicKey associated with this private key.
70
70
  * @returns {PublicKey} a Private that can be used to verify the signatures made with this PrivateKey
71
-
72
- toPublicKey(): PublicKey {
73
- return PublicKey.fromPublicKey(this.wallet.publicKey)
71
+ **/
72
+ toPublicKey() {
73
+ return PublicKey_1.PublicKey.fromHex(this.wallet.publicKey);
74
74
  }
75
- */
76
75
  /**
77
76
  * Sign the given message using the edcsa sign_deterministic function.
78
77
  * @param {any} message: the message that will be hashed and signed
@@ -1 +1 @@
1
- {"version":3,"file":"PrivateKey.js","sourceRoot":"","sources":["../../src/classes/PrivateKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,mCAA+B;AAC/B,0DAAiC;AACjC,0DAAiC;AACjC,kDAA4D;AAE5D;;GAEG;AACH,MAAa,UAAU;IAGrB,YAAoB,MAAc;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACb,MAAM,QAAQ,GAAG,eAAK,CAAC,gBAAgB,EAAE,CAAA;QACzC,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAEpD,OAAO;YACL,UAAU;YACV,QAAQ;SACT,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,KAAa,EACb,IAAI,GAAG,mCAAuB;QAE9B,OAAO,IAAI,UAAU,CAAC,eAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,UAAkB,EAClB,IAAI,GAAG,mCAAuB;QAE9B,OAAO,IAAI,UAAU,CAAC,eAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACnC,CAAC;IAED;;;;;;;;OAQG;IAEH;;;;OAIG;IACG,IAAI,CAAC,OAAY;;YACrB,MAAM,EAAE,MAAM,EAAE,G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;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACnC,CAAC;IAED;;;QAGI;IACJ,WAAW;QACT,OAAO,qBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACjD,CAAC;IAED;;;;OAIG;IACG,IAAI,CAAC,OAAY;;YACrB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;YAEvB,MAAM,OAAO,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;YAC/C,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;YAC7D,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAS,CAAC,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;YAEnE,OAAO,SAAS,CAAA;QAClB,CAAC;KAAA;CACF;AA/ED,gCA+EC"}
@@ -0,0 +1,14 @@
1
+ import { PubKey } from '@injectivelabs/chain-api/injective/crypto/v1beta1/ethsecp256k1/keys_pb';
2
+ import { Any } from 'google-protobuf/google/protobuf/any_pb';
3
+ export declare class PublicKey {
4
+ private type;
5
+ private key;
6
+ private constructor();
7
+ static fromHex(privateKey: string | Uint8Array): PublicKey;
8
+ toHex(): Uint8Array;
9
+ toPubKey(): string;
10
+ toBech32(): string;
11
+ toProto(): PubKey;
12
+ toAny(): Any;
13
+ }
14
+ //# sourceMappingURL=PublicKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublicKey.d.ts","sourceRoot":"","sources":["../../src/classes/PublicKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,wEAAwE,CAAA;AAC/F,OAAO,EAAE,GAAG,EAAE,MAAM,wCAAwC,CAAA;AAG5D,qBAAa,SAAS;IACpB,OAAO,CAAC,IAAI,CAAQ;IAEpB,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO;IAKP,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAcnD,KAAK,IAAI,UAAU;IAInB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAIlB,OAAO;IAOP,KAAK;CASb"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PublicKey = void 0;
7
+ const utils_1 = require("../utils");
8
+ const bech32_1 = require("bech32");
9
+ // import { sha256, ripemd160 } from '../util/hash'
10
+ const keys_pb_1 = require("@injectivelabs/chain-api/injective/crypto/v1beta1/ethsecp256k1/keys_pb");
11
+ const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
12
+ const secp256k1_1 = __importDefault(require("secp256k1"));
13
+ class PublicKey {
14
+ constructor(key, type) {
15
+ this.key = key;
16
+ this.type = type;
17
+ }
18
+ static fromHex(privateKey) {
19
+ const privateKeyHex = Buffer.from(privateKey.toString(), 'hex');
20
+ const publicKeyByte = secp256k1_1.default.publicKeyCreate(privateKeyHex);
21
+ const buf1 = Buffer.from([10]);
22
+ const buf2 = Buffer.from([publicKeyByte.length]);
23
+ const buf3 = Buffer.from(publicKeyByte);
24
+ const key = Buffer.concat([buf1, buf2, buf3]).toString('base64');
25
+ const type = '/injective.crypto.v1beta1.ethsecp256k1.PubKey';
26
+ return new PublicKey(key, type);
27
+ }
28
+ toHex() {
29
+ return new Uint8Array([]); /* TODO */
30
+ }
31
+ toPubKey() {
32
+ const pubkeyAminoPrefixSecp256k1 = Buffer.from('eb5ae987' + '21', 'hex');
33
+ const pubKeyBytes = Buffer.concat([
34
+ pubkeyAminoPrefixSecp256k1,
35
+ Buffer.from(this.key, 'base64'),
36
+ ]);
37
+ return bech32_1.bech32.encode(utils_1.BECH32_PUBKEY_ACC_PREFIX, bech32_1.bech32.toWords(pubKeyBytes));
38
+ }
39
+ toBech32() {
40
+ return bech32_1.bech32.encode(utils_1.BECH32_ADDR_ACC_PREFIX, bech32_1.bech32.toWords(this.toHex()));
41
+ }
42
+ toProto() {
43
+ const proto = new keys_pb_1.PubKey();
44
+ proto.setKey(this.key);
45
+ return proto;
46
+ }
47
+ toAny() {
48
+ const proto = this.toProto();
49
+ const message = new any_pb_1.Any();
50
+ message.setTypeUrl(this.type);
51
+ message.setValue(Buffer.from(proto.serializeBinary()).toString('base64'));
52
+ return message;
53
+ }
54
+ }
55
+ exports.PublicKey = PublicKey;
56
+ //# sourceMappingURL=PublicKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublicKey.js","sourceRoot":"","sources":["../../src/classes/PublicKey.ts"],"names":[],"mappings":";;;;;;AAAA,oCAA2E;AAC3E,mCAA+B;AAC/B,mDAAmD;AACnD,oGAA+F;AAC/F,mEAA4D;AAC5D,0DAAiC;AAEjC,MAAa,SAAS;IAKpB,YAAoB,GAAW,EAAE,IAAY;QAC3C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,UAA+B;QAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAA;QAC/D,MAAM,aAAa,GAAG,mBAAS,CAAC,eAAe,CAAC,aAAa,CAAC,CAAA;QAE9D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;QAChD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAEvC,MAAM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e,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;QAEzE,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AA1DD,8BA0DC"}
@@ -1,6 +1,8 @@
1
1
  export * from './Address';
2
+ export * from './BaseAccount';
2
3
  export * from './Network';
3
4
  export * from './PrivateKey';
5
+ export * from './PublicKey';
4
6
  export * from './InjectiveTx';
5
7
  export * from './TxService';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
@@ -11,8 +11,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./Address"), exports);
14
+ __exportStar(require("./BaseAccount"), exports);
14
15
  __exportStar(require("./Network"), exports);
15
16
  __exportStar(require("./PrivateKey"), exports);
17
+ __exportStar(require("./PublicKey"), exports);
16
18
  __exportStar(require("./InjectiveTx"), exports);
17
19
  __exportStar(require("./TxService"), exports);
18
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,4CAAyB;AACzB,+CAA4B;AAC5B,gDAA6B;AAC7B,8CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,gDAA6B;AAC7B,4CAAyB;AACzB,+CAA4B;AAC5B,8CAA2B;AAC3B,gDAA6B;AAC7B,8CAA2B"}
@@ -0,0 +1,6 @@
1
+ import { HttpClient } from '@injectivelabs/utils';
2
+ export default class BaseRestConsumer {
3
+ protected client: HttpClient;
4
+ constructor(endpoint: string);
5
+ }
6
+ //# sourceMappingURL=BaseRestConsumer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseRestConsumer.d.ts","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAA;gBAEhB,QAAQ,EAAE,MAAM;CAG7B"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("@injectivelabs/utils");
4
+ class BaseRestConsumer {
5
+ constructor(endpoint) {
6
+ this.client = new utils_1.HttpClient(endpoint);
7
+ }
8
+ }
9
+ exports.default = BaseRestConsumer;
10
+ //# sourceMappingURL=BaseRestConsumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseRestConsumer.js","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":";;AAAA,gDAAiD;AAEjD,MAAqB,gBAAgB;IAGnC,YAAY,QAAgB;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAU,CAAC,QAAQ,CAAC,CAAA;IACxC,CAAC;CACF;AAND,mCAMC"}
@@ -0,0 +1,6 @@
1
+ import { AuthRestApi } from './rest/AuthRestApi';
2
+ export declare class RestClient {
3
+ authRestApi: AuthRestApi;
4
+ constructor(endpoint: string);
5
+ }
6
+ //# sourceMappingURL=RestClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../../src/client/chain/RestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,qBAAa,UAAU;IACrB,WAAW,EAAE,WAAW,CAAA;gBAEZ,QAAQ,EAAE,MAAM;CAG7B"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RestClient = void 0;
4
+ const AuthRestApi_1 = require("./rest/AuthRestApi");
5
+ class RestClient {
6
+ constructor(endpoint) {
7
+ this.authRestApi = new AuthRestApi_1.AuthRestApi(endpoint);
8
+ }
9
+ }
10
+ exports.RestClient = RestClient;
11
+ //# sourceMappingURL=RestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../../../src/client/chain/RestClient.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,MAAa,UAAU;IAGrB,YAAY,QAAgB;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,QAAQ,CAAC,CAAA;IAC9C,CAAC;CACF;AAND,gCAMC"}
@@ -1,3 +1,5 @@
1
1
  export * from './GrpcClient';
2
+ export * from './RestClient';
2
3
  export * from './grpc';
4
+ export * from './rest';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/chain/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/chain/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./GrpcClient"), exports);
14
+ __exportStar(require("./RestClient"), exports);
14
15
  __exportStar(require("./grpc"), exports);
15
- // export * from './rest'
16
+ __exportStar(require("./rest"), exports);
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/chain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B;AAC5B,yCAAsB;AACtB,yBAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/chain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B;AAC5B,+CAA4B;AAC5B,yCAAsB;AACtB,yCAAsB"}
@@ -0,0 +1,11 @@
1
+ import BaseRestConsumer from '../../BaseRestConsumer';
2
+ import { AccountResponse } from './types';
3
+ export declare class AuthRestApi extends BaseRestConsumer {
4
+ /**
5
+ * Looks up the account information for the Injective address.
6
+ *
7
+ * @param address address of account to look up
8
+ */
9
+ account(address: string): Promise<AccountResponse>;
10
+ }
11
+ //# sourceMappingURL=AuthRestApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthRestApi.d.ts","sourceRoot":"","sources":["../../../../src/client/chain/rest/AuthRestApi.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAmB,MAAM,SAAS,CAAA;AAE1D,qBAAa,WAAY,SAAQ,gBAAgB;IAC/C;;;;OAIG;IACU,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAOhE"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AuthRestApi = void 0;
16
+ const BaseRestConsumer_1 = __importDefault(require("../../BaseRestConsumer"));
17
+ class AuthRestApi extends BaseRestConsumer_1.default {
18
+ /**
19
+ * Looks up the account information for the Injective address.
20
+ *
21
+ * @param address address of account to look up
22
+ */
23
+ account(address) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const response = (yield this.client.get(`cosmos/auth/v1beta1/accounts/${address}`));
26
+ return response.data;
27
+ });
28
+ }
29
+ }
30
+ exports.AuthRestApi = AuthRestApi;
31
+ //# sourceMappingURL=AuthRestApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthRestApi.js","sourceRoot":"","sources":["../../../../src/client/chain/rest/AuthRestApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8EAAqD;AAGrD,MAAa,WAAY,SAAQ,0BAAgB;IAC/C;;;;OAIG;IACU,OAAO,CAAC,OAAe;;YAClC,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACrC,gCAAgC,OAAO,EAAE,CAC1C,CAAqC,CAAA;YAEtC,OAAO,QAAQ,CAAC,IAAI,CAAA;QACtB,CAAC;KAAA;CACF;AAbD,kCAaC"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ export { AuthRestApi } from './AuthRestApi';
2
+ export * from './types';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/chain/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/chain/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,cAAc,SAAS,CAAA"}
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AuthRestApi = void 0;
14
+ var AuthRestApi_1 = require("./AuthRestApi");
15
+ Object.defineProperty(exports, "AuthRestApi", { enumerable: true, get: function () { return AuthRestApi_1.AuthRestApi; } });
16
+ __exportStar(require("./types"), exports);
3
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/chain/rest/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/chain/rest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,0CAAuB"}
@@ -0,0 +1,38 @@
1
+ export interface RestApiResponse<T> {
2
+ data: T;
3
+ }
4
+ export interface AccountsResponse {
5
+ accounts: {
6
+ '@type': string;
7
+ code_hash: string;
8
+ base_account: {
9
+ address: string;
10
+ account_number: string;
11
+ sequence: string;
12
+ pub_key: {
13
+ '@type': string;
14
+ key: string;
15
+ };
16
+ };
17
+ }[];
18
+ pagination: {
19
+ nextKey?: string;
20
+ total: string;
21
+ };
22
+ }
23
+ export interface AccountResponse {
24
+ account: {
25
+ '@type': string;
26
+ code_hash: string;
27
+ base_account: {
28
+ address: string;
29
+ account_number: string;
30
+ sequence: string;
31
+ pub_key: {
32
+ '@type': string;
33
+ key: string;
34
+ };
35
+ };
36
+ };
37
+ }
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/client/chain/rest/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE;YACZ,OAAO,EAAE,MAAM,CAAA;YACf,cAAc,EAAE,MAAM,CAAA;YACtB,QAAQ,EAAE,MAAM,CAAA;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAA;gBACf,GAAG,EAAE,MAAM,CAAA;aACZ,CAAA;SACF,CAAA;KACF,EAAE,CAAA;IACH,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE;YACZ,OAAO,EAAE,MAAM,CAAA;YACf,cAAc,EAAE,MAAM,CAAA;YACtB,QAAQ,EAAE,MAAM,CAAA;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAA;gBACf,GAAG,EAAE,MAAM,CAAA;aACZ,CAAA;SACF,CAAA;KACF,CAAA;CACF"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/client/chain/rest/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/sdk-ts",
3
3
  "description": "SDK in TypeScript for building Injective applications in a Node environment.",
4
- "version": "0.0.4",
4
+ "version": "0.0.7",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Bojan Angjelkoski",
@@ -54,5 +54,5 @@
54
54
  "snakecase-keys": "^5.4.1",
55
55
  "tiny-secp256k1": "^2.2.1"
56
56
  },
57
- "gitHead": "18ff6a0d75277b78ee8df548c7d4e455fc0455aa"
57
+ "gitHead": "5056f37b94920c9178f3d9ac802183be68418282"
58
58
  }