Skip to content

Commit

Permalink
Seed the Backend with Data
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Sep 29, 2022
1 parent 282cd2d commit 823eba3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/dist/src.e31bb0bc.js
Expand Up @@ -23332,7 +23332,11 @@ var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
<<<<<<< HEAD
var ws = new WebSocket(protocol + '://' + hostname + ':' + "54827" + '/');
=======
var ws = new WebSocket(protocol + '://' + hostname + ':' + "63937" + '/');
>>>>>>> 2a22398 (Seed the Backend with Data)

ws.onmessage = function (event) {
checkedAssets = {};
Expand Down
38 changes: 38 additions & 0 deletions index.js
Expand Up @@ -105,6 +105,44 @@ const syncWithRootState = () => {
});
};

const walletFoo = new Wallet();
const walletBar = new Wallet();

const generateWalletTransaction = ({ wallet, recipient, amount }) => {
const transaction = wallet.createTransaction({
recipient, amount, chain: blockchain.chain
});

transactionPool.setTransaction(transaction);
};

const walletAction = () => generateWalletTransaction({
wallet, recipient: walletFoo.publicKey, amount: 5
});

const walletFooAction = () => generateWalletTransaction({
wallet: walletFoo, recipient: walletBar.publicKey, amount: 10
});

const walletBarAction = () => generateWalletTransaction({
wallet: walletBar, recipient: wallet.publicKey, amount: 15
});

for (let i=0; i<10; i++) {
if (i%3 === 0) {
walletAction();
walletFooAction();
} else if (i%3 === 1) {
walletAction();
walletBarAction();
} else {
walletFooAction();
walletBarAction();
}

transactionMiner.mineTransactions();
}

let PEER_PORT;

if (process.env.GENERATE_PEER_PORT === 'true') {
Expand Down

0 comments on commit 823eba3

Please sign in to comment.