@smoothsend/sdk 2.2.1 → 2.2.3

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 (81) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +349 -349
  3. package/dist/aptos/index.cjs +1256 -0
  4. package/dist/aptos/index.cjs.map +1 -0
  5. package/dist/aptos/index.d.ts +783 -0
  6. package/dist/aptos/index.js +1230 -0
  7. package/dist/aptos/index.js.map +1 -0
  8. package/dist/aptos-entry.d.ts +36 -0
  9. package/dist/aptos-entry.d.ts.map +1 -0
  10. package/dist/avax/SmoothSendAvaxSubmitter.d.ts +79 -0
  11. package/dist/avax/SmoothSendAvaxSubmitter.d.ts.map +1 -0
  12. package/dist/avax/index.cjs +1869 -0
  13. package/dist/avax/index.cjs.map +1 -0
  14. package/dist/avax/index.d.ts +306 -0
  15. package/dist/avax/index.d.ts.map +1 -0
  16. package/dist/avax/index.js +1849 -0
  17. package/dist/avax/index.js.map +1 -0
  18. package/dist/avax/publicAaDefaults.d.ts +16 -0
  19. package/dist/avax/publicAaDefaults.d.ts.map +1 -0
  20. package/dist/avax/simpleAccountFactory.d.ts +44 -0
  21. package/dist/avax/simpleAccountFactory.d.ts.map +1 -0
  22. package/dist/avax/types.d.ts +86 -0
  23. package/dist/avax/types.d.ts.map +1 -0
  24. package/dist/avax/useSmoothSendAvax.d.ts +60 -0
  25. package/dist/avax/useSmoothSendAvax.d.ts.map +1 -0
  26. package/dist/avax/viemHelpers.d.ts +40 -0
  27. package/dist/avax/viemHelpers.d.ts.map +1 -0
  28. package/dist/avax-entry.d.ts +24 -0
  29. package/dist/avax-entry.d.ts.map +1 -0
  30. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs +1519 -0
  31. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs.map +1 -0
  32. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js +1511 -0
  33. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js.map +1 -0
  34. package/dist/chunks/SmoothSendSDK.d-9GBgZONY.d.ts +262 -0
  35. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs +1237 -0
  36. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs.map +1 -0
  37. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js +1228 -0
  38. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js.map +1 -0
  39. package/dist/chunks/shared-CNF22ESH.js +557 -0
  40. package/dist/chunks/shared-CNF22ESH.js.map +1 -0
  41. package/dist/chunks/shared-CaQMAGQR.js +1511 -0
  42. package/dist/chunks/shared-CaQMAGQR.js.map +1 -0
  43. package/dist/chunks/shared-Cn4duBJT.d.ts +1279 -0
  44. package/dist/chunks/shared-DEurKmpI.cjs +1519 -0
  45. package/dist/chunks/shared-DEurKmpI.cjs.map +1 -0
  46. package/dist/chunks/shared-RVkwmkG7.d.ts +262 -0
  47. package/dist/chunks/shared-x1-VC-Li.cjs +568 -0
  48. package/dist/chunks/shared-x1-VC-Li.cjs.map +1 -0
  49. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs +1865 -0
  50. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs.map +1 -0
  51. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js +1848 -0
  52. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js.map +1 -0
  53. package/dist/chunks/version-CNF22ESH.js +557 -0
  54. package/dist/chunks/version-CNF22ESH.js.map +1 -0
  55. package/dist/chunks/version-x1-VC-Li.cjs +568 -0
  56. package/dist/chunks/version-x1-VC-Li.cjs.map +1 -0
  57. package/dist/chunks/version.d-Cn4duBJT.d.ts +1279 -0
  58. package/dist/index.cjs +5209 -0
  59. package/dist/index.cjs.map +1 -0
  60. package/dist/index.d.ts +11 -2552
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.esm.js +1846 -3
  63. package/dist/index.esm.js.map +1 -1
  64. package/dist/index.js +1880 -62
  65. package/dist/index.js.map +1 -1
  66. package/dist/stellar/index.cjs +27 -0
  67. package/dist/stellar/index.cjs.map +1 -0
  68. package/dist/stellar/index.d.ts +214 -0
  69. package/dist/stellar/index.js +3 -0
  70. package/dist/stellar/index.js.map +1 -0
  71. package/dist/stellar-entry.d.ts +37 -0
  72. package/dist/stellar-entry.d.ts.map +1 -0
  73. package/dist/version.d.ts +2 -0
  74. package/dist/version.d.ts.map +1 -0
  75. package/package.json +120 -110
  76. package/dist/adapters/evm.d.ts +0 -39
  77. package/dist/adapters/evm.d.ts.map +0 -1
  78. package/dist/config/chains.d.ts +0 -7
  79. package/dist/config/chains.d.ts.map +0 -1
  80. package/dist/services/chainConfigService.d.ts +0 -49
  81. package/dist/services/chainConfigService.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,349 +1,349 @@
1
- # SmoothSend SDK
2
-
3
- Multi-chain gasless transaction SDK. Enable gas-free transactions with just 3 lines of code. Supports **Aptos** and **Stellar**.
4
-
5
- [![npm version](https://badge.fury.io/js/@smoothsend/sdk.svg)](https://www.npmjs.com/package/@smoothsend/sdk)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
-
9
- ## Features
10
-
11
- - **Gasless Transactions**: Users don't need APT or XLM for gas fees
12
- - **Multi-Chain**: Aptos + Stellar (same 3-line API)
13
- - **3-Line Integration**: Works with Aptos Wallet Adapter and Stellar wallets (Freighter, etc.)
14
- - **Type-Safe**: Full TypeScript support with comprehensive type definitions
15
- - **Testnet & Mainnet**: Supports both networks on each chain
16
- - **Fee-in-Token**: On Aptos mainnet, tiny fee deducted from token (not APT)
17
-
18
- ## Installation
19
-
20
- ```bash
21
- npm install @smoothsend/sdk
22
- ```
23
-
24
- ---
25
-
26
- ## Quick Start
27
-
28
- ### Wallet Adapter (EASIEST — All Transactions Gasless)
29
-
30
- The simplest integration — pass `transactionSubmitter` to your wallet provider and **every transaction becomes gasless automatically**. Ideal when you want to sponsor all functions.
31
-
32
- ```typescript
33
- import { SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
34
- import { AptosWalletAdapterProvider } from '@aptos-labs/wallet-adapter-react';
35
- import { Network } from '@aptos-labs/ts-sdk';
36
-
37
- // 1. Create the transaction submitter (one line!)
38
- const transactionSubmitter = new SmoothSendTransactionSubmitter({
39
- apiKey: 'pk_nogas_your_api_key_here',
40
- network: 'testnet'
41
- });
42
-
43
- // 2. Add to your wallet provider
44
- function App() {
45
- return (
46
- <AptosWalletAdapterProvider
47
- dappConfig={{
48
- network: Network.TESTNET,
49
- transactionSubmitter: transactionSubmitter // <-- That's it!
50
- }}
51
- >
52
- <YourApp />
53
- </AptosWalletAdapterProvider>
54
- );
55
- }
56
-
57
- // 3. Use normal wallet functions - they're now gasless!
58
- function TransferButton() {
59
- const { signAndSubmitTransaction } = useWallet();
60
-
61
- const handleTransfer = async () => {
62
- // This is now gasless! No code changes needed!
63
- const result = await signAndSubmitTransaction({
64
- data: {
65
- function: "0x1::coin::transfer",
66
- typeArguments: ["0x1::aptos_coin::AptosCoin"],
67
- functionArguments: [recipientAddress, amount],
68
- }
69
- });
70
- console.log('Gasless transaction:', result.hash);
71
- };
72
-
73
- return <button onClick={handleTransfer}>Send (Gasless!)</button>;
74
- }
75
- ```
76
-
77
- ---
78
-
79
- ### useSmoothSend Hook (Per-Function Routing)
80
-
81
- Use `useSmoothSend` when you want **some functions gasless and others not** — for example, free to create but user pays to delete. The hook automatically routes each transaction based on your project's sponsored-functions allowlist configured in the dashboard.
82
-
83
- ```typescript
84
- import { useSmoothSend, SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
85
-
86
- // Create once at module scope (not inside the component)
87
- const submitter = new SmoothSendTransactionSubmitter({
88
- apiKey: process.env.NEXT_PUBLIC_SMOOTHSEND_API_KEY!,
89
- network: 'testnet',
90
- });
91
-
92
- function MyComponent() {
93
- // Drop-in replacement for useWallet().signAndSubmitTransaction
94
- const { signAndSubmitTransaction } = useSmoothSend(submitter);
95
-
96
- const handleAction = async () => {
97
- // Automatically routed:
98
- // function in allowlist → fee-payer gasless (user pays 0 gas)
99
- // function not in list → walletSignAndSubmit fallback (user pays gas)
100
- await signAndSubmitTransaction({
101
- data: {
102
- function: '0xABC::mymodule::my_function',
103
- functionArguments: [arg1, arg2],
104
- }
105
- });
106
- };
107
- }
108
- ```
109
-
110
- > **Note:** Do NOT use `transactionSubmitter` in `AptosWalletAdapterProvider` when using `useSmoothSend` — the hook handles all routing directly.
111
- >
112
- > **Requirements:** `react >= 17`, `@aptos-labs/wallet-adapter-react >= 8`, `@aptos-labs/ts-sdk >= 5.0.0`
113
-
114
- ---
115
-
116
- ### True Gasless (Backend)
117
-
118
- For Node.js backends running 100% sponsored transactions for arbitrary generic payloads using a secret key.
119
-
120
- ```typescript
121
- import { TrueGaslessClient } from '@smoothsend/sdk';
122
- import { Account, Ed25519PrivateKey } from '@aptos-labs/ts-sdk';
123
-
124
- // 1. Instantiate the backend account (keep your private key safe!)
125
- const backendWallet = Account.fromPrivateKey({
126
- privateKey: new Ed25519PrivateKey(process.env.APTOS_PRIVATE_KEY!)
127
- });
128
-
129
- // 2. Create client using your secret key
130
- const client = new TrueGaslessClient({
131
- apiKey: process.env.SMOOTHSEND_SECRET_KEY!, // sk_nogas_*
132
- network: 'mainnet'
133
- });
134
-
135
- // 3. Build & execute your Move transaction payload
136
- const result = await client.execute({
137
- senderAccount: backendWallet,
138
- payload: {
139
- function: "0x12b...::nft::mint_to",
140
- functionArguments: [recipientAddress, "1"]
141
- }
142
- });
143
-
144
- console.log('Gasless transaction executed:', result.txHash);
145
- ```
146
-
147
- ---
148
-
149
- ### Script Composer — Fee-in-Token Transfers
150
-
151
- For mainnet with the free tier, Script Composer deducts fees from the token being transferred rather than requiring APT.
152
-
153
- ```typescript
154
- import { ScriptComposerClient } from '@smoothsend/sdk';
155
-
156
- const client = new ScriptComposerClient({
157
- apiKey: 'pk_nogas_your_api_key',
158
- network: 'mainnet'
159
- });
160
-
161
- // Step 1: Build transfer (fee calculated automatically)
162
- const { transactionBytes, fee, totalAmount } = await client.buildTransfer({
163
- sender: wallet.address,
164
- recipient: '0x123...',
165
- amount: '1000000', // 1 USDC
166
- assetType: '0xf22bede...::usdc::USDC',
167
- decimals: 6,
168
- symbol: 'USDC'
169
- });
170
-
171
- console.log(`Sending 1 USDC, fee: ${fee} (deducted from token)`);
172
-
173
- // Step 2: Sign with wallet
174
- const signedTx = await wallet.signTransaction(transactionBytes);
175
-
176
- // Step 3: Submit
177
- const result = await client.submitSignedTransaction({
178
- transactionBytes: signedTx.transactionBytes,
179
- authenticatorBytes: signedTx.authenticatorBytes
180
- });
181
-
182
- console.log('Transaction:', result.txHash);
183
- ```
184
-
185
- Additional `ScriptComposerClient` methods:
186
-
187
- ```typescript
188
- // Estimate fee without building a transaction
189
- const estimate = await client.estimateFee({
190
- sender: '0x...',
191
- recipient: '0x...',
192
- amount: '1000000',
193
- assetType: USDC_ADDRESS,
194
- decimals: 6,
195
- symbol: 'USDC'
196
- });
197
-
198
- console.log('Fee:', estimate.estimation.formatted.fee);
199
- console.log('Total:', estimate.estimation.formatted.totalAmount);
200
-
201
- // Or use the convenience method for the complete flow
202
- const result = await client.transfer(transferParams, wallet);
203
- ```
204
-
205
- ---
206
-
207
- ## Choosing an Integration
208
-
209
- | Scenario | Method | Notes |
210
- |---|---|---|
211
- | Make ALL transactions gasless, zero config | `transactionSubmitter` in `AptosWalletAdapterProvider` | Simplest setup |
212
- | Sponsor only specific functions (allowlist) | `useSmoothSend(submitter)` hook | Per-function routing |
213
- | Testnet (any tier) | `TransactionSubmitter` | Always free on testnet |
214
- | Mainnet + Free tier | `ScriptComposerClient` | Fee deducted from token (~$0.01/tx) |
215
- | Mainnet + Paid tier | `TransactionSubmitter` | Zero fees included in subscription |
216
- | Swaps, NFTs, contracts | `TransactionSubmitter` | Script Composer supports transfers only |
217
- | Token transfers you want to monetize | `ScriptComposerClient` | Pass the fee cost to your users |
218
- | Backend / server-side transactions | `TrueGaslessClient` | Requires secret key (`sk_nogas_*`) |
219
-
220
- ---
221
-
222
- ## Stellar — Gasless XLM & USDC
223
-
224
- Same 3-line API for Stellar. Works with Freighter, Stellar Wallets Kit, or any Stellar-compatible wallet.
225
-
226
- ```typescript
227
- import { SmoothSendSDK } from '@smoothsend/sdk';
228
-
229
- const sdk = new SmoothSendSDK({ apiKey: 'pk_nogas_xxx', network: 'testnet' });
230
-
231
- // Option 1: Full transfer (build + sign + submit)
232
- const result = await sdk.transfer(
233
- { from: 'G...', to: 'G...', amount: '100', token: 'XLM', chain: 'stellar-testnet' },
234
- stellarWallet
235
- );
236
-
237
- // Option 2: Submit pre-signed XDR
238
- const signedXdr = await wallet.signTransaction(tx);
239
- const result = await sdk.submitStellarTransaction(signedXdr);
240
- ```
241
-
242
- **Stellar wallet interface:**
243
-
244
- ```typescript
245
- const stellarWallet = {
246
- buildTransaction: (params) => buildPaymentTransaction(params.from, params.to, params.amount, params.token),
247
- signTransaction: (tx) => walletKit.signTransaction(tx.toXDR()).then(r => r.signedTxXdr),
248
- };
249
- ```
250
-
251
- ---
252
-
253
- ## Supported Networks
254
-
255
- | Network | Status | Features |
256
- |---|---|---|
257
- | Aptos Testnet | ✅ Active | Gasless transactions, Ed25519 signatures |
258
- | Aptos Mainnet | ✅ Active | Gasless transactions, fee-in-token option |
259
- | Stellar Testnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
260
- | Stellar Mainnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
261
-
262
- ---
263
-
264
- ## Authentication
265
-
266
- SmoothSend uses two types of API keys:
267
-
268
- ### Public Keys (`pk_nogas_*`)
269
-
270
- - Safe for frontend applications — can be embedded in client-side code
271
- - CORS-protected — only work from configured domains
272
- - Use in: React apps, Vue apps, browser extensions, mobile apps
273
-
274
- ### Secret Keys (`sk_nogas_*`)
275
-
276
- - Server-side only — must never be exposed in client-side code
277
- - No CORS restrictions — work from any server environment
278
- - Use in: Node.js backends, serverless functions, API servers
279
-
280
- ### Getting Your API Keys
281
-
282
- 1. Sign up at [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
283
- 2. Create a project
284
- 3. Generate an API key pair — you'll receive both a public and secret key
285
- 4. Configure CORS origins for your public key
286
-
287
- ### Security Best Practices
288
-
289
- - ⚠️ Never commit secret keys to version control
290
- - ⚠️ Never expose secret keys in client-side code
291
- - ✅ Use public keys for frontend applications
292
- - ✅ Use secret keys for backend services only
293
- - ✅ Configure CORS origins for all production domains
294
- - ✅ All transactions require user signature approval — private keys never leave the client
295
- - ✅ Rate limiting and input validation are enforced on all relayer endpoints
296
-
297
- ---
298
-
299
- ## MCP Server
300
-
301
- SmoothSend ships an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that lets AI assistants — Claude, Cursor, and others — help you integrate gasless transactions directly from your editor or chat interface.
302
-
303
- ```bash
304
- npm install -g @smoothsend/mcp
305
- ```
306
-
307
- Once installed, add it to your MCP client config:
308
-
309
- **Claude Desktop** (`claude_desktop_config.json`):
310
-
311
- ```json
312
- {
313
- "mcpServers": {
314
- "smoothsend": {
315
- "command": "smoothsend-mcp"
316
- }
317
- }
318
- }
319
- ```
320
-
321
- **Cursor** (`.cursor/mcp.json`):
322
-
323
- ```json
324
- {
325
- "mcpServers": {
326
- "smoothsend": {
327
- "command": "smoothsend-mcp"
328
- }
329
- }
330
- }
331
- ```
332
-
333
- Your AI assistant will then have full context on the SmoothSend API, client types, and integration patterns — making it faster to scaffold and debug gasless transaction flows.
334
-
335
- ---
336
-
337
- ## Links
338
-
339
- - **Dashboard**: [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
340
- - **Documentation**: [docs.smoothsend.xyz](https://docs.smoothsend.xyz)
341
- - **GitHub**: [github.com/smoothsend](https://github.com/smoothsend)
342
-
343
- ## License
344
-
345
- MIT
346
-
347
- ---
348
-
349
- Built with ❤️ by the SmoothSend team
1
+ # SmoothSend SDK
2
+
3
+ Multi-chain gasless transaction SDK. Enable gas-free transactions with just 3 lines of code. Supports **Aptos** and **Stellar**.
4
+
5
+ [![npm version](https://badge.fury.io/js/@smoothsend/sdk.svg)](https://www.npmjs.com/package/@smoothsend/sdk)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Features
10
+
11
+ - **Gasless Transactions**: Users don't need APT or XLM for gas fees
12
+ - **Multi-Chain**: Aptos + Stellar (same 3-line API)
13
+ - **3-Line Integration**: Works with Aptos Wallet Adapter and Stellar wallets (Freighter, etc.)
14
+ - **Type-Safe**: Full TypeScript support with comprehensive type definitions
15
+ - **Testnet & Mainnet**: Supports both networks on each chain
16
+ - **Fee-in-Token**: On Aptos mainnet, tiny fee deducted from token (not APT)
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @smoothsend/sdk
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Quick Start
27
+
28
+ ### Wallet Adapter (EASIEST — All Transactions Gasless)
29
+
30
+ The simplest integration — pass `transactionSubmitter` to your wallet provider and **every transaction becomes gasless automatically**. Ideal when you want to sponsor all functions.
31
+
32
+ ```typescript
33
+ import { SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
34
+ import { AptosWalletAdapterProvider } from '@aptos-labs/wallet-adapter-react';
35
+ import { Network } from '@aptos-labs/ts-sdk';
36
+
37
+ // 1. Create the transaction submitter (one line!)
38
+ const transactionSubmitter = new SmoothSendTransactionSubmitter({
39
+ apiKey: 'pk_nogas_your_api_key_here',
40
+ network: 'testnet'
41
+ });
42
+
43
+ // 2. Add to your wallet provider
44
+ function App() {
45
+ return (
46
+ <AptosWalletAdapterProvider
47
+ dappConfig={{
48
+ network: Network.TESTNET,
49
+ transactionSubmitter: transactionSubmitter // <-- That's it!
50
+ }}
51
+ >
52
+ <YourApp />
53
+ </AptosWalletAdapterProvider>
54
+ );
55
+ }
56
+
57
+ // 3. Use normal wallet functions - they're now gasless!
58
+ function TransferButton() {
59
+ const { signAndSubmitTransaction } = useWallet();
60
+
61
+ const handleTransfer = async () => {
62
+ // This is now gasless! No code changes needed!
63
+ const result = await signAndSubmitTransaction({
64
+ data: {
65
+ function: "0x1::coin::transfer",
66
+ typeArguments: ["0x1::aptos_coin::AptosCoin"],
67
+ functionArguments: [recipientAddress, amount],
68
+ }
69
+ });
70
+ console.log('Gasless transaction:', result.hash);
71
+ };
72
+
73
+ return <button onClick={handleTransfer}>Send (Gasless!)</button>;
74
+ }
75
+ ```
76
+
77
+ ---
78
+
79
+ ### useSmoothSend Hook (Per-Function Routing)
80
+
81
+ Use `useSmoothSend` when you want **some functions gasless and others not** — for example, free to create but user pays to delete. The hook automatically routes each transaction based on your project's sponsored-functions allowlist configured in the dashboard.
82
+
83
+ ```typescript
84
+ import { useSmoothSend, SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
85
+
86
+ // Create once at module scope (not inside the component)
87
+ const submitter = new SmoothSendTransactionSubmitter({
88
+ apiKey: process.env.NEXT_PUBLIC_SMOOTHSEND_API_KEY!,
89
+ network: 'testnet',
90
+ });
91
+
92
+ function MyComponent() {
93
+ // Drop-in replacement for useWallet().signAndSubmitTransaction
94
+ const { signAndSubmitTransaction } = useSmoothSend(submitter);
95
+
96
+ const handleAction = async () => {
97
+ // Automatically routed:
98
+ // function in allowlist → fee-payer gasless (user pays 0 gas)
99
+ // function not in list → walletSignAndSubmit fallback (user pays gas)
100
+ await signAndSubmitTransaction({
101
+ data: {
102
+ function: '0xABC::mymodule::my_function',
103
+ functionArguments: [arg1, arg2],
104
+ }
105
+ });
106
+ };
107
+ }
108
+ ```
109
+
110
+ > **Note:** Do NOT use `transactionSubmitter` in `AptosWalletAdapterProvider` when using `useSmoothSend` — the hook handles all routing directly.
111
+ >
112
+ > **Requirements:** `react >= 17`, `@aptos-labs/wallet-adapter-react >= 8`, `@aptos-labs/ts-sdk >= 5.0.0`
113
+
114
+ ---
115
+
116
+ ### True Gasless (Backend)
117
+
118
+ For Node.js backends running 100% sponsored transactions for arbitrary generic payloads using a secret key.
119
+
120
+ ```typescript
121
+ import { TrueGaslessClient } from '@smoothsend/sdk';
122
+ import { Account, Ed25519PrivateKey } from '@aptos-labs/ts-sdk';
123
+
124
+ // 1. Instantiate the backend account (keep your private key safe!)
125
+ const backendWallet = Account.fromPrivateKey({
126
+ privateKey: new Ed25519PrivateKey(process.env.APTOS_PRIVATE_KEY!)
127
+ });
128
+
129
+ // 2. Create client using your secret key
130
+ const client = new TrueGaslessClient({
131
+ apiKey: process.env.SMOOTHSEND_SECRET_KEY!, // sk_nogas_*
132
+ network: 'mainnet'
133
+ });
134
+
135
+ // 3. Build & execute your Move transaction payload
136
+ const result = await client.execute({
137
+ senderAccount: backendWallet,
138
+ payload: {
139
+ function: "0x12b...::nft::mint_to",
140
+ functionArguments: [recipientAddress, "1"]
141
+ }
142
+ });
143
+
144
+ console.log('Gasless transaction executed:', result.txHash);
145
+ ```
146
+
147
+ ---
148
+
149
+ ### Script Composer — Fee-in-Token Transfers
150
+
151
+ For mainnet with the free tier, Script Composer deducts fees from the token being transferred rather than requiring APT.
152
+
153
+ ```typescript
154
+ import { ScriptComposerClient } from '@smoothsend/sdk';
155
+
156
+ const client = new ScriptComposerClient({
157
+ apiKey: 'pk_nogas_your_api_key',
158
+ network: 'mainnet'
159
+ });
160
+
161
+ // Step 1: Build transfer (fee calculated automatically)
162
+ const { transactionBytes, fee, totalAmount } = await client.buildTransfer({
163
+ sender: wallet.address,
164
+ recipient: '0x123...',
165
+ amount: '1000000', // 1 USDC
166
+ assetType: '0xf22bede...::usdc::USDC',
167
+ decimals: 6,
168
+ symbol: 'USDC'
169
+ });
170
+
171
+ console.log(`Sending 1 USDC, fee: ${fee} (deducted from token)`);
172
+
173
+ // Step 2: Sign with wallet
174
+ const signedTx = await wallet.signTransaction(transactionBytes);
175
+
176
+ // Step 3: Submit
177
+ const result = await client.submitSignedTransaction({
178
+ transactionBytes: signedTx.transactionBytes,
179
+ authenticatorBytes: signedTx.authenticatorBytes
180
+ });
181
+
182
+ console.log('Transaction:', result.txHash);
183
+ ```
184
+
185
+ Additional `ScriptComposerClient` methods:
186
+
187
+ ```typescript
188
+ // Estimate fee without building a transaction
189
+ const estimate = await client.estimateFee({
190
+ sender: '0x...',
191
+ recipient: '0x...',
192
+ amount: '1000000',
193
+ assetType: USDC_ADDRESS,
194
+ decimals: 6,
195
+ symbol: 'USDC'
196
+ });
197
+
198
+ console.log('Fee:', estimate.estimation.formatted.fee);
199
+ console.log('Total:', estimate.estimation.formatted.totalAmount);
200
+
201
+ // Or use the convenience method for the complete flow
202
+ const result = await client.transfer(transferParams, wallet);
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Choosing an Integration
208
+
209
+ | Scenario | Method | Notes |
210
+ |---|---|---|
211
+ | Make ALL transactions gasless, zero config | `transactionSubmitter` in `AptosWalletAdapterProvider` | Simplest setup |
212
+ | Sponsor only specific functions (allowlist) | `useSmoothSend(submitter)` hook | Per-function routing |
213
+ | Testnet (any tier) | `TransactionSubmitter` | Always free on testnet |
214
+ | Mainnet + Free tier | `ScriptComposerClient` | Fee deducted from token (~$0.01/tx) |
215
+ | Mainnet + Paid tier | `TransactionSubmitter` | Zero fees included in subscription |
216
+ | Swaps, NFTs, contracts | `TransactionSubmitter` | Script Composer supports transfers only |
217
+ | Token transfers you want to monetize | `ScriptComposerClient` | Pass the fee cost to your users |
218
+ | Backend / server-side transactions | `TrueGaslessClient` | Requires secret key (`sk_nogas_*`) |
219
+
220
+ ---
221
+
222
+ ## Stellar — Gasless XLM & USDC
223
+
224
+ Same 3-line API for Stellar. Works with Freighter, Stellar Wallets Kit, or any Stellar-compatible wallet.
225
+
226
+ ```typescript
227
+ import { SmoothSendSDK } from '@smoothsend/sdk';
228
+
229
+ const sdk = new SmoothSendSDK({ apiKey: 'pk_nogas_xxx', network: 'testnet' });
230
+
231
+ // Option 1: Full transfer (build + sign + submit)
232
+ const result = await sdk.transfer(
233
+ { from: 'G...', to: 'G...', amount: '100', token: 'XLM', chain: 'stellar-testnet' },
234
+ stellarWallet
235
+ );
236
+
237
+ // Option 2: Submit pre-signed XDR
238
+ const signedXdr = await wallet.signTransaction(tx);
239
+ const result = await sdk.submitStellarTransaction(signedXdr);
240
+ ```
241
+
242
+ **Stellar wallet interface:**
243
+
244
+ ```typescript
245
+ const stellarWallet = {
246
+ buildTransaction: (params) => buildPaymentTransaction(params.from, params.to, params.amount, params.token),
247
+ signTransaction: (tx) => walletKit.signTransaction(tx.toXDR()).then(r => r.signedTxXdr),
248
+ };
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Supported Networks
254
+
255
+ | Network | Status | Features |
256
+ |---|---|---|
257
+ | Aptos Testnet | ✅ Active | Gasless transactions, Ed25519 signatures |
258
+ | Aptos Mainnet | ✅ Active | Gasless transactions, fee-in-token option |
259
+ | Stellar Testnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
260
+ | Stellar Mainnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
261
+
262
+ ---
263
+
264
+ ## Authentication
265
+
266
+ SmoothSend uses two types of API keys:
267
+
268
+ ### Public Keys (`pk_nogas_*`)
269
+
270
+ - Safe for frontend applications — can be embedded in client-side code
271
+ - CORS-protected — only work from configured domains
272
+ - Use in: React apps, Vue apps, browser extensions, mobile apps
273
+
274
+ ### Secret Keys (`sk_nogas_*`)
275
+
276
+ - Server-side only — must never be exposed in client-side code
277
+ - No CORS restrictions — work from any server environment
278
+ - Use in: Node.js backends, serverless functions, API servers
279
+
280
+ ### Getting Your API Keys
281
+
282
+ 1. Sign up at [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
283
+ 2. Create a project
284
+ 3. Generate an API key pair — you'll receive both a public and secret key
285
+ 4. Configure CORS origins for your public key
286
+
287
+ ### Security Best Practices
288
+
289
+ - ⚠️ Never commit secret keys to version control
290
+ - ⚠️ Never expose secret keys in client-side code
291
+ - ✅ Use public keys for frontend applications
292
+ - ✅ Use secret keys for backend services only
293
+ - ✅ Configure CORS origins for all production domains
294
+ - ✅ All transactions require user signature approval — private keys never leave the client
295
+ - ✅ Rate limiting and input validation are enforced on all relayer endpoints
296
+
297
+ ---
298
+
299
+ ## MCP Server
300
+
301
+ SmoothSend ships an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that lets AI assistants — Claude, Cursor, and others — help you integrate gasless transactions directly from your editor or chat interface.
302
+
303
+ ```bash
304
+ npm install -g @smoothsend/mcp
305
+ ```
306
+
307
+ Once installed, add it to your MCP client config:
308
+
309
+ **Claude Desktop** (`claude_desktop_config.json`):
310
+
311
+ ```json
312
+ {
313
+ "mcpServers": {
314
+ "smoothsend": {
315
+ "command": "smoothsend-mcp"
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ **Cursor** (`.cursor/mcp.json`):
322
+
323
+ ```json
324
+ {
325
+ "mcpServers": {
326
+ "smoothsend": {
327
+ "command": "smoothsend-mcp"
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ Your AI assistant will then have full context on the SmoothSend API, client types, and integration patterns — making it faster to scaffold and debug gasless transaction flows.
334
+
335
+ ---
336
+
337
+ ## Links
338
+
339
+ - **Dashboard**: [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
340
+ - **Documentation**: [docs.smoothsend.xyz](https://docs.smoothsend.xyz)
341
+ - **GitHub**: [github.com/smoothsend](https://github.com/smoothsend)
342
+
343
+ ## License
344
+
345
+ MIT
346
+
347
+ ---
348
+
349
+ Built with ❤️ by the SmoothSend team