openchain-nodejs-ts-yxl 1.0.2 → 1.0.4

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 CHANGED
@@ -1,16 +1,36 @@
1
+ /**
2
+ * OpenChain SDK配置参数接口
3
+ */
4
+ export interface OpenChainSDKConfig {
5
+ /** 区块链节点API地址 */
6
+ host: string;
7
+ /** 链ID */
8
+ chainID?: number;
9
+ /** 请求超时时间(ms) */
10
+ timeout?: number;
11
+ /** 是否使用HTTPS */
12
+ secure?: boolean;
13
+ }
14
+
1
15
  /**
2
16
  * OpenChain区块链SDK核心类
3
17
  * @class
4
18
  * @example
5
19
  * const sdk = new OpenChainSDK({host: 'http://api.openchain.org'});
6
20
  */
7
- export class OpenChainSDK {
21
+ declare class OpenChainSDK {
8
22
  /**
9
23
  * 初始化SDK实例
10
- * @param {Object} config 配置参数
11
- * @param {string} config.host 区块链节点API地址
24
+ * @param {OpenChainSDKConfig} config 配置参数
25
+ * @example
26
+ * const sdk = new OpenChainSDK({
27
+ * host: 'http://api.openchain.org',
28
+ * chainID: 0,
29
+ * timeout: 3000,
30
+ * secure: false
31
+ * });
12
32
  */
13
- constructor(config: { host: string, chainID?: number, timeout?: number, secure?: boolean});
33
+ constructor(config: OpenChainSDKConfig);
14
34
 
15
35
  account: {
16
36
  /**
@@ -19,82 +39,163 @@ export class OpenChainSDK {
19
39
  * @example
20
40
  * sdk.account.create().then(console.log);
21
41
  *
42
+ * // 返回示例:
43
+ * {
44
+ * errorCode: 0,
45
+ * result: {
46
+ * privateKey: 'priv4FXWYaYMpGMeYtEPyUWBCH5aGVGtGR5uvtXGKxgBU2',
47
+ * publicKey: 'b001d8236a15923c91eab5b36dc0ea7c5faad04ed9184246a5d18c4547b06c89e4b',
48
+ * address: 'adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF'
49
+ * }
50
+ * }
51
+ *
22
52
  * // 错误码:
23
53
  * // - SYSTEM_ERROR 20000 系统错误
54
+ * // - KEYPAIR_CREATE_ERROR 11031 密钥对创建失败
24
55
  */
25
56
  create(): Promise<{ errorCode: number; result: { privateKey: string; publicKey: string; address: string } }>;
57
+
26
58
  /**
27
59
  * 查询账户信息
28
- * @param {string} address 账户地址
60
+ * @param {string} address 账户地址(需以'adx'开头的base58编码格式)
29
61
  * @returns {Promise<{errorCode:number, result:AccountInfoResult}>}
30
62
  * @example
31
- * sdk.account.getInfo('adxS...').then(console.log);
63
+ * sdk.account.getInfo('adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF').then(console.log);
64
+ *
65
+ * // 返回示例:
66
+ * {
67
+ * errorCode: 0,
68
+ * result: {
69
+ * address: 'adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF',
70
+ * balance: '1000000000',
71
+ * nonce: '1',
72
+ * type_thresholds: [{
73
+ * type: 1,
74
+ * threshold: '1'
75
+ * }]
76
+ * }
77
+ * }
32
78
  *
33
79
  * // 错误码:
34
- * // - INVALID_SOURCEADDRESS_ERROR 11002 无效地址
80
+ * // - INVALID_ADDRESS_ERROR 11002 无效地址
81
+ * // - ACCOUNT_NOT_EXIST 11003 账户不存在
82
+ * // - ACCOUNT_NOT_ACTIVATED 11004 账户未激活
35
83
  */
36
84
  getInfo(address: string): Promise<{ errorCode: number; result: AccountInfoResult }>;
85
+
37
86
  /**
38
87
  * 校验账户地址有效性
39
- * @param {string} address 待校验的区块链地址(需符合adx开头base58编码格式)
88
+ * @param {string} address 待校验的区块链地址(需以'adx'开头的base58编码格式)
40
89
  * @returns {Promise<{errorCode:number, result:{isValid:boolean}}>}
41
90
  * @example
42
- * sdk.account.checkValid('adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2').then(console.log);
91
+ * sdk.account.checkValid('adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF').then(console.log);
92
+ *
93
+ * // 返回示例:
94
+ * {
95
+ * errorCode: 0,
96
+ * result: {
97
+ * isValid: true
98
+ * }
99
+ * }
43
100
  *
44
101
  * // 错误码:
45
102
  * // - INVALID_ADDRESS_ERROR 11002 地址格式错误
103
+ * // - ADDRESS_LENGTH_ERROR 11003 地址长度错误
104
+ * // - ADDRESS_CHECKSUM_ERROR 11004 地址校验和错误
46
105
  */
47
106
  checkValid(address: string): Promise<{ errorCode: number; result: { isValid: boolean } }>;
48
107
 
49
108
  /**
50
109
  * 查询账户余额
51
- * @param {string} address 账户地址
110
+ * @param {string} address 账户地址(需以'adx'开头的base58编码格式)
52
111
  * @returns {Promise<{errorCode:number, result:{balance:string}}>} 余额单位MO(1 MO = 1e8 stroop)
53
112
  * @example
54
- * sdk.account.getBalance('adxS...').then(console.log);
113
+ * sdk.account.getBalance('adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF').then(console.log);
114
+ *
115
+ * // 返回示例:
116
+ * {
117
+ * errorCode: 0,
118
+ * result: {
119
+ * balance: '1000000000' // 10 MO
120
+ * }
121
+ * }
55
122
  *
56
123
  * // 错误码:
57
124
  * // - INVALID_ADDRESS_ERROR 11002 无效地址
58
125
  * // - ACCOUNT_NOT_EXIST 11003 账户不存在
126
+ * // - ACCOUNT_NOT_ACTIVATED 11004 账户未激活
59
127
  */
60
128
  getBalance(address: string): Promise<{ errorCode: number; result: { balance: string } }>;
61
129
 
62
130
  /**
63
131
  * 获取账户交易序列号
64
- * @param {string} address 账户地址
132
+ * @param {string} address 账户地址(需以'adx'开头的base58编码格式)
65
133
  * @returns {Promise<{errorCode:number, result:{nonce:string}}>} nonce值用于防止重放攻击
66
134
  * @example
67
- * sdk.account.getNonce('adxS...').then(console.log);
135
+ * sdk.account.getNonce('adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF').then(console.log);
136
+ *
137
+ * // 返回示例:
138
+ * {
139
+ * errorCode: 0,
140
+ * result: {
141
+ * nonce: '1'
142
+ * }
143
+ * }
68
144
  *
69
145
  * // 错误码:
70
146
  * // - INVALID_ADDRESS_ERROR 11002 无效地址
71
147
  * // - ACCOUNT_NOT_EXIST 11003 账户不存在
148
+ * // - ACCOUNT_NOT_ACTIVATED 11004 账户未激活
72
149
  */
73
150
  getNonce(address: string): Promise<{ errorCode: number; result: { nonce: string } }>;
74
151
 
75
152
  /**
76
153
  * 查询账户元数据
77
154
  * @param {Object} params 查询参数
78
- * @param {string} params.address 账户地址
79
- * @param {string} params.key 元数据键
155
+ * @param {string} params.address 账户地址(需以'adx'开头的base58编码格式)
156
+ * @param {string} params.key 元数据键(不超过1024字节)
80
157
  * @returns {Promise<{errorCode:number, result:MetadataResult}>} 包含版本号和值的元数据
81
158
  * @example
82
- * sdk.account.getMetadata({address:'adxS...', key:'kyc_info'}).then(console.log);
159
+ * sdk.account.getMetadata({
160
+ * address: 'adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF',
161
+ * key: 'kyc_info'
162
+ * }).then(console.log);
163
+ *
164
+ * // 返回示例:
165
+ * {
166
+ * errorCode: 0,
167
+ * result: {
168
+ * version: '1',
169
+ * value: 'metadata value'
170
+ * }
171
+ * }
83
172
  *
84
173
  * // 错误码:
85
174
  * // - METADATA_NOT_FOUND 12001 元数据不存在
86
175
  * // - INVALID_ADDRESS_ERROR 11002 无效地址
176
+ * // - INVALID_DATAKEY_ERROR 11011 无效的元数据键
177
+ * // - ACCOUNT_NOT_EXIST 11003 账户不存在
87
178
  */
88
179
  getMetadata(params: { address: string; key: string }): Promise<{ errorCode: number; result: MetadataResult }>;
89
180
 
90
181
  /**
91
182
  * 检查账户是否激活
92
- * @param {string} address 待检查账户地址
183
+ * @param {string} address 待检查账户地址(需以'adx'开头的base58编码格式)
93
184
  * @returns {Promise<{errorCode:number, result:{isActivated:boolean}}>}
94
185
  * @example
95
- * 参见test/accountActivateOperation.test.js示例
186
+ * sdk.account.isActivated('adxSZHxE1YzrDRyQCJVpx7aStghSvyJTQAzF').then(console.log);
187
+ *
188
+ * // 返回示例:
189
+ * {
190
+ * errorCode: 0,
191
+ * result: {
192
+ * isActivated: true
193
+ * }
194
+ * }
96
195
  *
97
196
  * // 错误码:
197
+ * // - INVALID_ADDRESS_ERROR 11002 无效地址
198
+ * // - ACCOUNT_NOT_EXIST 11003 账户不存在
98
199
  * // - ACCOUNT_NOT_ACTIVATED 11004 账户未激活
99
200
  */
100
201
  isActivated(address: string): Promise<{ errorCode: number; result: { isActivated: boolean } }>;
@@ -108,9 +209,21 @@ export class OpenChainSDK {
108
209
  * @example
109
210
  * sdk.contract.getInfo('adxScpCtbeLP2KGRaCkbtrmz8iB5mu6DQcW3r').then(console.log);
110
211
  *
212
+ * // 返回示例:
213
+ * {
214
+ * errorCode: 0,
215
+ * result: {
216
+ * contract: {
217
+ * type: 0,
218
+ * payload: '...'
219
+ * }
220
+ * }
221
+ * }
222
+ *
111
223
  * // 错误码:
112
224
  * // - INVALID_CONTRACTADDRESS_ERROR 11037 无效合约地址
113
225
  * // - CONTRACTADDRESS_NOT_CONTRACTACCOUNT_ERROR 11038 非合约账户地址
226
+ * // - CONTRACT_NOT_EXIST 11039 合约不存在
114
227
  * // - SYSTEM_ERROR 20000 系统错误
115
228
  */
116
229
  getInfo(contractAddress: string): Promise<{ errorCode: number; result: ContractInfoResult }>;
@@ -122,10 +235,19 @@ export class OpenChainSDK {
122
235
  * @example
123
236
  * sdk.contract.getAddress('cc4c...').then(console.log);
124
237
  *
238
+ * // 返回示例:
239
+ * {
240
+ * errorCode: 0,
241
+ * result: [{
242
+ * contract_address: 'adx...',
243
+ * operation_index: 0
244
+ * }]
245
+ * }
246
+ *
125
247
  * // 错误码:
126
248
  * // - INVALID_HASH_ERROR 11025 无效交易哈希
127
249
  * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
128
- * // 参见test/contractCreateTransaction.test.js示例
250
+ * // - INVALID_CONTRACT_HASH 11040 无效的合约哈希
129
251
  */
130
252
  getAddress(hash: string): Promise<{ errorCode: number; result: ContractAddressInfo[] }>;
131
253
 
@@ -138,12 +260,25 @@ export class OpenChainSDK {
138
260
  * sourceAddress: 'adx...',
139
261
  * initBalance: '10',
140
262
  * type: 0,
141
- * payload: 'contract code'
263
+ * payload: 'contract code',
264
+ * initInput: 'constructor(param)',
265
+ * metadata: 'create contract'
142
266
  * }).then(console.log);
267
+ *
268
+ * // 返回示例:
269
+ * {
270
+ * errorCode: 0,
271
+ * result: {
272
+ * contract_address: 'adx...',
273
+ * operation_index: 0
274
+ * }
275
+ * }
143
276
  *
144
277
  * // 错误码:
145
278
  * // - INVALID_SOURCEADDRESS_ERROR 11002 无效源地址
146
279
  * // - PAYLOAD_EMPTY_ERROR 11044 合约代码为空
280
+ * // - INVALID_CONTRACT_TYPE 11041 无效的合约类型
281
+ * // - INVALID_INIT_BALANCE 11042 无效的初始化余额
147
282
  */
148
283
  createContract(params: ContractCreateParams): Promise<{ errorCode: number; result: ContractAddressInfo }>;
149
284
 
@@ -155,11 +290,24 @@ export class OpenChainSDK {
155
290
  * sdk.contract.invokeContract({
156
291
  * sourceAddress: 'adx...',
157
292
  * contractAddress: 'adx...',
158
- * input: 'methodName(param)'
293
+ * input: 'methodName(param)',
294
+ * metadata: 'invoke contract'
159
295
  * }).then(console.log);
296
+ *
297
+ * // 返回示例:
298
+ * {
299
+ * errorCode: 0,
300
+ * result: {
301
+ * result: 'execution result',
302
+ * logs: 'execution logs'
303
+ * }
304
+ * }
160
305
  *
161
306
  * // 错误码:
162
307
  * // - CONTRACT_EXECUTE_FAILED 12003 合约执行失败
308
+ * // - INVALID_CONTRACTADDRESS_ERROR 11037 无效合约地址
309
+ * // - CONTRACT_NOT_EXIST 11039 合约不存在
310
+ * // - INVALID_INPUT_ERROR 11043 无效的输入参数
163
311
  */
164
312
  invokeContract(params: ContractInvokeParams): Promise<{ errorCode: number; result: ContractInvokeResult }>;
165
313
  };
@@ -199,6 +347,102 @@ export class OpenChainSDK {
199
347
  * // - BLOCK_NOT_EXIST 11008 区块不存在
200
348
  */
201
349
  getTransactions(blockNumber: string): Promise<{ errorCode: number; result: TransactionListResult }>;
350
+
351
+ /**
352
+ * 获取指定区块信息
353
+ * @param {string} blockNumber 区块高度
354
+ * @returns {Promise<{errorCode:number, result:BlockInfoResult}>} 返回区块信息
355
+ * @example
356
+ * sdk.block.getInfo('100').then(console.log);
357
+ *
358
+ * // 错误码:
359
+ * // - INVALID_BLOCKNUMBER_ERROR 11007 无效区块高度
360
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
361
+ */
362
+ getInfo(blockNumber: string): Promise<{ errorCode: number; result: BlockInfoResult }>;
363
+
364
+ /**
365
+ * 获取最新区块信息
366
+ * @returns {Promise<{errorCode:number, result:BlockInfoResult}>} 返回最新区块信息
367
+ * @example
368
+ * sdk.block.getLatestInfo().then(console.log);
369
+ *
370
+ * // 错误码:
371
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
372
+ */
373
+ getLatestInfo(): Promise<{ errorCode: number; result: BlockInfoResult }>;
374
+
375
+ /**
376
+ * 获取指定区块的验证者信息
377
+ * @param {string} blockNumber 区块高度
378
+ * @returns {Promise<{errorCode:number, result:ValidatorsResult}>} 返回验证者信息
379
+ * @example
380
+ * sdk.block.getValidators('100').then(console.log);
381
+ *
382
+ * // 错误码:
383
+ * // - INVALID_BLOCKNUMBER_ERROR 11007 无效区块高度
384
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
385
+ */
386
+ getValidators(blockNumber: string): Promise<{ errorCode: number; result: ValidatorsResult }>;
387
+
388
+ /**
389
+ * 获取最新区块的验证者信息
390
+ * @returns {Promise<{errorCode:number, result:ValidatorsResult}>} 返回最新验证者信息
391
+ * @example
392
+ * sdk.block.getLatestValidators().then(console.log);
393
+ *
394
+ * // 错误码:
395
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
396
+ */
397
+ getLatestValidators(): Promise<{ errorCode: number; result: ValidatorsResult }>;
398
+
399
+ /**
400
+ * 获取指定区块的奖励信息
401
+ * @param {string} blockNumber 区块高度
402
+ * @returns {Promise<{errorCode:number, result:BlockRewardResult}>} 返回区块奖励信息
403
+ * @example
404
+ * sdk.block.getReward('100').then(console.log);
405
+ *
406
+ * // 错误码:
407
+ * // - INVALID_BLOCKNUMBER_ERROR 11007 无效区块高度
408
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
409
+ */
410
+ getReward(blockNumber: string): Promise<{ errorCode: number; result: BlockRewardResult }>;
411
+
412
+ /**
413
+ * 获取最新区块的奖励信息
414
+ * @returns {Promise<{errorCode:number, result:BlockRewardResult}>} 返回最新区块奖励信息
415
+ * @example
416
+ * sdk.block.getLatestReward().then(console.log);
417
+ *
418
+ * // 错误码:
419
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
420
+ */
421
+ getLatestReward(): Promise<{ errorCode: number; result: BlockRewardResult }>;
422
+
423
+ /**
424
+ * 获取指定区块的手续费信息
425
+ * @param {string} blockNumber 区块高度
426
+ * @returns {Promise<{errorCode:number, result:BlockFeesResult}>} 返回区块手续费信息
427
+ * @example
428
+ * sdk.block.getFees('100').then(console.log);
429
+ *
430
+ * // 错误码:
431
+ * // - INVALID_BLOCKNUMBER_ERROR 11007 无效区块高度
432
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
433
+ */
434
+ getFees(blockNumber: string): Promise<{ errorCode: number; result: BlockFeesResult }>;
435
+
436
+ /**
437
+ * 获取最新区块的手续费信息
438
+ * @returns {Promise<{errorCode:number, result:BlockFeesResult}>} 返回最新区块手续费信息
439
+ * @example
440
+ * sdk.block.getLatestFees().then(console.log);
441
+ *
442
+ * // 错误码:
443
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
444
+ */
445
+ getLatestFees(): Promise<{ errorCode: number; result: BlockFeesResult }>;
202
446
  };
203
447
 
204
448
  operation: {
@@ -222,12 +466,369 @@ export class OpenChainSDK {
222
466
  * @returns {OperationResult} 返回操作结果
223
467
  */
224
468
  accountSetMetadataOperation(params: MetadataParams): { errorCode: number; result: OperationResult };
469
+
470
+ /**
471
+ * 创建合约操作
472
+ * @param {ContractCreateOperationParams} params 合约创建参数
473
+ * @returns {OperationResult} 返回操作结果
474
+ * @example
475
+ * sdk.operation.contractCreateOperation({
476
+ * sourceAddress: 'adx...',
477
+ * initBalance: '10000',
478
+ * type: 0,
479
+ * payload: 'contract code'
480
+ * });
481
+ */
482
+ contractCreateOperation(params: ContractCreateOperationParams): { errorCode: number; result: OperationResult };
483
+
484
+ /**
485
+ * 调用合约操作
486
+ * @param {ContractInvokeOperationParams} params 合约调用参数
487
+ * @returns {OperationResult} 返回操作结果
488
+ * @example
489
+ * sdk.operation.contractInvokeOperation({
490
+ * sourceAddress: 'adx...',
491
+ * contractAddress: 'adx...',
492
+ * input: 'method(param)'
493
+ * });
494
+ */
495
+ contractInvokeOperation(params: ContractInvokeOperationParams): { errorCode: number; result: OperationResult };
496
+
497
+ /**
498
+ * 发送Gas操作
499
+ * @param {GasSendOperationParams} params Gas发送参数
500
+ * @returns {OperationResult} 返回操作结果
501
+ * @example
502
+ * sdk.operation.gasSendOperation({
503
+ * sourceAddress: 'adx...',
504
+ * destAddress: 'adx...',
505
+ * amount: '1000'
506
+ * });
507
+ */
508
+ gasSendOperation(params: GasSendOperationParams): { errorCode: number; result: OperationResult };
509
+
510
+ /**
511
+ * 创建日志操作
512
+ * @param {LogCreateOperationParams} params 日志创建参数
513
+ * @returns {OperationResult} 返回操作结果
514
+ * @example
515
+ * sdk.operation.logCreateOperation({
516
+ * sourceAddress: 'adx...',
517
+ * topic: 'mytopic',
518
+ * data: 'log content'
519
+ * });
520
+ */
521
+ logCreateOperation(params: LogCreateOperationParams): { errorCode: number; result: OperationResult };
522
+ };
523
+
524
+ token: {
525
+ /**
526
+ * 发行代币
527
+ * @param {TokenIssueParams} params 代币发行参数
528
+ * @returns {Promise<{errorCode:number, result:TokenIssueResult}>}
529
+ * @example
530
+ * sdk.token.issue({
531
+ * sourceAddress: 'adx...',
532
+ * name: 'MyToken',
533
+ * code: 'MTK',
534
+ * totalSupply: '1000000',
535
+ * decimals: 8,
536
+ * description: 'My test token'
537
+ * }).then(console.log);
538
+ *
539
+ * // 返回示例:
540
+ * {
541
+ * errorCode: 0,
542
+ * result: {
543
+ * hash: '0x...',
544
+ * token: {
545
+ * code: 'MTK',
546
+ * issuer: 'adx...'
547
+ * }
548
+ * }
549
+ * }
550
+ *
551
+ * // 错误码:
552
+ * // - INVALID_SOURCEADDRESS_ERROR 11002 无效源地址
553
+ * // - TOKEN_CODE_INVALID 11101 无效的代币代码
554
+ * // - TOKEN_ALREADY_EXISTS 11102 代币已存在
555
+ * // - TOKEN_SUPPLY_LIMIT_ERROR 11103 代币发行量超出限制
556
+ */
557
+ issue(params: TokenIssueParams): Promise<{ errorCode: number; result: TokenIssueResult }>;
558
+
559
+ /**
560
+ * 转移代币
561
+ * @param {TokenTransferParams} params 代币转移参数
562
+ * @returns {Promise<{errorCode:number, result:TokenTransferResult}>}
563
+ * @example
564
+ * sdk.token.transfer({
565
+ * sourceAddress: 'adx...',
566
+ * destAddress: 'adx...',
567
+ * code: 'MTK',
568
+ * amount: '100',
569
+ * metadata: 'transfer token'
570
+ * }).then(console.log);
571
+ *
572
+ * // 返回示例:
573
+ * {
574
+ * errorCode: 0,
575
+ * result: {
576
+ * hash: '0x...'
577
+ * }
578
+ * }
579
+ *
580
+ * // 错误码:
581
+ * // - INVALID_SOURCEADDRESS_ERROR 11002 无效源地址
582
+ * // - INVALID_DESTADDRESS_ERROR 11003 无效目标地址
583
+ * // - TOKEN_NOT_FOUND 11104 代币不存在
584
+ * // - INSUFFICIENT_TOKEN_BALANCE 11105 代币余额不足
585
+ */
586
+ transfer(params: TokenTransferParams): Promise<{ errorCode: number; result: TokenTransferResult }>;
587
+
588
+ /**
589
+ * 查询代币信息
590
+ * @param {string} code 代币代码
591
+ * @returns {Promise<{errorCode:number, result:TokenInfoResult}>}
592
+ * @example
593
+ * sdk.token.getInfo('MTK').then(console.log);
594
+ *
595
+ * // 返回示例:
596
+ * {
597
+ * errorCode: 0,
598
+ * result: {
599
+ * token: {
600
+ * code: 'MTK',
601
+ * name: 'MyToken',
602
+ * description: 'My test token',
603
+ * decimals: 8,
604
+ * totalSupply: '1000000',
605
+ * issuer: 'adx...',
606
+ * createTime: '1632047037000'
607
+ * }
608
+ * }
609
+ * }
610
+ *
611
+ * // 错误码:
612
+ * // - TOKEN_NOT_FOUND 11104 代币不存在
613
+ */
614
+ getInfo(code: string): Promise<{ errorCode: number; result: TokenInfoResult }>;
615
+
616
+ /**
617
+ * 查询代币余额
618
+ * @param {TokenBalanceParams} params 余额查询参数
619
+ * @returns {Promise<{errorCode:number, result:TokenBalanceResult}>}
620
+ * @example
621
+ * sdk.token.getBalance({
622
+ * address: 'adx...',
623
+ * code: 'MTK'
624
+ * }).then(console.log);
625
+ *
626
+ * // 返回示例:
627
+ * {
628
+ * errorCode: 0,
629
+ * result: {
630
+ * balance: '100',
631
+ * frozen: '0'
632
+ * }
633
+ * }
634
+ *
635
+ * // 错误码:
636
+ * // - INVALID_ADDRESS_ERROR 11002 无效地址
637
+ * // - TOKEN_NOT_FOUND 11104 代币不存在
638
+ */
639
+ getBalance(params: TokenBalanceParams): Promise<{ errorCode: number; result: TokenBalanceResult }>;
640
+
641
+ /**
642
+ * 查询代币持有者列表
643
+ * @param {TokenHoldersParams} params 持有者查询参数
644
+ * @returns {Promise<{errorCode:number, result:TokenHoldersResult}>}
645
+ * @example
646
+ * sdk.token.getHolders({
647
+ * code: 'MTK',
648
+ * limit: 10,
649
+ * offset: 0
650
+ * }).then(console.log);
651
+ *
652
+ * // 返回示例:
653
+ * {
654
+ * errorCode: 0,
655
+ * result: {
656
+ * total: 100,
657
+ * holders: [{
658
+ * address: 'adx...',
659
+ * balance: '1000',
660
+ * percentage: '0.001'
661
+ * }]
662
+ * }
663
+ * }
664
+ *
665
+ * // 错误码:
666
+ * // - TOKEN_NOT_FOUND 11104 代币不存在
667
+ * // - INVALID_PARAMETER 11001 无效参数
668
+ */
669
+ getHolders(params: TokenHoldersParams): Promise<{ errorCode: number; result: TokenHoldersResult }>;
670
+ };
671
+
672
+ util: {
673
+ /**
674
+ * 检查对象是否为 BigNumber 类型
675
+ * @param {any} object 要检查的对象
676
+ * @returns {boolean} 如果对象是 BigNumber 类型返回 true,否则返回 false
677
+ * @example
678
+ * const isBig = sdk.util.isBigNumber(new BigNumber('100'));
679
+ * console.log(isBig); // true
680
+ */
681
+ isBigNumber(object: any): boolean;
682
+
683
+ /**
684
+ * 将输入数据转换为 BigNumber 对象
685
+ * @param {string | number} data 要转换的数据
686
+ * @returns {BigNumber} 转换后的 BigNumber 对象
687
+ * @example
688
+ * const big = sdk.util.toBigNumber('100');
689
+ * console.log(big.toString()); // '100'
690
+ */
691
+ toBigNumber(data: string | number): any; // 返回 BigNumber 类型
692
+
693
+ /**
694
+ * 将 UTF-8 字符串转换为十六进制字符串
695
+ * @param {string} str UTF-8 字符串
696
+ * @returns {string} 转换后的十六进制字符串
697
+ * @example
698
+ * const hex = sdk.util.utfToHex('Hello');
699
+ * console.log(hex); // '48656c6c6f'
700
+ */
701
+ utfToHex(str: string): string;
702
+
703
+ /**
704
+ * 将十六进制字符串转换为 UTF-8 字符串
705
+ * @param {string} str 十六进制字符串
706
+ * @returns {string} 转换后的 UTF-8 字符串
707
+ * @example
708
+ * const text = sdk.util.hexToUtf('48656c6c6f');
709
+ * console.log(text); // 'Hello'
710
+ */
711
+ hexToUtf(str: string): string;
712
+
713
+ /**
714
+ * 将 BU 单位的数值转换为 MO 单位
715
+ * @param {string} bu BU 单位的数值
716
+ * @returns {string} MO 单位的数值字符串
717
+ * @example
718
+ * const mo = sdk.util.buToMo('1');
719
+ * console.log(mo); // '100000000'
720
+ */
721
+ buToMo(bu: string): string;
722
+
723
+ /**
724
+ * 将 MO 单位的数值转换为 BU 单位
725
+ * @param {string} mo MO 单位的数值
726
+ * @returns {string} BU 单位的数值字符串
727
+ * @example
728
+ * const bu = sdk.util.moToBu('100000000');
729
+ * console.log(bu); // '1'
730
+ */
731
+ moToBu(mo: string): string;
732
+
733
+ /**
734
+ * 根据指定的小数位数计算代币数量
735
+ * @param {string} amount 代币数量
736
+ * @param {string} decimals 小数位数
737
+ * @returns {string | false} 计算后的数值字符串,如果计算结果无效则返回 false
738
+ * @example
739
+ * const amount = sdk.util.unitWithDecimals('100', '8');
740
+ * console.log(amount); // '10000000000'
741
+ */
742
+ unitWithDecimals(amount: string, decimals: string): string | false;
225
743
  };
226
744
 
227
745
  transaction: {
228
- buildBlob(params: TransactionParams): Promise<{ errorCode: number; result: TransactionBuildBlobResult }>;
746
+ /**
747
+ * 构建交易
748
+ * @param {TransactionBuildBlobParams} params 交易构建参数
749
+ * @returns {Promise<{errorCode:number, result:TransactionBuildBlobResult}>} 返回交易blob
750
+ * @example
751
+ * sdk.transaction.buildBlob({
752
+ * sourceAddress: 'adx...',
753
+ * gasPrice: '100',
754
+ * feeLimit: '1000000',
755
+ * nonce: '1',
756
+ * operations: [{...}]
757
+ * }).then(console.log);
758
+ *
759
+ * // 错误码:
760
+ * // - INVALID_ARGUMENTS 11001 无效参数
761
+ * // - INVALID_SOURCEADDRESS_ERROR 11002 无效源地址
762
+ */
763
+ buildBlob(params: TransactionBuildBlobParams): Promise<{ errorCode: number; result: TransactionBuildBlobResult }>;
764
+
765
+ /**
766
+ * 签名交易
767
+ * @param {TransactionSignParams} params 签名参数
768
+ * @returns {Promise<{errorCode:number, result:TransactionSignResult}>} 返回签名结果
769
+ * @example
770
+ * sdk.transaction.sign({
771
+ * privateKeys: ['priv...'],
772
+ * blob: '0x...'
773
+ * }).then(console.log);
774
+ *
775
+ * // 错误码:
776
+ * // - INVALID_ARGUMENTS 11001 无效参数
777
+ * // - PRIVATEKEY_NULL_ERROR 11057 私钥不能为空
778
+ * // - INVALID_BLOB_ERROR 11056 无效的blob数据
779
+ */
229
780
  sign(params: TransactionSignParams): Promise<{ errorCode: number; result: TransactionSignResult }>;
781
+
782
+ /**
783
+ * 提交交易
784
+ * @param {TransactionSubmitParams} params 提交参数
785
+ * @returns {Promise<{errorCode:number, result:TransactionSubmitResult}>} 返回提交结果
786
+ * @example
787
+ * sdk.transaction.submit({
788
+ * blob: '0x...',
789
+ * signatures: [{
790
+ * signData: '0x...',
791
+ * publicKey: '0x...'
792
+ * }]
793
+ * }).then(console.log);
794
+ *
795
+ * // 错误码:
796
+ * // - INVALID_ARGUMENTS 11001 无效参数
797
+ * // - INVALID_BLOB_ERROR 11056 无效的blob数据
798
+ * // - SIGNATURE_EMPTY_ERROR 11067 签名数据不能为空
799
+ */
230
800
  submit(params: TransactionSubmitParams): Promise<{ errorCode: number; result: TransactionSubmitResult }>;
801
+
802
+ /**
803
+ * 评估交易费用
804
+ * @param {TransactionEvaluateFeeParams} params 评估参数
805
+ * @returns {Promise<{errorCode:number, result:TransactionEvaluateFeeResult}>} 返回费用评估结果
806
+ * @example
807
+ * sdk.transaction.evaluateFee({
808
+ * sourceAddress: 'adx...',
809
+ * nonce: '1',
810
+ * operations: [{...}],
811
+ * signtureNumber: '1'
812
+ * }).then(console.log);
813
+ *
814
+ * // 错误码:
815
+ * // - INVALID_ARGUMENTS 11001 无效参数
816
+ * // - INVALID_SOURCEADDRESS_ERROR 11002 无效源地址
817
+ * // - INVALID_NONCE_ERROR 11048 无效nonce值
818
+ */
819
+ evaluateFee(params: TransactionEvaluateFeeParams): Promise<{ errorCode: number; result: TransactionEvaluateFeeResult }>;
820
+
821
+ /**
822
+ * 获取交易信息
823
+ * @param {string} hash 交易哈希
824
+ * @returns {Promise<{errorCode:number, result:TransactionResult}>} 返回交易详情
825
+ * @example
826
+ * sdk.transaction.getInfo('0x...').then(console.log);
827
+ *
828
+ * // 错误码:
829
+ * // - INVALID_HASH_ERROR 11025 无效的交易哈希
830
+ * // - QUERY_RESULT_NOT_EXIST 12002 查询结果不存在
831
+ */
231
832
  getInfo(hash: string): Promise<{ errorCode: number; result: TransactionResult }>;
232
833
  };
233
834
  }
@@ -398,6 +999,70 @@ export interface AccountActivateParams {
398
999
  metadata?: string;
399
1000
  }
400
1001
 
1002
+ /**
1003
+ * 合约创建操作参数
1004
+ * @interface
1005
+ * @property {string} sourceAddress 操作源账户地址
1006
+ * @property {string} initBalance 合约初始化余额
1007
+ * @property {number} type 合约类型(0-JavaScript, 1-EVM)
1008
+ * @property {string} payload 合约代码
1009
+ * @property {string} [initInput] 合约初始化参数
1010
+ * @property {string} [metadata] 操作备注
1011
+ */
1012
+ export interface ContractCreateOperationParams {
1013
+ sourceAddress: string;
1014
+ initBalance: string;
1015
+ type: number;
1016
+ payload: string;
1017
+ initInput?: string;
1018
+ metadata?: string;
1019
+ }
1020
+
1021
+ /**
1022
+ * 合约调用操作参数
1023
+ * @interface
1024
+ * @property {string} sourceAddress 调用者账户地址
1025
+ * @property {string} contractAddress 合约账户地址
1026
+ * @property {string} input 合约调用输入数据
1027
+ * @property {string} [metadata] 操作备注
1028
+ */
1029
+ export interface ContractInvokeOperationParams {
1030
+ sourceAddress: string;
1031
+ contractAddress: string;
1032
+ input: string;
1033
+ metadata?: string;
1034
+ }
1035
+
1036
+ /**
1037
+ * Gas发送操作参数
1038
+ * @interface
1039
+ * @property {string} sourceAddress 发送方账户地址
1040
+ * @property {string} destAddress 接收方账户地址
1041
+ * @property {string} amount 发送金额(单位MO)
1042
+ * @property {string} [metadata] 操作备注
1043
+ */
1044
+ export interface GasSendOperationParams {
1045
+ sourceAddress: string;
1046
+ destAddress: string;
1047
+ amount: string;
1048
+ metadata?: string;
1049
+ }
1050
+
1051
+ /**
1052
+ * 日志创建操作参数
1053
+ * @interface
1054
+ * @property {string} sourceAddress 操作源账户地址
1055
+ * @property {string} topic 日志主题
1056
+ * @property {string} data 日志内容
1057
+ * @property {string} [metadata] 操作备注
1058
+ */
1059
+ export interface LogCreateOperationParams {
1060
+ sourceAddress: string;
1061
+ topic: string;
1062
+ data: string;
1063
+ metadata?: string;
1064
+ }
1065
+
401
1066
  /**
402
1067
  * 交易参数结构定义
403
1068
  * @interface
@@ -511,4 +1176,252 @@ export interface TransactionResult {
511
1176
  };
512
1177
  txSize: number;
513
1178
  }>;
514
- }
1179
+ }
1180
+
1181
+
1182
+ /**
1183
+ * 区块信息查询结果
1184
+ * @interface
1185
+ */
1186
+ export interface BlockInfoResult {
1187
+ closeTime: string;
1188
+ number: string;
1189
+ txCount: string;
1190
+ version: string;
1191
+ }
1192
+
1193
+ /**
1194
+ * 验证者信息查询结果
1195
+ * @interface
1196
+ */
1197
+ export interface ValidatorsResult {
1198
+ validators: Array<{
1199
+ address: string;
1200
+ pledge_coin_amount: string;
1201
+ [key: string]: any;
1202
+ }>;
1203
+ }
1204
+
1205
+ /**
1206
+ * 区块奖励信息查询结果
1207
+ * @interface
1208
+ */
1209
+ export interface BlockRewardResult {
1210
+ blockReward: string;
1211
+ validatorsReward: Array<{
1212
+ validator: string;
1213
+ reward: string;
1214
+ }>;
1215
+ }
1216
+
1217
+ /**
1218
+ * 区块手续费信息查询结果
1219
+ * @interface
1220
+ */
1221
+ export interface BlockFeesResult {
1222
+ fees: {
1223
+ base_reserve: string;
1224
+ gas_price: string;
1225
+ [key: string]: any;
1226
+ };
1227
+ }
1228
+
1229
+ /**
1230
+ * 代币发行参数
1231
+ * @interface
1232
+ * @property {string} sourceAddress 发行者账户地址
1233
+ * @property {string} name 代币名称
1234
+ * @property {string} code 代币代码(唯一标识)
1235
+ * @property {string} totalSupply 发行总量
1236
+ * @property {number} decimals 小数位数(0-8)
1237
+ * @property {string} [description] 代币描述
1238
+ * @property {string} [icon] 代币图标URL
1239
+ * @property {string} [metadata] 操作备注
1240
+ */
1241
+ export interface TokenIssueParams {
1242
+ sourceAddress: string;
1243
+ name: string;
1244
+ code: string;
1245
+ totalSupply: string;
1246
+ decimals: number;
1247
+ description?: string;
1248
+ icon?: string;
1249
+ metadata?: string;
1250
+ }
1251
+
1252
+ /**
1253
+ * 代币发行结果
1254
+ * @interface
1255
+ * @property {string} hash 交易哈希
1256
+ * @property {Object} token 代币信息
1257
+ */
1258
+ export interface TokenIssueResult {
1259
+ hash: string;
1260
+ token: {
1261
+ code: string;
1262
+ issuer: string;
1263
+ };
1264
+ }
1265
+
1266
+ /**
1267
+ * 代币转移参数
1268
+ * @interface
1269
+ * @property {string} sourceAddress 转出账户地址
1270
+ * @property {string} destAddress 转入账户地址
1271
+ * @property {string} code 代币代码
1272
+ * @property {string} amount 转移数量
1273
+ * @property {string} [metadata] 操作备注
1274
+ */
1275
+ export interface TokenTransferParams {
1276
+ sourceAddress: string;
1277
+ destAddress: string;
1278
+ code: string;
1279
+ amount: string;
1280
+ metadata?: string;
1281
+ }
1282
+
1283
+ /**
1284
+ * 代币转移结果
1285
+ * @interface
1286
+ * @property {string} hash 交易哈希
1287
+ */
1288
+ export interface TokenTransferResult {
1289
+ hash: string;
1290
+ }
1291
+
1292
+ /**
1293
+ * 代币信息查询结果
1294
+ * @interface
1295
+ * @property {Object} token 代币详情
1296
+ */
1297
+ export interface TokenInfoResult {
1298
+ token: {
1299
+ code: string;
1300
+ name: string;
1301
+ description?: string;
1302
+ decimals: number;
1303
+ totalSupply: string;
1304
+ issuer: string;
1305
+ createTime: string;
1306
+ icon?: string;
1307
+ };
1308
+ }
1309
+
1310
+ /**
1311
+ * 代币余额查询参数
1312
+ * @interface
1313
+ * @property {string} address 账户地址
1314
+ * @property {string} code 代币代码
1315
+ */
1316
+ export interface TokenBalanceParams {
1317
+ address: string;
1318
+ code: string;
1319
+ }
1320
+
1321
+ /**
1322
+ * 代币余额查询结果
1323
+ * @interface
1324
+ * @property {string} balance 可用余额
1325
+ * @property {string} frozen 冻结金额
1326
+ */
1327
+ export interface TokenBalanceResult {
1328
+ balance: string;
1329
+ frozen: string;
1330
+ }
1331
+
1332
+ /**
1333
+ * 代币持有者查询参数
1334
+ * @interface
1335
+ * @property {string} code 代币代码
1336
+ * @property {number} [limit] 返回记录数量限制
1337
+ * @property {number} [offset] 起始位置偏移量
1338
+ */
1339
+ export interface TokenHoldersParams {
1340
+ code: string;
1341
+ limit?: number;
1342
+ offset?: number;
1343
+ }
1344
+
1345
+ /**
1346
+ * 代币持有者查询结果
1347
+ * @interface
1348
+ * @property {number} total 总持有者数量
1349
+ * @property {Array} holders 持有者列表
1350
+ */
1351
+ export interface TokenHoldersResult {
1352
+ total: number;
1353
+ holders: Array<{
1354
+ address: string;
1355
+ balance: string;
1356
+ percentage: string;
1357
+ }>;
1358
+ }
1359
+
1360
+ /**
1361
+ * 交易构建参数
1362
+ * @interface
1363
+ * @property {string} sourceAddress 交易发起账户地址
1364
+ * @property {string} nonce 交易序列号
1365
+ * @property {OperationResult[]} operations 操作列表
1366
+ * @property {string} [gasPrice] Gas单价(单位MO)
1367
+ * @property {string} [feeLimit] 交易费用上限
1368
+ * @property {string} [metadata] 交易备注
1369
+ * @example
1370
+ * {
1371
+ * sourceAddress: 'adx...',
1372
+ * gasPrice: '100',
1373
+ * feeLimit: '1000000',
1374
+ * nonce: '1',
1375
+ * operations: [{...}]
1376
+ * }
1377
+ */
1378
+ export interface TransactionBuildBlobParams {
1379
+ sourceAddress: string;
1380
+ nonce: string;
1381
+ operations: OperationResult[];
1382
+ gasPrice?: string;
1383
+ feeLimit?: string;
1384
+ metadata?: string;
1385
+ }
1386
+
1387
+ /**
1388
+ * 交易费用评估参数
1389
+ * @interface
1390
+ * @property {string} sourceAddress 交易发起账户地址
1391
+ * @property {string} nonce 交易序列号
1392
+ * @property {OperationResult[]} operations 操作列表
1393
+ * @property {string} signtureNumber 签名数量
1394
+ * @property {string} [metadata] 交易备注
1395
+ * @example
1396
+ * {
1397
+ * sourceAddress: 'adx...',
1398
+ * nonce: '1',
1399
+ * operations: [{...}],
1400
+ * signtureNumber: '1'
1401
+ * }
1402
+ */
1403
+ export interface TransactionEvaluateFeeParams {
1404
+ sourceAddress: string;
1405
+ nonce: string;
1406
+ operations: OperationResult[];
1407
+ signtureNumber: string;
1408
+ metadata?: string;
1409
+ }
1410
+
1411
+ /**
1412
+ * 交易费用评估结果
1413
+ * @interface
1414
+ * @property {string} gasPrice 建议的Gas单价(单位MO)
1415
+ * @property {string} feeLimit 建议的费用上限
1416
+ * @example
1417
+ * {
1418
+ * gasPrice: '100',
1419
+ * feeLimit: '1000000'
1420
+ * }
1421
+ */
1422
+ export interface TransactionEvaluateFeeResult {
1423
+ gasPrice: string;
1424
+ feeLimit: string;
1425
+ }
1426
+
1427
+ export default OpenChainSDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openchain-nodejs-ts-yxl",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "openchain sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -13,7 +13,7 @@ describe('Test token.ctp10Token', function() {
13
13
  let address = 'YxLSTjYcKBcCJ3tDnBM6z8u8uvFNaZ7L8pse';
14
14
  let data = await sdk.token.ctp10Token.checkValid(address);
15
15
  data.result.isValid.should.equal(true);
16
- address = 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t';
16
+ address = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
17
17
  data = await sdk.token.ctp10Token.checkValid(address);
18
18
  data.errorCode.should.equal(11037)
19
19
  });
@@ -12,7 +12,7 @@ describe('Test bu send operation', function() {
12
12
 
13
13
  it('test operation.buSendOperation()', function() {
14
14
  let data = sdk.operation.buSendOperation({
15
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
16
16
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
17
17
  buAmount: '6000',
18
18
  metadata: 'oh my send bu',
@@ -26,7 +26,7 @@ describe('Test bu send operation', function() {
26
26
 
27
27
  // Invalid sourceAddress
28
28
  data = sdk.operation.buSendOperation({
29
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2tA',
29
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPzA',
30
30
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
31
31
  buAmount: '6000',
32
32
  metadata: 'oh my send bu',
@@ -34,7 +34,7 @@ describe('Test bu send operation', function() {
34
34
  data.errorCode.should.equal(11002);
35
35
 
36
36
  data = sdk.operation.buSendOperation({
37
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
37
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
38
38
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2A',
39
39
  buAmount: '6000',
40
40
  metadata: 'oh my send bu',
@@ -43,7 +43,7 @@ describe('Test bu send operation', function() {
43
43
 
44
44
  // Invalid buAmount
45
45
  data = sdk.operation.buSendOperation({
46
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
46
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
47
47
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
48
48
  buAmount: '6000A',
49
49
  metadata: 'oh my send bu',
@@ -52,7 +52,7 @@ describe('Test bu send operation', function() {
52
52
 
53
53
  // Invalid metadata
54
54
  data = sdk.operation.buSendOperation({
55
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
55
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
56
56
  destAddress: 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2',
57
57
  buAmount: '6000',
58
58
  metadata: '',
@@ -12,7 +12,7 @@ describe('Test contract create operation', function() {
12
12
  it('test operation.contractCreateOperation()', function() {
13
13
 
14
14
  let contractCreateOperation = sdk.operation.contractCreateOperation({
15
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
15
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
16
16
  initBalance: '1000',
17
17
  type: 0,
18
18
  payload: 'afasfsaff',
@@ -28,7 +28,7 @@ describe('Test contract create operation', function() {
28
28
  const operationItem = contractCreateOperation.result.operation;
29
29
 
30
30
  const blobInfo = sdk.transaction.buildBlob({
31
- sourceAddress: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
31
+ sourceAddress: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
32
32
  gasPrice: '1000',
33
33
  feeLimit: '1000000',
34
34
  nonce: '123',
@@ -35,7 +35,7 @@ describe('Test contract invoke by asset operation transaction', function() {
35
35
  assetAmount: '1000',
36
36
  input: 'aaaa',
37
37
  code: 'leo',
38
- issuer: 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t',
38
+ issuer: 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz',
39
39
  // metadata: 'Test contract create operation',
40
40
  });
41
41
 
@@ -16,7 +16,7 @@ describe('Test transaction', function() {
16
16
 
17
17
  it('evaluateFee', function() {
18
18
  const sourceAddress = 'adxSqKcX8wGCMKhzNUBoDWfbeQaMhfnGdtyG2';
19
- const destAddress = 'adxSk4rkz84a4fh5xYxfSqmAsnhcWZzrTfG2t';
19
+ const destAddress = 'YxLW1Vb5sz2DnaNtY3RdVV5XcvVQJKobiFEPz';
20
20
 
21
21
  sdk.account.getNonce(sourceAddress).then(info => {
22
22