Use Case
When working with multisig transactions on Aptos, we often need to encode an EntryPayload as a parameter for another transaction. A common example is using aptos_framework::multisig_account::create_transaction, which expects its payload parameter as either a string, number[], or Uint8Array.
Currently, there's no built-in way to serialize an EntryPayload to these formats, making it difficult to compose nested transactions while maintaining type safety.
Example code demonstrating the current limitation:
// Create the inner transaction payload
const innerPayload = createEntryPayload(SOME_ABI, {
function: 'some_function',
functionArguments: [...],
typeArguments: [...]
});
// Try to use it in a multisig transaction
// This fails because EntryPayload can't be used as an argument
const multisigPayload = createEntryPayload(MULTISIG_ACCOUNT_ABI, {
function: 'create_transaction',
functionArguments: [multisigAddress, innerPayload], // Type error!
});
Proposed Solution
Add methods to serialize EntryPayload objects into formats compatible with Aptos transactions. For example:
// Potential API:
const innerPayload = createEntryPayload(...)
const serialized = serializeEntryPayload(innerPayload);
// or
const serialized = innerPayload.serialize();
// Now works with multisig transactions
const multisigPayload = createEntryPayload(MULTISIG_ACCOUNT_ABI, {
function: 'create_transaction',
functionArguments: [multisigAddress, serialized],
});
Benefits
- Enables type-safe composition of nested transactions
- Maintains surf's strong typing benefits when working with complex transaction patterns
- Particularly useful for multisig operations, governance proposals, and other scenarios requiring transaction wrapping
Additional Context
This functionality would be especially valuable for projects working with:
- Multisig accounts
- Governance systems
- Delayed execution systems
- Any pattern requiring transaction composition
Would be happy to provide additional use cases or contribute to the implementation if helpful.
Use Case
When working with multisig transactions on Aptos, we often need to encode an
EntryPayloadas a parameter for another transaction. A common example is usingaptos_framework::multisig_account::create_transaction, which expects its payload parameter as either astring,number[], orUint8Array.Currently, there's no built-in way to serialize an
EntryPayloadto these formats, making it difficult to compose nested transactions while maintaining type safety.Example code demonstrating the current limitation:
Proposed Solution
Add methods to serialize
EntryPayloadobjects into formats compatible with Aptos transactions. For example:Benefits
Additional Context
This functionality would be especially valuable for projects working with:
Would be happy to provide additional use cases or contribute to the implementation if helpful.