@1llet.xyz/erc4337-gasless-sdk 0.4.37 → 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.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +43 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -6
- 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;
|
|
@@ -1263,7 +1263,6 @@ function mapToSDKConfig(data) {
|
|
|
1263
1263
|
symbol: a.name,
|
|
1264
1264
|
decimals: a.decimals,
|
|
1265
1265
|
address: a.address
|
|
1266
|
-
// Valid address string
|
|
1267
1266
|
}))
|
|
1268
1267
|
};
|
|
1269
1268
|
}
|
|
@@ -1286,13 +1285,13 @@ var BASE_MAINNET = mapToSDKConfig(BASE);
|
|
|
1286
1285
|
var OPTIMISM_MAINNET = mapToSDKConfig(OPTIMISM);
|
|
1287
1286
|
var GNOSIS_MAINNET = mapToSDKConfig(GNOSIS);
|
|
1288
1287
|
var BASE_SEPOLIA2 = mapToSDKConfig(BASE_SEPOLIA);
|
|
1289
|
-
var
|
|
1288
|
+
var STELLAR_MAINNET = mapToSDKConfig(STELLAR);
|
|
1290
1289
|
var CHAIN_CONFIGS = {
|
|
1291
1290
|
[base.id]: BASE_MAINNET,
|
|
1292
1291
|
[baseSepolia.id]: BASE_SEPOLIA2,
|
|
1293
1292
|
[gnosis.id]: GNOSIS_MAINNET,
|
|
1294
1293
|
[optimism.id]: OPTIMISM_MAINNET,
|
|
1295
|
-
9e3:
|
|
1294
|
+
9e3: STELLAR_MAINNET
|
|
1296
1295
|
};
|
|
1297
1296
|
|
|
1298
1297
|
// src/constants/chains.ts
|
|
@@ -2159,6 +2158,31 @@ var NearStrategy = class {
|
|
|
2159
2158
|
const stellarService = new StellarService2();
|
|
2160
2159
|
const tx = await stellarService.server.transactions().transaction(depositTxHash).call();
|
|
2161
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
|
+
}
|
|
2162
2186
|
return {
|
|
2163
2187
|
success: true,
|
|
2164
2188
|
transactionHash: depositTxHash,
|
|
@@ -2188,6 +2212,20 @@ var NearStrategy = class {
|
|
|
2188
2212
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: depositTxHash });
|
|
2189
2213
|
console.log(`[NearStrategy] Receipt found. Status: ${receipt.status}`);
|
|
2190
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
|
+
}
|
|
2191
2229
|
return {
|
|
2192
2230
|
success: true,
|
|
2193
2231
|
transactionHash: depositTxHash,
|
|
@@ -2278,7 +2316,7 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
|
|
|
2278
2316
|
refundType: QuoteRequest.refundType.ORIGIN_CHAIN,
|
|
2279
2317
|
recipient,
|
|
2280
2318
|
recipientType: QuoteRequest.recipientType.DESTINATION_CHAIN,
|
|
2281
|
-
deadline: new Date(Date.now() +
|
|
2319
|
+
deadline: new Date(Date.now() + 3 * 60 * 1e3).toISOString(),
|
|
2282
2320
|
referral: "1llet",
|
|
2283
2321
|
quoteWaitingTimeMs: 1e4
|
|
2284
2322
|
};
|
|
@@ -2334,6 +2372,6 @@ var TransferManager = class {
|
|
|
2334
2372
|
}
|
|
2335
2373
|
};
|
|
2336
2374
|
|
|
2337
|
-
export { AccountAbstraction, BASE_MAINNET, BASE_SEPOLIA2 as BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, GNOSIS_MAINNET, NearStrategy, OPTIMISM_MAINNET, STELLAR, StellarService, TransferManager, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
2375
|
+
export { AccountAbstraction, BASE_MAINNET, BASE_SEPOLIA2 as BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, GNOSIS_MAINNET, NearStrategy, OPTIMISM_MAINNET, STELLAR, STELLAR_MAINNET, StellarService, TransferManager, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
2338
2376
|
//# sourceMappingURL=index.mjs.map
|
|
2339
2377
|
//# sourceMappingURL=index.mjs.map
|