openchain-nodejs-ts-yxl 1.0.4 → 1.0.6

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 (2) hide show
  1. package/index.d.ts +68 -9
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -202,6 +202,65 @@ declare class OpenChainSDK {
202
202
  };
203
203
 
204
204
  contract: {
205
+ /**
206
+ * 检查合约地址有效性
207
+ * @param {string} contractAddress 合约账户地址
208
+ * @returns {Promise<{errorCode:number, result:{isValid:boolean}}>}
209
+ * @example
210
+ * sdk.contract.checkValid('adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r').then(console.log);
211
+ *
212
+ * // 返回示例:
213
+ * {
214
+ * errorCode: 0,
215
+ * result: {
216
+ * isValid: true
217
+ * }
218
+ * }
219
+ *
220
+ * // 错误码:
221
+ * // - INVALID_CONTRACTADDRESS_ERROR 11037 无效合约地址
222
+ * // - ACCOUNT_NOT_EXIST 11003 账户不存在
223
+ */
224
+ checkValid(contractAddress: string): Promise<{ errorCode: number; result: { isValid: boolean } }>;
225
+
226
+ /**
227
+ * 调用合约方法
228
+ * @param {ContractCallParams} args 合约调用参数
229
+ * @returns {Promise<{errorCode:number, result:ContractCallResult}>}
230
+ * @example
231
+ * sdk.contract.call({
232
+ * contractAddress: 'adx...',
233
+ * sourceAddress: 'adx...',
234
+ * input: 'method(param)',
235
+ * contractBalance: '0',
236
+ * optType: 2,
237
+ * feeLimit: '1000000',
238
+ * gasPrice: '100'
239
+ * }).then(console.log);
240
+ *
241
+ * // 返回示例:
242
+ * {
243
+ * errorCode: 0,
244
+ * result: {
245
+ * logs: 'execution logs',
246
+ * queryRets: ['return value'],
247
+ * stat: {
248
+ * apply_time: 0,
249
+ * memory_usage: 0,
250
+ * stack_usage: 0,
251
+ * step: 0
252
+ * }
253
+ * }
254
+ * }
255
+ *
256
+ * // 错误码:
257
+ * // - INVALID_ARGUMENTS 11001 无效参数
258
+ * // - INVALID_OPTTYPE_ERROR 11045 无效的操作类型
259
+ * // - CONTRACTADDRESS_CODE_BOTH_NULL_ERROR 11046 合约地址和代码不能同时为空
260
+ * // - INVALID_CONTRACTADDRESS_ERROR 11037 无效合约地址
261
+ */
262
+ call(args: ContractCallParams): Promise<{ errorCode: number; result: ContractCallResult }>;
263
+
205
264
  /**
206
265
  * 查询合约信息
207
266
  * @param {string} contractAddress 合约账户地址(需以'adx'开头的base58编码格式)
@@ -227,21 +286,23 @@ declare class OpenChainSDK {
227
286
  * // - SYSTEM_ERROR 20000 系统错误
228
287
  */
229
288
  getInfo(contractAddress: string): Promise<{ errorCode: number; result: ContractInfoResult }>;
230
-
289
+
231
290
  /**
232
291
  * 通过交易哈希查询合约地址
233
292
  * @param {string} hash 创建合约的交易哈希(64位十六进制字符串)
234
- * @returns {Promise<{errorCode:number, result:ContractAddressInfo[]}>}
293
+ * @returns {Promise<{errorCode:number, result:{contractAddressList:ContractAddressInfo[]}}}>}
235
294
  * @example
236
295
  * sdk.contract.getAddress('cc4c...').then(console.log);
237
296
  *
238
297
  * // 返回示例:
239
298
  * {
240
299
  * errorCode: 0,
241
- * result: [{
242
- * contract_address: 'adx...',
243
- * operation_index: 0
244
- * }]
300
+ * result: {
301
+ * contractAddressList: [{
302
+ * contract_address: 'adx...',
303
+ * operation_index: 0
304
+ * }]
305
+ * }
245
306
  * }
246
307
  *
247
308
  * // 错误码:
@@ -249,7 +310,7 @@ declare class OpenChainSDK {
249
310
  * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
250
311
  * // - INVALID_CONTRACT_HASH 11040 无效的合约哈希
251
312
  */
252
- getAddress(hash: string): Promise<{ errorCode: number; result: ContractAddressInfo[] }>;
313
+ getAddress(hash: string): Promise<{ errorCode: number; result: { contractAddressList: ContractAddressInfo[] } }>;
253
314
 
254
315
  /**
255
316
  * 创建智能合约
@@ -932,10 +993,8 @@ export interface ContractInvokeResult {
932
993
  }
933
994
 
934
995
  export interface OperationResult {
935
- operation: {
936
996
  type: string;
937
997
  data: Record<string, any>;
938
- };
939
998
  }
940
999
 
941
1000
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openchain-nodejs-ts-yxl",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "openchain sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",