Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/trcl 2685 remove staging reference #67

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 9 additions & 58 deletions v4-client-js/__native__/__ios__/v4-native-client.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IndexerClient } from '../../../src/clients/indexer-client';
import { DYDX_TEST_ADDRESS } from './constants';

describe('IndexerClient', () => {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);

describe('Private Endpoints', () => {
it('Subaccounts', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FaucetClient } from '../../../src/clients/faucet-client';
import { DYDX_TEST_ADDRESS } from './constants';

describe('FaucetClient', () => {
const client = new FaucetClient(FaucetApiHost.STAGING);
const client = new FaucetClient(FaucetApiHost.TESTNET);

describe('Faucet Endpoints', () => {
it('Fill', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IndexerClient } from '../../../src/clients/indexer-client';
export const MARKET_BTC_USD: string = 'BTC-USD';

describe('IndexerClient', () => {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);

describe('Market Endpoints', () => {
it('Markets', async () => {
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/__tests__/modules/client/Transfers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Validator Client', () => {
beforeEach(async () => {
wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
subaccount = new Subaccount(wallet, 0);
client = await ValidatorClient.connect(Network.staging().validatorConfig);
client = await ValidatorClient.connect(Network.testnet().validatorConfig);
await sleep(5000); // wait for withdraw to complete
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Network } from '../../../src/clients/constants';
import { DYDX_TEST_ADDRESS } from './constants';

describe('IndexerClient', () => {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);

describe('Utility Endpoints', () => {
it('getTime', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Validator Client', () => {
let client: ValidatorClient;
describe('Get', () => {
beforeEach(async () => {
client = await ValidatorClient.connect(Network.staging().validatorConfig);
client = await ValidatorClient.connect(Network.testnet().validatorConfig);
});

it('Account', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Validator Client', () => {
describe('Post', () => {
beforeEach(async () => {
wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
client = await ValidatorClient.connect(Network.staging().validatorConfig);
client = await ValidatorClient.connect(Network.testnet().validatorConfig);
});

it('PlaceOrder', async () => {
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/account_endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IndexerClient } from '../src/clients/indexer-client';
import { DYDX_TEST_ADDRESS } from './constants';

async function test(): Promise<void> {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);
const address = DYDX_TEST_ADDRESS;

// Get subaccounts
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/composite_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function sleep(ms: number): Promise<void> {
async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);
const network = Network.staging();
const network = Network.testnet();
const client = await CompositeClient.connect(network);
console.log('**Client**');
console.log(client);
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/faucet_endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FaucetClient } from '../src/clients/faucet-client';
import { DYDX_TEST_ADDRESS } from './constants';

async function test(): Promise<void> {
const client = new FaucetClient(FaucetApiHost.STAGING);
const client = new FaucetClient(FaucetApiHost.TESTNET);
const address = DYDX_TEST_ADDRESS;

// Use faucet to fill subaccount
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/long_term_order_cancel_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function sleep(ms: number): Promise<void> {
async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);
const network = Network.staging();
const network = Network.testnet();
const client = await CompositeClient.connect(network);
console.log('**Client**');
console.log(client);
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/markets_endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IndexerClient } from '../src/clients/indexer-client';
export const MARKET_BTC_USD: string = 'BTC-USD';

async function test(): Promise<void> {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);

// Get perp markets
try {
Expand Down
20 changes: 2 additions & 18 deletions v4-client-js/examples/native_examples.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Network } from '../src/clients/constants';
import { UserError } from '../src/clients/lib/errors';
import {
Environment,
connect,
connectNetwork,
connectWallet,
deposit,
getAccountBalances,
Expand Down Expand Up @@ -34,7 +33,7 @@ async function test(): Promise<void> {
const wallet = await connectWallet(DYDX_TEST_MNEMONIC);
console.log(wallet);

const address = await connect(Environment.testnet, DYDX_TEST_MNEMONIC);
const address = await connect(Network.testnet(), DYDX_TEST_MNEMONIC);
console.log(address);

const payload = `{ "address": "${DYDX_TEST_ADDRESS}" }`;
Expand Down Expand Up @@ -113,21 +112,6 @@ async function test(): Promise<void> {

tx = await withdrawToIBC(0, '13', encoded);
console.log(tx);

const connected = await connectNetwork(JSON.stringify({
indexerUrl: 'https://indexer.v4staging.dydx.exchange',
websocketUrl: 'wss://indexer.v4staging.dydx.exchange/v4/ws',
validatorUrl: 'https://validator.v4staging.dydx.exchange',
chainId: 'dydxprotocol-testnet',
faucetUrl: 'https://faucet.v4staging.dydx.exchange',
USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
USDC_DECIMALS: 6,
USDC_GAS_DENOM: 'uusdc',
CHAINTOKEN_DENOM: 'adv4tnt',
CHAINTOKEN_DECIMALS: 18,
}));
console.log(connected);

} catch (error) {
console.log(error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/short_term_order_cancel_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DYDX_TEST_MNEMONIC, MAX_CLIENT_ID } from './constants';
async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);
const network = Network.staging();
const network = Network.testnet();
const client = await CompositeClient.connect(network);
console.log('**Client**');
console.log(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function sleep(ms: number): Promise<void> {
async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);
const network = Network.staging();
const network = Network.testnet();
const client = await CompositeClient.connect(network);
console.log('**Client**');
console.log(client);
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function sleep(ms: number): Promise<void> {
async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);
const network = Network.staging();
const network = Network.testnet();
const client = await CompositeClient.connect(network);
console.log('**Client**');
console.log(client);
Expand Down
4 changes: 1 addition & 3 deletions v4-client-js/examples/transfer_example_deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import { Subaccount } from '../src/clients/subaccount';
import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_MNEMONIC } from './constants';

// TODO: Test after staging deploy latest transfer contracts.

async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
4 changes: 1 addition & 3 deletions v4-client-js/examples/transfer_example_send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ import { Subaccount } from '../src/clients/subaccount';
import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_MNEMONIC } from './constants';

// TODO: Test after staging deploy latest transfer contracts.

async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(
DYDX_TEST_MNEMONIC,
BECH32_PREFIX,
);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import { Subaccount } from '../src/clients/subaccount';
import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_MNEMONIC } from './constants';

// TODO: Test after staging deploy latest transfer contracts.

async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
4 changes: 2 additions & 2 deletions v4-client-js/examples/transfer_example_withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { Subaccount } from '../src/clients/subaccount';
import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_MNEMONIC } from './constants';

// TODO: Test after staging deploy latest transfer contracts.
// TODO: Test after testnet deploy latest transfer contracts.

async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
4 changes: 1 addition & 3 deletions v4-client-js/examples/transfer_example_withdraw_other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import { Subaccount } from '../src/clients/subaccount';
import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_MNEMONIC } from './constants';

// TODO: Test after staging deploy latest transfer contracts.

async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/utility_endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Network } from '../src/clients/constants';
import { IndexerClient } from '../src/clients/indexer-client';

async function test(): Promise<void> {
const client = new IndexerClient(Network.staging().indexerConfig);
const client = new IndexerClient(Network.testnet().indexerConfig);

// Get indexer server time
try {
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/validator_get_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ValidatorClient } from '../src/clients/validator-client';
import { DYDX_TEST_ADDRESS } from './constants';

async function test(): Promise<void> {
const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);

try {
const account = await client.get.getAccount(DYDX_TEST_ADDRESS);
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/validator_post_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function test(): Promise<void> {
const wallet = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
console.log(wallet);

const client = await ValidatorClient.connect(Network.staging().validatorConfig);
const client = await ValidatorClient.connect(Network.testnet().validatorConfig);
console.log('**Client**');
console.log(client);

Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/examples/websocket_example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DYDX_TEST_ADDRESS } from './constants';

function test(): void {
const mySocket = new SocketClient(
Network.staging().indexerConfig,
Network.testnet().indexerConfig,
() => {
console.log('socket opened');
},
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dydxprotocol/v4-client-js",
"version": "0.40.3",
"version": "0.41.0",
"description": "General client library for the new dYdX system (v4 decentralized)",
"main": "build/src/index.js",
"scripts": {
Expand Down
42 changes: 0 additions & 42 deletions v4-client-js/src/clients/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,27 @@ export const TESTNET_CHAIN_ID = 'dydx-testnet-4';

// ------------ API URLs ------------
export enum IndexerApiHost {
DEV = 'https://indexer.v4dev.dydx.exchange',
STAGING = 'https://indexer.v4staging.dydx.exchange',
TESTNET = 'https://dydx-testnet.imperator.co',
// TODO: Add MAINNET
}

export enum IndexerWSHost {
DEV = 'wss://indexer.v4dev.dydx.exchange/v4/ws',
STAGING = 'wss://indexer.v4staging.dydx.exchange/v4/ws',
TESTNET = 'wss://dydx-testnet.imperator.co/v4/ws',
// TODO: Add MAINNET
}

export enum FaucetApiHost {
DEV = 'https://faucet.v4dev.expotrading.com',
STAGING = 'https://faucet.v4staging.dydx.exchange',
TESTNET = 'https://faucet.v4testnet.dydx.exchange',
}

export enum ValidatorApiHost {
DEV = 'https://validator.v4dev.dydx.exchange',
STAGING = 'https://validator.v4staging.dydx.exchange',
TESTNET = 'https://dydx-testnet-archive.allthatnode.com',
// TODO: Add MAINNET
}

// ------------ Network IDs ------------

export enum NetworkId {
DEV = 'dydxprotocol-testnet',
STAGING = 'dydxprotocol-testnet',
TESTNET = 'dydx-testnet-4',
// TODO: Add MAINNET
}
Expand Down Expand Up @@ -174,38 +164,6 @@ export class Network {
public validatorConfig: ValidatorConfig,
) {}

static dev(): Network {
const indexerConfig = new IndexerConfig(
IndexerApiHost.DEV,
IndexerWSHost.DEV,
);
const validatorConfig = new ValidatorConfig(ValidatorApiHost.DEV, DEV_CHAIN_ID,
{
CHAINTOKEN_DENOM: 'adv4tnt',
USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
USDC_GAS_DENOM: 'uusdc',
USDC_DECIMALS: 6,
CHAINTOKEN_DECIMALS: 18,
});
return new Network('dev', indexerConfig, validatorConfig);
}

static staging(): Network {
const indexerConfig = new IndexerConfig(
IndexerApiHost.STAGING,
IndexerWSHost.STAGING,
);
const validatorConfig = new ValidatorConfig(ValidatorApiHost.STAGING, STAGING_CHAIN_ID,
{
CHAINTOKEN_DENOM: 'adv4tnt',
USDC_DENOM: 'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5',
USDC_GAS_DENOM: 'uusdc',
USDC_DECIMALS: 6,
CHAINTOKEN_DECIMALS: 18,
});
return new Network('staging', indexerConfig, validatorConfig);
}

static testnet(): Network {
const indexerConfig = new IndexerConfig(
IndexerApiHost.TESTNET,
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/src/clients/faucet-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import RestClient from './modules/rest';

export class FaucetClient extends RestClient {
/**
* @description For staging and testnet only, add USDC to an subaccount
* @description For testnet only, add USDC to an subaccount
*
* @returns The HTTP response.
*/
Expand Down
Loading