@therootnetwork/pact-web
Browser-Wasm bindings for the TRN-Pact capability codec.
Vendor-neutral, on-chain only
Published under @therootnetwork. These talk directly to TRN nodes (WS or HTTPS) — no hosted Futureverse service in the path — so they are the safest dependency to take for projects that need to outlive the Futureverse company.
- Version
0.0.3- Published
- 2024-02-20
- License
- Apache-2.0
- Status
trn-active- npm
- https://www.npmjs.com/package/@therootnetwork/pact-web
- Repository
- https://github.com/futureversecom/trn-trnnut-rs
- Homepage
- https://github.com/futureversecom/trn-trnnut-rs#readme
- Types
pact-web.d.ts- Maintainers
- zees-fv, karishma09, aidan-starke, kenvu-ai
- Recent versions
0.0.1·0.0.2·0.0.3
Why use it
Browser-side Pact encoding/decoding.
When to skip it
Server-only project.
Pairs with
@therootnetwork/pact-nodejs— Node counterpart
Upstream README
@therootnetwork/pact-nodejs
Wasm pact js interface.
Create a Pact contract
js
const {OpLoad, OpComp, OpConj} = require(".@therootnetwork/pact-nodejs");
const Pact = require('@therootnetwork/pact-nodejs').Pact;
const OpCodeComparator = require('@therootnetwork/pact-nodejs').OpCodeComparator;
const OpCodeConjunction = require('@therootnetwork/pact-nodejs').OpCodeConjunction;
let data_table = ["10","20"];
let comp = new OpCodeComparator(OpLoad.InputVsUser, OpComp.EQ,0,0,false);
let conj = new OpCodeConjunction(OpConj.AND,false);
let bytecode = new Uint8Array([
...comp.encode(),
conj.encode(),
]);
return new Pact(data_table, bytecode);Encode and serialize a Pact contract
js
const {OpLoad, OpComp, OpConj} = require(".@therootnetwork/pact-nodejs");
const Pact = require('@therootnetwork/pact-nodejs').Pact;
const OpCodeComparator = require('@therootnetwork/pact-nodejs').OpCodeComparator;
const OpCodeConjunction = require('@therootnetwork/pact-nodejs').OpCodeConjunction;
let data_table = ["10","20"];
let comp = new OpCodeComparator(OpLoad.InputVsUser, OpComp.EQ,0,0,false);
let conj = new OpCodeConjunction(OpConj.AND,false);
let bytecode = new Uint8Array([
...comp.encode(),
conj.encode(),
]);
let pactContract = new Pact(data_table, bytecode);
return pactContract.encode();Source: https://www.npmjs.com/package/@therootnetwork/pact-web · captured 2026-05-02