Merge pull request #1385 from cosmos/add-amino-types-to-cosmwasm-client-simon
Add amino types to cosmwasm client (merge PR)
This commit is contained in:
commit
53431ffec5
@ -28,12 +28,16 @@ and this project adheres to
|
||||
`createWasmAminoConverters()` instead.
|
||||
- @cosmjs/encoding: Remove previously deprecated `Bech32` class. Please replace
|
||||
`Bech32.encode`/`.decode` with free the functions `toBech32`/`fromBech32`.
|
||||
- @cosmjs/cosmwasm-stargate: Changed the `SigningCosmWasmClient` constructor to
|
||||
include all Amino type converters that the `SigningStargateClient` uses by
|
||||
default, to match the default registry types ([#1384]).
|
||||
|
||||
[#1002]: https://github.com/cosmos/cosmjs/issues/1002
|
||||
[#1240]: https://github.com/cosmos/cosmjs/pull/1240
|
||||
[#1289]: https://github.com/cosmos/cosmjs/issues/1289
|
||||
[#1291]: https://github.com/cosmos/cosmjs/issues/1291
|
||||
[#1329]: https://github.com/cosmos/cosmjs/pull/1329
|
||||
[#1384]: https://github.com/cosmos/cosmjs/pull/1384
|
||||
|
||||
### Added
|
||||
|
||||
@ -54,11 +58,15 @@ and this project adheres to
|
||||
addresses for Instantiate2 ([#1253]).
|
||||
- @cosmjs/stargate: Add `txIndex` to `DeliverTxResponse` and `IndexedTx`
|
||||
([#1361]).
|
||||
- @cosmjs/stargate: Add `createDefaultAminoConverters` to access the
|
||||
`SigningStargateClient`'s list of default Amino type converters to match the
|
||||
default registry types in `defaultStargateTypes` ([#1384]).
|
||||
|
||||
[#1253]: https://github.com/cosmos/cosmjs/pull/1253
|
||||
[#1308]: https://github.com/cosmos/cosmjs/pull/1308
|
||||
[#1361]: https://github.com/cosmos/cosmjs/issues/1361
|
||||
[#1376]: https://github.com/cosmos/cosmjs/pull/1376
|
||||
[#1384]: https://github.com/cosmos/cosmjs/pull/1384
|
||||
|
||||
## [0.29.5] - 2022-12-07
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ import {
|
||||
AminoTypes,
|
||||
calculateFee,
|
||||
Coin,
|
||||
createBankAminoConverters,
|
||||
createDefaultAminoConverters,
|
||||
defaultRegistryTypes as defaultStargateTypes,
|
||||
DeliverTxResponse,
|
||||
Event,
|
||||
@ -162,10 +162,6 @@ function createDeliverTxResponseErrorMessage(result: DeliverTxResponse): string
|
||||
return `Error when broadcasting tx ${result.transactionHash} at height ${result.height}. Code: ${result.code}; Raw log: ${result.rawLog}`;
|
||||
}
|
||||
|
||||
function createDefaultRegistry(): Registry {
|
||||
return new Registry([...defaultStargateTypes, ...wasmTypes]);
|
||||
}
|
||||
|
||||
export interface SigningCosmWasmClientOptions {
|
||||
readonly registry?: Registry;
|
||||
readonly aminoTypes?: AminoTypes;
|
||||
@ -233,8 +229,11 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
) {
|
||||
super(tmClient);
|
||||
const {
|
||||
registry = createDefaultRegistry(),
|
||||
aminoTypes = new AminoTypes({ ...createWasmAminoConverters(), ...createBankAminoConverters() }),
|
||||
registry = new Registry([...defaultStargateTypes, ...wasmTypes]),
|
||||
aminoTypes = new AminoTypes({
|
||||
...createDefaultAminoConverters(),
|
||||
...createWasmAminoConverters(),
|
||||
}),
|
||||
} = options;
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
|
||||
@ -123,6 +123,7 @@ export {
|
||||
SearchTxQuery,
|
||||
} from "./search";
|
||||
export {
|
||||
createDefaultAminoConverters,
|
||||
defaultRegistryTypes,
|
||||
SignerData,
|
||||
SigningStargateClient,
|
||||
|
||||
@ -64,10 +64,6 @@ export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
|
||||
...vestingTypes,
|
||||
];
|
||||
|
||||
function createDefaultRegistry(): Registry {
|
||||
return new Registry(defaultRegistryTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signing information for a single signer that is not included in the transaction.
|
||||
*
|
||||
@ -92,7 +88,7 @@ export interface SigningStargateClientOptions extends StargateClientOptions {
|
||||
readonly gasPrice?: GasPrice;
|
||||
}
|
||||
|
||||
function createDefaultTypes(): AminoConverters {
|
||||
export function createDefaultAminoConverters(): AminoConverters {
|
||||
return {
|
||||
...createAuthzAminoConverters(),
|
||||
...createBankAminoConverters(),
|
||||
@ -163,7 +159,10 @@ export class SigningStargateClient extends StargateClient {
|
||||
options: SigningStargateClientOptions,
|
||||
) {
|
||||
super(tmClient, options);
|
||||
const { registry = createDefaultRegistry(), aminoTypes = new AminoTypes(createDefaultTypes()) } = options;
|
||||
const {
|
||||
registry = new Registry(defaultRegistryTypes),
|
||||
aminoTypes = new AminoTypes(createDefaultAminoConverters()),
|
||||
} = options;
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
this.signer = signer;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user