Skip to content

Commit

Permalink
feat: remove testnet2(SN_GOERLI2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Sep 13, 2023
1 parent 8e3edce commit 02e17de
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 22 deletions.
7 changes: 3 additions & 4 deletions __tests__/cairo1.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Abi,
Account,
BigNumberish,
CallData,
Expand Down Expand Up @@ -27,7 +26,6 @@ import {
compiledHelloSierraCasm,
describeIfDevnet,
describeIfDevnetSequencer,
describeIfSequencerTestnet2,
getTestAccount,
getTestProvider,
} from './fixtures';
Expand Down Expand Up @@ -555,7 +553,8 @@ describeIfDevnet('Cairo 1 Devnet', () => {
});
});

describeIfSequencerTestnet2('Cairo1 Testnet2', () => {
// TODO: Refactor to Testnet
/* describeIfSequencerTestnet2('Cairo1 Testnet2', () => {
describe('Sequencer API - C1 T2 C:0x771bbe2ba64f...', () => {
const provider = getTestProvider() as SequencerProvider;
const account = getTestAccount(provider);
Expand Down Expand Up @@ -620,4 +619,4 @@ describeIfSequencerTestnet2('Cairo1 Testnet2', () => {
expect(tx).toBe(true);
});
});
});
}); */
3 changes: 0 additions & 3 deletions __tests__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'fs';
import path from 'path';

import { Account, ProviderInterface, RpcProvider, SequencerProvider, json } from '../src';
import { BaseUrl } from '../src/constants';
import {
CairoVersion,
CompiledSierra,
Expand Down Expand Up @@ -71,7 +70,6 @@ export const IS_DEVNET_SEQUENCER = IS_LOCALHOST_DEVNET && !PROVIDER_URL.includes
/* Definitions */
export const IS_RPC = !!RPC_URL;
export const IS_SEQUENCER = !RPC_URL;
export const IS_SEQUENCER_TESTNET2 = PROVIDER_URL.includes(BaseUrl.SN_GOERLI2);

export const getTestProvider = (): ProviderInterface => {
const provider = RPC_URL
Expand Down Expand Up @@ -121,7 +119,6 @@ export const describeIfNotDevnet = describeIf(!IS_LOCALHOST_DEVNET);
export const describeIfDevnet = describeIf(IS_LOCALHOST_DEVNET);
export const describeIfDevnetRpc = describeIf(IS_DEVNET_RPC);
export const describeIfDevnetSequencer = describeIf(IS_DEVNET_SEQUENCER);
export const describeIfSequencerTestnet2 = describeIf(IS_SEQUENCER_TESTNET2);

export const erc20ClassHash = '0x54328a1075b8820eb43caf0caa233923148c983742402dcfc38541dd843d01a';
export const wrongClassHash = '0x000000000000000000000000000000000000000000000000000000000000000';
4 changes: 0 additions & 4 deletions __tests__/utils/starknetId.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ describe('Should tets StarknetId utils', () => {
'0x3bab268e932d2cecd1946f100ae67ce3dff9fd234119ea2f6da57d16d29fce'
);

expect(() => {
getStarknetIdContract(StarknetChainId.SN_GOERLI2);
}).toThrow();

expect(getStarknetIdContract(StarknetChainId.SN_MAIN)).toBe(
'0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678'
);
Expand Down
5 changes: 1 addition & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ export const API_VERSION = ZERO;
export enum BaseUrl {
SN_MAIN = 'https://alpha-mainnet.starknet.io',
SN_GOERLI = 'https://alpha4.starknet.io',
SN_GOERLI2 = 'https://alpha4-2.starknet.io',
}

export enum NetworkName {
SN_MAIN = 'SN_MAIN',
SN_GOERLI = 'SN_GOERLI',
SN_GOERLI2 = 'SN_GOERLI2',
}

export enum StarknetChainId {
SN_MAIN = '0x534e5f4d41494e', // encodeShortString('SN_MAIN'),
SN_GOERLI = '0x534e5f474f45524c49', // encodeShortString('SN_GOERLI'),
SN_GOERLI2 = '0x534e5f474f45524c4932', // encodeShortString('SN_GOERLI2'),
SN_GOERLI = '0x534e5f474f45524c49', // encodeShortString('SN_GOERLI')
}

export enum TransactionHashPrefix {
Expand Down
8 changes: 1 addition & 7 deletions src/provider/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function isEmptyQueryObject(obj?: Record<any, any>): obj is undefined {
}

const defaultOptions = {
network: NetworkName.SN_GOERLI2,
network: NetworkName.SN_GOERLI,
blockIdentifier: BlockTag.pending,
};

Expand Down Expand Up @@ -116,9 +116,6 @@ export class SequencerProvider implements ProviderInterface {
case NetworkName.SN_GOERLI:
case StarknetChainId.SN_GOERLI:
return BaseUrl.SN_GOERLI;
case NetworkName.SN_GOERLI2:
case StarknetChainId.SN_GOERLI2:
return BaseUrl.SN_GOERLI2;
default:
throw new Error('Could not detect base url from NetworkName');
}
Expand All @@ -130,9 +127,6 @@ export class SequencerProvider implements ProviderInterface {
if (url.host.includes('mainnet.starknet.io')) {
return StarknetChainId.SN_MAIN;
}
if (url.host.includes('alpha4-2.starknet.io')) {
return StarknetChainId.SN_GOERLI2;
}
return StarknetChainId.SN_GOERLI;
} catch {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit 02e17de

Please sign in to comment.