@altiuslabs/tx-sdk 0.1.18 → 0.1.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altiuslabs/tx-sdk",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "SDK for signing and sending Altius USD multi-token transactions",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -169,7 +169,7 @@ export class TxBuilder {
169
169
  max_fee_per_gas: this._max_fee_per_gas,
170
170
  max_fee_per_gas_usd_attodollars: this._max_fee_per_gas_usd_attodollars,
171
171
  fee_token: this._fee_token,
172
- fee_payer: this._fee_payer,
172
+ fee_payer: this._fee_payer || '0x0000000000000000000000000000000000000000',
173
173
  fee_payer_signature: this._fee_payer_signature,
174
174
  };
175
175
  }
@@ -220,6 +220,9 @@ export class TxBuilder {
220
220
 
221
221
  const tx = this.build();
222
222
 
223
+ // Use sender as fee_payer if not specified
224
+ const feePayer = tx.fee_payer || wallet.address;
225
+
223
226
  // Convert r, s to 32-byte buffers
224
227
  const rBuffer = Buffer.from(sig.r.slice(2), 'hex');
225
228
  const sBuffer = Buffer.from(sig.s.slice(2), 'hex');
@@ -238,7 +241,7 @@ export class TxBuilder {
238
241
  Buffer.from(tx.data.slice(2), 'hex') || Buffer.alloc(0), // data as buffer
239
242
  [], // empty access list
240
243
  Buffer.from(tx.fee_token.slice(2), 'hex'), // fee_token as buffer
241
- Buffer.from(tx.fee_payer.slice(2), 'hex'), // fee_payer as buffer
244
+ Buffer.from(feePayer.slice(2), 'hex'), // fee_payer as buffer
242
245
  BigInt(tx.max_fee_per_gas_usd_attodollars),
243
246
  Buffer.from(tx.fee_payer_signature?.slice(2) || '', 'hex') || Buffer.alloc(0),
244
247
  // Signature: y_parity (1 byte), r (32 bytes), s (32 bytes)
@@ -255,6 +258,7 @@ export class TxBuilder {
255
258
 
256
259
  return {
257
260
  ...tx,
261
+ fee_payer: feePayer,
258
262
  v: y_parity,
259
263
  r: sig.r,
260
264
  s: sig.s,