From edb8431d2343b55641b5f95a0b6282034869d300 Mon Sep 17 00:00:00 2001 From: hard-nett Date: Sat, 6 Apr 2024 19:10:22 -0400 Subject: [PATCH] update auctions scripts --- scripts/auctions/.gitignore | 6 - scripts/auctions/01_init.sh | 35 +++ scripts/auctions/02_nft.sh | 77 +++++++ scripts/auctions/03_create.sh | 47 ++++ scripts/auctions/04_bid.sh | 34 +++ scripts/auctions/05_admin.sh | 51 ++++ scripts/auctions/06_settle.sh | 51 ++++ scripts/auctions/env.example | 12 - scripts/auctions/package.json | 23 -- scripts/auctions/src/delist.ts | 21 -- .../auctions/src/deploy_auction_mainnet.ts | 31 --- .../auctions/src/deploy_auction_testnet.ts | 38 --- scripts/auctions/src/deploy_nft.ts | 150 ------------ scripts/auctions/src/migrate_auction.ts | 20 -- scripts/auctions/src/place_bid.ts | 28 --- scripts/auctions/src/schema.ts | 1 - scripts/auctions/src/set_royalty_admin.ts | 27 --- scripts/auctions/src/set_royalty_fee.ts | 27 --- scripts/auctions/src/util.ts | 218 ------------------ scripts/auctions/tsconfig.json | 26 --- .../nft/terp721-updatable/01-init-factory.sh | 39 +++- .../nft/terp721-updatable/02-create-minter.sh | 36 ++- scripts/nft/vending-init.sh | 24 +- scripts/upload.sh | 13 +- 24 files changed, 375 insertions(+), 660 deletions(-) delete mode 100644 scripts/auctions/.gitignore create mode 100644 scripts/auctions/01_init.sh create mode 100644 scripts/auctions/02_nft.sh create mode 100644 scripts/auctions/03_create.sh create mode 100644 scripts/auctions/04_bid.sh create mode 100644 scripts/auctions/05_admin.sh create mode 100644 scripts/auctions/06_settle.sh delete mode 100644 scripts/auctions/env.example delete mode 100644 scripts/auctions/package.json delete mode 100644 scripts/auctions/src/delist.ts delete mode 100644 scripts/auctions/src/deploy_auction_mainnet.ts delete mode 100644 scripts/auctions/src/deploy_auction_testnet.ts delete mode 100644 scripts/auctions/src/deploy_nft.ts delete mode 100644 scripts/auctions/src/migrate_auction.ts delete mode 100644 scripts/auctions/src/place_bid.ts delete mode 100644 scripts/auctions/src/schema.ts delete mode 100644 scripts/auctions/src/set_royalty_admin.ts delete mode 100644 scripts/auctions/src/set_royalty_fee.ts delete mode 100644 scripts/auctions/src/util.ts delete mode 100644 scripts/auctions/tsconfig.json diff --git a/scripts/auctions/.gitignore b/scripts/auctions/.gitignore deleted file mode 100644 index 456ee5e..0000000 --- a/scripts/auctions/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -node_modules -build -*.js -.env* -package-lock.json -yarn.lock \ No newline at end of file diff --git a/scripts/auctions/01_init.sh b/scripts/auctions/01_init.sh new file mode 100644 index 0000000..38cda61 --- /dev/null +++ b/scripts/auctions/01_init.sh @@ -0,0 +1,35 @@ +AUCTION_CODE_ID=120 +PUBKEY=terp1tyl97ac3s7sec4jwznk0s7n3tlwf3matfmkape + + +MSG=$(cat < { - try{ - const result = await execute(wallet, AUCTION_ADDR, { - admin_cancel_auction: { - auction_id: "12" - } - }) - console.log('result ', result) - }catch(err){ - console.log('err ', err) - } -})() - diff --git a/scripts/auctions/src/deploy_auction_mainnet.ts b/scripts/auctions/src/deploy_auction_mainnet.ts deleted file mode 100644 index 81605fc..0000000 --- a/scripts/auctions/src/deploy_auction_mainnet.ts +++ /dev/null @@ -1,31 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate} from './util' - -require('dotenv').config() -const { MNEMONIC, AUCTION_MAINNET_CODE_ID } = process.env - -const wallet = create_wallet(MNEMONIC); - - -(async() => { - // Initialize Marketplace Contract - try{ - const result = await init(wallet, AUCTION_MAINNET_CODE_ID, { - protocol_fee: '0.02', // Protocol Fee to 2 Percent - min_increment: "0.1", // Minimum Bid to 10% above the price - duration: 86400, // Duration of the auction to one day (denominated in second) - min_duration: 300, // Extension duration for bidding 5 minute (denominated in seconds) - accepted_denom: ['uluna','ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4','ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF'], - min_reserve_price: '1000', // Minimum Price is 1 Luna - max_royalty_fee: '0.2', // Maximum Royalty Fee is 20% - protocol_addr: 'terra1endu7640tu3jf72qxsyd82fxapsyulv8zxqluk' // Royalty Receiving Fee - },'kw-marketplace') - const auction_addr = result.contract_addr - console.log('auction address is ',auction_addr) - const state = await query(auction_addr, { - state: {} - }) - console.log(state) - }catch(err){ - console.log('err ', err) - } -})() diff --git a/scripts/auctions/src/deploy_auction_testnet.ts b/scripts/auctions/src/deploy_auction_testnet.ts deleted file mode 100644 index f24583a..0000000 --- a/scripts/auctions/src/deploy_auction_testnet.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - create_wallet, - init, - query, - upload, - transfer, - execute, - migrate, -} from "./util"; - -require("dotenv").config(); -const { MNEMONIC, AUCTION_TESTNET_CODE_ID } = process.env; - -const wallet = create_wallet(MNEMONIC); - -(async () => { - // deploy auction - try{ - const response = await init(wallet, AUCTION_TESTNET_CODE_ID, { - protocol_fee: "0.01", - min_increment: "0.1", - duration: 300, - min_duration: 60, - accepted_denom: ["uluna"], - min_reserve_price: "1000", - max_royalty_fee: "0.2", - protocol_addr: wallet.key.accAddress, - }, 'kw-os'); - const auction_addr = response.contract_addr; - console.log(auction_addr); - const state = await query(auction_addr, { - state: {}, - }); - console.log(state); - }catch(err){ - console.log('err ', err) - } -})(); diff --git a/scripts/auctions/src/deploy_nft.ts b/scripts/auctions/src/deploy_nft.ts deleted file mode 100644 index 3751c91..0000000 --- a/scripts/auctions/src/deploy_nft.ts +++ /dev/null @@ -1,150 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate, batchExecute} from './util' - -require('dotenv').config() -const { MNEMONIC, MNEMONIC2 } = process.env - -const wallet = create_wallet(MNEMONIC); -const wallet2 = create_wallet(MNEMONIC2); - -(async() => { - // upload code - try{ - // const code_path = '../wasm/cw721_metadata_onchain.wasm' - // const code_id = await upload(wallet, code_path) - // console.log(code_id) - // initialize contract - // const response = await init(wallet, '7926', { - // name: 'Luna Lapin', - // symbol: 'LAPIN', - // minter: wallet.key.accAddress, - // }, 'nft') - // const nft_address = response.contract_addr - // console.log(`nft address: ${nft_address}`) - // // get minter info - // const minter:any = await query(nft_address, { - // minter: {} - // }) - // console.log(`minter: ${minter.minter}`) - // mint nft - const nft_address = 'terra126g6mxz77s5jeplhgzygmns4wnad85kn6qq99f62cp230499cknsnkzsmd' - let mintMSGs = [ - { - mint: { - token_id: '0', - owner: wallet.key.accAddress, - token_uri: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - extension: { - image: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - description: '', - name: `LunaLapin #0`, - attributes: [ - { - trait_type: "background", - value: "aurora" - }, - { - trait_type: "head", - value: "cosmic" - } - ] - } - } - }, - { - mint: { - token_id: '1', - owner: wallet.key.accAddress, - token_uri: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - extension: { - image: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - description: '', - name: `LunaLapin #1`, - attributes: [ - { - trait_type: "background", - value: "aurora" - }, - { - trait_type: "head", - value: "cosmic" - } - ] - } - } - }, - { - mint: { - token_id: '2', - owner: wallet.key.accAddress, - token_uri: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - extension: { - image: "ipfs://QmboqXNQcf4pcNhfMWAeXCbTejxuVreDVDaB4qoFmg7DBR", - description: '', - name: `LunaLapin #2`, - attributes: [ - { - trait_type: "background", - value: "aurora" - }, - { - trait_type: "head", - value: "cosmic" - } - ] - } - } - } - ] - await batchExecute(wallet, nft_address, mintMSGs) - // get nft info - // const nft_info = await query(nft_address, { - // nft_info: { - // token_id: '0' - // } - // }) - // console.log(nft_info) - - // check royalty - // const check_royalty = await query(nft_address, { - // check_royalties: {} - // }) - // console.log(check_royalty) - // set royalty - // get nft info - // const nft_info2 = await query(nft_address, { - // nft_info: { - // token_id: '1' - // } - // }) - // console.log(nft_info2) - - - // get nft info - // const nft_info3 = await query(nft_address, { - // nft_info: { - // token_id: '2' - // } - // }) - // console.log(nft_info3) - }catch(err){ - console.log('err ', err) - } - // // check royalty - // const check_royalty2 = await query(nft_address, { - // check_royalties: {} - // }) - // console.log(check_royalty2) - // const royalty_token1 = await query(nft_address, { - // royalty_info: { - // token_id: '1', - // sale_price: '1000000' - // } - // }) - // console.log(royalty_token1) - // // burn token - // await execute(wallet2, nft_address, { - // burn: { - // token_id: '1' - // } - // }) -})() \ No newline at end of file diff --git a/scripts/auctions/src/migrate_auction.ts b/scripts/auctions/src/migrate_auction.ts deleted file mode 100644 index 12bcf4b..0000000 --- a/scripts/auctions/src/migrate_auction.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate} from './util' - -require('dotenv').config() -const { MNEMONIC, AUCTION_ADDR } = process.env - -const wallet = create_wallet(MNEMONIC); - -(async() => { - // upload code - try{ - const auction_code_path = '../artifacts/auction.wasm' - const auction_code_id = await upload(wallet, auction_code_path) - console.log('upload code complete code id :',auction_code_id) - const migrate_response = await migrate(wallet, AUCTION_ADDR, auction_code_id, {}) - console.log(migrate_response) - }catch(err){ - console.log('err ', err) - } - -})() diff --git a/scripts/auctions/src/place_bid.ts b/scripts/auctions/src/place_bid.ts deleted file mode 100644 index 145b7f4..0000000 --- a/scripts/auctions/src/place_bid.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate} from './util' - -require('dotenv').config() -const { MNEMONIC, AUCTION_ADDR } = process.env - -const wallet = create_wallet(MNEMONIC); - -(async() => { - try{ - await execute(wallet, AUCTION_ADDR, { - place_bid: { - auction_id: '1' - } - }, '1000000ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4') - await execute(wallet, AUCTION_ADDR, { - settle: { - auction_id: '1' - } - }) - }catch(err){ - console.log('err ', err) - } - // await execute(wallet, auction_addr, { - // admin_cancel_auction: { - // auction_id: '2' - // } - // }) -})() diff --git a/scripts/auctions/src/schema.ts b/scripts/auctions/src/schema.ts deleted file mode 100644 index 693da49..0000000 --- a/scripts/auctions/src/schema.ts +++ /dev/null @@ -1 +0,0 @@ -export {} \ No newline at end of file diff --git a/scripts/auctions/src/set_royalty_admin.ts b/scripts/auctions/src/set_royalty_admin.ts deleted file mode 100644 index 714e40b..0000000 --- a/scripts/auctions/src/set_royalty_admin.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate, delay, balance} from './util' - -require('dotenv').config() -const { MNEMONIC, AUCTION_ADDR } = process.env - -const wallet = create_wallet(MNEMONIC); - -(async() => { - try{ - // add royalty permission to deployer account - const result = await execute(wallet, AUCTION_ADDR, { - set_royalty_admin: { - address: wallet.key.accAddress, - enable: true - } - }) - console.log('result ', result) - }catch(err){ - console.log('err ', err) - } - // await execute(wallet, token_addr, { - // transfer_nft: { - // recipient: 'terra1em2sanwzpv5226dxlp3rwf765r7x5gvrqfdk7p', - // token_id: '0' - // } - // }) -})() diff --git a/scripts/auctions/src/set_royalty_fee.ts b/scripts/auctions/src/set_royalty_fee.ts deleted file mode 100644 index 02ebf84..0000000 --- a/scripts/auctions/src/set_royalty_fee.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {create_wallet, init, query, upload, transfer, execute, migrate, delay, balance} from './util' - -require('dotenv').config() -const { MNEMONIC, AUCTION_ADDR ,NFT_ADDR } = process.env - -const wallet = create_wallet(MNEMONIC); - -(async() => { - try{ - const result = await execute(wallet, AUCTION_ADDR, { - set_royalty_fee: { - contract_addr: NFT_ADDR, - royalty_fee: '200', - creator: 'terra1y4747xzrmtdq04a20zuernnrduvt65qlctkzar' - } - }) - console.log('result ', result) - }catch(err){ - console.log('err ', err) - } - // await execute(wallet, token_addr, { - // transfer_nft: { - // recipient: 'terra1em2sanwzpv5226dxlp3rwf765r7x5gvrqfdk7p', - // token_id: '0' - // } - // }) -})() diff --git a/scripts/auctions/src/util.ts b/scripts/auctions/src/util.ts deleted file mode 100644 index 7298133..0000000 --- a/scripts/auctions/src/util.ts +++ /dev/null @@ -1,218 +0,0 @@ -import {MsgStoreCode, LCDClient, MnemonicKey, MsgInstantiateContract, Coins, MsgExecuteContract, Wallet, MsgSend, Coin, MsgMigrateContract} from '@terra-money/terra.js' -import * as fs from 'fs' - -require('dotenv').config() - -const DELAY_TIME = 1000 // this to prevent unauthorization error -const GAS_LIMIT = 10000000 - -const {NETWORK} = process.env - -const networks = { - localterra: { - URL: 'http://localhost:1317', - chainID: 'localterra', - gasAdjustment: 1.5 - }, - testnet: { - URL: 'https://pisco-lcd.terra.dev', - chainID: 'pisco-1', - gasAdjustment: 1.5 - }, - mainnet: { - URL: 'https://phoenix-lcd.terra.dev', - chainID: 'phoenix-1', - gasAdjustment: 1.5 - } -} - -const terra = new LCDClient(networks['testnet']) - -export const instantiate = async (network) => { - return new LCDClient(networks[network]) -} - -export const create_wallet = (mnemonic) => { - const key = new MnemonicKey({ - mnemonic - }) - return terra.wallet(key) -} - -export const upload = async ( - wallet, - path, - fee='5000000uusd' -):Promise => { - const tx = await wallet.createAndSignTx({ - msgs: [ - new MsgStoreCode( - wallet.key.accAddress, - fs.readFileSync(path, { encoding: 'base64'}) - ) - ] - }) - try { - const response = await terra.tx.broadcast(tx); - const logs = JSON.parse(response.raw_log) - let code_id = '' - logs.forEach( (log) => { - log.events.forEach( (event) => { - if(event.type == 'store_code') { - code_id = event.attributes.find( (attribute) => attribute.key == 'code_id').value - } - }) - }) - await delay(DELAY_TIME) - return Number(code_id) - } catch (err) { - console.log('err ', err) - throw err - } -} - -export const init = async ( - wallet, - code_id, - init_msg, - label -) => { - const msg = new MsgInstantiateContract(wallet.key.accAddress, wallet.key.accAddress, code_id, init_msg, [], label) - const tx = await wallet.createAndSignTx({ - msgs: [ - msg - ] - }); - try { - const response = await terra.tx.broadcast(tx); - await delay(DELAY_TIME) - const logs = JSON.parse(response.raw_log) - let contract_addr = '' - logs.forEach( (log) => { - log.events.forEach( (event) => { - if(event.type == 'instantiate') { - contract_addr = event.attributes.find( (attribute) => attribute.key == '_contract_address').value - } - }) - }) - await delay(DELAY_TIME) - return { - contract_addr: contract_addr, - logs - } - } catch (err) { - console.log('err ', err) - throw err - } -}; - -export const execute = async ( - wallet:Wallet, - addr, - execute_msg, - coins?, - fee='3800000uusd' -) => { - let coin = new Coins() - if(coins) - coin = Coins.fromString(coins) - const msgs = [new MsgExecuteContract(wallet.key.accAddress, addr, execute_msg, coin)] - //const _fee = await terra.tx.estimateFee(wallet.key.accAddress, msgs, { feeDenoms: ['uluna']}) - const tx = await wallet.createAndSignTx({ - msgs: msgs - }); - const response = await terra.tx.broadcast(tx); - await delay(DELAY_TIME) - return response; -} - -export const batchExecuteRaw = async ( - wallet:Wallet, - msgs: MsgExecuteContract[], -) => { - //const _fee = await terra.tx.estimateFee(wallet.key.accAddress, msgs, { feeDenoms: ['uluna']}) - const tx = await wallet.createAndSignTx({ - msgs - }); - const response = await terra.tx.broadcast(tx); - await delay(DELAY_TIME) - return response; -} - -export const batchExecute = async ( - wallet:Wallet, - addr, - execute_msgs, - coins?, - fee='3800000uusd' -) => { - let coin = new Coins() - if(coins) - coin = Coins.fromString(coins) - const msgs = execute_msgs.map(execute_msg => { - return new MsgExecuteContract(wallet.key.accAddress, addr, execute_msg, coin) - }) - //const _fee = await terra.tx.estimateFee(wallet.key.accAddress, msgs, { feeDenoms: ['uluna']}) - const tx = await wallet.createAndSignTx({ - msgs: msgs - }); - const response = await terra.tx.broadcast(tx); - await delay(DELAY_TIME) - return response; -} - -export const migrate = async ( - wallet, - addr, - code_id, - migrate_msg, - fee='5000000uusd' -) => { - const tx = await wallet.createAndSignTx({ - msgs: [new MsgMigrateContract(wallet.key.accAddress, addr, code_id, migrate_msg)] - }); - try { - const response = await terra.tx.broadcast(tx) - await delay(DELAY_TIME) - return response - } catch (err) { - throw err - } -} - -export const transfer = async (wallet:Wallet, addr, coins, fee='2500000uusd') => { - - const tx = await wallet.createAndSignTx({ - msgs: [new MsgSend( - wallet.key.accAddress, - addr, - Coins.fromString(coins) - )] - }) - const response = await terra.tx.broadcast(tx) - await delay(DELAY_TIME) - return response; -} - -export const balance = async (addr) => { - return await terra.bank.balance(addr) -} - -export const query = async (addr, msg) => { - const response = await terra.wasm.contractQuery(addr,msg) - return response -} - -export const codeInfo = async (codeId:number) => { - const response = await terra.wasm.codeInfo(codeId) - return response -} - -export const contractInfo = async (addr: string) => { - const response = await terra.wasm.contractInfo(addr) - return response -} - -export const delay = (ms) => { - return new Promise( resolve => setTimeout(resolve, ms, {}) ) -} \ No newline at end of file diff --git a/scripts/auctions/tsconfig.json b/scripts/auctions/tsconfig.json deleted file mode 100644 index 71b75f4..0000000 --- a/scripts/auctions/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "lib": [ - "esnext" - ], - "downlevelIteration": true, - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": false, - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "experimentalDecorators": true, - "outDir": "build/" - }, - "include": [ - "src/**/*.ts", - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file diff --git a/scripts/nft/terp721-updatable/01-init-factory.sh b/scripts/nft/terp721-updatable/01-init-factory.sh index c2b20b4..89d292a 100755 --- a/scripts/nft/terp721-updatable/01-init-factory.sh +++ b/scripts/nft/terp721-updatable/01-init-factory.sh @@ -2,34 +2,49 @@ # terpd config chain-id $CHAIN_ID # terpd config output json -KEY=$(terpd keys show $ADMIN | jq -r .name) -FACTORY_CODE_ID= -MINTER_CODE_ID= +# KEY=$(terpd keys show $ADMIN | jq -r .name) +FACTORY_CODE_ID=135 +MINTER_CODE_ID=136 MSG=$(cat < unsignedTx.json + + + if [ -n "$response" ]; then + txhash=$(echo "$response" | jq -r '.txhash') + echo $txhash + echo 'waiting for tx to process' + sleep 6; + tx_response=$(terpd q tx $txhash -o json) + + + contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value') + echo "Contract Address: $contract_address" + else + echo "Error please check tx hash " + fi \ No newline at end of file diff --git a/scripts/nft/terp721-updatable/02-create-minter.sh b/scripts/nft/terp721-updatable/02-create-minter.sh index 6bafb11..a748609 100755 --- a/scripts/nft/terp721-updatable/02-create-minter.sh +++ b/scripts/nft/terp721-updatable/02-create-minter.sh @@ -1,6 +1,6 @@ KEY=$(terpd keys show $ADMIN | jq -r .name) -FACTORY= -TERP721_CODE_ID= +FACTORY=terp14kq48e55k8sdpu4tv5dpjshsk737am7mjf7z5k8d7h26vxw96ensta0nqx +TERP721_CODE_ID=128 # init msg # VendingMinterInitMsgExtension { @@ -37,20 +37,20 @@ MSG=$(cat < unsignedTx.json +response_command='terpd tx wasm instantiate $FACTORY_CODE_ID "$MSG" --label="vendingfactory" --no-admin --from test1 --gas-prices 0.05uthiolx --gas-adjustment 1.7 --gas auto --chain-id 90u-4 -b sync -o json --yes -o json'; +response=$(eval $response_command); +echo $response; + + if [ -n "$response" ]; then + txhash=$(echo "$response" | jq -r '.txhash') + echo 'waiting for tx to process' + sleep 6; + tx_response=$(terpd q tx $txhash -o json) + contract_address=$(echo "$tx_response" | jq -r '.logs[].events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address") | .value') + echo "Contract Address: $contract_address" + else + echo "Error: Empty response" + fi \ No newline at end of file diff --git a/scripts/upload.sh b/scripts/upload.sh index 5d3bb87..da6bcfd 100755 --- a/scripts/upload.sh +++ b/scripts/upload.sh @@ -1,5 +1,14 @@ -for d in ./*.wasm; do +for d in ./artifacts/*.wasm; do echo $d; - terpd tx wasm store $d --from test --gas-prices auto --gas-adjustment 1.7 --gas auto --chain-id 90u-4 --node -b block --yes -o json | jq '.logs' | grep -A 1 code_id + response_command="terpd tx wasm store $d --from test1 --gas-prices 0.05uthiolx --gas-adjustment 1.7 --gas auto --chain-id 90u-4 -b async --yes -o json"; + response=$(eval $response_command); + if [ -n "$response" ]; then + txhash=$(echo "$response" | jq -r '.txhash') + echo "Using txhash: $txhash" + sleep 6; + terpd q tx $txhash | sed -n 's/.*"key":"code_id","value":"\([^"]*\)".*/\1/p' + else + echo "Error: Empty response" + fi echo "-----------------"; done