Skip to content

Commit

Permalink
fix: minimal ts erros for group-ui imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchristo committed Jul 12, 2023
1 parent f2cfd92 commit 9f5a846
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
14 changes: 10 additions & 4 deletions packages/api/src/codegen/cosmos/group/v1/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ export const GroupPolicyInfo = {
message.version = (reader.uint64() as Long);
break;
case 6:
message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as Any);
message.decisionPolicy = (DecisionPolicy_InterfaceDecoder(reader) as ThresholdDecisionPolicy & PercentageDecisionPolicy & Any);
break;
case 7:
message.createdAt = Timestamp.decode(reader, reader.uint32());
Expand All @@ -1579,7 +1579,9 @@ export const GroupPolicyInfo = {
admin: isSet(object.admin) ? String(object.admin) : "",
metadata: isSet(object.metadata) ? String(object.metadata) : "",
version: isSet(object.version) ? Long.fromValue(object.version) : Long.UZERO,
decisionPolicy: isSet(object.decisionPolicy) ? Any.fromJSON(object.decisionPolicy) : undefined,
decisionPolicy: isSet(object.decisionPolicy)
? Any.fromJSON(object.decisionPolicy) as (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any)
: undefined,
createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined
};
},
Expand All @@ -1601,7 +1603,9 @@ export const GroupPolicyInfo = {
message.admin = object.admin ?? "";
message.metadata = object.metadata ?? "";
message.version = object.version !== undefined && object.version !== null ? Long.fromValue(object.version) : Long.UZERO;
message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? Any.fromPartial(object.decisionPolicy) : undefined;
message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null
? Any.fromPartial(object.decisionPolicy) as (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any)
: undefined;
message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? Timestamp.fromPartial(object.createdAt) : undefined;
return message;
},
Expand All @@ -1612,7 +1616,9 @@ export const GroupPolicyInfo = {
admin: object.admin,
metadata: object.metadata,
version: Long.fromString(object.version),
decisionPolicy: object?.decision_policy ? DecisionPolicy_FromAmino(object.decision_policy) : undefined,
decisionPolicy: object?.decision_policy
? DecisionPolicy_FromAmino(object.decision_policy) as (ThresholdDecisionPolicy & PercentageDecisionPolicy & Any)
: undefined,
createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined
};
},
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/codegen/cosmos/staking/v1beta1/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,10 +1391,10 @@ export const Validator = {
fromAmino(object: ValidatorAmino): Validator {
return {
operatorAddress: object.operator_address,
consensusPubkey: encodeBech32Pubkey({
type: "tendermint/PubKeySecp256k1",
value: toBase64(object.consensus_pubkey.value)
}, "cosmos"),
consensusPubkey: {
typeUrl: "tendermint/PubKeySecp256k1",
value: object.consensus_pubkey?.value
},
jailed: object.jailed,
status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0,
tokens: object.tokens,
Expand All @@ -1411,7 +1411,7 @@ export const Validator = {
obj.operator_address = message.operatorAddress;
obj.consensus_pubkey = message.consensusPubkey ? {
typeUrl: "/cosmos.crypto.secp256k1.PubKey",
value: fromBase64(decodeBech32Pubkey(message.consensusPubkey).value)
value: message.consensusPubkey.value
} : undefined;
obj.jailed = message.jailed;
obj.status = message.status;
Expand Down Expand Up @@ -2951,6 +2951,6 @@ export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => {
export const Cosmos_cryptoPubKey_ToAmino = (content: Any) => {
return {
typeUrl: "/cosmos.crypto.secp256k1.PubKey",
value: fromBase64(decodeBech32Pubkey(content).value)
value: content.value
};
};
12 changes: 6 additions & 6 deletions packages/api/src/codegen/cosmos/staking/v1beta1/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,10 @@ export const MsgCreateValidator = {
minSelfDelegation: object.min_self_delegation,
delegatorAddress: object.delegator_address,
validatorAddress: object.validator_address,
pubkey: encodeBech32Pubkey({
type: "tendermint/PubKeySecp256k1",
value: toBase64(object.pubkey.value)
}, "cosmos"),
pubkey: {
typeUrl: "tendermint/PubKeySecp256k1",
value: object.pubkey?.value,
},
value: object?.value ? Coin.fromAmino(object.value) : undefined
};
},
Expand All @@ -476,7 +476,7 @@ export const MsgCreateValidator = {
obj.validator_address = message.validatorAddress;
obj.pubkey = message.pubkey ? {
typeUrl: "/cosmos.crypto.secp256k1.PubKey",
value: fromBase64(decodeBech32Pubkey(message.pubkey).value)
value: message.pubkey.value
} : undefined;
obj.value = message.value ? Coin.toAmino(message.value) : undefined;
return obj;
Expand Down Expand Up @@ -1452,6 +1452,6 @@ export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => {
export const Cosmos_cryptoPubKey_ToAmino = (content: Any) => {
return {
typeUrl: "/cosmos.crypto.secp256k1.PubKey",
value: fromBase64(decodeBech32Pubkey(content).value)
value: content.value
};
};
2 changes: 1 addition & 1 deletion packages/api/src/codegen/google/protobuf/any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export const Any = {
},
fromAmino(object: AnyAmino): Any {
return {
typeUrl: object.type_url,
typeUrl: object.type,
value: object.value
};
},
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/codegen/google/protobuf/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ export const Timestamp = {
},
fromAmino(object: TimestampAmino): Timestamp {
return {
seconds: Long.fromString(object.seconds),
nanos: object.nanos
seconds: Long.fromString(object),
nanos: 0
};
},
toAmino(message: Timestamp): TimestampAmino {
Expand Down

0 comments on commit 9f5a846

Please sign in to comment.