openchain-nodejs-ts-yxl 1.1.0 → 1.1.2
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/index.d.ts +0 -13
- package/index.js +1 -0
- package/lib/common/operation/index.js +52 -0
- package/lib/common/util.js +693 -685
- package/package.json +12 -6
package/index.d.ts
CHANGED
@@ -992,18 +992,6 @@ export interface ContractInvokeResult {
|
|
992
992
|
logs: string;
|
993
993
|
}
|
994
994
|
|
995
|
-
/**
|
996
|
-
* 合约调用参数
|
997
|
-
* @interface
|
998
|
-
* @property {string} [contractAddress] 合约账户地址
|
999
|
-
* @property {string} [sourceAddress] 调用者账户地址
|
1000
|
-
* @property {string} [code] 合约代码
|
1001
|
-
* @property {string} [input] 合约调用输入数据
|
1002
|
-
* @property {string} [contractBalance] 合约账户余额
|
1003
|
-
* @property {number} optType 操作类型(1-查询,2-调用)
|
1004
|
-
* @property {string} [feeLimit] 交易费用上限
|
1005
|
-
* @property {string} [gasPrice] Gas单价
|
1006
|
-
*/
|
1007
995
|
/**
|
1008
996
|
* 合约调用参数
|
1009
997
|
* @interface
|
@@ -1358,7 +1346,6 @@ export interface BlockFeesResult {
|
|
1358
1346
|
fees: {
|
1359
1347
|
base_reserve: string;
|
1360
1348
|
gas_price: string;
|
1361
|
-
[key: string]: any;
|
1362
1349
|
};
|
1363
1350
|
}
|
1364
1351
|
|
package/index.js
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
// 预先导入所有操作类型模块
|
4
|
+
const accountSetMetadata = require('./accountSetMetadata');
|
5
|
+
const accountSetPrivilege = require('./accountSetPrivilege');
|
6
|
+
const activateAccount = require('./activateAccount');
|
7
|
+
const contractCreate = require('./contractCreate');
|
8
|
+
const contractInvokeByAsset = require('./contractInvokeByAsset');
|
9
|
+
const contractInvokeByCcer = require('./contractInvokeByCcer');
|
10
|
+
const createLog = require('./createLog');
|
11
|
+
const ctp10TokenApprove = require('./ctp10TokenApprove');
|
12
|
+
const ctp10TokenAssign = require('./ctp10TokenAssign');
|
13
|
+
const ctp10TokenChangeOwner = require('./ctp10TokenChangeOwner');
|
14
|
+
const ctp10TokenIssue = require('./ctp10TokenIssue');
|
15
|
+
const ctp10TokenTransfer = require('./ctp10TokenTransfer');
|
16
|
+
const ctp10TokenTransferFrom = require('./ctp10TokenTransferFrom');
|
17
|
+
const issueAsset = require('./issueAsset');
|
18
|
+
const payAsset = require('./payAsset');
|
19
|
+
const payCoin = require('./payCoin');
|
20
|
+
|
21
|
+
// 创建操作类型到模块的映射表
|
22
|
+
const operationModules = {
|
23
|
+
accountSetMetadata,
|
24
|
+
accountSetPrivilege,
|
25
|
+
activateAccount,
|
26
|
+
contractCreate,
|
27
|
+
contractInvokeByAsset,
|
28
|
+
contractInvokeByCcer,
|
29
|
+
createLog,
|
30
|
+
ctp10TokenApprove,
|
31
|
+
ctp10TokenAssign,
|
32
|
+
ctp10TokenChangeOwner,
|
33
|
+
ctp10TokenIssue,
|
34
|
+
ctp10TokenTransfer,
|
35
|
+
ctp10TokenTransferFrom,
|
36
|
+
issueAsset,
|
37
|
+
payAsset,
|
38
|
+
payCoin
|
39
|
+
};
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 获取操作模块
|
43
|
+
* @param {string} type - 操作类型名称
|
44
|
+
* @returns {Function} - 操作模块函数
|
45
|
+
*/
|
46
|
+
module.exports = function getOperationModule(type) {
|
47
|
+
const module = operationModules[type];
|
48
|
+
if (!module) {
|
49
|
+
throw new Error(`Operation type '${type}' not found. Available types: ${Object.keys(operationModules).join(', ')}`);
|
50
|
+
}
|
51
|
+
return module;
|
52
|
+
};
|