@dappworks/kit 0.4.141 → 0.4.142

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 (43) hide show
  1. package/dist/{PromiseState-b0cc408e.d.ts → PromiseState-yojg0WLR.d.ts} +3 -3
  2. package/dist/aiem.d.mts +6 -3
  3. package/dist/aiem.mjs +31 -44
  4. package/dist/aiem.mjs.map +1 -1
  5. package/dist/{chunk-WYGQ3Y4R.mjs → chunk-AIZ7XDNV.mjs} +14 -14
  6. package/dist/chunk-AIZ7XDNV.mjs.map +1 -0
  7. package/dist/{chunk-WT2ARRCR.mjs → chunk-HRYH37UI.mjs} +2 -2
  8. package/dist/{chunk-PPYYRQDD.mjs → chunk-QWHU3HBK.mjs} +2 -2
  9. package/dist/{chunk-6F7H4PAA.mjs → chunk-R4SQKVDQ.mjs} +1 -1
  10. package/dist/{chunk-7FF4BCFW.mjs → chunk-SVPD6PC6.mjs} +4 -4
  11. package/dist/{chunk-DZMNL4BZ.mjs → chunk-WS43BV7Y.mjs} +2 -2
  12. package/dist/{chunk-HRWHDF2F.mjs → chunk-XJMRAPHI.mjs} +7 -7
  13. package/dist/{chunk-HRWHDF2F.mjs.map → chunk-XJMRAPHI.mjs.map} +1 -1
  14. package/dist/dev.d.mts +1 -1
  15. package/dist/dev.mjs +2 -2
  16. package/dist/experimental.d.mts +2 -2
  17. package/dist/experimental.mjs +3 -3
  18. package/dist/form.d.mts +5 -5
  19. package/dist/form.mjs +4 -4
  20. package/dist/{index-38be834f.d.ts → index-CUKoRIdy.d.ts} +1 -1
  21. package/dist/index.d.mts +4 -4
  22. package/dist/index.mjs +5 -5
  23. package/dist/inspector.d.mts +1 -1
  24. package/dist/inspector.mjs +1 -1
  25. package/dist/jsontable.d.mts +2 -2
  26. package/dist/jsontable.mjs +4 -4
  27. package/dist/metrics.d.mts +1 -1
  28. package/dist/metrics.mjs +4 -4
  29. package/dist/plugins.d.mts +7 -33
  30. package/dist/plugins.mjs +34 -163
  31. package/dist/plugins.mjs.map +1 -1
  32. package/dist/{root-766ae985.d.ts → root-C3lZnoCI.d.ts} +1 -1
  33. package/dist/ui.mjs +3 -3
  34. package/dist/utils.d.mts +8 -3
  35. package/dist/utils.mjs +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-WYGQ3Y4R.mjs.map +0 -1
  38. /package/dist/{PaginationState-c19e621a.d.ts → PaginationState-Bmrrw0ky.d.ts} +0 -0
  39. /package/dist/{chunk-WT2ARRCR.mjs.map → chunk-HRYH37UI.mjs.map} +0 -0
  40. /package/dist/{chunk-PPYYRQDD.mjs.map → chunk-QWHU3HBK.mjs.map} +0 -0
  41. /package/dist/{chunk-6F7H4PAA.mjs.map → chunk-R4SQKVDQ.mjs.map} +0 -0
  42. /package/dist/{chunk-7FF4BCFW.mjs.map → chunk-SVPD6PC6.mjs.map} +0 -0
  43. /package/dist/{chunk-DZMNL4BZ.mjs.map → chunk-WS43BV7Y.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'events';
2
- import { c as BooleanState, B as BaseState } from './root-766ae985.js';
2
+ import { c as BooleanState, B as BaseState } from './root-C3lZnoCI.js';
3
3
 
4
4
  interface Events {
5
5
  data: (data: any) => void;
@@ -22,10 +22,10 @@ declare class PromiseState<T extends (...args: any[]) => Promise<any>, U = Retur
22
22
  successMsg: string;
23
23
  errMsg: string;
24
24
  loadingLock: boolean;
25
- event: EventEmitter;
25
+ event: EventEmitter<[never]>;
26
26
  on<E extends keyof Events>(event: E, listener: Events[E]): this;
27
27
  once<E extends keyof Events>(event: E, listener: Events[E]): this;
28
- use<E extends keyof Events>(event: E, listener: Events[E]): () => EventEmitter;
28
+ use<E extends keyof Events>(event: E, listener: Events[E]): () => EventEmitter<[never]>;
29
29
  emit<E extends keyof Events>(event: E, ...args: Parameters<Events[E]>): void;
30
30
  init: () => Promise<void>;
31
31
  currentIndex: BaseState;
package/dist/aiem.d.mts CHANGED
@@ -18,6 +18,9 @@ declare class Cache {
18
18
  kv: TTLCache<string, any>;
19
19
  wrap<T>(key: string, fn: () => T | Promise<T>, config?: TTLCache.Options<any, any>): T | Promise<T>;
20
20
  }
21
+ type GetOptions = {
22
+ multicall?: boolean;
23
+ };
21
24
  declare class AIem<Contracts extends Record<string, Abi>, Chains extends Record<string, Chain>, Addrs extends {
22
25
  [K in keyof Contracts]?: {
23
26
  [key: string]: `${string}-0x${string}`;
@@ -69,7 +72,7 @@ declare class AIem<Contracts extends Record<string, Abi>, Chains extends Record<
69
72
  }>(args: Pick<AIem<Contracts, Chains, Addrs>, "contractMap" | "chainMap" | "nameMap" | "getWallet" | "cache" | "funcMap">): AIem<Contracts, Chains, Addrs>;
70
73
  constructor(args?: Pick<AIem<Contracts, Chains, Addrs>, "contractMap" | "chainMap" | "nameMap" | "getWallet" | "cache" | "funcMap">);
71
74
  static PubClient(chainId: string): PublicClient<HttpTransport, Chain, any, any>;
72
- PubClient<C extends keyof Chains>(chainId: C): PublicClient<HttpTransport, Chain, any, any>;
75
+ PubClient<C extends keyof Chains>(chainId: C, options?: GetOptions): PublicClient<HttpTransport, Chain, any, any>;
73
76
  Get<K extends keyof Contracts, C extends keyof Chains, Addr extends `0x${string}`>(contractName: K, chainId: C, address: Addr): GetContractReturnType<Contracts[K], PublicClient<HttpTransport, Chain, any, any>> & {
74
77
  encode: GetContractReturnType<Contracts[K], WalletClient<HttpTransport, Chain, Account, any>>["write"];
75
78
  };
@@ -82,7 +85,7 @@ declare class AIem<Contracts extends Record<string, Abi>, Chains extends Record<
82
85
  abi: any;
83
86
  }): any;
84
87
  static init(): AIem<any, any, any>;
85
- static Get<TAbi extends Abi = any, ReturnType extends GetContractReturnType<TAbi, WalletClient<Transport, Chain, Account>>>(abi: TAbi, chainId: any, address: any, wallet?: WalletClient): ReturnType & {
88
+ static Get<TAbi extends Abi = any, ReturnType extends GetContractReturnType<TAbi, WalletClient<Transport, Chain, Account>>>(abi: TAbi, chainId: any, address: any, wallet?: WalletClient, options?: GetOptions): ReturnType & {
86
89
  encode: ReturnType["write"];
87
90
  };
88
91
  static getPrice({ chainId, address }: {
@@ -115,4 +118,4 @@ type QueryReturnType<E, S extends QuerySelect<E>> = {
115
118
  [K in keyof E]: K extends keyof S ? E[K] extends (...args: any[]) => any ? Awaited<ReturnType<E[K]>> : E[K] extends object ? S[K] extends object ? QueryReturnType<E[K], S[K]> : E[K] : E[K] : E[K];
116
119
  };
117
120
 
118
- export { AIem, Cache, Fields, Item, QueryReturnType };
121
+ export { AIem, Cache, Fields, type GetOptions, type Item, type QueryReturnType };
package/dist/aiem.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import './chunk-7MDKCI65.mjs';
2
2
  import { helper } from './chunk-Q3AD5RHQ.mjs';
3
3
  import './chunk-MGU3KYGC.mjs';
4
- import { __spreadProps, __spreadValues, __objRest } from './chunk-6F7H4PAA.mjs';
4
+ import { __spreadProps, __spreadValues, __objRest } from './chunk-R4SQKVDQ.mjs';
5
5
  import { createPublicClient, http, getContract, encodeFunctionData } from 'viem';
6
6
  import { iotexTestnet, mainnet, iotex, bsc, polygon } from 'viem/chains';
7
7
  import TTLCache from '@isaacs/ttlcache';
@@ -374,7 +374,7 @@ var Reflect2;
374
374
  case 5:
375
375
  return input;
376
376
  }
377
- var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
377
+ var hint = "string" ;
378
378
  var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
379
379
  if (exoticToPrim !== void 0) {
380
380
  var result = exoticToPrim.call(input, hint);
@@ -382,10 +382,10 @@ var Reflect2;
382
382
  throw new TypeError();
383
383
  return result;
384
384
  }
385
- return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
385
+ return OrdinaryToPrimitive(input);
386
386
  }
387
387
  function OrdinaryToPrimitive(O, hint) {
388
- if (hint === "string") {
388
+ var valueOf, result; {
389
389
  var toString_1 = O.toString;
390
390
  if (IsCallable(toString_1)) {
391
391
  var result = toString_1.call(O);
@@ -398,19 +398,6 @@ var Reflect2;
398
398
  if (!IsObject(result))
399
399
  return result;
400
400
  }
401
- } else {
402
- var valueOf = O.valueOf;
403
- if (IsCallable(valueOf)) {
404
- var result = valueOf.call(O);
405
- if (!IsObject(result))
406
- return result;
407
- }
408
- var toString_2 = O.toString;
409
- if (IsCallable(toString_2)) {
410
- var result = toString_2.call(O);
411
- if (!IsObject(result))
412
- return result;
413
- }
414
401
  }
415
402
  throw new TypeError();
416
403
  }
@@ -422,10 +409,7 @@ var Reflect2;
422
409
  }
423
410
  function ToPropertyKey(argument) {
424
411
  var key = ToPrimitive(
425
- argument,
426
- 3
427
- /* String */
428
- );
412
+ argument);
429
413
  if (IsSymbol(key))
430
414
  return key;
431
415
  return ToString(key);
@@ -807,29 +791,29 @@ var Reflect2;
807
791
  var FIELD_KEY = Symbol("aiem_field");
808
792
  var metadataCache = /* @__PURE__ */ new WeakMap();
809
793
  var Fields = class _Fields {
810
- static hide(options = {}) {
794
+ static hide(options2 = {}) {
811
795
  return function(target, propertyKey, descriptor) {
812
- _Fields.setMetadata(target, propertyKey, { type: "hide", options });
796
+ _Fields.setMetadata(target, propertyKey, { type: "hide", options: options2 });
813
797
  };
814
798
  }
815
- static read(options = {}) {
799
+ static read(options2 = {}) {
816
800
  return function(target, propertyKey, descriptor) {
817
- _Fields.setMetadata(target, propertyKey, { type: "read", options });
801
+ _Fields.setMetadata(target, propertyKey, { type: "read", options: options2 });
818
802
  };
819
803
  }
820
- static write(options = {}) {
804
+ static write(options2 = {}) {
821
805
  return function(target, propertyKey, descriptor) {
822
- _Fields.setMetadata(target, propertyKey, { type: "write", options });
806
+ _Fields.setMetadata(target, propertyKey, { type: "write", options: options2 });
823
807
  };
824
808
  }
825
- static custom(options = {}) {
809
+ static custom(options2 = {}) {
826
810
  return function(target, propertyKey, descriptor) {
827
- _Fields.setMetadata(target, propertyKey, { type: "custom", options });
811
+ _Fields.setMetadata(target, propertyKey, { type: "custom", options: options2 });
828
812
  };
829
813
  }
830
- static contract(entity, options) {
814
+ static contract(entity, options2) {
831
815
  return function(target, propertyKey, descriptor) {
832
- _Fields.setMetadata(target, propertyKey, { type: "contract", entity, targetKey: options });
816
+ _Fields.setMetadata(target, propertyKey, { type: "contract", entity, targetKey: options2 });
833
817
  };
834
818
  }
835
819
  static setMetadata(target, propertyKey, metadata) {
@@ -955,17 +939,19 @@ var _AIem = class _AIem {
955
939
  static PubClient(chainId) {
956
940
  return this.init().PubClient(chainId);
957
941
  }
958
- PubClient(chainId) {
959
- return this._cache.wrap(`publicClient-${String(chainId)}`, () => {
960
- return createPublicClient({
942
+ PubClient(chainId, options2) {
943
+ return this._cache.wrap(`publicClient-${String(chainId)}-${options2.multicall}`, () => {
944
+ return createPublicClient(__spreadProps(__spreadValues({
961
945
  //@ts-ignore
962
- chain: this.chainMap[chainId],
946
+ chain: this.chainMap[chainId]
947
+ }, options2.multicall ? {
963
948
  batch: {
964
949
  multicall: true
965
- },
950
+ }
951
+ } : {}), {
966
952
  //@ts-ignore
967
953
  transport: http()
968
- });
954
+ }));
969
955
  });
970
956
  }
971
957
  //@ts-ignore
@@ -974,7 +960,7 @@ var _AIem = class _AIem {
974
960
  const cacheKey = `contract ${chainId}-${address}-${wallet ? wallet.account.address : null}`;
975
961
  return this._cache.wrap(cacheKey, () => {
976
962
  const contract = this.contractMap[contractName];
977
- const pubClient = this.PubClient(chainId);
963
+ const pubClient = this.PubClient(chainId, options);
978
964
  return this.getContract({
979
965
  client: {
980
966
  //@ts-ignore
@@ -1042,11 +1028,11 @@ var _AIem = class _AIem {
1042
1028
  return globalThis.aiem;
1043
1029
  }
1044
1030
  //@ts-ignore
1045
- static Get(abi, chainId, address, wallet) {
1031
+ static Get(abi, chainId, address, wallet, options2) {
1046
1032
  const aiem = this.init();
1047
1033
  const cacheKey = `contract ${chainId}-${address}-${wallet ? wallet.account.address : null}`;
1048
1034
  return aiem._cache.wrap(cacheKey, () => {
1049
- const pubClient = aiem.PubClient(chainId);
1035
+ const pubClient = aiem.PubClient(chainId, options2);
1050
1036
  return aiem.getContract({
1051
1037
  client: {
1052
1038
  //@ts-ignore
@@ -1093,15 +1079,16 @@ var _AIem = class _AIem {
1093
1079
  for (const key in sel) {
1094
1080
  const fieldMetadata = getFieldMetadata(obj, key);
1095
1081
  let call;
1082
+ const enableMulticall = entity.multicall == false ? false : true;
1096
1083
  if (sel[key] == false) {
1097
1084
  call = async () => null;
1098
1085
  } else if (fieldMetadata) {
1099
1086
  switch (fieldMetadata.type) {
1100
1087
  case "read":
1101
1088
  if (Array.isArray(sel[key])) {
1102
- call = () => this.Get(entity.abi, instance.chainId, instance.address).read[key](sel[key]);
1089
+ call = () => this.Get(entity.abi, instance.chainId, instance.address, null, { multicall: enableMulticall }).read[key](sel[key]);
1103
1090
  } else {
1104
- call = () => this.Get(entity.abi, instance.chainId, instance.address).read[key]();
1091
+ call = () => this.Get(entity.abi, instance.chainId, instance.address, null, { multicall: enableMulticall }).read[key]();
1105
1092
  }
1106
1093
  break;
1107
1094
  case "write":
@@ -1121,13 +1108,13 @@ var _AIem = class _AIem {
1121
1108
  if ((_a = targetMetadata == null ? void 0 : targetMetadata.options) == null ? void 0 : _a.ttl) {
1122
1109
  const cacheKey = `call ${instance.chainId}-${instance.address}-${fieldMetadata.targetKey}`;
1123
1110
  call = () => new Promise(async (resolve) => {
1124
- const address = await this.cache.wrap(cacheKey, async () => this.Get(entity.abi, instance.chainId, instance.address).read[fieldMetadata.targetKey]());
1111
+ const address = await this.cache.wrap(cacheKey, async () => this.Get(entity.abi, instance.chainId, instance.address, null, { multicall: enableMulticall }).read[fieldMetadata.targetKey]());
1125
1112
  resolve(this.Query(fieldMetadata.entity(), sel[key])({ address, chainId: instance.chainId }));
1126
1113
  });
1127
1114
  } else {
1128
1115
  call = () => (
1129
1116
  //@ts-ignore
1130
- this.Get(entity.abi, instance.chainId, instance.address).read[fieldMetadata.targetKey]().then((address) => {
1117
+ this.Get(entity.abi, instance.chainId, instance.address, null, { multicall: enableMulticall }).read[fieldMetadata.targetKey]().then((address) => {
1131
1118
  return this.Query(fieldMetadata.entity(), sel[key])({ address, chainId: instance.chainId });
1132
1119
  })
1133
1120
  );