@glowlabs-org/utils 0.2.140 → 0.2.142
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/browser.d.ts +1 -0
- package/dist/cjs/browser.js +5 -1
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/{farms-router-Darq9ZsF.js → farms-router-CCva--xp.js} +205 -60
- package/dist/cjs/farms-router-CCva--xp.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/types/index.d.ts +2 -1
- package/dist/cjs/utils/transaction-utils.d.ts +23 -0
- package/dist/esm/browser.d.ts +1 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-B5g58fsT.js → farms-router-Cxbn5Hap.js} +202 -61
- package/dist/esm/farms-router-Cxbn5Hap.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/types/index.d.ts +2 -1
- package/dist/esm/utils/transaction-utils.d.ts +23 -0
- package/package.json +1 -1
- package/src/browser.ts +1 -0
- package/src/lib/hooks/use-forwarder.ts +8 -30
- package/src/lib/hooks/use-offchain-fractions.ts +12 -49
- package/src/lib/types/index.ts +2 -1
- package/src/utils/transaction-utils.ts +285 -0
- package/dist/cjs/farms-router-Darq9ZsF.js.map +0 -1
- package/dist/esm/farms-router-B5g58fsT.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var viem = require('viem');
|
|
|
15
15
|
var merkletreejs = require('merkletreejs');
|
|
16
16
|
var ethers = require('ethers');
|
|
17
17
|
var Decimal = require('decimal.js');
|
|
18
|
-
var farmsRouter = require('./farms-router-
|
|
18
|
+
var farmsRouter = require('./farms-router-CCva--xp.js');
|
|
19
19
|
|
|
20
20
|
const GENESIS_TIMESTAMP = 1700352000;
|
|
21
21
|
|
|
@@ -370,6 +370,7 @@ export interface GlwRegionRewardsResponse {
|
|
|
370
370
|
export interface ControlWallet {
|
|
371
371
|
address: string;
|
|
372
372
|
controlBalance: string;
|
|
373
|
+
committedControl: string;
|
|
373
374
|
stakedControl: string;
|
|
374
375
|
createdAt: string;
|
|
375
376
|
}
|
|
@@ -409,11 +410,11 @@ export interface WalletFarmInfo {
|
|
|
409
410
|
export interface WalletDetails {
|
|
410
411
|
wallet: string;
|
|
411
412
|
controlBalance: string;
|
|
413
|
+
committedControl: string;
|
|
412
414
|
stakedControl: string;
|
|
413
415
|
createdAt: string;
|
|
414
416
|
regions: WalletRegionStakeTotal[];
|
|
415
417
|
ownedFarms: WalletFarmInfo[];
|
|
416
|
-
purchasedFarms: WalletFarmInfo[];
|
|
417
418
|
}
|
|
418
419
|
export interface EstimateRewardScoreParams {
|
|
419
420
|
userId: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PublicClient } from "viem";
|
|
2
|
+
import { type Signer } from "ethers";
|
|
3
|
+
export declare function parseViemError(error: unknown): string;
|
|
4
|
+
export declare function parseEthersError(error: unknown): string;
|
|
5
|
+
export interface TransactionRetryOptions {
|
|
6
|
+
maxRetries?: number;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
enableLogging?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Enhanced transaction receipt handler with retry logic for viem
|
|
12
|
+
* @param publicClient The viem public client
|
|
13
|
+
* @param hash The transaction hash
|
|
14
|
+
* @param options Retry configuration options
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitForViemTransactionWithRetry(publicClient: PublicClient, hash: `0x${string}`, options?: TransactionRetryOptions): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Enhanced transaction receipt handler with retry logic for ethers.js
|
|
19
|
+
* @param signer The ethers signer
|
|
20
|
+
* @param txHash The transaction hash
|
|
21
|
+
* @param options Retry configuration options
|
|
22
|
+
*/
|
|
23
|
+
export declare function waitForEthersTransactionWithRetry(signer: Signer, txHash: string, options?: TransactionRetryOptions): Promise<void>;
|
package/dist/esm/browser.d.ts
CHANGED
package/dist/esm/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TRANSFER_TYPES } from './farms-router-
|
|
2
|
-
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions } from './farms-router-
|
|
1
|
+
import { T as TRANSFER_TYPES } from './farms-router-Cxbn5Hap.js';
|
|
2
|
+
export { C as ControlRouter, D as DECIMALS_BY_TOKEN, i as FORWARDER_ABI, F as FarmsRouter, d as ForwarderError, l as GCA_URLS, G as GLOW_WEIGHT_DECIMAL_PRECISION, H as HUB_URL, c as KICKSTARTER_STATUS, K as KickstarterRouter, M as MAX_WEIGHT, j as OFFCHAIN_FRACTIONS_ABI, O as OFF_CHAIN_PAYMENT_CURRENCIES, e as OffchainFractionsError, P as PAYMENT_CURRENCIES, b as REGIONS, R as RegionRouter, S as STAKING_DIRECTIONS, U as USDG_WEIGHT_DECIMAL_PRECISION, W as WalletsRouter, f as allRegions, h as countries, k as getAddresses, m as parseEthersError, p as parseViemError, r as regionMetadata, g as usStates, u as useForwarder, a as useOffchainFractions, n as waitForEthersTransactionWithRetry, w as waitForViemTransactionWithRetry } from './farms-router-Cxbn5Hap.js';
|
|
3
3
|
import { verifyTypedData, checksumAddress } from 'viem';
|
|
4
4
|
import 'ethers';
|
|
5
5
|
|
|
@@ -301,15 +301,27 @@ const DECIMALS_BY_TOKEN = {
|
|
|
301
301
|
GLW: 18,
|
|
302
302
|
};
|
|
303
303
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
304
|
+
// Error parsing utilities
|
|
305
|
+
function parseViemError(error) {
|
|
306
|
+
if (!error)
|
|
307
|
+
return "Unknown error";
|
|
308
|
+
// Check if it's a viem BaseError
|
|
309
|
+
if (error instanceof Error) {
|
|
310
|
+
// For contract revert errors
|
|
311
|
+
if (error.cause?.reason) {
|
|
312
|
+
return error.cause.reason;
|
|
313
|
+
}
|
|
314
|
+
// For viem's shortMessage
|
|
315
|
+
if (error.shortMessage) {
|
|
316
|
+
return error.shortMessage;
|
|
317
|
+
}
|
|
318
|
+
// Fallback to regular message
|
|
319
|
+
if (error.message) {
|
|
320
|
+
return error.message;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return "Unknown error";
|
|
324
|
+
}
|
|
313
325
|
function parseEthersError(error) {
|
|
314
326
|
if (!error)
|
|
315
327
|
return "Unknown error";
|
|
@@ -334,8 +346,174 @@ function parseEthersError(error) {
|
|
|
334
346
|
return possibleError.reason;
|
|
335
347
|
if (possibleError?.message)
|
|
336
348
|
return possibleError.message;
|
|
337
|
-
return
|
|
349
|
+
return "Unknown error";
|
|
350
|
+
}
|
|
351
|
+
const DEFAULT_OPTIONS = {
|
|
352
|
+
maxRetries: 3,
|
|
353
|
+
timeoutMs: 60000,
|
|
354
|
+
enableLogging: true,
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Enhanced transaction receipt handler with retry logic for viem
|
|
358
|
+
* @param publicClient The viem public client
|
|
359
|
+
* @param hash The transaction hash
|
|
360
|
+
* @param options Retry configuration options
|
|
361
|
+
*/
|
|
362
|
+
async function waitForViemTransactionWithRetry(publicClient, hash, options = {}) {
|
|
363
|
+
const { maxRetries, timeoutMs, enableLogging } = {
|
|
364
|
+
...DEFAULT_OPTIONS,
|
|
365
|
+
...options,
|
|
366
|
+
};
|
|
367
|
+
let lastError = null;
|
|
368
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
369
|
+
try {
|
|
370
|
+
// Wait for transaction receipt with timeout
|
|
371
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
372
|
+
hash,
|
|
373
|
+
timeout: timeoutMs,
|
|
374
|
+
});
|
|
375
|
+
// Check transaction status
|
|
376
|
+
if (receipt.status === "reverted") {
|
|
377
|
+
throw new Error(`Transaction ${hash} was reverted on-chain`);
|
|
378
|
+
}
|
|
379
|
+
if (enableLogging) {
|
|
380
|
+
console.log(`Transaction ${hash} confirmed successfully in block ${receipt.blockNumber}`);
|
|
381
|
+
}
|
|
382
|
+
return; // Success, exit the function
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
lastError = error;
|
|
386
|
+
// Check if it's a timeout or not found error
|
|
387
|
+
const errorMessage = parseViemError(error);
|
|
388
|
+
const isRetryableError = errorMessage.includes("could not be found") ||
|
|
389
|
+
errorMessage.includes("timeout") ||
|
|
390
|
+
errorMessage.includes("timed out") ||
|
|
391
|
+
errorMessage.includes("receipt") ||
|
|
392
|
+
errorMessage.includes("not be processed");
|
|
393
|
+
if (!isRetryableError || attempt === maxRetries) {
|
|
394
|
+
// If it's not a retryable error or we've exhausted retries, throw
|
|
395
|
+
throw new Error(`Transaction failed after ${attempt} attempts: ${errorMessage}`);
|
|
396
|
+
}
|
|
397
|
+
// Wait before retrying (exponential backoff)
|
|
398
|
+
const delay = Math.min(2000 * Math.pow(2, attempt - 1), 10000);
|
|
399
|
+
if (enableLogging) {
|
|
400
|
+
console.warn(`Transaction receipt not found (attempt ${attempt}/${maxRetries}), retrying in ${delay}ms...`);
|
|
401
|
+
}
|
|
402
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
403
|
+
// Check transaction status before retrying
|
|
404
|
+
try {
|
|
405
|
+
const transaction = await publicClient.getTransaction({ hash });
|
|
406
|
+
if (!transaction) {
|
|
407
|
+
throw new Error("Transaction not found in mempool or blockchain");
|
|
408
|
+
}
|
|
409
|
+
if (enableLogging) {
|
|
410
|
+
console.log(`Transaction ${hash} found in ${transaction.blockNumber ? "block" : "mempool"}, waiting for confirmation...`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
catch (txError) {
|
|
414
|
+
if (enableLogging) {
|
|
415
|
+
console.warn(`Could not fetch transaction ${hash}: ${parseViemError(txError)}`);
|
|
416
|
+
}
|
|
417
|
+
// Continue with retry anyway in case it's just an RPC issue
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// This should never be reached, but just in case
|
|
422
|
+
throw new Error(`Transaction failed after ${maxRetries} attempts: ${parseViemError(lastError)}`);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Enhanced transaction receipt handler with retry logic for ethers.js
|
|
426
|
+
* @param signer The ethers signer
|
|
427
|
+
* @param txHash The transaction hash
|
|
428
|
+
* @param options Retry configuration options
|
|
429
|
+
*/
|
|
430
|
+
async function waitForEthersTransactionWithRetry(signer, txHash, options = {}) {
|
|
431
|
+
const { maxRetries, timeoutMs, enableLogging } = {
|
|
432
|
+
...DEFAULT_OPTIONS,
|
|
433
|
+
...options,
|
|
434
|
+
};
|
|
435
|
+
let lastError = null;
|
|
436
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
437
|
+
try {
|
|
438
|
+
// Wait for transaction receipt with timeout
|
|
439
|
+
const provider = signer.provider;
|
|
440
|
+
if (!provider) {
|
|
441
|
+
throw new Error("Provider not available");
|
|
442
|
+
}
|
|
443
|
+
// Create a timeout promise
|
|
444
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
445
|
+
setTimeout(() => reject(new Error("Transaction receipt timeout")), timeoutMs);
|
|
446
|
+
});
|
|
447
|
+
// Race between waiting for receipt and timeout
|
|
448
|
+
const receipt = await Promise.race([
|
|
449
|
+
provider.waitForTransaction(txHash, 1, timeoutMs),
|
|
450
|
+
timeoutPromise,
|
|
451
|
+
]);
|
|
452
|
+
if (!receipt) {
|
|
453
|
+
throw new Error("Transaction receipt not found");
|
|
454
|
+
}
|
|
455
|
+
// Check transaction status (ethers.js uses status: 0 for failed, 1 for success)
|
|
456
|
+
if (receipt.status === 0) {
|
|
457
|
+
throw new Error(`Transaction ${txHash} was reverted on-chain`);
|
|
458
|
+
}
|
|
459
|
+
if (enableLogging) {
|
|
460
|
+
console.log(`Transaction ${txHash} confirmed successfully in block ${receipt.blockNumber}`);
|
|
461
|
+
}
|
|
462
|
+
return; // Success, exit the function
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
lastError = error;
|
|
466
|
+
// Check if it's a timeout or not found error
|
|
467
|
+
const errorMessage = parseEthersError(error);
|
|
468
|
+
const isRetryableError = errorMessage.includes("could not be found") ||
|
|
469
|
+
errorMessage.includes("timeout") ||
|
|
470
|
+
errorMessage.includes("timed out") ||
|
|
471
|
+
errorMessage.includes("receipt") ||
|
|
472
|
+
errorMessage.includes("not be processed") ||
|
|
473
|
+
errorMessage.includes("Transaction receipt timeout");
|
|
474
|
+
if (!isRetryableError || attempt === maxRetries) {
|
|
475
|
+
// If it's not a retryable error or we've exhausted retries, throw
|
|
476
|
+
throw new Error(`Transaction failed after ${attempt} attempts: ${errorMessage}`);
|
|
477
|
+
}
|
|
478
|
+
// Wait before retrying (exponential backoff)
|
|
479
|
+
const delay = Math.min(2000 * Math.pow(2, attempt - 1), 10000);
|
|
480
|
+
if (enableLogging) {
|
|
481
|
+
console.warn(`Transaction receipt not found (attempt ${attempt}/${maxRetries}), retrying in ${delay}ms...`);
|
|
482
|
+
}
|
|
483
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
484
|
+
// Check transaction status before retrying
|
|
485
|
+
try {
|
|
486
|
+
const provider = signer.provider;
|
|
487
|
+
if (provider) {
|
|
488
|
+
const transaction = await provider.getTransaction(txHash);
|
|
489
|
+
if (!transaction) {
|
|
490
|
+
throw new Error("Transaction not found in mempool or blockchain");
|
|
491
|
+
}
|
|
492
|
+
if (enableLogging) {
|
|
493
|
+
console.log(`Transaction ${txHash} found in ${transaction.blockNumber ? "block" : "mempool"}, waiting for confirmation...`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
catch (txError) {
|
|
498
|
+
if (enableLogging) {
|
|
499
|
+
console.warn(`Could not fetch transaction ${txHash}: ${parseEthersError(txError)}`);
|
|
500
|
+
}
|
|
501
|
+
// Continue with retry anyway in case it's just an RPC issue
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
// This should never be reached, but just in case
|
|
506
|
+
throw new Error(`Transaction failed after ${maxRetries} attempts: ${parseEthersError(lastError)}`);
|
|
338
507
|
}
|
|
508
|
+
|
|
509
|
+
var ForwarderError;
|
|
510
|
+
(function (ForwarderError) {
|
|
511
|
+
ForwarderError["CONTRACT_NOT_AVAILABLE"] = "Contract not available";
|
|
512
|
+
ForwarderError["SIGNER_NOT_AVAILABLE"] = "Signer not available";
|
|
513
|
+
ForwarderError["UNKNOWN_ERROR"] = "Unknown error";
|
|
514
|
+
ForwarderError["INVALID_FORWARD_TYPE"] = "Invalid forward type";
|
|
515
|
+
ForwarderError["MISSING_REQUIRED_PARAMS"] = "Missing required parameters";
|
|
516
|
+
})(ForwarderError || (ForwarderError = {}));
|
|
339
517
|
// Type-guard style helper to ensure a signer exists throughout the rest of the function.
|
|
340
518
|
function assertSigner(maybeSigner) {
|
|
341
519
|
if (!maybeSigner) {
|
|
@@ -481,7 +659,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
481
659
|
setIsProcessing(true);
|
|
482
660
|
// Approve only the specific amount needed
|
|
483
661
|
const approveTx = await tokenContract.approve(ADDRESSES.FORWARDER, amount);
|
|
484
|
-
await approveTx.
|
|
662
|
+
await waitForEthersTransactionWithRetry(signer, approveTx.hash);
|
|
485
663
|
return true;
|
|
486
664
|
}
|
|
487
665
|
catch (error) {
|
|
@@ -525,7 +703,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
525
703
|
if (allowance < amount) {
|
|
526
704
|
try {
|
|
527
705
|
const approveTx = await tokenContract.approve(ADDRESSES.FORWARDER, MaxUint256);
|
|
528
|
-
await approveTx.
|
|
706
|
+
await waitForEthersTransactionWithRetry(signer, approveTx.hash);
|
|
529
707
|
}
|
|
530
708
|
catch (approveError) {
|
|
531
709
|
throw new Error(parseEthersError(approveError) || "Token approval failed");
|
|
@@ -578,7 +756,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
578
756
|
? ADDRESSES.AUDIT_FEE_WALLET
|
|
579
757
|
: ADDRESSES.FOUNDATION_WALLET, amount, sendToCounterfactualWallet, message);
|
|
580
758
|
}
|
|
581
|
-
await tx.
|
|
759
|
+
await waitForEthersTransactionWithRetry(signer, tx.hash);
|
|
582
760
|
return tx.hash;
|
|
583
761
|
}
|
|
584
762
|
catch (txError) {
|
|
@@ -801,7 +979,7 @@ function useForwarder(signer, CHAIN_ID) {
|
|
|
801
979
|
setIsProcessing(true);
|
|
802
980
|
// Try to call mint function (common for test tokens)
|
|
803
981
|
const tx = await usdcContract.mint(recipient, amount);
|
|
804
|
-
await tx.
|
|
982
|
+
await waitForEthersTransactionWithRetry(signer, tx.hash);
|
|
805
983
|
return tx.hash;
|
|
806
984
|
}
|
|
807
985
|
catch (error) {
|
|
@@ -1318,27 +1496,6 @@ var OffchainFractionsError;
|
|
|
1318
1496
|
OffchainFractionsError["INSUFFICIENT_BALANCE"] = "Insufficient balance";
|
|
1319
1497
|
OffchainFractionsError["INSUFFICIENT_ALLOWANCE"] = "Insufficient allowance";
|
|
1320
1498
|
})(OffchainFractionsError || (OffchainFractionsError = {}));
|
|
1321
|
-
// Utility to extract the most useful revert reason from a viem error object
|
|
1322
|
-
function parseViemError(error) {
|
|
1323
|
-
if (!error)
|
|
1324
|
-
return "Unknown error";
|
|
1325
|
-
// Check if it's a viem BaseError
|
|
1326
|
-
if (error instanceof Error) {
|
|
1327
|
-
// For contract revert errors
|
|
1328
|
-
if (error.cause?.reason) {
|
|
1329
|
-
return error.cause.reason;
|
|
1330
|
-
}
|
|
1331
|
-
// For viem's shortMessage
|
|
1332
|
-
if (error.shortMessage) {
|
|
1333
|
-
return error.shortMessage;
|
|
1334
|
-
}
|
|
1335
|
-
// Fallback to regular message
|
|
1336
|
-
if (error.message) {
|
|
1337
|
-
return error.message;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
return OffchainFractionsError.UNKNOWN_ERROR;
|
|
1341
|
-
}
|
|
1342
1499
|
// Type-guard style helper to ensure a wallet client exists throughout the rest of the function.
|
|
1343
1500
|
function assertWalletClient(maybeWalletClient) {
|
|
1344
1501
|
if (!maybeWalletClient) {
|
|
@@ -1420,9 +1577,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1420
1577
|
chain: walletClient.chain,
|
|
1421
1578
|
account: walletClient.account,
|
|
1422
1579
|
});
|
|
1423
|
-
await publicClient
|
|
1424
|
-
hash,
|
|
1425
|
-
});
|
|
1580
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1426
1581
|
return true;
|
|
1427
1582
|
}
|
|
1428
1583
|
catch (error) {
|
|
@@ -1494,9 +1649,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1494
1649
|
chain: walletClient.chain,
|
|
1495
1650
|
account: walletClient.account,
|
|
1496
1651
|
});
|
|
1497
|
-
await publicClient
|
|
1498
|
-
hash,
|
|
1499
|
-
});
|
|
1652
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1500
1653
|
return hash;
|
|
1501
1654
|
}
|
|
1502
1655
|
catch (error) {
|
|
@@ -1549,9 +1702,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1549
1702
|
chain: walletClient.chain,
|
|
1550
1703
|
account: walletClient.account,
|
|
1551
1704
|
});
|
|
1552
|
-
await publicClient
|
|
1553
|
-
hash: approveHash,
|
|
1554
|
-
});
|
|
1705
|
+
await waitForViemTransactionWithRetry(publicClient, approveHash);
|
|
1555
1706
|
}
|
|
1556
1707
|
// Run a simulation first to surface any revert reason
|
|
1557
1708
|
try {
|
|
@@ -1591,9 +1742,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1591
1742
|
chain: walletClient.chain,
|
|
1592
1743
|
account: walletClient.account,
|
|
1593
1744
|
});
|
|
1594
|
-
await publicClient
|
|
1595
|
-
hash,
|
|
1596
|
-
});
|
|
1745
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1597
1746
|
return hash;
|
|
1598
1747
|
}
|
|
1599
1748
|
catch (error) {
|
|
@@ -1671,9 +1820,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1671
1820
|
chain: walletClient.chain,
|
|
1672
1821
|
account: walletClient.account,
|
|
1673
1822
|
});
|
|
1674
|
-
await publicClient
|
|
1675
|
-
hash,
|
|
1676
|
-
});
|
|
1823
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1677
1824
|
return hash;
|
|
1678
1825
|
}
|
|
1679
1826
|
catch (error) {
|
|
@@ -1723,9 +1870,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1723
1870
|
chain: walletClient.chain,
|
|
1724
1871
|
account: walletClient.account,
|
|
1725
1872
|
});
|
|
1726
|
-
await publicClient
|
|
1727
|
-
hash,
|
|
1728
|
-
});
|
|
1873
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1729
1874
|
return hash;
|
|
1730
1875
|
}
|
|
1731
1876
|
catch (error) {
|
|
@@ -1891,9 +2036,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1891
2036
|
chain: walletClient.chain,
|
|
1892
2037
|
account: walletClient.account,
|
|
1893
2038
|
});
|
|
1894
|
-
await publicClient
|
|
1895
|
-
hash,
|
|
1896
|
-
});
|
|
2039
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1897
2040
|
return hash;
|
|
1898
2041
|
}
|
|
1899
2042
|
catch (error) {
|
|
@@ -1943,9 +2086,7 @@ function useOffchainFractions(walletClient, publicClient, CHAIN_ID) {
|
|
|
1943
2086
|
chain: walletClient.chain,
|
|
1944
2087
|
account: walletClient.account,
|
|
1945
2088
|
});
|
|
1946
|
-
await publicClient
|
|
1947
|
-
hash,
|
|
1948
|
-
});
|
|
2089
|
+
await waitForViemTransactionWithRetry(publicClient, hash);
|
|
1949
2090
|
return hash;
|
|
1950
2091
|
}
|
|
1951
2092
|
catch (error) {
|
|
@@ -3694,5 +3835,5 @@ function FarmsRouter(baseUrl) {
|
|
|
3694
3835
|
};
|
|
3695
3836
|
}
|
|
3696
3837
|
|
|
3697
|
-
export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, STAKING_DIRECTIONS as S, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, useOffchainFractions as a, REGIONS as b, KICKSTARTER_STATUS as c, ForwarderError as d, OffchainFractionsError as e, allRegions as f, usStates as g, countries as h, FORWARDER_ABI as i, OFFCHAIN_FRACTIONS_ABI as j, getAddresses as k, GCA_URLS as l, regionMetadata as r, useForwarder as u };
|
|
3698
|
-
//# sourceMappingURL=farms-router-
|
|
3838
|
+
export { ControlRouter as C, DECIMALS_BY_TOKEN as D, FarmsRouter as F, GLOW_WEIGHT_DECIMAL_PRECISION as G, HUB_URL as H, KickstarterRouter as K, MAX_WEIGHT as M, OFF_CHAIN_PAYMENT_CURRENCIES as O, PAYMENT_CURRENCIES as P, RegionRouter as R, STAKING_DIRECTIONS as S, TRANSFER_TYPES as T, USDG_WEIGHT_DECIMAL_PRECISION as U, WalletsRouter as W, useOffchainFractions as a, REGIONS as b, KICKSTARTER_STATUS as c, ForwarderError as d, OffchainFractionsError as e, allRegions as f, usStates as g, countries as h, FORWARDER_ABI as i, OFFCHAIN_FRACTIONS_ABI as j, getAddresses as k, GCA_URLS as l, parseEthersError as m, waitForEthersTransactionWithRetry as n, parseViemError as p, regionMetadata as r, useForwarder as u, waitForViemTransactionWithRetry as w };
|
|
3839
|
+
//# sourceMappingURL=farms-router-Cxbn5Hap.js.map
|