Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 376dd54

Browse files
authored
Merge branch 'main' into main
2 parents e7d254e + 4043a5e commit 376dd54

File tree

6 files changed

+172
-13
lines changed

6 files changed

+172
-13
lines changed

apps/nextra/pages/en/build/guides/_meta.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default {
3737
"sponsored-transactions": {
3838
title: "Sponsored Transactions",
3939
},
40+
"orderless-transactions": {
41+
title: "Orderless Transactions",
42+
},
4043
"transaction-management": {
4144
title: "Transaction Management",
4245
},
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Orderless Transactions
2+
3+
As outlined
4+
in [AIP-123](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-123.md),
5+
orderless transactions allow for transactions to be executed out of order, which
6+
is particularly useful in scenarios where multiple machines need to sign for a
7+
single sending account, but the order in which they sign does not affect the
8+
outcome of the transaction or matter to the creator. Replay is protected by a
9+
nonce, which is a unique identifier for a transaction. This allows for the
10+
transaction to be executed at any time within the expiration time, regardless of
11+
the order in which the machines sign the transaction, but not be able to be
12+
replayed after the nonce has expired. The maximum expiration time is 60 seconds
13+
for orderless transactions, which is not the same for sequence number
14+
transactions.
15+
16+
## Process Overview
17+
18+
Orderless transactions are dependent on the transaction payload specified in
19+
[AIP-129](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-129.md).
20+
The process for building and executing an orderless transaction is as follows:
21+
22+
1. Build a transaction with a `replayProtectionNonce` and a `TransactionPayload::TransactionPayloadPayload` that defines the operation to be executed.
23+
2. Sign and submit the transaction as any other transaction, but with the
24+
`replayProtectionNonce` set. Ideally, the nonce should be a random u64 value.
25+
26+
Note, that the behavior of the `replayProtectionNonce` is similar to a sequence
27+
number, but it does not guarantee ordered execution of transactions. Instead, it
28+
ensures that the transaction is unique and cannot be replayed (executed twice)
29+
with the same nonce.
30+
31+
## SDK Support
32+
33+
These are demonstrations of sponsored transactions:
34+
35+
- The [TypeScript SDK](../sdks/ts-sdk/building-transactions/orderless-transactions.mdx) has documentation
36+
- The [Go SDK](https://github.com/aptos-labs/aptos-go-sdk/tree/main/examples/orderless_transaction) has an example

apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ Building and sending transactions on-chain involves the following 5 steps:
200200

201201
Transactions have a couple of additional features which let them adapt to your needs which you can learn about here:
202202

203-
1. [Multi-Agent Signatures](building-transactions/multi-agent-transactions.mdx) - Allowing multiple accounts to be used for a single contract.
204-
2. [Sponsoring Transactions](building-transactions/sponsoring-transactions.mdx) - Have another account pay gas fees for this transaction.
205-
3. [Batch Submit Transactions](building-transactions/batching-transactions.mdx) - How to send multiple transactions quickly from a single account.
206-
4. [Binary Canonical Serialization (BCS)](building-transactions/bcs-format.mdx) - The format used to serialize data for Aptos transactions.
207-
5. [Composing multiple Move calls with ScriptComposer](building-transactions/script-composer.mdx) - (Experimental) Building more complex transaction payload that calls into multiple Move functions dynamically.
203+
1. [Multi-Agent Transactions](building-transactions/multi-agent-transactions.mdx) - Allowing multiple accounts to interact with a single transaction.
204+
2. [Orderless Transactions](building-transactions/orderless-transactions.mdx) - Allowing for transactions to be executed out of order for easier management.
205+
3. [Sponsoring Transactions](building-transactions/sponsoring-transactions.mdx) - Have another account pay gas fees for this transaction.
206+
4. [Batch Submit Transactions](building-transactions/batching-transactions.mdx) - How to send multiple transactions quickly from a single account.
207+
5. [Binary Canonical Serialization (BCS)](building-transactions/bcs-format.mdx) - The format used to serialize data for Aptos transactions.
208+
7. [Composing multiple Move calls with ScriptComposer](building-transactions/script-composer.mdx) - (Experimental) Building more complex transaction payload that calls into multiple Move functions dynamically.

apps/nextra/pages/en/build/sdks/ts-sdk/building-transactions/_meta.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ export default {
55
"multi-agent-transactions": {
66
title: "Multi-Agent Transactions",
77
},
8+
"orderless-transactions": {
9+
title: "Orderless Transactions",
10+
},
811
"sponsoring-transactions": {
912
title: "Sponsoring Transactions",
1013
},
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: "Orderless Transactions"
3+
---
4+
5+
import { Callout } from 'nextra/components'
6+
7+
# Orderless Transactions
8+
9+
Orderless transactions allow you to create transactions that do not specify a
10+
order of execution between them. This is particularly useful
11+
in scenarios where multiple machines need to sign a transaction, but the order
12+
in which they sign does not affect the outcome of the transaction or matter to
13+
the creator.
14+
15+
## Building Orderless Transactions
16+
17+
Creating and executing a multi-agent transaction follows a similar flow to the
18+
[simple transaction flow](../building-transactions.mdx), and the
19+
[multi-agent transaction flow](./multi-agent-transactions.mdx).
20+
21+
<Callout type="info">
22+
Instead of providing a `sequenceNumber` (or no sequence number at all), a
23+
`Replay Protection Nonce` is used to ensure that the transaction is unique and
24+
cannot be replayed (i.e., executed multiple times with the same nonce).
25+
</Callout>
26+
27+
For example, to create a single signer transaction that uses orderless transactions,
28+
specify the `nonce` in the `build.simple` method like so:
29+
30+
```ts filename="build-a-transaction.ts"
31+
const transaction = await aptos.transaction.build.simple({
32+
sender: sender.accountAddress,
33+
data: {
34+
// All transactions on Aptos are implemented via smart contracts.
35+
function: "0x1::aptos_account::transfer",
36+
functionArguments: [destination.accountAddress, 100],
37+
},
38+
options: {
39+
replayProtectionNonce: 12345, // This is the nonce that will be used to ensure the transaction is unique.
40+
}
41+
});
42+
```
43+
44+
Similarly, if you are building a multi-agent transaction, you can specify the
45+
`replayProtectionNonce` in the `build.multiAgent` method:
46+
47+
```ts filename="build-a-transaction.ts"
48+
const transaction = await aptos.transaction.build.multiAgent({
49+
sender: sender.accountAddress,
50+
secondarySignerAddresses: [bob.accountAddress], // List of secondary signers
51+
data: {
52+
// All transactions on Aptos are implemented via smart contracts.
53+
function: "0x1::aptos_account::transfer",
54+
functionArguments: [destination.accountAddress, 100],
55+
},
56+
options: {
57+
replayProtectionNonce: 12345, // This is the nonce that will be used to ensure the transaction is unique.
58+
}
59+
});
60+
```
61+
62+
And the same if you are building a sponsored transaction, you can specify the
63+
`replayProtectionNonce` in the `build.multiAgent` method:
64+
```ts filename="build-a-transaction.ts"
65+
const transaction = await aptos.transaction.build.multiAgent({
66+
sender: sender.accountAddress,
67+
withFeePayer: true, // This indicates that the transaction will be sponsored.
68+
data: {
69+
// All transactions on Aptos are implemented via smart contracts.
70+
function: "0x1::aptos_account::transfer",
71+
functionArguments: [destination.accountAddress, 100],
72+
},
73+
options: {
74+
replayProtectionNonce: 12345, // This is the nonce that will be used to ensure the transaction is unique.
75+
}
76+
});
77+
```
78+
79+
<Callout type="info">
80+
For orderless transactions, the `replayProtectionNonce` must be unique for
81+
each transaction. Additionally, the expiration time of the transaction is
82+
maximum 60 seconds from the time it is submitted. If the transaction is not
83+
executed within that time, it will be considered expired and will not be
84+
executed.
85+
</Callout>
86+
87+
After that, simply follow the same steps as you would for a simple transaction:
88+
1. [**Simulate** the transaction (optional)](./simulating-transactions).
89+
2. **Sign** the transaction.
90+
3. **Submit** the transaction to the network.
91+
4. **Wait** for the transaction to be executed.
92+
93+
### Examples
94+
95+
* [TS SDK Example](https://github.com/aptos-labs/aptos-ts-sdk/blob/main/examples/typescript/simple_orderless_transfer.ts)

apps/nextra/pages/en/build/sdks/wallet-adapter.mdx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,45 @@ title: "Wallet Adapter"
44

55
# Wallet Adapter
66

7-
The Aptos Wallet Adapter provides a single interface for Aptos dapps and Aptos wallets to communicate with each other.
7+
There are two wallet adapter standards in the Aptos ecosystem:
88

9-
For app developers, this means that you can connect to an ever-growing list of Aptos wallets with a single integration. As new wallets enter the ecosystem and integrate with the Wallet Adapter, you can support them simply by updating your Wallet Adapter version.
9+
1. [Aptos Wallet Adapter](#aptos-wallet-adapter) by Aptos Labs
10+
2. [OKX Connect](#okx-connect) by OKX
1011

11-
For Aptos wallet providers, integrating with the Wallet Adapter allows you to be supported on a wide range of Aptos apps.
12+
## Aptos Wallet Adapter
1213

13-
## For Aptos Dapps
14+
The Aptos Wallet Adapter by Aptos Labs provides a single interface for Aptos
15+
dapps and Aptos wallets to communicate with each other.
1416

15-
Follow the [Wallet Adapter for Dapp Builders Guide](./wallet-adapter/dapp.mdx) on how to use the Wallet Adapter (via the [Wallet Adapter React package](https://github.com/aptos-labs/aptos-wallet-adapter/tree/main/packages/wallet-adapter-react)).
17+
For dapp developers, this means that you can connect to any Aptos wallet that is
18+
integrated with the Wallet Adapter without needing to write custom code for each
19+
wallet. This is described in [AIP-62](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-62.md),
20+
which defines the Modern Wallet Standard and autodetection of wallets.
1621

17-
## For Aptos Wallet Providers
22+
For Aptos wallet providers, integrating with AIP-62 means that your wallet will
23+
be compatible with any dapp that uses the Wallet Adapter.
1824

19-
Follow one of these guides for how to implement a Wallet Adapter plugin that dapps can connect to:
25+
### For Aptos Dapps
26+
27+
Follow the [Wallet Adapter for Dapp Builders Guide](./wallet-adapter/dapp.mdx) on how to use the
28+
Wallet Adapter (via the [Wallet Adapter React package](https://github.com/aptos-labs/aptos-wallet-adapter/tree/main/packages/wallet-adapter-react)).
29+
30+
### For Aptos Wallet Providers
31+
32+
Follow one of these guides for how to implement a Wallet Adapter plugin that
33+
dapps can connect to:
2034

2135
1. For [Browser Extension Wallets](./wallet-adapter/browser-extension-wallets.mdx) (ex. [Petra](https://chromewebstore.google.com/detail/petra-aptos-wallet/ejjladinnckdgjemekebdpeokbikhfci?hl=en))
2236
2. For [SDK Wallets](./wallet-adapter/wallets.mdx) (ex. [AptosConnect](https://aptosconnect.app))
2337

24-
## Reference Material
38+
## OKX Connect
39+
40+
The OKX Connect adapter provides an interface for Aptos dapps to connect to OKX
41+
wallet and other wallets that support the OKX Connect standard. You can find
42+
more information about OKX Connect for Aptos dapps in the [OKX Connect documentation](https://web3.okx.com/build/dev-docs/sdks/app-connect-aptos)
43+
44+
45+
## Other Resources
2546

2647
- [Dapp Builder Guide](./wallet-adapter/dapp.mdx)
2748
- [Wallet Browser Extension Guide](./wallet-adapter/browser-extension-wallets.mdx)

0 commit comments

Comments
 (0)