Coder Social home page Coder Social logo

arufa-research / polar Goto Github PK

View Code? Open in Web Editor NEW
37.0 37.0 10.0 2.43 MB

Polar is a development environment to compile, deploy, test, run scrt contracts on different networks.

Home Page: https://docs.arufaresearch.com/

License: MIT License

JavaScript 2.49% Shell 0.03% TypeScript 85.61% Makefile 0.09% Rust 11.79%
cosmwasm dev-tooling smart-contracts

polar's People

Contributors

amityadav0 avatar coco-sha avatar dependabot[bot] avatar hunny98 avatar ozoromo avatar tusharxoxoxo avatar udit-gulati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

polar's Issues

Identify location of wasm and schema files from toml files

Polar should be able to identify location of schema and wasm file depending on the structure of project.

For wasm files, target/ dir needs to be located and inside structure of target/ dir is always same.

For schema files, schema/ dir needs to be loacted.

Deploy using cosmjs

  • Add client creation using cosmjs
  • Refract code for signing client
  • Check impact on package size

Globally set tx checking interval

Currently, the parameter broadcastCheckIntervalMs can only be defined for every transaction. It would be very helpful if it could be defined on the client creation. This would help development since localsecret may run with faster block times locally, while on CI it will probably be the testnet rate.
This would hugely improve the testing experience, which may be very "waity" for long tests.

Cleanup wasm.ts in wasm-ast-types to generalize schema parsing

  1. The InstantiateMsg, ExecuteMsg and QueryMsg are generated using https://www.npmjs.com/package/json-to-ts anf the Client objects are generated manually as structure is modified from above.

  2. Update wasm.ts to only use https://www.npmjs.com/package/json-to-ts for schema values in Client objects too.

  3. Test against astroport contracts https://github.com/astroport-fi/astroport-core to make sure that complex msg types parsing is working fine.

Have both rest and rpc endpoints in cfg

The js client for a given network can either use the REST or RPC url based on the implementation.

Having them as rest_endpoint and rpc_endpoint in place of endpoint will make it easier to understand for the user and if the js client only requires RPC endpoint then rpc_endpoint value can be skipped in the config and vice-versa.

While doing node-info, user can confirm if REST or RPC endpoint was required.

Polar test should not use checkpoints

  • polar tests are independent of contract scripts
  • there could be multiple tests
  • each test should deploy and init a different instance of contracts
  • test should not read from/write to checkpoints file

Polar logging

Logging needs rework. Look from the dev experience view.

There should be --verbose flag and important things like endpoint, other configs should be shown to user when interacting with a network as an example of things that should be there to make it easier for dev to find the possible issues in the contract development process.

Create a response parser class

The response from query, exec, init, deploy is huge.

There should be proper independent parser class to handle the parsing of this huge response msg into small readable json.

Should have some params passed by user as env variables to tweak the parser output like verbose, should detailed log, show network call stack etc.

error in running script

Contracts are compiling sucessfully, but getting error while running script. More particularly it is throwing error when fetching account with getAccountByName function of secret-polar.

Compiling TS files: scripts/flow.ts

/home/adarsh/Desktop/kiii/node_modules/secret-polar/dist/types.d.ts (2,25): Cannot find module 'secretjs/dist/protobuf_stuff/cosmos/distribution/v1beta1/distribution' or its corresponding type declarations.
Mon Dec 12 2022 16:51:54 GMT+0530 (India Standard Time)
Error PE602: Error running script {build/scripts/flow.js}: secretjs_1.SecretNetworkClient.create is not a function

Addition to polar init command

npm/yarn install can be added to polar init.

It can be added later, and it's addition depends on the usage workflow of polar so keeping for later.

TX timeout due to high fees

  • Add check in polar to throw error for this case
  • When high fees is passed, tx is not broadcasted to chain, Therefor resulting in timeout

Checkpoints error

Steps to regenerate:

  • Deploy contracts on chain A
  • Deploy contracts on chain B (This will return error)
  • There is issue when loading checkpoints in this case

Option<Vec<...>> is not supported in schema

Creating TS schema objects for contract in directory: artifacts/typescript_schema
Error: contact maintainers [unknown type]: object
at getType (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:76:13)
at getPropertyType (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:156:28)
at /home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:236:7
at Array.map ()
at createTypedObjectParams (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:186:26)
at createPropertyFunctionWithObjectParams (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:117:49)
at /home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:147:12
at Array.map ()
at Object.createQueryInterface (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:143:60)
at generateTsSchema (/home/ay/.config/yarn/global/node_modules/secret-polar/dist/lib/compile/tsSchema.js:59:21)
{
type: 'object',
properties: {
limit: {
description: 'The number of pairs to read and return. It is an [Option] type.',
type: [Array],
format: 'uint32',
minimum: 0
},
start_after: {
description: 'The pair item to start reading from. It is an [Option] type that accepts [AssetInfo] elements.',
type: [Array],
items: [Object],
minItems: 0
}
},
required: [],
additionalProperties: true
} start_after
An unexpected error occurred: contact maintainers [unknown type]: object

Secret Network Roadmap inclusion of Polar

Hi Polar Team,

I'm reaching out to you because we are working on the Secret Network Ecosystem Road map, and we hope you will join

What is the Secret Network Ecosystem Road map?
The road map is a visual overview of all development that is happening on Secret Network. It will include dapps, tools, sidechains and network upgrades developed by the core development teams and external developers alike. The road map will be updated on a monthly basis, and published publicly. Before the end of September we are aiming for a dedicated road map page on scrt.network.

We have come up with four requirements that should ensure the road map is of maximum value to everybody on the network

  1. A unique name (can be a code name)
  2. In development (meaning the project is worked on and aims for a mainnet launch)
  3. The project has a clear value proposition for Secret Network (expected positive impact to KPIs, no obvious meme or shitcoin)
  4. Has consent from the developer to be listed on the road map(edited)
    [11:45 AM]
    Timelines on the road map
    We want as many projects as possible to join the road map project, and we understand that committing to a road map usually means committing to a timeline. We want to take away these worries in our road map design.
    The road map is going to have 2 sections, 1) a timeline looking 3 months into the future, and 2) a list with the indication "also in development".

As a developer it is up to you where you want your project to show up. If you have already committed to a timeline in the next 3 months, we invite you to go on the timeline. If your mainnet release is further in the future, or if you aren't sure about your expected release in the coming months, join the "also in development" section.

We hope we aren't putting any unnecessary pressure on developers to communicate timelines, and allow everyone to join the road map without introducing stress :).

As far as we know project Polar meets req. 1, 2 and 3, and we would like to add it to the road map.

To add the project to the road map we have 4 questions:

  1. Would you like your project to be on the road map?
  2. Is Polar the name you want to have on the road map?
  3. What is your expected timeline? 1 month, 2 months, 3 months, later (again if you aim for 1/2/3 months, but prefer to be listed in the "also in development" section, let us know)
    4, optional) Each project has the opportunity for a hyperlink to a website or forum thread with information about the project. Please provide us the url you would like us to include

Ideally we have all the information available to use early next week so we can release the first road map by the end of the week.

I'm looking forward to hearing from you!

Error normalization

  • Error is not normalized, therefore for mainnet tx errors it is very difficult to know the actual error

Rust version cfg; Cargo commands cfg

Following cfg params should be there in polar.config.js:

  1. Rust toolchain version: Either "1.60.0" or "system"
  2. Cargo commands for compiling contracts, generating schema if made configurable can be used for broader number projects. Example: Generate schema using either cargo run --example schema or cargo schema depending on project's contract cfg.

polar init . issues

(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ npx polar init .
★ Welcome to polar v0.10.1
Initializing new project in /home/uditgulati/Documents/osmosis-on-sn.
Error PE17: Polar project file was detected: 'README.md'. Move the file or use an empty directory.

For more info run polar with --show-stack-traces or add --help to display task-specific help.
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ ls
Cargo.lock  Cargo.toml  LICENSE  README.md
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ rm -rf README.md 
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ npx polar init .
★ Welcome to polar v0.10.1
Initializing new project in /home/uditgulati/Documents/osmosis-on-sn.
Error PE17: Polar project file was detected: 'Cargo.lock'. Move the file or use an empty directory.

For more info run polar with --show-stack-traces or add --help to display task-specific help.
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ ls
Cargo.lock  Cargo.toml  LICENSE
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ rm -rf Cargo.lock Cargo.toml 
(env) uditgulati@uditgulati-Swift-SF313-52:~/Documents/osmosis-on-sn$ npx polar init .
★ Welcome to polar v0.10.1
Initializing new project in /home/uditgulati/Documents/osmosis-on-sn.

★ Project created ★

You need to install these dependencies to run the sample project:
  npm install --global --save-dev chai

Success! Created project at /home/uditgulati/Documents/osmosis-on-sn.
Begin by typing:
  cd .
  polar help
  polar compile

Init should not add any files is an error such as README.md exists error shows up. Should move README.md to README.md.old.

Use object as query params instead of string map

Example:

Instead of:

await contract.query.balance({ "address": contract_owner.account.address });

Use:

await contract.query.balance({ address: contract_owner.account.address });

This is the format being used for execute. This should also be used for query, init, deploy and send too to keep consistent format.

polar schema doesn't work

warning: secretswap (lib) generated 3 warnings
Compiling secretswap-generator v2.1.0 (/home/ay/arufa-research/secretswap2.0/contracts/generator)
Finished dev [unoptimized + debuginfo] target(s) in 15.43s
Running /home/ay/arufa-research/secretswap2.0/target/debug/examples/schema
Created /home/ay/arufa-research/secretswap2.0/contracts/generator/schema/instantiate_msg.json
Created /home/ay/arufa-research/secretswap2.0/contracts/generator/schema/execute_msg.json
Created /home/ay/arufa-research/secretswap2.0/contracts/generator/schema/query_msg.json
Creating TS schema objects for contract in directory: artifacts/typescript_schema
Error: [info.items] case not handled by transpiler. contact maintainers.
at getPropertyType (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:134:15)
at /home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:236:7
at Array.map ()
at createTypedObjectParams (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/utils/types.js:186:26)
at createPropertyFunctionWithObjectParams (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:131:49)
at /home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:178:12
at Array.map ()
at Object.createQueryInterface (/home/ay/.config/yarn/global/node_modules/polar-wasm-ast-types/main/wasm.js:174:60)
at generateTsSchema (/home/ay/.config/yarn/global/node_modules/secret-polar/dist/lib/compile/tsSchema.js:64:21)
at generateSchema (/home/ay/.config/yarn/global/node_modules/secret-polar/dist/lib/compile/compile.js:102:5)
{
type: 'object',
required: [ 'lp_token' ],
properties: {
lp_token: { type: 'array', items: [Array], maxItems: 2, minItems: 2 }
}
} lp_token
An unexpected error occurred: [info.items] case not handled by transpiler. contact maintainers.

Support multiple versions of cosmwasm

Different version of cosmwasm could have differences like instantiate_msg.json instead of init_msg.json etc.

We can support 2-3 variation of above such differences which affect polar flow and user can specify the cosmwasm version in the polar.config.js

Typescript schema issue

If there are same parameters in function parameters and execute parameters
Generated schema returns error.

Polar setup

  • Add polar setup or makefile to setup all the things for first time users (rust compiler, node etc.) in one command.

Add optional argument to polar clean

Just like polar compile has optional sourceDir argument, add one to polar clean which'll represent name of a contract. Ex: polar clean sample should only remove aritifacts/contracts/sample.wasm, artifacts/schema/sample/ and artifacts/checkoints/sample.yaml and not whole of artifacts dir.

Polar doesn't throw error

When executing a transaction and if it fails.
The error is not displayed.
Polar is not throwing error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.