From f610e1d514e73ed195fd1ddeb729af8e5ff8827c Mon Sep 17 00:00:00 2001 From: emidev98 Date: Wed, 1 Nov 2023 10:42:34 +0200 Subject: [PATCH 1/2] feat: auth api get module account --- package-lock.json | 4 ++-- package.json | 2 +- src/client/lcd/api/AuthAPI.ts | 22 +++++++++++++++++++--- src/core/ica/controller/v1/CosmosTx.ts | 6 ------ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85863ae3..bd31facd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.5", + "version": "2.0.0-beta.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.5", + "version": "2.0.0-beta.6", "license": "MIT", "dependencies": { "@ethersproject/bytes": "^5.7.0", diff --git a/package.json b/package.json index 7825e7e5..de7bf921 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.5", + "version": "2.0.0-beta.6", "description": "The JavaScript SDK for Terra and Feather chains", "license": "MIT", "author": "Terraform Labs, PTE.", diff --git a/src/client/lcd/api/AuthAPI.ts b/src/client/lcd/api/AuthAPI.ts index d4b8a733..3c2f12dc 100644 --- a/src/client/lcd/api/AuthAPI.ts +++ b/src/client/lcd/api/AuthAPI.ts @@ -39,15 +39,31 @@ export class AuthAPI extends BaseAPI { * * @param address address of account to look up */ - public async moduleAccountInfo( + public async moduleAccountsInfo( chainID: string, params: APIParams = {} - ): Promise> { + ): Promise> { const { accounts } = await this.getReqFromChainID(chainID).get<{ accounts: Array; }>(`/cosmos/auth/v1beta1/module_accounts`, params); - return accounts.map((account: any) => Account.fromData(account)); + return accounts.map((account: any) => ModuleAccount.fromData(account)); + } + /** + * Query a specific module acccount information + * + * @param address address of account to look up + */ + public async moduleAccountInfo( + chainID: string, + moduleName: string, + params: APIParams = {} + ): Promise { + const { account } = await this.getReqFromChainID(chainID).get<{ + account: ModuleAccount.Data; + }>(`/cosmos/auth/v1beta1/module_accounts/${moduleName}`, params); + + return ModuleAccount.fromData(account); } /** * Looks up the account information using its Terra account address. If the account has diff --git a/src/core/ica/controller/v1/CosmosTx.ts b/src/core/ica/controller/v1/CosmosTx.ts index 66de526d..c1654119 100644 --- a/src/core/ica/controller/v1/CosmosTx.ts +++ b/src/core/ica/controller/v1/CosmosTx.ts @@ -31,7 +31,6 @@ export class CosmosTx extends JSONSerializable< public static fromData(data: CosmosTx.Data, _?: boolean): CosmosTx { _; - console.log('CosmosTx#fromData', data); const parsedData = Buffer.from(data, 'base64'); const { messages } = CosmosTx_pb.decode(parsedData); return new CosmosTx(messages.map(msg => Msg.fromProto(msg))); @@ -39,7 +38,6 @@ export class CosmosTx extends JSONSerializable< public toData(_?: boolean): CosmosTx.Data { _; - console.log('CosmosTx#toData', this.messages); const { messages } = this; const ct = CosmosTx_pb.encode({ @@ -51,13 +49,11 @@ export class CosmosTx extends JSONSerializable< public static fromProto(proto: CosmosTx.Proto, _?: boolean): CosmosTx { _; - console.log('CosmosTx#fromProto', proto); return new CosmosTx(proto.messages.map(msg => Msg.fromProto(msg))); } public toProto(_?: boolean): CosmosTx.Proto { _; - console.log('CosmosTx#toProto', this.messages); const { messages } = this; const ct = CosmosTx_pb.encode({ @@ -68,14 +64,12 @@ export class CosmosTx extends JSONSerializable< } public packAny(isClassic?: boolean): Any { - console.log('CosmosTx#packAny', this.messages); return Any.fromPartial({ value: this.toProto(isClassic) as any, }); } public static unpackAny(msgAny: Any, isClassic?: boolean): CosmosTx { - console.log('CosmosTx#unpackAny', msgAny); return CosmosTx.fromProto(CosmosTx_pb.decode(msgAny.value), isClassic); } } From 1812a1b9264514aa2c53ce5bf97f8c56de2d4fe5 Mon Sep 17 00:00:00 2001 From: emidev98 Date: Wed, 1 Nov 2023 10:45:15 +0200 Subject: [PATCH 2/2] feat: beta.7 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd31facd..47f28a65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.6", + "version": "2.0.0-beta.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.6", + "version": "2.0.0-beta.7", "license": "MIT", "dependencies": { "@ethersproject/bytes": "^5.7.0", diff --git a/package.json b/package.json index de7bf921..2b863cd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@terra-money/feather.js", - "version": "2.0.0-beta.6", + "version": "2.0.0-beta.7", "description": "The JavaScript SDK for Terra and Feather chains", "license": "MIT", "author": "Terraform Labs, PTE.",