@1llet.xyz/erc4337-gasless-sdk 0.4.26 → 0.4.27
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -279,6 +279,8 @@ declare const erc20Abi: readonly [{
|
|
|
279
279
|
readonly type: "function";
|
|
280
280
|
}];
|
|
281
281
|
|
|
282
|
+
declare const CHAIN_ID_TO_KEY: Record<string, string>;
|
|
283
|
+
|
|
282
284
|
declare const ChainKeyEnum: z.ZodEnum<{
|
|
283
285
|
Base: "Base";
|
|
284
286
|
Optimism: "Optimism";
|
|
@@ -322,7 +324,7 @@ interface SettleResponse {
|
|
|
322
324
|
data?: any;
|
|
323
325
|
}
|
|
324
326
|
interface BridgeContext {
|
|
325
|
-
paymentPayload
|
|
327
|
+
paymentPayload?: FacilitatorPaymentPayload;
|
|
326
328
|
sourceChain: ChainKey;
|
|
327
329
|
destChain: ChainKey;
|
|
328
330
|
sourceToken?: string;
|
|
@@ -371,4 +373,4 @@ declare class StandardBridgeStrategy implements BridgeStrategy {
|
|
|
371
373
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
372
374
|
}
|
|
373
375
|
|
|
374
|
-
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BridgeManager, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, GaslessStrategy, NearStrategy, OPTIMISM_MAINNET, StandardBridgeStrategy, type Token, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
376
|
+
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BridgeManager, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, GaslessStrategy, NearStrategy, OPTIMISM_MAINNET, StandardBridgeStrategy, type Token, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
package/dist/index.d.ts
CHANGED
|
@@ -279,6 +279,8 @@ declare const erc20Abi: readonly [{
|
|
|
279
279
|
readonly type: "function";
|
|
280
280
|
}];
|
|
281
281
|
|
|
282
|
+
declare const CHAIN_ID_TO_KEY: Record<string, string>;
|
|
283
|
+
|
|
282
284
|
declare const ChainKeyEnum: z.ZodEnum<{
|
|
283
285
|
Base: "Base";
|
|
284
286
|
Optimism: "Optimism";
|
|
@@ -322,7 +324,7 @@ interface SettleResponse {
|
|
|
322
324
|
data?: any;
|
|
323
325
|
}
|
|
324
326
|
interface BridgeContext {
|
|
325
|
-
paymentPayload
|
|
327
|
+
paymentPayload?: FacilitatorPaymentPayload;
|
|
326
328
|
sourceChain: ChainKey;
|
|
327
329
|
destChain: ChainKey;
|
|
328
330
|
sourceToken?: string;
|
|
@@ -371,4 +373,4 @@ declare class StandardBridgeStrategy implements BridgeStrategy {
|
|
|
371
373
|
execute(context: BridgeContext): Promise<SettleResponse>;
|
|
372
374
|
}
|
|
373
375
|
|
|
374
|
-
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BridgeManager, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, GaslessStrategy, NearStrategy, OPTIMISM_MAINNET, StandardBridgeStrategy, type Token, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
|
376
|
+
export { AccountAbstraction, type ApprovalSupportResult, BASE_MAINNET, BASE_SEPOLIA, BridgeManager, BundlerClient, CCTPStrategy, CHAIN_CONFIGS, CHAIN_ID_TO_KEY, type ChainConfig, GNOSIS_MAINNET, type GasEstimate, GaslessStrategy, NearStrategy, OPTIMISM_MAINNET, StandardBridgeStrategy, type Token, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, smartAccountAbi };
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var init_facilitator = __esm({
|
|
|
57
57
|
rpcUrl: "https://opt-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN"
|
|
58
58
|
// Assuming same key works or public
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
Gnosis: {
|
|
61
61
|
chainId: 100,
|
|
62
62
|
chain: chains.gnosis,
|
|
63
63
|
usdc: "0x2a22f9c3b48403ebD92cF06fF916b322a30dB834",
|
|
@@ -906,6 +906,16 @@ var CHAIN_CONFIGS = {
|
|
|
906
906
|
[chains.optimism.id]: OPTIMISM_MAINNET
|
|
907
907
|
};
|
|
908
908
|
|
|
909
|
+
// src/constants/chains.ts
|
|
910
|
+
var CHAIN_ID_TO_KEY = {
|
|
911
|
+
"8453": "Base",
|
|
912
|
+
"84532": "Base",
|
|
913
|
+
"100": "Gnosis",
|
|
914
|
+
"10": "Optimism",
|
|
915
|
+
"11155420": "Optimism",
|
|
916
|
+
"42161": "Arbitrum"
|
|
917
|
+
};
|
|
918
|
+
|
|
909
919
|
// src/services/gasless.ts
|
|
910
920
|
init_facilitator();
|
|
911
921
|
init_facilitator();
|
|
@@ -1013,6 +1023,9 @@ var GaslessStrategy = class {
|
|
|
1013
1023
|
}
|
|
1014
1024
|
async execute(context) {
|
|
1015
1025
|
const { paymentPayload, sourceChain, amount, recipient } = context;
|
|
1026
|
+
if (!paymentPayload) {
|
|
1027
|
+
return { success: false, errorReason: "Payment payload is required for Gasless Strategy" };
|
|
1028
|
+
}
|
|
1016
1029
|
return processGaslessSettlement(
|
|
1017
1030
|
paymentPayload,
|
|
1018
1031
|
sourceChain,
|
|
@@ -1837,7 +1850,10 @@ async function processCCTPSettlement(context, crossChainConfig) {
|
|
|
1837
1850
|
};
|
|
1838
1851
|
}
|
|
1839
1852
|
const facilitatorAccount = accounts.privateKeyToAccount(facilitatorPrivateKey);
|
|
1840
|
-
const
|
|
1853
|
+
const fromAddress = context.senderAddress || paymentPayload?.authorization?.from;
|
|
1854
|
+
if (!fromAddress) {
|
|
1855
|
+
return { success: false, errorReason: "Sender address is missing" };
|
|
1856
|
+
}
|
|
1841
1857
|
const usdcAddress = networkConfig.usdc;
|
|
1842
1858
|
const amountBigInt = BigInt(Math.floor(parseFloat(amount) * 1e6));
|
|
1843
1859
|
const publicClient = viem.createPublicClient({
|
|
@@ -1892,7 +1908,7 @@ async function processCCTPSettlement(context, crossChainConfig) {
|
|
|
1892
1908
|
};
|
|
1893
1909
|
}
|
|
1894
1910
|
const transferHash = depositTxHash || "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
1895
|
-
return executeCCTPBridge(sourceChain, amount, crossChainConfig, facilitatorPrivateKey, recipient, transferHash,
|
|
1911
|
+
return executeCCTPBridge(sourceChain, amount, crossChainConfig, facilitatorPrivateKey, recipient, transferHash, fromAddress);
|
|
1896
1912
|
}
|
|
1897
1913
|
async function executeCCTPBridge(sourceChain, amount, crossChainConfig, facilitatorPrivateKey, recipient, transferHash, payerAddress) {
|
|
1898
1914
|
if (!facilitatorPrivateKey) {
|
|
@@ -2278,6 +2294,7 @@ exports.BridgeManager = BridgeManager;
|
|
|
2278
2294
|
exports.BundlerClient = BundlerClient;
|
|
2279
2295
|
exports.CCTPStrategy = CCTPStrategy;
|
|
2280
2296
|
exports.CHAIN_CONFIGS = CHAIN_CONFIGS;
|
|
2297
|
+
exports.CHAIN_ID_TO_KEY = CHAIN_ID_TO_KEY;
|
|
2281
2298
|
exports.GNOSIS_MAINNET = GNOSIS_MAINNET;
|
|
2282
2299
|
exports.GaslessStrategy = GaslessStrategy;
|
|
2283
2300
|
exports.NearStrategy = NearStrategy;
|