Skip to content

Commit

Permalink
Bug fix for sticky message
Browse files Browse the repository at this point in the history
Bug fix incorrect context path led to deployment error
  • Loading branch information
radicleart committed Jan 26, 2023
1 parent 37ec2fd commit 33cc9ff
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

NODE_ENV=development
NODE_ENV=production

VITE_SBTC_CONTRACT_ID_MAINNET=tb1qasu5x7dllnejmx0dtd5j42quk4q03dl56caqss
VITE_SBTC_CONTRACT_ID_TESTNET=tb1qasu5x7dllnejmx0dtd5j42quk4q03dl56caqss
VITE_SBTC_CONTRACT_ID_MAINNET=SP000000000000000000002Q6VF78.pox
VITE_SBTC_CONTRACT_ID_TESTNET=ST000000000000000000002AMW42H.pox

VITE_APP_STACKS_TESTNET_API=https://stacks-node-api.testnet.stacks.co
VITE_APP_STACKS_MAINNET_API=https://stacks-node-api.mainnet.stacks.co
Expand Down
16 changes: 16 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NODE_ENV=production

VITE_SBTC_CONTRACT_ID_MAINNET=SP000000000000000000002Q6VF78.pox
VITE_SBTC_CONTRACT_ID_TESTNET=ST000000000000000000002AMW42H.pox

VITE_APP_STACKS_TESTNET_API=https://stacks-node-api.testnet.stacks.co
VITE_APP_STACKS_MAINNET_API=https://stacks-node-api.mainnet.stacks.co

VITE_MEMPOOL_EXPLORER_MAINNET=https://mempool.space/api
VITE_MEMPOOL_EXPLORER_TESTNET=https://mempool.space/testnet/api

VITE_BLOCKCYPHER_EXPLORER_TESTNET=https://api.blockcypher.com/v1/btc/test3
VITE_BLOCKCYPHER_EXPLORER_MAINNET=https://api.blockcypher.com/v1/btc/main

VITE_ORIGIN=
VITE_STACKS_EXPLORER=https://explorer.stacks.co
38 changes: 38 additions & 0 deletions deploy-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash -e
set -e;

export DEPLOYMENT=$1
export PORT=22

PATH_DEPLOY=build
mkdir -p $PATH_DEPLOY
export SERVER=popper.brightblock.org
export BUILDER=build
if [ "$DEPLOYMENT" == "prod" ]; then
SERVER=chomsky.brightblock.org;
BUILDER=build
PORT=7019
fi

printf "\n-----------------------------------------------------------------------------------------------------\n";
printf "Running script: $0 \n";
printf "Deploying to: $SERVER \n";
printf "\n-----------------------------------------------------------------------------------------------------\n";

function __build() {
echo "Building $BUILDER ...";
#npm run $BUILDER
echo "Initialisation of $BUILD_PATH complete";
}

function __pushcode() {
echo "\n- deploying from pipeline build \n";
rsync -aP $PATH_DEPLOY/* static/* bob@$SERVER:/var/www/sbtc-bridge
}

BUILD_PATH=./
__build

__pushcode

exit 0;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Mike Cohen",
"scripts": {
"dev": "vite dev --port=8080",
"build": "vite build --mode production",
"build": "vite build --mode staging",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/FetchUTXOs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@
<div class="row">
<div class="col-12">
{#if showFeeCalculation}
<label for="transact-path" class="mb-3">Tx Fee Calculation</label>
<label for="transact-path" class="mb-3">Tx Fee Calculation (sats/kb)</label>
<div class="d-flex justify-content-between">
<div>Using fee rate: {feeToUse}</div>
<div><a href="/" on:click|preventDefault={() => {feeToUse = 0; hexTx = undefined}}>reset</a></div>
<div><a href="/" on:click|preventDefault={() => {feeToUse = 0; hexTx = undefined; changeErrorReason = undefined}}>reset</a></div>
</div>
<div>Peg In: {pegInAmount}</div>
<div>Change: {change}</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/psbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export async function buildPegInTx(config:SbtcConfig) {
})
const data = Buffer.from(config.stxAddress, 'utf8');
const embed = payments.embed({ data: [data] });
psbt.addOutput({ script: embed.output, value: 0 });
psbt.addOutput({ address: config.sbtcWalletAddress, value: config.pegInAmount });
psbt.addOutput({ address: config.fromBtcAddress, value: config.pegInChangeAmount });
if (config.pegInChangeAmount > 0) psbt.addOutput({ address: config.fromBtcAddress, value: config.pegInChangeAmount });
psbt.addOutput({ script: embed.output, value: 0 });
return psbt.toHex();
}

2 changes: 1 addition & 1 deletion src/lib/sbtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function fetchSbtcWalletAddress(network:string) {
const result = await callContractReadOnly(data);
console.log('pox: ', result)
if (network === 'testnet') {
return 'tb1qasu5x7dllnejmx0dtd5j42quk4q03dl56caqss';
return 'tb1qasu5x7dllnejmx0dtd5j42quk4q03dl56caqss'; // alice
}
return 'bc1q0pcvvu8ewfqw3p270cwxtsd5pe7us3s8kznftnrhs74w4nfl4rtqjt6hp6';
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
onMount(async () => {
bootstrap = (await import('bootstrap'));
try {
fetchWalletAddress();
await fetchWalletAddress();
} catch (err) {
console.log(err)
}
Expand Down
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const config = {
adapter: adapter({ fallback: "index.html" }),
prerender: { entries: [] },
paths: {
base: dev ? '' : '/blocksim',
base: dev ? '' : '/sbtc-bridge',
},
// If you are not using a .nojekyll file, change your appDir to something not starting with an underscore.
// For example, instead of '_app', use 'app_', 'internal', etc.
Expand Down

0 comments on commit 33cc9ff

Please sign in to comment.