diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d2c8de..565443cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - [\#112](https://github.com/Finschia/finschia-js/pull/112) change package version from v0.9.0 to v0.10.0-rc1 +- [\#113](https://github.com/Finschia/finschia-js/pull/113) bump up @finschia/finschia v4.0.0-rc4 ### Deprecated diff --git a/package.json b/package.json index 9b3c6f66..ad685f64 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@cosmjs/encoding": "^0.31.0", "@cosmjs/proto-signing": "^0.31.0", "@cosmjs/stargate": "^0.31.0", - "@finschia/finschia": "0.10.0-rc1", + "@finschia/finschia": "0.10.0-rc2", "eslint": "^7.5", "karma-chrome-launcher": "^3.1.0", "karma-jasmine": "^4.0.1", diff --git a/packages/finschia/package.json b/packages/finschia/package.json index 46bd03c4..49271ace 100644 --- a/packages/finschia/package.json +++ b/packages/finschia/package.json @@ -1,6 +1,6 @@ { "name": "@finschia/finschia", - "version": "0.10.0-rc1", + "version": "0.10.0-rc2", "description": "Utilities for FINSCHIA v2.0.0", "contributors": [ "zemyblue ", @@ -47,7 +47,7 @@ "@cosmjs/stargate": "^0.31.0", "@cosmjs/tendermint-rpc": "^0.31.0", "@cosmjs/utils": "^0.31.0", - "@finschia/finschia-proto": "4.0.0-rc2", + "@finschia/finschia-proto": "4.0.0-rc4", "cosmjs-types": "^0.8.0", "long": "^4.0.0", "pako": "^2.0.2", diff --git a/packages/finschia/src/finschiaclient.searchtx.spec.ts b/packages/finschia/src/finschiaclient.searchtx.spec.ts index 19119269..789e5b2e 100644 --- a/packages/finschia/src/finschiaclient.searchtx.spec.ts +++ b/packages/finschia/src/finschiaclient.searchtx.spec.ts @@ -76,7 +76,7 @@ async function sendTokens( const { accountNumber, sequence } = (await client.getSequence(walletAddress))!; const feeAmount = [ { - amount: "2000", + amount: "3000", denom: "cony", }, ]; diff --git a/packages/finschia/src/finschiaclient.spec.ts b/packages/finschia/src/finschiaclient.spec.ts index 2ce19006..df6443d1 100644 --- a/packages/finschia/src/finschiaclient.spec.ts +++ b/packages/finschia/src/finschiaclient.spec.ts @@ -221,7 +221,7 @@ describe("FinschiaClient", () => { }, }; const fee: StdFee = { - amount: coins(5000, "cony"), + amount: coins(13400, "cony"), gas: "890000", }; @@ -358,7 +358,7 @@ describe("FinschiaClient", () => { ...defaultSigningClientOptions, }); await client.delegateTokens(faucet.address4, validator.validatorAddress, coin(1234, "stake"), { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }); } @@ -662,7 +662,7 @@ describe("FinschiaClient", () => { const client = await FinschiaClient.connect(simapp.tendermintUrl); const minimumGasPrice = await client.queryMinimumGasPrice(); expect(minimumGasPrice).not.toBeNull(); - expect(minimumGasPrice).toBe("0.000100000000000000cony"); + expect(minimumGasPrice).toBe("0.015000000000000000cony,0.015000000000000000stake"); }); }); @@ -702,7 +702,7 @@ describe("FinschiaClient", () => { ); const memo = "Cross-chain fun"; const fee = { - amount: coins(2000, "cony"), + amount: coins(2700, "cony"), gas: "180000", // 180k }; diff --git a/packages/finschia/src/modules/fswap/aminomessages.spec.ts b/packages/finschia/src/modules/fswap/aminomessages.spec.ts index 5a0b98c4..00f3fb6b 100644 --- a/packages/finschia/src/modules/fswap/aminomessages.spec.ts +++ b/packages/finschia/src/modules/fswap/aminomessages.spec.ts @@ -149,6 +149,7 @@ describe("Amino Sign", () => { }); it("MsgSwapAll", async () => { + pendingWithoutSimapp(); const [client, tmClient] = await makeClientWithFswap(simapp.tendermintUrl); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic, { hdPaths: [makeLinkPath(0), makeLinkPath(100)], diff --git a/packages/finschia/src/modules/fswap/queries.spec.ts b/packages/finschia/src/modules/fswap/queries.spec.ts index 6a9b8379..665dfe43 100644 --- a/packages/finschia/src/modules/fswap/queries.spec.ts +++ b/packages/finschia/src/modules/fswap/queries.spec.ts @@ -123,6 +123,23 @@ describe("FswapExtension", () => { tmClient.disconnect(); }); + it("Swap", async () => { + pendingWithoutSimapp(); + const [client, tmClient] = await makeClientWithFswap(simapp.tendermintUrl); + + const swap = await client.fswap.swap("cony", "pdt"); + expect(swap).toBeDefined(); + const expected: Swap = { + fromDenom: "cony", + toDenom: "pdt", + amountCapForToDenom: "1000000000000000000000000000000000000000000000", + swapRate: Decimal.fromUserInput("148079656000000", 18).atomics, + }; + expect(swap).toEqual(expected); + + tmClient.disconnect(); + }); + it("TotalSwappableToCoinAmount", async () => { pendingWithoutSimapp(); assert(beforeTotalSwappableToAmount, "Missing beforeTotalSwappableToAmount"); diff --git a/packages/finschia/src/modules/fswap/queries.ts b/packages/finschia/src/modules/fswap/queries.ts index 2da1e1e0..722f8ef6 100644 --- a/packages/finschia/src/modules/fswap/queries.ts +++ b/packages/finschia/src/modules/fswap/queries.ts @@ -5,12 +5,14 @@ import { QuerySwapsResponse, } from "@finschia/finschia-proto/lbm/fswap/v1/query"; import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; +import { Swap } from "@finschia/finschia-proto/lbm/fswap/v1/fswap"; export interface FswapExtension { readonly fswap: { readonly swapped: (fromDenom: string, toDenom: string) => Promise; readonly totalSwappableToCoinAmount: (fromDenom: string, toDenom: string) => Promise; readonly swaps: (paginationKey?: Uint8Array) => Promise; + readonly swap: (fromDenom: string, toDenom: string) => Promise; }; } @@ -36,6 +38,10 @@ export function setupFswapExtension(base: QueryClient): FswapExtension { swaps: async (paginationKey?: Uint8Array) => { return await queryService.Swaps({ pagination: createPagination(paginationKey) }); }, + swap: async (fromDenom: string, toDenom: string) => { + const resp = await queryService.Swap({ fromDenom: fromDenom, toDenom: toDenom }); + return resp.swap; + }, }, }; } diff --git a/packages/finschia/src/signingfinschiaclient.spec.ts b/packages/finschia/src/signingfinschiaclient.spec.ts index 729a043a..9c758fee 100644 --- a/packages/finschia/src/signingfinschiaclient.spec.ts +++ b/packages/finschia/src/signingfinschiaclient.spec.ts @@ -213,7 +213,7 @@ describe("SigningFinschiaClient", () => { ); const memo = "Cross-chain fun"; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "180000", // 180k }; const sendAmount = coin(1234, "cony"); @@ -294,7 +294,7 @@ describe("SigningFinschiaClient", () => { ); const memo = "Cross-chain fun"; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "180000", // 180k }; const sendAmount = coin(1234, "cony"); @@ -1093,7 +1093,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "180000", // 180k }; const memo = "Use your power wisely"; @@ -1125,7 +1125,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "99000", }; const result = await client.signAndBroadcast(faucet.address0, [msgAny], fee); @@ -1186,7 +1186,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(5000, "cony"), gas: "180000", // 180k }; const memo = "Use your power wisely"; @@ -1200,7 +1200,7 @@ describe("SigningFinschiaClient", () => { const tx = decodeTxRaw(searchResult.tx); // From ModifyingDirectSecp256k1HdWallet expect(tx.body.memo).toEqual("This was modified"); - expect({ ...tx.authInfo.fee!.amount[0] }).toEqual(coin(3000, "cony")); + expect({ ...tx.authInfo.fee!.amount[0] }).toEqual(coin(5000, "cony")); expect(tx.authInfo.fee!.gasLimit.toNumber()).toEqual(333333); client.disconnect(); @@ -1230,7 +1230,7 @@ describe("SigningFinschiaClient", () => { value: msgSend, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "ampersand:&,lt:<,gt:>"; @@ -1258,7 +1258,7 @@ describe("SigningFinschiaClient", () => { value: msgSend, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your tokens wisely"; @@ -1289,7 +1289,7 @@ describe("SigningFinschiaClient", () => { value: msgDelegate, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your tokens wisely"; @@ -1320,7 +1320,7 @@ describe("SigningFinschiaClient", () => { value: msgStoreCode, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(22500, "cony"), gas: "1500000", }; const memo = "Use your tokens wisely"; @@ -1438,7 +1438,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your power wisely"; @@ -1469,7 +1469,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(5000, "cony"), gas: "200000", }; const memo = "Use your power wisely"; @@ -1483,7 +1483,7 @@ describe("SigningFinschiaClient", () => { const tx = decodeTxRaw(searchResult.tx); // From ModifyingSecp256k1HdWallet expect(tx.body.memo).toEqual("This was modified"); - expect({ ...tx.authInfo.fee!.amount[0] }).toEqual(coin(3000, "cony")); + expect({ ...tx.authInfo.fee!.amount[0] }).toEqual(coin(5000, "cony")); expect(tx.authInfo.fee!.gasLimit.toNumber()).toEqual(333333); client.disconnect(); @@ -1513,7 +1513,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "180000", // 180k }; const memo = "Use your power wisely"; @@ -1546,7 +1546,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(5000, "cony"), gas: "180000", // 180k }; const memo = "Use your power wisely"; @@ -1556,7 +1556,7 @@ describe("SigningFinschiaClient", () => { const authInfo = AuthInfo.decode(signed.authInfoBytes); // From ModifyingDirectSecp256k1HdWallet expect(body.memo).toEqual("This was modified"); - expect({ ...authInfo.fee!.amount[0] }).toEqual(coin(3000, "cony")); + expect({ ...authInfo.fee!.amount[0] }).toEqual(coin(5000, "cony")); expect(authInfo.fee!.gasLimit.toNumber()).toEqual(333333); // ensure signature is valid @@ -1588,7 +1588,7 @@ describe("SigningFinschiaClient", () => { value: msgSend, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your tokens wisely"; @@ -1622,7 +1622,7 @@ describe("SigningFinschiaClient", () => { value: msgDelegate, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your tokens wisely"; @@ -1740,7 +1740,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(3000, "cony"), gas: "200000", }; const memo = "Use your power wisely"; @@ -1774,7 +1774,7 @@ describe("SigningFinschiaClient", () => { value: msg, }; const fee = { - amount: coins(2000, "cony"), + amount: coins(5000, "cony"), gas: "200000", }; const memo = "Use your power wisely"; @@ -1784,7 +1784,7 @@ describe("SigningFinschiaClient", () => { const authInfo = AuthInfo.decode(signed.authInfoBytes); // From ModifyingSecp256k1HdWallet expect(body.memo).toEqual("This was modified"); - expect({ ...authInfo.fee!.amount[0] }).toEqual(coin(3000, "cony")); + expect({ ...authInfo.fee!.amount[0] }).toEqual(coin(5000, "cony")); expect(authInfo.fee!.gasLimit.toNumber()).toEqual(333333); // ensure signature is valid diff --git a/packages/finschia/src/signingfinschiaclientv4.spec.ts b/packages/finschia/src/signingfinschiaclientv4.spec.ts index 8c51244d..a6728bc6 100644 --- a/packages/finschia/src/signingfinschiaclientv4.spec.ts +++ b/packages/finschia/src/signingfinschiaclientv4.spec.ts @@ -12,7 +12,7 @@ describe("SigningFinschiaClient", () => { gas: "1500000", // 1.5 million }; - describe("signAndBridge", () => { + describe("swapAndBridge", () => { it("works", async () => { pendingWithoutSimapp(); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, { diff --git a/packages/finschia/src/testutils.spec.ts b/packages/finschia/src/testutils.spec.ts index e739080c..df7e1b19 100644 --- a/packages/finschia/src/testutils.spec.ts +++ b/packages/finschia/src/testutils.spec.ts @@ -269,7 +269,7 @@ export class ModifyingSecp256k1HdWallet extends Secp256k1HdWallet { const modifiedSignDoc = { ...signDoc, fee: { - amount: coins(3000, "cony"), + amount: coins(5000, "cony"), gas: "333333", }, memo: "This was modified", @@ -302,7 +302,7 @@ export class ModifyingDirectSecp256k1HdWallet extends DirectSecp256k1HdWallet { pubkey: signerInfo.publicKey!, sequence: signerInfo.sequence.toNumber(), })); - const modifiedFeeAmount = coins(3000, "cony"); + const modifiedFeeAmount = coins(5000, "cony"); const modifiedGasLimit = 333333; const modifiedFeeGranter = undefined; const modifiedFeePayer = undefined; diff --git a/scripts/finschia/env b/scripts/finschia/env index 6f234cee..178abc2b 100644 --- a/scripts/finschia/env +++ b/scripts/finschia/env @@ -1,4 +1,4 @@ # Choose from https://hub.docker.com/r/finschia/finschianode/tags REPOSITORY="finschia/finschianode" -VERSION="4.0.0-rc3" +VERSION="4.0.0-rc4" CONTAINER_NAME="finschia-app" diff --git a/scripts/finschia/template/.finschia/config/app.toml b/scripts/finschia/template/.finschia/config/app.toml index ade65de5..eae30e2e 100644 --- a/scripts/finschia/template/.finschia/config/app.toml +++ b/scripts/finschia/template/.finschia/config/app.toml @@ -8,7 +8,7 @@ # The minimum gas prices a validator is willing to accept for processing a # transaction. A transaction's fees must meet the minimum of any denomination # specified in this config (e.g. 0.25token1,0.0001token2). -minimum-gas-prices = "0.0001cony" +minimum-gas-prices = "0.015cony,0.015stake" # default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) diff --git a/scripts/simapp/env b/scripts/simapp/env index 5a3ee89e..a6959d41 100644 --- a/scripts/simapp/env +++ b/scripts/simapp/env @@ -1,4 +1,4 @@ # Choose from https://hub.docker.com/r/finschia/finschia-simapp/tags REPOSITORY="finschia/finschia-simapp" -VERSION="0.49.0-rc5" +VERSION="0.49.0-rc6" CONTAINER_NAME="finschia-simapp" diff --git a/scripts/simapp/template/.simapp/config/app.toml b/scripts/simapp/template/.simapp/config/app.toml index 23548072..292894ba 100644 --- a/scripts/simapp/template/.simapp/config/app.toml +++ b/scripts/simapp/template/.simapp/config/app.toml @@ -8,7 +8,7 @@ # The minimum gas prices a validator is willing to accept for processing a # transaction. A transaction's fees must meet the minimum of any denomination # specified in this config (e.g. 0.25token1,0.0001token2). -minimum-gas-prices = "0.0001cony" +minimum-gas-prices = "0.015cony,0.015stake" # default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) diff --git a/scripts/with-ibc/docker-compose.yaml b/scripts/with-ibc/docker-compose.yaml index 47228a7b..e9fdbd3a 100644 --- a/scripts/with-ibc/docker-compose.yaml +++ b/scripts/with-ibc/docker-compose.yaml @@ -2,7 +2,7 @@ version: "3" services: finschia-app: - image: "finschia/finschianode:4.0.0-rc3" + image: "finschia/finschianode:4.0.0-rc4" ports: - "26658:26657" - "1317:1317" @@ -15,7 +15,7 @@ services: - host.docker.internal:host-gateway finschia2-app: - image: "finschia/finschianode:4.0.0-rc3" + image: "finschia/finschianode:4.0.0-rc4" ports: - "26558:26657" - "1318:1317" diff --git a/scripts/with-ibc/finschia/env b/scripts/with-ibc/finschia/env index 6f234cee..178abc2b 100644 --- a/scripts/with-ibc/finschia/env +++ b/scripts/with-ibc/finschia/env @@ -1,4 +1,4 @@ # Choose from https://hub.docker.com/r/finschia/finschianode/tags REPOSITORY="finschia/finschianode" -VERSION="4.0.0-rc3" +VERSION="4.0.0-rc4" CONTAINER_NAME="finschia-app" diff --git a/scripts/with-ibc/finschia/template/.finschia/config/app.toml b/scripts/with-ibc/finschia/template/.finschia/config/app.toml index 9a583c91..eae30e2e 100644 --- a/scripts/with-ibc/finschia/template/.finschia/config/app.toml +++ b/scripts/with-ibc/finschia/template/.finschia/config/app.toml @@ -7,8 +7,8 @@ # The minimum gas prices a validator is willing to accept for processing a # transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0.0001cony" +# specified in this config (e.g. 0.25token1,0.0001token2). +minimum-gas-prices = "0.015cony,0.015stake" # default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) diff --git a/scripts/with-ibc/finschia2/env b/scripts/with-ibc/finschia2/env index c5f8f406..d9894413 100644 --- a/scripts/with-ibc/finschia2/env +++ b/scripts/with-ibc/finschia2/env @@ -1,4 +1,4 @@ # Choose from https://hub.docker.com/r/finschia/finschianode/tags REPOSITORY="finschia/finschianode" -VERSION="4.0.0-rc3" +VERSION="4.0.0-rc4" CONTAINER_NAME="finschia2-app" diff --git a/scripts/with-ibc/relayer/template/configs/chains/finschia-0.json b/scripts/with-ibc/relayer/template/configs/chains/finschia-0.json index fb8c470f..58fc8576 100644 --- a/scripts/with-ibc/relayer/template/configs/chains/finschia-0.json +++ b/scripts/with-ibc/relayer/template/configs/chains/finschia-0.json @@ -8,7 +8,7 @@ "account-prefix": "link", "keyring-backend": "test", "gas-adjustment": 1.5, - "gas-prices": "0.001cony", + "gas-prices": "0.015cony", "debug": true, "timeout": "10s", "output-format": "json", diff --git a/yarn.lock b/yarn.lock index bfeb21f8..17d46c21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -390,10 +390,10 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@finschia/finschia-proto@4.0.0-rc2": - version "4.0.0-rc2" - resolved "https://registry.yarnpkg.com/@finschia/finschia-proto/-/finschia-proto-4.0.0-rc2.tgz#c095829e6711d92eca9bab6b35ce6719f42b5552" - integrity sha512-wjN9H/Ddz5vriQjeW6NGGMnSrTFFkIRZr0JnG2yVErCcda4AgazIiIwfJwMX2wnwjuJr+wUVyx1skJ6m/ZD75g== +"@finschia/finschia-proto@4.0.0-rc4": + version "4.0.0-rc4" + resolved "https://registry.yarnpkg.com/@finschia/finschia-proto/-/finschia-proto-4.0.0-rc4.tgz#6fa689714787f5673901fa5aa2ce52d5395e60b8" + integrity sha512-S69IyMit7nyhVijTki5o9vIyHchZdO4JSSTfrES/vMRRHxX/esTSkB8IjxNyDWTTmXGIBaCDZmFvS/qFeoRNVw== dependencies: long "^4.0.0" protobufjs "~6.11.2"