@smoothsend/sdk 1.0.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/LICENSE +22 -0
- package/README.md +346 -0
- package/dist/adapters/aptos.d.ts +98 -0
- package/dist/adapters/aptos.d.ts.map +1 -0
- package/dist/core/SmoothSendSDK.d.ts +261 -0
- package/dist/core/SmoothSendSDK.d.ts.map +1 -0
- package/dist/index.d.ts +2072 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2076 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2097 -0
- package/dist/index.js.map +1 -0
- package/dist/script-composer/ScriptComposerClient.d.ts +263 -0
- package/dist/script-composer/ScriptComposerClient.d.ts.map +1 -0
- package/dist/script-composer/index.d.ts +42 -0
- package/dist/script-composer/index.d.ts.map +1 -0
- package/dist/shared-constants.d.ts +103 -0
- package/dist/shared-constants.d.ts.map +1 -0
- package/dist/types/errors.d.ts +216 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +939 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/http.d.ts +77 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/wallet-adapter/SmoothSendTransactionSubmitter.d.ts +179 -0
- package/dist/wallet-adapter/SmoothSendTransactionSubmitter.d.ts.map +1 -0
- package/dist/wallet-adapter/index.d.ts +20 -0
- package/dist/wallet-adapter/index.d.ts.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SmoothSend
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# SmoothSend SDK
|
|
2
|
+
|
|
3
|
+
Gasless transaction SDK for Aptos. Enable gas-free transactions with just 3 lines of code.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@smoothsend/sdk)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
## 🚀 Features
|
|
10
|
+
|
|
11
|
+
- **Gasless Transactions**: Users don't need APT for gas fees
|
|
12
|
+
- **3-Line Integration**: Works with Aptos Wallet Adapter out of the box
|
|
13
|
+
- **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)
|
|
16
|
+
|
|
17
|
+
## 📦 Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @smoothsend/sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ⚡ Quick Start - Wallet Adapter (EASIEST - 3 Lines!)
|
|
24
|
+
|
|
25
|
+
The easiest way to integrate SmoothSend is using the Wallet Adapter integration. Just add 3 lines of code and ALL your transactions become gasless automatically!
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
|
|
29
|
+
import { AptosWalletAdapterProvider } from '@aptos-labs/wallet-adapter-react';
|
|
30
|
+
import { Network } from '@aptos-labs/ts-sdk';
|
|
31
|
+
|
|
32
|
+
// 1. Create the transaction submitter (one line!)
|
|
33
|
+
const transactionSubmitter = new SmoothSendTransactionSubmitter({
|
|
34
|
+
apiKey: 'pk_nogas_your_api_key_here',
|
|
35
|
+
network: 'testnet'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// 2. Add to your wallet provider
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<AptosWalletAdapterProvider
|
|
42
|
+
dappConfig={{
|
|
43
|
+
network: Network.TESTNET,
|
|
44
|
+
transactionSubmitter: transactionSubmitter // <-- That's it!
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<YourApp />
|
|
48
|
+
</AptosWalletAdapterProvider>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 3. Use normal wallet functions - they're now gasless!
|
|
53
|
+
function TransferButton() {
|
|
54
|
+
const { signAndSubmitTransaction } = useWallet();
|
|
55
|
+
|
|
56
|
+
const handleTransfer = async () => {
|
|
57
|
+
// This is now gasless! No code changes needed!
|
|
58
|
+
const result = await signAndSubmitTransaction({
|
|
59
|
+
data: {
|
|
60
|
+
function: "0x1::coin::transfer",
|
|
61
|
+
typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
62
|
+
functionArguments: [recipientAddress, amount],
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
console.log('Gasless transaction:', result.hash);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return <button onClick={handleTransfer}>Send (Gasless!)</button>;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**That's it!** All transactions in your app are now gasless. Users don't need APT for gas fees!
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 💰 Script Composer - Fee-in-Token Transfers
|
|
77
|
+
|
|
78
|
+
For **mainnet with free tier**, use Script Composer to deduct fees from the token being transferred:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { ScriptComposerClient } from '@smoothsend/sdk';
|
|
82
|
+
|
|
83
|
+
// Create client for mainnet
|
|
84
|
+
const client = new ScriptComposerClient({
|
|
85
|
+
apiKey: 'pk_nogas_your_api_key',
|
|
86
|
+
network: 'mainnet'
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Step 1: Build transfer (fee calculated automatically)
|
|
90
|
+
const { transactionBytes, fee, totalAmount } = await client.buildTransfer({
|
|
91
|
+
sender: wallet.address,
|
|
92
|
+
recipient: '0x123...',
|
|
93
|
+
amount: '1000000', // 1 USDC
|
|
94
|
+
assetType: '0xf22bede...::usdc::USDC',
|
|
95
|
+
decimals: 6,
|
|
96
|
+
symbol: 'USDC'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
console.log(`Sending 1 USDC, fee: ${fee} (deducted from token)`);
|
|
100
|
+
|
|
101
|
+
// Step 2: Sign with wallet
|
|
102
|
+
const signedTx = await wallet.signTransaction(transactionBytes);
|
|
103
|
+
|
|
104
|
+
// Step 3: Submit
|
|
105
|
+
const result = await client.submitSignedTransaction({
|
|
106
|
+
transactionBytes: signedTx.transactionBytes,
|
|
107
|
+
authenticatorBytes: signedTx.authenticatorBytes
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
console.log('Transaction:', result.txHash);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### When to Use Each Method
|
|
114
|
+
|
|
115
|
+
| Scenario | Method | Why |
|
|
116
|
+
|----------|--------|-----|
|
|
117
|
+
| **Testnet (any tier)** | TransactionSubmitter | Always free on testnet |
|
|
118
|
+
| **Mainnet + Free tier** | ScriptComposerClient | Fee deducted from token ($0.01/tx) |
|
|
119
|
+
| **Mainnet + Paid tier** | TransactionSubmitter | Zero fees included in subscription |
|
|
120
|
+
| **Swaps, NFTs, contracts** | TransactionSubmitter | Script Composer only supports transfers |
|
|
121
|
+
| **Token transfers (monetize)** | ScriptComposerClient | Pass fee to users |
|
|
122
|
+
|
|
123
|
+
### Script Composer Methods
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Estimate fee without building transaction
|
|
127
|
+
const estimate = await client.estimateFee({
|
|
128
|
+
sender: '0x...',
|
|
129
|
+
recipient: '0x...',
|
|
130
|
+
amount: '1000000',
|
|
131
|
+
assetType: USDC_ADDRESS,
|
|
132
|
+
decimals: 6,
|
|
133
|
+
symbol: 'USDC'
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
console.log('Fee:', estimate.estimation.formatted.fee);
|
|
137
|
+
console.log('Total:', estimate.estimation.formatted.totalAmount);
|
|
138
|
+
|
|
139
|
+
// Or use the convenience method for complete flow
|
|
140
|
+
const result = await client.transfer(transferParams, wallet);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## ⚠️ Important Security Update
|
|
146
|
+
|
|
147
|
+
**For Aptos transactions**, the SDK uses a **secure serialized transaction approach** that requires proper wallet integration using the Aptos Wallet Standard.
|
|
148
|
+
|
|
149
|
+
See the [Wallet Adapter Integration](#-quick-start---wallet-adapter-easiest---3-lines) section for the recommended implementation.
|
|
150
|
+
|
|
151
|
+
## 🔑 Authentication
|
|
152
|
+
|
|
153
|
+
SmoothSend uses API keys for authentication. There are two types of keys:
|
|
154
|
+
|
|
155
|
+
### Public Keys (`pk_nogas_*`)
|
|
156
|
+
- **Safe for frontend applications** - Can be embedded in client-side code
|
|
157
|
+
- **CORS-protected** - Only work from configured domains
|
|
158
|
+
- **Use in**: React apps, Vue apps, browser extensions, mobile apps
|
|
159
|
+
|
|
160
|
+
### Secret Keys (`sk_nogas_*`)
|
|
161
|
+
- **Server-side only** - Must never be exposed in client-side code
|
|
162
|
+
- **No CORS restrictions** - Work from any server environment
|
|
163
|
+
- **Use in**: Node.js backends, serverless functions, API servers
|
|
164
|
+
|
|
165
|
+
### Getting Your API Keys
|
|
166
|
+
|
|
167
|
+
1. Sign up at [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
|
|
168
|
+
2. Create a project
|
|
169
|
+
3. Generate an API key pair - you'll receive both a public and secret key
|
|
170
|
+
4. Configure CORS origins for your public key
|
|
171
|
+
|
|
172
|
+
### Security Best Practices
|
|
173
|
+
|
|
174
|
+
⚠️ **Never commit secret keys to version control**
|
|
175
|
+
⚠️ **Never expose secret keys in client-side code**
|
|
176
|
+
✅ **Use public keys for frontend applications**
|
|
177
|
+
✅ **Use secret keys for backend services**
|
|
178
|
+
✅ **Configure CORS origins for production domains**
|
|
179
|
+
|
|
180
|
+
## 🏁 Classic SDK Usage
|
|
181
|
+
|
|
182
|
+
If you prefer more control over the transaction flow, you can use the classic SDK approach:
|
|
183
|
+
|
|
184
|
+
### Frontend Example (Public Key)
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { SmoothSendSDK } from '@smoothsend/sdk';
|
|
188
|
+
|
|
189
|
+
// Initialize with public key (safe for frontend)
|
|
190
|
+
const smoothSend = new SmoothSendSDK({
|
|
191
|
+
apiKey: 'pk_nogas_your_public_key_here',
|
|
192
|
+
network: 'testnet',
|
|
193
|
+
timeout: 30000,
|
|
194
|
+
retries: 3
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// Create a transfer request
|
|
198
|
+
const transferRequest = {
|
|
199
|
+
from: '0x742d35cc6634c0532925a3b8d2d2d2d2d2d2d2d2',
|
|
200
|
+
to: '0x742d35cc6634c0532925a3b8d2d2d2d2d2d2d2d3',
|
|
201
|
+
token: 'USDC',
|
|
202
|
+
amount: '1000000', // 1 USDC (6 decimals)
|
|
203
|
+
chain: 'aptos-testnet' as const
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Execute transfer (with wallet signer)
|
|
207
|
+
try {
|
|
208
|
+
const result = await smoothSend.transfer(transferRequest, walletSigner);
|
|
209
|
+
console.log('Transfer successful:', result.txHash);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error('Transfer failed:', error.message);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Backend Example (Secret Key)
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { SmoothSendSDK } from '@smoothsend/sdk';
|
|
219
|
+
|
|
220
|
+
// Initialize with secret key (server-side only)
|
|
221
|
+
const smoothSend = new SmoothSendSDK({
|
|
222
|
+
apiKey: 'sk_nogas_your_secret_key_here',
|
|
223
|
+
network: 'mainnet',
|
|
224
|
+
timeout: 30000,
|
|
225
|
+
retries: 3
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Execute transfer from backend
|
|
229
|
+
const result = await smoothSend.executeGaslessTransfer({
|
|
230
|
+
transactionBytes: signedTx.transactionBytes,
|
|
231
|
+
authenticatorBytes: signedTx.authenticatorBytes,
|
|
232
|
+
chain: 'aptos-mainnet',
|
|
233
|
+
network: 'mainnet'
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
console.log('Transfer successful:', result.txHash);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 🔧 Supported Networks
|
|
240
|
+
|
|
241
|
+
| Network | Status | Features |
|
|
242
|
+
|---------|--------|----------|
|
|
243
|
+
| Aptos Testnet | ✅ Active | Gasless transactions, Ed25519 signatures |
|
|
244
|
+
| Aptos Mainnet | ✅ Active | Gasless transactions, Fee-in-token option |
|
|
245
|
+
|
|
246
|
+
## 📚 API Reference
|
|
247
|
+
|
|
248
|
+
### SmoothSendTransactionSubmitter
|
|
249
|
+
|
|
250
|
+
The recommended way to integrate - works with Aptos Wallet Adapter.
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import { SmoothSendTransactionSubmitter } from '@smoothsend/sdk';
|
|
254
|
+
|
|
255
|
+
const submitter = new SmoothSendTransactionSubmitter({
|
|
256
|
+
apiKey: 'pk_nogas_your_api_key',
|
|
257
|
+
network: 'testnet' // or 'mainnet'
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// Pass to AptosWalletAdapterProvider
|
|
261
|
+
<AptosWalletAdapterProvider
|
|
262
|
+
dappConfig={{
|
|
263
|
+
network: Network.TESTNET,
|
|
264
|
+
transactionSubmitter: submitter
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### ScriptComposerClient
|
|
270
|
+
|
|
271
|
+
For mainnet transfers with fee-in-token (fee deducted from transferred amount).
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { ScriptComposerClient } from '@smoothsend/sdk';
|
|
275
|
+
|
|
276
|
+
const client = new ScriptComposerClient({
|
|
277
|
+
apiKey: 'pk_nogas_your_api_key',
|
|
278
|
+
network: 'mainnet'
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Build transfer
|
|
282
|
+
const { transactionBytes, fee } = await client.buildTransfer({
|
|
283
|
+
sender: '0x...',
|
|
284
|
+
recipient: '0x...',
|
|
285
|
+
amount: '1000000',
|
|
286
|
+
assetType: USDC_ADDRESS,
|
|
287
|
+
decimals: 6,
|
|
288
|
+
symbol: 'USDC'
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// Estimate fee
|
|
292
|
+
const estimate = await client.estimateFee(transferParams);
|
|
293
|
+
|
|
294
|
+
// Submit signed transaction
|
|
295
|
+
const result = await client.submitSignedTransaction({
|
|
296
|
+
transactionBytes,
|
|
297
|
+
authenticatorBytes
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### SmoothSendSDK (Classic)
|
|
302
|
+
|
|
303
|
+
Direct SDK usage for more control.
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
import { SmoothSendSDK } from '@smoothsend/sdk';
|
|
307
|
+
|
|
308
|
+
const smoothSend = new SmoothSendSDK({
|
|
309
|
+
apiKey: 'pk_nogas_your_api_key',
|
|
310
|
+
network: 'testnet',
|
|
311
|
+
timeout: 30000,
|
|
312
|
+
retries: 3
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Execute gasless transfer
|
|
316
|
+
const result = await smoothSend.executeGaslessTransfer({
|
|
317
|
+
transactionBytes: signedTx.transactionBytes,
|
|
318
|
+
authenticatorBytes: signedTx.authenticatorBytes,
|
|
319
|
+
chain: 'aptos-testnet',
|
|
320
|
+
network: 'testnet'
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## 🔐 Security
|
|
325
|
+
|
|
326
|
+
- All transactions require user signature approval
|
|
327
|
+
- Private keys never leave the client
|
|
328
|
+
- Rate limiting and validation on relayer endpoints
|
|
329
|
+
- Comprehensive input validation
|
|
330
|
+
- Public keys are CORS-protected (safe for frontend)
|
|
331
|
+
- Secret keys for backend only
|
|
332
|
+
|
|
333
|
+
## 🔗 Links
|
|
334
|
+
|
|
335
|
+
- **Dashboard**: [dashboard.smoothsend.xyz](https://dashboard.smoothsend.xyz)
|
|
336
|
+
- **Documentation**: [docs.smoothsend.xyz](https://docs.smoothsend.xyz)
|
|
337
|
+
- **GitHub**: [github.com/smoothsend](https://github.com/smoothsend)
|
|
338
|
+
|
|
339
|
+
## 📄 License
|
|
340
|
+
|
|
341
|
+
MIT
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
Built with ❤️ by the SmoothSend team
|
|
346
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { SupportedChain, IChainAdapter, ChainConfig, TransferRequest, TransferQuote, SignatureData, SignedTransferData, TransferResult, TokenBalance, TokenInfo, FeeEstimate, HealthResponse } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Aptos Multi-Chain Adapter - v2 Proxy Architecture
|
|
4
|
+
* Handles all Aptos chains (aptos-testnet, aptos-mainnet)
|
|
5
|
+
* Routes all requests through proxy.smoothsend.xyz with API key authentication
|
|
6
|
+
* Supports Aptos-specific features like gasless transactions and Move-based contracts
|
|
7
|
+
*/
|
|
8
|
+
export declare class AptosAdapter implements IChainAdapter {
|
|
9
|
+
readonly chain: SupportedChain;
|
|
10
|
+
readonly config: ChainConfig;
|
|
11
|
+
private httpClient;
|
|
12
|
+
private apiKey;
|
|
13
|
+
private network;
|
|
14
|
+
constructor(chain: SupportedChain, config: ChainConfig, apiKey: string, network?: 'testnet' | 'mainnet', includeOrigin?: boolean);
|
|
15
|
+
/**
|
|
16
|
+
* Build API path for proxy worker routing to Aptos relayer
|
|
17
|
+
* All requests route through /api/v1/relayer/aptos/* endpoints
|
|
18
|
+
*/
|
|
19
|
+
private getApiPath;
|
|
20
|
+
/**
|
|
21
|
+
* Update network parameter for subsequent requests
|
|
22
|
+
* Network is passed via X-Network header to proxy worker
|
|
23
|
+
*/
|
|
24
|
+
setNetwork(network: 'testnet' | 'mainnet'): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get current network
|
|
27
|
+
*/
|
|
28
|
+
getNetwork(): 'testnet' | 'mainnet';
|
|
29
|
+
/**
|
|
30
|
+
* Estimate fee for a transfer (v2 interface method)
|
|
31
|
+
* Routes through proxy: POST /api/v1/relayer/aptos/quote
|
|
32
|
+
*/
|
|
33
|
+
estimateFee(request: TransferRequest): Promise<FeeEstimate>;
|
|
34
|
+
/**
|
|
35
|
+
* Execute gasless transfer (v2 interface method)
|
|
36
|
+
* Routes through proxy: POST /api/v1/relayer/aptos/execute
|
|
37
|
+
*/
|
|
38
|
+
executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Get quote for a transfer (legacy method, kept for backward compatibility)
|
|
41
|
+
* Routes through proxy: POST /api/v1/relayer/aptos/quote
|
|
42
|
+
*/
|
|
43
|
+
getQuote(request: TransferRequest): Promise<TransferQuote>;
|
|
44
|
+
prepareTransfer(request: TransferRequest, quote: TransferQuote): Promise<SignatureData>;
|
|
45
|
+
executeTransfer(signedData: SignedTransferData): Promise<TransferResult>;
|
|
46
|
+
getBalance(address: string, token?: string): Promise<TokenBalance[]>;
|
|
47
|
+
getTokenInfo(token: string): Promise<TokenInfo>;
|
|
48
|
+
getNonce(address: string): Promise<string>;
|
|
49
|
+
getTransactionStatus(txHash: string): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Get health status of Aptos relayer through proxy
|
|
52
|
+
* Routes through proxy: GET /api/v1/relayer/aptos/health
|
|
53
|
+
*/
|
|
54
|
+
getHealth(): Promise<HealthResponse>;
|
|
55
|
+
validateAddress(address: string): boolean;
|
|
56
|
+
validateAmount(amount: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get Aptos token address from symbol
|
|
59
|
+
*/
|
|
60
|
+
private getAptosTokenAddress;
|
|
61
|
+
/**
|
|
62
|
+
* Build Aptos explorer URL for transaction
|
|
63
|
+
*/
|
|
64
|
+
private buildAptosExplorerUrl;
|
|
65
|
+
/**
|
|
66
|
+
* Validate serialized transaction data for proxy worker
|
|
67
|
+
* @param signedData The signed transfer data to validate
|
|
68
|
+
*/
|
|
69
|
+
private validateSerializedTransactionData;
|
|
70
|
+
/**
|
|
71
|
+
* Enhanced address validation with detailed error messages
|
|
72
|
+
* @param address The address to validate
|
|
73
|
+
* @returns true if valid, throws error if invalid
|
|
74
|
+
*/
|
|
75
|
+
validateAddressStrict(address: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Verify that a public key corresponds to an expected address
|
|
78
|
+
* This mirrors the enhanced verification in the relayer
|
|
79
|
+
* @param publicKey The public key to verify
|
|
80
|
+
* @param expectedAddress The expected address
|
|
81
|
+
* @returns true if they match
|
|
82
|
+
*/
|
|
83
|
+
verifyPublicKeyAddress(publicKey: string, expectedAddress: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Enhanced transaction preparation with better signature data structure
|
|
86
|
+
* @param request Transfer request
|
|
87
|
+
* @param quote Transfer quote
|
|
88
|
+
* @returns Signature data with enhanced structure
|
|
89
|
+
*/
|
|
90
|
+
prepareTransferEnhanced(request: TransferRequest, quote: TransferQuote): Promise<SignatureData & {
|
|
91
|
+
metadata: any;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Aptos-specific Move contract interaction
|
|
95
|
+
*/
|
|
96
|
+
callMoveFunction(functionName: string, args: any[]): Promise<any>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=aptos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aptos.d.ts","sourceRoot":"","sources":["../../src/adapters/aptos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,cAAc,EAKf,MAAM,UAAU,CAAC;AAGlB;;;;;GAKG;AACH,qBAAa,YAAa,YAAW,aAAa;IAChD,SAAgB,KAAK,EAAE,cAAc,CAAC;IACtC,SAAgB,MAAM,EAAE,WAAW,CAAC;IACpC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,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;IA2BhC;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI;IAKhD;;OAEG;IACH,UAAU,IAAI,SAAS,GAAG,SAAS;IAInC;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAuCjE;;;OAGG;IACG,sBAAsB,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAIrF;;;OAGG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAqC1D,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IA+BvF,eAAe,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAoDxE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA6BpE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAiC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBxD;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC;IA8B1C,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAMzC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IASvC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAQ7B;;;OAGG;IACH,OAAO,CAAC,iCAAiC;IA0CzC;;;;OAIG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAuB/C;;;;;;OAMG;IACG,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB1F;;;;;OAKG;IACG,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE,CAAC;IAmBzH;;OAEG;IACG,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CAuBxE"}
|