wagmi 3.6.9 → 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
|
@@ -8,5 +8,6 @@ export * as nonce from './nonce.js';
|
|
|
8
8
|
export * as policy from './policy.js';
|
|
9
9
|
export * as reward from './reward.js';
|
|
10
10
|
export * as token from './token.js';
|
|
11
|
+
export * as wallet from './wallet.js';
|
|
11
12
|
export * as zone from './zone.js';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,qDAAqD;AACrD,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.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,qDAAqD;AACrD,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,126 @@
|
|
|
1
|
+
import { Actions } from '@wagmi/core/tempo';
|
|
2
|
+
import { useConfig } from '../../hooks/useConfig.js';
|
|
3
|
+
import { useMutation } from '../../utils/query.js';
|
|
4
|
+
/**
|
|
5
|
+
* Hook for opening the wallet send flow with optional pre-filled send fields.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
10
|
+
*
|
|
11
|
+
* function App() {
|
|
12
|
+
* const { mutate, isPending } = Hooks.wallet.useSend()
|
|
13
|
+
*
|
|
14
|
+
* return (
|
|
15
|
+
* <button
|
|
16
|
+
* onClick={() =>
|
|
17
|
+
* mutate({
|
|
18
|
+
* to: '0x...',
|
|
19
|
+
* token: '0x...',
|
|
20
|
+
* value: '1.5',
|
|
21
|
+
* })
|
|
22
|
+
* }
|
|
23
|
+
* disabled={isPending}
|
|
24
|
+
* >
|
|
25
|
+
* Send
|
|
26
|
+
* </button>
|
|
27
|
+
* )
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param parameters - Parameters.
|
|
32
|
+
* @returns Mutation result.
|
|
33
|
+
*/
|
|
34
|
+
export function useSend(parameters = {}) {
|
|
35
|
+
const { mutation } = parameters;
|
|
36
|
+
const config = useConfig(parameters);
|
|
37
|
+
return useMutation({
|
|
38
|
+
...mutation,
|
|
39
|
+
async mutationFn(variables) {
|
|
40
|
+
return Actions.wallet.send(config, variables);
|
|
41
|
+
},
|
|
42
|
+
mutationKey: ['wallet', 'send'],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Hook for opening the wallet swap flow with optional pre-filled swap fields.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
51
|
+
*
|
|
52
|
+
* function App() {
|
|
53
|
+
* const { mutate, isPending } = Hooks.wallet.useSwap()
|
|
54
|
+
*
|
|
55
|
+
* return (
|
|
56
|
+
* <button
|
|
57
|
+
* onClick={() =>
|
|
58
|
+
* mutate({
|
|
59
|
+
* amount: '1.5',
|
|
60
|
+
* token: '0x...',
|
|
61
|
+
* type: 'sell',
|
|
62
|
+
* })
|
|
63
|
+
* }
|
|
64
|
+
* disabled={isPending}
|
|
65
|
+
* >
|
|
66
|
+
* Swap
|
|
67
|
+
* </button>
|
|
68
|
+
* )
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param parameters - Parameters.
|
|
73
|
+
* @returns Mutation result.
|
|
74
|
+
*/
|
|
75
|
+
export function useSwap(parameters = {}) {
|
|
76
|
+
const { mutation } = parameters;
|
|
77
|
+
const config = useConfig(parameters);
|
|
78
|
+
return useMutation({
|
|
79
|
+
...mutation,
|
|
80
|
+
async mutationFn(variables) {
|
|
81
|
+
return Actions.wallet.swap(config, variables);
|
|
82
|
+
},
|
|
83
|
+
mutationKey: ['wallet', 'swap'],
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Hook for opening the wallet deposit flow with optional pre-filled deposit fields.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
92
|
+
*
|
|
93
|
+
* function App() {
|
|
94
|
+
* const { mutate, isPending } = Hooks.wallet.useDeposit()
|
|
95
|
+
*
|
|
96
|
+
* return (
|
|
97
|
+
* <button
|
|
98
|
+
* onClick={() =>
|
|
99
|
+
* mutate({
|
|
100
|
+
* token: '0x...',
|
|
101
|
+
* value: '1.5',
|
|
102
|
+
* })
|
|
103
|
+
* }
|
|
104
|
+
* disabled={isPending}
|
|
105
|
+
* >
|
|
106
|
+
* Deposit
|
|
107
|
+
* </button>
|
|
108
|
+
* )
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @param parameters - Parameters.
|
|
113
|
+
* @returns Mutation result.
|
|
114
|
+
*/
|
|
115
|
+
export function useDeposit(parameters = {}) {
|
|
116
|
+
const { mutation } = parameters;
|
|
117
|
+
const config = useConfig(parameters);
|
|
118
|
+
return useMutation({
|
|
119
|
+
...mutation,
|
|
120
|
+
async mutationFn(variables) {
|
|
121
|
+
return Actions.wallet.deposit(config, variables);
|
|
122
|
+
},
|
|
123
|
+
mutationKey: ['wallet', 'deposit'],
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/wallet.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAA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