Skip to content

Commit

Permalink
Merge pull request #7 from BTI-Labs/develop
Browse files Browse the repository at this point in the history
Clusters Name and Clusters Url is not correct
  • Loading branch information
vambolapert committed Mar 13, 2023
2 parents d2a8471 + f48ecd4 commit 2850452
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/utils/cluster.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
const endpoint = {
http: {
devnet: 'http://api-devnet.bbachain.com',
testnet: 'http://api-testnet.bbachain.com',
'mainnet-beta': 'http://api-mainnet.bbachain.com/',
mainnet: 'http://api-mainnet.bbachain.com/',
},
https: {
devnet: 'https://api-devnet.bbachain.com',
testnet: 'https://api-testnet.bbachain.com',
'mainnet-beta': 'https://api-mainnet.bbachain.com/',
mainnet: 'https://api-mainnet.bbachain.com/',
},
};

export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
export type Cluster = 'testnet' | 'mainnet';

/**
* Retrieves the RPC API URL for the specified cluster
Expand All @@ -20,7 +18,7 @@ export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string {
const key = tls === false ? 'http' : 'https';

if (!cluster) {
return endpoint[key]['devnet'];
return endpoint[key]['testnet'];
}

const url = endpoint[key][cluster];
Expand Down
14 changes: 7 additions & 7 deletions test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ describe('Cluster Util', () => {
}).to.throw();
});

it('devnet', () => {
expect(clusterApiUrl()).to.eq('https://api-devnet.bbachain.com');
expect(clusterApiUrl('devnet')).to.eq('https://api-devnet.bbachain.com');
expect(clusterApiUrl('devnet', true)).to.eq(
'https://api-devnet.bbachain.com',
it('testnet', () => {
expect(clusterApiUrl()).to.eq('https://api-testnet.bbachain.com');
expect(clusterApiUrl('testnet')).to.eq('https://api-testnet.bbachain.com');
expect(clusterApiUrl('testnet', true)).to.eq(
'https://api-testnet.bbachain.com',
);
expect(clusterApiUrl('devnet', false)).to.eq(
'http://api-devnet.bbachain.com',
expect(clusterApiUrl('testnet', false)).to.eq(
'http://api-testnet.bbachain.com',
);
});
});
5 changes: 4 additions & 1 deletion test/makeWebsocketUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const TEST_CASES = [
['https://[::]/', 'wss://[::]/'],
['https://[::1]/', 'wss://[::1]/'],
// Increment port if supplied
['https://api-testnet.bbachain.com:80/', 'wss://api-testnet.bbachain.com:81/'],
[
'https://api-testnet.bbachain.com:80/',
'wss://api-testnet.bbachain.com:81/',
],
['https://192.168.0.1:443/', 'wss://192.168.0.1:444/'],
['https://[::]:8080/', 'wss://[::]:8081/'],
// No trailing slash
Expand Down
4 changes: 2 additions & 2 deletions test/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export const Node14Controller = function () {
return new AbortControllerPolyfill();
};

//export const url = 'https://api-devnet.bbachain.com/';
//export const url = 'http://api-devnet.bbachain.com/';
//export const url = 'https://api-testnet.bbachain.com/';
//export const url = 'http://api-testnet.bbachain.com/';

0 comments on commit 2850452

Please sign in to comment.