@wagmi/core 2.8.0 → 2.9.0
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/esm/actions/prepareTransactionRequest.js +4 -7
- package/dist/esm/actions/prepareTransactionRequest.js.map +1 -1
- package/dist/esm/actions/sendTransaction.js +1 -1
- package/dist/esm/actions/sendTransaction.js.map +1 -1
- package/dist/esm/connectors/mock.js +81 -2
- package/dist/esm/connectors/mock.js.map +1 -1
- package/dist/esm/experimental/actions/getCallsStatus.js +10 -0
- package/dist/esm/experimental/actions/getCallsStatus.js.map +1 -0
- package/dist/esm/experimental/actions/getCapabilities.js +10 -0
- package/dist/esm/experimental/actions/getCapabilities.js.map +1 -0
- package/dist/esm/experimental/actions/sendCalls.js +21 -0
- package/dist/esm/experimental/actions/sendCalls.js.map +1 -0
- package/dist/esm/experimental/actions/showCallsStatus.js +10 -0
- package/dist/esm/experimental/actions/showCallsStatus.js.map +1 -0
- package/dist/esm/experimental/actions/writeContracts.js +20 -0
- package/dist/esm/experimental/actions/writeContracts.js.map +1 -0
- package/dist/esm/experimental/query/getCallsStatus.js +24 -0
- package/dist/esm/experimental/query/getCallsStatus.js.map +1 -0
- package/dist/esm/experimental/query/getCapabilities.js +24 -0
- package/dist/esm/experimental/query/getCapabilities.js.map +1 -0
- package/dist/esm/experimental/query/sendCalls.js +12 -0
- package/dist/esm/experimental/query/sendCalls.js.map +1 -0
- package/dist/esm/experimental/query/showCallsStatus.js +12 -0
- package/dist/esm/experimental/query/showCallsStatus.js.map +1 -0
- package/dist/esm/experimental/query/writeContracts.js +12 -0
- package/dist/esm/experimental/query/writeContracts.js.map +1 -0
- package/dist/esm/exports/experimental.js +17 -0
- package/dist/esm/exports/experimental.js.map +1 -0
- package/dist/esm/query/prepareTransactionRequest.js +1 -2
- package/dist/esm/query/prepareTransactionRequest.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/prepareTransactionRequest.d.ts +3 -3
- package/dist/types/actions/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts +19 -1
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/connectors/mock.d.ts.map +1 -1
- package/dist/types/experimental/actions/getCallsStatus.d.ts +9 -0
- package/dist/types/experimental/actions/getCallsStatus.d.ts.map +1 -0
- package/dist/types/experimental/actions/getCapabilities.d.ts +10 -0
- package/dist/types/experimental/actions/getCapabilities.d.ts.map +1 -0
- package/dist/types/experimental/actions/sendCalls.d.ts +16 -0
- package/dist/types/experimental/actions/sendCalls.d.ts.map +1 -0
- package/dist/types/experimental/actions/showCallsStatus.d.ts +9 -0
- package/dist/types/experimental/actions/showCallsStatus.d.ts.map +1 -0
- package/dist/types/experimental/actions/writeContracts.d.ts +16 -0
- package/dist/types/experimental/actions/writeContracts.d.ts.map +1 -0
- package/dist/types/experimental/query/getCallsStatus.d.ts +34 -0
- package/dist/types/experimental/query/getCallsStatus.d.ts.map +1 -0
- package/dist/types/experimental/query/getCapabilities.d.ts +33 -0
- package/dist/types/experimental/query/getCapabilities.d.ts.map +1 -0
- package/dist/types/experimental/query/sendCalls.d.ts +13 -0
- package/dist/types/experimental/query/sendCalls.d.ts.map +1 -0
- package/dist/types/experimental/query/showCallsStatus.d.ts +13 -0
- package/dist/types/experimental/query/showCallsStatus.d.ts.map +1 -0
- package/dist/types/experimental/query/writeContracts.d.ts +13 -0
- package/dist/types/experimental/query/writeContracts.d.ts.map +1 -0
- package/dist/types/exports/experimental.d.ts +11 -0
- package/dist/types/exports/experimental.d.ts.map +1 -0
- package/dist/types/query/getConnectorClient.d.ts +25 -2
- package/dist/types/query/getConnectorClient.d.ts.map +1 -1
- package/dist/types/query/getWalletClient.d.ts +181 -177
- package/dist/types/query/getWalletClient.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +3 -3
- package/dist/types/query/prepareTransactionRequest.d.ts +3 -3
- package/dist/types/query/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +6 -3
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +14 -14
- package/dist/types/query/verifyMessage.d.ts +3 -3
- package/dist/types/transports/fallback.d.ts +1 -1
- package/dist/types/transports/fallback.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/experimental/package.json +5 -0
- package/package.json +9 -1
- package/src/actions/prepareTransactionRequest.ts +9 -17
- package/src/actions/sendTransaction.ts +1 -1
- package/src/connectors/mock.ts +88 -1
- package/src/experimental/actions/getCallsStatus.ts +27 -0
- package/src/experimental/actions/getCapabilities.ts +28 -0
- package/src/experimental/actions/sendCalls.ts +68 -0
- package/src/experimental/actions/showCallsStatus.ts +27 -0
- package/src/experimental/actions/writeContracts.ts +77 -0
- package/src/experimental/query/getCallsStatus.ts +50 -0
- package/src/experimental/query/getCapabilities.ts +50 -0
- package/src/experimental/query/sendCalls.ts +64 -0
- package/src/experimental/query/showCallsStatus.ts +57 -0
- package/src/experimental/query/writeContracts.ts +70 -0
- package/src/exports/experimental.ts +84 -0
- package/src/query/prepareTransactionRequest.ts +1 -2
- package/src/version.ts +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Account, type Chain } from 'viem'
|
|
2
|
+
import {
|
|
3
|
+
type SendCallsErrorType as viem_SendCallsErrorType,
|
|
4
|
+
type SendCallsParameters as viem_SendCallsParameters,
|
|
5
|
+
type SendCallsReturnType as viem_SendCallsReturnType,
|
|
6
|
+
sendCalls as viem_sendCalls,
|
|
7
|
+
} from 'viem/experimental'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type GetConnectorClientErrorType,
|
|
11
|
+
getConnectorClient,
|
|
12
|
+
} from '../../actions/getConnectorClient.js'
|
|
13
|
+
import { type Config } from '../../createConfig.js'
|
|
14
|
+
import type { BaseErrorType, ErrorType } from '../../errors/base.js'
|
|
15
|
+
import type { SelectChains } from '../../types/chain.js'
|
|
16
|
+
import type {
|
|
17
|
+
ChainIdParameter,
|
|
18
|
+
ConnectorParameter,
|
|
19
|
+
} from '../../types/properties.js'
|
|
20
|
+
import { type Evaluate } from '../../types/utils.js'
|
|
21
|
+
|
|
22
|
+
export type SendCallsParameters<
|
|
23
|
+
config extends Config = Config,
|
|
24
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
///
|
|
26
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
27
|
+
> = {
|
|
28
|
+
[key in keyof chains]: Evaluate<
|
|
29
|
+
Omit<viem_SendCallsParameters<chains[key], Account, chains[key]>, 'chain'> &
|
|
30
|
+
ChainIdParameter<config, chainId> &
|
|
31
|
+
ConnectorParameter
|
|
32
|
+
>
|
|
33
|
+
}[number]
|
|
34
|
+
|
|
35
|
+
export type SendCallsReturnType = viem_SendCallsReturnType
|
|
36
|
+
|
|
37
|
+
export type SendCallsErrorType =
|
|
38
|
+
// getConnectorClient()
|
|
39
|
+
| GetConnectorClientErrorType
|
|
40
|
+
// base
|
|
41
|
+
| BaseErrorType
|
|
42
|
+
| ErrorType
|
|
43
|
+
// viem
|
|
44
|
+
| viem_SendCallsErrorType
|
|
45
|
+
|
|
46
|
+
/** https://wagmi.sh/core/api/actions/sendCalls */
|
|
47
|
+
export async function sendCalls<
|
|
48
|
+
config extends Config,
|
|
49
|
+
chainId extends config['chains'][number]['id'],
|
|
50
|
+
>(
|
|
51
|
+
config: config,
|
|
52
|
+
parameters: SendCallsParameters<config, chainId>,
|
|
53
|
+
): Promise<SendCallsReturnType> {
|
|
54
|
+
const { account, chainId, connector, calls, ...rest } = parameters
|
|
55
|
+
|
|
56
|
+
const client = await getConnectorClient(config, {
|
|
57
|
+
account,
|
|
58
|
+
chainId,
|
|
59
|
+
connector,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return viem_sendCalls(client, {
|
|
63
|
+
...(rest as any),
|
|
64
|
+
...(account ? { account } : {}),
|
|
65
|
+
calls,
|
|
66
|
+
chain: chainId ? { id: chainId } : undefined,
|
|
67
|
+
})
|
|
68
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ShowCallsStatusErrorType as viem_ShowCallsStatusErrorType,
|
|
3
|
+
type ShowCallsStatusParameters as viem_ShowCallsStatusParameters,
|
|
4
|
+
type ShowCallsStatusReturnType as viem_ShowCallsStatusReturnType,
|
|
5
|
+
showCallsStatus as viem_showCallsStatus,
|
|
6
|
+
} from 'viem/experimental'
|
|
7
|
+
|
|
8
|
+
import { getConnectorClient } from '../../actions/getConnectorClient.js'
|
|
9
|
+
import { type Config } from '../../createConfig.js'
|
|
10
|
+
import type { ConnectorParameter } from '../../types/properties.js'
|
|
11
|
+
|
|
12
|
+
export type ShowCallsStatusParameters = viem_ShowCallsStatusParameters &
|
|
13
|
+
ConnectorParameter
|
|
14
|
+
|
|
15
|
+
export type ShowCallsStatusReturnType = viem_ShowCallsStatusReturnType
|
|
16
|
+
|
|
17
|
+
export type ShowCallsStatusErrorType = viem_ShowCallsStatusErrorType
|
|
18
|
+
|
|
19
|
+
/** https://wagmi.sh/core/api/actions/showCallsStatus */
|
|
20
|
+
export async function showCallsStatus<config extends Config>(
|
|
21
|
+
config: config,
|
|
22
|
+
parameters: ShowCallsStatusParameters,
|
|
23
|
+
): Promise<ShowCallsStatusReturnType> {
|
|
24
|
+
const { connector, id } = parameters
|
|
25
|
+
const client = await getConnectorClient(config, { connector })
|
|
26
|
+
return viem_showCallsStatus(client, { id })
|
|
27
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Account, type Chain, type ContractFunctionParameters } from 'viem'
|
|
2
|
+
import {
|
|
3
|
+
type WriteContractsErrorType as viem_WriteContractsErrorType,
|
|
4
|
+
type WriteContractsParameters as viem_WriteContractsParameters,
|
|
5
|
+
type WriteContractsReturnType as viem_WriteContractsReturnType,
|
|
6
|
+
writeContracts as viem_writeContracts,
|
|
7
|
+
} from 'viem/experimental'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
type GetConnectorClientErrorType,
|
|
11
|
+
getConnectorClient,
|
|
12
|
+
} from '../../actions/getConnectorClient.js'
|
|
13
|
+
import { type Config } from '../../createConfig.js'
|
|
14
|
+
import type { BaseErrorType, ErrorType } from '../../errors/base.js'
|
|
15
|
+
import type { SelectChains } from '../../types/chain.js'
|
|
16
|
+
import type {
|
|
17
|
+
ChainIdParameter,
|
|
18
|
+
ConnectorParameter,
|
|
19
|
+
} from '../../types/properties.js'
|
|
20
|
+
import { type Evaluate } from '../../types/utils.js'
|
|
21
|
+
|
|
22
|
+
export type WriteContractsParameters<
|
|
23
|
+
contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
|
|
24
|
+
config extends Config = Config,
|
|
25
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
26
|
+
///
|
|
27
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
28
|
+
> = {
|
|
29
|
+
[key in keyof chains]: Evaluate<
|
|
30
|
+
Omit<
|
|
31
|
+
viem_WriteContractsParameters<
|
|
32
|
+
contracts,
|
|
33
|
+
chains[key],
|
|
34
|
+
Account,
|
|
35
|
+
chains[key]
|
|
36
|
+
>,
|
|
37
|
+
'chain'
|
|
38
|
+
> &
|
|
39
|
+
ChainIdParameter<config, chainId> &
|
|
40
|
+
ConnectorParameter
|
|
41
|
+
>
|
|
42
|
+
}[number]
|
|
43
|
+
|
|
44
|
+
export type WriteContractsReturnType = viem_WriteContractsReturnType
|
|
45
|
+
|
|
46
|
+
export type WriteContractsErrorType =
|
|
47
|
+
// getConnectorClient()
|
|
48
|
+
| GetConnectorClientErrorType
|
|
49
|
+
// base
|
|
50
|
+
| BaseErrorType
|
|
51
|
+
| ErrorType
|
|
52
|
+
// viem
|
|
53
|
+
| viem_WriteContractsErrorType
|
|
54
|
+
|
|
55
|
+
/** https://wagmi.sh/core/api/actions/writeContracts */
|
|
56
|
+
export async function writeContracts<
|
|
57
|
+
const contracts extends readonly unknown[],
|
|
58
|
+
config extends Config,
|
|
59
|
+
chainId extends config['chains'][number]['id'],
|
|
60
|
+
>(
|
|
61
|
+
config: config,
|
|
62
|
+
parameters: WriteContractsParameters<contracts, config, chainId>,
|
|
63
|
+
): Promise<WriteContractsReturnType> {
|
|
64
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
65
|
+
|
|
66
|
+
const client = await getConnectorClient(config, {
|
|
67
|
+
account,
|
|
68
|
+
chainId,
|
|
69
|
+
connector,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return viem_writeContracts(client, {
|
|
73
|
+
...(rest as any),
|
|
74
|
+
...(account ? { account } : {}),
|
|
75
|
+
chain: chainId ? { id: chainId } : undefined,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type QueryOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import { type Config } from '../../createConfig.js'
|
|
4
|
+
import { ConnectorNotConnectedError } from '../../errors/config.js'
|
|
5
|
+
import { filterQueryOptions } from '../../query/utils.js'
|
|
6
|
+
import type { ScopeKeyParameter } from '../../types/properties.js'
|
|
7
|
+
import type { Evaluate } from '../../types/utils.js'
|
|
8
|
+
import {
|
|
9
|
+
type GetCallsStatusErrorType,
|
|
10
|
+
type GetCallsStatusParameters,
|
|
11
|
+
type GetCallsStatusReturnType,
|
|
12
|
+
getCallsStatus,
|
|
13
|
+
} from '../actions/getCallsStatus.js'
|
|
14
|
+
|
|
15
|
+
export type GetCallsStatusOptions = Evaluate<
|
|
16
|
+
GetCallsStatusParameters & ScopeKeyParameter
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
export function getCallsStatusQueryOptions<config extends Config,>(
|
|
20
|
+
config: config,
|
|
21
|
+
options: GetCallsStatusOptions,
|
|
22
|
+
) {
|
|
23
|
+
return {
|
|
24
|
+
async queryFn({ queryKey }) {
|
|
25
|
+
const { scopeKey: _, ...parameters } = queryKey[1]
|
|
26
|
+
const status = await getCallsStatus(config, parameters)
|
|
27
|
+
return status
|
|
28
|
+
},
|
|
29
|
+
queryKey: getCallsStatusQueryKey(options),
|
|
30
|
+
retry(failureCount, error) {
|
|
31
|
+
if (error instanceof ConnectorNotConnectedError) return false
|
|
32
|
+
return failureCount < 3
|
|
33
|
+
},
|
|
34
|
+
} as const satisfies QueryOptions<
|
|
35
|
+
GetCallsStatusQueryFnData,
|
|
36
|
+
GetCallsStatusErrorType,
|
|
37
|
+
GetCallsStatusData,
|
|
38
|
+
GetCallsStatusQueryKey
|
|
39
|
+
>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type GetCallsStatusQueryFnData = GetCallsStatusReturnType
|
|
43
|
+
|
|
44
|
+
export type GetCallsStatusData = GetCallsStatusQueryFnData
|
|
45
|
+
|
|
46
|
+
export function getCallsStatusQueryKey(options: GetCallsStatusOptions) {
|
|
47
|
+
return ['callsStatus', filterQueryOptions(options)] as const
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type GetCallsStatusQueryKey = ReturnType<typeof getCallsStatusQueryKey>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type QueryOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import { type Config } from '../../createConfig.js'
|
|
4
|
+
import { ConnectorNotConnectedError } from '../../errors/config.js'
|
|
5
|
+
import { filterQueryOptions } from '../../query/utils.js'
|
|
6
|
+
import type { ScopeKeyParameter } from '../../types/properties.js'
|
|
7
|
+
import type { Evaluate, ExactPartial } from '../../types/utils.js'
|
|
8
|
+
import {
|
|
9
|
+
type GetCapabilitiesErrorType,
|
|
10
|
+
type GetCapabilitiesParameters,
|
|
11
|
+
type GetCapabilitiesReturnType,
|
|
12
|
+
getCapabilities,
|
|
13
|
+
} from '../actions/getCapabilities.js'
|
|
14
|
+
|
|
15
|
+
export type GetCapabilitiesOptions = Evaluate<
|
|
16
|
+
ExactPartial<GetCapabilitiesParameters> & ScopeKeyParameter
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
export function getCapabilitiesQueryOptions<config extends Config,>(
|
|
20
|
+
config: config,
|
|
21
|
+
options: GetCapabilitiesOptions = {},
|
|
22
|
+
) {
|
|
23
|
+
return {
|
|
24
|
+
async queryFn({ queryKey }) {
|
|
25
|
+
const { scopeKey: _, ...parameters } = queryKey[1]
|
|
26
|
+
const capabilities = await getCapabilities(config, parameters)
|
|
27
|
+
return capabilities
|
|
28
|
+
},
|
|
29
|
+
queryKey: getCapabilitiesQueryKey(options),
|
|
30
|
+
retry(failureCount, error) {
|
|
31
|
+
if (error instanceof ConnectorNotConnectedError) return false
|
|
32
|
+
return failureCount < 3
|
|
33
|
+
},
|
|
34
|
+
} as const satisfies QueryOptions<
|
|
35
|
+
GetCapabilitiesQueryFnData,
|
|
36
|
+
GetCapabilitiesErrorType,
|
|
37
|
+
GetCapabilitiesData,
|
|
38
|
+
GetCapabilitiesQueryKey
|
|
39
|
+
>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type GetCapabilitiesQueryFnData = GetCapabilitiesReturnType
|
|
43
|
+
|
|
44
|
+
export type GetCapabilitiesData = GetCapabilitiesQueryFnData
|
|
45
|
+
|
|
46
|
+
export function getCapabilitiesQueryKey(options: GetCapabilitiesOptions = {}) {
|
|
47
|
+
return ['capabilities', filterQueryOptions(options)] as const
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type GetCapabilitiesQueryKey = ReturnType<typeof getCapabilitiesQueryKey>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import { type Config } from '../../createConfig.js'
|
|
4
|
+
import { type Evaluate } from '../../types/utils.js'
|
|
5
|
+
import {
|
|
6
|
+
type SendCallsErrorType,
|
|
7
|
+
type SendCallsParameters,
|
|
8
|
+
type SendCallsReturnType,
|
|
9
|
+
sendCalls,
|
|
10
|
+
} from '../actions/sendCalls.js'
|
|
11
|
+
|
|
12
|
+
export function sendCallsMutationOptions<config extends Config>(
|
|
13
|
+
config: config,
|
|
14
|
+
) {
|
|
15
|
+
return {
|
|
16
|
+
mutationFn(variables) {
|
|
17
|
+
return sendCalls(config, variables)
|
|
18
|
+
},
|
|
19
|
+
mutationKey: ['sendCalls'],
|
|
20
|
+
} as const satisfies MutationOptions<
|
|
21
|
+
SendCallsData,
|
|
22
|
+
SendCallsErrorType,
|
|
23
|
+
SendCallsVariables<config, config['chains'][number]['id']>
|
|
24
|
+
>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type SendCallsData = Evaluate<SendCallsReturnType>
|
|
28
|
+
|
|
29
|
+
export type SendCallsVariables<
|
|
30
|
+
config extends Config,
|
|
31
|
+
chainId extends config['chains'][number]['id'],
|
|
32
|
+
> = SendCallsParameters<config, chainId>
|
|
33
|
+
|
|
34
|
+
export type SendCallsMutate<config extends Config, context = unknown> = <
|
|
35
|
+
chainId extends config['chains'][number]['id'],
|
|
36
|
+
>(
|
|
37
|
+
variables: SendCallsVariables<config, chainId>,
|
|
38
|
+
options?:
|
|
39
|
+
| Evaluate<
|
|
40
|
+
MutateOptions<
|
|
41
|
+
SendCallsData,
|
|
42
|
+
SendCallsErrorType,
|
|
43
|
+
Evaluate<SendCallsVariables<config, chainId>>,
|
|
44
|
+
context
|
|
45
|
+
>
|
|
46
|
+
>
|
|
47
|
+
| undefined,
|
|
48
|
+
) => void
|
|
49
|
+
|
|
50
|
+
export type SendCallsMutateAsync<config extends Config, context = unknown> = <
|
|
51
|
+
chainId extends config['chains'][number]['id'],
|
|
52
|
+
>(
|
|
53
|
+
variables: SendCallsVariables<config, chainId>,
|
|
54
|
+
options?:
|
|
55
|
+
| Evaluate<
|
|
56
|
+
MutateOptions<
|
|
57
|
+
SendCallsData,
|
|
58
|
+
SendCallsErrorType,
|
|
59
|
+
Evaluate<SendCallsVariables<config, chainId>>,
|
|
60
|
+
context
|
|
61
|
+
>
|
|
62
|
+
>
|
|
63
|
+
| undefined,
|
|
64
|
+
) => Promise<SendCallsData>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import { type Config } from '../../createConfig.js'
|
|
4
|
+
import { type Evaluate } from '../../types/utils.js'
|
|
5
|
+
import {
|
|
6
|
+
type ShowCallsStatusErrorType,
|
|
7
|
+
type ShowCallsStatusParameters,
|
|
8
|
+
type ShowCallsStatusReturnType,
|
|
9
|
+
showCallsStatus,
|
|
10
|
+
} from '../actions/showCallsStatus.js'
|
|
11
|
+
|
|
12
|
+
export function showCallsStatusMutationOptions<config extends Config>(
|
|
13
|
+
config: config,
|
|
14
|
+
) {
|
|
15
|
+
return {
|
|
16
|
+
mutationFn(variables) {
|
|
17
|
+
return showCallsStatus(config, variables)
|
|
18
|
+
},
|
|
19
|
+
mutationKey: ['showCallsStatus'],
|
|
20
|
+
} as const satisfies MutationOptions<
|
|
21
|
+
ShowCallsStatusData,
|
|
22
|
+
ShowCallsStatusErrorType,
|
|
23
|
+
ShowCallsStatusVariables
|
|
24
|
+
>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ShowCallsStatusData = Evaluate<ShowCallsStatusReturnType>
|
|
28
|
+
|
|
29
|
+
export type ShowCallsStatusVariables = ShowCallsStatusParameters
|
|
30
|
+
|
|
31
|
+
export type ShowCallsStatusMutate<context = unknown> = (
|
|
32
|
+
variables: ShowCallsStatusVariables,
|
|
33
|
+
options?:
|
|
34
|
+
| Evaluate<
|
|
35
|
+
MutateOptions<
|
|
36
|
+
ShowCallsStatusData,
|
|
37
|
+
ShowCallsStatusErrorType,
|
|
38
|
+
Evaluate<ShowCallsStatusVariables>,
|
|
39
|
+
context
|
|
40
|
+
>
|
|
41
|
+
>
|
|
42
|
+
| undefined,
|
|
43
|
+
) => void
|
|
44
|
+
|
|
45
|
+
export type ShowCallsStatusMutateAsync<context = unknown,> = (
|
|
46
|
+
variables: ShowCallsStatusVariables,
|
|
47
|
+
options?:
|
|
48
|
+
| Evaluate<
|
|
49
|
+
MutateOptions<
|
|
50
|
+
ShowCallsStatusData,
|
|
51
|
+
ShowCallsStatusErrorType,
|
|
52
|
+
Evaluate<ShowCallsStatusVariables>,
|
|
53
|
+
context
|
|
54
|
+
>
|
|
55
|
+
>
|
|
56
|
+
| undefined,
|
|
57
|
+
) => Promise<ShowCallsStatusData>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
+
|
|
3
|
+
import { type Config } from '../../createConfig.js'
|
|
4
|
+
import { type Evaluate } from '../../types/utils.js'
|
|
5
|
+
import {
|
|
6
|
+
type WriteContractsErrorType,
|
|
7
|
+
type WriteContractsParameters,
|
|
8
|
+
type WriteContractsReturnType,
|
|
9
|
+
writeContracts,
|
|
10
|
+
} from '../actions/writeContracts.js'
|
|
11
|
+
|
|
12
|
+
export function writeContractsMutationOptions<
|
|
13
|
+
const contracts extends readonly unknown[],
|
|
14
|
+
config extends Config,
|
|
15
|
+
>(config: config) {
|
|
16
|
+
return {
|
|
17
|
+
mutationFn(variables) {
|
|
18
|
+
return writeContracts(config, variables as any) as any
|
|
19
|
+
},
|
|
20
|
+
mutationKey: ['writeContracts'],
|
|
21
|
+
} as const satisfies MutationOptions<
|
|
22
|
+
WriteContractsData,
|
|
23
|
+
WriteContractsErrorType,
|
|
24
|
+
WriteContractsVariables<contracts, config, config['chains'][number]['id']>
|
|
25
|
+
>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type WriteContractsData = Evaluate<WriteContractsReturnType>
|
|
29
|
+
|
|
30
|
+
export type WriteContractsVariables<
|
|
31
|
+
contracts extends readonly unknown[],
|
|
32
|
+
config extends Config,
|
|
33
|
+
chainId extends config['chains'][number]['id'],
|
|
34
|
+
> = WriteContractsParameters<contracts, config, chainId>
|
|
35
|
+
|
|
36
|
+
export type WriteContractsMutate<
|
|
37
|
+
contracts extends readonly unknown[],
|
|
38
|
+
config extends Config,
|
|
39
|
+
context = unknown,
|
|
40
|
+
> = <chainId extends config['chains'][number]['id'],>(
|
|
41
|
+
variables: WriteContractsVariables<contracts, config, chainId>,
|
|
42
|
+
options?:
|
|
43
|
+
| Evaluate<
|
|
44
|
+
MutateOptions<
|
|
45
|
+
WriteContractsData,
|
|
46
|
+
WriteContractsErrorType,
|
|
47
|
+
Evaluate<WriteContractsVariables<contracts, config, chainId>>,
|
|
48
|
+
context
|
|
49
|
+
>
|
|
50
|
+
>
|
|
51
|
+
| undefined,
|
|
52
|
+
) => void
|
|
53
|
+
|
|
54
|
+
export type WriteContractsMutateAsync<
|
|
55
|
+
contracts extends readonly unknown[],
|
|
56
|
+
config extends Config,
|
|
57
|
+
context = unknown,
|
|
58
|
+
> = <chainId extends config['chains'][number]['id'],>(
|
|
59
|
+
variables: WriteContractsVariables<contracts, config, chainId>,
|
|
60
|
+
options?:
|
|
61
|
+
| Evaluate<
|
|
62
|
+
MutateOptions<
|
|
63
|
+
WriteContractsData,
|
|
64
|
+
WriteContractsErrorType,
|
|
65
|
+
Evaluate<WriteContractsVariables<contracts, config, chainId>>,
|
|
66
|
+
context
|
|
67
|
+
>
|
|
68
|
+
>
|
|
69
|
+
| undefined,
|
|
70
|
+
) => Promise<WriteContractsData>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Actions
|
|
3
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
type GetCallsStatusErrorType,
|
|
7
|
+
type GetCallsStatusParameters,
|
|
8
|
+
type GetCallsStatusReturnType,
|
|
9
|
+
getCallsStatus,
|
|
10
|
+
} from '../experimental/actions/getCallsStatus.js'
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
type GetCapabilitiesErrorType,
|
|
14
|
+
type GetCapabilitiesParameters,
|
|
15
|
+
type GetCapabilitiesReturnType,
|
|
16
|
+
getCapabilities,
|
|
17
|
+
} from '../experimental/actions/getCapabilities.js'
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
type SendCallsErrorType,
|
|
21
|
+
type SendCallsParameters,
|
|
22
|
+
type SendCallsReturnType,
|
|
23
|
+
sendCalls,
|
|
24
|
+
} from '../experimental/actions/sendCalls.js'
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
type ShowCallsStatusErrorType,
|
|
28
|
+
type ShowCallsStatusParameters,
|
|
29
|
+
type ShowCallsStatusReturnType,
|
|
30
|
+
showCallsStatus,
|
|
31
|
+
} from '../experimental/actions/showCallsStatus.js'
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
type WriteContractsErrorType,
|
|
35
|
+
type WriteContractsParameters,
|
|
36
|
+
type WriteContractsReturnType,
|
|
37
|
+
writeContracts,
|
|
38
|
+
} from '../experimental/actions/writeContracts.js'
|
|
39
|
+
|
|
40
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
41
|
+
// Tanstack Query
|
|
42
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
type GetCallsStatusData,
|
|
46
|
+
type GetCallsStatusOptions,
|
|
47
|
+
type GetCallsStatusQueryFnData,
|
|
48
|
+
type GetCallsStatusQueryKey,
|
|
49
|
+
getCallsStatusQueryOptions,
|
|
50
|
+
getCallsStatusQueryKey,
|
|
51
|
+
} from '../experimental/query/getCallsStatus.js'
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
type GetCapabilitiesData,
|
|
55
|
+
type GetCapabilitiesOptions,
|
|
56
|
+
type GetCapabilitiesQueryFnData,
|
|
57
|
+
type GetCapabilitiesQueryKey,
|
|
58
|
+
getCapabilitiesQueryOptions,
|
|
59
|
+
getCapabilitiesQueryKey,
|
|
60
|
+
} from '../experimental/query/getCapabilities.js'
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
type SendCallsData,
|
|
64
|
+
type SendCallsMutate,
|
|
65
|
+
type SendCallsMutateAsync,
|
|
66
|
+
type SendCallsVariables,
|
|
67
|
+
sendCallsMutationOptions,
|
|
68
|
+
} from '../experimental/query/sendCalls.js'
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
type ShowCallsStatusData,
|
|
72
|
+
type ShowCallsStatusMutate,
|
|
73
|
+
type ShowCallsStatusMutateAsync,
|
|
74
|
+
type ShowCallsStatusVariables,
|
|
75
|
+
showCallsStatusMutationOptions,
|
|
76
|
+
} from '../experimental/query/showCallsStatus.js'
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
type WriteContractsData,
|
|
80
|
+
type WriteContractsMutate,
|
|
81
|
+
type WriteContractsMutateAsync,
|
|
82
|
+
type WriteContractsVariables,
|
|
83
|
+
writeContractsMutationOptions,
|
|
84
|
+
} from '../experimental/query/writeContracts.js'
|
|
@@ -86,8 +86,7 @@ export function prepareTransactionRequestQueryKey<
|
|
|
86
86
|
SelectChains<config, chainId>[0]
|
|
87
87
|
>,
|
|
88
88
|
>(options: PrepareTransactionRequestOptions<config, chainId, request>) {
|
|
89
|
-
|
|
90
|
-
return ['prepareTransactionRequest', filterQueryOptions(rest)] as const
|
|
89
|
+
return ['prepareTransactionRequest', filterQueryOptions(options)] as const
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
export type PrepareTransactionRequestQueryKey<
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.9.0'
|