arufa-research / polar Goto Github PK
View Code? Open in Web Editor NEWPolar is a development environment to compile, deploy, test, run scrt contracts on different networks.
Home Page: https://docs.arufaresearch.com/
License: MIT License
Polar is a development environment to compile, deploy, test, run scrt contracts on different networks.
Home Page: https://docs.arufaresearch.com/
License: MIT License
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.
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.
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.
Update wasm.ts to only use https://www.npmjs.com/package/json-to-ts for schema values in Client objects too.
Test against astroport contracts https://github.com/astroport-fi/astroport-core to make sure that complex msg types parsing is working fine.
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.
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.
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.
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.
/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
User can choose from:
Steps to recreate:
mock_address
for this instead of throwing error.target/
and schema/
dir locations depend on Cargo.toml..wasm
and schema .json
files.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.
Required changes in Contract class methods:
Steps to regenerate:
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
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
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:
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!
Following cfg params should be there in polar.config.js:
cargo run --example schema
or cargo schema
depending on project's contract cfg.(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.
When executing rust compiler, it should through "rust compiler not found" error if rust is not installed.
Reference: https://github.com/arufa-research/polar/blob/master/packages/polar/src/lib/compile/compile.ts#L59
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.
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.
An unexpected error occurred: Cannot read property 'split' of undefined
An unexpected error occurred: Cannot read property 'split' of undefined
Check for other complex types too.
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
If there are same parameters in function parameters and execute parameters
Generated schema returns error.
polar setup
or makefile to setup all the things for first time users (rust compiler, node etc.) in one command.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.
When executing a transaction and if it fails.
The error is not displayed.
Polar is not throwing error.
Error: cannot use import outside module
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.