Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
28 changes: 0 additions & 28 deletions .devArbitrum.env

This file was deleted.

1 change: 1 addition & 0 deletions .devSepoliaArbitrum.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FAUCET_URL=https://faucet.dev.lumerin.io/
SHOW_FAUCET=true
LUMERIN_TOKEN_ADDRESS=0xC27DafaD85F199FD50dD3FD720654875D6815871
CLONE_FACTORY_ADDRESS=0x15437978300786aDe37f61e02Be1C061e51353D3
VALIDATOR_REGISTRY_ADDRESS=0xD81265c55ED9Ca7C71d665EA12A40e7921EA1123

TITAN_LIGHTNING_POOL=pplp.titan.io:4141
DEFAULT_SELLER_CURRENCY=BTC
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- target: windows
os: windows-latest
- target: macos
os: macos-latest
os: macos-13
- target: macos-arm
os: macos-latest
runs-on: ${{ matrix.os }}
Expand All @@ -46,12 +46,12 @@ jobs:
PORT_CHECK_ERROR_LINK: ${{ vars.PORT_CHECK_ERROR_LINK }}
PORT_CHECKER_URL: ${{ vars.PORT_CHECKER_URL }}
RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }}
SELLER_WHITELIST_URL: ${{ vars.SELLER_WHITELIST_URL }}
SHOW_FAUCET: ${{ vars.SHOW_FAUCET }}
SYMBOL_ETH: ${{ vars.SYMBOL_ETH }}
SYMBOL_LMR: ${{ vars.SYMBOL_LMR }}
TITAN_LIGHTNING_DASHBOARD: ${{ vars.TITAN_LIGHTNING_DASHBOARD }}
TITAN_LIGHTNING_POOL: ${{ vars.TITAN_LIGHTNING_POOL }}
VALIDATOR_REGISTRY_ADDRESS: ${{ vars.VALIDATOR_REGISTRY_ADDRESS }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -86,7 +86,6 @@ jobs:
echo "PROXY_ROUTER_URL=$PROXY_ROUTER_URL" >> .env
echo "RECAPTCHA_SITE_KEY=$RECAPTCHA_SITE_KEY" >> .env
echo "REQUIRED_PASSWORD_ENTROPY=$REQUIRED_PASSWORD_ENTROPY" >> .env
echo "SELLER_WHITELIST_URL=$SELLER_WHITELIST_URL" >> .env
echo "SHOW_FAUCET=$SHOW_FAUCET" >> .env
echo "SYMBOL_ETH=$SYMBOL_ETH" >> .env
echo "SYMBOL_LMR=$SYMBOL_LMR" >> .env
Expand All @@ -96,7 +95,7 @@ jobs:
shell: bash
- name: Set env from gitlab
run: |
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL")
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL" "VALIDATOR_REGISTRY_ADDRESS")
gitlabVars=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_GROUP_TOKEN }}" "https://gitlab.com/api/v4/groups/${{ secrets.GITLAB_GROUP_ID }}/variables?per_page=1000")
echo $gitlabVars | jq -c '.[]' |
while IFS= read -r line; do
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/auto-release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
artifact_name: lumerin-wallet-desktop.exe
asset_name: lumerin_v${{github.ref_name}}.exe
- target: macos
os: macos-latest
os: macos-13
artifact_name: lumerin-wallet-desktop-x64.dmg
asset_name: lumerin_v${{github.ref_name}}.dmg
- target: macos-arm
Expand All @@ -52,12 +52,12 @@ jobs:
PORT_CHECK_ERROR_LINK: ${{ vars.PORT_CHECK_ERROR_LINK }}
PORT_CHECKER_URL: ${{ vars.PORT_CHECKER_URL }}
RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }}
SELLER_WHITELIST_URL: ${{ vars.SELLER_WHITELIST_URL }}
SHOW_FAUCET: ${{ vars.SHOW_FAUCET }}
SYMBOL_ETH: ${{ vars.SYMBOL_ETH }}
SYMBOL_LMR: ${{ vars.SYMBOL_LMR }}
TITAN_LIGHTNING_DASHBOARD: ${{ vars.TITAN_LIGHTNING_DASHBOARD }}
TITAN_LIGHTNING_POOL: ${{ vars.TITAN_LIGHTNING_POOL }}
VALIDATOR_REGISTRY_ADDRESS: ${{ vars.VALIDATOR_REGISTRY_ADDRESS }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -72,8 +72,8 @@ jobs:
- name: Set env from github
# keep alphabetical order
run: |
echo "AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT"=$AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT >> .env
echo "AUTO_ADJUST_PRICE_INTERVAL"=$AUTO_ADJUST_PRICE_INTERVAL >> .env
echo "AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT=$AUTO_ADJUST_CONTRACT_PRICE_TIMEOUT" >> .env
echo "AUTO_ADJUST_PRICE_INTERVAL=$AUTO_ADJUST_PRICE_INTERVAL" >> .env
echo "CHAIN_ID=$CHAIN_ID" >> .env
echo "COIN_DEFAULT_GAS_LIMIT=$COIN_DEFAULT_GAS_LIMIT" >> .env
echo "DEFAULT_GAS_PRICE=$DEFAULT_GAS_PRICE" >> .env
Expand All @@ -92,7 +92,6 @@ jobs:
echo "PROXY_ROUTER_URL=$PROXY_ROUTER_URL" >> .env
echo "RECAPTCHA_SITE_KEY=$RECAPTCHA_SITE_KEY" >> .env
echo "REQUIRED_PASSWORD_ENTROPY=$REQUIRED_PASSWORD_ENTROPY" >> .env
echo "SELLER_WHITELIST_URL=$SELLER_WHITELIST_URL" >> .env
echo "SHOW_FAUCET=$SHOW_FAUCET" >> .env
echo "SYMBOL_ETH=$SYMBOL_ETH" >> .env
echo "SYMBOL_LMR=$SYMBOL_LMR" >> .env
Expand All @@ -102,7 +101,7 @@ jobs:
shell: bash
- name: Set env from gitlab
run: |
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL")
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL" "VALIDATOR_REGISTRY_ADDRESS")
gitlabVars=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_GROUP_TOKEN }}" "https://gitlab.com/api/v4/groups/${{ secrets.GITLAB_GROUP_ID }}/variables?per_page=1000")
echo $gitlabVars | jq -c '.[]' |
while IFS= read -r line; do
Expand Down Expand Up @@ -163,13 +162,13 @@ jobs:
downloadUrl="https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs/$jobId/artifacts/$artifactPath"

if [ "${namePrefix}" = 'windows_amd64.exe' ]; then
curl -o "$GITHUB_WORKSPACE/executables/proxy-router.exe" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" "$downloadUrl" -L
curl -o "$GITHUB_WORKSPACE/executables/proxy-router.exe" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" "$downloadUrl" -L
else
curl -o "$GITHUB_WORKSPACE/executables/proxy-router" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" "$downloadUrl" -L
curl -o "$GITHUB_WORKSPACE/executables/proxy-router" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" "$downloadUrl" -L
fi
break_outer=true
break
done < <(curl -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" -0 "https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs?scope[]=success&per_page=100&page=$i" | jq -c '.[] | select(.name == "release-internal") | select(.ref | test("-dev$")) | {name: .ref, releaseName: .name, jobId: .id}')
done < <(curl -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" -0 "https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs?scope[]=success&per_page=100&page=$i" | jq -c '.[] | select(.name == "release-internal") | select(.ref | test("-dev$")) | {name: .ref, releaseName: .name, jobId: .id}')
if $break_outer; then
break
fi
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/auto-release-stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
artifact_name: lumerin-wallet-desktop.exe
asset_name: lumerin_v${{github.ref_name}}.exe
- target: macos
os: macos-latest
os: macos-13
artifact_name: lumerin-wallet-desktop-x64.dmg
asset_name: lumerin_v${{github.ref_name}}.dmg
- target: macos-arm
Expand All @@ -52,12 +52,12 @@ jobs:
PORT_CHECK_ERROR_LINK: ${{ vars.PORT_CHECK_ERROR_LINK }}
PORT_CHECKER_URL: ${{ vars.PORT_CHECKER_URL }}
RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }}
SELLER_WHITELIST_URL: ${{ vars.SELLER_WHITELIST_URL }}
SHOW_FAUCET: ${{ vars.SHOW_FAUCET }}
SYMBOL_ETH: ${{ vars.SYMBOL_ETH }}
SYMBOL_LMR: ${{ vars.SYMBOL_LMR }}
TITAN_LIGHTNING_DASHBOARD: ${{ vars.TITAN_LIGHTNING_DASHBOARD }}
TITAN_LIGHTNING_POOL: ${{ vars.TITAN_LIGHTNING_POOL }}
VALIDATOR_REGISTRY_ADDRESS: ${{ vars.VALIDATOR_REGISTRY_ADDRESS }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -92,7 +92,6 @@ jobs:
echo "PROXY_ROUTER_URL=$PROXY_ROUTER_URL" >> .env
echo "RECAPTCHA_SITE_KEY=$RECAPTCHA_SITE_KEY" >> .env
echo "REQUIRED_PASSWORD_ENTROPY=$REQUIRED_PASSWORD_ENTROPY" >> .env
echo "SELLER_WHITELIST_URL=$SELLER_WHITELIST_URL" >> .env
echo "SHOW_FAUCET=$SHOW_FAUCET" >> .env
echo "SYMBOL_ETH=$SYMBOL_ETH" >> .env
echo "SYMBOL_LMR=$SYMBOL_LMR" >> .env
Expand All @@ -102,7 +101,7 @@ jobs:
shell: bash
- name: Set env from gitlab
run: |
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL")
variables=("LUMERIN_TOKEN_ADDRESS" "CLONE_FACTORY_ADDRESS" "WALLET_ETH_NODE_ADDRESS" "PROXY_ROUTER_URL" "INDEXER_URL" "VALIDATOR_REGISTRY_ADDRESS")
gitlabVars=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_GROUP_TOKEN }}" "https://gitlab.com/api/v4/groups/${{ secrets.GITLAB_GROUP_ID }}/variables?per_page=1000")
echo $gitlabVars | jq -c '.[]' |
while IFS= read -r line; do
Expand Down Expand Up @@ -163,13 +162,13 @@ jobs:
downloadUrl="https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs/$jobId/artifacts/$artifactPath"

if [ "${namePrefix}" = 'windows_amd64.exe' ]; then
curl -o "$GITHUB_WORKSPACE/executables/proxy-router.exe" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" "$downloadUrl" -L
curl -o "$GITHUB_WORKSPACE/executables/proxy-router.exe" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" "$downloadUrl" -L
else
curl -o "$GITHUB_WORKSPACE/executables/proxy-router" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" "$downloadUrl" -L
curl -o "$GITHUB_WORKSPACE/executables/proxy-router" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" "$downloadUrl" -L
fi
break_outer=true
break
done < <(curl -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.GITLAB_TOKEN }}" -0 "https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs?scope[]=success&per_page=100&page=$i" | jq -c '.[] | select(.name == "release-internal") | select(.ref | test("-stg$")) | {name: .ref, releaseName: .name, jobId: .id}')
done < <(curl -H "Accept: application/json" -H "Authorization: Bearer ${{ secrets.GITLAB_PROXY_REPO_TOKEN }}" -0 "https://gitlab.com/api/v4/projects/${{ secrets.GITLAB_PROXY_REPO_ID }}/jobs?scope[]=success&per_page=100&page=$i" | jq -c '.[] | select(.name == "release-internal") | select(.ref | test("-stg$")) | {name: .ref, releaseName: .name, jobId: .id}')
if $break_outer; then
break
fi
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "lumerin-wallet-desktop",
"version": "1.3.4",
"version": "1.3.10",
"engines": {
"node": ">=14"
"node": "16"
},
"author": {
"name": "Lumerin",
Expand Down Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@electron/remote": "2.0.9",
"@lumerin/wallet-core": "github:Lumerin-protocol/WalletCore#1.1.1",
"@lumerin/wallet-core": "github:Lumerin-protocol/WalletCore#1.1.5",
"@reach/menu-button": "0.17.0",
"@tabler/icons": "1.119.0",
"axios": "0.27.2",
Expand Down Expand Up @@ -184,4 +184,4 @@
"prettier --write --config src/.prettierrc.json"
]
}
}
}
4 changes: 2 additions & 2 deletions public/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const chain = {

lmrTokenAddress: process.env.LUMERIN_TOKEN_ADDRESS,
cloneFactoryAddress: process.env.CLONE_FACTORY_ADDRESS,
validatorRegistryAddress: process.env.VALIDATOR_REGISTRY_ADDRESS,

proxyRouterUrl: process.env.PROXY_ROUTER_URL,
explorerUrl: process.env.EXPLORER_URL,
Expand Down Expand Up @@ -56,8 +57,7 @@ const chain = {
titanLightningDashboard: process.env.TITAN_LIGHTNING_DASHBOARD || "https://lightning.titan.io",
defaultSellerCurrency: process.env.DEFAULT_SELLER_CURRENCY || 'BTC',

bypassAuth: process.env.BYPASS_AUTH === "true",
sellerWhitelistUrl: process.env.SELLER_WHITELIST_URL || 'https://forms.gle/wEcAgppfK2p9YZ3g7'
bypassAuth: process.env.BYPASS_AUTH === "true"
};

module.exports = {
Expand Down
50 changes: 50 additions & 0 deletions public/main/client/handlers/single-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,50 @@ function getPastTransactions({ address, page, pageSize }, { api }) {
return api.explorer.getPastCoinTransactions(0, undefined, address, page, pageSize);
}

const getValidator = async ({ address }, { api }) => {
return await api["validator-registry"].getValidator(address);
}

const getValidators = async ({ offset, limit } = {}, { api }) => {
return await api["validator-registry"].getValidators(offset, limit);
}

const getValidatorsMinimalStake = async (_, { api }) => {
return await api["validator-registry"].getValidatorsMinimalStake();
}

const getValidatorsRegisterStake = async (_, { api }) => {
return await api["validator-registry"].getValidatorsRegisterStake();
}

const registerValidator = async (data, { api }) => {
data.walletId = wallet.getAddress().address;
data.password = await auth.getSessionPassword();

if (typeof data.walletId !== "string") {
throw new WalletError("WalletId is not defined");
}
return withAuth((privateKey) =>
api["validator-registry"].registerValidator({
...data,
walletAddress: data.walletAddress,
privateKey,
})
)(data, { api });
};

const deregisterValidator = async (data, { api }) => {
data.walletId = wallet.getAddress().address;
data.password = await auth.getSessionPassword();

return withAuth((privateKey) =>
api["validator-registry"].deregisterValidator({
...data,
privateKey,
})
)(data, { api });
}

module.exports = {
// refreshAllSockets,
refreshAllContracts,
Expand Down Expand Up @@ -402,4 +446,10 @@ module.exports = {
getMarketplaceFee,
isProxyPortPublic,
stopProxyRouter,
getValidator,
getValidators,
registerValidator,
getValidatorsMinimalStake,
getValidatorsRegisterStake,
deregisterValidator,
};
10 changes: 8 additions & 2 deletions public/main/client/subscriptions/single-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ const listeners = {
"stop-proxy-router": handlers.stopProxyRouter,
"claim-faucet": handlers.claimFaucet,
'get-private-key': handlers.getAddressAndPrivateKey,
"get-marketplace-fee": handlers.getMarketplaceFee
"get-marketplace-fee": handlers.getMarketplaceFee,
'get-validators': handlers.getValidators,
'get-validators-minimal-stake': handlers.getValidatorsMinimalStake,
'get-validators-register-stake': handlers.getValidatorsRegisterStake,
'get-validator': handlers.getValidator,
'register-validator': handlers.registerValidator,
'deregister-validator': handlers.deregisterValidator,
};

let coreListeners = {};

// Subscribe to messages where only one particular core has to react
function subscribeSingleCore(core) {
coreListeners[core.chain] = {};
Object.keys(listeners).forEach(function(key) {
Object.keys(listeners).forEach(function (key) {
coreListeners[core.chain][key] = withCore(core)(listeners[key]);
Comment on lines +48 to 49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function subscribeSingleCore lacks error handling for undefined handler functions in the listeners dictionary. This can lead to runtime errors if listeners[key] is undefined and is attempted to be wrapped with withCore(core). To improve robustness, add a check to ensure that listeners[key] exists before attempting to use it:

if (listeners[key]) {
    coreListeners[core.chain][key] = withCore(core)(listeners[key]);
} else {
    console.error('Handler for ' + key + ' is undefined.');
}

});

Expand Down
Loading
Loading