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

feat: Workspace optimizer and other breaking changes! #106

Merged
merged 14 commits into from
Aug 4, 2022

Conversation

octalmage
Copy link
Contributor

This is a biggie, so let me break it down:

New features

  • Workspace optimizer support! This is currently undocumented but it's required for monorepos.
  • Users can now specify a default task to run instead of the default deploy behavior. This is documented in the readme.

New commands

  • terrain contract:build
  • terrain contract:optimize

Breaking changes

  • The parameters for execute on the LCD client injected into the task runner have switched places to keep the interface consistent with queries and deploy tasks. Where possible all methods have been modified to take the contract name first.

Before

  await client.execute(wallets.test1, 'counter', {
    increment: {},
  });

After

  await client.execute('counter', wallets.test1, {
    increment: {},
  });
  • The deploy helper injected into the task runner now expects different parameters to make tasks less verbose.

Before

  // First deploy the counter smart contract.
  const counterCodeId = await deploy.storeCode(wallets.test1, "counter");
  const counterAddress = await deploy.instantiate(
    // Signer
    wallets.test1,
    // Contract name
    "counter",
    // Code ID
    counterCodeId,
    // Instance ID
    "default",
    // Contract admin
    wallets.test1.key.accAddress
  );

After

  // First deploy the counter smart contract.
  await deploy.storeCode('counter', wallets.test1);
  const counterAddress = await deploy.instantiate(
    // Contract name
    'counter',
    // Signer
    wallets.test1,
    { 
      // Contract admin
      admin: wallets.test1.key.accAddress,
    },
  );
  • To support global configuration options I had to move contract specific configuration into a contracts key.

Before

{
  "_global": {
    "payment-minter": {
       "deployTask": "deploy_payment_minter"
     }
  }
}

After

{
  "_global": {
    "contracts": {
      "payment-minter": {
        "deployTask": "deploy_payment_minter"
      }
    }
  }
}

Miscellaneous changes

  • Updates to eslint rules to work better with TypeScript.
  • Removed src/lib/waitForInclusionBlock.ts helper since this is now included in Terra.js
  • Jest tests are updated and passing!

});
// pause for account sequence to update.
// eslint-disable-next-line no-promise-executor-return
await new Promise((r) => setTimeout(r, 1000));

Check failure

Code scanning / ESLint

disallow returning values from Promise executor functions

Return values from promise executor functions cannot be read.
const contractConfig = (
allConfig[network]
&& allConfig[network].contracts
&& allConfig[network].contracts![contract]

Check warning

Code scanning / ESLint

Disallows non-null assertions using the `!` postfix operator

Forbidden non-null assertion.
This was referenced Aug 1, 2022
@octalmage octalmage force-pushed the feat/workspace-optimizer branch from df4227e to aea1f88 Compare August 1, 2022 21:02
@octalmage octalmage merged commit 82e2dcf into main Aug 4, 2022
@octalmage octalmage deleted the feat/workspace-optimizer branch August 4, 2022 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant