@@ -1,4 +1,4 @@
|
||||
import { Transaction } from '@xo/primitives';
|
||||
import { Transaction } from './transaction.js';
|
||||
|
||||
import { binToHex, Output } from '@bitauth/libauth';
|
||||
|
||||
|
||||
@@ -59,6 +59,14 @@ export class Transaction {
|
||||
return Transaction.fromBytes(bytes);
|
||||
}
|
||||
|
||||
public static fromAny(bytesOrHex: Uint8Array | string) {
|
||||
if (typeof bytesOrHex === 'string') {
|
||||
return Transaction.fromHex(bytesOrHex);
|
||||
}
|
||||
|
||||
return Transaction.fromBytes(bytesOrHex);
|
||||
}
|
||||
|
||||
public toBytes(): Uint8Array {
|
||||
const bytes = encodeTransaction(this.transaction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user