-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom fees; updated logging; working scripts/test (#84)
* add types for error to fix build * move the schema to ts schema * update sample project for ts * use the polar wasm ast to parse schema into ts client * fixes * restore * update sample scripts; fix readonly coin issue * compile ts files on running script, test ts file * remove package lock file * use custom fee from method args; make the contract polar errors verbose * add sample project script and test ts files * add comment to sample script Co-authored-by: Amit Yadav <[email protected]>
- Loading branch information
1 parent
f4b4a23
commit 2ab23ff
Showing
5 changed files
with
81 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
import { getAccountByName } from "secret-polar"; | ||
import { use } from "chai"; | ||
import { getAccountByName, polarChai } from "secret-polar"; | ||
|
||
import { SampleProjectContract } from "../artifacts/typescript_schema/SampleProjectContract"; | ||
|
||
export default async function run () { | ||
const runTs = String(new Date()); | ||
const contract_owner = await getAccountByName("account_0"); | ||
const contract = new SampleProjectContract(); | ||
use(polarChai); | ||
|
||
const deploy_response = await contract.deploy( | ||
contract_owner, | ||
{ // custom fees | ||
amount: [{ amount: "750000", denom: "uscrt" }], | ||
gas: "3000000", | ||
} | ||
); | ||
console.log(deploy_response); | ||
describe("counter", () => { | ||
|
||
const contract_info = await contract.instantiate( | ||
{"count": 102}, | ||
`deploy test ${runTs}`, | ||
contract_owner, | ||
); | ||
console.log(contract_info); | ||
async function setup() { | ||
const contract_owner = await getAccountByName("account_0"); | ||
const contract = new SampleProjectContract(); | ||
await contract.setUpclient(); | ||
|
||
const inc_response = await contract.increment({account: contract_owner}); | ||
console.log(inc_response); | ||
|
||
const response = await contract.getCount(); | ||
console.log(response); | ||
|
||
const transferAmount = [{"denom": "uscrt", "amount": "15000000"}] // 15 SCRT | ||
const customFees = { // custom fees | ||
amount: [{ amount: "750000", denom: "uscrt" }], | ||
gas: "3000000", | ||
return { contract_owner, contract }; | ||
} | ||
const ex_response = await contract.increment( | ||
{account: contract_owner, transferAmount: transferAmount} | ||
); | ||
console.log(ex_response); | ||
} | ||
|
||
it("deploy and init", async () => { | ||
const runTs = String(new Date()); | ||
const { contract_owner, contract } = await setup(); | ||
const deploy_response = await contract.deploy( | ||
contract_owner, | ||
{ // custom fees | ||
amount: [{ amount: "90000", denom: "uscrt" }], | ||
gas: "35000000", | ||
} | ||
); | ||
console.log(deploy_response); | ||
const contract_info = await contract.instantiate( | ||
{ | ||
"count": 102 | ||
}, | ||
`deploy test ${runTs}`, | ||
contract_owner, | ||
); | ||
console.log(contract_info); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters