Skip to content

Commit 0e42483

Browse files
authored
Merge pull request #1638 from onflow/peter/7830-scheduled-transaction-endpoints
[AccessAPI] Add grpc and rest endpoints for schedule transaction endpoints
2 parents 3ec938f + 2d478f7 commit 0e42483

File tree

14 files changed

+554
-257
lines changed

14 files changed

+554
-257
lines changed

openapi/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11

22
generate:
3-
swagger-codegen generate -l go -i ./access.yaml -o ./go-client-generated
3+
swagger-codegen generate -l go -i ./access.yaml -o ./go-client-generated
4+
5+
generate-docker:
6+
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate \
7+
-i /local/access.yaml \
8+
-l go \
9+
-o /local/go-client-generated

openapi/access.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,17 @@ paths:
123123
/transactions/{id}:
124124
get:
125125
summary: Get a Transaction by ID.
126-
description: Get a transaction data by the provided transaction ID.
126+
description: Get a transaction data by the provided transaction ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
127127
tags:
128128
- Transactions
129129
parameters:
130-
- description: The ID of the transaction to get.
130+
- description: The ID of the transaction, or id field of the scheduled transaction returned by the system contract.
131131
name: id
132132
in: path
133133
schema:
134-
$ref: '#/components/schemas/Identifier'
134+
oneOf:
135+
- $ref: '#/components/schemas/Identifier'
136+
- $ref: '#/components/schemas/ScheduledTransactionId'
135137
required: true
136138
- $ref: '#/components/parameters/blockIdParam'
137139
- $ref: '#/components/parameters/collectionIdParam'
@@ -152,16 +154,18 @@ paths:
152154
$ref: '#/components/responses/500InternalServerError'
153155
/transaction_results/{transaction_id}:
154156
get:
155-
summary: Get a Transaction Result by ID.
156-
description: Get transaction result by the transaction result ID.
157+
summary: Get a Transaction Result by transaction ID or scheduled transaction ID.
158+
description: Get transaction result by the transaction's ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
157159
tags:
158160
- Transactions
159161
parameters:
160-
- description: The transaction ID of the transaction result.
162+
- description: The transaction ID of the transaction result, or id field of the scheduled transaction returned by the system contract.
161163
name: transaction_id
162164
in: path
163165
schema:
164-
$ref: '#/components/schemas/Identifier'
166+
oneOf:
167+
- $ref: '#/components/schemas/Identifier'
168+
- $ref: '#/components/schemas/ScheduledTransactionId'
165169
required: true
166170
- $ref: '#/components/parameters/blockIdParam'
167171
- $ref: '#/components/parameters/collectionIdParam'
@@ -1230,6 +1234,10 @@ components:
12301234
type: string
12311235
format: hexadecimal
12321236
pattern: '[a-fA-F0-9]{64}'
1237+
ScheduledTransactionId:
1238+
description: The ID of a scheduled transaction.
1239+
type: string
1240+
format: uint64
12331241
Signature:
12341242
description: A variable length signature.
12351243
type: string
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.71
1+
3.0.75

openapi/go-client-generated/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Class | Method | HTTP request | Description
3434
*NodeVersionInfoApi* | [**NodeVersionInfoGet**](docs/NodeVersionInfoApi.md#nodeversioninfoget) | **Get** /node_version_info | Get Node Version Information
3535
*ScriptsApi* | [**ScriptsPost**](docs/ScriptsApi.md#scriptspost) | **Post** /scripts | Execute a Cadence Script
3636
*SubscribeEventsApi* | [**SubscribeEventsGet**](docs/SubscribeEventsApi.md#subscribeeventsget) | **Get** /subscribe_events | Subscribe events
37-
*TransactionsApi* | [**TransactionResultsTransactionIdGet**](docs/TransactionsApi.md#transactionresultstransactionidget) | **Get** /transaction_results/{transaction_id} | Get a Transaction Result by ID.
37+
*TransactionsApi* | [**TransactionResultsTransactionIdGet**](docs/TransactionsApi.md#transactionresultstransactionidget) | **Get** /transaction_results/{transaction_id} | Get a Transaction Result by transaction ID or scheduled transaction ID.
3838
*TransactionsApi* | [**TransactionsIdGet**](docs/TransactionsApi.md#transactionsidget) | **Get** /transactions/{id} | Get a Transaction by ID.
3939
*TransactionsApi* | [**TransactionsPost**](docs/TransactionsApi.md#transactionspost) | **Post** /transactions | Submit a Transaction
4040

@@ -62,6 +62,7 @@ Class | Method | HTTP request | Description
6262
- [ExecutionResult](docs/ExecutionResult.md)
6363
- [ExecutorMetadata](docs/ExecutorMetadata.md)
6464
- [HashingAlgorithm](docs/HashingAlgorithm.md)
65+
- [Id](docs/Id.md)
6566
- [InlineResponse200](docs/InlineResponse200.md)
6667
- [Links](docs/Links.md)
6768
- [Metadata](docs/Metadata.md)
@@ -75,6 +76,7 @@ Class | Method | HTTP request | Description
7576
- [Transaction](docs/Transaction.md)
7677
- [TransactionExecution](docs/TransactionExecution.md)
7778
- [TransactionExpandable](docs/TransactionExpandable.md)
79+
- [TransactionId](docs/TransactionId.md)
7880
- [TransactionResult](docs/TransactionResult.md)
7981
- [TransactionSignature](docs/TransactionSignature.md)
8082
- [TransactionStatus](docs/TransactionStatus.md)

openapi/go-client-generated/api/swagger.yaml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,19 @@ paths:
249249
tags:
250250
- Transactions
251251
summary: Get a Transaction by ID.
252-
description: Get a transaction data by the provided transaction ID.
252+
description: "Get a transaction data by the provided transaction ID. If the\
253+
\ transaction is a scheduled transaction, it can alternatively be retrieved\
254+
\ by the scheduled transaction ID field returned by the system contract."
253255
parameters:
254256
- name: id
255257
in: path
256-
description: The ID of the transaction to get.
258+
description: "The ID of the transaction, or id field of the scheduled transaction\
259+
\ returned by the system contract."
257260
required: true
258261
style: simple
259262
explode: false
260263
schema:
261-
$ref: "#/components/schemas/Identifier"
264+
$ref: "#/components/schemas/id"
262265
- name: block_id
263266
in: query
264267
description: A block ID optional parameter
@@ -330,17 +333,21 @@ paths:
330333
get:
331334
tags:
332335
- Transactions
333-
summary: Get a Transaction Result by ID.
334-
description: Get transaction result by the transaction result ID.
336+
summary: Get a Transaction Result by transaction ID or scheduled transaction
337+
ID.
338+
description: "Get transaction result by the transaction's ID. If the transaction\
339+
\ is a scheduled transaction, it can alternatively be retrieved by the scheduled\
340+
\ transaction ID field returned by the system contract."
335341
parameters:
336342
- name: transaction_id
337343
in: path
338-
description: The transaction ID of the transaction result.
344+
description: "The transaction ID of the transaction result, or id field of\
345+
\ the scheduled transaction returned by the system contract."
339346
required: true
340347
style: simple
341348
explode: false
342349
schema:
343-
$ref: "#/components/schemas/Identifier"
350+
$ref: "#/components/schemas/transaction_id"
344351
- name: block_id
345352
in: query
346353
description: A block ID optional parameter
@@ -2327,6 +2334,10 @@ components:
23272334
type: string
23282335
description: A 32-byte unique identifier for an entity.
23292336
format: hexadecimal
2337+
ScheduledTransactionId:
2338+
type: string
2339+
description: The ID of a scheduled transaction.
2340+
format: uint64
23302341
Signature:
23312342
type: string
23322343
description: A variable length signature.
@@ -2480,6 +2491,14 @@ components:
24802491
event_index: event_index
24812492
BlockId: BlockId
24822493
Height: Height
2494+
id:
2495+
oneOf:
2496+
- $ref: "#/components/schemas/Identifier"
2497+
- $ref: "#/components/schemas/ScheduledTransactionId"
2498+
transaction_id:
2499+
oneOf:
2500+
- $ref: "#/components/schemas/Identifier"
2501+
- $ref: "#/components/schemas/ScheduledTransactionId"
24832502
transactions_body:
24842503
required:
24852504
- arguments

openapi/go-client-generated/api_transactions.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ var (
2626

2727
type TransactionsApiService service
2828
/*
29-
TransactionsApiService Get a Transaction Result by ID.
30-
Get transaction result by the transaction result ID.
29+
TransactionsApiService Get a Transaction Result by transaction ID or scheduled transaction ID.
30+
Get transaction result by the transaction's ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
3131
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
32-
* @param transactionId The transaction ID of the transaction result.
32+
* @param transactionId The transaction ID of the transaction result, or id field of the scheduled transaction returned by the system contract.
3333
* @param optional nil or *TransactionsApiTransactionResultsTransactionIdGetOpts - Optional Parameters:
3434
* @param "BlockId" (optional.Interface of string) - A block ID optional parameter
3535
* @param "CollectionId" (optional.Interface of string) - A collection ID optional parameter.
@@ -51,7 +51,7 @@ type TransactionsApiTransactionResultsTransactionIdGetOpts struct {
5151
IncludeExecutorMetadata optional.Bool
5252
}
5353

54-
func (a *TransactionsApiService) TransactionResultsTransactionIdGet(ctx context.Context, transactionId string, localVarOptionals *TransactionsApiTransactionResultsTransactionIdGetOpts) (TransactionResult, *http.Response, error) {
54+
func (a *TransactionsApiService) TransactionResultsTransactionIdGet(ctx context.Context, transactionId TransactionId, localVarOptionals *TransactionsApiTransactionResultsTransactionIdGetOpts) (TransactionResult, *http.Response, error) {
5555
var (
5656
localVarHttpMethod = strings.ToUpper("Get")
5757
localVarPostBody interface{}
@@ -182,9 +182,9 @@ func (a *TransactionsApiService) TransactionResultsTransactionIdGet(ctx context.
182182
}
183183
/*
184184
TransactionsApiService Get a Transaction by ID.
185-
Get a transaction data by the provided transaction ID.
185+
Get a transaction data by the provided transaction ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
186186
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
187-
* @param id The ID of the transaction to get.
187+
* @param id The ID of the transaction, or id field of the scheduled transaction returned by the system contract.
188188
* @param optional nil or *TransactionsApiTransactionsIdGetOpts - Optional Parameters:
189189
* @param "BlockId" (optional.Interface of string) - A block ID optional parameter
190190
* @param "CollectionId" (optional.Interface of string) - A collection ID optional parameter.
@@ -200,7 +200,7 @@ type TransactionsApiTransactionsIdGetOpts struct {
200200
Select_ optional.Interface
201201
}
202202

203-
func (a *TransactionsApiService) TransactionsIdGet(ctx context.Context, id string, localVarOptionals *TransactionsApiTransactionsIdGetOpts) (Transaction, *http.Response, error) {
203+
func (a *TransactionsApiService) TransactionsIdGet(ctx context.Context, id Id, localVarOptionals *TransactionsApiTransactionsIdGetOpts) (Transaction, *http.Response, error) {
204204
var (
205205
localVarHttpMethod = strings.ToUpper("Get")
206206
localVarPostBody interface{}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Id
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
7+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# TransactionId
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
7+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
8+

openapi/go-client-generated/docs/TransactionsApi.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ All URIs are relative to *https://rest-testnet.onflow.org/v1*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7-
[**TransactionResultsTransactionIdGet**](TransactionsApi.md#TransactionResultsTransactionIdGet) | **Get** /transaction_results/{transaction_id} | Get a Transaction Result by ID.
7+
[**TransactionResultsTransactionIdGet**](TransactionsApi.md#TransactionResultsTransactionIdGet) | **Get** /transaction_results/{transaction_id} | Get a Transaction Result by transaction ID or scheduled transaction ID.
88
[**TransactionsIdGet**](TransactionsApi.md#TransactionsIdGet) | **Get** /transactions/{id} | Get a Transaction by ID.
99
[**TransactionsPost**](TransactionsApi.md#TransactionsPost) | **Post** /transactions | Submit a Transaction
1010

1111
# **TransactionResultsTransactionIdGet**
1212
> TransactionResult TransactionResultsTransactionIdGet(ctx, transactionId, optional)
13-
Get a Transaction Result by ID.
13+
Get a Transaction Result by transaction ID or scheduled transaction ID.
1414

15-
Get transaction result by the transaction result ID.
15+
Get transaction result by the transaction's ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
1616

1717
### Required Parameters
1818

1919
Name | Type | Description | Notes
2020
------------- | ------------- | ------------- | -------------
2121
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
22-
**transactionId** | [**string**](.md)| The transaction ID of the transaction result. |
22+
**transactionId** | [**TransactionId**](.md)| The transaction ID of the transaction result, or id field of the scheduled transaction returned by the system contract. |
2323
**optional** | ***TransactionsApiTransactionResultsTransactionIdGetOpts** | optional parameters | nil if no parameters
2424

2525
### Optional Parameters
@@ -54,14 +54,14 @@ No authorization required
5454
> Transaction TransactionsIdGet(ctx, id, optional)
5555
Get a Transaction by ID.
5656

57-
Get a transaction data by the provided transaction ID.
57+
Get a transaction data by the provided transaction ID. If the transaction is a scheduled transaction, it can alternatively be retrieved by the scheduled transaction ID field returned by the system contract.
5858

5959
### Required Parameters
6060

6161
Name | Type | Description | Notes
6262
------------- | ------------- | ------------- | -------------
6363
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
64-
**id** | [**string**](.md)| The ID of the transaction to get. |
64+
**id** | [**Id**](.md)| The ID of the transaction, or id field of the scheduled transaction returned by the system contract. |
6565
**optional** | ***TransactionsApiTransactionsIdGetOpts** | optional parameters | nil if no parameters
6666

6767
### Optional Parameters
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Access API
3+
*
4+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5+
*
6+
* API version: 1.0.0
7+
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
8+
*/
9+
package swagger
10+
11+
type Id struct {
12+
Identifier
13+
ScheduledTransactionId
14+
}

0 commit comments

Comments
 (0)