Skip to content

Commit f4e728f

Browse files
authored
credentials feature flag and sdk bump (#844)
* build SDK * bump SDK * feature flag * update flag name
1 parent 6652e44 commit f4e728f

9 files changed

+174
-20
lines changed

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thirdweb-dev/engine",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"main": "dist/thirdweb-dev-engine.cjs.js",
55
"module": "dist/thirdweb-dev-engine.esm.js",
66
"files": [

sdk/src/Engine.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { MarketplaceOffersService } from './services/MarketplaceOffersService';
3030
import { PermissionsService } from './services/PermissionsService';
3131
import { RelayerService } from './services/RelayerService';
3232
import { TransactionService } from './services/TransactionService';
33+
import { WalletCredentialsService } from './services/WalletCredentialsService';
3334
import { WebhooksService } from './services/WebhooksService';
3435

3536
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
@@ -60,6 +61,7 @@ class EngineLogic {
6061
public readonly permissions: PermissionsService;
6162
public readonly relayer: RelayerService;
6263
public readonly transaction: TransactionService;
64+
public readonly walletCredentials: WalletCredentialsService;
6365
public readonly webhooks: WebhooksService;
6466

6567
public readonly request: BaseHttpRequest;
@@ -101,6 +103,7 @@ class EngineLogic {
101103
this.permissions = new PermissionsService(this.request);
102104
this.relayer = new RelayerService(this.request);
103105
this.transaction = new TransactionService(this.request);
106+
this.walletCredentials = new WalletCredentialsService(this.request);
104107
this.webhooks = new WebhooksService(this.request);
105108
}
106109
}

sdk/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ export { MarketplaceOffersService } from './services/MarketplaceOffersService';
3434
export { PermissionsService } from './services/PermissionsService';
3535
export { RelayerService } from './services/RelayerService';
3636
export { TransactionService } from './services/TransactionService';
37+
export { WalletCredentialsService } from './services/WalletCredentialsService';
3738
export { WebhooksService } from './services/WebhooksService';

sdk/src/services/BackendWalletService.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,27 @@ export class BackendWalletService {
1717
* @throws ApiError
1818
*/
1919
public create(
20-
requestBody?: {
20+
requestBody?: ({
2121
label?: string;
22+
type?: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
23+
} | {
24+
label?: string;
25+
type: ('circle' | 'smart:circle');
2226
/**
23-
* Type of new wallet to create. It is recommended to always provide this value. If not provided, the default wallet type will be used.
27+
* If your engine is configured with a testnet API Key for Circle, you can only create testnet wallets and send testnet transactions. Enable this field for testnet wallets. NOTE: A production API Key cannot be used for testnet transactions, and a testnet API Key cannot be used for production transactions. See: https://developers.circle.com/w3s/sandbox-vs-production
2428
*/
25-
type?: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
26-
},
29+
isTestnet?: boolean;
30+
credentialId: string;
31+
walletSetId?: string;
32+
}),
2733
): CancelablePromise<{
2834
result: {
2935
/**
3036
* A contract or wallet address
3137
*/
3238
walletAddress: string;
3339
status: string;
34-
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
40+
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
3541
};
3642
}> {
3743
return this.httpRequest.request({
@@ -721,7 +727,7 @@ export class BackendWalletService {
721727
gasPrice?: string;
722728
data?: string;
723729
value?: string;
724-
chainId?: number;
730+
chainId: number;
725731
type?: number;
726732
accessList?: any;
727733
maxFeePerGas?: string;
@@ -1032,7 +1038,7 @@ export class BackendWalletService {
10321038
* @throws ApiError
10331039
*/
10341040
public resetNonces(
1035-
requestBody?: {
1041+
requestBody: {
10361042
/**
10371043
* The chain ID to reset nonces for.
10381044
*/
@@ -1041,6 +1047,10 @@ export class BackendWalletService {
10411047
* The backend wallet address to reset nonces for. Omit to reset all backend wallets.
10421048
*/
10431049
walletAddress?: string;
1050+
/**
1051+
* Resync nonces to match the onchain transaction count for your backend wallets. (Default: true)
1052+
*/
1053+
syncOnchainNonces: boolean;
10441054
},
10451055
): CancelablePromise<{
10461056
result: {

sdk/src/services/ConfigurationService.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class ConfigurationService {
1717
*/
1818
public getWalletsConfiguration(): CancelablePromise<{
1919
result: {
20-
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
20+
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
2121
awsAccessKeyId: (string | null);
2222
awsRegion: (string | null);
2323
gcpApplicationProjectId: (string | null);
@@ -55,10 +55,12 @@ export class ConfigurationService {
5555
gcpKmsKeyRingId: string;
5656
gcpApplicationCredentialEmail: string;
5757
gcpApplicationCredentialPrivateKey: string;
58+
} | {
59+
circleApiKey: string;
5860
}),
5961
): CancelablePromise<{
6062
result: {
61-
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
63+
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
6264
awsAccessKeyId: (string | null);
6365
awsRegion: (string | null);
6466
gcpApplicationProjectId: (string | null);
@@ -329,7 +331,8 @@ export class ConfigurationService {
329331
*/
330332
public getAuthConfiguration(): CancelablePromise<{
331333
result: {
332-
domain: string;
334+
authDomain: string;
335+
mtlsCertificate: (string | null);
333336
};
334337
}> {
335338
return this.httpRequest.request({
@@ -351,12 +354,21 @@ export class ConfigurationService {
351354
* @throws ApiError
352355
*/
353356
public updateAuthConfiguration(
354-
requestBody: {
355-
domain: string;
357+
requestBody?: {
358+
authDomain?: string;
359+
/**
360+
* Engine certificate used for outbound mTLS requests. Must provide the full certificate chain.
361+
*/
362+
mtlsCertificate?: string;
363+
/**
364+
* Engine private key used for outbound mTLS requests.
365+
*/
366+
mtlsPrivateKey?: string;
356367
},
357368
): CancelablePromise<{
358369
result: {
359-
domain: string;
370+
authDomain: string;
371+
mtlsCertificate: (string | null);
360372
};
361373
}> {
362374
return this.httpRequest.request({

sdk/src/services/ContractEventsService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export class ContractEventsService {
2323
public getAllEvents(
2424
chain: string,
2525
contractAddress: string,
26-
fromBlock?: (number | string),
27-
toBlock?: (number | string),
26+
fromBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'),
27+
toBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'),
2828
order?: ('asc' | 'desc'),
2929
): CancelablePromise<{
3030
result: Array<Record<string, any>>;
@@ -63,8 +63,8 @@ export class ContractEventsService {
6363
contractAddress: string,
6464
requestBody: {
6565
eventName: string;
66-
fromBlock?: (number | string);
67-
toBlock?: (number | string);
66+
fromBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized');
67+
toBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized');
6868
order?: ('asc' | 'desc');
6969
filters?: any;
7070
},
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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 WalletCredentialsService {
9+
10+
constructor(public readonly httpRequest: BaseHttpRequest) {}
11+
12+
/**
13+
* Create wallet credentials
14+
* Create a new set of wallet credentials.
15+
* @param requestBody
16+
* @returns any Default Response
17+
* @throws ApiError
18+
*/
19+
public createWalletCredential(
20+
requestBody: {
21+
label: string;
22+
type: 'circle';
23+
/**
24+
* 32-byte hex string. If not provided, a random one will be generated.
25+
*/
26+
entitySecret?: string;
27+
/**
28+
* Whether this credential should be set as the default for its type. Only one credential can be default per type.
29+
*/
30+
isDefault?: boolean;
31+
},
32+
): CancelablePromise<{
33+
result: {
34+
id: string;
35+
type: string;
36+
label: string;
37+
isDefault: (boolean | null);
38+
createdAt: string;
39+
updatedAt: string;
40+
};
41+
}> {
42+
return this.httpRequest.request({
43+
method: 'POST',
44+
url: '/wallet-credentials',
45+
body: requestBody,
46+
mediaType: 'application/json',
47+
errors: {
48+
400: `Bad Request`,
49+
404: `Not Found`,
50+
500: `Internal Server Error`,
51+
},
52+
});
53+
}
54+
55+
/**
56+
* Get all wallet credentials
57+
* Get all wallet credentials with pagination.
58+
* @param page Specify the page number.
59+
* @param limit Specify the number of results to return per page.
60+
* @returns any Default Response
61+
* @throws ApiError
62+
*/
63+
public getAllWalletCredentials(
64+
page: number = 1,
65+
limit: number = 100,
66+
): CancelablePromise<{
67+
result: Array<{
68+
id: string;
69+
type: string;
70+
label: (string | null);
71+
isDefault: (boolean | null);
72+
createdAt: string;
73+
updatedAt: string;
74+
}>;
75+
}> {
76+
return this.httpRequest.request({
77+
method: 'GET',
78+
url: '/wallet-credentials',
79+
query: {
80+
'page': page,
81+
'limit': limit,
82+
},
83+
errors: {
84+
400: `Bad Request`,
85+
404: `Not Found`,
86+
500: `Internal Server Error`,
87+
},
88+
});
89+
}
90+
91+
/**
92+
* Get wallet credential
93+
* Get a wallet credential by ID.
94+
* @param id The ID of the wallet credential to get.
95+
* @returns any Default Response
96+
* @throws ApiError
97+
*/
98+
public getWalletCredential(
99+
id: string,
100+
): CancelablePromise<{
101+
result: {
102+
id: string;
103+
type: string;
104+
label: (string | null);
105+
isDefault: boolean;
106+
createdAt: string;
107+
updatedAt: string;
108+
deletedAt: (string | null);
109+
};
110+
}> {
111+
return this.httpRequest.request({
112+
method: 'GET',
113+
url: '/wallet-credentials/{id}',
114+
path: {
115+
'id': id,
116+
},
117+
errors: {
118+
400: `Bad Request`,
119+
404: `Not Found`,
120+
500: `Internal Server Error`,
121+
},
122+
});
123+
}
124+
125+
}

sdk/src/services/WebhooksService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class WebhooksService {
3838
}
3939

4040
/**
41-
* Create a webhook
41+
* Create webhook
4242
* Create a webhook to call when a specific Engine event occurs.
4343
* @param requestBody
4444
* @returns any Default Response

src/server/routes/system/health.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ type EngineFeature =
1111
| "CONTRACT_SUBSCRIPTIONS"
1212
| "IP_ALLOWLIST"
1313
| "HETEROGENEOUS_WALLET_TYPES"
14-
| "SMART_BACKEND_WALLETS";
14+
| "SMART_BACKEND_WALLETS"
15+
| "WALLET_CREDENTIALS";
1516

1617
const ReplySchema = Type.Object({
1718
db: Type.Boolean(),
@@ -26,6 +27,7 @@ const ReplySchema = Type.Object({
2627
Type.Literal("IP_ALLOWLIST"),
2728
Type.Literal("HETEROGENEOUS_WALLET_TYPES"),
2829
Type.Literal("SMART_BACKEND_WALLETS"),
30+
Type.Literal("WALLET_CREDENTIALS"),
2931
]),
3032
),
3133
clientId: Type.String(),
@@ -77,6 +79,7 @@ const getFeatures = (): EngineFeature[] => {
7779
"HETEROGENEOUS_WALLET_TYPES",
7880
"CONTRACT_SUBSCRIPTIONS",
7981
"SMART_BACKEND_WALLETS",
82+
"WALLET_CREDENTIALS",
8083
];
8184

8285
if (env.ENABLE_KEYPAIR_AUTH) features.push("KEYPAIR_AUTH");

0 commit comments

Comments
 (0)