@b3dotfun/sdk 0.0.61-alpha.0 → 0.0.61-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.
|
@@ -163,12 +163,23 @@ function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, stakeAmo
|
|
|
163
163
|
functionName: "approve",
|
|
164
164
|
args: [ERC20Staking, BigInt(userStakeAmount)],
|
|
165
165
|
});
|
|
166
|
-
await switchChainAndExecute(chains_1.base.id, {
|
|
166
|
+
const approvalHash = await switchChainAndExecute(chains_1.base.id, {
|
|
167
167
|
to: anyspend_1.B3_TOKEN.address,
|
|
168
168
|
data: approvalData,
|
|
169
169
|
value: BigInt(0),
|
|
170
170
|
});
|
|
171
|
-
|
|
171
|
+
if (!approvalHash) {
|
|
172
|
+
sonner_1.toast.error("Approval failed. Please try again.");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const approvalReceipt = await basePublicClient.waitForTransactionReceipt({
|
|
176
|
+
hash: approvalHash,
|
|
177
|
+
confirmations: 1,
|
|
178
|
+
});
|
|
179
|
+
if (approvalReceipt?.status !== "success") {
|
|
180
|
+
sonner_1.toast.error("Approval failed. Please try again.");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
172
183
|
}
|
|
173
184
|
// Execute the stake
|
|
174
185
|
sonner_1.toast.info("Staking B3...");
|
|
@@ -157,12 +157,23 @@ export function AnySpendStakeB3({ loadOrder, mode = "modal", recipientAddress, s
|
|
|
157
157
|
functionName: "approve",
|
|
158
158
|
args: [ERC20Staking, BigInt(userStakeAmount)],
|
|
159
159
|
});
|
|
160
|
-
await switchChainAndExecute(base.id, {
|
|
160
|
+
const approvalHash = await switchChainAndExecute(base.id, {
|
|
161
161
|
to: B3_TOKEN.address,
|
|
162
162
|
data: approvalData,
|
|
163
163
|
value: BigInt(0),
|
|
164
164
|
});
|
|
165
|
-
|
|
165
|
+
if (!approvalHash) {
|
|
166
|
+
toast.error("Approval failed. Please try again.");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const approvalReceipt = await basePublicClient.waitForTransactionReceipt({
|
|
170
|
+
hash: approvalHash,
|
|
171
|
+
confirmations: 1,
|
|
172
|
+
});
|
|
173
|
+
if (approvalReceipt?.status !== "success") {
|
|
174
|
+
toast.error("Approval failed. Please try again.");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
166
177
|
}
|
|
167
178
|
// Execute the stake
|
|
168
179
|
toast.info("Staking B3...");
|
package/package.json
CHANGED
|
@@ -207,13 +207,26 @@ export function AnySpendStakeB3({
|
|
|
207
207
|
args: [ERC20Staking as `0x${string}`, BigInt(userStakeAmount)],
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
await switchChainAndExecute(base.id, {
|
|
210
|
+
const approvalHash = await switchChainAndExecute(base.id, {
|
|
211
211
|
to: B3_TOKEN.address as `0x${string}`,
|
|
212
212
|
data: approvalData,
|
|
213
213
|
value: BigInt(0),
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
if (!approvalHash) {
|
|
217
|
+
toast.error("Approval failed. Please try again.");
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const approvalReceipt = await basePublicClient.waitForTransactionReceipt({
|
|
222
|
+
hash: approvalHash as `0x${string}`,
|
|
223
|
+
confirmations: 1,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
if (approvalReceipt?.status !== "success") {
|
|
227
|
+
toast.error("Approval failed. Please try again.");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
217
230
|
}
|
|
218
231
|
|
|
219
232
|
// Execute the stake
|