@injectivelabs/sdk-ts 0.0.5 → 0.0.6

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 (33) hide show
  1. package/dist/classes/Address.d.ts +10 -4
  2. package/dist/classes/Address.d.ts.map +1 -1
  3. package/dist/classes/Address.js +2 -4
  4. package/dist/classes/Address.js.map +1 -1
  5. package/dist/classes/BaseAccount.d.ts +21 -0
  6. package/dist/classes/BaseAccount.d.ts.map +1 -0
  7. package/dist/classes/BaseAccount.js +26 -0
  8. package/dist/classes/BaseAccount.js.map +1 -0
  9. package/dist/client/BaseRestConsumer.d.ts +6 -0
  10. package/dist/client/BaseRestConsumer.d.ts.map +1 -0
  11. package/dist/client/BaseRestConsumer.js +10 -0
  12. package/dist/client/BaseRestConsumer.js.map +1 -0
  13. package/dist/client/chain/RestClient.d.ts +6 -0
  14. package/dist/client/chain/RestClient.d.ts.map +1 -0
  15. package/dist/client/chain/RestClient.js +11 -0
  16. package/dist/client/chain/RestClient.js.map +1 -0
  17. package/dist/client/chain/index.d.ts +2 -0
  18. package/dist/client/chain/index.d.ts.map +1 -1
  19. package/dist/client/chain/index.js +2 -1
  20. package/dist/client/chain/index.js.map +1 -1
  21. package/dist/client/chain/rest/AuthRestApi.d.ts +11 -0
  22. package/dist/client/chain/rest/AuthRestApi.d.ts.map +1 -0
  23. package/dist/client/chain/rest/AuthRestApi.js +31 -0
  24. package/dist/client/chain/rest/AuthRestApi.js.map +1 -0
  25. package/dist/client/chain/rest/index.d.ts +2 -1
  26. package/dist/client/chain/rest/index.d.ts.map +1 -1
  27. package/dist/client/chain/rest/index.js +14 -0
  28. package/dist/client/chain/rest/index.js.map +1 -1
  29. package/dist/client/chain/rest/types.d.ts +38 -0
  30. package/dist/client/chain/rest/types.d.ts.map +1 -0
  31. package/dist/client/chain/rest/types.js +3 -0
  32. package/dist/client/chain/rest/types.js.map +1 -0
  33. package/package.json +2 -2
@@ -1,8 +1,14 @@
1
1
  export declare class Address {
2
2
  address: string;
3
- accountNumber: 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,7 +17,7 @@ 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
22
  * Create an address instance from an ethereum address
17
23
  * @param {string} hex Ethereum address
@@ -1 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":"AAQA,qBAAa,OAAO;IACX,OAAO,EAAE,MAAM,CAAA;IAEf,aAAa,EAAE,MAAM,CAAA;IAErB,QAAQ,EAAE,MAAM,CAAA;IAEvB,OAAO;IAMP,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAIlC;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IASxC;;;;;;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"}
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../src/classes/Address.ts"],"names":[],"mappings":"AAQA,qBAAa,OAAO;IACX,OAAO,EAAE,MAAM,CAAA;IAEf,WAAW,CAAC,EAAE;QACnB,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE;YACN,OAAO,EAAE,MAAM,CAAA;YACf,GAAG,EAAE,MAAM,CAAA;SACZ,CAAA;KACF,CAAA;gBAEW,OAAO,EAAE,MAAM;IAI3B,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAIlC;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CACf,IAAI,EAAE,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.accountNumber = 0;
11
- this.sequence = 0;
12
10
  }
13
11
  compare(address) {
14
12
  return this.address.toLowerCase() === address.address.toLowerCase();
@@ -20,10 +18,10 @@ 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 Address.fromHex(addressInHex);
24
+ return Address.fromHex(addressInHex, prefix);
27
25
  }
28
26
  /**
29
27
  * Create an address instance from an ethereum address
@@ -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,aAAa,GAAG,CAAC,CAAA;QACtB,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,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAA;QAExE,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IACtC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CACZ,GAAW,EACX,SAAiB,kCAAsB;QAEvC,MAAM,aAAa,GAAG,yBAAoB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EA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AU,CACnD,IAAI,CAAC,KAAK,EAAE,CACb,CAAC,QAAQ,EAAE,CAAA;QAEZ,OAAO,eAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;IAC7D,CAAC;IAED;;;;SAIK;IACL,gBAAgB;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,kCAAsB,CAAC,CAAA;IAC9C,CAAC;IAED;;;;SAIK;IACL,kBAAkB;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,kCAAsB,CAAC,CAAA;IAC9C,CAAC;IAED;;;;SAIK;IACL,kBAAkB;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,mCAAuB,CAAC,CAAA;IAC/C,CAAC;IAED;;;;SAIK;IACL,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;IAC3E,CAAC;IAED;;;;;SAKK;IACL,eAAe,CAAC,QAAgB,CAAC;QAC/B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA,CAAC,mCAAmC;QAEzE,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,EAAE,CAAA;IACnC,CAAC;IAED;;;;SAIK;IACL,kBAAkB;QAChB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;CACF;AA7HD,0BA6HC"}
@@ -0,0 +1,21 @@
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
+ }
21
+ //# 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;CAapD"}
@@ -0,0 +1,26 @@
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
+ }
25
+ exports.BaseAccount = BaseAccount;
26
+ //# 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;CACF;AA3CD,kCA2CC"}
@@ -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.5",
4
+ "version": "0.0.6",
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": "ac3037cbef81c4906682f2d9c2ba8ae2959d0453"
57
+ "gitHead": "f22ea91f30abcad389da62beeee026699c2ea810"
58
58
  }