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

@minka/ledger-sdk

Package Overview
Dependencies
Maintainers
5
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@minka/ledger-sdk - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0-rc.1

crypto/DOCS.md

14

package.json
{
"name": "@minka/ledger-sdk",
"version": "2.1.0",
"license": "MIT",
"version": "2.2.0-rc.1",
"description": "SDK for Minka Ledger",
"main": "main.js",
"main": "src/index.js",
"types": "src/index.d.ts",

@@ -17,3 +16,3 @@ "scripts": {

"typedoc": {
"entryPoint": "src/lib/sdk.ts",
"entryPoint": "src/index.ts",
"displayName": "Ledger SDK",

@@ -24,2 +23,3 @@ "tsconfig": "tsconfig.lib.json",

"author": "Željko Rumenjak",
"license": "MIT",
"dependencies": {

@@ -34,3 +34,9 @@ "@noble/ed25519": "1.7.1",

"type-fest": "3.0.0"
},
"peerDependencies": {
"@minka/crypto": "1.0.0",
"@minka/errors": "1.0.0",
"@minka/format": "1.0.0",
"@minka/types": "1.0.0"
}
}

@@ -17,7 +17,7 @@ # Minka Ledger SDK

First, you need an instance of the `LedgerSDK` class, you can pass an options object with the `required` property `baseUrl` pointing to the ledger you want to use.
First, you need an instance of the `LedgerSDK` class, you can pass an options object with the `required` property `server` pointing to the ledger you want to use.
```javascript
const ledger = new LedgerSDK({
baseUrl: 'https://minka.inc..',
const ledger = new LedgerSdk({
server: 'https://minka.inc..',
})

@@ -34,4 +34,6 @@ ```

Each entity of the ledger has its client, and those clients are properties of the `LedgerSDK` instance, for example, the client for `signers` will be returned in `ledger.signers` if you used the example below to connect to the ledger.
Each entity of the ledger has its client, and those clients are properties of the `LedgerSDK` instance, for example, the client for `signer` will be returned in `sdk.signer` if you used the example below to connect to the ledger.
Available clients: `ledger`, `symbol`, `wallet`, `intent`, `signer`, `effect` and `bridge`.
##### Common client methods

@@ -46,3 +48,3 @@

```javascript
const output = await ledger.signers.list()
const output = await sdk.signer.list()
// output: MultipleRecordsResponse

@@ -56,3 +58,3 @@ ```

```javascript
const output = await ledger.signers.read('handle')
const output = await sdk.signer.read('handle')
// output: SingleRecordResponse

@@ -66,4 +68,4 @@ ```

```javascript
// Initialize a record builder for the signers entity
const emptySignerRecord = await ledger.signers.init()
// Initialize a record builder for the signer entity
const emptySignerRecord = await sdk.signer.init()
/**

@@ -83,3 +85,3 @@ * Send that record to the backend. Note this record will

*/
await ledger.signers.init({ record: {} }).hash().sign([keyPair]).send()
await sdk.signer.init({}).hash().sign([{ keyPair }]).send()
```

@@ -10,1 +10,4 @@ export { BridgeResponse, BridgesResponse } from './lib/clients/bridge-client';

export { LedgerSdkError } from './lib/types/ledger-sdk-error';
export * as crypto from "../crypto/src";
export * as errors from "../errors/src";
export * as types from "../types/src";

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

import { LedgerRecord, JwtConfig, LedgerSignature, LedgerMeta } from '@minka/types';
import { LedgerRecord, JwtConfig, LedgerSignature, LedgerMeta } from "../../../types/src";
import { Axios, AxiosRequestConfig } from 'axios';

@@ -6,3 +6,3 @@ import { LedgerListParams } from '../types/list-params';

import { BaseRecordResponse, RecordResponseClass } from '../types/record-response';
export declare type BaseClientOptions = {
export type BaseClientOptions = {
apiClient: Axios;

@@ -9,0 +9,0 @@ secure?: JwtConfig;

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

import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerBridge } from '@minka/types';
import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerBridge } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -18,6 +18,6 @@ import { CreateRecordBuilder } from '../services/create-record-builder';

export declare class BridgeClient extends BaseClient {
init(record?: Partial<LedgerRecord<LedgerBridge>>): CreateRecordBuilder<LedgerBridge, BridgeResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<LedgerBridge>): UpdateRecordBuilder<LedgerBridge, BridgeResponse, import("@minka/types").LedgerMeta>;
init(record?: Partial<LedgerRecord<LedgerBridge>>): CreateRecordBuilder<LedgerBridge, BridgeResponse, import("../../../types/src").LedgerMeta>;
from(record: LedgerRecord<LedgerBridge>): UpdateRecordBuilder<LedgerBridge, BridgeResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<BridgeResponse>;
list(params?: LedgerListParams): Promise<BridgesResponse>;
}

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

import { JwtConfig, LedgerEffect, LedgerHandle, LedgerList, LedgerRecord } from '@minka/types';
import { JwtConfig, LedgerEffect, LedgerHandle, LedgerList, LedgerRecord } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -18,6 +18,6 @@ import { CreateRecordBuilder } from '../services/create-record-builder';

export declare class EffectClient extends BaseClient {
init(record?: Partial<LedgerRecord<LedgerEffect>>): CreateRecordBuilder<LedgerEffect, EffectResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<LedgerEffect>): UpdateRecordBuilder<LedgerEffect, EffectResponse, import("@minka/types").LedgerMeta>;
init(record?: Partial<LedgerRecord<LedgerEffect>>): CreateRecordBuilder<LedgerEffect, EffectResponse, import("../../../types/src").LedgerMeta>;
from(record: LedgerRecord<LedgerEffect>): UpdateRecordBuilder<LedgerEffect, EffectResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<EffectResponse>;
list(params?: LedgerListParams): Promise<EffectsResponse>;
}

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

import { IntentMeta, IntentRecord, JwtConfig, LedgerHandle, LedgerIntent, LedgerList } from '@minka/types';
import { IntentMeta, IntentRecord, JwtConfig, LedgerHandle, LedgerIntent, LedgerList } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -3,0 +3,0 @@ import { SignIntentBuilder } from '../services/sign-intent-builder';

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

import { JwtConfig, Ledger, LedgerHandle, LedgerList, LedgerRecord } from '@minka/types';
import { JwtConfig, Ledger, LedgerHandle, LedgerList, LedgerRecord } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -18,6 +18,6 @@ import { CreateRecordBuilder } from '../services/create-record-builder';

export declare class LedgerClient extends BaseClient {
init(record?: Partial<LedgerRecord<Ledger>>): CreateRecordBuilder<Ledger, LedgerResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<Ledger>): UpdateRecordBuilder<Ledger, LedgerResponse, import("@minka/types").LedgerMeta>;
init(record?: Partial<LedgerRecord<Ledger>>): CreateRecordBuilder<Ledger, LedgerResponse, import("../../../types/src").LedgerMeta>;
from(record: LedgerRecord<Ledger>): UpdateRecordBuilder<Ledger, LedgerResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<LedgerResponse>;
list(params?: LedgerListParams): Promise<LedgersResponse>;
}

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

import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerSigner } from '@minka/types';
import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerSigner } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -19,5 +19,5 @@ import { SignerRecordBuilder } from '../services/signer-record-builder';

init(record?: Partial<LedgerRecord<LedgerSigner>>): SignerRecordBuilder;
from(record: LedgerRecord<LedgerSigner>): UpdateRecordBuilder<LedgerSigner, SignerResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<LedgerSigner>): UpdateRecordBuilder<LedgerSigner, SignerResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<SignerResponse>;
list(params?: LedgerListParams): Promise<SignersResponse>;
}

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

import { LedgerRecord, LedgerStatus } from '@minka/types';
import { LedgerRecord, LedgerStatus } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -3,0 +3,0 @@ import { BaseRecordResponse } from '../types/record-response';

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

import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerSymbol } from '@minka/types';
import { JwtConfig, LedgerHandle, LedgerList, LedgerRecord, LedgerSymbol } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -18,6 +18,6 @@ import { CreateRecordBuilder } from '../services/create-record-builder';

export declare class SymbolClient extends BaseClient {
init(record?: Partial<LedgerRecord<LedgerSymbol>>): CreateRecordBuilder<LedgerSymbol, SymbolResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<LedgerSymbol>): UpdateRecordBuilder<LedgerSymbol, SymbolResponse, import("@minka/types").LedgerMeta>;
init(record?: Partial<LedgerRecord<LedgerSymbol>>): CreateRecordBuilder<LedgerSymbol, SymbolResponse, import("../../../types/src").LedgerMeta>;
from(record: LedgerRecord<LedgerSymbol>): UpdateRecordBuilder<LedgerSymbol, SymbolResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<SymbolResponse>;
list(params?: LedgerListParams): Promise<SymbolsResponse>;
}

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

import { JwtConfig, LedgerAddress, LedgerBalance, LedgerList, LedgerRecord, LedgerWallet } from '@minka/types';
import { JwtConfig, LedgerAddress, LedgerBalance, LedgerList, LedgerRecord, LedgerWallet } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -22,4 +22,4 @@ import { CreateRecordBuilder } from '../services/create-record-builder';

export declare class WalletClient extends BaseClient {
init(record?: Partial<LedgerRecord<LedgerWallet>>): CreateRecordBuilder<LedgerWallet, WalletResponse, import("@minka/types").LedgerMeta>;
from(record: LedgerRecord<LedgerWallet>): UpdateRecordBuilder<LedgerWallet, WalletResponse, import("@minka/types").LedgerMeta>;
init(record?: Partial<LedgerRecord<LedgerWallet>>): CreateRecordBuilder<LedgerWallet, WalletResponse, import("../../../types/src").LedgerMeta>;
from(record: LedgerRecord<LedgerWallet>): UpdateRecordBuilder<LedgerWallet, WalletResponse, import("../../../types/src").LedgerMeta>;
read(handle: LedgerAddress, authParams?: Partial<JwtConfig>): Promise<WalletResponse>;

@@ -26,0 +26,0 @@ list(params?: LedgerListParams): Promise<WalletsResponse>;

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

import { JwtConfig, LedgerHandle, LedgerPublic } from '@minka/types';
import { JwtConfig, LedgerHandle, LedgerPublic } from "../../types/src";
import { EffectClient } from './clients/effect-client';

@@ -10,3 +10,3 @@ import { LedgerClient } from './clients/ledger-client';

import { ProofVerificationClient } from './services/proof-verification-client';
export declare type SdkOptions = {
export type SdkOptions = {
secure?: JwtConfig;

@@ -19,3 +19,3 @@ server: string;

};
export declare type HandleHelper = {
export type HandleHelper = {
unique: (size?: number) => LedgerHandle;

@@ -22,0 +22,0 @@ };

import { PartialDeep } from 'type-fest';
import { JwtConfig, LedgerHash, LedgerMeta, LedgerRecord, LedgerSigningParams } from '@minka/types';
import { JwtConfig, LedgerHash, LedgerMeta, LedgerRecord, LedgerSigningParams } from "../../../types/src";
export declare class BaseRecordBuilder<T, M extends LedgerMeta = LedgerMeta> {

@@ -4,0 +4,0 @@ protected authParams: JwtConfig;

@@ -1,5 +0,5 @@

import { JwtConfig, LedgerMeta, LedgerRecord } from '@minka/types';
import { JwtConfig, LedgerMeta, LedgerRecord } from "../../../types/src";
import { BaseRecordResponse } from '../types/record-response';
import { BaseRecordBuilder } from './base-record-builder';
export declare type CreateRecordHandler<T, R, M extends LedgerMeta = LedgerMeta> = (record: LedgerRecord<T, M>, authParams: JwtConfig) => Promise<R>;
export type CreateRecordHandler<T, R, M extends LedgerMeta = LedgerMeta> = (record: LedgerRecord<T, M>, authParams: JwtConfig) => Promise<R>;
export declare class CreateRecordBuilder<T, R extends BaseRecordResponse<T, M>, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder<T, M> {

@@ -6,0 +6,0 @@ protected createRecord: CreateRecordHandler<T, R, M>;

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

import { IntentMeta, LedgerIntent, LedgerSigningParams } from '@minka/types';
import { IntentMeta, LedgerIntent, LedgerSigningParams } from "../../../types/src";
import { IntentResponse } from '../clients/intent-client';

@@ -3,0 +3,0 @@ import { CreateRecordBuilder } from './create-record-builder';

@@ -1,4 +0,4 @@

import { LedgerPublic, LedgerRecord, LedgerSignature } from '@minka/types';
import { LedgerPublic, LedgerRecord, LedgerSignature } from "../../../types/src";
import { LedgerSdkError } from '../types/ledger-sdk-error';
declare type ComparableSignature = Partial<LedgerSignature>;
type ComparableSignature = Partial<LedgerSignature>;
export declare class ProofVerificationClient {

@@ -5,0 +5,0 @@ private ledgerSigner;

@@ -1,4 +0,4 @@

import { IntentMeta, IntentRecord, IntentSignatureData, JwtConfig, LedgerHash, LedgerIntent, LedgerSignature, LedgerSigningParams } from '@minka/types';
import { IntentMeta, IntentRecord, IntentSignatureData, JwtConfig, LedgerHash, LedgerIntent, LedgerSignature, LedgerSigningParams } from "../../../types/src";
import { IntentResponse } from '../clients/intent-client';
declare type SendSignatureFunction = (signature: LedgerSignature<IntentSignatureData>, authParams: JwtConfig) => Promise<IntentResponse>;
type SendSignatureFunction = (signature: LedgerSignature<IntentSignatureData>, authParams: JwtConfig) => Promise<IntentResponse>;
export declare class SignIntentBuilder {

@@ -11,3 +11,3 @@ private recordBuilder;

auth(params: Partial<JwtConfig>): this;
read(): Promise<import("@minka/types").LedgerRecord<LedgerIntent, IntentMeta>>;
read(): Promise<import("../../../types/src").LedgerRecord<LedgerIntent, IntentMeta>>;
hash(hash?: LedgerHash): this;

@@ -14,0 +14,0 @@ sign(params: LedgerSigningParams[]): this;

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

import { LedgerKeyPair, LedgerSigner } from '@minka/types';
import { LedgerKeyPair, LedgerSigner } from "../../../types/src";
import { SignerResponse } from '../clients/signer-client';

@@ -11,4 +11,4 @@ import { SignerRecordReadOptions } from '../types/record-builder';

lock(): this;
read(readOptions?: SignerRecordReadOptions): Promise<import("@minka/types").LedgerRecord<LedgerSigner, import("@minka/types").LedgerMeta>>;
read(readOptions?: SignerRecordReadOptions): Promise<import("../../../types/src").LedgerRecord<LedgerSigner, import("../../../types/src").LedgerMeta>>;
keys(keyPair: Partial<LedgerKeyPair>): this;
}

@@ -1,6 +0,6 @@

import { JwtConfig, LedgerMeta, LedgerRecord, LedgerBaseData } from '@minka/types';
import { JwtConfig, LedgerMeta, LedgerRecord, LedgerBaseData } from "../../../types/src";
import { BaseRecordResponse } from '../types/record-response';
import { BaseRecordBuilder } from './base-record-builder';
import { PartialDeep } from 'type-fest';
export declare type UpdateRecordHandler<T, R, M extends LedgerMeta = LedgerMeta> = (record: LedgerRecord<T, M>, authParams: JwtConfig) => Promise<R>;
export type UpdateRecordHandler<T, R, M extends LedgerMeta = LedgerMeta> = (record: LedgerRecord<T, M>, authParams: JwtConfig) => Promise<R>;
export declare class UpdateRecordBuilder<T extends LedgerBaseData, R extends BaseRecordResponse<T>, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder<T, M> {

@@ -7,0 +7,0 @@ protected updateRecord: UpdateRecordHandler<T, R, M>;

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

import { LedgerError, LedgerErrorReason } from '@minka/errors';
import { LedgerError, LedgerErrorReason } from "../../../errors/src";
export declare class LedgerSdkError extends Error implements LedgerError {

@@ -3,0 +3,0 @@ reason: LedgerErrorReason;

@@ -1,9 +0,9 @@

import { JwtConfig } from '@minka/types';
export declare type LedgerPaginationParams = {
import { JwtConfig } from "../../../types/src";
export type LedgerPaginationParams = {
index: number;
limit: number;
};
export declare type LedgerListParams = {
export type LedgerListParams = {
page?: LedgerPaginationParams;
authParams?: Partial<JwtConfig>;
};

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

import { LedgerHash, LedgerList, LedgerMeta, LedgerPage } from '@minka/types';
import { LedgerHash, LedgerList, LedgerMeta, LedgerPage } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -11,2 +11,2 @@ import { LedgerResponse } from './ledger-response';

}
export declare type ListResponseClass<T, R extends BaseListResponse<T, M>, M extends LedgerMeta = LedgerMeta> = new (response: AxiosResponse<LedgerList<T, M>, void>) => R;
export type ListResponseClass<T, R extends BaseListResponse<T, M>, M extends LedgerMeta = LedgerMeta> = new (response: AxiosResponse<LedgerList<T, M>, void>) => R;

@@ -1,3 +0,3 @@

export declare type SignerRecordReadOptions = {
export type SignerRecordReadOptions = {
plain?: boolean;
};

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

import { LedgerHash, LedgerMeta, LedgerRecord } from '@minka/types';
import { LedgerHash, LedgerMeta, LedgerRecord } from "../../../types/src";
import { AxiosResponse } from 'axios';

@@ -10,2 +10,2 @@ import { LedgerResponse } from './ledger-response';

}
export declare type RecordResponseClass<T, R extends BaseRecordResponse<T, M>, M extends LedgerMeta = LedgerMeta> = new (response: AxiosResponse<LedgerRecord<T, M>, LedgerRecord<T, M>>) => R;
export type RecordResponseClass<T, R extends BaseRecordResponse<T, M>, M extends LedgerMeta = LedgerMeta> = new (response: AxiosResponse<LedgerRecord<T, M>, LedgerRecord<T, M>>) => R;
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