@minka/ledger-sdk
Advanced tools
Comparing version 1.1.0 to 2.1.0
{ | ||
"name": "@minka/ledger-sdk", | ||
"version": "1.1.0", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
"description": "SDK for Minka Ledger", | ||
@@ -22,3 +23,2 @@ "main": "main.js", | ||
"author": "Željko Rumenjak", | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
@@ -25,0 +25,0 @@ "@noble/ed25519": "1.7.1", |
export { BridgeResponse, BridgesResponse } from './lib/clients/bridge-client'; | ||
export { LedgerResponse, LedgersResponse } from './lib/clients/ledger-client'; | ||
export { IntentResponse, IntentsResponse } from './lib/clients/intent-client'; | ||
@@ -9,2 +10,1 @@ export { SignerResponse, SignersResponse } from './lib/clients/signer-client'; | ||
export { LedgerSdkError } from './lib/types/ledger-sdk-error'; | ||
export { LedgerRecordTestResult, type LedgerRecordTestStatus, } from './lib/types/test-result'; |
import { LedgerRecord, JwtConfig, LedgerSignature, LedgerMeta } from '@minka/types'; | ||
import { Axios } from 'axios'; | ||
import { Axios, AxiosRequestConfig } from 'axios'; | ||
import { LedgerListParams } from '../types/list-params'; | ||
import { BaseListResponse, ListResponseClass } from '../types/list-response'; | ||
import { BaseRecordResponse, RecordResponseClass } from '../types/record-response'; | ||
export declare type BaseClientOptions = { | ||
apiClient: Axios; | ||
secure?: JwtConfig; | ||
ledger?: string; | ||
}; | ||
export declare abstract class BaseClient { | ||
private apiClient; | ||
private authParams; | ||
private activeLedger; | ||
protected readonly secure: Partial<JwtConfig>; | ||
constructor(apiClient: Axios, secure?: Partial<JwtConfig>); | ||
constructor(options: BaseClientOptions); | ||
private buildRequestHash; | ||
private buildJwt; | ||
protected buildHeaders(token: string): { | ||
'X-Ledger': string; | ||
Authorization: string; | ||
} | { | ||
'X-Ledger'?: undefined; | ||
Authorization: string; | ||
} | { | ||
'X-Ledger': string; | ||
Authorization?: undefined; | ||
} | { | ||
'X-Ledger'?: undefined; | ||
Authorization?: undefined; | ||
}; | ||
protected createRecord<T, R extends BaseRecordResponse<T, M>, M extends LedgerMeta = LedgerMeta>(path: string, ResponseClass: RecordResponseClass<T, R, M>, record: LedgerRecord<T, M>, authParams?: Partial<JwtConfig>): Promise<R>; | ||
@@ -18,3 +37,5 @@ protected updateRecord<T, R extends BaseRecordResponse<T, M>, M extends LedgerMeta = LedgerMeta>(path: string, ResponseClass: RecordResponseClass<T, R, M>, record: LedgerRecord<T, M>, authParams?: Partial<JwtConfig>): Promise<R>; | ||
protected getRecordsList<T, R extends BaseListResponse<T, M>, M extends LedgerMeta = LedgerMeta>(path: string, ResponseClass: ListResponseClass<T, R, M>, params?: LedgerListParams): Promise<R>; | ||
protected createRelativeUrl(url: string, config?: AxiosRequestConfig): string; | ||
setAuthParams(authParams: Partial<JwtConfig>): void; | ||
setActiveLedger(handle: string): void; | ||
} |
import { IntentMeta, IntentRecord, JwtConfig, LedgerHandle, LedgerIntent, LedgerList } from '@minka/types'; | ||
import { AxiosResponse } from 'axios'; | ||
import { SignIntentBuilder } from '../services/sign-intent-builder'; | ||
import { CreateRecordBuilder } from '../services/create-record-builder'; | ||
import { IntentRecordBuilder } from '../services/intent-record-builder'; | ||
import { LedgerListParams } from '../types/list-params'; | ||
@@ -18,3 +18,3 @@ import { BaseListResponse } from '../types/list-response'; | ||
export declare class IntentClient extends BaseClient { | ||
init(record?: Partial<IntentRecord>): CreateRecordBuilder<LedgerIntent, IntentResponse, IntentMeta>; | ||
init(record?: Partial<IntentRecord>): IntentRecordBuilder; | ||
from(record: IntentRecord): SignIntentBuilder; | ||
@@ -21,0 +21,0 @@ read(handle: LedgerHandle, authParams?: Partial<JwtConfig>): Promise<IntentResponse>; |
@@ -1,4 +0,4 @@ | ||
import { JwtConfig, LedgerHandle, LedgerRecord, LedgerPublic } from '@minka/types'; | ||
import { JwtConfig, LedgerHandle, LedgerPublic } from '@minka/types'; | ||
import { EffectClient } from './clients/effect-client'; | ||
import { InstanceClient } from './clients/instance-client'; | ||
import { LedgerClient } from './clients/ledger-client'; | ||
import { IntentClient } from './clients/intent-client'; | ||
@@ -9,7 +9,10 @@ import { SignerClient } from './clients/signer-client'; | ||
import { BridgeClient } from './clients/bridge-client'; | ||
import { ProofVerificationClient } from './services/proof-verification-client'; | ||
export declare type SdkOptions = { | ||
secure?: JwtConfig; | ||
server: string; | ||
expiry?: number; | ||
ledger?: string; | ||
timeout?: number; | ||
signer?: LedgerPublic; | ||
verifyResponseProofs?: boolean; | ||
}; | ||
@@ -21,3 +24,3 @@ export declare type HandleHelper = { | ||
private statusClient; | ||
instance: InstanceClient; | ||
ledger: LedgerClient; | ||
symbol: SymbolClient; | ||
@@ -32,6 +35,7 @@ bridge: BridgeClient; | ||
constructor(options: SdkOptions); | ||
setAuthParams(authParams: Partial<JwtConfig>): Promise<void>; | ||
setAuthParams(authParams: Partial<JwtConfig>): void; | ||
setActiveLedger(handle: string): void; | ||
status(): Promise<import("./clients/status-client").StatusResponse>; | ||
setSigner(signer: LedgerPublic): this; | ||
verify(record: LedgerRecord<any>): Promise<boolean>; | ||
get proofs(): ProofVerificationClient; | ||
} |
import { PartialDeep } from 'type-fest'; | ||
import { JwtConfig, LedgerHash, LedgerMeta, LedgerRecord, LedgerSigningParams } from '@minka/types'; | ||
import { LedgerRecordTestResult } from '../types/test-result'; | ||
export declare class BaseRecordBuilder<T, M extends LedgerMeta = LedgerMeta> { | ||
@@ -17,3 +16,2 @@ protected authParams: JwtConfig; | ||
read(): Promise<LedgerRecord<T, M>>; | ||
test(): Promise<LedgerRecordTestResult[]>; | ||
} |
@@ -15,4 +15,3 @@ import { IntentMeta, IntentRecord, IntentSignatureData, JwtConfig, LedgerHash, LedgerIntent, LedgerSignature, LedgerSigningParams } from '@minka/types'; | ||
send(): Promise<IntentResponse>; | ||
test(): Promise<import("../..").LedgerRecordTestResult[]>; | ||
} | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { JwtConfig, LedgerMeta, LedgerRecord } from '@minka/types'; | ||
import { JwtConfig, LedgerMeta, LedgerRecord, LedgerBaseData } from '@minka/types'; | ||
import { BaseRecordResponse } from '../types/record-response'; | ||
@@ -6,3 +6,3 @@ import { BaseRecordBuilder } from './base-record-builder'; | ||
export declare type UpdateRecordHandler<T, R, M extends LedgerMeta = LedgerMeta> = (record: LedgerRecord<T, M>, authParams: JwtConfig) => Promise<R>; | ||
export declare class UpdateRecordBuilder<T, R extends BaseRecordResponse<T>, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder<T, M> { | ||
export declare class UpdateRecordBuilder<T extends LedgerBaseData, R extends BaseRecordResponse<T>, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder<T, M> { | ||
protected updateRecord: UpdateRecordHandler<T, R, M>; | ||
@@ -9,0 +9,0 @@ constructor(updateRecord: UpdateRecordHandler<T, R, M>); |
@@ -1,9 +0,9 @@ | ||
import { LedgerError, LedgerErrorStatus } from '@minka/types'; | ||
import { LedgerError, LedgerErrorReason } from '@minka/errors'; | ||
export declare class LedgerSdkError extends Error implements LedgerError { | ||
status: LedgerErrorStatus; | ||
reason: string; | ||
detail: Record<string, any>; | ||
reason: LedgerErrorReason; | ||
detail: string; | ||
custom: Record<string, any>; | ||
constructor(causedBy: Error); | ||
toJSON(): this & { | ||
detail: { | ||
custom: { | ||
causedBy: any; | ||
@@ -10,0 +10,0 @@ }; |
import { LedgerHash, LedgerList, LedgerMeta, LedgerPage } from '@minka/types'; | ||
import { AxiosResponse } from 'axios'; | ||
export declare class BaseListResponse<T, M extends LedgerMeta = LedgerMeta> { | ||
import { LedgerResponse } from './ledger-response'; | ||
export declare class BaseListResponse<T, M extends LedgerMeta = LedgerMeta> extends LedgerResponse { | ||
response: AxiosResponse<LedgerList<T, M>>; | ||
@@ -5,0 +6,0 @@ hash: LedgerHash; |
import { LedgerHash, LedgerMeta, LedgerRecord } from '@minka/types'; | ||
import { AxiosResponse } from 'axios'; | ||
export declare class BaseRecordResponse<T, M extends LedgerMeta = LedgerMeta> { | ||
import { LedgerResponse } from './ledger-response'; | ||
export declare class BaseRecordResponse<T, M extends LedgerMeta = LedgerMeta> extends LedgerResponse { | ||
response: AxiosResponse<LedgerRecord<T, M>>; | ||
@@ -5,0 +6,0 @@ hash: LedgerHash; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Explicitly Unlicensed Item
License(Experimental) Something was found which is explicitly marked as unlicensed.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
130395
27
0
0
0
100
397