Skip to content

Commit

Permalink
remove v2 from basepath in most packages (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCarlomagno authored Sep 27, 2024
1 parent 11dfcb0 commit 60d73b9
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/account/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AccountClient extends BaseApiClient {
}

protected getApiUrl(): string {
return process.env.DEFENDER_API_URL ?? 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL ?? 'https://defender-api.openzeppelin.com/';
}

public async getUsage(params?: { date?: string | Date; quotas: string[] }): Promise<AccountUsageResponse> {
Expand Down
3 changes: 1 addition & 2 deletions packages/action/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export class ActionClient extends BaseApiClient {
}

protected getApiUrl(): string {
// TODO: update to /action when available
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';
}

public async list(): Promise<ActionListResponse> {
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DeployClient extends BaseApiClient {
}

protected getApiUrl(): string {
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';
}

public async deployContract(params: DeployContractRequest): Promise<DeploymentResponse> {
Expand Down
3 changes: 1 addition & 2 deletions packages/network/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export class NetworkClient extends BaseApiClient {
}

protected getApiUrl(): string {
// TODO: update to /monitor when available
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';
}

public async listSupportedNetworks(params?: ListNetworkRequestOptions): Promise<Network[]> {
Expand Down
2 changes: 1 addition & 1 deletion packages/proposal/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ProposalClient extends BaseApiClient {
}

protected getApiUrl(): string {
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';
}

public async addContract(contract: Contract): Promise<Contract> {
Expand Down
6 changes: 2 additions & 4 deletions packages/relay-signer/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import {
import { JsonRpcResponse, SignMessagePayload, SignTypedDataPayload, SignedMessagePayload } from '../models/rpc';
import { AuthType } from '@openzeppelin/defender-sdk-base-client/lib/api/auth-v2';

export const getAdminApiUrl = () => process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';

export const getRelaySignerApiUrl = () => process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
export const getApiUrl = () => process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';

export class RelaySignerClient extends BaseApiClient implements IRelayer {
private jsonRpcRequestNextId: number;
Expand All @@ -38,7 +36,7 @@ export class RelaySignerClient extends BaseApiClient implements IRelayer {
}

protected getApiUrl(type?: AuthType): string {
return getAdminApiUrl();
return getApiUrl();
}

public async getRelayer(): Promise<RelayerGetResponse | RelayerGroupResponse> {
Expand Down
4 changes: 2 additions & 2 deletions packages/relay-signer/src/ethers/provider-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { DefenderRelaySignerV5 } from './signer-v5';
import { defineReadOnly, getStatic } from '@ethersproject/properties';
import { Networkish } from '@ethersproject/networks';
import { BigNumber } from '@ethersproject/bignumber';
import { getRelaySignerApiUrl } from '../api';
import { Relayer } from '../relayer';
import { getApiUrl } from '../api';

export class DefenderRelayProviderV5 extends StaticJsonRpcProvider {
private relayer: Relayer;

constructor(readonly credentials: RelayerParams) {
super(getRelaySignerApiUrl());
super(getApiUrl());
this.relayer = new Relayer(credentials);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/relay-signer/src/ethers/provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EthersVersion, RelayerParams } from '../models/relayer';
import { DefenderRelaySigner } from './signer';
import { getRelaySignerApiUrl } from '../api';
import { getApiUrl } from '../api';
import { Relayer } from '../relayer';
import {
JsonRpcError,
Expand All @@ -22,7 +22,7 @@ export class DefenderRelayProvider extends JsonRpcProvider {
private pendingNetwork: Promise<Network> | null = null;

constructor(readonly credentials: RelayerParams) {
super(getRelaySignerApiUrl());
super(getApiUrl());
this.relayer = new Relayer(credentials);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/relay/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class RelayClient extends BaseApiClient {
}

protected getApiUrl(): string {
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/v2/';
return process.env.DEFENDER_API_URL || 'https://defender-api.openzeppelin.com/';
}

public async get(id: string): Promise<RelayerGetResponse> {
Expand Down

0 comments on commit 60d73b9

Please sign in to comment.