This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Process signed message | |
router.post('/:user/signature', (req, res) => { | |
// Get user from db | |
db.get('SELECT * FROM users WHERE address = ?', [req.params.user], (err, row) => { | |
if (err) { | |
console.error(err.message); | |
return res.status(500).send(err.message); | |
} | |
if (row) { | |
const msg = `Nonce: ${row.nonce}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkIfWalletConnected() { | |
if (window.ethereum.request({ method: 'eth_accounts' }).then(function (accounts) { | |
if (accounts.length > 0) { | |
connected = true; | |
buyerAddress = accounts[0]; | |
} else { | |
connected = false; | |
} | |
}) | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function connectWallet() { | |
if (window.ethereum) { | |
console.log('MetaMask is installed'); | |
window.web3 = new Web3(window.ethereum); | |
window.ethereum.send('eth_requestAccounts').then(function() { | |
// Get account address | |
window.ethereum.request({ method: 'eth_accounts' }) | |
.then(function(accounts) { | |
if (accounts.length > 0) { | |
buyerAddress = accounts[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makePaymentRequest(buyerAddress, sellerAddress, itemPriceInWei) { | |
// Start wallet payment process | |
window.ethereum.request({ method: 'eth_sendTransaction', params: [{ from: buyerAddress, to: sellerAddress, value: itemPriceInWei }] }) | |
.then(response => { | |
console.log(response); | |
return true; | |
}) | |
.catch(error => { | |
console.log(error); | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="m-4 max-w-lg rounded overflow-hidden shadow-lg bg-white"> | |
<div class="p-4 max-w-xl" v-if="!connected" :key="updateModal"> | |
<h2 class="text-xl pb-9">Select one of the bellow options to perform a cryptocurrency transation via the ethereum test network.</h2> | |
<div class="flex space-x-4"> | |
<button @click="checkWalletConnected" class="py-2 px-8 rounded button-custom flex"><img src="@/assets/logos/metamask-logo.png" class="w-6 mr-3" alt=""> Metamask</button> | |
<button class="py-2 px-8 rounded button-custom disabled-custom flex"><img src="@/assets/logos/coinbase-logo.svg" class="w-6 mr-3" alt=""> Coinbase wallet</button> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openpyxl | |
import csv | |
def excel_to_csv_with_formulas(excel_path, csv_path, sheet_index=None): | |
""" | |
Convert Excel file to CSV, preserving formulas. | |
Args: | |
excel_path: Path to input Excel file | |
csv_path: Path to output CSV file | |
sheet_index: Optional index of specific sheet to convert (0-based). |
OlderNewer