Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EVM] Merge balances on associate tx #1630

Merged
merged 6 commits into from
May 7, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
fix test (multi-interaction cli step)
  • Loading branch information
stevenlanders committed May 6, 2024
commit d8bf2e11f72365dc3f7ff8cc090987613963f231
12 changes: 5 additions & 7 deletions contracts/test/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ async function getSeiBalance(seiAddr, denom="usei") {

async function importKey(name, keyfile) {
try {
const result = await execute(`printf "12345678"| seid keys import ${name} ${keyfile}`)
console.log(result)
return result
return await execute(`seid keys import ${name} ${keyfile}`, `printf "12345678\\n12345678\\n"`)
} catch(e) {
console.log("skipping key import")
console.log("not importing key (skipping)")
console.log(e)
}
}

Expand Down Expand Up @@ -220,15 +219,14 @@ async function executeWasm(contractAddress, msg, coins = "0usei") {
return JSON.parse(output);
}

async function execute(command) {
async function execute(command, interaction=`printf "12345678\\n"`){
return new Promise((resolve, reject) => {
// Check if the Docker container 'sei-node-0' is running
exec("docker ps --filter 'name=sei-node-0' --format '{{.Names}}'", (error, stdout, stderr) => {
if (stdout.includes('sei-node-0')) {
// The container is running, modify the command to execute inside Docker
command = command.replace(/\.\.\//g, "/sei-protocol/sei-chain/");
command = command.replace("printf \"12345678\\n\" |", "")
const dockerCommand = `docker exec sei-node-0 /bin/bash -c 'export PATH=$PATH:/root/go/bin:/root/.foundry/bin && printf "12345678\\n" | ${command}'`;
const dockerCommand = `docker exec sei-node-0 /bin/bash -c 'export PATH=$PATH:/root/go/bin:/root/.foundry/bin && ${interaction} | ${command}'`;
execCommand(dockerCommand, resolve, reject);
} else {
// The container is not running, execute command normally
Expand Down
Loading