Skip to content

Commit

Permalink
Merge pull request #164 from proximax-storage/next
Browse files Browse the repository at this point in the history
v0.10.5
  • Loading branch information
sleepyOwl14 authored Jan 4, 2024
2 parents 814b8c3 + 7656b07 commit a99c605
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 34 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsjs-xpx-chain-sdk",
"version": "0.10.4",
"version": "0.10.5",
"description": "Proximax Blockchain sdk for typescript and javascript",
"scripts": {
"pretest": "npm run build",
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/HarvesterRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export interface HarvesterRepository {
* @summary Search harvester based on query params
* @param paginationQueryParams search filter
*/
searchHarvesters(offerType: PaginationQueryParams, requestOptions?: RequestOptions): Observable<HarvesterSearch>;
searchHarvesters(paginationQueryParams: PaginationQueryParams, requestOptions?: RequestOptions): Observable<HarvesterSearch>;

}
6 changes: 4 additions & 2 deletions src/infrastructure/LiquidityProviderHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {NetworkHttp} from './NetworkHttp';
import { RequestOptions } from './RequestOptions';
import { LiquidityProviderSearch } from '../model/liquidity/LiquidityProviderSearch';
import { Pagination } from "../model/Pagination"
import { PaginationQueryParams } from './PaginationQueryParams';

/**
* LiquidityProvider http repository.
Expand Down Expand Up @@ -97,10 +98,11 @@ export class LiquidityProviderHttp extends Http implements LiquidityProviderRepo

/**
* Search LiquidityProviders info.
* @param paginationQueryParams
* @returns Observable<LiquidityProviderSearchResponse>
*/
public searchLiquidityProviders(requestOptions?: RequestOptions): Observable<LiquidityProviderSearch> {
return observableFrom(this.liquidityProviderRoutesApi.searchLiquidityProviders(requestOptions))
public searchLiquidityProviders(paginationQueryParams?: PaginationQueryParams, requestOptions?: RequestOptions): Observable<LiquidityProviderSearch> {
return observableFrom(this.liquidityProviderRoutesApi.searchLiquidityProviders(paginationQueryParams, requestOptions))
.pipe(map((response: LiquidityProviderSearchResponse) => {

const liquidityProviders = response.body.data.map((inlineLPInfo)=> new LiquidityProvider(
Expand Down
4 changes: 3 additions & 1 deletion src/infrastructure/LiquidityProviderRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {Observable} from 'rxjs';
import { LiquidityProvider } from '../model/liquidity/LiquidityProvider';
import { LiquidityProviderSearch } from '../model/liquidity/LiquidityProviderSearch';
import { RequestOptions } from './RequestOptions';
import { PaginationQueryParams } from './PaginationQueryParams';

/**
* Liquidity Provider interface repository.
Expand All @@ -33,7 +34,8 @@ export interface LiquidityProviderRepository {

/**
* Get liquidity providers info.
* @param paginationQueryParams search filter
* @returns Observable<LiquidityProviderSearch>
*/
searchLiquidityProviders(requestOptions?: RequestOptions): Observable<LiquidityProviderSearch>;
searchLiquidityProviders(paginationQueryParams: PaginationQueryParams, requestOptions?: RequestOptions): Observable<LiquidityProviderSearch>;
}
13 changes: 10 additions & 3 deletions src/infrastructure/api/liquidityProviderRoutesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LiquidityProviderSearchDTO } from '../model/liquidityProvider/liquidity

import { ObjectSerializer} from '../model/models';
import { RequestOptions } from '../RequestOptions';
import { HttpError, RequestFile, TransactionSearchResponse } from './apis';
import { PaginationQueryParams } from '../PaginationQueryParams';

export interface LiquidityProviderResponse{
response: AxiosResponse;
Expand Down Expand Up @@ -115,17 +115,24 @@ export class LiquidityProviderRoutesApi {
* Return the liquidity providers information.
* @summary Get liquidity providers information
*/
public async searchLiquidityProviders (reqOptions?:RequestOptions) : Promise<LiquidityProviderSearchResponse> {
public async searchLiquidityProviders (paginationQueryParams?: PaginationQueryParams, reqOptions?:RequestOptions) : Promise<LiquidityProviderSearchResponse> {
const localVarPath = '/liquidity_providers';

let localVarQueryParameters: any = {};

if(paginationQueryParams){
localVarQueryParameters = paginationQueryParams.buildQueryParams();
}

let requestHeaders = this.combineHeaders(reqOptions);

let localVarRequestOptions: AxiosRequestConfig = {
method: 'GET',
headers: requestHeaders,
url: localVarPath,
baseURL: this.basePath,
responseType: 'json'
responseType: 'json',
params: localVarQueryParameters
};

return new Promise<LiquidityProviderSearchResponse>((resolve, reject) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ driveKeyArray():Uint8Array|null {
return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}

downloadDataCdi(index: number):number|null {
dataModificationId(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
}

downloadDataCdiLength():number {
dataModificationIdLength():number {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}

downloadDataCdiArray():Uint8Array|null {
dataModificationIdArray():Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}
Expand Down Expand Up @@ -231,19 +231,19 @@ static startDriveKeyVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}

static addDownloadDataCdi(builder:flatbuffers.Builder, downloadDataCdiOffset:flatbuffers.Offset) {
builder.addFieldOffset(8, downloadDataCdiOffset, 0);
static addDataModificationId(builder:flatbuffers.Builder, dataModificationIdOffset:flatbuffers.Offset) {
builder.addFieldOffset(8, dataModificationIdOffset, 0);
}

static createDownloadDataCdiVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
static createDataModificationIdVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
builder.startVector(1, data.length, 1);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt8(data[i]!);
}
return builder.endVector();
}

static startDownloadDataCdiVector(builder:flatbuffers.Builder, numElems:number) {
static startDataModificationIdVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}

Expand All @@ -252,7 +252,7 @@ static endDataModificationCancelTransactionBuffer(builder:flatbuffers.Builder):f
return offset;
}

static createDataModificationCancelTransactionBuffer(builder:flatbuffers.Builder, size:number, signatureOffset:flatbuffers.Offset, signerOffset:flatbuffers.Offset, version:number, type:number, maxFeeOffset:flatbuffers.Offset, deadlineOffset:flatbuffers.Offset, driveKeyOffset:flatbuffers.Offset, downloadDataCdiOffset:flatbuffers.Offset):flatbuffers.Offset {
static createDataModificationCancelTransactionBuffer(builder:flatbuffers.Builder, size:number, signatureOffset:flatbuffers.Offset, signerOffset:flatbuffers.Offset, version:number, type:number, maxFeeOffset:flatbuffers.Offset, deadlineOffset:flatbuffers.Offset, driveKeyOffset:flatbuffers.Offset, dataModificationIdOffset:flatbuffers.Offset):flatbuffers.Offset {
DataModificationCancelTransactionBuffer.startDataModificationCancelTransactionBuffer(builder);
DataModificationCancelTransactionBuffer.addSize(builder, size);
DataModificationCancelTransactionBuffer.addSignature(builder, signatureOffset);
Expand All @@ -262,7 +262,7 @@ static createDataModificationCancelTransactionBuffer(builder:flatbuffers.Builder
DataModificationCancelTransactionBuffer.addMaxFee(builder, maxFeeOffset);
DataModificationCancelTransactionBuffer.addDeadline(builder, deadlineOffset);
DataModificationCancelTransactionBuffer.addDriveKey(builder, driveKeyOffset);
DataModificationCancelTransactionBuffer.addDownloadDataCdi(builder, downloadDataCdiOffset);
DataModificationCancelTransactionBuffer.addDataModificationId(builder, dataModificationIdOffset);
return DataModificationCancelTransactionBuffer.endDataModificationCancelTransactionBuffer(builder);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export class Builder {
type: number;
deadline: number[];
driveKey: string;
downloadDataCdi: string;
uploadSize: number[];
dataModificationId: string;
feedbackFeeAmount: number[];

constructor() {
Expand Down Expand Up @@ -78,8 +77,8 @@ export class Builder {
return this;
}

addDownloadDataCdi(downloadDataCdi: string) {
this.downloadDataCdi = downloadDataCdi;
addDataModificationId(dataModificationId: string) {
this.dataModificationId = dataModificationId;
return this;
}

Expand All @@ -93,7 +92,7 @@ export class Builder {
const deadlineVector = DataModificationCancelTransactionBuffer.createDeadlineVector(builder, this.deadline);
const feeVector = DataModificationCancelTransactionBuffer.createMaxFeeVector(builder, this.fee);
const driveKeyVector = DataModificationCancelTransactionBuffer.createDriveKeyVector(builder, convert.hexToUint8(this.driveKey));
const downloadDataCdiVector = DataModificationCancelTransactionBuffer.createDownloadDataCdiVector(builder, convert.hexToUint8(this.downloadDataCdi));
const dataModificationIdVector = DataModificationCancelTransactionBuffer.createDataModificationIdVector(builder, convert.hexToUint8(this.dataModificationId));

DataModificationCancelTransactionBuffer.startDataModificationCancelTransactionBuffer(builder);
DataModificationCancelTransactionBuffer.addSize(builder, this.size);
Expand All @@ -104,7 +103,7 @@ export class Builder {
DataModificationCancelTransactionBuffer.addMaxFee(builder, feeVector);
DataModificationCancelTransactionBuffer.addDeadline(builder, deadlineVector);
DataModificationCancelTransactionBuffer.addDriveKey(builder, driveKeyVector);
DataModificationCancelTransactionBuffer.addDownloadDataCdi(builder, downloadDataCdiVector);
DataModificationCancelTransactionBuffer.addDataModificationId(builder, dataModificationIdVector);

const codedTransfer = DataModificationCancelTransactionBuffer.endDataModificationCancelTransactionBuffer(builder);
builder.finish(codedTransfer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ const schema = new Schema([
array('fee', TypeSize.INT),
array('deadline', TypeSize.INT),
array('driveKey'),
array('downloadDataCdi')
array('dataModificationId')
]);
export default schema;
2 changes: 1 addition & 1 deletion src/infrastructure/transaction/CreateTransactionFromDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo, isA
isAggregatedInfo.isEmbedded ? new UInt64([0,0]) : new UInt64(transactionDTO.maxFee || [0, 0]),
PublicAccount.createFromPublicKey(transactionDTO.driveKey,
networkType),
transactionDTO.downloadDataCdi,
transactionDTO.dataModificationId,
isAggregatedInfo.isEmbedded ? undefined : transactionDTO.signature,
transactionDTO.signer ? PublicAccount.createFromPublicKey(transactionDTO.signer,
networkType, signerVersion) : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ export class NewDataModificationCancelTransaction extends Transaction {
deadline: Deadline,
maxFee: UInt64,
public readonly driveKey: PublicAccount,
public readonly downloadDataCdi: string,
public readonly dataModificationId: string,
signature?: string,
signer?: PublicAccount,
transactionInfo?: TransactionInfo) {

super(TransactionType.Data_Modification_Cancel,
networkType, version, deadline, maxFee, signature, signer, transactionInfo);

if(!Convert.isHexString(downloadDataCdi) || downloadDataCdi.length !== 64){
if(!Convert.isHexString(dataModificationId) || dataModificationId.length !== 64){
throw new Error("downloadDataCdi should be 32 bytes hexadecimal string")
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ export class NewDataModificationCancelTransaction extends Transaction {
transaction: {
...parent.transaction,
driveKey: this.driveKey.toDTO(),
downloadDataCdi: this.downloadDataCdi
dataModificationId: this.dataModificationId
}
}
}
Expand All @@ -131,22 +131,22 @@ export class NewDataModificationCancelTransaction extends Transaction {
.addMaxFee(this.maxFee.toDTO())
.addVersion(this.versionToDTO())
.addDriveKey(this.driveKey.publicKey)
.addDownloadDataCdi(this.downloadDataCdi)
.addDataModificationId(this.dataModificationId)
.build();
}
}

export class NewDataModificationCancelTransactionBuilder extends TransactionBuilder {
private _driveKey: PublicAccount;
private _downloadDataCdi: string;
private _dataModificationId: string;

public driveKey(driveKey: PublicAccount) {
this._driveKey = driveKey;
return this;
}

public downloadDataCdi(downloadDataCdi: string) {
this._downloadDataCdi = downloadDataCdi;
this._dataModificationId = downloadDataCdi;
return this;
}

Expand All @@ -157,7 +157,7 @@ export class NewDataModificationCancelTransactionBuilder extends TransactionBuil
this._deadline ? this._deadline : this._createNewDeadlineFn(),
this._maxFee ? this._maxFee : calculateFee(NewDataModificationCancelTransaction.calculateSize(), this._feeCalculationStrategy),
this._driveKey,
this._downloadDataCdi,
this._dataModificationId,
this._signature,
this._signer,
this._transactionInfo
Expand Down

0 comments on commit a99c605

Please sign in to comment.