From 69ec36917ee9d3fee3868a6fe10a951eb1f8eb90 Mon Sep 17 00:00:00 2001 From: Alexandre Alouit Date: Tue, 26 Apr 2022 09:36:53 +0200 Subject: [PATCH] Cosmos JS (#1897) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * fix could not find optimisticOperation in redelegate transaction * trigger bot * trigger bot * Cosmos JS (#1730) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction Co-authored-by: Alexandre Alouit * restore getStargateRewardsState methode * Cosmos JS (#1731) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode Co-authored-by: Alexandre Alouit * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * try to limit even more the cost of delegation * lint * Add files via upload * amount of the operation more close * return transaction in prepareTransaction * prevent cosmos-js bot to do invalid scenarios of amount=0 * keep immutable paradigm for prepareTransaction * bot: do not limit a maxRun for 'send some' * Cosmos JS (#1743) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode * amount of the operation more close * return transaction in prepareTransaction * keep immutable paradigm for prepareTransaction Co-authored-by: Alexandre Alouit * add .github/workflows/bot7-meredenis.yml * fix amount update in prepareTransaction * fix amount control to be more specific * fix BigNumber compare * Cosmos JS (#1746) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode * amount of the operation more close * return transaction in prepareTransaction * keep immutable paradigm for prepareTransaction * fix amount update in prepareTransaction * fix amount control to be more specific * fix BigNumber compare Co-authored-by: Alexandre Alouit * fix spendableBalance * Cosmos JS (#1749) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode * amount of the operation more close * return transaction in prepareTransaction * keep immutable paradigm for prepareTransaction * fix amount update in prepareTransaction * fix amount control to be more specific * fix BigNumber compare * fix spendableBalance Co-authored-by: Alexandre Alouit * separate postBuildTransaction logic + fix use useAllAmount * Cosmos JS (#1751) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode * amount of the operation more close * return transaction in prepareTransaction * keep immutable paradigm for prepareTransaction * fix amount update in prepareTransaction * fix amount control to be more specific * fix BigNumber compare * fix spendableBalance * separate postBuildTransaction logic + fix use useAllAmount Co-authored-by: Alexandre Alouit * bot: lower claim reward at 1000 * bot: lower the # of // delegations for cosmos * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * bot: fixes 0 atom undelegate * trigger bot * v21.33.1-cosmos.0 * trigger bot * trigger bot * update cosmos specs for claim rewards * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * fix rewards * trigger bot * Cosmos JS (#1761) * increase gas amplifier * fix payload construction handle payload atomic construction * More accurate gas amplifier * increase gas amplifier * use same node for calculation and broadcast * fix amount payload * fix fees/gas calculation * fix signature fix public key when account is derivate * fix fees regression * More accurate pubkey selection * don't use extra.tx_bytes * fix pubkey selection * simplify hex serialization * update transaction: more strict types * many things restruct operation builder simulate now return int prepareTransaction use patch format * accuracy more accuracy int value small refactor * remove useless isPreValidation * fix strange edge effect of ledger live desktop * Update xpub during sync * temporary enable log for bot * LL-9159 cosmos node * Update js-signOperation.ts revert back test trace for bot * fix signature * fix redelegate payload * fix payload send transaction when sendmax * fix optimistic operation type * fix typo * bugfix * fix regression * update optimistic operation fix regression add operation type more consistent fee * fix prettier * more deterministic transaction parsing * clarify code readable * adjust sender and recipient * fix fees when is ibc transaction * fix redelegations data mapping * fix mixed styles * fix array cast type * fix more determinist operation data * fix could not find optimisticOperation in redelegate transaction * restore getStargateRewardsState methode * amount of the operation more close * return transaction in prepareTransaction * keep immutable paradigm for prepareTransaction * fix amount update in prepareTransaction * fix amount control to be more specific * fix BigNumber compare * fix spendableBalance * separate postBuildTransaction logic + fix use useAllAmount * fix rewards Co-authored-by: Alexandre Alouit * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * trigger bot * fix unbondings * fix fees calculation and add cache usage * trigger bot * v21.33.1-cosmos.1 * v21.33.1-cosmos.2 * trigger bot * trigger bot * trigger bot * trigger bot * cosmos bot: lower the amount for general tx & lower part alloc in delegate * ensure for all cosmos mutation that only one op results of a tx * be more conform between optimistic and final operation * be more conform between optimistic and final operation (#1786) Co-authored-by: Alexandre Alouit * Filecoin fixes (#1740) * make use of useAllAmount flag * make use of useAllAmount on signing tx process * refactor signOperation process to use extra field better * add deviceTransactionConfig for filecoin * re org fields for confirm tx * change fields order * add extra field parsers * move extra field parsers to the correct file * fix lint issue * Create dependencies.md * Add env var to enable learn staging URL * lint * Bump urijs from 1.19.8 to 1.19.9 (#1774) Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.8 to 1.19.9. - [Release notes](https://github.com/medialize/URI.js/releases) - [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md) - [Commits](https://github.com/medialize/URI.js/compare/v1.19.8...v1.19.9) --- updated-dependencies: - dependency-name: urijs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump urijs from 1.19.8 to 1.19.9 in /tools (#1776) Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.8 to 1.19.9. - [Release notes](https://github.com/medialize/URI.js/releases) - [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md) - [Commits](https://github.com/medialize/URI.js/compare/v1.19.8...v1.19.9) --- updated-dependencies: - dependency-name: urijs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump urijs from 1.19.8 to 1.19.9 in /cli (#1775) Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.8 to 1.19.9. - [Release notes](https://github.com/medialize/URI.js/releases) - [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md) - [Commits](https://github.com/medialize/URI.js/compare/v1.19.8...v1.19.9) --- updated-dependencies: - dependency-name: urijs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump urijs from 1.19.8 to 1.19.9 in /mobile-test-app (#1773) Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.8 to 1.19.9. - [Release notes](https://github.com/medialize/URI.js/releases) - [Changelog](https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md) - [Commits](https://github.com/medialize/URI.js/compare/v1.19.8...v1.19.9) --- updated-dependencies: - dependency-name: urijs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump plist from 3.0.1 to 3.0.4 in /mobile-test-app (#1767) Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.1 to 3.0.4. - [Release notes](https://github.com/TooTallNate/node-plist/releases) - [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md) - [Commits](https://github.com/TooTallNate/node-plist/commits) --- updated-dependencies: - dependency-name: plist dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * disable a failing test of countervalues (#1778) temporarily disable a countervalues api test. team informed. * re-enable countervalues test (#1779) * fix device actions used by bot and add new test case (#1784) * Fixes for XTZ JS (still under experimental, no impact) * Update Ethereum related libraries (#1780) * Update Ethereum related libraries * axios update * bitcoin bot to slack on ll-bitcoin-ci * v21.34.0-cosmos.0 * use old code logic * Cosmos JS (#1791) * be more conform between optimistic and final operation * use old code logic Co-authored-by: Alexandre Alouit * fix senders/recipients regression * Cosmos JS (#1793) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression Co-authored-by: Alexandre Alouit * fix duplicate data * Cosmos JS (#1794) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data Co-authored-by: Alexandre Alouit * fix duplicate data (again) * Cosmos JS (#1795) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) Co-authored-by: Alexandre Alouit * append block height * Cosmos JS (#1796) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height Co-authored-by: Alexandre Alouit * trigger bot * Cosmos-JS - Fix random balance changes (#1797) * Cleanup Cosmos.api and remove default values * forEach doesn't behave well with async/await * Restore some necessary API default values * Fix lint error * trigger bot * Fix setting of experimental JS currencies * fix specific empty amount case in reward transaction * Cosmos JS (#1799) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height * fix specific empty amount case in reward transaction Co-authored-by: Alexandre Alouit * temporary debug operation broadcasted * use toOperationRaw method * return patchedOperation * Cosmos JS (#1800) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height * fix specific empty amount case in reward transaction * temporary debug operation broadcasted * use toOperationRaw method * return patchedOperation Co-authored-by: Alexandre Alouit * restore broadcast operation * Update js-synchronisation.ts * remove block height support * Cosmos JS (#1801) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height * fix specific empty amount case in reward transaction * temporary debug operation broadcasted * use toOperationRaw method * return patchedOperation * restore broadcast operation * Update js-synchronisation.ts * remove block height support Co-authored-by: Alexandre Alouit * v21.34.1-cosmos.3 * Revert "remove block height support" This reverts commit eb7198f9ab1edef8a82a1edcccaefc9907e99868. * log allOperationsMatchingId * lint * augment the nb of cosmos accounts * trigger bot * trigger bot * trigger bot * trigger bot * enable crypto_org to run tests * More strict type * reverse order of validators * Cosmos JS (#1803) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height * fix specific empty amount case in reward transaction * temporary debug operation broadcasted * use toOperationRaw method * return patchedOperation * restore broadcast operation * Update js-synchronisation.ts * remove block height support * Revert "remove block height support" This reverts commit eb7198f9ab1edef8a82a1edcccaefc9907e99868. * More strict type * reverse order of validators Co-authored-by: Alexandre Alouit * fix validators type in createTransmission * add sequence to ops * strict output getAccount type * fix operations sequence * Cosmos JS (#1804) * be more conform between optimistic and final operation * use old code logic * fix senders/recipients regression * fix duplicate data * fix duplicate data (again) * append block height * fix specific empty amount case in reward transaction * temporary debug operation broadcasted * use toOperationRaw method * return patchedOperation * restore broadcast operation * Update js-synchronisation.ts * remove block height support * Revert "remove block height support" This reverts commit eb7198f9ab1edef8a82a1edcccaefc9907e99868. * More strict type * reverse order of validators * fix validators type in createTransmission * add sequence to ops * strict output getAccount type * fix operations sequence Co-authored-by: Alexandre Alouit * Add a workaround that prevent 2 last operations to be same id (#1807) * Fixes deduplication logic of mergeOps * Revert "Add a workaround that prevent 2 last operations to be same id (#1807)" This reverts commit b0e55cd909829febbe43941c13ea5029b8a675fa. * fix multiple tx messages * Remove all libcore codebase * remove calculateFees libcore logic * trigger some bot (commit to revert before merging this PR) * lint * remove useless cli test run * fix type issue * cli update * Revert "trigger some bot (commit to revert before merging this PR)" This reverts commit add26678d33cda3d5a6106773044b3d328341cb3. * update cli/README * don't use round ceil * add comment note * sync with upstream * fix merge * Cosmos js (#1832) Document Nano app limitations + minor fix on reward amounts * Modularize the all.libcore.tests (#1834) * LL-1589 more robust bitcoin retry (#1835) * fix bot * fix sync error exception process * Additional cleanup on bitcoin implem * fix mixed transaction sync fix edge case when we have delegate and reward like tx DF458FE6A82C310837D7A33735FA5298BCF71B0BFF7A4134641AAE30F6F10501 * fix balance incorrect balance when have unbonding data * Set bot on family/cosmos branch * fix bch address convert issue (#1847) * Hotfix - v21.36.1 on Develop (#1860) * bugfix/swap-operation-details-duplicates getCompleteSwapHistory modified to avoid returning the same swap operations multiple times (#1854) * v21.36.1 Co-authored-by: Côme Grellard * Remove all libcore codebase (#1831) * Remove all libcore codebase * trigger some bot (commit to revert before merging this PR) * lint * remove useless cli test run * fix type issue * cli update * Revert "trigger some bot (commit to revert before merging this PR)" This reverts commit add26678d33cda3d5a6106773044b3d328341cb3. * update cli/README * fix merge * Cosmos js (#1832) Document Nano app limitations + minor fix on reward amounts * Modularize the all.libcore.tests (#1834) * Additional cleanup on bitcoin implem * LIVE-1873 Co-authored-by: wa-aal <93649819+wa-aal@users.noreply.github.com> Co-authored-by: haammar-ledger * Add ETH goerli (#1841) * add ETH goerli * add goerli test * Cosmos fixes (#1846) * Set bot on family/cosmos branch * LIVE-1873 * trigger bot * Family/crypto org (#1852) * LIVE-1743 Fix crypto.com address derivation path (#1836) * trigger bot * Tentative to fix crypto.com use of address Co-authored-by: Thomas Nguy <81727899+thomas-nguy@users.noreply.github.com> * [LIVE-1174] - Feature: Upgrade NFT Architecture (#1805) * Fix wrong NFTResource typing * Update NFT types to ProtoNFT * Update NFT Id to contain currency * Update NFT Helpers for new model * Update Eth API metadata call to include chainId * Move nft metadata resolution to bridge * Update NftMetadaProvider logic to use bridge * Update prepare tx of ERC721/1155 w/ new model * Update CLI for new NFT model * Add getNftCapabilities to nft support * Naming + fixing ERC1155 quantity potentially falsy * Make CLI use the LLC branch hash * Add type to nftMetadataResolver param + use of sync metadata * Remove useless import * Remove useless comment in CLI formatters * Add comment to nftsByCollection helper * Add comments + types to NFT metadata call batchers * Fix sync metadata resolution for Eth family * Add return type to nftMetadataResolver + decodeNftId * Add polygon to NFT currencies (#1848) * [LIVE-1909] - Bugfix: OpenSea Lazy mint quantity fix (#1862) * Fix lazyminting issue for nfts quantity * run ci * Reset CLI LLC dep * LIVE-1890 Replace all deprecated uses of open(deviceId) with withDevice (#1856) * Fix nft operations wrong order to infer balance (#1865) * Replace all deprecated uses of open(deviceId) with withDevice (#1864) * [LIVE-1911][LIVE-1912] Feature - Add collection name resolver to eth familly (#1863) * Change nfts resolvers from Bridge type * Update eth nft resolvers & add collection resolver * Add loadCollectionMetadata to nft context * Change eth NFT prepareTransaction to use collection call instead of nft metadata call * Bump plist from 3.0.4 to 3.0.5 in /mobile-test-app (#1849) Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.4 to 3.0.5. - [Release notes](https://github.com/TooTallNate/node-plist/releases) - [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md) - [Commits](https://github.com/TooTallNate/node-plist/commits) --- updated-dependencies: - dependency-name: plist dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump cocoapods-downloader from 1.3.0 to 1.6.3 in /mobile-test-app (#1857) Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader) from 1.3.0 to 1.6.3. - [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases) - [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md) - [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.3.0...1.6.3) --- updated-dependencies: - dependency-name: cocoapods-downloader dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ansi-regex from 3.0.0 to 3.0.1 (#1850) Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](https://github.com/chalk/ansi-regex/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Solana staking (#1844) * solana add initial staking support * solana improve staking * solana fix typos * solana fix cli format for staking * solana add device fields for stake create acc * solana add stake delegate support * solana fix lint * solana add stake undelegate * solana add stake withdraw * solana add stake split * solana add stakes loading * solana improve staking * solana introduce solana resources * solana add preload data * solana add hydrate to bridge * solana add stake actions * solana improve staking * solana add meta to validators * solana add validator name * solana fix seed for stake accs * solana add stake reward * solana improve staking * solana stake add withdrawable amount * solana refactor framework * solana fix tests * solana make auto delegation mandatory * solana sort stakes * solana fix error key * solana add delegation validator validation * solana add staking create acc tests * solana add staking delegate tests * solana add stake undelegate tests * solana remove redundant checks for stake delegation * solana skip options validations on cli level * solana skip undelegate options validations on cli level * solana improve staking tests * solana add delegatable check to staking * solana fix estimate max spendable * solana add delegation active test * solana add stake state tests * solana introduce validators app validators * solana add validators for testnet & devnet * solana refactor validators app validators * solana update meta of stakes * solana update sort order of stakes * solana add delegated op type * solana shuffle staking validators * solana fix stake withdraw optimistic value * solana clean comments * solana update mock data * solana add initial staking bot specs * solana add staking bot specs * solana move ledger vote acc to utils * solana add swap util * solana update device tx config * solana fix lint * Add bot for Solana * Solana staking integration (#1825) * solana add initial staking support * solana improve staking * solana fix typos * solana fix cli format for staking * solana add device fields for stake create acc * solana add stake delegate support * solana fix lint * solana add stake undelegate * solana add stake withdraw * solana add stake split * solana add stakes loading * solana improve staking * solana introduce solana resources * solana add preload data * solana add hydrate to bridge * solana add stake actions * solana improve staking * solana add meta to validators * solana add validator name * solana fix seed for stake accs * solana add stake reward * solana improve staking * solana stake add withdrawable amount * solana refactor framework * solana fix tests * solana make auto delegation mandatory * solana sort stakes * solana fix error key * solana add delegation validator validation * solana add staking create acc tests * solana add staking delegate tests * solana add stake undelegate tests * solana remove redundant checks for stake delegation * solana skip options validations on cli level * solana skip undelegate options validations on cli level * solana improve staking tests * solana add delegatable check to staking * solana fix estimate max spendable * solana add delegation active test * solana add stake state tests * solana introduce validators app validators * solana add validators for testnet & devnet * solana refactor validators app validators * solana update meta of stakes * solana update sort order of stakes * solana add delegated op type * solana shuffle staking validators * solana fix stake withdraw optimistic value * solana clean comments * solana update mock data * solana add initial staking bot specs * solana add staking bot specs * solana move ledger vote acc to utils * solana add swap util * solana update device tx config * solana fix lint * Change seed for Solana bot * Change seed again for Solana bot * trigger bot * solana add stake percent calc fn * solana update spec for new nano app * solana set minimum required nano app version * solana add validators app url env variable * fix bad merge * trigger bot * trigger bot * trigger bot * trigger bot * Solana bot - increase timeout and decrease minimum to delegate * trigger bot * trigger bot * trigger bot * trigger bot * Setup the bot to not use the validators.app proxy (yet) * Replace all deprecated uses of open(deviceId) with withDevice * Solana - replace open(deviceId) with withDevice * Remove custom data * Update solana bot Co-authored-by: konoart Co-authored-by: konoart <91595347+konoart@users.noreply.github.com> Co-authored-by: lambertkevin * v22.0.0 * (Solana): fix missing superstruct dependency -> making app crashes * v21.36.2 * Revert "Merge remote-tracking branch 'origin/release/v22.0.0'" This reverts commit 1e72d959a8d957225775e08b088f95a504c0bc27, reversing changes made to 77dfa66acbe2b79d241dce6b1a94b379115963a0. * Revert "Merge pull request #1853 from LedgerHQ/release/v22.0.0" This reverts commit 78650fe55c25ca6ec38bb9de893c286cc958da4d, reversing changes made to 7ef865dc771794fade3f9d452199e6cde161188f. * (Solana): fix missing superstruct dependency -> making app crashes * v21.36.2 * Update Cosmos dataset snapshot to fix test (#1861) * move from cosmjs/ledger-amino to ledgerhq/hw-app-cosmos * fix message and signature * fix derivation path * remove cosmjs/ledger-amino package Co-authored-by: Gaëtan Renaudeau Co-authored-by: wa-aal <93649819+wa-aal@users.noreply.github.com> Co-authored-by: Emmanuel Co-authored-by: Olivier Freyssinet Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: haammar-ledger Co-authored-by: Hakim <59644786+haammar-ledger@users.noreply.github.com> Co-authored-by: hzheng-ledger <71653044+hzheng-ledger@users.noreply.github.com> Co-authored-by: Valentin D. Pinkman Co-authored-by: Kévin Lambert <44363395+lambertkevin@users.noreply.github.com> Co-authored-by: Côme Grellard Co-authored-by: Thomas Nguy <81727899+thomas-nguy@users.noreply.github.com> Co-authored-by: lambertkevin Co-authored-by: konoart Co-authored-by: konoart <91595347+konoart@users.noreply.github.com> Co-authored-by: LFBarreto Co-authored-by: henrily-ledger <33897120+henrily-ledger@users.noreply.github.com> --- cli/yarn.lock | 30 +------ package.json | 1 - src/families/cosmos/js-prepareTransaction.ts | 12 +-- src/families/cosmos/js-signOperation.ts | 90 ++++++++++++-------- yarn.lock | 13 --- 5 files changed, 63 insertions(+), 83 deletions(-) diff --git a/cli/yarn.lock b/cli/yarn.lock index 94aad86a71..be683a9990 100644 --- a/cli/yarn.lock +++ b/cli/yarn.lock @@ -329,19 +329,6 @@ axios "^0.21.1" fast-deep-equal "^3.1.3" -"@cosmjs/ledger-amino@^0.26.5": - version "0.26.6" - resolved "https://registry.yarnpkg.com/@cosmjs/ledger-amino/-/ledger-amino-0.26.6.tgz#4fd342229f3de3059e193f8db3f88877074aabe0" - integrity sha512-L5KDfEq7EswV4ku2SbWlozfKVv9WJWtap4/7SMXKH0XrYWOIz0AYeBfM0OGtJQjuHAiD/1QJ8pam/kjUL3+quQ== - dependencies: - "@cosmjs/amino" "0.26.6" - "@cosmjs/crypto" "0.26.6" - "@cosmjs/encoding" "0.26.6" - "@cosmjs/math" "0.26.6" - "@cosmjs/utils" "0.26.6" - ledger-cosmos-js "^2.1.8" - semver "^7.3.2" - "@cosmjs/math@0.23.1": version "0.23.1" resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.23.1.tgz#706f38742a9a1f6561cf2c4510f8e5ab001fc5e6" @@ -1062,7 +1049,7 @@ "@ledgerhq/errors" "^6.10.0" events "^3.3.0" -"@ledgerhq/hw-transport@^5.11.0", "@ledgerhq/hw-transport@^5.19.1", "@ledgerhq/hw-transport@^5.25.0", "@ledgerhq/hw-transport@^5.51.1": +"@ledgerhq/hw-transport@^5.11.0", "@ledgerhq/hw-transport@^5.19.1", "@ledgerhq/hw-transport@^5.51.1": version "5.51.1" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-5.51.1.tgz#8dd14a8e58cbee4df0c29eaeef983a79f5f22578" integrity sha512-6wDYdbWrw9VwHIcoDnqWBaDFyviyjZWv6H9vz9Vyhe4Qd7TIFmbTl/eWs6hZvtZBza9K8y7zD8ChHwRI4s9tSw== @@ -1095,16 +1082,13 @@ bignumber.js "^9.0.1" json-rpc-2.0 "^0.2.16" -"@ledgerhq/live-common@22.0.0": +"@ledgerhq/live-common@file:.yalc/@ledgerhq/live-common": version "22.0.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-22.0.0.tgz#2717701fc8ba63b4befdd3cb1400527c2922335f" - integrity sha512-BUMgPMWmavlFip0LwMVzr+TABG1o77nLZepGSmxZWIcyLUvsmRRDtCEasVJCW60g0Cd0BhvbtUOo8l0NdDZ+/A== dependencies: "@celo/contractkit" "^1.5.2" "@celo/wallet-base" "^1.5.2" "@celo/wallet-ledger" "^1.5.2" "@cosmjs/crypto" "^0.26.5" - "@cosmjs/ledger-amino" "^0.26.5" "@cosmjs/proto-signing" "^0.26.5" "@cosmjs/stargate" "^0.26.5" "@crypto-com/chain-jslib" "0.0.19" @@ -4855,16 +4839,6 @@ leb128@^0.0.5: bn.js "^5.0.0" buffer-pipe "0.0.3" -ledger-cosmos-js@^2.1.8: - version "2.1.8" - resolved "https://registry.yarnpkg.com/ledger-cosmos-js/-/ledger-cosmos-js-2.1.8.tgz#b409ecd1e77f630e6fb212a9f602fe5c6e8f054b" - integrity sha512-Gl7SWMq+3R9OTkF1hLlg5+1geGOmcHX9OdS+INDsGNxSiKRWlsWCvQipGoDnRIQ6CPo2i/Ze58Dw0Mt/l3UYyA== - dependencies: - "@babel/runtime" "^7.11.2" - "@ledgerhq/hw-transport" "^5.25.0" - bech32 "^1.1.4" - ripemd160 "^2.0.2" - libsodium-wrappers@^0.7.6: version "0.7.9" resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz#4ffc2b69b8f7c7c7c5594a93a4803f80f6d0f346" diff --git a/package.json b/package.json index ed30cd6f6b..43516f7775 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "@celo/wallet-base": "^1.5.2", "@celo/wallet-ledger": "^1.5.2", "@cosmjs/crypto": "^0.26.5", - "@cosmjs/ledger-amino": "^0.26.5", "@cosmjs/proto-signing": "^0.26.5", "@cosmjs/stargate": "^0.26.5", "@crypto-com/chain-jslib": "0.0.19", diff --git a/src/families/cosmos/js-prepareTransaction.ts b/src/families/cosmos/js-prepareTransaction.ts index 95657d5013..f7310eb413 100644 --- a/src/families/cosmos/js-prepareTransaction.ts +++ b/src/families/cosmos/js-prepareTransaction.ts @@ -2,7 +2,6 @@ import { Account } from "../../types"; import { Transaction } from "./types"; import BigNumber from "bignumber.js"; import { simulate } from "./api/Cosmos"; -import { encodePubkey } from "@cosmjs/proto-signing"; import { getEnv } from "../../env"; import { buildTransaction, postBuildTransaction } from "./js-buildTransaction"; import { getMaxEstimatedBalance } from "./logic"; @@ -50,10 +49,13 @@ const getEstimatedFees = async ( // be sure payload is complete if (unsignedPayload) { - const pubkey = encodePubkey({ - type: "tendermint/PubKeySecp256k1", - value: Buffer.from(account.seedIdentifier, "hex").toString("base64"), - }); + const pubkey = { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: new Uint8Array([ + ...new Uint8Array([10, 33]), + ...new Uint8Array(Buffer.from(account.seedIdentifier, "hex")), + ]), + }; const tx_bytes = await postBuildTransaction( account, diff --git a/src/families/cosmos/js-signOperation.ts b/src/families/cosmos/js-signOperation.ts index dba1960f55..ab0cf93d6b 100644 --- a/src/families/cosmos/js-signOperation.ts +++ b/src/families/cosmos/js-signOperation.ts @@ -8,13 +8,12 @@ import type { Transaction } from "./types"; import { getAccount, getChainId } from "./api/Cosmos"; import { Observable } from "rxjs"; import { withDevice } from "../../hw/deviceAccess"; -import { encodePubkey } from "@cosmjs/proto-signing"; import { encodeOperationId } from "../../operation"; -import { LedgerSigner } from "@cosmjs/ledger-amino"; +import Cosmos from "@ledgerhq/hw-app-cosmos"; import { AminoTypes } from "@cosmjs/stargate"; -import { stringToPath } from "@cosmjs/crypto"; import { buildTransaction, postBuildTransaction } from "./js-buildTransaction"; import BigNumber from "bignumber.js"; +import { Secp256k1Signature } from "@cosmjs/crypto"; const aminoTypes = new AminoTypes({ prefix: "cosmos" }); @@ -32,52 +31,39 @@ const signOperation = ({ let cancelled; async function main() { + const hwApp = new Cosmos(transport); + const { accountNumber, sequence } = await getAccount( account.freshAddress ); const chainId = await getChainId(); - const hdPaths: any = stringToPath("m/" + account.freshAddressPath); - - const ledgerSigner = new LedgerSigner(transport, { - hdPaths: [hdPaths], - }); - o.next({ type: "device-signature-requested" }); - const accounts = await ledgerSigner.getAccounts(); - - let pubkey; + const { publicKey } = await hwApp.getAddress( + account.freshAddressPath, + "cosmos", + false + ); - accounts.forEach((a) => { - if (a.address == account.freshAddress) { - pubkey = encodePubkey({ - type: "tendermint/PubKeySecp256k1", - value: Buffer.from(a.pubkey).toString("base64"), - }); - } - }); + const pubkey = { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: new Uint8Array([ + ...new Uint8Array([10, 33]), + ...new Uint8Array(Buffer.from(publicKey, "hex")), + ]), + }; const unsignedPayload = await buildTransaction(account, transaction); const msgs = unsignedPayload.map((msg) => aminoTypes.toAmino(msg)); // Note: - // We don't use Cosmos App, - // Cosmos App support legacy StdTx and required to be ordered in a strict way, - // 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. + // Cosmos Nano 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, { + const message = { chain_id: chainId, account_number: accountNumber.toString(), sequence: sequence.toString(), @@ -92,17 +78,30 @@ const signOperation = ({ }, msgs: msgs, memo: transaction.memo || "", - }); + }; + + const { signature } = await hwApp.sign( + account.freshAddressPath, + JSON.stringify(sortedObject(message)) + ); + + if (!signature) { + throw new Error("Cosmos: no Signature Found"); + } + + const secp256k1Signature = Secp256k1Signature.fromDer( + new Uint8Array(signature) + ).toFixedLength(); const tx_bytes = await postBuildTransaction( account, transaction, pubkey, unsignedPayload, - new Uint8Array(Buffer.from(signed.signature.signature, "base64")) + secp256k1Signature ); - const signature = Buffer.from(tx_bytes).toString("hex"); + const signed = Buffer.from(tx_bytes).toString("hex"); if (cancelled) { return; @@ -169,7 +168,7 @@ const signOperation = ({ type: "signed", signedOperation: { operation, - signature, + signature: signed, expirationDate: null, }, }); @@ -186,4 +185,23 @@ const signOperation = ({ }) ); +const sortedObject = (obj) => { + if (typeof obj !== "object" || obj === null) { + return obj; + } + + if (Array.isArray(obj)) { + return obj.map(sortedObject); + } + + const sortedKeys = Object.keys(obj).sort(); + const result = {}; + + sortedKeys.forEach((key) => { + result[key] = sortedObject(obj[key]); + }); + + return result; +}; + export default signOperation; diff --git a/yarn.lock b/yarn.lock index 513a128fc5..8f3e5f065b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -614,19 +614,6 @@ axios "^0.21.1" fast-deep-equal "^3.1.3" -"@cosmjs/ledger-amino@^0.26.5": - version "0.26.6" - resolved "https://registry.yarnpkg.com/@cosmjs/ledger-amino/-/ledger-amino-0.26.6.tgz#4fd342229f3de3059e193f8db3f88877074aabe0" - integrity sha512-L5KDfEq7EswV4ku2SbWlozfKVv9WJWtap4/7SMXKH0XrYWOIz0AYeBfM0OGtJQjuHAiD/1QJ8pam/kjUL3+quQ== - dependencies: - "@cosmjs/amino" "0.26.6" - "@cosmjs/crypto" "0.26.6" - "@cosmjs/encoding" "0.26.6" - "@cosmjs/math" "0.26.6" - "@cosmjs/utils" "0.26.6" - ledger-cosmos-js "^2.1.8" - semver "^7.3.2" - "@cosmjs/math@0.23.1": version "0.23.1" resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.23.1.tgz#706f38742a9a1f6561cf2c4510f8e5ab001fc5e6"