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.2 to 0.0.3

4

assembly/action.ts

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

export function unpackActionData<T>(): T {
export function unpackActionData<T extends Packer>(): T {
let data = readActionData()

@@ -61,3 +61,3 @@ let ret = instantiate<T>()

constructor(
public actor: Name,
public actor: Name = new Name(0),
public permission: Name = Name.fromString("active")) {

@@ -64,0 +64,0 @@ }

@@ -80,3 +80,3 @@ import { check } from "./system";

getSymbolString(): string {
let buf = new Array<u8>(7);
let buf = new Uint8Array(7);
let n: i32 = 0;

@@ -256,3 +256,3 @@ let value = this.value;

let _b = new U128(<u64>b.amount);
let _c = _a * _b;
let _c = U128.mul(_a, _b);

@@ -259,0 +259,0 @@ let max_amount = new U128(MAX_AMOUNT);

import { check } from "./system";
import { Decoder, Encoder, Packer } from "./serializer";
import { Utils } from "./utils";
import { print } from "./debug"

@@ -41,6 +40,10 @@ import * as env from "./env";

export class Checksum256 implements Packer {
data!: u8[];
constructor(
public data: u8[] | null = null
){
}
pack(): u8[] {
return this.data;
return this.data!;
}

@@ -59,3 +62,3 @@

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

@@ -65,3 +68,3 @@

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

@@ -71,3 +74,3 @@

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

@@ -74,0 +77,0 @@ }

@@ -10,8 +10,8 @@ export declare function memcpy (destination: usize, source: usize, num: usize): usize;

export declare function printi128(i128_ptr: usize): void;
export declare function printui128(i128_ptr: usize): void;
export declare function printsf(value: f32): void;
export declare function printdf(value: f64): void;
export declare function printqf(f128_ptr: usize): void;
export declare function printn(name: u64): void;
export declare function printi128(i128_ptr: usize): void;
export declare function printui128(i128_ptr: usize): void;
export declare function printsf(value: f32): void;
export declare function printdf(value: f64): void;
export declare function printqf(f128_ptr: usize): void;
export declare function printn(name: u64): void;

@@ -18,0 +18,0 @@ // system

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

let secondary_ptr = value.value.dataStart;
printString(`+++++++++lo, hi: ${value.value[0]}, ${value.value[1]}\n`);
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);
let lo = load<u64>(secondary_ptr);
let hi = load<u64>(secondary_ptr + 8);
printString(`+++++++++lo, hi: ${lo}, ${hi}\n`);
// let lo = load<u64>(secondary_ptr);
// let hi = load<u64>(secondary_ptr + 8);
// printString(`+++++++++lo, hi: ${lo}, ${hi}\n`);

@@ -43,4 +42,4 @@ return new SecondaryIterator(it, id, this.dbIndex);

let arr = new Array<u64>(2);
store<u64>(arr.dataStart, value.lo);
store<u64>(arr.dataStart + 8, value.hi);
store<u64>(arr.dataStart, secondary.lo);
store<u64>(arr.dataStart + 8, secondary.hi);
env.db_idx128_update(iterator.i, payer, arr.dataStart);

@@ -47,0 +46,0 @@ }

@@ -35,3 +35,3 @@ import { U128, U256 } from "./bignum";

export function newSecondaryValue_double(value: T): SecondaryValue {
export function newSecondaryValue_double<T extends number>(value: T): SecondaryValue {
let arr = new Array<u64>(sizeof<T>()/8);

@@ -38,0 +38,0 @@ arr[0] = value;

import { Decoder, Packer } from "./serializer";
import { check } from "./system"
const charToSymbol = (c: u16): u16 => {

@@ -20,2 +20,3 @@ if (c >= 97 && c <= 122) {// c >= 'a' && c <= 'z'

let value: u64 = 0;
check(s.length <= 13, `Invalid name: ${s}`);
for (let i=0; i<=12; i++) {

@@ -26,2 +27,3 @@ let c: u64 = 0;

if (c==0xffff) {
check(false, `invalid name ${s}`);
return 0;

@@ -83,2 +85,6 @@ }

@inline static fromU64(n: u64): Name {
return new Name(n);
}
toString(): string {

@@ -113,2 +119,22 @@ return N2S(this.N);

}
@inline @operator('<')
static lt(a: Name, b: Name): bool {
return a.N < b.N;
}
@inline @operator('>')
static gt(a: Name, b: Name): bool {
return a.N > b.N;
}
@inline @operator('<=')
static lte(a: Name, b: Name): bool {
return a.N <= b.N;
}
@inline @operator('>=')
static gte(a: Name, b: Name): bool {
return a.N >= b.N;
}
}

@@ -21,2 +21,11 @@ import { MultiIndex, MultiIndexValue } from "./mi";

getOrNull(): T | null {
let it = this.mi.find(this.key);
if (it.isOk()) {
return this.mi.get(it);
}
return null;
// return instantiate<T>();
}
get(): T {

@@ -23,0 +32,0 @@ let it = this.mi.find(this.key);

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