@misofm/api-client 0.5.2 → 0.5.3

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/schemas.d.ts CHANGED
@@ -1007,6 +1007,8 @@ export declare const balanceSchema: z.ZodObject<{
1007
1007
  address: z.ZodString;
1008
1008
  coinType: z.ZodString;
1009
1009
  balance: z.ZodString;
1010
+ coinBalance: z.ZodString;
1011
+ addressBalance: z.ZodString;
1010
1012
  decimals: z.ZodNumber;
1011
1013
  }, z.core.$strip>;
1012
1014
  export declare const ownershipSchema: z.ZodObject<{
package/dist/schemas.js CHANGED
@@ -276,12 +276,30 @@ export const workDetailSchema = ownedWorkSchema.extend({
276
276
  discCount: z.number().int().min(0).optional(),
277
277
  trackCount: z.number().int().min(0).optional(),
278
278
  });
279
- export const balanceSchema = z.object({
279
+ export const balanceSchema = z
280
+ .object({
280
281
  address: suiIdSchema,
281
282
  coinType: z.string(),
282
- /** Base units. Totals coin objects AND the address balance. */
283
+ /** Base units. `coinBalance + addressBalance`. */
283
284
  balance: u64Schema,
285
+ /** Base units held in address-owned `Coin<T>` objects. */
286
+ coinBalance: u64Schema,
287
+ /** Base units held in the address balance and available to `FundsWithdrawal`. */
288
+ addressBalance: u64Schema,
284
289
  decimals: z.number().int().min(0).max(18),
290
+ })
291
+ .superRefine((value, context) => {
292
+ if (![value.balance, value.coinBalance, value.addressBalance].every((part) => /^\d+$/.test(part))) {
293
+ return;
294
+ }
295
+ if (BigInt(value.coinBalance) + BigInt(value.addressBalance) !==
296
+ BigInt(value.balance)) {
297
+ context.addIssue({
298
+ code: "custom",
299
+ path: ["balance"],
300
+ message: "expected coinBalance + addressBalance to equal balance",
301
+ });
302
+ }
285
303
  });
286
304
  export const ownershipSchema = z.object({
287
305
  address: suiIdSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misofm/api-client",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Typed client and response contract for the Miso API read layer. The one definition of what a Miso read returns.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {