@oydual31/more-vaults-sdk 1.1.24 → 1.1.26
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/ethers/index.cjs +177 -6
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +75 -2
- package/dist/ethers/index.d.ts +75 -2
- package/dist/ethers/index.js +165 -7
- package/dist/ethers/index.js.map +1 -1
- package/dist/gasBuffer-BMHxT7CX.d.cts +35 -0
- package/dist/gasBuffer-BMHxT7CX.d.ts +35 -0
- package/dist/react/index.cjs +40 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +40 -4
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +224 -28
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +88 -3
- package/dist/viem/index.d.ts +88 -3
- package/dist/viem/index.js +212 -30
- package/dist/viem/index.js.map +1 -1
- package/package.json +3 -2
- package/src/common/gasBuffer.test.ts +70 -0
- package/src/common/gasBuffer.ts +51 -0
- package/src/ethers/chains.ts +15 -0
- package/src/ethers/crossChainFlows.test.ts +77 -0
- package/src/ethers/crossChainFlows.ts +241 -9
- package/src/ethers/index.ts +16 -1
- package/src/ethers/redeemFlows.ts +2 -1
- package/src/viem/chains.ts +20 -0
- package/src/viem/crossChainFlows.test.ts +96 -0
- package/src/viem/crossChainFlows.ts +258 -20
- package/src/viem/curatorMulticall.ts +28 -0
- package/src/viem/curatorSwaps.ts +1 -1
- package/src/viem/depositFlows.ts +3 -2
- package/src/viem/index.ts +17 -1
- package/src/viem/redeemFlows.ts +12 -8
package/dist/react/index.js
CHANGED
|
@@ -1308,6 +1308,16 @@ var UnsupportedAssetError = class extends MoreVaultsError {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
};
|
|
1310
1310
|
|
|
1311
|
+
// src/common/gasBuffer.ts
|
|
1312
|
+
var DEFAULT_GAS_BUFFER_BPS = 4000n;
|
|
1313
|
+
var BPS_DENOMINATOR = 10000n;
|
|
1314
|
+
var currentDefaultBps = DEFAULT_GAS_BUFFER_BPS;
|
|
1315
|
+
function applyGasBuffer(estimate, bufferBps) {
|
|
1316
|
+
const bps = currentDefaultBps;
|
|
1317
|
+
if (bps < 0n) throw new RangeError(`gas buffer bps must be >= 0, got ${bps}`);
|
|
1318
|
+
return estimate * (BPS_DENOMINATOR + bps) / BPS_DENOMINATOR;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1311
1321
|
// src/viem/utils.ts
|
|
1312
1322
|
async function waitForTx(publicClient, hash, maxRetries = 3) {
|
|
1313
1323
|
const timeouts = [6e4, 12e4, 18e4];
|
|
@@ -2225,7 +2235,7 @@ async function depositAsync(walletClient, publicClient, addresses, assets, recei
|
|
|
2225
2235
|
} catch (err) {
|
|
2226
2236
|
parseContractError(err, vault, account.address);
|
|
2227
2237
|
}
|
|
2228
|
-
const gas = gasEstimate
|
|
2238
|
+
const gas = applyGasBuffer(gasEstimate);
|
|
2229
2239
|
const txHash = await walletClient.writeContract({
|
|
2230
2240
|
address: vault,
|
|
2231
2241
|
abi: BRIDGE_ABI,
|
|
@@ -2306,7 +2316,7 @@ async function redeemAsync(walletClient, publicClient, addresses, shares, receiv
|
|
|
2306
2316
|
} catch (err) {
|
|
2307
2317
|
parseContractError(err, vault, account.address);
|
|
2308
2318
|
}
|
|
2309
|
-
const gas = gasEstimate
|
|
2319
|
+
const gas = applyGasBuffer(gasEstimate);
|
|
2310
2320
|
const txHash = await walletClient.writeContract({
|
|
2311
2321
|
address: vault,
|
|
2312
2322
|
abi: BRIDGE_ABI,
|
|
@@ -2983,13 +2993,26 @@ async function submitActions(walletClient, publicClient, vault, actions) {
|
|
|
2983
2993
|
} catch (err) {
|
|
2984
2994
|
parseContractError(err, v, account.address);
|
|
2985
2995
|
}
|
|
2996
|
+
let gasLimit;
|
|
2997
|
+
try {
|
|
2998
|
+
const estimated = await publicClient.estimateContractGas({
|
|
2999
|
+
address: v,
|
|
3000
|
+
abi: MULTICALL_ABI,
|
|
3001
|
+
functionName: "submitActions",
|
|
3002
|
+
args: [actions],
|
|
3003
|
+
account: account.address
|
|
3004
|
+
});
|
|
3005
|
+
gasLimit = applyGasBuffer(estimated);
|
|
3006
|
+
} catch {
|
|
3007
|
+
}
|
|
2986
3008
|
const txHash = await walletClient.writeContract({
|
|
2987
3009
|
address: v,
|
|
2988
3010
|
abi: MULTICALL_ABI,
|
|
2989
3011
|
functionName: "submitActions",
|
|
2990
3012
|
args: [actions],
|
|
2991
3013
|
account,
|
|
2992
|
-
chain: walletClient.chain
|
|
3014
|
+
chain: walletClient.chain,
|
|
3015
|
+
gas: gasLimit
|
|
2993
3016
|
});
|
|
2994
3017
|
const nextNonce = await publicClient.readContract({
|
|
2995
3018
|
address: v,
|
|
@@ -3013,13 +3036,26 @@ async function executeActions(walletClient, publicClient, vault, nonce) {
|
|
|
3013
3036
|
} catch (err) {
|
|
3014
3037
|
parseContractError(err, v, account.address);
|
|
3015
3038
|
}
|
|
3039
|
+
let gasLimit;
|
|
3040
|
+
try {
|
|
3041
|
+
const estimated = await publicClient.estimateContractGas({
|
|
3042
|
+
address: v,
|
|
3043
|
+
abi: MULTICALL_ABI,
|
|
3044
|
+
functionName: "executeActions",
|
|
3045
|
+
args: [nonce],
|
|
3046
|
+
account: account.address
|
|
3047
|
+
});
|
|
3048
|
+
gasLimit = applyGasBuffer(estimated);
|
|
3049
|
+
} catch {
|
|
3050
|
+
}
|
|
3016
3051
|
const txHash = await walletClient.writeContract({
|
|
3017
3052
|
address: v,
|
|
3018
3053
|
abi: MULTICALL_ABI,
|
|
3019
3054
|
functionName: "executeActions",
|
|
3020
3055
|
args: [nonce],
|
|
3021
3056
|
account,
|
|
3022
|
-
chain: walletClient.chain
|
|
3057
|
+
chain: walletClient.chain,
|
|
3058
|
+
gas: gasLimit
|
|
3023
3059
|
});
|
|
3024
3060
|
return { txHash };
|
|
3025
3061
|
}
|