File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed
modules/sdk-coin-apt/src/lib/transaction Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ import {
1616 DEFAULT_MAX_GAS_AMOUNT ,
1717 Ed25519PublicKey ,
1818 Ed25519Signature ,
19+ FeePayerRawTransaction ,
20+ generateSigningMessage ,
1921 generateUserTransactionHash ,
2022 Hex ,
2123 Network ,
24+ RAW_TRANSACTION_SALT ,
25+ RAW_TRANSACTION_WITH_DATA_SALT ,
2226 RawTransaction ,
2327 SignedTransaction ,
2428 SimpleTransaction ,
@@ -286,6 +290,23 @@ export abstract class Transaction extends BaseTransaction {
286290 return new BigNumber ( this . gasUsed ) . multipliedBy ( this . gasUnitPrice ) . toString ( ) ;
287291 }
288292
293+ public get signablePayload ( ) : Buffer {
294+ return this . feePayerAddress ? this . getSignablePayloadWithFeePayer ( ) : this . getSignablePayloadWithoutFeePayer ( ) ;
295+ }
296+
297+ private getSignablePayloadWithFeePayer ( ) : Buffer {
298+ const feePayerRawTxn = new FeePayerRawTransaction (
299+ this . _rawTransaction ,
300+ [ ] ,
301+ AccountAddress . fromString ( this . _feePayerAddress )
302+ ) ;
303+ return Buffer . from ( generateSigningMessage ( feePayerRawTxn . bcsToBytes ( ) , RAW_TRANSACTION_WITH_DATA_SALT ) ) ;
304+ }
305+
306+ private getSignablePayloadWithoutFeePayer ( ) : Buffer {
307+ return Buffer . from ( generateSigningMessage ( this . _rawTransaction . bcsToBytes ( ) , RAW_TRANSACTION_SALT ) ) ;
308+ }
309+
289310 private generateTxnId ( ) {
290311 if (
291312 ! this . _senderSignature ||
Original file line number Diff line number Diff line change 11import { Transaction } from './transaction' ;
22import { AptTransactionExplanation , TransferTxData } from '../iface' ;
33import { TransactionRecipient , TransactionType } from '@bitgo/sdk-core' ;
4- import {
5- AccountAddress ,
6- FeePayerRawTransaction ,
7- generateSigningMessage ,
8- RAW_TRANSACTION_WITH_DATA_SALT ,
9- } from '@aptos-labs/ts-sdk' ;
104
115export class TransferTransaction extends Transaction {
126 constructor ( coinConfig ) {
137 super ( coinConfig ) ;
148 this . _type = TransactionType . Send ;
159 }
1610
17- public get signablePayload ( ) : Buffer {
18- const feePayerRawTxn = new FeePayerRawTransaction (
19- this . _rawTransaction ,
20- [ ] ,
21- AccountAddress . fromString ( this . _feePayerAddress )
22- ) ;
23- return Buffer . from ( generateSigningMessage ( feePayerRawTxn . bcsToBytes ( ) , RAW_TRANSACTION_WITH_DATA_SALT ) ) ;
24- }
25-
2611 /** @inheritDoc */
2712 explainTransaction ( ) : AptTransactionExplanation {
2813 const displayOrder = [
You can’t perform that action at this time.
0 commit comments