@gluwa/connect-kit 0.2.1-next.1 → 0.2.1-next.4
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/CHANGELOG.md +6 -0
- package/dist/{chunk-CJANPJHY.js → chunk-TMKSC7ZT.js} +5 -0
- package/dist/credit-connect.js +1 -1
- package/dist/index.d.ts +92 -25
- package/dist/index.js +217 -91
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/src/api/wrappers.ts +361 -0
- package/src/events/account.ts +0 -12
- package/src/index.ts +28 -24
- package/src/api/account.ts +0 -21
- package/src/api/asset.ts +0 -10
- package/src/api/balance.ts +0 -10
- package/src/api/chain.ts +0 -17
- package/src/api/contract.ts +0 -33
- package/src/api/transaction.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __export = (target, all) => {
|
|
5
|
+
for (var name in all)
|
|
6
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
+
};
|
|
4
8
|
|
|
5
9
|
// src/creditConnectConnector.ts
|
|
6
10
|
import { createConnector } from "@wagmi/core";
|
|
@@ -403,5 +407,6 @@ var creditConnectConnector = /* @__PURE__ */ __name((options) => {
|
|
|
403
407
|
|
|
404
408
|
export {
|
|
405
409
|
__name,
|
|
410
|
+
__export,
|
|
406
411
|
creditConnectConnector
|
|
407
412
|
};
|
package/dist/credit-connect.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,89 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Abi, ContractFunctionName, ContractFunctionArgs, Chain, Transport } from 'viem';
|
|
3
|
-
import
|
|
4
|
-
import { ReadContractParameters, Config, ReadContractReturnType, WriteContractParameters, WriteContractReturnType } from '@wagmi/core';
|
|
1
|
+
import * as actions from '@wagmi/core/actions';
|
|
2
|
+
import { Abi, FeeValuesType, BlockTag, ContractFunctionParameters, PrepareTransactionRequestRequest, ContractFunctionName, ContractFunctionArgs, TypedData, ContractEventName, Chain, Transport } from 'viem';
|
|
3
|
+
import { Connector, CreateConnectorFn, ConnectParameters, Config, ConnectReturnType, DeployContractParameters, DeployContractReturnType, EstimateFeesPerGasParameters, EstimateFeesPerGasReturnType, EstimateGasParameters, EstimateGasReturnType, EstimateMaxPriorityFeePerGasParameters, EstimateMaxPriorityFeePerGasReturnType, GetBlockParameters, GetBlockReturnType, GetBlockNumberParameters, GetBlockNumberReturnType, GetBlockTransactionCountParameters, GetBlockTransactionCountReturnType, GetCapabilitiesParameters, GetCapabilitiesReturnType, GetClientParameters, GetClientReturnType, GetConnectorClientParameters, GetConnectorClientReturnType, GetFeeHistoryParameters, GetFeeHistoryReturnType, GetGasPriceParameters, GetGasPriceReturnType, GetPublicClientParameters, GetPublicClientReturnType, GetTransactionParameters, GetTransactionReturnType, GetTransactionConfirmationsParameters, GetTransactionConfirmationsReturnType, GetTransactionReceiptParameters, GetTransactionReceiptReturnType, GetWalletClientParameters, GetWalletClientReturnType, MulticallParameters, MulticallReturnType, SelectChains, PrepareTransactionRequestParameters, PrepareTransactionRequestReturnType, ReadContractParameters, ReadContractReturnType, ReadContractsParameters, ReadContractsReturnType, SendCallsParameters, SendCallsReturnType, SendTransactionParameters, SendTransactionReturnType, SignTypedDataParameters, SignTypedDataReturnType, SimulateContractParameters, SimulateContractReturnType, SwitchChainParameters, SwitchChainReturnType, VerifyTypedDataParameters, VerifyTypedDataReturnType, WaitForTransactionReceiptParameters, WaitForTransactionReceiptReturnType, WatchBlockNumberParameters, WatchBlockNumberReturnType, WatchBlocksParameters, WatchBlocksReturnType, WatchClientParameters, WatchClientReturnType, WatchContractEventParameters, WatchPendingTransactionsParameters, WatchPublicClientParameters, WatchPublicClientReturnType, WriteContractParameters, WriteContractReturnType, ReconnectReturnType } from '@wagmi/core';
|
|
5
4
|
export * from '@wagmi/core';
|
|
6
5
|
import { ReactNode, FC } from 'react';
|
|
7
|
-
import { CreateConnectorFn, Config as Config$1 } from 'wagmi';
|
|
6
|
+
import { CreateConnectorFn as CreateConnectorFn$1, Config as Config$1 } from 'wagmi';
|
|
8
7
|
|
|
8
|
+
declare function connect<connector extends Connector | CreateConnectorFn, withCapabilities extends boolean = false>(parameters: ConnectParameters<Config, connector, withCapabilities>): Promise<ConnectReturnType<Config, connector, withCapabilities>>;
|
|
9
|
+
declare function deployContract<const abi extends Abi | readonly unknown[], chainId extends Config['chains'][number]['id']>(parameters: DeployContractParameters<abi, Config, chainId>): Promise<DeployContractReturnType>;
|
|
10
|
+
declare function estimateFeesPerGas<type extends FeeValuesType = 'eip1559'>(parameters?: EstimateFeesPerGasParameters<type, Config>): Promise<EstimateFeesPerGasReturnType<type>>;
|
|
11
|
+
declare function estimateGas<chainId extends Config['chains'][number]['id'] | undefined = undefined>(parameters: EstimateGasParameters<Config, chainId>): Promise<EstimateGasReturnType>;
|
|
12
|
+
declare function estimateMaxPriorityFeePerGas<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters?: EstimateMaxPriorityFeePerGasParameters<Config, chainId>): Promise<EstimateMaxPriorityFeePerGasReturnType>;
|
|
13
|
+
declare function getBlock<chainId extends Config['chains'][number]['id'], includeTransactions extends boolean = false, blockTag extends BlockTag = 'latest'>(parameters?: GetBlockParameters<includeTransactions, blockTag, Config, chainId>): Promise<GetBlockReturnType<includeTransactions, blockTag, Config, chainId>>;
|
|
14
|
+
declare function getBlockNumber<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters?: GetBlockNumberParameters<Config, chainId>): Promise<GetBlockNumberReturnType>;
|
|
15
|
+
declare function getBlockTransactionCount<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters?: GetBlockTransactionCountParameters<Config, chainId>): Promise<GetBlockTransactionCountReturnType>;
|
|
16
|
+
declare function getCapabilities<chainId extends Config['chains'][number]['id'] | undefined = undefined>(parameters?: GetCapabilitiesParameters<Config, chainId>): Promise<GetCapabilitiesReturnType<Config, chainId>>;
|
|
17
|
+
declare function getClient<chainId extends Config['chains'][number]['id'] | number | undefined>(parameters?: GetClientParameters<Config, chainId>): GetClientReturnType<Config, chainId>;
|
|
18
|
+
declare function getConnectorClient<chainId extends Config['chains'][number]['id']>(parameters?: GetConnectorClientParameters<Config, chainId>): Promise<GetConnectorClientReturnType<Config, chainId>>;
|
|
19
|
+
declare function getFeeHistory<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters: GetFeeHistoryParameters<Config, chainId>): Promise<GetFeeHistoryReturnType>;
|
|
20
|
+
declare function getGasPrice<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters?: GetGasPriceParameters<Config, chainId>): Promise<GetGasPriceReturnType>;
|
|
21
|
+
declare function getPublicClient<chainId extends Config['chains'][number]['id'] | number | undefined>(parameters?: GetPublicClientParameters<Config, chainId>): GetPublicClientReturnType<Config, chainId>;
|
|
22
|
+
declare function getTransaction<chainId extends Config['chains'][number]['id']>(parameters: GetTransactionParameters<Config, chainId>): Promise<GetTransactionReturnType<Config, chainId>>;
|
|
23
|
+
declare function getTransactionConfirmations<chainId extends Config['chains'][number]['id'] | undefined = Config['chains'][number]['id']>(parameters: GetTransactionConfirmationsParameters<Config, chainId>): Promise<GetTransactionConfirmationsReturnType>;
|
|
24
|
+
declare function getTransactionReceipt<chainId extends Config['chains'][number]['id']>(parameters: GetTransactionReceiptParameters<Config>): Promise<GetTransactionReceiptReturnType<Config, chainId>>;
|
|
25
|
+
declare function getWalletClient<chainId extends Config['chains'][number]['id']>(parameters?: GetWalletClientParameters<Config, chainId>): Promise<GetWalletClientReturnType<Config, chainId>>;
|
|
26
|
+
declare function multicall<const contracts extends readonly ContractFunctionParameters[], allowFailure extends boolean = true>(parameters: MulticallParameters<contracts, allowFailure, Config>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
27
|
+
declare function prepareTransactionRequest<chainId extends Config['chains'][number]['id'] | undefined, const request extends PrepareTransactionRequestRequest<SelectChains<Config, chainId>['0'], SelectChains<Config, chainId>['0']>>(parameters: PrepareTransactionRequestParameters<Config, chainId, request>): Promise<PrepareTransactionRequestReturnType<Config, chainId, request>>;
|
|
9
28
|
declare function readContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'pure' | 'view'>, args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>>(parameters: ReadContractParameters<abi, functionName, args, Config>): Promise<ReadContractReturnType<abi, functionName, args>>;
|
|
10
|
-
declare function
|
|
29
|
+
declare function readContracts<const contracts extends readonly ContractFunctionParameters[], allowFailure extends boolean = true>(parameters: ReadContractsParameters<contracts, allowFailure, Config>): Promise<ReadContractsReturnType<contracts, allowFailure>>;
|
|
30
|
+
declare function sendCalls<const calls extends readonly unknown[], chainId extends Config['chains'][number]['id']>(parameters: SendCallsParameters<Config, chainId, calls>): Promise<SendCallsReturnType>;
|
|
31
|
+
declare function sendTransaction<chainId extends Config['chains'][number]['id']>(parameters: SendTransactionParameters<Config, chainId>): Promise<SendTransactionReturnType>;
|
|
32
|
+
declare function signTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain'>(parameters: SignTypedDataParameters<typedData, primaryType>): Promise<SignTypedDataReturnType>;
|
|
33
|
+
declare function simulateContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>, args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>, chainId extends Config['chains'][number]['id'] | undefined = undefined>(parameters: SimulateContractParameters<abi, functionName, args, Config, chainId>): Promise<SimulateContractReturnType<abi, functionName, args, Config, chainId>>;
|
|
34
|
+
declare function switchChain<chainId extends Config['chains'][number]['id']>(parameters: SwitchChainParameters<Config, chainId>): Promise<SwitchChainReturnType<Config, chainId>>;
|
|
35
|
+
declare function verifyTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain'>(parameters: VerifyTypedDataParameters<typedData, primaryType, Config>): Promise<VerifyTypedDataReturnType>;
|
|
36
|
+
declare function waitForTransactionReceipt<chainId extends Config['chains'][number]['id']>(parameters: WaitForTransactionReceiptParameters<Config, chainId>): Promise<WaitForTransactionReceiptReturnType<Config, chainId>>;
|
|
37
|
+
declare function watchBlockNumber<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id']>(parameters: WatchBlockNumberParameters<Config, chainId>): WatchBlockNumberReturnType;
|
|
38
|
+
declare function watchBlocks<chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'], includeTransactions extends boolean = false, blockTag extends BlockTag = 'latest'>(parameters: WatchBlocksParameters<includeTransactions, blockTag, Config, chainId>): WatchBlocksReturnType;
|
|
39
|
+
declare function watchClient<chainId extends Config['chains'][number]['id']>(parameters: WatchClientParameters<Config, chainId>): WatchClientReturnType;
|
|
40
|
+
declare function watchContractEvent<chainId extends Config['chains'][number]['id'], const abi extends Abi | readonly unknown[], eventName extends ContractEventName<abi> | undefined, strict extends boolean | undefined = undefined>(parameters: WatchContractEventParameters<abi, eventName, strict, Config, chainId>): () => void;
|
|
41
|
+
declare function watchPendingTransactions<chainId extends Config['chains'][number]['id']>(parameters: WatchPendingTransactionsParameters<Config, chainId>): () => void;
|
|
42
|
+
declare function watchPublicClient<chainId extends Config['chains'][number]['id']>(parameters: WatchPublicClientParameters<Config, chainId>): WatchPublicClientReturnType;
|
|
43
|
+
declare function writeContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>, args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>, chainId extends Config['chains'][number]['id']>(parameters: WriteContractParameters<abi, functionName, args, Config, chainId>): Promise<WriteContractReturnType>;
|
|
44
|
+
|
|
45
|
+
declare const wrappers_connect: typeof connect;
|
|
46
|
+
declare const wrappers_deployContract: typeof deployContract;
|
|
47
|
+
declare const wrappers_estimateFeesPerGas: typeof estimateFeesPerGas;
|
|
48
|
+
declare const wrappers_estimateGas: typeof estimateGas;
|
|
49
|
+
declare const wrappers_estimateMaxPriorityFeePerGas: typeof estimateMaxPriorityFeePerGas;
|
|
50
|
+
declare const wrappers_getBlock: typeof getBlock;
|
|
51
|
+
declare const wrappers_getBlockNumber: typeof getBlockNumber;
|
|
52
|
+
declare const wrappers_getBlockTransactionCount: typeof getBlockTransactionCount;
|
|
53
|
+
declare const wrappers_getCapabilities: typeof getCapabilities;
|
|
54
|
+
declare const wrappers_getClient: typeof getClient;
|
|
55
|
+
declare const wrappers_getConnectorClient: typeof getConnectorClient;
|
|
56
|
+
declare const wrappers_getFeeHistory: typeof getFeeHistory;
|
|
57
|
+
declare const wrappers_getGasPrice: typeof getGasPrice;
|
|
58
|
+
declare const wrappers_getPublicClient: typeof getPublicClient;
|
|
59
|
+
declare const wrappers_getTransaction: typeof getTransaction;
|
|
60
|
+
declare const wrappers_getTransactionConfirmations: typeof getTransactionConfirmations;
|
|
61
|
+
declare const wrappers_getTransactionReceipt: typeof getTransactionReceipt;
|
|
62
|
+
declare const wrappers_getWalletClient: typeof getWalletClient;
|
|
63
|
+
declare const wrappers_multicall: typeof multicall;
|
|
64
|
+
declare const wrappers_prepareTransactionRequest: typeof prepareTransactionRequest;
|
|
65
|
+
declare const wrappers_readContract: typeof readContract;
|
|
66
|
+
declare const wrappers_readContracts: typeof readContracts;
|
|
67
|
+
declare const wrappers_sendCalls: typeof sendCalls;
|
|
68
|
+
declare const wrappers_sendTransaction: typeof sendTransaction;
|
|
69
|
+
declare const wrappers_signTypedData: typeof signTypedData;
|
|
70
|
+
declare const wrappers_simulateContract: typeof simulateContract;
|
|
71
|
+
declare const wrappers_switchChain: typeof switchChain;
|
|
72
|
+
declare const wrappers_verifyTypedData: typeof verifyTypedData;
|
|
73
|
+
declare const wrappers_waitForTransactionReceipt: typeof waitForTransactionReceipt;
|
|
74
|
+
declare const wrappers_watchBlockNumber: typeof watchBlockNumber;
|
|
75
|
+
declare const wrappers_watchBlocks: typeof watchBlocks;
|
|
76
|
+
declare const wrappers_watchClient: typeof watchClient;
|
|
77
|
+
declare const wrappers_watchContractEvent: typeof watchContractEvent;
|
|
78
|
+
declare const wrappers_watchPendingTransactions: typeof watchPendingTransactions;
|
|
79
|
+
declare const wrappers_watchPublicClient: typeof watchPublicClient;
|
|
80
|
+
declare const wrappers_writeContract: typeof writeContract;
|
|
81
|
+
declare namespace wrappers {
|
|
82
|
+
export { wrappers_connect as connect, wrappers_deployContract as deployContract, wrappers_estimateFeesPerGas as estimateFeesPerGas, wrappers_estimateGas as estimateGas, wrappers_estimateMaxPriorityFeePerGas as estimateMaxPriorityFeePerGas, wrappers_getBlock as getBlock, wrappers_getBlockNumber as getBlockNumber, wrappers_getBlockTransactionCount as getBlockTransactionCount, wrappers_getCapabilities as getCapabilities, wrappers_getClient as getClient, wrappers_getConnectorClient as getConnectorClient, wrappers_getFeeHistory as getFeeHistory, wrappers_getGasPrice as getGasPrice, wrappers_getPublicClient as getPublicClient, wrappers_getTransaction as getTransaction, wrappers_getTransactionConfirmations as getTransactionConfirmations, wrappers_getTransactionReceipt as getTransactionReceipt, wrappers_getWalletClient as getWalletClient, wrappers_multicall as multicall, wrappers_prepareTransactionRequest as prepareTransactionRequest, wrappers_readContract as readContract, wrappers_readContracts as readContracts, wrappers_sendCalls as sendCalls, wrappers_sendTransaction as sendTransaction, wrappers_signTypedData as signTypedData, wrappers_simulateContract as simulateContract, wrappers_switchChain as switchChain, wrappers_verifyTypedData as verifyTypedData, wrappers_waitForTransactionReceipt as waitForTransactionReceipt, wrappers_watchBlockNumber as watchBlockNumber, wrappers_watchBlocks as watchBlocks, wrappers_watchClient as watchClient, wrappers_watchContractEvent as watchContractEvent, wrappers_watchPendingTransactions as watchPendingTransactions, wrappers_watchPublicClient as watchPublicClient, wrappers_writeContract as writeContract };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare const reconnect: () => Promise<ReconnectReturnType>;
|
|
86
|
+
declare const disconnectAll: (onLog?: (message: string, error?: Error) => void) => Promise<void>;
|
|
11
87
|
|
|
12
88
|
type ConnectorId = 'CREDIT_CONNECT' | 'METAMASK' | 'WALLET_CONNECT';
|
|
13
89
|
interface ConnectKitConfig {
|
|
@@ -18,7 +94,7 @@ interface ConnectKitConfig {
|
|
|
18
94
|
projectId: string;
|
|
19
95
|
serverUrl: string;
|
|
20
96
|
};
|
|
21
|
-
extraConnectors?: CreateConnectorFn[];
|
|
97
|
+
extraConnectors?: CreateConnectorFn$1[];
|
|
22
98
|
autoConnectInjected?: boolean;
|
|
23
99
|
}
|
|
24
100
|
type ConnectorKey = 'creditWallet' | 'metamask' | 'walletConnect';
|
|
@@ -93,25 +169,16 @@ declare const useConnectKit: () => ConnectKitContextValue;
|
|
|
93
169
|
|
|
94
170
|
declare const initConfig: (kitConfig: ConnectKitConfig) => Config$1;
|
|
95
171
|
|
|
172
|
+
type StripConfig<T> = T extends (config: any, ...rest: infer A) => infer R ? (...rest: A) => R : never;
|
|
173
|
+
type Bridge = {
|
|
174
|
+
[K in keyof typeof actions]: StripConfig<(typeof actions)[K]>;
|
|
175
|
+
};
|
|
176
|
+
type KitActions = Omit<Bridge, keyof typeof wrappers | 'reconnect' | 'disconnectAll'> & typeof wrappers & {
|
|
177
|
+
reconnect: typeof reconnect;
|
|
178
|
+
disconnectAll: typeof disconnectAll;
|
|
179
|
+
};
|
|
96
180
|
declare const connectKit: {
|
|
97
|
-
readonly
|
|
98
|
-
readonly readContract: typeof readContract;
|
|
99
|
-
readonly writeContract: typeof writeContract;
|
|
100
|
-
readonly getBalance: (params: _wagmi_core.GetBalanceParameters) => Promise<_wagmi_core.GetBalanceReturnType>;
|
|
101
|
-
readonly switchChain: (params: _wagmi_core.SwitchChainParameters) => Promise<viem.Chain>;
|
|
102
|
-
readonly getPublicClient: (params?: _wagmi_core.GetPublicClientParameters) => _wagmi_core.GetPublicClientReturnType;
|
|
103
|
-
readonly waitForTransactionReceipt: (params: _wagmi_core.WaitForTransactionReceiptParameters) => Promise<_wagmi_core.WaitForTransactionReceiptReturnType>;
|
|
104
|
-
readonly getAccount: () => _wagmi_core.GetAccountReturnType;
|
|
105
|
-
readonly signMessage: (params: _wagmi_core.SignMessageParameters) => Promise<`0x${string}`>;
|
|
106
|
-
readonly signTypedData: (params: _wagmi_core.SignTypedDataParameters) => Promise<`0x${string}`>;
|
|
107
|
-
readonly watchAsset: (params: _wagmi_core.WatchAssetParameters) => Promise<_wagmi_core.WatchAssetReturnType>;
|
|
108
|
-
};
|
|
109
|
-
readonly events: {
|
|
110
|
-
readonly watchAccount: (params: _wagmi_core.WatchAccountParameters) => (() => void);
|
|
111
|
-
readonly watchConnections: (params: _wagmi_core.WatchConnectionsParameters) => (() => void);
|
|
112
|
-
readonly reconnect: () => Promise<_wagmi_core.ReconnectReturnType>;
|
|
113
|
-
readonly disconnectAll: (onLog?: (message: string, error?: Error) => void) => Promise<void>;
|
|
114
|
-
};
|
|
181
|
+
readonly actions: KitActions;
|
|
115
182
|
};
|
|
116
183
|
|
|
117
184
|
export { type ConnectBannerSiteKey, type ConnectErrorContext, type ConnectErrorReason, type ConnectKitConfig, type ConnectKitContextValue, ConnectKitProvider, type ConnectKitProviderProps, type ConnectKitTheme, type ConnectModalProps, type ConnectResult, type ConnectorId, type ConnectorKey, type Connectors, type WCSubView, type WCWallet, connectKit, initConfig, useConnectKit };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,54 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
+
__export,
|
|
3
4
|
__name,
|
|
4
5
|
creditConnectConnector
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TMKSC7ZT.js";
|
|
6
7
|
|
|
7
|
-
// src/
|
|
8
|
-
import
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import * as actions from "@wagmi/core/actions";
|
|
10
|
+
|
|
11
|
+
// src/api/wrappers.ts
|
|
12
|
+
var wrappers_exports = {};
|
|
13
|
+
__export(wrappers_exports, {
|
|
14
|
+
connect: () => connect2,
|
|
15
|
+
deployContract: () => deployContract2,
|
|
16
|
+
estimateFeesPerGas: () => estimateFeesPerGas2,
|
|
17
|
+
estimateGas: () => estimateGas2,
|
|
18
|
+
estimateMaxPriorityFeePerGas: () => estimateMaxPriorityFeePerGas2,
|
|
19
|
+
getBlock: () => getBlock2,
|
|
20
|
+
getBlockNumber: () => getBlockNumber2,
|
|
21
|
+
getBlockTransactionCount: () => getBlockTransactionCount2,
|
|
22
|
+
getCapabilities: () => getCapabilities2,
|
|
23
|
+
getClient: () => getClient2,
|
|
24
|
+
getConnectorClient: () => getConnectorClient2,
|
|
25
|
+
getFeeHistory: () => getFeeHistory2,
|
|
26
|
+
getGasPrice: () => getGasPrice2,
|
|
27
|
+
getPublicClient: () => getPublicClient2,
|
|
28
|
+
getTransaction: () => getTransaction2,
|
|
29
|
+
getTransactionConfirmations: () => getTransactionConfirmations2,
|
|
30
|
+
getTransactionReceipt: () => getTransactionReceipt2,
|
|
31
|
+
getWalletClient: () => getWalletClient2,
|
|
32
|
+
multicall: () => multicall2,
|
|
33
|
+
prepareTransactionRequest: () => prepareTransactionRequest2,
|
|
34
|
+
readContract: () => readContract2,
|
|
35
|
+
readContracts: () => readContracts2,
|
|
36
|
+
sendCalls: () => sendCalls2,
|
|
37
|
+
sendTransaction: () => sendTransaction2,
|
|
38
|
+
signTypedData: () => signTypedData2,
|
|
39
|
+
simulateContract: () => simulateContract2,
|
|
40
|
+
switchChain: () => switchChain2,
|
|
41
|
+
verifyTypedData: () => verifyTypedData2,
|
|
42
|
+
waitForTransactionReceipt: () => waitForTransactionReceipt2,
|
|
43
|
+
watchBlockNumber: () => watchBlockNumber2,
|
|
44
|
+
watchBlocks: () => watchBlocks2,
|
|
45
|
+
watchClient: () => watchClient2,
|
|
46
|
+
watchContractEvent: () => watchContractEvent2,
|
|
47
|
+
watchPendingTransactions: () => watchPendingTransactions2,
|
|
48
|
+
watchPublicClient: () => watchPublicClient2,
|
|
49
|
+
writeContract: () => writeContract2
|
|
50
|
+
});
|
|
51
|
+
import * as w from "@wagmi/core/actions";
|
|
9
52
|
|
|
10
53
|
// src/core/config.ts
|
|
11
54
|
import { createConfig, createStorage } from "wagmi";
|
|
@@ -139,63 +182,154 @@ var getKitConfig = /* @__PURE__ */ __name(() => {
|
|
|
139
182
|
return slot.kitConfig;
|
|
140
183
|
}, "getKitConfig");
|
|
141
184
|
|
|
142
|
-
// src/api/
|
|
143
|
-
function
|
|
144
|
-
return
|
|
185
|
+
// src/api/wrappers.ts
|
|
186
|
+
function connect2(parameters) {
|
|
187
|
+
return w.connect(getConfig(), parameters);
|
|
145
188
|
}
|
|
146
|
-
__name(
|
|
147
|
-
function
|
|
148
|
-
return
|
|
189
|
+
__name(connect2, "connect");
|
|
190
|
+
function deployContract2(parameters) {
|
|
191
|
+
return w.deployContract(getConfig(), parameters);
|
|
149
192
|
}
|
|
150
|
-
__name(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
189
|
-
}
|
|
193
|
+
__name(deployContract2, "deployContract");
|
|
194
|
+
function estimateFeesPerGas2(parameters) {
|
|
195
|
+
return w.estimateFeesPerGas(getConfig(), parameters);
|
|
196
|
+
}
|
|
197
|
+
__name(estimateFeesPerGas2, "estimateFeesPerGas");
|
|
198
|
+
function estimateGas2(parameters) {
|
|
199
|
+
return w.estimateGas(getConfig(), parameters);
|
|
200
|
+
}
|
|
201
|
+
__name(estimateGas2, "estimateGas");
|
|
202
|
+
function estimateMaxPriorityFeePerGas2(parameters) {
|
|
203
|
+
return w.estimateMaxPriorityFeePerGas(getConfig(), parameters);
|
|
204
|
+
}
|
|
205
|
+
__name(estimateMaxPriorityFeePerGas2, "estimateMaxPriorityFeePerGas");
|
|
206
|
+
function getBlock2(parameters) {
|
|
207
|
+
return w.getBlock(getConfig(), parameters);
|
|
208
|
+
}
|
|
209
|
+
__name(getBlock2, "getBlock");
|
|
210
|
+
function getBlockNumber2(parameters) {
|
|
211
|
+
return w.getBlockNumber(getConfig(), parameters);
|
|
212
|
+
}
|
|
213
|
+
__name(getBlockNumber2, "getBlockNumber");
|
|
214
|
+
function getBlockTransactionCount2(parameters) {
|
|
215
|
+
return w.getBlockTransactionCount(getConfig(), parameters);
|
|
216
|
+
}
|
|
217
|
+
__name(getBlockTransactionCount2, "getBlockTransactionCount");
|
|
218
|
+
function getCapabilities2(parameters) {
|
|
219
|
+
return w.getCapabilities(getConfig(), parameters);
|
|
220
|
+
}
|
|
221
|
+
__name(getCapabilities2, "getCapabilities");
|
|
222
|
+
function getClient2(parameters) {
|
|
223
|
+
return w.getClient(getConfig(), parameters);
|
|
224
|
+
}
|
|
225
|
+
__name(getClient2, "getClient");
|
|
226
|
+
function getConnectorClient2(parameters) {
|
|
227
|
+
return w.getConnectorClient(getConfig(), parameters);
|
|
228
|
+
}
|
|
229
|
+
__name(getConnectorClient2, "getConnectorClient");
|
|
230
|
+
function getFeeHistory2(parameters) {
|
|
231
|
+
return w.getFeeHistory(getConfig(), parameters);
|
|
232
|
+
}
|
|
233
|
+
__name(getFeeHistory2, "getFeeHistory");
|
|
234
|
+
function getGasPrice2(parameters) {
|
|
235
|
+
return w.getGasPrice(getConfig(), parameters);
|
|
236
|
+
}
|
|
237
|
+
__name(getGasPrice2, "getGasPrice");
|
|
238
|
+
function getPublicClient2(parameters) {
|
|
239
|
+
return w.getPublicClient(getConfig(), parameters);
|
|
240
|
+
}
|
|
241
|
+
__name(getPublicClient2, "getPublicClient");
|
|
242
|
+
function getTransaction2(parameters) {
|
|
243
|
+
return w.getTransaction(getConfig(), parameters);
|
|
244
|
+
}
|
|
245
|
+
__name(getTransaction2, "getTransaction");
|
|
246
|
+
function getTransactionConfirmations2(parameters) {
|
|
247
|
+
return w.getTransactionConfirmations(getConfig(), parameters);
|
|
248
|
+
}
|
|
249
|
+
__name(getTransactionConfirmations2, "getTransactionConfirmations");
|
|
250
|
+
function getTransactionReceipt2(parameters) {
|
|
251
|
+
return w.getTransactionReceipt(getConfig(), parameters);
|
|
252
|
+
}
|
|
253
|
+
__name(getTransactionReceipt2, "getTransactionReceipt");
|
|
254
|
+
function getWalletClient2(parameters) {
|
|
255
|
+
return w.getWalletClient(getConfig(), parameters);
|
|
256
|
+
}
|
|
257
|
+
__name(getWalletClient2, "getWalletClient");
|
|
258
|
+
function multicall2(parameters) {
|
|
259
|
+
return w.multicall(getConfig(), parameters);
|
|
260
|
+
}
|
|
261
|
+
__name(multicall2, "multicall");
|
|
262
|
+
function prepareTransactionRequest2(parameters) {
|
|
263
|
+
return w.prepareTransactionRequest(getConfig(), parameters);
|
|
264
|
+
}
|
|
265
|
+
__name(prepareTransactionRequest2, "prepareTransactionRequest");
|
|
266
|
+
function readContract2(parameters) {
|
|
267
|
+
return w.readContract(getConfig(), parameters);
|
|
268
|
+
}
|
|
269
|
+
__name(readContract2, "readContract");
|
|
270
|
+
function readContracts2(parameters) {
|
|
271
|
+
return w.readContracts(getConfig(), parameters);
|
|
272
|
+
}
|
|
273
|
+
__name(readContracts2, "readContracts");
|
|
274
|
+
function sendCalls2(parameters) {
|
|
275
|
+
return w.sendCalls(getConfig(), parameters);
|
|
276
|
+
}
|
|
277
|
+
__name(sendCalls2, "sendCalls");
|
|
278
|
+
function sendTransaction2(parameters) {
|
|
279
|
+
return w.sendTransaction(getConfig(), parameters);
|
|
280
|
+
}
|
|
281
|
+
__name(sendTransaction2, "sendTransaction");
|
|
282
|
+
function signTypedData2(parameters) {
|
|
283
|
+
return w.signTypedData(getConfig(), parameters);
|
|
284
|
+
}
|
|
285
|
+
__name(signTypedData2, "signTypedData");
|
|
286
|
+
function simulateContract2(parameters) {
|
|
287
|
+
return w.simulateContract(getConfig(), parameters);
|
|
288
|
+
}
|
|
289
|
+
__name(simulateContract2, "simulateContract");
|
|
290
|
+
function switchChain2(parameters) {
|
|
291
|
+
return w.switchChain(getConfig(), parameters);
|
|
292
|
+
}
|
|
293
|
+
__name(switchChain2, "switchChain");
|
|
294
|
+
function verifyTypedData2(parameters) {
|
|
295
|
+
return w.verifyTypedData(getConfig(), parameters);
|
|
296
|
+
}
|
|
297
|
+
__name(verifyTypedData2, "verifyTypedData");
|
|
298
|
+
function waitForTransactionReceipt2(parameters) {
|
|
299
|
+
return w.waitForTransactionReceipt(getConfig(), parameters);
|
|
300
|
+
}
|
|
301
|
+
__name(waitForTransactionReceipt2, "waitForTransactionReceipt");
|
|
302
|
+
function watchBlockNumber2(parameters) {
|
|
303
|
+
return w.watchBlockNumber(getConfig(), parameters);
|
|
304
|
+
}
|
|
305
|
+
__name(watchBlockNumber2, "watchBlockNumber");
|
|
306
|
+
function watchBlocks2(parameters) {
|
|
307
|
+
return w.watchBlocks(getConfig(), parameters);
|
|
308
|
+
}
|
|
309
|
+
__name(watchBlocks2, "watchBlocks");
|
|
310
|
+
function watchClient2(parameters) {
|
|
311
|
+
return w.watchClient(getConfig(), parameters);
|
|
312
|
+
}
|
|
313
|
+
__name(watchClient2, "watchClient");
|
|
314
|
+
function watchContractEvent2(parameters) {
|
|
315
|
+
return w.watchContractEvent(getConfig(), parameters);
|
|
316
|
+
}
|
|
317
|
+
__name(watchContractEvent2, "watchContractEvent");
|
|
318
|
+
function watchPendingTransactions2(parameters) {
|
|
319
|
+
return w.watchPendingTransactions(getConfig(), parameters);
|
|
320
|
+
}
|
|
321
|
+
__name(watchPendingTransactions2, "watchPendingTransactions");
|
|
322
|
+
function watchPublicClient2(parameters) {
|
|
323
|
+
return w.watchPublicClient(getConfig(), parameters);
|
|
324
|
+
}
|
|
325
|
+
__name(watchPublicClient2, "watchPublicClient");
|
|
326
|
+
function writeContract2(parameters) {
|
|
327
|
+
return w.writeContract(getConfig(), parameters);
|
|
328
|
+
}
|
|
329
|
+
__name(writeContract2, "writeContract");
|
|
190
330
|
|
|
191
331
|
// src/events/account.ts
|
|
192
|
-
import {
|
|
193
|
-
var watchAccount = /* @__PURE__ */ __name((params) => {
|
|
194
|
-
return wagmiWatchAccount(getConfig(), params);
|
|
195
|
-
}, "watchAccount");
|
|
196
|
-
var watchConnections = /* @__PURE__ */ __name((params) => {
|
|
197
|
-
return wagmiWatchConnections(getConfig(), params);
|
|
198
|
-
}, "watchConnections");
|
|
332
|
+
import { reconnect as wagmiReconnect, connect as wagmiConnect, getAccount as wagmiGetAccount, disconnect as wagmiDisconnect } from "@wagmi/core";
|
|
199
333
|
var reconnect = /* @__PURE__ */ __name(async () => {
|
|
200
334
|
const config = getConfig();
|
|
201
335
|
if (getKitConfig().autoConnectInjected !== false) {
|
|
@@ -218,7 +352,7 @@ var reconnect = /* @__PURE__ */ __name(async () => {
|
|
|
218
352
|
console.warn("auto-connect skipped (non-fatal):", error);
|
|
219
353
|
}
|
|
220
354
|
}
|
|
221
|
-
if (
|
|
355
|
+
if (wagmiGetAccount(config).status === "connected") {
|
|
222
356
|
return [];
|
|
223
357
|
}
|
|
224
358
|
const result = await wagmiReconnect(config);
|
|
@@ -250,7 +384,7 @@ var disconnectAll = /* @__PURE__ */ __name(async (onLog) => {
|
|
|
250
384
|
// src/ConnectKitProvider.tsx
|
|
251
385
|
import { createContext, useCallback as useCallback4, useContext, useEffect as useEffect8, useMemo as useMemo2, useRef as useRef6, useState as useState7 } from "react";
|
|
252
386
|
import { WagmiProvider, useAccount, useConfig as useConfig3, useDisconnect, useSwitchChain } from "wagmi";
|
|
253
|
-
import { getAccount as
|
|
387
|
+
import { getAccount as getAccount2 } from "@wagmi/core";
|
|
254
388
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
255
389
|
|
|
256
390
|
// src/layout/connectDialog/index.tsx
|
|
@@ -917,10 +1051,10 @@ var AllWallets = /* @__PURE__ */ __name(({ wallets, isLoading, onSelectWallet })
|
|
|
917
1051
|
const q = search.trim().toLowerCase();
|
|
918
1052
|
let list = wallets;
|
|
919
1053
|
if (filterInstalled) {
|
|
920
|
-
list = list.filter((
|
|
1054
|
+
list = list.filter((w2) => w2.mobileNative || w2.mobileUniversal || w2.desktopNative || w2.desktopUniversal);
|
|
921
1055
|
}
|
|
922
1056
|
if (q) {
|
|
923
|
-
list = list.filter((
|
|
1057
|
+
list = list.filter((w2) => w2.name.toLowerCase().includes(q));
|
|
924
1058
|
}
|
|
925
1059
|
return list;
|
|
926
1060
|
}, [
|
|
@@ -1188,7 +1322,7 @@ var useMetaMaskExtension = /* @__PURE__ */ __name(() => {
|
|
|
1188
1322
|
// src/hooks/useWagmiConnect.ts
|
|
1189
1323
|
import { useEffect as useEffect3, useRef, useCallback } from "react";
|
|
1190
1324
|
import { useConnect, useConfig } from "wagmi";
|
|
1191
|
-
import { getAccount
|
|
1325
|
+
import { getAccount } from "@wagmi/core";
|
|
1192
1326
|
var hasMetaMaskKeyword = /* @__PURE__ */ __name((value) => value.toLowerCase().includes("metamask"), "hasMetaMaskKeyword");
|
|
1193
1327
|
var hasWalletConnectKeyword = /* @__PURE__ */ __name((value) => value.toLowerCase().includes("walletconnect"), "hasWalletConnectKeyword");
|
|
1194
1328
|
var isMetaMaskConnector = /* @__PURE__ */ __name((connector) => {
|
|
@@ -1292,7 +1426,7 @@ var useWagmiConnect = /* @__PURE__ */ __name(({ onConnect, onError, onQrUri, onS
|
|
|
1292
1426
|
if (attemptCounter.current !== attemptId) {
|
|
1293
1427
|
return;
|
|
1294
1428
|
}
|
|
1295
|
-
const address = (_b = (_a = result.accounts) == null ? void 0 : _a[0]) != null ? _b :
|
|
1429
|
+
const address = (_b = (_a = result.accounts) == null ? void 0 : _a[0]) != null ? _b : getAccount(config).address;
|
|
1296
1430
|
if (!address) {
|
|
1297
1431
|
throw new Error("Connected but no account returned");
|
|
1298
1432
|
}
|
|
@@ -1484,19 +1618,19 @@ var fetchWCWalletList = /* @__PURE__ */ __name(async (projectId, signal) => {
|
|
|
1484
1618
|
if (!res.ok) throw new Error(`Failed to fetch wallet list: ${res.status}`);
|
|
1485
1619
|
const json = await res.json();
|
|
1486
1620
|
const listings = Object.values((_a = json.listings) != null ? _a : {});
|
|
1487
|
-
for (const
|
|
1488
|
-
if (byId.has(
|
|
1489
|
-
byId.set(
|
|
1490
|
-
id:
|
|
1491
|
-
name:
|
|
1492
|
-
imageUrl: (_e = (_d = (_b =
|
|
1493
|
-
mobileNative: (_g = (_f =
|
|
1494
|
-
mobileUniversal: (_i = (_h =
|
|
1495
|
-
desktopNative: (_k = (_j =
|
|
1496
|
-
desktopUniversal: (_m = (_l =
|
|
1497
|
-
appIos: (_o = (_n =
|
|
1498
|
-
appAndroid: (_q = (_p =
|
|
1499
|
-
homepage: (_r =
|
|
1621
|
+
for (const w2 of listings) {
|
|
1622
|
+
if (byId.has(w2.id)) continue;
|
|
1623
|
+
byId.set(w2.id, {
|
|
1624
|
+
id: w2.id,
|
|
1625
|
+
name: w2.name,
|
|
1626
|
+
imageUrl: (_e = (_d = (_b = w2.image_url) == null ? void 0 : _b.md) != null ? _d : (_c = w2.image_url) == null ? void 0 : _c.sm) != null ? _e : "",
|
|
1627
|
+
mobileNative: (_g = (_f = w2.mobile) == null ? void 0 : _f.native) != null ? _g : "",
|
|
1628
|
+
mobileUniversal: (_i = (_h = w2.mobile) == null ? void 0 : _h.universal) != null ? _i : "",
|
|
1629
|
+
desktopNative: (_k = (_j = w2.desktop) == null ? void 0 : _j.native) != null ? _k : "",
|
|
1630
|
+
desktopUniversal: (_m = (_l = w2.desktop) == null ? void 0 : _l.universal) != null ? _m : "",
|
|
1631
|
+
appIos: (_o = (_n = w2.app) == null ? void 0 : _n.ios) != null ? _o : "",
|
|
1632
|
+
appAndroid: (_q = (_p = w2.app) == null ? void 0 : _p.android) != null ? _q : "",
|
|
1633
|
+
homepage: (_r = w2.homepage) != null ? _r : ""
|
|
1500
1634
|
});
|
|
1501
1635
|
}
|
|
1502
1636
|
if (listings.length < entries || byId.size >= json.total) break;
|
|
@@ -1981,7 +2115,7 @@ var ConnectKitProviderInner = /* @__PURE__ */ __name(({ children, siteKey, conne
|
|
|
1981
2115
|
}, []);
|
|
1982
2116
|
const close = useCallback4(() => {
|
|
1983
2117
|
setIsOpen(false);
|
|
1984
|
-
const status =
|
|
2118
|
+
const status = getAccount2(wagmiConfig).status;
|
|
1985
2119
|
if (status === "connecting" || status === "reconnecting") {
|
|
1986
2120
|
disconnectAsync().catch(() => void 0);
|
|
1987
2121
|
}
|
|
@@ -2091,22 +2225,14 @@ var useConnectKit = /* @__PURE__ */ __name(() => {
|
|
|
2091
2225
|
}, "useConnectKit");
|
|
2092
2226
|
|
|
2093
2227
|
// src/index.ts
|
|
2228
|
+
var bridged = Object.fromEntries(Object.entries(actions).map(([name, fn]) => [
|
|
2229
|
+
name,
|
|
2230
|
+
(...args) => fn(getConfig(), ...args)
|
|
2231
|
+
]));
|
|
2094
2232
|
var connectKit = {
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
getBalance,
|
|
2099
|
-
switchChain,
|
|
2100
|
-
getPublicClient,
|
|
2101
|
-
waitForTransactionReceipt,
|
|
2102
|
-
getAccount,
|
|
2103
|
-
signMessage,
|
|
2104
|
-
signTypedData,
|
|
2105
|
-
watchAsset
|
|
2106
|
-
},
|
|
2107
|
-
events: {
|
|
2108
|
-
watchAccount,
|
|
2109
|
-
watchConnections,
|
|
2233
|
+
actions: {
|
|
2234
|
+
...bridged,
|
|
2235
|
+
...wrappers_exports,
|
|
2110
2236
|
reconnect,
|
|
2111
2237
|
disconnectAll
|
|
2112
2238
|
}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import * as w from '@wagmi/core/actions';
|
|
2
|
+
import type {
|
|
3
|
+
Abi,
|
|
4
|
+
BlockTag,
|
|
5
|
+
ContractEventName,
|
|
6
|
+
ContractFunctionArgs,
|
|
7
|
+
ContractFunctionName,
|
|
8
|
+
ContractFunctionParameters,
|
|
9
|
+
FeeValuesType,
|
|
10
|
+
TypedData,
|
|
11
|
+
PrepareTransactionRequestRequest as ViemPrepareTransactionRequestRequest,
|
|
12
|
+
} from 'viem';
|
|
13
|
+
import type {
|
|
14
|
+
Config,
|
|
15
|
+
ConnectParameters,
|
|
16
|
+
ConnectReturnType,
|
|
17
|
+
Connector,
|
|
18
|
+
CreateConnectorFn,
|
|
19
|
+
DeployContractParameters,
|
|
20
|
+
DeployContractReturnType,
|
|
21
|
+
EstimateFeesPerGasParameters,
|
|
22
|
+
EstimateFeesPerGasReturnType,
|
|
23
|
+
EstimateGasParameters,
|
|
24
|
+
EstimateGasReturnType,
|
|
25
|
+
EstimateMaxPriorityFeePerGasParameters,
|
|
26
|
+
EstimateMaxPriorityFeePerGasReturnType,
|
|
27
|
+
GetBlockNumberParameters,
|
|
28
|
+
GetBlockNumberReturnType,
|
|
29
|
+
GetBlockParameters,
|
|
30
|
+
GetBlockReturnType,
|
|
31
|
+
GetBlockTransactionCountParameters,
|
|
32
|
+
GetBlockTransactionCountReturnType,
|
|
33
|
+
GetCapabilitiesParameters,
|
|
34
|
+
GetCapabilitiesReturnType,
|
|
35
|
+
GetClientParameters,
|
|
36
|
+
GetClientReturnType,
|
|
37
|
+
GetConnectorClientParameters,
|
|
38
|
+
GetConnectorClientReturnType,
|
|
39
|
+
GetFeeHistoryParameters,
|
|
40
|
+
GetFeeHistoryReturnType,
|
|
41
|
+
GetGasPriceParameters,
|
|
42
|
+
GetGasPriceReturnType,
|
|
43
|
+
GetPublicClientParameters,
|
|
44
|
+
GetPublicClientReturnType,
|
|
45
|
+
GetTransactionConfirmationsParameters,
|
|
46
|
+
GetTransactionConfirmationsReturnType,
|
|
47
|
+
GetTransactionParameters,
|
|
48
|
+
GetTransactionReceiptParameters,
|
|
49
|
+
GetTransactionReceiptReturnType,
|
|
50
|
+
GetTransactionReturnType,
|
|
51
|
+
GetWalletClientParameters,
|
|
52
|
+
GetWalletClientReturnType,
|
|
53
|
+
MulticallParameters,
|
|
54
|
+
MulticallReturnType,
|
|
55
|
+
PrepareTransactionRequestParameters,
|
|
56
|
+
PrepareTransactionRequestReturnType,
|
|
57
|
+
ReadContractParameters,
|
|
58
|
+
ReadContractReturnType,
|
|
59
|
+
ReadContractsParameters,
|
|
60
|
+
ReadContractsReturnType,
|
|
61
|
+
SelectChains,
|
|
62
|
+
SendCallsParameters,
|
|
63
|
+
SendCallsReturnType,
|
|
64
|
+
SendTransactionParameters,
|
|
65
|
+
SendTransactionReturnType,
|
|
66
|
+
SignTypedDataParameters,
|
|
67
|
+
SignTypedDataReturnType,
|
|
68
|
+
SimulateContractParameters,
|
|
69
|
+
SimulateContractReturnType,
|
|
70
|
+
SwitchChainParameters,
|
|
71
|
+
SwitchChainReturnType,
|
|
72
|
+
VerifyTypedDataParameters,
|
|
73
|
+
VerifyTypedDataReturnType,
|
|
74
|
+
WaitForTransactionReceiptParameters,
|
|
75
|
+
WaitForTransactionReceiptReturnType,
|
|
76
|
+
WatchBlockNumberParameters,
|
|
77
|
+
WatchBlockNumberReturnType,
|
|
78
|
+
WatchBlocksParameters,
|
|
79
|
+
WatchBlocksReturnType,
|
|
80
|
+
WatchClientParameters,
|
|
81
|
+
WatchClientReturnType,
|
|
82
|
+
WatchContractEventParameters,
|
|
83
|
+
WatchPendingTransactionsParameters,
|
|
84
|
+
WatchPublicClientParameters,
|
|
85
|
+
WatchPublicClientReturnType,
|
|
86
|
+
WriteContractParameters,
|
|
87
|
+
WriteContractReturnType,
|
|
88
|
+
} from '@wagmi/core';
|
|
89
|
+
import { getConfig } from '../core/config';
|
|
90
|
+
|
|
91
|
+
export function connect<
|
|
92
|
+
connector extends Connector | CreateConnectorFn,
|
|
93
|
+
withCapabilities extends boolean = false,
|
|
94
|
+
>(
|
|
95
|
+
parameters: ConnectParameters<Config, connector, withCapabilities>,
|
|
96
|
+
): Promise<ConnectReturnType<Config, connector, withCapabilities>> {
|
|
97
|
+
return w.connect(getConfig(), parameters as never) as never;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function deployContract<
|
|
101
|
+
const abi extends Abi | readonly unknown[],
|
|
102
|
+
chainId extends Config['chains'][number]['id'],
|
|
103
|
+
>(parameters: DeployContractParameters<abi, Config, chainId>): Promise<DeployContractReturnType> {
|
|
104
|
+
return w.deployContract(getConfig(), parameters as never) as never;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function estimateFeesPerGas<type extends FeeValuesType = 'eip1559'>(
|
|
108
|
+
parameters?: EstimateFeesPerGasParameters<type, Config>,
|
|
109
|
+
): Promise<EstimateFeesPerGasReturnType<type>> {
|
|
110
|
+
return w.estimateFeesPerGas(getConfig(), parameters as never) as never;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function estimateGas<chainId extends Config['chains'][number]['id'] | undefined = undefined>(
|
|
114
|
+
parameters: EstimateGasParameters<Config, chainId>,
|
|
115
|
+
): Promise<EstimateGasReturnType> {
|
|
116
|
+
return w.estimateGas(getConfig(), parameters as never) as never;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function estimateMaxPriorityFeePerGas<
|
|
120
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
121
|
+
>(
|
|
122
|
+
parameters?: EstimateMaxPriorityFeePerGasParameters<Config, chainId>,
|
|
123
|
+
): Promise<EstimateMaxPriorityFeePerGasReturnType> {
|
|
124
|
+
return w.estimateMaxPriorityFeePerGas(getConfig(), parameters as never) as never;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function getBlock<
|
|
128
|
+
chainId extends Config['chains'][number]['id'],
|
|
129
|
+
includeTransactions extends boolean = false,
|
|
130
|
+
blockTag extends BlockTag = 'latest',
|
|
131
|
+
>(
|
|
132
|
+
parameters?: GetBlockParameters<includeTransactions, blockTag, Config, chainId>,
|
|
133
|
+
): Promise<GetBlockReturnType<includeTransactions, blockTag, Config, chainId>> {
|
|
134
|
+
return w.getBlock(getConfig(), parameters as never) as never;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function getBlockNumber<
|
|
138
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
139
|
+
>(parameters?: GetBlockNumberParameters<Config, chainId>): Promise<GetBlockNumberReturnType> {
|
|
140
|
+
return w.getBlockNumber(getConfig(), parameters as never) as never;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function getBlockTransactionCount<
|
|
144
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
145
|
+
>(
|
|
146
|
+
parameters?: GetBlockTransactionCountParameters<Config, chainId>,
|
|
147
|
+
): Promise<GetBlockTransactionCountReturnType> {
|
|
148
|
+
return w.getBlockTransactionCount(getConfig(), parameters as never) as never;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function getCapabilities<
|
|
152
|
+
chainId extends Config['chains'][number]['id'] | undefined = undefined,
|
|
153
|
+
>(
|
|
154
|
+
parameters?: GetCapabilitiesParameters<Config, chainId>,
|
|
155
|
+
): Promise<GetCapabilitiesReturnType<Config, chainId>> {
|
|
156
|
+
return w.getCapabilities(getConfig(), parameters as never) as never;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getClient<chainId extends Config['chains'][number]['id'] | number | undefined>(
|
|
160
|
+
parameters?: GetClientParameters<Config, chainId>,
|
|
161
|
+
): GetClientReturnType<Config, chainId> {
|
|
162
|
+
return w.getClient(getConfig(), parameters as never) as never;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function getConnectorClient<chainId extends Config['chains'][number]['id']>(
|
|
166
|
+
parameters?: GetConnectorClientParameters<Config, chainId>,
|
|
167
|
+
): Promise<GetConnectorClientReturnType<Config, chainId>> {
|
|
168
|
+
return w.getConnectorClient(getConfig(), parameters as never) as never;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function getFeeHistory<
|
|
172
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
173
|
+
>(parameters: GetFeeHistoryParameters<Config, chainId>): Promise<GetFeeHistoryReturnType> {
|
|
174
|
+
return w.getFeeHistory(getConfig(), parameters as never) as never;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function getGasPrice<
|
|
178
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
179
|
+
>(parameters?: GetGasPriceParameters<Config, chainId>): Promise<GetGasPriceReturnType> {
|
|
180
|
+
return w.getGasPrice(getConfig(), parameters as never) as never;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function getPublicClient<
|
|
184
|
+
chainId extends Config['chains'][number]['id'] | number | undefined,
|
|
185
|
+
>(
|
|
186
|
+
parameters?: GetPublicClientParameters<Config, chainId>,
|
|
187
|
+
): GetPublicClientReturnType<Config, chainId> {
|
|
188
|
+
return w.getPublicClient(getConfig(), parameters as never) as never;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function getTransaction<chainId extends Config['chains'][number]['id']>(
|
|
192
|
+
parameters: GetTransactionParameters<Config, chainId>,
|
|
193
|
+
): Promise<GetTransactionReturnType<Config, chainId>> {
|
|
194
|
+
return w.getTransaction(getConfig(), parameters as never) as never;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function getTransactionConfirmations<
|
|
198
|
+
chainId extends Config['chains'][number]['id'] | undefined = Config['chains'][number]['id'],
|
|
199
|
+
>(
|
|
200
|
+
parameters: GetTransactionConfirmationsParameters<Config, chainId>,
|
|
201
|
+
): Promise<GetTransactionConfirmationsReturnType> {
|
|
202
|
+
return w.getTransactionConfirmations(getConfig(), parameters as never) as never;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function getTransactionReceipt<chainId extends Config['chains'][number]['id']>(
|
|
206
|
+
parameters: GetTransactionReceiptParameters<Config>,
|
|
207
|
+
): Promise<GetTransactionReceiptReturnType<Config, chainId>> {
|
|
208
|
+
return w.getTransactionReceipt(getConfig(), parameters as never) as never;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function getWalletClient<chainId extends Config['chains'][number]['id']>(
|
|
212
|
+
parameters?: GetWalletClientParameters<Config, chainId>,
|
|
213
|
+
): Promise<GetWalletClientReturnType<Config, chainId>> {
|
|
214
|
+
return w.getWalletClient(getConfig(), parameters as never) as never;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function multicall<
|
|
218
|
+
const contracts extends readonly ContractFunctionParameters[],
|
|
219
|
+
allowFailure extends boolean = true,
|
|
220
|
+
>(
|
|
221
|
+
parameters: MulticallParameters<contracts, allowFailure, Config>,
|
|
222
|
+
): Promise<MulticallReturnType<contracts, allowFailure>> {
|
|
223
|
+
return w.multicall(getConfig(), parameters as never) as never;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function prepareTransactionRequest<
|
|
227
|
+
chainId extends Config['chains'][number]['id'] | undefined,
|
|
228
|
+
const request extends ViemPrepareTransactionRequestRequest<
|
|
229
|
+
SelectChains<Config, chainId>['0'],
|
|
230
|
+
SelectChains<Config, chainId>['0']
|
|
231
|
+
>,
|
|
232
|
+
>(
|
|
233
|
+
parameters: PrepareTransactionRequestParameters<Config, chainId, request>,
|
|
234
|
+
): Promise<PrepareTransactionRequestReturnType<Config, chainId, request>> {
|
|
235
|
+
return w.prepareTransactionRequest(getConfig(), parameters as never) as never;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function readContract<
|
|
239
|
+
const abi extends Abi | readonly unknown[],
|
|
240
|
+
functionName extends ContractFunctionName<abi, 'pure' | 'view'>,
|
|
241
|
+
args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>,
|
|
242
|
+
>(
|
|
243
|
+
parameters: ReadContractParameters<abi, functionName, args, Config>,
|
|
244
|
+
): Promise<ReadContractReturnType<abi, functionName, args>> {
|
|
245
|
+
return w.readContract(getConfig(), parameters as never) as never;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function readContracts<
|
|
249
|
+
const contracts extends readonly ContractFunctionParameters[],
|
|
250
|
+
allowFailure extends boolean = true,
|
|
251
|
+
>(
|
|
252
|
+
parameters: ReadContractsParameters<contracts, allowFailure, Config>,
|
|
253
|
+
): Promise<ReadContractsReturnType<contracts, allowFailure>> {
|
|
254
|
+
return w.readContracts(getConfig(), parameters as never) as never;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function sendCalls<
|
|
258
|
+
const calls extends readonly unknown[],
|
|
259
|
+
chainId extends Config['chains'][number]['id'],
|
|
260
|
+
>(parameters: SendCallsParameters<Config, chainId, calls>): Promise<SendCallsReturnType> {
|
|
261
|
+
return w.sendCalls(getConfig(), parameters as never) as never;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function sendTransaction<chainId extends Config['chains'][number]['id']>(
|
|
265
|
+
parameters: SendTransactionParameters<Config, chainId>,
|
|
266
|
+
): Promise<SendTransactionReturnType> {
|
|
267
|
+
return w.sendTransaction(getConfig(), parameters as never) as never;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function signTypedData<
|
|
271
|
+
const typedData extends TypedData | Record<string, unknown>,
|
|
272
|
+
primaryType extends keyof typedData | 'EIP712Domain',
|
|
273
|
+
>(parameters: SignTypedDataParameters<typedData, primaryType>): Promise<SignTypedDataReturnType> {
|
|
274
|
+
return w.signTypedData(getConfig(), parameters as never) as never;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function simulateContract<
|
|
278
|
+
const abi extends Abi | readonly unknown[],
|
|
279
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
280
|
+
args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
281
|
+
chainId extends Config['chains'][number]['id'] | undefined = undefined,
|
|
282
|
+
>(
|
|
283
|
+
parameters: SimulateContractParameters<abi, functionName, args, Config, chainId>,
|
|
284
|
+
): Promise<SimulateContractReturnType<abi, functionName, args, Config, chainId>> {
|
|
285
|
+
return w.simulateContract(getConfig(), parameters as never) as never;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function switchChain<chainId extends Config['chains'][number]['id']>(
|
|
289
|
+
parameters: SwitchChainParameters<Config, chainId>,
|
|
290
|
+
): Promise<SwitchChainReturnType<Config, chainId>> {
|
|
291
|
+
return w.switchChain(getConfig(), parameters as never) as never;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function verifyTypedData<
|
|
295
|
+
const typedData extends TypedData | Record<string, unknown>,
|
|
296
|
+
primaryType extends keyof typedData | 'EIP712Domain',
|
|
297
|
+
>(
|
|
298
|
+
parameters: VerifyTypedDataParameters<typedData, primaryType, Config>,
|
|
299
|
+
): Promise<VerifyTypedDataReturnType> {
|
|
300
|
+
return w.verifyTypedData(getConfig(), parameters as never) as never;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export function waitForTransactionReceipt<chainId extends Config['chains'][number]['id']>(
|
|
304
|
+
parameters: WaitForTransactionReceiptParameters<Config, chainId>,
|
|
305
|
+
): Promise<WaitForTransactionReceiptReturnType<Config, chainId>> {
|
|
306
|
+
return w.waitForTransactionReceipt(getConfig(), parameters as never) as never;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export function watchBlockNumber<
|
|
310
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
311
|
+
>(parameters: WatchBlockNumberParameters<Config, chainId>): WatchBlockNumberReturnType {
|
|
312
|
+
return w.watchBlockNumber(getConfig(), parameters as never) as never;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function watchBlocks<
|
|
316
|
+
chainId extends Config['chains'][number]['id'] = Config['chains'][number]['id'],
|
|
317
|
+
includeTransactions extends boolean = false,
|
|
318
|
+
blockTag extends BlockTag = 'latest',
|
|
319
|
+
>(
|
|
320
|
+
parameters: WatchBlocksParameters<includeTransactions, blockTag, Config, chainId>,
|
|
321
|
+
): WatchBlocksReturnType {
|
|
322
|
+
return w.watchBlocks(getConfig(), parameters as never) as never;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function watchClient<chainId extends Config['chains'][number]['id']>(
|
|
326
|
+
parameters: WatchClientParameters<Config, chainId>,
|
|
327
|
+
): WatchClientReturnType {
|
|
328
|
+
return w.watchClient(getConfig(), parameters as never) as never;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export function watchContractEvent<
|
|
332
|
+
chainId extends Config['chains'][number]['id'],
|
|
333
|
+
const abi extends Abi | readonly unknown[],
|
|
334
|
+
eventName extends ContractEventName<abi> | undefined,
|
|
335
|
+
strict extends boolean | undefined = undefined,
|
|
336
|
+
>(parameters: WatchContractEventParameters<abi, eventName, strict, Config, chainId>): () => void {
|
|
337
|
+
return w.watchContractEvent(getConfig(), parameters as never) as never;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export function watchPendingTransactions<chainId extends Config['chains'][number]['id']>(
|
|
341
|
+
parameters: WatchPendingTransactionsParameters<Config, chainId>,
|
|
342
|
+
): () => void {
|
|
343
|
+
return w.watchPendingTransactions(getConfig(), parameters as never) as never;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function watchPublicClient<chainId extends Config['chains'][number]['id']>(
|
|
347
|
+
parameters: WatchPublicClientParameters<Config, chainId>,
|
|
348
|
+
): WatchPublicClientReturnType {
|
|
349
|
+
return w.watchPublicClient(getConfig(), parameters as never) as never;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function writeContract<
|
|
353
|
+
const abi extends Abi | readonly unknown[],
|
|
354
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
355
|
+
args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
356
|
+
chainId extends Config['chains'][number]['id'],
|
|
357
|
+
>(
|
|
358
|
+
parameters: WriteContractParameters<abi, functionName, args, Config, chainId>,
|
|
359
|
+
): Promise<WriteContractReturnType> {
|
|
360
|
+
return w.writeContract(getConfig(), parameters as never) as never;
|
|
361
|
+
}
|
package/src/events/account.ts
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
watchAccount as wagmiWatchAccount,
|
|
3
|
-
watchConnections as wagmiWatchConnections,
|
|
4
2
|
reconnect as wagmiReconnect,
|
|
5
3
|
connect as wagmiConnect,
|
|
6
4
|
getAccount as wagmiGetAccount,
|
|
7
5
|
disconnect as wagmiDisconnect,
|
|
8
|
-
type WatchAccountParameters,
|
|
9
|
-
type WatchConnectionsParameters,
|
|
10
6
|
type ReconnectReturnType,
|
|
11
7
|
} from '@wagmi/core';
|
|
12
8
|
import { getConfig, getKitConfig } from '../core/config';
|
|
13
9
|
|
|
14
|
-
export const watchAccount = (params: WatchAccountParameters): (() => void) => {
|
|
15
|
-
return wagmiWatchAccount(getConfig(), params);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const watchConnections = (params: WatchConnectionsParameters): (() => void) => {
|
|
19
|
-
return wagmiWatchConnections(getConfig(), params);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
10
|
export const reconnect = async (): Promise<ReconnectReturnType> => {
|
|
23
11
|
const config = getConfig();
|
|
24
12
|
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { getAccount, signMessage, signTypedData } from './api/account';
|
|
6
|
-
import { watchAsset } from './api/asset';
|
|
7
|
-
import { watchAccount, watchConnections, reconnect, disconnectAll } from './events/account';
|
|
1
|
+
import * as actions from '@wagmi/core/actions';
|
|
2
|
+
import * as wrappers from './api/wrappers';
|
|
3
|
+
import { reconnect, disconnectAll } from './events/account';
|
|
4
|
+
import { getConfig } from './core/config';
|
|
8
5
|
|
|
9
6
|
export { ConnectKitProvider, useConnectKit } from './ConnectKitProvider';
|
|
10
7
|
export type { ConnectKitContextValue, ConnectKitProviderProps } from './ConnectKitProvider';
|
|
@@ -26,25 +23,32 @@ export type {
|
|
|
26
23
|
WCWallet,
|
|
27
24
|
} from './types';
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
type StripConfig<T> = T extends (config: any, ...rest: infer A) => infer R
|
|
27
|
+
? (...rest: A) => R
|
|
28
|
+
: never;
|
|
29
|
+
|
|
30
|
+
type Bridge = { [K in keyof typeof actions]: StripConfig<(typeof actions)[K]> };
|
|
31
|
+
|
|
32
|
+
const bridged = Object.fromEntries(
|
|
33
|
+
Object.entries(actions).map(([name, fn]) => [
|
|
34
|
+
name,
|
|
35
|
+
(...args: unknown[]) => (fn as (...a: unknown[]) => unknown)(getConfig(), ...args),
|
|
36
|
+
]),
|
|
37
|
+
) as Bridge;
|
|
38
|
+
|
|
39
|
+
type KitActions = Omit<Bridge, keyof typeof wrappers | 'reconnect' | 'disconnectAll'> &
|
|
40
|
+
typeof wrappers & {
|
|
41
|
+
reconnect: typeof reconnect;
|
|
42
|
+
disconnectAll: typeof disconnectAll;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const connectKit: { readonly actions: KitActions } = {
|
|
46
|
+
actions: {
|
|
47
|
+
...bridged,
|
|
48
|
+
...wrappers,
|
|
45
49
|
reconnect,
|
|
46
50
|
disconnectAll,
|
|
47
51
|
},
|
|
48
|
-
}
|
|
52
|
+
};
|
|
49
53
|
|
|
50
54
|
export type * from '@wagmi/core';
|
package/src/api/account.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAccount as wagmiGetAccount,
|
|
3
|
-
signMessage as wagmiSignMessage,
|
|
4
|
-
signTypedData as wagmiSignTypedData,
|
|
5
|
-
type GetAccountReturnType,
|
|
6
|
-
type SignMessageParameters,
|
|
7
|
-
type SignTypedDataParameters,
|
|
8
|
-
} from '@wagmi/core';
|
|
9
|
-
import { getConfig } from '../core/config';
|
|
10
|
-
|
|
11
|
-
export const getAccount = (): GetAccountReturnType => {
|
|
12
|
-
return wagmiGetAccount(getConfig());
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const signMessage = (params: SignMessageParameters): Promise<`0x${string}`> => {
|
|
16
|
-
return wagmiSignMessage(getConfig(), params);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const signTypedData = (params: SignTypedDataParameters): Promise<`0x${string}`> => {
|
|
20
|
-
return wagmiSignTypedData(getConfig(), params);
|
|
21
|
-
};
|
package/src/api/asset.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
watchAsset as wagmiWatchAsset,
|
|
3
|
-
type WatchAssetParameters,
|
|
4
|
-
type WatchAssetReturnType,
|
|
5
|
-
} from '@wagmi/core';
|
|
6
|
-
import { getConfig } from '../core/config';
|
|
7
|
-
|
|
8
|
-
export const watchAsset = (params: WatchAssetParameters): Promise<WatchAssetReturnType> => {
|
|
9
|
-
return wagmiWatchAsset(getConfig(), params);
|
|
10
|
-
};
|
package/src/api/balance.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBalance as wagmiGetBalance,
|
|
3
|
-
type GetBalanceParameters,
|
|
4
|
-
type GetBalanceReturnType,
|
|
5
|
-
} from '@wagmi/core';
|
|
6
|
-
import { getConfig } from '../core/config';
|
|
7
|
-
|
|
8
|
-
export const getBalance = (params: GetBalanceParameters): Promise<GetBalanceReturnType> => {
|
|
9
|
-
return wagmiGetBalance(getConfig(), params);
|
|
10
|
-
};
|
package/src/api/chain.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
switchChain as wagmiSwitchChain,
|
|
3
|
-
getPublicClient as wagmiGetPublicClient,
|
|
4
|
-
type SwitchChainParameters,
|
|
5
|
-
type GetPublicClientParameters,
|
|
6
|
-
type GetPublicClientReturnType,
|
|
7
|
-
} from '@wagmi/core';
|
|
8
|
-
import type { Chain } from 'viem';
|
|
9
|
-
import { getConfig } from '../core/config';
|
|
10
|
-
|
|
11
|
-
export const switchChain = (params: SwitchChainParameters): Promise<Chain> => {
|
|
12
|
-
return wagmiSwitchChain(getConfig(), params);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const getPublicClient = (params?: GetPublicClientParameters): GetPublicClientReturnType => {
|
|
16
|
-
return wagmiGetPublicClient(getConfig(), params);
|
|
17
|
-
};
|
package/src/api/contract.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readContract as wagmiReadContract,
|
|
3
|
-
writeContract as wagmiWriteContract,
|
|
4
|
-
type ReadContractParameters,
|
|
5
|
-
type ReadContractReturnType,
|
|
6
|
-
type WriteContractParameters,
|
|
7
|
-
type WriteContractReturnType,
|
|
8
|
-
type Config,
|
|
9
|
-
} from '@wagmi/core';
|
|
10
|
-
import type { Abi, ContractFunctionArgs, ContractFunctionName } from 'viem';
|
|
11
|
-
import { getConfig } from '../core/config';
|
|
12
|
-
|
|
13
|
-
export function readContract<
|
|
14
|
-
const abi extends Abi | readonly unknown[],
|
|
15
|
-
functionName extends ContractFunctionName<abi, 'pure' | 'view'>,
|
|
16
|
-
args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>,
|
|
17
|
-
>(
|
|
18
|
-
parameters: ReadContractParameters<abi, functionName, args, Config>,
|
|
19
|
-
): Promise<ReadContractReturnType<abi, functionName, args>> {
|
|
20
|
-
return wagmiReadContract(getConfig(), parameters as any) as Promise<
|
|
21
|
-
ReadContractReturnType<abi, functionName, args>
|
|
22
|
-
>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function writeContract<
|
|
26
|
-
const abi extends Abi | readonly unknown[],
|
|
27
|
-
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
28
|
-
args extends ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
29
|
-
>(
|
|
30
|
-
parameters: WriteContractParameters<abi, functionName, args, Config>,
|
|
31
|
-
): Promise<WriteContractReturnType> {
|
|
32
|
-
return wagmiWriteContract(getConfig(), parameters as any);
|
|
33
|
-
}
|
package/src/api/transaction.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
waitForTransactionReceipt as wagmiWaitForTransactionReceipt,
|
|
3
|
-
type WaitForTransactionReceiptParameters,
|
|
4
|
-
type WaitForTransactionReceiptReturnType,
|
|
5
|
-
} from '@wagmi/core';
|
|
6
|
-
import { getConfig } from '../core/config';
|
|
7
|
-
|
|
8
|
-
export const waitForTransactionReceipt = (
|
|
9
|
-
params: WaitForTransactionReceiptParameters,
|
|
10
|
-
): Promise<WaitForTransactionReceiptReturnType> => {
|
|
11
|
-
return wagmiWaitForTransactionReceipt(getConfig(), params);
|
|
12
|
-
};
|