@dappworks/kit 0.4.155 → 0.4.156
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.
- package/dist/{PromiseState-23a1c20b.d.ts → PromiseState-DdfQCVl2.d.ts} +3 -3
- package/dist/aiem.d.mts +7 -4
- package/dist/aiem.mjs +22 -35
- package/dist/aiem.mjs.map +1 -1
- package/dist/{chunk-J5PZWR2P.mjs → chunk-3O7QI47S.mjs} +2 -2
- package/dist/{chunk-SYQNMCVQ.mjs → chunk-5BJM6R2E.mjs} +4 -4
- package/dist/{chunk-WYGQ3Y4R.mjs → chunk-AIZ7XDNV.mjs} +14 -14
- package/dist/chunk-AIZ7XDNV.mjs.map +1 -0
- package/dist/{chunk-ISMCID4L.mjs → chunk-NWJBLIGQ.mjs} +2 -2
- package/dist/{chunk-6F7H4PAA.mjs → chunk-R4SQKVDQ.mjs} +1 -1
- package/dist/{chunk-IDKGZ5T4.mjs → chunk-XSGTWROT.mjs} +7 -7
- package/dist/{chunk-IDKGZ5T4.mjs.map → chunk-XSGTWROT.mjs.map} +1 -1
- package/dist/dev.d.mts +1 -1
- package/dist/dev.mjs +2 -2
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.mjs +3 -3
- package/dist/form.d.mts +5 -5
- package/dist/form.mjs +3 -3
- package/dist/{index-38be834f.d.ts → index-CUKoRIdy.d.ts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/inspector.d.mts +1 -1
- package/dist/inspector.mjs +1 -1
- package/dist/jsontable.d.mts +2 -2
- package/dist/jsontable.mjs +4 -4
- package/dist/metrics.d.mts +1 -1
- package/dist/metrics.mjs +4 -4
- package/dist/plugins.d.mts +3 -3
- package/dist/plugins.mjs +3 -3
- package/dist/{root-766ae985.d.ts → root-C3lZnoCI.d.ts} +1 -1
- package/dist/ui.mjs +3 -3
- package/dist/utils.d.mts +8 -3
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-WYGQ3Y4R.mjs.map +0 -1
- /package/dist/{PaginationState-c19e621a.d.ts → PaginationState-Bmrrw0ky.d.ts} +0 -0
- /package/dist/{chunk-J5PZWR2P.mjs.map → chunk-3O7QI47S.mjs.map} +0 -0
- /package/dist/{chunk-SYQNMCVQ.mjs.map → chunk-5BJM6R2E.mjs.map} +0 -0
- /package/dist/{chunk-ISMCID4L.mjs.map → chunk-NWJBLIGQ.mjs.map} +0 -0
- /package/dist/{chunk-6F7H4PAA.mjs.map → chunk-R4SQKVDQ.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { c as BooleanState, B as BaseState } from './root-
|
|
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,8 +72,8 @@ 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>;
|
|
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>> & {
|
|
75
|
+
PubClient<C extends keyof Chains>(chainId: C, options?: GetOptions): PublicClient<HttpTransport, Chain, any, any>;
|
|
76
|
+
Get<K extends keyof Contracts, C extends keyof Chains, Addr extends `0x${string}`>(contractName: K, chainId: C, address: Addr, options?: GetOptions): GetContractReturnType<Contracts[K], PublicClient<HttpTransport, Chain, any, any>> & {
|
|
74
77
|
encode: GetContractReturnType<Contracts[K], WalletClient<HttpTransport, Chain, Account, any>>["write"];
|
|
75
78
|
};
|
|
76
79
|
getContract({ client, address, abi, }: {
|
|
@@ -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-UPGWJHSO.mjs';
|
|
3
3
|
import './chunk-K7LFG5BA.mjs';
|
|
4
|
-
import { __spreadProps, __spreadValues, __objRest } from './chunk-
|
|
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 =
|
|
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
|
|
385
|
+
return OrdinaryToPrimitive(input);
|
|
386
386
|
}
|
|
387
387
|
function OrdinaryToPrimitive(O, hint) {
|
|
388
|
-
|
|
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);
|
|
@@ -955,26 +939,28 @@ 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, options = { multicall: true }) {
|
|
943
|
+
return this._cache.wrap(`publicClient-${String(chainId)}-${options == null ? void 0 : options.multicall}`, () => {
|
|
944
|
+
return createPublicClient(__spreadProps(__spreadValues({
|
|
961
945
|
//@ts-ignore
|
|
962
|
-
chain: this.chainMap[chainId]
|
|
946
|
+
chain: this.chainMap[chainId]
|
|
947
|
+
}, (options == null ? void 0 : options.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
|
|
972
|
-
Get(contractName, chainId, address) {
|
|
958
|
+
Get(contractName, chainId, address, options = { multicall: true }) {
|
|
973
959
|
const wallet = this.getWallet ? this.getWallet() : null;
|
|
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, options = { multicall: true }) {
|
|
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, options);
|
|
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
|
);
|