@@ -9,11 +9,16 @@ describe("rpc", () => {
99 const invalidHash = "0x0000000000000000000000000000000000000000000000000000000000000000" ;
1010 const signerSecret = "ede1d4ccb4ec9a8bbbae9a13db3f4a7b56ea04189be86ac3a6a439d9a0a1addd" ;
1111 const signerAccount = "0xa6594b7196808d161b6fb137e781abbc251385d9" ;
12+ const signerAddress = "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7" ;
1213
1314 beforeAll ( async ( ) => {
1415 sdk = new SDK ( { server : "http://localhost:8080" } ) ;
1516 } ) ;
1617
18+ test ( "PlatformAddress" , ( ) => {
19+ expect ( sdk . key . classes . PlatformAddress . fromAccountId ( signerAccount ) . value ) . toEqual ( signerAddress ) ;
20+ } ) ;
21+
1722 describe ( "node" , ( ) => {
1823 test ( "ping" , async ( ) => {
1924 expect ( await sdk . rpc . node . ping ( ) ) . toBe ( "pong" ) ;
@@ -50,18 +55,23 @@ describe("rpc", () => {
5055
5156 describe ( "with account" , ( ) => {
5257 const account = "0xa6594b7196808d161b6fb137e781abbc251385d9" ;
58+ const address = "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7" ;
59+
60+ test ( "PlatformAddress" , ( ) => {
61+ expect ( sdk . key . classes . PlatformAddress . fromAccountId ( account ) . value ) . toEqual ( address ) ;
62+ } ) ;
5363
5464 test ( "getBalance" , async ( ) => {
55- expect ( await sdk . rpc . chain . getBalance ( account ) ) . toEqual ( expect . any ( U256 ) ) ;
65+ expect ( await sdk . rpc . chain . getBalance ( address ) ) . toEqual ( expect . any ( U256 ) ) ;
5666 } ) ;
5767
5868 test ( "getNonce" , async ( ) => {
59- expect ( await sdk . rpc . chain . getNonce ( account ) ) . toEqual ( expect . any ( U256 ) ) ;
69+ expect ( await sdk . rpc . chain . getNonce ( address ) ) . toEqual ( expect . any ( U256 ) ) ;
6070 } ) ;
6171
6272 // FIXME: setRegularKey action isn't implemented.
6373 test . skip ( "getRegularKey" , async ( ) => {
64- expect ( await sdk . rpc . chain . getRegularKey ( account ) ) . toEqual ( expect . any ( H512 ) ) ;
74+ expect ( await sdk . rpc . chain . getRegularKey ( address ) ) . toEqual ( expect . any ( H512 ) ) ;
6575 } ) ;
6676 } ) ;
6777
@@ -72,13 +82,13 @@ describe("rpc", () => {
7282
7383 beforeAll ( async ( ) => {
7484 const parcel = sdk . core . createPaymentParcel ( {
75- recipient : sdk . key . classes . PlatformAddress . fromAccountId ( signerAccount ) ,
85+ recipient : signerAddress ,
7686 amount : 10 ,
7787 } ) ;
7888 const signedParcel = parcel . sign ( {
7989 secret : signerSecret ,
8090 fee : 10 ,
81- nonce : await sdk . rpc . chain . getNonce ( signerAccount ) ,
91+ nonce : await sdk . rpc . chain . getNonce ( signerAddress ) ,
8292 } ) ;
8393 parcelHash = await sdk . rpc . chain . sendSignedParcel ( signedParcel ) ;
8494 } ) ;
@@ -120,7 +130,7 @@ describe("rpc", () => {
120130 } ) ;
121131 await sdk . rpc . chain . sendSignedParcel ( parcel . sign ( {
122132 secret : signerSecret ,
123- nonce : await sdk . rpc . chain . getNonce ( signerAccount ) ,
133+ nonce : await sdk . rpc . chain . getNonce ( signerAddress ) ,
124134 fee : 10
125135 } ) ) ;
126136 } ) ;
@@ -183,7 +193,7 @@ describe("rpc", () => {
183193 const parcel = sdk . core . createChangeShardStateParcel ( { transactions : [ mintTransaction , transferTransaction ] } ) ;
184194 await sdk . rpc . chain . sendSignedParcel ( parcel . sign ( {
185195 secret : signerSecret ,
186- nonce : await sdk . rpc . chain . getNonce ( signerAccount ) ,
196+ nonce : await sdk . rpc . chain . getNonce ( signerAddress ) ,
187197 fee : 10
188198 } ) ) ;
189199 blockNumber = await sdk . rpc . chain . getBestBlockNumber ( ) ;
0 commit comments