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.71 to 0.0.72

54

assembly/action.ts
import * as env from "./env";
import { Encoder, Decoder, Packer } from "./serializer";
import { Name } from "./name";
import { calcPackedVarUint32Length } from "./varint";
import { calcPackedVarUint32Length, VarUint32 } from "./varint";
import { Checksum256 } from "./crypto";
export function getSender(): Name {

@@ -144,1 +144,51 @@ return new Name(env.get_sender());

}
export class GetCodeHashResult implements Packer {
constructor(
public structVersion: VarUint32 = new VarUint32(0),
public codeSequence: u64 = 0,
public codeHash: Checksum256 = new Checksum256(),
public vmType: u8 = 0,
public vmVersion: u8 = 0
) {}
pack(): u8[] {
let enc = new Encoder(this.getSize());
enc.pack(this.structVersion);
enc.packNumber<u64>(this.codeSequence);
enc.pack(this.codeHash);
enc.packNumber<u8>(this.vmType);
enc.packNumber<u8>(this.vmVersion);
return enc.getBytes();
}
unpack(data: u8[]): usize {
let dec = new Decoder(data);
this.structVersion = new VarUint32();
dec.unpack(this.structVersion);
this.codeSequence = dec.unpackNumber<u64>();
this.codeHash = new Checksum256();
dec.unpack(this.codeHash);
this.vmType = dec.unpackNumber<u8>();
this.vmVersion = dec.unpackNumber<u8>();
return dec.getPos();
}
getSize(): usize {
let size: usize = 0;
size += this.structVersion.getSize();
size += sizeof<u64>();
size += this.codeHash.getSize();
size += sizeof<u8>();
size += sizeof<u8>();
return size;
}
}
export function getCodeHash(account: Name): GetCodeHashResult {
const result = new GetCodeHashResult();
const rawResult = new Array<u8>(result.getSize());
env.get_code_hash(account.N, 0, rawResult.dataStart);
result.unpack(rawResult);
return result;
}

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

export declare function current_time(): u64;
export declare function get_block_num(): u32;
export declare function is_feature_activated(feature_digest_ptr: usize): boolean;

@@ -33,2 +35,3 @@ export declare function read_action_data(ptr: usize, len: u32): usize

export declare function current_receiver(): u64
export declare function get_code_hash(account: u64, struct_version: u32, packed_result_ptr: usize): usize

@@ -35,0 +38,0 @@ // void eosio_assert_message( uint32_t test, const char* msg, uint32_t msg_len );

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

check,
currentBlockNum,
currentTimePoint,

@@ -24,2 +25,3 @@ currentTime,

currentTimeSec,
isFeatureActivated
} from "./system";

@@ -79,3 +81,5 @@

publicationTime,
currentReceiver
currentReceiver,
getCodeHash,
GetCodeHashResult
} from "./action";

@@ -82,0 +86,0 @@

@@ -0,1 +1,2 @@

import { Checksum256 } from "./crypto";
import * as env from "./env";

@@ -17,2 +18,6 @@ import { TimePoint } from "./time";

export function currentBlockNum(): u32 {
return env.get_block_num();
}
export function currentTimePoint(): TimePoint {

@@ -33,1 +38,5 @@ return new TimePoint(env.current_time());

}
export function isFeatureActivated(feature: Checksum256): boolean {
return env.is_feature_activated(feature.data.dataStart)
}

2

package.json
{
"name": "as-chain",
"version": "0.0.71",
"version": "0.0.72",
"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