@daimo/pay-common 1.16.1 → 1.16.2

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.
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.zSolanaPublicKey = exports.zHex = exports.zAddress = exports.zUUID = exports.zBigIntStr = void 0;
4
+ const viem_1 = require("viem");
4
5
  const zod_1 = require("zod");
5
6
  exports.zBigIntStr = zod_1.z
6
7
  .string()
7
8
  .regex(/^[0-9]+$/i)
8
9
  .refine((s) => true);
9
10
  exports.zUUID = zod_1.z.string().uuid();
10
- exports.zAddress = zod_1.z
11
- .string()
12
- .regex(/^0x[0-9a-f]{40}$/i)
13
- .refine((s) => true);
11
+ exports.zAddress = zod_1.z.string().transform((val) => (0, viem_1.getAddress)(val));
14
12
  exports.zHex = zod_1.z
15
13
  .string()
16
14
  .regex(/^0x[0-9a-f]*$/i)
@@ -1 +1 @@
1
- {"version":3,"file":"primitiveTypes.js","sourceRoot":"","sources":["../src/primitiveTypes.ts"],"names":[],"mappings":";;;AACA,6BAAwB;AAEX,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,EAAE;KACR,KAAK,CAAC,WAAW,CAAC;KAClB,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;AAI1B,QAAA,KAAK,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAI1B,QAAA,QAAQ,GAAG,OAAC;KACtB,MAAM,EAAE;KACR,KAAK,CAAC,mBAAmB,CAAC;KAC1B,MAAM,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,IAAI,CAAC,CAAC;AAExB,QAAA,IAAI,GAAG,OAAC;KAClB,MAAM,EAAE;KACR,KAAK,CAAC,gBAAgB,CAAC;KACvB,MAAM,CAAC,CAAC,CAAC,EAAY,EAAE,CAAC,IAAI,CAAC,CAAC;AAEpB,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"primitiveTypes.js","sourceRoot":"","sources":["../src/primitiveTypes.ts"],"names":[],"mappings":";;;AAAA,+BAAuC;AACvC,6BAAwB;AAEX,QAAA,UAAU,GAAG,OAAC;KACxB,MAAM,EAAE;KACR,KAAK,CAAC,WAAW,CAAC;KAClB,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;AAI1B,QAAA,KAAK,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;AAI1B,QAAA,QAAQ,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iBAAU,EAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,QAAA,IAAI,GAAG,OAAC;KAClB,MAAM,EAAE;KACR,KAAK,CAAC,gBAAgB,CAAC;KACvB,MAAM,CAAC,CAAC,CAAC,EAAY,EAAE,CAAC,IAAI,CAAC,CAAC;AAEpB,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daimo/pay-common",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "Daimo Pay shared types and utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { Address, Hex } from "viem";
1
+ import { getAddress, Hex } from "viem";
2
2
  import { z } from "zod";
3
3
 
4
4
  export const zBigIntStr = z
@@ -12,10 +12,7 @@ export const zUUID = z.string().uuid();
12
12
 
13
13
  export type UUID = z.infer<typeof zUUID>;
14
14
 
15
- export const zAddress = z
16
- .string()
17
- .regex(/^0x[0-9a-f]{40}$/i)
18
- .refine((s): s is Address => true);
15
+ export const zAddress = z.string().transform((val) => getAddress(val));
19
16
 
20
17
  export const zHex = z
21
18
  .string()