@b3dotfun/sdk 0.0.59-alpha.1 → 0.0.59

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.
@@ -1,11 +1,12 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
- export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }: {
2
+ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, poolType, onSuccess, activeTab, }: {
3
3
  loadOrder?: string;
4
4
  mode?: "modal" | "page";
5
5
  beneficiaryAddress: string;
6
6
  stakeAmount: string;
7
7
  stakingContractAddress: string;
8
8
  token: components["schemas"]["Token"];
9
+ poolType: "b3" | "weth";
9
10
  onSuccess?: () => void;
10
11
  activeTab?: "crypto" | "fiat";
11
12
  }): import("react/jsx-runtime").JSX.Element;
@@ -223,6 +223,8 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
223
223
  stakeAmount: string;
224
224
  /** Staking contract address */
225
225
  stakingContractAddress: string;
226
+ /** Pool type for staking */
227
+ poolType: "b3" | "weth";
226
228
  /** Token address to stake */
227
229
  token: components["schemas"]["Token"];
228
230
  /** Active tab for the modal */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.59-alpha.1",
3
+ "version": "0.0.59",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -1,4 +1,573 @@
1
- export const STAKING_CONTRACT = [
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 = [
2
571
  { inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
3
572
  {
4
573
  inputs: [{ internalType: "address", name: "implementation", type: "address" }],
@@ -4,16 +4,25 @@ 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 { STAKING_CONTRACT } from "../../abis/upsideStaking";
7
+ import { B3_STAKING_CONTRACT, WETH_STAKING_CONTRACT } from "../../abis/upsideStaking";
8
8
  import { AnySpendCustom } from "./AnySpendCustom";
9
9
 
10
- function generateEncodedDataForStaking(amount: string, beneficiary: string): string {
10
+ function generateEncodedDataForStaking(amount: string, beneficiary: string, poolType: "b3" | "weth"): string {
11
11
  invariant(BigInt(amount) > 0, "Amount must be greater than zero");
12
- return encodeFunctionData({
13
- abi: STAKING_CONTRACT,
14
- functionName: "stakeFor",
15
- args: [beneficiary as `0x${string}`, BigInt(amount)],
16
- });
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");
17
26
  }
18
27
 
19
28
  export function AnySpendStakeUpside({
@@ -23,6 +32,7 @@ export function AnySpendStakeUpside({
23
32
  stakeAmount,
24
33
  stakingContractAddress,
25
34
  token,
35
+ poolType,
26
36
  onSuccess,
27
37
  activeTab,
28
38
  }: {
@@ -32,6 +42,7 @@ export function AnySpendStakeUpside({
32
42
  stakeAmount: string;
33
43
  stakingContractAddress: string;
34
44
  token: components["schemas"]["Token"];
45
+ poolType: "b3" | "weth";
35
46
  onSuccess?: () => void;
36
47
  activeTab?: "crypto" | "fiat";
37
48
  }) {
@@ -60,7 +71,7 @@ export function AnySpendStakeUpside({
60
71
  );
61
72
  }
62
73
 
63
- const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
74
+ const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress, poolType);
64
75
 
65
76
  return (
66
77
  <AnySpendCustom
@@ -236,6 +236,8 @@ export interface AnySpendStakeUpsideProps extends BaseModalProps {
236
236
  stakeAmount: string;
237
237
  /** Staking contract address */
238
238
  stakingContractAddress: string;
239
+ /** Pool type for staking */
240
+ poolType: "b3" | "weth";
239
241
  /** Token address to stake */
240
242
  token: components["schemas"]["Token"];
241
243
  /** Active tab for the modal */