@@ -2,25 +2,25 @@ import * as chai from "chai";
2
2
import { AssetAddress , H160 } from "codechain-primitives" ;
3
3
import { SDK } from "codechain-sdk" ;
4
4
import { Asset } from "codechain-sdk/lib/core/Asset" ;
5
- import { rpcServer } from "../../../app" ;
6
5
import * as Config from "../../config/dex.json" ;
7
6
import { controllers } from "../../controllers" ;
8
7
import db from "../../models" ;
9
8
import { submit } from "../matching" ;
10
9
11
10
const expect = chai . expect ;
12
- const DEX_ASSET_ADDRESS = Config [ "dex -asset-address" ] ;
13
- const DEX_PLATFORM_ADDRESS = Config [ "dex -platform-address" ] ;
14
- const DEX_PASSPHRASE = Config [ "dex -passphrase" ] ;
11
+ const ASSET_ADDRESS = Config [ "test -asset-address" ] ;
12
+ const PLATFORM_ADDRESS = Config [ "test -platform-address" ] ;
13
+ const PASSPHRASE = Config [ "test -passphrase" ] ;
15
14
const FEE_ASSET_TYPE = Config [ "fee-asset-type" ] ;
16
15
17
16
describe ( "Order matching basic test" , ( ) => {
18
17
let sdk : SDK ;
19
18
const shardId = 0 ;
20
19
21
- before ( async ( ) => {
20
+ before ( async function ( ) {
21
+ this . timeout ( 50000 ) ;
22
22
sdk = new SDK ( {
23
- server : rpcServer ,
23
+ server : "http://127.0.0.1:8080" ,
24
24
networkId : "tc"
25
25
} ) ;
26
26
@@ -29,10 +29,7 @@ describe("Order matching basic test", () => {
29
29
"ede1d4ccb4ec9a8bbbae9a13db3f4a7b56ea04189be86ac3a6a439d9a0a1addd" ;
30
30
const ACCOUNT_PASSPHRASE = process . env . ACCOUNT_PASSPHRASE || "satoshi" ;
31
31
try {
32
- await sdk . rpc . account . importRaw (
33
- ACCOUNT_SECRET ,
34
- ACCOUNT_PASSPHRASE
35
- ) ;
32
+ await sdk . rpc . account . importRaw ( ACCOUNT_SECRET , ACCOUNT_PASSPHRASE ) ;
36
33
} catch ( error ) {
37
34
if ( error . message !== "Already Exists" ) {
38
35
console . error ( error ) ;
@@ -68,8 +65,8 @@ describe("Order matching basic test", () => {
68
65
recipient : aliceAddress
69
66
} ) ;
70
67
await sdk . rpc . chain . sendTransaction ( goldMintTx , {
71
- account : DEX_PLATFORM_ADDRESS ,
72
- passphrase : DEX_PASSPHRASE
68
+ account : PLATFORM_ADDRESS ,
69
+ passphrase : PASSPHRASE
73
70
} ) ;
74
71
const goldMintTxResults = await sdk . rpc . chain . getTransactionResultsByTracker (
75
72
goldMintTx . tracker ( ) ,
@@ -100,8 +97,8 @@ describe("Order matching basic test", () => {
100
97
recipient : bobAddress
101
98
} ) ;
102
99
await sdk . rpc . chain . sendTransaction ( silverMintTx , {
103
- account : DEX_PLATFORM_ADDRESS ,
104
- passphrase : DEX_PASSPHRASE
100
+ account : PLATFORM_ADDRESS ,
101
+ passphrase : PASSPHRASE
105
102
} ) ;
106
103
const silverMintTxResults = await sdk . rpc . chain . getTransactionResultsByTracker (
107
104
silverMintTx . tracker ( ) ,
@@ -121,11 +118,11 @@ describe("Order matching basic test", () => {
121
118
shardId : 0 ,
122
119
recipient : bobAddress ,
123
120
quantity : 1000 ,
124
- payer : DEX_PLATFORM_ADDRESS
121
+ payer : PLATFORM_ADDRESS
125
122
} ) ;
126
123
const hash = await sdk . rpc . chain . sendTransaction ( wrapCCC , {
127
- account : DEX_PLATFORM_ADDRESS ,
128
- passphrase : DEX_PASSPHRASE
124
+ account : PLATFORM_ADDRESS ,
125
+ passphrase : PASSPHRASE
129
126
} ) ;
130
127
const result = await sdk . rpc . chain . containsTransaction ( hash ) ;
131
128
expect ( result ) . to . equal ( true ) ;
@@ -167,7 +164,7 @@ describe("Order matching basic test", () => {
167
164
expiration,
168
165
originOutputs : [ silverInput . prevOut , wcccInput . prevOut ] ,
169
166
recipientFrom : bobAddress ,
170
- recipientFee : DEX_ASSET_ADDRESS
167
+ recipientFee : ASSET_ADDRESS
171
168
} ) ;
172
169
await sdk . key . signTransactionInputWithOrder ( silverInput , orderB ) ;
173
170
await sdk . key . signTransactionInputWithOrder ( wcccInput , orderB ) ;
0 commit comments