@caict/bop-typescript-sdk 1.0.0

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/README.md +112 -0
  5. package/package.json +90 -0
  6. package/src/bop/bop-base/README.md +5 -0
  7. package/src/bop/bop-base/base.ts +366 -0
  8. package/src/bop/bop-base/index.ts +83 -0
  9. package/src/bop/bop-base/permit.ts +116 -0
  10. package/src/bop/bop-base/test/base.test.ts +867 -0
  11. package/src/bop/bop-base/test/index.test.ts +69 -0
  12. package/src/bop/bop-base/test/permit.test.ts +125 -0
  13. package/src/bop/bop-base/tsconfig.json +8 -0
  14. package/src/bop/bop-proto/README.md +2 -0
  15. package/src/bop/bop-proto/bop-ws.proto +266 -0
  16. package/src/bop/bop-proto/bop-ws.ts +4447 -0
  17. package/src/bop/bop-proto/bop.proto +898 -0
  18. package/src/bop/bop-proto/bop.ts +12890 -0
  19. package/src/bop/bop-proto/tsconfig.json +8 -0
  20. package/src/bop/bop-ws/index.ts +315 -0
  21. package/src/bop/bop-ws/sample/sample.ts +107 -0
  22. package/src/bop/bop-ws/tsconfig.json +8 -0
  23. package/src/bop/index.ts +14 -0
  24. package/src/bop-sdk/index.ts +22 -0
  25. package/src/bop-sdk/interface/abstract-service/abstract-account.ts +23 -0
  26. package/src/bop-sdk/interface/abstract-service/abstract-chain.ts +9 -0
  27. package/src/bop-sdk/interface/abstract-service/abstract-contract.ts +16 -0
  28. package/src/bop-sdk/interface/abstract-service/abstract-ledger.ts +15 -0
  29. package/src/bop-sdk/interface/abstract-service/abstract-provider.ts +13 -0
  30. package/src/bop-sdk/interface/abstract-service/abstract-signer.ts +133 -0
  31. package/src/bop-sdk/interface/abstract-service/abstract-transaction.ts +86 -0
  32. package/src/bop-sdk/interface/provider-ws.ts +10 -0
  33. package/src/bop-sdk/interface/provider.ts +22 -0
  34. package/src/bop-sdk/interface/service/3rd.ts +54 -0
  35. package/src/bop-sdk/interface/service/account.ts +86 -0
  36. package/src/bop-sdk/interface/service/chain.ts +27 -0
  37. package/src/bop-sdk/interface/service/contract.ts +51 -0
  38. package/src/bop-sdk/interface/service/helper.ts +426 -0
  39. package/src/bop-sdk/interface/service/ledger.ts +75 -0
  40. package/src/bop-sdk/interface/service/offline/check/index.js +138 -0
  41. package/src/bop-sdk/interface/service/offline/common/constant.js +6 -0
  42. package/src/bop-sdk/interface/service/offline/common/snowFlakeUtils.js +192 -0
  43. package/src/bop-sdk/interface/service/offline/common/util.js +511 -0
  44. package/src/bop-sdk/interface/service/offline/exception/customErrors.js +29 -0
  45. package/src/bop-sdk/interface/service/offline/exception/errors.js +90 -0
  46. package/src/bop-sdk/interface/service/offline/exception/index.js +5 -0
  47. package/src/bop-sdk/interface/service/offline/operation/accountCreateOperation.js +28 -0
  48. package/src/bop-sdk/interface/service/offline/operation/accountSetMetadataOperation.js +44 -0
  49. package/src/bop-sdk/interface/service/offline/operation/accountSetPrivilegeOperation.js +49 -0
  50. package/src/bop-sdk/interface/service/offline/operation/contractCreateOperation.js +43 -0
  51. package/src/bop-sdk/interface/service/offline/operation/contractInvokeOperation.js +42 -0
  52. package/src/bop-sdk/interface/service/offline/operation/contractInvokeRequestOperation.js +69 -0
  53. package/src/bop-sdk/interface/service/offline/operation/gasSendOperation.js +29 -0
  54. package/src/bop-sdk/interface/service/offline/operation/gasSendRequestOperation.js +61 -0
  55. package/src/bop-sdk/interface/service/offline/operation/index.js +20 -0
  56. package/src/bop-sdk/interface/service/offline/proto/chain_pb.js +12079 -0
  57. package/src/bop-sdk/interface/service/offline/proto/common_pb.js +2867 -0
  58. package/src/bop-sdk/interface/service/offline/transaction/index.js +988 -0
  59. package/src/bop-sdk/interface/service/offline/transaction/operations.js +188 -0
  60. package/src/bop-sdk/interface/service/offline/validate/account.js +152 -0
  61. package/src/bop-sdk/interface/service/offline/validate/contract.js +101 -0
  62. package/src/bop-sdk/interface/service/offline/validate/index.js +10 -0
  63. package/src/bop-sdk/interface/service/offline/validate/transaction.js +51 -0
  64. package/src/bop-sdk/interface/service/transaction.ts +731 -0
  65. package/src/bop-sdk/interface/signer.ts +46 -0
  66. package/src/bop-sdk/interface/test/3rd.test.ts +1571 -0
  67. package/src/bop-sdk/interface/test/account.test.ts +284 -0
  68. package/src/bop-sdk/interface/test/chain.test.ts +45 -0
  69. package/src/bop-sdk/interface/test/contract.test.ts +283 -0
  70. package/src/bop-sdk/interface/test/ledger.test.ts +166 -0
  71. package/src/bop-sdk/interface/test/provider.test.ts +407 -0
  72. package/src/bop-sdk/interface/test/signer.test.ts +105 -0
  73. package/src/bop-sdk/interface/test/transaction.test.ts +713 -0
  74. package/src/bop-sdk/proto/bop-sdk-common.proto +159 -0
  75. package/src/bop-sdk/proto/bop-sdk-common.ts +829 -0
  76. package/src/bop-sdk/proto/bop-sdk-interface.proto +581 -0
  77. package/src/bop-sdk/proto/bop-sdk-interface.ts +10839 -0
  78. package/src/bop-sdk/proto/bop-sdk-utils.proto +86 -0
  79. package/src/bop-sdk/proto/bop-sdk-utils.ts +1495 -0
  80. package/src/bop-sdk/utils/abi/abi-coder.ts +147 -0
  81. package/src/bop-sdk/utils/abi/address.ts +109 -0
  82. package/src/bop-sdk/utils/abi/bignumber.ts +403 -0
  83. package/src/bop-sdk/utils/abi/bytes.ts +565 -0
  84. package/src/bop-sdk/utils/abi/coders/abstract-coder.ts +239 -0
  85. package/src/bop-sdk/utils/abi/coders/address.ts +58 -0
  86. package/src/bop-sdk/utils/abi/coders/anonymous.ts +25 -0
  87. package/src/bop-sdk/utils/abi/coders/array.ts +275 -0
  88. package/src/bop-sdk/utils/abi/coders/boolean.ts +21 -0
  89. package/src/bop-sdk/utils/abi/coders/bytes.ts +36 -0
  90. package/src/bop-sdk/utils/abi/coders/fixed-bytes.ts +35 -0
  91. package/src/bop-sdk/utils/abi/coders/null.ts +25 -0
  92. package/src/bop-sdk/utils/abi/coders/number.ts +56 -0
  93. package/src/bop-sdk/utils/abi/coders/string.ts +24 -0
  94. package/src/bop-sdk/utils/abi/coders/tuple.ts +73 -0
  95. package/src/bop-sdk/utils/abi/constants/addresses.ts +1 -0
  96. package/src/bop-sdk/utils/abi/constants/bignumbers.ts +30 -0
  97. package/src/bop-sdk/utils/abi/constants/hashes.ts +2 -0
  98. package/src/bop-sdk/utils/abi/constants/index.ts +15 -0
  99. package/src/bop-sdk/utils/abi/constants/strings.ts +2 -0
  100. package/src/bop-sdk/utils/abi/fragments.ts +1243 -0
  101. package/src/bop-sdk/utils/abi/id.ts +6 -0
  102. package/src/bop-sdk/utils/abi/index.ts +46 -0
  103. package/src/bop-sdk/utils/abi/interface.ts +921 -0
  104. package/src/bop-sdk/utils/abi/keccak256.ts +9 -0
  105. package/src/bop-sdk/utils/abi/properties.ts +172 -0
  106. package/src/bop-sdk/utils/abi/strings/bytes32.ts +40 -0
  107. package/src/bop-sdk/utils/abi/strings/idna.ts +258 -0
  108. package/src/bop-sdk/utils/abi/strings/index.ts +28 -0
  109. package/src/bop-sdk/utils/abi/strings/utf8.ts +373 -0
  110. package/src/bop-sdk/utils/encryption-address.ts +501 -0
  111. package/src/bop-sdk/utils/encryption-crypto.ts +427 -0
  112. package/src/bop-sdk/utils/encryption-mnemonics.ts +120 -0
  113. package/src/bop-sdk/utils/index.ts +27 -0
  114. package/src/bop-sdk/utils/logger.ts +480 -0
  115. package/src/index.ts +35 -0
@@ -0,0 +1,29 @@
1
+ // custom error code: from 12001 to 17000
2
+ module.exports = {
3
+ REQUEST_NULL_ERROR: {
4
+ CODE: 12001,
5
+ MSG: "Request parameter cannot be null",
6
+ },
7
+
8
+ INVALID_PRITX_FROM_ERROR: {
9
+ CODE: 12003,
10
+ MSG: "Invalid Private Transaction Sender",
11
+ },
12
+ INVALID_PRITX_TO_ERROR: {
13
+ CODE: 12005,
14
+ MSG: "Invalid Private Transaction recipient list",
15
+ },
16
+ INVALID_PRITX_HASH_ERROR: {
17
+ CODE: 12006,
18
+ MSG: "Invalid Private Transaction Hash",
19
+ },
20
+
21
+ INVALID_NUMBER_OF_ARG: {
22
+ CODE: 12008,
23
+ MSG: "Invalid number of arguments to the function",
24
+ },
25
+ INVALID_ARGUMENTS: {
26
+ CODE: 12010,
27
+ MSG: "Invalid arguments to the function",
28
+ },
29
+ };
@@ -0,0 +1,90 @@
1
+ module.exports = {
2
+ INVALID_SOURCEADDRESS_ERROR: {
3
+ CODE: 11002,
4
+ MSG: "Invalid sourceAddress",
5
+ },
6
+ INVALID_DESTADDRESS_ERROR: {
7
+ CODE: 11003,
8
+ MSG: "Invalid destAddress",
9
+ },
10
+ INVALID_INITBALANCE_ERROR: {
11
+ CODE: 11004,
12
+ MSG: "InitBalance must between 0 and Long.MAX_VALUE",
13
+ },
14
+ INVALID_DATAVERSION_ERROR: {
15
+ CODE: 11013,
16
+ MSG: "The version must be equal or bigger than 0",
17
+ },
18
+ INVALID_MASTERWEIGHT_ERROR: {
19
+ CODE: 11015,
20
+ MSG: "MasterWeight must between 0 and max(uint32)",
21
+ },
22
+ INVALID_SIGNER_ADDRESS_ERROR: {
23
+ CODE: 11016,
24
+ MSG: "Invalid signer address",
25
+ },
26
+ INVALID_SIGNER_WEIGHT_ERROR: {
27
+ CODE: 11017,
28
+ MSG: "Signer weight must between 0 and max(uint32)",
29
+ },
30
+ INVALID_TX_THRESHOLD_ERROR: {
31
+ CODE: 11018,
32
+ MSG: "TxThreshold must between 0 and max(int64)",
33
+ },
34
+ INVALID_OPERATION_TYPE_ERROR: {
35
+ CODE: 11019,
36
+ MSG: "Type of typeThreshold is invalid",
37
+ },
38
+ INVALID_TYPE_THRESHOLD_ERROR: {
39
+ CODE: 11020,
40
+ MSG: "TypeThreshold must between 0 and max(int64)",
41
+ },
42
+ INVALID_AMOUNT_ERROR: {
43
+ CODE: 11024,
44
+ MSG: "Amount must between 0 and max(int64)",
45
+ },
46
+ INVALID_CONTRACTADDRESS_ERROR: {
47
+ CODE: 11037,
48
+ MSG: "Invalid contract address",
49
+ },
50
+ CONTRACTADDRESS_NOT_CONTRACTACCOUNT_ERROR: {
51
+ CODE: 11038,
52
+ MSG: "ContractAddress is not a contract account",
53
+ },
54
+ INVALID_FROMADDRESS_ERROR: {
55
+ CODE: 11041,
56
+ MSG: "Invalid fromAddress",
57
+ },
58
+ PAYLOAD_EMPTY_ERROR: {
59
+ CODE: 11044,
60
+ MSG: "Payload must be a non-empty string",
61
+ },
62
+ INVALID_CONTRACT_TYPE_ERROR: {
63
+ CODE: 11047,
64
+ MSG: "Invalid contract type",
65
+ },
66
+ INVALID_NONCE_ERROR: {
67
+ CODE: 11048,
68
+ MSG: "Nonce must between 1 and max(int64)",
69
+ },
70
+ INVALID_GASPRICE_ERROR: {
71
+ CODE: 11049,
72
+ MSG: "GasPrice must be between 0 and Long.MAX_VALUE",
73
+ },
74
+ INVALID_FEELIMIT_ERROR: {
75
+ CODE: 11050,
76
+ MSG: "FeeLimit must be between 0 and Long.MAX_VALUE",
77
+ },
78
+ OPERATIONS_EMPTY_ERROR: {
79
+ CODE: 11051,
80
+ MSG: "Operations cannot be empty",
81
+ },
82
+ INVALID_CEILLEDGERSEQ_ERROR: {
83
+ CODE: 11052,
84
+ MSG: "CeilLedgerSeq must be equal to or greater than 0",
85
+ },
86
+ INVALID_NONCE_TYPE_ERROR: {
87
+ CODE: 12008,
88
+ MSG: "nonceType must be equal to 0 or 1",
89
+ },
90
+ };
@@ -0,0 +1,5 @@
1
+ const merge = require("merge-descriptors");
2
+ const proto = (module.exports = {});
3
+
4
+ merge(proto, require("./errors"));
5
+ merge(proto, require("./customErrors"));
@@ -0,0 +1,28 @@
1
+ function AccountCreateOperation(destAddress, initBalance) {
2
+ this.destAddress = destAddress;
3
+ this.initBalance = initBalance;
4
+ this.operationType = "ACCOUNT_ACTIVATE";
5
+ this.actionType = 1;
6
+ }
7
+ // set 方法
8
+ AccountCreateOperation.prototype.setDestAddress = function (val) {
9
+ this.destAddress = val;
10
+ };
11
+ AccountCreateOperation.prototype.setInitBalance = function (val) {
12
+ this.initBalance = val;
13
+ };
14
+
15
+ // get 方法
16
+ AccountCreateOperation.prototype.getDestAddress = function () {
17
+ return this.destAddress;
18
+ };
19
+ AccountCreateOperation.prototype.getInitBalance = function () {
20
+ return this.initBalance;
21
+ };
22
+ AccountCreateOperation.prototype.getOperationType = function () {
23
+ return this.operationType;
24
+ };
25
+ AccountCreateOperation.prototype.getActionType = function () {
26
+ return this.actionType;
27
+ };
28
+ module.exports = AccountCreateOperation;
@@ -0,0 +1,44 @@
1
+ function AccountSetMetadataOperation(key, value, version, deleteFlag) {
2
+ this.key = key;
3
+ this.value = value;
4
+ this.version = version;
5
+ this.deleteFlag = deleteFlag;
6
+ this.operationType = "ACCOUNT_SET_METADATA";
7
+ this.actionType = 4;
8
+ }
9
+ // set 方法
10
+ AccountSetMetadataOperation.prototype.setKey = function (val) {
11
+ this.key = val;
12
+ };
13
+ AccountSetMetadataOperation.prototype.setValue = function (val) {
14
+ this.value = val;
15
+ };
16
+
17
+ AccountSetMetadataOperation.prototype.setVersion = function (val) {
18
+ this.version = val;
19
+ };
20
+ AccountSetMetadataOperation.prototype.setDeleteFlag = function (val) {
21
+ this.deleteFlag = val;
22
+ };
23
+
24
+ // get 方法
25
+ AccountSetMetadataOperation.prototype.getKey = function () {
26
+ return this.key;
27
+ };
28
+ AccountSetMetadataOperation.prototype.getValue = function () {
29
+ return this.value;
30
+ };
31
+ AccountSetMetadataOperation.prototype.getVersion = function () {
32
+ return this.version;
33
+ };
34
+ AccountSetMetadataOperation.prototype.getDeleteFlag = function () {
35
+ return this.deleteFlag;
36
+ };
37
+ AccountSetMetadataOperation.prototype.getOperationType = function () {
38
+ return this.operationType;
39
+ };
40
+ AccountSetMetadataOperation.prototype.getActionType = function () {
41
+ return this.actionType;
42
+ };
43
+
44
+ module.exports = AccountSetMetadataOperation;
@@ -0,0 +1,49 @@
1
+ function AccountSetPrivilegeOperation(
2
+ masterWeight,
3
+ signers,
4
+ txThreshold,
5
+ typeThresholds,
6
+ ) {
7
+ this.masterWeight = masterWeight;
8
+ this.signers = signers;
9
+ this.txThreshold = txThreshold;
10
+ this.typeThresholds = typeThresholds;
11
+ this.operationType = "ACCOUNT_SET_PRIVILEGE";
12
+ this.actionType = 9;
13
+ }
14
+ // set 方法
15
+ AccountSetPrivilegeOperation.prototype.setMasterWeight = function (val) {
16
+ this.masterWeight = val;
17
+ };
18
+ AccountSetPrivilegeOperation.prototype.setSigners = function (val) {
19
+ this.signers = val;
20
+ };
21
+
22
+ AccountSetPrivilegeOperation.prototype.setTxThreshold = function (val) {
23
+ this.txThreshold = val;
24
+ };
25
+ AccountSetPrivilegeOperation.prototype.setTypeThresholds = function (val) {
26
+ this.typeThresholds = val;
27
+ };
28
+
29
+ // get 方法
30
+ AccountSetPrivilegeOperation.prototype.getMasterWeight = function () {
31
+ return this.masterWeight;
32
+ };
33
+ AccountSetPrivilegeOperation.prototype.getSigners = function () {
34
+ return this.signers;
35
+ };
36
+ AccountSetPrivilegeOperation.prototype.getTxThreshold = function () {
37
+ return this.txThreshold;
38
+ };
39
+ AccountSetPrivilegeOperation.prototype.getTypeThresholds = function () {
40
+ return this.typeThresholds;
41
+ };
42
+ AccountSetPrivilegeOperation.prototype.getOperationType = function () {
43
+ return this.operationType;
44
+ };
45
+ AccountSetPrivilegeOperation.prototype.getActionType = function () {
46
+ return this.actionType;
47
+ };
48
+
49
+ module.exports = AccountSetPrivilegeOperation;
@@ -0,0 +1,43 @@
1
+ function ContractCreateOperation(initBalance, type, payload, initInput) {
2
+ this.initBalance = initBalance;
3
+ this.type = type;
4
+ this.payload = payload;
5
+ this.initInput = initInput;
6
+ this.operationType = "CONTRACT_CREATE";
7
+ this.actionType = 1;
8
+ }
9
+ // set 方法
10
+ ContractCreateOperation.prototype.setInitBalance = function (val) {
11
+ this.initBalance = val;
12
+ };
13
+ ContractCreateOperation.prototype.setType = function (val) {
14
+ this.type = val;
15
+ };
16
+ ContractCreateOperation.prototype.setPayload = function (val) {
17
+ this.payload = val;
18
+ };
19
+ ContractCreateOperation.prototype.setInitInput = function (val) {
20
+ this.initInput = val;
21
+ };
22
+
23
+ // get 方法
24
+ ContractCreateOperation.prototype.getInitBalance = function () {
25
+ return this.initBalance;
26
+ };
27
+ ContractCreateOperation.prototype.getType = function () {
28
+ return this.type;
29
+ };
30
+ ContractCreateOperation.prototype.getPayload = function () {
31
+ return this.payload;
32
+ };
33
+ ContractCreateOperation.prototype.getInitInput = function () {
34
+ return this.initInput;
35
+ };
36
+ ContractCreateOperation.prototype.getOperationType = function () {
37
+ return this.operationType;
38
+ };
39
+ ContractCreateOperation.prototype.getActionType = function () {
40
+ return this.actionType;
41
+ };
42
+
43
+ module.exports = ContractCreateOperation;
@@ -0,0 +1,42 @@
1
+ function ContractInvokeOperation(contractAddress, amount, input) {
2
+ this.contractAddress = contractAddress;
3
+ this.amount = amount;
4
+ this.input = input;
5
+ this.operationType = "CONTRACT_INVOKE";
6
+ this.actionType = 7;
7
+ }
8
+ // set 方法
9
+ ContractInvokeOperation.prototype.setContractAddress = function (val) {
10
+ this.contractAddress = val;
11
+ };
12
+ ContractInvokeOperation.prototype.setAmount = function (val) {
13
+ this.amount = val;
14
+ };
15
+ ContractInvokeOperation.prototype.setInput = function (val) {
16
+ this.input = val;
17
+ };
18
+ ContractInvokeOperation.prototype.setOperationType = function (val) {
19
+ this.operationType = val;
20
+ };
21
+ ContractInvokeOperation.prototype.setActionType = function (val) {
22
+ this.actionType = val;
23
+ };
24
+
25
+ // get 方法
26
+ ContractInvokeOperation.prototype.getContractAddress = function () {
27
+ return this.contractAddress;
28
+ };
29
+ ContractInvokeOperation.prototype.getAmount = function () {
30
+ return this.amount;
31
+ };
32
+ ContractInvokeOperation.prototype.getInput = function () {
33
+ return this.input;
34
+ };
35
+ ContractInvokeOperation.prototype.getOperationType = function () {
36
+ return this.operationType;
37
+ };
38
+ ContractInvokeOperation.prototype.getActionType = function () {
39
+ return this.actionType;
40
+ };
41
+
42
+ module.exports = ContractInvokeOperation;
@@ -0,0 +1,69 @@
1
+ const ContractInvokeOperation = require("./contractInvokeOperation");
2
+ function ContractInvokeRequestOperation(
3
+ senderAddress,
4
+ feeLimit,
5
+ gasPrice,
6
+ ceilLedgerSeq,
7
+ remarks,
8
+ privateKey,
9
+ nonceType,
10
+ ) {
11
+ this.operations = ContractInvokeOperation;
12
+ this.senderAddress = senderAddress;
13
+ this.feeLimit = feeLimit;
14
+ this.gasPrice = gasPrice;
15
+ this.ceilLedgerSeq = ceilLedgerSeq;
16
+ this.remarks = remarks;
17
+ this.privateKey = privateKey;
18
+ this.nonceType = nonceType;
19
+ }
20
+ // set 方法
21
+ ContractInvokeRequestOperation.prototype.setOperations = function (val) {
22
+ this.operations = val;
23
+ };
24
+ ContractInvokeRequestOperation.prototype.setSenderAddress = function (val) {
25
+ this.senderAddress = val;
26
+ };
27
+ ContractInvokeRequestOperation.prototype.setFeeLimit = function (val) {
28
+ this.feeLimit = val;
29
+ };
30
+ ContractInvokeRequestOperation.prototype.setGasPrice = function (val) {
31
+ this.gasPrice = val;
32
+ };
33
+ ContractInvokeRequestOperation.prototype.setCeilLedgerSeq = function (val) {
34
+ this.ceilLedgerSeq = val;
35
+ };
36
+ ContractInvokeRequestOperation.prototype.setRemarks = function (val) {
37
+ this.remarks = val;
38
+ };
39
+ ContractInvokeRequestOperation.prototype.setPrivateKey = function (val) {
40
+ this.privateKey = val;
41
+ };
42
+ ContractInvokeRequestOperation.prototype.setNonceType = function (val) {
43
+ this.nonceType = val;
44
+ };
45
+
46
+ // get 方法
47
+ ContractInvokeRequestOperation.prototype.getOperations = function () {
48
+ return this.operations;
49
+ };
50
+ ContractInvokeRequestOperation.prototype.getSenderAddress = function () {
51
+ return this.senderAddress;
52
+ };
53
+ ContractInvokeRequestOperation.prototype.getFeeLimit = function () {
54
+ return this.feeLimit;
55
+ };
56
+ ContractInvokeRequestOperation.prototype.getGasPrice = function () {
57
+ return this.gasPrice;
58
+ };
59
+ ContractInvokeRequestOperation.prototype.getCeilLedgerSeq = function () {
60
+ return this.ceilLedgerSeq;
61
+ };
62
+ ContractInvokeRequestOperation.prototype.getRemarks = function () {
63
+ return this.remarks;
64
+ };
65
+ ContractInvokeRequestOperation.prototype.getPrivateKey = function () {
66
+ return this.privateKey;
67
+ };
68
+
69
+ module.exports = ContractInvokeRequestOperation;
@@ -0,0 +1,29 @@
1
+ function GasSendOperation(destAddress, amount) {
2
+ this.destAddress = destAddress;
3
+ this.amount = amount;
4
+ this.operationType = "GAS_SEND";
5
+ this.actionType = 7;
6
+ }
7
+ // set 方法
8
+ GasSendOperation.prototype.setDestAddress = function (val) {
9
+ this.destAddress = val;
10
+ };
11
+ GasSendOperation.prototype.setAmount = function (val) {
12
+ this.amount = val;
13
+ };
14
+
15
+ // get 方法
16
+ GasSendOperation.prototype.getDestAddress = function () {
17
+ return this.destAddress;
18
+ };
19
+ GasSendOperation.prototype.getAmount = function () {
20
+ return this.amount;
21
+ };
22
+ GasSendOperation.prototype.getOperationType = function () {
23
+ return this.operationType;
24
+ };
25
+ GasSendOperation.prototype.getActionType = function () {
26
+ return this.actionType;
27
+ };
28
+
29
+ module.exports = GasSendOperation;
@@ -0,0 +1,61 @@
1
+ const GasSendOperation = require("./gasSendOperation");
2
+ function GasSendRequestOperation(
3
+ senderAddress,
4
+ feeLimit,
5
+ gasPrice,
6
+ ceilLedgerSeq,
7
+ remarks,
8
+ nonceType,
9
+ ) {
10
+ this.operations = GasSendOperation;
11
+ this.senderAddress = senderAddress;
12
+ this.feeLimit = feeLimit;
13
+ this.gasPrice = gasPrice;
14
+ this.ceilLedgerSeq = ceilLedgerSeq;
15
+ this.remarks = remarks;
16
+ this.nonceType = nonceType;
17
+ }
18
+ // set 方法
19
+ GasSendRequestOperation.prototype.setOperations = function (val) {
20
+ this.operations = val;
21
+ };
22
+ GasSendRequestOperation.prototype.setSenderAddress = function (val) {
23
+ this.senderAddress = val;
24
+ };
25
+ GasSendRequestOperation.prototype.setFeeLimit = function (val) {
26
+ this.feeLimit = val;
27
+ };
28
+ GasSendRequestOperation.prototype.setGasPrice = function (val) {
29
+ this.gasPrice = val;
30
+ };
31
+ GasSendRequestOperation.prototype.setCeilLedgerSeq = function (val) {
32
+ this.ceilLedgerSeq = val;
33
+ };
34
+ GasSendRequestOperation.prototype.setNonceType = function (val) {
35
+ this.nonceType = val;
36
+ };
37
+ GasSendRequestOperation.prototype.setRemarks = function (val) {
38
+ this.remarks = val;
39
+ };
40
+
41
+ // get 方法
42
+ GasSendRequestOperation.prototype.getOperations = function () {
43
+ return this.operations;
44
+ };
45
+ GasSendRequestOperation.prototype.getSenderAddress = function () {
46
+ return this.senderAddress;
47
+ };
48
+ GasSendRequestOperation.prototype.getFeeLimit = function () {
49
+ return this.feeLimit;
50
+ };
51
+ GasSendRequestOperation.prototype.getGasPrice = function () {
52
+ return this.gasPrice;
53
+ };
54
+ GasSendRequestOperation.prototype.getCeilLedgerSeq = function () {
55
+ return this.ceilLedgerSeq;
56
+ };
57
+ GasSendRequestOperation.prototype.getRemarks = function () {
58
+ return this.remarks;
59
+ };
60
+
61
+ module.exports = GasSendRequestOperation;
@@ -0,0 +1,20 @@
1
+ const AccountCreateOperation = require("./accountCreateOperation");
2
+ const AccountSetMetadataOperation = require("./accountSetMetadataOperation");
3
+ const AccountSetPrivilegeOperation = require("./accountSetPrivilegeOperation");
4
+ const ContractCreateOperation = require("./contractCreateOperation");
5
+ const ContractInvokeOperation = require("./contractInvokeOperation");
6
+ const GasSendOperation = require("./gasSendOperation");
7
+ const ContractInvokeRequestOperation = require("./contractInvokeRequestOperation");
8
+ const GasSendRequestOperation = require("./gasSendRequestOperation");
9
+ module.exports = Operation;
10
+
11
+ function Operation() {
12
+ this.accountCreateOperation = new AccountCreateOperation();
13
+ this.accountSetMetadataOperation = new AccountSetMetadataOperation();
14
+ this.accountSetPrivilegeOperation = new AccountSetPrivilegeOperation();
15
+ this.contractCreateOperation = new ContractCreateOperation();
16
+ this.contractInvokeOperation = new ContractInvokeOperation();
17
+ this.gasSendOperation = new GasSendOperation();
18
+ this.contractInvokeRequestOperation = new ContractInvokeRequestOperation();
19
+ this.gasSendRequestOperation = new GasSendRequestOperation();
20
+ }