Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
cosmwasm-vm
Advanced tools
THIS IS STILL UNDER DEVELOPMENT! Contributions are welcome.
NOTE: This was built for Terra-specific applications and thus is only supported for CosmWasm v0.16. However, this implementation probably can be easily adapted to support CosmWasm v1.0+.
This package implements a pure JavaScript (no Rust bindings / WASM needed) VM capable of executing compiled CosmWasm .wasm binaries in environments such as Node.js and compatible web browsers.
Add the cosmwasm-vm
package as a dependency in your package.json
.
npm install -S cosmwasm-vm
or
yarn add cosmwasm-vm
Please refer to the test in this repository for an example. I include a test contract based on cosmwasm/cw-template
that has been augmented with additional ExecuteMsg
variants for testing the various WASM imports.
yarn
yarn test
import { CosmWasmVM } from '../src';
import { readFileSync } from 'fs';
const wasm_byte_code = readFileSync('./cosmwasm_vm_test.wasm');
const vm = new CosmWasmVM(wasm_byte_code);
const mock_env = {
block: {
height: 1,
time: '2000000000',
chain_id: 'columbus-5',
},
contract: {
address: 'contract',
},
};
const mock_info = {
sender: 'sender',
funds: [],
};
describe('CosmWasmVM', () => {
it('instantiates', () => {
let res = vm.instantiate(mock_env, mock_info, { count: 20 });
console.log(res.json);
console.log(vm.store);
});
it('execute', () => {
let res = vm.instantiate(mock_env, mock_info, { count: 20 });
res = vm.execute(mock_env, mock_info, { increment: {} });
console.log(res.json);
console.log(vm.store);
});
});
FAQs
**THIS IS STILL UNDER DEVELOPMENT! Contributions are welcome.**
The npm package cosmwasm-vm receives a total of 1 weekly downloads. As such, cosmwasm-vm popularity was classified as not popular.
We found that cosmwasm-vm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.