@altiuslabs/tx-sdk 0.1.23 → 0.1.24
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/package.json +1 -1
- package/src/transaction.js +10 -9
package/package.json
CHANGED
package/src/transaction.js
CHANGED
|
@@ -234,8 +234,8 @@ export class TxBuilder {
|
|
|
234
234
|
// Compute fee_payer signature hash using sender as the sender
|
|
235
235
|
const feePayerSigHash = fee_payer_signature_hash(tx, wallet.address);
|
|
236
236
|
const feePayerSig = await wallet.sign_hash(feePayerSigHash);
|
|
237
|
-
// Format:
|
|
238
|
-
feePayerSignature = '0x' + feePayerSig.
|
|
237
|
+
// Format: r (32 bytes) + s (32 bytes) + v (1 byte) - matches node's expected layout
|
|
238
|
+
feePayerSignature = '0x' + feePayerSig.r.slice(2) + feePayerSig.s.slice(2) + feePayerSig.v.toString(16).padStart(2, '0');
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// Convert r, s to 32-byte buffers
|
|
@@ -314,14 +314,15 @@ export function create_transaction() {
|
|
|
314
314
|
export function fee_payer_signature_hash(tx, sender) {
|
|
315
315
|
// RLP encode the fields as a list
|
|
316
316
|
// [chain_id, nonce, gas_limit, fee_token, fee_payer, max_fee_per_gas_usd_attodollars, sender]
|
|
317
|
+
// IMPORTANT: Use Buffer for addresses to match Rust alloy-rlp encoding (20-byte binary)
|
|
317
318
|
const list = [
|
|
318
|
-
tx.chain_id,
|
|
319
|
-
tx.nonce,
|
|
320
|
-
tx.gas_limit,
|
|
321
|
-
tx.fee_token,
|
|
322
|
-
tx.fee_payer,
|
|
323
|
-
tx.max_fee_per_gas_usd_attodollars,
|
|
324
|
-
sender,
|
|
319
|
+
BigInt(tx.chain_id),
|
|
320
|
+
BigInt(tx.nonce),
|
|
321
|
+
BigInt(tx.gas_limit),
|
|
322
|
+
Buffer.from(tx.fee_token.slice(2), 'hex'), // fee_token as 20-byte buffer
|
|
323
|
+
Buffer.from(tx.fee_payer.slice(2), 'hex'), // fee_payer as 20-byte buffer
|
|
324
|
+
BigInt(tx.max_fee_per_gas_usd_attodollars),
|
|
325
|
+
Buffer.from(sender.slice(2), 'hex'), // sender as 20-byte buffer
|
|
325
326
|
];
|
|
326
327
|
|
|
327
328
|
const encoded = rlp_encode(list);
|