@caict/bop-typescript-sdk 1.0.2 → 1.0.3
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.
- package/CHANGELOG.md +34 -0
- package/base.tsconfig.json +14 -0
- package/dist/bop/bop-base/base.d.ts +24 -0
- package/dist/bop/bop-base/base.js +253 -0
- package/dist/bop/bop-base/base.js.map +1 -0
- package/dist/bop/bop-base/index.d.ts +18 -0
- package/dist/bop/bop-base/index.js +69 -0
- package/dist/bop/bop-base/index.js.map +1 -0
- package/dist/bop/bop-base/permit.d.ts +11 -0
- package/dist/bop/bop-base/permit.js +104 -0
- package/dist/bop/bop-base/permit.js.map +1 -0
- package/dist/bop/bop-base/test/base.test.d.ts +1 -0
- package/dist/bop/bop-base/test/base.test.js +772 -0
- package/dist/bop/bop-base/test/base.test.js.map +1 -0
- package/dist/bop/bop-base/test/index.test.d.ts +1 -0
- package/dist/bop/bop-base/test/index.test.js +89 -0
- package/dist/bop/bop-base/test/index.test.js.map +1 -0
- package/dist/bop/bop-base/test/permit.test.d.ts +1 -0
- package/dist/bop/bop-base/test/permit.test.js +140 -0
- package/dist/bop/bop-base/test/permit.test.js.map +1 -0
- package/dist/bop/bop-proto/bop-ws.d.ts +325 -0
- package/dist/bop/bop-proto/bop-ws.js +3599 -0
- package/dist/bop/bop-proto/bop-ws.js.map +1 -0
- package/dist/bop/bop-proto/bop.d.ts +903 -0
- package/dist/bop/bop-proto/bop.js +10421 -0
- package/dist/bop/bop-proto/bop.js.map +1 -0
- package/dist/bop/bop-ws/index.d.ts +43 -0
- package/dist/bop/bop-ws/index.js +265 -0
- package/dist/bop/bop-ws/index.js.map +1 -0
- package/dist/bop/bop-ws/sample/sample.d.ts +1 -0
- package/dist/bop/bop-ws/sample/sample.js +96 -0
- package/dist/bop/bop-ws/sample/sample.js.map +1 -0
- package/dist/bop/index.d.ts +5 -0
- package/dist/bop/index.js +37 -0
- package/dist/bop/index.js.map +1 -0
- package/dist/bop-sdk/index.d.ts +13 -0
- package/dist/bop-sdk/index.js +45 -0
- package/dist/bop-sdk/index.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-account.d.ts +8 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-account.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-account.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-chain.d.ts +5 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-chain.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-chain.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-contract.d.ts +6 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-contract.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-contract.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-ledger.d.ts +8 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-ledger.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-ledger.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-provider.d.ts +12 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-provider.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-provider.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-signer.d.ts +17 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-signer.js +109 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-signer.js.map +1 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-transaction.d.ts +17 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-transaction.js +7 -0
- package/dist/bop-sdk/interface/abstract-service/abstract-transaction.js.map +1 -0
- package/dist/bop-sdk/interface/provider-ws.d.ts +5 -0
- package/dist/bop-sdk/interface/provider-ws.js +12 -0
- package/dist/bop-sdk/interface/provider-ws.js.map +1 -0
- package/dist/bop-sdk/interface/provider.d.ts +7 -0
- package/dist/bop-sdk/interface/provider.js +23 -0
- package/dist/bop-sdk/interface/provider.js.map +1 -0
- package/dist/bop-sdk/interface/service/3rd.d.ts +12 -0
- package/dist/bop-sdk/interface/service/3rd.js +49 -0
- package/dist/bop-sdk/interface/service/3rd.js.map +1 -0
- package/dist/bop-sdk/interface/service/account.d.ts +12 -0
- package/dist/bop-sdk/interface/service/account.js +98 -0
- package/dist/bop-sdk/interface/service/account.js.map +1 -0
- package/dist/bop-sdk/interface/service/chain.d.ts +9 -0
- package/dist/bop-sdk/interface/service/chain.js +55 -0
- package/dist/bop-sdk/interface/service/chain.js.map +1 -0
- package/dist/bop-sdk/interface/service/contract.d.ts +10 -0
- package/dist/bop-sdk/interface/service/contract.js +67 -0
- package/dist/bop-sdk/interface/service/contract.js.map +1 -0
- package/dist/bop-sdk/interface/service/helper.d.ts +20 -0
- package/dist/bop-sdk/interface/service/helper.js +383 -0
- package/dist/bop-sdk/interface/service/helper.js.map +1 -0
- package/dist/bop-sdk/interface/service/ledger.d.ts +12 -0
- package/dist/bop-sdk/interface/service/ledger.js +89 -0
- package/dist/bop-sdk/interface/service/ledger.js.map +1 -0
- package/dist/bop-sdk/interface/service/offline/check/index.js +138 -0
- package/dist/bop-sdk/interface/service/offline/common/constant.js +6 -0
- package/dist/bop-sdk/interface/service/offline/common/snowFlakeUtils.js +192 -0
- package/dist/bop-sdk/interface/service/offline/common/util.js +511 -0
- package/dist/bop-sdk/interface/service/offline/exception/customErrors.js +29 -0
- package/dist/bop-sdk/interface/service/offline/exception/errors.js +90 -0
- package/dist/bop-sdk/interface/service/offline/exception/index.js +5 -0
- package/dist/bop-sdk/interface/service/offline/operation/accountCreateOperation.js +28 -0
- package/dist/bop-sdk/interface/service/offline/operation/accountSetMetadataOperation.js +44 -0
- package/dist/bop-sdk/interface/service/offline/operation/accountSetPrivilegeOperation.js +49 -0
- package/dist/bop-sdk/interface/service/offline/operation/contractCreateOperation.js +43 -0
- package/dist/bop-sdk/interface/service/offline/operation/contractInvokeOperation.js +42 -0
- package/dist/bop-sdk/interface/service/offline/operation/contractInvokeRequestOperation.js +69 -0
- package/dist/bop-sdk/interface/service/offline/operation/gasSendOperation.js +29 -0
- package/dist/bop-sdk/interface/service/offline/operation/gasSendRequestOperation.js +61 -0
- package/dist/bop-sdk/interface/service/offline/operation/index.js +20 -0
- package/dist/bop-sdk/interface/service/offline/proto/chain_pb.js +12079 -0
- package/dist/bop-sdk/interface/service/offline/proto/common_pb.js +2867 -0
- package/dist/bop-sdk/interface/service/offline/transaction/index.js +988 -0
- package/dist/bop-sdk/interface/service/offline/transaction/operations.js +188 -0
- package/dist/bop-sdk/interface/service/offline/validate/account.js +152 -0
- package/dist/bop-sdk/interface/service/offline/validate/contract.js +101 -0
- package/dist/bop-sdk/interface/service/offline/validate/index.js +10 -0
- package/dist/bop-sdk/interface/service/offline/validate/transaction.js +51 -0
- package/dist/bop-sdk/interface/service/transaction.d.ts +21 -0
- package/dist/bop-sdk/interface/service/transaction.js +591 -0
- package/dist/bop-sdk/interface/service/transaction.js.map +1 -0
- package/dist/bop-sdk/interface/signer.d.ts +12 -0
- package/dist/bop-sdk/interface/signer.js +53 -0
- package/dist/bop-sdk/interface/signer.js.map +1 -0
- package/dist/bop-sdk/interface/test/3rd.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/3rd.test.js +1524 -0
- package/dist/bop-sdk/interface/test/3rd.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/account.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/account.test.js +225 -0
- package/dist/bop-sdk/interface/test/account.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/chain.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/chain.test.js +72 -0
- package/dist/bop-sdk/interface/test/chain.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/contract.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/contract.test.js +266 -0
- package/dist/bop-sdk/interface/test/contract.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/ledger.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/ledger.test.js +167 -0
- package/dist/bop-sdk/interface/test/ledger.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/provider.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/provider.test.js +295 -0
- package/dist/bop-sdk/interface/test/provider.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/signer.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/signer.test.js +87 -0
- package/dist/bop-sdk/interface/test/signer.test.js.map +1 -0
- package/dist/bop-sdk/interface/test/transaction.test.d.ts +1 -0
- package/dist/bop-sdk/interface/test/transaction.test.js +663 -0
- package/dist/bop-sdk/interface/test/transaction.test.js.map +1 -0
- package/dist/bop-sdk/proto/bop-sdk-common.d.ts +225 -0
- package/dist/bop-sdk/proto/bop-sdk-common.js +831 -0
- package/dist/bop-sdk/proto/bop-sdk-common.js.map +1 -0
- package/dist/bop-sdk/proto/bop-sdk-interface.d.ts +623 -0
- package/dist/bop-sdk/proto/bop-sdk-interface.js +8623 -0
- package/dist/bop-sdk/proto/bop-sdk-interface.js.map +1 -0
- package/dist/bop-sdk/proto/bop-sdk-utils.d.ts +107 -0
- package/dist/bop-sdk/proto/bop-sdk-utils.js +1160 -0
- package/dist/bop-sdk/proto/bop-sdk-utils.js.map +1 -0
- package/dist/bop-sdk/utils/abi/abi-coder.d.ts +16 -0
- package/dist/bop-sdk/utils/abi/abi-coder.js +101 -0
- package/dist/bop-sdk/utils/abi/abi-coder.js.map +1 -0
- package/dist/bop-sdk/utils/abi/address.d.ts +8 -0
- package/dist/bop-sdk/utils/abi/address.js +116 -0
- package/dist/bop-sdk/utils/abi/address.js.map +1 -0
- package/dist/bop-sdk/utils/abi/bignumber.d.ts +39 -0
- package/dist/bop-sdk/utils/abi/bignumber.js +316 -0
- package/dist/bop-sdk/utils/abi/bignumber.js.map +1 -0
- package/dist/bop-sdk/utils/abi/bytes.d.ts +41 -0
- package/dist/bop-sdk/utils/abi/bytes.js +423 -0
- package/dist/bop-sdk/utils/abi/bytes.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/abstract-coder.d.ts +52 -0
- package/dist/bop-sdk/utils/abi/coders/abstract-coder.js +164 -0
- package/dist/bop-sdk/utils/abi/coders/abstract-coder.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/address.d.ts +7 -0
- package/dist/bop-sdk/utils/abi/coders/address.js +52 -0
- package/dist/bop-sdk/utils/abi/coders/address.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/anonymous.d.ts +8 -0
- package/dist/bop-sdk/utils/abi/coders/anonymous.js +22 -0
- package/dist/bop-sdk/utils/abi/coders/anonymous.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/array.d.ts +13 -0
- package/dist/bop-sdk/utils/abi/coders/array.js +220 -0
- package/dist/bop-sdk/utils/abi/coders/array.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/boolean.d.ts +7 -0
- package/dist/bop-sdk/utils/abi/coders/boolean.js +20 -0
- package/dist/bop-sdk/utils/abi/coders/boolean.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/bytes.d.ts +11 -0
- package/dist/bop-sdk/utils/abi/coders/bytes.js +33 -0
- package/dist/bop-sdk/utils/abi/coders/bytes.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/fixed-bytes.d.ts +9 -0
- package/dist/bop-sdk/utils/abi/coders/fixed-bytes.js +28 -0
- package/dist/bop-sdk/utils/abi/coders/fixed-bytes.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/null.d.ts +7 -0
- package/dist/bop-sdk/utils/abi/coders/null.js +24 -0
- package/dist/bop-sdk/utils/abi/coders/null.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/number.d.ts +10 -0
- package/dist/bop-sdk/utils/abi/coders/number.js +45 -0
- package/dist/bop-sdk/utils/abi/coders/number.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/string.d.ts +8 -0
- package/dist/bop-sdk/utils/abi/coders/string.js +21 -0
- package/dist/bop-sdk/utils/abi/coders/string.js.map +1 -0
- package/dist/bop-sdk/utils/abi/coders/tuple.d.ts +10 -0
- package/dist/bop-sdk/utils/abi/coders/tuple.js +60 -0
- package/dist/bop-sdk/utils/abi/coders/tuple.js.map +1 -0
- package/dist/bop-sdk/utils/abi/constants/addresses.d.ts +1 -0
- package/dist/bop-sdk/utils/abi/constants/addresses.js +5 -0
- package/dist/bop-sdk/utils/abi/constants/addresses.js.map +1 -0
- package/dist/bop-sdk/utils/abi/constants/bignumbers.d.ts +10 -0
- package/dist/bop-sdk/utils/abi/constants/bignumbers.js +21 -0
- package/dist/bop-sdk/utils/abi/constants/bignumbers.js.map +1 -0
- package/dist/bop-sdk/utils/abi/constants/hashes.d.ts +1 -0
- package/dist/bop-sdk/utils/abi/constants/hashes.js +5 -0
- package/dist/bop-sdk/utils/abi/constants/hashes.js.map +1 -0
- package/dist/bop-sdk/utils/abi/constants/index.d.ts +4 -0
- package/dist/bop-sdk/utils/abi/constants/index.js +19 -0
- package/dist/bop-sdk/utils/abi/constants/index.js.map +1 -0
- package/dist/bop-sdk/utils/abi/constants/strings.d.ts +1 -0
- package/dist/bop-sdk/utils/abi/constants/strings.js +6 -0
- package/dist/bop-sdk/utils/abi/constants/strings.js.map +1 -0
- package/dist/bop-sdk/utils/abi/fragments.d.ts +84 -0
- package/dist/bop-sdk/utils/abi/fragments.js +919 -0
- package/dist/bop-sdk/utils/abi/fragments.js.map +1 -0
- package/dist/bop-sdk/utils/abi/id.d.ts +1 -0
- package/dist/bop-sdk/utils/abi/id.js +10 -0
- package/dist/bop-sdk/utils/abi/id.js.map +1 -0
- package/dist/bop-sdk/utils/abi/index.d.ts +4 -0
- package/dist/bop-sdk/utils/abi/index.js +21 -0
- package/dist/bop-sdk/utils/abi/index.js.map +1 -0
- package/dist/bop-sdk/utils/abi/interface.d.ts +83 -0
- package/dist/bop-sdk/utils/abi/interface.js +663 -0
- package/dist/bop-sdk/utils/abi/interface.js.map +1 -0
- package/dist/bop-sdk/utils/abi/keccak256.d.ts +2 -0
- package/dist/bop-sdk/utils/abi/keccak256.js +13 -0
- package/dist/bop-sdk/utils/abi/keccak256.js.map +1 -0
- package/dist/bop-sdk/utils/abi/properties.d.ts +16 -0
- package/dist/bop-sdk/utils/abi/properties.js +141 -0
- package/dist/bop-sdk/utils/abi/properties.js.map +1 -0
- package/dist/bop-sdk/utils/abi/strings/bytes32.d.ts +3 -0
- package/dist/bop-sdk/utils/abi/strings/bytes32.js +36 -0
- package/dist/bop-sdk/utils/abi/strings/bytes32.js.map +1 -0
- package/dist/bop-sdk/utils/abi/strings/idna.d.ts +4 -0
- package/dist/bop-sdk/utils/abi/strings/idna.js +200 -0
- package/dist/bop-sdk/utils/abi/strings/idna.js.map +1 -0
- package/dist/bop-sdk/utils/abi/strings/index.d.ts +4 -0
- package/dist/bop-sdk/utils/abi/strings/index.js +17 -0
- package/dist/bop-sdk/utils/abi/strings/index.js.map +1 -0
- package/dist/bop-sdk/utils/abi/strings/utf8.d.ts +26 -0
- package/dist/bop-sdk/utils/abi/strings/utf8.js +265 -0
- package/dist/bop-sdk/utils/abi/strings/utf8.js.map +1 -0
- package/dist/bop-sdk/utils/encryption-address.d.ts +25 -0
- package/dist/bop-sdk/utils/encryption-address.js +426 -0
- package/dist/bop-sdk/utils/encryption-address.js.map +1 -0
- package/dist/bop-sdk/utils/encryption-crypto.d.ts +16 -0
- package/dist/bop-sdk/utils/encryption-crypto.js +406 -0
- package/dist/bop-sdk/utils/encryption-crypto.js.map +1 -0
- package/dist/bop-sdk/utils/encryption-mnemonics.d.ts +7 -0
- package/dist/bop-sdk/utils/encryption-mnemonics.js +129 -0
- package/dist/bop-sdk/utils/encryption-mnemonics.js.map +1 -0
- package/dist/bop-sdk/utils/index.d.ts +13 -0
- package/dist/bop-sdk/utils/index.js +22 -0
- package/dist/bop-sdk/utils/index.js.map +1 -0
- package/dist/bop-sdk/utils/logger.d.ts +52 -0
- package/dist/bop-sdk/utils/logger.js +377 -0
- package/dist/bop-sdk/utils/logger.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -88
- package/tsconfig.json +24 -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,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
|
+
}
|