Skip to content

Commit

Permalink
[sdk] deprecate requestType option in SDK (MystenLabs#18854)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
hayes-mysten authored Jul 31, 2024
1 parent c9a6d67 commit 0851b31
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 20 deletions.
6 changes: 6 additions & 0 deletions .changeset/beige-windows-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@mysten/wallet-standard': minor
'@mysten/sui': minor
---

Deprecate requestType option when executing transactions
14 changes: 11 additions & 3 deletions sdk/typescript/scripts/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const options: {
{
alias?: string;
typeAlias?: string;
deprecated?: string;
}
>;
}
Expand Down Expand Up @@ -173,6 +174,9 @@ const options: {
alias: 'signature',
typeAlias: 'string | string[]',
},
requestType: {
deprecated: 'requestType will be ignored by JSON RPC in the future',
},
},
},
suix_queryEvents: {
Expand All @@ -190,7 +194,7 @@ const options: {
},
tx_bytes: {
alias: 'transactionBlock',
typeAlias: 'TransactionBlock | Uint8Array | string',
typeAlias: 'Transaction | Uint8Array | string',
},
gas_price: {
typeAlias: 'bigint | number',
Expand Down Expand Up @@ -339,7 +343,7 @@ methodGenerator.imports.push(
ts.factory.createImportSpecifier(
false,
undefined,
ts.factory.createIdentifier('TransactionBlock'),
ts.factory.createIdentifier('Transaction'),
),
]),
),
Expand All @@ -364,8 +368,12 @@ async function createMethodParams(method: OpenRpcMethod) {
return !methodOptions.flattenParams?.includes(param.name);
})
.map(async (param) => {
const paramOptions =
methodOptions.params?.[normalizeParamName(method.name, param.name)] ?? {};
return withDescription(
param,
paramOptions.deprecated
? { description: `@deprecated ${paramOptions.deprecated}` }
: param,
ts.factory.createPropertySignature(
undefined,
normalizeParamName(method.name, param.name),
Expand Down
66 changes: 55 additions & 11 deletions sdk/typescript/src/client/types/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export type CompressedSignature =
| {
ZkLogin: string;
};
/** Uses an enum to allow for future expansion of the ConsensusDeterminedVersionAssignments. */
export type ConsensusDeterminedVersionAssignments = {
CancelledTransactions: [string, [string, string][]][];
};
export type SuiParsedData =
| {
dataType: 'moveObject';
Expand Down Expand Up @@ -356,13 +360,6 @@ export type InputObjectKind =
mutable?: boolean;
};
};
export interface LoadedChildObject {
objectId: string;
sequenceNumber: string;
}
export interface LoadedChildObjectsResponse {
loadedChildObjects: LoadedChildObject[];
}
export interface MoveCallParams {
arguments: unknown[];
function: string;
Expand Down Expand Up @@ -396,7 +393,15 @@ export type MoveValue =
id: string;
}
| MoveStruct
| null;
| null
| MoveVariant;
export interface MoveVariant {
fields: {
[key: string]: MoveValue;
};
type: string;
variant: string;
}
/** The struct that contains signatures and public keys necessary for authenticating a MultiSig. */
export interface MultiSig {
/** A bitmap that indicates the position of which public key the signature should be authenticated with. */
Expand All @@ -410,8 +415,8 @@ export interface MultiSig {
sigs: CompressedSignature[];
}
/**
* Deprecated, use [struct MultiSig] instead. The struct that contains signatures and public keys
* necessary for authenticating a MultiSigLegacy.
* Deprecated, use [struct MultiSig] instead. The struct that contains signatures and public keys necessary
* for authenticating a MultiSigLegacy.
*/
export interface MultiSigLegacy {
/** A bitmap that indicates the position of which public key the signature should be authenticated with. */
Expand Down Expand Up @@ -715,6 +720,24 @@ export interface PaginatedTransactionResponse {
hasNextPage: boolean;
nextCursor?: string | null;
}
/**
* An passkey authenticator with parsed fields. See field defition below. Can be initialized from
* [struct RawPasskeyAuthenticator].
*/
export interface PasskeyAuthenticator {
/**
* `authenticatorData` is a bytearray that encodes
* [Authenticator Data](https://www.w3.org/TR/webauthn-2/#sctn-authenticator-data) structure returned
* by the authenticator attestation response as is.
*/
authenticator_data: number[];
/**
* `clientDataJSON` contains a JSON-compatible UTF-8 encoded string of the client data which is passed
* to the authenticator by the client during the authentication request (see
* [CollectedClientData](https://www.w3.org/TR/webauthn-2/#dictdef-collectedclientdata))
*/
client_data_json: string;
}
export interface ProtocolConfig {
attributes: {
[key: string]: ProtocolConfigValue | null;
Expand All @@ -738,6 +761,9 @@ export type ProtocolConfigValue =
}
| {
f64: string;
}
| {
bool: string;
};
export type PublicKey =
| {
Expand All @@ -751,6 +777,9 @@ export type PublicKey =
}
| {
ZkLogin: string;
}
| {
Passkey: string;
};
export type RPCTransactionRequestParams =
| {
Expand Down Expand Up @@ -895,6 +924,12 @@ export type SuiEndOfEpochTransactionKind =
}
| {
AuthenticatorStateExpire: SuiAuthenticatorStateExpire;
}
| {
BridgeStateCreate: string;
}
| {
BridgeCommitteeUpdate: string;
};
export interface SuiExecutionResult {
/** The value of any arguments that were mutably borrowed. Non-mut borrowed values are not included */
Expand Down Expand Up @@ -1375,6 +1410,15 @@ export type SuiTransactionBlockKind =
epoch: string;
kind: 'ConsensusCommitPrologueV2';
round: string;
}
| {
commit_timestamp_ms: string;
consensus_commit_digest: string;
consensus_determined_version_assignments: ConsensusDeterminedVersionAssignments;
epoch: string;
kind: 'ConsensusCommitPrologueV3';
round: string;
sub_dag_index?: string | null;
};
export interface SuiTransactionBlockResponse {
balanceChanges?: BalanceChange[] | null;
Expand Down Expand Up @@ -1468,9 +1512,9 @@ export interface TransferObjectParams {
}
/** Identifies a struct and the module it was defined in */
export interface TypeOrigin {
datatype_name: string;
module_name: string;
package: string;
struct_name: string;
}
/** Upgraded package info for the linkage table */
export interface UpgradeInfo {
Expand Down
5 changes: 1 addition & 4 deletions sdk/typescript/src/client/types/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface ExecuteTransactionBlockParams {
signature: string | string[];
/** options for specifying the content to be returned */
options?: RpcTypes.SuiTransactionBlockResponseOptions | null | undefined;
/** The request type, derived from `SuiTransactionBlockResponseOptions` if None */
/** @deprecated requestType will be ignored by JSON RPC in the future */
requestType?: RpcTypes.ExecuteTransactionRequestType | null | undefined;
}
/** Return the first four bytes of the chain's genesis checkpoint digest. */
Expand Down Expand Up @@ -85,9 +85,6 @@ export interface GetEventsParams {
}
/** Return the sequence number of the latest checkpoint that has been executed */
export interface GetLatestCheckpointSequenceNumberParams {}
export interface GetLoadedChildObjectsParams {
digest: string;
}
/** Return the argument types of a Move function, based on normalized Type. */
export interface GetMoveFunctionArgTypesParams {
package: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export type SuiSignAndExecuteTransactionBlockMethod = (
/** Input for signing and sending transactions. */
export interface SuiSignAndExecuteTransactionBlockInput extends SuiSignTransactionBlockInput {
/**
* `WaitForEffectsCert` or `WaitForLocalExecution`, see details in `ExecuteTransactionRequestType`.
* Defaults to `WaitForLocalExecution` if options.showEffects or options.showEvents is true
* @deprecated requestType will be ignored by JSON RPC in the future
*/
requestType?: ExecuteTransactionRequestType;
/** specify which fields to return (e.g., transaction, effects, events, etc). By default, only the transaction digest will be returned. */
Expand Down

0 comments on commit 0851b31

Please sign in to comment.