@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.
- package/dist/cjs/anyspend/abis/upsideStaking.d.ts +1 -1030
- package/dist/cjs/anyspend/abis/upsideStaking.js +2 -570
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +8 -18
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +4 -0
- package/dist/cjs/anyspend/utils/accountStore.d.ts +7 -0
- package/dist/cjs/anyspend/utils/accountStore.js +8 -0
- package/dist/cjs/anyspend/utils/index.d.ts +1 -0
- package/dist/cjs/anyspend/utils/index.js +1 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +17 -0
- package/dist/cjs/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
- package/dist/cjs/global-account/react/hooks/useWagmiConfig.js +2 -0
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/cjs/shared/react/components/CurrencySelector.js +8 -3
- package/dist/cjs/shared/react/components/FormattedCurrency.d.ts +3 -3
- package/dist/cjs/shared/react/components/FormattedCurrency.js +31 -26
- package/dist/cjs/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
- package/dist/cjs/shared/react/hooks/useCurrencyConversion.js +153 -94
- package/dist/cjs/shared/react/stores/currencyStore.d.ts +83 -8
- package/dist/cjs/shared/react/stores/currencyStore.js +147 -5
- package/dist/esm/anyspend/abis/upsideStaking.d.ts +1 -1030
- package/dist/esm/anyspend/abis/upsideStaking.js +1 -569
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +9 -19
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +5 -1
- package/dist/esm/anyspend/utils/accountStore.d.ts +7 -0
- package/dist/esm/anyspend/utils/accountStore.js +5 -0
- package/dist/esm/anyspend/utils/index.d.ts +1 -0
- package/dist/esm/anyspend/utils/index.js +1 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +17 -0
- package/dist/esm/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
- package/dist/esm/global-account/react/hooks/useWagmiConfig.js +2 -0
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/shared/react/components/CurrencySelector.js +10 -5
- package/dist/esm/shared/react/components/FormattedCurrency.d.ts +3 -3
- package/dist/esm/shared/react/components/FormattedCurrency.js +31 -26
- package/dist/esm/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
- package/dist/esm/shared/react/hooks/useCurrencyConversion.js +154 -95
- package/dist/esm/shared/react/stores/currencyStore.d.ts +83 -8
- package/dist/esm/shared/react/stores/currencyStore.js +143 -5
- package/dist/types/anyspend/abis/upsideStaking.d.ts +1 -1030
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/types/anyspend/utils/accountStore.d.ts +7 -0
- package/dist/types/anyspend/utils/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useWagmiConfig.d.ts +441 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/shared/react/components/FormattedCurrency.d.ts +3 -3
- package/dist/types/shared/react/hooks/useCurrencyConversion.d.ts +8 -5
- package/dist/types/shared/react/stores/currencyStore.d.ts +83 -8
- package/package.json +4 -3
- package/src/anyspend/abis/upsideStaking.ts +1 -570
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +8 -19
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +6 -2
- package/src/anyspend/utils/accountStore.ts +12 -0
- package/src/anyspend/utils/index.ts +1 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +20 -0
- package/src/global-account/react/hooks/useWagmiConfig.tsx +2 -0
- package/src/global-account/react/stores/useModalStore.ts +0 -2
- package/src/shared/react/components/CurrencySelector.tsx +36 -5
- package/src/shared/react/components/FormattedCurrency.tsx +36 -30
- package/src/shared/react/hooks/__tests__/useCurrencyConversion.test.ts +14 -14
- package/src/shared/react/hooks/useCurrencyConversion.ts +163 -96
- package/src/shared/react/stores/currencyStore.ts +216 -10
|
@@ -1,575 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
{ inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
|
|
6
|
-
{
|
|
7
|
-
inputs: [{ internalType: "address", name: "implementation", type: "address" }],
|
|
8
|
-
name: "ERC1967InvalidImplementation",
|
|
9
|
-
type: "error",
|
|
10
|
-
},
|
|
11
|
-
{ inputs: [], name: "ERC1967NonPayable", type: "error" },
|
|
12
|
-
{ inputs: [], name: "EnforcedPause", type: "error" },
|
|
13
|
-
{ inputs: [], name: "ExpectedPause", type: "error" },
|
|
14
|
-
{ inputs: [], name: "FailedCall", type: "error" },
|
|
15
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
16
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
17
|
-
{ inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" },
|
|
18
|
-
{
|
|
19
|
-
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
20
|
-
name: "OwnableUnauthorizedAccount",
|
|
21
|
-
type: "error",
|
|
22
|
-
},
|
|
23
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
24
|
-
{
|
|
25
|
-
inputs: [{ internalType: "address", name: "token", type: "address" }],
|
|
26
|
-
name: "SafeERC20FailedOperation",
|
|
27
|
-
type: "error",
|
|
28
|
-
},
|
|
29
|
-
{ inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
|
|
30
|
-
{
|
|
31
|
-
inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
|
|
32
|
-
name: "UUPSUnsupportedProxiableUUID",
|
|
33
|
-
type: "error",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
anonymous: false,
|
|
37
|
-
inputs: [
|
|
38
|
-
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
39
|
-
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
40
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
41
|
-
{ indexed: false, internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
42
|
-
{ indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
43
|
-
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
|
|
44
|
-
],
|
|
45
|
-
name: "DelayedUnstakeClaimed",
|
|
46
|
-
type: "event",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
anonymous: false,
|
|
50
|
-
inputs: [
|
|
51
|
-
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
52
|
-
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
53
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
54
|
-
{ indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
|
|
55
|
-
{ indexed: false, internalType: "uint256", name: "requestTime", type: "uint256" },
|
|
56
|
-
{ indexed: false, internalType: "uint256", name: "claimableTime", type: "uint256" },
|
|
57
|
-
{ indexed: false, internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
58
|
-
{ indexed: true, internalType: "uint256", name: "nonce", type: "uint256" },
|
|
59
|
-
],
|
|
60
|
-
name: "DelayedUnstakeRequested",
|
|
61
|
-
type: "event",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
anonymous: false,
|
|
65
|
-
inputs: [
|
|
66
|
-
{ indexed: true, internalType: "address", name: "token", type: "address" },
|
|
67
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
68
|
-
],
|
|
69
|
-
name: "EmergencyWithdraw",
|
|
70
|
-
type: "event",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
anonymous: false,
|
|
74
|
-
inputs: [
|
|
75
|
-
{ indexed: true, internalType: "address", name: "oldRecipient", type: "address" },
|
|
76
|
-
{ indexed: true, internalType: "address", name: "newRecipient", type: "address" },
|
|
77
|
-
],
|
|
78
|
-
name: "FeeRecipientUpdated",
|
|
79
|
-
type: "event",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
anonymous: false,
|
|
83
|
-
inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }],
|
|
84
|
-
name: "Initialized",
|
|
85
|
-
type: "event",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
anonymous: false,
|
|
89
|
-
inputs: [
|
|
90
|
-
{ indexed: false, internalType: "uint256", name: "oldFee", type: "uint256" },
|
|
91
|
-
{ indexed: false, internalType: "uint256", name: "newFee", type: "uint256" },
|
|
92
|
-
],
|
|
93
|
-
name: "InstantUnstakeFeeUpdated",
|
|
94
|
-
type: "event",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
anonymous: false,
|
|
98
|
-
inputs: [
|
|
99
|
-
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
100
|
-
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
101
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
102
|
-
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
103
|
-
{ indexed: false, internalType: "uint256", name: "netAmount", type: "uint256" },
|
|
104
|
-
{ indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
|
|
105
|
-
{ indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
106
|
-
{ indexed: true, internalType: "uint256", name: "nonce", type: "uint256" },
|
|
107
|
-
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
108
|
-
],
|
|
109
|
-
name: "InstantUnstaked",
|
|
110
|
-
type: "event",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
anonymous: false,
|
|
114
|
-
inputs: [
|
|
115
|
-
{ indexed: true, internalType: "address", name: "previousOwner", type: "address" },
|
|
116
|
-
{ indexed: true, internalType: "address", name: "newOwner", type: "address" },
|
|
117
|
-
],
|
|
118
|
-
name: "OwnershipTransferred",
|
|
119
|
-
type: "event",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
anonymous: false,
|
|
123
|
-
inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
|
|
124
|
-
name: "Paused",
|
|
125
|
-
type: "event",
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
anonymous: false,
|
|
129
|
-
inputs: [
|
|
130
|
-
{ indexed: true, internalType: "address", name: "staker", type: "address" },
|
|
131
|
-
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
132
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
133
|
-
{ indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
|
|
134
|
-
{ indexed: false, internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
135
|
-
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
|
|
136
|
-
],
|
|
137
|
-
name: "Staked",
|
|
138
|
-
type: "event",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
anonymous: false,
|
|
142
|
-
inputs: [
|
|
143
|
-
{ indexed: true, internalType: "address", name: "oldWallet", type: "address" },
|
|
144
|
-
{ indexed: true, internalType: "address", name: "newWallet", type: "address" },
|
|
145
|
-
],
|
|
146
|
-
name: "TreasuryWalletUpdated",
|
|
147
|
-
type: "event",
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
anonymous: false,
|
|
151
|
-
inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
|
|
152
|
-
name: "Unpaused",
|
|
153
|
-
type: "event",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
anonymous: false,
|
|
157
|
-
inputs: [
|
|
158
|
-
{ indexed: true, internalType: "address", name: "user", type: "address" },
|
|
159
|
-
{ indexed: true, internalType: "address", name: "to", type: "address" },
|
|
160
|
-
{ indexed: true, internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
161
|
-
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
|
|
162
|
-
{ indexed: false, internalType: "uint256", name: "newTotal", type: "uint256" },
|
|
163
|
-
{ indexed: false, internalType: "uint256", name: "nonce", type: "uint256" },
|
|
164
|
-
],
|
|
165
|
-
name: "UnstakeCancelled",
|
|
166
|
-
type: "event",
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
anonymous: false,
|
|
170
|
-
inputs: [
|
|
171
|
-
{ indexed: false, internalType: "uint256", name: "oldDelay", type: "uint256" },
|
|
172
|
-
{ indexed: false, internalType: "uint256", name: "newDelay", type: "uint256" },
|
|
173
|
-
],
|
|
174
|
-
name: "UnstakeDelayUpdated",
|
|
175
|
-
type: "event",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
anonymous: false,
|
|
179
|
-
inputs: [{ indexed: true, internalType: "address", name: "implementation", type: "address" }],
|
|
180
|
-
name: "Upgraded",
|
|
181
|
-
type: "event",
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
inputs: [],
|
|
185
|
-
name: "BASIS_POINTS",
|
|
186
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
187
|
-
stateMutability: "view",
|
|
188
|
-
type: "function",
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
inputs: [],
|
|
192
|
-
name: "UPGRADE_INTERFACE_VERSION",
|
|
193
|
-
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
194
|
-
stateMutability: "view",
|
|
195
|
-
type: "function",
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
inputs: [{ internalType: "uint256[]", name: "requestIndices", type: "uint256[]" }],
|
|
199
|
-
name: "batchClaimDelayedUnstakes",
|
|
200
|
-
outputs: [],
|
|
201
|
-
stateMutability: "nonpayable",
|
|
202
|
-
type: "function",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
inputs: [
|
|
206
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
207
|
-
{ internalType: "uint256[]", name: "requestIndices", type: "uint256[]" },
|
|
208
|
-
],
|
|
209
|
-
name: "batchClaimDelayedUnstakesFor",
|
|
210
|
-
outputs: [],
|
|
211
|
-
stateMutability: "nonpayable",
|
|
212
|
-
type: "function",
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
216
|
-
name: "calculateInstantUnstakeFee",
|
|
217
|
-
outputs: [
|
|
218
|
-
{ internalType: "uint256", name: "fee", type: "uint256" },
|
|
219
|
-
{ internalType: "uint256", name: "netAmount", type: "uint256" },
|
|
220
|
-
],
|
|
221
|
-
stateMutability: "view",
|
|
222
|
-
type: "function",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
inputs: [{ internalType: "uint256", name: "requestIndex", type: "uint256" }],
|
|
226
|
-
name: "cancelUnstake",
|
|
227
|
-
outputs: [],
|
|
228
|
-
stateMutability: "nonpayable",
|
|
229
|
-
type: "function",
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
inputs: [
|
|
233
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
234
|
-
{ internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
235
|
-
],
|
|
236
|
-
name: "cancelUnstakeFor",
|
|
237
|
-
outputs: [],
|
|
238
|
-
stateMutability: "nonpayable",
|
|
239
|
-
type: "function",
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
inputs: [{ internalType: "uint256", name: "requestIndex", type: "uint256" }],
|
|
243
|
-
name: "claimDelayedUnstake",
|
|
244
|
-
outputs: [],
|
|
245
|
-
stateMutability: "nonpayable",
|
|
246
|
-
type: "function",
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
inputs: [
|
|
250
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
251
|
-
{ internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
252
|
-
],
|
|
253
|
-
name: "claimDelayedUnstakeFor",
|
|
254
|
-
outputs: [],
|
|
255
|
-
stateMutability: "nonpayable",
|
|
256
|
-
type: "function",
|
|
257
|
-
},
|
|
258
|
-
{ inputs: [], name: "emergencyWithdraw", outputs: [], stateMutability: "nonpayable", type: "function" },
|
|
259
|
-
{
|
|
260
|
-
inputs: [],
|
|
261
|
-
name: "feeRecipient",
|
|
262
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
263
|
-
stateMutability: "view",
|
|
264
|
-
type: "function",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
inputs: [],
|
|
268
|
-
name: "getContractBalance",
|
|
269
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
270
|
-
stateMutability: "view",
|
|
271
|
-
type: "function",
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
inputs: [],
|
|
275
|
-
name: "getCurrentNonce",
|
|
276
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
277
|
-
stateMutability: "view",
|
|
278
|
-
type: "function",
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
inputs: [],
|
|
282
|
-
name: "getTotalStaked",
|
|
283
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
284
|
-
stateMutability: "view",
|
|
285
|
-
type: "function",
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
inputs: [
|
|
289
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
290
|
-
{ internalType: "uint256", name: "requestIndex", type: "uint256" },
|
|
291
|
-
],
|
|
292
|
-
name: "getUnstakeRequest",
|
|
293
|
-
outputs: [
|
|
294
|
-
{
|
|
295
|
-
components: [
|
|
296
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
297
|
-
{ internalType: "uint256", name: "requestTime", type: "uint256" },
|
|
298
|
-
{ internalType: "bool", name: "claimed", type: "bool" },
|
|
299
|
-
],
|
|
300
|
-
internalType: "struct ERC20StakingUpgradeable.UnstakeRequest",
|
|
301
|
-
name: "",
|
|
302
|
-
type: "tuple",
|
|
303
|
-
},
|
|
304
|
-
],
|
|
305
|
-
stateMutability: "view",
|
|
306
|
-
type: "function",
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
inputs: [{ internalType: "address", name: "user", type: "address" }],
|
|
310
|
-
name: "getUserStakeInfo",
|
|
311
|
-
outputs: [
|
|
312
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
313
|
-
{ internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
314
|
-
{
|
|
315
|
-
components: [
|
|
316
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
317
|
-
{ internalType: "uint256", name: "requestTime", type: "uint256" },
|
|
318
|
-
{ internalType: "bool", name: "claimed", type: "bool" },
|
|
319
|
-
],
|
|
320
|
-
internalType: "struct ERC20StakingUpgradeable.UnstakeRequest[]",
|
|
321
|
-
name: "requests",
|
|
322
|
-
type: "tuple[]",
|
|
323
|
-
},
|
|
324
|
-
{ internalType: "uint256", name: "totalPending", type: "uint256" },
|
|
325
|
-
{ internalType: "uint256[]", name: "claimableRequestIndices", type: "uint256[]" },
|
|
326
|
-
{ internalType: "uint256", name: "totalClaimableAmount", type: "uint256" },
|
|
327
|
-
],
|
|
328
|
-
stateMutability: "view",
|
|
329
|
-
type: "function",
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
inputs: [
|
|
333
|
-
{ internalType: "address", name: "initialOwner", type: "address" },
|
|
334
|
-
{ internalType: "contract IERC20", name: "_stakingToken", type: "address" },
|
|
335
|
-
{ internalType: "address", name: "_treasuryWallet", type: "address" },
|
|
336
|
-
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
337
|
-
],
|
|
338
|
-
name: "initialize",
|
|
339
|
-
outputs: [],
|
|
340
|
-
stateMutability: "nonpayable",
|
|
341
|
-
type: "function",
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
345
|
-
name: "instantUnstake",
|
|
346
|
-
outputs: [],
|
|
347
|
-
stateMutability: "nonpayable",
|
|
348
|
-
type: "function",
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
inputs: [],
|
|
352
|
-
name: "instantUnstakeFeePercentage",
|
|
353
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
354
|
-
stateMutability: "view",
|
|
355
|
-
type: "function",
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
inputs: [
|
|
359
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
360
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
361
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
362
|
-
],
|
|
363
|
-
name: "instantUnstakeFor",
|
|
364
|
-
outputs: [],
|
|
365
|
-
stateMutability: "nonpayable",
|
|
366
|
-
type: "function",
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
inputs: [
|
|
370
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
371
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
372
|
-
],
|
|
373
|
-
name: "instantUnstakeTo",
|
|
374
|
-
outputs: [],
|
|
375
|
-
stateMutability: "nonpayable",
|
|
376
|
-
type: "function",
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
inputs: [],
|
|
380
|
-
name: "nonce",
|
|
381
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
382
|
-
stateMutability: "view",
|
|
383
|
-
type: "function",
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
inputs: [],
|
|
387
|
-
name: "owner",
|
|
388
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
389
|
-
stateMutability: "view",
|
|
390
|
-
type: "function",
|
|
391
|
-
},
|
|
392
|
-
{ inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" },
|
|
393
|
-
{
|
|
394
|
-
inputs: [],
|
|
395
|
-
name: "paused",
|
|
396
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
397
|
-
stateMutability: "view",
|
|
398
|
-
type: "function",
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
inputs: [],
|
|
402
|
-
name: "proxiableUUID",
|
|
403
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
404
|
-
stateMutability: "view",
|
|
405
|
-
type: "function",
|
|
406
|
-
},
|
|
407
|
-
{ inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" },
|
|
408
|
-
{
|
|
409
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
410
|
-
name: "requestDelayedUnstake",
|
|
411
|
-
outputs: [],
|
|
412
|
-
stateMutability: "nonpayable",
|
|
413
|
-
type: "function",
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
inputs: [
|
|
417
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
418
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
419
|
-
],
|
|
420
|
-
name: "requestDelayedUnstakeFor",
|
|
421
|
-
outputs: [],
|
|
422
|
-
stateMutability: "nonpayable",
|
|
423
|
-
type: "function",
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
inputs: [
|
|
427
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
428
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
429
|
-
],
|
|
430
|
-
name: "requestDelayedUnstakeTo",
|
|
431
|
-
outputs: [],
|
|
432
|
-
stateMutability: "nonpayable",
|
|
433
|
-
type: "function",
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
437
|
-
name: "stake",
|
|
438
|
-
outputs: [],
|
|
439
|
-
stateMutability: "nonpayable",
|
|
440
|
-
type: "function",
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
inputs: [
|
|
444
|
-
{ internalType: "address", name: "user", type: "address" },
|
|
445
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
446
|
-
],
|
|
447
|
-
name: "stakeFor",
|
|
448
|
-
outputs: [],
|
|
449
|
-
stateMutability: "nonpayable",
|
|
450
|
-
type: "function",
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
454
|
-
name: "stakeTimestamps",
|
|
455
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
456
|
-
stateMutability: "view",
|
|
457
|
-
type: "function",
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
461
|
-
name: "stakedAmounts",
|
|
462
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
463
|
-
stateMutability: "view",
|
|
464
|
-
type: "function",
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
inputs: [],
|
|
468
|
-
name: "stakingToken",
|
|
469
|
-
outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
|
|
470
|
-
stateMutability: "view",
|
|
471
|
-
type: "function",
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
475
|
-
name: "totalPendingUnstakes",
|
|
476
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
477
|
-
stateMutability: "view",
|
|
478
|
-
type: "function",
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
inputs: [],
|
|
482
|
-
name: "totalStaked",
|
|
483
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
484
|
-
stateMutability: "view",
|
|
485
|
-
type: "function",
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
489
|
-
name: "transferOwnership",
|
|
490
|
-
outputs: [],
|
|
491
|
-
stateMutability: "nonpayable",
|
|
492
|
-
type: "function",
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
inputs: [],
|
|
496
|
-
name: "treasuryWallet",
|
|
497
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
498
|
-
stateMutability: "view",
|
|
499
|
-
type: "function",
|
|
500
|
-
},
|
|
501
|
-
{ inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" },
|
|
502
|
-
{
|
|
503
|
-
inputs: [],
|
|
504
|
-
name: "unstakeDelay",
|
|
505
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
506
|
-
stateMutability: "view",
|
|
507
|
-
type: "function",
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
inputs: [
|
|
511
|
-
{ internalType: "address", name: "", type: "address" },
|
|
512
|
-
{ internalType: "uint256", name: "", type: "uint256" },
|
|
513
|
-
],
|
|
514
|
-
name: "unstakeRequestRecipients",
|
|
515
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
516
|
-
stateMutability: "view",
|
|
517
|
-
type: "function",
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
inputs: [
|
|
521
|
-
{ internalType: "address", name: "", type: "address" },
|
|
522
|
-
{ internalType: "uint256", name: "", type: "uint256" },
|
|
523
|
-
],
|
|
524
|
-
name: "unstakeRequests",
|
|
525
|
-
outputs: [
|
|
526
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
527
|
-
{ internalType: "uint256", name: "requestTime", type: "uint256" },
|
|
528
|
-
{ internalType: "bool", name: "claimed", type: "bool" },
|
|
529
|
-
],
|
|
530
|
-
stateMutability: "view",
|
|
531
|
-
type: "function",
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
inputs: [{ internalType: "address", name: "_newFeeRecipient", type: "address" }],
|
|
535
|
-
name: "updateFeeRecipient",
|
|
536
|
-
outputs: [],
|
|
537
|
-
stateMutability: "nonpayable",
|
|
538
|
-
type: "function",
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
inputs: [{ internalType: "uint256", name: "_newFeePercentage", type: "uint256" }],
|
|
542
|
-
name: "updateInstantUnstakeFee",
|
|
543
|
-
outputs: [],
|
|
544
|
-
stateMutability: "nonpayable",
|
|
545
|
-
type: "function",
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
inputs: [{ internalType: "address", name: "_newTreasuryWallet", type: "address" }],
|
|
549
|
-
name: "updateTreasuryWallet",
|
|
550
|
-
outputs: [],
|
|
551
|
-
stateMutability: "nonpayable",
|
|
552
|
-
type: "function",
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
inputs: [{ internalType: "uint256", name: "_newDelay", type: "uint256" }],
|
|
556
|
-
name: "updateUnstakeDelay",
|
|
557
|
-
outputs: [],
|
|
558
|
-
stateMutability: "nonpayable",
|
|
559
|
-
type: "function",
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
inputs: [
|
|
563
|
-
{ internalType: "address", name: "newImplementation", type: "address" },
|
|
564
|
-
{ internalType: "bytes", name: "data", type: "bytes" },
|
|
565
|
-
],
|
|
566
|
-
name: "upgradeToAndCall",
|
|
567
|
-
outputs: [],
|
|
568
|
-
stateMutability: "payable",
|
|
569
|
-
type: "function",
|
|
570
|
-
},
|
|
571
|
-
];
|
|
572
|
-
exports.B3_STAKING_CONTRACT = [
|
|
3
|
+
exports.STAKING_CONTRACT = void 0;
|
|
4
|
+
exports.STAKING_CONTRACT = [
|
|
573
5
|
{ inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" },
|
|
574
6
|
{
|
|
575
7
|
inputs: [{ internalType: "address", name: "implementation", type: "address" }],
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token,
|
|
2
|
+
export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, 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";
|
|
10
9
|
onSuccess?: () => void;
|
|
11
10
|
activeTab?: "crypto" | "fiat";
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,32 +12,22 @@ const viem_1 = require("viem");
|
|
|
12
12
|
const chains_1 = require("viem/chains");
|
|
13
13
|
const upsideStaking_1 = require("../../abis/upsideStaking");
|
|
14
14
|
const AnySpendCustom_1 = require("./AnySpendCustom");
|
|
15
|
-
function generateEncodedDataForStaking(amount, beneficiary
|
|
15
|
+
function generateEncodedDataForStaking(amount, beneficiary) {
|
|
16
16
|
(0, invariant_1.default)(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
else if (poolType === "b3") {
|
|
25
|
-
return (0, viem_1.encodeFunctionData)({
|
|
26
|
-
abi: upsideStaking_1.B3_STAKING_CONTRACT,
|
|
27
|
-
functionName: "stakeFor",
|
|
28
|
-
args: [beneficiary, BigInt(amount)],
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
throw new Error("Unsupported pool type");
|
|
17
|
+
return (0, viem_1.encodeFunctionData)({
|
|
18
|
+
abi: upsideStaking_1.STAKING_CONTRACT,
|
|
19
|
+
functionName: "stakeFor",
|
|
20
|
+
args: [beneficiary, BigInt(amount)],
|
|
21
|
+
});
|
|
32
22
|
}
|
|
33
|
-
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token,
|
|
23
|
+
function AnySpendStakeUpside({ loadOrder, mode = "modal", beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, }) {
|
|
34
24
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-60px] w-full rounded-t-lg bg-gradient-to-t", children: [(0, jsx_runtime_1.jsx)("div", { className: "h-[60px] w-full" }), (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", stakeAmount ? (0, number_1.formatTokenAmount)(BigInt(stakeAmount), token.decimals) : "", " ", token.symbol] }) })] }) }));
|
|
35
25
|
// Only generate encoded data if we have a valid beneficiary address
|
|
36
26
|
// This is used for the AnySpendCustom swap & stake flow
|
|
37
27
|
if (!beneficiaryAddress || beneficiaryAddress === "") {
|
|
38
28
|
return ((0, jsx_runtime_1.jsx)(react_1.StyleRoot, { children: (0, jsx_runtime_1.jsx)("div", { className: "bg-b3-react-background flex w-full flex-col items-center justify-center p-8", children: (0, jsx_runtime_1.jsx)("p", { className: "font-medium text-yellow-600 dark:text-yellow-400", children: "\u26A0\uFE0F Please connect your wallet to continue." }) }) }));
|
|
39
29
|
}
|
|
40
|
-
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress
|
|
30
|
+
const encodedData = generateEncodedDataForStaking(stakeAmount, beneficiaryAddress);
|
|
41
31
|
return ((0, jsx_runtime_1.jsx)(AnySpendCustom_1.AnySpendCustom, { loadOrder: loadOrder, mode: mode, recipientAddress: beneficiaryAddress, orderType: "custom", dstChainId: chains_1.base.id, dstToken: token, dstAmount: stakeAmount, contractAddress: stakingContractAddress, encodedData: encodedData, metadata: {
|
|
42
32
|
action: `stake ${token.symbol}`,
|
|
43
33
|
}, header: header, onSuccess: onSuccess, showRecipient: true, activeTab: activeTab }));
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.CryptoPaymentMethodType = void 0;
|
|
5
5
|
exports.CryptoPaymentMethod = CryptoPaymentMethod;
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const utils_1 = require("../../../../anyspend/utils");
|
|
7
8
|
const react_1 = require("../../../../global-account/react");
|
|
8
9
|
const cn_1 = require("../../../../shared/utils/cn");
|
|
9
10
|
const formatAddress_1 = require("../../../../shared/utils/formatAddress");
|
|
@@ -32,6 +33,8 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
32
33
|
const [showWalletModal, setShowWalletModal] = (0, react_3.useState)(false);
|
|
33
34
|
const setActiveWallet = (0, react_4.useSetActiveWallet)();
|
|
34
35
|
const { data: eoaWalletInfo } = (0, react_4.useWalletInfo)(connectedEOAWallet?.id);
|
|
36
|
+
const activeWallet = (0, react_4.useActiveWallet)();
|
|
37
|
+
const setGlobalAccountWallet = (0, utils_1.useGlobalWalletState)(state => state.setGlobalAccountWallet);
|
|
35
38
|
const isConnected = !!connectedEOAWallet;
|
|
36
39
|
const globalAddress = connectedSmartWallet?.getAccount()?.address;
|
|
37
40
|
// Helper function to check if two addresses are the same
|
|
@@ -173,6 +176,7 @@ function CryptoPaymentMethod({ selectedPaymentMethod, setSelectedPaymentMethod,
|
|
|
173
176
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-method mx-auto h-fit w-[460px] max-w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)("relative flex flex-col gap-10"), children: [(0, jsx_runtime_1.jsx)("button", { onClick: onBack, className: "text-as-quaternary hover:text-as-primary absolute flex h-8 w-8 items-center justify-center rounded-lg transition-colors", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { className: "h-6 w-6" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-around gap-4", children: (0, jsx_runtime_1.jsx)("div", { className: "flex-1 text-center", children: (0, jsx_runtime_1.jsx)("h2", { className: "text-as-primary text-lg font-semibold", children: "Select a payment method" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "crypto-payment-methods flex flex-col gap-4", children: [(shouldShowConnectedEOA || shouldShowWagmiWallet || globalAddress) && ((0, jsx_runtime_1.jsxs)("div", { className: "installed-wallets", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-as-primary/80 mb-3 text-sm font-medium", children: "Connected wallets" }), (0, jsx_runtime_1.jsxs)("div", { className: "space-y-2", children: [shouldShowConnectedEOA && ((0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
174
177
|
setSelectedPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
175
178
|
onSelectPaymentMethod(CryptoPaymentMethodType.CONNECT_WALLET);
|
|
179
|
+
setGlobalAccountWallet(activeWallet);
|
|
176
180
|
setActiveWallet(connectedEOAWallet);
|
|
177
181
|
sonner_1.toast.success(`Selected ${eoaWalletInfo?.name || connector?.name || "wallet"}`);
|
|
178
182
|
}, className: (0, cn_1.cn)("crypto-payment-method-connect-wallet w-full rounded-xl border p-4 text-left transition-all hover:shadow-md", selectedPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Wallet } from "thirdweb/wallets";
|
|
2
|
+
interface GlobalWalletState {
|
|
3
|
+
globalAccountWallet?: Wallet;
|
|
4
|
+
setGlobalAccountWallet: (account?: Wallet) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useGlobalWalletState: import("zustand").UseBoundStore<import("zustand").StoreApi<GlobalWalletState>>;
|
|
7
|
+
export {};
|