@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
1,516 lines (1,390 loc) • 63.2 kB
text/typescript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.4
// protoc unknown
// source: cheqd/did/v2/tx.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Coin } from "../../../cosmos/base/v1beta1/coin.js";
import { DidDocWithMetadata, Service, VerificationMethod } from "./diddoc.js";
import { FeeParams } from "./fee.js";
/**
* MsgCreateDidDoc defines the Msg/CreateDidDoc request type.
* It describes the parameters of a request for creating a new DID document.
*/
export interface MsgCreateDidDoc {
/** Payload containing the DID Document to be created */
payload:
| MsgCreateDidDocPayload
| undefined;
/** Signatures of the DID Document's controller(s) */
signatures: SignInfo[];
}
/**
* MsgUpdateDidDoc defines the Msg/UpdateDidDoc request type.
* It describes the parameters of a request for updating an existing DID document.
*/
export interface MsgUpdateDidDoc {
/** Payload containing the DID Document to be updated. This should be updated the DID Document. */
payload:
| MsgUpdateDidDocPayload
| undefined;
/** Signatures of the DID Document's controller(s) */
signatures: SignInfo[];
}
/**
* MsgDeactivateDidDoc defines the Msg/DeactivateDidDoc request type.
* It describes the parameters of a request for deactivating an existing DID document.
*/
export interface MsgDeactivateDidDoc {
/** Payload containing the DID Document to be deactivated */
payload:
| MsgDeactivateDidDocPayload
| undefined;
/** Signatures of the DID Document's controller(s) */
signatures: SignInfo[];
}
/** SignInfo defines the structure of a DID Document controller's signature */
export interface SignInfo {
/** Verification method ID of the DID Controller */
verificationMethodId: string;
/** Signature of the DID Document controller */
signature: Uint8Array;
}
/** MsgCreateDidDocPayload defines the structure of the payload for creating a new DID document */
export interface MsgCreateDidDocPayload {
/**
* context is a list of URIs used to identify the context of the DID document.
* Default: https://www.w3.org/ns/did/v1
*/
context: string[];
/**
* id is the DID of the DID document.
* Format: did:cheqd:<namespace>:<unique-identifier>
*/
id: string;
/** controller is a list of DIDs that are allowed to control the DID document. */
controller: string[];
/**
* verificationMethod is a list of verification methods that can be used to
* verify a digital signature or cryptographic proof.
* Documentation: https://www.w3.org/TR/did-core/#verification-methods
*
* Required fields:
* - id: A unique identifier for the verification method
* - type: A supported verification method type (supported: Ed25519VerificationKey2018, Ed25519VerificationKey2020, JsonWebKey2020)
* - controller: DID of the controller of the verification method
* - verification_material: Public key of the verification method (supported: publicJwk, publicKeyBase58, publicKeyMultibase)
*/
verificationMethod: VerificationMethod[];
/**
* authentication is a list of verification methods that can be used to
* authenticate as the DID subject.
*/
authentication: string[];
/**
* assertionMethod is a list of verification methods that can be used to
* assert statements as the DID subject.
*/
assertionMethod: string[];
/**
* capabilityInvocation is a list of verification methods that can be used to
* invoke capabilities as the DID subject.
*/
capabilityInvocation: string[];
/**
* capabilityDelegation is a list of verification methods that can be used to
* delegate capabilities as the DID subject.
*/
capabilityDelegation: string[];
/**
* keyAgreement is a list of verification methods that can be used to perform
* key agreement as the DID subject.
*/
keyAgreement: string[];
/**
* service is a list of services that can be used to interact with the DID subject.
* Documentation: https://www.w3.org/TR/did-core/#services
*
* Required fields:
* - id: A unique identifier for the service
* - type: A service type defined in DID Specification Registries
* - service_endpoint: Service endpoint(s), provided as a URI or set of URIs
*/
service: Service[];
/** alsoKnownAs is a list of DIDs that are known to refer to the same DID subject. */
alsoKnownAs: string[];
/**
* Version ID of the DID Document to be created
*
* Format: <uuid>
*/
versionId: string;
}
/** MsgCreateDidDocResponse defines response type for Msg/CreateDidDoc. */
export interface MsgCreateDidDocResponse {
/** Return the created DID Document with metadata */
value: DidDocWithMetadata | undefined;
}
/** MsgUpdateDidDocPayload defines the structure of the payload for updating an existing DID document */
export interface MsgUpdateDidDocPayload {
/**
* context is a list of URIs used to identify the context of the DID document.
* Default: https://www.w3.org/ns/did/v1
*/
context: string[];
/**
* id is the DID of the DID document.
* Format: did:cheqd:<namespace>:<unique-identifier>
*/
id: string;
/** controller is a list of DIDs that are allowed to control the DID document. */
controller: string[];
/**
* verificationMethod is a list of verification methods that can be used to
* verify a digital signature or cryptographic proof.
* Documentation: https://www.w3.org/TR/did-core/#verification-methods
*
* Required fields:
* - id: A unique identifier for the verification method
* - type: A supported verification method type (supported: Ed25519VerificationKey2018, Ed25519VerificationKey2020, JsonWebKey2020)
* - controller: DID of the controller of the verification method
* - verification_material: Public key of the verification method (supported: publicJwk, publicKeyBase58, publicKeyMultibase)
*/
verificationMethod: VerificationMethod[];
/**
* authentication is a list of verification methods that can be used to
* authenticate as the DID subject.
*/
authentication: string[];
/**
* assertionMethod is a list of verification methods that can be used to
* assert statements as the DID subject.
*/
assertionMethod: string[];
/**
* capabilityInvocation is a list of verification methods that can be used to
* invoke capabilities as the DID subject.
*/
capabilityInvocation: string[];
/**
* capabilityDelegation is a list of verification methods that can be used to
* delegate capabilities as the DID subject.
*/
capabilityDelegation: string[];
/**
* keyAgreement is a list of verification methods that can be used to perform
* key agreement as the DID subject.
*/
keyAgreement: string[];
/**
* service is a list of services that can be used to interact with the DID subject.
* Documentation: https://www.w3.org/TR/did-core/#services
*
* Required fields:
* - id: A unique identifier for the service
* - type: A service type defined in DID Specification Registries
* - service_endpoint: Service endpoint(s), provided as a URI or set of URIs
*/
service: Service[];
/** alsoKnownAs is a list of DIDs that are known to refer to the same DID subject. */
alsoKnownAs: string[];
/**
* Updated version ID of the DID Document.
* Links to next/previous versions of the DID Document will be automatically updated.
*
* Format: <uuid>
*/
versionId: string;
}
export interface MsgUpdateDidDocResponse {
/** Return the updated DID Document with metadata */
value: DidDocWithMetadata | undefined;
}
/** MsgDeactivateDidDocPayload defines the structure of the payload for deactivating an existing DID document */
export interface MsgDeactivateDidDocPayload {
/** Unique identifier of the DID Document to be deactivated */
id: string;
/**
* Version ID of the DID Document to be deactivated
* This is primarily used as a sanity check to ensure that the correct DID Document is being deactivated.
*/
versionId: string;
}
/** MsgDeactivateDidDocResponse defines response type for Msg/DeactivateDidDoc. */
export interface MsgDeactivateDidDocResponse {
/** Return the deactivated DID Document with metadata */
value: DidDocWithMetadata | undefined;
}
/** MsgBurn represents a message to burn coins from the message signer account */
export interface MsgBurn {
fromAddress: string;
amount: Coin[];
}
export interface MsgBurnResponse {
}
/**
* MsgMint is the sdk.Msg type for allowing an admin account to mint
* more of a token.
* Only the admin of the token factory denom has permission to mint unless
* the denom does not have any admin.
*/
export interface MsgMint {
authority: string;
toAddress: string;
amount: Coin[];
}
export interface MsgMintResponse {
}
export interface MsgUpdateParams {
/** authority is the address that controls the module (defaults to x/gov unless overwritten). */
authority: string;
/**
* params defines the x/did parameters to update.
*
* NOTE: All parameters must be supplied.
*/
params: FeeParams | undefined;
}
/**
* MsgUpdateParamsResponse defines the response structure for executing a
* MsgUpdateParams message.
*
* Since: cosmos-sdk 0.47
*/
export interface MsgUpdateParamsResponse {
}
function createBaseMsgCreateDidDoc(): MsgCreateDidDoc {
return { payload: undefined, signatures: [] };
}
export const MsgCreateDidDoc: MessageFns<MsgCreateDidDoc> = {
encode(message: MsgCreateDidDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.payload !== undefined) {
MsgCreateDidDocPayload.encode(message.payload, writer.uint32(10).fork()).join();
}
for (const v of message.signatures) {
SignInfo.encode(v!, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateDidDoc {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateDidDoc();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.payload = MsgCreateDidDocPayload.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.signatures.push(SignInfo.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgCreateDidDoc {
return {
payload: isSet(object.payload) ? MsgCreateDidDocPayload.fromJSON(object.payload) : undefined,
signatures: globalThis.Array.isArray(object?.signatures)
? object.signatures.map((e: any) => SignInfo.fromJSON(e))
: [],
};
},
toJSON(message: MsgCreateDidDoc): unknown {
const obj: any = {};
if (message.payload !== undefined) {
obj.payload = MsgCreateDidDocPayload.toJSON(message.payload);
}
if (message.signatures?.length) {
obj.signatures = message.signatures.map((e) => SignInfo.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<MsgCreateDidDoc>, I>>(base?: I): MsgCreateDidDoc {
return MsgCreateDidDoc.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgCreateDidDoc>, I>>(object: I): MsgCreateDidDoc {
const message = createBaseMsgCreateDidDoc();
message.payload = (object.payload !== undefined && object.payload !== null)
? MsgCreateDidDocPayload.fromPartial(object.payload)
: undefined;
message.signatures = object.signatures?.map((e) => SignInfo.fromPartial(e)) || [];
return message;
},
};
function createBaseMsgUpdateDidDoc(): MsgUpdateDidDoc {
return { payload: undefined, signatures: [] };
}
export const MsgUpdateDidDoc: MessageFns<MsgUpdateDidDoc> = {
encode(message: MsgUpdateDidDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.payload !== undefined) {
MsgUpdateDidDocPayload.encode(message.payload, writer.uint32(10).fork()).join();
}
for (const v of message.signatures) {
SignInfo.encode(v!, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateDidDoc {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgUpdateDidDoc();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.payload = MsgUpdateDidDocPayload.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.signatures.push(SignInfo.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgUpdateDidDoc {
return {
payload: isSet(object.payload) ? MsgUpdateDidDocPayload.fromJSON(object.payload) : undefined,
signatures: globalThis.Array.isArray(object?.signatures)
? object.signatures.map((e: any) => SignInfo.fromJSON(e))
: [],
};
},
toJSON(message: MsgUpdateDidDoc): unknown {
const obj: any = {};
if (message.payload !== undefined) {
obj.payload = MsgUpdateDidDocPayload.toJSON(message.payload);
}
if (message.signatures?.length) {
obj.signatures = message.signatures.map((e) => SignInfo.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<MsgUpdateDidDoc>, I>>(base?: I): MsgUpdateDidDoc {
return MsgUpdateDidDoc.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgUpdateDidDoc>, I>>(object: I): MsgUpdateDidDoc {
const message = createBaseMsgUpdateDidDoc();
message.payload = (object.payload !== undefined && object.payload !== null)
? MsgUpdateDidDocPayload.fromPartial(object.payload)
: undefined;
message.signatures = object.signatures?.map((e) => SignInfo.fromPartial(e)) || [];
return message;
},
};
function createBaseMsgDeactivateDidDoc(): MsgDeactivateDidDoc {
return { payload: undefined, signatures: [] };
}
export const MsgDeactivateDidDoc: MessageFns<MsgDeactivateDidDoc> = {
encode(message: MsgDeactivateDidDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.payload !== undefined) {
MsgDeactivateDidDocPayload.encode(message.payload, writer.uint32(10).fork()).join();
}
for (const v of message.signatures) {
SignInfo.encode(v!, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgDeactivateDidDoc {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgDeactivateDidDoc();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.payload = MsgDeactivateDidDocPayload.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.signatures.push(SignInfo.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgDeactivateDidDoc {
return {
payload: isSet(object.payload) ? MsgDeactivateDidDocPayload.fromJSON(object.payload) : undefined,
signatures: globalThis.Array.isArray(object?.signatures)
? object.signatures.map((e: any) => SignInfo.fromJSON(e))
: [],
};
},
toJSON(message: MsgDeactivateDidDoc): unknown {
const obj: any = {};
if (message.payload !== undefined) {
obj.payload = MsgDeactivateDidDocPayload.toJSON(message.payload);
}
if (message.signatures?.length) {
obj.signatures = message.signatures.map((e) => SignInfo.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<MsgDeactivateDidDoc>, I>>(base?: I): MsgDeactivateDidDoc {
return MsgDeactivateDidDoc.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgDeactivateDidDoc>, I>>(object: I): MsgDeactivateDidDoc {
const message = createBaseMsgDeactivateDidDoc();
message.payload = (object.payload !== undefined && object.payload !== null)
? MsgDeactivateDidDocPayload.fromPartial(object.payload)
: undefined;
message.signatures = object.signatures?.map((e) => SignInfo.fromPartial(e)) || [];
return message;
},
};
function createBaseSignInfo(): SignInfo {
return { verificationMethodId: "", signature: new Uint8Array(0) };
}
export const SignInfo: MessageFns<SignInfo> = {
encode(message: SignInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.verificationMethodId !== "") {
writer.uint32(10).string(message.verificationMethodId);
}
if (message.signature.length !== 0) {
writer.uint32(18).bytes(message.signature);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): SignInfo {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSignInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.verificationMethodId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.signature = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): SignInfo {
return {
verificationMethodId: isSet(object.verificationMethodId)
? globalThis.String(object.verificationMethodId)
: isSet(object.verification_method_id)
? globalThis.String(object.verification_method_id)
: "",
signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0),
};
},
toJSON(message: SignInfo): unknown {
const obj: any = {};
if (message.verificationMethodId !== "") {
obj.verificationMethodId = message.verificationMethodId;
}
if (message.signature.length !== 0) {
obj.signature = base64FromBytes(message.signature);
}
return obj;
},
create<I extends Exact<DeepPartial<SignInfo>, I>>(base?: I): SignInfo {
return SignInfo.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<SignInfo>, I>>(object: I): SignInfo {
const message = createBaseSignInfo();
message.verificationMethodId = object.verificationMethodId ?? "";
message.signature = object.signature ?? new Uint8Array(0);
return message;
},
};
function createBaseMsgCreateDidDocPayload(): MsgCreateDidDocPayload {
return {
context: [],
id: "",
controller: [],
verificationMethod: [],
authentication: [],
assertionMethod: [],
capabilityInvocation: [],
capabilityDelegation: [],
keyAgreement: [],
service: [],
alsoKnownAs: [],
versionId: "",
};
}
export const MsgCreateDidDocPayload: MessageFns<MsgCreateDidDocPayload> = {
encode(message: MsgCreateDidDocPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.context) {
writer.uint32(10).string(v!);
}
if (message.id !== "") {
writer.uint32(18).string(message.id);
}
for (const v of message.controller) {
writer.uint32(26).string(v!);
}
for (const v of message.verificationMethod) {
VerificationMethod.encode(v!, writer.uint32(34).fork()).join();
}
for (const v of message.authentication) {
writer.uint32(42).string(v!);
}
for (const v of message.assertionMethod) {
writer.uint32(50).string(v!);
}
for (const v of message.capabilityInvocation) {
writer.uint32(58).string(v!);
}
for (const v of message.capabilityDelegation) {
writer.uint32(66).string(v!);
}
for (const v of message.keyAgreement) {
writer.uint32(74).string(v!);
}
for (const v of message.service) {
Service.encode(v!, writer.uint32(82).fork()).join();
}
for (const v of message.alsoKnownAs) {
writer.uint32(90).string(v!);
}
if (message.versionId !== "") {
writer.uint32(98).string(message.versionId);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateDidDocPayload {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateDidDocPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context.push(reader.string());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.id = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.controller.push(reader.string());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.verificationMethod.push(VerificationMethod.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.authentication.push(reader.string());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.assertionMethod.push(reader.string());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.capabilityInvocation.push(reader.string());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.capabilityDelegation.push(reader.string());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.keyAgreement.push(reader.string());
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.service.push(Service.decode(reader, reader.uint32()));
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.alsoKnownAs.push(reader.string());
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.versionId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgCreateDidDocPayload {
return {
context: globalThis.Array.isArray(object?.context) ? object.context.map((e: any) => globalThis.String(e)) : [],
id: isSet(object.id) ? globalThis.String(object.id) : "",
controller: globalThis.Array.isArray(object?.controller)
? object.controller.map((e: any) => globalThis.String(e))
: [],
verificationMethod: globalThis.Array.isArray(object?.verificationMethod)
? object.verificationMethod.map((e: any) => VerificationMethod.fromJSON(e))
: globalThis.Array.isArray(object?.verification_method)
? object.verification_method.map((e: any) => VerificationMethod.fromJSON(e))
: [],
authentication: globalThis.Array.isArray(object?.authentication)
? object.authentication.map((e: any) => globalThis.String(e))
: [],
assertionMethod: globalThis.Array.isArray(object?.assertionMethod)
? object.assertionMethod.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.assertion_method)
? object.assertion_method.map((e: any) => globalThis.String(e))
: [],
capabilityInvocation: globalThis.Array.isArray(object?.capabilityInvocation)
? object.capabilityInvocation.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.capability_invocation)
? object.capability_invocation.map((e: any) => globalThis.String(e))
: [],
capabilityDelegation: globalThis.Array.isArray(object?.capabilityDelegation)
? object.capabilityDelegation.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.capability_delegation)
? object.capability_delegation.map((e: any) => globalThis.String(e))
: [],
keyAgreement: globalThis.Array.isArray(object?.keyAgreement)
? object.keyAgreement.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.key_agreement)
? object.key_agreement.map((e: any) => globalThis.String(e))
: [],
service: globalThis.Array.isArray(object?.service) ? object.service.map((e: any) => Service.fromJSON(e)) : [],
alsoKnownAs: globalThis.Array.isArray(object?.alsoKnownAs)
? object.alsoKnownAs.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.also_known_as)
? object.also_known_as.map((e: any) => globalThis.String(e))
: [],
versionId: isSet(object.versionId)
? globalThis.String(object.versionId)
: isSet(object.version_id)
? globalThis.String(object.version_id)
: "",
};
},
toJSON(message: MsgCreateDidDocPayload): unknown {
const obj: any = {};
if (message.context?.length) {
obj.context = message.context;
}
if (message.id !== "") {
obj.id = message.id;
}
if (message.controller?.length) {
obj.controller = message.controller;
}
if (message.verificationMethod?.length) {
obj.verificationMethod = message.verificationMethod.map((e) => VerificationMethod.toJSON(e));
}
if (message.authentication?.length) {
obj.authentication = message.authentication;
}
if (message.assertionMethod?.length) {
obj.assertionMethod = message.assertionMethod;
}
if (message.capabilityInvocation?.length) {
obj.capabilityInvocation = message.capabilityInvocation;
}
if (message.capabilityDelegation?.length) {
obj.capabilityDelegation = message.capabilityDelegation;
}
if (message.keyAgreement?.length) {
obj.keyAgreement = message.keyAgreement;
}
if (message.service?.length) {
obj.service = message.service.map((e) => Service.toJSON(e));
}
if (message.alsoKnownAs?.length) {
obj.alsoKnownAs = message.alsoKnownAs;
}
if (message.versionId !== "") {
obj.versionId = message.versionId;
}
return obj;
},
create<I extends Exact<DeepPartial<MsgCreateDidDocPayload>, I>>(base?: I): MsgCreateDidDocPayload {
return MsgCreateDidDocPayload.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgCreateDidDocPayload>, I>>(object: I): MsgCreateDidDocPayload {
const message = createBaseMsgCreateDidDocPayload();
message.context = object.context?.map((e) => e) || [];
message.id = object.id ?? "";
message.controller = object.controller?.map((e) => e) || [];
message.verificationMethod = object.verificationMethod?.map((e) => VerificationMethod.fromPartial(e)) || [];
message.authentication = object.authentication?.map((e) => e) || [];
message.assertionMethod = object.assertionMethod?.map((e) => e) || [];
message.capabilityInvocation = object.capabilityInvocation?.map((e) => e) || [];
message.capabilityDelegation = object.capabilityDelegation?.map((e) => e) || [];
message.keyAgreement = object.keyAgreement?.map((e) => e) || [];
message.service = object.service?.map((e) => Service.fromPartial(e)) || [];
message.alsoKnownAs = object.alsoKnownAs?.map((e) => e) || [];
message.versionId = object.versionId ?? "";
return message;
},
};
function createBaseMsgCreateDidDocResponse(): MsgCreateDidDocResponse {
return { value: undefined };
}
export const MsgCreateDidDocResponse: MessageFns<MsgCreateDidDocResponse> = {
encode(message: MsgCreateDidDocResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.value !== undefined) {
DidDocWithMetadata.encode(message.value, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateDidDocResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgCreateDidDocResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.value = DidDocWithMetadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgCreateDidDocResponse {
return { value: isSet(object.value) ? DidDocWithMetadata.fromJSON(object.value) : undefined };
},
toJSON(message: MsgCreateDidDocResponse): unknown {
const obj: any = {};
if (message.value !== undefined) {
obj.value = DidDocWithMetadata.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<MsgCreateDidDocResponse>, I>>(base?: I): MsgCreateDidDocResponse {
return MsgCreateDidDocResponse.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgCreateDidDocResponse>, I>>(object: I): MsgCreateDidDocResponse {
const message = createBaseMsgCreateDidDocResponse();
message.value = (object.value !== undefined && object.value !== null)
? DidDocWithMetadata.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseMsgUpdateDidDocPayload(): MsgUpdateDidDocPayload {
return {
context: [],
id: "",
controller: [],
verificationMethod: [],
authentication: [],
assertionMethod: [],
capabilityInvocation: [],
capabilityDelegation: [],
keyAgreement: [],
service: [],
alsoKnownAs: [],
versionId: "",
};
}
export const MsgUpdateDidDocPayload: MessageFns<MsgUpdateDidDocPayload> = {
encode(message: MsgUpdateDidDocPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.context) {
writer.uint32(10).string(v!);
}
if (message.id !== "") {
writer.uint32(18).string(message.id);
}
for (const v of message.controller) {
writer.uint32(26).string(v!);
}
for (const v of message.verificationMethod) {
VerificationMethod.encode(v!, writer.uint32(34).fork()).join();
}
for (const v of message.authentication) {
writer.uint32(42).string(v!);
}
for (const v of message.assertionMethod) {
writer.uint32(50).string(v!);
}
for (const v of message.capabilityInvocation) {
writer.uint32(58).string(v!);
}
for (const v of message.capabilityDelegation) {
writer.uint32(66).string(v!);
}
for (const v of message.keyAgreement) {
writer.uint32(74).string(v!);
}
for (const v of message.service) {
Service.encode(v!, writer.uint32(82).fork()).join();
}
for (const v of message.alsoKnownAs) {
writer.uint32(90).string(v!);
}
if (message.versionId !== "") {
writer.uint32(98).string(message.versionId);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateDidDocPayload {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgUpdateDidDocPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context.push(reader.string());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.id = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.controller.push(reader.string());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.verificationMethod.push(VerificationMethod.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.authentication.push(reader.string());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.assertionMethod.push(reader.string());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.capabilityInvocation.push(reader.string());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.capabilityDelegation.push(reader.string());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.keyAgreement.push(reader.string());
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.service.push(Service.decode(reader, reader.uint32()));
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.alsoKnownAs.push(reader.string());
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.versionId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgUpdateDidDocPayload {
return {
context: globalThis.Array.isArray(object?.context) ? object.context.map((e: any) => globalThis.String(e)) : [],
id: isSet(object.id) ? globalThis.String(object.id) : "",
controller: globalThis.Array.isArray(object?.controller)
? object.controller.map((e: any) => globalThis.String(e))
: [],
verificationMethod: globalThis.Array.isArray(object?.verificationMethod)
? object.verificationMethod.map((e: any) => VerificationMethod.fromJSON(e))
: globalThis.Array.isArray(object?.verification_method)
? object.verification_method.map((e: any) => VerificationMethod.fromJSON(e))
: [],
authentication: globalThis.Array.isArray(object?.authentication)
? object.authentication.map((e: any) => globalThis.String(e))
: [],
assertionMethod: globalThis.Array.isArray(object?.assertionMethod)
? object.assertionMethod.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.assertion_method)
? object.assertion_method.map((e: any) => globalThis.String(e))
: [],
capabilityInvocation: globalThis.Array.isArray(object?.capabilityInvocation)
? object.capabilityInvocation.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.capability_invocation)
? object.capability_invocation.map((e: any) => globalThis.String(e))
: [],
capabilityDelegation: globalThis.Array.isArray(object?.capabilityDelegation)
? object.capabilityDelegation.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.capability_delegation)
? object.capability_delegation.map((e: any) => globalThis.String(e))
: [],
keyAgreement: globalThis.Array.isArray(object?.keyAgreement)
? object.keyAgreement.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.key_agreement)
? object.key_agreement.map((e: any) => globalThis.String(e))
: [],
service: globalThis.Array.isArray(object?.service) ? object.service.map((e: any) => Service.fromJSON(e)) : [],
alsoKnownAs: globalThis.Array.isArray(object?.alsoKnownAs)
? object.alsoKnownAs.map((e: any) => globalThis.String(e))
: globalThis.Array.isArray(object?.also_known_as)
? object.also_known_as.map((e: any) => globalThis.String(e))
: [],
versionId: isSet(object.versionId)
? globalThis.String(object.versionId)
: isSet(object.version_id)
? globalThis.String(object.version_id)
: "",
};
},
toJSON(message: MsgUpdateDidDocPayload): unknown {
const obj: any = {};
if (message.context?.length) {
obj.context = message.context;
}
if (message.id !== "") {
obj.id = message.id;
}
if (message.controller?.length) {
obj.controller = message.controller;
}
if (message.verificationMethod?.length) {
obj.verificationMethod = message.verificationMethod.map((e) => VerificationMethod.toJSON(e));
}
if (message.authentication?.length) {
obj.authentication = message.authentication;
}
if (message.assertionMethod?.length) {
obj.assertionMethod = message.assertionMethod;
}
if (message.capabilityInvocation?.length) {
obj.capabilityInvocation = message.capabilityInvocation;
}
if (message.capabilityDelegation?.length) {
obj.capabilityDelegation = message.capabilityDelegation;
}
if (message.keyAgreement?.length) {
obj.keyAgreement = message.keyAgreement;
}
if (message.service?.length) {
obj.service = message.service.map((e) => Service.toJSON(e));
}
if (message.alsoKnownAs?.length) {
obj.alsoKnownAs = message.alsoKnownAs;
}
if (message.versionId !== "") {
obj.versionId = message.versionId;
}
return obj;
},
create<I extends Exact<DeepPartial<MsgUpdateDidDocPayload>, I>>(base?: I): MsgUpdateDidDocPayload {
return MsgUpdateDidDocPayload.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgUpdateDidDocPayload>, I>>(object: I): MsgUpdateDidDocPayload {
const message = createBaseMsgUpdateDidDocPayload();
message.context = object.context?.map((e) => e) || [];
message.id = object.id ?? "";
message.controller = object.controller?.map((e) => e) || [];
message.verificationMethod = object.verificationMethod?.map((e) => VerificationMethod.fromPartial(e)) || [];
message.authentication = object.authentication?.map((e) => e) || [];
message.assertionMethod = object.assertionMethod?.map((e) => e) || [];
message.capabilityInvocation = object.capabilityInvocation?.map((e) => e) || [];
message.capabilityDelegation = object.capabilityDelegation?.map((e) => e) || [];
message.keyAgreement = object.keyAgreement?.map((e) => e) || [];
message.service = object.service?.map((e) => Service.fromPartial(e)) || [];
message.alsoKnownAs = object.alsoKnownAs?.map((e) => e) || [];
message.versionId = object.versionId ?? "";
return message;
},
};
function createBaseMsgUpdateDidDocResponse(): MsgUpdateDidDocResponse {
return { value: undefined };
}
export const MsgUpdateDidDocResponse: MessageFns<MsgUpdateDidDocResponse> = {
encode(message: MsgUpdateDidDocResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.value !== undefined) {
DidDocWithMetadata.encode(message.value, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateDidDocResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgUpdateDidDocResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.value = DidDocWithMetadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgUpdateDidDocResponse {
return { value: isSet(object.value) ? DidDocWithMetadata.fromJSON(object.value) : undefined };
},
toJSON(message: MsgUpdateDidDocResponse): unknown {
const obj: any = {};
if (message.value !== undefined) {
obj.value = DidDocWithMetadata.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<MsgUpdateDidDocResponse>, I>>(base?: I): MsgUpdateDidDocResponse {
return MsgUpdateDidDocResponse.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgUpdateDidDocResponse>, I>>(object: I): MsgUpdateDidDocResponse {
const message = createBaseMsgUpdateDidDocResponse();
message.value = (object.value !== undefined && object.value !== null)
? DidDocWithMetadata.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseMsgDeactivateDidDocPayload(): MsgDeactivateDidDocPayload {
return { id: "", versionId: "" };
}
export const MsgDeactivateDidDocPayload: MessageFns<MsgDeactivateDidDocPayload> = {
encode(message: MsgDeactivateDidDocPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.versionId !== "") {
writer.uint32(18).string(message.versionId);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgDeactivateDidDocPayload {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgDeactivateDidDocPayload();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.versionId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgDeactivateDidDocPayload {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
versionId: isSet(object.versionId)
? globalThis.String(object.versionId)
: isSet(object.version_id)
? globalThis.String(object.version_id)
: "",
};
},
toJSON(message: MsgDeactivateDidDocPayload): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.versionId !== "") {
obj.versionId = message.versionId;
}
return obj;
},
create<I extends Exact<DeepPartial<MsgDeactivateDidDocPayload>, I>>(base?: I): MsgDeactivateDidDocPayload {
return MsgDeactivateDidDocPayload.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgDeactivateDidDocPayload>, I>>(object: I): MsgDeactivateDidDocPayload {
const message = createBaseMsgDeactivateDidDocPayload();
message.id = object.id ?? "";
message.versionId = object.versionId ?? "";
return message;
},
};
function createBaseMsgDeactivateDidDocResponse(): MsgDeactivateDidDocResponse {
return { value: undefined };
}
export const MsgDeactivateDidDocResponse: MessageFns<MsgDeactivateDidDocResponse> = {
encode(message: MsgDeactivateDidDocResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.value !== undefined) {
DidDocWithMetadata.encode(message.value, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgDeactivateDidDocResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgDeactivateDidDocResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.value = DidDocWithMetadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgDeactivateDidDocResponse {
return { value: isSet(object.value) ? DidDocWithMetadata.fromJSON(object.value) : undefined };
},
toJSON(message: MsgDeactivateDidDocResponse): unknown {
const obj: any = {};
if (message.value !== undefined) {
obj.value = DidDocWithMetadata.toJSON(message.value);
}
return obj;
},
create<I extends Exact<DeepPartial<MsgDeactivateDidDocResponse>, I>>(base?: I): MsgDeactivateDidDocResponse {
return MsgDeactivateDidDocResponse.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgDeactivateDidDocResponse>, I>>(object: I): MsgDeactivateDidDocResponse {
const message = createBaseMsgDeactivateDidDocResponse();
message.value = (object.value !== undefined && object.value !== null)
? DidDocWithMetadata.fromPartial(object.value)
: undefined;
return message;
},
};
function createBaseMsgBurn(): MsgBurn {
return { fromAddress: "", amount: [] };
}
export const MsgBurn: MessageFns<MsgBurn> = {
encode(message: MsgBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.fromAddress !== "") {
writer.uint32(10).string(message.fromAddress);
}
for (const v of message.amount) {
Coin.encode(v!, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgBurn {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgBurn();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.fromAddress = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.amount.push(Coin.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MsgBurn {
return {
fromAddress: isSet(object.fromAddress)
? globalThis.String(object.fromAddress)
: isSet(object.from_address)
? globalThis.String(object.from_address)
: "",
amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [],
};
},
toJSON(message: MsgBurn): unknown {
const obj: any = {};
if (message.fromAddress !== "") {
obj.fromAddress = message.fromAddress;
}
if (message.amount?.length) {
obj.amount = message.amount.map((e) => Coin.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<MsgBurn>, I>>(base?: I): MsgBurn {
return MsgBurn.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MsgBurn>, I>>(object: I): MsgBurn {
const message = createBaseMsgBurn();
message.fromAddress = object.fromAddress ?? "";
message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
return message;
},
};
function createBaseMsgBurnResponse(): MsgBurnResponse {
return {};
}
export const MsgBurnResponse: MessageFns<MsgBurnResponse> = {
encode(_: MsgBurnResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MsgBurnResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMsgBurnResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;