New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3 to 0.0.4

16

assembly/action.ts

@@ -55,8 +55,9 @@ import * as env from "./env";

export function currentReceiver(): u64 {
return env.current_receiver();
export function currentReceiver(): Name {
return new Name(env.current_receiver());
}
export class PermissionLevel implements Packer {
constructor(
public actor: Name = new Name(0),
public actor: Name = new Name(),
public permission: Name = Name.fromString("active")) {

@@ -86,6 +87,7 @@ }

constructor(
public authorization: PermissionLevel[],
public account: Name,
public name: Name,
public data: u8[]) {
public authorization: PermissionLevel[] = [],
public account: Name = new Name(),
public name: Name = new Name(),
public data: u8[] = [],
) {
}

@@ -92,0 +94,0 @@

@@ -42,2 +42,33 @@ import { i128, u128, u256 } from "as-bignum";

}
@inline @operator('+')
static add(a: U128, b: U128): U128 {
let ret = u128.add(a, b);
return new U128(ret.lo, ret.hi);
}
@inline @operator('-')
static sub(a: U128, b: U128): U128 {
let ret = u128.sub(a, b);
return new U128(ret.lo, ret.hi);
}
// mul: u128 x u128 = u128
@inline @operator('*')
static mul(a: U128, b: U128): U128 {
let ret = u128.mul(a, b);
return new U128(ret.lo, ret.hi);
}
@inline @operator('/')
static div(a: U128, b: U128): U128 {
let ret = u128.div(a, b);
return new U128(ret.lo, ret.hi);
}
@inline @operator('%')
static rem(a: U128, b: U128): U128 {
let ret = u128.rem(a, b);
return new U128(ret.lo, ret.hi);
}
}

@@ -44,0 +75,0 @@

@@ -40,10 +40,20 @@ import { check } from "./system";

export class Checksum256 implements Packer {
data: u8[];
constructor(
public data: u8[] | null = null
data: u8[] | null = null
){
this.data = new Array<u8>(32);
if (data) {
check(this.data.length == 32, "bad checksum length");
this.assign(data);
}
}
assign(value: u8[]): void {
check(value.length == 32, "bad assign length");
env.memcpy(this.data.dataStart, value.dataStart, 32);
}
pack(): u8[] {
return this.data!;
return this.data;
}

@@ -62,3 +72,3 @@

toString(): string {
return Utils.bytesToHex(this.data!);
return Utils.bytesToHex(this.data);
}

@@ -68,3 +78,3 @@

static eq(a: Checksum256, b: Checksum256): bool {
return Utils.bytesCmp(a.data!, b.data!) == 0;
return Utils.bytesCmp(a.data, b.data) == 0;
}

@@ -74,3 +84,3 @@

static neq(a: Checksum256, b: Checksum256): bool {
return Utils.bytesCmp(a.data!, b.data!) != 0;
return Utils.bytesCmp(a.data, b.data) != 0;
}

@@ -77,0 +87,0 @@ }

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

// void eosio_assert_message( uint32_t test, const char* msg, uint32_t msg_len );
export declare function eosio_assert(test: u32, msg_ptr: usize): void;
export declare function eosio_assert_message(test: u32, msg_ptr: usize, msg_len: usize): void;

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

@@ -5,3 +5,3 @@ import { IDXDB, SecondaryValue, SecondaryType, SecondaryIterator, SecondaryReturnValue } from "./idxdb";

import { U128 } from "./bignum";
import { printString } from "./debug";
import { print } from "./debug";

@@ -32,3 +32,3 @@ class IDX128ReturnValue {

let it = env.db_idx128_store(this.scope, this.table, payer, id, secondary_ptr);
env.db_idx128_find_primary(this.code, this.scope, this.table, secondary_ptr, id);
// env.db_idx128_find_primary(this.code, this.scope, this.table, secondary_ptr, id);
// let lo = load<u64>(secondary_ptr);

@@ -97,3 +97,3 @@ // let hi = load<u64>(secondary_ptr + 8);

store<u64>(secondary_ptr, secondary.lo);
store<u64>(secondary_ptr, secondary.hi);
store<u64>(secondary_ptr+8, secondary.hi);
let it = env.db_idx128_find_secondary(this.code, this.scope, this.table, secondary_ptr, primary_ptr);

@@ -100,0 +100,0 @@ return new SecondaryIterator(it, load<u64>(primary_ptr), this.dbIndex);

@@ -91,7 +91,9 @@ import { IDXDB, SecondaryValue, SecondaryType, SecondaryIterator, SecondaryReturnValue } from "./idxdb";

find(secondary: SecondaryValue): SecondaryIterator {
assert(secondary.type == SecondaryType.U256, "idx256: bad secondary type");
assert(secondary.value.length == 4, "find: idx256: bad value");
find(secondary: U256): SecondaryIterator {
let primary_ptr = __alloc(sizeof<u64>());
let secondary_ptr = secondary.value.dataStart;
let secondary_ptr = __alloc(sizeof<u64>()*4);
store<u64>(secondary_ptr, secondary.lo1);
store<u64>(secondary_ptr + 8, secondary.lo2);
store<u64>(secondary_ptr + 16, secondary.hi1);
store<u64>(secondary_ptr + 24, secondary.hi2);
let it = env.db_idx256_find_secondary(this.code, this.scope, this.table, secondary_ptr, 2, primary_ptr);

@@ -98,0 +100,0 @@ return new SecondaryIterator(it, load<u64>(primary_ptr), this.dbIndex);

@@ -81,8 +81,5 @@ import {IDXDB, SecondaryValue, SecondaryType, SecondaryIterator, SecondaryReturnValue} from "./idxdb";

find(secondary: SecondaryValue): SecondaryIterator {
check(secondary.type == SecondaryType.F128, "idx_long_double: bad secondary type");
check(secondary.value.length == 2, "idx_long_double: bad value");
find(secondary: Float128): SecondaryIterator {
let primary_ptr = __alloc(sizeof<u64>());
let secondary_ptr = secondary.value.dataStart;
let it = env.db_idx_long_double_find_secondary(this.code, this.scope, this.table, secondary_ptr, primary_ptr);
let it = env.db_idx_long_double_find_secondary(this.code, this.scope, this.table, secondary.data.dataStart, primary_ptr);
return new SecondaryIterator(it, load<u64>(primary_ptr), this.dbIndex);

@@ -89,0 +86,0 @@ }

@@ -78,2 +78,14 @@ import { IDXDB, SecondaryValue, SecondaryIterator } from "./idxdb";

getByKey(primary: u64): T | null {
let iterator = this.find(primary);
if (!iterator.isOk()) {
return null;
}
let data = this.db.get(iterator.i);
let ret = instantiate<T>();
ret.unpack(data);
return ret;
}
next(iterator: PrimaryIterator): PrimaryIterator {

@@ -80,0 +92,0 @@ let i = this.db.next(iterator.i);

import * as env from "./env";
import { TimePoint } from "./time";
export declare function eosio_assert_message(test: u32, msg_ptr: usize, msg_len: usize): void;
export function assert(test: bool, msg: string): void {

@@ -10,3 +8,3 @@ let s1 = String.UTF8.encode(msg);

let _test = test ? 1 : 0;
env.eosio_assert_message(_test, dv.dataStart, msg.length);
env.eosio_assert(_test, dv.dataStart);
}

@@ -13,0 +11,0 @@

@@ -161,3 +161,3 @@ import * as env from "./env";

for (let i=0; i<length; i++) {
let obj = new Action([], new Name(0), new Name(0), []);
let obj = new Action();
this.contextFreeActions[i] = obj;

@@ -172,3 +172,3 @@ dec.unpack(obj);

for (let i=0; i<length; i++) {
let obj = new Action([], new Name(0), new Name(0), []);
let obj = new Action();
this.actions[i] = obj;

@@ -175,0 +175,0 @@ dec.unpack(obj);

{
"name": "as-chain",
"version": "0.0.3",
"version": "0.0.4",
"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