Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Multisig V2][API] Fix the API error for Multisig V2 #12445

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion api/doc/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -13366,7 +13366,32 @@
},
"MultisigTransactionPayload": {
"type": "object",
"anyOf": [
"oneOf": [
{
"$ref": "#/components/schemas/MultisigTransactionPayload_EntryFunctionPayload"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"entry_function_payload": "#/components/schemas/MultisigTransactionPayload_EntryFunctionPayload"
}
}
},
"MultisigTransactionPayload_EntryFunctionPayload": {
"allOf": [
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"example": "entry_function_payload"
}
}
},
{
"$ref": "#/components/schemas/EntryFunctionPayload"
}
Expand Down
16 changes: 15 additions & 1 deletion api/doc/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10072,7 +10072,21 @@ components:
$ref: '#/components/schemas/MultisigTransactionPayload'
MultisigTransactionPayload:
type: object
anyOf:
oneOf:
- $ref: '#/components/schemas/MultisigTransactionPayload_EntryFunctionPayload'
discriminator:
propertyName: type
mapping:
entry_function_payload: '#/components/schemas/MultisigTransactionPayload_EntryFunctionPayload'
MultisigTransactionPayload_EntryFunctionPayload:
allOf:
- type: object
required:
- type
properties:
type:
type: string
example: entry_function_payload
- $ref: '#/components/schemas/EntryFunctionPayload'
PendingTransaction:
type: object
Expand Down
2 changes: 2 additions & 0 deletions api/test-context/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ impl TestContext {
"type": "multisig_payload",
"multisig_address": multisig_account.to_hex_literal(),
"transaction_payload": {
"type": "entry_function_payload",
"function": function,
"type_arguments": type_args,
"arguments": args
Expand Down Expand Up @@ -822,6 +823,7 @@ impl TestContext {
"type": "multisig_payload",
"multisig_address": multisig_account.to_hex_literal(),
"transaction_payload": {
"type": "entry_function_payload",
"function": function,
"type_arguments": type_args,
"arguments": args
Expand Down
4 changes: 4 additions & 0 deletions api/types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ impl TryFrom<Script> for ScriptPayload {
// We use an enum here for extensibility so we can add Script payload support
// in the future for example.
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Union)]
#[serde(tag = "type", rename_all = "snake_case")]
#[oai(one_of, discriminator_name = "type", rename_all = "snake_case")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@banool , does this line for oai look good to you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks good.

pub enum MultisigTransactionPayload {
EntryFunctionPayload(EntryFunctionPayload),
}
Comment on lines 742 to 747
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this affect the indexer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bowenyang007 , @larry-aptos , we are making this change for the correct (de)serialization of simulation API results. Do you think this would affect the indexer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this affects indexer, we have our own layer to convert the API types into proto types and this doesn't leverage the JSON representation of the types from serde.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the clarification!

Expand All @@ -751,6 +753,8 @@ pub struct MultisigPayload {
pub multisig_address: Address,

// Transaction payload is optional if already stored on chain.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub transaction_payload: Option<MultisigTransactionPayload>,
}

Expand Down
1 change: 1 addition & 0 deletions ecosystem/typescript/sdk/src/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export type { MultiEd25519Signature } from './models/MultiEd25519Signature';
export type { MultiKeySignature } from './models/MultiKeySignature';
export type { MultisigPayload } from './models/MultisigPayload';
export type { MultisigTransactionPayload } from './models/MultisigTransactionPayload';
export type { MultisigTransactionPayload_EntryFunctionPayload } from './models/MultisigTransactionPayload_EntryFunctionPayload';
export type { PendingTransaction } from './models/PendingTransaction';
export type { PublicKey } from './models/PublicKey';
export type { PublicKey_string_HexEncodedBytes_ } from './models/PublicKey_string_HexEncodedBytes_';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import type { EntryFunctionPayload } from './EntryFunctionPayload';
import type { MultisigTransactionPayload_EntryFunctionPayload } from './MultisigTransactionPayload_EntryFunctionPayload';

export type MultisigTransactionPayload = EntryFunctionPayload;
export type MultisigTransactionPayload = MultisigTransactionPayload_EntryFunctionPayload;

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { EntryFunctionPayload } from './EntryFunctionPayload';

export type MultisigTransactionPayload_EntryFunctionPayload = ({
type: string;
} & EntryFunctionPayload);

Loading