@dappworks/kit 0.5.40 → 0.5.41

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 (51) hide show
  1. package/dist/PaginationState-c19e621a.d.ts +17 -0
  2. package/dist/PromiseState-e64b3707.d.ts +57 -0
  3. package/dist/StorageState-cfd942cb.d.ts +48 -0
  4. package/dist/aiem.d.mts +168 -0
  5. package/dist/aiem.mjs +2 -2
  6. package/dist/{chunk-O3FWAAEG.mjs → chunk-3XIPR2M3.mjs} +2 -2
  7. package/dist/{chunk-2WRRZVUW.mjs → chunk-4F33QAJ4.mjs} +5 -5
  8. package/dist/{chunk-R4SQKVDQ.mjs → chunk-6F7H4PAA.mjs} +1 -1
  9. package/dist/{chunk-PZ3VSAOC.mjs → chunk-C5BPNLKH.mjs} +3 -3
  10. package/dist/{chunk-QA3E2PJT.mjs → chunk-FJHGIW3I.mjs} +2 -2
  11. package/dist/{chunk-XSGTWROT.mjs → chunk-IDKGZ5T4.mjs} +7 -7
  12. package/dist/{chunk-XSGTWROT.mjs.map → chunk-IDKGZ5T4.mjs.map} +1 -1
  13. package/dist/{chunk-MPNSYZJU.mjs → chunk-ISV4OEKJ.mjs} +4 -4
  14. package/dist/{chunk-2HNXZE3X.mjs → chunk-M5Y3VYMJ.mjs} +373 -396
  15. package/dist/chunk-M5Y3VYMJ.mjs.map +1 -0
  16. package/dist/{chunk-B7RV4C5E.mjs → chunk-SL5OV6OR.mjs} +2 -2
  17. package/dist/dev.d.mts +26 -0
  18. package/dist/dev.mjs +2 -2
  19. package/dist/experimental.d.mts +190 -0
  20. package/dist/experimental.mjs +3 -3
  21. package/dist/form.d.mts +384 -0
  22. package/dist/form.mjs +3 -3
  23. package/dist/index-38be834f.d.ts +3 -0
  24. package/dist/index.d.mts +90 -0
  25. package/dist/index.mjs +6 -6
  26. package/dist/inspector.d.mts +15 -0
  27. package/dist/inspector.mjs +1 -1
  28. package/dist/jsoncomponent.d.mts +22 -0
  29. package/dist/jsoncomponent.mjs +1 -1
  30. package/dist/jsontable.d.mts +126 -0
  31. package/dist/jsontable.mjs +4 -4
  32. package/dist/metrics.d.mts +121 -0
  33. package/dist/metrics.mjs +4 -4
  34. package/dist/plugins.d.mts +118 -0
  35. package/dist/plugins.mjs +5 -5
  36. package/dist/root-218afa4f.d.ts +111 -0
  37. package/dist/ui.d.mts +29 -0
  38. package/dist/ui.mjs +3 -3
  39. package/dist/utils.d.mts +148 -0
  40. package/dist/utils.mjs +1 -1
  41. package/dist/wallet.d.mts +196 -0
  42. package/dist/wallet.mjs +7 -7
  43. package/package.json +2 -2
  44. package/dist/chunk-2HNXZE3X.mjs.map +0 -1
  45. /package/dist/{chunk-O3FWAAEG.mjs.map → chunk-3XIPR2M3.mjs.map} +0 -0
  46. /package/dist/{chunk-2WRRZVUW.mjs.map → chunk-4F33QAJ4.mjs.map} +0 -0
  47. /package/dist/{chunk-R4SQKVDQ.mjs.map → chunk-6F7H4PAA.mjs.map} +0 -0
  48. /package/dist/{chunk-PZ3VSAOC.mjs.map → chunk-C5BPNLKH.mjs.map} +0 -0
  49. /package/dist/{chunk-QA3E2PJT.mjs.map → chunk-FJHGIW3I.mjs.map} +0 -0
  50. /package/dist/{chunk-MPNSYZJU.mjs.map → chunk-ISV4OEKJ.mjs.map} +0 -0
  51. /package/dist/{chunk-B7RV4C5E.mjs.map → chunk-SL5OV6OR.mjs.map} +0 -0
@@ -0,0 +1,148 @@
1
+ import DataLoader from 'dataloader';
2
+ import { Table } from 'dexie';
3
+ import BigNumber from 'bignumber.js';
4
+
5
+ declare class DexieCache {
6
+ kv: Table<{
7
+ key: string;
8
+ value: {
9
+ value: any;
10
+ expiration: number;
11
+ };
12
+ }, any, {
13
+ key: string;
14
+ value: {
15
+ value: any;
16
+ expiration: number;
17
+ };
18
+ }>;
19
+ kv_get: DataLoader<string, {
20
+ value: any;
21
+ expiration: number;
22
+ }, string>;
23
+ kv_set: DataLoader<{
24
+ key: string;
25
+ value: any;
26
+ ttl: number;
27
+ }, {
28
+ key: string;
29
+ value: any;
30
+ ttl: number;
31
+ }, {
32
+ key: string;
33
+ value: any;
34
+ ttl: number;
35
+ }>;
36
+ options: {
37
+ ttl: number;
38
+ prefix: string;
39
+ };
40
+ get(_key: any): Promise<any>;
41
+ getRaw(_key: any): Promise<any>;
42
+ set(_key: any, value: any, options?: {
43
+ ttl?: number;
44
+ }): Promise<this>;
45
+ delete(key: any): Promise<void>;
46
+ clear(): Promise<void>;
47
+ wrap<T extends (...args: any[]) => Promise<any>, U = ReturnType<T>>(key: any, fn: T, args?: {
48
+ ttl?: number;
49
+ alowStale?: boolean;
50
+ }): Promise<Awaited<U>>;
51
+ }
52
+ declare const cache: DexieCache;
53
+
54
+ declare const helper: {
55
+ env: {
56
+ isIopayMobile: () => boolean;
57
+ isBrowser: () => boolean;
58
+ onBrowser(func: any): void;
59
+ };
60
+ promise: {
61
+ sleep(ms: any): Promise<unknown>;
62
+ runAsync<T, U = Error>(promise: Promise<T>): Promise<[U | null, T | null]>;
63
+ };
64
+ object: {
65
+ crawlObject(object: any, options: any): any;
66
+ crawl(object: any, options: any): any;
67
+ };
68
+ json: {
69
+ isJsonString(str: string): boolean;
70
+ safeParse(val: any): any;
71
+ };
72
+ deepAssign(target: any, ...sources: any[]): any;
73
+ isObject(value: any): boolean;
74
+ deepMerge(obj: any, newObj: any): any;
75
+ img: {
76
+ parse(src: string | undefined): string;
77
+ };
78
+ string: {
79
+ copy(str: string): void;
80
+ fristUpper(str: string): string;
81
+ firstUpperCase(str: string): string;
82
+ toFixString(str: any, length: any): any;
83
+ truncate(fullStr: string, strLen: any, separator: any): string;
84
+ validAbi(abi: string): {
85
+ abi: any[];
86
+ address: string;
87
+ };
88
+ random(count: number): string;
89
+ };
90
+ download: {
91
+ downloadByBlob(name: string, blob: Blob): void;
92
+ downloadJSON(name: string, jsonObj: object): void;
93
+ };
94
+ number: {
95
+ countNonZeroNumbers: (str: string) => number;
96
+ numberWithCommas(num: number): string;
97
+ getBN: (value: number | string | BigNumber) => BigNumber;
98
+ toPrecisionFloor: (str: number | string, options?: {
99
+ decimals?: number;
100
+ format?: string;
101
+ toLocalString?: boolean;
102
+ }) => any;
103
+ warpBigNumber(value: string, decimals?: number, options?: {
104
+ format?: string;
105
+ fallback?: string;
106
+ min?: number;
107
+ }): {
108
+ value: string;
109
+ format: string;
110
+ originFormat: string;
111
+ decimals: string;
112
+ };
113
+ numberFormat(str: string | number, format?: string, options?: {
114
+ min?: number;
115
+ fallback?: string;
116
+ }): string;
117
+ };
118
+ address: {
119
+ convertAddress: (addressMode: "io" | "0x", address?: string) => string;
120
+ validateEthAddress: (address: string) => boolean;
121
+ validateIoAddress: (address: string) => boolean;
122
+ validateAddress: (address: string) => boolean;
123
+ };
124
+ };
125
+
126
+ declare const _: {
127
+ throttle: any;
128
+ debounce: any;
129
+ each: any;
130
+ flattenDeep: any;
131
+ omitBy: any;
132
+ isNil: any;
133
+ keyBy: any;
134
+ mergeWith: any;
135
+ cloneDeep: any;
136
+ groupBy: any;
137
+ get: any;
138
+ set: any;
139
+ remove: any;
140
+ merge: any;
141
+ isEqual: any;
142
+ uniqWith: any;
143
+ orderBy: any;
144
+ map: any;
145
+ zip: any;
146
+ };
147
+
148
+ export { _, cache, helper };
package/dist/utils.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { cache } from './chunk-2N4HH4ZF.mjs';
2
2
  export { helper } from './chunk-R4N52NI2.mjs';
3
3
  export { _ } from './chunk-K7LFG5BA.mjs';
4
- import './chunk-R4SQKVDQ.mjs';
4
+ import './chunk-6F7H4PAA.mjs';
5
5
  //# sourceMappingURL=out.js.map
6
6
  //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1,196 @@
1
+ import React from 'react';
2
+ import { Chain } from 'viem/chains';
3
+ import { a as PromiseHookData, S as StorageState } from './StorageState-cfd942cb.js';
4
+ import { S as Store } from './root-218afa4f.js';
5
+ import { WalletClient, PublicClient, HttpTransport, TransactionReceipt } from 'viem';
6
+ import EventEmitter from 'events';
7
+ import { SwitchChainMutateAsync } from 'wagmi/query';
8
+ import * as wagmi from 'wagmi';
9
+ import { Config } from 'wagmi';
10
+ import { Chain as Chain$1 } from '@rainbow-me/rainbowkit';
11
+ import * as _rainbow_me_rainbowkit_dist_config_getDefaultConfig from '@rainbow-me/rainbowkit/dist/config/getDefaultConfig';
12
+ import 'mobx';
13
+ import 'typed-emitter';
14
+
15
+ declare const WalletProvider: (({ children, theme, appName, supportedChains, compatibleMode, rainbowKitProps, projectId }: {
16
+ children: React.ReactNode;
17
+ theme?: "dark" | "light";
18
+ appName?: string;
19
+ supportedChains?: Chain[];
20
+ compatibleMode?: boolean;
21
+ debug?: boolean;
22
+ rainbowKitProps?: any;
23
+ projectId?: string;
24
+ }) => React.JSX.Element) & {
25
+ displayName: string;
26
+ };
27
+
28
+ type NetworkObject = {
29
+ name: string;
30
+ chainId: number;
31
+ rpcUrl: string;
32
+ logoUrl: string;
33
+ explorerUrl: string;
34
+ explorerName: string;
35
+ nativeCoin: string;
36
+ type: 'mainnet' | 'testnet';
37
+ };
38
+ type WalletTransactionHistoryType = {
39
+ chainId: number;
40
+ tx?: string;
41
+ msg: string;
42
+ timestamp: number;
43
+ type: string;
44
+ status: 'loading' | 'success' | 'fail';
45
+ };
46
+ type AddressMode = 'io' | '0x';
47
+ declare const iotex: Chain;
48
+ declare const iotexTestnet: Chain;
49
+
50
+ declare class WalletStore implements Store {
51
+ sid: string;
52
+ autoObservable: boolean;
53
+ account: `0x${string}`;
54
+ isSuccessDialogOpen: boolean;
55
+ get isInSafeApp(): boolean;
56
+ isLedger: boolean;
57
+ isConnect: boolean;
58
+ walletClient: WalletClient;
59
+ event: EventEmitter<[never]>;
60
+ switchChain: SwitchChainMutateAsync<Config, unknown> | undefined;
61
+ updateTicker: number;
62
+ addressMode: AddressMode;
63
+ isIoTeXChain: boolean;
64
+ setAddressMode(mode: AddressMode): void;
65
+ get accountFormat(): string;
66
+ get connectAccountEllipsisFormat(): string;
67
+ get accountEllipsisFormat(): string;
68
+ get supportedChains(): Chain$1[];
69
+ chain: Chain$1 | undefined;
70
+ openConnectModal: any;
71
+ disconnect: any;
72
+ balance: PromiseHookData<() => Promise<{
73
+ value: string;
74
+ format: string;
75
+ originFormat: string;
76
+ decimals: string;
77
+ }>, Promise<{
78
+ value: string;
79
+ format: string;
80
+ originFormat: string;
81
+ decimals: string;
82
+ }>>;
83
+ constructor(args?: Partial<WalletStore>);
84
+ use(): void;
85
+ private useWalletClientWithCompatibleMode;
86
+ useWalletClientWithoutCompatibleMode(): void;
87
+ get publicClient(): PublicClient<HttpTransport, Chain$1, any, any>;
88
+ set(args: Partial<WalletStore>): void;
89
+ toJSON(): {
90
+ account: `0x${string}`;
91
+ };
92
+ prepare(chainId?: number): Promise<WalletStore>;
93
+ waitForTransactionReceipt({ hash }: {
94
+ hash: any;
95
+ }): Promise<TransactionReceipt>;
96
+ static SendTx(...args: Parameters<WalletStore['sendTx']>): Promise<TransactionReceipt>;
97
+ static SendRawTx(...args: Parameters<WalletStore['sendRawTx']>): Promise<TransactionReceipt>;
98
+ sendTx({ chainId, tx, autoAlert, loadingText, successText, historyItem, showSuccessDialog, onSuccess, onError, }: {
99
+ chainId: number | string;
100
+ tx: any;
101
+ autoAlert?: boolean;
102
+ loadingText?: string;
103
+ successText?: string;
104
+ showSuccessDialog?: boolean;
105
+ historyItem?: Pick<WalletTransactionHistoryType, 'msg' | 'type'>;
106
+ onSuccess?: ({ receipt }: {
107
+ receipt: TransactionReceipt;
108
+ }) => Promise<void>;
109
+ onError?: (error: any) => void;
110
+ }): Promise<TransactionReceipt>;
111
+ sendRawTx({ chainId, address, data, value, autoAlert, onSended, onSuccess, onError, historyItem, loadingText, showSuccessDialog, }: {
112
+ loadingText?: string;
113
+ chainId: number | string;
114
+ address: string;
115
+ data: string | null;
116
+ value?: string;
117
+ autoRefresh?: boolean;
118
+ autoAlert?: boolean;
119
+ historyItem?: Pick<WalletTransactionHistoryType, 'msg' | 'type'>;
120
+ showTransactionSubmitDialog?: boolean;
121
+ showSuccessDialog?: boolean;
122
+ onSended?: ({ res }: {
123
+ res: TransactionReceipt;
124
+ }) => void;
125
+ onSuccess?: ({ res }: {
126
+ res: TransactionReceipt;
127
+ }) => void;
128
+ onError?: (error: any) => void;
129
+ }): Promise<TransactionReceipt | undefined>;
130
+ signMessage(message: string): Promise<string>;
131
+ }
132
+
133
+ declare class WalletRpcStore implements Store {
134
+ sid: string;
135
+ autoObservable: boolean;
136
+ curRpc: StorageState<unknown>;
137
+ isAutoSelectRpc: StorageState<unknown>;
138
+ customRpc: string;
139
+ rpcList: StorageState<unknown>;
140
+ showCustomRpc: boolean;
141
+ get currentRpc(): any;
142
+ addCustomRpc(): string;
143
+ addToMetamask(url: any): Promise<void>;
144
+ switchOrAddChain(chainId: number): Promise<unknown>;
145
+ addToMetamaskById(id: number): Promise<unknown>;
146
+ refresh(): void;
147
+ latencyColor(latency: number): "text-red-500" | "text-green-500" | "text-yellow-500";
148
+ testRpcFunction(url: string): Promise<{
149
+ url: string;
150
+ lentency: number;
151
+ height: number;
152
+ }>;
153
+ testRpc(): void;
154
+ removeRpc(name: string): void;
155
+ scoreIcon(score: number): React.JSX.Element;
156
+ get wallet(): WalletStore;
157
+ autoSelectRpc(): Promise<void>;
158
+ }
159
+ declare class WalletHistoryStore implements Store {
160
+ sid: string;
161
+ isRender: boolean;
162
+ autoObservable: boolean;
163
+ set(params: Partial<WalletHistoryStore>): void;
164
+ private history;
165
+ get historyList(): WalletTransactionHistoryType[];
166
+ recordHistory(item: WalletTransactionHistoryType): void;
167
+ updateHistoryStatusByTx(tx: string | null, status: 'loading' | 'success' | 'fail'): void;
168
+ clearHistory(): void;
169
+ }
170
+
171
+ declare class WalletConfigStore implements Store {
172
+ sid: string;
173
+ autoObservable: boolean;
174
+ appName: string;
175
+ projectId: string;
176
+ supportedChains: Chain$1[];
177
+ defaultChainId: number;
178
+ updateTicker: number;
179
+ walletUpdateTick: number;
180
+ isConnect: boolean;
181
+ isInSafeApp: boolean;
182
+ compatibleMode: boolean;
183
+ constructor(args: Partial<WalletConfigStore>);
184
+ set(params: Partial<WalletConfigStore>): void;
185
+ get reconnectOnMount(): boolean;
186
+ get rainbowKitConfig(): wagmi.Config<_rainbow_me_rainbowkit_dist_config_getDefaultConfig._chains, _rainbow_me_rainbowkit_dist_config_getDefaultConfig._transports, wagmi.CreateConnectorFn<unknown, Record<string, unknown>, Record<string, unknown>>[]>;
187
+ }
188
+
189
+ declare const RpcList: (() => React.JSX.Element) & {
190
+ displayName: string;
191
+ };
192
+
193
+ declare const ConnectLedger: () => Promise<void>;
194
+ declare const DisconnectLedger: () => void;
195
+
196
+ export { AddressMode, ConnectLedger, DisconnectLedger, NetworkObject, RpcList, WalletConfigStore, WalletHistoryStore, WalletProvider, WalletRpcStore, WalletStore, WalletTransactionHistoryType, iotex, iotexTestnet };
package/dist/wallet.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { WalletConfigStore, WalletStore, WalletRpcStore } from './chunk-2WRRZVUW.mjs';
2
- export { ConnectLedger, DisconnectLedger, WalletConfigStore, WalletHistoryStore, WalletRpcStore, WalletStore } from './chunk-2WRRZVUW.mjs';
3
- import './chunk-B7RV4C5E.mjs';
4
- import './chunk-O3FWAAEG.mjs';
1
+ import { WalletConfigStore, WalletStore, WalletRpcStore } from './chunk-4F33QAJ4.mjs';
2
+ export { ConnectLedger, DisconnectLedger, WalletConfigStore, WalletHistoryStore, WalletRpcStore, WalletStore } from './chunk-4F33QAJ4.mjs';
3
+ import './chunk-SL5OV6OR.mjs';
4
+ import './chunk-3XIPR2M3.mjs';
5
5
  import './chunk-2N4HH4ZF.mjs';
6
- import './chunk-PZ3VSAOC.mjs';
6
+ import './chunk-C5BPNLKH.mjs';
7
7
  import { ToastPlugin } from './chunk-IMOLRP7I.mjs';
8
8
  import './chunk-GKAU4P5I.mjs';
9
- import { RootStore } from './chunk-XSGTWROT.mjs';
9
+ import { RootStore } from './chunk-IDKGZ5T4.mjs';
10
10
  import './chunk-R4N52NI2.mjs';
11
11
  import './chunk-ONVPCAMQ.mjs';
12
12
  import './chunk-K7LFG5BA.mjs';
13
- import { __spreadValues } from './chunk-R4SQKVDQ.mjs';
13
+ import { __spreadValues } from './chunk-6F7H4PAA.mjs';
14
14
  import { RainbowKitProvider, darkTheme, lightTheme } from '@rainbow-me/rainbowkit';
15
15
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
16
16
  import React2, { useEffect } from 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dappworks/kit",
3
- "version": "0.5.40",
3
+ "version": "0.5.41",
4
4
  "description": "",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",
@@ -111,7 +111,7 @@
111
111
  "scripts": {
112
112
  "dev": "npm run build -- --watch",
113
113
  "test": "echo \"Error: no test specified\" && exit 1",
114
- "build": "tsup --format esm",
114
+ "build": "tsup --format esm --dts",
115
115
  "prepublishOnly": "npm run build"
116
116
  },
117
117
  "peerDependencies": {