Skip to content

Commit 40c85b5

Browse files
committed
feat: Add Balance Subscriptions feature
1 parent 07d1d7d commit 40c85b5

27 files changed

+1229
-8
lines changed

sdk/src/Engine.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { AccessTokensService } from './services/AccessTokensService';
1010
import { AccountService } from './services/AccountService';
1111
import { AccountFactoryService } from './services/AccountFactoryService';
1212
import { BackendWalletService } from './services/BackendWalletService';
13+
import { BalanceSubscriptionsService } from './services/BalanceSubscriptionsService';
1314
import { ChainService } from './services/ChainService';
1415
import { ConfigurationService } from './services/ConfigurationService';
1516
import { ContractService } from './services/ContractService';
@@ -41,6 +42,7 @@ class EngineLogic {
4142
public readonly account: AccountService;
4243
public readonly accountFactory: AccountFactoryService;
4344
public readonly backendWallet: BackendWalletService;
45+
public readonly balanceSubscriptions: BalanceSubscriptionsService;
4446
public readonly chain: ChainService;
4547
public readonly configuration: ConfigurationService;
4648
public readonly contract: ContractService;
@@ -83,6 +85,7 @@ class EngineLogic {
8385
this.account = new AccountService(this.request);
8486
this.accountFactory = new AccountFactoryService(this.request);
8587
this.backendWallet = new BackendWalletService(this.request);
88+
this.balanceSubscriptions = new BalanceSubscriptionsService(this.request);
8689
this.chain = new ChainService(this.request);
8790
this.configuration = new ConfigurationService(this.request);
8891
this.contract = new ContractService(this.request);

sdk/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export { AccessTokensService } from './services/AccessTokensService';
1414
export { AccountService } from './services/AccountService';
1515
export { AccountFactoryService } from './services/AccountFactoryService';
1616
export { BackendWalletService } from './services/BackendWalletService';
17+
export { BalanceSubscriptionsService } from './services/BalanceSubscriptionsService';
1718
export { ChainService } from './services/ChainService';
1819
export { ConfigurationService } from './services/ConfigurationService';
1920
export { ContractService } from './services/ContractService';
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
import type { CancelablePromise } from '../core/CancelablePromise';
6+
import type { BaseHttpRequest } from '../core/BaseHttpRequest';
7+
8+
export class BalanceSubscriptionsService {
9+
10+
constructor(public readonly httpRequest: BaseHttpRequest) {}
11+
12+
/**
13+
* Get balance subscriptions
14+
* Get all balance subscriptions.
15+
* @returns any Default Response
16+
* @throws ApiError
17+
*/
18+
public getAllBalanceSubscriptions(): CancelablePromise<{
19+
result: Array<{
20+
id: string;
21+
/**
22+
* A chain ID ("137") or slug ("polygon-amoy-testnet"). Chain ID is preferred.
23+
*/
24+
chain: string;
25+
/**
26+
* A contract or wallet address
27+
*/
28+
contractAddress?: string;
29+
/**
30+
* A contract or wallet address
31+
*/
32+
walletAddress: string;
33+
config: {
34+
threshold?: {
35+
/**
36+
* Minimum balance threshold
37+
*/
38+
min?: string;
39+
/**
40+
* Maximum balance threshold
41+
*/
42+
max?: string;
43+
};
44+
};
45+
webhook?: {
46+
url: string;
47+
};
48+
createdAt: string;
49+
updatedAt: string;
50+
}>;
51+
}> {
52+
return this.httpRequest.request({
53+
method: 'GET',
54+
url: '/balance-subscriptions/get-all',
55+
errors: {
56+
400: `Bad Request`,
57+
404: `Not Found`,
58+
500: `Internal Server Error`,
59+
},
60+
});
61+
}
62+
63+
/**
64+
* Add balance subscription
65+
* Subscribe to balance changes for a wallet.
66+
* @param requestBody
67+
* @returns any Default Response
68+
* @throws ApiError
69+
*/
70+
public addBalanceSubscription(
71+
requestBody: {
72+
/**
73+
* A chain ID ("137") or slug ("polygon-amoy-testnet"). Chain ID is preferred.
74+
*/
75+
chain: string;
76+
/**
77+
* A contract or wallet address
78+
*/
79+
contractAddress?: string;
80+
/**
81+
* A contract or wallet address
82+
*/
83+
walletAddress: string;
84+
config: {
85+
threshold?: {
86+
/**
87+
* Minimum balance threshold
88+
*/
89+
min?: string;
90+
/**
91+
* Maximum balance threshold
92+
*/
93+
max?: string;
94+
};
95+
};
96+
/**
97+
* Webhook URL
98+
*/
99+
webhookUrl?: string;
100+
},
101+
): CancelablePromise<{
102+
result: {
103+
id: string;
104+
/**
105+
* A chain ID ("137") or slug ("polygon-amoy-testnet"). Chain ID is preferred.
106+
*/
107+
chain: string;
108+
/**
109+
* A contract or wallet address
110+
*/
111+
contractAddress?: string;
112+
/**
113+
* A contract or wallet address
114+
*/
115+
walletAddress: string;
116+
config: {
117+
threshold?: {
118+
/**
119+
* Minimum balance threshold
120+
*/
121+
min?: string;
122+
/**
123+
* Maximum balance threshold
124+
*/
125+
max?: string;
126+
};
127+
};
128+
webhook?: {
129+
url: string;
130+
};
131+
createdAt: string;
132+
updatedAt: string;
133+
};
134+
}> {
135+
return this.httpRequest.request({
136+
method: 'POST',
137+
url: '/balance-subscriptions/add',
138+
body: requestBody,
139+
mediaType: 'application/json',
140+
errors: {
141+
400: `Bad Request`,
142+
404: `Not Found`,
143+
500: `Internal Server Error`,
144+
},
145+
});
146+
}
147+
148+
/**
149+
* Update balance subscription
150+
* Update an existing balance subscription.
151+
* @param requestBody
152+
* @returns any Default Response
153+
* @throws ApiError
154+
*/
155+
public updateBalanceSubscription(
156+
requestBody: {
157+
/**
158+
* The ID of the balance subscription to update.
159+
*/
160+
balanceSubscriptionId: string;
161+
/**
162+
* A chain ID ("137") or slug ("polygon-amoy-testnet"). Chain ID is preferred.
163+
*/
164+
chain?: string;
165+
contractAddress?: (string | null);
166+
/**
167+
* A contract or wallet address
168+
*/
169+
walletAddress?: string;
170+
config?: {
171+
threshold?: {
172+
/**
173+
* Minimum balance threshold
174+
*/
175+
min?: string;
176+
/**
177+
* Maximum balance threshold
178+
*/
179+
max?: string;
180+
};
181+
};
182+
webhookId?: (number | null);
183+
},
184+
): CancelablePromise<{
185+
result: {
186+
id: string;
187+
/**
188+
* A chain ID ("137") or slug ("polygon-amoy-testnet"). Chain ID is preferred.
189+
*/
190+
chain: string;
191+
/**
192+
* A contract or wallet address
193+
*/
194+
contractAddress?: string;
195+
/**
196+
* A contract or wallet address
197+
*/
198+
walletAddress: string;
199+
config: {
200+
threshold?: {
201+
/**
202+
* Minimum balance threshold
203+
*/
204+
min?: string;
205+
/**
206+
* Maximum balance threshold
207+
*/
208+
max?: string;
209+
};
210+
};
211+
webhook?: {
212+
url: string;
213+
};
214+
createdAt: string;
215+
updatedAt: string;
216+
};
217+
}> {
218+
return this.httpRequest.request({
219+
method: 'POST',
220+
url: '/balance-subscriptions/update',
221+
body: requestBody,
222+
mediaType: 'application/json',
223+
errors: {
224+
400: `Bad Request`,
225+
404: `Not Found`,
226+
500: `Internal Server Error`,
227+
},
228+
});
229+
}
230+
231+
/**
232+
* Remove balance subscription
233+
* Remove an existing balance subscription
234+
* @param requestBody
235+
* @returns any Default Response
236+
* @throws ApiError
237+
*/
238+
public removeBalanceSubscription(
239+
requestBody: {
240+
/**
241+
* The ID for an existing balance subscription.
242+
*/
243+
balanceSubscriptionId: string;
244+
},
245+
): CancelablePromise<{
246+
result: {
247+
status: string;
248+
};
249+
}> {
250+
return this.httpRequest.request({
251+
method: 'POST',
252+
url: '/balance-subscriptions/remove',
253+
body: requestBody,
254+
mediaType: 'application/json',
255+
errors: {
256+
400: `Bad Request`,
257+
404: `Not Found`,
258+
500: `Internal Server Error`,
259+
},
260+
});
261+
}
262+
263+
}

sdk/src/services/WalletCredentialsService.ts

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export class WalletCredentialsService {
2121
label: string;
2222
type: 'circle';
2323
/**
24-
* 32-byte hex string. If not provided, a random one will be generated.
24+
* 32-byte hex string. Consult https://developers.circle.com/w3s/entity-secret-management to create and register an entity secret.
2525
*/
26-
entitySecret?: string;
26+
entitySecret: string;
2727
/**
2828
* Whether this credential should be set as the default for its type. Only one credential can be default per type.
2929
*/
@@ -102,7 +102,7 @@ export class WalletCredentialsService {
102102
id: string;
103103
type: string;
104104
label: (string | null);
105-
isDefault: boolean;
105+
isDefault: (boolean | null);
106106
createdAt: string;
107107
updatedAt: string;
108108
deletedAt: (string | null);
@@ -122,4 +122,51 @@ export class WalletCredentialsService {
122122
});
123123
}
124124

125+
/**
126+
* Update wallet credential
127+
* Update a wallet credential's label, default status, and entity secret.
128+
* @param id The ID of the wallet credential to update.
129+
* @param requestBody
130+
* @returns any Default Response
131+
* @throws ApiError
132+
*/
133+
public updateWalletCredential(
134+
id: string,
135+
requestBody?: {
136+
label?: string;
137+
/**
138+
* Whether this credential should be set as the default for its type. Only one credential can be default per type.
139+
*/
140+
isDefault?: boolean;
141+
/**
142+
* 32-byte hex string. Consult https://developers.circle.com/w3s/entity-secret-management to create and register an entity secret.
143+
*/
144+
entitySecret?: string;
145+
},
146+
): CancelablePromise<{
147+
result: {
148+
id: string;
149+
type: string;
150+
label: (string | null);
151+
isDefault: (boolean | null);
152+
createdAt: string;
153+
updatedAt: string;
154+
};
155+
}> {
156+
return this.httpRequest.request({
157+
method: 'PUT',
158+
url: '/wallet-credentials/{id}',
159+
path: {
160+
'id': id,
161+
},
162+
body: requestBody,
163+
mediaType: 'application/json',
164+
errors: {
165+
400: `Bad Request`,
166+
404: `Not Found`,
167+
500: `Internal Server Error`,
168+
},
169+
});
170+
}
171+
125172
}

sdk/src/services/WebhooksService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class WebhooksService {
5151
*/
5252
url: string;
5353
name?: string;
54-
eventType: ('queued_transaction' | 'sent_transaction' | 'mined_transaction' | 'errored_transaction' | 'cancelled_transaction' | 'all_transactions' | 'backend_wallet_balance' | 'auth' | 'contract_subscription');
54+
eventType: ('queued_transaction' | 'sent_transaction' | 'mined_transaction' | 'errored_transaction' | 'cancelled_transaction' | 'all_transactions' | 'backend_wallet_balance' | 'auth' | 'contract_subscription' | 'balance_subscription');
5555
},
5656
): CancelablePromise<{
5757
result: {
@@ -113,7 +113,7 @@ export class WebhooksService {
113113
* @throws ApiError
114114
*/
115115
public getEventTypes(): CancelablePromise<{
116-
result: Array<('queued_transaction' | 'sent_transaction' | 'mined_transaction' | 'errored_transaction' | 'cancelled_transaction' | 'all_transactions' | 'backend_wallet_balance' | 'auth' | 'contract_subscription')>;
116+
result: Array<('queued_transaction' | 'sent_transaction' | 'mined_transaction' | 'errored_transaction' | 'cancelled_transaction' | 'all_transactions' | 'backend_wallet_balance' | 'auth' | 'contract_subscription' | 'balance_subscription')>;
117117
}> {
118118
return this.httpRequest.request({
119119
method: 'GET',

0 commit comments

Comments
 (0)