x402-engineer 0.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/AGENT.md +102 -0
- package/README.md +43 -0
- package/dist/cli.cjs +137 -0
- package/package.json +51 -0
- package/skills/stellar-dev/SKILL.md +146 -0
- package/skills/stellar-dev/advanced-patterns.md +188 -0
- package/skills/stellar-dev/api-rpc-horizon.md +521 -0
- package/skills/stellar-dev/common-pitfalls.md +510 -0
- package/skills/stellar-dev/contracts-soroban.md +565 -0
- package/skills/stellar-dev/ecosystem.md +430 -0
- package/skills/stellar-dev/frontend-stellar-sdk.md +651 -0
- package/skills/stellar-dev/resources.md +306 -0
- package/skills/stellar-dev/security.md +491 -0
- package/skills/stellar-dev/standards-reference.md +94 -0
- package/skills/stellar-dev/stellar-assets.md +419 -0
- package/skills/stellar-dev/testing.md +786 -0
- package/skills/stellar-dev/zk-proofs.md +136 -0
- package/skills/x402-add-paywall/SKILL.md +208 -0
- package/skills/x402-add-paywall/references/patterns.md +132 -0
- package/skills/x402-debug/SKILL.md +92 -0
- package/skills/x402-debug/references/checklist.md +146 -0
- package/skills/x402-explain/SKILL.md +136 -0
- package/skills/x402-init/SKILL.md +129 -0
- package/skills/x402-init/templates/env-example.md +17 -0
- package/skills/x402-init/templates/express/config.ts.md +29 -0
- package/skills/x402-init/templates/express/server.ts.md +30 -0
- package/skills/x402-init/templates/fastify/adapter.ts.md +66 -0
- package/skills/x402-init/templates/fastify/config.ts.md +29 -0
- package/skills/x402-init/templates/fastify/server.ts.md +90 -0
- package/skills/x402-init/templates/hono/config.ts.md +29 -0
- package/skills/x402-init/templates/hono/server.ts.md +31 -0
- package/skills/x402-init/templates/next-app-router/config.ts.md +29 -0
- package/skills/x402-init/templates/next-app-router/server.ts.md +31 -0
- package/skills/x402-stellar/SKILL.md +139 -0
- package/skills/x402-stellar/references/api.md +237 -0
- package/skills/x402-stellar/references/patterns.md +276 -0
- package/skills/x402-stellar/references/setup.md +138 -0
- package/skills/x402-stellar/scripts/check-deps.js +218 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
# Common Pitfalls and Solutions
|
|
2
|
+
|
|
3
|
+
## Soroban Contract Issues
|
|
4
|
+
|
|
5
|
+
### 1. Contract Size Exceeds 64KB Limit
|
|
6
|
+
|
|
7
|
+
**Problem**: Contract won't deploy because WASM exceeds size limit.
|
|
8
|
+
|
|
9
|
+
**Symptoms**:
|
|
10
|
+
```
|
|
11
|
+
Error: contract exceeds maximum size
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Solutions**:
|
|
15
|
+
|
|
16
|
+
```toml
|
|
17
|
+
# Cargo.toml - Use aggressive optimization
|
|
18
|
+
[profile.release]
|
|
19
|
+
opt-level = "z" # Optimize for size
|
|
20
|
+
lto = true # Link-time optimization
|
|
21
|
+
codegen-units = 1 # Single codegen unit
|
|
22
|
+
panic = "abort" # Smaller panic handling
|
|
23
|
+
strip = "symbols" # Remove symbols
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Additional strategies:
|
|
27
|
+
- Split large contracts into multiple smaller contracts
|
|
28
|
+
- Use `symbol_short!()` for symbols under 9 chars
|
|
29
|
+
- Avoid large static data in contract
|
|
30
|
+
- Remove debug code and unused functions
|
|
31
|
+
- Use `cargo bloat` to identify large dependencies
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Check contract size
|
|
35
|
+
ls -la target/wasm32-unknown-unknown/release/*.wasm
|
|
36
|
+
|
|
37
|
+
# Analyze what's taking space
|
|
38
|
+
cargo install cargo-bloat
|
|
39
|
+
cargo bloat --release --target wasm32-unknown-unknown
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### 2. `#![no_std]` Missing
|
|
45
|
+
|
|
46
|
+
**Problem**: Compilation fails with std library errors.
|
|
47
|
+
|
|
48
|
+
**Symptoms**:
|
|
49
|
+
```
|
|
50
|
+
error: cannot find macro `println` in this scope
|
|
51
|
+
error[E0433]: failed to resolve: use of undeclared crate or module `std`
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Solution**:
|
|
55
|
+
```rust
|
|
56
|
+
// MUST be first line of lib.rs
|
|
57
|
+
#![no_std]
|
|
58
|
+
|
|
59
|
+
use soroban_sdk::{contract, contractimpl, Env};
|
|
60
|
+
|
|
61
|
+
// Use soroban_sdk equivalents instead of std:
|
|
62
|
+
// - soroban_sdk::String instead of std::string::String
|
|
63
|
+
// - soroban_sdk::Vec instead of std::vec::Vec
|
|
64
|
+
// - soroban_sdk::Map instead of std::collections::HashMap
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### 3. Storage TTL Not Extended
|
|
70
|
+
|
|
71
|
+
**Problem**: Contract data gets archived and becomes inaccessible.
|
|
72
|
+
|
|
73
|
+
**Symptoms**:
|
|
74
|
+
- Contract calls fail after period of inactivity
|
|
75
|
+
- Data appears missing but contract still exists
|
|
76
|
+
|
|
77
|
+
**Solution**:
|
|
78
|
+
```rust
|
|
79
|
+
// Proactively extend TTL in operations that use data
|
|
80
|
+
pub fn use_data(env: Env) {
|
|
81
|
+
// Extend instance storage
|
|
82
|
+
env.storage().instance().extend_ttl(
|
|
83
|
+
50, // If TTL < 50, extend
|
|
84
|
+
518400, // Extend to ~30 days
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// Extend specific persistent keys
|
|
88
|
+
env.storage().persistent().extend_ttl(
|
|
89
|
+
&DataKey::ImportantData,
|
|
90
|
+
50,
|
|
91
|
+
518400,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// Now use the data...
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> See [contracts-soroban.md](contracts-soroban.md) for full TTL management patterns and storage type guidance.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### 4. Wrong Storage Type
|
|
103
|
+
|
|
104
|
+
**Problem**: Data unexpectedly deleted or costs too high.
|
|
105
|
+
|
|
106
|
+
**Symptoms**:
|
|
107
|
+
- Temporary data deleted before expected
|
|
108
|
+
- Unexpectedly high fees for storage
|
|
109
|
+
|
|
110
|
+
**Solution**:
|
|
111
|
+
```rust
|
|
112
|
+
// Instance: Shared config, survives with contract
|
|
113
|
+
env.storage().instance().set(&DataKey::Admin, &admin);
|
|
114
|
+
|
|
115
|
+
// Persistent: User data, can be archived but restored
|
|
116
|
+
env.storage().persistent().set(&DataKey::Balance(user), &balance);
|
|
117
|
+
|
|
118
|
+
// Temporary: Truly temporary, auto-deleted, cheapest
|
|
119
|
+
env.storage().temporary().set(&DataKey::Cache(key), &value);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### 5. Authorization Not Working
|
|
125
|
+
|
|
126
|
+
**Problem**: `require_auth()` not enforcing signatures in tests.
|
|
127
|
+
|
|
128
|
+
**Symptoms**:
|
|
129
|
+
- Tests pass but transactions fail on network
|
|
130
|
+
- Anyone can call protected functions
|
|
131
|
+
|
|
132
|
+
**Solution**:
|
|
133
|
+
```rust
|
|
134
|
+
#[test]
|
|
135
|
+
fn test_auth() {
|
|
136
|
+
let env = Env::default();
|
|
137
|
+
|
|
138
|
+
// DON'T just mock all auths blindly
|
|
139
|
+
// env.mock_all_auths(); // Be careful with this!
|
|
140
|
+
|
|
141
|
+
// DO test specific auth requirements with mock_auths()
|
|
142
|
+
env.mock_auths(&[MockAuth {
|
|
143
|
+
address: &user,
|
|
144
|
+
invoke: &MockAuthInvoke {
|
|
145
|
+
contract: &contract_id,
|
|
146
|
+
fn_name: "transfer",
|
|
147
|
+
args: (&user, &other, &100i128).into_val(&env),
|
|
148
|
+
sub_invokes: &[],
|
|
149
|
+
},
|
|
150
|
+
}]);
|
|
151
|
+
|
|
152
|
+
client.transfer(&user, &other, &100);
|
|
153
|
+
assert!(!env.auths().is_empty());
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> See [testing.md](testing.md) for comprehensive auth testing patterns including `mock_all_auths()`, specific auth mocking, and cross-contract auth.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## SDK Issues
|
|
162
|
+
|
|
163
|
+
### 6. Network Passphrase Mismatch
|
|
164
|
+
|
|
165
|
+
**Problem**: Transactions fail with signature errors.
|
|
166
|
+
|
|
167
|
+
**Symptoms**:
|
|
168
|
+
```
|
|
169
|
+
Error: tx_bad_auth
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Solution**:
|
|
173
|
+
```typescript
|
|
174
|
+
import * as StellarSdk from "@stellar/stellar-sdk";
|
|
175
|
+
|
|
176
|
+
// ALWAYS use correct passphrase for network
|
|
177
|
+
const PASSPHRASES = {
|
|
178
|
+
mainnet: StellarSdk.Networks.PUBLIC,
|
|
179
|
+
// "Public Global Stellar Network ; September 2015"
|
|
180
|
+
|
|
181
|
+
testnet: StellarSdk.Networks.TESTNET,
|
|
182
|
+
// "Test SDF Network ; September 2015"
|
|
183
|
+
|
|
184
|
+
local: "Standalone Network ; February 2017",
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// When building transactions
|
|
188
|
+
const tx = new StellarSdk.TransactionBuilder(account, {
|
|
189
|
+
fee: StellarSdk.BASE_FEE,
|
|
190
|
+
networkPassphrase: PASSPHRASES.testnet, // Match your network!
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### 7. Account Not Funded
|
|
197
|
+
|
|
198
|
+
**Problem**: Operations fail because account doesn't exist.
|
|
199
|
+
|
|
200
|
+
**Symptoms**:
|
|
201
|
+
```
|
|
202
|
+
Error: Account not found
|
|
203
|
+
Status: 404
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Solution**:
|
|
207
|
+
```typescript
|
|
208
|
+
// Testnet - use Friendbot
|
|
209
|
+
await fetch(`https://friendbot.stellar.org?addr=${publicKey}`);
|
|
210
|
+
|
|
211
|
+
// Mainnet - must receive XLM from existing account
|
|
212
|
+
const tx = new StellarSdk.TransactionBuilder(funderAccount, {
|
|
213
|
+
fee: StellarSdk.BASE_FEE,
|
|
214
|
+
networkPassphrase: StellarSdk.Networks.PUBLIC,
|
|
215
|
+
})
|
|
216
|
+
.addOperation(
|
|
217
|
+
StellarSdk.Operation.createAccount({
|
|
218
|
+
destination: newAccountPublicKey,
|
|
219
|
+
startingBalance: "2", // Minimum ~1 XLM for base reserve
|
|
220
|
+
})
|
|
221
|
+
)
|
|
222
|
+
.setTimeout(180)
|
|
223
|
+
.build();
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### 8. Missing Trustline
|
|
229
|
+
|
|
230
|
+
**Problem**: Payment fails for non-native assets.
|
|
231
|
+
|
|
232
|
+
**Symptoms**:
|
|
233
|
+
```
|
|
234
|
+
Error: op_no_trust
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Solution**:
|
|
238
|
+
```typescript
|
|
239
|
+
// Check if trustline exists
|
|
240
|
+
const account = await server.loadAccount(destination);
|
|
241
|
+
const hasTrustline = account.balances.some(
|
|
242
|
+
(b) =>
|
|
243
|
+
b.asset_type !== "native" &&
|
|
244
|
+
b.asset_code === asset.code &&
|
|
245
|
+
b.asset_issuer === asset.issuer
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
if (!hasTrustline) {
|
|
249
|
+
// Create trustline first
|
|
250
|
+
const trustTx = new StellarSdk.TransactionBuilder(destAccount, {
|
|
251
|
+
fee: StellarSdk.BASE_FEE,
|
|
252
|
+
networkPassphrase,
|
|
253
|
+
})
|
|
254
|
+
.addOperation(StellarSdk.Operation.changeTrust({ asset }))
|
|
255
|
+
.setTimeout(180)
|
|
256
|
+
.build();
|
|
257
|
+
// Sign and submit...
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### 9. Sequence Number Issues
|
|
264
|
+
|
|
265
|
+
**Problem**: Transaction rejected for sequence number.
|
|
266
|
+
|
|
267
|
+
**Symptoms**:
|
|
268
|
+
```
|
|
269
|
+
Error: tx_bad_seq
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Causes & Solutions**:
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
// Cause 1: Stale account data
|
|
276
|
+
// Solution: Always load fresh account before building tx
|
|
277
|
+
const account = await server.loadAccount(publicKey);
|
|
278
|
+
|
|
279
|
+
// Cause 2: Parallel transactions
|
|
280
|
+
// Solution: Use sequence number management
|
|
281
|
+
class SequenceManager {
|
|
282
|
+
private sequence: bigint;
|
|
283
|
+
|
|
284
|
+
async getNext(server: Horizon.Server, publicKey: string) {
|
|
285
|
+
if (!this.sequence) {
|
|
286
|
+
const account = await server.loadAccount(publicKey);
|
|
287
|
+
this.sequence = BigInt(account.sequence);
|
|
288
|
+
}
|
|
289
|
+
this.sequence++;
|
|
290
|
+
return this.sequence.toString();
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Cause 3: Transaction timeout without resubmit
|
|
295
|
+
// Solution: Rebuild with fresh sequence on timeout
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
### 10. Soroban Transaction Not Simulated
|
|
301
|
+
|
|
302
|
+
**Problem**: Soroban transaction fails with resource errors.
|
|
303
|
+
|
|
304
|
+
**Symptoms**:
|
|
305
|
+
```
|
|
306
|
+
Error: transaction simulation failed
|
|
307
|
+
Error: insufficient resources
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Solution**:
|
|
311
|
+
```typescript
|
|
312
|
+
// ALWAYS simulate before submitting Soroban transactions
|
|
313
|
+
const simulation = await rpc.simulateTransaction(transaction);
|
|
314
|
+
|
|
315
|
+
if (StellarSdk.rpc.Api.isSimulationError(simulation)) {
|
|
316
|
+
throw new Error(`Simulation failed: ${simulation.error}`);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Use assembleTransaction to add correct resources
|
|
320
|
+
const preparedTx = StellarSdk.rpc.assembleTransaction(
|
|
321
|
+
transaction,
|
|
322
|
+
simulation
|
|
323
|
+
).build();
|
|
324
|
+
|
|
325
|
+
// Now sign and submit preparedTx, not original transaction
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Frontend Issues
|
|
331
|
+
|
|
332
|
+
### 11. Freighter Not Detected
|
|
333
|
+
|
|
334
|
+
**Problem**: Wallet connection fails silently.
|
|
335
|
+
|
|
336
|
+
**Symptoms**:
|
|
337
|
+
- `isConnected()` returns false
|
|
338
|
+
- No wallet prompt appears
|
|
339
|
+
|
|
340
|
+
**Solution**:
|
|
341
|
+
```typescript
|
|
342
|
+
import { isConnected, isAllowed } from "@stellar/freighter-api";
|
|
343
|
+
|
|
344
|
+
async function checkFreighter() {
|
|
345
|
+
// Check if extension is installed
|
|
346
|
+
const connected = await isConnected();
|
|
347
|
+
if (!connected) {
|
|
348
|
+
// Prompt user to install
|
|
349
|
+
window.open("https://freighter.app", "_blank");
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Check if app is allowed
|
|
354
|
+
const allowed = await isAllowed();
|
|
355
|
+
if (!allowed) {
|
|
356
|
+
// Need to request permission
|
|
357
|
+
await setAllowed();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
### 12. Network Mismatch with Wallet
|
|
365
|
+
|
|
366
|
+
**Problem**: Wallet on different network than app.
|
|
367
|
+
|
|
368
|
+
**Symptoms**:
|
|
369
|
+
- Transactions fail unexpectedly
|
|
370
|
+
- Wrong balances displayed
|
|
371
|
+
|
|
372
|
+
**Solution**:
|
|
373
|
+
```typescript
|
|
374
|
+
import { getNetwork } from "@stellar/freighter-api";
|
|
375
|
+
|
|
376
|
+
async function validateNetwork() {
|
|
377
|
+
const walletNetwork = await getNetwork();
|
|
378
|
+
const appNetwork = process.env.NEXT_PUBLIC_STELLAR_NETWORK;
|
|
379
|
+
|
|
380
|
+
if (walletNetwork !== appNetwork) {
|
|
381
|
+
throw new Error(
|
|
382
|
+
`Please switch Freighter to ${appNetwork}. Currently on ${walletNetwork}`
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### 13. Transaction Timeout
|
|
391
|
+
|
|
392
|
+
**Problem**: Transaction expires before confirmation.
|
|
393
|
+
|
|
394
|
+
**Symptoms**:
|
|
395
|
+
```
|
|
396
|
+
Error: tx_too_late
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Solution**:
|
|
400
|
+
```typescript
|
|
401
|
+
// Set appropriate timeout based on expected confirmation time
|
|
402
|
+
const tx = new StellarSdk.TransactionBuilder(account, {
|
|
403
|
+
fee: StellarSdk.BASE_FEE,
|
|
404
|
+
networkPassphrase,
|
|
405
|
+
})
|
|
406
|
+
.addOperation(/* ... */)
|
|
407
|
+
.setTimeout(180) // 3 minutes - adjust as needed
|
|
408
|
+
.build();
|
|
409
|
+
|
|
410
|
+
// Handle timeout gracefully
|
|
411
|
+
async function submitWithRetry(signedXdr: string) {
|
|
412
|
+
try {
|
|
413
|
+
return await submitTransaction(signedXdr);
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (error.response?.data?.extras?.result_codes?.transaction === "tx_too_late") {
|
|
416
|
+
// Rebuild with fresh blockhash and retry
|
|
417
|
+
const newTx = await rebuildTransaction(signedXdr);
|
|
418
|
+
return await submitTransaction(newTx);
|
|
419
|
+
}
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## CLI Issues
|
|
428
|
+
|
|
429
|
+
### 14. Identity Not Found
|
|
430
|
+
|
|
431
|
+
**Problem**: Stellar CLI can't find saved identity.
|
|
432
|
+
|
|
433
|
+
**Symptoms**:
|
|
434
|
+
```
|
|
435
|
+
Error: identity "alice" not found
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Solution**:
|
|
439
|
+
```bash
|
|
440
|
+
# List existing identities
|
|
441
|
+
stellar keys list
|
|
442
|
+
|
|
443
|
+
# Generate new identity
|
|
444
|
+
stellar keys generate --global alice
|
|
445
|
+
|
|
446
|
+
# For testnet with funding
|
|
447
|
+
stellar keys generate --global alice --network testnet --fund
|
|
448
|
+
|
|
449
|
+
# Specify identity location
|
|
450
|
+
stellar keys generate alice --config-dir /custom/path
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### 15. Contract Invoke Parsing Errors
|
|
456
|
+
|
|
457
|
+
**Problem**: CLI can't parse function arguments.
|
|
458
|
+
|
|
459
|
+
**Symptoms**:
|
|
460
|
+
```
|
|
461
|
+
Error: invalid argument format
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**Solution**:
|
|
465
|
+
```bash
|
|
466
|
+
# Use correct argument syntax
|
|
467
|
+
# Addresses: just the G... or C... string
|
|
468
|
+
stellar contract invoke \
|
|
469
|
+
--id CONTRACT_ID \
|
|
470
|
+
--source alice \
|
|
471
|
+
--network testnet \
|
|
472
|
+
-- \
|
|
473
|
+
transfer \
|
|
474
|
+
--from GABC... \
|
|
475
|
+
--to GDEF... \
|
|
476
|
+
--amount 1000
|
|
477
|
+
|
|
478
|
+
# Complex types: use JSON
|
|
479
|
+
stellar contract invoke \
|
|
480
|
+
--id CONTRACT_ID \
|
|
481
|
+
-- \
|
|
482
|
+
complex_fn \
|
|
483
|
+
--data '{"field1": "value", "field2": 123}'
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## General Best Practices
|
|
489
|
+
|
|
490
|
+
### Debugging Checklist
|
|
491
|
+
|
|
492
|
+
1. **Check network**: Is wallet/CLI on correct network?
|
|
493
|
+
2. **Check account**: Is source account funded?
|
|
494
|
+
3. **Check sequence**: Is sequence number current?
|
|
495
|
+
4. **Check simulation**: Did Soroban tx simulate successfully?
|
|
496
|
+
5. **Check trustlines**: For asset transfers, do trustlines exist?
|
|
497
|
+
6. **Check TTL**: For contract data, is TTL sufficient?
|
|
498
|
+
7. **Check authorization**: Is correct account signing?
|
|
499
|
+
8. **Check logs**: What does the error message actually say?
|
|
500
|
+
|
|
501
|
+
### Error Code Reference
|
|
502
|
+
|
|
503
|
+
| Code | Meaning | Common Fix |
|
|
504
|
+
|------|---------|------------|
|
|
505
|
+
| `tx_bad_auth` | Signature invalid | Check network passphrase |
|
|
506
|
+
| `tx_bad_seq` | Wrong sequence | Reload account |
|
|
507
|
+
| `tx_too_late` | Transaction expired | Rebuild and resubmit |
|
|
508
|
+
| `op_no_trust` | Missing trustline | Create trustline first |
|
|
509
|
+
| `op_underfunded` | Insufficient balance | Add funds |
|
|
510
|
+
| `op_low_reserve` | Below minimum balance | Maintain reserve |
|