Skip to content

Commit 9b09869

Browse files
committed
Release 0.0.441
1 parent 6684640 commit 9b09869

15 files changed

Lines changed: 130 additions & 23 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@syndicateio/syndicate-node",
3-
"version": "0.0.428",
3+
"version": "0.0.441",
44
"private": false,
55
"repository": "https://github.com/SyndicateProtocol/syndicate-node",
66
"main": "./index.js",
@@ -11,9 +11,9 @@
1111
"prepack": "cp -rv dist/. ."
1212
},
1313
"dependencies": {
14+
"@ungap/url-search-params": "0.2.2",
1415
"url-join": "4.0.1",
1516
"@types/url-join": "4.0.1",
16-
"@ungap/url-search-params": "0.2.2",
1717
"js-base64": "3.7.2",
1818
"axios": "0.27.2"
1919
},

src/Client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*/
44

55
import * as core from "./core";
6-
import { Transact } from "./api/resources/transact/client/Client";
76
import { Funding } from "./api/resources/funding/client/Client";
7+
import { Transact } from "./api/resources/transact/client/Client";
88
import { Wallet } from "./api/resources/wallet/client/Client";
99

1010
export declare namespace SyndicateClient {
@@ -20,18 +20,18 @@ export declare namespace SyndicateClient {
2020
export class SyndicateClient {
2121
constructor(protected readonly _options: SyndicateClient.Options) {}
2222

23-
protected _transact: Transact | undefined;
24-
25-
public get transact(): Transact {
26-
return (this._transact ??= new Transact(this._options));
27-
}
28-
2923
protected _funding: Funding | undefined;
3024

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

29+
protected _transact: Transact | undefined;
30+
31+
public get transact(): Transact {
32+
return (this._transact ??= new Transact(this._options));
33+
}
34+
3535
protected _wallet: Wallet | undefined;
3636

3737
public get wallet(): Wallet {

src/api/resources/funding/client/Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Funding {
4848
Authorization: await this._getAuthorizationHeader(),
4949
"X-Fern-Language": "JavaScript",
5050
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
51-
"X-Fern-SDK-Version": "0.0.428",
51+
"X-Fern-SDK-Version": "0.0.441",
5252
},
5353
contentType: "application/json",
5454
queryParameters: _queryParams,

src/api/resources/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * as transact from "./transact";
21
export * as funding from "./funding";
2+
export * as transact from "./transact";
33
export * as wallet from "./wallet";

src/api/resources/transact/client/Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Transact {
4040
Authorization: await this._getAuthorizationHeader(),
4141
"X-Fern-Language": "JavaScript",
4242
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
43-
"X-Fern-SDK-Version": "0.0.428",
43+
"X-Fern-SDK-Version": "0.0.441",
4444
},
4545
contentType: "application/json",
4646
body: await serializers.transact.SendTransactionRequest.jsonOrThrow(request, {

src/api/resources/wallet/client/Client.ts

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class Wallet {
3838
Authorization: await this._getAuthorizationHeader(),
3939
"X-Fern-Language": "JavaScript",
4040
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
41-
"X-Fern-SDK-Version": "0.0.428",
41+
"X-Fern-SDK-Version": "0.0.441",
4242
},
4343
contentType: "application/json",
4444
body: await serializers.wallet.CreateWalletRequest.jsonOrThrow(request, {
@@ -104,7 +104,7 @@ export class Wallet {
104104
Authorization: await this._getAuthorizationHeader(),
105105
"X-Fern-Language": "JavaScript",
106106
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
107-
"X-Fern-SDK-Version": "0.0.428",
107+
"X-Fern-SDK-Version": "0.0.441",
108108
},
109109
contentType: "application/json",
110110
body: await serializers.wallet.RetireWalletRequest.jsonOrThrow(request, {
@@ -148,6 +148,65 @@ export class Wallet {
148148
}
149149
}
150150

151+
/**
152+
* Toggle a wallet's isActive status
153+
* @throws {@link Syndicate.wallet.WalletNotFoundError}
154+
*/
155+
public async toggleIsActive(
156+
request: Syndicate.wallet.ToggleIsActiveRequest,
157+
requestOptions?: Wallet.RequestOptions
158+
): Promise<Syndicate.wallet.Wallet> {
159+
const _response = await core.fetcher({
160+
url: urlJoin(environments.SyndicateEnvironment.Production, "/wallet/toggleIsActive"),
161+
method: "POST",
162+
headers: {
163+
Authorization: await this._getAuthorizationHeader(),
164+
"X-Fern-Language": "JavaScript",
165+
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
166+
"X-Fern-SDK-Version": "0.0.441",
167+
},
168+
contentType: "application/json",
169+
body: await serializers.wallet.ToggleIsActiveRequest.jsonOrThrow(request, {
170+
unrecognizedObjectKeys: "strip",
171+
}),
172+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
173+
});
174+
if (_response.ok) {
175+
return await serializers.wallet.Wallet.parseOrThrow(_response.body, {
176+
unrecognizedObjectKeys: "passthrough",
177+
allowUnrecognizedUnionMembers: true,
178+
allowUnrecognizedEnumValues: true,
179+
breadcrumbsPrefix: ["response"],
180+
});
181+
}
182+
183+
if (_response.error.reason === "status-code") {
184+
switch (_response.error.statusCode) {
185+
case 404:
186+
throw new Syndicate.wallet.WalletNotFoundError();
187+
default:
188+
throw new errors.SyndicateError({
189+
statusCode: _response.error.statusCode,
190+
body: _response.error.body,
191+
});
192+
}
193+
}
194+
195+
switch (_response.error.reason) {
196+
case "non-json":
197+
throw new errors.SyndicateError({
198+
statusCode: _response.error.statusCode,
199+
body: _response.error.rawBody,
200+
});
201+
case "timeout":
202+
throw new errors.SyndicateTimeoutError();
203+
case "unknown":
204+
throw new errors.SyndicateError({
205+
message: _response.error.errorMessage,
206+
});
207+
}
208+
}
209+
151210
/**
152211
* Get a transaction request by id
153212
* @throws {@link Syndicate.wallet.TransactionNotFoundError}
@@ -167,7 +226,7 @@ export class Wallet {
167226
Authorization: await this._getAuthorizationHeader(),
168227
"X-Fern-Language": "JavaScript",
169228
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
170-
"X-Fern-SDK-Version": "0.0.428",
229+
"X-Fern-SDK-Version": "0.0.441",
171230
},
172231
contentType: "application/json",
173232
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -242,7 +301,7 @@ export class Wallet {
242301
Authorization: await this._getAuthorizationHeader(),
243302
"X-Fern-Language": "JavaScript",
244303
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
245-
"X-Fern-SDK-Version": "0.0.428",
304+
"X-Fern-SDK-Version": "0.0.441",
246305
},
247306
contentType: "application/json",
248307
queryParameters: _queryParams,
@@ -306,7 +365,7 @@ export class Wallet {
306365
Authorization: await this._getAuthorizationHeader(),
307366
"X-Fern-Language": "JavaScript",
308367
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
309-
"X-Fern-SDK-Version": "0.0.428",
368+
"X-Fern-SDK-Version": "0.0.441",
310369
},
311370
contentType: "application/json",
312371
queryParameters: _queryParams,
@@ -391,7 +450,7 @@ export class Wallet {
391450
Authorization: await this._getAuthorizationHeader(),
392451
"X-Fern-Language": "JavaScript",
393452
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
394-
"X-Fern-SDK-Version": "0.0.428",
453+
"X-Fern-SDK-Version": "0.0.441",
395454
},
396455
contentType: "application/json",
397456
queryParameters: _queryParams,
@@ -442,7 +501,7 @@ export class Wallet {
442501
Authorization: await this._getAuthorizationHeader(),
443502
"X-Fern-Language": "JavaScript",
444503
"X-Fern-SDK-Name": "@syndicateio/syndicate-node",
445-
"X-Fern-SDK-Version": "0.0.428",
504+
"X-Fern-SDK-Version": "0.0.441",
446505
},
447506
contentType: "application/json",
448507
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as errors from "../../../../errors";
6+
7+
export class WalletNotFoundError extends errors.SyndicateError {
8+
constructor() {
9+
super({
10+
statusCode: 404,
11+
});
12+
Object.setPrototypeOf(this, WalletNotFoundError.prototype);
13+
}
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from "./CreateWalletError";
22
export * from "./RetireWalletError";
3+
export * from "./WalletNotFoundError";
34
export * from "./TransactionNotFoundError";
45
export * from "./GetWalletsError";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
export interface ToggleIsActiveRequest {
6+
projectId: string;
7+
walletAddress: string;
8+
}

src/api/resources/wallet/types/TransactionStatus.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* This file was auto-generated by Fern from our API Definition.
33
*/
44

5-
export type TransactionStatus = "PENDING" | "SUBMITTED" | "CONFIRMED";
5+
export type TransactionStatus = "PENDING" | "PROCESSED" | "SUBMITTED" | "CONFIRMED";
66

77
export const TransactionStatus = {
88
Pending: "PENDING",
9+
Processed: "PROCESSED",
910
Submitted: "SUBMITTED",
1011
Confirmed: "CONFIRMED",
1112
} as const;

0 commit comments

Comments
 (0)