Skip to content

Commit 344868f

Browse files
PiVortexPiVortex
and
PiVortex
authored
Update deposit (#37)
* add warning msg * update deposit * small fix --------- Co-authored-by: PiVortex <[email protected]>
1 parent 33a97ea commit 344868f

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ yarn-error.log*
77
pnpm-debug.log*
88
lerna-debug.log*
99

10+
yarn.lock
1011
node_modules
1112
dist
1213
dist-ssr

src/App.jsx

+11
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ function App() {
5555
<div className="mt-3 small text-center">
5656
{status}
5757
</div>
58+
59+
<div style={{
60+
padding: '10px',
61+
margin: '10px',
62+
backgroundColor: '#FFC10780',
63+
borderRadius: '5px',
64+
fontSize: '15px',
65+
}}>
66+
⚠️ Warning: Minimum deposit is used. MPC congestion may cause transaction failure. See documentation for details.
67+
</div>
68+
5869
</div>
5970
</NearContext.Provider>
6071
)

src/services/bitcoin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import axios from 'axios';
22
import * as ethers from 'ethers';
33
import * as bitcoin from "bitcoinjs-lib";
44
import { deriveChildPublicKey, najPublicKeyStrToUncompressedHexPoint, uncompressedHexPointToBtcAddress } from '../services/kdf';
5+
import { parseNearAmount } from "near-api-js/lib/utils/format";
56

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

src/services/ethereum.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class Ethereum {
7777
sessionStorage.setItem('derivation', path);
7878

7979
const payload = Array.from(ethPayload);
80-
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') });
80+
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') });
8181
return { big_r, s, recovery_id };
8282
}
8383

0 commit comments

Comments
 (0)