@sparkdreamnft/sparkdreamjs 0.0.46 → 0.0.47

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 (70) hide show
  1. package/amino-schema.d.ts +5741 -0
  2. package/amino-schema.js +8 -0
  3. package/chain-amino.d.ts +61 -0
  4. package/chain-amino.js +670 -0
  5. package/esm/amino-schema.js +5 -0
  6. package/esm/chain-amino.js +665 -0
  7. package/esm/nested-amino.js +7 -1
  8. package/esm/sparkdream/artifact/v1/tx.amino.js +12 -473
  9. package/esm/sparkdream/blog/v1/tx.amino.js +15 -135
  10. package/esm/sparkdream/collect/v1/tx.amino.js +15 -254
  11. package/esm/sparkdream/commons/v1/tx.amino.js +12 -258
  12. package/esm/sparkdream/ecosystem/v1/tx.amino.js +15 -26
  13. package/esm/sparkdream/federation/v1/tx.amino.js +12 -174
  14. package/esm/sparkdream/forum/v1/tx.amino.js +15 -231
  15. package/esm/sparkdream/futarchy/v1/tx.amino.js +16 -38
  16. package/esm/sparkdream/guardian/v1/tx.amino.js +12 -33
  17. package/esm/sparkdream/name/v1/tx.amino.js +16 -63
  18. package/esm/sparkdream/rep/v1/tx.amino.js +12 -484
  19. package/esm/sparkdream/reveal/v1/tx.amino.js +15 -73
  20. package/esm/sparkdream/season/v1/tx.amino.js +12 -276
  21. package/esm/sparkdream/service/v1/tx.amino.js +16 -78
  22. package/esm/sparkdream/session/v1/tx.amino.js +16 -271
  23. package/esm/sparkdream/shield/v1/tx.amino.js +15 -80
  24. package/esm/sparkdream/sparkdream/v1/tx.amino.js +16 -8
  25. package/esm/sparkdream/split/v1/tx.amino.js +16 -8
  26. package/esm/sparkdream/vault/v1/tx.amino.js +12 -105
  27. package/nested-amino.d.ts +5 -1
  28. package/nested-amino.js +8 -1
  29. package/package.json +1 -1
  30. package/sparkdream/artifact/v1/tx.amino.d.ts +1 -353
  31. package/sparkdream/artifact/v1/tx.amino.js +47 -475
  32. package/sparkdream/blog/v1/tx.amino.d.ts +1 -103
  33. package/sparkdream/blog/v1/tx.amino.js +50 -137
  34. package/sparkdream/bundle.d.ts +19 -2047
  35. package/sparkdream/client.d.ts +1 -2009
  36. package/sparkdream/collect/v1/tx.amino.d.ts +1 -153
  37. package/sparkdream/collect/v1/tx.amino.js +50 -256
  38. package/sparkdream/commons/v1/tx.amino.d.ts +1 -123
  39. package/sparkdream/commons/v1/tx.amino.js +49 -262
  40. package/sparkdream/ecosystem/v1/tx.amino.d.ts +1 -13
  41. package/sparkdream/ecosystem/v1/tx.amino.js +50 -28
  42. package/sparkdream/federation/v1/tx.amino.d.ts +1 -128
  43. package/sparkdream/federation/v1/tx.amino.js +47 -176
  44. package/sparkdream/forum/v1/tx.amino.d.ts +1 -203
  45. package/sparkdream/forum/v1/tx.amino.js +50 -233
  46. package/sparkdream/futarchy/v1/tx.amino.d.ts +1 -38
  47. package/sparkdream/futarchy/v1/tx.amino.js +49 -38
  48. package/sparkdream/guardian/v1/tx.amino.d.ts +1 -7
  49. package/sparkdream/guardian/v1/tx.amino.js +49 -37
  50. package/sparkdream/name/v1/tx.amino.d.ts +1 -63
  51. package/sparkdream/name/v1/tx.amino.js +49 -63
  52. package/sparkdream/rep/v1/tx.amino.d.ts +1 -353
  53. package/sparkdream/rep/v1/tx.amino.js +47 -486
  54. package/sparkdream/reveal/v1/tx.amino.d.ts +1 -53
  55. package/sparkdream/reveal/v1/tx.amino.js +50 -75
  56. package/sparkdream/season/v1/tx.amino.d.ts +1 -218
  57. package/sparkdream/season/v1/tx.amino.js +47 -278
  58. package/sparkdream/service/v1/tx.amino.d.ts +1 -78
  59. package/sparkdream/service/v1/tx.amino.js +49 -78
  60. package/sparkdream/session/v1/tx.amino.d.ts +1 -93
  61. package/sparkdream/session/v1/tx.amino.js +48 -270
  62. package/sparkdream/shield/v1/tx.amino.d.ts +1 -28
  63. package/sparkdream/shield/v1/tx.amino.js +50 -82
  64. package/sparkdream/sparkdream/v1/tx.amino.d.ts +1 -8
  65. package/sparkdream/sparkdream/v1/tx.amino.js +49 -8
  66. package/sparkdream/split/v1/tx.amino.d.ts +1 -8
  67. package/sparkdream/split/v1/tx.amino.js +49 -8
  68. package/sparkdream/vault/v1/tx.amino.d.ts +1 -43
  69. package/sparkdream/vault/v1/tx.amino.js +49 -109
  70. package/varint.d.ts +1 -1
@@ -1,275 +1,53 @@
1
1
  "use strict";
2
- //@ts-nocheck
3
- // HAND-WRITTEN OVERRIDE — overlaid by scripts/codegen.ts after telescope.
4
- // See ../../commons/v1/tx.amino.ts for rationale.
5
- //
6
- // Because this file replaces the generated one wholesale, EVERY Msg in
7
- // session/v1/tx.proto must have an entry here — a message added to the proto
8
- // but not to this map ships in the registry with no amino converter, and
9
- // Keplr/Ledger (amino-json) signing of it fails.
10
- //
11
- // Three shapes telescope gets wrong for this module:
12
- //
13
- // 1. MsgExecSession / OneshotExec carry google.protobuf.Any, which needs the
14
- // recursive conversion in ../../../nested-amino.
15
- // 2. MsgCreateGrant.payload and ScheduledOneshotPayload.action are oneofs
16
- // with (amino.oneof_name). cosmossdk.io/x/tx/signing/aminojson renders a
17
- // set oneof member as
18
- //
19
- // "<CamelCase oneof name>": {"type": "<oneof_name>", "value": {"<field>": {...}}}
20
- //
21
- // e.g. "Payload": {"type": "sparkdream/session/RecurringPullPayload",
22
- // "value": {"recurring_pull": {...}}}
23
- //
24
- // while telescope emits the bare member ("recurring_pull": {...}).
25
- // 3. Repeated fields must be omitted when empty (omitempty), never `[]`.
26
- //
27
- // cosmjs rebuilds the TxBody from fromAmino(signed msgs), so each fromAmino
28
- // below must exactly invert its toAmino.
29
- //
30
- // 64-bit ints are coerced here rather than trusting callers to pass BigInt:
31
- // cosmjs hands toAmino the caller's raw value (no fromPartial), and a Number
32
- // 0 would otherwise sign a key the chain omits.
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.AminoConverter = void 0;
35
- const tx_1 = require("./tx");
36
- const coin_1 = require("../../../cosmos/base/v1beta1/coin");
37
- const timestamp_1 = require("../../../google/protobuf/timestamp");
38
- const helpers_1 = require("../../../helpers");
39
- const nested_amino_1 = require("../../../nested-amino");
40
- const str = (v) => (v === "" || v === undefined || v === null ? undefined : v);
41
- const int64 = (v) => {
42
- if (v === undefined || v === null || v === "")
43
- return undefined;
44
- const b = BigInt(v);
45
- return b === BigInt(0) ? undefined : b.toString();
46
- };
47
- const bool = (v) => (v ? true : undefined);
48
- const list = (v) => ((v?.length ?? 0) > 0 ? v.map((e) => e) : undefined);
49
- const coin = (v) => (v ? coin_1.Coin.toAmino(coin_1.Coin.fromPartial(v)) : undefined);
50
- const time = (v) => (v ? timestamp_1.Timestamp.toAmino((0, helpers_1.toTimestamp)(v)) : undefined);
51
- const toBig = (v) => (v === undefined || v === null ? BigInt(0) : BigInt(v));
52
- const fromCoin = (v) => (v ? coin_1.Coin.fromAmino(v) : undefined);
53
- const fromTime = (v) => (v ? (0, helpers_1.fromTimestamp)(timestamp_1.Timestamp.fromAmino(v)) : undefined);
54
- // ── Payloads ────────────────────────────────────────────────────────────
55
- const sessionKeyToAmino = (p) => ({
56
- allowed_msg_types: list(p.allowedMsgTypes),
57
- spend_limit: coin(p.spendLimit),
58
- spent: coin(p.spent),
59
- max_exec_count: int64(p.maxExecCount),
60
- exec_count: int64(p.execCount),
61
- last_used_at: time(p.lastUsedAt),
62
- allow_self_revoke: bool(p.allowSelfRevoke),
63
- });
64
- const sessionKeyFromAmino = (o) => ({
65
- allowedMsgTypes: o.allowed_msg_types ?? [],
66
- spendLimit: fromCoin(o.spend_limit),
67
- spent: fromCoin(o.spent),
68
- maxExecCount: toBig(o.max_exec_count),
69
- execCount: toBig(o.exec_count),
70
- lastUsedAt: fromTime(o.last_used_at),
71
- allowSelfRevoke: o.allow_self_revoke ?? false,
72
- });
73
- const recurringPullToAmino = (p) => ({
74
- amount_per_period: coin(p.amountPerPeriod),
75
- period_seconds: int64(p.periodSeconds),
76
- start_time: int64(p.startTime),
77
- last_claim_advance: int64(p.lastClaimAdvance),
78
- claims_made: int64(p.claimsMade),
79
- max_per_epoch: str(p.maxPerEpoch),
80
- });
81
- const recurringPullFromAmino = (o) => ({
82
- amountPerPeriod: fromCoin(o.amount_per_period),
83
- periodSeconds: toBig(o.period_seconds),
84
- startTime: toBig(o.start_time),
85
- lastClaimAdvance: toBig(o.last_claim_advance),
86
- claimsMade: toBig(o.claims_made),
87
- maxPerEpoch: o.max_per_epoch ?? "",
88
- });
89
- const spendingAllowanceToAmino = (p) => ({
90
- max_per_period: coin(p.maxPerPeriod),
91
- period_seconds: int64(p.periodSeconds),
92
- current_period_start: int64(p.currentPeriodStart),
93
- spent_in_current_period: coin(p.spentInCurrentPeriod),
94
- allowed_recipients: list(p.allowedRecipients),
95
- denom: str(p.denom),
96
- });
97
- const spendingAllowanceFromAmino = (o) => ({
98
- maxPerPeriod: fromCoin(o.max_per_period),
99
- periodSeconds: toBig(o.period_seconds),
100
- currentPeriodStart: toBig(o.current_period_start),
101
- spentInCurrentPeriod: fromCoin(o.spent_in_current_period),
102
- allowedRecipients: o.allowed_recipients ?? [],
103
- denom: o.denom ?? "",
104
- });
105
- const scheduledOneshotToAmino = (p) => {
106
- let action = undefined;
107
- if (p.transfer) {
108
- action = {
109
- type: "sparkdream/session/OneshotTransfer",
110
- value: { transfer: { recipient: str(p.transfer.recipient), amount: coin(p.transfer.amount) } },
111
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
112
7
  }
113
- else if (p.exec) {
114
- action = {
115
- type: "sparkdream/session/OneshotExec",
116
- value: {
117
- exec: {
118
- msg: p.exec.msg ? (0, nested_amino_1.anyToAmino)(p.exec.msg) : undefined,
119
- gas_limit: int64(p.exec.gasLimit),
120
- },
121
- },
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
122
24
  };
123
- }
124
- return {
125
- // aminojson writes `null` for an unset oneof rather than omitting it.
126
- Action: action ?? null,
127
- fire_at: int64(p.fireAt),
128
- fire_error: str(p.fireError),
25
+ return ownKeys(o);
129
26
  };
130
- };
131
- const scheduledOneshotFromAmino = (o) => {
132
- const v = o.Action?.value ?? {};
133
- return {
134
- transfer: v.transfer
135
- ? { recipient: v.transfer.recipient ?? "", amount: fromCoin(v.transfer.amount) }
136
- : undefined,
137
- exec: v.exec
138
- ? { msg: v.exec.msg ? (0, nested_amino_1.aminoToAny)(v.exec.msg) : undefined, gasLimit: toBig(v.exec.gas_limit) }
139
- : undefined,
140
- fireAt: toBig(o.fire_at),
141
- fireError: o.fire_error ?? "",
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
142
33
  };
143
- };
144
- const signInToAmino = (p) => ({ service: str(p.service) });
145
- const signInFromAmino = (o) => ({ service: o.service ?? "" });
146
- const PAYLOADS = [
147
- ["sessionKey", "session_key", "sparkdream/session/SessionKeyPayload", sessionKeyToAmino, sessionKeyFromAmino],
148
- ["recurringPull", "recurring_pull", "sparkdream/session/RecurringPullPayload", recurringPullToAmino, recurringPullFromAmino],
149
- ["spendingAllowance", "spending_allowance", "sparkdream/session/SpendingAllowancePayload", spendingAllowanceToAmino, spendingAllowanceFromAmino],
150
- ["scheduledOneshot", "scheduled_oneshot", "sparkdream/session/ScheduledOneshotPayload", scheduledOneshotToAmino, scheduledOneshotFromAmino],
151
- ["signIn", "sign_in", "sparkdream/session/SignInPayload", signInToAmino, signInFromAmino],
152
- ];
153
- // ── Messages ────────────────────────────────────────────────────────────
154
- // {<signer>, grant_id} messages; each signer field name is a single word, so
155
- // the proto and amino spellings coincide.
156
- const grantIdMsg = (signer) => ({
157
- toAmino: (m) => ({ [signer]: str(m[signer]), grant_id: int64(m.grantId) }),
158
- fromAmino: (o) => ({ [signer]: o[signer] ?? "", grantId: toBig(o.grant_id) }),
159
- });
160
- exports.AminoConverter = {
161
- "/sparkdream.session.v1.MsgUpdateParams": {
162
- aminoType: "sparkdream/x/session/MsgUpdateParams",
163
- toAmino: tx_1.MsgUpdateParams.toAmino,
164
- fromAmino: tx_1.MsgUpdateParams.fromAmino,
165
- },
166
- "/sparkdream.session.v1.MsgUpdateOperationalParams": {
167
- aminoType: "sparkdream/x/session/MsgUpdateOperationalParams",
168
- toAmino: tx_1.MsgUpdateOperationalParams.toAmino,
169
- fromAmino: tx_1.MsgUpdateOperationalParams.fromAmino,
170
- },
171
- // `allowed_msg_types` is the repeated string field that gets emitted as `[]`
172
- // when a session is created with no type allowlist (i.e. allow-all).
173
- "/sparkdream.session.v1.MsgCreateSession": {
174
- aminoType: "sparkdream/x/session/MsgCreateSession",
175
- toAmino(message) {
176
- const obj = {};
177
- obj.granter = message.granter === "" ? undefined : message.granter;
178
- obj.grantee = message.grantee === "" ? undefined : message.grantee;
179
- obj.allowed_msg_types = (message.allowedMsgTypes?.length ?? 0) > 0
180
- ? message.allowedMsgTypes.map((e) => e)
181
- : undefined;
182
- obj.spend_limit = message.spendLimit ? coin_1.Coin.toAmino(message.spendLimit) : undefined;
183
- obj.expiration = message.expiration ? timestamp_1.Timestamp.toAmino((0, helpers_1.toTimestamp)(message.expiration)) : undefined;
184
- obj.max_exec_count = message.maxExecCount !== BigInt(0) ? message.maxExecCount?.toString() : undefined;
185
- return obj;
186
- },
187
- fromAmino: tx_1.MsgCreateSession.fromAmino,
188
- },
189
- "/sparkdream.session.v1.MsgRevokeSession": {
190
- aminoType: "sparkdream/x/session/MsgRevokeSession",
191
- toAmino: tx_1.MsgRevokeSession.toAmino,
192
- fromAmino: tx_1.MsgRevokeSession.fromAmino,
193
- },
194
- "/sparkdream.session.v1.MsgExecSession": {
195
- aminoType: "sparkdream/x/session/MsgExecSession",
196
- toAmino(message) {
197
- const obj = {};
198
- obj.grantee = message.grantee === "" ? undefined : message.grantee;
199
- obj.granter = message.granter === "" ? undefined : message.granter;
200
- // Omit when empty to match the chain's aminojson default for
201
- // repeated fields.
202
- obj.msgs = (message.msgs?.length ?? 0) > 0
203
- ? message.msgs.map((a) => (0, nested_amino_1.anyToAmino)(a))
204
- : undefined;
205
- return obj;
206
- },
207
- fromAmino(object) {
208
- return {
209
- grantee: object.grantee ?? "",
210
- granter: object.granter ?? "",
211
- msgs: (object.msgs ?? []).map((e) => (0, nested_amino_1.aminoToAny)(e)),
212
- };
213
- },
214
- },
215
- "/sparkdream.session.v1.MsgCreateGrant": {
216
- aminoType: "sparkdream/x/session/MsgCreateGrant",
217
- toAmino(message) {
218
- const set = PAYLOADS.find(([key]) => message[key]);
219
- return {
220
- granter: str(message.granter),
221
- grantee: str(message.grantee),
222
- expires_at: time(message.expiresAt),
223
- note: str(message.note),
224
- Payload: set
225
- ? { type: set[2], value: { [set[1]]: set[3](message[set[0]]) } }
226
- : null,
227
- };
228
- },
229
- fromAmino(object) {
230
- const out = {
231
- granter: object.granter ?? "",
232
- grantee: object.grantee ?? "",
233
- expiresAt: fromTime(object.expires_at),
234
- note: object.note ?? "",
235
- };
236
- const inner = object.Payload?.value ?? {};
237
- for (const [key, field, , , fromAmino] of PAYLOADS) {
238
- if (inner[field])
239
- out[key] = fromAmino(inner[field]);
240
- }
241
- return out;
242
- },
243
- },
244
- "/sparkdream.session.v1.MsgClaimRecurringPull": {
245
- aminoType: "sparkdream/x/session/MsgClaimRecurringPull",
246
- ...grantIdMsg("grantee"),
247
- },
248
- "/sparkdream.session.v1.MsgPullAllowance": {
249
- aminoType: "sparkdream/x/session/MsgPullAllowance",
250
- toAmino: (m) => ({
251
- grantee: str(m.grantee),
252
- grant_id: int64(m.grantId),
253
- recipient: str(m.recipient),
254
- amount: coin(m.amount),
255
- }),
256
- fromAmino: (o) => ({
257
- grantee: o.grantee ?? "",
258
- grantId: toBig(o.grant_id),
259
- recipient: o.recipient ?? "",
260
- amount: fromCoin(o.amount),
261
- }),
262
- },
263
- "/sparkdream.session.v1.MsgRetryScheduledOneshot": {
264
- aminoType: "sparkdream/x/session/MsgRetryScheduledOneshot",
265
- ...grantIdMsg("caller"),
266
- },
267
- "/sparkdream.session.v1.MsgRevokeGrant": {
268
- aminoType: "sparkdream/x/session/MsgRevokeGrant",
269
- ...grantIdMsg("granter"),
270
- },
271
- "/sparkdream.session.v1.MsgDeclineGrant": {
272
- aminoType: "sparkdream/x/session/MsgDeclineGrant",
273
- ...grantIdMsg("grantee"),
274
- },
275
- };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AminoConverter = void 0;
37
+ //@ts-nocheck
38
+ // HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
39
+ // by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
40
+ //
41
+ // Why: Telescope's generated converters (and the per-message overrides that
42
+ // used to patch them) disagree with the chain's aminojson on empty lists,
43
+ // empty bytes, Dec strings, oneofs and non-nullable messages, and went stale
44
+ // whenever a proto changed. Every Msg of x/session is converted by the
45
+ // schema-driven engine in chain-amino.ts instead, which renders amino JSON
46
+ // from the protobuf bytes exactly as the chain does.
47
+ //
48
+ // MAINTENANCE: none per message. The schema (amino-schema.ts, regenerated from
49
+ // the chain on every proto sync) lists every Msg; __tests__/amino-golden.test.ts
50
+ // checks them all against the chain's encoder.
51
+ const tx = __importStar(require("./tx"));
52
+ const chain_amino_1 = require("../../../chain-amino");
53
+ exports.AminoConverter = (0, chain_amino_1.chainAminoConverters)("sparkdream.session.v1", tx);
@@ -1,28 +1 @@
1
- import { MsgUpdateParams, MsgTriggerDkg, MsgRegisterShieldedOp, MsgDeregisterShieldedOp } from "./tx";
2
- export declare const AminoConverter: {
3
- "/sparkdream.shield.v1.MsgUpdateParams": {
4
- aminoType: string;
5
- toAmino: (message: MsgUpdateParams) => import("./tx").MsgUpdateParamsAmino;
6
- fromAmino: (object: import("./tx").MsgUpdateParamsAmino) => MsgUpdateParams;
7
- };
8
- "/sparkdream.shield.v1.MsgShieldedExec": {
9
- aminoType: string;
10
- toAmino(message: any): any;
11
- fromAmino(object: any): any;
12
- };
13
- "/sparkdream.shield.v1.MsgTriggerDkg": {
14
- aminoType: string;
15
- toAmino: (message: MsgTriggerDkg) => import("./tx").MsgTriggerDkgAmino;
16
- fromAmino: (object: import("./tx").MsgTriggerDkgAmino) => MsgTriggerDkg;
17
- };
18
- "/sparkdream.shield.v1.MsgRegisterShieldedOp": {
19
- aminoType: string;
20
- toAmino: (message: MsgRegisterShieldedOp) => import("./tx").MsgRegisterShieldedOpAmino;
21
- fromAmino: (object: import("./tx").MsgRegisterShieldedOpAmino) => MsgRegisterShieldedOp;
22
- };
23
- "/sparkdream.shield.v1.MsgDeregisterShieldedOp": {
24
- aminoType: string;
25
- toAmino: (message: MsgDeregisterShieldedOp) => import("./tx").MsgDeregisterShieldedOpAmino;
26
- fromAmino: (object: import("./tx").MsgDeregisterShieldedOpAmino) => MsgDeregisterShieldedOp;
27
- };
28
- };
1
+ export declare const AminoConverter: Record<string, import("../../../chain-amino").ChainAminoConverter>;
@@ -1,85 +1,53 @@
1
1
  "use strict";
2
- //@ts-nocheck
3
- // HAND-WRITTEN OVERRIDE — overlaid by scripts/codegen.ts after telescope.
4
- // See ../../commons/v1/tx.amino.ts for the broader rationale.
5
- //
6
- // MsgShieldedExec wraps a single `google.protobuf.Any inner_message`. The
7
- // auto-generated toAmino calls Any.toAmino directly, which attaches raw
8
- // `{type, value: Uint8Array}` — JSON.stringify renders the Uint8Array as
9
- // `{"0":N,"1":N,…}` (numeric, unsorted keys), breaking Ledger's amino-JSON
10
- // validator and producing sign bytes the chain can't reconstruct. Same root
11
- // cause as MsgSubmitProposal in commons; here we route the inner Any through
12
- // the consumer-provided AminoTypes so it's expanded into the proper
13
- // `{type: "<aminoType>", value: <amino-encoded fields>}` shape.
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
14
35
  Object.defineProperty(exports, "__esModule", { value: true });
15
36
  exports.AminoConverter = void 0;
16
- const tx_1 = require("./tx");
17
- const helpers_1 = require("../../../helpers");
18
- const nested_amino_1 = require("../../../nested-amino");
19
- exports.AminoConverter = {
20
- "/sparkdream.shield.v1.MsgUpdateParams": {
21
- aminoType: "sparkdream/x/shield/MsgUpdateParams",
22
- toAmino: tx_1.MsgUpdateParams.toAmino,
23
- fromAmino: tx_1.MsgUpdateParams.fromAmino,
24
- },
25
- "/sparkdream.shield.v1.MsgShieldedExec": {
26
- aminoType: "sparkdream/x/shield/MsgShieldedExec",
27
- toAmino(message) {
28
- const obj = {};
29
- obj.submitter = message.submitter === "" ? undefined : message.submitter;
30
- obj.inner_message = message.innerMessage ? (0, nested_amino_1.anyToAmino)(message.innerMessage) : undefined;
31
- obj.proof = message.proof ? (0, helpers_1.base64FromBytes)(message.proof) : undefined;
32
- obj.nullifier = message.nullifier ? (0, helpers_1.base64FromBytes)(message.nullifier) : undefined;
33
- obj.rate_limit_nullifier = message.rateLimitNullifier ? (0, helpers_1.base64FromBytes)(message.rateLimitNullifier) : undefined;
34
- obj.merkle_root = message.merkleRoot ? (0, helpers_1.base64FromBytes)(message.merkleRoot) : undefined;
35
- obj.proof_domain = message.proofDomain === 0 ? undefined : message.proofDomain;
36
- obj.min_trust_level = message.minTrustLevel === 0 ? undefined : message.minTrustLevel;
37
- obj.exec_mode = message.execMode === 0 ? undefined : message.execMode;
38
- obj.encrypted_payload = message.encryptedPayload ? (0, helpers_1.base64FromBytes)(message.encryptedPayload) : undefined;
39
- obj.target_epoch = message.targetEpoch !== BigInt(0) ? message.targetEpoch?.toString() : undefined;
40
- return obj;
41
- },
42
- fromAmino(object) {
43
- return {
44
- submitter: object.submitter ?? "",
45
- innerMessage: object.inner_message ? (0, nested_amino_1.aminoToAny)(object.inner_message) : undefined,
46
- proof: object.proof !== undefined && object.proof !== null
47
- ? (0, helpers_1.bytesFromBase64)(object.proof)
48
- : new Uint8Array(),
49
- nullifier: object.nullifier !== undefined && object.nullifier !== null
50
- ? (0, helpers_1.bytesFromBase64)(object.nullifier)
51
- : new Uint8Array(),
52
- rateLimitNullifier: object.rate_limit_nullifier !== undefined && object.rate_limit_nullifier !== null
53
- ? (0, helpers_1.bytesFromBase64)(object.rate_limit_nullifier)
54
- : new Uint8Array(),
55
- merkleRoot: object.merkle_root !== undefined && object.merkle_root !== null
56
- ? (0, helpers_1.bytesFromBase64)(object.merkle_root)
57
- : new Uint8Array(),
58
- proofDomain: object.proof_domain ?? 0,
59
- minTrustLevel: object.min_trust_level ?? 0,
60
- execMode: object.exec_mode ?? 0,
61
- encryptedPayload: object.encrypted_payload !== undefined && object.encrypted_payload !== null
62
- ? (0, helpers_1.bytesFromBase64)(object.encrypted_payload)
63
- : new Uint8Array(),
64
- targetEpoch: object.target_epoch !== undefined && object.target_epoch !== null
65
- ? BigInt(object.target_epoch)
66
- : BigInt(0),
67
- };
68
- },
69
- },
70
- "/sparkdream.shield.v1.MsgTriggerDkg": {
71
- aminoType: "sparkdream/x/shield/MsgTriggerDkg",
72
- toAmino: tx_1.MsgTriggerDkg.toAmino,
73
- fromAmino: tx_1.MsgTriggerDkg.fromAmino,
74
- },
75
- "/sparkdream.shield.v1.MsgRegisterShieldedOp": {
76
- aminoType: "sparkdream/x/shield/MsgRegisterShieldedOp",
77
- toAmino: tx_1.MsgRegisterShieldedOp.toAmino,
78
- fromAmino: tx_1.MsgRegisterShieldedOp.fromAmino,
79
- },
80
- "/sparkdream.shield.v1.MsgDeregisterShieldedOp": {
81
- aminoType: "sparkdream/x/shield/MsgDeregisterShieldedOp",
82
- toAmino: tx_1.MsgDeregisterShieldedOp.toAmino,
83
- fromAmino: tx_1.MsgDeregisterShieldedOp.fromAmino,
84
- },
85
- };
37
+ //@ts-nocheck
38
+ // HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
39
+ // by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
40
+ //
41
+ // Why: Telescope's generated converters (and the per-message overrides that
42
+ // used to patch them) disagree with the chain's aminojson on empty lists,
43
+ // empty bytes, Dec strings, oneofs and non-nullable messages, and went stale
44
+ // whenever a proto changed. Every Msg of x/shield is converted by the
45
+ // schema-driven engine in chain-amino.ts instead, which renders amino JSON
46
+ // from the protobuf bytes exactly as the chain does.
47
+ //
48
+ // MAINTENANCE: none per message. The schema (amino-schema.ts, regenerated from
49
+ // the chain on every proto sync) lists every Msg; __tests__/amino-golden.test.ts
50
+ // checks them all against the chain's encoder.
51
+ const tx = __importStar(require("./tx"));
52
+ const chain_amino_1 = require("../../../chain-amino");
53
+ exports.AminoConverter = (0, chain_amino_1.chainAminoConverters)("sparkdream.shield.v1", tx);
@@ -1,8 +1 @@
1
- import { MsgUpdateParams } from "./tx";
2
- export declare const AminoConverter: {
3
- "/sparkdream.sparkdream.v1.MsgUpdateParams": {
4
- aminoType: string;
5
- toAmino: (message: MsgUpdateParams) => import("./tx").MsgUpdateParamsAmino;
6
- fromAmino: (object: import("./tx").MsgUpdateParamsAmino) => MsgUpdateParams;
7
- };
8
- };
1
+ export declare const AminoConverter: Record<string, import("../../../chain-amino").ChainAminoConverter>;
@@ -1,12 +1,53 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.AminoConverter = void 0;
4
37
  //@ts-nocheck
5
- const tx_1 = require("./tx");
6
- exports.AminoConverter = {
7
- "/sparkdream.sparkdream.v1.MsgUpdateParams": {
8
- aminoType: "sparkdream/x/sparkdream/MsgUpdateParams",
9
- toAmino: tx_1.MsgUpdateParams.toAmino,
10
- fromAmino: tx_1.MsgUpdateParams.fromAmino
11
- }
12
- };
38
+ // HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
39
+ // by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
40
+ //
41
+ // Why: Telescope's generated converters (and the per-message overrides that
42
+ // used to patch them) disagree with the chain's aminojson on empty lists,
43
+ // empty bytes, Dec strings, oneofs and non-nullable messages, and went stale
44
+ // whenever a proto changed. Every Msg of x/sparkdream is converted by the
45
+ // schema-driven engine in chain-amino.ts instead, which renders amino JSON
46
+ // from the protobuf bytes exactly as the chain does.
47
+ //
48
+ // MAINTENANCE: none per message. The schema (amino-schema.ts, regenerated from
49
+ // the chain on every proto sync) lists every Msg; __tests__/amino-golden.test.ts
50
+ // checks them all against the chain's encoder.
51
+ const tx = __importStar(require("./tx"));
52
+ const chain_amino_1 = require("../../../chain-amino");
53
+ exports.AminoConverter = (0, chain_amino_1.chainAminoConverters)("sparkdream.sparkdream.v1", tx);
@@ -1,8 +1 @@
1
- import { MsgUpdateParams } from "./tx";
2
- export declare const AminoConverter: {
3
- "/sparkdream.split.v1.MsgUpdateParams": {
4
- aminoType: string;
5
- toAmino: (message: MsgUpdateParams) => import("./tx").MsgUpdateParamsAmino;
6
- fromAmino: (object: import("./tx").MsgUpdateParamsAmino) => MsgUpdateParams;
7
- };
8
- };
1
+ export declare const AminoConverter: Record<string, import("../../../chain-amino").ChainAminoConverter>;
@@ -1,12 +1,53 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.AminoConverter = void 0;
4
37
  //@ts-nocheck
5
- const tx_1 = require("./tx");
6
- exports.AminoConverter = {
7
- "/sparkdream.split.v1.MsgUpdateParams": {
8
- aminoType: "sparkdream/x/split/MsgUpdateParams",
9
- toAmino: tx_1.MsgUpdateParams.toAmino,
10
- fromAmino: tx_1.MsgUpdateParams.fromAmino
11
- }
12
- };
38
+ // HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
39
+ // by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
40
+ //
41
+ // Why: Telescope's generated converters (and the per-message overrides that
42
+ // used to patch them) disagree with the chain's aminojson on empty lists,
43
+ // empty bytes, Dec strings, oneofs and non-nullable messages, and went stale
44
+ // whenever a proto changed. Every Msg of x/split is converted by the
45
+ // schema-driven engine in chain-amino.ts instead, which renders amino JSON
46
+ // from the protobuf bytes exactly as the chain does.
47
+ //
48
+ // MAINTENANCE: none per message. The schema (amino-schema.ts, regenerated from
49
+ // the chain on every proto sync) lists every Msg; __tests__/amino-golden.test.ts
50
+ // checks them all against the chain's encoder.
51
+ const tx = __importStar(require("./tx"));
52
+ const chain_amino_1 = require("../../../chain-amino");
53
+ exports.AminoConverter = (0, chain_amino_1.chainAminoConverters)("sparkdream.split.v1", tx);