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

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

22 Apr 2024 05:20AM UTC coverage: 67.306% (-3.7%) from 71.021%
8778928347

push

github

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

Add new transactions and new node API fetch

1207 of 2739 branches covered (44.07%)

Branch coverage included in aggregate %.

359 of 1167 new or added lines in 63 files covered. (30.76%)

2 existing lines in 1 file now uncovered.

8977 of 12392 relevant lines covered (72.44%)

140180.65 hits per line

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

13.73
/src/infrastructure/builders/NetworkConfigAbsoluteHeightTransaction.ts
1
// Copyright 2019 ProximaX Limited. All rights reserved.
2
// Use of this source code is governed by the Apache 2.0
3
// license that can be found in the LICENSE file
4

5
/**
6
 * @module transactions/NetworkConfigTransaction
7
 */
8
import { TransactionType } from '../../model/transaction/TransactionType';
1✔
9
import { NetworkConfigAbsoluteHeightTransactionBuffer } from '../buffers/NetworkConfigAbsoluteHeightTransactionBuffer';
1✔
10
import NetworkConfigTransactionSchema from '../schemas/NetworkConfigAbsoluteHeightTransactionSchema';
1✔
11
import { VerifiableTransaction } from './VerifiableTransaction';
1✔
12

13
import * as flatbuffers from 'flatbuffers';
1✔
14
import { Convert } from '../../core/format';
15

16
export default class NetworkConfigTransaction extends VerifiableTransaction {
1✔
17
    constructor(bytes) {
NEW
18
        super(bytes, NetworkConfigTransactionSchema);
×
19
    }
20
}
21

22
export class Builder {
1✔
23
    size: any;
24
    maxFee: any;
25
    version: any;
26
    type: any;
27
    deadline: any;
28
    applyHeight: any;
29
    networkConfig: any;
30
    supportedEntityVersions: any;
31

32
    constructor() {
NEW
33
        this.maxFee = [0, 0];
×
NEW
34
        this.type = TransactionType.NetworkConfig_Absolute_Height;
×
35
    }
36

37
    addSize(size) {
NEW
38
        this.size = size;
×
NEW
39
        return this;
×
40
    }
41

42
    addMaxFee(maxFee) {
NEW
43
        this.maxFee = maxFee;
×
NEW
44
        return this;
×
45
    }
46

47
    addApplyHeight(applyHeight) {
NEW
48
        this.applyHeight = applyHeight;
×
NEW
49
        return this;
×
50
    }
51

52
    addNetworkConfig(networkConfig) {
NEW
53
        this.networkConfig = networkConfig.split('').map(n=>n.charCodeAt(0));
×
NEW
54
        return this;
×
55
    }
56

57
    addSupportedEntityVersions(supportedEntityVersions) {
NEW
58
        this.supportedEntityVersions = supportedEntityVersions.split('').map(n=>n.charCodeAt(0));
×
NEW
59
        return this;
×
60
    }
61

62
    addVersion(version) {
NEW
63
        this.version = version;
×
NEW
64
        return this;
×
65
    }
66

67
    addType(type) {
NEW
68
        this.type = type;
×
NEW
69
        return this;
×
70
    }
71

72
    addDeadline(deadline) {
NEW
73
        this.deadline = deadline;
×
NEW
74
        return this;
×
75
    }
76

77
    build() {
NEW
78
        const builder = new flatbuffers.Builder(1);
×
79

NEW
80
        const signatureVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
81
            .createSignatureVector(builder, Array(...Array(64)).map(Number.prototype.valueOf, 0));
NEW
82
        const signerVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
83
            .createSignerVector(builder, Array(...Array(32)).map(Number.prototype.valueOf, 0));
NEW
84
        const deadlineVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
85
            .createDeadlineVector(builder, this.deadline);
NEW
86
        const feeVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
87
            .createMaxFeeVector(builder, this.maxFee);
NEW
88
        const applyHeightVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
89
            .createApplyHeightVector(builder, this.applyHeight);
NEW
90
        const networkConfigVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
91
            .createNetworkConfigVector(builder, this.networkConfig);
NEW
92
        const supportedEntityVersionsVector = NetworkConfigAbsoluteHeightTransactionBuffer
×
93
            .createSupportedEntityVersionsVector(builder, this.supportedEntityVersions);
94

NEW
95
        NetworkConfigAbsoluteHeightTransactionBuffer.startNetworkConfigAbsoluteHeightTransactionBuffer(builder);
×
NEW
96
        NetworkConfigAbsoluteHeightTransactionBuffer.addSize(builder, this.size);
×
NEW
97
        NetworkConfigAbsoluteHeightTransactionBuffer.addSignature(builder, signatureVector);
×
NEW
98
        NetworkConfigAbsoluteHeightTransactionBuffer.addSigner(builder, signerVector);
×
NEW
99
        NetworkConfigAbsoluteHeightTransactionBuffer.addVersion(builder, this.version);
×
NEW
100
        NetworkConfigAbsoluteHeightTransactionBuffer.addType(builder, this.type);
×
NEW
101
        NetworkConfigAbsoluteHeightTransactionBuffer.addMaxFee(builder, feeVector);
×
NEW
102
        NetworkConfigAbsoluteHeightTransactionBuffer.addDeadline(builder, deadlineVector);
×
NEW
103
        NetworkConfigAbsoluteHeightTransactionBuffer.addApplyHeight(builder, applyHeightVector);
×
NEW
104
        NetworkConfigAbsoluteHeightTransactionBuffer.addNetworkConfigSize(builder, this.networkConfig.length);
×
NEW
105
        NetworkConfigAbsoluteHeightTransactionBuffer.addSupportedEntityVersionsSize(builder, this.supportedEntityVersions.length);
×
NEW
106
        NetworkConfigAbsoluteHeightTransactionBuffer.addNetworkConfig(builder, networkConfigVector);
×
NEW
107
        NetworkConfigAbsoluteHeightTransactionBuffer.addSupportedEntityVersions(builder, supportedEntityVersionsVector);
×
108

109
        // Calculate size
NEW
110
        const codedNetworkConfig = NetworkConfigAbsoluteHeightTransactionBuffer.endNetworkConfigAbsoluteHeightTransactionBuffer(builder);
×
NEW
111
        builder.finish(codedNetworkConfig);
×
112

NEW
113
        const bytes = builder.asUint8Array();
×
NEW
114
        return new NetworkConfigTransaction(bytes);
×
115
    }
116
}
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