Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 5 additions & 41 deletions src/spammer.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
import {
getByteCode,
getEnv,
killProcessOnPort,
wait,
waitForHealth,
} from './util.ts'
import { FlipperAbi } from '../codegen/abi/Flipper.ts'

if (Deno.env.get('START_REVIVE_DEV_NODE')) {
const nodePath = Deno.env.get('REVIVE_DEV_NODE_PATH') ??
`${Deno.env.get('HOME')}/polkadot-sdk/target/debug/revive-dev-node`
console.log(`🚀 Start node ${nodePath}...`)
killProcessOnPort(9944)
new Deno.Command(nodePath, {
args: [
'--dev',
'-l=error,evm=debug,sc_rpc_server=info,runtime::revive=debug',
],
stdout: 'inherit',
stderr: 'inherit',
}).spawn()
}
#!/usr/bin/env -S deno run --env-file --allow-all

// Run eth-rpc on 8545
if (Deno.env.get('START_ETH_RPC')) {
const adapterPath = Deno.env.get('ETH_RPC_PATH') ??
`${Deno.env.get('HOME')}/polkadot-sdk/target/debug/eth-rpc`
console.log(`🚀 Start eth-rpc ${adapterPath} ...`)
killProcessOnPort(8545)
new Deno.Command(adapterPath, {
args: [
'--dev',
'--node-rpc-url=ws://localhost:9944',
'-l=rpc-metrics=debug,eth-rpc=debug',
],
stdout: 'inherit',
stderr: 'inherit',
}).spawn()
}
import { getByteCode, getEnv, wait, waitForHealth } from './util.ts'
import { FlipperAbi } from '../codegen/abi/Flipper.ts'

await waitForHealth('http://localhost:8545').catch()
const env = await getEnv()
Expand All @@ -49,7 +13,7 @@ const hash = await wallet.deployContract({
bytecode: getByteCode('Flipper', env.evm),
})

const deployReceipt = await wallet.waitForTransactionReceipt({ hash })
const deployReceipt = await wallet.waitForTransactionReceipt(hash)
if (!deployReceipt.contractAddress) {
throw new Error('Contract address should be set')
}
Expand Down Expand Up @@ -91,7 +55,7 @@ try {

const hash = await wallet.writeContract(request)
console.time(hash)
wallet.waitForTransactionReceipt({ hash }).then((receipt) => {
wallet.waitForTransactionReceipt(hash).then((receipt) => {
console.timeEnd(hash)
console.log('-----------------------------------')
console.log(`status: ${receipt.status ? '✅' : '❌'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export async function getEnv() {
}) => ({
async waitForTransactionReceipt(
hash: Hex,
pollingInterval = 100,
timeout = 30000,
pollingInterval = 500,
timeout = 6000,
): Promise<TransactionReceipt> {
const startTime = Date.now()
while (true) {
Expand Down