@1llet.xyz/erc4337-gasless-sdk 0.4.39 → 0.4.40
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 +40 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { gnosis, optimism, baseSepolia, base, avalanche, worldchain, monad, poly
|
|
|
4
4
|
import { createPublicClient, http, createWalletClient, decodeErrorResult, maxUint256, encodeFunctionData, encodeAbiParameters, keccak256, padHex } from 'viem';
|
|
5
5
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
6
6
|
import axios from 'axios';
|
|
7
|
-
import { OpenAPI,
|
|
7
|
+
import { OpenAPI, OneClickService, QuoteRequest } from '@defuse-protocol/one-click-sdk-typescript';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
10
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -2158,6 +2158,31 @@ var NearStrategy = class {
|
|
|
2158
2158
|
const stellarService = new StellarService2();
|
|
2159
2159
|
const tx = await stellarService.server.transactions().transaction(depositTxHash).call();
|
|
2160
2160
|
if (tx.successful) {
|
|
2161
|
+
const operations = await stellarService.server.operations().forTransaction(depositTxHash).call();
|
|
2162
|
+
const paymentOp = operations.records.find((op) => op.type === "payment" || op.type === "path_payment_strict_send" || op.type === "path_payment_strict_receive");
|
|
2163
|
+
let depositAddress = "";
|
|
2164
|
+
let memo = "";
|
|
2165
|
+
if (paymentOp) {
|
|
2166
|
+
depositAddress = paymentOp.to || paymentOp.funder || "";
|
|
2167
|
+
}
|
|
2168
|
+
if (tx.memo_type === "text" || tx.memo_type === "id") {
|
|
2169
|
+
memo = tx.memo || "";
|
|
2170
|
+
}
|
|
2171
|
+
if (depositAddress) {
|
|
2172
|
+
console.log(`[NearStrategy] Submitting deposit to 1-Click: ${depositTxHash} -> ${depositAddress} (Memo: ${memo})`);
|
|
2173
|
+
try {
|
|
2174
|
+
await OneClickService.submitDepositTx({
|
|
2175
|
+
txHash: depositTxHash,
|
|
2176
|
+
depositAddress,
|
|
2177
|
+
memo: memo || void 0
|
|
2178
|
+
});
|
|
2179
|
+
console.log("[NearStrategy] Deposit submitted successfully.");
|
|
2180
|
+
} catch (e) {
|
|
2181
|
+
console.error("[NearStrategy] Failed to submit deposit to 1-Click:", e.message);
|
|
2182
|
+
}
|
|
2183
|
+
} else {
|
|
2184
|
+
console.error("[NearStrategy] Could not determine deposit address from Stellar operations.");
|
|
2185
|
+
}
|
|
2161
2186
|
return {
|
|
2162
2187
|
success: true,
|
|
2163
2188
|
transactionHash: depositTxHash,
|
|
@@ -2187,6 +2212,20 @@ var NearStrategy = class {
|
|
|
2187
2212
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: depositTxHash });
|
|
2188
2213
|
console.log(`[NearStrategy] Receipt found. Status: ${receipt.status}`);
|
|
2189
2214
|
if (receipt.status === "success") {
|
|
2215
|
+
const tx = await publicClient.getTransaction({ hash: depositTxHash });
|
|
2216
|
+
const depositAddress = tx.to;
|
|
2217
|
+
if (depositAddress) {
|
|
2218
|
+
console.log(`[NearStrategy] Submitting deposit to 1-Click: ${depositTxHash} -> ${depositAddress}`);
|
|
2219
|
+
try {
|
|
2220
|
+
await OneClickService.submitDepositTx({
|
|
2221
|
+
txHash: depositTxHash,
|
|
2222
|
+
depositAddress
|
|
2223
|
+
});
|
|
2224
|
+
console.log("[NearStrategy] Deposit submitted successfully.");
|
|
2225
|
+
} catch (e) {
|
|
2226
|
+
console.error("[NearStrategy] Failed to submit deposit to 1-Click:", e.message);
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2190
2229
|
return {
|
|
2191
2230
|
success: true,
|
|
2192
2231
|
transactionHash: depositTxHash,
|
|
@@ -2277,7 +2316,7 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
|
|
|
2277
2316
|
refundType: QuoteRequest.refundType.ORIGIN_CHAIN,
|
|
2278
2317
|
recipient,
|
|
2279
2318
|
recipientType: QuoteRequest.recipientType.DESTINATION_CHAIN,
|
|
2280
|
-
deadline: new Date(Date.now() +
|
|
2319
|
+
deadline: new Date(Date.now() + 3 * 60 * 1e3).toISOString(),
|
|
2281
2320
|
referral: "1llet",
|
|
2282
2321
|
quoteWaitingTimeMs: 1e4
|
|
2283
2322
|
};
|