@agoric/cosmic-proto 0.4.1-dev-2a8fca7.0.2a8fca7 → 0.4.1-dev-4a66092.0.4a66092
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codec-helpers.d.ts +53 -0
- package/dist/codec-helpers.d.ts.map +1 -0
- package/dist/codec-helpers.js +1 -0
- package/dist/codec-helpers.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BinaryReader, BinaryWriter, JsonSafe } from './codegen/index.js';
|
|
2
|
+
import type { MessageBody, TypedJson } from './helpers.js';
|
|
3
|
+
export type ProtoMsg<TU = string> = {
|
|
4
|
+
readonly typeUrl: TU;
|
|
5
|
+
readonly value: Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
export interface EncodeObject<TU = string> {
|
|
8
|
+
readonly typeUrl: TU;
|
|
9
|
+
readonly value: MessageBody<TU>;
|
|
10
|
+
}
|
|
11
|
+
export interface TypedAmino<TU = string, MT = MessageBody<TU>> {
|
|
12
|
+
readonly type: TU;
|
|
13
|
+
readonly value: MT;
|
|
14
|
+
}
|
|
15
|
+
export interface Proto3Codec<TU = string, MT = MessageBody<TU>, IM = MT> {
|
|
16
|
+
readonly typeUrl: TU;
|
|
17
|
+
encode(message: IM, writer?: BinaryWriter): BinaryWriter;
|
|
18
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MT;
|
|
19
|
+
fromJSON(object: any): MT;
|
|
20
|
+
toJSON(message: IM): JsonSafe<MT>;
|
|
21
|
+
fromPartial(object: Partial<MT>): MT;
|
|
22
|
+
fromProtoMsg(message: ProtoMsg<TU>): MT;
|
|
23
|
+
toProto(message: IM): Uint8Array;
|
|
24
|
+
toProtoMsg(message: IM): ProtoMsg<TU>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wraps a codec, adding built-in partial message support.
|
|
28
|
+
*
|
|
29
|
+
* @template [TU=string]
|
|
30
|
+
* @template [MT=MessageBody<TU>]
|
|
31
|
+
* @param {Proto3Codec<TU, MT>} codec The original codec.
|
|
32
|
+
* @param {string[]} [nonNullishFields] The properties that should be replaced with `{}` if nullish.
|
|
33
|
+
* @returns {Proto3Codec<TU, MT, Partial<MT>>} A new codec that can handle partial input messages.
|
|
34
|
+
*/
|
|
35
|
+
export declare const Codec: <TU = string, MT = MessageBody<TU>>(codec: Proto3Codec<TU, MT>, nonNullishFields?: string[]) => Proto3Codec<TU, MT, Partial<MT>>;
|
|
36
|
+
export interface Proto3CodecHelper<TU = string, MT = MessageBody<TU>> extends Proto3Codec<TU, MT, Partial<MT>> {
|
|
37
|
+
typedJson(message: Partial<MT>): TypedJson<TU>;
|
|
38
|
+
typedAmino(message: Partial<MT>): TypedAmino<TU, MT>;
|
|
39
|
+
typedEncode(message: Partial<MT>): EncodeObject<TU>;
|
|
40
|
+
fromTyped(object: TypedJson<TU> | TypedAmino<TU, MT> | EncodeObject<TU> | ProtoMsg<TU>, embeddedFields?: string[]): MT;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Wraps a codec, adding built-in partial message support and helpers for common
|
|
44
|
+
* manipulations.
|
|
45
|
+
*
|
|
46
|
+
* @template [TU=string]
|
|
47
|
+
* @template [MT=MessageBody<TU>]
|
|
48
|
+
* @param {Proto3Codec<TU, MT>} codec The original codec.
|
|
49
|
+
* @param {string[]} [nonNullishFields] The fields that should be replaced with `{}` if nullish.
|
|
50
|
+
* @returns {Proto3CodecHelper<TU, MT>} Codec and helpers that can handle partial input messages.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CodecHelper: <TU = string, MT = MessageBody<TU>>(codec: Proto3Codec<TU, MT>, nonNullishFields?: string[]) => Proto3CodecHelper<TU, MT>;
|
|
53
|
+
//# sourceMappingURL=codec-helpers.d.ts.map
|
|
@@ -0,0 +1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,GAAI,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,EAC3D,OAAO,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,EAC1B,mBAAmB,MAAM,EAAE,KAC1B,iBAAiB,CAAC,EAAE,EAAE,EAAE,CA6C1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const{freeze:t}=Object,r={"/ibc.applications.transfer.v1.MsgTransfer":["timeoutHeight"]},e={"/cosmos.auth.v1beta1.ModuleAccount":["base_account"]};export const Codec=(e,o)=>{const n=o??r[e.typeUrl]??[],a=t({typeUrl:e.typeUrl,encode:(t,r)=>e.encode(a.fromPartial(t),r),decode:(t,r)=>e.decode(t,r),fromJSON:t=>e.fromJSON(t),toJSON:t=>e.toJSON(a.fromPartial(t)),fromPartial(t){const r={...t};for(const t of n)null==r[t]&&(r[t]={});return e.fromPartial(r)},fromProtoMsg:t=>e.fromProtoMsg(t),toProto:t=>e.toProto(a.fromPartial(t)),toProtoMsg:t=>e.toProtoMsg(a.fromPartial(t))});return a};export const CodecHelper=(r,o)=>{const n=Codec(r,o);return t({...n,typedAmino:t=>({type:r.typeUrl,value:n.fromPartial(t)}),typedEncode:t=>({typeUrl:r.typeUrl,value:n.fromPartial(t)}),typedJson:t=>({"@type":r.typeUrl,...n.fromPartial(t)}),fromTyped(t,o){const{typeUrl:a,value:l}=(t=>{if("@type"in t){const{"@type":r,...e}=t;return{typeUrl:r,value:e}}if("typeUrl"in t){const{typeUrl:r,value:e}=t;return{typeUrl:r,value:e instanceof Uint8Array?e:{...e}}}if("type"in t){const{type:r,value:e}=t;return{typeUrl:r,value:e}}throw TypeError(`Unrecognized input: ${t}`)})(t);if(a!==r.typeUrl)throw TypeError(`Invalid typeUrl: ${a}. Must be ${r.typeUrl}.`);const p=o??e[a]??[],c=t=>{for(const r of p)Object.assign(t,l[r],t[r]);return t};return l instanceof Uint8Array?c(n.fromProtoMsg({typeUrl:a,value:l})):c(n.fromPart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AAG,CAAC,OAAW,EAAE,EAAE;gBACrC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;oBAC/B,MAAM,CAAC,MAAM,CAAC,OAAc,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC5D,CAAC;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC;YAEF,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBAChC,WAAW;gBACX,OAAO,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC9D,CAAC;YAED,OAAO,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;KACF,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./codegen/json-safe.js";export*from"./helpers.js";
|
|
1
|
+
export*from"./codegen/json-safe.js";export*from"./helpers.js";export*from"./codec-helpers.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,4GAA4G;AAC5G,yFAAyF;AAEzF,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,4GAA4G;AAC5G,yFAAyF;AAEzF,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmic-proto",
|
|
3
|
-
"version": "0.4.1-dev-
|
|
3
|
+
"version": "0.4.1-dev-4a66092.0.4a66092",
|
|
4
4
|
"description": "Protobuf stubs for the Agoric cosmos-sdk module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Agoric",
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"types": "./dist/codegen/ibc/applications/transfer/v1/tx.d.ts",
|
|
85
85
|
"default": "./dist/codegen/ibc/applications/transfer/v1/tx.js"
|
|
86
86
|
},
|
|
87
|
+
"./ibc/applications/transfer/v1/query.js": {
|
|
88
|
+
"types": "./dist/codegen/ibc/applications/transfer/v1/query.d.ts",
|
|
89
|
+
"default": "./dist/codegen/ibc/applications/transfer/v1/query.js"
|
|
90
|
+
},
|
|
87
91
|
"./ibc/core/channel/v1/channel.js": {
|
|
88
92
|
"types": "./dist/codegen/ibc/core/channel/v1/channel.d.ts",
|
|
89
93
|
"default": "./dist/codegen/ibc/core/channel/v1/channel.js"
|
|
@@ -204,5 +208,5 @@
|
|
|
204
208
|
"engines": {
|
|
205
209
|
"node": "^20.9 || ^22.11"
|
|
206
210
|
},
|
|
207
|
-
"gitHead": "
|
|
211
|
+
"gitHead": "4a660927e7eafc2eabc8a6c5339c43177f168930"
|
|
208
212
|
}
|