Skip to content

Commit

Permalink
Merge pull request #15 from Chia-Mine/v0.0.14
Browse files Browse the repository at this point in the history
V0.0.14
  • Loading branch information
ChiaMineJP authored Jun 30, 2021
2 parents 8c267a6 + 7b72bb5 commit c9f78f4
Show file tree
Hide file tree
Showing 42 changed files with 2,566 additions and 2,521 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.0.14]
### Changed
- Changed new line style for files in `dist/` from windows-style(CR) to linux-style(LF).
### Removed
- Removed `WordArray32` from possible argument of `Bytes.from`.
### Added
- Added `Bytes.SHA256()`.

## [0.0.13]
### Changed
- `Bytes.from()` now accepts an array of number.
Expand Down Expand Up @@ -85,6 +93,7 @@
Initial (beta) release.

<!--[Unreleased]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.1...v0.0.2-->
[0.0.14]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.13...v0.0.14
[0.0.13]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.12...v0.0.13
[0.0.12]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.11...v0.0.12
[0.0.11]: https://github.com/Chia-Mine/clvm-js/compare/v0.0.10...v0.0.11
Expand Down
42 changes: 21 additions & 21 deletions dist/CLVMObject.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { None, Optional } from "./__python_types__";
import { Bytes, Tuple } from "./__type_compatibility__";
export declare type CLVMType = {
atom: Optional<Bytes>;
pair: Optional<Tuple<any, any>>;
};
export declare type Atom = {
atom: Bytes;
pair: None;
};
export declare type Cons = {
atom: None;
pair: Tuple<any, any>;
};
export declare class CLVMObject implements CLVMType {
atom: Optional<Bytes>;
pair: Optional<Tuple<any, any>>;
constructor(v: any);
}
export declare function isAtom(obj: CLVMType): obj is Atom;
export declare function isCons(obj: CLVMType): obj is Cons;
import { None, Optional } from "./__python_types__";
import { Bytes, Tuple } from "./__type_compatibility__";
export declare type CLVMType = {
atom: Optional<Bytes>;
pair: Optional<Tuple<any, any>>;
};
export declare type Atom = {
atom: Bytes;
pair: None;
};
export declare type Cons = {
atom: None;
pair: Tuple<any, any>;
};
export declare class CLVMObject implements CLVMType {
atom: Optional<Bytes>;
pair: Optional<Tuple<any, any>>;
constructor(v: any);
}
export declare function isAtom(obj: CLVMType): obj is Atom;
export declare function isCons(obj: CLVMType): obj is Cons;
88 changes: 44 additions & 44 deletions dist/CLVMObject.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCons = exports.isAtom = exports.CLVMObject = void 0;
const __python_types__1 = require("./__python_types__");
const __type_compatibility__1 = require("./__type_compatibility__");
const EvalError_1 = require("./EvalError");
/*
This class implements the CLVM Object protocol in the simplest possible way,
by just having an "atom" and a "pair" field
*/
class CLVMObject {
constructor(v) {
this.atom = __python_types__1.None;
// this is always a 2-tuple of an object implementing the CLVM object protocol.
this.pair = __python_types__1.None;
if (v instanceof CLVMObject) {
this.atom = v.atom;
this.pair = v.pair;
}
else if (v instanceof __type_compatibility__1.Tuple) {
this.pair = v;
this.atom = __python_types__1.None;
}
else {
this.atom = v;
this.pair = __python_types__1.None;
}
}
}
exports.CLVMObject = CLVMObject;
function isAtom(obj) {
if ((obj.atom && obj.pair) || (!obj.atom && !obj.pair)) {
throw new EvalError_1.EvalError("Invalid clvm", obj);
}
return Boolean(obj.atom && !obj.pair);
}
exports.isAtom = isAtom;
function isCons(obj) {
if ((obj.atom && obj.pair) || (!obj.atom && !obj.pair)) {
throw new EvalError_1.EvalError("Invalid clvm", obj);
}
return Boolean((!obj.atom && obj.pair));
}
exports.isCons = isCons;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCons = exports.isAtom = exports.CLVMObject = void 0;
const __python_types__1 = require("./__python_types__");
const __type_compatibility__1 = require("./__type_compatibility__");
const EvalError_1 = require("./EvalError");
/*
This class implements the CLVM Object protocol in the simplest possible way,
by just having an "atom" and a "pair" field
*/
class CLVMObject {
constructor(v) {
this.atom = __python_types__1.None;
// this is always a 2-tuple of an object implementing the CLVM object protocol.
this.pair = __python_types__1.None;
if (v instanceof CLVMObject) {
this.atom = v.atom;
this.pair = v.pair;
}
else if (v instanceof __type_compatibility__1.Tuple) {
this.pair = v;
this.atom = __python_types__1.None;
}
else {
this.atom = v;
this.pair = __python_types__1.None;
}
}
}
exports.CLVMObject = CLVMObject;
function isAtom(obj) {
if ((obj.atom && obj.pair) || (!obj.atom && !obj.pair)) {
throw new EvalError_1.EvalError("Invalid clvm", obj);
}
return Boolean(obj.atom && !obj.pair);
}
exports.isAtom = isAtom;
function isCons(obj) {
if ((obj.atom && obj.pair) || (!obj.atom && !obj.pair)) {
throw new EvalError_1.EvalError("Invalid clvm", obj);
}
return Boolean((!obj.atom && obj.pair));
}
exports.isCons = isCons;
14 changes: 7 additions & 7 deletions dist/EvalError.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { str } from "./__python_types__";
import type { CLVMObject } from "./CLVMObject";
export declare class EvalError extends Error {
_sexp?: CLVMObject;
name: string;
constructor(message: str, sexp: CLVMObject);
}
import type { str } from "./__python_types__";
import type { CLVMObject } from "./CLVMObject";
export declare class EvalError extends Error {
_sexp?: CLVMObject;
name: string;
constructor(message: str, sexp: CLVMObject);
}
22 changes: 11 additions & 11 deletions dist/EvalError.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EvalError = void 0;
class EvalError extends Error {
constructor(message, sexp) {
super(message);
this.name = "EvalError";
this._sexp = sexp;
}
}
exports.EvalError = EvalError;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EvalError = void 0;
class EvalError extends Error {
constructor(message, sexp) {
super(message);
this.name = "EvalError";
this._sexp = sexp;
}
}
exports.EvalError = EvalError;
60 changes: 30 additions & 30 deletions dist/SExp.d.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { G1Element } from "@chiamine/bls-signatures";
import { int, None, str } from "./__python_types__";
import { CLVMObject } from "./CLVMObject";
import { Bytes, Tuple } from "./__type_compatibility__";
export declare type CastableType = SExp | CLVMObject | Bytes | str | int | None | G1Element | CastableType[] | Tuple<CastableType, CastableType>;
export declare function looks_like_clvm_object(o: any): o is CLVMObject;
export declare function convert_atom_to_bytes(v: any): Bytes;
export declare function to_sexp_type(value: CastableType): CLVMObject;
export declare class SExp extends CLVMObject {
static readonly TRUE: SExp;
static readonly FALSE: SExp;
static readonly __NULL__: SExp;
static to(v: CastableType): SExp;
static null(): SExp;
constructor(v: CLVMObject);
as_pair(): Tuple<SExp, SExp> | None;
listp(): boolean;
nullp(): boolean;
as_int(): number;
as_bin(): Bytes;
cons(right: any): SExp;
first(): SExp;
rest(): SExp;
as_iter(): Generator<SExp, void, unknown>;
equal_to(other: CastableType): boolean;
list_len(): number;
as_javascript(): import("./as_javascript").TToJavascript;
toString(): string;
__repr__(): string;
}
import { G1Element } from "@chiamine/bls-signatures";
import { int, None, str } from "./__python_types__";
import { CLVMObject } from "./CLVMObject";
import { Bytes, Tuple } from "./__type_compatibility__";
export declare type CastableType = SExp | CLVMObject | Bytes | str | int | None | G1Element | CastableType[] | Tuple<CastableType, CastableType>;
export declare function looks_like_clvm_object(o: any): o is CLVMObject;
export declare function convert_atom_to_bytes(v: any): Bytes;
export declare function to_sexp_type(value: CastableType): CLVMObject;
export declare class SExp extends CLVMObject {
static readonly TRUE: SExp;
static readonly FALSE: SExp;
static readonly __NULL__: SExp;
static to(v: CastableType): SExp;
static null(): SExp;
constructor(v: CLVMObject);
as_pair(): Tuple<SExp, SExp> | None;
listp(): boolean;
nullp(): boolean;
as_int(): number;
as_bin(): Bytes;
cons(right: any): SExp;
first(): SExp;
rest(): SExp;
as_iter(): Generator<SExp, void, unknown>;
equal_to(other: CastableType): boolean;
list_len(): number;
as_javascript(): import("./as_javascript").TToJavascript;
toString(): string;
__repr__(): string;
}
Loading

0 comments on commit c9f78f4

Please sign in to comment.