Skip to content

Commit 5807aba

Browse files
feat: add new endpoint types for plugins (#151)
* feat: add new endpoint types for plugins Signed-off-by: dylankilkenny <dylankilkenny95@gmail.com> * fix: remove comment Signed-off-by: dylankilkenny <dylankilkenny95@gmail.com> * fix: update readme to generate docs * chore: add changeset --------- Signed-off-by: dylankilkenny <dylankilkenny95@gmail.com> Co-authored-by: tirumerla <tirumerla@gmail.com>
1 parent ff8aa77 commit 5807aba

File tree

266 files changed

+8838
-1621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+8838
-1621
lines changed

.changeset/pretty-horses-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openzeppelin/relayer-sdk': minor
3+
---
4+
5+
Add new endpoint types for plugins

.hintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"development"
4+
],
5+
"hints": {
6+
"typescript-config/strict": "off"
7+
}
8+
}
File renamed without changes.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ The SDK is built on top of an OpenAPI specification which can be found in the [o
7272

7373
For detailed API documentation, please refer to the [API Reference](docs/README.md) in the docs folder. This documentation provides comprehensive information about all available endpoints, request parameters, and response types.
7474

75+
To generate docs from the OpenAPI specification, you can use the following command:
76+
77+
```bash
78+
pnpm generate:docs
79+
```
80+
81+
> Note: You will need java runtime installed to generate the documentation.
82+
7583
## Development
7684

7785
### Setup

custom-models/plugin-api.ts

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
/**
22
* Custom Plugin API Model
3-
*
3+
*
44
* This file contains custom type definitions for the Plugin API that are not generated
55
* by the OpenAPI generator. This file is automatically copied to src/models/ by the
66
* post-generate script after OpenAPI code generation.
7-
*
7+
*
88
* Note: Import paths use absolute references from project root and are automatically
99
* normalized to relative paths when copied by scripts/post-generate.js
1010
*/
1111

12-
import { NetworkTransactionRequest } from "../src/models/network-transaction-request";
13-
import { TransactionResponse } from "../src/models/transaction-response";
12+
import { NetworkTransactionRequest } from '../src/models/network-transaction-request';
13+
import { TransactionResponse } from '../src/models/transaction-response';
14+
import { ApiResponseRelayerStatus } from '../src/models/api-response-relayer-status';
15+
import { ApiResponseRelayerResponse } from '../src/models/api-response-relayer-response';
16+
import { SignTransactionRequest } from '../src/models/sign-transaction-request';
17+
import { SignTransactionResponse } from '../src/models/sign-transaction-response';
1418

1519
/**
1620
* The result of a sendTransaction call.
@@ -55,19 +59,23 @@ type SendTransactionResult = {
5559
* @returns The transaction response.
5660
*/
5761
wait: (options?: TransactionWaitOptions) => Promise<TransactionResponse>;
58-
}
62+
};
5963

6064
type GetTransactionRequest = {
6165
transactionId: string;
62-
}
66+
};
6367

6468
/**
6569
* The relayer API.
6670
*
71+
*
6772
* @property sendTransaction - Sends a transaction to the relayer.
6873
* @property getTransaction - Gets a transaction from the relayer.
74+
* @property getRelayerStatus - Gets the relayer status (Stellar).
75+
* @property signTransaction - Signs a transaction (Stellar).
76+
* @property getRelayer - Gets the relayer info including address.
6977
*/
70-
type Relayer = {
78+
export type Relayer = {
7179
/**
7280
* Sends a transaction to the relayer.
7381
* @param payload - The transaction request payload.
@@ -81,7 +89,25 @@ type Relayer = {
8189
* @returns The transaction response.
8290
*/
8391
getTransaction: (payload: GetTransactionRequest) => Promise<TransactionResponse>;
84-
}
92+
93+
/**
94+
* Gets the relayer status (balance, nonce/sequence number, etc).
95+
* @returns The relayer status information.
96+
*/
97+
getRelayerStatus: () => Promise<ApiResponseRelayerStatus>;
98+
/**
99+
* Gets the relayer info including address.
100+
* @returns The relayer information.
101+
*/
102+
getRelayer: () => Promise<ApiResponseRelayerResponse>;
103+
104+
/**
105+
* Signs a transaction with the relayer's key (Stellar specific).
106+
* @param payload - The unsigned transaction XDR.
107+
* @returns The signed transaction XDR and signature.
108+
*/
109+
signTransaction: (payload: SignTransactionRequest) => Promise<SignTransactionResponse>;
110+
};
85111

86112
export interface PluginAPI {
87113
useRelayer(relayerId: string): Relayer;
@@ -91,4 +117,4 @@ export interface PluginAPI {
91117
type TransactionWaitOptions = {
92118
interval?: number;
93119
timeout?: number;
94-
}
120+
};

docs/.openapi-generator/FILES

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
Apis/HealthApi.md
22
Apis/MetricsApi.md
3+
Apis/NotificationsApi.md
34
Apis/PluginsApi.md
45
Apis/RelayersApi.md
6+
Apis/SignersApi.md
57
Models/ApiResponse_BalanceResponse.md
68
Models/ApiResponse_BalanceResponse_data.md
79
Models/ApiResponse_DeletePendingTransactionsResponse.md
810
Models/ApiResponse_DeletePendingTransactionsResponse_data.md
11+
Models/ApiResponse_NotificationResponse.md
12+
Models/ApiResponse_NotificationResponse_data.md
913
Models/ApiResponse_PluginCallResponse.md
1014
Models/ApiResponse_PluginCallResponse_data.md
1115
Models/ApiResponse_RelayerResponse.md
@@ -14,12 +18,22 @@ Models/ApiResponse_RelayerStatus.md
1418
Models/ApiResponse_RelayerStatus_data.md
1519
Models/ApiResponse_RelayerStatus_data_oneOf.md
1620
Models/ApiResponse_RelayerStatus_data_oneOf_1.md
21+
Models/ApiResponse_RelayerStatus_data_oneOf_2.md
1722
Models/ApiResponse_SignDataResponse.md
1823
Models/ApiResponse_SignDataResponse_data.md
24+
Models/ApiResponse_SignTransactionResponse.md
25+
Models/ApiResponse_SignTransactionResponse_data.md
26+
Models/ApiResponse_SignTransactionResponse_data_oneOf.md
27+
Models/ApiResponse_SignTransactionResponse_data_oneOf_1.md
28+
Models/ApiResponse_SignTransactionResponse_data_oneOf_2.md
29+
Models/ApiResponse_SignerResponse.md
30+
Models/ApiResponse_SignerResponse_data.md
1931
Models/ApiResponse_String.md
2032
Models/ApiResponse_TransactionResponse.md
2133
Models/ApiResponse_TransactionResponse_data.md
34+
Models/ApiResponse_Vec_NotificationResponse.md
2235
Models/ApiResponse_Vec_RelayerResponse.md
36+
Models/ApiResponse_Vec_SignerResponse.md
2337
Models/ApiResponse_Vec_TransactionResponse.md
2438
Models/AssetSpec.md
2539
Models/AssetSpec_oneOf.md
@@ -30,10 +44,16 @@ Models/AuthSpec_oneOf.md
3044
Models/AuthSpec_oneOf_1.md
3145
Models/AuthSpec_oneOf_2.md
3246
Models/AuthSpec_oneOf_3.md
47+
Models/AwsKmsSignerRequestConfig.md
3348
Models/BalanceResponse.md
3449
Models/ContractSource.md
3550
Models/ContractSource_oneOf.md
3651
Models/ContractSource_oneOf_1.md
52+
Models/CreateRelayerPolicyRequest.md
53+
Models/CreateRelayerPolicyRequest_oneOf.md
54+
Models/CreateRelayerPolicyRequest_oneOf_1.md
55+
Models/CreateRelayerPolicyRequest_oneOf_2.md
56+
Models/CreateRelayerRequest.md
3757
Models/DeletePendingTransactionsResponse.md
3858
Models/EvmPolicyResponse.md
3959
Models/EvmRpcRequest.md
@@ -47,12 +67,18 @@ Models/FeeEstimateResult.md
4767
Models/GetFeaturesEnabledResult.md
4868
Models/GetSupportedTokensItem.md
4969
Models/GetSupportedTokensResult.md
70+
Models/GoogleCloudKmsSignerKeyRequestConfig.md
71+
Models/GoogleCloudKmsSignerKeyResponseConfig.md
72+
Models/GoogleCloudKmsSignerRequestConfig.md
73+
Models/GoogleCloudKmsSignerServiceAccountRequestConfig.md
74+
Models/GoogleCloudKmsSignerServiceAccountResponseConfig.md
5075
Models/JsonRpcError.md
5176
Models/JsonRpcId.md
5277
Models/JsonRpcRequest_NetworkRpcRequest.md
5378
Models/JsonRpcResponse_NetworkRpcResult.md
5479
Models/JsonRpcResponse_NetworkRpcResult_result.md
5580
Models/JupiterSwapOptions.md
81+
Models/LocalSignerRequestConfig.md
5682
Models/LogEntry.md
5783
Models/LogLevel.md
5884
Models/MemoSpec.md
@@ -65,7 +91,10 @@ Models/NetworkPolicyResponse.md
6591
Models/NetworkRpcRequest.md
6692
Models/NetworkRpcResult.md
6793
Models/NetworkTransactionRequest.md
68-
Models/NetworkType.md
94+
Models/NotificationCreateRequest.md
95+
Models/NotificationResponse.md
96+
Models/NotificationType.md
97+
Models/NotificationUpdateRequest.md
6998
Models/OperationSpec.md
7099
Models/OperationSpec_oneOf.md
71100
Models/OperationSpec_oneOf_1.md
@@ -76,19 +105,43 @@ Models/PluginCallRequest.md
76105
Models/PluginCallResponse.md
77106
Models/PrepareTransactionRequestParams.md
78107
Models/PrepareTransactionResult.md
108+
Models/RelayerEvmPolicy.md
109+
Models/RelayerNetworkPolicy.md
110+
Models/RelayerNetworkPolicyResponse.md
111+
Models/RelayerNetworkPolicy_oneOf.md
112+
Models/RelayerNetworkPolicy_oneOf_1.md
113+
Models/RelayerNetworkPolicy_oneOf_2.md
114+
Models/RelayerNetworkType.md
79115
Models/RelayerResponse.md
116+
Models/RelayerSolanaPolicy.md
80117
Models/RelayerSolanaSwapConfig.md
81118
Models/RelayerStatus.md
82-
Models/RelayerUpdateRequest.md
119+
Models/RelayerStellarPolicy.md
120+
Models/RpcConfig.md
83121
Models/SignAndSendTransactionRequestParams.md
84122
Models/SignAndSendTransactionResult.md
85123
Models/SignDataRequest.md
86124
Models/SignDataResponse.md
87125
Models/SignDataResponseEvm.md
88126
Models/SignDataResponseSolana.md
127+
Models/SignTransactionRequest.md
89128
Models/SignTransactionRequestParams.md
129+
Models/SignTransactionRequestStellar.md
130+
Models/SignTransactionResponse.md
131+
Models/SignTransactionResponseStellar.md
90132
Models/SignTransactionResult.md
91133
Models/SignTypedDataRequest.md
134+
Models/SignerConfigRequest.md
135+
Models/SignerConfigResponse.md
136+
Models/SignerConfigResponse_oneOf.md
137+
Models/SignerConfigResponse_oneOf_1.md
138+
Models/SignerConfigResponse_oneOf_2.md
139+
Models/SignerConfigResponse_oneOf_3.md
140+
Models/SignerConfigResponse_oneOf_4.md
141+
Models/SignerCreateRequest.md
142+
Models/SignerResponse.md
143+
Models/SignerType.md
144+
Models/SignerTypeRequest.md
92145
Models/SolanaAllowedTokensPolicy.md
93146
Models/SolanaAllowedTokensSwapConfig.md
94147
Models/SolanaFeePaymentStrategy.md
@@ -116,6 +169,10 @@ Models/TransactionResponse.md
116169
Models/TransactionStatus.md
117170
Models/TransferTransactionRequestParams.md
118171
Models/TransferTransactionResult.md
172+
Models/TurnkeySignerRequestConfig.md
173+
Models/UpdateRelayerRequest.md
174+
Models/VaultSignerRequestConfig.md
175+
Models/VaultTransitSignerRequestConfig.md
119176
Models/WasmSource.md
120177
Models/WasmSource_oneOf.md
121178
Models/WasmSource_oneOf_1.md

0 commit comments

Comments
 (0)