laconic-sdk/src/proto/cosmos/base/v1beta1/coin.ts
Thomas E Lackey b5fce86d48 Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord (#44)
See also: cerc-io/laconicd#113

![image](/attachments/db05bbb6-86ca-4fbb-a8a4-fcd06501b1b1)

```
message ApplicationRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string homepage       = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
  string license        = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
  string author         = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
  string repository     = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
  string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
  string app_version    = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
  string app_type       = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message WebAppDeploymentRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string application    = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
  string url            = 6 [(gogoproto.moretags) = "json:\"\" yaml:\"name\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message GeneralRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string category       = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
  string value          = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
```

```
❯ cat general.yml
record:
  type: GeneralRecord
  name: my-generic-record
  version: 0.0.1
  value: "anything-goes-here"
  category: filter-by-this
  tags:
    - a
    - b
    - c
  meta:
    foo: bar
    bar:
      baz: boz

❯ bin/laconic cns record publish --filename general.yml --bond-id ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c
{
  "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q"
}

❯ bin/laconic cns record get --id bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q
[
  {
    "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q",
    "names": null,
    "owners": [
      "9A66500A9AA574CAAB4EDB26F7333590BF452CE0"
    ],
    "bondId": "ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c",
    "createTime": "2023-11-17T23:11:27Z",
    "expiryTime": "2024-11-16T23:11:27Z",
    "attributes": {
      "meta": "{\"foo\":\"bar\",\"bar\":{\"baz\":\"boz\"}}",
      "tags": [
        "a",
        "b",
        "c"
      ],
      "type": "GeneralRecord",
      "name": "my-generic-record",
      "version": "0.0.1",
      "category": "filter-by-this",
      "value": "anything-goes-here"
    }
  }
]
```

> Note: The repeated items are preserved as lists, but the object/map ends up encoded as a string.  It would be nice to avoid this.

Reviewed-on: cerc-io/laconic-sdk#44
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-20 22:01:19 +00:00

326 lines
11 KiB
TypeScript

// @ts-nocheck
/* eslint-disable */
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 4.25.1
* source: cosmos/base/v1beta1/coin.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as dependency_1 from "./../../../gogoproto/gogo";
import * as pb_1 from "google-protobuf";
export namespace cosmos.base.v1beta1 {
export class Coin extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
denom?: string;
amount?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("denom" in data && data.denom != undefined) {
this.denom = data.denom;
}
if ("amount" in data && data.amount != undefined) {
this.amount = data.amount;
}
}
}
get denom() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set denom(value: string) {
pb_1.Message.setField(this, 1, value);
}
get amount() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set amount(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
denom?: string;
amount?: string;
}): Coin {
const message = new Coin({});
if (data.denom != null) {
message.denom = data.denom;
}
if (data.amount != null) {
message.amount = data.amount;
}
return message;
}
toObject() {
const data: {
denom?: string;
amount?: string;
} = {};
if (this.denom != null) {
data.denom = this.denom;
}
if (this.amount != null) {
data.amount = this.amount;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.denom.length)
writer.writeString(1, this.denom);
if (this.amount.length)
writer.writeString(2, this.amount);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Coin {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Coin();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.denom = reader.readString();
break;
case 2:
message.amount = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Coin {
return Coin.deserialize(bytes);
}
}
export class DecCoin extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
denom?: string;
amount?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("denom" in data && data.denom != undefined) {
this.denom = data.denom;
}
if ("amount" in data && data.amount != undefined) {
this.amount = data.amount;
}
}
}
get denom() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set denom(value: string) {
pb_1.Message.setField(this, 1, value);
}
get amount() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set amount(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
denom?: string;
amount?: string;
}): DecCoin {
const message = new DecCoin({});
if (data.denom != null) {
message.denom = data.denom;
}
if (data.amount != null) {
message.amount = data.amount;
}
return message;
}
toObject() {
const data: {
denom?: string;
amount?: string;
} = {};
if (this.denom != null) {
data.denom = this.denom;
}
if (this.amount != null) {
data.amount = this.amount;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.denom.length)
writer.writeString(1, this.denom);
if (this.amount.length)
writer.writeString(2, this.amount);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DecCoin {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DecCoin();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.denom = reader.readString();
break;
case 2:
message.amount = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DecCoin {
return DecCoin.deserialize(bytes);
}
}
export class IntProto extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
int?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("int" in data && data.int != undefined) {
this.int = data.int;
}
}
}
get int() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set int(value: string) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
int?: string;
}): IntProto {
const message = new IntProto({});
if (data.int != null) {
message.int = data.int;
}
return message;
}
toObject() {
const data: {
int?: string;
} = {};
if (this.int != null) {
data.int = this.int;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.int.length)
writer.writeString(1, this.int);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IntProto {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IntProto();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.int = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): IntProto {
return IntProto.deserialize(bytes);
}
}
export class DecProto extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
dec?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("dec" in data && data.dec != undefined) {
this.dec = data.dec;
}
}
}
get dec() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set dec(value: string) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
dec?: string;
}): DecProto {
const message = new DecProto({});
if (data.dec != null) {
message.dec = data.dec;
}
return message;
}
toObject() {
const data: {
dec?: string;
} = {};
if (this.dec != null) {
data.dec = this.dec;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.dec.length)
writer.writeString(1, this.dec);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DecProto {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DecProto();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.dec = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): DecProto {
return DecProto.deserialize(bytes);
}
}
}