@unlink-xyz/react 0.1.3-canary.b98d1f5 → 0.1.3-canary.c61b790
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/index.js +9 -31
- package/dist/index.js.map +1 -1
- package/dist/multisig/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -55778,11 +55778,6 @@ function normalizeCall2(call, index) {
|
|
|
55778
55778
|
}
|
|
55779
55779
|
function normalizeSpendInput(input, index) {
|
|
55780
55780
|
const token = ensureAddress(`spend[${index}].token`, input.token);
|
|
55781
|
-
if (token.toLowerCase() === ETH_TOKEN.toLowerCase()) {
|
|
55782
|
-
throw new AdapterError(
|
|
55783
|
-
`spend[${index}].token: native ETH is not supported in adapter execution`
|
|
55784
|
-
);
|
|
55785
|
-
}
|
|
55786
55781
|
if (input.amount <= 0n) {
|
|
55787
55782
|
throw new AdapterError(`spend[${index}].amount must be greater than zero`);
|
|
55788
55783
|
}
|
|
@@ -55793,11 +55788,6 @@ function normalizeSpendInput(input, index) {
|
|
|
55793
55788
|
}
|
|
55794
55789
|
function normalizeReceiveInput(receive, index) {
|
|
55795
55790
|
const token = ensureAddress(`receive[${index}].token`, receive.token);
|
|
55796
|
-
if (token.toLowerCase() === ETH_TOKEN.toLowerCase()) {
|
|
55797
|
-
throw new AdapterError(
|
|
55798
|
-
`receive[${index}].token: native ETH is not supported in adapter execution`
|
|
55799
|
-
);
|
|
55800
|
-
}
|
|
55801
55791
|
if (receive.minAmount < 0n) {
|
|
55802
55792
|
throw new AdapterError(`receive[${index}].minAmount must be non-negative`);
|
|
55803
55793
|
}
|
|
@@ -55999,9 +55989,6 @@ init_process();
|
|
|
55999
55989
|
init_buffer();
|
|
56000
55990
|
var BIP44_ETH_PREFIX = "m/44'/60'/0'/0";
|
|
56001
55991
|
var ERC20_BALANCE_OF = "function balanceOf(address) view returns (uint256)";
|
|
56002
|
-
function isNativeToken(token) {
|
|
56003
|
-
return token.toLowerCase() === ETH_TOKEN.toLowerCase();
|
|
56004
|
-
}
|
|
56005
55992
|
function createBurnerService(deps) {
|
|
56006
55993
|
const { chainRpcUrl, getMasterSeed, withdrawToAddress, requestDeposit } = deps;
|
|
56007
55994
|
const provider = new JsonRpcProvider(chainRpcUrl);
|
|
@@ -56069,12 +56056,6 @@ function createBurnerService(deps) {
|
|
|
56069
56056
|
}
|
|
56070
56057
|
async function sweepToPool(index, params) {
|
|
56071
56058
|
const { address } = await addressOf(index);
|
|
56072
|
-
const native = isNativeToken(params.token);
|
|
56073
|
-
if (native && params.amount == null) {
|
|
56074
|
-
throw new Error(
|
|
56075
|
-
"amount is required for native ETH sweeps (needed to reserve gas)"
|
|
56076
|
-
);
|
|
56077
|
-
}
|
|
56078
56059
|
const amount = params.amount ?? await getTokenBalance(address, params.token);
|
|
56079
56060
|
if (amount === 0n) {
|
|
56080
56061
|
throw new Error("No token balance to sweep");
|
|
@@ -56085,20 +56066,17 @@ function createBurnerService(deps) {
|
|
|
56085
56066
|
depositor: address,
|
|
56086
56067
|
deposits: [{ token: params.token, amount }]
|
|
56087
56068
|
});
|
|
56088
|
-
|
|
56089
|
-
|
|
56090
|
-
|
|
56091
|
-
|
|
56092
|
-
|
|
56093
|
-
|
|
56094
|
-
|
|
56095
|
-
|
|
56096
|
-
await send(index, { to: params.token, data: approveData });
|
|
56097
|
-
}
|
|
56069
|
+
const erc20Iface = new Interface([
|
|
56070
|
+
"function approve(address spender, uint256 amount)"
|
|
56071
|
+
]);
|
|
56072
|
+
const approveData = erc20Iface.encodeFunctionData("approve", [
|
|
56073
|
+
params.poolAddress,
|
|
56074
|
+
amount
|
|
56075
|
+
]);
|
|
56076
|
+
await send(index, { to: params.token, data: approveData });
|
|
56098
56077
|
const { txHash } = await send(index, {
|
|
56099
56078
|
to: depositResult.to,
|
|
56100
|
-
data: depositResult.calldata
|
|
56101
|
-
value: depositResult.value
|
|
56079
|
+
data: depositResult.calldata
|
|
56102
56080
|
});
|
|
56103
56081
|
return { txHash };
|
|
56104
56082
|
}
|