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

@entropyxyz/sdk

Package Overview
Dependencies
Maintainers
7
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entropyxyz/sdk

JS SDK for entropy blockchain

  • 0.1.4
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-77.78%
Maintainers
7
Weekly downloads
 
Created
Source

SDK

@entropyxyz/sdk is a collection of TS packages that allow you to interact with the Entropy network. This is currently in alpha release.

EN-Backgrounds-2023-7-5_11-35-31

Installation

yarn:

yarn add @entropyxyz/sdk

npm:

npm i @entropyxyz/sdk --save

Usage

NOTICE endpoint defaults to 'ws://127.0.0.1:9944' if no value is provided. Remarks

The main interface for users wanting to interact with Entropy. This class provides methods to register, check registration status, and sign transactions. Users can await the ready promise to ensure that the class has been initialized before performing operations.

Example

const signer = await getWallet(charlieStashSeed);

const entropyAccount: EntropyAccount = {
  sigRequestKey: signer,
  programModKey: signer,
};

const entropy = new Entropy({ account: entropyAccount });
await entropy.ready;

await entropy.register({
  programModAccount: '5Gw3s7q9...',
  keyVisibility: 'Permissioned',
  freeTx: false
});

Table of contents

Constructors

  • constructor

Properties

Methods

Constructors

constructor

new default(opts): default

Initializes an instance of the Entropy class.

Parameters
NameTypeDescription
optsEntropyOptsThe configuration options for the Entropy instance.
Returns

default

Defined in

index.ts:83

Properties

account

Optional account: EntropyAccount

Defined in

index.ts:70


isRegistered

isRegistered: (address: Address) => Promise<boolean>

Type declaration

▸ (address): Promise<boolean>

Parameters
NameType
addressAddress
Returns

Promise<boolean>

Defined in

index.ts:67


programs

programs: default

Defined in

index.ts:68


ready

ready: Promise<boolean>

A promise that resolves once chacha20poly1305 cryptoLib has been loaded

Defined in

index.ts:65


registrationManager

registrationManager: default

Defined in

index.ts:66


signingManager

signingManager: default

Defined in

index.ts:69


substrate

substrate: ApiPromise

Defined in

index.ts:71

Methods

getVerifyingKey

getVerifyingKey(address): Promise<string>

Retrieves the verifying key associated with the given address's registration record.

Parameters
NameTypeDescription
addressAddressThe address for which the verifying key is needed.
Returns

Promise<string>

  • A promise resolving to the verifying key.
Defined in

index.ts:215


register

register(params): Promise<void>

Registers an address with Entropy using the provided parameters.

Parameters
NameTypeDescription
paramsRegistrationParams & { account?: EntropyAccount }The registration parameters.
Returns

Promise<void>

A promise indicating the completion of the registration process.

Throws

  • If the provided address format is incompatible.

Throws

  • If the address is already registered or if there's a problem during registration.
Defined in

index.ts:186


sign

sign(params): Promise<Uint8Array>

Signs a signature request hash. This method involves various steps including validator selection, transaction request formatting, and submission of these requests to validators for signing. It returns the signature from the first validator after validation.

Parameters
NameTypeDescription
paramsSigOpsThe signature operation parameters.
Returns

Promise<Uint8Array>

  • A promise resolving to the signed hash as a Uint8Array.

Throws

  • If there's an error in the signing routine.
Defined in

index.ts:259


signTransaction

signTransaction(params): Promise<unknown>

Signs a given transaction based on the provided parameters.

The signTransaction method invokes the appropriate adapter (chain based configuration) based on the type specified in the params. This modular approach ensures that various transaction types can be supported. The method performs a series of operations, starting with the preSign function of the selected adapter, followed by the actual signing of the transaction request hash, and if necessary, the postSign function of the adapter.

Parameters
NameTypeDescription
paramsSigTxOpsThe parameters for signing the transaction.
Returns

Promise<unknown>

  • A promise resolving to the transaction signature.

A promise that returns the transaction signature. Note that the structure and format of this signature may differ based on the adapter.

Throws

  • If no adapter is found for the specified transaction type.

Throws

Will throw an error if the transaction type does not have a corresponding adapter.

Defined in

index.ts:240

FAQs

Package last updated on 09 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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