@sparkdreamnft/sparkdreamjs 0.0.12 → 0.0.14

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.
Files changed (39) hide show
  1. package/esm/nested-amino.js +52 -0
  2. package/esm/sparkdream/commons/v1/tx.amino.js +68 -29
  3. package/esm/sparkdream/commons/v1/tx.js +147 -0
  4. package/esm/sparkdream/commons/v1/tx.registry.js +20 -2
  5. package/esm/sparkdream/commons/v1/tx.rpc.msg.js +7 -1
  6. package/esm/sparkdream/forum/v1/hide_record.js +19 -1
  7. package/esm/sparkdream/forum/v1/params.js +26 -2
  8. package/esm/sparkdream/forum/v1/tx.amino.js +6 -1
  9. package/esm/sparkdream/forum/v1/tx.js +144 -0
  10. package/esm/sparkdream/forum/v1/tx.registry.js +20 -2
  11. package/esm/sparkdream/forum/v1/tx.rpc.msg.js +12 -1
  12. package/esm/sparkdream/session/v1/tx.amino.js +30 -8
  13. package/nested-amino.d.ts +76 -0
  14. package/nested-amino.js +57 -0
  15. package/package.json +1 -1
  16. package/sparkdream/bundle.d.ts +89 -6
  17. package/sparkdream/client.d.ts +11 -6
  18. package/sparkdream/commons/v1/tx.amino.d.ts +6 -5
  19. package/sparkdream/commons/v1/tx.amino.js +70 -30
  20. package/sparkdream/commons/v1/tx.d.ts +99 -0
  21. package/sparkdream/commons/v1/tx.js +148 -1
  22. package/sparkdream/commons/v1/tx.registry.d.ts +13 -1
  23. package/sparkdream/commons/v1/tx.registry.js +19 -1
  24. package/sparkdream/commons/v1/tx.rpc.msg.d.ts +3 -1
  25. package/sparkdream/commons/v1/tx.rpc.msg.js +6 -0
  26. package/sparkdream/forum/v1/hide_record.d.ts +50 -0
  27. package/sparkdream/forum/v1/hide_record.js +19 -1
  28. package/sparkdream/forum/v1/params.d.ts +28 -0
  29. package/sparkdream/forum/v1/params.js +26 -2
  30. package/sparkdream/forum/v1/tx.amino.d.ts +6 -1
  31. package/sparkdream/forum/v1/tx.amino.js +5 -0
  32. package/sparkdream/forum/v1/tx.d.ts +90 -0
  33. package/sparkdream/forum/v1/tx.js +146 -2
  34. package/sparkdream/forum/v1/tx.registry.d.ts +13 -1
  35. package/sparkdream/forum/v1/tx.registry.js +19 -1
  36. package/sparkdream/forum/v1/tx.rpc.msg.d.ts +11 -1
  37. package/sparkdream/forum/v1/tx.rpc.msg.js +11 -0
  38. package/sparkdream/session/v1/tx.amino.d.ts +3 -3
  39. package/sparkdream/session/v1/tx.amino.js +30 -8
@@ -2962,6 +2962,150 @@ export const MsgHidePostResponse = {
2962
2962
  };
2963
2963
  }
2964
2964
  };
2965
+ function createBaseMsgUnhidePost() {
2966
+ return {
2967
+ creator: "",
2968
+ postId: BigInt(0)
2969
+ };
2970
+ }
2971
+ /**
2972
+ * MsgUnhidePost reverses MsgHidePost.
2973
+ * @name MsgUnhidePost
2974
+ * @package sparkdream.forum.v1
2975
+ * @see proto type: sparkdream.forum.v1.MsgUnhidePost
2976
+ */
2977
+ export const MsgUnhidePost = {
2978
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePost",
2979
+ aminoType: "sparkdream/x/forum/MsgUnhidePost",
2980
+ encode(message, writer = BinaryWriter.create()) {
2981
+ if (message.creator !== "") {
2982
+ writer.uint32(10).string(message.creator);
2983
+ }
2984
+ if (message.postId !== BigInt(0)) {
2985
+ writer.uint32(16).uint64(message.postId);
2986
+ }
2987
+ return writer;
2988
+ },
2989
+ decode(input, length) {
2990
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2991
+ let end = length === undefined ? reader.len : reader.pos + length;
2992
+ const message = createBaseMsgUnhidePost();
2993
+ while (reader.pos < end) {
2994
+ const tag = reader.uint32();
2995
+ switch (tag >>> 3) {
2996
+ case 1:
2997
+ message.creator = reader.string();
2998
+ break;
2999
+ case 2:
3000
+ message.postId = reader.uint64();
3001
+ break;
3002
+ default:
3003
+ reader.skipType(tag & 7);
3004
+ break;
3005
+ }
3006
+ }
3007
+ return message;
3008
+ },
3009
+ fromPartial(object) {
3010
+ const message = createBaseMsgUnhidePost();
3011
+ message.creator = object.creator ?? "";
3012
+ message.postId = object.postId !== undefined && object.postId !== null ? BigInt(object.postId.toString()) : BigInt(0);
3013
+ return message;
3014
+ },
3015
+ fromAmino(object) {
3016
+ const message = createBaseMsgUnhidePost();
3017
+ if (object.creator !== undefined && object.creator !== null) {
3018
+ message.creator = object.creator;
3019
+ }
3020
+ if (object.post_id !== undefined && object.post_id !== null) {
3021
+ message.postId = BigInt(object.post_id);
3022
+ }
3023
+ return message;
3024
+ },
3025
+ toAmino(message) {
3026
+ const obj = {};
3027
+ obj.creator = message.creator === "" ? undefined : message.creator;
3028
+ obj.post_id = message.postId !== BigInt(0) ? message.postId?.toString() : undefined;
3029
+ return obj;
3030
+ },
3031
+ fromAminoMsg(object) {
3032
+ return MsgUnhidePost.fromAmino(object.value);
3033
+ },
3034
+ toAminoMsg(message) {
3035
+ return {
3036
+ type: "sparkdream/x/forum/MsgUnhidePost",
3037
+ value: MsgUnhidePost.toAmino(message)
3038
+ };
3039
+ },
3040
+ fromProtoMsg(message) {
3041
+ return MsgUnhidePost.decode(message.value);
3042
+ },
3043
+ toProto(message) {
3044
+ return MsgUnhidePost.encode(message).finish();
3045
+ },
3046
+ toProtoMsg(message) {
3047
+ return {
3048
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePost",
3049
+ value: MsgUnhidePost.encode(message).finish()
3050
+ };
3051
+ }
3052
+ };
3053
+ function createBaseMsgUnhidePostResponse() {
3054
+ return {};
3055
+ }
3056
+ /**
3057
+ * MsgUnhidePostResponse defines the MsgUnhidePostResponse message.
3058
+ * @name MsgUnhidePostResponse
3059
+ * @package sparkdream.forum.v1
3060
+ * @see proto type: sparkdream.forum.v1.MsgUnhidePostResponse
3061
+ */
3062
+ export const MsgUnhidePostResponse = {
3063
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePostResponse",
3064
+ encode(_, writer = BinaryWriter.create()) {
3065
+ return writer;
3066
+ },
3067
+ decode(input, length) {
3068
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3069
+ let end = length === undefined ? reader.len : reader.pos + length;
3070
+ const message = createBaseMsgUnhidePostResponse();
3071
+ while (reader.pos < end) {
3072
+ const tag = reader.uint32();
3073
+ switch (tag >>> 3) {
3074
+ default:
3075
+ reader.skipType(tag & 7);
3076
+ break;
3077
+ }
3078
+ }
3079
+ return message;
3080
+ },
3081
+ fromPartial(_) {
3082
+ const message = createBaseMsgUnhidePostResponse();
3083
+ return message;
3084
+ },
3085
+ fromAmino(_) {
3086
+ const message = createBaseMsgUnhidePostResponse();
3087
+ return message;
3088
+ },
3089
+ toAmino(_) {
3090
+ const obj = {};
3091
+ return obj;
3092
+ },
3093
+ fromAminoMsg(object) {
3094
+ return MsgUnhidePostResponse.fromAmino(object.value);
3095
+ },
3096
+ fromProtoMsg(message) {
3097
+ return MsgUnhidePostResponse.decode(message.value);
3098
+ },
3099
+ toProto(message) {
3100
+ return MsgUnhidePostResponse.encode(message).finish();
3101
+ },
3102
+ toProtoMsg(message) {
3103
+ return {
3104
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePostResponse",
3105
+ value: MsgUnhidePostResponse.encode(message).finish()
3106
+ };
3107
+ }
3108
+ };
2965
3109
  function createBaseMsgAppealPost() {
2966
3110
  return {
2967
3111
  creator: "",
@@ -1,5 +1,5 @@
1
- import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreatePost, MsgEditPost, MsgDeletePost, MsgFreezeThread, MsgUnarchiveThread, MsgPinPost, MsgUnpinPost, MsgLockThread, MsgUnlockThread, MsgMoveThread, MsgFollowThread, MsgUnfollowThread, MsgUpvotePost, MsgDownvotePost, MsgFlagPost, MsgDismissFlags, MsgHidePost, MsgAppealPost, MsgAppealThreadLock, MsgAppealThreadMove, MsgCreateBounty, MsgAwardBounty, MsgIncreaseBounty, MsgCancelBounty, MsgAssignBountyToReply, MsgPinReply, MsgUnpinReply, MsgDisputePin, MsgMarkAcceptedReply, MsgConfirmProposedReply, MsgRejectProposedReply, MsgSetForumPaused, MsgSetModerationPaused } from "./tx";
2
- export const registry = [["/sparkdream.forum.v1.MsgUpdateParams", MsgUpdateParams], ["/sparkdream.forum.v1.MsgUpdateOperationalParams", MsgUpdateOperationalParams], ["/sparkdream.forum.v1.MsgCreatePost", MsgCreatePost], ["/sparkdream.forum.v1.MsgEditPost", MsgEditPost], ["/sparkdream.forum.v1.MsgDeletePost", MsgDeletePost], ["/sparkdream.forum.v1.MsgFreezeThread", MsgFreezeThread], ["/sparkdream.forum.v1.MsgUnarchiveThread", MsgUnarchiveThread], ["/sparkdream.forum.v1.MsgPinPost", MsgPinPost], ["/sparkdream.forum.v1.MsgUnpinPost", MsgUnpinPost], ["/sparkdream.forum.v1.MsgLockThread", MsgLockThread], ["/sparkdream.forum.v1.MsgUnlockThread", MsgUnlockThread], ["/sparkdream.forum.v1.MsgMoveThread", MsgMoveThread], ["/sparkdream.forum.v1.MsgFollowThread", MsgFollowThread], ["/sparkdream.forum.v1.MsgUnfollowThread", MsgUnfollowThread], ["/sparkdream.forum.v1.MsgUpvotePost", MsgUpvotePost], ["/sparkdream.forum.v1.MsgDownvotePost", MsgDownvotePost], ["/sparkdream.forum.v1.MsgFlagPost", MsgFlagPost], ["/sparkdream.forum.v1.MsgDismissFlags", MsgDismissFlags], ["/sparkdream.forum.v1.MsgHidePost", MsgHidePost], ["/sparkdream.forum.v1.MsgAppealPost", MsgAppealPost], ["/sparkdream.forum.v1.MsgAppealThreadLock", MsgAppealThreadLock], ["/sparkdream.forum.v1.MsgAppealThreadMove", MsgAppealThreadMove], ["/sparkdream.forum.v1.MsgCreateBounty", MsgCreateBounty], ["/sparkdream.forum.v1.MsgAwardBounty", MsgAwardBounty], ["/sparkdream.forum.v1.MsgIncreaseBounty", MsgIncreaseBounty], ["/sparkdream.forum.v1.MsgCancelBounty", MsgCancelBounty], ["/sparkdream.forum.v1.MsgAssignBountyToReply", MsgAssignBountyToReply], ["/sparkdream.forum.v1.MsgPinReply", MsgPinReply], ["/sparkdream.forum.v1.MsgUnpinReply", MsgUnpinReply], ["/sparkdream.forum.v1.MsgDisputePin", MsgDisputePin], ["/sparkdream.forum.v1.MsgMarkAcceptedReply", MsgMarkAcceptedReply], ["/sparkdream.forum.v1.MsgConfirmProposedReply", MsgConfirmProposedReply], ["/sparkdream.forum.v1.MsgRejectProposedReply", MsgRejectProposedReply], ["/sparkdream.forum.v1.MsgSetForumPaused", MsgSetForumPaused], ["/sparkdream.forum.v1.MsgSetModerationPaused", MsgSetModerationPaused]];
1
+ import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreatePost, MsgEditPost, MsgDeletePost, MsgFreezeThread, MsgUnarchiveThread, MsgPinPost, MsgUnpinPost, MsgLockThread, MsgUnlockThread, MsgMoveThread, MsgFollowThread, MsgUnfollowThread, MsgUpvotePost, MsgDownvotePost, MsgFlagPost, MsgDismissFlags, MsgHidePost, MsgUnhidePost, MsgAppealPost, MsgAppealThreadLock, MsgAppealThreadMove, MsgCreateBounty, MsgAwardBounty, MsgIncreaseBounty, MsgCancelBounty, MsgAssignBountyToReply, MsgPinReply, MsgUnpinReply, MsgDisputePin, MsgMarkAcceptedReply, MsgConfirmProposedReply, MsgRejectProposedReply, MsgSetForumPaused, MsgSetModerationPaused } from "./tx";
2
+ export const registry = [["/sparkdream.forum.v1.MsgUpdateParams", MsgUpdateParams], ["/sparkdream.forum.v1.MsgUpdateOperationalParams", MsgUpdateOperationalParams], ["/sparkdream.forum.v1.MsgCreatePost", MsgCreatePost], ["/sparkdream.forum.v1.MsgEditPost", MsgEditPost], ["/sparkdream.forum.v1.MsgDeletePost", MsgDeletePost], ["/sparkdream.forum.v1.MsgFreezeThread", MsgFreezeThread], ["/sparkdream.forum.v1.MsgUnarchiveThread", MsgUnarchiveThread], ["/sparkdream.forum.v1.MsgPinPost", MsgPinPost], ["/sparkdream.forum.v1.MsgUnpinPost", MsgUnpinPost], ["/sparkdream.forum.v1.MsgLockThread", MsgLockThread], ["/sparkdream.forum.v1.MsgUnlockThread", MsgUnlockThread], ["/sparkdream.forum.v1.MsgMoveThread", MsgMoveThread], ["/sparkdream.forum.v1.MsgFollowThread", MsgFollowThread], ["/sparkdream.forum.v1.MsgUnfollowThread", MsgUnfollowThread], ["/sparkdream.forum.v1.MsgUpvotePost", MsgUpvotePost], ["/sparkdream.forum.v1.MsgDownvotePost", MsgDownvotePost], ["/sparkdream.forum.v1.MsgFlagPost", MsgFlagPost], ["/sparkdream.forum.v1.MsgDismissFlags", MsgDismissFlags], ["/sparkdream.forum.v1.MsgHidePost", MsgHidePost], ["/sparkdream.forum.v1.MsgUnhidePost", MsgUnhidePost], ["/sparkdream.forum.v1.MsgAppealPost", MsgAppealPost], ["/sparkdream.forum.v1.MsgAppealThreadLock", MsgAppealThreadLock], ["/sparkdream.forum.v1.MsgAppealThreadMove", MsgAppealThreadMove], ["/sparkdream.forum.v1.MsgCreateBounty", MsgCreateBounty], ["/sparkdream.forum.v1.MsgAwardBounty", MsgAwardBounty], ["/sparkdream.forum.v1.MsgIncreaseBounty", MsgIncreaseBounty], ["/sparkdream.forum.v1.MsgCancelBounty", MsgCancelBounty], ["/sparkdream.forum.v1.MsgAssignBountyToReply", MsgAssignBountyToReply], ["/sparkdream.forum.v1.MsgPinReply", MsgPinReply], ["/sparkdream.forum.v1.MsgUnpinReply", MsgUnpinReply], ["/sparkdream.forum.v1.MsgDisputePin", MsgDisputePin], ["/sparkdream.forum.v1.MsgMarkAcceptedReply", MsgMarkAcceptedReply], ["/sparkdream.forum.v1.MsgConfirmProposedReply", MsgConfirmProposedReply], ["/sparkdream.forum.v1.MsgRejectProposedReply", MsgRejectProposedReply], ["/sparkdream.forum.v1.MsgSetForumPaused", MsgSetForumPaused], ["/sparkdream.forum.v1.MsgSetModerationPaused", MsgSetModerationPaused]];
3
3
  export const load = (protoRegistry) => {
4
4
  registry.forEach(([typeUrl, mod]) => {
5
5
  protoRegistry.register(typeUrl, mod);
@@ -121,6 +121,12 @@ export const MessageComposer = {
121
121
  value: MsgHidePost.encode(value).finish()
122
122
  };
123
123
  },
124
+ unhidePost(value) {
125
+ return {
126
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePost",
127
+ value: MsgUnhidePost.encode(value).finish()
128
+ };
129
+ },
124
130
  appealPost(value) {
125
131
  return {
126
132
  typeUrl: "/sparkdream.forum.v1.MsgAppealPost",
@@ -333,6 +339,12 @@ export const MessageComposer = {
333
339
  value
334
340
  };
335
341
  },
342
+ unhidePost(value) {
343
+ return {
344
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePost",
345
+ value
346
+ };
347
+ },
336
348
  appealPost(value) {
337
349
  return {
338
350
  typeUrl: "/sparkdream.forum.v1.MsgAppealPost",
@@ -545,6 +557,12 @@ export const MessageComposer = {
545
557
  value: MsgHidePost.fromPartial(value)
546
558
  };
547
559
  },
560
+ unhidePost(value) {
561
+ return {
562
+ typeUrl: "/sparkdream.forum.v1.MsgUnhidePost",
563
+ value: MsgUnhidePost.fromPartial(value)
564
+ };
565
+ },
548
566
  appealPost(value) {
549
567
  return {
550
568
  typeUrl: "/sparkdream.forum.v1.MsgAppealPost",
@@ -1,5 +1,5 @@
1
1
  import { BinaryReader } from "../../../binary";
2
- import { MsgUpdateParams, MsgUpdateParamsResponse, MsgUpdateOperationalParams, MsgUpdateOperationalParamsResponse, MsgCreatePost, MsgCreatePostResponse, MsgEditPost, MsgEditPostResponse, MsgDeletePost, MsgDeletePostResponse, MsgFreezeThread, MsgFreezeThreadResponse, MsgUnarchiveThread, MsgUnarchiveThreadResponse, MsgPinPost, MsgPinPostResponse, MsgUnpinPost, MsgUnpinPostResponse, MsgLockThread, MsgLockThreadResponse, MsgUnlockThread, MsgUnlockThreadResponse, MsgMoveThread, MsgMoveThreadResponse, MsgFollowThread, MsgFollowThreadResponse, MsgUnfollowThread, MsgUnfollowThreadResponse, MsgUpvotePost, MsgUpvotePostResponse, MsgDownvotePost, MsgDownvotePostResponse, MsgFlagPost, MsgFlagPostResponse, MsgDismissFlags, MsgDismissFlagsResponse, MsgHidePost, MsgHidePostResponse, MsgAppealPost, MsgAppealPostResponse, MsgAppealThreadLock, MsgAppealThreadLockResponse, MsgAppealThreadMove, MsgAppealThreadMoveResponse, MsgCreateBounty, MsgCreateBountyResponse, MsgAwardBounty, MsgAwardBountyResponse, MsgIncreaseBounty, MsgIncreaseBountyResponse, MsgCancelBounty, MsgCancelBountyResponse, MsgAssignBountyToReply, MsgAssignBountyToReplyResponse, MsgPinReply, MsgPinReplyResponse, MsgUnpinReply, MsgUnpinReplyResponse, MsgDisputePin, MsgDisputePinResponse, MsgMarkAcceptedReply, MsgMarkAcceptedReplyResponse, MsgConfirmProposedReply, MsgConfirmProposedReplyResponse, MsgRejectProposedReply, MsgRejectProposedReplyResponse, MsgSetForumPaused, MsgSetForumPausedResponse, MsgSetModerationPaused, MsgSetModerationPausedResponse } from "./tx";
2
+ import { MsgUpdateParams, MsgUpdateParamsResponse, MsgUpdateOperationalParams, MsgUpdateOperationalParamsResponse, MsgCreatePost, MsgCreatePostResponse, MsgEditPost, MsgEditPostResponse, MsgDeletePost, MsgDeletePostResponse, MsgFreezeThread, MsgFreezeThreadResponse, MsgUnarchiveThread, MsgUnarchiveThreadResponse, MsgPinPost, MsgPinPostResponse, MsgUnpinPost, MsgUnpinPostResponse, MsgLockThread, MsgLockThreadResponse, MsgUnlockThread, MsgUnlockThreadResponse, MsgMoveThread, MsgMoveThreadResponse, MsgFollowThread, MsgFollowThreadResponse, MsgUnfollowThread, MsgUnfollowThreadResponse, MsgUpvotePost, MsgUpvotePostResponse, MsgDownvotePost, MsgDownvotePostResponse, MsgFlagPost, MsgFlagPostResponse, MsgDismissFlags, MsgDismissFlagsResponse, MsgHidePost, MsgHidePostResponse, MsgUnhidePost, MsgUnhidePostResponse, MsgAppealPost, MsgAppealPostResponse, MsgAppealThreadLock, MsgAppealThreadLockResponse, MsgAppealThreadMove, MsgAppealThreadMoveResponse, MsgCreateBounty, MsgCreateBountyResponse, MsgAwardBounty, MsgAwardBountyResponse, MsgIncreaseBounty, MsgIncreaseBountyResponse, MsgCancelBounty, MsgCancelBountyResponse, MsgAssignBountyToReply, MsgAssignBountyToReplyResponse, MsgPinReply, MsgPinReplyResponse, MsgUnpinReply, MsgUnpinReplyResponse, MsgDisputePin, MsgDisputePinResponse, MsgMarkAcceptedReply, MsgMarkAcceptedReplyResponse, MsgConfirmProposedReply, MsgConfirmProposedReplyResponse, MsgRejectProposedReply, MsgRejectProposedReplyResponse, MsgSetForumPaused, MsgSetForumPausedResponse, MsgSetModerationPaused, MsgSetModerationPausedResponse } from "./tx";
3
3
  export class MsgClientImpl {
4
4
  rpc;
5
5
  constructor(rpc) {
@@ -121,6 +121,17 @@ export class MsgClientImpl {
121
121
  const promise = this.rpc.request("sparkdream.forum.v1.Msg", "HidePost", data);
122
122
  return promise.then(data => MsgHidePostResponse.decode(new BinaryReader(data)));
123
123
  };
124
+ /* UnhidePost reverses a prior MsgHidePost. Authorized for (a) the sentinel
125
+ who originally hid the post, but only within sentinel_unhide_window
126
+ seconds of the hide (self-correction grace window analogous to the
127
+ edit_max_window for authors); and (b) the Commons Operations Committee
128
+ / governance at any time (council override). Refuses if the post's
129
+ parent category has since been deleted (dangling reference guard). */
130
+ unhidePost = async (request) => {
131
+ const data = MsgUnhidePost.encode(request).finish();
132
+ const promise = this.rpc.request("sparkdream.forum.v1.Msg", "UnhidePost", data);
133
+ return promise.then(data => MsgUnhidePostResponse.decode(new BinaryReader(data)));
134
+ };
124
135
  /* AppealPost defines the AppealPost RPC. */
125
136
  appealPost = async (request) => {
126
137
  const data = MsgAppealPost.encode(request).finish();
@@ -1,29 +1,51 @@
1
1
  //@ts-nocheck
2
- import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession, MsgExecSession } from "./tx";
2
+ // HAND-WRITTEN OVERRIDE overlaid by scripts/codegen.ts after telescope.
3
+ // See ../../commons/v1/tx.amino.ts for rationale.
4
+ //
5
+ // MsgExecSession has `repeated google.protobuf.Any msgs = 3` (note the
6
+ // shorter field name `msgs`, not `messages`). Same recursive-Any problem.
7
+ import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession, } from "./tx";
8
+ import { anyToAmino, aminoToAny } from "../../../nested-amino";
3
9
  export const AminoConverter = {
4
10
  "/sparkdream.session.v1.MsgUpdateParams": {
5
11
  aminoType: "sparkdream/x/session/MsgUpdateParams",
6
12
  toAmino: MsgUpdateParams.toAmino,
7
- fromAmino: MsgUpdateParams.fromAmino
13
+ fromAmino: MsgUpdateParams.fromAmino,
8
14
  },
9
15
  "/sparkdream.session.v1.MsgUpdateOperationalParams": {
10
16
  aminoType: "sparkdream/x/session/MsgUpdateOperationalParams",
11
17
  toAmino: MsgUpdateOperationalParams.toAmino,
12
- fromAmino: MsgUpdateOperationalParams.fromAmino
18
+ fromAmino: MsgUpdateOperationalParams.fromAmino,
13
19
  },
14
20
  "/sparkdream.session.v1.MsgCreateSession": {
15
21
  aminoType: "sparkdream/x/session/MsgCreateSession",
16
22
  toAmino: MsgCreateSession.toAmino,
17
- fromAmino: MsgCreateSession.fromAmino
23
+ fromAmino: MsgCreateSession.fromAmino,
18
24
  },
19
25
  "/sparkdream.session.v1.MsgRevokeSession": {
20
26
  aminoType: "sparkdream/x/session/MsgRevokeSession",
21
27
  toAmino: MsgRevokeSession.toAmino,
22
- fromAmino: MsgRevokeSession.fromAmino
28
+ fromAmino: MsgRevokeSession.fromAmino,
23
29
  },
24
30
  "/sparkdream.session.v1.MsgExecSession": {
25
31
  aminoType: "sparkdream/x/session/MsgExecSession",
26
- toAmino: MsgExecSession.toAmino,
27
- fromAmino: MsgExecSession.fromAmino
28
- }
32
+ toAmino(message) {
33
+ const obj = {};
34
+ obj.grantee = message.grantee === "" ? undefined : message.grantee;
35
+ obj.granter = message.granter === "" ? undefined : message.granter;
36
+ // Omit when empty to match the chain's aminojson default for
37
+ // repeated fields.
38
+ obj.msgs = (message.msgs?.length ?? 0) > 0
39
+ ? message.msgs.map((a) => anyToAmino(a))
40
+ : undefined;
41
+ return obj;
42
+ },
43
+ fromAmino(object) {
44
+ return {
45
+ grantee: object.grantee ?? "",
46
+ granter: object.granter ?? "",
47
+ msgs: (object.msgs ?? []).map((e) => aminoToAny(e)),
48
+ };
49
+ },
50
+ },
29
51
  };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Shared registry + helpers for amino-converting messages that embed a
3
+ * `repeated google.protobuf.Any` field (`MsgSubmitProposal`,
4
+ * `MsgSubmitAnonymousProposal`, `MsgExecSession`).
5
+ *
6
+ * The Telescope-generated `Any.toAmino` just emits `{type, value: Uint8Array}`,
7
+ * which JSON.stringify turns into `{"0":N,"1":N,…}` — numeric keys that aren't
8
+ * lexicographically sorted, breaking Ledger's strict amino-JSON validator and
9
+ * leaving the chain unable to reconstruct identical sign bytes.
10
+ *
11
+ * Consumers must call `configureNestedAminoConverter({registry, aminoTypes})`
12
+ * once after they've built both their proto Registry and their stargate
13
+ * AminoTypes. The patched converters below then look up each inner Any's
14
+ * proto codec (to decode bytes back to a typed message) and its registered
15
+ * amino converter (to render the proper amino JSON) — symmetric to what
16
+ * `cosmossdk.io/x/tx/signing/aminojson` does on the chain side.
17
+ */
18
+ interface ProtoCodec {
19
+ /** Proto-decodes raw bytes back to the typed message. */
20
+ decode: (bytes: Uint8Array) => any;
21
+ /** Proto-encodes a typed message (or partial) back to raw bytes. */
22
+ encode: (msg: any) => {
23
+ finish: () => Uint8Array;
24
+ };
25
+ fromPartial: (msg: any) => any;
26
+ }
27
+ interface RegistryLike {
28
+ lookupType: (typeUrl: string) => ProtoCodec | undefined;
29
+ }
30
+ interface AminoTypesLike {
31
+ toAmino: (msg: {
32
+ typeUrl: string;
33
+ value: any;
34
+ }) => {
35
+ type: string;
36
+ value: any;
37
+ };
38
+ fromAmino: (msg: {
39
+ type: string;
40
+ value: any;
41
+ }) => {
42
+ typeUrl: string;
43
+ value: any;
44
+ };
45
+ }
46
+ export interface NestedAminoConfig {
47
+ /**
48
+ * Proto registry capable of resolving any typeUrl that may appear inside an
49
+ * Any-typed field. Typically `new Registry(defaultRegistryTypes)` with each
50
+ * module's `load(registry)` called against it.
51
+ */
52
+ registry: RegistryLike;
53
+ /**
54
+ * AminoTypes containing converters for every typeUrl that may appear inside
55
+ * an Any-typed field. Typically `new AminoTypes({...createDefaultAminoConverters(), ...moduleAminos})`.
56
+ */
57
+ aminoTypes: AminoTypesLike;
58
+ }
59
+ export declare function configureNestedAminoConverter(next: NestedAminoConfig): void;
60
+ /** Convert one proto-encoded Any to its amino representation. */
61
+ export declare function anyToAmino(any: {
62
+ typeUrl: string;
63
+ value: Uint8Array;
64
+ }): {
65
+ type: string;
66
+ value: any;
67
+ };
68
+ /** Convert one amino-typed entry back to a proto-encoded Any. */
69
+ export declare function aminoToAny(entry: {
70
+ type: string;
71
+ value: any;
72
+ }): {
73
+ typeUrl: string;
74
+ value: Uint8Array;
75
+ };
76
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ //@ts-nocheck
3
+ /**
4
+ * Shared registry + helpers for amino-converting messages that embed a
5
+ * `repeated google.protobuf.Any` field (`MsgSubmitProposal`,
6
+ * `MsgSubmitAnonymousProposal`, `MsgExecSession`).
7
+ *
8
+ * The Telescope-generated `Any.toAmino` just emits `{type, value: Uint8Array}`,
9
+ * which JSON.stringify turns into `{"0":N,"1":N,…}` — numeric keys that aren't
10
+ * lexicographically sorted, breaking Ledger's strict amino-JSON validator and
11
+ * leaving the chain unable to reconstruct identical sign bytes.
12
+ *
13
+ * Consumers must call `configureNestedAminoConverter({registry, aminoTypes})`
14
+ * once after they've built both their proto Registry and their stargate
15
+ * AminoTypes. The patched converters below then look up each inner Any's
16
+ * proto codec (to decode bytes back to a typed message) and its registered
17
+ * amino converter (to render the proper amino JSON) — symmetric to what
18
+ * `cosmossdk.io/x/tx/signing/aminojson` does on the chain side.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.configureNestedAminoConverter = configureNestedAminoConverter;
22
+ exports.anyToAmino = anyToAmino;
23
+ exports.aminoToAny = aminoToAny;
24
+ let cfg = null;
25
+ function configureNestedAminoConverter(next) {
26
+ cfg = next;
27
+ }
28
+ function requireCfg() {
29
+ if (!cfg) {
30
+ throw new Error("@sparkdreamnft/sparkdreamjs: configureNestedAminoConverter({registry, aminoTypes}) " +
31
+ "must be called before amino-signing a tx with MsgSubmitProposal / " +
32
+ "MsgSubmitAnonymousProposal / MsgExecSession (their `messages` / `msgs` " +
33
+ "field needs recursive Any conversion that Telescope can't generate).");
34
+ }
35
+ return cfg;
36
+ }
37
+ /** Convert one proto-encoded Any to its amino representation. */
38
+ function anyToAmino(any) {
39
+ const { registry, aminoTypes } = requireCfg();
40
+ const codec = registry.lookupType(any.typeUrl);
41
+ if (!codec) {
42
+ throw new Error(`No proto codec registered for inner type ${any.typeUrl}. ` +
43
+ `Ensure the corresponding module's load() has been called on your Registry.`);
44
+ }
45
+ const decoded = codec.decode(any.value);
46
+ return aminoTypes.toAmino({ typeUrl: any.typeUrl, value: decoded });
47
+ }
48
+ /** Convert one amino-typed entry back to a proto-encoded Any. */
49
+ function aminoToAny(entry) {
50
+ const { registry, aminoTypes } = requireCfg();
51
+ const decoded = aminoTypes.fromAmino(entry);
52
+ const codec = registry.lookupType(decoded.typeUrl);
53
+ if (!codec) {
54
+ throw new Error(`No proto codec registered for inner type ${decoded.typeUrl}.`);
55
+ }
56
+ return { typeUrl: decoded.typeUrl, value: codec.encode(codec.fromPartial(decoded.value)).finish() };
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkdreamnft/sparkdreamjs",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "author": "kob <kob@sparkdream.io>",
5
5
  "description": "Spark Dream blockchain TypeScript library",
6
6
  "main": "index.js",
@@ -153,6 +153,7 @@ import * as _326 from "./split/v1/params";
153
153
  import * as _327 from "./split/v1/query";
154
154
  import * as _328 from "./split/v1/share";
155
155
  import * as _329 from "./split/v1/tx";
156
+ import * as _480 from "./commons/v1/tx.amino";
156
157
  import * as _508 from "./blog/v1/query.lcd";
157
158
  import * as _509 from "./collect/v1/query.lcd";
158
159
  import * as _510 from "./commons/v1/query.lcd";
@@ -3588,6 +3589,10 @@ export declare namespace sparkdream {
3588
3589
  typeUrl: string;
3589
3590
  value: Uint8Array<ArrayBufferLike>;
3590
3591
  };
3592
+ deleteCategory(value: _199.MsgDeleteCategory): {
3593
+ typeUrl: string;
3594
+ value: Uint8Array<ArrayBufferLike>;
3595
+ };
3591
3596
  };
3592
3597
  withTypeUrl: {
3593
3598
  updateParams(value: _199.MsgUpdateParams): {
@@ -3666,6 +3671,10 @@ export declare namespace sparkdream {
3666
3671
  typeUrl: string;
3667
3672
  value: _199.MsgCreateCategory;
3668
3673
  };
3674
+ deleteCategory(value: _199.MsgDeleteCategory): {
3675
+ typeUrl: string;
3676
+ value: _199.MsgDeleteCategory;
3677
+ };
3669
3678
  };
3670
3679
  fromPartial: {
3671
3680
  updateParams(value: _199.MsgUpdateParams): {
@@ -3744,8 +3753,13 @@ export declare namespace sparkdream {
3744
3753
  typeUrl: string;
3745
3754
  value: _199.MsgCreateCategory;
3746
3755
  };
3756
+ deleteCategory(value: _199.MsgDeleteCategory): {
3757
+ typeUrl: string;
3758
+ value: _199.MsgDeleteCategory;
3759
+ };
3747
3760
  };
3748
3761
  };
3762
+ configureNestedAminoConverter: typeof _480.configureNestedAminoConverter;
3749
3763
  AminoConverter: {
3750
3764
  "/sparkdream.commons.v1.MsgUpdateParams": {
3751
3765
  aminoType: string;
@@ -3814,8 +3828,8 @@ export declare namespace sparkdream {
3814
3828
  };
3815
3829
  "/sparkdream.commons.v1.MsgSubmitProposal": {
3816
3830
  aminoType: string;
3817
- toAmino: (message: _199.MsgSubmitProposal) => _199.MsgSubmitProposalAmino;
3818
- fromAmino: (object: _199.MsgSubmitProposalAmino) => _199.MsgSubmitProposal;
3831
+ toAmino(message: any): any;
3832
+ fromAmino(object: any): any;
3819
3833
  };
3820
3834
  "/sparkdream.commons.v1.MsgVoteProposal": {
3821
3835
  aminoType: string;
@@ -3829,8 +3843,8 @@ export declare namespace sparkdream {
3829
3843
  };
3830
3844
  "/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
3831
3845
  aminoType: string;
3832
- toAmino: (message: _199.MsgSubmitAnonymousProposal) => _199.MsgSubmitAnonymousProposalAmino;
3833
- fromAmino: (object: _199.MsgSubmitAnonymousProposalAmino) => _199.MsgSubmitAnonymousProposal;
3846
+ toAmino(message: any): any;
3847
+ fromAmino(object: any): any;
3834
3848
  };
3835
3849
  "/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
3836
3850
  aminoType: string;
@@ -4361,6 +4375,32 @@ export declare namespace sparkdream {
4361
4375
  toProto(message: _199.MsgCreateCategoryResponse): Uint8Array;
4362
4376
  toProtoMsg(message: _199.MsgCreateCategoryResponse): _199.MsgCreateCategoryResponseProtoMsg;
4363
4377
  };
4378
+ MsgDeleteCategory: {
4379
+ typeUrl: string;
4380
+ aminoType: string;
4381
+ encode(message: _199.MsgDeleteCategory, writer?: import("..").BinaryWriter): import("..").BinaryWriter;
4382
+ decode(input: import("..").BinaryReader | Uint8Array, length?: number): _199.MsgDeleteCategory;
4383
+ fromPartial(object: import("../helpers").DeepPartial<_199.MsgDeleteCategory>): _199.MsgDeleteCategory;
4384
+ fromAmino(object: _199.MsgDeleteCategoryAmino): _199.MsgDeleteCategory;
4385
+ toAmino(message: _199.MsgDeleteCategory): _199.MsgDeleteCategoryAmino;
4386
+ fromAminoMsg(object: _199.MsgDeleteCategoryAminoMsg): _199.MsgDeleteCategory;
4387
+ toAminoMsg(message: _199.MsgDeleteCategory): _199.MsgDeleteCategoryAminoMsg;
4388
+ fromProtoMsg(message: _199.MsgDeleteCategoryProtoMsg): _199.MsgDeleteCategory;
4389
+ toProto(message: _199.MsgDeleteCategory): Uint8Array;
4390
+ toProtoMsg(message: _199.MsgDeleteCategory): _199.MsgDeleteCategoryProtoMsg;
4391
+ };
4392
+ MsgDeleteCategoryResponse: {
4393
+ typeUrl: string;
4394
+ encode(_: _199.MsgDeleteCategoryResponse, writer?: import("..").BinaryWriter): import("..").BinaryWriter;
4395
+ decode(input: import("..").BinaryReader | Uint8Array, length?: number): _199.MsgDeleteCategoryResponse;
4396
+ fromPartial(_: import("../helpers").DeepPartial<_199.MsgDeleteCategoryResponse>): _199.MsgDeleteCategoryResponse;
4397
+ fromAmino(_: _199.MsgDeleteCategoryResponseAmino): _199.MsgDeleteCategoryResponse;
4398
+ toAmino(_: _199.MsgDeleteCategoryResponse): _199.MsgDeleteCategoryResponseAmino;
4399
+ fromAminoMsg(object: _199.MsgDeleteCategoryResponseAminoMsg): _199.MsgDeleteCategoryResponse;
4400
+ fromProtoMsg(message: _199.MsgDeleteCategoryResponseProtoMsg): _199.MsgDeleteCategoryResponse;
4401
+ toProto(message: _199.MsgDeleteCategoryResponse): Uint8Array;
4402
+ toProtoMsg(message: _199.MsgDeleteCategoryResponse): _199.MsgDeleteCategoryResponseProtoMsg;
4403
+ };
4364
4404
  QueryParamsRequest: {
4365
4405
  typeUrl: string;
4366
4406
  encode(_: _198.QueryParamsRequest, writer?: import("..").BinaryWriter): import("..").BinaryWriter;
@@ -7054,6 +7094,10 @@ export declare namespace sparkdream {
7054
7094
  typeUrl: string;
7055
7095
  value: Uint8Array<ArrayBufferLike>;
7056
7096
  };
7097
+ unhidePost(value: _228.MsgUnhidePost): {
7098
+ typeUrl: string;
7099
+ value: Uint8Array<ArrayBufferLike>;
7100
+ };
7057
7101
  appealPost(value: _228.MsgAppealPost): {
7058
7102
  typeUrl: string;
7059
7103
  value: Uint8Array<ArrayBufferLike>;
@@ -7196,6 +7240,10 @@ export declare namespace sparkdream {
7196
7240
  typeUrl: string;
7197
7241
  value: _228.MsgHidePost;
7198
7242
  };
7243
+ unhidePost(value: _228.MsgUnhidePost): {
7244
+ typeUrl: string;
7245
+ value: _228.MsgUnhidePost;
7246
+ };
7199
7247
  appealPost(value: _228.MsgAppealPost): {
7200
7248
  typeUrl: string;
7201
7249
  value: _228.MsgAppealPost;
@@ -7338,6 +7386,10 @@ export declare namespace sparkdream {
7338
7386
  typeUrl: string;
7339
7387
  value: _228.MsgHidePost;
7340
7388
  };
7389
+ unhidePost(value: _228.MsgUnhidePost): {
7390
+ typeUrl: string;
7391
+ value: _228.MsgUnhidePost;
7392
+ };
7341
7393
  appealPost(value: _228.MsgAppealPost): {
7342
7394
  typeUrl: string;
7343
7395
  value: _228.MsgAppealPost;
@@ -7500,6 +7552,11 @@ export declare namespace sparkdream {
7500
7552
  toAmino: (message: _228.MsgHidePost) => _228.MsgHidePostAmino;
7501
7553
  fromAmino: (object: _228.MsgHidePostAmino) => _228.MsgHidePost;
7502
7554
  };
7555
+ "/sparkdream.forum.v1.MsgUnhidePost": {
7556
+ aminoType: string;
7557
+ toAmino: (message: _228.MsgUnhidePost) => _228.MsgUnhidePostAmino;
7558
+ fromAmino: (object: _228.MsgUnhidePostAmino) => _228.MsgUnhidePost;
7559
+ };
7503
7560
  "/sparkdream.forum.v1.MsgAppealPost": {
7504
7561
  aminoType: string;
7505
7562
  toAmino: (message: _228.MsgAppealPost) => _228.MsgAppealPostAmino;
@@ -8139,6 +8196,32 @@ export declare namespace sparkdream {
8139
8196
  toProto(message: _228.MsgHidePostResponse): Uint8Array;
8140
8197
  toProtoMsg(message: _228.MsgHidePostResponse): _228.MsgHidePostResponseProtoMsg;
8141
8198
  };
8199
+ MsgUnhidePost: {
8200
+ typeUrl: string;
8201
+ aminoType: string;
8202
+ encode(message: _228.MsgUnhidePost, writer?: import("..").BinaryWriter): import("..").BinaryWriter;
8203
+ decode(input: import("..").BinaryReader | Uint8Array, length?: number): _228.MsgUnhidePost;
8204
+ fromPartial(object: import("../helpers").DeepPartial<_228.MsgUnhidePost>): _228.MsgUnhidePost;
8205
+ fromAmino(object: _228.MsgUnhidePostAmino): _228.MsgUnhidePost;
8206
+ toAmino(message: _228.MsgUnhidePost): _228.MsgUnhidePostAmino;
8207
+ fromAminoMsg(object: _228.MsgUnhidePostAminoMsg): _228.MsgUnhidePost;
8208
+ toAminoMsg(message: _228.MsgUnhidePost): _228.MsgUnhidePostAminoMsg;
8209
+ fromProtoMsg(message: _228.MsgUnhidePostProtoMsg): _228.MsgUnhidePost;
8210
+ toProto(message: _228.MsgUnhidePost): Uint8Array;
8211
+ toProtoMsg(message: _228.MsgUnhidePost): _228.MsgUnhidePostProtoMsg;
8212
+ };
8213
+ MsgUnhidePostResponse: {
8214
+ typeUrl: string;
8215
+ encode(_: _228.MsgUnhidePostResponse, writer?: import("..").BinaryWriter): import("..").BinaryWriter;
8216
+ decode(input: import("..").BinaryReader | Uint8Array, length?: number): _228.MsgUnhidePostResponse;
8217
+ fromPartial(_: import("../helpers").DeepPartial<_228.MsgUnhidePostResponse>): _228.MsgUnhidePostResponse;
8218
+ fromAmino(_: _228.MsgUnhidePostResponseAmino): _228.MsgUnhidePostResponse;
8219
+ toAmino(_: _228.MsgUnhidePostResponse): _228.MsgUnhidePostResponseAmino;
8220
+ fromAminoMsg(object: _228.MsgUnhidePostResponseAminoMsg): _228.MsgUnhidePostResponse;
8221
+ fromProtoMsg(message: _228.MsgUnhidePostResponseProtoMsg): _228.MsgUnhidePostResponse;
8222
+ toProto(message: _228.MsgUnhidePostResponse): Uint8Array;
8223
+ toProtoMsg(message: _228.MsgUnhidePostResponse): _228.MsgUnhidePostResponseProtoMsg;
8224
+ };
8142
8225
  MsgAppealPost: {
8143
8226
  typeUrl: string;
8144
8227
  aminoType: string;
@@ -20727,8 +20810,8 @@ export declare namespace sparkdream {
20727
20810
  };
20728
20811
  "/sparkdream.session.v1.MsgExecSession": {
20729
20812
  aminoType: string;
20730
- toAmino: (message: _312.MsgExecSession) => _312.MsgExecSessionAmino;
20731
- fromAmino: (object: _312.MsgExecSessionAmino) => _312.MsgExecSession;
20813
+ toAmino(message: any): any;
20814
+ fromAmino(object: any): any;
20732
20815
  };
20733
20816
  };
20734
20817
  MsgUpdateParams: {