Skip to content

Commit

Permalink
Release staging code to production (#122)
Browse files Browse the repository at this point in the history
* Staging CI Test (#110)

* Remove old github pages work flows (#107)

* Test cloudflare2 (#108)

* Improvement: setting un/wrap up to use op_drop to either show qr code or sign using stacks web wallet.

* no message

* Remove old github pages work flows

* Merge branch 'test-cloudflare' into feat/105-commit-transaction-formats

* test-cloudflare:
  Remove old github pages work flows

# Conflicts:
#	.github/deprecated-node.js.yml

* Chore: testing cloudflare..

* Pointing Cloudflare at the linode docker containers

* staging ci test - tweak to distinguish staging ui from prod

* staging ci test - tweak to distinguish staging ui from prod

* Feat/105 commit transaction formats (#106)

* Improvement: setting un/wrap up to use op_drop to either show qr code or sign using stacks web wallet.

* no message

* Remove old github pages work flows

* Merge branch 'test-cloudflare' into feat/105-commit-transaction-formats

* test-cloudflare:
  Remove old github pages work flows

# Conflicts:
#	.github/deprecated-node.js.yml

* Chore: testing cloudflare..

* Remove old github pages work flows (#107)

* Pointing Cloudflare at the linode docker containers

* Test cloudflare2 (#108)

* Improvement: setting un/wrap up to use op_drop to either show qr code or sign using stacks web wallet.

* no message

* Remove old github pages work flows

* Merge branch 'test-cloudflare' into feat/105-commit-transaction-formats

* test-cloudflare:
  Remove old github pages work flows

# Conflicts:
#	.github/deprecated-node.js.yml

* Chore: testing cloudflare..

* Pointing Cloudflare at the linode docker containers

* Commit reveal transactions.

---------

Co-authored-by: Sergey Shandar <sergey-shandar@users.noreply.github.com>

* Switch taproot method to the two script solution.

* Chore(deps): Bump @noble/secp256k1 from 1.7.1 to 2.0.0 (#111)

* Remove old github pages work flows (#107)

* Test cloudflare2 (#108)

* Improvement: setting un/wrap up to use op_drop to either show qr code or sign using stacks web wallet.

* no message

* Remove old github pages work flows

* Merge branch 'test-cloudflare' into feat/105-commit-transaction-formats

* test-cloudflare:
  Remove old github pages work flows

# Conflicts:
#	.github/deprecated-node.js.yml

* Chore: testing cloudflare..

* Pointing Cloudflare at the linode docker containers

* Chore(deps-dev): Bump @sveltejs/adapter-auto from 2.0.0 to 2.0.1 (#112)

Bumps [@sveltejs/adapter-auto](https://github.com/sveltejs/kit/tree/HEAD/packages/adapter-auto) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/master/packages/adapter-auto/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/adapter-auto@2.0.1/packages/adapter-auto)

---
updated-dependencies:
- dependency-name: "@sveltejs/adapter-auto"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps-dev): Bump vite from 4.2.1 to 4.3.3 (#113)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.2.1 to 4.3.3.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.3.3/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps-dev): Bump @playwright/test from 1.32.1 to 1.33.0 (#114)

Bumps [@playwright/test](https://github.com/Microsoft/playwright) from 1.32.1 to 1.33.0.
- [Release notes](https://github.com/Microsoft/playwright/releases)
- [Commits](microsoft/playwright@v1.32.1...v1.33.0)

---
updated-dependencies:
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump @scure/btc-signer from 0.5.1 to 1.0.0 (#115)

Bumps [@scure/btc-signer](https://github.com/paulmillr/scure-btc-signer) from 0.5.1 to 1.0.0.
- [Release notes](https://github.com/paulmillr/scure-btc-signer/releases)
- [Commits](paulmillr/scure-btc-signer@0.5.1...1.0.0)

---
updated-dependencies:
- dependency-name: "@scure/btc-signer"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump @noble/secp256k1 from 1.7.1 to 2.0.0

Bumps [@noble/secp256k1](https://github.com/paulmillr/noble-secp256k1) from 1.7.1 to 2.0.0.
- [Release notes](https://github.com/paulmillr/noble-secp256k1/releases)
- [Commits](paulmillr/noble-secp256k1@1.7.1...2.0.0)

---
updated-dependencies:
- dependency-name: "@noble/secp256k1"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Mike Cohen <mjoecohen@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore: updated readme

* Chore(deps-dev): Bump vitest from 0.29.8 to 0.31.0 (#116)

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 0.29.8 to 0.31.0.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v0.31.0/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump @scure/bip32 from 1.2.0 to 1.3.0 (#117)

Bumps [@scure/bip32](https://github.com/paulmillr/scure-bip32) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/paulmillr/scure-bip32/releases)
- [Commits](paulmillr/scure-bip32@1.2.0...1.3.0)

---
updated-dependencies:
- dependency-name: "@scure/bip32"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps-dev): Bump sass from 1.60.0 to 1.62.1 (#119)

Bumps [sass](https://github.com/sass/dart-sass) from 1.60.0 to 1.62.1.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](sass/dart-sass@1.60.0...1.62.1)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump @stacks/encryption from 6.5.0 to 6.5.2 (#120)

Bumps [@stacks/encryption](https://github.com/hirosystems/stacks.js) from 6.5.0 to 6.5.2.
- [Changelog](https://github.com/hirosystems/stacks.js/blob/master/CHANGELOG.md)
- [Commits](hirosystems/stacks.js@v6.5.0...v6.5.2)

---
updated-dependencies:
- dependency-name: "@stacks/encryption"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps-dev): Bump @typescript-eslint/eslint-plugin (#121)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.57.0 to 5.59.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.59.2/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* no message

* Chore: sorting out dependabot updates.

* rolled noble/secp256 back to 1.7 to fix tests - raised paulmillr/noble-secp256k1#110.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Sergey Shandar <sergey-shandar@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed May 5, 2023
1 parent 09c8e81 commit 32a30b9
Show file tree
Hide file tree
Showing 39 changed files with 3,038 additions and 11,248 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sbtc-bridge supports a trustless two way peg between BTC and sBTC.
sBTC is a SIP-010 fungible token on the Stacks Blockchain that can be used in
defi protocols, nft marketplaces, governance and many more applications.

[sbtc-bridge.pages.dev](https://sbtc-bridge.pages.dev).
[sbtc.world](https://sbtc.world).

## Testnet

Expand Down
10,349 changes: 541 additions & 9,808 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "module",
"author": "Mike Cohen",
"scripts": {
"dev": "vite dev --port=8080 --mode linode-staging",
"dev": "vite dev --port=8080 --mode development",
"build-linode": "vite build --mode linode-staging",
"build-stag": "vite build --mode staging",
"build": "vite build",
Expand Down Expand Up @@ -32,30 +32,30 @@
"@types/bootstrap": "^5.2.6",
"@types/cookie": "^0.5.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.57.0",
"@vitest/coverage-c8": "^0.29.8",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.8.7",
"prettier-plugin-svelte": "^2.8.1",
"sass": "^1.60.0",
"sass": "^1.62.1",
"svelte": "^3.54.0",
"svelte-check": "^3.1.4",
"tslib": "^2.4.1",
"typescript": "^5.0.2",
"vite": "^4.3.3",
"vitest": "^0.29.8",
"vitest": "^0.31.0",
"vitest-fetch-mock": "^0.2.1"
},
"dependencies": {
"@noble/secp256k1": "^1.7.1",
"@scure/base": "^1.1.1",
"@scure/bip32": "^1.1.0",
"@scure/bip32": "^1.3.0",
"@scure/btc-signer": "^1.0.0",
"@stacks/connect": "^7.2.1",
"@stacks/encryption": "^6.2.0",
"@stacks/encryption": "^6.5.2",
"@stacks/transactions": "^6.4.0",
"assert": "^2.0.0",
"big-integer": "^1.6.51",
Expand Down
100 changes: 70 additions & 30 deletions src/lib/bridge_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ function addNetSelector (path:string) {
}
}

async function extractResponse(response:any) {
try {
return await response.json();
} catch(err) {
try {
return await response.text();
} catch(err) {
console.log('error fetching response.. ', err)
}
}
}

export async function sendRawTxDirectMempool(hex:string) {
//const url = CONFIG.VITE_MEMPOOL_EXPLORER + '/tx';
const url = addNetSelector(CONFIG.VITE_BLOCKCYPHER_EXPLORER + '/txs/push');
Expand Down Expand Up @@ -44,11 +56,7 @@ export async function sendRawTransaction(tx: { hex: string; }) {
if (response.status !== 200) {
throw new Error('Bitcoin tx send error.');
}
try {
return await response.text();
} catch (err) {
return await response.json();
}
return await extractResponse(response);
}

export async function fetchBurnBlockCount() {
Expand All @@ -57,7 +65,7 @@ export async function fetchBurnBlockCount() {
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const txs = await response.json();
const txs = await extractResponse(response);
return txs;
}

Expand All @@ -71,12 +79,12 @@ export async function fetchWalletProcessPsbt(psbt: { hex: string; }) {
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const signedPsbt = await response.json();
const signedPsbt = await extractResponse(response);
return signedPsbt;
}

export async function savePaymentRequest(peginRequest:PeginRequestI) {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/btc/payments/request');
export async function savePeginCommit(peginRequest:PeginRequestI) {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/pegins');
const response = await fetch(path, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand All @@ -85,24 +93,50 @@ export async function savePaymentRequest(peginRequest:PeginRequestI) {
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const signedPsbt = await response.json();
const signedPsbt = await extractResponse(response);
return signedPsbt;
}
export async function fetchMyWrapTransactions(stxAddress:string):Promise<Array<PeginRequestI>> {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/btc/payments/address/' + stxAddress);
export async function fetchPeginById(_id:string):Promise<Array<PeginRequestI>> {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/pegins/' + _id);
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Commit not found.');
}
const pegin = await extractResponse(response);
return pegin;
}

export async function doPeginScan():Promise<Array<PeginRequestI>> {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/pegin-scan');
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Unable to scan.');
}
const pegins = await extractResponse(response);
return pegins;
}

export async function fetchPeginsByStacksAddress(stxAddress:string):Promise<Array<PeginRequestI>> {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/pegins/search/' + stxAddress);
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const pegins = await response.json();
const pegins = await extractResponse(response);
return pegins;
}

export async function fetchCurrentFeeRates() {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/btc/blocks/fee-estimate');
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
return {
feeInfo: {
low_fee_per_kb: 19226,
medium_fee_per_kb: 29679,
high_fee_per_kb: 44424
}
}
}
const txs = await response.json();
return txs;
Expand All @@ -112,10 +146,18 @@ export async function fetchTransaction(txid:string) {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/btc/tx/' + txid);
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
throw new Error('Bitcoin tx not known - is the network correct?');
}
const txs = await response.json();
return txs;
return await extractResponse(response);
}

export async function fetchTransactionHex(txid:string) {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/btc/tx/' + txid + '/hex');
const response = await fetch(path);
if (response.status !== 200) {
throw new Error('Bitcoin hex not known - is the network correct?');
}
return await extractResponse(response);
}

export async function fetchAddressTransactions(address:string) {
Expand All @@ -124,8 +166,7 @@ export async function fetchAddressTransactions(address:string) {
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const txs = await response.json();
return txs;
return await extractResponse(response);
}

export async function fetchUtxoSet(address:string) {
Expand All @@ -134,16 +175,14 @@ export async function fetchUtxoSet(address:string) {
if (response.status !== 200) {
throw new Error('Bitcoin address not known - is the network correct?');
}
const txs = await response.json();
return txs;
return await extractResponse(response);
}

export async function fetchSbtcEvents() {
try {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/events/0');
const response = await fetch(path);
const result = await response.json();
return result;
return await extractResponse(response);
} catch (err) {
return [];
}
Expand All @@ -152,23 +191,24 @@ export async function fetchSbtcEvents() {
export async function fetchSbtcWalletAddress() {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/wallet-address');
const response = await fetch(path);
const result = await response.text();
return result;
return await extractResponse(response);
}

export async function fetchSbtcData() {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/data');
const response = await fetch(path);
const result = await response.text();
return result;
try {
const response = await fetch(path);
return await extractResponse(response);
} catch(err) {
return {}
}
}

export async function fetchUserSbtcBalance(stxAddress:string) {
try {
const path = addNetSelector(CONFIG.VITE_BRIDGE_API + '/sbtc/address/' + stxAddress + '/balance');
const response = await fetch(path);
const result = await response.json();
return (result);
return await extractResponse(response);
} catch (err) {
return { balance: 0 };
}
Expand Down
27 changes: 14 additions & 13 deletions src/lib/components/common/DebugPeginInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ import * as btc from '@scure/btc-signer';
import type { PeginRequestI } from '$types/pegin_request';
export let tx:any;
export let peginRequest:PeginRequestI|undefined;
let peginRequest:PeginRequestI = tx.getOpDropPeginRequest();
let showDebugInfo = $sbtcConfig.userSettings.debugMode;
let showDetails = false;
$: decodedScript = () => {
if (!peginRequest || !peginRequest.timeBasedPegin?.witnessScript) return ''
const script = btc.OutScript.decode(hex.decode(peginRequest.timeBasedPegin.witnessScript))
if (script.type === 'ms' || script.type === 'tr_ms' || script.type === 'tr_ns') return script.type + ':' + script.pubkeys;
if (script.type === 'wsh') return script.type + ':' + script.hash;
if (script.type === 'wpkh') return script.type + ':' + script.hash;
if (script.type === 'pkh') return script.type + ':' + script.hash;
if (script.type === 'tr') return script.type + ':' + script.pubkey;
if (script.type === 'unknown') return script.type + ':' + script.script;
else return script.type + ':' + script;
if (peginRequest && peginRequest.commitTxScript && peginRequest.commitTxScript.witnessScript) {
const script = btc.OutScript.decode(hex.decode(peginRequest.commitTxScript.witnessScript as string))
if (script.type === 'ms' || script.type === 'tr_ms' || script.type === 'tr_ns') return script.type + ':' + script.pubkeys;
if (script.type === 'wsh') return script.type + ':' + script.hash;
if (script.type === 'wpkh') return script.type + ':' + script.hash;
if (script.type === 'pkh') return script.type + ':' + script.hash;
if (script.type === 'tr') return script.type + ':' + script.pubkey;
if (script.type === 'unknown') return script.type + ':' + script.script;
else return script.type + ':' + script;
}
}
</script>
{#if showDebugInfo}
Expand All @@ -36,9 +37,9 @@ $: decodedScript = () => {
<div class="col-2">Stacks Address</div><div class="col-10">{peginRequest.stacksAddress}</div>
<div class="col-2">SBTC Wallet</div><div class="col-10">{peginRequest.sbtcWalletAddress}</div>
<div class="col-2">Pegin Status</div><div class="col-10">{peginRequest.status}</div>
<div class="col-2">Script Hash</div><div class="col-10">{peginRequest.timeBasedPegin?.script}</div>
<div class="col-2">Payment Type</div><div class="col-10">{peginRequest.timeBasedPegin?.paymentType}</div>
<div class="col-2">Witness Script</div><div class="col-10">{peginRequest.timeBasedPegin?.witnessScript}</div>
<div class="col-2">Script Hash</div><div class="col-10">{peginRequest.commitTxScript?.script}</div>
<div class="col-2">Payment Type</div><div class="col-10">{peginRequest.commitTxScript?.paymentType}</div>
<div class="col-2">Witness Script</div><div class="col-10">{peginRequest.commitTxScript?.witnessScript}</div>
<div class="col-2">Decoded Script</div><div class="col-10">{decodedScript()}</div>
{/if}
</div>
Expand Down
18 changes: 9 additions & 9 deletions src/lib/components/common/PegInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { addresses } from '$lib/stacks_connect'
import { createEventDispatcher } from "svelte";
import { ArrowUp, ArrowDown, CheckCircle } from "svelte-bootstrap-icons";
import { sbtcConfig } from '$stores/stores';
import type { PegInTransactionI } from '$lib/domain/PegInTransaction';
import type { PegOutTransactionI } from '$lib/domain/PegOutTransaction';
const dispatch = createEventDispatcher();
export let piTx: PegInTransactionI|PegOutTransactionI;
export let fromBtcAddress:string;
export let stacksAddress:string|undefined;
export let amount:number;
export let sigData:any;
export let currentTx:any;
const webWallet = piTx.fromBtcAddress === addresses().cardinal;
export let currentTx:string;
const webWallet = fromBtcAddress === addresses().cardinal;
let showTx = false;
let showHex = false;
Expand All @@ -29,19 +29,19 @@ const updateTransaction = () => {
</div>
<div class="row">
<div class="col-4">From</div>
<div class="col-8">{piTx.fromBtcAddress}</div>
<div class="col-8">{fromBtcAddress}</div>
</div>
<div class="row">
<div class="col-4">Wallet</div>
<div class="col-8">{(webWallet) ? 'Stacks Web Wallet' : 'Other Wallet'}</div>
</div>
<div class="row">
<div class="col-4">Stacks Address</div>
<div class="col-8">{piTx.pegInData.stacksAddress}</div>
<div class="col-8">{stacksAddress}</div>
</div>
<div class="row">
<div class="col-4">Amount</div>
<div class="col-8">{piTx.pegInData.amount}</div>
<div class="col-8">{amount}</div>
</div>
<div class="row">
<div class="col-4">Details</div>
Expand All @@ -55,7 +55,7 @@ const updateTransaction = () => {
</div>
<div class="row">
<div class="col-12">
{#if showTx}
{#if showTx && sigData}
<section class="mb-4">
<h4>Transaction Inputs</h4>
{#each sigData.inputsForDisplay as input}
Expand Down
13 changes: 7 additions & 6 deletions src/lib/components/common/SignTransaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { SigData } from '$types/sig_data';
import type { PegInTransactionI } from '$lib/domain/PegInTransaction';
import type { PegOutTransactionI } from '$lib/domain/PegOutTransaction';
import { sbtcConfig } from '$stores/stores';
import { savePaymentRequest } from '$lib/bridge_api';
import { savePeginCommit } from '$lib/bridge_api';
export let piTx:PegInTransactionI|PegOutTransactionI;
Expand All @@ -23,7 +23,7 @@ let copied = false;
let currentTx:string;
const setCurrent = () => {
const psbt = piTx?.buildOpReturnTransaction().toPSBT(2);
const psbt = piTx?.buildOpReturnTransaction().toPSBT();
(wallet === 'Bitcoin Core') ? currentTx = base64.encode(psbt) : currentTx = hex.encode(psbt);
/**
if (opMechanism === 'return') {
Expand All @@ -43,8 +43,9 @@ const updateWallet = async (newWallet:string) => {
copy();
if ($sbtcConfig.pegIn) {
try {
const peginRequest = piTx.getOpDropPeginRequest('op_return', (wallet === 'Bitcoin Core') ? 'bitcoin_core' : 'electrum')
await savePaymentRequest(peginRequest)
const peginRequest = piTx.getOpDropPeginRequest()
//'op_return', (wallet === 'Bitcoin Core') ? 'bitcoin_core' : 'electrum'
await savePeginCommit(peginRequest)
} catch (err) {
errorReason = 'Request already being processed with these details - change the amount to send another request.'
}
Expand Down Expand Up @@ -77,7 +78,7 @@ onMount(async () => {
outputsForDisplay: piTx?.getOutputsForDisplay(),
inputsForDisplay: piTx?.addressInfo.utxos
}
currentTx = hex.encode(piTx?.buildOpReturnTransaction().toPSBT(2));
currentTx = hex.encode(piTx?.buildOpReturnTransaction().toPSBT());
})
</script>

Expand All @@ -87,7 +88,7 @@ onMount(async () => {
<h2>Step 2: Sign & Broadcast</h2>
</div>
</section>
<PegInfo {piTx} {sigData} {currentTx} on:update_transaction={updateTransaction}/>
<PegInfo fromBtcAddress={piTx.fromBtcAddress} stacksAddress={piTx.pegInData.stacksAddress} amount={piTx.pegInData.amount} {sigData} {currentTx} on:update_transaction={updateTransaction}/>

<section>
<!-- Select Wallet -->
Expand Down

0 comments on commit 32a30b9

Please sign in to comment.