Skip to content

Commit

Permalink
Merge branch 'main' into pb/eip-7702
Browse files Browse the repository at this point in the history
  • Loading branch information
d4mr authored Feb 18, 2025
2 parents 1f3f481 + 503f37e commit b8f276c
Show file tree
Hide file tree
Showing 77 changed files with 3,472 additions and 235 deletions.
14 changes: 7 additions & 7 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ENABLE_HTTPS="true"
REDIS_URL="redis://127.0.0.1:6379/0"
THIRDWEB_API_SECRET_KEY="my-thirdweb-secret-key"

TEST_AWS_KMS_KEY_ID=""
TEST_AWS_KMS_ACCESS_KEY_ID=""
TEST_AWS_KMS_SECRET_ACCESS_KEY=""
TEST_AWS_KMS_REGION=""
TEST_AWS_KMS_KEY_ID="UNIMPLEMENTED"
TEST_AWS_KMS_ACCESS_KEY_ID="UNIMPLEMENTED"
TEST_AWS_KMS_SECRET_ACCESS_KEY="UNIMPLEMENTED"
TEST_AWS_KMS_REGION="UNIMPLEMENTED"

TEST_GCP_KMS_RESOURCE_PATH=""
TEST_GCP_KMS_EMAIL=""
TEST_GCP_KMS_PK=""
TEST_GCP_KMS_RESOURCE_PATH="UNIMPLEMENTED"
TEST_GCP_KMS_EMAIL="UNIMPLEMENTED"
TEST_GCP_KMS_PK="UNIMPLEMENTED"
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dependencies": {
"@aws-sdk/client-kms": "^3.679.0",
"@bull-board/fastify": "^5.23.0",
"@circle-fin/developer-controlled-wallets": "^7.0.0",
"@cloud-cryptographic-wallet/cloud-kms-signer": "^0.1.2",
"@cloud-cryptographic-wallet/signer": "^0.0.5",
"@ethersproject/json-wallets": "^5.7.0",
Expand Down Expand Up @@ -63,11 +64,13 @@
"knex": "^3.1.0",
"mnemonist": "^0.39.8",
"node-cron": "^3.0.2",
"ox": "^0.6.9",
"pg": "^8.11.3",
"prisma": "^5.14.0",
"prom-client": "^15.1.3",
"superjson": "^2.2.1",
"thirdweb": "^5.83.0",
"undici": "^6.20.1",
"uuid": "^9.0.1",
"viem": "^2.21.54",
"winston": "^3.14.1",
Expand Down
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
6 changes: 6 additions & 0 deletions sdk/src/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ 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';
import { WalletSubscriptionsService } from './services/WalletSubscriptionsService';
import { WebhooksService } from './services/WebhooksService';

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

public readonly request: BaseHttpRequest;
Expand Down Expand Up @@ -101,6 +105,8 @@ 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.walletSubscriptions = new WalletSubscriptionsService(this.request);
this.webhooks = new WebhooksService(this.request);
}
}
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ 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 { WalletSubscriptionsService } from './services/WalletSubscriptionsService';
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
172 changes: 172 additions & 0 deletions sdk/src/services/WalletCredentialsService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/* 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. Consult https://developers.circle.com/w3s/entity-secret-management to create and register an entity secret.
*/
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 | null);
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`,
},
});
}

/**
* Update wallet credential
* Update a wallet credential's label, default status, and entity secret.
* @param id The ID of the wallet credential to update.
* @param requestBody
* @returns any Default Response
* @throws ApiError
*/
public updateWalletCredential(
id: string,
requestBody?: {
label?: string;
/**
* Whether this credential should be set as the default for its type. Only one credential can be default per type.
*/
isDefault?: boolean;
/**
* 32-byte hex string. Consult https://developers.circle.com/w3s/entity-secret-management to create and register an entity secret.
*/
entitySecret?: string;
},
): CancelablePromise<{
result: {
id: string;
type: string;
label: (string | null);
isDefault: (boolean | null);
createdAt: string;
updatedAt: string;
};
}> {
return this.httpRequest.request({
method: 'PUT',
url: '/wallet-credentials/{id}',
path: {
'id': id,
},
body: requestBody,
mediaType: 'application/json',
errors: {
400: `Bad Request`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}

}
Loading

0 comments on commit b8f276c

Please sign in to comment.