Skip to content

Commit

Permalink
feat(client-managedblockchain-query): This release adds support for t…
Browse files Browse the repository at this point in the history
…ransactions that have not reached finality. It also removes support for the status property from the response of the GetTransaction operation. You can use the confirmationStatus and executionStatus properties to determine the status of the transaction.
  • Loading branch information
awstools committed Feb 1, 2024
1 parent ad41dca commit 97bb566
Show file tree
Hide file tree
Showing 8 changed files with 2,685 additions and 2,633 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface BatchGetTokenBalanceCommandOutput extends BatchGetTokenBalanceO
* <p>Gets the token balance for a batch of tokens by using the <code>BatchGetTokenBalance</code>
* action for every token in the request.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface GetTokenBalanceCommandOutput extends GetTokenBalanceOutput, __M
* @public
* <p>Gets the balance of a specific token, including native tokens, for a given address (wallet or contract) on the blockchain.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export interface GetTransactionCommandOutput extends GetTransactionOutput, __Met

/**
* @public
* <p>Get the details of a transaction.</p>
* <p>Gets the details of a transaction.</p>
* <note>
* <p>This action will return transaction details for all transactions
* that are <i>confirmed</i> on the blockchain, even if they have not reached
* <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ambq-dg/key-concepts.html#finality">finality</a>.
* </p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -54,7 +60,6 @@ export interface GetTransactionCommandOutput extends GetTransactionOutput, __Met
* // transactionTimestamp: new Date("TIMESTAMP"), // required
* // transactionIndex: Number("long"), // required
* // numberOfTransactions: Number("long"), // required
* // status: "STRING_VALUE",
* // to: "STRING_VALUE", // required
* // from: "STRING_VALUE",
* // contractAddress: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export interface ListTransactionEventsCommandOutput extends ListTransactionEvent
* @public
* <p>An array of <code>TransactionEvent</code> objects. Each object contains details
* about the transaction event.</p>
* <note>
* <p>This action will return transaction details for all transactions
* that are <i>confirmed</i> on the blockchain, even if they have not reached
* <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ambq-dg/key-concepts.html#finality">finality</a>.
* </p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export interface ListTransactionsCommandOutput extends ListTransactionsOutput, _
* },
* nextToken: "STRING_VALUE",
* maxResults: Number("int"),
* confirmationStatusFilter: { // ConfirmationStatusFilter
* include: [ // ConfirmationStatusIncludeList // required
* "STRING_VALUE",
* ],
* },
* };
* const command = new ListTransactionsCommand(input);
* const response = await client.send(command);
Expand All @@ -63,6 +68,7 @@ export interface ListTransactionsCommandOutput extends ListTransactionsOutput, _
* // transactionHash: "STRING_VALUE", // required
* // network: "STRING_VALUE", // required
* // transactionTimestamp: new Date("TIMESTAMP"), // required
* // confirmationStatus: "STRING_VALUE",
* // },
* // ],
* // nextToken: "STRING_VALUE",
Expand Down
116 changes: 64 additions & 52 deletions clients/client-managedblockchain-query/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export interface OwnerIdentifier {
* @public
* <p>The container for the identifier for the token including the unique token ID and its blockchain network.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
*/
Expand All @@ -162,8 +162,8 @@ export interface TokenIdentifier {
* @public
* <p>The unique identifier of the token.</p>
* <note>
* <p>You must specify this container with <code>btc</code> for the native BTC token, and
* <code>eth</code> for the native ETH token. For all other token types you must
* <p>For native tokens, use the 3 character abbreviation that best matches your token.
* For example, btc for Bitcoin, eth for Ether, etc. For all other token types you must
* specify the <code>tokenId</code> in the 64 character hexadecimal <code>tokenid</code> format.</p>
* </note>
*/
Expand All @@ -179,7 +179,7 @@ export interface BatchGetTokenBalanceInputItem {
* @public
* <p>The container for the identifier for the token including the unique token ID and its blockchain network.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
*/
Expand Down Expand Up @@ -238,7 +238,7 @@ export interface BatchGetTokenBalanceErrorItem {
* @public
* <p>The container for the identifier for the token including the unique token ID and its blockchain network.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
*/
Expand Down Expand Up @@ -290,7 +290,7 @@ export interface BatchGetTokenBalanceOutputItem {
* @public
* <p>The container for the identifier for the token including the unique token ID and its blockchain network.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
*/
Expand Down Expand Up @@ -576,13 +576,31 @@ export class ValidationException extends __BaseException {
*/
export const ConfirmationStatus = {
FINAL: "FINAL",
NONFINAL: "NONFINAL",
} as const;

/**
* @public
*/
export type ConfirmationStatus = (typeof ConfirmationStatus)[keyof typeof ConfirmationStatus];

/**
* @public
* <p>The container for the <code>ConfirmationStatusFilter</code> that filters for the <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ambq-dg/key-concepts.html#finality">
* <i>finality</i>
* </a> of the results.</p>
*/
export interface ConfirmationStatusFilter {
/**
* @public
* <p>The container to determine whether to list results that have only reached <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ambq-dg/key-concepts.html#finality">
* <i>finality</i>
* </a>. Transactions
* that have reached finality are always part of the response.</p>
*/
include: ConfirmationStatus[] | undefined;
}

/**
* @public
* <p>The contract or wallet address by which to filter the request.</p>
Expand Down Expand Up @@ -727,7 +745,7 @@ export interface GetTokenBalanceOutput {
* @public
* <p>The container for the identifier for the token including the unique token ID and its blockchain network.</p>
* <note>
* <p>Only the native tokens BTC,ETH, and the ERC-20,
* <p>Only the native tokens BTC and ETH, and the ERC-20,
* ERC-721, and ERC 1155 token standards are supported.</p>
* </note>
*/
Expand Down Expand Up @@ -769,26 +787,6 @@ export interface GetTransactionInput {
network: QueryNetwork | undefined;
}

/**
* @public
* @enum
*/
export const QueryTransactionStatus = {
/**
* The transaction completed on the blockchain, but failed
*/
FAILED: "FAILED",
/**
* The transaction has been confirmed and is final in the blockchain
*/
FINAL: "FINAL",
} as const;

/**
* @public
*/
export type QueryTransactionStatus = (typeof QueryTransactionStatus)[keyof typeof QueryTransactionStatus];

/**
* @public
* <p>There are two possible types of transactions used for this data type:</p>
Expand Down Expand Up @@ -850,29 +848,6 @@ export interface Transaction {
*/
numberOfTransactions: number | undefined;

/**
* @public
* @deprecated
*
* <p>The status of the transaction.</p>
* <important>
* <p>This property is deprecated. You must use the <code>confirmationStatus</code>
* and the <code>executionStatus</code> properties to determine if the <code>status</code>
* of the transaction is <code>FINAL</code> or <code>FAILED</code>.</p>
* <ul>
* <li>
* <p>Transactions with a <code>status</code> of <code>FINAL</code> will now have the <code>confirmationStatus</code> set
* to <code>FINAL</code> and the <code>executionStatus</code> set to <code>SUCCEEDED</code>.</p>
* </li>
* <li>
* <p>Transactions with a <code>status</code> of <code>FAILED</code> will now have the <code>confirmationStatus</code> set
* to <code>FINAL</code> and the <code>executionStatus</code> set to <code>FAILED</code>.</p>
* </li>
* </ul>
* </important>
*/
status?: QueryTransactionStatus;

/**
* @public
* <p>The identifier of the transaction. It is generated whenever a transaction is verified and added to the blockchain.</p>
Expand Down Expand Up @@ -983,6 +958,15 @@ export interface ListAssetContractsInput {
/**
* @public
* <p>The maximum number of contracts to list.</p>
* <p>Default:<code>100</code>
* </p>
* <note>
* <p>Even if additional results can be retrieved, the request can return less
* results than <code>maxResults</code> or an empty array of results.</p>
* <p>To retrieve the next set of results, make another request with the
* returned <code>nextToken</code> value. The value of <code>nextToken</code> is
* <code>null</code> when there are no more results to return</p>
* </note>
*/
maxResults?: number;
}
Expand Down Expand Up @@ -1079,6 +1063,15 @@ export interface ListTokenBalancesInput {
/**
* @public
* <p>The maximum number of token balances to return.</p>
* <p>Default:<code>100</code>
* </p>
* <note>
* <p>Even if additional results can be retrieved, the request can return less
* results than <code>maxResults</code> or an empty array of results.</p>
* <p>To retrieve the next set of results, make another request with the
* returned <code>nextToken</code> value. The value of <code>nextToken</code> is
* <code>null</code> when there are no more results to return</p>
* </note>
*/
maxResults?: number;
}
Expand Down Expand Up @@ -1166,6 +1159,8 @@ export interface ListTransactionEventsInput {
/**
* @public
* <p>The maximum number of transaction events to list.</p>
* <p>Default:<code>100</code>
* </p>
* <note>
* <p>Even if additional results can be retrieved, the request can return less
* results than <code>maxResults</code> or an empty array of results.</p>
Expand Down Expand Up @@ -1405,8 +1400,8 @@ export interface ListTransactionsInput {

/**
* @public
* <p>Sorts items in an ascending order if the first page starts at <code>fromTime</code>.
* Sorts items in a descending order if the first page starts at <code>toTime</code>.</p>
* <p>The order by which the results will be sorted. If <code>ASCENNDING</code> is selected, the results
* will be ordered by <code>fromTime</code>. </p>
*/
sort?: ListTransactionsSort;

Expand All @@ -1419,6 +1414,8 @@ export interface ListTransactionsInput {
/**
* @public
* <p>The maximum number of transactions to list.</p>
* <p>Default:<code>100</code>
* </p>
* <note>
* <p>Even if additional results can be retrieved, the request can return less
* results than <code>maxResults</code> or an empty array of results.</p>
Expand All @@ -1428,6 +1425,15 @@ export interface ListTransactionsInput {
* </note>
*/
maxResults?: number;

/**
* @public
* <p>This filter is used to include transactions in the response that haven't reached <a href="https://docs.aws.amazon.com/managed-blockchain/latest/ambq-dg/key-concepts.html#finality">
* <i>finality</i>
* </a>. Transactions that have reached finiality are always
* part of the response.</p>
*/
confirmationStatusFilter?: ConfirmationStatusFilter;
}

/**
Expand All @@ -1452,6 +1458,12 @@ export interface TransactionOutputItem {
* <p>The time when the transaction occurred.</p>
*/
transactionTimestamp: Date | undefined;

/**
* @public
* <p>Specifies whether to list transactions that have not reached Finality.</p>
*/
confirmationStatus?: ConfirmationStatus;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
BatchGetTokenBalanceInputItem,
BatchGetTokenBalanceOutputItem,
BlockchainInstant,
ConfirmationStatus,
ConfirmationStatusFilter,
ContractFilter,
ContractIdentifier,
InternalServerException,
Expand Down Expand Up @@ -242,6 +244,7 @@ export const se_ListTransactionsCommand = async (
body = JSON.stringify(
take(input, {
address: [],
confirmationStatusFilter: (_) => _json(_),
fromBlockchainInstant: (_) => se_BlockchainInstant(_, context),
maxResults: [],
network: [],
Expand Down Expand Up @@ -899,6 +902,10 @@ const se_BlockchainInstant = (input: BlockchainInstant, context: __SerdeContext)
});
};

// se_ConfirmationStatusFilter omitted.

// se_ConfirmationStatusIncludeList omitted.

// se_ContractFilter omitted.

// se_ContractIdentifier omitted.
Expand Down Expand Up @@ -1040,7 +1047,6 @@ const de_Transaction = (output: any, context: __SerdeContext): Transaction => {
signatureR: __expectString,
signatureS: __expectString,
signatureV: __expectInt32,
status: __expectString,
to: __expectString,
transactionFee: __expectString,
transactionHash: __expectString,
Expand All @@ -1059,6 +1065,7 @@ const de_Transaction = (output: any, context: __SerdeContext): Transaction => {
*/
const de_TransactionOutputItem = (output: any, context: __SerdeContext): TransactionOutputItem => {
return take(output, {
confirmationStatus: __expectString,
network: __expectString,
transactionHash: __expectString,
transactionTimestamp: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
Expand Down
Loading

0 comments on commit 97bb566

Please sign in to comment.