@inco/js 0.1.26 → 0.1.28

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.
@@ -52482,7 +52482,7 @@ class Lightning {
52482
52482
  }, covalidatorUrl);
52483
52483
  }
52484
52484
  static latestDeployment(pepper, chainId) {
52485
- const latestByPepper = lightningDeployments.find((d) => d.pepper === pepper && BigInt(d.chainId) === chainId);
52485
+ const latestByPepper = lightningDeployments.find((d) => d.pepper === pepper && BigInt(d.chainId) === BigInt(chainId));
52486
52486
  if (!latestByPepper) {
52487
52487
  throw new Error(`No deployment found for pepper ${pepper}`);
52488
52488
  }
@@ -71306,7 +71306,7 @@ class Lightning {
71306
71306
  }, covalidatorUrl);
71307
71307
  }
71308
71308
  static latestDeployment(pepper, chainId) {
71309
- const latestByPepper = lightningDeployments.find((d) => d.pepper === pepper && BigInt(d.chainId) === chainId);
71309
+ const latestByPepper = lightningDeployments.find((d) => d.pepper === pepper && BigInt(d.chainId) === BigInt(chainId));
71310
71310
  if (!latestByPepper) {
71311
71311
  throw new Error(`No deployment found for pepper ${pepper}`);
71312
71312
  }
@@ -4,11 +4,13 @@ import { EciesScheme } from '../encryption';
4
4
  import { lightningDeployments } from '../generated/lightning';
5
5
  import type { Reencryptor } from '../reencryption';
6
6
  type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
7
- type ToBigInt<T extends string> = T extends `${infer N extends bigint}` ? N : never;
8
- type ValuesToBigInt<T> = {
9
- [K in keyof T]: T[K] extends string ? ToBigInt<T[K]> : never;
7
+ type ToBigInt<T extends number | string | bigint> = `${T}` extends `${infer N extends bigint}` ? N : never;
8
+ type ToNumber<T extends number | string | bigint> = `${T}` extends `${infer N extends number}` ? N : never;
9
+ type Numberish<T extends number | string | bigint> = T | ToBigInt<T> | ToNumber<T>;
10
+ type ValuesToNumberish<T> = {
11
+ [K in keyof T]: T[K] extends string ? Numberish<T[K]> : never;
10
12
  };
11
- type DistributedToBigInt<T, K> = T extends infer U ? K extends keyof U ? Omit<U, K> & (ValuesToBigInt<Pick<U, K>> | Pick<U, K>) : never : never;
13
+ type DistributedToBigInt<T, K> = T extends infer U ? K extends keyof U ? Omit<U, K> & (ValuesToNumberish<Pick<U, K>> | Pick<U, K>) : never : never;
12
14
  type Deployment = TupleToUnion<typeof lightningDeployments>;
13
15
  type DeploymentWithBigIntChainId = DistributedToBigInt<Deployment, 'chainId'>;
14
16
  type DistributedPick<T, K> = T extends any ? Pick<T, Extract<keyof T, K>> : never;
@@ -16,7 +18,7 @@ export type DeploymentByName = DistributedPick<DeploymentWithBigIntChainId, 'nam
16
18
  export type DeploymentByExecutor = DistributedPick<DeploymentWithBigIntChainId, 'executorAddress' | 'chainId'>;
17
19
  export type DeploymentId = DeploymentByName | DeploymentByExecutor;
18
20
  export type Pepper = Deployment['pepper'];
19
- export type ChainId = ToBigInt<Deployment['chainId']>;
21
+ export type ChainId = Numberish<Deployment['chainId']>;
20
22
  export type SupportedNativeType = boolean | bigint | number;
21
23
  export type EncryptionContext = {
22
24
  accountAddress: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inco/js",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "scripts": {
6
6
  "test": "bun run lint && bun run test:tsc && bun run test:unit",