Skip to content

Commit

Permalink
chore: use stage url for onramp
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciosantise committed Mar 6, 2025
1 parent 464b357 commit 4da3286
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/common/src/utils/ConstantsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const ConstantsUtil = {
WC_NAME_SUFFIX_LEGACY: '.wcn.id',

BLOCKCHAIN_API_RPC_URL: 'https://rpc.walletconnect.org',
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
PULSE_API_URL: 'https://pulse.walletconnect.org',
API_URL: 'https://api.web3modal.org',

Expand Down
22 changes: 13 additions & 9 deletions packages/core/src/controllers/BlockchainApiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { ApiUtil } from '../utils/ApiUtil';

// -- Helpers ------------------------------------------- //
const baseUrl = CoreHelperUtil.getBlockchainApiUrl();
const stagingUrl = CoreHelperUtil.getBlockchainStagingApiUrl();

const getHeaders = () => {
const { sdkType, sdkVersion } = OptionsController.state;
Expand All @@ -57,12 +58,15 @@ const getHeaders = () => {
export interface BlockchainApiControllerState {
clientId: string | null;
api: FetchUtil;
stageApi: FetchUtil;
}

// -- State --------------------------------------------- //
const state = proxy<BlockchainApiControllerState>({
clientId: null,
api: new FetchUtil({ baseUrl })
api: new FetchUtil({ baseUrl }),
//TODO: remove this before release
stageApi: new FetchUtil({ baseUrl: stagingUrl })
});

// -- Controller ---------------------------------------- //
Expand Down Expand Up @@ -234,7 +238,7 @@ export const BlockchainApiController = {
},

async fetchOnRampCountries() {
return await state.api.get<OnRampCountry[]>({
return await state.stageApi.get<OnRampCountry[]>({
path: '/v1/onramp/providers/properties',
headers: getHeaders(),
params: {
Expand All @@ -245,7 +249,7 @@ export const BlockchainApiController = {
},

async fetchOnRampServiceProviders() {
return await state.api.get<OnRampServiceProvider[]>({
return await state.stageApi.get<OnRampServiceProvider[]>({
path: '/v1/onramp/providers',
headers: getHeaders(),
params: {
Expand All @@ -255,7 +259,7 @@ export const BlockchainApiController = {
},

async fetchOnRampPaymentMethods(params: { countries?: string }) {
return await state.api.get<OnRampPaymentMethod[]>({
return await state.stageApi.get<OnRampPaymentMethod[]>({
path: '/v1/onramp/providers/properties',
headers: getHeaders(),
params: {
Expand All @@ -267,7 +271,7 @@ export const BlockchainApiController = {
},

async fetchOnRampCryptoCurrencies(params: { countries?: string }) {
return await state.api.get<OnRampCryptoCurrency[]>({
return await state.stageApi.get<OnRampCryptoCurrency[]>({
path: '/v1/onramp/providers/properties',
headers: getHeaders(),
params: {
Expand All @@ -279,7 +283,7 @@ export const BlockchainApiController = {
},

async fetchOnRampFiatCurrencies() {
return await state.api.get<OnRampFiatCurrency[]>({
return await state.stageApi.get<OnRampFiatCurrency[]>({
path: '/v1/onramp/providers/properties',
headers: getHeaders(),
params: {
Expand All @@ -290,7 +294,7 @@ export const BlockchainApiController = {
},

async fetchOnRampFiatLimits() {
return await state.api.get<OnRampFiatLimit[]>({
return await state.stageApi.get<OnRampFiatLimit[]>({
path: '/v1/onramp/providers/properties',
headers: getHeaders(),
params: {
Expand All @@ -301,7 +305,7 @@ export const BlockchainApiController = {
},

async getOnRampQuotes(body: BlockchainApiOnRampQuotesRequest, signal?: AbortSignal) {
return await state.api.post<OnRampQuote[]>({
return await state.stageApi.post<OnRampQuote[]>({
path: '/v1/onramp/multi/quotes',
headers: getHeaders(),
body: {
Expand All @@ -313,7 +317,7 @@ export const BlockchainApiController = {
},

async getOnRampWidget(body: BlockchainApiOnRampWidgetRequest, signal?: AbortSignal) {
return await state.api.post<BlockchainApiOnRampWidgetResponse>({
return await state.stageApi.post<BlockchainApiOnRampWidgetResponse>({
path: '/v1/onramp/widget',
headers: getHeaders(),
body: {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/utils/CoreHelperUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export const CoreHelperUtil = {
return CommonConstants.BLOCKCHAIN_API_RPC_URL;
},

getBlockchainStagingApiUrl() {
return CommonConstants.BLOCKCHAIN_API_RPC_URL_STAGING;
},

getAnalyticsUrl() {
return CommonConstants.PULSE_API_URL;
},
Expand Down

0 comments on commit 4da3286

Please sign in to comment.