// npm 패키지
cwao-units
`cwao-units` runs [AO compatible units](https://ao.arweave.dev/#/spec) for CosmWasm.
버전
46
메인테이너
1
라이선스
MIT
최초 publish
2024-03-27
publisher
asteroiddao
tarball
48,459 B
AUTO-PUBLISHED·1개 버전 인덱싱됨·최근 publish: 2026-05-27
// publisher 캠페인by asteroiddao
이 계정에서 catch된 패키지 9건고립된 catch가 아닙니다. 동일 publisher가 8개의 다른 패키지를 추가로 발행했고, 모두 파이프라인이 catch했습니다 — 일회성이 아닌 조직적 캠페인의 형태. 아래 링크는 각 형제 catch의 분석으로 이동합니다.
// offending code· @0.8.4· 1 file flagged
- @0.8.4··AUTO-PUBLISHED·publisher: asteroiddaoheuristic 75/100static flags 2llm skippedmature-packageosv-flagged:MAL-2026-4546eval-dynamicbase64-decode
// offending code· 1 file flaggedpatterns: 2
--- package/cu.js (excerpt) --- const express = require("express") const Arweave = require("arweave") const Base = require("./base") const { VM } = require("./cosmwasm") const { SU } = require("cwao") const { isNil, concat, includes, filter } = require("ramda") const reserved_tags = [ "Data-Protocol", "Variant", "Type", "Action", "From-Process", "From-Module", "Pushed-For", "Cast", "Load", "Read-Only", "Epoch", "Nonce", "Process", "Hash-Chain", "Timestamp", "Message", "Block-Height", "Module", "Scheduler", "Cron-Interval", "Memory-Limit", "Compute-Limit", ] class CU extends Base { constructor({ port = 1987, arweave = { host: "localhost", port: 1984, protocol: "http", }, graphql = "http://localhost:1984/graphql", wallet, protocol, variant, }) { super({ wallet, port, arweave, graphql, type: "CU", protocol, variant }) this.ongoing = {} this.subscribe = {} this.results = {} this.vms = {} this.sus = {} this.msgs = {} this.init() } init() { const routes = { get: { "/": "root", "/state/:process": "state", "/result/:message": "result", }, } this.router(routes) this.start() } async getModule(txid, pr_id) { const wasm = await this.arweave.transactions.getData(txid, { decode: true }) const vm = new VM({ id: "ao", addr: pr_id }) await vm.getVM(wasm) return vm } async _instantiate(pid, input) { let result = nu --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- cu-weavedb.js (bundled) --- const { DB: ZKDB } = require("zkjson") const WDB = require("weavedb-offchain") const express = require("express") const Arweave = require("arweave") const CU = require("./cu") const { SU } = require("cwao") const { concat, includes, filter, clone, isNil, last } = require("ramda") const reserved_tags = [ "Data-Protocol", "Variant", "Type", "Action", "From-Process", "From-Module", "Pushed-For", "Cast", "Load", "Read-Only", "Epoch", "Nonce", "Process", "Hash-Chain", "Timestamp", "Message", "Block-Height", "Module", "Scheduler", "Cron-Interval", "Memory-Limit", "Compute-Limit", ] class CUWDB extends CU { constructor(params) { super(params) this.zkdbs = {} this.cols = {} this.hashes = {} this.wasmRU = params.wasmRU this.zkeyRU = params.zkeyRU this.zk_error = false this.wasm = params.wasm this.zkey = params.zkey this.col_idmap = {} } init() { const routes = { get: { "/": "root", "/state/:process": "state", "/result/:message": "result", "/hash/:process": "hash", "/zkjson/:process": "zkjson", }, } this.router(routes) this.start() } async get_hash(req, res) { if (this.zk_error) return this.bad_request(res) try { const pid = req.params["process"] if (!this.hashes[pid]) return this.bad_request(res) res.json({ hash: last(this.hashes[pid]), height: this.hashes[pid].length, }) } catch (e) { return this.bad_request(res) } } async get_zkjson(req, res) { if (this.zk_error) return this.bad_request(res) try { const pid = req.params["process"] if (!this.hashes[pid]) return this.bad_request(res) const { path, doc, collection } = req.query const col_id = this.cols[pid][collection] if (isNil(col_id)) return this.bad_request(res) const data = await this.vms[pid].read({ function: "get", query: [collectio --- test/test-cosmwasm.js (bundled) --- const { expect } = require("chai") const { BasicBackendApi, BasicKVIterStorage, BasicQuerier, VMInstance, } = require("@terran-one/cosmwasm-vm-js") const { readFileSync } = require("fs") const { resolve } = require("path") const mockEnv = { block: { height: 100, time: Number(Date.now()).toString(), chain_id: "wdb", }, contract: { address: "random-contract", }, } const mockInfo = { sender: "random-sender", funds: [], } const get = vm => { return JSON.parse( atob( vm.query(mockEnv, { Num: {}, }).json.ok, ), ).num } const inc = (vm, num) => { vm.execute(mockEnv, mockInfo, { Add: { num: num }, }) } const init = (vm, num) => { vm.instantiate(mockEnv, mockInfo, { num, }) } const getVM = async () => { const wasmBytecode = readFileSync( resolve( __dirname, "../../cosmwasm/simple/target/wasm32-unknown-unknown/release/contract.wasm", ), ) const backend = { backend_api: new BasicBackendApi("wdb"), storage: new BasicKVIterStorage(), querier: new BasicQuerier(), } const vm = new VMInstance(backend) await vm.build(wasmBytecode) return vm } describe("CosmWasm", function () { it("should add numbers to contract state", async () => { const vm = await getVM() init(vm, 5) expect(get(vm)).to.eql(5) inc(vm, 3) expect(get(vm)).to.eql(8) }) })
