-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b75853c
commit e0a053f
Showing
28 changed files
with
297 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./requests"; |
8 changes: 8 additions & 0 deletions
8
src/api/resources/funding/client/requests/GetTransactionsByProjectIdRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { GetTransactionsByProjectIdRequest } from "./GetTransactionsByProjectIdRequest"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./types"; | ||
export * from "./client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
src/api/resources/funding/types/TransactionsByProjectResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./TransactionsByProjectResponse"; | ||
export * from "./Transaction"; | ||
export * from "./TransactionStatus"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
src/serialization/resources/funding/types/TransactionStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} |
Oops, something went wrong.