-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ibc protobufs #7
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
68ee1a9
feat: ibc protobuf and MsgTransfer model
ryoid 7d143be
chore: generate protobufs
ryoid 7a07464
refactor: rename to MsgIbcTransfer
ryoid 7633ee9
fix: toAmino conversion
ryoid 2c68dff
fix: amino big ints
ryoid 1346ba1
fix: convert names to pascal case
AaronCQL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { PlainMessage } from "@bufbuild/protobuf"; | ||
import { IbcApplicationsTransferV1MsgTransfer as ProtoMsgTransfer } from "cosmes/protobufs"; | ||
|
||
import { DeepPrettify } from "../../typeutils/prettify"; | ||
import { Adapter } from "./Adapter"; | ||
|
||
type Data = DeepPrettify<PlainMessage<ProtoMsgTransfer>>; | ||
|
||
export class MsgTransfer implements Adapter { | ||
private readonly data: Data; | ||
|
||
constructor(data: Data) { | ||
this.data = data; | ||
} | ||
|
||
public toProto() { | ||
return new ProtoMsgTransfer(this.data); | ||
} | ||
|
||
public toAmino() { | ||
return { | ||
type: "ibc/MsgTransfer", | ||
value: this.data, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" | ||
// @generated from file capability/v1/capability.proto (package capability.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* Capability defines an implementation of an object capability. The index | ||
* provided to a Capability must be globally unique. | ||
* | ||
* @generated from message capability.v1.Capability | ||
*/ | ||
export class Capability extends Message<Capability> { | ||
/** | ||
* @generated from field: uint64 index = 1; | ||
*/ | ||
index = protoInt64.zero; | ||
|
||
constructor(data?: PartialMessage<Capability>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime: typeof proto3 = proto3; | ||
static readonly typeName = "capability.v1.Capability"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "index", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Capability { | ||
return new Capability().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Capability { | ||
return new Capability().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Capability { | ||
return new Capability().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Capability | PlainMessage<Capability> | undefined, b: Capability | PlainMessage<Capability> | undefined): boolean { | ||
return proto3.util.equals(Capability, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* Owner defines a single capability owner. An owner is defined by the name of | ||
* capability and the module name. | ||
* | ||
* @generated from message capability.v1.Owner | ||
*/ | ||
export class Owner extends Message<Owner> { | ||
/** | ||
* @generated from field: string module = 1; | ||
*/ | ||
module = ""; | ||
|
||
/** | ||
* @generated from field: string name = 2; | ||
*/ | ||
name = ""; | ||
|
||
constructor(data?: PartialMessage<Owner>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime: typeof proto3 = proto3; | ||
static readonly typeName = "capability.v1.Owner"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "module", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Owner { | ||
return new Owner().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Owner { | ||
return new Owner().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Owner { | ||
return new Owner().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Owner | PlainMessage<Owner> | undefined, b: Owner | PlainMessage<Owner> | undefined): boolean { | ||
return proto3.util.equals(Owner, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* CapabilityOwners defines a set of owners of a single Capability. The set of | ||
* owners must be unique. | ||
* | ||
* @generated from message capability.v1.CapabilityOwners | ||
*/ | ||
export class CapabilityOwners extends Message<CapabilityOwners> { | ||
/** | ||
* @generated from field: repeated capability.v1.Owner owners = 1; | ||
*/ | ||
owners: Owner[] = []; | ||
|
||
constructor(data?: PartialMessage<CapabilityOwners>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime: typeof proto3 = proto3; | ||
static readonly typeName = "capability.v1.CapabilityOwners"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "owners", kind: "message", T: Owner, repeated: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CapabilityOwners { | ||
return new CapabilityOwners().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CapabilityOwners { | ||
return new CapabilityOwners().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CapabilityOwners { | ||
return new CapabilityOwners().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: CapabilityOwners | PlainMessage<CapabilityOwners> | undefined, b: CapabilityOwners | PlainMessage<CapabilityOwners> | undefined): boolean { | ||
return proto3.util.equals(CapabilityOwners, a, b); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// @generated by protoc-gen-es v1.2.0 with parameter "target=ts" | ||
// @generated from file capability/v1/genesis.proto (package capability.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; | ||
import { CapabilityOwners } from "./capability_pb.js"; | ||
|
||
/** | ||
* GenesisOwners defines the capability owners with their corresponding index. | ||
* | ||
* @generated from message capability.v1.GenesisOwners | ||
*/ | ||
export class GenesisOwners extends Message<GenesisOwners> { | ||
/** | ||
* index is the index of the capability owner. | ||
* | ||
* @generated from field: uint64 index = 1; | ||
*/ | ||
index = protoInt64.zero; | ||
|
||
/** | ||
* index_owners are the owners at the given index. | ||
* | ||
* @generated from field: capability.v1.CapabilityOwners index_owners = 2; | ||
*/ | ||
indexOwners?: CapabilityOwners; | ||
|
||
constructor(data?: PartialMessage<GenesisOwners>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime: typeof proto3 = proto3; | ||
static readonly typeName = "capability.v1.GenesisOwners"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "index", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 2, name: "index_owners", kind: "message", T: CapabilityOwners }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GenesisOwners { | ||
return new GenesisOwners().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GenesisOwners { | ||
return new GenesisOwners().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GenesisOwners { | ||
return new GenesisOwners().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: GenesisOwners | PlainMessage<GenesisOwners> | undefined, b: GenesisOwners | PlainMessage<GenesisOwners> | undefined): boolean { | ||
return proto3.util.equals(GenesisOwners, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* GenesisState defines the capability module's genesis state. | ||
* | ||
* @generated from message capability.v1.GenesisState | ||
*/ | ||
export class GenesisState extends Message<GenesisState> { | ||
/** | ||
* index is the capability global index. | ||
* | ||
* @generated from field: uint64 index = 1; | ||
*/ | ||
index = protoInt64.zero; | ||
|
||
/** | ||
* owners represents a map from index to owners of the capability index | ||
* index key is string to allow amino marshalling. | ||
* | ||
* @generated from field: repeated capability.v1.GenesisOwners owners = 2; | ||
*/ | ||
owners: GenesisOwners[] = []; | ||
|
||
constructor(data?: PartialMessage<GenesisState>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime: typeof proto3 = proto3; | ||
static readonly typeName = "capability.v1.GenesisState"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "index", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, | ||
{ no: 2, name: "owners", kind: "message", T: GenesisOwners, repeated: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GenesisState { | ||
return new GenesisState().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GenesisState { | ||
return new GenesisState().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GenesisState { | ||
return new GenesisState().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: GenesisState | PlainMessage<GenesisState> | undefined, b: GenesisState | PlainMessage<GenesisState> | undefined): boolean { | ||
return proto3.util.equals(GenesisState, a, b); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name this file and function
MsgIbcTransfer
to make it more obvious what it does