Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
Cosmos js (#1832)
Browse files Browse the repository at this point in the history
Document Nano app limitations + minor fix on reward amounts
  • Loading branch information
wa-aal authored Mar 25, 2022
1 parent 676aff6 commit 640f015
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/families/cosmos/api/Cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const getDelegations = async (address: string): Promise<any> => {
if (r.validator_address === d.validatorAddress) {
for (const reward of r.reward) {
d.pendingRewards = d.pendingRewards.plus(
new BigNumber(reward.amount).integerValue(BigNumber.ROUND_CEIL)
new BigNumber(reward.amount).integerValue()
);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/families/cosmos/js-signOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ const signOperation = ({
// Cosmos API expects a different sorting, resulting in a separate signature.
// https://github.com/LedgerHQ/app-cosmos/blob/6c194daa28936e273f9548eabca9e72ba04bb632/app/src/tx_parser.c#L52

// Cosmos App sign data in Amino way only, not Protobuf.
// This is a legacy outdated standard and a long-term blocking point.

// @ledgerhq/hw-app-cosmos don't allow to push message to device message converted
// by the AminoConverter from @cosmjs/stargate. There's two things who don't work:
// 1st, the way who message is sorted.
// 2nd, cast of numeric value (integer/numeric versus string).

const signed = await ledgerSigner.signAmino(account.freshAddress, {
chain_id: chainId,
account_number: accountNumber.toString(),
Expand Down

0 comments on commit 640f015

Please sign in to comment.