Skip to content

Commit

Permalink
Release 0.0.441
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 5, 2023
1 parent 6684640 commit 9b09869
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 23 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.428",
"version": "0.0.441",
"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
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 { Transact } from "./api/resources/transact/client/Client";
import { Funding } from "./api/resources/funding/client/Client";
import { Transact } from "./api/resources/transact/client/Client";
import { Wallet } from "./api/resources/wallet/client/Client";

export declare namespace SyndicateClient {
Expand All @@ -20,18 +20,18 @@ export declare namespace SyndicateClient {
export class SyndicateClient {
constructor(protected readonly _options: SyndicateClient.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 _transact: Transact | undefined;

public get transact(): Transact {
return (this._transact ??= new Transact(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": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
queryParameters: _queryParams,
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 transact from "./transact";
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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
body: await serializers.transact.SendTransactionRequest.jsonOrThrow(request, {
Expand Down
73 changes: 66 additions & 7 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.428",
"X-Fern-SDK-Version": "0.0.441",
},
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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
body: await serializers.wallet.RetireWalletRequest.jsonOrThrow(request, {
Expand Down Expand Up @@ -148,6 +148,65 @@ export class Wallet {
}
}

/**
* Toggle a wallet's isActive status
* @throws {@link Syndicate.wallet.WalletNotFoundError}
*/
public async toggleIsActive(
request: Syndicate.wallet.ToggleIsActiveRequest,
requestOptions?: Wallet.RequestOptions
): Promise<Syndicate.wallet.Wallet> {
const _response = await core.fetcher({
url: urlJoin(environments.SyndicateEnvironment.Production, "/wallet/toggleIsActive"),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
body: await serializers.wallet.ToggleIsActiveRequest.jsonOrThrow(request, {
unrecognizedObjectKeys: "strip",
}),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
});
if (_response.ok) {
return await serializers.wallet.Wallet.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ["response"],
});
}

if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 404:
throw new Syndicate.wallet.WalletNotFoundError();
default:
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,
});
}
}

/**
* Get a transaction request by id
* @throws {@link Syndicate.wallet.TransactionNotFoundError}
Expand All @@ -167,7 +226,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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down Expand Up @@ -242,7 +301,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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -306,7 +365,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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -391,7 +450,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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -442,7 +501,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.428",
"X-Fern-SDK-Version": "0.0.441",
},
contentType: "application/json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Expand Down
14 changes: 14 additions & 0 deletions src/api/resources/wallet/errors/WalletNotFoundError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

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

export class WalletNotFoundError extends errors.SyndicateError {
constructor() {
super({
statusCode: 404,
});
Object.setPrototypeOf(this, WalletNotFoundError.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 "./RetireWalletError";
export * from "./WalletNotFoundError";
export * from "./TransactionNotFoundError";
export * from "./GetWalletsError";
8 changes: 8 additions & 0 deletions src/api/resources/wallet/types/ToggleIsActiveRequest.ts
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 ToggleIsActiveRequest {
projectId: string;
walletAddress: string;
}
3 changes: 2 additions & 1 deletion src/api/resources/wallet/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";
export type TransactionStatus = "PENDING" | "PROCESSED" | "SUBMITTED" | "CONFIRMED";

export const TransactionStatus = {
Pending: "PENDING",
Processed: "PROCESSED",
Submitted: "SUBMITTED",
Confirmed: "CONFIRMED",
} 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 @@ -4,6 +4,7 @@ export * from "./WalletType";
export * from "./CreateWalletResponse";
export * from "./CreateWalletErrorBody";
export * from "./WalletWithTxCountAndBalance";
export * from "./ToggleIsActiveRequest";
export * from "./RetireWalletRequest";
export * from "./RetireWalletResponse";
export * from "./TransactionResponse";
Expand Down
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 transact from "./transact";
export * as funding from "./funding";
export * as transact from "./transact";
export * as wallet from "./wallet";
22 changes: 22 additions & 0 deletions src/serialization/resources/wallet/types/ToggleIsActiveRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* 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 ToggleIsActiveRequest: core.serialization.ObjectSchema<
serializers.wallet.ToggleIsActiveRequest.Raw,
Syndicate.wallet.ToggleIsActiveRequest
> = core.serialization.object({
projectId: core.serialization.string(),
walletAddress: core.serialization.string(),
});

export declare namespace ToggleIsActiveRequest {
interface Raw {
projectId: string;
walletAddress: string;
}
}
4 changes: 2 additions & 2 deletions src/serialization/resources/wallet/types/TransactionStatus.ts
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.wallet.TransactionStatus.Raw,
Syndicate.wallet.TransactionStatus
> = core.serialization.enum_(["PENDING", "SUBMITTED", "CONFIRMED"]);
> = core.serialization.enum_(["PENDING", "PROCESSED", "SUBMITTED", "CONFIRMED"]);

export declare namespace TransactionStatus {
type Raw = "PENDING" | "SUBMITTED" | "CONFIRMED";
type Raw = "PENDING" | "PROCESSED" | "SUBMITTED" | "CONFIRMED";
}
1 change: 1 addition & 0 deletions src/serialization/resources/wallet/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./WalletType";
export * from "./CreateWalletResponse";
export * from "./CreateWalletErrorBody";
export * from "./WalletWithTxCountAndBalance";
export * from "./ToggleIsActiveRequest";
export * from "./RetireWalletRequest";
export * from "./RetireWalletResponse";
export * from "./TransactionResponse";
Expand Down

0 comments on commit 9b09869

Please sign in to comment.