• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

proximax-storage / tsjs-xpx-chain-sdk / 5831092307

pending completion
5831092307

push

github

web-flow
Merge pull request #161 from proximax-storage/next

v0.10.3

1166 of 2585 branches covered (45.11%)

Branch coverage included in aggregate %.

85 of 85 new or added lines in 10 files covered. (100.0%)

8660 of 11238 relevant lines covered (77.06%)

154574.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/src/model/transaction/BasicTransaction.ts
1
/*
2
 * Copyright 2023 ProximaX
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
import { PublicAccount } from '../account/PublicAccount';
18
import { NetworkType } from '../blockchain/NetworkType';
19
import { UInt64 } from '../UInt64';
20
import { AggregateTransactionInfo } from './AggregateTransactionInfo';
21
import { Transaction } from './Transaction';
1✔
22
import { Deadline } from './Deadline';
23
import { TransactionInfo } from './TransactionInfo';
24
import { DerivationScheme } from '../../core/crypto';
25

26
/**
27
 * A known transaction class that hold the basic transaction, without any extra details. 
28
 */
29
export class BasicTransaction extends Transaction{
1✔
30

31
    /**
32
     * @constructor
33
     * @param type
34
     * @param networkType
35
     * @param version
36
     * @param deadline
37
     * @param maxFee
38
     * @param signature
39
     * @param signer
40
     * @param transactionInfo
41
     */
42
    constructor(
43
            /**
44
             * The transaction type.
45
             */
46
            type: number,
47
            /**
48
             * The network type.
49
             */
50
            networkType: NetworkType,
51
            /**
52
             * The transaction version number.
53
             */
54
            version: number,
55
            /**
56
             * The deadline to include the transaction.
57
             */
58
            deadline: Deadline,
59
            /**
60
             * A sender of a transaction must specify during the transaction definition a max_fee,
61
             * meaning the maximum fee the account allows to spend for this transaction.
62
             */
63
            maxFee: UInt64,
64
            
65
            /**
66
             * The account of the transaction creator.
67
             */
68
            signer?: PublicAccount,
69
            
70
            /**
71
             * The transaction signature (missing if part of an aggregate transaction).
72
             */
73
            signature?: string,
74
            
75
            /**
76
             * Transactions meta data object contains additional information about the transaction.
77
             */
78
            transactionInfo?: TransactionInfo | AggregateTransactionInfo,
79
            
80
            ) {
81
        super(type, networkType, version, deadline, maxFee, signature, signer, transactionInfo);
×
82
    }
83

84
    /**
85
     * @override Transaction.size()
86
     * @description get the byte size of a BasicTransaction, will return error
87
     * @returns {number}
88
     * @memberof BasicTransaction
89
     */
90
    public get size(): number {
91
        return Transaction.getHeaderSize();
×
92
    }
93

94
    /**
95
     * @override Transaction.buildTransaction()
96
     * @description buildTransaction of BasicTransaction, will return error
97
     * @returns {never}
98
     * @memberof BasicTransaction
99
     */
100
    protected buildTransaction(): never {
101
        throw new Error("SDK not yet implemented transaction");
×
102
    }
103

104
    /**
105
     * Convert an aggregate transaction to an inner transaction including transaction signer, will return error
106
     * @override Transaction.toAggregate()
107
     * @internal
108
     * @param signer - Transaction signer.
109
     * @returns {never}
110
     */
111
    public toAggregate(signer: PublicAccount): never {
112
        throw new Error("SDK not yet implemented transaction");
×
113
    }
114

115
    /**
116
     * @override Transaction.toJSON()
117
     * @description Create JSON object
118
     * @returns {Object}
119
     * @memberof BasicTransaction
120
     */
121
    public toJSON() {
122
        const commonTransactionObject = {
×
123
            type: this.type,
124
            networkType: this.version.networkType,
125
            version: this.versionToDTO(),
126
            maxFee: this.maxFee.toDTO(),
127
            deadline: this.deadline.toDTO(),
128
            signature: this.signature ? this.signature : '',
×
129
            signer: this.signer!.publicKey
130
        };
131

132
        return { transaction: commonTransactionObject };
×
133
    }
134
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc