@dynamic-labs-sdk/sui 1.18.0 → 1.19.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 (42) hide show
  1. package/dist/addSuiExtension/addSuiExtension.d.ts +10 -1
  2. package/dist/addSuiExtension/addSuiExtension.d.ts.map +1 -1
  3. package/dist/{addSuiWalletStandardExtension-C7zW0mYq.esm.js → addSuiWalletStandardExtension-CQOYtKK_.esm.js} +2 -2
  4. package/dist/{addSuiWalletStandardExtension-C7zW0mYq.esm.js.map → addSuiWalletStandardExtension-CQOYtKK_.esm.js.map} +1 -1
  5. package/dist/{addSuiWalletStandardExtension-DlnjZIlP.cjs → addSuiWalletStandardExtension-D-mo7IOV.cjs} +2 -2
  6. package/dist/{addSuiWalletStandardExtension-DlnjZIlP.cjs.map → addSuiWalletStandardExtension-D-mo7IOV.cjs.map} +1 -1
  7. package/dist/{addWaasSuiExtension-CQcDTwR9.esm.js → addWaasSuiExtension-3gXZX4UO.esm.js} +2 -2
  8. package/dist/{addWaasSuiExtension-CQcDTwR9.esm.js.map → addWaasSuiExtension-3gXZX4UO.esm.js.map} +1 -1
  9. package/dist/{addWaasSuiExtension-MlRpJdZQ.cjs → addWaasSuiExtension-C5HZiisx.cjs} +2 -2
  10. package/dist/{addWaasSuiExtension-MlRpJdZQ.cjs.map → addWaasSuiExtension-C5HZiisx.cjs.map} +1 -1
  11. package/dist/getSuiClient/getSuiClient.d.ts +10 -3
  12. package/dist/getSuiClient/getSuiClient.d.ts.map +1 -1
  13. package/dist/index.cjs +82 -20
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.esm.js +82 -20
  16. package/dist/index.esm.js.map +1 -1
  17. package/dist/isSuiNetworkProvider/isSuiNetworkProvider.d.ts +10 -1
  18. package/dist/isSuiNetworkProvider/isSuiNetworkProvider.d.ts.map +1 -1
  19. package/dist/isSuiWalletAccount/isSuiWalletAccount.d.ts +9 -1
  20. package/dist/isSuiWalletAccount/isSuiWalletAccount.d.ts.map +1 -1
  21. package/dist/signAndExecuteTransaction/signAndExecuteTransaction.d.ts +17 -5
  22. package/dist/signAndExecuteTransaction/signAndExecuteTransaction.d.ts.map +1 -1
  23. package/dist/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.d.ts +19 -9
  24. package/dist/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.d.ts.map +1 -1
  25. package/dist/signTransaction/signTransaction.d.ts +17 -5
  26. package/dist/signTransaction/signTransaction.d.ts.map +1 -1
  27. package/dist/signTransactionBlock/signTransactionBlock.d.ts +17 -6
  28. package/dist/signTransactionBlock/signTransactionBlock.d.ts.map +1 -1
  29. package/dist/{suiTransferAmount-D2kS-vB5.esm.js → suiTransferAmount-Cdq2tGeI.esm.js} +35 -8
  30. package/dist/suiTransferAmount-Cdq2tGeI.esm.js.map +1 -0
  31. package/dist/{suiTransferAmount-BRIUf5WC.cjs → suiTransferAmount-DnI1yPsS.cjs} +35 -8
  32. package/dist/suiTransferAmount-DnI1yPsS.cjs.map +1 -0
  33. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  34. package/dist/utils/getSuiTransactionHistory/getSuiTransactionHistory.d.ts +11 -0
  35. package/dist/utils/getSuiTransactionHistory/getSuiTransactionHistory.d.ts.map +1 -1
  36. package/dist/waas.cjs +2 -2
  37. package/dist/waas.esm.js +2 -2
  38. package/dist/walletStandard.cjs +2 -2
  39. package/dist/walletStandard.esm.js +2 -2
  40. package/package.json +4 -4
  41. package/dist/suiTransferAmount-BRIUf5WC.cjs.map +0 -1
  42. package/dist/suiTransferAmount-D2kS-vB5.esm.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as isSuiWalletAccount, c as NotSuiProviderError, d as version, n as signAndExecuteTransaction, o as getSuiClient, s as isSuiWalletProvider, u as name } from "./suiTransferAmount-D2kS-vB5.esm.js";
2
- import { t as addWaasSuiExtension } from "./addWaasSuiExtension-CQcDTwR9.esm.js";
3
- import { t as addSuiWalletStandardExtension } from "./addSuiWalletStandardExtension-C7zW0mYq.esm.js";
1
+ import { a as isSuiWalletAccount, c as NotSuiProviderError, d as version, n as signAndExecuteTransaction, o as getSuiClient, s as isSuiWalletProvider, u as name } from "./suiTransferAmount-Cdq2tGeI.esm.js";
2
+ import { t as addWaasSuiExtension } from "./addWaasSuiExtension-3gXZX4UO.esm.js";
3
+ import { t as addSuiWalletStandardExtension } from "./addSuiWalletStandardExtension-CQOYtKK_.esm.js";
4
4
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
5
5
  import { MethodNotImplementedError, getDefaultClient, getWalletProviderFromWalletAccount } from "@dynamic-labs-sdk/client/core";
6
6
  import { InvalidParamError, getDefaultClient as getDefaultClient$1, getTransactionHistory } from "@dynamic-labs-sdk/client";
@@ -13,7 +13,16 @@ import { InvalidParamError, getDefaultClient as getDefaultClient$1, getTransacti
13
13
  * and the Dynamic WaaS Sui extension, enabling support for all Sui wallet types
14
14
  * including standard wallets and embedded wallets managed by Dynamic's infrastructure.
15
15
  *
16
+ * @example
17
+ * ```ts
18
+ * const client = createDynamicClient({ environmentId: 'env-123' });
19
+ * addSuiExtension(client);
20
+ * ```
21
+ *
16
22
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
23
+ * @returns void
24
+ * @see isSuiWalletAccount
25
+ * @see isSuiNetworkProvider
17
26
  * @notInstrumented
18
27
  */
19
28
  const addSuiExtension = (client = getDefaultClient()) => {
@@ -27,12 +36,23 @@ const addSuiExtension = (client = getDefaultClient()) => {
27
36
  * Retrieves transaction history for a SUI wallet account.
28
37
  * Delegates to the Dynamic backend API; returns a normalized WalletTransactionsResponse.
29
38
  *
39
+ * @example
40
+ * ```ts
41
+ * const history = await getSuiTransactionHistory({
42
+ * walletAccount: suiAccount,
43
+ * networkId: 501,
44
+ * });
45
+ * ```
46
+ *
30
47
  * @param params.walletAccount - The SUI wallet account to query.
31
48
  * @param params.networkId - The SUI network ID (501=mainnet, 502=testnet, 503=devnet).
32
49
  * @param [params.limit] - Max transactions to return.
33
50
  * @param [params.offset] - Pagination cursor from a previous response's nextOffset.
34
51
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
35
52
  * @returns A promise that resolves to the transaction history for the given SUI wallet account.
53
+ * @throws {InvalidParamError} If the wallet account is not a SUI wallet account.
54
+ * @see isSuiWalletAccount
55
+ * @see getSuiClient
36
56
  * @notInstrumented
37
57
  */
38
58
  const getSuiTransactionHistory = async ({ walletAccount, networkId, limit, offset }, client = getDefaultClient()) => {
@@ -51,8 +71,17 @@ const getSuiTransactionHistory = async ({ walletAccount, networkId, limit, offse
51
71
  /**
52
72
  * Type guard function to check if a network provider is a Sui network provider.
53
73
  *
74
+ * @example
75
+ * ```ts
76
+ * if (isSuiNetworkProvider(networkProvider)) {
77
+ * const suiClient = networkProvider.getSuiClient();
78
+ * }
79
+ * ```
80
+ *
54
81
  * @param networkProvider - The network provider to check.
55
82
  * @returns True if the network provider is a Sui network provider, false otherwise.
83
+ * @see isSuiWalletAccount
84
+ * @see addSuiExtension
56
85
  * @notInstrumented
57
86
  */
58
87
  const isSuiNetworkProvider = (networkProvider) => networkProvider.chain === "SUI";
@@ -60,17 +89,27 @@ const isSuiNetworkProvider = (networkProvider) => networkProvider.chain === "SUI
60
89
  //#endregion
61
90
  //#region src/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.ts
62
91
  /**
63
- * @deprecated Use signAndExecuteTransaction instead
92
+ * Signs and executes a Sui transaction block.
93
+ *
94
+ * @deprecated Use signAndExecuteTransaction instead.
64
95
  *
65
- * Signs and executes a Sui transaction block
96
+ * @example
97
+ * ```ts
98
+ * const result = await signAndExecuteTransactionBlock({
99
+ * walletAccount: suiAccount,
100
+ * transactionBlock: txBlock,
101
+ * });
102
+ * ```
66
103
  *
67
- * @param params.transactionBlock - The transaction block to sign and execute
68
- * @param params.walletAccount - The wallet account to sign the transaction with
69
- * @param [params.options] - The fields to return in the execution response (e.g., transaction, effects, events, etc).
70
- * By default, only the transaction digest will be returned.
71
- * @param [params.requestType] - The request type to use for the transaction execution
104
+ * @param params.transactionBlock - The transaction block to sign and execute.
105
+ * @param params.walletAccount - The wallet account to sign the transaction with.
106
+ * @param [params.options] - The fields to return in the execution response.
107
+ * @param [params.requestType] - The request type to use for the transaction execution.
72
108
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
73
- * @returns An object containing signature result
109
+ * @returns An object containing signature result.
110
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
111
+ * @see signAndExecuteTransaction
112
+ * @see signTransactionBlock
74
113
  * @notInstrumented
75
114
  */
76
115
  const signAndExecuteTransactionBlock = async ({ walletAccount, transactionBlock, options, requestType }, client = getDefaultClient$1()) => {
@@ -89,11 +128,23 @@ const signAndExecuteTransactionBlock = async ({ walletAccount, transactionBlock,
89
128
  //#endregion
90
129
  //#region src/signTransaction/signTransaction.ts
91
130
  /**
92
- * Signs a Sui transaction
93
- * @param params.transaction - The transaction to sign
94
- * @param params.walletAccount - The wallet account to sign the transaction with
131
+ * Signs a Sui transaction without executing it.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const { signature, transactionBlockBytes } = await signTransaction({
136
+ * walletAccount: suiAccount,
137
+ * transaction: suiTransaction,
138
+ * });
139
+ * ```
140
+ *
141
+ * @param params.transaction - The transaction to sign.
142
+ * @param params.walletAccount - The wallet account to sign the transaction with.
95
143
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
96
- * @returns An object containing the signature and transaction bytes
144
+ * @returns An object containing the signature and transaction bytes.
145
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
146
+ * @see signAndExecuteTransaction
147
+ * @see getSuiClient
97
148
  * @notInstrumented
98
149
  */
99
150
  const signTransaction = async ({ walletAccount, transaction }, client = getDefaultClient$1()) => {
@@ -108,14 +159,25 @@ const signTransaction = async ({ walletAccount, transaction }, client = getDefau
108
159
  //#endregion
109
160
  //#region src/signTransactionBlock/signTransactionBlock.ts
110
161
  /**
111
- * @deprecated Use signTransaction instead
162
+ * Signs a Sui transaction block.
163
+ *
164
+ * @deprecated Use signTransaction instead.
112
165
  *
113
- * Signs a Sui transaction block
166
+ * @example
167
+ * ```ts
168
+ * const { signature, transactionBlockBytes } = await signTransactionBlock({
169
+ * walletAccount: suiAccount,
170
+ * transactionBlock: txBlock,
171
+ * });
172
+ * ```
114
173
  *
115
- * @param params.transactionBlock - The transaction block to sign
116
- * @param params.walletAccount - The wallet account to sign the transaction with
174
+ * @param params.transactionBlock - The transaction block to sign.
175
+ * @param params.walletAccount - The wallet account to sign the transaction with.
117
176
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
118
- * @returns An object containing the signature and transaction block bytes
177
+ * @returns An object containing the signature and transaction block bytes.
178
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
179
+ * @see signTransaction
180
+ * @see signAndExecuteTransaction
119
181
  * @notInstrumented
120
182
  */
121
183
  const signTransactionBlock = async ({ walletAccount, transactionBlock }, client = getDefaultClient$1()) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","names":["getDefaultClient","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/addSuiExtension/addSuiExtension.ts","../src/utils/getSuiTransactionHistory/getSuiTransactionHistory.ts","../src/isSuiNetworkProvider/isSuiNetworkProvider.ts","../src/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.ts","../src/signTransaction/signTransaction.ts","../src/signTransactionBlock/signTransactionBlock.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addWaasSuiExtension } from '../waas/addWaasSuiExtension';\nimport { addSuiWalletStandardExtension } from '../walletStandard/addSuiWalletStandardExtension';\n\n/**\n * Adds the Sui extension to the Dynamic client.\n *\n * This is a convenience function that adds both the Sui Wallet Standard extension\n * and the Dynamic WaaS Sui extension, enabling support for all Sui wallet types\n * including standard wallets and embedded wallets managed by Dynamic's infrastructure.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @notInstrumented\n */\nexport const addSuiExtension = (client = getDefaultClient()): void => {\n addSuiWalletStandardExtension(client);\n addWaasSuiExtension(client);\n};\n","import {\n type DynamicClient,\n type GetTransactionHistoryResponse,\n InvalidParamError,\n getTransactionHistory,\n} from '@dynamic-labs-sdk/client';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { isSuiWalletAccount } from '../../isSuiWalletAccount';\nimport type { SuiWalletAccount } from '../../SuiWalletAccount.types';\n\nexport type GetSuiTransactionHistoryParams = {\n limit?: number;\n networkId: number;\n offset?: string;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Retrieves transaction history for a SUI wallet account.\n * Delegates to the Dynamic backend API; returns a normalized WalletTransactionsResponse.\n *\n * @param params.walletAccount - The SUI wallet account to query.\n * @param params.networkId - The SUI network ID (501=mainnet, 502=testnet, 503=devnet).\n * @param [params.limit] - Max transactions to return.\n * @param [params.offset] - Pagination cursor from a previous response's nextOffset.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the transaction history for the given SUI wallet account.\n * @notInstrumented\n */\nexport const getSuiTransactionHistory = async (\n { walletAccount, networkId, limit, offset }: GetSuiTransactionHistoryParams,\n client: DynamicClient = getDefaultClient(),\n): Promise<GetTransactionHistoryResponse> => {\n if (!isSuiWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not a SUI wallet account');\n }\n\n return getTransactionHistory(\n { address: walletAccount.address, chain: 'SUI', limit, networkId, offset },\n client,\n );\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { SuiNetworkProvider } from '../SuiNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Sui network provider.\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Sui network provider, false otherwise.\n * @notInstrumented\n */\nexport const isSuiNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is SuiNetworkProvider => networkProvider.chain === 'SUI';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type {\n SuiExecuteTransactionRequestType,\n SuiSignAndExecuteTransactionBlockResult,\n SuiTransactionBlockResponseOptions,\n} from '../SuiWalletProvider.types';\n\ntype SignAndExecuteTransactionBlockParams = {\n options?: SuiTransactionBlockResponseOptions;\n requestType?: SuiExecuteTransactionRequestType;\n transactionBlock: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * @deprecated Use signAndExecuteTransaction instead\n *\n * Signs and executes a Sui transaction block\n *\n * @param params.transactionBlock - The transaction block to sign and execute\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [params.options] - The fields to return in the execution response (e.g., transaction, effects, events, etc).\n * By default, only the transaction digest will be returned.\n * @param [params.requestType] - The request type to use for the transaction execution\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing signature result\n * @notInstrumented\n */\nexport const signAndExecuteTransactionBlock = async (\n {\n walletAccount,\n transactionBlock,\n options,\n requestType,\n }: SignAndExecuteTransactionBlockParams,\n client = getDefaultClient()\n): Promise<SuiSignAndExecuteTransactionBlockResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signAndExecuteTransactionBlock) {\n throw new MethodNotImplementedError('signAndExecuteTransactionBlock');\n }\n\n transactionBlock.setSender(walletAccount.address);\n\n return provider.signAndExecuteTransactionBlock({\n options,\n requestType,\n transactionBlock,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type { SuiSignTransactionResult } from '../SuiWalletProvider.types';\n\ntype SignTransactionParams = {\n transaction: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Signs a Sui transaction\n * @param params.transaction - The transaction to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature and transaction bytes\n * @notInstrumented\n */\nexport const signTransaction = async (\n { walletAccount, transaction }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<SuiSignTransactionResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ transaction, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type { SuiSignTransactionBlockResult } from '../SuiWalletProvider.types';\n\ntype SignTransactionBlockParams = {\n transactionBlock: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * @deprecated Use signTransaction instead\n *\n * Signs a Sui transaction block\n *\n * @param params.transactionBlock - The transaction block to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature and transaction block bytes\n * @notInstrumented\n */\nexport const signTransactionBlock = async (\n { walletAccount, transactionBlock }: SignTransactionBlockParams,\n client = getDefaultClient()\n): Promise<SuiSignTransactionBlockResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signTransactionBlock) {\n throw new MethodNotImplementedError('signTransactionBlock');\n }\n\n return provider.signTransactionBlock({ transactionBlock, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addSuiExtension } from '../addSuiExtension';\nexport { getSuiTransactionHistory } from '../utils/getSuiTransactionHistory';\nexport type { GetSuiTransactionHistoryParams } from '../utils/getSuiTransactionHistory';\nexport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nexport { getSuiClient } from '../getSuiClient';\nexport { isSuiNetworkProvider } from '../isSuiNetworkProvider';\nexport { isSuiWalletAccount } from '../isSuiWalletAccount';\nexport { signAndExecuteTransaction } from '../signAndExecuteTransaction';\nexport { signAndExecuteTransactionBlock } from '../signAndExecuteTransactionBlock';\nexport { signTransaction } from '../signTransaction';\nexport { signTransactionBlock } from '../signTransactionBlock';\nexport type { SuiNetworkProvider } from '../SuiNetworkProvider.types';\nexport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nexport type {\n SuiClient,\n SuiExecuteTransactionRequestType,\n SuiSignAndExecuteTransactionBlockResult,\n SuiSignAndExecuteTransactionResult,\n SuiSignTransactionBlockResult,\n SuiSignTransactionResult,\n SuiTransactionBlockResponseOptions,\n} from '../SuiWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAeA,MAAa,mBAAmB,SAAS,kBAAkB,KAAW;AACpE,+BAA8B,OAAO;AACrC,qBAAoB,OAAO;;;;;;;;;;;;;;;;;ACa7B,MAAa,2BAA2B,OACtC,EAAE,eAAe,WAAW,OAAO,UACnC,SAAwB,kBAAkB,KACC;AAC3C,KAAI,CAAC,mBAAmB,cAAc,CACpC,OAAM,IAAI,kBAAkB,6CAA6C;AAG3E,QAAO,sBACL;EAAE,SAAS,cAAc;EAAS,OAAO;EAAO;EAAO;EAAW;EAAQ,EAC1E,OACD;;;;;;;;;;;;AC9BH,MAAa,wBACX,oBAC0C,gBAAgB,UAAU;;;;;;;;;;;;;;;;;;ACwBtE,MAAa,iCAAiC,OAC5C,EACE,eACA,kBACA,SACA,eAEF,SAASA,oBAAkB,KAC0B;CACrD,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,KAAI,CAAC,SAAS,+BACZ,OAAM,IAAI,0BAA0B,iCAAiC;AAGvE,kBAAiB,UAAU,cAAc,QAAQ;AAEjD,QAAO,SAAS,+BAA+B;EAC7C;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;;AC9CJ,MAAa,kBAAkB,OAC7B,EAAE,eAAe,eACjB,SAASC,oBAAkB,KACW;CACtC,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,QAAO,SAAS,gBAAgB;EAAE;EAAa;EAAe,CAAC;;;;;;;;;;;;;;;;ACTjE,MAAa,uBAAuB,OAClC,EAAE,eAAe,oBACjB,SAASC,oBAAkB,KACgB;CAC3C,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,KAAI,CAAC,SAAS,qBACZ,OAAM,IAAI,0BAA0B,uBAAuB;AAG7D,QAAO,SAAS,qBAAqB;EAAE;EAAkB;EAAe,CAAC;;;;;ACzC3E,qBAAqBC,MAAaC,QAAe"}
1
+ {"version":3,"file":"index.esm.js","names":["getDefaultClient","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/addSuiExtension/addSuiExtension.ts","../src/utils/getSuiTransactionHistory/getSuiTransactionHistory.ts","../src/isSuiNetworkProvider/isSuiNetworkProvider.ts","../src/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.ts","../src/signTransaction/signTransaction.ts","../src/signTransactionBlock/signTransactionBlock.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addWaasSuiExtension } from '../waas/addWaasSuiExtension';\nimport { addSuiWalletStandardExtension } from '../walletStandard/addSuiWalletStandardExtension';\n\n/**\n * Adds the Sui extension to the Dynamic client.\n *\n * This is a convenience function that adds both the Sui Wallet Standard extension\n * and the Dynamic WaaS Sui extension, enabling support for all Sui wallet types\n * including standard wallets and embedded wallets managed by Dynamic's infrastructure.\n *\n * @example\n * ```ts\n * const client = createDynamicClient({ environmentId: 'env-123' });\n * addSuiExtension(client);\n * ```\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns void\n * @see isSuiWalletAccount\n * @see isSuiNetworkProvider\n * @notInstrumented\n */\nexport const addSuiExtension = (client = getDefaultClient()): void => {\n addSuiWalletStandardExtension(client);\n addWaasSuiExtension(client);\n};\n","import {\n type DynamicClient,\n type GetTransactionHistoryResponse,\n InvalidParamError,\n getTransactionHistory,\n} from '@dynamic-labs-sdk/client';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { isSuiWalletAccount } from '../../isSuiWalletAccount';\nimport type { SuiWalletAccount } from '../../SuiWalletAccount.types';\n\nexport type GetSuiTransactionHistoryParams = {\n limit?: number;\n networkId: number;\n offset?: string;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Retrieves transaction history for a SUI wallet account.\n * Delegates to the Dynamic backend API; returns a normalized WalletTransactionsResponse.\n *\n * @example\n * ```ts\n * const history = await getSuiTransactionHistory({\n * walletAccount: suiAccount,\n * networkId: 501,\n * });\n * ```\n *\n * @param params.walletAccount - The SUI wallet account to query.\n * @param params.networkId - The SUI network ID (501=mainnet, 502=testnet, 503=devnet).\n * @param [params.limit] - Max transactions to return.\n * @param [params.offset] - Pagination cursor from a previous response's nextOffset.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the transaction history for the given SUI wallet account.\n * @throws {InvalidParamError} If the wallet account is not a SUI wallet account.\n * @see isSuiWalletAccount\n * @see getSuiClient\n * @notInstrumented\n */\nexport const getSuiTransactionHistory = async (\n { walletAccount, networkId, limit, offset }: GetSuiTransactionHistoryParams,\n client: DynamicClient = getDefaultClient(),\n): Promise<GetTransactionHistoryResponse> => {\n if (!isSuiWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not a SUI wallet account');\n }\n\n return getTransactionHistory(\n { address: walletAccount.address, chain: 'SUI', limit, networkId, offset },\n client,\n );\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { SuiNetworkProvider } from '../SuiNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Sui network provider.\n *\n * @example\n * ```ts\n * if (isSuiNetworkProvider(networkProvider)) {\n * const suiClient = networkProvider.getSuiClient();\n * }\n * ```\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Sui network provider, false otherwise.\n * @see isSuiWalletAccount\n * @see addSuiExtension\n * @notInstrumented\n */\nexport const isSuiNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is SuiNetworkProvider => networkProvider.chain === 'SUI';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type {\n SuiExecuteTransactionRequestType,\n SuiSignAndExecuteTransactionBlockResult,\n SuiTransactionBlockResponseOptions,\n} from '../SuiWalletProvider.types';\n\ntype SignAndExecuteTransactionBlockParams = {\n options?: SuiTransactionBlockResponseOptions;\n requestType?: SuiExecuteTransactionRequestType;\n transactionBlock: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Signs and executes a Sui transaction block.\n *\n * @deprecated Use signAndExecuteTransaction instead.\n *\n * @example\n * ```ts\n * const result = await signAndExecuteTransactionBlock({\n * walletAccount: suiAccount,\n * transactionBlock: txBlock,\n * });\n * ```\n *\n * @param params.transactionBlock - The transaction block to sign and execute.\n * @param params.walletAccount - The wallet account to sign the transaction with.\n * @param [params.options] - The fields to return in the execution response.\n * @param [params.requestType] - The request type to use for the transaction execution.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing signature result.\n * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.\n * @see signAndExecuteTransaction\n * @see signTransactionBlock\n * @notInstrumented\n */\nexport const signAndExecuteTransactionBlock = async (\n {\n walletAccount,\n transactionBlock,\n options,\n requestType,\n }: SignAndExecuteTransactionBlockParams,\n client = getDefaultClient()\n): Promise<SuiSignAndExecuteTransactionBlockResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signAndExecuteTransactionBlock) {\n throw new MethodNotImplementedError('signAndExecuteTransactionBlock');\n }\n\n transactionBlock.setSender(walletAccount.address);\n\n return provider.signAndExecuteTransactionBlock({\n options,\n requestType,\n transactionBlock,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type { SuiSignTransactionResult } from '../SuiWalletProvider.types';\n\ntype SignTransactionParams = {\n transaction: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Signs a Sui transaction without executing it.\n *\n * @example\n * ```ts\n * const { signature, transactionBlockBytes } = await signTransaction({\n * walletAccount: suiAccount,\n * transaction: suiTransaction,\n * });\n * ```\n *\n * @param params.transaction - The transaction to sign.\n * @param params.walletAccount - The wallet account to sign the transaction with.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature and transaction bytes.\n * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.\n * @see signAndExecuteTransaction\n * @see getSuiClient\n * @notInstrumented\n */\nexport const signTransaction = async (\n { walletAccount, transaction }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<SuiSignTransactionResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ transaction, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type { SuiSignTransactionBlockResult } from '../SuiWalletProvider.types';\n\ntype SignTransactionBlockParams = {\n transactionBlock: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Signs a Sui transaction block.\n *\n * @deprecated Use signTransaction instead.\n *\n * @example\n * ```ts\n * const { signature, transactionBlockBytes } = await signTransactionBlock({\n * walletAccount: suiAccount,\n * transactionBlock: txBlock,\n * });\n * ```\n *\n * @param params.transactionBlock - The transaction block to sign.\n * @param params.walletAccount - The wallet account to sign the transaction with.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature and transaction block bytes.\n * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.\n * @see signTransaction\n * @see signAndExecuteTransaction\n * @notInstrumented\n */\nexport const signTransactionBlock = async (\n { walletAccount, transactionBlock }: SignTransactionBlockParams,\n client = getDefaultClient()\n): Promise<SuiSignTransactionBlockResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signTransactionBlock) {\n throw new MethodNotImplementedError('signTransactionBlock');\n }\n\n return provider.signTransactionBlock({ transactionBlock, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addSuiExtension } from '../addSuiExtension';\nexport { getSuiTransactionHistory } from '../utils/getSuiTransactionHistory';\nexport type { GetSuiTransactionHistoryParams } from '../utils/getSuiTransactionHistory';\nexport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nexport { getSuiClient } from '../getSuiClient';\nexport { isSuiNetworkProvider } from '../isSuiNetworkProvider';\nexport { isSuiWalletAccount } from '../isSuiWalletAccount';\nexport { signAndExecuteTransaction } from '../signAndExecuteTransaction';\nexport { signAndExecuteTransactionBlock } from '../signAndExecuteTransactionBlock';\nexport { signTransaction } from '../signTransaction';\nexport { signTransactionBlock } from '../signTransactionBlock';\nexport type { SuiNetworkProvider } from '../SuiNetworkProvider.types';\nexport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nexport type {\n SuiClient,\n SuiExecuteTransactionRequestType,\n SuiSignAndExecuteTransactionBlockResult,\n SuiSignAndExecuteTransactionResult,\n SuiSignTransactionBlockResult,\n SuiSignTransactionResult,\n SuiTransactionBlockResponseOptions,\n} from '../SuiWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,mBAAmB,SAAS,kBAAkB,KAAW;AACpE,+BAA8B,OAAO;AACrC,qBAAoB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACe7B,MAAa,2BAA2B,OACtC,EAAE,eAAe,WAAW,OAAO,UACnC,SAAwB,kBAAkB,KACC;AAC3C,KAAI,CAAC,mBAAmB,cAAc,CACpC,OAAM,IAAI,kBAAkB,6CAA6C;AAG3E,QAAO,sBACL;EAAE,SAAS,cAAc;EAAS,OAAO;EAAO;EAAO;EAAW;EAAQ,EAC1E,OACD;;;;;;;;;;;;;;;;;;;;;AChCH,MAAa,wBACX,oBAC0C,gBAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACyBtE,MAAa,iCAAiC,OAC5C,EACE,eACA,kBACA,SACA,eAEF,SAASA,oBAAkB,KAC0B;CACrD,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,KAAI,CAAC,SAAS,+BACZ,OAAM,IAAI,0BAA0B,iCAAiC;AAGvE,kBAAiB,UAAU,cAAc,QAAQ;AAEjD,QAAO,SAAS,+BAA+B;EAC7C;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AC5CJ,MAAa,kBAAkB,OAC7B,EAAE,eAAe,eACjB,SAASC,oBAAkB,KACW;CACtC,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,QAAO,SAAS,gBAAgB;EAAE;EAAa;EAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVjE,MAAa,uBAAuB,OAClC,EAAE,eAAe,oBACjB,SAASC,oBAAkB,KACgB;CAC3C,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,KAAI,CAAC,SAAS,qBACZ,OAAM,IAAI,0BAA0B,uBAAuB;AAG7D,QAAO,SAAS,qBAAqB;EAAE;EAAkB;EAAe,CAAC;;;;;ACpD3E,qBAAqBC,MAAaC,QAAe"}
@@ -3,9 +3,18 @@ import type { SuiNetworkProvider } from '../SuiNetworkProvider.types';
3
3
  /**
4
4
  * Type guard function to check if a network provider is a Sui network provider.
5
5
  *
6
+ * @example
7
+ * ```ts
8
+ * if (isSuiNetworkProvider(networkProvider)) {
9
+ * const suiClient = networkProvider.getSuiClient();
10
+ * }
11
+ * ```
12
+ *
6
13
  * @param networkProvider - The network provider to check.
7
14
  * @returns True if the network provider is a Sui network provider, false otherwise.
8
- * @notInstrumented
15
+ * @see isSuiWalletAccount
16
+ * @see addSuiExtension
17
+ * @notInstrumented
9
18
  */
10
19
  export declare const isSuiNetworkProvider: (networkProvider: NetworkProvider) => networkProvider is SuiNetworkProvider;
11
20
  //# sourceMappingURL=isSuiNetworkProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isSuiNetworkProvider.d.ts","sourceRoot":"","sources":["../../src/isSuiNetworkProvider/isSuiNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,oBACd,eAAe,KAC/B,eAAe,IAAI,kBAAqD,CAAC"}
1
+ {"version":3,"file":"isSuiNetworkProvider.d.ts","sourceRoot":"","sources":["../../src/isSuiNetworkProvider/isSuiNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,oBACd,eAAe,KAC/B,eAAe,IAAI,kBAAqD,CAAC"}
@@ -3,9 +3,17 @@ import type { SuiWalletAccount } from '../SuiWalletAccount.types';
3
3
  /**
4
4
  * Type guard function to check if a wallet account is a Sui wallet account.
5
5
  *
6
+ * @example
7
+ * ```ts
8
+ * const accounts = getWalletAccounts();
9
+ * const suiAccounts = accounts.filter(isSuiWalletAccount);
10
+ * ```
11
+ *
6
12
  * @param walletAccount - The wallet account to check.
7
13
  * @returns True if the wallet account is a Sui wallet account, false otherwise.
8
- * @notInstrumented
14
+ * @see isSuiNetworkProvider
15
+ * @see addSuiExtension
16
+ * @notInstrumented
9
17
  */
10
18
  export declare const isSuiWalletAccount: (walletAccount: WalletAccount) => walletAccount is SuiWalletAccount;
11
19
  //# sourceMappingURL=isSuiWalletAccount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isSuiWalletAccount.d.ts","sourceRoot":"","sources":["../../src/isSuiWalletAccount/isSuiWalletAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,kBACd,aAAa,KAC3B,aAAa,IAAI,gBAAiD,CAAC"}
1
+ {"version":3,"file":"isSuiWalletAccount.d.ts","sourceRoot":"","sources":["../../src/isSuiWalletAccount/isSuiWalletAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,kBACd,aAAa,KAC3B,aAAa,IAAI,gBAAiD,CAAC"}
@@ -6,12 +6,24 @@ type SignAndExecuteTransactionParams = {
6
6
  walletAccount: SuiWalletAccount;
7
7
  };
8
8
  /**
9
- * Signs and executes a Sui transaction
10
- * @param params.transaction - The transaction to sign and execute
11
- * @param params.walletAccount - The wallet account to sign the transaction with
9
+ * Signs and executes a Sui transaction.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const result = await signAndExecuteTransaction({
14
+ * walletAccount: suiAccount,
15
+ * transaction: suiTransaction,
16
+ * });
17
+ * ```
18
+ *
19
+ * @param params.transaction - The transaction to sign and execute.
20
+ * @param params.walletAccount - The wallet account to sign the transaction with.
12
21
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
13
- * @returns An object containing the signature and transaction bytes
14
- * @notInstrumented
22
+ * @returns An object containing the signature and transaction bytes.
23
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
24
+ * @see signTransaction
25
+ * @see getSuiClient
26
+ * @notInstrumented
15
27
  */
16
28
  export declare const signAndExecuteTransaction: ({ walletAccount, transaction }: SignAndExecuteTransactionParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<SuiSignAndExecuteTransactionResult>;
17
29
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"signAndExecuteTransaction.d.ts","sourceRoot":"","sources":["../../src/signAndExecuteTransaction/signAndExecuteTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAErF,KAAK,+BAA+B,GAAG;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,mCACJ,+BAA+B,gEAE9D,OAAO,CAAC,kCAAkC,CAe5C,CAAC"}
1
+ {"version":3,"file":"signAndExecuteTransaction.d.ts","sourceRoot":"","sources":["../../src/signAndExecuteTransaction/signAndExecuteTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAErF,KAAK,+BAA+B,GAAG;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,mCACJ,+BAA+B,gEAE9D,OAAO,CAAC,kCAAkC,CAe5C,CAAC"}
@@ -8,18 +8,28 @@ type SignAndExecuteTransactionBlockParams = {
8
8
  walletAccount: SuiWalletAccount;
9
9
  };
10
10
  /**
11
- * @deprecated Use signAndExecuteTransaction instead
11
+ * Signs and executes a Sui transaction block.
12
12
  *
13
- * Signs and executes a Sui transaction block
13
+ * @deprecated Use signAndExecuteTransaction instead.
14
14
  *
15
- * @param params.transactionBlock - The transaction block to sign and execute
16
- * @param params.walletAccount - The wallet account to sign the transaction with
17
- * @param [params.options] - The fields to return in the execution response (e.g., transaction, effects, events, etc).
18
- * By default, only the transaction digest will be returned.
19
- * @param [params.requestType] - The request type to use for the transaction execution
15
+ * @example
16
+ * ```ts
17
+ * const result = await signAndExecuteTransactionBlock({
18
+ * walletAccount: suiAccount,
19
+ * transactionBlock: txBlock,
20
+ * });
21
+ * ```
22
+ *
23
+ * @param params.transactionBlock - The transaction block to sign and execute.
24
+ * @param params.walletAccount - The wallet account to sign the transaction with.
25
+ * @param [params.options] - The fields to return in the execution response.
26
+ * @param [params.requestType] - The request type to use for the transaction execution.
20
27
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
21
- * @returns An object containing signature result
22
- * @notInstrumented
28
+ * @returns An object containing signature result.
29
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
30
+ * @see signAndExecuteTransaction
31
+ * @see signTransactionBlock
32
+ * @notInstrumented
23
33
  */
24
34
  export declare const signAndExecuteTransactionBlock: ({ walletAccount, transactionBlock, options, requestType, }: SignAndExecuteTransactionBlockParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<SuiSignAndExecuteTransactionBlockResult>;
25
35
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"signAndExecuteTransactionBlock.d.ts","sourceRoot":"","sources":["../../src/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,gCAAgC,EAChC,uCAAuC,EACvC,kCAAkC,EACnC,MAAM,4BAA4B,CAAC;AAEpC,KAAK,oCAAoC,GAAG;IAC1C,OAAO,CAAC,EAAE,kCAAkC,CAAC;IAC7C,WAAW,CAAC,EAAE,gCAAgC,CAAC;IAC/C,gBAAgB,EAAE,WAAW,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,8BAA8B,+DAMtC,oCAAoC,gEAEtC,OAAO,CAAC,uCAAuC,CAwBjD,CAAC"}
1
+ {"version":3,"file":"signAndExecuteTransactionBlock.d.ts","sourceRoot":"","sources":["../../src/signAndExecuteTransactionBlock/signAndExecuteTransactionBlock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,gCAAgC,EAChC,uCAAuC,EACvC,kCAAkC,EACnC,MAAM,4BAA4B,CAAC;AAEpC,KAAK,oCAAoC,GAAG;IAC1C,OAAO,CAAC,EAAE,kCAAkC,CAAC;IAC7C,WAAW,CAAC,EAAE,gCAAgC,CAAC;IAC/C,gBAAgB,EAAE,WAAW,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,8BAA8B,+DAMtC,oCAAoC,gEAEtC,OAAO,CAAC,uCAAuC,CAwBjD,CAAC"}
@@ -6,12 +6,24 @@ type SignTransactionParams = {
6
6
  walletAccount: SuiWalletAccount;
7
7
  };
8
8
  /**
9
- * Signs a Sui transaction
10
- * @param params.transaction - The transaction to sign
11
- * @param params.walletAccount - The wallet account to sign the transaction with
9
+ * Signs a Sui transaction without executing it.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const { signature, transactionBlockBytes } = await signTransaction({
14
+ * walletAccount: suiAccount,
15
+ * transaction: suiTransaction,
16
+ * });
17
+ * ```
18
+ *
19
+ * @param params.transaction - The transaction to sign.
20
+ * @param params.walletAccount - The wallet account to sign the transaction with.
12
21
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
13
- * @returns An object containing the signature and transaction bytes
14
- * @notInstrumented
22
+ * @returns An object containing the signature and transaction bytes.
23
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
24
+ * @see signAndExecuteTransaction
25
+ * @see getSuiClient
26
+ * @notInstrumented
15
27
  */
16
28
  export declare const signTransaction: ({ walletAccount, transaction }: SignTransactionParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<SuiSignTransactionResult>;
17
29
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"signTransaction.d.ts","sourceRoot":"","sources":["../../src/signTransaction/signTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,mCACM,qBAAqB,gEAEpD,OAAO,CAAC,wBAAwB,CAalC,CAAC"}
1
+ {"version":3,"file":"signTransaction.d.ts","sourceRoot":"","sources":["../../src/signTransaction/signTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,mCACM,qBAAqB,gEAEpD,OAAO,CAAC,wBAAwB,CAalC,CAAC"}
@@ -6,15 +6,26 @@ type SignTransactionBlockParams = {
6
6
  walletAccount: SuiWalletAccount;
7
7
  };
8
8
  /**
9
- * @deprecated Use signTransaction instead
9
+ * Signs a Sui transaction block.
10
10
  *
11
- * Signs a Sui transaction block
11
+ * @deprecated Use signTransaction instead.
12
12
  *
13
- * @param params.transactionBlock - The transaction block to sign
14
- * @param params.walletAccount - The wallet account to sign the transaction with
13
+ * @example
14
+ * ```ts
15
+ * const { signature, transactionBlockBytes } = await signTransactionBlock({
16
+ * walletAccount: suiAccount,
17
+ * transactionBlock: txBlock,
18
+ * });
19
+ * ```
20
+ *
21
+ * @param params.transactionBlock - The transaction block to sign.
22
+ * @param params.walletAccount - The wallet account to sign the transaction with.
15
23
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
16
- * @returns An object containing the signature and transaction block bytes
17
- * @notInstrumented
24
+ * @returns An object containing the signature and transaction block bytes.
25
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
26
+ * @see signTransaction
27
+ * @see signAndExecuteTransaction
28
+ * @notInstrumented
18
29
  */
19
30
  export declare const signTransactionBlock: ({ walletAccount, transactionBlock }: SignTransactionBlockParams, client?: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<SuiSignTransactionBlockResult>;
20
31
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"signTransactionBlock.d.ts","sourceRoot":"","sources":["../../src/signTransactionBlock/signTransactionBlock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAEhF,KAAK,0BAA0B,GAAG;IAChC,gBAAgB,EAAE,WAAW,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,wCACM,0BAA0B,gEAE9D,OAAO,CAAC,6BAA6B,CAiBvC,CAAC"}
1
+ {"version":3,"file":"signTransactionBlock.d.ts","sourceRoot":"","sources":["../../src/signTransactionBlock/signTransactionBlock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAEhF,KAAK,0BAA0B,GAAG;IAChC,gBAAgB,EAAE,WAAW,CAAC;IAC9B,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,oBAAoB,wCACM,0BAA0B,gEAE9D,OAAO,CAAC,6BAA6B,CAiBvC,CAAC"}
@@ -6,7 +6,7 @@ import { Transaction } from "@mysten/sui/transactions";
6
6
 
7
7
  //#region package.json
8
8
  var name = "@dynamic-labs-sdk/sui";
9
- var version = "1.18.0";
9
+ var version = "1.19.1";
10
10
 
11
11
  //#endregion
12
12
  //#region src/utils/fetchSuiBalance/fetchSuiBalance.ts
@@ -72,10 +72,17 @@ const isSuiWalletProvider = (provider) => {
72
72
  /**
73
73
  * Retrieves a SuiClient from a wallet account.
74
74
  *
75
+ * @example
76
+ * ```ts
77
+ * const suiClient = await getSuiClient({ walletAccount: suiAccount });
78
+ * ```
79
+ *
75
80
  * @param params.walletAccount - The wallet account to get the SuiClient for.
76
81
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
77
- * @returns A promise that resolves to a SuiClient instance
78
- * @throws NotSuiProviderError If the wallet account's provider is not a SUI provider
82
+ * @returns A promise that resolves to a SuiClient instance.
83
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
84
+ * @see signAndExecuteTransaction
85
+ * @see isSuiWalletAccount
79
86
  * @notInstrumented
80
87
  */
81
88
  const getSuiClient = async ({ walletAccount }, client = getDefaultClient()) => {
@@ -89,8 +96,16 @@ const getSuiClient = async ({ walletAccount }, client = getDefaultClient()) => {
89
96
  /**
90
97
  * Type guard function to check if a wallet account is a Sui wallet account.
91
98
  *
99
+ * @example
100
+ * ```ts
101
+ * const accounts = getWalletAccounts();
102
+ * const suiAccounts = accounts.filter(isSuiWalletAccount);
103
+ * ```
104
+ *
92
105
  * @param walletAccount - The wallet account to check.
93
106
  * @returns True if the wallet account is a Sui wallet account, false otherwise.
107
+ * @see isSuiNetworkProvider
108
+ * @see addSuiExtension
94
109
  * @notInstrumented
95
110
  */
96
111
  const isSuiWalletAccount = (walletAccount) => walletAccount.chain === "SUI";
@@ -144,11 +159,23 @@ const suiExecuteSwapTransaction = async ({ onStepChange, signingPayload, walletA
144
159
  //#endregion
145
160
  //#region src/signAndExecuteTransaction/signAndExecuteTransaction.ts
146
161
  /**
147
- * Signs and executes a Sui transaction
148
- * @param params.transaction - The transaction to sign and execute
149
- * @param params.walletAccount - The wallet account to sign the transaction with
162
+ * Signs and executes a Sui transaction.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const result = await signAndExecuteTransaction({
167
+ * walletAccount: suiAccount,
168
+ * transaction: suiTransaction,
169
+ * });
170
+ * ```
171
+ *
172
+ * @param params.transaction - The transaction to sign and execute.
173
+ * @param params.walletAccount - The wallet account to sign the transaction with.
150
174
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
151
- * @returns An object containing the signature and transaction bytes
175
+ * @returns An object containing the signature and transaction bytes.
176
+ * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.
177
+ * @see signTransaction
178
+ * @see getSuiClient
152
179
  * @notInstrumented
153
180
  */
154
181
  const signAndExecuteTransaction = async ({ walletAccount, transaction }, client = getDefaultClient$1()) => {
@@ -202,4 +229,4 @@ const suiTransferAmount = async ({ amount, recipient, token, walletAccount }, cl
202
229
 
203
230
  //#endregion
204
231
  export { isSuiWalletAccount as a, NotSuiProviderError as c, version as d, suiConfirmTransaction as i, registerSuiNetworkProviderBuilder as l, signAndExecuteTransaction as n, getSuiClient as o, suiExecuteSwapTransaction as r, isSuiWalletProvider as s, suiTransferAmount as t, name as u };
205
- //# sourceMappingURL=suiTransferAmount-D2kS-vB5.esm.js.map
232
+ //# sourceMappingURL=suiTransferAmount-Cdq2tGeI.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suiTransferAmount-Cdq2tGeI.esm.js","names":["getDefaultClient"],"sources":["../package.json","../src/utils/fetchSuiBalance/fetchSuiBalance.ts","../src/utils/createSuiNetworkProvider/createSuiNetworkProvider.ts","../src/registerSuiNetworkProviderBuilder/registerSuiNetworkProviderBuilder.ts","../src/errors/NotSuiProviderError/NotSuiProviderError.ts","../src/isSuiWalletProvider/isSuiWalletProvider.ts","../src/getSuiClient/getSuiClient.ts","../src/isSuiWalletAccount/isSuiWalletAccount.ts","../src/utils/suiConfirmTransaction/suiConfirmTransaction.ts","../src/utils/suiExecuteSwapTransaction/suiExecuteSwapTransaction.ts","../src/signAndExecuteTransaction/signAndExecuteTransaction.ts","../src/utils/suiTransferAmount/suiTransferAmount.ts"],"sourcesContent":["","import type { NetworkData } from '@dynamic-labs-sdk/client';\nimport { SuiClient } from '@mysten/sui/client';\nimport { MIST_PER_SUI } from '@mysten/sui/utils';\n\n/** @notInstrumented */\nexport const fetchSuiBalance = async ({\n address,\n networkData,\n}: {\n address: string;\n networkData: NetworkData;\n}): Promise<string | null> => {\n // Create a SuiClient using the provided RPC URL.\n const suiClient = new SuiClient({\n url: networkData.rpcUrls.http[0],\n });\n\n const balanceInMist = await suiClient.getBalance({\n owner: address,\n });\n\n // Balance comes back as MIST, 1 SUI = 1e9 MIST\n const balance = Number(balanceInMist.totalBalance) / Number(MIST_PER_SUI);\n\n if (Number.isNaN(balance)) {\n return null;\n }\n\n return balance.toString();\n};\n","import type { NetworkData } from '@dynamic-labs-sdk/client';\nimport { createBaseNetworkProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { SuiNetworkProvider } from '../../SuiNetworkProvider.types';\nimport { fetchSuiBalance } from '../fetchSuiBalance';\n\n/** @notInstrumented */\nexport const createSuiNetworkProvider = (\n networkData: NetworkData\n): SuiNetworkProvider => ({\n ...createBaseNetworkProvider('SUI', networkData),\n getBalance: async ({ address }) => ({\n balance: await fetchSuiBalance({\n address,\n networkData,\n }),\n }),\n});\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';\n\nimport { createSuiNetworkProvider } from '../utils/createSuiNetworkProvider';\n\n/** @notInstrumented */\nexport const registerSuiNetworkProviderBuilder = (\n client: DynamicClient\n): void => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n /**\n * If the Sui network provider builder is already registered, return.\n */\n if (networkProviderBuilderRegistry.get().get('SUI')) {\n return;\n }\n\n networkProviderBuilderRegistry.register({\n builder: createSuiNetworkProvider,\n chain: 'SUI',\n });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotSuiProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_sui_provider_error',\n docsUrl: null,\n name: 'NotSuiProviderError',\n shortMessage: 'Provider is not a Sui wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { SuiWalletProvider } from '../SuiWalletProvider.types';\n\n/** @notInstrumented */\nexport const isSuiWalletProvider = (\n provider: WalletProvider\n): provider is SuiWalletProvider => {\n return provider.chain === 'SUI';\n};\n","import {\n getDefaultClient,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\n\ntype GetSuiClientParams = {\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Retrieves a SuiClient from a wallet account.\n *\n * @example\n * ```ts\n * const suiClient = await getSuiClient({ walletAccount: suiAccount });\n * ```\n *\n * @param params.walletAccount - The wallet account to get the SuiClient for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to a SuiClient instance.\n * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.\n * @see signAndExecuteTransaction\n * @see isSuiWalletAccount\n * @notInstrumented\n */\nexport const getSuiClient = async (\n { walletAccount }: GetSuiClientParams,\n client = getDefaultClient()\n) => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n return provider.getSuiClient({ walletAccount });\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is a Sui wallet account.\n *\n * @example\n * ```ts\n * const accounts = getWalletAccounts();\n * const suiAccounts = accounts.filter(isSuiWalletAccount);\n * ```\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is a Sui wallet account, false otherwise.\n * @see isSuiNetworkProvider\n * @see addSuiExtension\n * @notInstrumented\n */\nexport const isSuiWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is SuiWalletAccount => walletAccount.chain === 'SUI';\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { ConfirmTransactionParams } from '@dynamic-labs-sdk/client/core';\n\nimport { getSuiClient } from '../../getSuiClient';\nimport { isSuiWalletAccount } from '../../isSuiWalletAccount';\n\n/**\n * Waits for a SUI transaction to be confirmed on-chain.\n *\n * @param params.transactionHash - The transaction digest to wait for.\n * @param params.walletAccount - The wallet account that submitted the transaction.\n * @param client - The Dynamic client instance.\n * @notInstrumented\n */\nexport const suiConfirmTransaction = async (\n { transactionHash, walletAccount }: ConfirmTransactionParams,\n client: DynamicClient\n): Promise<void> => {\n if (!isSuiWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not a SUI wallet account');\n }\n\n const suiClient = await getSuiClient({ walletAccount }, client);\n\n await suiClient.waitForTransaction({ digest: transactionHash });\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n} from '@dynamic-labs-sdk/client';\nimport type {\n ExecuteSwapTransactionParams,\n ExecuteSwapTransactionResult,\n} from '@dynamic-labs-sdk/client/core';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport { isSuiWalletAccount } from '../../isSuiWalletAccount';\nimport { isSuiWalletProvider } from '../../isSuiWalletProvider';\n\n/**\n * Executes a Sui checkout transaction by deserializing the base64-encoded\n * BCS transaction and sending it via the wallet provider's signAndExecuteTransaction.\n *\n * 1. Validates that the wallet account is a Sui wallet account\n * 2. Extracts and validates the serialized transaction from the signing payload\n * 3. Deserializes the transaction using Transaction.from()\n * 4. Signs and executes via the Sui wallet provider\n *\n * @param params.signingPayload - The signing payload containing `serializedTransaction`.\n * @param params.walletAccount - The wallet account used to sign and execute the transaction.\n * @param params.onStepChange - Optional callback invoked with `'transaction'` when the execution step begins.\n * @param client - The Dynamic client instance.\n * @returns The transaction hash (digest).\n * @notInstrumented\n */\nexport const suiExecuteSwapTransaction = async (\n { onStepChange, signingPayload, walletAccount }: ExecuteSwapTransactionParams,\n client: DynamicClient\n): Promise<ExecuteSwapTransactionResult> => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (\n !isSuiWalletAccount(walletAccount) ||\n !isSuiWalletProvider(walletProvider)\n ) {\n throw new InvalidParamError('Wallet account is not a Sui wallet account');\n }\n\n const serializedTransactionData = signingPayload.serializedTransaction;\n\n if (!serializedTransactionData) {\n throw new InvalidParamError(\n 'Signing payload is missing serialized transaction data'\n );\n }\n\n const transaction = Transaction.from(serializedTransactionData);\n\n onStepChange?.('transaction');\n\n const result = await walletProvider.signAndExecuteTransaction({\n transaction,\n walletAccount,\n });\n\n return { transactionHash: result.digest };\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { NotSuiProviderError } from '../errors/NotSuiProviderError';\nimport { isSuiWalletProvider } from '../isSuiWalletProvider';\nimport type { SuiWalletAccount } from '../SuiWalletAccount.types';\nimport type { SuiSignAndExecuteTransactionResult } from '../SuiWalletProvider.types';\n\ntype SignAndExecuteTransactionParams = {\n transaction: Transaction;\n walletAccount: SuiWalletAccount;\n};\n\n/**\n * Signs and executes a Sui transaction.\n *\n * @example\n * ```ts\n * const result = await signAndExecuteTransaction({\n * walletAccount: suiAccount,\n * transaction: suiTransaction,\n * });\n * ```\n *\n * @param params.transaction - The transaction to sign and execute.\n * @param params.walletAccount - The wallet account to sign the transaction with.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature and transaction bytes.\n * @throws {NotSuiProviderError} If the wallet account's provider is not a SUI provider.\n * @see signTransaction\n * @see getSuiClient\n * @notInstrumented\n */\nexport const signAndExecuteTransaction = async (\n { walletAccount, transaction }: SignAndExecuteTransactionParams,\n client = getDefaultClient()\n): Promise<SuiSignAndExecuteTransactionResult> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isSuiWalletProvider(provider)) {\n throw new NotSuiProviderError({ providerKey: provider.key });\n }\n\n transaction.setSender(walletAccount.address);\n\n return provider.signAndExecuteTransaction({ transaction, walletAccount });\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport {\n type TransferAmountParams,\n parseAmountToSmallestUnit,\n} from '@dynamic-labs-sdk/client/core';\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport { getSuiClient } from '../../getSuiClient';\nimport { isSuiWalletAccount } from '../../isSuiWalletAccount';\nimport { signAndExecuteTransaction } from '../../signAndExecuteTransaction';\n\nconst SUI_DECIMALS = 9;\n\n/**\n * Transfers native SUI or a SUI token from one wallet to another.\n *\n * For native SUI, converts the human-readable amount string to MIST (9 decimals).\n * For tokens, fetches the user's coins of that type and splits from them.\n * @notInstrumented\n */\nexport const suiTransferAmount = async (\n { amount, recipient, token, walletAccount }: TransferAmountParams,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n if (!isSuiWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not a SUI wallet account');\n }\n\n const transaction = new Transaction();\n\n if (token?.address) {\n const suiClient = await getSuiClient({ walletAccount }, client);\n\n const { data: coins } = await suiClient.getCoins({\n coinType: token.address,\n owner: walletAccount.address,\n });\n\n if (coins.length === 0) {\n throw new InvalidParamError('Token not found');\n }\n\n const smallestUnit = parseAmountToSmallestUnit({\n amount,\n decimals: token.decimals,\n });\n\n const [coin] = transaction.splitCoins(coins[0].coinObjectId, [\n smallestUnit,\n ]);\n transaction.transferObjects([coin], recipient);\n } else {\n const mist = parseAmountToSmallestUnit({\n amount,\n decimals: SUI_DECIMALS,\n });\n\n const [coin] = transaction.splitCoins(transaction.gas, [mist]);\n transaction.transferObjects([coin], recipient);\n }\n\n const result = await signAndExecuteTransaction(\n { transaction, walletAccount },\n client\n );\n\n return { transactionHash: result.digest };\n};\n"],"mappings":";;;;;;;;;;;;;ACKA,MAAa,kBAAkB,OAAO,EACpC,SACA,kBAI4B;CAM5B,MAAM,gBAAgB,MAJJ,IAAI,UAAU,EAC9B,KAAK,YAAY,QAAQ,KAAK,IAC/B,CAAC,CAEoC,WAAW,EAC/C,OAAO,SACR,CAAC;CAGF,MAAM,UAAU,OAAO,cAAc,aAAa,GAAG,OAAO,aAAa;AAEzE,KAAI,OAAO,MAAM,QAAQ,CACvB,QAAO;AAGT,QAAO,QAAQ,UAAU;;;;;;ACrB3B,MAAa,4BACX,iBACwB;CACxB,GAAG,0BAA0B,OAAO,YAAY;CAChD,YAAY,OAAO,EAAE,eAAe,EAClC,SAAS,MAAM,gBAAgB;EAC7B;EACA;EACD,CAAC,EACH;CACF;;;;;ACXD,MAAa,qCACX,WACS;CACT,MAAM,iCACJ,kCAAkC,OAAO;;;;AAK3C,KAAI,+BAA+B,KAAK,CAAC,IAAI,MAAM,CACjD;AAGF,gCAA+B,SAAS;EACtC,SAAS;EACT,OAAO;EACR,CAAC;;;;;ACpBJ,IAAa,sBAAb,cAAyC,UAAU;CACjD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;;ACT9B,MAAa,uBACX,aACkC;AAClC,QAAO,SAAS,UAAU;;;;;;;;;;;;;;;;;;;;;ACqB5B,MAAa,eAAe,OAC1B,EAAE,iBACF,SAAS,kBAAkB,KACxB;CACH,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,QAAO,SAAS,aAAa,EAAE,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;ACzBjD,MAAa,sBACX,kBACsC,cAAc,UAAU;;;;;;;;;;;;ACNhE,MAAa,wBAAwB,OACnC,EAAE,iBAAiB,iBACnB,WACkB;AAClB,KAAI,CAAC,mBAAmB,cAAc,CACpC,OAAM,IAAI,kBAAkB,6CAA6C;AAK3E,QAFkB,MAAM,aAAa,EAAE,eAAe,EAAE,OAAO,EAE/C,mBAAmB,EAAE,QAAQ,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;ACKjE,MAAa,4BAA4B,OACvC,EAAE,cAAc,gBAAgB,iBAChC,WAC0C;CAC1C,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KACE,CAAC,mBAAmB,cAAc,IAClC,CAAC,oBAAoB,eAAe,CAEpC,OAAM,IAAI,kBAAkB,6CAA6C;CAG3E,MAAM,4BAA4B,eAAe;AAEjD,KAAI,CAAC,0BACH,OAAM,IAAI,kBACR,yDACD;CAGH,MAAM,cAAc,YAAY,KAAK,0BAA0B;AAE/D,gBAAe,cAAc;AAO7B,QAAO,EAAE,kBALM,MAAM,eAAe,0BAA0B;EAC5D;EACA;EACD,CAAC,EAE+B,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;AC7B3C,MAAa,4BAA4B,OACvC,EAAE,eAAe,eACjB,SAASA,oBAAkB,KACqB;CAChD,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,oBAAoB,SAAS,CAChC,OAAM,IAAI,oBAAoB,EAAE,aAAa,SAAS,KAAK,CAAC;AAG9D,aAAY,UAAU,cAAc,QAAQ;AAE5C,QAAO,SAAS,0BAA0B;EAAE;EAAa;EAAe,CAAC;;;;;ACvC3E,MAAM,eAAe;;;;;;;;AASrB,MAAa,oBAAoB,OAC/B,EAAE,QAAQ,WAAW,OAAO,iBAC5B,WACyC;AACzC,KAAI,CAAC,mBAAmB,cAAc,CACpC,OAAM,IAAI,kBAAkB,6CAA6C;CAG3E,MAAM,cAAc,IAAI,aAAa;AAErC,KAAI,OAAO,SAAS;EAGlB,MAAM,EAAE,MAAM,UAAU,OAFN,MAAM,aAAa,EAAE,eAAe,EAAE,OAAO,EAEvB,SAAS;GAC/C,UAAU,MAAM;GAChB,OAAO,cAAc;GACtB,CAAC;AAEF,MAAI,MAAM,WAAW,EACnB,OAAM,IAAI,kBAAkB,kBAAkB;EAGhD,MAAM,eAAe,0BAA0B;GAC7C;GACA,UAAU,MAAM;GACjB,CAAC;EAEF,MAAM,CAAC,QAAQ,YAAY,WAAW,MAAM,GAAG,cAAc,CAC3D,aACD,CAAC;AACF,cAAY,gBAAgB,CAAC,KAAK,EAAE,UAAU;QACzC;EACL,MAAM,OAAO,0BAA0B;GACrC;GACA,UAAU;GACX,CAAC;EAEF,MAAM,CAAC,QAAQ,YAAY,WAAW,YAAY,KAAK,CAAC,KAAK,CAAC;AAC9D,cAAY,gBAAgB,CAAC,KAAK,EAAE,UAAU;;AAQhD,QAAO,EAAE,kBALM,MAAM,0BACnB;EAAE;EAAa;EAAe,EAC9B,OACD,EAEgC,QAAQ"}