7
7
import com .peersafe .chainsql .core .Chainsql ;
8
8
import com .peersafe .chainsql .core .Submit .SyncCond ;
9
9
10
+ import java .nio .channels .ScatteringByteChannel ;
11
+
10
12
public class TestRipple {
11
13
12
14
public static final Chainsql c = new Chainsql ();
13
15
//
14
16
//account,secret
15
17
private static String [] sAddr = {
16
- "zHb9CJAWyB4zj91VRWn96DkukG4bwdtyTh" , // 0
17
- "zKQwdkkzpUQC9haHFEe2EwUsKHvvwwPHsv " , // 1
18
- "zPcimjPjkhQk7a7uFHLKEv6fyGHwFGQjHa" , // 2
19
- "z4ypskpHPpMDtHsZvFHg8eDEdTjQrYYYV6 " // 3
18
+ "zHb9CJAWyB4zj91VRWn96DkukG4bwdtyTh" , // root
19
+ "zLLV3G8RfBXY4EAYDvnSaAz4q4PQg8PEe6 " , // user1
20
+ "zPcimjPjkhQk7a7uFHLKEv6fyGHwFGQjHa" , // user
21
+ "zhRc343nqZk1wUEQFGXaoU76faJgYRrSBS " // issuer
20
22
21
23
};
22
24
private static String [] sSec = {
23
- "xnoPBzXtMeMyMHUVTgbuqAfg1SUTb" , // 0
24
- "xnJn5J5uYz3qnYX72jXkAPVB3ZsER " , // 1
25
- "xxCosoAJMADiy6kQFVgq1Nz8QewkU" , // 2
26
- "xxXvas5HTwVwjpmGNLQDdRyYe2H6t " // 3
25
+ "xnoPBzXtMeMyMHUVTgbuqAfg1SUTb" , // root sec
26
+ "xnBWT67xXecGGWPCrTYtE1MHjKQqW " , // user1 sec
27
+ "xxCosoAJMADiy6kQFVgq1Nz8QewkU" , // user sec
28
+ "xxRjxBvT7ABczPh2CMikpNUwjiuLU " // issuer sec
27
29
28
30
};
29
31
public static String rootAddress = sAddr [0 ];
30
32
public static String rootSecret = sSec [0 ];
33
+
31
34
public static String sUser1 = sAddr [1 ];
32
35
public static String sUserSec1 = sSec [1 ];
33
36
public static String sUser = sAddr [2 ];
34
37
public static String sUserSec = sSec [2 ];
38
+
35
39
public static String sGateWay = sAddr [3 ];
36
40
public static String sGateWaySec = sSec [3 ];
37
41
38
42
//
39
43
public static void main (String [] args ) throws Exception
40
44
{
41
45
//
42
- c .connect ("ws://127.0.0.1:6006 " );
46
+ c .connect ("ws://192.168.29.115:5217 " );
43
47
//
44
- String sCurrency = "aaa " ;
48
+ String sCurrency = "abc " ;
45
49
JSONObject jsonObj ;
46
50
boolean bGateWay = true ;
47
51
boolean bEscrow = false ;
@@ -50,9 +54,9 @@ public static void main(String[] args) throws Exception
50
54
//
51
55
c .as (rootAddress , rootSecret );
52
56
//
53
- boolean bActive = true ;
57
+ boolean bActive = false ;
54
58
boolean bTrust = true ;
55
- boolean bPay = true ;
59
+ boolean bPay = false ;
56
60
if (bActive )
57
61
{
58
62
System .out .print ("activate >>>>>>>>>>>>>>>\n " );
@@ -70,8 +74,14 @@ public static void main(String[] args) throws Exception
70
74
c .as (sGateWay , sGateWaySec );
71
75
jsonObj = c .accountSet (8 , true ).submit (SyncCond .validate_success );
72
76
System .out .print ("set gateWay:" + jsonObj + "\n trust gateWay ...\n " );
73
- jsonObj = c .accountSet ("1.005" , "0.2" , "0.3" ).submit (SyncCond .validate_success );
74
- System .out .print ("set gateWay:" + jsonObj + "\n trust gateWay ...\n " );
77
+ try {
78
+ jsonObj = c .accountSet ("1.002" , "0.2" , "0.3" ).submit (SyncCond .validate_success );
79
+ System .out .print ("set gateWay:" + jsonObj + "\n trust gateWay ...\n " );
80
+ }
81
+ catch (Exception e )
82
+ {
83
+ System .out .print (e );
84
+ }
75
85
c .as (sUser , sUserSec );
76
86
jsonObj = c .trustSet ("1000000000" , sCurrency , sGateWay ).submit (SyncCond .validate_success );
77
87
System .out .print (" user: " + jsonObj + "\n " );
@@ -96,7 +106,7 @@ public static void main(String[] args) throws Exception
96
106
jsonObj = c .connection .client .GetAccountLines (sUser );
97
107
System .out .print (" lines: " + jsonObj + "\n " );
98
108
c .as (sUser , sUserSec );
99
- jsonObj = c .pay (sUser1 , "10000 " , sCurrency , sGateWay ).submit (SyncCond .validate_success );
109
+ jsonObj = c .pay (sUser1 , "10000000 " , sCurrency , sGateWay ).submit (SyncCond .validate_success );
100
110
System .out .print (" user1:\n " + jsonObj + "\n " );
101
111
jsonObj = c .connection .client .GetAccountLines (sUser1 );
102
112
System .out .print (" lines: " + jsonObj + "\n " );
@@ -109,11 +119,14 @@ public static void main(String[] args) throws Exception
109
119
boolean bTestFin = true ;
110
120
boolean bTestCancel = false ;
111
121
boolean bTime = false ;
112
- int nCreateEscrowSeq = 41 ;
122
+ int nCreateEscrowSeq = 2 ;
113
123
if (bTestCreate )
114
124
{
115
- c .as (sUser , sUserSec );
116
- jsonObj = c .escrowCreate (sUser1 , "100" , sCurrency , sGateWay , "2018-09-12 16:42:00" , "2018-09-12 16:43:00" ).submit (SyncCond .validate_success );
125
+ c .as (sGateWay , sGateWaySec );
126
+ // jsonObj = c.escrowCreate(sUser1, "10", "", "2020-01-03 18:10:40").submit(SyncCond.validate_success);
127
+ jsonObj = c .escrowCreate (sUser1 , "10" , "2020-01-03 17:27:06" , "2020-01-03 18:10:40" ).submit (SyncCond .validate_success );
128
+ // jsonObj = c.escrowCreate(sUser1, "10", sCurrency, sGateWay, "", "2020-01-03 16:17:56").submit(SyncCond.validate_success);
129
+ // jsonObj = c.escrowCreate(sUser1, "10", sCurrency, sGateWay, "2018-09-12 16:42:00", "2018-09-12 16:43:00").submit(SyncCond.validate_success);
117
130
System .out .print ("escrowCreate res: " + jsonObj + "\n " );
118
131
jsonObj = c .getTransaction (jsonObj .getString ("tx_hash" ));
119
132
nCreateEscrowSeq = jsonObj .getInt ("Sequence" );
@@ -123,7 +136,7 @@ public static void main(String[] args) throws Exception
123
136
if (bTestFin )
124
137
{
125
138
c .as (sUser1 , sUserSec1 );
126
- jsonObj = c .escrowExecute (sUser , nCreateEscrowSeq ).submit (SyncCond .validate_success );
139
+ jsonObj = c .escrowExecute (sGateWay , nCreateEscrowSeq ).submit (SyncCond .validate_success );
127
140
System .out .print ("escrowExecute res: " + jsonObj + "\n " );
128
141
}
129
142
if (bTestCancel )
@@ -134,7 +147,7 @@ public static void main(String[] args) throws Exception
134
147
}
135
148
if (bTime )
136
149
{
137
- System .out .print ("\n " + RippleDate .localFromSecondsSinceRippleEpoch (590056740 ) + "\n " );
150
+ System .out .print ("\n " + RippleDate .localFromSecondsSinceRippleEpoch (631346404 ) + "\n " );
138
151
System .exit (1 );
139
152
}
140
153
System .exit (1 );
0 commit comments