@wagmi/core 3.2.3 → 3.3.1
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/getBlobBaseFee.js +10 -0
- package/dist/esm/actions/getBlobBaseFee.js.map +1 -0
- package/dist/esm/actions/getContractEvents.js +10 -0
- package/dist/esm/actions/getContractEvents.js.map +1 -0
- package/dist/esm/actions/writeContractSync.js +31 -0
- package/dist/esm/actions/writeContractSync.js.map +1 -0
- package/dist/esm/connectors/mock.js +2 -0
- package/dist/esm/connectors/mock.js.map +1 -1
- package/dist/esm/exports/actions.js +2 -0
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/index.js +3 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/query.js +3 -0
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/query/connect.js +3 -2
- package/dist/esm/query/connect.js.map +1 -1
- package/dist/esm/query/deployContract.js +2 -1
- package/dist/esm/query/deployContract.js.map +1 -1
- package/dist/esm/query/disconnect.js +3 -2
- package/dist/esm/query/disconnect.js.map +1 -1
- package/dist/esm/query/getBlobBaseFee.js +17 -0
- package/dist/esm/query/getBlobBaseFee.js.map +1 -0
- package/dist/esm/query/getContractEvents.js +24 -0
- package/dist/esm/query/getContractEvents.js.map +1 -0
- package/dist/esm/query/readContracts.js +13 -2
- package/dist/esm/query/readContracts.js.map +1 -1
- package/dist/esm/query/reconnect.js +2 -1
- package/dist/esm/query/reconnect.js.map +1 -1
- package/dist/esm/query/sendCalls.js +2 -1
- package/dist/esm/query/sendCalls.js.map +1 -1
- package/dist/esm/query/sendCallsSync.js +2 -1
- package/dist/esm/query/sendCallsSync.js.map +1 -1
- package/dist/esm/query/sendTransaction.js +2 -1
- package/dist/esm/query/sendTransaction.js.map +1 -1
- package/dist/esm/query/sendTransactionSync.js +2 -1
- package/dist/esm/query/sendTransactionSync.js.map +1 -1
- package/dist/esm/query/showCallsStatus.js +2 -1
- package/dist/esm/query/showCallsStatus.js.map +1 -1
- package/dist/esm/query/signMessage.js +2 -1
- package/dist/esm/query/signMessage.js.map +1 -1
- package/dist/esm/query/signTypedData.js +2 -1
- package/dist/esm/query/signTypedData.js.map +1 -1
- package/dist/esm/query/switchChain.js +2 -1
- package/dist/esm/query/switchChain.js.map +1 -1
- package/dist/esm/query/switchConnection.js +2 -1
- package/dist/esm/query/switchConnection.js.map +1 -1
- package/dist/esm/query/verifyTypedData.js.map +1 -1
- package/dist/esm/query/watchAsset.js +2 -1
- package/dist/esm/query/watchAsset.js.map +1 -1
- package/dist/esm/query/writeContract.js +2 -1
- package/dist/esm/query/writeContract.js.map +1 -1
- package/dist/esm/query/writeContractSync.js +11 -0
- package/dist/esm/query/writeContractSync.js.map +1 -0
- package/dist/esm/tempo/Connectors.js +6 -2
- package/dist/esm/tempo/Connectors.js.map +1 -1
- package/dist/esm/tempo/KeyManager.js +4 -4
- package/dist/esm/tempo/KeyManager.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/getBlobBaseFee.d.ts +10 -0
- package/dist/types/actions/getBlobBaseFee.d.ts.map +1 -0
- package/dist/types/actions/getContractEvents.d.ts +11 -0
- package/dist/types/actions/getContractEvents.d.ts.map +1 -0
- package/dist/types/actions/writeContractSync.d.ts +16 -0
- package/dist/types/actions/writeContractSync.d.ts.map +1 -0
- package/dist/types/connectors/mock.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +2 -0
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/index.d.ts +3 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +21 -14
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/query/connect.d.ts +5 -5
- package/dist/types/query/connect.d.ts.map +1 -1
- package/dist/types/query/deployContract.d.ts +5 -5
- package/dist/types/query/deployContract.d.ts.map +1 -1
- package/dist/types/query/disconnect.d.ts +5 -4
- package/dist/types/query/disconnect.d.ts.map +1 -1
- package/dist/types/query/getBlobBaseFee.d.ts +16 -0
- package/dist/types/query/getBlobBaseFee.d.ts.map +1 -0
- package/dist/types/query/getContractEvents.d.ts +24 -0
- package/dist/types/query/getContractEvents.d.ts.map +1 -0
- package/dist/types/query/getEnsAddress.d.ts +1 -1
- package/dist/types/query/getEnsAvatar.d.ts +1 -1
- package/dist/types/query/getEnsName.d.ts +1 -1
- package/dist/types/query/getEnsText.d.ts +1 -1
- package/dist/types/query/readContracts.d.ts +1 -1
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/reconnect.d.ts +5 -4
- package/dist/types/query/reconnect.d.ts.map +1 -1
- package/dist/types/query/sendCalls.d.ts +5 -10
- package/dist/types/query/sendCalls.d.ts.map +1 -1
- package/dist/types/query/sendCallsSync.d.ts +5 -18
- package/dist/types/query/sendCallsSync.d.ts.map +1 -1
- package/dist/types/query/sendTransaction.d.ts +5 -5
- package/dist/types/query/sendTransaction.d.ts.map +1 -1
- package/dist/types/query/sendTransactionSync.d.ts +5 -5
- package/dist/types/query/sendTransactionSync.d.ts.map +1 -1
- package/dist/types/query/showCallsStatus.d.ts +5 -5
- package/dist/types/query/showCallsStatus.d.ts.map +1 -1
- package/dist/types/query/signMessage.d.ts +5 -8
- package/dist/types/query/signMessage.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +5 -223
- package/dist/types/query/signTypedData.d.ts.map +1 -1
- package/dist/types/query/switchChain.d.ts +5 -21
- package/dist/types/query/switchChain.d.ts.map +1 -1
- package/dist/types/query/switchConnection.d.ts +5 -6
- package/dist/types/query/switchConnection.d.ts.map +1 -1
- package/dist/types/query/verifyTypedData.d.ts.map +1 -1
- package/dist/types/query/watchAsset.d.ts +5 -13
- package/dist/types/query/watchAsset.d.ts.map +1 -1
- package/dist/types/query/writeContract.d.ts +5 -7
- package/dist/types/query/writeContract.d.ts.map +1 -1
- package/dist/types/query/writeContractSync.d.ts +14 -0
- package/dist/types/query/writeContractSync.d.ts.map +1 -0
- package/dist/types/tempo/Connectors.d.ts.map +1 -1
- package/dist/types/types/query.d.ts +4 -1
- package/dist/types/types/query.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/actions/getBlobBaseFee.ts +35 -0
- package/src/actions/getContractEvents.ts +68 -0
- package/src/actions/writeContractSync.ts +120 -0
- package/src/connectors/mock.ts +1 -0
- package/src/exports/actions.ts +14 -0
- package/src/exports/index.ts +21 -0
- package/src/exports/query.ts +64 -0
- package/src/query/connect.ts +24 -8
- package/src/query/deployContract.ts +20 -5
- package/src/query/disconnect.ts +20 -9
- package/src/query/getBlobBaseFee.ts +75 -0
- package/src/query/getContractEvents.ts +214 -0
- package/src/query/readContracts.ts +12 -2
- package/src/query/reconnect.ts +20 -7
- package/src/query/sendCalls.ts +22 -8
- package/src/query/sendCallsSync.ts +20 -5
- package/src/query/sendTransaction.ts +20 -5
- package/src/query/sendTransactionSync.ts +23 -5
- package/src/query/showCallsStatus.ts +19 -8
- package/src/query/signMessage.ts +20 -7
- package/src/query/signTypedData.ts +19 -8
- package/src/query/switchChain.ts +22 -8
- package/src/query/switchConnection.ts +20 -5
- package/src/query/verifyTypedData.ts +0 -1
- package/src/query/watchAsset.ts +20 -7
- package/src/query/writeContract.ts +26 -5
- package/src/query/writeContractSync.ts +130 -0
- package/src/tempo/Connectors.ts +6 -2
- package/src/tempo/KeyManager.ts +6 -4
- package/src/types/query.ts +15 -1
- package/src/version.ts +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
type ShowCallsStatusErrorType,
|
|
5
4
|
type ShowCallsStatusParameters,
|
|
@@ -7,23 +6,35 @@ import {
|
|
|
7
6
|
showCallsStatus,
|
|
8
7
|
} from '../actions/showCallsStatus.js'
|
|
9
8
|
import type { Config } from '../createConfig.js'
|
|
9
|
+
import type { MutationParameter } from '../types/query.js'
|
|
10
10
|
import type { Compute } from '../types/utils.js'
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export type ShowCallsStatusOptions<context = unknown> = MutationParameter<
|
|
13
|
+
ShowCallsStatusData,
|
|
14
|
+
ShowCallsStatusErrorType,
|
|
15
|
+
ShowCallsStatusVariables,
|
|
16
|
+
context
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
export function showCallsStatusMutationOptions<config extends Config, context>(
|
|
13
20
|
config: config,
|
|
14
|
-
|
|
21
|
+
options: ShowCallsStatusOptions<context> = {},
|
|
22
|
+
): ShowCallsStatusMutationOptions {
|
|
15
23
|
return {
|
|
24
|
+
...(options.mutation as any),
|
|
16
25
|
mutationFn(variables) {
|
|
17
26
|
return showCallsStatus(config, variables)
|
|
18
27
|
},
|
|
19
28
|
mutationKey: ['showCallsStatus'],
|
|
20
|
-
}
|
|
21
|
-
ShowCallsStatusData,
|
|
22
|
-
ShowCallsStatusErrorType,
|
|
23
|
-
ShowCallsStatusVariables
|
|
24
|
-
>
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
export type ShowCallsStatusMutationOptions = MutationOptions<
|
|
33
|
+
ShowCallsStatusData,
|
|
34
|
+
ShowCallsStatusErrorType,
|
|
35
|
+
ShowCallsStatusVariables
|
|
36
|
+
>
|
|
37
|
+
|
|
27
38
|
export type ShowCallsStatusData = Compute<ShowCallsStatusReturnType>
|
|
28
39
|
|
|
29
40
|
export type ShowCallsStatusVariables = ShowCallsStatusParameters
|
package/src/query/signMessage.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
type SignMessageErrorType,
|
|
5
4
|
type SignMessageParameters,
|
|
@@ -7,22 +6,36 @@ import {
|
|
|
7
6
|
signMessage,
|
|
8
7
|
} from '../actions/signMessage.js'
|
|
9
8
|
import type { Config } from '../createConfig.js'
|
|
9
|
+
import type { MutationParameter } from '../types/query.js'
|
|
10
10
|
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import type { Mutate, MutateAsync } from './types.js'
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type SignMessageOptions<context = unknown> = MutationParameter<
|
|
14
|
+
SignMessageData,
|
|
15
|
+
SignMessageErrorType,
|
|
16
|
+
SignMessageVariables,
|
|
17
|
+
context
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export function signMessageMutationOptions<context>(
|
|
21
|
+
config: Config,
|
|
22
|
+
options: SignMessageOptions<context> = {},
|
|
23
|
+
): SignMessageMutationOptions {
|
|
14
24
|
return {
|
|
25
|
+
...(options.mutation as any),
|
|
15
26
|
mutationFn(variables) {
|
|
16
27
|
return signMessage(config, variables)
|
|
17
28
|
},
|
|
18
29
|
mutationKey: ['signMessage'],
|
|
19
|
-
}
|
|
20
|
-
SignMessageData,
|
|
21
|
-
SignMessageErrorType,
|
|
22
|
-
SignMessageVariables
|
|
23
|
-
>
|
|
30
|
+
}
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
export type SignMessageMutationOptions = MutationOptions<
|
|
34
|
+
SignMessageData,
|
|
35
|
+
SignMessageErrorType,
|
|
36
|
+
SignMessageVariables
|
|
37
|
+
>
|
|
38
|
+
|
|
26
39
|
export type SignMessageData = SignMessageReturnType
|
|
27
40
|
|
|
28
41
|
export type SignMessageVariables = Compute<SignMessageParameters>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import type { TypedData } from 'viem'
|
|
4
3
|
import {
|
|
5
4
|
type SignTypedDataErrorType,
|
|
@@ -8,23 +7,35 @@ import {
|
|
|
8
7
|
signTypedData,
|
|
9
8
|
} from '../actions/signTypedData.js'
|
|
10
9
|
import type { Config } from '../createConfig.js'
|
|
10
|
+
import type { MutationParameter } from '../types/query.js'
|
|
11
11
|
import type { Compute } from '../types/utils.js'
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type SignTypedDataOptions<context = unknown> = MutationParameter<
|
|
14
|
+
SignTypedDataData,
|
|
15
|
+
SignTypedDataErrorType,
|
|
16
|
+
SignTypedDataVariables,
|
|
17
|
+
context
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export function signTypedDataMutationOptions<config extends Config, context>(
|
|
14
21
|
config: config,
|
|
15
|
-
|
|
22
|
+
options: SignTypedDataOptions<context> = {},
|
|
23
|
+
): SignTypedDataMutationOptions {
|
|
16
24
|
return {
|
|
25
|
+
...(options.mutation as any),
|
|
17
26
|
mutationFn(variables) {
|
|
18
27
|
return signTypedData(config, variables)
|
|
19
28
|
},
|
|
20
29
|
mutationKey: ['signTypedData'],
|
|
21
|
-
}
|
|
22
|
-
SignTypedDataData,
|
|
23
|
-
SignTypedDataErrorType,
|
|
24
|
-
SignTypedDataVariables
|
|
25
|
-
>
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
export type SignTypedDataMutationOptions = MutationOptions<
|
|
34
|
+
SignTypedDataData,
|
|
35
|
+
SignTypedDataErrorType,
|
|
36
|
+
SignTypedDataVariables
|
|
37
|
+
>
|
|
38
|
+
|
|
28
39
|
export type SignTypedDataData = Compute<SignTypedDataReturnType>
|
|
29
40
|
|
|
30
41
|
export type SignTypedDataVariables<
|
package/src/query/switchChain.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
type SwitchChainErrorType,
|
|
5
4
|
type SwitchChainParameters,
|
|
@@ -7,23 +6,38 @@ import {
|
|
|
7
6
|
switchChain,
|
|
8
7
|
} from '../actions/switchChain.js'
|
|
9
8
|
import type { Config } from '../createConfig.js'
|
|
9
|
+
import type { MutationParameter } from '../types/query.js'
|
|
10
10
|
import type { Compute } from '../types/utils.js'
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export type SwitchChainOptions<
|
|
13
|
+
config extends Config,
|
|
14
|
+
context = unknown,
|
|
15
|
+
> = MutationParameter<
|
|
16
|
+
SwitchChainData<config, config['chains'][number]['id']>,
|
|
17
|
+
SwitchChainErrorType,
|
|
18
|
+
SwitchChainVariables<config, config['chains'][number]['id']>,
|
|
19
|
+
context
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
export function switchChainMutationOptions<config extends Config, context>(
|
|
13
23
|
config: config,
|
|
14
|
-
|
|
24
|
+
options: SwitchChainOptions<config, context> = {},
|
|
25
|
+
): SwitchChainMutationOptions<config> {
|
|
15
26
|
return {
|
|
27
|
+
...(options.mutation as any),
|
|
16
28
|
mutationFn(variables) {
|
|
17
29
|
return switchChain(config, variables)
|
|
18
30
|
},
|
|
19
31
|
mutationKey: ['switchChain'],
|
|
20
|
-
}
|
|
21
|
-
SwitchChainData<config, config['chains'][number]['id']>,
|
|
22
|
-
SwitchChainErrorType,
|
|
23
|
-
SwitchChainVariables<config, config['chains'][number]['id']>
|
|
24
|
-
>
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
export type SwitchChainMutationOptions<config extends Config> = MutationOptions<
|
|
36
|
+
SwitchChainData<config, config['chains'][number]['id']>,
|
|
37
|
+
SwitchChainErrorType,
|
|
38
|
+
SwitchChainVariables<config, config['chains'][number]['id']>
|
|
39
|
+
>
|
|
40
|
+
|
|
27
41
|
export type SwitchChainData<
|
|
28
42
|
config extends Config,
|
|
29
43
|
chainId extends config['chains'][number]['id'],
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
type SwitchConnectionErrorType,
|
|
5
4
|
type SwitchConnectionParameters,
|
|
@@ -7,23 +6,39 @@ import {
|
|
|
7
6
|
switchConnection,
|
|
8
7
|
} from '../actions/switchConnection.js'
|
|
9
8
|
import type { Config } from '../createConfig.js'
|
|
9
|
+
import type { MutationParameter } from '../types/query.js'
|
|
10
10
|
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import type { Mutate, MutateAsync } from './types.js'
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type SwitchConnectionOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
context = unknown,
|
|
16
|
+
> = MutationParameter<
|
|
17
|
+
SwitchConnectionData<config>,
|
|
18
|
+
SwitchConnectionErrorType,
|
|
19
|
+
SwitchConnectionVariables,
|
|
20
|
+
context
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
export function switchConnectionMutationOptions<config extends Config, context>(
|
|
14
24
|
config: config,
|
|
15
|
-
|
|
25
|
+
options: SwitchConnectionOptions<config, context> = {},
|
|
26
|
+
): SwitchConnectionMutationOptions<config> {
|
|
16
27
|
return {
|
|
28
|
+
...(options.mutation as any),
|
|
17
29
|
mutationFn(variables) {
|
|
18
30
|
return switchConnection(config, variables)
|
|
19
31
|
},
|
|
20
32
|
mutationKey: ['switchConnection'],
|
|
21
|
-
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type SwitchConnectionMutationOptions<config extends Config> =
|
|
37
|
+
MutationOptions<
|
|
22
38
|
SwitchConnectionData<config>,
|
|
23
39
|
SwitchConnectionErrorType,
|
|
24
40
|
SwitchConnectionVariables
|
|
25
41
|
>
|
|
26
|
-
}
|
|
27
42
|
|
|
28
43
|
export type SwitchConnectionData<config extends Config> = Compute<
|
|
29
44
|
SwitchConnectionReturnType<config>
|
package/src/query/watchAsset.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { MutationOptions } from '@tanstack/query-core'
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
type WatchAssetErrorType,
|
|
5
4
|
type WatchAssetParameters,
|
|
@@ -7,22 +6,36 @@ import {
|
|
|
7
6
|
watchAsset,
|
|
8
7
|
} from '../actions/watchAsset.js'
|
|
9
8
|
import type { Config } from '../createConfig.js'
|
|
9
|
+
import type { MutationParameter } from '../types/query.js'
|
|
10
10
|
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import type { Mutate, MutateAsync } from './types.js'
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type WatchAssetOptions<context = unknown> = MutationParameter<
|
|
14
|
+
WatchAssetData,
|
|
15
|
+
WatchAssetErrorType,
|
|
16
|
+
WatchAssetVariables,
|
|
17
|
+
context
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export function watchAssetMutationOptions<context>(
|
|
21
|
+
config: Config,
|
|
22
|
+
options: WatchAssetOptions<context> = {},
|
|
23
|
+
): WatchAssetMutationOptions {
|
|
14
24
|
return {
|
|
25
|
+
...(options.mutation as any),
|
|
15
26
|
mutationFn(variables) {
|
|
16
27
|
return watchAsset(config, variables)
|
|
17
28
|
},
|
|
18
29
|
mutationKey: ['watchAsset'],
|
|
19
|
-
}
|
|
20
|
-
WatchAssetData,
|
|
21
|
-
WatchAssetErrorType,
|
|
22
|
-
WatchAssetVariables
|
|
23
|
-
>
|
|
30
|
+
}
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
export type WatchAssetMutationOptions = MutationOptions<
|
|
34
|
+
WatchAssetData,
|
|
35
|
+
WatchAssetErrorType,
|
|
36
|
+
WatchAssetVariables
|
|
37
|
+
>
|
|
38
|
+
|
|
26
39
|
export type WatchAssetData = WatchAssetReturnType
|
|
27
40
|
|
|
28
41
|
export type WatchAssetVariables = Compute<WatchAssetParameters>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
2
|
import type { Abi, ContractFunctionArgs, ContractFunctionName } from 'viem'
|
|
3
|
-
|
|
4
3
|
import {
|
|
5
4
|
type WriteContractErrorType,
|
|
6
5
|
type WriteContractParameters,
|
|
@@ -8,17 +7,40 @@ import {
|
|
|
8
7
|
writeContract,
|
|
9
8
|
} from '../actions/writeContract.js'
|
|
10
9
|
import type { Config } from '../createConfig.js'
|
|
10
|
+
import type { MutationParameter } from '../types/query.js'
|
|
11
11
|
import type { Compute } from '../types/utils.js'
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type WriteContractOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
context = unknown,
|
|
16
|
+
> = MutationParameter<
|
|
17
|
+
WriteContractData,
|
|
18
|
+
WriteContractErrorType,
|
|
19
|
+
WriteContractVariables<
|
|
20
|
+
Abi,
|
|
21
|
+
string,
|
|
22
|
+
readonly unknown[],
|
|
23
|
+
config,
|
|
24
|
+
config['chains'][number]['id']
|
|
25
|
+
>,
|
|
26
|
+
context
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
export function writeContractMutationOptions<config extends Config, context>(
|
|
14
30
|
config: config,
|
|
15
|
-
|
|
31
|
+
options: WriteContractOptions<config, context> = {},
|
|
32
|
+
): WriteContractMutationOptions<config> {
|
|
16
33
|
return {
|
|
34
|
+
...(options.mutation as any),
|
|
17
35
|
mutationFn(variables) {
|
|
18
36
|
return writeContract(config, variables)
|
|
19
37
|
},
|
|
20
38
|
mutationKey: ['writeContract'],
|
|
21
|
-
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type WriteContractMutationOptions<config extends Config> =
|
|
43
|
+
MutationOptions<
|
|
22
44
|
WriteContractData,
|
|
23
45
|
WriteContractErrorType,
|
|
24
46
|
WriteContractVariables<
|
|
@@ -29,7 +51,6 @@ export function writeContractMutationOptions<config extends Config>(
|
|
|
29
51
|
config['chains'][number]['id']
|
|
30
52
|
>
|
|
31
53
|
>
|
|
32
|
-
}
|
|
33
54
|
|
|
34
55
|
export type WriteContractData = Compute<WriteContractReturnType>
|
|
35
56
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { MutateOptions, MutationOptions } from '@tanstack/query-core'
|
|
2
|
+
import type { Abi, ContractFunctionArgs, ContractFunctionName } from 'viem'
|
|
3
|
+
import {
|
|
4
|
+
type WriteContractSyncErrorType,
|
|
5
|
+
type WriteContractSyncParameters,
|
|
6
|
+
type WriteContractSyncReturnType,
|
|
7
|
+
writeContractSync,
|
|
8
|
+
} from '../actions/writeContractSync.js'
|
|
9
|
+
import type { Config } from '../createConfig.js'
|
|
10
|
+
import type { MutationParameter } from '../types/query.js'
|
|
11
|
+
import type { Compute } from '../types/utils.js'
|
|
12
|
+
|
|
13
|
+
export type WriteContractSyncOptions<
|
|
14
|
+
config extends Config,
|
|
15
|
+
context = unknown,
|
|
16
|
+
> = MutationParameter<
|
|
17
|
+
WriteContractSyncData,
|
|
18
|
+
WriteContractSyncErrorType,
|
|
19
|
+
WriteContractSyncVariables<
|
|
20
|
+
Abi,
|
|
21
|
+
string,
|
|
22
|
+
readonly unknown[],
|
|
23
|
+
config,
|
|
24
|
+
config['chains'][number]['id']
|
|
25
|
+
>,
|
|
26
|
+
context
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
export function writeContractSyncMutationOptions<
|
|
30
|
+
config extends Config,
|
|
31
|
+
context,
|
|
32
|
+
>(
|
|
33
|
+
config: config,
|
|
34
|
+
options: WriteContractSyncOptions<config, context> = {},
|
|
35
|
+
): WriteContractSyncMutationOptions<config> {
|
|
36
|
+
return {
|
|
37
|
+
...(options.mutation as any),
|
|
38
|
+
mutationFn(variables) {
|
|
39
|
+
return writeContractSync(config, variables)
|
|
40
|
+
},
|
|
41
|
+
mutationKey: ['writeContractSync'],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type WriteContractSyncMutationOptions<config extends Config> =
|
|
46
|
+
MutationOptions<
|
|
47
|
+
WriteContractSyncData,
|
|
48
|
+
WriteContractSyncErrorType,
|
|
49
|
+
WriteContractSyncVariables<
|
|
50
|
+
Abi,
|
|
51
|
+
string,
|
|
52
|
+
readonly unknown[],
|
|
53
|
+
config,
|
|
54
|
+
config['chains'][number]['id']
|
|
55
|
+
>
|
|
56
|
+
>
|
|
57
|
+
|
|
58
|
+
export type WriteContractSyncData = Compute<WriteContractSyncReturnType>
|
|
59
|
+
|
|
60
|
+
export type WriteContractSyncVariables<
|
|
61
|
+
abi extends Abi | readonly unknown[],
|
|
62
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
63
|
+
args extends ContractFunctionArgs<
|
|
64
|
+
abi,
|
|
65
|
+
'nonpayable' | 'payable',
|
|
66
|
+
functionName
|
|
67
|
+
>,
|
|
68
|
+
config extends Config,
|
|
69
|
+
chainId extends config['chains'][number]['id'],
|
|
70
|
+
> = WriteContractSyncParameters<abi, functionName, args, config, chainId>
|
|
71
|
+
|
|
72
|
+
export type WriteContractSyncMutate<
|
|
73
|
+
config extends Config,
|
|
74
|
+
context = unknown,
|
|
75
|
+
> = <
|
|
76
|
+
const abi extends Abi | readonly unknown[],
|
|
77
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
78
|
+
args extends ContractFunctionArgs<
|
|
79
|
+
abi,
|
|
80
|
+
'nonpayable' | 'payable',
|
|
81
|
+
functionName
|
|
82
|
+
>,
|
|
83
|
+
chainId extends config['chains'][number]['id'],
|
|
84
|
+
>(
|
|
85
|
+
variables: WriteContractSyncVariables<
|
|
86
|
+
abi,
|
|
87
|
+
functionName,
|
|
88
|
+
args,
|
|
89
|
+
config,
|
|
90
|
+
chainId
|
|
91
|
+
>,
|
|
92
|
+
options?:
|
|
93
|
+
| MutateOptions<
|
|
94
|
+
WriteContractSyncData,
|
|
95
|
+
WriteContractSyncErrorType,
|
|
96
|
+
WriteContractSyncVariables<abi, functionName, args, config, chainId>,
|
|
97
|
+
context
|
|
98
|
+
>
|
|
99
|
+
| undefined,
|
|
100
|
+
) => void
|
|
101
|
+
|
|
102
|
+
export type WriteContractSyncMutateAsync<
|
|
103
|
+
config extends Config,
|
|
104
|
+
context = unknown,
|
|
105
|
+
> = <
|
|
106
|
+
const abi extends Abi | readonly unknown[],
|
|
107
|
+
functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
108
|
+
args extends ContractFunctionArgs<
|
|
109
|
+
abi,
|
|
110
|
+
'nonpayable' | 'payable',
|
|
111
|
+
functionName
|
|
112
|
+
>,
|
|
113
|
+
chainId extends config['chains'][number]['id'],
|
|
114
|
+
>(
|
|
115
|
+
variables: WriteContractSyncVariables<
|
|
116
|
+
abi,
|
|
117
|
+
functionName,
|
|
118
|
+
args,
|
|
119
|
+
config,
|
|
120
|
+
chainId
|
|
121
|
+
>,
|
|
122
|
+
options?:
|
|
123
|
+
| MutateOptions<
|
|
124
|
+
WriteContractSyncData,
|
|
125
|
+
WriteContractSyncErrorType,
|
|
126
|
+
WriteContractSyncVariables<abi, functionName, args, config, chainId>,
|
|
127
|
+
context
|
|
128
|
+
>
|
|
129
|
+
| undefined,
|
|
130
|
+
) => Promise<WriteContractSyncData>
|
package/src/tempo/Connectors.ts
CHANGED
|
@@ -91,7 +91,9 @@ export function webAuthn(options: webAuthn.Parameters) {
|
|
|
91
91
|
'webAuthn.activeCredential',
|
|
92
92
|
)
|
|
93
93
|
if (!credential) return
|
|
94
|
-
account = Account.fromWebAuthnP256(credential
|
|
94
|
+
account = Account.fromWebAuthnP256(credential, {
|
|
95
|
+
rpId: options.getOptions?.rpId ?? options.rpId,
|
|
96
|
+
})
|
|
95
97
|
},
|
|
96
98
|
async connect(parameters = {}) {
|
|
97
99
|
const capabilities =
|
|
@@ -243,7 +245,9 @@ export function webAuthn(options: webAuthn.Parameters) {
|
|
|
243
245
|
normalizeValue(credential),
|
|
244
246
|
)
|
|
245
247
|
|
|
246
|
-
account = Account.fromWebAuthnP256(credential
|
|
248
|
+
account = Account.fromWebAuthnP256(credential, {
|
|
249
|
+
rpId: options.getOptions?.rpId ?? options.rpId,
|
|
250
|
+
})
|
|
247
251
|
|
|
248
252
|
if (keyPair) {
|
|
249
253
|
accessKey = Account.fromWebCryptoP256(keyPair, {
|
package/src/tempo/KeyManager.ts
CHANGED
|
@@ -200,22 +200,24 @@ function serializeCredential(
|
|
|
200
200
|
...('getAuthenticatorData' in response &&
|
|
201
201
|
typeof response.getAuthenticatorData === 'function' && {
|
|
202
202
|
authenticatorData: Base64.fromBytes(
|
|
203
|
-
new Uint8Array(
|
|
203
|
+
new Uint8Array(
|
|
204
|
+
response.getAuthenticatorData.call(response) as ArrayBuffer,
|
|
205
|
+
),
|
|
204
206
|
),
|
|
205
207
|
}),
|
|
206
208
|
...('getPublicKey' in response &&
|
|
207
209
|
typeof response.getPublicKey === 'function' && {
|
|
208
210
|
publicKey: Base64.fromBytes(
|
|
209
|
-
new Uint8Array(response.getPublicKey() as ArrayBuffer),
|
|
211
|
+
new Uint8Array(response.getPublicKey.call(response) as ArrayBuffer),
|
|
210
212
|
),
|
|
211
213
|
}),
|
|
212
214
|
...('getPublicKeyAlgorithm' in response &&
|
|
213
215
|
typeof response.getPublicKeyAlgorithm === 'function' && {
|
|
214
|
-
publicKeyAlgorithm: response.getPublicKeyAlgorithm(),
|
|
216
|
+
publicKeyAlgorithm: response.getPublicKeyAlgorithm.call(response),
|
|
215
217
|
}),
|
|
216
218
|
...('getTransports' in response &&
|
|
217
219
|
typeof response.getTransports === 'function' && {
|
|
218
|
-
transports: response.getTransports(),
|
|
220
|
+
transports: response.getTransports.call(response),
|
|
219
221
|
}),
|
|
220
222
|
...('authenticatorData' in response && {
|
|
221
223
|
authenticatorData: Base64.fromBytes(
|
package/src/types/query.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type * as Query from '@tanstack/query-core'
|
|
2
|
-
import type { RequiredBy, UnionLooseOmit } from './utils.js'
|
|
2
|
+
import type { Compute, LooseOmit, RequiredBy, UnionLooseOmit } from './utils.js'
|
|
3
|
+
|
|
4
|
+
export type MutationParameter<
|
|
5
|
+
data = unknown,
|
|
6
|
+
error = Error,
|
|
7
|
+
variables = void,
|
|
8
|
+
context = unknown,
|
|
9
|
+
> = {
|
|
10
|
+
mutation?:
|
|
11
|
+
| LooseOmit<
|
|
12
|
+
Query.MutationOptions<data, error, Compute<variables>, context>,
|
|
13
|
+
'mutationFn' | 'mutationKey' | 'throwOnError'
|
|
14
|
+
>
|
|
15
|
+
| undefined
|
|
16
|
+
}
|
|
3
17
|
|
|
4
18
|
export type QueryParameter<
|
|
5
19
|
queryFnData = unknown,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.3.1'
|