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

oasis-std

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oasis-std - npm Package Compare versions

Comparing version 0.1.0-rc.3 to 0.1.0-rc.4

lib/src/gateway.d.ts

5

lib/src/abi.js

@@ -10,3 +10,3 @@ "use strict";

function abiEncode(schema, obj, encoder) {
encoder = (encoder !== null && encoder !== void 0 ? encoder : new Encoder());
encoder = encoder !== null && encoder !== void 0 ? encoder : new Encoder();
doAbiEncode(schema, obj, encoder);

@@ -206,2 +206,3 @@ return encoder.finish();

function doAbiDecode(schema, bytes) {
var _a;
const decoder = bytes instanceof Decoder ? bytes : new Decoder(bytes);

@@ -302,3 +303,3 @@ if (typeof schema === 'string') {

}
else if (typeof schema === 'function') {
else if (typeof ((_a = schema) === null || _a === void 0 ? void 0 : _a.abiDecode) === 'function') {
return schema.abiDecode(decoder);

@@ -305,0 +306,0 @@ }

3

lib/src/index.d.ts
export { abiEncode, abiDecode, Schema, AbiEncodable, AbiDecodable, Encoder, Decoder, } from './abi';
export { Address, Balance } from './types';
export * from './gateway';
export { Address, Balance, ExecutionError } from './types';
export { encodeHex, decodeHex } from './utils';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });

@@ -8,5 +11,7 @@ var abi_1 = require("./abi");

exports.Decoder = abi_1.Decoder;
__export(require("./gateway"));
var types_1 = require("./types");
exports.Address = types_1.Address;
exports.Balance = types_1.Balance;
exports.ExecutionError = types_1.ExecutionError;
var utils_1 = require("./utils");

@@ -13,0 +18,0 @@ exports.encodeHex = utils_1.encodeHex;

@@ -38,2 +38,6 @@ import { AbiEncodable, Encoder, Decoder } from './abi';

}
export declare class ExecutionError {
output: Uint8Array;
constructor(output: Uint8Array);
}
export {};

@@ -116,2 +116,8 @@ "use strict";

Balance.LENGTH = 16; // 128 bits
class ExecutionError {
constructor(output) {
this.output = output;
}
}
exports.ExecutionError = ExecutionError;
//# sourceMappingURL=types.js.map
{
"name": "oasis-std",
"version": "0.1.0-rc.3",
"version": "0.1.0-rc.4",
"description": "Oasis platform standard library",

@@ -14,5 +14,11 @@ "license": "Apache-2.0",

"dependencies": {
"buffer": "^5.4.3"
"@oasislabs/common": "^1.0.0-rc.15",
"@oasislabs/confidential": "^1.0.0-rc.16",
"@oasislabs/gateway": "^1.0.0-rc.27",
"@oasislabs/service": "^1.0.0-rc.23",
"buffer": "^5.4.3",
"eventemitter3": "^4.0.0",
"js-sha3": "^0.8.0"
},
"gitHead": "943299d78a2a0ae3f2dabea1025fe19d1d606cc4"
"gitHead": "01716c4b10578cfa4db39ee6d80df60abe0ca60a"
}

@@ -315,3 +315,3 @@ import { Buffer } from 'buffer';

return (schema as Schema[]).map(s => doAbiDecode(s, decoder));
} else if (typeof schema === 'function') {
} else if (typeof (schema as any)?.abiDecode === 'function') {
return (schema as AbiDecodable).abiDecode(decoder);

@@ -318,0 +318,0 @@ } else {

@@ -10,3 +10,4 @@ export {

} from './abi';
export { Address, Balance } from './types';
export * from './gateway';
export { Address, Balance, ExecutionError } from './types';
export { encodeHex, decodeHex } from './utils';

@@ -140,1 +140,5 @@ import { decodeHex, encodeHex } from './utils';

}
export class ExecutionError {
public constructor(public output: Uint8Array) {}
}
import { abiEncode, abiDecode, Schema, Encoder } from '../src/abi';
import { typedArrayToBuffer, TypedArray } from '../src/utils';
import { typedArrayToBuffer } from '../src/utils';
import { randFill, randNumber, typedArrayLetter } from './utils';
describe('abiEncode', () => {

@@ -430,37 +432,1 @@ it('void', () => {

});
function randNumber(bits: number, ty: 'i' | 'u' | 'f'): number | bigint {
const signed = ty !== 'u';
const sign = signed ? Number(Math.random() > 0.5) : 1;
if (bits === 64 && ty !== 'f') {
let maxValue = BigInt(18446744073709551616); // 2^64
if (signed) {
maxValue = maxValue / BigInt(2) - BigInt(1);
}
return (
(maxValue /
BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))) *
BigInt(sign)
);
} else if (ty === 'f') {
const largeValue = Math.pow(2, bits / 2);
return Math.floor(largeValue * Math.random() * sign);
} else {
const maxValue = Math.pow(2, bits - Number(signed));
return Math.floor(maxValue * Math.random() * sign);
}
}
function randFill(typedArray: TypedArray) {
for (let i = 0; i < typedArray.length; i++) {
typedArray[i] = randNumber(
typedArray.BYTES_PER_ELEMENT * 8,
typedArrayLetter(typedArray),
);
}
}
function typedArrayLetter(typedArray: TypedArray): 'u' | 'i' | 'f' {
const name = typedArray.constructor.name;
return name.startsWith('Float') ? 'f' : /Int/.test(name) ? 'i' : 'u';
}

@@ -27,3 +27,3 @@ import { Buffer } from 'buffer';

it(`decode odd length`, () => {
it('decode odd length', () => {
expect(decodeHex('123456789abcdef')).toEqual(

@@ -30,0 +30,0 @@ new Uint8Array([1, 35, 69, 103, 137, 171, 205, 239]),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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