@b3dotfun/sdk 0.0.60 → 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
- sonner_1.toast.info("Approval confirmed. Proceeding with stake...");
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
- toast.info("Approval confirmed. Proceeding with stake...");
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.60",
3
+ "version": "0.0.61-alpha.1",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -136,6 +136,11 @@
136
136
  "import": "./dist/esm/global-account/types.js",
137
137
  "require": "./dist/cjs/global-account/types.js"
138
138
  },
139
+ "./global-account/client-manager": {
140
+ "types": "./dist/types/global-account/client-manager.d.ts",
141
+ "import": "./dist/esm/global-account/client-manager.js",
142
+ "require": "./dist/cjs/global-account/client-manager.js"
143
+ },
139
144
  "./global-account/types/*": {
140
145
  "types": "./dist/types/global-account/types/*.d.ts",
141
146
  "import": "./dist/esm/global-account/types/*.js",
@@ -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
- toast.info("Approval confirmed. Proceeding with stake...");
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