Skip to content

Commit 653cf08

Browse files
authoredFeb 7, 2024··
Merge pull request #146 from swaponline/add_phpx_chain
add phpx chain
2 parents 4824694 + d4ff914 commit 653cf08

8 files changed

+47
-3
lines changed
 

‎assets/js/admin.js

+4
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ console.log('>>> data', data)
281281
var auroraDisabled = thisParent.find( '[name="aurora_disabled"]' );
282282
var phiDisabled = thisParent.find( '[name="phi_disabled"]' );
283283
var fkwDisabled = thisParent.find( '[name="fkw_disabled"]' );
284+
var phpxDisabled = thisParent.find( '[name="phpx_disabled"]' );
284285
var ameDisabled = thisParent.find( '[name="ame_disabled"]' );
285286
var ghostEnabled = thisParent.find( '[name="ghost_enabled"]' );
286287
var nextEnabled = thisParent.find( '[name="next_enabled"]' );
@@ -337,6 +338,8 @@ console.log('>>> data', data)
337338
ameDisabled = ameDisabled.is(':checked') ? 'true' : 'false';
338339

339340
fkwDisabled = fkwDisabled.is(':checked') ? 'true' : 'false';
341+
phpxDisabled = phpxDisabled.is(':checked') ? 'true' : 'false';
342+
340343

341344
mcwallet_enable_multitab = mcwallet_enable_multitab.is(':checked') ? 'true' : 'false';
342345

@@ -401,6 +404,7 @@ console.log('>>> data', data)
401404
ghostEnabled: ghostEnabled,
402405
nextEnabled: nextEnabled,
403406
fkwDisabled: fkwDisabled,
407+
phpxDisabled: phpxDisabled,
404408
exchangeDisabled: exchangeDisabled,
405409
useTestnet: useTestnet,
406410
selected_exchange_mode: selected_exchange_mode,

‎includes/admin-page/main-page-settings.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function mcwallet_do_settings_sections() {
3535
<option value="erc20aurora"><?php esc_html_e( 'Aurora (ERC-20)', 'multi-currency-wallet' ); ?></option>
3636
<option value="phi20_v2"><?php esc_html_e( 'PHIv2 (ERC-20)', 'multi-currency-wallet' ); ?></option>
3737
<option value="fkw20"><?php esc_html_e( 'Forawa (FKW-20)', 'multi-currency-wallet' ); ?></option>
38+
<option value="phpx20"><?php esc_html_e( 'phpX (PHPX-20)', 'multi-currency-wallet' ); ?></option>
3839
<!-- Uncommenting when add web3 php tokens info fetcher instead of etherscal-like
3940
<option value="erc20one"></option>
4041
<option value="erc20xdai"></option>

‎includes/admin-page/tabs/options.php

+11
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@
263263
</label>
264264
</td>
265265
</tr>
266+
<!--
267+
<tr>
268+
<th scope="row"></th>
269+
<td>
270+
<label for="mcwallet_phpx_disabled">
271+
<input name="phpx_disabled" type="checkbox" id="mcwallet_phpx_disabled" <?php checked( 'true', ( get_option( 'mcwallet_phpx_disabled', 'true') === 'true') ? 'true' : 'false' ); ?>>
272+
<?php esc_html_e( 'Disable phpX wallet.', 'multi-currency-wallet' );?>
273+
</label>
274+
</td>
275+
</tr>
276+
-->
266277
<tr>
267278
<th scope="row"></th>
268279
<td>

‎includes/ajax.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function mcwallet_add_token() {
211211
$custom_name = sanitize_text_field( $_POST['name'] );
212212

213213
$standard = 'erc20';
214-
if (in_array($_POST['standard'], array('erc20','bep20','erc20matic','erc20ftm','erc20avax','erc20movr','erc20aurora','phi20_v2','fkw20'))) $standard = $_POST['standard'];
214+
if (in_array($_POST['standard'], array('erc20','bep20','erc20matic','erc20ftm','erc20avax','erc20movr','erc20aurora','phi20_v2','fkw20','phpx20'))) $standard = $_POST['standard'];
215215
if ( mcwallet_is_address( $address, $standard ) ) {
216216
$status = 'success';
217217

@@ -675,6 +675,12 @@ function mcwallet_update_options() {
675675
update_option( 'mcwallet_fkw_disabled', sanitize_text_field( 'true' ) );
676676
}
677677

678+
if ( $_POST['phpxDisabled'] == 'false' ) {
679+
update_option( 'mcwallet_phpx_disabled', sanitize_text_field( 'false' ) );
680+
} else {
681+
update_option( 'mcwallet_phpx_disabled', sanitize_text_field( 'true' ) );
682+
}
683+
678684
if ( $_POST['nextEnabled'] == 'true' ) {
679685
update_option( 'mcwallet_next_enabled', sanitize_text_field( 'true' ) );
680686
} else {

‎includes/etherscan-api.php

+16
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ function mcwallet_service_url_fkw() {
5454
$service_url_mainnet = ( get_option( 'mcwallet_use_testnet' ) === 'true' ) ? '' : 'explorer.fokawa.com/api';
5555
return esc_url( $service_url_mainnet, 'https' );
5656
}
57+
58+
function mcwallet_service_url_phpx() {
59+
$service_url_mainnet = ( get_option( 'mcwallet_use_testnet' ) === 'true' ) ? 'https://explorer.phpx.network/api' : 'https://explorer.phpx.network/api';
60+
return esc_url( $service_url_mainnet, 'https' );
61+
}
5762
/* Service Phi-v2 */
5863
function mcwallet_service_url_phiv2() {
5964
return esc_url( 'https://phiscan.io/api', 'https' );
@@ -70,6 +75,7 @@ function mcwallet_service_api_token( $standart = 'erc20' ){
7075
if ( 'erc20aurora' === $standart ) $service_api_token = 'J9ZZ9C6FI4YHJVISBI2VYRRJ1MTU3ID45Q';
7176
if ( 'phi20_v2' === $standart ) $service_api_token = '';
7277
if ( 'fkw20' === $standart ) $service_api_token = '';
78+
if ( 'phpx20' === $standart ) $service_api_token = '';
7379
return $service_api_token;
7480
}
7581

@@ -133,6 +139,9 @@ function mcwallet_get_remote_url( $result = 'name', $address = '', $standart = '
133139
}
134140
if ( 'fkw20' === $standart) {
135141
$url = mcwallet_service_url_fkw();
142+
}
143+
if ( 'phpx20' === $standart) {
144+
$url = mcwallet_service_url_phpx();
136145
}
137146
$swap_remote_url = add_query_arg(
138147
$args,
@@ -154,13 +163,17 @@ function mcwallet_is_address( $address = '', $standart = 'erc20' ){
154163
case 'fkw20':
155164
$url = mcwallet_service_url_fkw();
156165
break;
166+
case 'phpx20':
167+
$url = mcwallet_service_url_phpx();
168+
break;
157169
}
158170
if ($url !== false) {
159171
$args = array(
160172
'module' => 'token',
161173
'action' => 'getToken',
162174
'contractaddress' => $address
163175
);
176+
164177
$swap_remote_url = add_query_arg(
165178
$args,
166179
$url
@@ -208,6 +221,9 @@ function mcwallet_get_remote_result( $result = 'name', $address, $standart = 'er
208221
case 'fkw20':
209222
$url = mcwallet_service_url_fkw();
210223
break;
224+
case 'phpx20':
225+
$url = mcwallet_service_url_phpx();
226+
break;
211227
}
212228
if ($url !== false) {
213229
$args = array(

‎includes/functions.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ function mcwallet_supperted_chains() {
446446
'phi' => 'PHI',
447447
'phi_v2' => 'PHI-V2',
448448
'ame' => 'AME',
449-
'xdai' => 'XDAI'
449+
'xdai' => 'XDAI',
450+
'phpx' => 'PHPX'
450451
);
451452
return apply_filters( 'mcwallet_supperted_chains', $supperted_chains );
452453
}

‎includes/scripts/front-scripts.php

+5
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ function mcwallet_inline_script() {
475475
$fees['aureth']['fee'] = get_option( 'eth_fee' );
476476
$fees['phi']['fee'] = get_option( 'eth_fee' );
477477
$fees['ame']['fee'] = get_option( 'eth_fee' );
478+
$fees['phpx']['fee'] = get_option( 'eth_fee' );
478479
}
479480
if ( get_option( 'eth_min' ) ) {
480481
$fees['eth']['min'] = get_option( 'eth_min' );
@@ -489,6 +490,7 @@ function mcwallet_inline_script() {
489490
$fees['aureth']['min'] = get_option( 'eth_min' );
490491
$fees['phi']['min'] = get_option( 'eth_min' );
491492
$fees['ame']['min'] = get_option( 'eth_min' );
493+
$fees['phpx']['min'] = get_option( 'eth_min' );
492494
}
493495
if ( get_option( 'tokens_fee' ) ) {
494496
$fees['erc20']['fee'] = get_option( 'tokens_fee' );
@@ -502,6 +504,7 @@ function mcwallet_inline_script() {
502504
$fees['erc20aurora']['fee'] = get_option( 'tokens_fee' );
503505
$fees['phi20']['fee'] = get_option( 'tokens_fee' );
504506
$fees['erc20ame']['fee'] = get_option( 'tokens_fee' );
507+
$fees['phpx20']['fee'] = get_option( 'tokens_fee' );
505508
}
506509
if ( get_option( 'tokens_min' ) ) {
507510
$fees['erc20']['min'] = get_option( 'tokens_min' );
@@ -515,6 +518,7 @@ function mcwallet_inline_script() {
515518
$fees['erc20aurora']['min'] = get_option( 'tokens_min' );
516519
$fees['phi20']['min'] = get_option( 'tokens_min' );
517520
$fees['erc20ame']['min'] = get_option( 'tokens_min' );
521+
$fees['phpx20']['min'] = get_option( 'tokens_min' );
518522
}
519523
if ( get_option( 'eth_fee_address' ) ) {
520524
$fees['eth']['address'] = get_option( 'eth_fee_address' );
@@ -540,6 +544,7 @@ function mcwallet_inline_script() {
540544
$fees['erc20aurora']['address'] = get_option( 'eth_fee_address' );
541545
$fees['phi20']['address'] = get_option( 'eth_fee_address' );
542546
$fees['erc20ame']['address'] = get_option( 'eth_fee_address' );
547+
$fees['phpx20']['address'] = get_option( 'eth_fee_address' );
543548
}
544549

545550
$script .= 'window.widgetERC20Comisions = ' . wp_json_encode( $fees, JSON_PRETTY_PRINT ) . ';' . "\n\n";

‎multi-currency-wallet-pro.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
define( 'MCWALLET_BUILD_VER', 'e4db99' );
3030

3131

32-
define( 'MC_WALLET_USED_TOKEN_MODULE_STANDART' ,array('phi20_v2', 'fkw20'));
32+
define( 'MC_WALLET_USED_TOKEN_MODULE_STANDART' ,array('phi20_v2', 'fkw20', 'phpx20'));
3333
/**
3434
* Plugin Init
3535
*/

0 commit comments

Comments
 (0)
Please sign in to comment.