@dappworks/kit 0.4.144 → 0.4.145

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