@b3dotfun/sdk 0.0.58 → 0.0.59-alpha.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.
Files changed (63) hide show
  1. package/dist/cjs/anyspend/abis/upsideStaking.d.ts +1 -1030
  2. package/dist/cjs/anyspend/abis/upsideStaking.js +2 -570
  3. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  4. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +8 -18
  5. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -0
  6. package/dist/cjs/anyspend/utils/accountStore.d.ts +7 -0
  7. package/dist/cjs/anyspend/utils/accountStore.js +8 -0
  8. package/dist/cjs/anyspend/utils/index.d.ts +1 -0
  9. package/dist/cjs/anyspend/utils/index.js +1 -0
  10. package/dist/cjs/global-account/react/components/B3DynamicModal.js +17 -0
  11. package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
  12. package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +2 -0
  13. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
  14. package/dist/cjs/shared/react/components/CurrencySelector.js +8 -3
  15. package/dist/cjs/shared/react/components/FormattedCurrency.d.ts +3 -3
  16. package/dist/cjs/shared/react/components/FormattedCurrency.js +31 -26
  17. package/dist/cjs/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
  18. package/dist/cjs/shared/react/hooks/useCurrencyConversion.js +153 -94
  19. package/dist/cjs/shared/react/stores/currencyStore.d.ts +83 -8
  20. package/dist/cjs/shared/react/stores/currencyStore.js +147 -5
  21. package/dist/esm/anyspend/abis/upsideStaking.d.ts +1 -1030
  22. package/dist/esm/anyspend/abis/upsideStaking.js +1 -569
  23. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  24. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +9 -19
  25. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +5 -1
  26. package/dist/esm/anyspend/utils/accountStore.d.ts +7 -0
  27. package/dist/esm/anyspend/utils/accountStore.js +5 -0
  28. package/dist/esm/anyspend/utils/index.d.ts +1 -0
  29. package/dist/esm/anyspend/utils/index.js +1 -0
  30. package/dist/esm/global-account/react/components/B3DynamicModal.js +17 -0
  31. package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
  32. package/dist/esm/global-account/react/hooks/useWagmiConfig.js +2 -0
  33. package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
  34. package/dist/esm/shared/react/components/CurrencySelector.js +10 -5
  35. package/dist/esm/shared/react/components/FormattedCurrency.d.ts +3 -3
  36. package/dist/esm/shared/react/components/FormattedCurrency.js +31 -26
  37. package/dist/esm/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
  38. package/dist/esm/shared/react/hooks/useCurrencyConversion.js +154 -95
  39. package/dist/esm/shared/react/stores/currencyStore.d.ts +83 -8
  40. package/dist/esm/shared/react/stores/currencyStore.js +143 -5
  41. package/dist/types/anyspend/abis/upsideStaking.d.ts +1 -1030
  42. package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
  43. package/dist/types/anyspend/utils/accountStore.d.ts +7 -0
  44. package/dist/types/anyspend/utils/index.d.ts +1 -0
  45. package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
  46. package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
  47. package/dist/types/shared/react/components/FormattedCurrency.d.ts +3 -3
  48. package/dist/types/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
  49. package/dist/types/shared/react/stores/currencyStore.d.ts +83 -8
  50. package/package.json +4 -3
  51. package/src/anyspend/abis/upsideStaking.ts +1 -570
  52. package/src/anyspend/react/components/AnySpendStakeUpside.tsx +8 -19
  53. package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +6 -2
  54. package/src/anyspend/utils/accountStore.ts +12 -0
  55. package/src/anyspend/utils/index.ts +1 -0
  56. package/src/global-account/react/components/B3DynamicModal.tsx +20 -0
  57. package/src/global-account/react/hooks/useWagmiConfig.tsx +2 -0
  58. package/src/global-account/react/stores/useModalStore.ts +0 -2
  59. package/src/shared/react/components/CurrencySelector.tsx +36 -5
  60. package/src/shared/react/components/FormattedCurrency.tsx +36 -30
  61. package/src/shared/react/hooks/__tests__/useCurrencyConversion.test.ts +14 -14
  62. package/src/shared/react/hooks/useCurrencyConversion.ts +163 -96
  63. package/src/shared/react/stores/currencyStore.ts +216 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.58",
3
+ "version": "0.0.59-alpha.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -279,6 +279,7 @@
279
279
  "dependencies": {
280
280
  "@b3dotfun/b3-api": "0.0.77",
281
281
  "@b3dotfun/basement-api": "0.0.11",
282
+ "@farcaster/miniapp-wagmi-connector": "^1.1.0",
282
283
  "@feathersjs/authentication-client": "5.0.33",
283
284
  "@feathersjs/feathers": "5.0.33",
284
285
  "@feathersjs/rest-client": "5.0.33",
@@ -371,14 +372,14 @@
371
372
  "@readyplayerme/react-avatar-creator": "0.5.0",
372
373
  "@readyplayerme/visage": "6.10.0",
373
374
  "@tanstack/react-query": "5.55.0",
375
+ "@wagmi/core": "2.20.3",
374
376
  "react": "^18.0.0 || ^19.0.0",
375
377
  "react-dom": "^18.0.0 || ^19.0.0",
376
378
  "react-native-mmkv": "^3.2.0",
377
379
  "thirdweb": "5.108.14",
378
380
  "three": "^0.175.0",
379
381
  "viem": "2.37.9",
380
- "wagmi": "2.16.9",
381
- "@wagmi/core": "2.20.3"
382
+ "wagmi": "2.16.9"
382
383
  },
383
384
  "peerDependenciesMeta": {
384
385
  "@react-three/postprocessing": {
@@ -1,573 +1,4 @@
1
- export const WETH_STAKING_CONTRACT = [
2
- { inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
3
- {
4
- inputs: [{ internalType: "address", name: "implementation", type: "address" }],
5
- name: "ERC1967InvalidImplementation",
6
- type: "error",
7
- },
8
- { inputs: [], name: "ERC1967NonPayable", type: "error" },
9
- { inputs: [], name: "EnforcedPause", type: "error" },
10
- { inputs: [], name: "ExpectedPause", type: "error" },
11
- { inputs: [], name: "FailedCall", type: "error" },
12
- { inputs: [], name: "InvalidInitialization", type: "error" },
13
- { inputs: [], name: "NotInitializing", type: "error" },
14
- { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" },
15
- {
16
- inputs: [{ internalType: "address", name: "account", type: "address" }],
17
- name: "OwnableUnauthorizedAccount",
18
- type: "error",
19
- },
20
- { inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
21
- {
22
- inputs: [{ internalType: "address", name: "token", type: "address" }],
23
- name: "SafeERC20FailedOperation",
24
- type: "error",
25
- },
26
- { inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
27
- {
28
- inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
29
- name: "UUPSUnsupportedProxiableUUID",
30
- type: "error",
31
- },
32
- {
33
- anonymous: false,
34
- inputs: [
35
- { indexed: true, internalType: "address", name: "user", type: "address" },
36
- { indexed: true, internalType: "address", name: "to", type: "address" },
37
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
38
- { indexed: false, internalType: "uint256", name: "requestIndex", type: "uint256" },
39
- { indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
40
- { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
41
- ],
42
- name: "DelayedUnstakeClaimed",
43
- type: "event",
44
- },
45
- {
46
- anonymous: false,
47
- inputs: [
48
- { indexed: true, internalType: "address", name: "user", type: "address" },
49
- { indexed: true, internalType: "address", name: "to", type: "address" },
50
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
51
- { indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
52
- { indexed: false, internalType: "uint256", name: "requestTime", type: "uint256" },
53
- { indexed: false, internalType: "uint256", name: "claimableTime", type: "uint256" },
54
- { indexed: false, internalType: "uint256", name: "requestIndex", type: "uint256" },
55
- { indexed: true, internalType: "uint256", name: "nonce", type: "uint256" },
56
- ],
57
- name: "DelayedUnstakeRequested",
58
- type: "event",
59
- },
60
- {
61
- anonymous: false,
62
- inputs: [
63
- { indexed: true, internalType: "address", name: "token", type: "address" },
64
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
65
- ],
66
- name: "EmergencyWithdraw",
67
- type: "event",
68
- },
69
- {
70
- anonymous: false,
71
- inputs: [
72
- { indexed: true, internalType: "address", name: "oldRecipient", type: "address" },
73
- { indexed: true, internalType: "address", name: "newRecipient", type: "address" },
74
- ],
75
- name: "FeeRecipientUpdated",
76
- type: "event",
77
- },
78
- {
79
- anonymous: false,
80
- inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }],
81
- name: "Initialized",
82
- type: "event",
83
- },
84
- {
85
- anonymous: false,
86
- inputs: [
87
- { indexed: false, internalType: "uint256", name: "oldFee", type: "uint256" },
88
- { indexed: false, internalType: "uint256", name: "newFee", type: "uint256" },
89
- ],
90
- name: "InstantUnstakeFeeUpdated",
91
- type: "event",
92
- },
93
- {
94
- anonymous: false,
95
- inputs: [
96
- { indexed: true, internalType: "address", name: "user", type: "address" },
97
- { indexed: true, internalType: "address", name: "to", type: "address" },
98
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
99
- { indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
100
- { indexed: false, internalType: "uint256", name: "netAmount", type: "uint256" },
101
- { indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
102
- { indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
103
- { indexed: true, internalType: "uint256", name: "nonce", type: "uint256" },
104
- { indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
105
- ],
106
- name: "InstantUnstaked",
107
- type: "event",
108
- },
109
- {
110
- anonymous: false,
111
- inputs: [
112
- { indexed: true, internalType: "address", name: "previousOwner", type: "address" },
113
- { indexed: true, internalType: "address", name: "newOwner", type: "address" },
114
- ],
115
- name: "OwnershipTransferred",
116
- type: "event",
117
- },
118
- {
119
- anonymous: false,
120
- inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
121
- name: "Paused",
122
- type: "event",
123
- },
124
- {
125
- anonymous: false,
126
- inputs: [
127
- { indexed: true, internalType: "address", name: "staker", type: "address" },
128
- { indexed: true, internalType: "address", name: "user", type: "address" },
129
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
130
- { indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
131
- { indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
132
- { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
133
- ],
134
- name: "Staked",
135
- type: "event",
136
- },
137
- {
138
- anonymous: false,
139
- inputs: [
140
- { indexed: true, internalType: "address", name: "oldWallet", type: "address" },
141
- { indexed: true, internalType: "address", name: "newWallet", type: "address" },
142
- ],
143
- name: "TreasuryWalletUpdated",
144
- type: "event",
145
- },
146
- {
147
- anonymous: false,
148
- inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
149
- name: "Unpaused",
150
- type: "event",
151
- },
152
- {
153
- anonymous: false,
154
- inputs: [
155
- { indexed: true, internalType: "address", name: "user", type: "address" },
156
- { indexed: true, internalType: "address", name: "to", type: "address" },
157
- { indexed: true, internalType: "uint256", name: "requestIndex", type: "uint256" },
158
- { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
159
- { indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
160
- { indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
161
- ],
162
- name: "UnstakeCancelled",
163
- type: "event",
164
- },
165
- {
166
- anonymous: false,
167
- inputs: [
168
- { indexed: false, internalType: "uint256", name: "oldDelay", type: "uint256" },
169
- { indexed: false, internalType: "uint256", name: "newDelay", type: "uint256" },
170
- ],
171
- name: "UnstakeDelayUpdated",
172
- type: "event",
173
- },
174
- {
175
- anonymous: false,
176
- inputs: [{ indexed: true, internalType: "address", name: "implementation", type: "address" }],
177
- name: "Upgraded",
178
- type: "event",
179
- },
180
- {
181
- inputs: [],
182
- name: "BASIS_POINTS",
183
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
184
- stateMutability: "view",
185
- type: "function",
186
- },
187
- {
188
- inputs: [],
189
- name: "UPGRADE_INTERFACE_VERSION",
190
- outputs: [{ internalType: "string", name: "", type: "string" }],
191
- stateMutability: "view",
192
- type: "function",
193
- },
194
- {
195
- inputs: [{ internalType: "uint256[]", name: "requestIndices", type: "uint256[]" }],
196
- name: "batchClaimDelayedUnstakes",
197
- outputs: [],
198
- stateMutability: "nonpayable",
199
- type: "function",
200
- },
201
- {
202
- inputs: [
203
- { internalType: "address", name: "user", type: "address" },
204
- { internalType: "uint256[]", name: "requestIndices", type: "uint256[]" },
205
- ],
206
- name: "batchClaimDelayedUnstakesFor",
207
- outputs: [],
208
- stateMutability: "nonpayable",
209
- type: "function",
210
- },
211
- {
212
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
213
- name: "calculateInstantUnstakeFee",
214
- outputs: [
215
- { internalType: "uint256", name: "fee", type: "uint256" },
216
- { internalType: "uint256", name: "netAmount", type: "uint256" },
217
- ],
218
- stateMutability: "view",
219
- type: "function",
220
- },
221
- {
222
- inputs: [{ internalType: "uint256", name: "requestIndex", type: "uint256" }],
223
- name: "cancelUnstake",
224
- outputs: [],
225
- stateMutability: "nonpayable",
226
- type: "function",
227
- },
228
- {
229
- inputs: [
230
- { internalType: "address", name: "user", type: "address" },
231
- { internalType: "uint256", name: "requestIndex", type: "uint256" },
232
- ],
233
- name: "cancelUnstakeFor",
234
- outputs: [],
235
- stateMutability: "nonpayable",
236
- type: "function",
237
- },
238
- {
239
- inputs: [{ internalType: "uint256", name: "requestIndex", type: "uint256" }],
240
- name: "claimDelayedUnstake",
241
- outputs: [],
242
- stateMutability: "nonpayable",
243
- type: "function",
244
- },
245
- {
246
- inputs: [
247
- { internalType: "address", name: "user", type: "address" },
248
- { internalType: "uint256", name: "requestIndex", type: "uint256" },
249
- ],
250
- name: "claimDelayedUnstakeFor",
251
- outputs: [],
252
- stateMutability: "nonpayable",
253
- type: "function",
254
- },
255
- { inputs: [], name: "emergencyWithdraw", outputs: [], stateMutability: "nonpayable", type: "function" },
256
- {
257
- inputs: [],
258
- name: "feeRecipient",
259
- outputs: [{ internalType: "address", name: "", type: "address" }],
260
- stateMutability: "view",
261
- type: "function",
262
- },
263
- {
264
- inputs: [],
265
- name: "getContractBalance",
266
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
267
- stateMutability: "view",
268
- type: "function",
269
- },
270
- {
271
- inputs: [],
272
- name: "getCurrentNonce",
273
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
274
- stateMutability: "view",
275
- type: "function",
276
- },
277
- {
278
- inputs: [],
279
- name: "getTotalStaked",
280
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
281
- stateMutability: "view",
282
- type: "function",
283
- },
284
- {
285
- inputs: [
286
- { internalType: "address", name: "user", type: "address" },
287
- { internalType: "uint256", name: "requestIndex", type: "uint256" },
288
- ],
289
- name: "getUnstakeRequest",
290
- outputs: [
291
- {
292
- components: [
293
- { internalType: "uint256", name: "amount", type: "uint256" },
294
- { internalType: "uint256", name: "requestTime", type: "uint256" },
295
- { internalType: "bool", name: "claimed", type: "bool" },
296
- ],
297
- internalType: "struct ERC20StakingUpgradeable.UnstakeRequest",
298
- name: "",
299
- type: "tuple",
300
- },
301
- ],
302
- stateMutability: "view",
303
- type: "function",
304
- },
305
- {
306
- inputs: [{ internalType: "address", name: "user", type: "address" }],
307
- name: "getUserStakeInfo",
308
- outputs: [
309
- { internalType: "uint256", name: "amount", type: "uint256" },
310
- { internalType: "uint256", name: "timestamp", type: "uint256" },
311
- {
312
- components: [
313
- { internalType: "uint256", name: "amount", type: "uint256" },
314
- { internalType: "uint256", name: "requestTime", type: "uint256" },
315
- { internalType: "bool", name: "claimed", type: "bool" },
316
- ],
317
- internalType: "struct ERC20StakingUpgradeable.UnstakeRequest[]",
318
- name: "requests",
319
- type: "tuple[]",
320
- },
321
- { internalType: "uint256", name: "totalPending", type: "uint256" },
322
- { internalType: "uint256[]", name: "claimableRequestIndices", type: "uint256[]" },
323
- { internalType: "uint256", name: "totalClaimableAmount", type: "uint256" },
324
- ],
325
- stateMutability: "view",
326
- type: "function",
327
- },
328
- {
329
- inputs: [
330
- { internalType: "address", name: "initialOwner", type: "address" },
331
- { internalType: "contract IERC20", name: "_stakingToken", type: "address" },
332
- { internalType: "address", name: "_treasuryWallet", type: "address" },
333
- { internalType: "address", name: "_feeRecipient", type: "address" },
334
- ],
335
- name: "initialize",
336
- outputs: [],
337
- stateMutability: "nonpayable",
338
- type: "function",
339
- },
340
- {
341
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
342
- name: "instantUnstake",
343
- outputs: [],
344
- stateMutability: "nonpayable",
345
- type: "function",
346
- },
347
- {
348
- inputs: [],
349
- name: "instantUnstakeFeePercentage",
350
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
351
- stateMutability: "view",
352
- type: "function",
353
- },
354
- {
355
- inputs: [
356
- { internalType: "address", name: "user", type: "address" },
357
- { internalType: "address", name: "to", type: "address" },
358
- { internalType: "uint256", name: "amount", type: "uint256" },
359
- ],
360
- name: "instantUnstakeFor",
361
- outputs: [],
362
- stateMutability: "nonpayable",
363
- type: "function",
364
- },
365
- {
366
- inputs: [
367
- { internalType: "uint256", name: "amount", type: "uint256" },
368
- { internalType: "address", name: "to", type: "address" },
369
- ],
370
- name: "instantUnstakeTo",
371
- outputs: [],
372
- stateMutability: "nonpayable",
373
- type: "function",
374
- },
375
- {
376
- inputs: [],
377
- name: "nonce",
378
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
379
- stateMutability: "view",
380
- type: "function",
381
- },
382
- {
383
- inputs: [],
384
- name: "owner",
385
- outputs: [{ internalType: "address", name: "", type: "address" }],
386
- stateMutability: "view",
387
- type: "function",
388
- },
389
- { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" },
390
- {
391
- inputs: [],
392
- name: "paused",
393
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
394
- stateMutability: "view",
395
- type: "function",
396
- },
397
- {
398
- inputs: [],
399
- name: "proxiableUUID",
400
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
401
- stateMutability: "view",
402
- type: "function",
403
- },
404
- { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" },
405
- {
406
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
407
- name: "requestDelayedUnstake",
408
- outputs: [],
409
- stateMutability: "nonpayable",
410
- type: "function",
411
- },
412
- {
413
- inputs: [
414
- { internalType: "address", name: "user", type: "address" },
415
- { internalType: "uint256", name: "amount", type: "uint256" },
416
- ],
417
- name: "requestDelayedUnstakeFor",
418
- outputs: [],
419
- stateMutability: "nonpayable",
420
- type: "function",
421
- },
422
- {
423
- inputs: [
424
- { internalType: "uint256", name: "amount", type: "uint256" },
425
- { internalType: "address", name: "to", type: "address" },
426
- ],
427
- name: "requestDelayedUnstakeTo",
428
- outputs: [],
429
- stateMutability: "nonpayable",
430
- type: "function",
431
- },
432
- {
433
- inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
434
- name: "stake",
435
- outputs: [],
436
- stateMutability: "nonpayable",
437
- type: "function",
438
- },
439
- {
440
- inputs: [
441
- { internalType: "address", name: "user", type: "address" },
442
- { internalType: "uint256", name: "amount", type: "uint256" },
443
- ],
444
- name: "stakeFor",
445
- outputs: [],
446
- stateMutability: "nonpayable",
447
- type: "function",
448
- },
449
- {
450
- inputs: [{ internalType: "address", name: "", type: "address" }],
451
- name: "stakeTimestamps",
452
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
453
- stateMutability: "view",
454
- type: "function",
455
- },
456
- {
457
- inputs: [{ internalType: "address", name: "", type: "address" }],
458
- name: "stakedAmounts",
459
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
460
- stateMutability: "view",
461
- type: "function",
462
- },
463
- {
464
- inputs: [],
465
- name: "stakingToken",
466
- outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
467
- stateMutability: "view",
468
- type: "function",
469
- },
470
- {
471
- inputs: [{ internalType: "address", name: "", type: "address" }],
472
- name: "totalPendingUnstakes",
473
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
474
- stateMutability: "view",
475
- type: "function",
476
- },
477
- {
478
- inputs: [],
479
- name: "totalStaked",
480
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
481
- stateMutability: "view",
482
- type: "function",
483
- },
484
- {
485
- inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
486
- name: "transferOwnership",
487
- outputs: [],
488
- stateMutability: "nonpayable",
489
- type: "function",
490
- },
491
- {
492
- inputs: [],
493
- name: "treasuryWallet",
494
- outputs: [{ internalType: "address", name: "", type: "address" }],
495
- stateMutability: "view",
496
- type: "function",
497
- },
498
- { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" },
499
- {
500
- inputs: [],
501
- name: "unstakeDelay",
502
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
503
- stateMutability: "view",
504
- type: "function",
505
- },
506
- {
507
- inputs: [
508
- { internalType: "address", name: "", type: "address" },
509
- { internalType: "uint256", name: "", type: "uint256" },
510
- ],
511
- name: "unstakeRequestRecipients",
512
- outputs: [{ internalType: "address", name: "", type: "address" }],
513
- stateMutability: "view",
514
- type: "function",
515
- },
516
- {
517
- inputs: [
518
- { internalType: "address", name: "", type: "address" },
519
- { internalType: "uint256", name: "", type: "uint256" },
520
- ],
521
- name: "unstakeRequests",
522
- outputs: [
523
- { internalType: "uint256", name: "amount", type: "uint256" },
524
- { internalType: "uint256", name: "requestTime", type: "uint256" },
525
- { internalType: "bool", name: "claimed", type: "bool" },
526
- ],
527
- stateMutability: "view",
528
- type: "function",
529
- },
530
- {
531
- inputs: [{ internalType: "address", name: "_newFeeRecipient", type: "address" }],
532
- name: "updateFeeRecipient",
533
- outputs: [],
534
- stateMutability: "nonpayable",
535
- type: "function",
536
- },
537
- {
538
- inputs: [{ internalType: "uint256", name: "_newFeePercentage", type: "uint256" }],
539
- name: "updateInstantUnstakeFee",
540
- outputs: [],
541
- stateMutability: "nonpayable",
542
- type: "function",
543
- },
544
- {
545
- inputs: [{ internalType: "address", name: "_newTreasuryWallet", type: "address" }],
546
- name: "updateTreasuryWallet",
547
- outputs: [],
548
- stateMutability: "nonpayable",
549
- type: "function",
550
- },
551
- {
552
- inputs: [{ internalType: "uint256", name: "_newDelay", type: "uint256" }],
553
- name: "updateUnstakeDelay",
554
- outputs: [],
555
- stateMutability: "nonpayable",
556
- type: "function",
557
- },
558
- {
559
- inputs: [
560
- { internalType: "address", name: "newImplementation", type: "address" },
561
- { internalType: "bytes", name: "data", type: "bytes" },
562
- ],
563
- name: "upgradeToAndCall",
564
- outputs: [],
565
- stateMutability: "payable",
566
- type: "function",
567
- },
568
- ] as const;
569
-
570
- export const B3_STAKING_CONTRACT = [
1
+ export const STAKING_CONTRACT = [
571
2
  { inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
572
3
  {
573
4
  inputs: [{ internalType: "address", name: "implementation", type: "address" }],
@@ -4,25 +4,16 @@ import { formatTokenAmount } from "@b3dotfun/sdk/shared/utils/number";
4
4
  import invariant from "invariant";
5
5
  import { encodeFunctionData } from "viem";
6
6
  import { base } from "viem/chains";
7
- import { B3_STAKING_CONTRACT, WETH_STAKING_CONTRACT } from "../../abis/upsideStaking";
7
+ import { STAKING_CONTRACT } from "../../abis/upsideStaking";
8
8
  import { AnySpendCustom } from "./AnySpendCustom";
9
9
 
10
- function generateEncodedDataForStaking(amount: string, beneficiary: string, poolType: "b3" | "weth"): string {
10
+ function generateEncodedDataForStaking(amount: string, beneficiary: string): string {
11
11
  invariant(BigInt(amount) > 0, "Amount must be greater than zero");
12
- if (poolType === "weth") {
13
- return encodeFunctionData({
14
- abi: WETH_STAKING_CONTRACT,
15
- functionName: "stakeFor",
16
- args: [beneficiary as `0x${string}`, BigInt(amount)],
17
- });
18
- } else if (poolType === "b3") {
19
- return encodeFunctionData({
20
- abi: B3_STAKING_CONTRACT,
21
- functionName: "stakeFor",
22
- args: [beneficiary as `0x${string}`, BigInt(amount)],
23
- });
24
- }
25
- throw new Error("Unsupported pool type");
12
+ return encodeFunctionData({
13
+ abi: STAKING_CONTRACT,
14
+ functionName: "stakeFor",
15
+ args: [beneficiary as `0x${string}`, BigInt(amount)],
16
+ });
26
17
  }
27
18
 
28
19
  export function AnySpendStakeUpside({
@@ -32,7 +23,6 @@ export function AnySpendStakeUpside({
32
23
  stakeAmount,
33
24
  stakingContractAddress,
34
25
  token,
35
- poolType,
36
26
  onSuccess,
37
27
  activeTab,
38
28
  }: {
@@ -42,7 +32,6 @@ export function AnySpendStakeUpside({
42
32
  stakeAmount: string;
43
33
  stakingContractAddress: string;
44
34
  token: components["schemas"]["Token"];
45
- poolType: "b3" | "weth";
46
35
  onSuccess?: () => void;
47
36
  activeTab?: "crypto" | "fiat";
48
37
  }) {
@@ -71,7 +60,7 @@ export function AnySpendStakeUpside({
71
60
  );
72
61
  }
73
62
 
74
- const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress, poolType);
63
+ const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
75
64
 
76
65
  return (
77
66
  <AnySpendCustom