Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

as-chain

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

as-chain - npm Package Compare versions

Comparing version 0.0.73 to 0.0.74

4

assembly/action.ts

@@ -59,2 +59,6 @@ import * as env from "./env";

export function setActionReturnValue<T extends Packer>(returnValue: T): void {
env.set_action_return_value(returnValue.pack().dataStart, returnValue.getSize());
}
export class PermissionLevel implements Packer {

@@ -61,0 +65,0 @@ constructor(

109

assembly/crypto.ts

@@ -8,10 +8,9 @@ import { check } from "./system";

export class Checksum160 implements Packer {
data: u8[];
class Checksum implements Packer {
data: u8[] = new Array<u8>(<i32>this.getSize());
constructor(
data: u8[] | null = null
){
this.data = new Array<u8>(20);
if (data) {
check(this.data.length == 20, "bad checksum length");
check(this.data.length == <i32>this.getSize(), "bad checksum length");
this.assign(data);

@@ -21,5 +20,9 @@ }

static fromString(str: string): Checksum {
return new Checksum(Utils.hexToBytes(str))
}
assign(value: u8[]): void {
check(value.length == 20, "bad assign length");
env.memcpy(this.data.dataStart, value.dataStart, 20);
check(value.length == <i32>this.getSize(), "bad assign length");
env.memcpy(this.data.dataStart, value.dataStart, this.getSize());
}

@@ -33,3 +36,3 @@

let dec = new Decoder(data);
this.data = dec.unpackBytes(20);
this.data = dec.unpackBytes(this.getSize());
return dec.getPos();

@@ -39,3 +42,3 @@ }

getSize(): usize {
return 20;
return 0;
}

@@ -48,3 +51,3 @@

@inline @operator('==')
static eq(a: Checksum160, b: Checksum160): bool {
static eq(a: Checksum, b: Checksum): bool {
return Utils.bytesCmp(a.data, b.data) == 0;

@@ -54,3 +57,3 @@ }

@inline @operator('!=')
static neq(a: Checksum160, b: Checksum160): bool {
static neq(a: Checksum, b: Checksum): bool {
return Utils.bytesCmp(a.data, b.data) != 0;

@@ -60,92 +63,18 @@ }

export class Checksum256 implements Packer {
data: u8[];
constructor(
data: u8[] | null = null
){
this.data = new Array<u8>(32);
if (data) {
check(this.data.length == 32, "bad checksum length");
this.assign(data);
}
export class Checksum160 extends Checksum {
getSize(): usize {
return 20;
}
}
assign(value: u8[]): void {
check(value.length == 32, "bad assign length");
env.memcpy(this.data.dataStart, value.dataStart, 32);
}
pack(): u8[] {
return this.data.slice(0);
}
unpack(data: u8[]): usize {
let dec = new Decoder(data);
this.data = dec.unpackBytes(32);
return dec.getPos();
}
export class Checksum256 extends Checksum {
getSize(): usize {
return 32;
}
toString(): string {
return Utils.bytesToHex(this.data);
}
@inline @operator('==')
static eq(a: Checksum256, b: Checksum256): bool {
return Utils.bytesCmp(a.data, b.data) == 0;
}
@inline @operator('!=')
static neq(a: Checksum256, b: Checksum256): bool {
return Utils.bytesCmp(a.data, b.data) != 0;
}
}
export class Checksum512 implements Packer {
data: u8[];
constructor(
data: u8[] | null = null
){
this.data = new Array<u8>(64);
if (data) {
check(this.data.length == 64, "bad checksum length");
this.assign(data);
}
}
assign(value: u8[]): void {
check(value.length == 64, "bad assign length");
env.memcpy(this.data.dataStart, value.dataStart, 64);
}
pack(): u8[] {
return this.data.slice(0);
}
unpack(data: u8[]): usize {
let dec = new Decoder(data);
this.data = dec.unpackBytes(64);
return dec.getPos();
}
export class Checksum512 extends Checksum {
getSize(): usize {
return 64;
}
toString(): string {
return Utils.bytesToHex(this.data);
}
@inline @operator('==')
static eq(a: Checksum512, b: Checksum512): bool {
return Utils.bytesCmp(a.data, b.data) == 0;
}
@inline @operator('!=')
static neq(a: Checksum512, b: Checksum512): bool {
return Utils.bytesCmp(a.data, b.data) != 0;
}
}

@@ -152,0 +81,0 @@

@@ -34,2 +34,3 @@ export declare function memcpy (destination: usize, source: usize, num: usize): usize;

export declare function current_receiver(): u64
export declare function set_action_return_value(return_value: usize, size: u32): void;
export declare function get_code_hash(account: u64, struct_version: u32, packed_result_ptr: usize): usize

@@ -36,0 +37,0 @@

{
"name": "as-chain",
"version": "0.0.73",
"version": "0.0.74",
"description": "chain module for assemblyscript",

@@ -5,0 +5,0 @@ "main": "js/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc