@smoothsend/sdk 1.0.2 → 1.1.0
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/README.md +45 -8
- package/dist/adapters/stellar.d.ts +28 -0
- package/dist/adapters/stellar.d.ts.map +1 -0
- package/dist/core/SmoothSendSDK.d.ts +16 -17
- package/dist/core/SmoothSendSDK.d.ts.map +1 -1
- package/dist/index.d.ts +100 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +208 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +209 -45
- package/dist/index.js.map +1 -1
- package/dist/shared-constants.d.ts +17 -9
- package/dist/shared-constants.d.ts.map +1 -1
- package/dist/types/index.d.ts +46 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SmoothSend SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multi-chain gasless transaction SDK. Enable gas-free transactions with just 3 lines of code. Supports **Aptos** and **Stellar**.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@smoothsend/sdk)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
@@ -8,11 +8,12 @@ Gasless transaction SDK for Aptos. Enable gas-free transactions with just 3 line
|
|
|
8
8
|
|
|
9
9
|
## 🚀 Features
|
|
10
10
|
|
|
11
|
-
- **Gasless Transactions**: Users don't need APT for gas fees
|
|
12
|
-
- **
|
|
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.)
|
|
13
14
|
- **Type-Safe**: Full TypeScript support with comprehensive type definitions
|
|
14
|
-
- **Testnet & Mainnet**: Supports both networks
|
|
15
|
-
- **Fee-in-Token**: On mainnet, tiny fee deducted from token (not APT)
|
|
15
|
+
- **Testnet & Mainnet**: Supports both networks on each chain
|
|
16
|
+
- **Fee-in-Token**: On Aptos mainnet, tiny fee deducted from token (not APT)
|
|
16
17
|
|
|
17
18
|
## 📦 Installation
|
|
18
19
|
|
|
@@ -225,7 +226,7 @@ const smoothSend = new SmoothSendSDK({
|
|
|
225
226
|
retries: 3
|
|
226
227
|
});
|
|
227
228
|
|
|
228
|
-
// Execute transfer from backend
|
|
229
|
+
// Execute Aptos transfer from backend
|
|
229
230
|
const result = await smoothSend.executeGaslessTransfer({
|
|
230
231
|
transactionBytes: signedTx.transactionBytes,
|
|
231
232
|
authenticatorBytes: signedTx.authenticatorBytes,
|
|
@@ -233,15 +234,48 @@ const result = await smoothSend.executeGaslessTransfer({
|
|
|
233
234
|
network: 'mainnet'
|
|
234
235
|
});
|
|
235
236
|
|
|
237
|
+
// Or Stellar - submit signed XDR
|
|
238
|
+
const stellarResult = await smoothSend.submitStellarTransaction(signedXdr);
|
|
239
|
+
|
|
236
240
|
console.log('Transfer successful:', result.txHash);
|
|
237
241
|
```
|
|
238
242
|
|
|
243
|
+
## ⭐ Stellar - Gasless XLM & USDC
|
|
244
|
+
|
|
245
|
+
Same 3-line API for Stellar. Use with Freighter, Stellar Wallets Kit, or any Stellar-compatible wallet.
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
import { SmoothSendSDK } from '@smoothsend/sdk';
|
|
249
|
+
|
|
250
|
+
const sdk = new SmoothSendSDK({ apiKey: 'pk_nogas_xxx', network: 'testnet' });
|
|
251
|
+
|
|
252
|
+
// Option 1: Full transfer (build + sign + submit)
|
|
253
|
+
const result = await sdk.transfer(
|
|
254
|
+
{ from: 'G...', to: 'G...', amount: '100', token: 'XLM', chain: 'stellar-testnet' },
|
|
255
|
+
stellarWallet
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
// Option 2: Submit pre-signed XDR
|
|
259
|
+
const signedXdr = await wallet.signTransaction(tx);
|
|
260
|
+
const result = await sdk.submitStellarTransaction(signedXdr);
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Stellar wallet interface:**
|
|
264
|
+
```typescript
|
|
265
|
+
const stellarWallet = {
|
|
266
|
+
buildTransaction: (params) => buildPaymentTransaction(params.from, params.to, params.amount, params.token),
|
|
267
|
+
signTransaction: (tx) => walletKit.signTransaction(tx.toXDR()).then(r => r.signedTxXdr),
|
|
268
|
+
};
|
|
269
|
+
```
|
|
270
|
+
|
|
239
271
|
## 🔧 Supported Networks
|
|
240
272
|
|
|
241
273
|
| Network | Status | Features |
|
|
242
274
|
|---------|--------|----------|
|
|
243
275
|
| Aptos Testnet | ✅ Active | Gasless transactions, Ed25519 signatures |
|
|
244
276
|
| Aptos Mainnet | ✅ Active | Gasless transactions, Fee-in-token option |
|
|
277
|
+
| Stellar Testnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
|
|
278
|
+
| Stellar Mainnet | ✅ Active | Gasless XLM, USDC, EURC via Fee Bump |
|
|
245
279
|
|
|
246
280
|
## 📚 API Reference
|
|
247
281
|
|
|
@@ -300,7 +334,7 @@ const result = await client.submitSignedTransaction({
|
|
|
300
334
|
|
|
301
335
|
### SmoothSendSDK (Classic)
|
|
302
336
|
|
|
303
|
-
Direct SDK usage for more control.
|
|
337
|
+
Direct SDK usage for more control. Works for both Aptos and Stellar.
|
|
304
338
|
|
|
305
339
|
```typescript
|
|
306
340
|
import { SmoothSendSDK } from '@smoothsend/sdk';
|
|
@@ -312,13 +346,16 @@ const smoothSend = new SmoothSendSDK({
|
|
|
312
346
|
retries: 3
|
|
313
347
|
});
|
|
314
348
|
|
|
315
|
-
//
|
|
349
|
+
// Aptos - execute gasless transfer
|
|
316
350
|
const result = await smoothSend.executeGaslessTransfer({
|
|
317
351
|
transactionBytes: signedTx.transactionBytes,
|
|
318
352
|
authenticatorBytes: signedTx.authenticatorBytes,
|
|
319
353
|
chain: 'aptos-testnet',
|
|
320
354
|
network: 'testnet'
|
|
321
355
|
});
|
|
356
|
+
|
|
357
|
+
// Stellar - submit signed XDR
|
|
358
|
+
const stellarResult = await smoothSend.submitStellarTransaction(signedXdr);
|
|
322
359
|
```
|
|
323
360
|
|
|
324
361
|
## 🔐 Security
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SupportedChain, IChainAdapter, ChainConfig, TransferRequest, FeeEstimate, SignedTransferData, TransferResult, HealthResponse } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Stellar Adapter - Gasless transactions via Fee Bump
|
|
4
|
+
* Routes through proxy.smoothsend.xyz with API key authentication
|
|
5
|
+
* Supports XLM, USDC, EURC and other Stellar assets
|
|
6
|
+
*/
|
|
7
|
+
export declare class StellarAdapter implements IChainAdapter {
|
|
8
|
+
readonly chain: SupportedChain;
|
|
9
|
+
readonly config: ChainConfig;
|
|
10
|
+
private httpClient;
|
|
11
|
+
private network;
|
|
12
|
+
constructor(chain: SupportedChain, config: ChainConfig, apiKey: string, network?: 'testnet' | 'mainnet', includeOrigin?: boolean);
|
|
13
|
+
setNetwork(network: 'testnet' | 'mainnet'): void;
|
|
14
|
+
getNetwork(): 'testnet' | 'mainnet';
|
|
15
|
+
/**
|
|
16
|
+
* Stellar gasless: relayer pays fee. Returns 0 for user.
|
|
17
|
+
*/
|
|
18
|
+
estimateFee(_request: TransferRequest): Promise<FeeEstimate>;
|
|
19
|
+
/**
|
|
20
|
+
* Submit signed XDR to relayer for Fee Bump wrapping
|
|
21
|
+
*/
|
|
22
|
+
executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
23
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
24
|
+
getHealth(): Promise<HealthResponse>;
|
|
25
|
+
validateAddress(address: string): boolean;
|
|
26
|
+
validateAmount(amount: string): boolean;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=stellar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stellar.d.ts","sourceRoot":"","sources":["../../src/adapters/stellar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,cAAc,EAKf,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,qBAAa,cAAe,YAAW,aAAa;IAClD,SAAgB,KAAK,EAAE,cAAc,CAAC;IACtC,SAAgB,MAAM,EAAE,WAAW,CAAC;IACpC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,OAAO,CAAwB;gBAGrC,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,SAAS,GAAG,SAAqB,EAC1C,aAAa,GAAE,OAAe;IAwBhC,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI;IAKhD,UAAU,IAAI,SAAS,GAAG,SAAS;IAInC;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAUlE;;OAEG;IACG,sBAAsB,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IA4C/E,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkBlD,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC;IAuB1C,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIzC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAQxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SupportedChain, ChainEcosystem, TransferRequest, SignedTransferData, TransferResult, SmoothSendConfig, EventListener, HealthResponse, FeeEstimate, UsageMetadata } from '../types';
|
|
1
|
+
import { SupportedChain, ChainEcosystem, TransferRequest, SignedTransferData, TransferResult, SmoothSendConfig, EventListener, HealthResponse, FeeEstimate, UsageMetadata, AptosWallet, StellarWallet } from '../types';
|
|
2
2
|
export declare class SmoothSendSDK {
|
|
3
3
|
private adapters;
|
|
4
4
|
private eventListeners;
|
|
@@ -36,30 +36,29 @@ export declare class SmoothSendSDK {
|
|
|
36
36
|
estimateFee(request: TransferRequest): Promise<FeeEstimate & {
|
|
37
37
|
metadata?: UsageMetadata;
|
|
38
38
|
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Submit a signed Stellar transaction (XDR) for gasless relay.
|
|
41
|
+
* Use when you've already built and signed the transaction.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const signedXdr = await stellarWallet.signTransaction(tx);
|
|
45
|
+
* const result = await sdk.submitStellarTransaction(signedXdr);
|
|
46
|
+
*/
|
|
47
|
+
submitStellarTransaction(signedXdr: string): Promise<TransferResult>;
|
|
39
48
|
executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
40
49
|
/**
|
|
41
50
|
* Convenience method for complete transfer flow
|
|
42
|
-
*
|
|
51
|
+
* Works for both Aptos and Stellar - same 3-line API.
|
|
43
52
|
*
|
|
44
53
|
* @param request Transfer request with from, to, token, amount, chain
|
|
45
|
-
* @param wallet
|
|
54
|
+
* @param wallet Aptos or Stellar wallet provider
|
|
46
55
|
* @returns Transfer result with transaction hash and usage metadata
|
|
47
56
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* - signTransaction(transaction): Sign and serialize transaction
|
|
51
|
-
*
|
|
52
|
-
* The wallet's signTransaction should return an object with:
|
|
53
|
-
* - transactionBytes: number[] - Serialized transaction
|
|
54
|
-
* - authenticatorBytes: number[] - Serialized authenticator
|
|
57
|
+
* Aptos wallet: signTransaction returns { transactionBytes, authenticatorBytes }
|
|
58
|
+
* Stellar wallet: signTransaction returns string (signed XDR)
|
|
55
59
|
*/
|
|
56
|
-
transfer(request: TransferRequest, wallet:
|
|
57
|
-
|
|
58
|
-
signTransaction: (transaction: any) => Promise<{
|
|
59
|
-
transactionBytes: number[];
|
|
60
|
-
authenticatorBytes: number[];
|
|
61
|
-
}>;
|
|
62
|
-
}): Promise<TransferResult>;
|
|
60
|
+
transfer(request: TransferRequest, wallet: AptosWallet | StellarWallet): Promise<TransferResult>;
|
|
61
|
+
private transferStellar;
|
|
63
62
|
/**
|
|
64
63
|
* Get transaction status for a specific transaction
|
|
65
64
|
* Routes through proxy to chain-specific status endpoint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmoothSendSDK.d.ts","sourceRoot":"","sources":["../../src/core/SmoothSendSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EAEd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAGhB,aAAa,EAEb,cAAc,EACd,WAAW,EACX,aAAa,EACd,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"SmoothSendSDK.d.ts","sourceRoot":"","sources":["../../src/core/SmoothSendSDK.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -225,15 +225,16 @@ declare function createNetworkError(error: any): NetworkError;
|
|
|
225
225
|
* - `aptos-testnet`: Aptos testnet
|
|
226
226
|
* - `aptos-mainnet`: Aptos mainnet
|
|
227
227
|
*/
|
|
228
|
-
type SupportedChain = 'avalanche' | 'aptos-testnet' | 'aptos-mainnet';
|
|
228
|
+
type SupportedChain = 'avalanche' | 'aptos-testnet' | 'aptos-mainnet' | 'stellar-testnet' | 'stellar-mainnet';
|
|
229
229
|
/**
|
|
230
230
|
* Chain ecosystem types for routing to correct relayers
|
|
231
231
|
*
|
|
232
232
|
* @remarks
|
|
233
233
|
* - `evm`: Ethereum Virtual Machine compatible chains (Avalanche, Base, Arbitrum, etc.)
|
|
234
234
|
* - `aptos`: Aptos blockchain ecosystem
|
|
235
|
+
* - `stellar`: Stellar blockchain ecosystem
|
|
235
236
|
*/
|
|
236
|
-
type ChainEcosystem = 'evm' | 'aptos';
|
|
237
|
+
type ChainEcosystem = 'evm' | 'aptos' | 'stellar';
|
|
237
238
|
/**
|
|
238
239
|
* Mapping of supported chains to their respective ecosystems
|
|
239
240
|
* Used internally for adapter selection and routing
|
|
@@ -621,9 +622,11 @@ interface SignatureData {
|
|
|
621
622
|
*/
|
|
622
623
|
interface SignedTransferData {
|
|
623
624
|
/** Serialized transaction (Aptos) */
|
|
624
|
-
transactionBytes
|
|
625
|
+
transactionBytes?: number[];
|
|
625
626
|
/** Serialized authenticator (Aptos) */
|
|
626
|
-
authenticatorBytes
|
|
627
|
+
authenticatorBytes?: number[];
|
|
628
|
+
/** Signed XDR transaction (Stellar) */
|
|
629
|
+
signedTransaction?: string;
|
|
627
630
|
/** Target blockchain */
|
|
628
631
|
chain: SupportedChain;
|
|
629
632
|
/** Optional network override (testnet or mainnet) */
|
|
@@ -878,6 +881,16 @@ declare const APTOS_ERROR_CODES: {
|
|
|
878
881
|
* Ensures type safety when using error codes
|
|
879
882
|
*/
|
|
880
883
|
type AptosErrorCode = typeof APTOS_ERROR_CODES[keyof typeof APTOS_ERROR_CODES];
|
|
884
|
+
/**
|
|
885
|
+
* Stellar adapter error codes
|
|
886
|
+
*/
|
|
887
|
+
declare const STELLAR_ERROR_CODES: {
|
|
888
|
+
readonly MISSING_SIGNED_TRANSACTION: "STELLAR_MISSING_SIGNED_TRANSACTION";
|
|
889
|
+
readonly GASLESS_TRANSACTION_ERROR: "STELLAR_GASLESS_TRANSACTION_ERROR";
|
|
890
|
+
readonly STATUS_ERROR: "STELLAR_STATUS_ERROR";
|
|
891
|
+
readonly HEALTH_ERROR: "STELLAR_HEALTH_ERROR";
|
|
892
|
+
readonly INVALID_ADDRESS_FORMAT: "STELLAR_INVALID_ADDRESS_FORMAT";
|
|
893
|
+
};
|
|
881
894
|
/**
|
|
882
895
|
* Generic API response structure
|
|
883
896
|
* Used for all API responses with optional data payload
|
|
@@ -982,6 +995,35 @@ interface UsageMetadata {
|
|
|
982
995
|
/** Unique request identifier for debugging */
|
|
983
996
|
requestId: string;
|
|
984
997
|
}
|
|
998
|
+
/**
|
|
999
|
+
* Aptos wallet interface for sdk.transfer()
|
|
1000
|
+
*/
|
|
1001
|
+
interface AptosWallet {
|
|
1002
|
+
buildTransaction: (params: {
|
|
1003
|
+
sender: string;
|
|
1004
|
+
recipient: string;
|
|
1005
|
+
amount: string;
|
|
1006
|
+
coinType: string;
|
|
1007
|
+
relayerFee: string;
|
|
1008
|
+
}) => Promise<any>;
|
|
1009
|
+
signTransaction: (transaction: any) => Promise<{
|
|
1010
|
+
transactionBytes: number[];
|
|
1011
|
+
authenticatorBytes: number[];
|
|
1012
|
+
}>;
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Stellar wallet interface for sdk.transfer()
|
|
1016
|
+
* Use with Freighter, Stellar Wallets Kit, or any Stellar-compatible wallet
|
|
1017
|
+
*/
|
|
1018
|
+
interface StellarWallet {
|
|
1019
|
+
buildTransaction: (params: {
|
|
1020
|
+
from: string;
|
|
1021
|
+
to: string;
|
|
1022
|
+
amount: string;
|
|
1023
|
+
token: string;
|
|
1024
|
+
}) => Promise<any>;
|
|
1025
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
1026
|
+
}
|
|
985
1027
|
/**
|
|
986
1028
|
* Transfer event types
|
|
987
1029
|
* Emitted during transfer lifecycle for monitoring and debugging
|
|
@@ -1192,30 +1234,29 @@ declare class SmoothSendSDK {
|
|
|
1192
1234
|
estimateFee(request: TransferRequest): Promise<FeeEstimate & {
|
|
1193
1235
|
metadata?: UsageMetadata;
|
|
1194
1236
|
}>;
|
|
1237
|
+
/**
|
|
1238
|
+
* Submit a signed Stellar transaction (XDR) for gasless relay.
|
|
1239
|
+
* Use when you've already built and signed the transaction.
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* const signedXdr = await stellarWallet.signTransaction(tx);
|
|
1243
|
+
* const result = await sdk.submitStellarTransaction(signedXdr);
|
|
1244
|
+
*/
|
|
1245
|
+
submitStellarTransaction(signedXdr: string): Promise<TransferResult>;
|
|
1195
1246
|
executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
1196
1247
|
/**
|
|
1197
1248
|
* Convenience method for complete transfer flow
|
|
1198
|
-
*
|
|
1249
|
+
* Works for both Aptos and Stellar - same 3-line API.
|
|
1199
1250
|
*
|
|
1200
1251
|
* @param request Transfer request with from, to, token, amount, chain
|
|
1201
|
-
* @param wallet
|
|
1252
|
+
* @param wallet Aptos or Stellar wallet provider
|
|
1202
1253
|
* @returns Transfer result with transaction hash and usage metadata
|
|
1203
1254
|
*
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1206
|
-
* - signTransaction(transaction): Sign and serialize transaction
|
|
1207
|
-
*
|
|
1208
|
-
* The wallet's signTransaction should return an object with:
|
|
1209
|
-
* - transactionBytes: number[] - Serialized transaction
|
|
1210
|
-
* - authenticatorBytes: number[] - Serialized authenticator
|
|
1255
|
+
* Aptos wallet: signTransaction returns { transactionBytes, authenticatorBytes }
|
|
1256
|
+
* Stellar wallet: signTransaction returns string (signed XDR)
|
|
1211
1257
|
*/
|
|
1212
|
-
transfer(request: TransferRequest, wallet:
|
|
1213
|
-
|
|
1214
|
-
signTransaction: (transaction: any) => Promise<{
|
|
1215
|
-
transactionBytes: number[];
|
|
1216
|
-
authenticatorBytes: number[];
|
|
1217
|
-
}>;
|
|
1218
|
-
}): Promise<TransferResult>;
|
|
1258
|
+
transfer(request: TransferRequest, wallet: AptosWallet | StellarWallet): Promise<TransferResult>;
|
|
1259
|
+
private transferStellar;
|
|
1219
1260
|
/**
|
|
1220
1261
|
* Get transaction status for a specific transaction
|
|
1221
1262
|
* Routes through proxy to chain-specific status endpoint
|
|
@@ -1898,6 +1939,33 @@ declare class AptosAdapter implements IChainAdapter {
|
|
|
1898
1939
|
callMoveFunction(functionName: string, args: any[]): Promise<any>;
|
|
1899
1940
|
}
|
|
1900
1941
|
|
|
1942
|
+
/**
|
|
1943
|
+
* Stellar Adapter - Gasless transactions via Fee Bump
|
|
1944
|
+
* Routes through proxy.smoothsend.xyz with API key authentication
|
|
1945
|
+
* Supports XLM, USDC, EURC and other Stellar assets
|
|
1946
|
+
*/
|
|
1947
|
+
declare class StellarAdapter implements IChainAdapter {
|
|
1948
|
+
readonly chain: SupportedChain;
|
|
1949
|
+
readonly config: ChainConfig;
|
|
1950
|
+
private httpClient;
|
|
1951
|
+
private network;
|
|
1952
|
+
constructor(chain: SupportedChain, config: ChainConfig, apiKey: string, network?: 'testnet' | 'mainnet', includeOrigin?: boolean);
|
|
1953
|
+
setNetwork(network: 'testnet' | 'mainnet'): void;
|
|
1954
|
+
getNetwork(): 'testnet' | 'mainnet';
|
|
1955
|
+
/**
|
|
1956
|
+
* Stellar gasless: relayer pays fee. Returns 0 for user.
|
|
1957
|
+
*/
|
|
1958
|
+
estimateFee(_request: TransferRequest): Promise<FeeEstimate>;
|
|
1959
|
+
/**
|
|
1960
|
+
* Submit signed XDR to relayer for Fee Bump wrapping
|
|
1961
|
+
*/
|
|
1962
|
+
executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
1963
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
1964
|
+
getHealth(): Promise<HealthResponse>;
|
|
1965
|
+
validateAddress(address: string): boolean;
|
|
1966
|
+
validateAmount(amount: string): boolean;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1901
1969
|
/**
|
|
1902
1970
|
* Configuration for HTTP client
|
|
1903
1971
|
*/
|
|
@@ -1986,24 +2054,17 @@ declare class HttpClient {
|
|
|
1986
2054
|
* @packageDocumentation
|
|
1987
2055
|
*
|
|
1988
2056
|
* @example
|
|
1989
|
-
*
|
|
2057
|
+
* Aptos:
|
|
1990
2058
|
* ```typescript
|
|
1991
|
-
*
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
* apiKey: 'no_gas_abc123...',
|
|
1995
|
-
* network: 'testnet'
|
|
1996
|
-
* });
|
|
1997
|
-
*
|
|
1998
|
-
* const result = await sdk.transfer({
|
|
1999
|
-
* from: '0x123...',
|
|
2000
|
-
* to: '0x456...',
|
|
2001
|
-
* token: 'USDC',
|
|
2002
|
-
* amount: '1000000',
|
|
2003
|
-
* chain: 'aptos-testnet'
|
|
2004
|
-
* }, wallet);
|
|
2059
|
+
* const sdk = new SmoothSendSDK({ apiKey: 'pk_nogas_xxx', network: 'testnet' });
|
|
2060
|
+
* const result = await sdk.transfer({ from, to, token: 'USDC', amount: '1000000', chain: 'aptos-testnet' }, aptosWallet);
|
|
2061
|
+
* ```
|
|
2005
2062
|
*
|
|
2006
|
-
*
|
|
2063
|
+
* @example
|
|
2064
|
+
* Stellar (same API):
|
|
2065
|
+
* ```typescript
|
|
2066
|
+
* const sdk = new SmoothSendSDK({ apiKey: 'pk_nogas_xxx', network: 'testnet' });
|
|
2067
|
+
* const result = await sdk.transfer({ from, to, token: 'XLM', amount: '100', chain: 'stellar-testnet' }, stellarWallet);
|
|
2007
2068
|
* ```
|
|
2008
2069
|
*/
|
|
2009
2070
|
|
|
@@ -2011,7 +2072,7 @@ declare class HttpClient {
|
|
|
2011
2072
|
* SDK version
|
|
2012
2073
|
* @public
|
|
2013
2074
|
*/
|
|
2014
|
-
declare const VERSION = "
|
|
2075
|
+
declare const VERSION = "1.1.0";
|
|
2015
2076
|
|
|
2016
|
-
export { APTOS_ERROR_CODES, AptosAdapter, AuthenticationError, CHAIN_ECOSYSTEM_MAP, HttpClient, NetworkError, RateLimitError, ScriptComposerClient, SmoothSendError, SmoothSendSDK, SmoothSendTransactionSubmitter, VERSION, ValidationError, createErrorFromResponse, createNetworkError, createScriptComposerClient, createSmoothSendSubmitter, SmoothSendSDK as default };
|
|
2017
|
-
export type { ApiResponse, AptosErrorCode, AptosTransferData, AvalancheTransferData, BatchRelayTransferRequest, BatchTransferRequest, BuildTransferParams, BuildTransferResult, ChainConfig, ChainEcosystem, ChainInfo, DomainSeparatorResponse, EVMTransferData, ErrorResponse, EstimateGasRequest, EventListener, FeeEstimate, FeeEstimateResult, GasEstimateResponse, HealthResponse, IChainAdapter, PermitData, PrepareSignatureRequest, PrepareSignatureResponse, RelayTransferRequest, RelayTransferResponse, ScriptComposerConfig, SignatureData, SignedTransferData, SmoothSendConfig, SmoothSendTransactionSubmitterConfig, SubmitSignedTransactionParams, SubmitTransactionResult, SuccessResponse, SupportedChain, TokenBalance, TokenInfo, TransactionSubmitter, TransferData, TransferEvent, TransferQuote, TransferQuoteRequest, TransferQuoteResponse, TransferRequest, TransferResult, TransferStatusResponse, UsageMetadata };
|
|
2077
|
+
export { APTOS_ERROR_CODES, AptosAdapter, AuthenticationError, CHAIN_ECOSYSTEM_MAP, HttpClient, NetworkError, RateLimitError, STELLAR_ERROR_CODES, ScriptComposerClient, SmoothSendError, SmoothSendSDK, SmoothSendTransactionSubmitter, StellarAdapter, VERSION, ValidationError, createErrorFromResponse, createNetworkError, createScriptComposerClient, createSmoothSendSubmitter, SmoothSendSDK as default };
|
|
2078
|
+
export type { ApiResponse, AptosErrorCode, AptosTransferData, AptosWallet, AvalancheTransferData, BatchRelayTransferRequest, BatchTransferRequest, BuildTransferParams, BuildTransferResult, ChainConfig, ChainEcosystem, ChainInfo, DomainSeparatorResponse, EVMTransferData, ErrorResponse, EstimateGasRequest, EventListener, FeeEstimate, FeeEstimateResult, GasEstimateResponse, HealthResponse, IChainAdapter, PermitData, PrepareSignatureRequest, PrepareSignatureResponse, RelayTransferRequest, RelayTransferResponse, ScriptComposerConfig, SignatureData, SignedTransferData, SmoothSendConfig, SmoothSendTransactionSubmitterConfig, StellarWallet, SubmitSignedTransactionParams, SubmitTransactionResult, SuccessResponse, SupportedChain, TokenBalance, TokenInfo, TransactionSubmitter, TransferData, TransferEvent, TransferQuote, TransferQuoteRequest, TransferQuoteResponse, TransferRequest, TransferResult, TransferStatusResponse, UsageMetadata };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,KAAK,oCAAoC,EACzC,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|