mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Beautify Code
This commit is contained in:
parent
069a298e44
commit
aa1dd9ab8d
@ -17,6 +17,7 @@ import {
|
||||
AminoTypes,
|
||||
calculateFee,
|
||||
Coin,
|
||||
createBankAminoConverters,
|
||||
defaultRegistryTypes as defaultStargateTypes,
|
||||
DeliverTxResponse,
|
||||
GasPrice,
|
||||
@ -203,7 +204,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
super(tmClient);
|
||||
const {
|
||||
registry = createDefaultRegistry(),
|
||||
aminoTypes = new AminoTypes({ ...createWasmAminoConverters() }),
|
||||
aminoTypes = new AminoTypes({ ...createWasmAminoConverters(), ...createBankAminoConverters() }),
|
||||
} = options;
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
|
@ -91,6 +91,18 @@ export interface SigningStargateClientOptions {
|
||||
readonly gasPrice?: GasPrice;
|
||||
}
|
||||
|
||||
export function createDefaultTypes(prefix: string): AminoConverters {
|
||||
return {
|
||||
...createAuthzAminoConverters(),
|
||||
...createBankAminoConverters(),
|
||||
...createDistributionAminoConverters(),
|
||||
...createGovAminoConverters(),
|
||||
...createStakingAminoConverters(prefix),
|
||||
...createIbcAminoConverters(),
|
||||
...createFreegrantAminoConverters(),
|
||||
};
|
||||
}
|
||||
|
||||
export class SigningStargateClient extends StargateClient {
|
||||
public readonly registry: Registry;
|
||||
public readonly broadcastTimeoutMs: number | undefined;
|
||||
@ -133,10 +145,8 @@ export class SigningStargateClient extends StargateClient {
|
||||
super(tmClient);
|
||||
// TODO: do we really want to set a default here? Ideally we could get it from the signer such that users only have to set it once.
|
||||
const prefix = options.prefix ?? "cosmos";
|
||||
const {
|
||||
registry = createDefaultRegistry(),
|
||||
aminoTypes = new AminoTypes({ ...this.createDefaultTypes(prefix) }),
|
||||
} = options;
|
||||
const { registry = createDefaultRegistry(), aminoTypes = new AminoTypes(createDefaultTypes(prefix)) } =
|
||||
options;
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
this.signer = signer;
|
||||
@ -319,18 +329,6 @@ export class SigningStargateClient extends StargateClient {
|
||||
: this.signAmino(signerAddress, messages, fee, memo, signerData);
|
||||
}
|
||||
|
||||
public createDefaultTypes(prefix: string): AminoConverters {
|
||||
return {
|
||||
...createAuthzAminoConverters(),
|
||||
...createBankAminoConverters(),
|
||||
...createDistributionAminoConverters(),
|
||||
...createGovAminoConverters(),
|
||||
...createStakingAminoConverters(prefix),
|
||||
...createIbcAminoConverters(),
|
||||
...createFreegrantAminoConverters(),
|
||||
};
|
||||
}
|
||||
|
||||
private async signAmino(
|
||||
signerAddress: string,
|
||||
messages: readonly EncodeObject[],
|
||||
|
Loading…
x
Reference in New Issue
Block a user