New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@phala/pink-env

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phala/pink-env - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

86

dist/index.d.ts
/** Bytes represented in Uint8Array or hex string */
declare type Bytes = Uint8Array | string;
declare type Headers = {
type Bytes = Uint8Array | string;
type Headers = {
[key: string]: string;

@@ -11,20 +11,14 @@ };

*/
export declare type TypeRegistry = {
export type TypeRegistry = {
[_opaqueBrand]: "TypeRegistry";
};
/**
* Represents a SCALE encoder.
* @typedef ScaleEncoder
* Represents a SCALE coder.
* @typedef Codec
*/
export declare type ScaleEncoder = {
[_opaqueBrand]: "ScaleEncoder";
export type Codec = {
encode: (value: any) => Uint8Array;
decode: (value: Uint8Array) => any;
};
/**
* Represents a SCALE decoder.
* @typedef ScaleDecoder
*/
export declare type ScaleDecoder = {
[_opaqueBrand]: "ScaleDecoder";
};
/**
* Represents a SCALE codec for encoding and decoding data.

@@ -50,49 +44,9 @@ * @interface ScaleCodec

/**
* Creates a SCALE encoder for encoding tuple values.
* @function createTupleEncoder
* @param {number[]} typeIds - An array of type IDs.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be encoded.
* @returns {ScaleEncoder} - A ScaleEncoder for encoding tuple values.
*/
createTupleEncoder(typeIds: number[], typeRegistry: TypeRegistry): ScaleEncoder;
/**
* Creates a SCALE encoder for a specific type ID.
* Creates a SCALE codec object for a specific type ID.
* @function createEncoderForTypeId
* @param {number} typeId - The type ID for which to create the encoder.
* @param {number|number[]} typeId - The type ID for which to create the encoder.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be encoded.
* @returns {ScaleEncoder} - A ScaleEncoder for encoding values of the specified type ID.
* @returns {Codec} - A ScaleEncoder for encoding values of the specified type ID.
*/
createEncoderForTypeId(typeId: number, typeRegistry: TypeRegistry): ScaleEncoder;
/**
* Creates a SCALE decoder for decoding tuple values.
* @function createTupleDecoder
* @param {number[]} typeIds - An array of type IDs.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be decoded.
* @returns {ScaleDecoder} - A ScaleDecoder for decoding tuple values.
*/
createTupleDecoder(typeIds: number[], typeRegistry: TypeRegistry): ScaleDecoder;
/**
* Creates a SCALE decoder for a specific type ID.
* @function createDecoderForTypeId
* @param {number} typeId - The type ID for which to create the decoder.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be decoded.
* @returns {ScaleDecoder} - A ScaleDecoder for decoding values of the specified type ID.
*/
createDecoderForTypeId(typeId: number, typeRegistry: TypeRegistry): ScaleDecoder;
/**
* Encodes a value using the provided SCALE encoder.
* @function encode
* @param {*} value - The value to be encoded.
* @param {ScaleEncoder} encoder - The ScaleEncoder to use for encoding the value.
* @returns {Uint8Array} - The encoded value as a Uint8Array.
*/
encode(value: any, encoder: ScaleEncoder): Uint8Array;
/**
* Decodes a value from a Uint8Array using the provided SCALE decoder.
* @function decode
* @param {Uint8Array} bytes - The bytes to be decoded.
* @param {ScaleDecoder} decoder - The ScaleDecoder to use for decoding the bytes.
* @returns {*} - The decoded value
*/
decode(bytes: Uint8Array, decoder: ScaleDecoder): any;
codec(typeId: number | number[], typeRegistry: TypeRegistry): Codec;
}

@@ -126,2 +80,14 @@ declare global {

/**
* Invokes a delegate call on a contract code by a code hash.
* @param {Bytes} args.codeHash - The code hash of the contract to delegate to.
* @param {number} args.selector - The selector of the ink message to be called.
* @param {Bytes} args.input - The input arguments for the delegate call, encoded in scale.
* @return {Uint8Array} - The result of the delegate call.
*/
invokeContractDelegate(args: {
codeHash: Bytes;
selector: number;
input: Bytes;
}): Uint8Array;
/**
* This function sends an HTTP request and returns the response as either a Uint8Array or a string.

@@ -157,4 +123,8 @@ * @param {string} args.url - The URL to send the request to.

SCALE: ScaleCodec;
/**
* The version of the pink qjs engine.
*/
version: string;
};
}
export {};
{
"name": "@phala/pink-env",
"version": "1.0.6",
"version": "1.0.7",
"description": "The js environment accessing of Phala's Phat contract.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -17,18 +17,11 @@ /** Bytes represented in Uint8Array or hex string */

/**
* Represents a SCALE encoder.
* @typedef ScaleEncoder
* Represents a SCALE coder.
* @typedef Codec
*/
export type ScaleEncoder = {
[_opaqueBrand]: "ScaleEncoder";
export type Codec = {
encode: (value: any) => Uint8Array;
decode: (value: Uint8Array) => any;
};
/**
* Represents a SCALE decoder.
* @typedef ScaleDecoder
*/
export type ScaleDecoder = {
[_opaqueBrand]: "ScaleDecoder";
};
/**
* Represents a SCALE codec for encoding and decoding data.

@@ -55,66 +48,9 @@ * @interface ScaleCodec

/**
* Creates a SCALE encoder for encoding tuple values.
* @function createTupleEncoder
* @param {number[]} typeIds - An array of type IDs.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be encoded.
* @returns {ScaleEncoder} - A ScaleEncoder for encoding tuple values.
*/
createTupleEncoder(
typeIds: number[],
typeRegistry: TypeRegistry
): ScaleEncoder;
/**
* Creates a SCALE encoder for a specific type ID.
* Creates a SCALE codec object for a specific type ID.
* @function createEncoderForTypeId
* @param {number} typeId - The type ID for which to create the encoder.
* @param {number|number[]} typeId - The type ID for which to create the encoder.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be encoded.
* @returns {ScaleEncoder} - A ScaleEncoder for encoding values of the specified type ID.
* @returns {Codec} - A ScaleEncoder for encoding values of the specified type ID.
*/
createEncoderForTypeId(
typeId: number,
typeRegistry: TypeRegistry
): ScaleEncoder;
/**
* Creates a SCALE decoder for decoding tuple values.
* @function createTupleDecoder
* @param {number[]} typeIds - An array of type IDs.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be decoded.
* @returns {ScaleDecoder} - A ScaleDecoder for decoding tuple values.
*/
createTupleDecoder(
typeIds: number[],
typeRegistry: TypeRegistry
): ScaleDecoder;
/**
* Creates a SCALE decoder for a specific type ID.
* @function createDecoderForTypeId
* @param {number} typeId - The type ID for which to create the decoder.
* @param {TypeRegistry} typeRegistry - A TypeRegistry containing the types to be decoded.
* @returns {ScaleDecoder} - A ScaleDecoder for decoding values of the specified type ID.
*/
createDecoderForTypeId(
typeId: number,
typeRegistry: TypeRegistry
): ScaleDecoder;
/**
* Encodes a value using the provided SCALE encoder.
* @function encode
* @param {*} value - The value to be encoded.
* @param {ScaleEncoder} encoder - The ScaleEncoder to use for encoding the value.
* @returns {Uint8Array} - The encoded value as a Uint8Array.
*/
encode(value: any, encoder: ScaleEncoder): Uint8Array;
/**
* Decodes a value from a Uint8Array using the provided SCALE decoder.
* @function decode
* @param {Uint8Array} bytes - The bytes to be decoded.
* @param {ScaleDecoder} decoder - The ScaleDecoder to use for decoding the bytes.
* @returns {*} - The decoded value
*/
decode(bytes: Uint8Array, decoder: ScaleDecoder): any;
codec(typeId: number | number[], typeRegistry: TypeRegistry): Codec;
}

@@ -149,2 +85,14 @@

/**
* Invokes a delegate call on a contract code by a code hash.
* @param {Bytes} args.codeHash - The code hash of the contract to delegate to.
* @param {number} args.selector - The selector of the ink message to be called.
* @param {Bytes} args.input - The input arguments for the delegate call, encoded in scale.
* @return {Uint8Array} - The result of the delegate call.
*/
invokeContractDelegate(args: {
codeHash: Bytes;
selector: number;
input: Bytes;
}): Uint8Array;
/**
* This function sends an HTTP request and returns the response as either a Uint8Array or a string.

@@ -181,4 +129,9 @@ * @param {string} args.url - The URL to send the request to.

SCALE: ScaleCodec;
/**
* The version of the pink qjs engine.
*/
version: string;
};
}
export {};
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