Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/engine",
"version": "0.0.18",
"version": "0.0.19",
"main": "dist/thirdweb-dev-engine.cjs.js",
"module": "dist/thirdweb-dev-engine.esm.js",
"files": [
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { MarketplaceOffersService } from './services/MarketplaceOffersService';
import { PermissionsService } from './services/PermissionsService';
import { RelayerService } from './services/RelayerService';
import { TransactionService } from './services/TransactionService';
import { WalletCredentialsService } from './services/WalletCredentialsService';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the SDK folder be .gitignored?

import { WebhooksService } from './services/WebhooksService';

type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
Expand Down Expand Up @@ -60,6 +61,7 @@ class EngineLogic {
public readonly permissions: PermissionsService;
public readonly relayer: RelayerService;
public readonly transaction: TransactionService;
public readonly walletCredentials: WalletCredentialsService;
public readonly webhooks: WebhooksService;

public readonly request: BaseHttpRequest;
Expand Down Expand Up @@ -101,6 +103,7 @@ class EngineLogic {
this.permissions = new PermissionsService(this.request);
this.relayer = new RelayerService(this.request);
this.transaction = new TransactionService(this.request);
this.walletCredentials = new WalletCredentialsService(this.request);
this.webhooks = new WebhooksService(this.request);
}
}
Expand Down
1 change: 1 addition & 0 deletions sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ export { MarketplaceOffersService } from './services/MarketplaceOffersService';
export { PermissionsService } from './services/PermissionsService';
export { RelayerService } from './services/RelayerService';
export { TransactionService } from './services/TransactionService';
export { WalletCredentialsService } from './services/WalletCredentialsService';
export { WebhooksService } from './services/WebhooksService';
24 changes: 17 additions & 7 deletions sdk/src/services/BackendWalletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,27 @@ export class BackendWalletService {
* @throws ApiError
*/
public create(
requestBody?: {
requestBody?: ({
label?: string;
type?: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
} | {
label?: string;
type: ('circle' | 'smart:circle');
/**
* Type of new wallet to create. It is recommended to always provide this value. If not provided, the default wallet type will be used.
* 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
*/
type?: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
},
isTestnet?: boolean;
credentialId: string;
walletSetId?: string;
}),
): CancelablePromise<{
result: {
/**
* A contract or wallet address
*/
walletAddress: string;
status: string;
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
};
}> {
return this.httpRequest.request({
Expand Down Expand Up @@ -721,7 +727,7 @@ export class BackendWalletService {
gasPrice?: string;
data?: string;
value?: string;
chainId?: number;
chainId: number;
type?: number;
accessList?: any;
maxFeePerGas?: string;
Expand Down Expand Up @@ -1032,7 +1038,7 @@ export class BackendWalletService {
* @throws ApiError
*/
public resetNonces(
requestBody?: {
requestBody: {
/**
* The chain ID to reset nonces for.
*/
Expand All @@ -1041,6 +1047,10 @@ export class BackendWalletService {
* The backend wallet address to reset nonces for. Omit to reset all backend wallets.
*/
walletAddress?: string;
/**
* Resync nonces to match the onchain transaction count for your backend wallets. (Default: true)
*/
syncOnchainNonces: boolean;
},
): CancelablePromise<{
result: {
Expand Down
24 changes: 18 additions & 6 deletions sdk/src/services/ConfigurationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ConfigurationService {
*/
public getWalletsConfiguration(): CancelablePromise<{
result: {
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
awsAccessKeyId: (string | null);
awsRegion: (string | null);
gcpApplicationProjectId: (string | null);
Expand Down Expand Up @@ -55,10 +55,12 @@ export class ConfigurationService {
gcpKmsKeyRingId: string;
gcpApplicationCredentialEmail: string;
gcpApplicationCredentialPrivateKey: string;
} | {
circleApiKey: string;
}),
): CancelablePromise<{
result: {
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local');
type: ('local' | 'aws-kms' | 'gcp-kms' | 'smart:aws-kms' | 'smart:gcp-kms' | 'smart:local' | 'circle' | 'smart:circle');
awsAccessKeyId: (string | null);
awsRegion: (string | null);
gcpApplicationProjectId: (string | null);
Expand Down Expand Up @@ -329,7 +331,8 @@ export class ConfigurationService {
*/
public getAuthConfiguration(): CancelablePromise<{
result: {
domain: string;
authDomain: string;
mtlsCertificate: (string | null);
};
}> {
return this.httpRequest.request({
Expand All @@ -351,12 +354,21 @@ export class ConfigurationService {
* @throws ApiError
*/
public updateAuthConfiguration(
requestBody: {
domain: string;
requestBody?: {
authDomain?: string;
/**
* Engine certificate used for outbound mTLS requests. Must provide the full certificate chain.
*/
mtlsCertificate?: string;
/**
* Engine private key used for outbound mTLS requests.
*/
mtlsPrivateKey?: string;
},
): CancelablePromise<{
result: {
domain: string;
authDomain: string;
mtlsCertificate: (string | null);
};
}> {
return this.httpRequest.request({
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/services/ContractEventsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export class ContractEventsService {
public getAllEvents(
chain: string,
contractAddress: string,
fromBlock?: (number | string),
toBlock?: (number | string),
fromBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'),
toBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'),
order?: ('asc' | 'desc'),
): CancelablePromise<{
result: Array<Record<string, any>>;
Expand Down Expand Up @@ -63,8 +63,8 @@ export class ContractEventsService {
contractAddress: string,
requestBody: {
eventName: string;
fromBlock?: (number | string);
toBlock?: (number | string);
fromBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized');
toBlock?: (number | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized');
order?: ('asc' | 'desc');
filters?: any;
},
Expand Down
125 changes: 125 additions & 0 deletions sdk/src/services/WalletCredentialsService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { CancelablePromise } from '../core/CancelablePromise';
import type { BaseHttpRequest } from '../core/BaseHttpRequest';

export class WalletCredentialsService {

constructor(public readonly httpRequest: BaseHttpRequest) {}

/**
* Create wallet credentials
* Create a new set of wallet credentials.
* @param requestBody
* @returns any Default Response
* @throws ApiError
*/
public createWalletCredential(
requestBody: {
label: string;
type: 'circle';
/**
* 32-byte hex string. If not provided, a random one will be generated.
*/
entitySecret?: string;
/**
* Whether this credential should be set as the default for its type. Only one credential can be default per type.
*/
isDefault?: boolean;
},
): CancelablePromise<{
result: {
id: string;
type: string;
label: string;
isDefault: (boolean | null);
createdAt: string;
updatedAt: string;
};
}> {
return this.httpRequest.request({
method: 'POST',
url: '/wallet-credentials',
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Bad Request`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}

/**
* Get all wallet credentials
* Get all wallet credentials with pagination.
* @param page Specify the page number.
* @param limit Specify the number of results to return per page.
* @returns any Default Response
* @throws ApiError
*/
public getAllWalletCredentials(
page: number = 1,
limit: number = 100,
): CancelablePromise<{
result: Array<{
id: string;
type: string;
label: (string | null);
isDefault: (boolean | null);
createdAt: string;
updatedAt: string;
}>;
}> {
return this.httpRequest.request({
method: 'GET',
url: '/wallet-credentials',
query: {
'page': page,
'limit': limit,
},
errors: {
400: `Bad Request`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}

/**
* Get wallet credential
* Get a wallet credential by ID.
* @param id The ID of the wallet credential to get.
* @returns any Default Response
* @throws ApiError
*/
public getWalletCredential(
id: string,
): CancelablePromise<{
result: {
id: string;
type: string;
label: (string | null);
isDefault: boolean;
createdAt: string;
updatedAt: string;
deletedAt: (string | null);
};
}> {
return this.httpRequest.request({
method: 'GET',
url: '/wallet-credentials/{id}',
path: {
'id': id,
},
errors: {
400: `Bad Request`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}

}
2 changes: 1 addition & 1 deletion sdk/src/services/WebhooksService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class WebhooksService {
}

/**
* Create a webhook
* Create webhook
* Create a webhook to call when a specific Engine event occurs.
* @param requestBody
* @returns any Default Response
Expand Down
5 changes: 4 additions & 1 deletion src/server/routes/system/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ type EngineFeature =
| "CONTRACT_SUBSCRIPTIONS"
| "IP_ALLOWLIST"
| "HETEROGENEOUS_WALLET_TYPES"
| "SMART_BACKEND_WALLETS";
| "SMART_BACKEND_WALLETS"
| "WALLET_CREDENTIALS";

const ReplySchemaOk = Type.Object({
status: Type.String(),
Expand All @@ -25,6 +26,7 @@ const ReplySchemaOk = Type.Object({
Type.Literal("IP_ALLOWLIST"),
Type.Literal("HETEROGENEOUS_WALLET_TYPES"),
Type.Literal("SMART_BACKEND_WALLETS"),
Type.Literal("WALLET_CREDENTIALS"),
]),
),
clientId: Type.String(),
Expand Down Expand Up @@ -89,6 +91,7 @@ const getFeatures = (): EngineFeature[] => {
"HETEROGENEOUS_WALLET_TYPES",
"CONTRACT_SUBSCRIPTIONS",
"SMART_BACKEND_WALLETS",
"WALLET_CREDENTIALS",
];

if (env.ENABLE_KEYPAIR_AUTH) features.push("KEYPAIR_AUTH");
Expand Down