UNPKG

near-workspaces

Version:

Write tests in TypeScript/JavaScript to run in a controlled NEAR Sandbox local environment.

23 lines 709 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ContractState = void 0; const buffer_1 = require("buffer"); const borsh_1 = require("borsh"); class ContractState { data; constructor(dataArray) { this.data = new Map(); for (const { key, value } of dataArray) { this.data.set(key.toString(), value); } } getRaw(key) { return this.data.get(key) ?? buffer_1.Buffer.from(''); } get(key, borshSchema) { const value = this.getRaw(key); return (0, borsh_1.deserialize)(borshSchema, Uint8Array.from(value)); } } exports.ContractState = ContractState; //# sourceMappingURL=contract-state.js.map