Skip to content

Commit

Permalink
splitting gas price and microdenom
Browse files Browse the repository at this point in the history
  • Loading branch information
spoo-bar committed Jun 3, 2022
1 parent 5f947e5 commit f607311
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,31 @@
"type": "string",
"description": "default amount of gas to be used as the gas limit for a transaction."
},
"chainDenom": {
"type": "string",
"description": "the micro denom used to pay for gas and to track account balance"
},
"faucetEndpoint": {
"type":"string",
"description": "Faucet address and port to request funds"
}
},
"required": ["configName","chainId", "addressPrefix", "rpcEndpoint", "defaultGasPrice"]
"required": ["configName","chainId", "addressPrefix", "rpcEndpoint", "defaultGasPrice", "chainDenom"]
},
"default": [{
"configName": "Juno UNI-3 testnet",
"chainId": "uni-3",
"addressPrefix": "juno",
"rpcEndpoint": "https://rpc.uni.juno.deuslabs.fi",
"defaultGasPrice": "0.025ujunox"
"defaultGasPrice": "0.025",
"chainDenom": "ujunox"
}, {
"configName": "Localnet - Juno",
"chainId": "testing",
"addressPrefix": "juno",
"rpcEndpoint": "http://localhost:26657",
"defaultGasPrice": "0.025ujunox",
"defaultGasPrice": "0.025",
"chainDenom": "ujunox",
"faucetEndpoint": "http://localhost:8000"
}]
}
Expand Down
4 changes: 4 additions & 0 deletions src/models/Workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ChainConfig {
addressPrefix!: string;
rpcEndpoint!: string;
defaultGasPrice!: string;
chainDenom!: string;

public Validate() {
if (!this) {
Expand All @@ -78,6 +79,9 @@ class ChainConfig {
if (!this.defaultGasPrice || this.defaultGasPrice === " ") {
throw new Error("Default Gas Price is empty");
}
if (!this.chainDenom || this.chainDenom === " ") {
throw new Error("Chain denom is empty");
}
return;
}
}
3 changes: 2 additions & 1 deletion src/views/TxProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ export class TxProvider implements vscode.WebviewViewProvider {
DirectSecp256k1HdWallet.fromMnemonic(account.mnemonic, {
prefix: Workspace.GetWorkspaceChainConfig().addressPrefix,
}).then(signer => {
let gasPrice = Workspace.GetWorkspaceChainConfig().defaultGasPrice + Workspace.GetWorkspaceChainConfig().chainDenom;
SigningCosmWasmClient.connectWithSigner(
Workspace.GetWorkspaceChainConfig().rpcEndpoint,
signer, {
gasPrice: GasPrice.fromString(Workspace.GetWorkspaceChainConfig().defaultGasPrice)
gasPrice: GasPrice.fromString(gasPrice)
}).then(client => {
client.execute(account.address, contract.contractAddress, req, "auto").then(res => {
let output = "// Input: \n";
Expand Down

0 comments on commit f607311

Please sign in to comment.