mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Let Registry constructor argument override types
This commit is contained in:
parent
d9df9dae8e
commit
7af2c64732
@ -95,12 +95,13 @@ export class Registry {
|
||||
* change the `customTypes` argument to override the default types if set.
|
||||
* See https://github.com/cosmos/cosmjs/issues/994
|
||||
*/
|
||||
public constructor(customTypes: Iterable<[string, GeneratedType]> = []) {
|
||||
public constructor(customTypes?: Iterable<[string, GeneratedType]>) {
|
||||
const { cosmosCoin, cosmosMsgSend } = defaultTypeUrls;
|
||||
this.types = new Map<string, GeneratedType>([
|
||||
this.types = customTypes ? new Map<string, GeneratedType>([
|
||||
...customTypes
|
||||
]) : new Map<string, GeneratedType>([
|
||||
[cosmosCoin, Coin],
|
||||
[cosmosMsgSend, MsgSend],
|
||||
...customTypes,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ import { calculateFee, GasPrice } from "./fee";
|
||||
import { DeliverTxResponse, StargateClient } from "./stargateclient";
|
||||
|
||||
export const defaultRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
|
||||
["/cosmos.base.v1beta1.Coin", Coin],
|
||||
["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend],
|
||||
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
|
||||
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
|
||||
|
Loading…
x
Reference in New Issue
Block a user