Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 24, 2024
1 parent 7aba32d commit c81cbbf
Show file tree
Hide file tree
Showing 25 changed files with 188 additions and 78 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calebguy/testing",
"version": "0.0.466",
"version": "0.1.0",
"private": false,
"repository": "https://github.com/SyndicateProtocol/syndicate-node",
"main": "./index.js",
Expand Down
14 changes: 7 additions & 7 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

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

export declare namespace SyndicateClient {
Expand All @@ -21,18 +21,18 @@ 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 {
return (this._transact ??= new Transact(this._options));
}

protected _funding: Funding | undefined;

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

protected _wallet: Wallet | undefined;

public get wallet(): Wallet {
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/funding/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Funding {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down
1 change: 1 addition & 0 deletions src/api/resources/funding/types/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface Transaction {
signedTxn: string;
block: number;
status: Syndicate.funding.TransactionStatus;
blockCreatedAt?: Date;
}
3 changes: 2 additions & 1 deletion src/api/resources/funding/types/TransactionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
* This file was auto-generated by Fern from our API Definition.
*/

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

export const TransactionStatus = {
Pending: "PENDING",
Processed: "PROCESSED",
Submitted: "SUBMITTED",
Confirmed: "CONFIRMED",
Failed: "FAILED",
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * as funding from "./funding";
export * as transact from "./transact";
export * as funding from "./funding";
export * as wallet from "./wallet";
17 changes: 16 additions & 1 deletion src/api/resources/transact/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ export class Transact {
* @throws {@link Syndicate.transact.BadRequestError}
* @throws {@link Syndicate.transact.InternalError}
* @throws {@link Syndicate.transact.InvalidRequestIdError}
*
* @example
* await syndicate.transact.sendTransaction({
* requestId: "083be671-9f3f-41c0-9377-8c33aab3b413",
* projectId: "638d1d78-d63d-4cda-9f1e-4d0799acfeee",
* contractAddress: "0x94f6E9c420Db1566A3c035Df291F206eBfAfC762",
* chainId: 80001,
* functionSignature: "addPerson((string name, uint16 age) person))",
* args: {
* "person": {
* "name": "Person",
* "age": 55
* }
* }
* })
*/
public async sendTransaction(
request: Syndicate.transact.SendTransactionRequest,
Expand All @@ -41,7 +56,7 @@ export class Transact {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
body: await serializers.transact.SendTransactionRequest.jsonOrThrow(request, {
Expand Down
18 changes: 16 additions & 2 deletions src/api/resources/transact/types/SendTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
* This file was auto-generated by Fern from our API Definition.
*/

/**
* @example
* {
* requestId: "083be671-9f3f-41c0-9377-8c33aab3b413",
* projectId: "638d1d78-d63d-4cda-9f1e-4d0799acfeee",
* contractAddress: "0x94f6E9c420Db1566A3c035Df291F206eBfAfC762",
* chainId: 80001,
* functionSignature: "addPerson((string name, uint16 age) person))",
* args: {
* "person": {
* "name": "Person",
* "age": 55
* }
* }
* }
*/
export interface SendTransactionRequest {
/** (Optional) ID of the request. Needs to be a valid UUID. If provided, it will be saved and returned as the transactionId of the response. If not provided, we will generate one for you and return it as the transactionId. */
requestId?: string;
Expand All @@ -15,6 +31,4 @@ export interface SendTransactionRequest {
functionSignature: string;
/** (Optional) The function arguments for the transaction if any. The keys are the argument names or index from the provided function signature and the values are the argument values. */
args?: Record<string, unknown>;
organizationId: string;
organizationTier: string;
}
6 changes: 6 additions & 0 deletions src/api/resources/transact/types/SendTransactionResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
* This file was auto-generated by Fern from our API Definition.
*/

/**
* @example
* {
* transactionId: "561b77ed-6e35-4248-87ef-c6af93f3bad9"
* }
*/
export interface SendTransactionResponse {
transactionId: string;
}
26 changes: 18 additions & 8 deletions src/api/resources/wallet/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class Wallet {
/**
* Creates a new wallet and assigns it to a project
* @throws {@link Syndicate.wallet.CreateWalletError}
* @throws {@link Syndicate.wallet.InvalidChainError}
*/
public async createWallet(
request: Syndicate.wallet.CreateWalletRequest,
Expand All @@ -38,7 +39,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
body: await serializers.wallet.CreateWalletRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -67,6 +68,15 @@ export class Wallet {
breadcrumbsPrefix: ["response"],
})
);
case 400:
throw new Syndicate.wallet.InvalidChainError(
await serializers.wallet.ErrorBody.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ["response"],
})
);
default:
throw new errors.SyndicateError({
statusCode: _response.error.statusCode,
Expand Down Expand Up @@ -105,7 +115,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
body: await serializers.wallet.RetireWalletRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -165,7 +175,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
body: await serializers.wallet.ToggleIsActiveRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -229,7 +239,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -305,7 +315,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -370,7 +380,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -454,7 +464,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -506,7 +516,7 @@ export class Wallet {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@calebguy/testing",
"X-Fern-SDK-Version": "0.0.466",
"X-Fern-SDK-Version": "0.1.0",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
17 changes: 17 additions & 0 deletions src/api/resources/wallet/errors/InvalidChainError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

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

export class InvalidChainError extends errors.SyndicateError {
constructor(body: Syndicate.wallet.ErrorBody) {
super({
message: "InvalidChainError",
statusCode: 400,
body: body,
});
Object.setPrototypeOf(this, InvalidChainError.prototype);
}
}
1 change: 1 addition & 0 deletions src/api/resources/wallet/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./CreateWalletError";
export * from "./InvalidChainError";
export * from "./RetireWalletError";
export * from "./WalletNotFoundError";
export * from "./TransactionNotFoundError";
Expand Down
7 changes: 7 additions & 0 deletions src/api/resources/wallet/types/ErrorBody.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export interface ErrorBody {
message: string;
}
1 change: 1 addition & 0 deletions src/api/resources/wallet/types/TransactionAttempt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface TransactionAttempt {
chainId: number;
status: Syndicate.wallet.TransactionStatus;
block: number;
blockCreatedAt?: Date;
signedTxn: string;
walletAddress: string;
reverted: boolean;
Expand Down
3 changes: 1 addition & 2 deletions src/api/resources/wallet/types/WalletType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
* This file was auto-generated by Fern from our API Definition.
*/

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

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
Expand Up @@ -13,3 +13,4 @@ export * from "./TransactionsByProjectResponse";
export * from "./TransactionRequestsByProjectResponse";
export * from "./TransactionStatus";
export * from "./ProjectTransactionStatsResponse";
export * from "./ErrorBody";
2 changes: 2 additions & 0 deletions src/serialization/resources/funding/types/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const Transaction: core.serialization.ObjectSchema<
signedTxn: core.serialization.string(),
block: core.serialization.number(),
status: core.serialization.lazy(async () => (await import("../../..")).funding.TransactionStatus),
blockCreatedAt: core.serialization.date().optional(),
});

export declare namespace Transaction {
Expand All @@ -38,5 +39,6 @@ export declare namespace Transaction {
signedTxn: string;
block: number;
status: serializers.funding.TransactionStatus.Raw;
blockCreatedAt?: string | null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ 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"]);
> = core.serialization.enum_(["PENDING", "PROCESSED", "SUBMITTED", "CONFIRMED", "FAILED"]);

export declare namespace TransactionStatus {
type Raw = "PENDING" | "SUBMITTED" | "CONFIRMED" | "FAILED";
type Raw = "PENDING" | "PROCESSED" | "SUBMITTED" | "CONFIRMED" | "FAILED";
}
2 changes: 1 addition & 1 deletion src/serialization/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * as funding from "./funding";
export * as transact from "./transact";
export * as funding from "./funding";
export * as wallet from "./wallet";
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const SendTransactionRequest: core.serialization.ObjectSchema<
chainId: core.serialization.number(),
functionSignature: core.serialization.string(),
args: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
organizationId: core.serialization.string(),
organizationTier: core.serialization.string(),
});

export declare namespace SendTransactionRequest {
Expand All @@ -28,7 +26,5 @@ export declare namespace SendTransactionRequest {
chainId: number;
functionSignature: string;
args?: Record<string, unknown> | null;
organizationId: string;
organizationTier: string;
}
}
18 changes: 18 additions & 0 deletions src/serialization/resources/wallet/types/ErrorBody.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* 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 ErrorBody: core.serialization.ObjectSchema<serializers.wallet.ErrorBody.Raw, Syndicate.wallet.ErrorBody> =
core.serialization.object({
message: core.serialization.string(),
});

export declare namespace ErrorBody {
interface Raw {
message: string;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const TransactionAttempt: core.serialization.ObjectSchema<
chainId: core.serialization.number(),
status: core.serialization.lazy(async () => (await import("../../..")).wallet.TransactionStatus),
block: core.serialization.number(),
blockCreatedAt: core.serialization.date().optional(),
signedTxn: core.serialization.string(),
walletAddress: core.serialization.string(),
reverted: core.serialization.boolean(),
Expand All @@ -30,6 +31,7 @@ export declare namespace TransactionAttempt {
chainId: number;
status: serializers.wallet.TransactionStatus.Raw;
block: number;
blockCreatedAt?: string | null;
signedTxn: string;
walletAddress: string;
reverted: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/serialization/resources/wallet/types/WalletType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as Syndicate from "../../../../api";
import * as core from "../../../../core";

export const WalletType: core.serialization.Schema<serializers.wallet.WalletType.Raw, Syndicate.wallet.WalletType> =
core.serialization.enum_(["BROADCAST", "SIGNING", "CLUSTER_MANAGER"]);
core.serialization.enum_(["BROADCAST", "SIGNING"]);

export declare namespace WalletType {
type Raw = "BROADCAST" | "SIGNING" | "CLUSTER_MANAGER";
type Raw = "BROADCAST" | "SIGNING";
}
Loading

0 comments on commit c81cbbf

Please sign in to comment.