Skip to content

Commit

Permalink
finished coding is method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Nov 15, 2023
1 parent a74f32c commit 50ba045
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function createBaseDepositDeploymentAuthorization(): DepositDeploymentAuthorizat
export const DepositDeploymentAuthorization = {
typeUrl: "/akash.deployment.v1beta1.DepositDeploymentAuthorization",
is(o: any): o is DepositDeploymentAuthorization {
return o && o.$typeUrl === DepositDeploymentAuthorization.typeUrl && o;
return o && (o.$typeUrl === DepositDeploymentAuthorization.typeUrl || Coin.is(o.spendLimit));
},
encode(message: DepositDeploymentAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.spendLimit !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface GenericAuthorizationProtoMsg {
* the provide method with expiration time.
*/
export interface Grant {
authorization?: GenericAuthorization | DepositDeploymentAuthorization | SendAuthorization | Any | undefined;
authorization: GenericAuthorization | DepositDeploymentAuthorization | SendAuthorization | Any | undefined;
/**
* time when the grant will expire and will be pruned. If null, then the grant
* doesn't have a time expiration (other conditions in `authorization`
Expand Down Expand Up @@ -66,7 +66,7 @@ function createBaseGenericAuthorization(): GenericAuthorization {
export const GenericAuthorization = {
typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization",
is(o: any): o is GenericAuthorization {
return o && o.$typeUrl === GenericAuthorization.typeUrl && typeof o.msg === "string";
return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string");
},
encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.msg !== "") {
Expand Down Expand Up @@ -122,14 +122,14 @@ export const GenericAuthorization = {
GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization);
function createBaseGrant(): Grant {
return {
authorization: undefined,
authorization: Any.fromPartial({}),
expiration: undefined
};
}
export const Grant = {
typeUrl: "/cosmos.authz.v1beta1.Grant",
is(o: any): o is Grant {
return o && o.$typeUrl === Grant.typeUrl && o && o;
return o && (o.$typeUrl === Grant.typeUrl || GenericAuthorization.is(o.authorization) || DepositDeploymentAuthorization.is(o.authorization) || SendAuthorization.is(o.authorization) || Any.is(o.authorization));
},
encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.authorization !== undefined) {
Expand Down Expand Up @@ -205,7 +205,7 @@ function createBaseGrantAuthorization(): GrantAuthorization {
export const GrantAuthorization = {
typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization",
is(o: any): o is GrantAuthorization {
return o && o.$typeUrl === GrantAuthorization.typeUrl && typeof o.granter === "string" && typeof o.grantee === "string" && o && o;
return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string");
},
encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.granter !== "") {
Expand Down Expand Up @@ -296,9 +296,7 @@ function createBaseGrantQueueItem(): GrantQueueItem {
export const GrantQueueItem = {
typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem",
is(o: any): o is GrantQueueItem {
return o && o.$typeUrl === GrantQueueItem.typeUrl && Array.isArray(o.msgTypeUrls) && (!o.msgTypeUrls.length || o.msgTypeUrls.some(item => {
return typeof o.item === "string";
}));
return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msgTypeUrls) && (!o.msgTypeUrls.length || typeof o.msgTypeUrls[0] === "string"));
},
encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
for (const v of message.msgTypeUrls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function createBaseSendAuthorization(): SendAuthorization {
export const SendAuthorization = {
typeUrl: "/cosmos.bank.v1beta1.SendAuthorization",
is(o: any): o is SendAuthorization {
return o && o.$typeUrl === SendAuthorization.typeUrl && o;
return o && (o.$typeUrl === SendAuthorization.typeUrl || Array.isArray(o.spendLimit) && (!o.spendLimit.length || Coin.is(o.spendLimit[0])));
},
encode(message: SendAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
for (const v of message.spendLimit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function createBaseCoin(): Coin {
export const Coin = {
typeUrl: "/cosmos.base.v1beta1.Coin",
is(o: any): o is Coin {
return o && o.$typeUrl === Coin.typeUrl && typeof o.denom === "string" && typeof o.amount === "string";
return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string");
},
encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.denom !== "") {
Expand Down Expand Up @@ -127,7 +127,7 @@ function createBaseDecCoin(): DecCoin {
export const DecCoin = {
typeUrl: "/cosmos.base.v1beta1.DecCoin",
is(o: any): o is DecCoin {
return o && o.$typeUrl === DecCoin.typeUrl && typeof o.denom === "string" && typeof o.amount === "string";
return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string");
},
encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.denom !== "") {
Expand Down Expand Up @@ -198,7 +198,7 @@ function createBaseIntProto(): IntProto {
export const IntProto = {
typeUrl: "/cosmos.base.v1beta1.IntProto",
is(o: any): o is IntProto {
return o && o.$typeUrl === IntProto.typeUrl && typeof o.int === "string";
return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string");
},
encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.int !== "") {
Expand Down Expand Up @@ -260,7 +260,7 @@ function createBaseDecProto(): DecProto {
export const DecProto = {
typeUrl: "/cosmos.base.v1beta1.DecProto",
is(o: any): o is DecProto {
return o && o.$typeUrl === DecProto.typeUrl && typeof o.dec === "string";
return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string");
},
encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.dec !== "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function createBaseInterfaceDescriptor(): InterfaceDescriptor {
export const InterfaceDescriptor = {
typeUrl: "/cosmos_proto.InterfaceDescriptor",
is(o: any): o is InterfaceDescriptor {
return o && o.$typeUrl === InterfaceDescriptor.typeUrl && typeof o.name === "string" && typeof o.description === "string";
return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string");
},
encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.name !== "") {
Expand Down Expand Up @@ -177,7 +177,7 @@ function createBaseScalarDescriptor(): ScalarDescriptor {
export const ScalarDescriptor = {
typeUrl: "/cosmos_proto.ScalarDescriptor",
is(o: any): o is ScalarDescriptor {
return o && o.$typeUrl === ScalarDescriptor.typeUrl && typeof o.name === "string" && typeof o.description === "string" && o;
return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.fieldType));
},
encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.name !== "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function createBaseAny(): Any {
export const Any = {
typeUrl: "/google.protobuf.Any",
is(o: any): o is Any {
return o && o.$typeUrl === Any.typeUrl && typeof o.typeUrl === "string" && typeof o.value === "bytes";
return o && (o.$typeUrl === Any.typeUrl || typeof o.typeUrl === "string" && o.value instanceof Uint8Array);
},
encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.typeUrl !== "") {
Expand Down
Loading

0 comments on commit 50ba045

Please sign in to comment.