From 7e83910617143bd340ef5bfd3f2a3ae9dbd106b1 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Fri, 12 Feb 2021 14:28:50 +0100 Subject: [PATCH] Deprecate DateTime --- CHANGELOG.md | 5 +++++ packages/cosmwasm-stargate/src/cosmwasmclient.ts | 4 ++-- packages/stargate/src/stargateclient.ts | 4 ++-- packages/tendermint-rpc/src/dates.ts | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dceef247..b33d6101 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,11 @@ - @cosmjs/launchpad-ledger: Renamed to @cosmjs/ledger-amino. - @cosmjs/ledger-amino: `LedgerSigner.sign` method renamed `signAmino`. +### Deprecated + +- @cosmjs/tendermint-rpc: Deprecate `DateTime` in favour of the free functions + `fromRfc3339WithNanoseconds` and `toRfc3339WithNanoseconds`. + ## 0.23.2 (2021-01-06) ### Security diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index 8b15dc71..d5d267c0 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -35,7 +35,7 @@ import { adaptor34, broadcastTxCommitSuccess, Client as TendermintClient, - DateTime, + toRfc3339WithNanoseconds, } from "@cosmjs/tendermint-rpc"; import { assert } from "@cosmjs/utils"; @@ -114,7 +114,7 @@ export class CosmWasmClient { }, height: response.block.header.height, chainId: response.block.header.chainId, - time: DateTime.encode(response.block.header.time), + time: toRfc3339WithNanoseconds(response.block.header.time), }, txs: response.block.txs, }; diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index bc26a5a7..8b6c5b4b 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -15,7 +15,7 @@ import { adaptor34, broadcastTxCommitSuccess, Client as TendermintClient, - DateTime, + toRfc3339WithNanoseconds, } from "@cosmjs/tendermint-rpc"; import { assert, assertDefinedAndNotNull } from "@cosmjs/utils"; import Long from "long"; @@ -185,7 +185,7 @@ export class StargateClient { }, height: response.block.header.height, chainId: response.block.header.chainId, - time: DateTime.encode(response.block.header.time), + time: toRfc3339WithNanoseconds(response.block.header.time), }, txs: response.block.txs, }; diff --git a/packages/tendermint-rpc/src/dates.ts b/packages/tendermint-rpc/src/dates.ts index e4928fc8..24199e4a 100644 --- a/packages/tendermint-rpc/src/dates.ts +++ b/packages/tendermint-rpc/src/dates.ts @@ -26,6 +26,7 @@ export function toRfc3339WithNanoseconds(dateTime: ReadonlyDateWithNanoseconds): return `${millisecondIso.slice(0, -1)}${nanoseconds.padStart(6, "0")}Z`; } +/** @deprecated Use fromRfc3339WithNanoseconds/toRfc3339WithNanoseconds instead */ export class DateTime { /** @deprecated Use fromRfc3339WithNanoseconds instead */ public static decode(dateTimeString: string): ReadonlyDateWithNanoseconds {