@chainpayhq/sdk 0.0.0-stage → 0.1.0

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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/accounts.d.ts +23 -0
  4. package/dist/accounts.js +148 -0
  5. package/dist/cards/accounts.d.ts +156 -0
  6. package/dist/cards/accounts.js +346 -0
  7. package/dist/cards/api.d.ts +379 -0
  8. package/dist/cards/api.js +241 -0
  9. package/dist/cards/commitment.d.ts +86 -0
  10. package/dist/cards/commitment.js +288 -0
  11. package/dist/cards/constants.d.ts +160 -0
  12. package/dist/cards/constants.js +163 -0
  13. package/dist/cards/draft.d.ts +57 -0
  14. package/dist/cards/draft.js +131 -0
  15. package/dist/cards/evidence.d.ts +69 -0
  16. package/dist/cards/evidence.js +41 -0
  17. package/dist/cards/hash.d.ts +9 -0
  18. package/dist/cards/hash.js +47 -0
  19. package/dist/cards/index.d.ts +14 -0
  20. package/dist/cards/index.js +14 -0
  21. package/dist/cards/instructions.d.ts +302 -0
  22. package/dist/cards/instructions.js +474 -0
  23. package/dist/cards/layout.d.ts +33 -0
  24. package/dist/cards/layout.js +137 -0
  25. package/dist/cards/math.d.ts +67 -0
  26. package/dist/cards/math.js +138 -0
  27. package/dist/cards/merchants.d.ts +23 -0
  28. package/dist/cards/merchants.js +38 -0
  29. package/dist/cards/pda.d.ts +42 -0
  30. package/dist/cards/pda.js +93 -0
  31. package/dist/cards/private-repayment.d.ts +198 -0
  32. package/dist/cards/private-repayment.js +485 -0
  33. package/dist/cards/redact.d.ts +18 -0
  34. package/dist/cards/redact.js +103 -0
  35. package/dist/cards/tee.d.ts +253 -0
  36. package/dist/cards/tee.js +605 -0
  37. package/dist/cli.d.ts +31 -0
  38. package/dist/cli.js +351 -0
  39. package/dist/client.d.ts +80 -0
  40. package/dist/client.js +493 -0
  41. package/dist/constants.d.ts +44 -0
  42. package/dist/constants.js +43 -0
  43. package/dist/crossmint-adapt.d.ts +43 -0
  44. package/dist/crossmint-adapt.js +68 -0
  45. package/dist/crossmint-order.d.ts +220 -0
  46. package/dist/crossmint-order.js +638 -0
  47. package/dist/delivery.d.ts +66 -0
  48. package/dist/delivery.js +232 -0
  49. package/dist/encoding.d.ts +51 -0
  50. package/dist/encoding.js +128 -0
  51. package/dist/index.d.ts +27 -0
  52. package/dist/index.js +26 -0
  53. package/dist/known-assets.d.ts +30 -0
  54. package/dist/known-assets.js +49 -0
  55. package/dist/mandate-request.d.ts +123 -0
  56. package/dist/mandate-request.js +401 -0
  57. package/dist/mandate.d.ts +44 -0
  58. package/dist/mandate.js +157 -0
  59. package/dist/ops-snapshot.d.ts +157 -0
  60. package/dist/ops-snapshot.js +356 -0
  61. package/dist/payment-request.d.ts +37 -0
  62. package/dist/payment-request.js +218 -0
  63. package/dist/payment.d.ts +40 -0
  64. package/dist/payment.js +214 -0
  65. package/dist/pda.d.ts +13 -0
  66. package/dist/pda.js +36 -0
  67. package/dist/receipt-export.d.ts +55 -0
  68. package/dist/receipt-export.js +149 -0
  69. package/dist/receipt.d.ts +108 -0
  70. package/dist/receipt.js +213 -0
  71. package/dist/solana.d.ts +5 -0
  72. package/dist/solana.js +20 -0
  73. package/dist/token-capabilities.d.ts +9 -0
  74. package/dist/token-capabilities.js +139 -0
  75. package/dist/token.d.ts +18 -0
  76. package/dist/token.js +55 -0
  77. package/dist/transaction-reader.d.ts +10 -0
  78. package/dist/transaction-reader.js +18 -0
  79. package/dist/transaction-v1.d.ts +18 -0
  80. package/dist/transaction-v1.js +73 -0
  81. package/dist/types.d.ts +267 -0
  82. package/dist/types.js +1 -0
  83. package/dist/x402-adapt.d.ts +20 -0
  84. package/dist/x402-adapt.js +62 -0
  85. package/dist/x402-challenge.d.ts +116 -0
  86. package/dist/x402-challenge.js +385 -0
  87. package/dist/x402.d.ts +18 -0
  88. package/dist/x402.js +35 -0
  89. package/package.json +54 -4
@@ -0,0 +1,346 @@
1
+ import { assertDiscriminator } from "../encoding.js";
2
+ import { CARD_ACCOUNT_DISCRIMINATORS, MAX_MCCS, MAX_MEMBERS, MAX_MERCHANTS, } from "./constants.js";
3
+ import { BorshReader, BorshWriter } from "./layout.js";
4
+ /** On-chain ReservationState bytes as card_policy defines them (0 is never written). */
5
+ export const RESERVATION_STATES = { 1: "reserved", 2: "partially_captured", 3: "captured", 4: "reversed", 5: "expired" };
6
+ export function reservationStateName(state) {
7
+ return RESERVATION_STATES[state];
8
+ }
9
+ const BINDING_STATUS = ["active", "closing", "closed"];
10
+ const FREEZE_REASONS = ["none", "owner", "authorizer_safety", "recovery", "expiry"];
11
+ const RECOVERY_STATES = ["normal", "recovery_frozen", "restored_pending_reconcile"];
12
+ const INTENT_STATES = ["open", "consumed", "expired", "cancelled"];
13
+ const DISPUTE_STATES = ["none", "open", "won", "lost", "withdrawn"];
14
+ function enumValue(values, raw, name) {
15
+ const value = values[raw];
16
+ if (value === undefined)
17
+ throw new Error(`Unknown ${name} value ${raw}`);
18
+ return value;
19
+ }
20
+ function enumIndex(values, value, name) {
21
+ const index = values.indexOf(value);
22
+ if (index < 0)
23
+ throw new Error(`Unknown ${name} ${String(value)}`);
24
+ return index;
25
+ }
26
+ function currencyFromBytes(bytes) {
27
+ if (bytes.every((byte) => byte === 0))
28
+ return "";
29
+ return String.fromCharCode(...bytes);
30
+ }
31
+ export function currencyBytes(currency) {
32
+ if (currency === "")
33
+ return new Uint8Array(3);
34
+ if (!/^[A-Z]{3}$/.test(currency))
35
+ throw new Error("currency must be a 3-letter uppercase code");
36
+ return Uint8Array.from(currency, (char) => char.charCodeAt(0));
37
+ }
38
+ function bytesOf(data) {
39
+ return data instanceof Uint8Array ? data : new Uint8Array(data);
40
+ }
41
+ function header(data, discriminator, name, minLength) {
42
+ const bytes = bytesOf(data);
43
+ assertDiscriminator(bytes, discriminator, name);
44
+ if (bytes.length < minLength)
45
+ throw new Error(`${name} account data is truncated`);
46
+ return new BorshReader(bytes, 8);
47
+ }
48
+ export const CARD_BINDING_LENGTH = 8 + 1 + 32 + 32 + 1 + 32 + 32 * 3 + 1 + 8 + 1;
49
+ export function decodeCardBinding(data) {
50
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.cardBinding, "CardBinding", CARD_BINDING_LENGTH);
51
+ return {
52
+ version: r.u8("version"),
53
+ owner: r.pubkey("owner"),
54
+ cardId: r.fixed(32, "cardId"),
55
+ issuer: r.u8("issuer"),
56
+ issuerCardRefHash: r.fixed(32, "issuerCardRefHash"),
57
+ policy: r.pubkey("policy"),
58
+ period: r.pubkey("period"),
59
+ commitment: r.pubkey("commitment"),
60
+ status: enumValue(BINDING_STATUS, r.u8("status"), "binding status"),
61
+ createdAt: r.i64("createdAt"),
62
+ bump: r.u8("bump"),
63
+ };
64
+ }
65
+ export function encodeCardBinding(value) {
66
+ return new BorshWriter()
67
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.cardBinding)
68
+ .u8(value.version, "version")
69
+ .pubkey(value.owner)
70
+ .fixed(value.cardId, 32, "cardId")
71
+ .u8(value.issuer, "issuer")
72
+ .fixed(value.issuerCardRefHash, 32, "issuerCardRefHash")
73
+ .pubkey(value.policy)
74
+ .pubkey(value.period)
75
+ .pubkey(value.commitment)
76
+ .u8(enumIndex(BINDING_STATUS, value.status, "binding status"))
77
+ .i64(value.createdAt, "createdAt")
78
+ .u8(value.bump, "bump")
79
+ .toBytes();
80
+ }
81
+ const REPAYMENT_RING = 8;
82
+ const CAPTURE_RING = 8;
83
+ export const CARD_POLICY_LENGTH = 8 + 32 * 3 + 4 + 8 + 8 + 2 + 4 + 3 + 1 + 32 * MAX_MERCHANTS + 1 + 2 * MAX_MCCS + 8 + 1 + 2 + 1 + 1 + 1 + 8 + 2 + 1
84
+ + 32 * MAX_MEMBERS + MAX_MEMBERS + 32 + 8 + 8 + 1;
85
+ export function decodeCardPolicy(data) {
86
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.cardPolicy, "CardPolicy", CARD_POLICY_LENGTH);
87
+ const binding = r.pubkey("binding");
88
+ const owner = r.pubkey("owner");
89
+ const authorizer = r.pubkey("authorizer");
90
+ const policyVersion = r.u32("policyVersion");
91
+ const budgetCents = r.u64("budgetCents");
92
+ const maxPurchaseCents = r.u64("maxPurchaseCents");
93
+ const maxPurchasesPerPeriod = r.u16("maxPurchasesPerPeriod");
94
+ const periodSeconds = r.u32("periodSeconds");
95
+ const currency = currencyFromBytes(r.fixed(3, "currency"));
96
+ const merchantCount = r.u8("merchantCount");
97
+ if (merchantCount > MAX_MERCHANTS)
98
+ throw new Error("CardPolicy merchant_count exceeds capacity");
99
+ const allMerchants = Array.from({ length: MAX_MERCHANTS }, (_, i) => r.fixed(32, `merchantIdHashes[${i}]`));
100
+ const mccCount = r.u8("mccCount");
101
+ if (mccCount > MAX_MCCS)
102
+ throw new Error("CardPolicy mcc_count exceeds capacity");
103
+ const allMccs = Array.from({ length: MAX_MCCS }, (_, i) => r.u16(`mccs[${i}]`));
104
+ const expiresAt = r.i64("expiresAt");
105
+ const recurringAllowed = r.bool("recurringAllowed");
106
+ const feeBps = r.u16("feeBps");
107
+ const frozen = r.bool("frozen");
108
+ const freezeReason = enumValue(FREEZE_REASONS, r.u8("freezeReason"), "freeze reason");
109
+ const recoveryState = enumValue(RECOVERY_STATES, r.u8("recoveryState"), "recovery state");
110
+ const statementOutstandingCents = r.u64("statementOutstandingCents");
111
+ const exceptionsOpen = r.u16("exceptionsOpen");
112
+ const memberCount = r.u8("memberCount");
113
+ if (memberCount > MAX_MEMBERS)
114
+ throw new Error("CardPolicy member_count exceeds capacity");
115
+ const allMembers = Array.from({ length: MAX_MEMBERS }, (_, i) => r.pubkey(`members[${i}]`));
116
+ const allFlags = Array.from({ length: MAX_MEMBERS }, (_, i) => r.u8(`memberFlags[${i}]`));
117
+ return {
118
+ binding,
119
+ owner,
120
+ authorizer,
121
+ policyVersion,
122
+ budgetCents,
123
+ maxPurchaseCents,
124
+ maxPurchasesPerPeriod,
125
+ periodSeconds,
126
+ currency,
127
+ merchantIdHashes: allMerchants.slice(0, merchantCount),
128
+ mccs: allMccs.slice(0, mccCount),
129
+ expiresAt,
130
+ recurringAllowed,
131
+ feeBps,
132
+ frozen,
133
+ freezeReason,
134
+ recoveryState,
135
+ statementOutstandingCents,
136
+ exceptionsOpen,
137
+ members: allMembers.slice(0, memberCount).map((pubkey, i) => ({ pubkey, flags: allFlags[i] })),
138
+ ledgerHead: r.fixed(32, "ledgerHead"),
139
+ ledgerSeq: r.u64("ledgerSeq"),
140
+ commitSeq: r.u64("commitSeq"),
141
+ bump: r.u8("bump"),
142
+ ...policyTail(r),
143
+ };
144
+ }
145
+ function policyTail(r) {
146
+ if (r.remaining() < 32 + 32 * REPAYMENT_RING + 1)
147
+ return {};
148
+ const reconDigest = r.fixed(32, "reconDigest");
149
+ const ring = Array.from({ length: REPAYMENT_RING }, (_, i) => r.fixed(32, `repaymentDigests[${i}]`));
150
+ const count = Math.min(r.u8("repaymentCount"), REPAYMENT_RING);
151
+ return { tail: { reconDigest, repaymentDigests: ring.slice(0, count) } };
152
+ }
153
+ export function encodeCardPolicy(value) {
154
+ if (value.merchantIdHashes.length > MAX_MERCHANTS)
155
+ throw new Error(`At most ${MAX_MERCHANTS} merchants`);
156
+ if (value.mccs.length > MAX_MCCS)
157
+ throw new Error(`At most ${MAX_MCCS} MCCs`);
158
+ if (value.members.length > MAX_MEMBERS)
159
+ throw new Error(`At most ${MAX_MEMBERS} members`);
160
+ const w = new BorshWriter()
161
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.cardPolicy)
162
+ .pubkey(value.binding)
163
+ .pubkey(value.owner)
164
+ .pubkey(value.authorizer)
165
+ .u32(value.policyVersion, "policyVersion")
166
+ .u64(value.budgetCents, "budgetCents")
167
+ .u64(value.maxPurchaseCents, "maxPurchaseCents")
168
+ .u16(value.maxPurchasesPerPeriod, "maxPurchasesPerPeriod")
169
+ .u32(value.periodSeconds, "periodSeconds")
170
+ .fixed(currencyBytes(value.currency), 3, "currency")
171
+ .u8(value.merchantIdHashes.length);
172
+ for (let i = 0; i < MAX_MERCHANTS; i += 1)
173
+ w.fixed(value.merchantIdHashes[i] ?? new Uint8Array(32), 32, `merchantIdHashes[${i}]`);
174
+ w.u8(value.mccs.length);
175
+ for (let i = 0; i < MAX_MCCS; i += 1)
176
+ w.u16(value.mccs[i] ?? 0, `mccs[${i}]`);
177
+ w.i64(value.expiresAt, "expiresAt")
178
+ .bool(value.recurringAllowed)
179
+ .u16(value.feeBps, "feeBps")
180
+ .bool(value.frozen)
181
+ .u8(enumIndex(FREEZE_REASONS, value.freezeReason, "freeze reason"))
182
+ .u8(enumIndex(RECOVERY_STATES, value.recoveryState, "recovery state"))
183
+ .u64(value.statementOutstandingCents, "statementOutstandingCents")
184
+ .u16(value.exceptionsOpen, "exceptionsOpen")
185
+ .u8(value.members.length);
186
+ for (let i = 0; i < MAX_MEMBERS; i += 1)
187
+ w.fixed(value.members[i] ? publicKeyBytes(value.members[i].pubkey) : new Uint8Array(32), 32, `members[${i}]`);
188
+ for (let i = 0; i < MAX_MEMBERS; i += 1)
189
+ w.u8(value.members[i]?.flags ?? 0, `memberFlags[${i}]`);
190
+ return w.fixed(value.ledgerHead, 32, "ledgerHead")
191
+ .u64(value.ledgerSeq, "ledgerSeq")
192
+ .u64(value.commitSeq, "commitSeq")
193
+ .u8(value.bump, "bump")
194
+ .toBytes();
195
+ }
196
+ function publicKeyBytes(value) {
197
+ return new BorshWriter().pubkey(value).toBytes();
198
+ }
199
+ export const CARD_PERIOD_LENGTH = 8 + 32 + 4 + 8 + 8 + 8 + 8 + 8 + 2 + 8 + 1;
200
+ export function decodeCardPeriod(data) {
201
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.cardPeriod, "CardPeriod", CARD_PERIOD_LENGTH);
202
+ return {
203
+ policy: r.pubkey("policy"),
204
+ periodIndex: r.u32("periodIndex"),
205
+ periodStart: r.i64("periodStart"),
206
+ periodEnd: r.i64("periodEnd"),
207
+ capturedCents: r.u64("capturedCents"),
208
+ reservedCents: r.u64("reservedCents"),
209
+ refundedCents: r.u64("refundedCents"),
210
+ purchasesCount: r.u16("purchasesCount"),
211
+ exceptionCents: r.u64("exceptionCents"),
212
+ bump: r.u8("bump"),
213
+ };
214
+ }
215
+ export function encodeCardPeriod(value) {
216
+ return new BorshWriter()
217
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.cardPeriod)
218
+ .pubkey(value.policy)
219
+ .u32(value.periodIndex, "periodIndex")
220
+ .i64(value.periodStart, "periodStart")
221
+ .i64(value.periodEnd, "periodEnd")
222
+ .u64(value.capturedCents, "capturedCents")
223
+ .u64(value.reservedCents, "reservedCents")
224
+ .u64(value.refundedCents, "refundedCents")
225
+ .u16(value.purchasesCount, "purchasesCount")
226
+ .u64(value.exceptionCents, "exceptionCents")
227
+ .u8(value.bump, "bump")
228
+ .toBytes();
229
+ }
230
+ // ---------------------------------------------------------------- Reservation
231
+ /** Reservation.flags bits (contracts.md §1.2). */
232
+ export const RESERVATION_FLAGS = {
233
+ lateCapture: 1 << 0,
234
+ overCapture: 1 << 1,
235
+ singleMessage: 1 << 2,
236
+ recurring: 1 << 3,
237
+ };
238
+ export const RESERVATION_LENGTH = 8 + 32 + 32 + 32 + 4 + 8 * 4 + 1 + 1 + 1 + 8 + 8 + 1;
239
+ export function decodeReservation(data) {
240
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.reservation, "Reservation", RESERVATION_LENGTH);
241
+ return {
242
+ policy: r.pubkey("policy"),
243
+ authIdHash: r.fixed(32, "authIdHash"),
244
+ intent: r.pubkey("intent"),
245
+ periodIndex: r.u32("periodIndex"),
246
+ amountReservedCents: r.u64("amountReservedCents"),
247
+ capturedCents: r.u64("capturedCents"),
248
+ reversedCents: r.u64("reversedCents"),
249
+ refundedCents: r.u64("refundedCents"),
250
+ state: r.u8("state"),
251
+ disputeState: enumValue(DISPUTE_STATES, r.u8("disputeState"), "dispute state"),
252
+ flags: r.u8("flags"),
253
+ createdAt: r.i64("createdAt"),
254
+ holdExpiresAt: r.i64("holdExpiresAt"),
255
+ bump: r.u8("bump"),
256
+ ...captureTail(r),
257
+ };
258
+ }
259
+ function captureTail(r) {
260
+ if (r.remaining() < 1 + 32 * CAPTURE_RING)
261
+ return {};
262
+ const count = Math.min(r.u8("captureCount"), CAPTURE_RING);
263
+ const ring = Array.from({ length: CAPTURE_RING }, (_, i) => r.fixed(32, `captureIds[${i}]`));
264
+ if (r.remaining() < 8)
265
+ return { captureIdHashes: ring.slice(0, count) };
266
+ return { captureIdHashes: ring.slice(0, count), maxAmountCents: r.u64("maxAmountCents") };
267
+ }
268
+ export function encodeReservation(value) {
269
+ return new BorshWriter()
270
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.reservation)
271
+ .pubkey(value.policy)
272
+ .fixed(value.authIdHash, 32, "authIdHash")
273
+ .pubkey(value.intent)
274
+ .u32(value.periodIndex, "periodIndex")
275
+ .u64(value.amountReservedCents, "amountReservedCents")
276
+ .u64(value.capturedCents, "capturedCents")
277
+ .u64(value.reversedCents, "reversedCents")
278
+ .u64(value.refundedCents, "refundedCents")
279
+ .u8(value.state, "state")
280
+ .u8(enumIndex(DISPUTE_STATES, value.disputeState, "dispute state"))
281
+ .u8(value.flags, "flags")
282
+ .i64(value.createdAt, "createdAt")
283
+ .i64(value.holdExpiresAt, "holdExpiresAt")
284
+ .u8(value.bump, "bump")
285
+ .toBytes();
286
+ }
287
+ export const CHECKOUT_INTENT_LENGTH = 8 + 32 + 16 + 32 + 32 + 2 + 8 + 3 + 4 + 8 + 1 + 32 + 1;
288
+ export function decodeCheckoutIntent(data) {
289
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.checkoutIntent, "CheckoutIntent", CHECKOUT_INTENT_LENGTH);
290
+ return {
291
+ policy: r.pubkey("policy"),
292
+ intentId: r.fixed(16, "intentId"),
293
+ agent: r.pubkey("agent"),
294
+ merchantIdHash: r.fixed(32, "merchantIdHash"),
295
+ mcc: r.u16("mcc"),
296
+ maxAmountCents: r.u64("maxAmountCents"),
297
+ currency: currencyFromBytes(r.fixed(3, "currency")),
298
+ policyVersion: r.u32("policyVersion"),
299
+ expiresAt: r.i64("expiresAt"),
300
+ state: enumValue(INTENT_STATES, r.u8("state"), "intent state"),
301
+ reservation: r.pubkey("reservation"),
302
+ bump: r.u8("bump"),
303
+ };
304
+ }
305
+ export function encodeCheckoutIntent(value) {
306
+ return new BorshWriter()
307
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.checkoutIntent)
308
+ .pubkey(value.policy)
309
+ .fixed(value.intentId, 16, "intentId")
310
+ .pubkey(value.agent)
311
+ .fixed(value.merchantIdHash, 32, "merchantIdHash")
312
+ .u16(value.mcc, "mcc")
313
+ .u64(value.maxAmountCents, "maxAmountCents")
314
+ .fixed(currencyBytes(value.currency), 3, "currency")
315
+ .u32(value.policyVersion, "policyVersion")
316
+ .i64(value.expiresAt, "expiresAt")
317
+ .u8(enumIndex(INTENT_STATES, value.state, "intent state"))
318
+ .pubkey(value.reservation)
319
+ .u8(value.bump, "bump")
320
+ .toBytes();
321
+ }
322
+ export const CARD_COMMITMENT_LENGTH = 8 + 32 + 8 + 32 + 4 + 4 + 8 + 1;
323
+ export function decodeCardCommitment(data) {
324
+ const r = header(data, CARD_ACCOUNT_DISCRIMINATORS.cardCommitment, "CardCommitment", CARD_COMMITMENT_LENGTH);
325
+ return {
326
+ binding: r.pubkey("binding"),
327
+ seq: r.u64("seq"),
328
+ root: r.fixed(32, "root"),
329
+ policyVersion: r.u32("policyVersion"),
330
+ periodIndex: r.u32("periodIndex"),
331
+ writtenSlot: r.u64("writtenSlot"),
332
+ bump: r.u8("bump"),
333
+ };
334
+ }
335
+ export function encodeCardCommitment(value) {
336
+ return new BorshWriter()
337
+ .bytes(CARD_ACCOUNT_DISCRIMINATORS.cardCommitment)
338
+ .pubkey(value.binding)
339
+ .u64(value.seq, "seq")
340
+ .fixed(value.root, 32, "root")
341
+ .u32(value.policyVersion, "policyVersion")
342
+ .u32(value.periodIndex, "periodIndex")
343
+ .u64(value.writtenSlot, "writtenSlot")
344
+ .u8(value.bump, "bump")
345
+ .toBytes();
346
+ }