Skip to content

Commit

Permalink
Release 0.0.387
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Oct 31, 2023
1 parent b75853c commit e0a053f
Show file tree
Hide file tree
Showing 28 changed files with 297 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@syndicateio/syndicate-node",
"version": "0.0.302",
"version": "0.0.387",
"private": false,
"repository": "https://github.com/SyndicateProtocol/syndicate-node",
"main": "./index.js",
Expand All @@ -11,9 +11,9 @@
"prepack": "cp -rv dist/. ."
},
"dependencies": {
"@ungap/url-search-params": "0.2.2",
"url-join": "4.0.1",
"@types/url-join": "4.0.1",
"@ungap/url-search-params": "0.2.2",
"js-base64": "3.7.2",
"axios": "0.27.2"
},
Expand Down
7 changes: 7 additions & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import * as core from "./core";
import { Funding } from "./api/resources/funding/client/Client";
import { Transact } from "./api/resources/transact/client/Client";
import { Wallet } from "./api/resources/wallet/client/Client";

Expand All @@ -19,6 +20,12 @@ export declare namespace SyndicateClient {
export class SyndicateClient {
constructor(protected readonly _options: SyndicateClient.Options) {}

protected _funding: Funding | undefined;

public get funding(): Funding {
return (this._funding ??= new Funding(this._options));
}

protected _transact: Transact | undefined;

public get transact(): Transact {
Expand Down
91 changes: 91 additions & 0 deletions src/api/resources/funding/client/Client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as core from "../../../../core";
import * as Syndicate from "../../..";
import { default as URLSearchParams } from "@ungap/url-search-params";
import * as environments from "../../../../environments";
import urlJoin from "url-join";
import * as serializers from "../../../../serialization";
import * as errors from "../../../../errors";

export declare namespace Funding {
interface Options {
token: core.Supplier<core.BearerToken>;
}

interface RequestOptions {
timeoutInSeconds?: number;
}
}

export class Funding {
constructor(protected readonly _options: Funding.Options) {}

/**
* Get transactions by project
*/
public async getTransactionsByProjects(
projectId: string,
request: Syndicate.funding.GetTransactionsByProjectIdRequest = {},
requestOptions?: Funding.RequestOptions
): Promise<Syndicate.funding.TransactionsByProjectResponse> {
const { page, limit } = request;
const _queryParams = new URLSearchParams();
if (page != null) {
_queryParams.append("page", page.toString());
}

if (limit != null) {
_queryParams.append("limit", limit.toString());
}

const _response = await core.fetcher({
url: urlJoin(environments.SyndicateEnvironment.Production, `/funding/project/${projectId}/transactions`),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
queryParameters: _queryParams,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
});
if (_response.ok) {
return await serializers.funding.TransactionsByProjectResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ["response"],
});
}

if (_response.error.reason === "status-code") {
throw new errors.SyndicateError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
}

switch (_response.error.reason) {
case "non-json":
throw new errors.SyndicateError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.SyndicateTimeoutError();
case "unknown":
throw new errors.SyndicateError({
message: _response.error.errorMessage,
});
}
}

protected async _getAuthorizationHeader() {
return `Bearer ${await core.Supplier.get(this._options.token)}`;
}
}
1 change: 1 addition & 0 deletions src/api/resources/funding/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./requests";
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export interface GetTransactionsByProjectIdRequest {
page?: number;
limit?: number;
}
1 change: 1 addition & 0 deletions src/api/resources/funding/client/requests/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { GetTransactionsByProjectIdRequest } from "./GetTransactionsByProjectIdRequest";
2 changes: 2 additions & 0 deletions src/api/resources/funding/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./types";
export * from "./client";
20 changes: 20 additions & 0 deletions src/api/resources/funding/types/Transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Syndicate from "../../..";

export interface Transaction {
id: string;
createdAt: Date;
updatedAt: Date;
chainId: number;
projectId: string;
fromAddress: string;
toAddress: string;
amount: string;
hash: string;
signedTxn: string;
block: number;
status: Syndicate.funding.TransactionStatus;
}
12 changes: 12 additions & 0 deletions src/api/resources/funding/types/TransactionStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export type TransactionStatus = "PENDING" | "SUBMITTED" | "CONFIRMED" | "FAILED";

export const TransactionStatus = {
Pending: "PENDING",
Submitted: "SUBMITTED",
Confirmed: "CONFIRMED",
Failed: "FAILED",
} as const;
10 changes: 10 additions & 0 deletions src/api/resources/funding/types/TransactionsByProjectResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Syndicate from "../../..";

export interface TransactionsByProjectResponse {
transactions: Syndicate.funding.Transaction[];
total: number;
}
3 changes: 3 additions & 0 deletions src/api/resources/funding/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./TransactionsByProjectResponse";
export * from "./Transaction";
export * from "./TransactionStatus";
1 change: 1 addition & 0 deletions src/api/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * as funding from "./funding";
export * as transact from "./transact";
export * as wallet from "./wallet";
2 changes: 1 addition & 1 deletion src/api/resources/transact/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Transact {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
body: await serializers.transact.SendTransactionRequest.jsonOrThrow(request, {
Expand Down
20 changes: 12 additions & 8 deletions src/api/resources/wallet/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
body: await serializers.wallet.CreateWalletRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -104,7 +104,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
body: await serializers.wallet.RetireWalletRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -167,7 +167,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -217,8 +217,12 @@ export class Wallet {
request: Syndicate.wallet.GetRequestsByProjectIdRequest = {},
requestOptions?: Wallet.RequestOptions
): Promise<Syndicate.wallet.TransactionRequestsByProjectResponse> {
const { page, limit, invalid } = request;
const { search, page, limit, invalid } = request;
const _queryParams = new URLSearchParams();
if (search != null) {
_queryParams.append("search", search);
}

if (page != null) {
_queryParams.append("page", page.toString());
}
Expand All @@ -238,7 +242,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -302,7 +306,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -387,7 +391,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -438,7 +442,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.302",
"X-Fern-SDK-Version": "0.0.387",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*/

export interface GetRequestsByProjectIdRequest {
/**
* Optional search parameter will filter by function signature, contract address, or transaction id
*/
search?: string;
page?: number;
limit?: number;
invalid?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import * as Syndicate from "../../../..";

export interface GetTransactionsByProjectIdRequest {
/**
* Optional search parameter will filter by transaction hash, wallet address, or transaction id
*/
search?: string;
page?: number;
limit?: number;
Expand Down
3 changes: 3 additions & 0 deletions src/api/resources/wallet/types/CreateWalletRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as Syndicate from "../../..";

export interface CreateWalletRequest {
projectId: string;
chainId: number;
type?: Syndicate.wallet.WalletType;
}
11 changes: 11 additions & 0 deletions src/api/resources/wallet/types/WalletType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export type WalletType = "BROADCAST" | "SIGNING" | "CLUSTER_MANAGER";

export const WalletType = {
Broadcast: "BROADCAST",
Signing: "SIGNING",
ClusterManager: "CLUSTER_MANAGER",
} as const;
1 change: 1 addition & 0 deletions src/api/resources/wallet/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from "./Wallet";
export * from "./CreateWalletRequest";
export * from "./WalletType";
export * from "./CreateWalletResponse";
export * from "./CreateWalletErrorBody";
export * from "./WalletWithTxCountAndBalance";
Expand Down
1 change: 1 addition & 0 deletions src/serialization/resources/funding/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./types";
42 changes: 42 additions & 0 deletions src/serialization/resources/funding/types/Transaction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../..";
import * as Syndicate from "../../../../api";
import * as core from "../../../../core";

export const Transaction: core.serialization.ObjectSchema<
serializers.funding.Transaction.Raw,
Syndicate.funding.Transaction
> = core.serialization.object({
id: core.serialization.string(),
createdAt: core.serialization.date(),
updatedAt: core.serialization.date(),
chainId: core.serialization.number(),
projectId: core.serialization.string(),
fromAddress: core.serialization.string(),
toAddress: core.serialization.string(),
amount: core.serialization.string(),
hash: core.serialization.string(),
signedTxn: core.serialization.string(),
block: core.serialization.number(),
status: core.serialization.lazy(async () => (await import("../../..")).funding.TransactionStatus),
});

export declare namespace Transaction {
interface Raw {
id: string;
createdAt: string;
updatedAt: string;
chainId: number;
projectId: string;
fromAddress: string;
toAddress: string;
amount: string;
hash: string;
signedTxn: string;
block: number;
status: serializers.funding.TransactionStatus.Raw;
}
}
16 changes: 16 additions & 0 deletions src/serialization/resources/funding/types/TransactionStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../..";
import * as Syndicate from "../../../../api";
import * as core from "../../../../core";

export const TransactionStatus: core.serialization.Schema<
serializers.funding.TransactionStatus.Raw,
Syndicate.funding.TransactionStatus
> = core.serialization.enum_(["PENDING", "SUBMITTED", "CONFIRMED", "FAILED"]);

export declare namespace TransactionStatus {
type Raw = "PENDING" | "SUBMITTED" | "CONFIRMED" | "FAILED";
}
Loading

0 comments on commit e0a053f

Please sign in to comment.