@1llet.xyz/erc4337-gasless-sdk 0.4.47 → 0.4.48

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.
Files changed (2) hide show
  1. package/README.md +71 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ERC-4337 Gasless SDK ⛽️
2
2
 
3
- A lightweight, typed SDK to integrate Account Abstraction (ERC-4337) and Cross-Chain transfers into your dApp. It handles Smart Account creation, gasless transactions, and orchestrates cross-chain bridges.
3
+ A lightweight, typed SDK to integrate Account Abstraction (ERC-4337) and Cross-Chain transfers into your dApp. It handles Smart Account creation, gasless transactions, and orchestrates cross-chain bridges strategies including CCTP and Near Intents.
4
4
 
5
5
  ## 📦 Installation
6
6
 
@@ -61,7 +61,7 @@ await aa.sendTransaction({
61
61
 
62
62
  ## 🌉 Cross-Chain Transfer Manager
63
63
 
64
- The `TransferManager` orchestrates transfers between chains, choosing the best strategy (CCTP, Near Intents) or signaling a direct transfer if on the same chain.
64
+ The `TransferManager` orchestrates transfers between chains, choosing the best strategy (**CCTP**, **Near Intents**) or signaling a **Direct Transfer** if on the same chain.
65
65
 
66
66
  ```typescript
67
67
  import { TransferManager, BridgeContext } from "@1llet.xyz/erc4337-gasless-sdk";
@@ -76,7 +76,14 @@ const context: BridgeContext = {
76
76
  amount: "10.5", // Human readable string
77
77
  recipient: "0xRecipient...",
78
78
  senderAddress: "0xSender...",
79
- facilitatorPrivateKey: "0x..." // For CCTP/Near verification usage (Backend)
79
+
80
+ // Optional: Provide depositTxHash if you already made the deposit
81
+ depositTxHash: "0x...",
82
+
83
+ // Optional: For Stellar source
84
+ paymentPayload: {
85
+ signedXDR: "AAAA..."
86
+ }
80
87
  };
81
88
 
82
89
  const result = await transferManager.execute(context);
@@ -86,22 +93,79 @@ if (result.success) {
86
93
  // Signal to Client: Execute direct transfer on same chain!
87
94
  console.log("Execute local transfer:", result.data);
88
95
  } else {
89
- // Cross-chain initiated
90
- console.log("Bridge Tx:", result.transactionHash);
96
+ // Cross-chain initiated (or Deposit Address returned for Near)
97
+ console.log("Bridge Tx / Deposit Address:", result.data);
91
98
  }
92
99
  } else {
93
100
  console.error("Error:", result.errorReason);
94
101
  }
95
102
  ```
96
103
 
104
+ ### Simulation (Quote)
105
+
106
+ You can simulate a simulation to estimate fees and received amount before executing.
107
+
108
+ ```typescript
109
+ import { getNearSimulation } from "@1llet.xyz/erc4337-gasless-sdk";
110
+
111
+ const simulation = await getNearSimulation(
112
+ "Base",
113
+ "Gnosis",
114
+ "10",
115
+ "USDC", // Source
116
+ "EURe" // Destination
117
+ );
118
+
119
+ if (simulation.success) {
120
+ console.log(`Fee: ${simulation.protocolFee}`);
121
+ console.log(`Est. Received: ${simulation.estimatedReceived}`);
122
+ } else {
123
+ console.error(simulation.error);
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 🌟 Stellar Service
130
+
131
+ The SDK includes a dedicated `StellarService` to handle non-EVM interactions, useful for bridging from Stellar to EVM.
132
+
133
+ ```typescript
134
+ import { StellarService } from "@1llet.xyz/erc4337-gasless-sdk";
135
+
136
+ const stellar = new StellarService();
137
+
138
+ // 1. Get Balance
139
+ const balance = await stellar.getBalance("G...", "USDC");
140
+
141
+ // 2. Build Transfer XDR (for bridging)
142
+ const xdr = await stellar.buildTransferXdr(
143
+ "S_SENDER_PRIVATE_KEY",
144
+ "G_RECIPIENT_ADDRESS",
145
+ "10", // Amount
146
+ "USDC",
147
+ "MEMO_IF_NEEDED"
148
+ );
149
+
150
+ // 3. Submit Transaction
151
+ const hash = await stellar.submitXdr(xdr);
152
+ ```
153
+
154
+ ---
155
+
97
156
  ## 🛠️ Supported Chains
98
157
 
99
158
  The SDK exports pre-configured objects:
100
159
 
101
- - `BASE_MAINNET`
102
- - `BASE_SEPOLIA`
160
+ - `BASE_MAINNET`, `BASE_SEPOLIA`
103
161
  - `OPTIMISM_MAINNET`
162
+ - `ARBITRUM_MAINNET`
104
163
  - `GNOSIS_MAINNET`
164
+ - `POLYGON_MAINNET`
165
+ - `AVALANCHE_MAINNET`
166
+ - `STELLAR_MAINNET`
167
+ - `UNICHAIN_SEPOLIA`
168
+ - `WORLD_CHAIN_MAINNET`
105
169
 
106
170
  ```typescript
107
171
  import { GNOSIS_MAINNET } from "@1llet.xyz/erc4337-gasless-sdk";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.47",
6
+ "version": "0.4.48",
7
7
  "description": "SDK for ERC-4337 Gasless Transfers",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -44,4 +44,4 @@
44
44
  "tsx": "^4.21.0",
45
45
  "typescript": "^5.0.0"
46
46
  }
47
- }
47
+ }