wagmi 3.6.8 → 3.6.10
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/tempo/hooks/index.js +1 -0
- package/dist/esm/tempo/hooks/index.js.map +1 -1
- package/dist/esm/tempo/hooks/wallet.js +126 -0
- package/dist/esm/tempo/hooks/wallet.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/tempo/hooks/index.d.ts +1 -0
- package/dist/types/tempo/hooks/index.d.ts.map +1 -1
- package/dist/types/tempo/hooks/wallet.d.ts +116 -0
- package/dist/types/tempo/hooks/wallet.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/tempo/hooks/index.ts +1 -0
- package/src/tempo/hooks/wallet.ts +224 -0
- package/src/version.ts +1 -1
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '3.6.
|
|
1
|
+
export const version = '3.6.10';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA"}
|
|
@@ -7,5 +7,6 @@ export * as nonce from './nonce.js';
|
|
|
7
7
|
export * as policy from './policy.js';
|
|
8
8
|
export * as reward from './reward.js';
|
|
9
9
|
export * as token from './token.js';
|
|
10
|
+
export * as wallet from './wallet.js';
|
|
10
11
|
export * as zone from './zone.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
import type { Config, ResolvedRegister } from '@wagmi/core';
|
|
3
|
+
import type { ConfigParameter } from '@wagmi/core/internal';
|
|
4
|
+
import { Actions } from '@wagmi/core/tempo';
|
|
5
|
+
import { type UseMutationParameters } from '../../utils/query.js';
|
|
6
|
+
/**
|
|
7
|
+
* Hook for opening the wallet send flow with optional pre-filled send fields.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
12
|
+
*
|
|
13
|
+
* function App() {
|
|
14
|
+
* const { mutate, isPending } = Hooks.wallet.useSend()
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <button
|
|
18
|
+
* onClick={() =>
|
|
19
|
+
* mutate({
|
|
20
|
+
* to: '0x...',
|
|
21
|
+
* token: '0x...',
|
|
22
|
+
* value: '1.5',
|
|
23
|
+
* })
|
|
24
|
+
* }
|
|
25
|
+
* disabled={isPending}
|
|
26
|
+
* >
|
|
27
|
+
* Send
|
|
28
|
+
* </button>
|
|
29
|
+
* )
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param parameters - Parameters.
|
|
34
|
+
* @returns Mutation result.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useSend<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useSend.Parameters<config, context>): useSend.ReturnType<config, context>;
|
|
37
|
+
export declare namespace useSend {
|
|
38
|
+
type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
|
|
39
|
+
mutation?: UseMutationParameters<Actions.wallet.send.ReturnValue, Actions.wallet.send.ErrorType, Actions.wallet.send.Parameters<config>, context> | undefined;
|
|
40
|
+
};
|
|
41
|
+
type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.send.ReturnValue, Actions.wallet.send.ErrorType, Actions.wallet.send.Parameters<config>, context>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Hook for opening the wallet swap flow with optional pre-filled swap fields.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
49
|
+
*
|
|
50
|
+
* function App() {
|
|
51
|
+
* const { mutate, isPending } = Hooks.wallet.useSwap()
|
|
52
|
+
*
|
|
53
|
+
* return (
|
|
54
|
+
* <button
|
|
55
|
+
* onClick={() =>
|
|
56
|
+
* mutate({
|
|
57
|
+
* amount: '1.5',
|
|
58
|
+
* token: '0x...',
|
|
59
|
+
* type: 'sell',
|
|
60
|
+
* })
|
|
61
|
+
* }
|
|
62
|
+
* disabled={isPending}
|
|
63
|
+
* >
|
|
64
|
+
* Swap
|
|
65
|
+
* </button>
|
|
66
|
+
* )
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param parameters - Parameters.
|
|
71
|
+
* @returns Mutation result.
|
|
72
|
+
*/
|
|
73
|
+
export declare function useSwap<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useSwap.Parameters<config, context>): useSwap.ReturnType<config, context>;
|
|
74
|
+
export declare namespace useSwap {
|
|
75
|
+
type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
|
|
76
|
+
mutation?: UseMutationParameters<Actions.wallet.swap.ReturnValue, Actions.wallet.swap.ErrorType, Actions.wallet.swap.Parameters<config>, context> | undefined;
|
|
77
|
+
};
|
|
78
|
+
type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.swap.ReturnValue, Actions.wallet.swap.ErrorType, Actions.wallet.swap.Parameters<config>, context>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Hook for opening the wallet deposit flow with optional pre-filled deposit fields.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
86
|
+
*
|
|
87
|
+
* function App() {
|
|
88
|
+
* const { mutate, isPending } = Hooks.wallet.useDeposit()
|
|
89
|
+
*
|
|
90
|
+
* return (
|
|
91
|
+
* <button
|
|
92
|
+
* onClick={() =>
|
|
93
|
+
* mutate({
|
|
94
|
+
* token: '0x...',
|
|
95
|
+
* value: '1.5',
|
|
96
|
+
* })
|
|
97
|
+
* }
|
|
98
|
+
* disabled={isPending}
|
|
99
|
+
* >
|
|
100
|
+
* Deposit
|
|
101
|
+
* </button>
|
|
102
|
+
* )
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @param parameters - Parameters.
|
|
107
|
+
* @returns Mutation result.
|
|
108
|
+
*/
|
|
109
|
+
export declare function useDeposit<config extends Config = ResolvedRegister['config'], context = unknown>(parameters?: useDeposit.Parameters<config, context>): useDeposit.ReturnType<config, context>;
|
|
110
|
+
export declare namespace useDeposit {
|
|
111
|
+
type Parameters<config extends Config = Config, context = unknown> = ConfigParameter<config> & {
|
|
112
|
+
mutation?: UseMutationParameters<Actions.wallet.deposit.ReturnValue, Actions.wallet.deposit.ErrorType, Actions.wallet.deposit.Parameters<config>, context> | undefined;
|
|
113
|
+
};
|
|
114
|
+
type ReturnType<config extends Config = Config, context = unknown> = UseMutationResult<Actions.wallet.deposit.ReturnValue, Actions.wallet.deposit.ErrorType, Actions.wallet.deposit.Parameters<config>, context>;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/tempo/hooks/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,KAAK,qBAAqB,EAAe,MAAM,sBAAsB,CAAA;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,OAAO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AM,CAAC,EACzC,OAAO,CACR,GACD,SAAS,CAAA;KACd,CAAA;IAED,KAAK,UAAU,CACb,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,OAAO,GAAG,OAAO,IACf,iBAAiB,CACnB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAClC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAChC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EACzC,OAAO,CACR,CAAA;CACF"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "3.6.
|
|
1
|
+
export declare const version = "3.6.10";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wagmi",
|
|
3
3
|
"description": "React Hooks for Ethereum",
|
|
4
|
-
"version": "3.6.
|
|
4
|
+
"version": "3.6.10",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"use-sync-external-store": "1.4.0",
|
|
95
|
-
"@wagmi/connectors": "8.0.
|
|
96
|
-
"@wagmi/core": "3.4.
|
|
95
|
+
"@wagmi/connectors": "8.0.10",
|
|
96
|
+
"@wagmi/core": "3.4.9"
|
|
97
97
|
},
|
|
98
98
|
"contributors": [
|
|
99
99
|
"awkweb.eth <t@wevm.dev>",
|
package/src/tempo/hooks/index.ts
CHANGED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import type { UseMutationResult } from '@tanstack/react-query'
|
|
2
|
+
import type { Config, ResolvedRegister } from '@wagmi/core'
|
|
3
|
+
import type { ConfigParameter } from '@wagmi/core/internal'
|
|
4
|
+
import { Actions } from '@wagmi/core/tempo'
|
|
5
|
+
import { useConfig } from '../../hooks/useConfig.js'
|
|
6
|
+
import { type UseMutationParameters, useMutation } from '../../utils/query.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Hook for opening the wallet send flow with optional pre-filled send fields.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
14
|
+
*
|
|
15
|
+
* function App() {
|
|
16
|
+
* const { mutate, isPending } = Hooks.wallet.useSend()
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <button
|
|
20
|
+
* onClick={() =>
|
|
21
|
+
* mutate({
|
|
22
|
+
* to: '0x...',
|
|
23
|
+
* token: '0x...',
|
|
24
|
+
* value: '1.5',
|
|
25
|
+
* })
|
|
26
|
+
* }
|
|
27
|
+
* disabled={isPending}
|
|
28
|
+
* >
|
|
29
|
+
* Send
|
|
30
|
+
* </button>
|
|
31
|
+
* )
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param parameters - Parameters.
|
|
36
|
+
* @returns Mutation result.
|
|
37
|
+
*/
|
|
38
|
+
export function useSend<
|
|
39
|
+
config extends Config = ResolvedRegister['config'],
|
|
40
|
+
context = unknown,
|
|
41
|
+
>(
|
|
42
|
+
parameters: useSend.Parameters<config, context> = {},
|
|
43
|
+
): useSend.ReturnType<config, context> {
|
|
44
|
+
const { mutation } = parameters
|
|
45
|
+
const config = useConfig(parameters)
|
|
46
|
+
return useMutation({
|
|
47
|
+
...mutation,
|
|
48
|
+
async mutationFn(variables) {
|
|
49
|
+
return Actions.wallet.send(config, variables)
|
|
50
|
+
},
|
|
51
|
+
mutationKey: ['wallet', 'send'],
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare namespace useSend {
|
|
56
|
+
type Parameters<
|
|
57
|
+
config extends Config = Config,
|
|
58
|
+
context = unknown,
|
|
59
|
+
> = ConfigParameter<config> & {
|
|
60
|
+
mutation?:
|
|
61
|
+
| UseMutationParameters<
|
|
62
|
+
Actions.wallet.send.ReturnValue,
|
|
63
|
+
Actions.wallet.send.ErrorType,
|
|
64
|
+
Actions.wallet.send.Parameters<config>,
|
|
65
|
+
context
|
|
66
|
+
>
|
|
67
|
+
| undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type ReturnType<
|
|
71
|
+
config extends Config = Config,
|
|
72
|
+
context = unknown,
|
|
73
|
+
> = UseMutationResult<
|
|
74
|
+
Actions.wallet.send.ReturnValue,
|
|
75
|
+
Actions.wallet.send.ErrorType,
|
|
76
|
+
Actions.wallet.send.Parameters<config>,
|
|
77
|
+
context
|
|
78
|
+
>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Hook for opening the wallet swap flow with optional pre-filled swap fields.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
87
|
+
*
|
|
88
|
+
* function App() {
|
|
89
|
+
* const { mutate, isPending } = Hooks.wallet.useSwap()
|
|
90
|
+
*
|
|
91
|
+
* return (
|
|
92
|
+
* <button
|
|
93
|
+
* onClick={() =>
|
|
94
|
+
* mutate({
|
|
95
|
+
* amount: '1.5',
|
|
96
|
+
* token: '0x...',
|
|
97
|
+
* type: 'sell',
|
|
98
|
+
* })
|
|
99
|
+
* }
|
|
100
|
+
* disabled={isPending}
|
|
101
|
+
* >
|
|
102
|
+
* Swap
|
|
103
|
+
* </button>
|
|
104
|
+
* )
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param parameters - Parameters.
|
|
109
|
+
* @returns Mutation result.
|
|
110
|
+
*/
|
|
111
|
+
export function useSwap<
|
|
112
|
+
config extends Config = ResolvedRegister['config'],
|
|
113
|
+
context = unknown,
|
|
114
|
+
>(
|
|
115
|
+
parameters: useSwap.Parameters<config, context> = {},
|
|
116
|
+
): useSwap.ReturnType<config, context> {
|
|
117
|
+
const { mutation } = parameters
|
|
118
|
+
const config = useConfig(parameters)
|
|
119
|
+
return useMutation({
|
|
120
|
+
...mutation,
|
|
121
|
+
async mutationFn(variables) {
|
|
122
|
+
return Actions.wallet.swap(config, variables)
|
|
123
|
+
},
|
|
124
|
+
mutationKey: ['wallet', 'swap'],
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare namespace useSwap {
|
|
129
|
+
type Parameters<
|
|
130
|
+
config extends Config = Config,
|
|
131
|
+
context = unknown,
|
|
132
|
+
> = ConfigParameter<config> & {
|
|
133
|
+
mutation?:
|
|
134
|
+
| UseMutationParameters<
|
|
135
|
+
Actions.wallet.swap.ReturnValue,
|
|
136
|
+
Actions.wallet.swap.ErrorType,
|
|
137
|
+
Actions.wallet.swap.Parameters<config>,
|
|
138
|
+
context
|
|
139
|
+
>
|
|
140
|
+
| undefined
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type ReturnType<
|
|
144
|
+
config extends Config = Config,
|
|
145
|
+
context = unknown,
|
|
146
|
+
> = UseMutationResult<
|
|
147
|
+
Actions.wallet.swap.ReturnValue,
|
|
148
|
+
Actions.wallet.swap.ErrorType,
|
|
149
|
+
Actions.wallet.swap.Parameters<config>,
|
|
150
|
+
context
|
|
151
|
+
>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Hook for opening the wallet deposit flow with optional pre-filled deposit fields.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```tsx
|
|
159
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
160
|
+
*
|
|
161
|
+
* function App() {
|
|
162
|
+
* const { mutate, isPending } = Hooks.wallet.useDeposit()
|
|
163
|
+
*
|
|
164
|
+
* return (
|
|
165
|
+
* <button
|
|
166
|
+
* onClick={() =>
|
|
167
|
+
* mutate({
|
|
168
|
+
* token: '0x...',
|
|
169
|
+
* value: '1.5',
|
|
170
|
+
* })
|
|
171
|
+
* }
|
|
172
|
+
* disabled={isPending}
|
|
173
|
+
* >
|
|
174
|
+
* Deposit
|
|
175
|
+
* </button>
|
|
176
|
+
* )
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* @param parameters - Parameters.
|
|
181
|
+
* @returns Mutation result.
|
|
182
|
+
*/
|
|
183
|
+
export function useDeposit<
|
|
184
|
+
config extends Config = ResolvedRegister['config'],
|
|
185
|
+
context = unknown,
|
|
186
|
+
>(
|
|
187
|
+
parameters: useDeposit.Parameters<config, context> = {},
|
|
188
|
+
): useDeposit.ReturnType<config, context> {
|
|
189
|
+
const { mutation } = parameters
|
|
190
|
+
const config = useConfig(parameters)
|
|
191
|
+
return useMutation({
|
|
192
|
+
...mutation,
|
|
193
|
+
async mutationFn(variables) {
|
|
194
|
+
return Actions.wallet.deposit(config, variables)
|
|
195
|
+
},
|
|
196
|
+
mutationKey: ['wallet', 'deposit'],
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export declare namespace useDeposit {
|
|
201
|
+
type Parameters<
|
|
202
|
+
config extends Config = Config,
|
|
203
|
+
context = unknown,
|
|
204
|
+
> = ConfigParameter<config> & {
|
|
205
|
+
mutation?:
|
|
206
|
+
| UseMutationParameters<
|
|
207
|
+
Actions.wallet.deposit.ReturnValue,
|
|
208
|
+
Actions.wallet.deposit.ErrorType,
|
|
209
|
+
Actions.wallet.deposit.Parameters<config>,
|
|
210
|
+
context
|
|
211
|
+
>
|
|
212
|
+
| undefined
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
type ReturnType<
|
|
216
|
+
config extends Config = Config,
|
|
217
|
+
context = unknown,
|
|
218
|
+
> = UseMutationResult<
|
|
219
|
+
Actions.wallet.deposit.ReturnValue,
|
|
220
|
+
Actions.wallet.deposit.ErrorType,
|
|
221
|
+
Actions.wallet.deposit.Parameters<config>,
|
|
222
|
+
context
|
|
223
|
+
>
|
|
224
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.6.
|
|
1
|
+
export const version = '3.6.10'
|