tempo.ts 0.12.0 → 0.13.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +28 -34
  3. package/package.json +2 -28
  4. package/dist/wagmi/Actions/amm.d.ts +0 -418
  5. package/dist/wagmi/Actions/amm.d.ts.map +0 -1
  6. package/dist/wagmi/Actions/amm.js +0 -462
  7. package/dist/wagmi/Actions/amm.js.map +0 -1
  8. package/dist/wagmi/Actions/dex.d.ts +0 -864
  9. package/dist/wagmi/Actions/dex.d.ts.map +0 -1
  10. package/dist/wagmi/Actions/dex.js +0 -968
  11. package/dist/wagmi/Actions/dex.js.map +0 -1
  12. package/dist/wagmi/Actions/faucet.d.ts +0 -66
  13. package/dist/wagmi/Actions/faucet.d.ts.map +0 -1
  14. package/dist/wagmi/Actions/faucet.js +0 -64
  15. package/dist/wagmi/Actions/faucet.js.map +0 -1
  16. package/dist/wagmi/Actions/fee.d.ts +0 -111
  17. package/dist/wagmi/Actions/fee.d.ts.map +0 -1
  18. package/dist/wagmi/Actions/fee.js +0 -126
  19. package/dist/wagmi/Actions/fee.js.map +0 -1
  20. package/dist/wagmi/Actions/index.d.ts +0 -9
  21. package/dist/wagmi/Actions/index.d.ts.map +0 -1
  22. package/dist/wagmi/Actions/index.js +0 -9
  23. package/dist/wagmi/Actions/index.js.map +0 -1
  24. package/dist/wagmi/Actions/nonce.d.ts +0 -77
  25. package/dist/wagmi/Actions/nonce.d.ts.map +0 -1
  26. package/dist/wagmi/Actions/nonce.js +0 -87
  27. package/dist/wagmi/Actions/nonce.js.map +0 -1
  28. package/dist/wagmi/Actions/policy.d.ts +0 -480
  29. package/dist/wagmi/Actions/policy.d.ts.map +0 -1
  30. package/dist/wagmi/Actions/policy.js +0 -530
  31. package/dist/wagmi/Actions/policy.js.map +0 -1
  32. package/dist/wagmi/Actions/reward.d.ts +0 -346
  33. package/dist/wagmi/Actions/reward.d.ts.map +0 -1
  34. package/dist/wagmi/Actions/reward.js +0 -382
  35. package/dist/wagmi/Actions/reward.js.map +0 -1
  36. package/dist/wagmi/Actions/token.d.ts +0 -1546
  37. package/dist/wagmi/Actions/token.d.ts.map +0 -1
  38. package/dist/wagmi/Actions/token.js +0 -1712
  39. package/dist/wagmi/Actions/token.js.map +0 -1
  40. package/dist/wagmi/Connector.d.ts +0 -91
  41. package/dist/wagmi/Connector.d.ts.map +0 -1
  42. package/dist/wagmi/Connector.js +0 -473
  43. package/dist/wagmi/Connector.js.map +0 -1
  44. package/dist/wagmi/Hooks/amm.d.ts +0 -411
  45. package/dist/wagmi/Hooks/amm.d.ts.map +0 -1
  46. package/dist/wagmi/Hooks/amm.js +0 -494
  47. package/dist/wagmi/Hooks/amm.js.map +0 -1
  48. package/dist/wagmi/Hooks/dex.d.ts +0 -773
  49. package/dist/wagmi/Hooks/dex.d.ts.map +0 -1
  50. package/dist/wagmi/Hooks/dex.js +0 -921
  51. package/dist/wagmi/Hooks/dex.js.map +0 -1
  52. package/dist/wagmi/Hooks/faucet.d.ts +0 -71
  53. package/dist/wagmi/Hooks/faucet.d.ts.map +0 -1
  54. package/dist/wagmi/Hooks/faucet.js +0 -76
  55. package/dist/wagmi/Hooks/faucet.js.map +0 -1
  56. package/dist/wagmi/Hooks/fee.d.ts +0 -97
  57. package/dist/wagmi/Hooks/fee.d.ts.map +0 -1
  58. package/dist/wagmi/Hooks/fee.js +0 -109
  59. package/dist/wagmi/Hooks/fee.js.map +0 -1
  60. package/dist/wagmi/Hooks/index.d.ts +0 -9
  61. package/dist/wagmi/Hooks/index.d.ts.map +0 -1
  62. package/dist/wagmi/Hooks/index.js +0 -9
  63. package/dist/wagmi/Hooks/index.js.map +0 -1
  64. package/dist/wagmi/Hooks/nonce.d.ts +0 -59
  65. package/dist/wagmi/Hooks/nonce.d.ts.map +0 -1
  66. package/dist/wagmi/Hooks/nonce.js +0 -75
  67. package/dist/wagmi/Hooks/nonce.js.map +0 -1
  68. package/dist/wagmi/Hooks/policy.d.ts +0 -423
  69. package/dist/wagmi/Hooks/policy.d.ts.map +0 -1
  70. package/dist/wagmi/Hooks/policy.js +0 -510
  71. package/dist/wagmi/Hooks/policy.js.map +0 -1
  72. package/dist/wagmi/Hooks/reward.d.ts +0 -305
  73. package/dist/wagmi/Hooks/reward.d.ts.map +0 -1
  74. package/dist/wagmi/Hooks/reward.js +0 -368
  75. package/dist/wagmi/Hooks/reward.js.map +0 -1
  76. package/dist/wagmi/Hooks/token.d.ts +0 -1388
  77. package/dist/wagmi/Hooks/token.d.ts.map +0 -1
  78. package/dist/wagmi/Hooks/token.js +0 -1657
  79. package/dist/wagmi/Hooks/token.js.map +0 -1
  80. package/dist/wagmi/KeyManager.d.ts +0 -60
  81. package/dist/wagmi/KeyManager.d.ts.map +0 -1
  82. package/dist/wagmi/KeyManager.js +0 -106
  83. package/dist/wagmi/KeyManager.js.map +0 -1
  84. package/dist/wagmi/index.d.ts +0 -5
  85. package/dist/wagmi/index.d.ts.map +0 -1
  86. package/dist/wagmi/index.js +0 -5
  87. package/dist/wagmi/index.js.map +0 -1
  88. package/src/wagmi/Actions/amm.test.ts +0 -208
  89. package/src/wagmi/Actions/amm.ts +0 -690
  90. package/src/wagmi/Actions/dex.test.ts +0 -1482
  91. package/src/wagmi/Actions/dex.ts +0 -1540
  92. package/src/wagmi/Actions/faucet.ts +0 -89
  93. package/src/wagmi/Actions/fee.test.ts +0 -63
  94. package/src/wagmi/Actions/fee.ts +0 -211
  95. package/src/wagmi/Actions/index.ts +0 -8
  96. package/src/wagmi/Actions/nonce.test.ts +0 -82
  97. package/src/wagmi/Actions/nonce.ts +0 -139
  98. package/src/wagmi/Actions/policy.test.ts +0 -461
  99. package/src/wagmi/Actions/policy.ts +0 -817
  100. package/src/wagmi/Actions/reward.test.ts +0 -216
  101. package/src/wagmi/Actions/reward.ts +0 -613
  102. package/src/wagmi/Actions/token.test.ts +0 -1309
  103. package/src/wagmi/Actions/token.ts +0 -2644
  104. package/src/wagmi/Connector.test.ts +0 -56
  105. package/src/wagmi/Connector.ts +0 -670
  106. package/src/wagmi/Hooks/amm.test.ts +0 -564
  107. package/src/wagmi/Hooks/amm.ts +0 -796
  108. package/src/wagmi/Hooks/dex.test.ts +0 -992
  109. package/src/wagmi/Hooks/dex.ts +0 -1598
  110. package/src/wagmi/Hooks/faucet.ts +0 -144
  111. package/src/wagmi/Hooks/fee.test.ts +0 -166
  112. package/src/wagmi/Hooks/fee.ts +0 -206
  113. package/src/wagmi/Hooks/index.ts +0 -8
  114. package/src/wagmi/Hooks/nonce.test.ts +0 -142
  115. package/src/wagmi/Hooks/nonce.ts +0 -117
  116. package/src/wagmi/Hooks/policy.test.ts +0 -665
  117. package/src/wagmi/Hooks/policy.ts +0 -873
  118. package/src/wagmi/Hooks/reward.test.ts +0 -249
  119. package/src/wagmi/Hooks/reward.ts +0 -645
  120. package/src/wagmi/Hooks/token.test.ts +0 -1183
  121. package/src/wagmi/Hooks/token.ts +0 -2906
  122. package/src/wagmi/KeyManager.ts +0 -172
  123. package/src/wagmi/index.ts +0 -7
@@ -1,216 +0,0 @@
1
- import { getAccount } from '@wagmi/core'
2
- import { parseUnits } from 'viem'
3
- import { describe, expect, test } from 'vitest'
4
- import { config, queryClient, setupToken } from '../../../test/wagmi/config.js'
5
- import * as actions from './reward.js'
6
- import * as tokenActions from './token.js'
7
-
8
- // TODO: unskip
9
- describe.skip('claimSync', () => {
10
- test('default', async () => {
11
- const { token } = await setupToken()
12
-
13
- const account = getAccount(config)
14
-
15
- const balanceBefore = await tokenActions.getBalance(config, {
16
- account: account.address!,
17
- token,
18
- })
19
-
20
- // Opt in to rewards
21
- await actions.setRecipientSync(config, {
22
- recipient: account.address!,
23
- token,
24
- })
25
-
26
- // Mint reward tokens
27
- const rewardAmount = parseUnits('100', 6)
28
- await tokenActions.mintSync(config, {
29
- amount: rewardAmount,
30
- to: account.address!,
31
- token,
32
- })
33
-
34
- // Start immediate reward
35
- await actions.startSync(config, {
36
- amount: rewardAmount,
37
- token,
38
- })
39
-
40
- // Trigger reward accrual by transferring
41
- await tokenActions.transferSync(config, {
42
- amount: 1n,
43
- to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
44
- token,
45
- })
46
-
47
- // Claim rewards
48
- const { receipt } = await actions.claimSync(config, {
49
- token,
50
- })
51
-
52
- expect(receipt).toBeDefined()
53
-
54
- const balanceAfter = await tokenActions.getBalance(config, {
55
- account: account.address!,
56
- token,
57
- })
58
-
59
- // Balance should have increased due to claimed rewards
60
- expect(balanceAfter).toBeGreaterThan(
61
- balanceBefore + rewardAmount - parseUnits('1', 6),
62
- )
63
- })
64
- })
65
-
66
- describe('getTotalPerSecond', () => {
67
- test('default', async () => {
68
- const { token } = await setupToken()
69
-
70
- const rate = await actions.getTotalPerSecond(config, {
71
- token,
72
- })
73
-
74
- expect(rate).toBe(0n)
75
- })
76
-
77
- describe('queryOptions', () => {
78
- test('default', async () => {
79
- const { token } = await setupToken()
80
-
81
- const options = actions.getTotalPerSecond.queryOptions(config, {
82
- token,
83
- })
84
-
85
- const rate = await queryClient.fetchQuery(options)
86
-
87
- expect(rate).toBe(0n)
88
- })
89
- })
90
- })
91
-
92
- describe('getUserRewardInfo', () => {
93
- test('default', async () => {
94
- const { token } = await setupToken()
95
-
96
- const account = getAccount(config)
97
-
98
- const info = await actions.getUserRewardInfo(config, {
99
- token,
100
- account: account.address!,
101
- })
102
-
103
- expect(info.rewardRecipient).toBeDefined()
104
- expect(info.rewardPerToken).toBeDefined()
105
- expect(info.rewardBalance).toBeDefined()
106
- })
107
-
108
- describe('queryOptions', () => {
109
- test('default', async () => {
110
- const { token } = await setupToken()
111
-
112
- const account = getAccount(config)
113
-
114
- const options = actions.getUserRewardInfo.queryOptions(config, {
115
- token,
116
- account: account.address!,
117
- })
118
-
119
- const info = await queryClient.fetchQuery(options)
120
-
121
- expect(info.rewardRecipient).toBeDefined()
122
- expect(info.rewardPerToken).toBeDefined()
123
- expect(info.rewardBalance).toBeDefined()
124
- })
125
- })
126
- })
127
-
128
- describe('setRecipientSync', () => {
129
- test('default', async () => {
130
- const { token } = await setupToken()
131
-
132
- const account = getAccount(config)
133
-
134
- // Set reward recipient
135
- const { holder, receipt, recipient } = await actions.setRecipientSync(
136
- config,
137
- {
138
- recipient: account.address!,
139
- token,
140
- },
141
- )
142
-
143
- expect(receipt).toBeDefined()
144
- expect(holder).toBe(account.address)
145
- expect(recipient).toBe(account.address)
146
- })
147
- })
148
-
149
- describe('watchRewardScheduled', () => {
150
- test('default', async () => {
151
- const { token } = await setupToken()
152
-
153
- const account = getAccount(config)
154
-
155
- // Setup rewards
156
- await actions.setRecipientSync(config, {
157
- recipient: account.address!,
158
- token,
159
- })
160
-
161
- const rewardAmount = parseUnits('100', 6)
162
- await tokenActions.mintSync(config, {
163
- amount: rewardAmount,
164
- to: account.address!,
165
- token,
166
- })
167
-
168
- const events: any[] = []
169
- const unwatch = actions.watchRewardScheduled(config, {
170
- token,
171
- onRewardScheduled: (args) => {
172
- events.push(args)
173
- },
174
- })
175
-
176
- await actions.startSync(config, {
177
- amount: rewardAmount,
178
- token,
179
- })
180
-
181
- await new Promise((resolve) => setTimeout(resolve, 500))
182
-
183
- expect(events.length).toBeGreaterThan(0)
184
- expect(events[0]?.amount).toBe(rewardAmount)
185
- expect(events[0]?.funder).toBe(account.address)
186
- unwatch()
187
- })
188
- })
189
-
190
- describe('watchRewardRecipientSet', () => {
191
- test('default', async () => {
192
- const { token } = await setupToken()
193
-
194
- const account = getAccount(config)
195
-
196
- const events: any[] = []
197
- const unwatch = actions.watchRewardRecipientSet(config, {
198
- token,
199
- onRewardRecipientSet: (args) => {
200
- events.push(args)
201
- },
202
- })
203
-
204
- await actions.setRecipientSync(config, {
205
- recipient: account.address!,
206
- token,
207
- })
208
-
209
- await new Promise((resolve) => setTimeout(resolve, 500))
210
-
211
- expect(events.length).toBeGreaterThan(0)
212
- expect(events[0]?.holder).toBe(account.address)
213
- expect(events[0]?.recipient).toBe(account.address)
214
- unwatch()
215
- })
216
- })