@mysten/docs 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +24 -0
  2. package/dist/bcs/index.md +358 -0
  3. package/dist/bcs/llms-index.md +4 -0
  4. package/dist/codegen/index.md +441 -0
  5. package/dist/codegen/llms-index.md +4 -0
  6. package/dist/dapp-kit/actions/connect-wallet.md +69 -0
  7. package/dist/dapp-kit/actions/disconnect-wallet.md +38 -0
  8. package/dist/dapp-kit/actions/sign-and-execute-transaction.md +96 -0
  9. package/dist/dapp-kit/actions/sign-personal-message.md +58 -0
  10. package/dist/dapp-kit/actions/sign-transaction.md +65 -0
  11. package/dist/dapp-kit/actions/switch-account.md +37 -0
  12. package/dist/dapp-kit/actions/switch-network.md +37 -0
  13. package/dist/dapp-kit/dapp-kit-instance.md +162 -0
  14. package/dist/dapp-kit/getting-started/create-dapp.md +151 -0
  15. package/dist/dapp-kit/getting-started/next-js.md +162 -0
  16. package/dist/dapp-kit/getting-started/react.md +172 -0
  17. package/dist/dapp-kit/getting-started/vue.md +193 -0
  18. package/dist/dapp-kit/index.md +70 -0
  19. package/dist/dapp-kit/llms-index.md +26 -0
  20. package/dist/dapp-kit/react/components/connect-button.md +42 -0
  21. package/dist/dapp-kit/react/components/connect-modal.md +51 -0
  22. package/dist/dapp-kit/react/components/index.md +13 -0
  23. package/dist/dapp-kit/react/dapp-kit-provider.md +86 -0
  24. package/dist/dapp-kit/react/hooks/index.md +25 -0
  25. package/dist/dapp-kit/react/hooks/use-current-account.md +33 -0
  26. package/dist/dapp-kit/react/hooks/use-current-client.md +36 -0
  27. package/dist/dapp-kit/react/hooks/use-current-network.md +28 -0
  28. package/dist/dapp-kit/react/hooks/use-current-wallet.md +36 -0
  29. package/dist/dapp-kit/react/hooks/use-dapp-kit.md +100 -0
  30. package/dist/dapp-kit/react/hooks/use-wallet-connection.md +48 -0
  31. package/dist/dapp-kit/react/hooks/use-wallets.md +33 -0
  32. package/dist/dapp-kit/state.md +169 -0
  33. package/dist/dapp-kit/theming.md +196 -0
  34. package/dist/dapp-kit/web-components/connect-button.md +89 -0
  35. package/dist/dapp-kit/web-components/connect-modal.md +177 -0
  36. package/dist/kiosk/advanced-examples.md +101 -0
  37. package/dist/kiosk/from-v1.md +320 -0
  38. package/dist/kiosk/index.md +22 -0
  39. package/dist/kiosk/kiosk-client/introduction.md +52 -0
  40. package/dist/kiosk/kiosk-client/kiosk-transaction/examples.md +119 -0
  41. package/dist/kiosk/kiosk-client/kiosk-transaction/kiosk-transaction.md +103 -0
  42. package/dist/kiosk/kiosk-client/kiosk-transaction/managing.md +235 -0
  43. package/dist/kiosk/kiosk-client/kiosk-transaction/purchasing.md +110 -0
  44. package/dist/kiosk/kiosk-client/querying.md +237 -0
  45. package/dist/kiosk/kiosk-client/transfer-policy-transaction/introduction.md +79 -0
  46. package/dist/kiosk/kiosk-client/transfer-policy-transaction/using-the-manager.md +115 -0
  47. package/dist/kiosk/llms-index.md +8 -0
  48. package/dist/llms-index.md +125 -0
  49. package/dist/payment-kit/getting-started.md +256 -0
  50. package/dist/payment-kit/index.md +132 -0
  51. package/dist/payment-kit/llms-index.md +8 -0
  52. package/dist/payment-kit/payment-kit-sdk.md +747 -0
  53. package/dist/payment-kit/payment-processing.md +372 -0
  54. package/dist/payment-kit/registry-management.md +529 -0
  55. package/dist/seal/index.md +85 -0
  56. package/dist/seal/llms-index.md +4 -0
  57. package/dist/slush-wallet/dapp.md +95 -0
  58. package/dist/slush-wallet/deep-linking.md +465 -0
  59. package/dist/slush-wallet/index.md +7 -0
  60. package/dist/slush-wallet/llms-index.md +6 -0
  61. package/dist/sui/bcs.md +134 -0
  62. package/dist/sui/clients/core.md +606 -0
  63. package/dist/sui/clients/graphql.md +101 -0
  64. package/dist/sui/clients/grpc.md +155 -0
  65. package/dist/sui/clients/index.md +95 -0
  66. package/dist/sui/clients/json-rpc.md +239 -0
  67. package/dist/sui/cryptography/keypairs.md +267 -0
  68. package/dist/sui/cryptography/multisig.md +194 -0
  69. package/dist/sui/cryptography/passkey.md +111 -0
  70. package/dist/sui/cryptography/webcrypto-signer.md +81 -0
  71. package/dist/sui/executors.md +148 -0
  72. package/dist/sui/faucet.md +26 -0
  73. package/dist/sui/hello-sui.md +115 -0
  74. package/dist/sui/index.md +53 -0
  75. package/dist/sui/install.md +61 -0
  76. package/dist/sui/llm-docs.md +32 -0
  77. package/dist/sui/llms-index.md +44 -0
  78. package/dist/sui/migrations/0.38.md +58 -0
  79. package/dist/sui/migrations/sui-1.0.md +455 -0
  80. package/dist/sui/migrations/sui-2.0/agent-prompt.md +42 -0
  81. package/dist/sui/migrations/sui-2.0/dapp-kit.md +350 -0
  82. package/dist/sui/migrations/sui-2.0/deepbook-v3.md +33 -0
  83. package/dist/sui/migrations/sui-2.0/index.md +158 -0
  84. package/dist/sui/migrations/sui-2.0/json-rpc-migration.md +386 -0
  85. package/dist/sui/migrations/sui-2.0/kiosk.md +120 -0
  86. package/dist/sui/migrations/sui-2.0/sdk-maintainers.md +90 -0
  87. package/dist/sui/migrations/sui-2.0/seal.md +14 -0
  88. package/dist/sui/migrations/sui-2.0/sui.md +341 -0
  89. package/dist/sui/migrations/sui-2.0/suins.md +43 -0
  90. package/dist/sui/migrations/sui-2.0/wallet-builders.md +66 -0
  91. package/dist/sui/migrations/sui-2.0/walrus.md +41 -0
  92. package/dist/sui/migrations/sui-2.0/zksend.md +95 -0
  93. package/dist/sui/plugins.md +258 -0
  94. package/dist/sui/sdk-building.md +344 -0
  95. package/dist/sui/transaction-building/basics.md +299 -0
  96. package/dist/sui/transaction-building/gas.md +62 -0
  97. package/dist/sui/transaction-building/intents.md +62 -0
  98. package/dist/sui/transaction-building/offline.md +73 -0
  99. package/dist/sui/transaction-building/sponsored-transactions.md +22 -0
  100. package/dist/sui/utils/derived_objects.md +59 -0
  101. package/dist/sui/utils/index.md +52 -0
  102. package/dist/sui/zklogin.md +83 -0
  103. package/dist/walrus/index.md +527 -0
  104. package/dist/walrus/llms-index.md +4 -0
  105. package/dist/zksend/index.md +27 -0
  106. package/dist/zksend/link-builder.md +192 -0
  107. package/dist/zksend/llms-index.md +5 -0
  108. package/package.json +66 -0
@@ -0,0 +1,155 @@
1
+ # SuiGrpcClient
2
+
3
+ > Connect to Sui via gRPC with SuiGrpcClient
4
+
5
+ The `SuiGrpcClient` provides access to the Full Node gRPC API.
6
+
7
+ For more complete details on what is available through this API see the
8
+ [gRPC API docs](https://docs.sui.io/concepts/data-access/grpc-overview).
9
+
10
+ ## Creating a gRPC client
11
+
12
+ To get started, create a `SuiGrpcClient` instance by specifying a network and base URL:
13
+
14
+ ```typescript
15
+
16
+ const grpcClient = new SuiGrpcClient({
17
+ network: 'testnet',
18
+ baseUrl: 'https://fullnode.testnet.sui.io:443',
19
+ });
20
+ ```
21
+
22
+ For local development:
23
+
24
+ ```typescript
25
+ const grpcClient = new SuiGrpcClient({
26
+ network: 'localnet',
27
+ baseUrl: 'http://127.0.0.1:9000',
28
+ });
29
+ ```
30
+
31
+ You can also provide a custom transport for advanced use cases:
32
+
33
+ ```typescript
34
+
35
+ const transport = new GrpcWebFetchTransport({
36
+ baseUrl: 'https://your-custom-grpc-endpoint.com',
37
+ // Additional transport options
38
+ });
39
+
40
+ const grpcClient = new SuiGrpcClient({
41
+ network: 'testnet',
42
+ transport,
43
+ });
44
+ ```
45
+
46
+ ## Using service clients
47
+
48
+ The `SuiGrpcClient` exposes several service clients for lower-level access to the gRPC API. These
49
+ service clients are generated using [protobuf-ts](https://github.com/timostamm/protobuf-ts), which
50
+ provides type-safe gRPC clients for TypeScript. For more details on how to use gRPC with Sui, see
51
+ the [gRPC overview](https://docs.sui.io/concepts/data-access/grpc-overview).
52
+
53
+ ### With the core API
54
+
55
+ The gRPC client implements all the [`core`](./core) API methods:
56
+
57
+ ```typescript
58
+
59
+ const grpcClient = new SuiGrpcClient({
60
+ network: 'testnet',
61
+ baseUrl: 'https://fullnode.testnet.sui.io:443',
62
+ });
63
+ // Get coins owned by an address
64
+ await grpcClient.getCoins({
65
+ owner: '<OWNER_ADDRESS>',
66
+ });
67
+ ```
68
+
69
+ To query additional data not available in the core API, you can use the service clients directly:
70
+
71
+ ### Transaction Execution Service
72
+
73
+ ```typescript
74
+ const { response } = await grpcClient.transactionExecutionService.executeTransaction({
75
+ transaction: {
76
+ bcs: {
77
+ value: transactionBytes,
78
+ },
79
+ },
80
+ signatures: signatures.map((sig) => ({
81
+ bcs: { value: fromBase64(sig) },
82
+ signature: { oneofKind: undefined },
83
+ })),
84
+ });
85
+
86
+ // IMPORTANT: Always check the transaction status
87
+ if (!response.finality?.effects?.status?.success) {
88
+ const error = response.finality?.effects?.status?.error;
89
+ throw new Error(`Transaction failed: ${error || 'Unknown error'}`);
90
+ }
91
+ ```
92
+
93
+ ### Ledger Service
94
+
95
+ ```typescript
96
+ // Get transaction by digest
97
+ const { response } = await grpcClient.ledgerService.getTransaction({
98
+ digest: '0x123...',
99
+ });
100
+
101
+ // Get current epoch information
102
+ const { response: epochInfo } = await grpcClient.ledgerService.getEpoch({});
103
+ ```
104
+
105
+ ### State Service
106
+
107
+ ```typescript
108
+ // List owned objects
109
+ const { response } = await grpcClient.stateService.listOwnedObjects({
110
+ owner: '0xabc...',
111
+ objectType: '0x2::coin::Coin<0x2::sui::SUI>',
112
+ });
113
+
114
+ // Get dynamic fields
115
+ const { response: fields } = await grpcClient.stateService.listDynamicFields({
116
+ parent: '0x123...',
117
+ });
118
+ ```
119
+
120
+ ### Move Package Service
121
+
122
+ ```typescript
123
+ // Get function information
124
+ const { response } = await grpcClient.movePackageService.getFunction({
125
+ packageId: '0x2',
126
+ moduleName: 'coin',
127
+ name: 'transfer',
128
+ });
129
+ ```
130
+
131
+ ### Name Service
132
+
133
+ ```typescript
134
+ // Reverse lookup address to get name
135
+ const { response } = await grpcClient.nameService.reverseLookupName({
136
+ address: '0xabc...',
137
+ });
138
+ ```
139
+
140
+ ### Signature Verification Service
141
+
142
+ ```typescript
143
+ // Verify a signature
144
+ const { response } = await grpcClient.signatureVerificationService.verifySignature({
145
+ message: {
146
+ name: 'TransactionData',
147
+ value: messageBytes,
148
+ },
149
+ signature: {
150
+ bcs: { value: signatureBytes },
151
+ signature: { oneofKind: undefined },
152
+ },
153
+ jwks: [],
154
+ });
155
+ ```
@@ -0,0 +1,95 @@
1
+ # Sui Clients
2
+
3
+ > Choose and configure gRPC, GraphQL, or JSON-RPC clients
4
+
5
+ The Sui TypeScript SDK provides multiple client implementations for interacting with the Sui
6
+ network. Each client connects to a different API but provides two levels of access:
7
+
8
+ - **Native API** - Full access to everything the underlying API offers
9
+ - **[Core API](/sui/clients/core)** - A consistent interface across all clients for common
10
+ operations
11
+
12
+ ## Available Clients
13
+
14
+ | Client | API |
15
+ | ------------------------------------------------------ | ------------------------------------------------------------------ |
16
+ | [SuiGrpcClient](/sui/clients/grpc) (recommended) | [Full Node gRPC](https://docs.sui.io/references/fullnode-protocol) |
17
+ | [SuiGraphQLClient](/sui/clients/graphql) | [GraphQL](https://docs.sui.io/references/sui-graphql) |
18
+ | [SuiJsonRpcClient](/sui/clients/json-rpc) (deprecated) | [JSON-RPC (deprecated)](https://docs.sui.io/sui-api-ref) |
19
+
20
+ All clients are compatible with Mysten SDKs like `@mysten/walrus`, `@mysten/seal` and
21
+ `@mysten/suins`.
22
+
23
+ For most application gRPC is a good default. The JSON RPC API has been deprecated and will be
24
+ decommissioned soon. The GraphQL can be used for more advanced query patterns that can not be
25
+ supported directly on full nodes (eg, querying for transactions or events with various filters).
26
+
27
+ ## Quick Start
28
+
29
+ ```typescript
30
+
31
+ const client = new SuiGrpcClient({
32
+ network: 'mainnet',
33
+ baseUrl: 'https://fullnode.mainnet.sui.io:443',
34
+ });
35
+
36
+ // Use the native API for full access to transport-specific features
37
+ const { response } = await client.ledgerService.getTransaction({ digest: '0x...' });
38
+
39
+ // Use the Core API for transport-agnostic operations
40
+ const { object } = await client.core.getObject({ objectId: '0x...' });
41
+ ```
42
+
43
+ ## Native vs Core API
44
+
45
+ ### Native API
46
+
47
+ Each client exposes the full capabilities of its underlying transport. Use the native API when you
48
+ need transport-specific features or want maximum control:
49
+
50
+ ```typescript
51
+
52
+ // gRPC - access various service clients to call any gRPC method
53
+ const { response } = await grpcClient.stateService.listOwnedObjects({ owner: '0x...' });
54
+
55
+ // GraphQL - write type-safe custom queries using the graphql function
56
+ const result = await graphqlClient.query({
57
+ query: graphql(`
58
+ query {
59
+ chainIdentifier
60
+ }
61
+ `),
62
+ });
63
+
64
+ // JSON-RPC - call any JSON-RPC method
65
+ const coins = await jsonRpcClient.getCoins({ owner: '0x...' });
66
+ ```
67
+
68
+ ### Core API
69
+
70
+ All clients also implement the [Core API](/sui/clients/core) through `client.core`. This provides a
71
+ consistent interface for common operations that works identically across all transports:
72
+
73
+ ```typescript
74
+ // These methods work the same on any client
75
+ const { object } = await client.core.getObject({ objectId: '0x...' });
76
+ const balance = await client.core.getBalance({ owner: '0x...' });
77
+ await client.core.executeTransaction({ transaction, signatures });
78
+ ```
79
+
80
+ The Core API is essential for [building SDKs](/sui/sdk-building) that work with any client the user
81
+ chooses.
82
+
83
+ ## Client Extensions
84
+
85
+ All clients support extensions through the `$extend` method, enabling SDKs like
86
+ [@mysten/walrus](https://www.npmjs.com/package/@mysten/walrus) to add functionality:
87
+
88
+ ```typescript
89
+
90
+ const client = new SuiGrpcClient({ network: 'mainnet', baseUrl: '...' }).$extend(walrus());
91
+
92
+ await client.walrus.writeBlob({ ... });
93
+ ```
94
+
95
+ See [Building SDKs](/sui/sdk-building) for more on creating client extensions.
@@ -0,0 +1,239 @@
1
+ # SuiJsonRpcClient
2
+
3
+ > Connect to Sui via JSON-RPC with SuiJsonRpcClient
4
+
5
+ > **Warning:** The Sui JSON-RPC API has been deprecated. We recommend migration to
6
+ > [SuiGrpcClient](/sui/clients/grpc) or [SuiGraphQLClient](/sui/clients/graphql) as soon as
7
+ > possible.
8
+
9
+ The `SuiJsonRpcClient` connects to a Sui network's JSON-RPC server. It implements the
10
+ [Core API](/sui/clients/core), so it can be used with any SDK that accepts `ClientWithCoreApi`.
11
+
12
+ ```typescript
13
+
14
+ const client = new SuiJsonRpcClient({
15
+ url: getJsonRpcFullnodeUrl('mainnet'),
16
+ network: 'mainnet',
17
+ });
18
+
19
+ // Use the Core API
20
+ const { object } = await client.core.getObject({ objectId: '0x...' });
21
+ ```
22
+
23
+ ## Connecting to a Sui network
24
+
25
+ To establish a connection to a network, import `SuiJsonRpcClient` from `@mysten/sui/client` and pass
26
+ the relevant URL to the `url` parameter. The following example establishes a connection to Devnet
27
+ and get all `Coin<coin_type>` objects owned by an address.
28
+
29
+ ```typescript
30
+
31
+ // use getJsonRpcFullnodeUrl to define Devnet RPC location
32
+ const rpcUrl = getJsonRpcFullnodeUrl('devnet');
33
+
34
+ // create a client connected to devnet
35
+ const client = new SuiJsonRpcClient({ url: rpcUrl, network: 'devnet' });
36
+
37
+ // get coins owned by an address
38
+ // replace <OWNER_ADDRESS> with actual address in the form of 0x123...
39
+ await client.getCoins({
40
+ owner: '<OWNER_ADDRESS>',
41
+ });
42
+ ```
43
+
44
+ Network URLs:
45
+
46
+ - `localnet`: `http://127.0.0.1:9000`
47
+ - `devnet`: `https://fullnode.devnet.sui.io:443`
48
+ - `testnet`: `https://fullnode.testnet.sui.io:443`
49
+
50
+ For local development, you can run `cargo run --bin sui -- start --with-faucet --force-regenesis` to
51
+ spin up a local network with a local validator, a Full node, and a faucet server. Refer to
52
+ [the Local Network guide](https://docs.sui.io/guides/developer/getting-started/local-network) for
53
+ more information.
54
+
55
+ ## Manually calling unsupported RPC methods
56
+
57
+ You can use `SuiJsonRpcClient` to call any RPC method the node you're connecting to exposes. Most
58
+ RPC methods are built into `SuiJsonRpcClient`, but you can use `call` to leverage any methods
59
+ available in the RPC.
60
+
61
+ ```typescript
62
+
63
+ const client = new SuiJsonRpcClient({
64
+ url: 'https://fullnode.devnet.sui.io:443',
65
+ });
66
+ // asynchronously call suix_getCommitteeInfo
67
+ const committeeInfo = await client.call('suix_getCommitteeInfo', []);
68
+ ```
69
+
70
+ For a full list of available RPC methods, see the
71
+ [RPC documentation](https://docs.sui.io/references/sui-api).
72
+
73
+ ## Customizing the transport
74
+
75
+ The `SuiJsonRpcClient` uses a `Transport` class to manage connections to the RPC node. The default
76
+ `SuiHTTPTransport` (alias for `JsonRpcHTTPTransport`) makes both JSON RPC requests, as well as
77
+ websocket requests for subscriptions. You can construct a custom transport instance if you need to
78
+ pass any custom options, such as headers or timeout values.
79
+
80
+ ```typescript
81
+
82
+ const client = new SuiJsonRpcClient({
83
+ transport: new JsonRpcHTTPTransport({
84
+ url: 'https://fullnode.devnet.sui.io:443',
85
+ websocket: {
86
+ reconnectTimeout: 1000,
87
+ url: 'wss://fullnode.devnet.sui.io:443',
88
+ },
89
+ rpc: {
90
+ headers: {
91
+ 'x-custom-header': 'custom value',
92
+ },
93
+ },
94
+ }),
95
+ });
96
+ ```
97
+
98
+ ## Pagination
99
+
100
+ `SuiJsonRpcClient` exposes a number of RPC methods that return paginated results. These methods
101
+ return a result object with 3 fields:
102
+
103
+ - data: The list of results for the current page
104
+ - nextCursor: a cursor pointing to the next page of results
105
+ - hasNextPage: a boolean indicating whether there are more pages of results
106
+
107
+ Some APIs also accept an `order` option that can be set to either `ascending` or `descending` to
108
+ change the order in which the results are returned.
109
+
110
+ You can pass the `nextCursor` to the `cursor` option of the RPC method to retrieve the next page,
111
+ along with a `limit` to specify the page size:
112
+
113
+ ```ts
114
+ const page1 = await client.getCheckpoints({
115
+ descendingOrder: false,
116
+ limit: 10,
117
+ });
118
+
119
+ const page2 =
120
+ page1.hasNextPage &&
121
+ (await client.getCheckpoints({
122
+ descendingOrder: false,
123
+ cursor: page1.nextCursor,
124
+ limit: 10,
125
+ }));
126
+ ```
127
+
128
+ ## Methods
129
+
130
+ In addition to the RPC methods mentioned above, `SuiJsonRpcClient` also exposes some methods for
131
+ working with Transactions.
132
+
133
+ ### `executeTransactionBlock`
134
+
135
+ ```tsx
136
+ const tx = new Transaction();
137
+
138
+ // add transaction data to tx...
139
+
140
+ const { bytes, signature } = await tx.sign({ client, signer: keypair });
141
+
142
+ const result = await client.executeTransactionBlock({
143
+ transactionBlock: bytes,
144
+ signature,
145
+ options: {
146
+ showEffects: true,
147
+ },
148
+ });
149
+ ```
150
+
151
+ #### Arguments
152
+
153
+ - `transactionBlock` - either a Transaction or BCS serialized transaction data bytes as a Uint8Array
154
+ or as a base-64 encoded string.
155
+ - `signature` - A signature, or list of signatures committed to the intent message of the
156
+ transaction data, as a base-64 encoded string.
157
+ - `options`:
158
+ - `showBalanceChanges`: Whether to show balance_changes. Default to be False
159
+ - `showEffects`: Whether to show transaction effects. Default to be False
160
+ - `showEvents`: Whether to show transaction events. Default to be False
161
+ - `showInput`: Whether to show transaction input data. Default to be False
162
+ - `showObjectChanges`: Whether to show object_changes. Default to be False
163
+ - `showRawInput`: Whether to show bcs-encoded transaction input data
164
+
165
+ ### `signAndExecuteTransaction`
166
+
167
+ ```tsx
168
+ const tx = new Transaction();
169
+
170
+ // add transaction data to tx...
171
+
172
+ const result = await client.signAndExecuteTransaction({
173
+ transaction: tx,
174
+ signer: keypair,
175
+ options: {
176
+ showEffects: true,
177
+ },
178
+ });
179
+
180
+ // IMPORTANT: Always check the transaction status
181
+ if (result.$kind === 'FailedTransaction') {
182
+ throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
183
+ }
184
+ ```
185
+
186
+ #### Arguments
187
+
188
+ - `transaction` - BCS serialized transaction data bytes as a Uint8Array or as a base-64 encoded
189
+ string.
190
+ - `signer` - A `Keypair` instance to sign the transaction
191
+ - `options`:
192
+ - `showBalanceChanges`: Whether to show balance_changes. Default to be False
193
+ - `showEffects`: Whether to show transaction effects. Default to be False
194
+ - `showEvents`: Whether to show transaction events. Default to be False
195
+ - `showInput`: Whether to show transaction input data. Default to be False
196
+ - `showObjectChanges`: Whether to show object_changes. Default to be False
197
+ - `showRawInput`: Whether to show bcs-encoded transaction input data
198
+
199
+ ### `waitForTransaction`
200
+
201
+ Wait for a transaction result to be available over the API. This can be used in conjunction with
202
+ `signAndExecuteTransaction` to wait for the transaction to be available via the API. This currently
203
+ polls the `getTransactionBlock` API to check for the transaction.
204
+
205
+ ```tsx
206
+ const tx = new Transaction();
207
+
208
+ const result = await client.signAndExecuteTransaction({
209
+ transaction: tx,
210
+ signer: keypair,
211
+ });
212
+
213
+ // Check transaction status
214
+ if (result.$kind === 'FailedTransaction') {
215
+ throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
216
+ }
217
+
218
+ const transaction = await client.waitForTransaction({
219
+ digest: result.Transaction.digest,
220
+ options: {
221
+ showEffects: true,
222
+ },
223
+ });
224
+ ```
225
+
226
+ #### Arguments
227
+
228
+ - `digest` - the digest of the queried transaction
229
+ - `signal` - An optional abort signal that can be used to cancel the request
230
+ - `timeout` - The amount of time to wait for a transaction. Defaults to one minute.
231
+ - `pollInterval` - The amount of time to wait between checks for the transaction. Defaults to 2
232
+ seconds.
233
+ - `options`:
234
+ - `showBalanceChanges`: Whether to show balance_changes. Default to be False
235
+ - `showEffects`: Whether to show transaction effects. Default to be False
236
+ - `showEvents`: Whether to show transaction events. Default to be False
237
+ - `showInput`: Whether to show transaction input data. Default to be False
238
+ - `showObjectChanges`: Whether to show object_changes. Default to be False
239
+ - `showRawInput`: Whether to show bcs-encoded transaction input data