Skip to content

Commit

Permalink
Update deposit (#37)
Browse files Browse the repository at this point in the history
* add warning msg

* update deposit

* small fix

---------

Co-authored-by: PiVortex <[email protected]>
  • Loading branch information
PiVortex and PiVortex authored Aug 20, 2024
1 parent 33a97ea commit 344868f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

yarn.lock
node_modules
dist
dist-ssr
Expand Down
11 changes: 11 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ function App() {
<div className="mt-3 small text-center">
{status}
</div>

<div style={{
padding: '10px',
margin: '10px',
backgroundColor: '#FFC10780',
borderRadius: '5px',
fontSize: '15px',
}}>
⚠️ Warning: Minimum deposit is used. MPC congestion may cause transaction failure. See documentation for details.
</div>

</div>
</NearContext.Provider>
)
Expand Down
3 changes: 2 additions & 1 deletion src/services/bitcoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import axios from 'axios';
import * as ethers from 'ethers';
import * as bitcoin from "bitcoinjs-lib";
import { deriveChildPublicKey, najPublicKeyStrToUncompressedHexPoint, uncompressedHexPointToBtcAddress } from '../services/kdf';
import { parseNearAmount } from "near-api-js/lib/utils/format";

export class Bitcoin {
constructor(chain_rpc, network) {
Expand Down Expand Up @@ -85,7 +86,7 @@ export class Bitcoin {
// Bitcoin needs to sign multiple utxos, so we need to pass a signer function
const sign = async (tx) => {
const payload = Array.from(ethers.getBytes(tx)).reverse();
const [big_r, big_s] = await wallet.callMethod({ contractId, method: 'sign', args: { payload, path, key_version: 0 }, gas: '250000000000000' });
const [big_r, big_s] = await wallet.callMethod({ contractId, method: 'sign', args: { payload, path, key_version: 0 }, gas: '250000000000000', deposit: parseNearAmount('0.05')});
return this.reconstructSignature(big_r, big_s);
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/ethereum.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class Ethereum {
sessionStorage.setItem('derivation', path);

const payload = Array.from(ethPayload);
const { big_r, s, recovery_id } = await wallet.callMethod({ contractId, method: 'sign', args: { request: { payload, path, key_version: 0 } }, gas: '250000000000000', deposit: parseNearAmount('0.1') });
const { big_r, s, recovery_id } = await wallet.callMethod({ contractId, method: 'sign', args: { request: { payload, path, key_version: 0 } }, gas: '250000000000000', deposit: parseNearAmount('0.05') });
return { big_r, s, recovery_id };
}

Expand Down

0 comments on commit 344868f

Please sign in to comment.