@dynamic-labs-sdk/tempo 1.46.0 → 1.47.0

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.
package/dist/waas.esm.js CHANGED
@@ -1,10 +1,10 @@
1
- import { a as isTempoWalletAccount, c as registerTempoNetworkProviderBuilder, d as version, i as isTempoWalletProvider, l as TempoNativeTokenError, n as isTempoChainId, o as getTempoPublicClient, r as sendTip20Transaction, s as mapNetworkDataToViemChain, u as name } from "./tempoChainIds-BEdWIIeT.esm.js";
1
+ import { a as isTempoWalletAccount, c as registerTempoNetworkProviderBuilder, d as version, i as isTempoWalletProvider, l as TempoNativeTokenError, n as isTempoChainId, o as getTempoPublicClient, r as sendTip20Transaction, s as mapNetworkDataToViemChain, u as name } from "./tempoChainIds-D9HtsDBK.esm.js";
2
2
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
3
3
  import { BaseError, InvalidParamError, getActiveNetworkData } from "@dynamic-labs-sdk/client";
4
- import { WalletProviderPriority, assertDefined, formatWalletProviderGroupKey, formatWalletProviderKey, getActiveNetworkIdFromLastKnownRegistry, getDefaultClient, getWalletProviderFromWalletAccount, getWalletProviderRegistry, hasExtension, registerExtension, switchActiveNetworkInLastKnownRegistry } from "@dynamic-labs-sdk/client/core";
5
- import { bytesToHex, createPublicClient, createWalletClient, hexToString, http, isAddress, isHex, stringToHex } from "viem";
4
+ import { WalletProviderPriority, assertDefined, formatWalletProviderGroupKey, formatWalletProviderKey, getActionAuthorizationTokens, getActiveNetworkIdFromLastKnownRegistry, getDefaultClient, getSignedSessionId, getWalletProviderFromWalletAccount, getWalletProviderRegistry, hasExtension, registerExtension, switchActiveNetworkInLastKnownRegistry } from "@dynamic-labs-sdk/client/core";
5
+ import { bytesToHex, createPublicClient, createWalletClient, hexToString, http, isAddress, isHex, stringToHex, stringify } from "viem";
6
6
  import { DYNAMIC_WAAS_METADATA, createWaasProvider, getAllUserWaasAddressesForChain, prepareSigningQuorumApproval } from "@dynamic-labs-sdk/client/waas/core";
7
- import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
7
+ import { MFAAction, TokenScope, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
8
8
  import { toAccount } from "viem/accounts";
9
9
 
10
10
  //#region src/errors/TempoTransactionValidationError/TempoTransactionValidationError.ts
@@ -309,32 +309,6 @@ var TempoRawMessageNotUtf8Error = class extends BaseError {
309
309
  }
310
310
  };
311
311
 
312
- //#endregion
313
- //#region src/errors/TempoTypedDataNotSupportedError/TempoTypedDataNotSupportedError.ts
314
- /**
315
- * Thrown when typed data is signed with a Tempo embedded wallet, which does
316
- * not support it yet.
317
- *
318
- * @example
319
- * ```ts
320
- * throw new TempoTypedDataNotSupportedError();
321
- * ```
322
- *
323
- * @see createWalletProviderForWaasTempo
324
- * @see addWaasTempoExtension
325
- */
326
- var TempoTypedDataNotSupportedError = class extends BaseError {
327
- constructor() {
328
- super({
329
- cause: null,
330
- code: "tempo_typed_data_not_supported",
331
- docsUrl: null,
332
- name: "TempoTypedDataNotSupportedError",
333
- shortMessage: "Signing typed data is not supported for Tempo embedded wallets yet"
334
- });
335
- }
336
- };
337
-
338
312
  //#endregion
339
313
  //#region src/waas/utils/assertValidTempoTransactionCalls/assertValidTempoTransactionCalls.ts
340
314
  /**
@@ -537,6 +511,62 @@ const signMessage = async ({ approvalQuorum, message, waasProvider, walletAccoun
537
511
  });
538
512
  };
539
513
 
514
+ //#endregion
515
+ //#region src/waas/utils/signTypedData/signTypedData.ts
516
+ /**
517
+ * Signs EIP-712 typed data with a Tempo embedded wallet account.
518
+ *
519
+ * For a business-account wallet, this first prepares and signs the quorum
520
+ * intent for the typed data. Personal wallets pass `approvalQuorum` through
521
+ * unchanged.
522
+ *
523
+ * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.
524
+ * @param params.typedData - The EIP-712 typed data to sign. `bigint` values are serialized.
525
+ * @param params.waasProvider - The WaaS provider that holds the signing client.
526
+ * @param params.walletAccount - The wallet account that signs the typed data.
527
+ * @param client - The Dynamic client holding the current session key.
528
+ * @returns The signature.
529
+ * @example
530
+ * ```ts
531
+ * const signature = await signTypedData(
532
+ * { typedData, waasProvider, walletAccount },
533
+ * client
534
+ * );
535
+ * ```
536
+ * @see {@link prepareSigningQuorumApproval} for the quorum intent step.
537
+ * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.
538
+ * @notInstrumented
539
+ */
540
+ const signTypedData = async ({ approvalQuorum, typedData, waasProvider, walletAccount }, client) => {
541
+ const { signature: signedSessionId } = await getSignedSessionId(client);
542
+ const waasClient = await waasProvider.getWaasClient();
543
+ const stringifiedTypedData = stringify(typedData);
544
+ const serializableTypedData = JSON.parse(stringifiedTypedData);
545
+ const preparedApprovalQuorum = await prepareSigningQuorumApproval({
546
+ approvalQuorum,
547
+ chainName: TEMPO_CHAIN,
548
+ operation: {
549
+ kind: "typedData",
550
+ typedData: stringifiedTypedData
551
+ },
552
+ waasClient,
553
+ walletAccount
554
+ }, client);
555
+ const { elevatedAccessToken, mfaToken } = await getActionAuthorizationTokens({
556
+ mfaAction: MFAAction.WalletWaasSign,
557
+ scope: TokenScope.Walletsign
558
+ }, client);
559
+ return waasClient.signTypedData({
560
+ accountAddress: walletAccount.address,
561
+ approvalQuorum: preparedApprovalQuorum,
562
+ authToken: client.token ?? void 0,
563
+ elevatedAccessToken,
564
+ mfaToken,
565
+ signedSessionId,
566
+ typedData: serializableTypedData
567
+ });
568
+ };
569
+
540
570
  //#endregion
541
571
  //#region src/waas/utils/createViemWalletClientForWaasTempo/createViemWalletClientForWaasTempo.ts
542
572
  const TEMPO_GAS_BUFFER_NUMERATOR = 130n;
@@ -690,8 +720,12 @@ const createViemWalletClientForWaasTempo = async ({ waasProvider, walletAccount,
690
720
  });
691
721
  return signature;
692
722
  },
693
- signTypedData: () => {
694
- throw new TempoTypedDataNotSupportedError();
723
+ signTypedData: async (typedData) => {
724
+ return await signTypedData({
725
+ typedData,
726
+ waasProvider,
727
+ walletAccount
728
+ }, dynamicClient);
695
729
  }
696
730
  }),
697
731
  chain,
@@ -881,6 +915,35 @@ const addWaasTempoExtension = (client = getDefaultClient()) => {
881
915
  });
882
916
  };
883
917
 
918
+ //#endregion
919
+ //#region src/errors/TempoTypedDataNotSupportedError/TempoTypedDataNotSupportedError.ts
920
+ /**
921
+ * Thrown when typed data is signed with a Tempo embedded wallet, which did
922
+ * not support it yet.
923
+ *
924
+ * @deprecated Tempo embedded wallets now sign typed data, so the SDK no longer
925
+ * throws this error. It stays exported so existing imports keep compiling.
926
+ *
927
+ * @example
928
+ * ```ts
929
+ * throw new TempoTypedDataNotSupportedError();
930
+ * ```
931
+ *
932
+ * @see createWalletProviderForWaasTempo
933
+ * @see addWaasTempoExtension
934
+ */
935
+ var TempoTypedDataNotSupportedError = class extends BaseError {
936
+ constructor() {
937
+ super({
938
+ cause: null,
939
+ code: "tempo_typed_data_not_supported",
940
+ docsUrl: null,
941
+ name: "TempoTypedDataNotSupportedError",
942
+ shortMessage: "Signing typed data is not supported for Tempo embedded wallets yet"
943
+ });
944
+ }
945
+ };
946
+
884
947
  //#endregion
885
948
  //#region src/exports/waas.ts
886
949
  assertPackageVersion(name, version);
@@ -1 +1 @@
1
- {"version":3,"file":"waas.esm.js","names":["signableMessage: string","calls: readonly TempoTransactionCall[]","createViemWalletClient: WaasTempoWalletProvider['createViemWalletClient']","getActiveNetworkId: WaasTempoWalletProvider['getActiveNetworkId']","getConnectedAddresses: WaasTempoWalletProvider['getConnectedAddresses']","signMessage: WaasTempoWalletProvider['signMessage']","signWaasMessage","signRawMessage: WaasTempoWalletProvider['signRawMessage']","signWaasRawMessage","signSerializedTransaction: WaasTempoWalletProvider['signSerializedTransaction']","switchActiveNetwork: WaasTempoWalletProvider['switchActiveNetwork']","destroy: WaasTempoWalletProvider['destroy']","packageName","packageVersion"],"sources":["../src/errors/TempoTransactionValidationError/TempoTransactionValidationError.ts","../src/waas/utils/assertTransactionCanBeBroadcast/assertTransactionCanBeBroadcast.ts","../src/waas/utils/getTempoWalletClient/getTempoWalletClient.ts","../src/waas/sendTempoTransaction/sendTempoTransaction.ts","../src/waas/signTempoTransaction/signTempoTransaction.ts","../src/constants.ts","../src/errors/InvalidTempoNetworkError/InvalidTempoNetworkError.ts","../src/errors/TempoBusinessAccountTransactionNotSupportedError/TempoBusinessAccountTransactionNotSupportedError.ts","../src/utils/tempoConfirmTransaction/tempoConfirmTransaction.ts","../src/utils/tempoTransferAmount/tempoTransferAmount.ts","../src/errors/TempoRawMessageNotUtf8Error/TempoRawMessageNotUtf8Error.ts","../src/errors/TempoTypedDataNotSupportedError/TempoTypedDataNotSupportedError.ts","../src/waas/utils/assertValidTempoTransactionCalls/assertValidTempoTransactionCalls.ts","../src/waas/utils/assertValidTempoFeePayerFields/assertValidTempoFeePayerFields.ts","../src/waas/utils/assertValidTempoValidityWindow/assertValidTempoValidityWindow.ts","../src/waas/utils/assertValidTempoTransactionRequest/assertValidTempoTransactionRequest.ts","../src/waas/utils/isBusinessAccountWalletAccount/isBusinessAccountWalletAccount.ts","../src/waas/utils/serializeTempoTransactionForWaas/serializeTempoTransactionForWaas.ts","../src/waas/utils/signMessage/signMessage.ts","../src/waas/utils/createViemWalletClientForWaasTempo/createViemWalletClientForWaasTempo.ts","../src/waas/utils/signRawMessage/signRawMessage.ts","../src/waas/utils/createWalletProviderForWaasTempo/createWalletProviderForWaasTempo.ts","../src/waas/addWaasTempoExtension/addWaasTempoExtension.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a Tempo transaction fails validation before signing, for\n * example because of a malformed address or non-hex call data.\n *\n * @example\n * ```ts\n * throw new TempoTransactionValidationError({ reason: 'malformed call data' });\n * ```\n *\n * @see createWalletProviderForWaasTempo\n * @see addWaasTempoExtension\n */\nexport class TempoTransactionValidationError extends BaseError {\n constructor({ reason }: { reason: string }) {\n super({\n cause: null,\n code: 'tempo_transaction_validation_error',\n docsUrl: null,\n name: 'TempoTransactionValidationError',\n shortMessage: `Invalid Tempo transaction: ${reason}`,\n });\n }\n}\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects a transaction that awaits a fee payer, because broadcasting it\n * before the sponsor signs would fail on the network.\n *\n * @param transaction - The transaction about to be broadcast.\n * @returns Nothing. Throws when the transaction awaits a fee payer.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is set.\n * @example\n * ```ts\n * assertTransactionCanBeBroadcast({ calls: [{ to: '0xabc' }] });\n * ```\n * @see signTempoTransaction\n * @see sendTempoTransaction\n * @notInstrumented\n */\nexport const assertTransactionCanBeBroadcast = (transaction: unknown): void => {\n if (\n typeof transaction === 'object' &&\n transaction !== null &&\n 'awaitingFeePayer' in transaction &&\n transaction.awaitingFeePayer\n )\n throw new TempoTransactionValidationError({\n reason:\n 'awaitingFeePayer transactions cannot be broadcast, use signTempoTransaction',\n });\n};\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { DynamicClient, WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Account, Chain, Transport, WalletClient } from 'viem';\n\nimport { isTempoWalletProvider } from '../../../isTempoWalletProvider/isTempoWalletProvider';\n\n/**\n * Creates the viem wallet client of a Tempo embedded wallet account.\n *\n * @param params.walletAccount - The Tempo embedded wallet account.\n * @param client - The Dynamic client instance.\n * @returns A viem wallet client bound to the Tempo account.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @example\n * ```ts\n * const walletClient = await getTempoWalletClient({ walletAccount }, client);\n * ```\n * @see sendTempoTransaction\n * @see signTempoTransaction\n * @notInstrumented\n */\nexport const getTempoWalletClient = async (\n { walletAccount }: { walletAccount: WalletAccount },\n client: DynamicClient\n): Promise<WalletClient<Transport, Chain, Account>> => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isTempoWalletProvider(walletProvider))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n assertDefined(\n walletProvider.createViemWalletClient,\n 'Tempo wallet provider cannot create a wallet client'\n );\n\n return await walletProvider.createViemWalletClient({ walletAccount });\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getDefaultClient,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { assertTransactionCanBeBroadcast } from '../utils/assertTransactionCanBeBroadcast';\nimport type { TempoTransactionRequest } from '../utils/assertValidTempoTransactionRequest';\nimport { getTempoWalletClient } from '../utils/getTempoWalletClient';\n\ntype SendTempoTransactionParams = Pick<\n TempoTransactionRequest,\n 'calls' | 'feeToken' | 'gas' | 'nonceKey' | 'validAfter' | 'validBefore'\n> & {\n walletAccount: WalletAccount;\n};\n\ntype SendTempoTransactionResult = { transactionHash: string };\n\n/**\n * Sends a Tempo transaction from a Tempo embedded wallet, including the\n * Tempo-only fields: batched calls, a fee token, a nonce key and a validity\n * window. Use it when a plain viem `sendTransaction` cannot express the\n * transaction.\n *\n * @param params.walletAccount - The Tempo embedded wallet account that sends.\n * @param params.calls - The calls the transaction executes atomically.\n * @param [params.feeToken] - TIP-20 token address used to pay the fee.\n * @param [params.gas] - Gas limit. Defaults to a buffered estimate.\n * @param [params.nonceKey] - Nonce key selecting a parallel nonce lane.\n * @param [params.validAfter] - Unix timestamp after which the transaction is valid.\n * @param [params.validBefore] - Unix timestamp after which the transaction expires.\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns The transaction hash.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is set, because a transaction that awaits a fee payer cannot be broadcast.\n * @example\n * ```ts\n * const { transactionHash } = await sendTempoTransaction({\n * calls: [\n * { data: transferData, to: tokenAddress },\n * { data: approveData, to: tokenAddress },\n * ],\n * feeToken: tokenAddress,\n * walletAccount,\n * });\n * ```\n * @see sendTip20Transaction\n * @see signTempoTransaction\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const sendTempoTransaction = async (\n { walletAccount, ...transaction }: SendTempoTransactionParams,\n client = getDefaultClient()\n): Promise<SendTempoTransactionResult> => {\n assertTransactionCanBeBroadcast(transaction);\n\n const walletClient = await getTempoWalletClient({ walletAccount }, client);\n\n assertDefined(\n walletClient.account.signTransaction,\n 'Tempo account cannot sign transactions'\n );\n\n const serializedTransaction = await walletClient.account.signTransaction(\n transaction\n );\n\n const transactionHash = await walletClient.sendRawTransaction({\n serializedTransaction,\n });\n\n return { transactionHash };\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getDefaultClient,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { getTempoWalletClient } from '../utils/getTempoWalletClient';\nimport type { TempoTransactionRequest } from '../utils/assertValidTempoTransactionRequest';\n\ntype SignTempoTransactionParams = Pick<\n TempoTransactionRequest,\n | 'awaitingFeePayer'\n | 'calls'\n | 'feeToken'\n | 'gas'\n | 'nonceKey'\n | 'validAfter'\n | 'validBefore'\n> & {\n walletAccount: WalletAccount;\n};\n\ntype SignTempoTransactionResult = { signedTransaction: string };\n\n/**\n * Signs a Tempo transaction with a Tempo embedded wallet without broadcasting\n * it. Set `awaitingFeePayer` to sign a transaction whose fee a sponsor pays:\n * the sender signs first, and the sponsor signs the returned transaction\n * afterwards and broadcasts it.\n *\n * @param params.walletAccount - The Tempo embedded wallet account that signs.\n * @param [params.awaitingFeePayer] - Leaves the fee to a sponsor who signs afterwards. Cannot be combined with `feeToken`.\n * @param [params.calls] - The calls the transaction executes atomically.\n * @param [params.feeToken] - TIP-20 token address used to pay the fee.\n * @param [params.gas] - Gas limit. Defaults to a buffered estimate.\n * @param [params.nonceKey] - Nonce key selecting a parallel nonce lane.\n * @param [params.validAfter] - Unix timestamp after which the transaction is valid.\n * @param [params.validBefore] - Unix timestamp after which the transaction expires.\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns The serialized signed transaction.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoTransactionValidationError} If a field is malformed or inconsistent.\n * @example\n * ```ts\n * const { signedTransaction } = await signTempoTransaction({\n * awaitingFeePayer: true,\n * calls: [{ data: transferData, to: tokenAddress }],\n * walletAccount,\n * });\n * ```\n * @see sendTempoTransaction\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const signTempoTransaction = async (\n { walletAccount, ...transaction }: SignTempoTransactionParams,\n client = getDefaultClient()\n): Promise<SignTempoTransactionResult> => {\n const walletClient = await getTempoWalletClient({ walletAccount }, client);\n\n assertDefined(\n walletClient.account.signTransaction,\n 'Tempo account cannot sign transactions'\n );\n\n const signedTransaction = await walletClient.account.signTransaction(\n transaction\n );\n\n return { signedTransaction };\n};\n","import type { Chain } from '@dynamic-labs-sdk/client';\n\n\n/**\n * Chain identifier shared by every Tempo wallet provider, network provider and\n * signing request.\n */\nexport const TEMPO_CHAIN = 'TEMPO' satisfies Chain;\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a Tempo wallet provider is asked to activate a network that is\n * not a Tempo network.\n *\n * @example\n * ```ts\n * throw new InvalidTempoNetworkError({ networkId: '1' });\n * ```\n *\n * @see isTempoChainId\n * @see addWaasTempoExtension\n */\nexport class InvalidTempoNetworkError extends BaseError {\n constructor({ networkId }: { networkId: string | number }) {\n super({\n cause: null,\n code: 'invalid_tempo_network_error',\n docsUrl: null,\n name: 'InvalidTempoNetworkError',\n shortMessage: `Network ${networkId} is not a Tempo network`,\n });\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a business-account Tempo wallet is asked to sign a transaction.\n * Business-account transactions need a signing-quorum intent, which the\n * embedded wallet signer does not support for Tempo transactions yet.\n *\n * @example\n * ```ts\n * throw new TempoBusinessAccountTransactionNotSupportedError();\n * ```\n *\n * @see addWaasTempoExtension\n */\nexport class TempoBusinessAccountTransactionNotSupportedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_business_account_transaction_not_supported_error',\n docsUrl: null,\n name: 'TempoBusinessAccountTransactionNotSupportedError',\n shortMessage:\n 'Signing Tempo transactions with a business account wallet is not supported',\n });\n }\n}\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { ConfirmTransactionParams } from '@dynamic-labs-sdk/client/core';\nimport type { DynamicClient } from '@dynamic-labs-sdk/client';\n\nimport { getTempoPublicClient } from '../../getTempoPublicClient/getTempoPublicClient';\nimport { isTempoWalletAccount } from '../../isTempoWalletAccount/isTempoWalletAccount';\n\n/**\n * Waits until a transaction sent from a Tempo wallet account is included in a\n * block.\n *\n * @param params.transactionHash - The hash of the transaction to wait for.\n * @param params.walletAccount - The Tempo wallet account that sent it.\n * @param client - The Dynamic client instance.\n * @returns Nothing. Resolves once the transaction receipt is available.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @example\n * ```ts\n * await tempoConfirmTransaction({ transactionHash, walletAccount }, client);\n * ```\n * @see tempoTransferAmount\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const tempoConfirmTransaction = async (\n { transactionHash, walletAccount }: ConfirmTransactionParams,\n client: DynamicClient\n): Promise<void> => {\n if (!isTempoWalletAccount(walletAccount))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n const publicClient = await getTempoPublicClient({ walletAccount }, client);\n\n await publicClient.waitForTransactionReceipt({\n hash: transactionHash as `0x${string}`,\n });\n};\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { TransferAmountParams } from '@dynamic-labs-sdk/client/core';\n\nimport { TempoNativeTokenError } from '../../errors/TempoNativeTokenError/TempoNativeTokenError';\nimport { isTempoWalletAccount } from '../../isTempoWalletAccount/isTempoWalletAccount';\nimport { sendTip20Transaction } from '../../sendTip20Transaction/sendTip20Transaction';\nimport type { CreateTempoViemWalletClient } from '../../TempoWalletProvider.types';\n\ntype TempoTransferAmountParams = TransferAmountParams & {\n createViemWalletClient: CreateTempoViemWalletClient;\n};\n\ntype TempoTransferAmountResult = { transactionHash: string };\n\n/**\n * Transfers a TIP-20 token from a Tempo wallet account. Tempo has no native\n * token, so the token is required.\n *\n * @param params.amount - Human-readable amount, e.g. '1.5'.\n * @param params.recipient - Recipient address.\n * @param params.token - The TIP-20 token to transfer.\n * @param params.walletAccount - The Tempo wallet account that sends.\n * @param params.createViemWalletClient - Creates the viem wallet client that signs.\n * @returns The transaction hash.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoNativeTokenError} If no token is provided.\n * @example\n * ```ts\n * const { transactionHash } = await tempoTransferAmount({\n * amount: '1.5',\n * createViemWalletClient,\n * recipient: '0xRecipient',\n * token: { address: '0xTip20Token', decimals: 6 },\n * walletAccount,\n * });\n * ```\n * @see sendTip20Transaction\n * @see tempoConfirmTransaction\n * @notInstrumented\n */\nexport const tempoTransferAmount = async ({\n amount,\n createViemWalletClient,\n recipient,\n token,\n walletAccount,\n}: TempoTransferAmountParams): Promise<TempoTransferAmountResult> => {\n if (!isTempoWalletAccount(walletAccount))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n if (!token?.address) throw new TempoNativeTokenError();\n\n const walletClient = await createViemWalletClient({ walletAccount });\n\n const transactionHash = await sendTip20Transaction({\n amount,\n decimals: token.decimals,\n to: recipient,\n tokenAddress: token.address,\n walletClient,\n });\n\n return { transactionHash };\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a raw message passed to a Tempo embedded wallet is not valid\n * UTF-8 text. The embedded wallet signs text messages, so bytes that cannot be\n * decoded and re-encoded unchanged would be signed as different bytes.\n *\n * @example\n * ```ts\n * throw new TempoRawMessageNotUtf8Error();\n * ```\n *\n * @see createWalletProviderForWaasTempo\n */\nexport class TempoRawMessageNotUtf8Error extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_raw_message_not_utf8_error',\n docsUrl: null,\n name: 'TempoRawMessageNotUtf8Error',\n shortMessage:\n 'Raw messages must be valid UTF-8 text to be signed by a Tempo embedded wallet',\n });\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when typed data is signed with a Tempo embedded wallet, which does\n * not support it yet.\n *\n * @example\n * ```ts\n * throw new TempoTypedDataNotSupportedError();\n * ```\n *\n * @see createWalletProviderForWaasTempo\n * @see addWaasTempoExtension\n */\nexport class TempoTypedDataNotSupportedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_typed_data_not_supported',\n docsUrl: null,\n name: 'TempoTypedDataNotSupportedError',\n shortMessage:\n 'Signing typed data is not supported for Tempo embedded wallets yet',\n });\n }\n}\n","// jsdoc-completeness-disable @see\nimport { isAddress, isHex } from 'viem';\n\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\n\n/**\n * Rejects malformed calls before they reach the signer, which would otherwise\n * fail with an opaque parsing error.\n *\n * @param params.calls - The Tempo calls to validate.\n * @returns Nothing. Throws on malformed input.\n * @throws {TempoTransactionValidationError} If a call is malformed or the batch is empty.\n * @example\n * ```ts\n * assertValidTempoTransactionCalls({ calls: [{ to, data, value }] });\n * ```\n * @notInstrumented\n */\nexport const assertValidTempoTransactionCalls = ({\n calls,\n}: {\n calls: readonly TempoTransactionCall[];\n}): void => {\n if (calls.length === 0)\n throw new TempoTransactionValidationError({\n reason: 'at least one call is required',\n });\n\n for (const call of calls) {\n if (call.to !== undefined && !isAddress(call.to))\n throw new TempoTransactionValidationError({\n reason: 'malformed call address',\n });\n if (call.data !== undefined && !isHex(call.data))\n throw new TempoTransactionValidationError({\n reason: 'malformed call data',\n });\n if (call.value !== undefined && typeof call.value !== 'bigint')\n throw new TempoTransactionValidationError({\n reason: 'malformed call value',\n });\n }\n};\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects an inconsistent fee payer setup before it reaches the signer. A\n * transaction that awaits a fee payer leaves the fee token to the sponsor, so\n * it cannot name one.\n *\n * @param params.awaitingFeePayer - Whether a sponsor signs the transaction afterwards.\n * @param [params.feeToken] - The TIP-20 token address that pays the fee.\n * @returns Nothing. Throws on an inconsistent setup.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is not true or is combined with `feeToken`.\n * @example\n * ```ts\n * assertValidTempoFeePayerFields({ awaitingFeePayer: true });\n * ```\n * @see assertValidTempoTransactionRequest\n * @see signTempoTransaction\n * @notInstrumented\n */\nexport const assertValidTempoFeePayerFields = ({\n awaitingFeePayer,\n feeToken,\n}: {\n awaitingFeePayer?: true;\n feeToken?: string;\n}): void => {\n if (awaitingFeePayer !== undefined && awaitingFeePayer !== true)\n throw new TempoTransactionValidationError({\n reason: 'awaitingFeePayer must be true',\n });\n\n if (awaitingFeePayer && feeToken !== undefined)\n throw new TempoTransactionValidationError({\n reason: 'awaitingFeePayer cannot be combined with feeToken',\n });\n};\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects a malformed validity window before it reaches the signer. Both\n * bounds are non-negative integer Unix timestamps in seconds, and the window\n * must open before it closes.\n *\n * @param params.validAfter - Unix timestamp after which the transaction is valid.\n * @param params.validBefore - Unix timestamp after which the transaction expires.\n * @returns Nothing. Throws on a malformed window.\n * @throws {TempoTransactionValidationError} If a bound is not a non-negative integer or `validAfter` is not before `validBefore`.\n * @example\n * ```ts\n * assertValidTempoValidityWindow({ validAfter: 100, validBefore: 200 });\n * ```\n * @see assertValidTempoTransactionRequest\n * @see sendTempoTransaction\n * @notInstrumented\n */\nexport const assertValidTempoValidityWindow = ({\n validAfter,\n validBefore,\n}: {\n validAfter?: number;\n validBefore?: number;\n}): void => {\n for (const [field, value] of [\n ['validAfter', validAfter],\n ['validBefore', validBefore],\n ] as const) {\n if (value !== undefined && (!Number.isInteger(value) || value < 0))\n throw new TempoTransactionValidationError({\n reason: `${field} must be a non-negative integer timestamp`,\n });\n }\n\n if (\n validAfter !== undefined &&\n validBefore !== undefined &&\n validAfter >= validBefore\n )\n throw new TempoTransactionValidationError({\n reason: 'validAfter must be before validBefore',\n });\n};\n","// jsdoc-completeness-disable @see\nimport { isAddress } from 'viem';\nimport type { Hex, TransactionSerializable } from 'viem';\n\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport { assertValidTempoFeePayerFields } from '../assertValidTempoFeePayerFields';\nimport { assertValidTempoValidityWindow } from '../assertValidTempoValidityWindow';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\n\n/**\n * A Tempo transaction request. Extends the standard viem transaction with the\n * Tempo fields: batched `calls`, `feeToken`, `nonceKey` (2D nonce),\n * `validAfter` / `validBefore` expirations and `awaitingFeePayer`, which leaves\n * the fee to be paid by a sponsor who signs the transaction afterwards.\n *\n * @example\n * ```ts\n * const transaction: TempoTransactionRequest = {\n * calls: [{ to: '0xabc', data: '0xa9059cbb' }],\n * feeToken: '0xdef',\n * };\n * ```\n */\nexport type TempoTransactionRequest = TransactionSerializable & {\n awaitingFeePayer?: true;\n calls?: readonly TempoTransactionCall[];\n feeToken?: Hex;\n nonceKey?: bigint;\n validAfter?: number;\n validBefore?: number;\n};\n\n/**\n * Rejects malformed Tempo transaction fields before they reach the signer,\n * which would otherwise fail with an opaque parsing error.\n *\n * @param params.transaction - The Tempo transaction request to validate.\n * @param params.chainId - The chain id of the active Tempo network.\n * @returns Nothing. Throws on malformed input.\n * @throws {TempoTransactionValidationError} If a field is malformed or inconsistent.\n * @example\n * ```ts\n * assertValidTempoTransactionRequest({ transaction, chainId: 4217 });\n * ```\n * @notInstrumented\n */\nexport const assertValidTempoTransactionRequest = ({\n transaction,\n chainId,\n}: {\n chainId: number;\n transaction: TempoTransactionRequest;\n}): void => {\n if (transaction.feeToken !== undefined && !isAddress(transaction.feeToken))\n throw new TempoTransactionValidationError({\n reason: 'malformed feeToken address',\n });\n\n assertValidTempoFeePayerFields(transaction);\n\n if (\n transaction.calls !== undefined &&\n (transaction.to !== undefined ||\n transaction.data !== undefined ||\n transaction.value !== undefined)\n )\n throw new TempoTransactionValidationError({\n reason: 'calls cannot be combined with top-level to, data or value',\n });\n\n if (transaction.chainId !== undefined && transaction.chainId !== chainId)\n throw new TempoTransactionValidationError({\n reason: 'chainId does not match the active Tempo network',\n });\n\n if (\n transaction.nonceKey !== undefined &&\n (typeof transaction.nonceKey !== 'bigint' || transaction.nonceKey < 0n)\n )\n throw new TempoTransactionValidationError({\n reason: 'nonceKey must be a non-negative bigint',\n });\n\n assertValidTempoValidityWindow(transaction);\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\ntype BusinessAccountWalletAccount = WalletAccount & {\n businessAccountId: string;\n};\n\n/**\n * Type guard — returns true if the wallet account belongs to a business\n * account, meaning its signatures need a signing-quorum approval.\n *\n * @param walletAccount - The wallet account to check.\n * @returns Whether the wallet account has a business account id.\n * @example\n * ```ts\n * if (isBusinessAccountWalletAccount(walletAccount)) {\n * console.log(walletAccount.businessAccountId);\n * }\n * ```\n * @see signMessage\n * @see signRawMessage\n * @notInstrumented\n */\nexport const isBusinessAccountWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BusinessAccountWalletAccount =>\n 'businessAccountId' in walletAccount &&\n typeof walletAccount.businessAccountId === 'string' &&\n walletAccount.businessAccountId !== '';\n","import type { Hex } from 'viem';\n\n/**\n * A single call inside a Tempo transaction.\n *\n * @example\n * ```ts\n * const call: TempoTransactionCall = { data: '0xa9059cbb', to: '0xabc' };\n * ```\n *\n * @see TempoTransactionRequest\n * @see sendTip20Transaction\n */\nexport type TempoTransactionCall = {\n data?: Hex;\n to?: Hex;\n value?: bigint;\n};\n\nexport type SerializeTempoTransactionForWaasParams = {\n /** Leaves the fee to a sponsor who signs the transaction after the sender. */\n awaitingFeePayer?: boolean;\n /** Calls executed atomically by the transaction, one entry per batched call. */\n calls: readonly TempoTransactionCall[];\n chainId: number;\n /** TIP-20 token address used to pay the fee. */\n feeToken?: Hex;\n gas: bigint;\n maxFeePerGas: bigint;\n maxPriorityFeePerGas: bigint;\n nonce: number;\n /** 2D nonce key selecting the parallel nonce lane. */\n nonceKey?: bigint;\n /** Unix timestamp after which the transaction becomes valid. */\n validAfter?: number;\n /** Unix timestamp after which the transaction expires. */\n validBefore?: number;\n};\n\n/**\n * Serializes a Tempo transaction to the JSON an embedded wallet signs.\n * BigInt values are written as decimal strings because JSON has no BigInt type.\n *\n * @param params - The Tempo transaction fields to serialize.\n * @returns The JSON-encoded transaction.\n * @example\n * ```ts\n * const transaction = serializeTempoTransactionForWaas({\n * calls: [{ to: '0xabc', value: 1n }],\n * chainId: 4217,\n * gas: 300_000n,\n * maxFeePerGas: 1_000n,\n * maxPriorityFeePerGas: 100n,\n * nonce: 0,\n * });\n * ```\n * @see addWaasTempoExtension\n * @see createWalletProviderForWaasTempo\n * @notInstrumented\n */\nexport const serializeTempoTransactionForWaas = ({\n awaitingFeePayer,\n calls,\n chainId,\n feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey,\n validAfter,\n validBefore,\n}: SerializeTempoTransactionForWaasParams): string =>\n JSON.stringify(\n {\n calls: calls.map(({ data, to, value }) => ({ data, to, value })),\n chainId,\n feePayer: awaitingFeePayer ? true : undefined,\n feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey,\n validAfter,\n validBefore,\n },\n (_key, value: unknown) =>\n typeof value === 'bigint' ? value.toString() : value\n );\n","import {\n type DynamicClient,\n type WalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport { prepareSigningQuorumApproval } from '@dynamic-labs-sdk/client/waas/core';\nimport type {\n ApprovalQuorumRequestContext,\n WaasProvider,\n} from '@dynamic-labs-sdk/client/waas/core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\n\ntype SignMessageParams = {\n approvalQuorum?: ApprovalQuorumRequestContext;\n message: string;\n waasProvider: WaasProvider;\n walletAccount: WalletAccount;\n};\n\ntype SignMessageResult = { signature: string };\n\n/**\n * Signs a message with a Tempo embedded wallet account.\n *\n * For a business-account wallet, this first prepares and signs the quorum\n * intent for the message. Personal wallets pass `approvalQuorum` through\n * unchanged.\n *\n * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.\n * @param params.message - The message to sign.\n * @param params.waasProvider - The WaaS provider that prepares the intent and signs.\n * @param params.walletAccount - The wallet account that signs the message.\n * @param client - The Dynamic client holding the current session key.\n * @returns The signature.\n * @example\n * ```ts\n * const { signature } = await signMessage(\n * { message, waasProvider, walletAccount },\n * client\n * );\n * ```\n * @see {@link prepareSigningQuorumApproval} for the quorum intent step.\n * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.\n * @notInstrumented\n */\nexport const signMessage = async (\n { approvalQuorum, message, waasProvider, walletAccount }: SignMessageParams,\n client: DynamicClient\n): Promise<SignMessageResult> => {\n const preparedApprovalQuorum = await prepareSigningQuorumApproval(\n {\n approvalQuorum,\n chainName: TEMPO_CHAIN,\n operation: { kind: 'message', message },\n waasClient: await waasProvider.getWaasClient(),\n walletAccount,\n },\n client\n );\n\n return waasProvider.signMessage({\n approvalQuorum: preparedApprovalQuorum,\n message,\n walletAccount,\n });\n};\n","import {\n type DynamicClient,\n type WalletAccount,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';\nimport type {\n Account,\n Chain,\n Hex,\n HttpTransportConfig,\n Transport,\n WalletClient,\n WalletClientConfig,\n} from 'viem';\nimport {\n bytesToHex,\n createPublicClient,\n createWalletClient,\n hexToString,\n http,\n isHex,\n stringToHex,\n} from 'viem';\nimport { toAccount } from 'viem/accounts';\n\nimport { TempoBusinessAccountTransactionNotSupportedError } from '../../../errors/TempoBusinessAccountTransactionNotSupportedError';\nimport { TempoRawMessageNotUtf8Error } from '../../../errors/TempoRawMessageNotUtf8Error';\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport { TempoTypedDataNotSupportedError } from '../../../errors/TempoTypedDataNotSupportedError';\nimport { mapNetworkDataToViemChain } from '../../../utils/mapNetworkDataToViemChain';\nimport { assertTransactionCanBeBroadcast } from '../assertTransactionCanBeBroadcast';\nimport { assertValidTempoTransactionCalls } from '../assertValidTempoTransactionCalls';\nimport { assertValidTempoTransactionRequest } from '../assertValidTempoTransactionRequest';\nimport type { TempoTransactionRequest } from '../assertValidTempoTransactionRequest';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\nimport { serializeTempoTransactionForWaas } from '../serializeTempoTransactionForWaas';\nimport { signMessage } from '../signMessage';\n\nconst TEMPO_GAS_BUFFER_NUMERATOR = 130n;\nconst TEMPO_GAS_BUFFER_DENOMINATOR = 100n;\nconst TEMPO_MIN_GAS = 300_000n;\n\n/**\n * Address of the Tempo nonce manager, which keeps one nonce counter per\n * account and nonce key.\n */\nconst TEMPO_NONCE_MANAGER_ADDRESS =\n '0x4e4F4E4345000000000000000000000000000000';\n\nconst TEMPO_NONCE_MANAGER_ABI = [\n {\n inputs: [\n { name: 'account', type: 'address' },\n { name: 'nonceKey', type: 'uint256' },\n ],\n name: 'getNonce',\n outputs: [{ name: 'nonce', type: 'uint64' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const;\n\ntype CreateViemWalletClientForWaasTempoParams = {\n httpTransportConfig?: HttpTransportConfig;\n viemWalletClientConfig?: Omit<\n WalletClientConfig,\n 'account' | 'chain' | 'transport'\n >;\n waasProvider: WaasProvider;\n walletAccount: WalletAccount;\n};\n\n/**\n * Creates a viem wallet client for a Tempo embedded wallet account.\n *\n * Transactions are signed as Tempo transactions: batched `calls`, `feeToken`,\n * `nonceKey`, `validAfter` / `validBefore` and `awaitingFeePayer` pass through\n * to the signer. Gas\n * is the larger of the caller's value and a 30% buffered estimate with a 300k\n * floor, fees are at least the network gas price, and the nonce is the next\n * one on the requested nonce lane.\n *\n * @param params.waasProvider - The embedded wallet provider that signs.\n * @param params.walletAccount - The Tempo embedded wallet account that signs.\n * @param [params.httpTransportConfig] - Optional viem HTTP transport config.\n * @param [params.viemWalletClientConfig] - Optional extra viem client config.\n * @param client - The Dynamic client instance.\n * @returns A viem wallet client bound to the Tempo account.\n * @throws If no active network data exists for the wallet account.\n * @example\n * ```ts\n * const walletClient = await createViemWalletClientForWaasTempo(\n * { waasProvider, walletAccount },\n * client\n * );\n *\n * const hash = await walletClient.sendTransaction({ to, data });\n * ```\n * @see serializeTempoTransactionForWaas\n * @see createWalletProviderForWaasTempo\n * @notInstrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const createViemWalletClientForWaasTempo = async (\n {\n waasProvider,\n walletAccount,\n httpTransportConfig,\n viemWalletClientConfig,\n }: CreateViemWalletClientForWaasTempoParams,\n dynamicClient: DynamicClient\n): Promise<WalletClient<Transport, Chain, Account>> => {\n const { networkData: activeNetworkData } = await getActiveNetworkData(\n { walletAccount },\n dynamicClient\n );\n\n assertDefined(\n activeNetworkData,\n 'No active network data found for the provided wallet account'\n );\n\n const chain = mapNetworkDataToViemChain(activeNetworkData);\n const transport = http(\n activeNetworkData.rpcUrls.http[0],\n httpTransportConfig\n );\n const publicClient = createPublicClient({ chain, transport });\n\n const estimateTempoGas = async ({\n calls,\n hasExplicitGas,\n }: {\n calls: readonly TempoTransactionCall[];\n hasExplicitGas: boolean;\n }): Promise<bigint> => {\n const estimates = await Promise.all(\n calls.map(async (call) => {\n try {\n return await publicClient.estimateGas({\n account: walletAccount.address as Hex,\n data: call.data,\n to: call.to,\n value: call.value,\n });\n } catch (error) {\n if (calls.length === 1 && !hasExplicitGas) throw error;\n\n return TEMPO_MIN_GAS;\n }\n })\n );\n\n const estimate = estimates.reduce((total, value) => total + value, 0n);\n const buffered =\n (estimate * TEMPO_GAS_BUFFER_NUMERATOR) / TEMPO_GAS_BUFFER_DENOMINATOR;\n\n return buffered > TEMPO_MIN_GAS ? buffered : TEMPO_MIN_GAS;\n };\n\n const getTempoNonce = async ({\n nonceKey,\n }: {\n nonceKey?: bigint;\n }): Promise<number> => {\n if (nonceKey === undefined || nonceKey === 0n)\n return publicClient.getTransactionCount({\n address: walletAccount.address as Hex,\n });\n\n return Number(\n await publicClient.readContract({\n abi: TEMPO_NONCE_MANAGER_ABI,\n address: TEMPO_NONCE_MANAGER_ADDRESS,\n args: [walletAccount.address as Hex, nonceKey],\n functionName: 'getNonce',\n })\n );\n };\n\n const walletClient = createWalletClient({\n account: toAccount({\n address: walletAccount.address as Hex,\n signMessage: async ({ message }) => {\n let signableMessage: string;\n\n if (typeof message === 'string') signableMessage = message;\n else {\n const raw = isHex(message.raw)\n ? message.raw\n : bytesToHex(message.raw);\n\n signableMessage = hexToString(raw);\n\n if (stringToHex(signableMessage) !== raw.toLowerCase())\n throw new TempoRawMessageNotUtf8Error();\n }\n\n const { signature } = await signMessage(\n { message: signableMessage, waasProvider, walletAccount },\n dynamicClient\n );\n\n return signature as Hex;\n },\n signTransaction: async (\n transaction: TempoTransactionRequest\n ): Promise<Hex> => {\n if (isBusinessAccountWalletAccount(walletAccount))\n throw new TempoBusinessAccountTransactionNotSupportedError();\n\n assertValidTempoTransactionRequest({ chainId: chain.id, transaction });\n\n const calls: readonly TempoTransactionCall[] = transaction.calls ?? [\n {\n data: transaction.data ?? '0x',\n to: transaction.to ?? undefined,\n value: transaction.value ?? 0n,\n },\n ];\n\n assertValidTempoTransactionCalls({ calls });\n\n const estimatedGas = await estimateTempoGas({\n calls,\n hasExplicitGas: transaction.gas !== undefined,\n });\n const gas =\n transaction.gas !== undefined && transaction.gas > estimatedGas\n ? transaction.gas\n : estimatedGas;\n\n const nonce =\n transaction.nonceKey !== undefined && transaction.nonceKey !== 0n\n ? await getTempoNonce({ nonceKey: transaction.nonceKey })\n : transaction.nonce ??\n (await getTempoNonce({ nonceKey: transaction.nonceKey }));\n\n const gasPrice = await publicClient.getGasPrice();\n const priorityGasPrice = gasPrice / 10n;\n const requestedGasPrice =\n 'gasPrice' in transaction ? transaction.gasPrice : undefined;\n const requestedMaxFeePerGas =\n transaction.maxFeePerGas ?? requestedGasPrice;\n const requestedMaxPriorityFeePerGas =\n transaction.maxPriorityFeePerGas ?? requestedGasPrice;\n const maxFeePerGas =\n requestedMaxFeePerGas !== undefined &&\n requestedMaxFeePerGas > gasPrice\n ? requestedMaxFeePerGas\n : gasPrice;\n const maxPriorityFeePerGas =\n requestedMaxPriorityFeePerGas !== undefined &&\n requestedMaxPriorityFeePerGas > priorityGasPrice\n ? requestedMaxPriorityFeePerGas\n : priorityGasPrice;\n\n if (maxPriorityFeePerGas > maxFeePerGas)\n throw new TempoTransactionValidationError({\n reason: 'maxPriorityFeePerGas must not exceed maxFeePerGas',\n });\n\n const serializedTransaction = serializeTempoTransactionForWaas({\n awaitingFeePayer: transaction.awaitingFeePayer,\n calls,\n chainId: chain.id,\n feeToken: transaction.feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey: transaction.nonceKey,\n validAfter: transaction.validAfter,\n validBefore: transaction.validBefore,\n });\n\n const { signature } = await waasProvider.signSerializedTransaction({\n serializedTransaction,\n walletAccount,\n });\n\n return signature as Hex;\n },\n signTypedData: () => {\n throw new TempoTypedDataNotSupportedError();\n },\n }),\n chain,\n transport,\n ...viemWalletClientConfig,\n });\n\n const { sendTransaction } = walletClient;\n\n return Object.assign(walletClient, {\n sendTransaction: (async (transaction) => {\n assertTransactionCanBeBroadcast(transaction);\n\n return await sendTransaction(transaction);\n }) as typeof sendTransaction,\n });\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n} from '@dynamic-labs-sdk/client';\nimport { prepareSigningQuorumApproval } from '@dynamic-labs-sdk/client/waas/core';\nimport type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\n\ntype SignRawMessageParams = Parameters<WaasProvider['signRawMessage']>[0] & {\n waasProvider: WaasProvider;\n};\n\ntype SignRawMessageResult = { signature: string };\n\n/**\n * Signs a raw message with a Tempo embedded wallet account.\n *\n * For a business-account wallet, `rawSign` is required: the quorum intent\n * commits to its preimage, so the intent can be checked before signing.\n *\n * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.\n * @param params.message - The raw message to sign.\n * @param [params.password] - The wallet password, if the wallet is password protected.\n * @param [params.rawSign] - The hex preimage and hash metadata that the intent commits to.\n * @param params.waasProvider - The WaaS provider that prepares the intent and signs.\n * @param params.walletAccount - The wallet account that signs the message.\n * @param client - The Dynamic client holding the current session key.\n * @returns The signature.\n * @throws {InvalidParamError} If a business-account wallet has no `rawSign`.\n * @example\n * ```ts\n * const { signature } = await signRawMessage(\n * { message, rawSign, waasProvider, walletAccount },\n * client\n * );\n * ```\n * @see {@link prepareSigningQuorumApproval} for the quorum intent step.\n * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.\n * @notInstrumented\n */\nexport const signRawMessage = async (\n {\n approvalQuorum,\n message,\n password,\n rawSign,\n waasProvider,\n walletAccount,\n }: SignRawMessageParams,\n client: DynamicClient\n): Promise<SignRawMessageResult> => {\n if (isBusinessAccountWalletAccount(walletAccount) && !rawSign)\n throw new InvalidParamError(\n 'Raw signing for a business-account wallet requires a verifiable preimage'\n );\n\n const preparedApprovalQuorum = rawSign\n ? await prepareSigningQuorumApproval(\n {\n approvalQuorum,\n chainName: TEMPO_CHAIN,\n operation: { kind: 'raw', message, rawSign },\n waasClient: await waasProvider.getWaasClient(),\n walletAccount,\n },\n client\n )\n : approvalQuorum;\n\n return waasProvider.signRawMessage({\n approvalQuorum: preparedApprovalQuorum,\n message,\n password,\n rawSign,\n walletAccount,\n });\n};\n","import { type DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n switchActiveNetworkInLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n DYNAMIC_WAAS_METADATA,\n createWaasProvider,\n getAllUserWaasAddressesForChain,\n} from '@dynamic-labs-sdk/client/waas/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\nimport { InvalidTempoNetworkError } from '../../../errors/InvalidTempoNetworkError';\nimport { TempoBusinessAccountTransactionNotSupportedError } from '../../../errors/TempoBusinessAccountTransactionNotSupportedError';\nimport { isTempoChainId } from '../../../utils/tempoChainIds/tempoChainIds';\nimport { tempoConfirmTransaction } from '../../../utils/tempoConfirmTransaction';\nimport { tempoTransferAmount } from '../../../utils/tempoTransferAmount';\nimport type { WaasTempoWalletProvider } from '../../WaasTempoWalletProvider.types';\nimport { createViemWalletClientForWaasTempo } from '../createViemWalletClientForWaasTempo';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\nimport { signMessage as signWaasMessage } from '../signMessage';\nimport { signRawMessage as signWaasRawMessage } from '../signRawMessage';\n\ntype CreateWalletProviderForWaasTempoParams = {\n dynamicClient: DynamicClient;\n};\n\n/**\n * Creates the embedded wallet provider for the Tempo chain.\n *\n * @param params.dynamicClient - The Dynamic client the provider is bound to.\n * @returns A wallet provider that signs with Tempo embedded wallets.\n * @throws {InvalidTempoNetworkError} When the returned provider is asked to switch to a network that is not a Tempo network.\n * @throws {TempoBusinessAccountTransactionNotSupportedError} When the returned provider is asked to sign a transaction with a business-account wallet.\n * @example\n * ```ts\n * const walletProvider = createWalletProviderForWaasTempo({ dynamicClient });\n * ```\n * @see addWaasTempoExtension\n * @see WaasTempoWalletProvider\n * @notInstrumented\n */\nexport const createWalletProviderForWaasTempo = ({\n dynamicClient,\n}: CreateWalletProviderForWaasTempoParams): WaasTempoWalletProvider => {\n const chain = TEMPO_CHAIN;\n\n const walletProviderType = WalletProviderEnum.EmbeddedWallet;\n\n const key = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType,\n });\n\n const waasProvider = createWaasProvider({\n chain,\n sdkClient: dynamicClient,\n });\n\n const createViemWalletClient: WaasTempoWalletProvider['createViemWalletClient'] =\n async ({ walletAccount, httpTransportConfig, viemWalletClientConfig }) =>\n createViemWalletClientForWaasTempo(\n {\n httpTransportConfig,\n viemWalletClientConfig,\n waasProvider,\n walletAccount,\n },\n dynamicClient\n );\n\n const getActiveNetworkId: WaasTempoWalletProvider['getActiveNetworkId'] =\n () =>\n getActiveNetworkIdFromLastKnownRegistry({\n client: dynamicClient,\n walletProviderKey: key,\n });\n\n const getConnectedAddresses: WaasTempoWalletProvider['getConnectedAddresses'] =\n () =>\n Promise.resolve({\n addresses: getAllUserWaasAddressesForChain({ chain }, dynamicClient),\n });\n\n const signMessage: WaasTempoWalletProvider['signMessage'] = async ({\n approvalQuorum,\n message,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n\n return signWaasMessage(\n { approvalQuorum, message, waasProvider, walletAccount },\n dynamicClient\n );\n };\n\n const signRawMessage: WaasTempoWalletProvider['signRawMessage'] = async (\n args\n ) => signWaasRawMessage({ ...args, waasProvider }, dynamicClient);\n\n const signSerializedTransaction: WaasTempoWalletProvider['signSerializedTransaction'] =\n async (args) => {\n if (isBusinessAccountWalletAccount(args.walletAccount))\n throw new TempoBusinessAccountTransactionNotSupportedError();\n\n return await waasProvider.signSerializedTransaction(args);\n };\n\n const switchActiveNetwork: WaasTempoWalletProvider['switchActiveNetwork'] =\n async ({ networkId }) => {\n if (!isTempoChainId(networkId))\n throw new InvalidTempoNetworkError({ networkId });\n\n await switchActiveNetworkInLastKnownRegistry({\n client: dynamicClient,\n networkId,\n walletProviderKey: key,\n });\n };\n\n const destroy: WaasTempoWalletProvider['destroy'] = (args) =>\n waasProvider.destroy(args);\n\n return {\n ...waasProvider,\n chain,\n confirmTransaction: (args) => tempoConfirmTransaction(args, dynamicClient),\n createViemWalletClient,\n destroy,\n getActiveNetworkId,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(DYNAMIC_WAAS_METADATA.displayName),\n key,\n metadata: {\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n icon: DYNAMIC_WAAS_METADATA.icon,\n },\n signMessage,\n signRawMessage,\n signSerializedTransaction,\n supportsFeeTokenSelection: true,\n switchActiveNetwork,\n transferAmount: (args) =>\n tempoTransferAmount({ ...args, createViemWalletClient }),\n walletProviderType,\n };\n};\n","import {\n WalletProviderPriority,\n getDefaultClient,\n getWalletProviderRegistry,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerTempoNetworkProviderBuilder } from '../../registerTempoNetworkProviderBuilder/registerTempoNetworkProviderBuilder';\nimport { createWalletProviderForWaasTempo } from '../utils/createWalletProviderForWaasTempo';\n\n/** Registry key for the Tempo embedded wallet extension registered by addWaasTempoExtension. */\nexport const WAAS_TEMPO_EXTENSION_KEY = 'waasTempo';\n\n/**\n * Registers Tempo embedded wallet support with the Dynamic client: the Tempo\n * network provider and the embedded wallet provider for Tempo.\n * Calling it more than once is safe: later calls do nothing.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns Nothing. The extension is registered on the client.\n * @example\n * ```ts\n * import { addWaasTempoExtension } from '@dynamic-labs-sdk/tempo/waas';\n *\n * addWaasTempoExtension(dynamicClient);\n * ```\n * @see addTempoExtension\n * @see isTempoWalletAccount\n * @notInstrumented\n */\nexport const addWaasTempoExtension = (client = getDefaultClient()): void => {\n if (hasExtension({ extensionKey: WAAS_TEMPO_EXTENSION_KEY }, client)) {\n return;\n }\n\n registerExtension({ extensionKey: WAAS_TEMPO_EXTENSION_KEY }, client);\n registerTempoNetworkProviderBuilder(client);\n\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n const walletProvider = createWalletProviderForWaasTempo({\n dynamicClient: client,\n });\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SDK,\n walletProvider,\n });\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 { sendTempoTransaction } from '../waas/sendTempoTransaction/sendTempoTransaction';\nexport { signTempoTransaction } from '../waas/signTempoTransaction/signTempoTransaction';\nexport { addWaasTempoExtension } from '../waas/addWaasTempoExtension/addWaasTempoExtension';\nexport { InvalidTempoNetworkError } from '../errors/InvalidTempoNetworkError';\nexport { TempoTransactionValidationError } from '../errors/TempoTransactionValidationError';\nexport { TempoTypedDataNotSupportedError } from '../errors/TempoTypedDataNotSupportedError';\nexport type { TempoTransactionRequest } from '../waas/utils/assertValidTempoTransactionRequest';\nexport type { TempoTransactionCall } from '../waas/utils/serializeTempoTransactionForWaas';\nexport type { WaasTempoWalletProvider } from '../waas/WaasTempoWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA,IAAa,kCAAb,cAAqD,UAAU;CAC7D,YAAY,EAAE,UAA8B;AAC1C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,8BAA8B;GAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;ACLN,MAAa,mCAAmC,gBAA+B;AAC7E,KACE,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,sBAAsB,eACtB,YAAY,iBAEZ,OAAM,IAAI,gCAAgC,EACxC,QACE,+EACH,CAAC;;;;;;;;;;;;;;;;;;;;ACFN,MAAa,uBAAuB,OAClC,EAAE,iBACF,WACqD;CACrD,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,sBAAsB,eAAe,CACxC,OAAM,IAAI,kBAAkB,+CAA+C;AAE7E,eACE,eAAe,wBACf,sDACD;AAED,QAAO,MAAM,eAAe,uBAAuB,EAAE,eAAe,CAAC;;;;;;;;;;;;;;;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AkD;AAE9D,SAAO,MAAM,aAAa,0BAA0B,KAAK;;CAG7D,MAAMC,sBACJ,OAAO,EAAE,gBAAgB;AACvB,MAAI,CAAC,eAAe,UAAU,CAC5B,OAAM,IAAI,yBAAyB,EAAE,WAAW,CAAC;AAEnD,QAAM,uCAAuC;GAC3C,QAAQ;GACR;GACA,mBAAmB;GACpB,CAAC;;CAGN,MAAMC,WAA+C,SACnD,aAAa,QAAQ,KAAK;AAE5B,QAAO;EACL,GAAG;EACH;EACA,qBAAqB,SAAS,wBAAwB,MAAM,cAAc;EAC1E;EACA;EACA;EACA;EACA,UAAU,6BAA6B,sBAAsB,YAAY;EACzE;EACA,UAAU;GACR,aAAa,sBAAsB;GACnC,MAAM,sBAAsB;GAC7B;EACD;EACA;EACA;EACA,2BAA2B;EAC3B;EACA,iBAAiB,SACf,oBAAoB;GAAE,GAAG;GAAM;GAAwB,CAAC;EAC1D;EACD;;;;;;AC3IH,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;AAmBxC,MAAa,yBAAyB,SAAS,kBAAkB,KAAW;AAC1E,KAAI,aAAa,EAAE,cAAc,0BAA0B,EAAE,OAAO,CAClE;AAGF,mBAAkB,EAAE,cAAc,0BAA0B,EAAE,OAAO;AACrE,qCAAoC,OAAO;CAE3C,MAAM,yBAAyB,0BAA0B,OAAO;CAEhE,MAAM,iBAAiB,iCAAiC,EACtD,eAAe,QAChB,CAAC;AAEF,wBAAuB,SAAS;EAC9B,UAAU,uBAAuB;EACjC;EACD,CAAC;;;;;AC1CJ,qBAAqBC,MAAaC,QAAe"}
1
+ {"version":3,"file":"waas.esm.js","names":["signableMessage: string","calls: readonly TempoTransactionCall[]","createViemWalletClient: WaasTempoWalletProvider['createViemWalletClient']","getActiveNetworkId: WaasTempoWalletProvider['getActiveNetworkId']","getConnectedAddresses: WaasTempoWalletProvider['getConnectedAddresses']","signMessage: WaasTempoWalletProvider['signMessage']","signWaasMessage","signRawMessage: WaasTempoWalletProvider['signRawMessage']","signWaasRawMessage","signSerializedTransaction: WaasTempoWalletProvider['signSerializedTransaction']","switchActiveNetwork: WaasTempoWalletProvider['switchActiveNetwork']","destroy: WaasTempoWalletProvider['destroy']","packageName","packageVersion"],"sources":["../src/errors/TempoTransactionValidationError/TempoTransactionValidationError.ts","../src/waas/utils/assertTransactionCanBeBroadcast/assertTransactionCanBeBroadcast.ts","../src/waas/utils/getTempoWalletClient/getTempoWalletClient.ts","../src/waas/sendTempoTransaction/sendTempoTransaction.ts","../src/waas/signTempoTransaction/signTempoTransaction.ts","../src/constants.ts","../src/errors/InvalidTempoNetworkError/InvalidTempoNetworkError.ts","../src/errors/TempoBusinessAccountTransactionNotSupportedError/TempoBusinessAccountTransactionNotSupportedError.ts","../src/utils/tempoConfirmTransaction/tempoConfirmTransaction.ts","../src/utils/tempoTransferAmount/tempoTransferAmount.ts","../src/errors/TempoRawMessageNotUtf8Error/TempoRawMessageNotUtf8Error.ts","../src/waas/utils/assertValidTempoTransactionCalls/assertValidTempoTransactionCalls.ts","../src/waas/utils/assertValidTempoFeePayerFields/assertValidTempoFeePayerFields.ts","../src/waas/utils/assertValidTempoValidityWindow/assertValidTempoValidityWindow.ts","../src/waas/utils/assertValidTempoTransactionRequest/assertValidTempoTransactionRequest.ts","../src/waas/utils/isBusinessAccountWalletAccount/isBusinessAccountWalletAccount.ts","../src/waas/utils/serializeTempoTransactionForWaas/serializeTempoTransactionForWaas.ts","../src/waas/utils/signMessage/signMessage.ts","../src/waas/utils/signTypedData/signTypedData.ts","../src/waas/utils/createViemWalletClientForWaasTempo/createViemWalletClientForWaasTempo.ts","../src/waas/utils/signRawMessage/signRawMessage.ts","../src/waas/utils/createWalletProviderForWaasTempo/createWalletProviderForWaasTempo.ts","../src/waas/addWaasTempoExtension/addWaasTempoExtension.ts","../src/errors/TempoTypedDataNotSupportedError/TempoTypedDataNotSupportedError.ts","../src/exports/waas.ts"],"sourcesContent":["import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a Tempo transaction fails validation before signing, for\n * example because of a malformed address or non-hex call data.\n *\n * @example\n * ```ts\n * throw new TempoTransactionValidationError({ reason: 'malformed call data' });\n * ```\n *\n * @see createWalletProviderForWaasTempo\n * @see addWaasTempoExtension\n */\nexport class TempoTransactionValidationError extends BaseError {\n constructor({ reason }: { reason: string }) {\n super({\n cause: null,\n code: 'tempo_transaction_validation_error',\n docsUrl: null,\n name: 'TempoTransactionValidationError',\n shortMessage: `Invalid Tempo transaction: ${reason}`,\n });\n }\n}\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects a transaction that awaits a fee payer, because broadcasting it\n * before the sponsor signs would fail on the network.\n *\n * @param transaction - The transaction about to be broadcast.\n * @returns Nothing. Throws when the transaction awaits a fee payer.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is set.\n * @example\n * ```ts\n * assertTransactionCanBeBroadcast({ calls: [{ to: '0xabc' }] });\n * ```\n * @see signTempoTransaction\n * @see sendTempoTransaction\n * @notInstrumented\n */\nexport const assertTransactionCanBeBroadcast = (transaction: unknown): void => {\n if (\n typeof transaction === 'object' &&\n transaction !== null &&\n 'awaitingFeePayer' in transaction &&\n transaction.awaitingFeePayer\n )\n throw new TempoTransactionValidationError({\n reason:\n 'awaitingFeePayer transactions cannot be broadcast, use signTempoTransaction',\n });\n};\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { DynamicClient, WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { Account, Chain, Transport, WalletClient } from 'viem';\n\nimport { isTempoWalletProvider } from '../../../isTempoWalletProvider/isTempoWalletProvider';\n\n/**\n * Creates the viem wallet client of a Tempo embedded wallet account.\n *\n * @param params.walletAccount - The Tempo embedded wallet account.\n * @param client - The Dynamic client instance.\n * @returns A viem wallet client bound to the Tempo account.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @example\n * ```ts\n * const walletClient = await getTempoWalletClient({ walletAccount }, client);\n * ```\n * @see sendTempoTransaction\n * @see signTempoTransaction\n * @notInstrumented\n */\nexport const getTempoWalletClient = async (\n { walletAccount }: { walletAccount: WalletAccount },\n client: DynamicClient\n): Promise<WalletClient<Transport, Chain, Account>> => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isTempoWalletProvider(walletProvider))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n assertDefined(\n walletProvider.createViemWalletClient,\n 'Tempo wallet provider cannot create a wallet client'\n );\n\n return await walletProvider.createViemWalletClient({ walletAccount });\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getDefaultClient,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { assertTransactionCanBeBroadcast } from '../utils/assertTransactionCanBeBroadcast';\nimport type { TempoTransactionRequest } from '../utils/assertValidTempoTransactionRequest';\nimport { getTempoWalletClient } from '../utils/getTempoWalletClient';\n\ntype SendTempoTransactionParams = Pick<\n TempoTransactionRequest,\n 'calls' | 'feeToken' | 'gas' | 'nonceKey' | 'validAfter' | 'validBefore'\n> & {\n walletAccount: WalletAccount;\n};\n\ntype SendTempoTransactionResult = { transactionHash: string };\n\n/**\n * Sends a Tempo transaction from a Tempo embedded wallet, including the\n * Tempo-only fields: batched calls, a fee token, a nonce key and a validity\n * window. Use it when a plain viem `sendTransaction` cannot express the\n * transaction.\n *\n * @param params.walletAccount - The Tempo embedded wallet account that sends.\n * @param params.calls - The calls the transaction executes atomically.\n * @param [params.feeToken] - TIP-20 token address used to pay the fee.\n * @param [params.gas] - Gas limit. Defaults to a buffered estimate.\n * @param [params.nonceKey] - Nonce key selecting a parallel nonce lane.\n * @param [params.validAfter] - Unix timestamp after which the transaction is valid.\n * @param [params.validBefore] - Unix timestamp after which the transaction expires.\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns The transaction hash.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is set, because a transaction that awaits a fee payer cannot be broadcast.\n * @example\n * ```ts\n * const { transactionHash } = await sendTempoTransaction({\n * calls: [\n * { data: transferData, to: tokenAddress },\n * { data: approveData, to: tokenAddress },\n * ],\n * feeToken: tokenAddress,\n * walletAccount,\n * });\n * ```\n * @see sendTip20Transaction\n * @see signTempoTransaction\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const sendTempoTransaction = async (\n { walletAccount, ...transaction }: SendTempoTransactionParams,\n client = getDefaultClient()\n): Promise<SendTempoTransactionResult> => {\n assertTransactionCanBeBroadcast(transaction);\n\n const walletClient = await getTempoWalletClient({ walletAccount }, client);\n\n assertDefined(\n walletClient.account.signTransaction,\n 'Tempo account cannot sign transactions'\n );\n\n const serializedTransaction = await walletClient.account.signTransaction(\n transaction\n );\n\n const transactionHash = await walletClient.sendRawTransaction({\n serializedTransaction,\n });\n\n return { transactionHash };\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getDefaultClient,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { getTempoWalletClient } from '../utils/getTempoWalletClient';\nimport type { TempoTransactionRequest } from '../utils/assertValidTempoTransactionRequest';\n\ntype SignTempoTransactionParams = Pick<\n TempoTransactionRequest,\n | 'awaitingFeePayer'\n | 'calls'\n | 'feeToken'\n | 'gas'\n | 'nonceKey'\n | 'validAfter'\n | 'validBefore'\n> & {\n walletAccount: WalletAccount;\n};\n\ntype SignTempoTransactionResult = { signedTransaction: string };\n\n/**\n * Signs a Tempo transaction with a Tempo embedded wallet without broadcasting\n * it. Set `awaitingFeePayer` to sign a transaction whose fee a sponsor pays:\n * the sender signs first, and the sponsor signs the returned transaction\n * afterwards and broadcasts it.\n *\n * @param params.walletAccount - The Tempo embedded wallet account that signs.\n * @param [params.awaitingFeePayer] - Leaves the fee to a sponsor who signs afterwards. Cannot be combined with `feeToken`.\n * @param [params.calls] - The calls the transaction executes atomically.\n * @param [params.feeToken] - TIP-20 token address used to pay the fee.\n * @param [params.gas] - Gas limit. Defaults to a buffered estimate.\n * @param [params.nonceKey] - Nonce key selecting a parallel nonce lane.\n * @param [params.validAfter] - Unix timestamp after which the transaction is valid.\n * @param [params.validBefore] - Unix timestamp after which the transaction expires.\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns The serialized signed transaction.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoTransactionValidationError} If a field is malformed or inconsistent.\n * @example\n * ```ts\n * const { signedTransaction } = await signTempoTransaction({\n * awaitingFeePayer: true,\n * calls: [{ data: transferData, to: tokenAddress }],\n * walletAccount,\n * });\n * ```\n * @see sendTempoTransaction\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const signTempoTransaction = async (\n { walletAccount, ...transaction }: SignTempoTransactionParams,\n client = getDefaultClient()\n): Promise<SignTempoTransactionResult> => {\n const walletClient = await getTempoWalletClient({ walletAccount }, client);\n\n assertDefined(\n walletClient.account.signTransaction,\n 'Tempo account cannot sign transactions'\n );\n\n const signedTransaction = await walletClient.account.signTransaction(\n transaction\n );\n\n return { signedTransaction };\n};\n","import type { Chain } from '@dynamic-labs-sdk/client';\n\n\n/**\n * Chain identifier shared by every Tempo wallet provider, network provider and\n * signing request.\n */\nexport const TEMPO_CHAIN = 'TEMPO' satisfies Chain;\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a Tempo wallet provider is asked to activate a network that is\n * not a Tempo network.\n *\n * @example\n * ```ts\n * throw new InvalidTempoNetworkError({ networkId: '1' });\n * ```\n *\n * @see isTempoChainId\n * @see addWaasTempoExtension\n */\nexport class InvalidTempoNetworkError extends BaseError {\n constructor({ networkId }: { networkId: string | number }) {\n super({\n cause: null,\n code: 'invalid_tempo_network_error',\n docsUrl: null,\n name: 'InvalidTempoNetworkError',\n shortMessage: `Network ${networkId} is not a Tempo network`,\n });\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a business-account Tempo wallet is asked to sign a transaction.\n * Business-account transactions need a signing-quorum intent, which the\n * embedded wallet signer does not support for Tempo transactions yet.\n *\n * @example\n * ```ts\n * throw new TempoBusinessAccountTransactionNotSupportedError();\n * ```\n *\n * @see addWaasTempoExtension\n */\nexport class TempoBusinessAccountTransactionNotSupportedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_business_account_transaction_not_supported_error',\n docsUrl: null,\n name: 'TempoBusinessAccountTransactionNotSupportedError',\n shortMessage:\n 'Signing Tempo transactions with a business account wallet is not supported',\n });\n }\n}\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { ConfirmTransactionParams } from '@dynamic-labs-sdk/client/core';\nimport type { DynamicClient } from '@dynamic-labs-sdk/client';\n\nimport { getTempoPublicClient } from '../../getTempoPublicClient/getTempoPublicClient';\nimport { isTempoWalletAccount } from '../../isTempoWalletAccount/isTempoWalletAccount';\n\n/**\n * Waits until a transaction sent from a Tempo wallet account is included in a\n * block.\n *\n * @param params.transactionHash - The hash of the transaction to wait for.\n * @param params.walletAccount - The Tempo wallet account that sent it.\n * @param client - The Dynamic client instance.\n * @returns Nothing. Resolves once the transaction receipt is available.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @example\n * ```ts\n * await tempoConfirmTransaction({ transactionHash, walletAccount }, client);\n * ```\n * @see tempoTransferAmount\n * @see getTempoPublicClient\n * @notInstrumented\n */\nexport const tempoConfirmTransaction = async (\n { transactionHash, walletAccount }: ConfirmTransactionParams,\n client: DynamicClient\n): Promise<void> => {\n if (!isTempoWalletAccount(walletAccount))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n const publicClient = await getTempoPublicClient({ walletAccount }, client);\n\n await publicClient.waitForTransactionReceipt({\n hash: transactionHash as `0x${string}`,\n });\n};\n","import { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport type { TransferAmountParams } from '@dynamic-labs-sdk/client/core';\n\nimport { TempoNativeTokenError } from '../../errors/TempoNativeTokenError/TempoNativeTokenError';\nimport { isTempoWalletAccount } from '../../isTempoWalletAccount/isTempoWalletAccount';\nimport { sendTip20Transaction } from '../../sendTip20Transaction/sendTip20Transaction';\nimport type { CreateTempoViemWalletClient } from '../../TempoWalletProvider.types';\n\ntype TempoTransferAmountParams = TransferAmountParams & {\n createViemWalletClient: CreateTempoViemWalletClient;\n};\n\ntype TempoTransferAmountResult = { transactionHash: string };\n\n/**\n * Transfers a TIP-20 token from a Tempo wallet account. Tempo has no native\n * token, so the token is required.\n *\n * @param params.amount - Human-readable amount, e.g. '1.5'.\n * @param params.recipient - Recipient address.\n * @param params.token - The TIP-20 token to transfer.\n * @param params.walletAccount - The Tempo wallet account that sends.\n * @param params.createViemWalletClient - Creates the viem wallet client that signs.\n * @returns The transaction hash.\n * @throws {InvalidParamError} If the wallet account is not a Tempo wallet account.\n * @throws {TempoNativeTokenError} If no token is provided.\n * @example\n * ```ts\n * const { transactionHash } = await tempoTransferAmount({\n * amount: '1.5',\n * createViemWalletClient,\n * recipient: '0xRecipient',\n * token: { address: '0xTip20Token', decimals: 6 },\n * walletAccount,\n * });\n * ```\n * @see sendTip20Transaction\n * @see tempoConfirmTransaction\n * @notInstrumented\n */\nexport const tempoTransferAmount = async ({\n amount,\n createViemWalletClient,\n recipient,\n token,\n walletAccount,\n}: TempoTransferAmountParams): Promise<TempoTransferAmountResult> => {\n if (!isTempoWalletAccount(walletAccount))\n throw new InvalidParamError('Wallet account is not a Tempo wallet account');\n\n if (!token?.address) throw new TempoNativeTokenError();\n\n const walletClient = await createViemWalletClient({ walletAccount });\n\n const transactionHash = await sendTip20Transaction({\n amount,\n decimals: token.decimals,\n to: recipient,\n tokenAddress: token.address,\n walletClient,\n });\n\n return { transactionHash };\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when a raw message passed to a Tempo embedded wallet is not valid\n * UTF-8 text. The embedded wallet signs text messages, so bytes that cannot be\n * decoded and re-encoded unchanged would be signed as different bytes.\n *\n * @example\n * ```ts\n * throw new TempoRawMessageNotUtf8Error();\n * ```\n *\n * @see createWalletProviderForWaasTempo\n */\nexport class TempoRawMessageNotUtf8Error extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_raw_message_not_utf8_error',\n docsUrl: null,\n name: 'TempoRawMessageNotUtf8Error',\n shortMessage:\n 'Raw messages must be valid UTF-8 text to be signed by a Tempo embedded wallet',\n });\n }\n}\n","// jsdoc-completeness-disable @see\nimport { isAddress, isHex } from 'viem';\n\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\n\n/**\n * Rejects malformed calls before they reach the signer, which would otherwise\n * fail with an opaque parsing error.\n *\n * @param params.calls - The Tempo calls to validate.\n * @returns Nothing. Throws on malformed input.\n * @throws {TempoTransactionValidationError} If a call is malformed or the batch is empty.\n * @example\n * ```ts\n * assertValidTempoTransactionCalls({ calls: [{ to, data, value }] });\n * ```\n * @notInstrumented\n */\nexport const assertValidTempoTransactionCalls = ({\n calls,\n}: {\n calls: readonly TempoTransactionCall[];\n}): void => {\n if (calls.length === 0)\n throw new TempoTransactionValidationError({\n reason: 'at least one call is required',\n });\n\n for (const call of calls) {\n if (call.to !== undefined && !isAddress(call.to))\n throw new TempoTransactionValidationError({\n reason: 'malformed call address',\n });\n if (call.data !== undefined && !isHex(call.data))\n throw new TempoTransactionValidationError({\n reason: 'malformed call data',\n });\n if (call.value !== undefined && typeof call.value !== 'bigint')\n throw new TempoTransactionValidationError({\n reason: 'malformed call value',\n });\n }\n};\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects an inconsistent fee payer setup before it reaches the signer. A\n * transaction that awaits a fee payer leaves the fee token to the sponsor, so\n * it cannot name one.\n *\n * @param params.awaitingFeePayer - Whether a sponsor signs the transaction afterwards.\n * @param [params.feeToken] - The TIP-20 token address that pays the fee.\n * @returns Nothing. Throws on an inconsistent setup.\n * @throws {TempoTransactionValidationError} If `awaitingFeePayer` is not true or is combined with `feeToken`.\n * @example\n * ```ts\n * assertValidTempoFeePayerFields({ awaitingFeePayer: true });\n * ```\n * @see assertValidTempoTransactionRequest\n * @see signTempoTransaction\n * @notInstrumented\n */\nexport const assertValidTempoFeePayerFields = ({\n awaitingFeePayer,\n feeToken,\n}: {\n awaitingFeePayer?: true;\n feeToken?: string;\n}): void => {\n if (awaitingFeePayer !== undefined && awaitingFeePayer !== true)\n throw new TempoTransactionValidationError({\n reason: 'awaitingFeePayer must be true',\n });\n\n if (awaitingFeePayer && feeToken !== undefined)\n throw new TempoTransactionValidationError({\n reason: 'awaitingFeePayer cannot be combined with feeToken',\n });\n};\n","import { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\n\n/**\n * Rejects a malformed validity window before it reaches the signer. Both\n * bounds are non-negative integer Unix timestamps in seconds, and the window\n * must open before it closes.\n *\n * @param params.validAfter - Unix timestamp after which the transaction is valid.\n * @param params.validBefore - Unix timestamp after which the transaction expires.\n * @returns Nothing. Throws on a malformed window.\n * @throws {TempoTransactionValidationError} If a bound is not a non-negative integer or `validAfter` is not before `validBefore`.\n * @example\n * ```ts\n * assertValidTempoValidityWindow({ validAfter: 100, validBefore: 200 });\n * ```\n * @see assertValidTempoTransactionRequest\n * @see sendTempoTransaction\n * @notInstrumented\n */\nexport const assertValidTempoValidityWindow = ({\n validAfter,\n validBefore,\n}: {\n validAfter?: number;\n validBefore?: number;\n}): void => {\n for (const [field, value] of [\n ['validAfter', validAfter],\n ['validBefore', validBefore],\n ] as const) {\n if (value !== undefined && (!Number.isInteger(value) || value < 0))\n throw new TempoTransactionValidationError({\n reason: `${field} must be a non-negative integer timestamp`,\n });\n }\n\n if (\n validAfter !== undefined &&\n validBefore !== undefined &&\n validAfter >= validBefore\n )\n throw new TempoTransactionValidationError({\n reason: 'validAfter must be before validBefore',\n });\n};\n","// jsdoc-completeness-disable @see\nimport { isAddress } from 'viem';\nimport type { Hex, TransactionSerializable } from 'viem';\n\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport { assertValidTempoFeePayerFields } from '../assertValidTempoFeePayerFields';\nimport { assertValidTempoValidityWindow } from '../assertValidTempoValidityWindow';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\n\n/**\n * A Tempo transaction request. Extends the standard viem transaction with the\n * Tempo fields: batched `calls`, `feeToken`, `nonceKey` (2D nonce),\n * `validAfter` / `validBefore` expirations and `awaitingFeePayer`, which leaves\n * the fee to be paid by a sponsor who signs the transaction afterwards.\n *\n * @example\n * ```ts\n * const transaction: TempoTransactionRequest = {\n * calls: [{ to: '0xabc', data: '0xa9059cbb' }],\n * feeToken: '0xdef',\n * };\n * ```\n */\nexport type TempoTransactionRequest = TransactionSerializable & {\n awaitingFeePayer?: true;\n calls?: readonly TempoTransactionCall[];\n feeToken?: Hex;\n nonceKey?: bigint;\n validAfter?: number;\n validBefore?: number;\n};\n\n/**\n * Rejects malformed Tempo transaction fields before they reach the signer,\n * which would otherwise fail with an opaque parsing error.\n *\n * @param params.transaction - The Tempo transaction request to validate.\n * @param params.chainId - The chain id of the active Tempo network.\n * @returns Nothing. Throws on malformed input.\n * @throws {TempoTransactionValidationError} If a field is malformed or inconsistent.\n * @example\n * ```ts\n * assertValidTempoTransactionRequest({ transaction, chainId: 4217 });\n * ```\n * @notInstrumented\n */\nexport const assertValidTempoTransactionRequest = ({\n transaction,\n chainId,\n}: {\n chainId: number;\n transaction: TempoTransactionRequest;\n}): void => {\n if (transaction.feeToken !== undefined && !isAddress(transaction.feeToken))\n throw new TempoTransactionValidationError({\n reason: 'malformed feeToken address',\n });\n\n assertValidTempoFeePayerFields(transaction);\n\n if (\n transaction.calls !== undefined &&\n (transaction.to !== undefined ||\n transaction.data !== undefined ||\n transaction.value !== undefined)\n )\n throw new TempoTransactionValidationError({\n reason: 'calls cannot be combined with top-level to, data or value',\n });\n\n if (transaction.chainId !== undefined && transaction.chainId !== chainId)\n throw new TempoTransactionValidationError({\n reason: 'chainId does not match the active Tempo network',\n });\n\n if (\n transaction.nonceKey !== undefined &&\n (typeof transaction.nonceKey !== 'bigint' || transaction.nonceKey < 0n)\n )\n throw new TempoTransactionValidationError({\n reason: 'nonceKey must be a non-negative bigint',\n });\n\n assertValidTempoValidityWindow(transaction);\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\ntype BusinessAccountWalletAccount = WalletAccount & {\n businessAccountId: string;\n};\n\n/**\n * Type guard — returns true if the wallet account belongs to a business\n * account, meaning its signatures need a signing-quorum approval.\n *\n * @param walletAccount - The wallet account to check.\n * @returns Whether the wallet account has a business account id.\n * @example\n * ```ts\n * if (isBusinessAccountWalletAccount(walletAccount)) {\n * console.log(walletAccount.businessAccountId);\n * }\n * ```\n * @see signMessage\n * @see signRawMessage\n * @notInstrumented\n */\nexport const isBusinessAccountWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BusinessAccountWalletAccount =>\n 'businessAccountId' in walletAccount &&\n typeof walletAccount.businessAccountId === 'string' &&\n walletAccount.businessAccountId !== '';\n","import type { Hex } from 'viem';\n\n/**\n * A single call inside a Tempo transaction.\n *\n * @example\n * ```ts\n * const call: TempoTransactionCall = { data: '0xa9059cbb', to: '0xabc' };\n * ```\n *\n * @see TempoTransactionRequest\n * @see sendTip20Transaction\n */\nexport type TempoTransactionCall = {\n data?: Hex;\n to?: Hex;\n value?: bigint;\n};\n\nexport type SerializeTempoTransactionForWaasParams = {\n /** Leaves the fee to a sponsor who signs the transaction after the sender. */\n awaitingFeePayer?: boolean;\n /** Calls executed atomically by the transaction, one entry per batched call. */\n calls: readonly TempoTransactionCall[];\n chainId: number;\n /** TIP-20 token address used to pay the fee. */\n feeToken?: Hex;\n gas: bigint;\n maxFeePerGas: bigint;\n maxPriorityFeePerGas: bigint;\n nonce: number;\n /** 2D nonce key selecting the parallel nonce lane. */\n nonceKey?: bigint;\n /** Unix timestamp after which the transaction becomes valid. */\n validAfter?: number;\n /** Unix timestamp after which the transaction expires. */\n validBefore?: number;\n};\n\n/**\n * Serializes a Tempo transaction to the JSON an embedded wallet signs.\n * BigInt values are written as decimal strings because JSON has no BigInt type.\n *\n * @param params - The Tempo transaction fields to serialize.\n * @returns The JSON-encoded transaction.\n * @example\n * ```ts\n * const transaction = serializeTempoTransactionForWaas({\n * calls: [{ to: '0xabc', value: 1n }],\n * chainId: 4217,\n * gas: 300_000n,\n * maxFeePerGas: 1_000n,\n * maxPriorityFeePerGas: 100n,\n * nonce: 0,\n * });\n * ```\n * @see addWaasTempoExtension\n * @see createWalletProviderForWaasTempo\n * @notInstrumented\n */\nexport const serializeTempoTransactionForWaas = ({\n awaitingFeePayer,\n calls,\n chainId,\n feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey,\n validAfter,\n validBefore,\n}: SerializeTempoTransactionForWaasParams): string =>\n JSON.stringify(\n {\n calls: calls.map(({ data, to, value }) => ({ data, to, value })),\n chainId,\n feePayer: awaitingFeePayer ? true : undefined,\n feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey,\n validAfter,\n validBefore,\n },\n (_key, value: unknown) =>\n typeof value === 'bigint' ? value.toString() : value\n );\n","import {\n type DynamicClient,\n type WalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport { prepareSigningQuorumApproval } from '@dynamic-labs-sdk/client/waas/core';\nimport type {\n ApprovalQuorumRequestContext,\n WaasProvider,\n} from '@dynamic-labs-sdk/client/waas/core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\n\ntype SignMessageParams = {\n approvalQuorum?: ApprovalQuorumRequestContext;\n message: string;\n waasProvider: WaasProvider;\n walletAccount: WalletAccount;\n};\n\ntype SignMessageResult = { signature: string };\n\n/**\n * Signs a message with a Tempo embedded wallet account.\n *\n * For a business-account wallet, this first prepares and signs the quorum\n * intent for the message. Personal wallets pass `approvalQuorum` through\n * unchanged.\n *\n * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.\n * @param params.message - The message to sign.\n * @param params.waasProvider - The WaaS provider that prepares the intent and signs.\n * @param params.walletAccount - The wallet account that signs the message.\n * @param client - The Dynamic client holding the current session key.\n * @returns The signature.\n * @example\n * ```ts\n * const { signature } = await signMessage(\n * { message, waasProvider, walletAccount },\n * client\n * );\n * ```\n * @see {@link prepareSigningQuorumApproval} for the quorum intent step.\n * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.\n * @notInstrumented\n */\nexport const signMessage = async (\n { approvalQuorum, message, waasProvider, walletAccount }: SignMessageParams,\n client: DynamicClient\n): Promise<SignMessageResult> => {\n const preparedApprovalQuorum = await prepareSigningQuorumApproval(\n {\n approvalQuorum,\n chainName: TEMPO_CHAIN,\n operation: { kind: 'message', message },\n waasClient: await waasProvider.getWaasClient(),\n walletAccount,\n },\n client\n );\n\n return waasProvider.signMessage({\n approvalQuorum: preparedApprovalQuorum,\n message,\n walletAccount,\n });\n};\n","import {\n type DynamicClient,\n type WalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport {\n getActionAuthorizationTokens,\n getSignedSessionId,\n} from '@dynamic-labs-sdk/client/core';\nimport { prepareSigningQuorumApproval } from '@dynamic-labs-sdk/client/waas/core';\nimport type {\n ApprovalQuorumRequestContext,\n WaasProvider,\n} from '@dynamic-labs-sdk/client/waas/core';\nimport { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';\nimport type { TypedData } from 'viem';\nimport { stringify } from 'viem';\n\nimport { TEMPO_CHAIN } from '../../../constants';\n\ntype SignTypedDataParams = {\n /** Pass back in, unmodified, after signing the `intent` from a\n * `SigningConsentRequiredError` with reason `INTENT_REQUIRED` — see\n * `isSigningConsentRequiredError` and `signSigningQuorumIntent`. */\n approvalQuorum?: ApprovalQuorumRequestContext;\n typedData: TypedData | { [key: string]: unknown };\n waasProvider: WaasProvider;\n walletAccount: WalletAccount;\n};\n\n/**\n * Signs EIP-712 typed data with a Tempo embedded wallet account.\n *\n * For a business-account wallet, this first prepares and signs the quorum\n * intent for the typed data. Personal wallets pass `approvalQuorum` through\n * unchanged.\n *\n * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.\n * @param params.typedData - The EIP-712 typed data to sign. `bigint` values are serialized.\n * @param params.waasProvider - The WaaS provider that holds the signing client.\n * @param params.walletAccount - The wallet account that signs the typed data.\n * @param client - The Dynamic client holding the current session key.\n * @returns The signature.\n * @example\n * ```ts\n * const signature = await signTypedData(\n * { typedData, waasProvider, walletAccount },\n * client\n * );\n * ```\n * @see {@link prepareSigningQuorumApproval} for the quorum intent step.\n * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.\n * @notInstrumented\n */\nexport const signTypedData = async (\n {\n approvalQuorum,\n typedData,\n waasProvider,\n walletAccount,\n }: SignTypedDataParams,\n client: DynamicClient\n): Promise<string> => {\n const { signature: signedSessionId } = await getSignedSessionId(client);\n\n const waasClient = await waasProvider.getWaasClient();\n\n // serialize bigint values\n const stringifiedTypedData = stringify(typedData);\n const serializableTypedData = JSON.parse(stringifiedTypedData) as string;\n\n const preparedApprovalQuorum = await prepareSigningQuorumApproval(\n {\n approvalQuorum,\n chainName: TEMPO_CHAIN,\n operation: { kind: 'typedData', typedData: stringifiedTypedData },\n waasClient,\n walletAccount,\n },\n client\n );\n\n const { elevatedAccessToken, mfaToken } = await getActionAuthorizationTokens(\n {\n mfaAction: MFAAction.WalletWaasSign,\n scope: TokenScope.Walletsign,\n },\n client\n );\n\n return waasClient.signTypedData({\n accountAddress: walletAccount.address,\n approvalQuorum: preparedApprovalQuorum,\n authToken: client.token ?? undefined,\n elevatedAccessToken,\n mfaToken,\n signedSessionId,\n typedData: serializableTypedData,\n });\n};\n","import {\n type DynamicClient,\n type WalletAccount,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';\nimport type {\n Account,\n Chain,\n Hex,\n HttpTransportConfig,\n Transport,\n WalletClient,\n WalletClientConfig,\n} from 'viem';\nimport {\n bytesToHex,\n createPublicClient,\n createWalletClient,\n hexToString,\n http,\n isHex,\n stringToHex,\n} from 'viem';\nimport { toAccount } from 'viem/accounts';\n\nimport { TempoBusinessAccountTransactionNotSupportedError } from '../../../errors/TempoBusinessAccountTransactionNotSupportedError';\nimport { TempoRawMessageNotUtf8Error } from '../../../errors/TempoRawMessageNotUtf8Error';\nimport { TempoTransactionValidationError } from '../../../errors/TempoTransactionValidationError';\nimport { mapNetworkDataToViemChain } from '../../../utils/mapNetworkDataToViemChain';\nimport { assertTransactionCanBeBroadcast } from '../assertTransactionCanBeBroadcast';\nimport { assertValidTempoTransactionCalls } from '../assertValidTempoTransactionCalls';\nimport { assertValidTempoTransactionRequest } from '../assertValidTempoTransactionRequest';\nimport type { TempoTransactionRequest } from '../assertValidTempoTransactionRequest';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\nimport type { TempoTransactionCall } from '../serializeTempoTransactionForWaas';\nimport { serializeTempoTransactionForWaas } from '../serializeTempoTransactionForWaas';\nimport { signMessage } from '../signMessage';\nimport { signTypedData } from '../signTypedData';\n\nconst TEMPO_GAS_BUFFER_NUMERATOR = 130n;\nconst TEMPO_GAS_BUFFER_DENOMINATOR = 100n;\nconst TEMPO_MIN_GAS = 300_000n;\n\n/**\n * Address of the Tempo nonce manager, which keeps one nonce counter per\n * account and nonce key.\n */\nconst TEMPO_NONCE_MANAGER_ADDRESS =\n '0x4e4F4E4345000000000000000000000000000000';\n\nconst TEMPO_NONCE_MANAGER_ABI = [\n {\n inputs: [\n { name: 'account', type: 'address' },\n { name: 'nonceKey', type: 'uint256' },\n ],\n name: 'getNonce',\n outputs: [{ name: 'nonce', type: 'uint64' }],\n stateMutability: 'view',\n type: 'function',\n },\n] as const;\n\ntype CreateViemWalletClientForWaasTempoParams = {\n httpTransportConfig?: HttpTransportConfig;\n viemWalletClientConfig?: Omit<\n WalletClientConfig,\n 'account' | 'chain' | 'transport'\n >;\n waasProvider: WaasProvider;\n walletAccount: WalletAccount;\n};\n\n/**\n * Creates a viem wallet client for a Tempo embedded wallet account.\n *\n * Transactions are signed as Tempo transactions: batched `calls`, `feeToken`,\n * `nonceKey`, `validAfter` / `validBefore` and `awaitingFeePayer` pass through\n * to the signer. Gas\n * is the larger of the caller's value and a 30% buffered estimate with a 300k\n * floor, fees are at least the network gas price, and the nonce is the next\n * one on the requested nonce lane.\n *\n * @param params.waasProvider - The embedded wallet provider that signs.\n * @param params.walletAccount - The Tempo embedded wallet account that signs.\n * @param [params.httpTransportConfig] - Optional viem HTTP transport config.\n * @param [params.viemWalletClientConfig] - Optional extra viem client config.\n * @param client - The Dynamic client instance.\n * @returns A viem wallet client bound to the Tempo account.\n * @throws If no active network data exists for the wallet account.\n * @example\n * ```ts\n * const walletClient = await createViemWalletClientForWaasTempo(\n * { waasProvider, walletAccount },\n * client\n * );\n *\n * const hash = await walletClient.sendTransaction({ to, data });\n * ```\n * @see serializeTempoTransactionForWaas\n * @see createWalletProviderForWaasTempo\n * @notInstrumented\n */\n// eslint-disable-next-line custom-rules/require-single-object-param\nexport const createViemWalletClientForWaasTempo = async (\n {\n waasProvider,\n walletAccount,\n httpTransportConfig,\n viemWalletClientConfig,\n }: CreateViemWalletClientForWaasTempoParams,\n dynamicClient: DynamicClient\n): Promise<WalletClient<Transport, Chain, Account>> => {\n const { networkData: activeNetworkData } = await getActiveNetworkData(\n { walletAccount },\n dynamicClient\n );\n\n assertDefined(\n activeNetworkData,\n 'No active network data found for the provided wallet account'\n );\n\n const chain = mapNetworkDataToViemChain(activeNetworkData);\n const transport = http(\n activeNetworkData.rpcUrls.http[0],\n httpTransportConfig\n );\n const publicClient = createPublicClient({ chain, transport });\n\n const estimateTempoGas = async ({\n calls,\n hasExplicitGas,\n }: {\n calls: readonly TempoTransactionCall[];\n hasExplicitGas: boolean;\n }): Promise<bigint> => {\n const estimates = await Promise.all(\n calls.map(async (call) => {\n try {\n return await publicClient.estimateGas({\n account: walletAccount.address as Hex,\n data: call.data,\n to: call.to,\n value: call.value,\n });\n } catch (error) {\n if (calls.length === 1 && !hasExplicitGas) throw error;\n\n return TEMPO_MIN_GAS;\n }\n })\n );\n\n const estimate = estimates.reduce((total, value) => total + value, 0n);\n const buffered =\n (estimate * TEMPO_GAS_BUFFER_NUMERATOR) / TEMPO_GAS_BUFFER_DENOMINATOR;\n\n return buffered > TEMPO_MIN_GAS ? buffered : TEMPO_MIN_GAS;\n };\n\n const getTempoNonce = async ({\n nonceKey,\n }: {\n nonceKey?: bigint;\n }): Promise<number> => {\n if (nonceKey === undefined || nonceKey === 0n)\n return publicClient.getTransactionCount({\n address: walletAccount.address as Hex,\n });\n\n return Number(\n await publicClient.readContract({\n abi: TEMPO_NONCE_MANAGER_ABI,\n address: TEMPO_NONCE_MANAGER_ADDRESS,\n args: [walletAccount.address as Hex, nonceKey],\n functionName: 'getNonce',\n })\n );\n };\n\n const walletClient = createWalletClient({\n account: toAccount({\n address: walletAccount.address as Hex,\n signMessage: async ({ message }) => {\n let signableMessage: string;\n\n if (typeof message === 'string') signableMessage = message;\n else {\n const raw = isHex(message.raw)\n ? message.raw\n : bytesToHex(message.raw);\n\n signableMessage = hexToString(raw);\n\n if (stringToHex(signableMessage) !== raw.toLowerCase())\n throw new TempoRawMessageNotUtf8Error();\n }\n\n const { signature } = await signMessage(\n { message: signableMessage, waasProvider, walletAccount },\n dynamicClient\n );\n\n return signature as Hex;\n },\n signTransaction: async (\n transaction: TempoTransactionRequest\n ): Promise<Hex> => {\n if (isBusinessAccountWalletAccount(walletAccount))\n throw new TempoBusinessAccountTransactionNotSupportedError();\n\n assertValidTempoTransactionRequest({ chainId: chain.id, transaction });\n\n const calls: readonly TempoTransactionCall[] = transaction.calls ?? [\n {\n data: transaction.data ?? '0x',\n to: transaction.to ?? undefined,\n value: transaction.value ?? 0n,\n },\n ];\n\n assertValidTempoTransactionCalls({ calls });\n\n const estimatedGas = await estimateTempoGas({\n calls,\n hasExplicitGas: transaction.gas !== undefined,\n });\n const gas =\n transaction.gas !== undefined && transaction.gas > estimatedGas\n ? transaction.gas\n : estimatedGas;\n\n const nonce =\n transaction.nonceKey !== undefined && transaction.nonceKey !== 0n\n ? await getTempoNonce({ nonceKey: transaction.nonceKey })\n : transaction.nonce ??\n (await getTempoNonce({ nonceKey: transaction.nonceKey }));\n\n const gasPrice = await publicClient.getGasPrice();\n const priorityGasPrice = gasPrice / 10n;\n const requestedGasPrice =\n 'gasPrice' in transaction ? transaction.gasPrice : undefined;\n const requestedMaxFeePerGas =\n transaction.maxFeePerGas ?? requestedGasPrice;\n const requestedMaxPriorityFeePerGas =\n transaction.maxPriorityFeePerGas ?? requestedGasPrice;\n const maxFeePerGas =\n requestedMaxFeePerGas !== undefined &&\n requestedMaxFeePerGas > gasPrice\n ? requestedMaxFeePerGas\n : gasPrice;\n const maxPriorityFeePerGas =\n requestedMaxPriorityFeePerGas !== undefined &&\n requestedMaxPriorityFeePerGas > priorityGasPrice\n ? requestedMaxPriorityFeePerGas\n : priorityGasPrice;\n\n if (maxPriorityFeePerGas > maxFeePerGas)\n throw new TempoTransactionValidationError({\n reason: 'maxPriorityFeePerGas must not exceed maxFeePerGas',\n });\n\n const serializedTransaction = serializeTempoTransactionForWaas({\n awaitingFeePayer: transaction.awaitingFeePayer,\n calls,\n chainId: chain.id,\n feeToken: transaction.feeToken,\n gas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n nonceKey: transaction.nonceKey,\n validAfter: transaction.validAfter,\n validBefore: transaction.validBefore,\n });\n\n const { signature } = await waasProvider.signSerializedTransaction({\n serializedTransaction,\n walletAccount,\n });\n\n return signature as Hex;\n },\n signTypedData: async (typedData) => {\n const signature = await signTypedData(\n { typedData, waasProvider, walletAccount },\n dynamicClient\n );\n\n return signature as Hex;\n },\n }),\n chain,\n transport,\n ...viemWalletClientConfig,\n });\n\n const { sendTransaction } = walletClient;\n\n return Object.assign(walletClient, {\n sendTransaction: (async (transaction) => {\n assertTransactionCanBeBroadcast(transaction);\n\n return await sendTransaction(transaction);\n }) as typeof sendTransaction,\n });\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n} from '@dynamic-labs-sdk/client';\nimport { prepareSigningQuorumApproval } from '@dynamic-labs-sdk/client/waas/core';\nimport type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\n\ntype SignRawMessageParams = Parameters<WaasProvider['signRawMessage']>[0] & {\n waasProvider: WaasProvider;\n};\n\ntype SignRawMessageResult = { signature: string };\n\n/**\n * Signs a raw message with a Tempo embedded wallet account.\n *\n * For a business-account wallet, `rawSign` is required: the quorum intent\n * commits to its preimage, so the intent can be checked before signing.\n *\n * @param params.approvalQuorum - A signed intent from an earlier `SigningConsentRequiredError`, when retrying.\n * @param params.message - The raw message to sign.\n * @param [params.password] - The wallet password, if the wallet is password protected.\n * @param [params.rawSign] - The hex preimage and hash metadata that the intent commits to.\n * @param params.waasProvider - The WaaS provider that prepares the intent and signs.\n * @param params.walletAccount - The wallet account that signs the message.\n * @param client - The Dynamic client holding the current session key.\n * @returns The signature.\n * @throws {InvalidParamError} If a business-account wallet has no `rawSign`.\n * @example\n * ```ts\n * const { signature } = await signRawMessage(\n * { message, rawSign, waasProvider, walletAccount },\n * client\n * );\n * ```\n * @see {@link prepareSigningQuorumApproval} for the quorum intent step.\n * @see {@link isSigningConsentRequiredError} for handling an unmet signing quorum.\n * @notInstrumented\n */\nexport const signRawMessage = async (\n {\n approvalQuorum,\n message,\n password,\n rawSign,\n waasProvider,\n walletAccount,\n }: SignRawMessageParams,\n client: DynamicClient\n): Promise<SignRawMessageResult> => {\n if (isBusinessAccountWalletAccount(walletAccount) && !rawSign)\n throw new InvalidParamError(\n 'Raw signing for a business-account wallet requires a verifiable preimage'\n );\n\n const preparedApprovalQuorum = rawSign\n ? await prepareSigningQuorumApproval(\n {\n approvalQuorum,\n chainName: TEMPO_CHAIN,\n operation: { kind: 'raw', message, rawSign },\n waasClient: await waasProvider.getWaasClient(),\n walletAccount,\n },\n client\n )\n : approvalQuorum;\n\n return waasProvider.signRawMessage({\n approvalQuorum: preparedApprovalQuorum,\n message,\n password,\n rawSign,\n walletAccount,\n });\n};\n","import { type DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n switchActiveNetworkInLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n DYNAMIC_WAAS_METADATA,\n createWaasProvider,\n getAllUserWaasAddressesForChain,\n} from '@dynamic-labs-sdk/client/waas/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { TEMPO_CHAIN } from '../../../constants';\nimport { InvalidTempoNetworkError } from '../../../errors/InvalidTempoNetworkError';\nimport { TempoBusinessAccountTransactionNotSupportedError } from '../../../errors/TempoBusinessAccountTransactionNotSupportedError';\nimport { isTempoChainId } from '../../../utils/tempoChainIds/tempoChainIds';\nimport { tempoConfirmTransaction } from '../../../utils/tempoConfirmTransaction';\nimport { tempoTransferAmount } from '../../../utils/tempoTransferAmount';\nimport type { WaasTempoWalletProvider } from '../../WaasTempoWalletProvider.types';\nimport { createViemWalletClientForWaasTempo } from '../createViemWalletClientForWaasTempo';\nimport { isBusinessAccountWalletAccount } from '../isBusinessAccountWalletAccount';\nimport { signMessage as signWaasMessage } from '../signMessage';\nimport { signRawMessage as signWaasRawMessage } from '../signRawMessage';\n\ntype CreateWalletProviderForWaasTempoParams = {\n dynamicClient: DynamicClient;\n};\n\n/**\n * Creates the embedded wallet provider for the Tempo chain.\n *\n * @param params.dynamicClient - The Dynamic client the provider is bound to.\n * @returns A wallet provider that signs with Tempo embedded wallets.\n * @throws {InvalidTempoNetworkError} When the returned provider is asked to switch to a network that is not a Tempo network.\n * @throws {TempoBusinessAccountTransactionNotSupportedError} When the returned provider is asked to sign a transaction with a business-account wallet.\n * @example\n * ```ts\n * const walletProvider = createWalletProviderForWaasTempo({ dynamicClient });\n * ```\n * @see addWaasTempoExtension\n * @see WaasTempoWalletProvider\n * @notInstrumented\n */\nexport const createWalletProviderForWaasTempo = ({\n dynamicClient,\n}: CreateWalletProviderForWaasTempoParams): WaasTempoWalletProvider => {\n const chain = TEMPO_CHAIN;\n\n const walletProviderType = WalletProviderEnum.EmbeddedWallet;\n\n const key = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType,\n });\n\n const waasProvider = createWaasProvider({\n chain,\n sdkClient: dynamicClient,\n });\n\n const createViemWalletClient: WaasTempoWalletProvider['createViemWalletClient'] =\n async ({ walletAccount, httpTransportConfig, viemWalletClientConfig }) =>\n createViemWalletClientForWaasTempo(\n {\n httpTransportConfig,\n viemWalletClientConfig,\n waasProvider,\n walletAccount,\n },\n dynamicClient\n );\n\n const getActiveNetworkId: WaasTempoWalletProvider['getActiveNetworkId'] =\n () =>\n getActiveNetworkIdFromLastKnownRegistry({\n client: dynamicClient,\n walletProviderKey: key,\n });\n\n const getConnectedAddresses: WaasTempoWalletProvider['getConnectedAddresses'] =\n () =>\n Promise.resolve({\n addresses: getAllUserWaasAddressesForChain({ chain }, dynamicClient),\n });\n\n const signMessage: WaasTempoWalletProvider['signMessage'] = async ({\n approvalQuorum,\n message,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n\n return signWaasMessage(\n { approvalQuorum, message, waasProvider, walletAccount },\n dynamicClient\n );\n };\n\n const signRawMessage: WaasTempoWalletProvider['signRawMessage'] = async (\n args\n ) => signWaasRawMessage({ ...args, waasProvider }, dynamicClient);\n\n const signSerializedTransaction: WaasTempoWalletProvider['signSerializedTransaction'] =\n async (args) => {\n if (isBusinessAccountWalletAccount(args.walletAccount))\n throw new TempoBusinessAccountTransactionNotSupportedError();\n\n return await waasProvider.signSerializedTransaction(args);\n };\n\n const switchActiveNetwork: WaasTempoWalletProvider['switchActiveNetwork'] =\n async ({ networkId }) => {\n if (!isTempoChainId(networkId))\n throw new InvalidTempoNetworkError({ networkId });\n\n await switchActiveNetworkInLastKnownRegistry({\n client: dynamicClient,\n networkId,\n walletProviderKey: key,\n });\n };\n\n const destroy: WaasTempoWalletProvider['destroy'] = (args) =>\n waasProvider.destroy(args);\n\n return {\n ...waasProvider,\n chain,\n confirmTransaction: (args) => tempoConfirmTransaction(args, dynamicClient),\n createViemWalletClient,\n destroy,\n getActiveNetworkId,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(DYNAMIC_WAAS_METADATA.displayName),\n key,\n metadata: {\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n icon: DYNAMIC_WAAS_METADATA.icon,\n },\n signMessage,\n signRawMessage,\n signSerializedTransaction,\n supportsFeeTokenSelection: true,\n switchActiveNetwork,\n transferAmount: (args) =>\n tempoTransferAmount({ ...args, createViemWalletClient }),\n walletProviderType,\n };\n};\n","import {\n WalletProviderPriority,\n getDefaultClient,\n getWalletProviderRegistry,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerTempoNetworkProviderBuilder } from '../../registerTempoNetworkProviderBuilder/registerTempoNetworkProviderBuilder';\nimport { createWalletProviderForWaasTempo } from '../utils/createWalletProviderForWaasTempo';\n\n/** Registry key for the Tempo embedded wallet extension registered by addWaasTempoExtension. */\nexport const WAAS_TEMPO_EXTENSION_KEY = 'waasTempo';\n\n/**\n * Registers Tempo embedded wallet support with the Dynamic client: the Tempo\n * network provider and the embedded wallet provider for Tempo.\n * Calling it more than once is safe: later calls do nothing.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple clients.\n * @returns Nothing. The extension is registered on the client.\n * @example\n * ```ts\n * import { addWaasTempoExtension } from '@dynamic-labs-sdk/tempo/waas';\n *\n * addWaasTempoExtension(dynamicClient);\n * ```\n * @see addTempoExtension\n * @see isTempoWalletAccount\n * @notInstrumented\n */\nexport const addWaasTempoExtension = (client = getDefaultClient()): void => {\n if (hasExtension({ extensionKey: WAAS_TEMPO_EXTENSION_KEY }, client)) {\n return;\n }\n\n registerExtension({ extensionKey: WAAS_TEMPO_EXTENSION_KEY }, client);\n registerTempoNetworkProviderBuilder(client);\n\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n const walletProvider = createWalletProviderForWaasTempo({\n dynamicClient: client,\n });\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SDK,\n walletProvider,\n });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\n/**\n * Thrown when typed data is signed with a Tempo embedded wallet, which did\n * not support it yet.\n *\n * @deprecated Tempo embedded wallets now sign typed data, so the SDK no longer\n * throws this error. It stays exported so existing imports keep compiling.\n *\n * @example\n * ```ts\n * throw new TempoTypedDataNotSupportedError();\n * ```\n *\n * @see createWalletProviderForWaasTempo\n * @see addWaasTempoExtension\n */\nexport class TempoTypedDataNotSupportedError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'tempo_typed_data_not_supported',\n docsUrl: null,\n name: 'TempoTypedDataNotSupportedError',\n shortMessage:\n 'Signing typed data is not supported for Tempo embedded wallets yet',\n });\n }\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 { sendTempoTransaction } from '../waas/sendTempoTransaction/sendTempoTransaction';\nexport { signTempoTransaction } from '../waas/signTempoTransaction/signTempoTransaction';\nexport { addWaasTempoExtension } from '../waas/addWaasTempoExtension/addWaasTempoExtension';\nexport { InvalidTempoNetworkError } from '../errors/InvalidTempoNetworkError';\nexport { TempoTransactionValidationError } from '../errors/TempoTransactionValidationError';\nexport { TempoTypedDataNotSupportedError } from '../errors/TempoTypedDataNotSupportedError';\nexport type { TempoTransactionRequest } from '../waas/utils/assertValidTempoTransactionRequest';\nexport type { TempoTransactionCall } from '../waas/utils/serializeTempoTransactionForWaas';\nexport type { WaasTempoWalletProvider } from '../waas/WaasTempoWalletProvider.types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA,IAAa,kCAAb,cAAqD,UAAU;CAC7D,YAAY,EAAE,UAA8B;AAC1C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,8BAA8B;GAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;ACLN,MAAa,mCAAmC,gBAA+B;AAC7E,KACE,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,sBAAsB,eACtB,YAAY,iBAEZ,OAAM,IAAI,gCAAgC,EACxC,QACE,+EACH,CAAC;;;;;;;;;;;;;;;;;;;;ACFN,MAAa,uBAAuB,OAClC,EAAE,iBACF,WACqD;CACrD,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,sBAAsB,eAAe,CACxC,OAAM,IAAI,kBAAkB,+CAA+C;AAE7E,eACE,eAAe,wBACf,sDACD;AAED,QAAO,MAAM,eAAe,uBAAuB,EAAE,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACUvE,MAAa,uBAAuB,OAClC,EAAE,eAAe,GAAG,eACpB,SAAS,kBAAkB,KACa;AACxC,iCAAgC,YAAY;CAE5C,MAAM,eAAe,MAAM,qBAAqB,EAAE,eAAe,EAAE,OAAO;AAE1E,eACE,aAAa,QAAQ,iBACrB,yCACD;CAED,MAAM,wBAAwB,MAAM,aAAa,QAAQ,gBACvD,YACD;AAMD,QAAO,EAAE,iBAJe,MAAM,aAAa,mBAAmB,EAC5D,uBACD,CAAC,EAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnB5B,MAAa,uBAAuB,OAClC,EAAE,eAAe,GAAG,eACpB,SAAS,kBAAkB,K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-labs-sdk/tempo",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.esm.js",
@@ -22,9 +22,9 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@dynamic-labs/sdk-api-core": "0.125.0",
26
- "@dynamic-labs-sdk/assert-package-version": "1.46.0",
27
- "@dynamic-labs-sdk/client": "1.46.0"
25
+ "@dynamic-labs/sdk-api-core": "0.136.0",
26
+ "@dynamic-labs-sdk/assert-package-version": "1.47.0",
27
+ "@dynamic-labs-sdk/client": "1.47.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "viem": "^2.28.4"