nansen-cli 1.40.1 → 1.41.1

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/src/x402-svm.js CHANGED
@@ -32,9 +32,13 @@ export function deriveATA(ownerBase58, mintBase58, tokenProgramBase58 = TOKEN_PR
32
32
 
33
33
  /**
34
34
  * Build a Solana MessageV0 from accounts and instructions.
35
- * Simplified builder for x402 payment transactions.
35
+ * feePayer is always placed at account index 0, forced signer+writable,
36
+ * regardless of whether an instruction references it directly.
37
+ * Returns numRequiredSignatures alongside the bytes since it's read back out
38
+ * of the header to size the signature-placeholder slots of the wrapping
39
+ * unsigned transaction (see callers).
36
40
  */
37
- function buildMessageV0({ feePayer, instructions, recentBlockhash, accounts: _accounts }) {
41
+ export function buildMessageV0({ feePayer, instructions, recentBlockhash, accounts: _accounts }) {
38
42
  // All unique accounts in order: feePayer first, then signers, then rest
39
43
  const accountMap = new Map();
40
44
  const feePayerKey = feePayer;
@@ -129,10 +133,10 @@ function buildMessageV0({ feePayer, instructions, recentBlockhash, accounts: _ac
129
133
  parts.push(ix.data);
130
134
  }
131
135
 
132
- // Address table lookups (empty for our use case)
136
+ // Address table lookups (empty all accounts referenced statically above)
133
137
  parts.push(encodeCompactU16(0));
134
138
 
135
- return Buffer.concat(parts);
139
+ return { messageBytes: Buffer.concat(parts), numRequiredSignatures };
136
140
  }
137
141
 
138
142
  // ============= Ed25519 Signing =============
@@ -231,7 +235,7 @@ export function buildUnsignedSvmTransaction(
231
235
  },
232
236
  ];
233
237
 
234
- const messageBytes = buildMessageV0({
238
+ const { messageBytes } = buildMessageV0({
235
239
  feePayer: feePayerStr,
236
240
  instructions,
237
241
  recentBlockhash,