@gibs/common 1.7.1 → 1.7.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.
@@ -1,5 +1,6 @@
1
1
  import { type Chain, type PublicClient, type Hex, type Abi } from 'viem';
2
2
  import type { Call } from './types.js';
3
+ /** The multicall for the given chain, client, abi, calls, and target */
3
4
  export declare const multicallRead: <T>({ chain, client, abi, calls, target, }: {
4
5
  chain: Chain;
5
6
  client: PublicClient;
@@ -1,4 +1,5 @@
1
1
  import { getContract, encodeFunctionData, decodeFunctionResult, multicall3Abi, } from 'viem';
2
+ /** The multicall for the given chain, client, abi, calls, and target */
2
3
  export const multicallRead = async ({ chain, client, abi, calls, target, }) => {
3
4
  const multicall = getContract({
4
5
  abi: multicall3Abi,
@@ -3,7 +3,10 @@ type SerializedBigInt = {
3
3
  __type__: typeof BIGINT_TYPE;
4
4
  value: string;
5
5
  };
6
+ /** The json any stringify for the given key and value */
6
7
  export declare const jsonAnyStringify: (key: string, value: unknown) => unknown;
8
+ /** The is serialized big int for the given value */
7
9
  export declare const isSerializedBigInt: (value: unknown) => value is SerializedBigInt;
10
+ /** The json any parse for the given key and value */
8
11
  export declare const jsonAnyParse: (_key: string, value: unknown) => unknown;
9
12
  export {};
@@ -1,4 +1,5 @@
1
1
  const BIGINT_TYPE = 'bigint';
2
+ /** The json any stringify for the given key and value */
2
3
  export const jsonAnyStringify = (key, value) => {
3
4
  if (typeof value === BIGINT_TYPE) {
4
5
  return {
@@ -8,9 +9,11 @@ export const jsonAnyStringify = (key, value) => {
8
9
  }
9
10
  return value;
10
11
  };
12
+ /** The is serialized big int for the given value */
11
13
  export const isSerializedBigInt = (value) => {
12
14
  return (!!value && typeof value === 'object' && value.__type__ === BIGINT_TYPE);
13
15
  };
16
+ /** The json any parse for the given key and value */
14
17
  export const jsonAnyParse = (_key, value) => {
15
18
  if (isSerializedBigInt(value)) {
16
19
  return BigInt(value.value);
@@ -1,4 +1,5 @@
1
1
  import type { Abi, Hex } from "viem";
2
+ /** The inputs for a multicall read */
2
3
  export type Call = {
3
4
  allowFailure?: boolean;
4
5
  functionName: string;
@@ -6,4 +7,5 @@ export type Call = {
6
7
  abi?: Abi;
7
8
  args?: (bigint | Hex | Hex[] | bigint[] | string | string[])[];
8
9
  };
10
+ /** The erc20 metadata */
9
11
  export type Erc20Metadata = [string, string, number];