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.37 to 0.0.38

2

assembly/index.ts

@@ -80,3 +80,3 @@ export { U128, U256, I128 } from "./bignum";

export { Name, nameToSuffix } from "./name";
export { Name } from "./name";
export { Action, PermissionLevel } from "./action";

@@ -83,0 +83,0 @@ export { Asset, ExtendedAsset, Symbol, ExtendedSymbol, isValid } from "./asset";

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

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

export function S2N(s: string): u64 {
function S2N(s: string): u64 {
let value: u64 = 0;

@@ -45,3 +46,3 @@ check(s.length <= 13, `Invalid name: ${s}`);

export function N2S(value: u64): string {
function N2S(value: u64): string {
// 13 dots

@@ -74,3 +75,3 @@ let str = new Array<u8>(13);

export function nameToSuffix(name: Name): Name {
function nameToSuffix(name: Name): Name {
let remainingBitsAfterLastActualDot: u32 = 0

@@ -107,2 +108,34 @@ let tmp: u32 = 0

function nameToPrefix(name: Name): Name {
const value = name.N
let result: u64 = value;
let not_dot_character_seen: boolean = false;
let mask: u64 = 0xF;
// Get characters one-by-one in name in order from right to left
for(let offset: i32 = 0; offset <= 59; ) {
const c = (value >> offset) & mask;
if( !c ) { // if this character is a dot
if(not_dot_character_seen) { // we found the rightmost dot character
result = (value >> offset) << offset;
break;
}
} else {
not_dot_character_seen = true;
}
if (offset == 0) {
offset += 4;
mask = <u64>(0x1F);
} else {
offset += 5;
}
}
return new Name(result);
}
export class Name implements Packer {

@@ -131,2 +164,6 @@ N: u64;

prefix(): Name {
return nameToPrefix(this)
}
pack(): u8[] {

@@ -133,0 +170,0 @@ let ret = new Array<u8>(8);

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