@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.d.mts
CHANGED
|
@@ -6,6 +6,9 @@ import z from 'zod';
|
|
|
6
6
|
interface Token {
|
|
7
7
|
symbol: string;
|
|
8
8
|
decimals: number;
|
|
9
|
+
address: string;
|
|
10
|
+
}
|
|
11
|
+
interface EvmToken extends Token {
|
|
9
12
|
address: Address;
|
|
10
13
|
}
|
|
11
14
|
interface EvmChainConfig {
|
|
@@ -15,7 +18,7 @@ interface EvmChainConfig {
|
|
|
15
18
|
entryPointAddress?: Address;
|
|
16
19
|
factoryAddress?: Address;
|
|
17
20
|
paymasterAddress?: Address;
|
|
18
|
-
tokens:
|
|
21
|
+
tokens: EvmToken[];
|
|
19
22
|
}
|
|
20
23
|
interface NonEvmChainConfig {
|
|
21
24
|
chain: {
|
|
@@ -174,6 +177,7 @@ declare const BASE_MAINNET: ChainConfig$1;
|
|
|
174
177
|
declare const OPTIMISM_MAINNET: ChainConfig$1;
|
|
175
178
|
declare const GNOSIS_MAINNET: ChainConfig$1;
|
|
176
179
|
declare const BASE_SEPOLIA: ChainConfig$1;
|
|
180
|
+
declare const STELLAR_MAINNET: ChainConfig$1;
|
|
177
181
|
declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
|
|
178
182
|
|
|
179
183
|
declare const entryPointAbi: readonly [{
|
|
@@ -462,4 +466,4 @@ declare class CCTPStrategy implements BridgeStrategy {
|
|
|
462
466
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
463
467
|
}
|
|
464
468
|
|
|
465
|
-
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
469
|
+
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, STELLAR_MAINNET, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ import z from 'zod';
|
|
|
6
6
|
interface Token {
|
|
7
7
|
symbol: string;
|
|
8
8
|
decimals: number;
|
|
9
|
+
address: string;
|
|
10
|
+
}
|
|
11
|
+
interface EvmToken extends Token {
|
|
9
12
|
address: Address;
|
|
10
13
|
}
|
|
11
14
|
interface EvmChainConfig {
|
|
@@ -15,7 +18,7 @@ interface EvmChainConfig {
|
|
|
15
18
|
entryPointAddress?: Address;
|
|
16
19
|
factoryAddress?: Address;
|
|
17
20
|
paymasterAddress?: Address;
|
|
18
|
-
tokens:
|
|
21
|
+
tokens: EvmToken[];
|
|
19
22
|
}
|
|
20
23
|
interface NonEvmChainConfig {
|
|
21
24
|
chain: {
|
|
@@ -174,6 +177,7 @@ declare const BASE_MAINNET: ChainConfig$1;
|
|
|
174
177
|
declare const OPTIMISM_MAINNET: ChainConfig$1;
|
|
175
178
|
declare const GNOSIS_MAINNET: ChainConfig$1;
|
|
176
179
|
declare const BASE_SEPOLIA: ChainConfig$1;
|
|
180
|
+
declare const STELLAR_MAINNET: ChainConfig$1;
|
|
177
181
|
declare const CHAIN_CONFIGS: Record<number, ChainConfig$1>;
|
|
178
182
|
|
|
179
183
|
declare const entryPointAbi: readonly [{
|
|
@@ -462,4 +466,4 @@ declare class CCTPStrategy implements BridgeStrategy {
|
|
|
462
466
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
463
467
|
}
|
|
464
468
|
|
|
465
|
-
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
469
|
+
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig$1 as ChainConfig, GNOSIS_MAINNET, type GasEstimate, NearStrategy, OPTIMISM_MAINNET, STELLAR, STELLAR_MAINNET, StellarService, type Token, TransferManager, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
package/dist/index.js
CHANGED
|
@@ -1287,7 +1287,6 @@ function mapToSDKConfig(data) {
|
|
|
1287
1287
|
symbol: a.name,
|
|
1288
1288
|
decimals: a.decimals,
|
|
1289
1289
|
address: a.address
|
|
1290
|
-
// Valid address string
|
|
1291
1290
|
}))
|
|
1292
1291
|
};
|
|
1293
1292
|
}
|
|
@@ -1310,13 +1309,13 @@ var BASE_MAINNET = mapToSDKConfig(BASE);
|
|
|
1310
1309
|
var OPTIMISM_MAINNET = mapToSDKConfig(OPTIMISM);
|
|
1311
1310
|
var GNOSIS_MAINNET = mapToSDKConfig(GNOSIS);
|
|
1312
1311
|
var BASE_SEPOLIA2 = mapToSDKConfig(BASE_SEPOLIA);
|
|
1313
|
-
var
|
|
1312
|
+
var STELLAR_MAINNET = mapToSDKConfig(exports.STELLAR);
|
|
1314
1313
|
var CHAIN_CONFIGS = {
|
|
1315
1314
|
[chains.base.id]: BASE_MAINNET,
|
|
1316
1315
|
[chains.baseSepolia.id]: BASE_SEPOLIA2,
|
|
1317
1316
|
[chains.gnosis.id]: GNOSIS_MAINNET,
|
|
1318
1317
|
[chains.optimism.id]: OPTIMISM_MAINNET,
|
|
1319
|
-
9e3:
|
|
1318
|
+
9e3: STELLAR_MAINNET
|
|
1320
1319
|
};
|
|
1321
1320
|
|
|
1322
1321
|
// src/constants/chains.ts
|
|
@@ -2183,6 +2182,31 @@ var NearStrategy = class {
|
|
|
2183
2182
|
const stellarService = new StellarService2();
|
|
2184
2183
|
const tx = await stellarService.server.transactions().transaction(depositTxHash).call();
|
|
2185
2184
|
if (tx.successful) {
|
|
2185
|
+
const operations = await stellarService.server.operations().forTransaction(depositTxHash).call();
|
|
2186
|
+
const paymentOp = operations.records.find((op) => op.type === "payment" || op.type === "path_payment_strict_send" || op.type === "path_payment_strict_receive");
|
|
2187
|
+
let depositAddress = "";
|
|
2188
|
+
let memo = "";
|
|
2189
|
+
if (paymentOp) {
|
|
2190
|
+
depositAddress = paymentOp.to || paymentOp.funder || "";
|
|
2191
|
+
}
|
|
2192
|
+
if (tx.memo_type === "text" || tx.memo_type === "id") {
|
|
2193
|
+
memo = tx.memo || "";
|
|
2194
|
+
}
|
|
2195
|
+
if (depositAddress) {
|
|
2196
|
+
console.log(`[NearStrategy] Submitting deposit to 1-Click: ${depositTxHash} -> ${depositAddress} (Memo: ${memo})`);
|
|
2197
|
+
try {
|
|
2198
|
+
await oneClickSdkTypescript.OneClickService.submitDepositTx({
|
|
2199
|
+
txHash: depositTxHash,
|
|
2200
|
+
depositAddress,
|
|
2201
|
+
memo: memo || void 0
|
|
2202
|
+
});
|
|
2203
|
+
console.log("[NearStrategy] Deposit submitted successfully.");
|
|
2204
|
+
} catch (e) {
|
|
2205
|
+
console.error("[NearStrategy] Failed to submit deposit to 1-Click:", e.message);
|
|
2206
|
+
}
|
|
2207
|
+
} else {
|
|
2208
|
+
console.error("[NearStrategy] Could not determine deposit address from Stellar operations.");
|
|
2209
|
+
}
|
|
2186
2210
|
return {
|
|
2187
2211
|
success: true,
|
|
2188
2212
|
transactionHash: depositTxHash,
|
|
@@ -2212,6 +2236,20 @@ var NearStrategy = class {
|
|
|
2212
2236
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: depositTxHash });
|
|
2213
2237
|
console.log(`[NearStrategy] Receipt found. Status: ${receipt.status}`);
|
|
2214
2238
|
if (receipt.status === "success") {
|
|
2239
|
+
const tx = await publicClient.getTransaction({ hash: depositTxHash });
|
|
2240
|
+
const depositAddress = tx.to;
|
|
2241
|
+
if (depositAddress) {
|
|
2242
|
+
console.log(`[NearStrategy] Submitting deposit to 1-Click: ${depositTxHash} -> ${depositAddress}`);
|
|
2243
|
+
try {
|
|
2244
|
+
await oneClickSdkTypescript.OneClickService.submitDepositTx({
|
|
2245
|
+
txHash: depositTxHash,
|
|
2246
|
+
depositAddress
|
|
2247
|
+
});
|
|
2248
|
+
console.log("[NearStrategy] Deposit submitted successfully.");
|
|
2249
|
+
} catch (e) {
|
|
2250
|
+
console.error("[NearStrategy] Failed to submit deposit to 1-Click:", e.message);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2215
2253
|
return {
|
|
2216
2254
|
success: true,
|
|
2217
2255
|
transactionHash: depositTxHash,
|
|
@@ -2302,7 +2340,7 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
|
|
|
2302
2340
|
refundType: oneClickSdkTypescript.QuoteRequest.refundType.ORIGIN_CHAIN,
|
|
2303
2341
|
recipient,
|
|
2304
2342
|
recipientType: oneClickSdkTypescript.QuoteRequest.recipientType.DESTINATION_CHAIN,
|
|
2305
|
-
deadline: new Date(Date.now() +
|
|
2343
|
+
deadline: new Date(Date.now() + 3 * 60 * 1e3).toISOString(),
|
|
2306
2344
|
referral: "1llet",
|
|
2307
2345
|
quoteWaitingTimeMs: 1e4
|
|
2308
2346
|
};
|
|
@@ -2368,6 +2406,7 @@ exports.CHAIN_ID_TO_KEY = CHAIN_ID_TO_KEY;
|
|
|
2368
2406
|
exports.GNOSIS_MAINNET = GNOSIS_MAINNET;
|
|
2369
2407
|
exports.NearStrategy = NearStrategy;
|
|
2370
2408
|
exports.OPTIMISM_MAINNET = OPTIMISM_MAINNET;
|
|
2409
|
+
exports.STELLAR_MAINNET = STELLAR_MAINNET;
|
|
2371
2410
|
exports.TransferManager = TransferManager;
|
|
2372
2411
|
exports.entryPointAbi = entryPointAbi;
|
|
2373
2412
|
exports.erc20Abi = erc20Abi;
|