@dynamic-labs-sdk/aptos 0.14.0 → 0.15.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.
@@ -6,7 +6,7 @@ let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
6
6
 
7
7
  //#region package.json
8
8
  var name = "@dynamic-labs-sdk/aptos";
9
- var version = "0.14.0";
9
+ var version = "0.15.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/utils/constants.ts
@@ -47,6 +47,71 @@ const registerAptosNetworkProviderBuilder = (client) => {
47
47
  });
48
48
  };
49
49
 
50
+ //#endregion
51
+ //#region src/errors/NotAptosProviderError/NotAptosProviderError.ts
52
+ var NotAptosProviderError = class extends _dynamic_labs_sdk_client.BaseError {
53
+ providerKey;
54
+ constructor(params) {
55
+ super({
56
+ cause: null,
57
+ code: "not_aptos_provider_error",
58
+ docsUrl: null,
59
+ name: "NotAptosProviderError",
60
+ shortMessage: "Provider is not an Aptos wallet provider"
61
+ });
62
+ this.providerKey = params.providerKey;
63
+ }
64
+ };
65
+
66
+ //#endregion
67
+ //#region src/isAptosWalletAccount/isAptosWalletAccount.ts
68
+ const isAptosWalletAccount = (walletAccount) => walletAccount.chain === "APTOS";
69
+
70
+ //#endregion
71
+ //#region src/isAptosWalletProvider/isAptosWalletProvider.ts
72
+ const isAptosWalletProvider = (provider) => {
73
+ return provider.chain === "APTOS";
74
+ };
75
+
76
+ //#endregion
77
+ //#region src/utils/aptosTransferAmount/aptosTransferAmount.ts
78
+ const APT_DECIMALS = 8;
79
+ /**
80
+ * Transfers native APT or fungible tokens from one wallet to another.
81
+ *
82
+ * Converts the human-readable amount string to the smallest unit (octas for APT,
83
+ * or the appropriate unit for fungible tokens) using string-based arithmetic
84
+ * to avoid floating-point precision issues.
85
+ */
86
+ const aptosTransferAmount = async ({ amount, recipient, token, walletAccount }, client) => {
87
+ if (!isAptosWalletAccount(walletAccount)) throw new _dynamic_labs_sdk_client.InvalidParamError("Wallet account is not an Aptos wallet account");
88
+ const provider = (0, _dynamic_labs_sdk_client_core.getWalletProviderFromWalletAccount)({ walletAccount }, client);
89
+ if (!isAptosWalletProvider(provider)) throw new NotAptosProviderError({ providerKey: provider.key });
90
+ const smallestUnitAmount = (0, _dynamic_labs_sdk_client_core.parseAmountToSmallestUnit)({
91
+ amount,
92
+ decimals: token?.decimals ?? APT_DECIMALS
93
+ });
94
+ let transaction;
95
+ if (token?.address) transaction = {
96
+ function: "0x1::primary_fungible_store::transfer",
97
+ functionArguments: [
98
+ token.address,
99
+ recipient,
100
+ Number(smallestUnitAmount)
101
+ ],
102
+ typeArguments: ["0x1::fungible_asset::Metadata"]
103
+ };
104
+ else transaction = {
105
+ function: "0x1::coin::transfer",
106
+ functionArguments: [recipient, Number(smallestUnitAmount)],
107
+ typeArguments: ["0x1::aptos_coin::AptosCoin"]
108
+ };
109
+ return { transactionHash: (await provider.signAndSubmitTransaction({
110
+ transaction,
111
+ walletAccount
112
+ })).hash };
113
+ };
114
+
50
115
  //#endregion
51
116
  //#region src/walletStandard/utils/createWalletProviderFromAptosStandardWallet/createWalletProviderFromAptosStandardWallet.ts
52
117
  const createWalletProviderFromAptosStandardWallet = ({ dynamicClient, walletStandardWallet }) => {
@@ -187,6 +252,7 @@ const createWalletProviderFromAptosStandardWallet = ({ dynamicClient, walletStan
187
252
  signMessage,
188
253
  signTransaction,
189
254
  terminate,
255
+ transferAmount: (args) => aptosTransferAmount(args, dynamicClient),
190
256
  walletProviderType
191
257
  };
192
258
  };
@@ -249,12 +315,30 @@ const addAptosWalletStandardExtension = (client = (0, _dynamic_labs_sdk_client_c
249
315
  };
250
316
 
251
317
  //#endregion
318
+ Object.defineProperty(exports, 'NotAptosProviderError', {
319
+ enumerable: true,
320
+ get: function () {
321
+ return NotAptosProviderError;
322
+ }
323
+ });
252
324
  Object.defineProperty(exports, 'addAptosWalletStandardExtension', {
253
325
  enumerable: true,
254
326
  get: function () {
255
327
  return addAptosWalletStandardExtension;
256
328
  }
257
329
  });
330
+ Object.defineProperty(exports, 'isAptosWalletAccount', {
331
+ enumerable: true,
332
+ get: function () {
333
+ return isAptosWalletAccount;
334
+ }
335
+ });
336
+ Object.defineProperty(exports, 'isAptosWalletProvider', {
337
+ enumerable: true,
338
+ get: function () {
339
+ return isAptosWalletProvider;
340
+ }
341
+ });
258
342
  Object.defineProperty(exports, 'name', {
259
343
  enumerable: true,
260
344
  get: function () {
@@ -267,4 +351,4 @@ Object.defineProperty(exports, 'version', {
267
351
  return version;
268
352
  }
269
353
  });
270
- //# sourceMappingURL=addAptosWalletStandardExtension-nCf982HY.cjs.js.map
354
+ //# sourceMappingURL=addAptosWalletStandardExtension-DrKR-qte.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addAptosWalletStandardExtension-DrKR-qte.cjs.js","names":["Aptos","AptosConfig","BaseError","InvalidParamError","transaction: AptosTransactionPayload","features: AptosFeatures","WalletProviderEnum","connect: AptosWalletProvider['connect']","UserResponseStatus","UserRejectedError","disconnect: AptosWalletProvider['disconnect']","getActiveNetworkId: AptosWalletProvider['getActiveNetworkId']","getAptosClient: AptosWalletProvider['getAptosClient']","Aptos","AptosConfig","getConnectedAddresses: AptosWalletProvider['getConnectedAddresses']","signTransaction: AptosWalletProvider['signTransaction']","signAndSubmitTransaction: AptosWalletProvider['signAndSubmitTransaction']","signMessage: AptosWalletProvider['signMessage']","publicKey: string | undefined","terminate: AptosWalletProvider['terminate']","REQUIRED_FEATURES: (keyof MinimallyRequiredFeatures)[]","WalletProviderPriority"],"sources":["../package.json","../src/utils/constants.ts","../src/utils/fetchAptosBalance/fetchAptosBalance.ts","../src/utils/createAptosNetworkProvider/createAptosNetworkProvider.ts","../src/registerAptosNetworkProviderBuilder/registerAptosNetworkProviderBuilder.ts","../src/errors/NotAptosProviderError/NotAptosProviderError.ts","../src/isAptosWalletAccount/isAptosWalletAccount.ts","../src/isAptosWalletProvider/isAptosWalletProvider.ts","../src/utils/aptosTransferAmount/aptosTransferAmount.ts","../src/walletStandard/utils/createWalletProviderFromAptosStandardWallet/createWalletProviderFromAptosStandardWallet.ts","../src/walletStandard/utils/hasAllRequiredFeatures/hasAllRequiredFeatures.ts","../src/walletStandard/utils/registerAptosStandardWallet/registerAptosStandardWallet.ts","../src/walletStandard/addAptosWalletStandardExtension/addAptosWalletStandardExtension.ts"],"sourcesContent":["","// 1 APT = 10^8 octas (similar to 1 BTC = 10^8 satoshis)\nexport const OCTAS_PER_APT = 1e8;\n","import type { Network } from '@aptos-labs/ts-sdk';\nimport { Aptos, AptosConfig } from '@aptos-labs/ts-sdk';\nimport type { NetworkData } from '@dynamic-labs-sdk/client';\n\nimport { OCTAS_PER_APT } from '../constants';\n\ntype FetchAptosBalanceParams = {\n address: string;\n networkData: NetworkData;\n};\n\nexport const fetchAptosBalance = async ({\n address,\n networkData,\n}: FetchAptosBalanceParams): Promise<string | null> => {\n const config = new AptosConfig({\n fullnode: networkData.rpcUrls.http[0],\n network: networkData.cluster as Network,\n });\n\n const aptosClient = new Aptos(config);\n\n const balance = await aptosClient.getBalance({\n accountAddress: address,\n // APT coin type\n asset: '0x1::aptos_coin::AptosCoin',\n });\n\n return (Number(balance) / OCTAS_PER_APT).toString();\n};\n","import type { NetworkData } from '@dynamic-labs-sdk/client';\nimport { createBaseNetworkProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosNetworkProvider } from '../../AptosNetworkProvider.types';\nimport { fetchAptosBalance } from '../fetchAptosBalance';\n\nexport const createAptosNetworkProvider = (\n networkData: NetworkData\n): AptosNetworkProvider => ({\n ...createBaseNetworkProvider('APTOS', networkData),\n cluster: networkData.cluster,\n getBalance: async ({ address }) => ({\n balance: await fetchAptosBalance({\n address,\n networkData,\n }),\n }),\n});\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';\n\nimport { createAptosNetworkProvider } from '../utils/createAptosNetworkProvider';\n\nexport const registerAptosNetworkProviderBuilder = (\n client: DynamicClient\n): void => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n // If the Aptos network provider builder is already registered, return.\n if (networkProviderBuilderRegistry.get().get('APTOS')) {\n return;\n }\n\n networkProviderBuilderRegistry.register({\n builder: createAptosNetworkProvider,\n chain: 'APTOS',\n });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotAptosProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aptos_provider_error',\n docsUrl: null,\n name: 'NotAptosProviderError',\n shortMessage: 'Provider is not an Aptos wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\n\nexport const isAptosWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AptosWalletAccount => walletAccount.chain === 'APTOS';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletProvider } from '../AptosWalletProvider.types';\n\nexport const isAptosWalletProvider = (\n provider: WalletProvider | AptosWalletProvider\n): provider is AptosWalletProvider => {\n return provider.chain === 'APTOS';\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport {\n type TransferAmountParams,\n getWalletProviderFromWalletAccount,\n parseAmountToSmallestUnit,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosTransactionPayload } from '../../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../../errors/NotAptosProviderError';\nimport { isAptosWalletAccount } from '../../isAptosWalletAccount';\nimport { isAptosWalletProvider } from '../../isAptosWalletProvider';\n\nconst APT_DECIMALS = 8;\n\n/**\n * Transfers native APT or fungible tokens from one wallet to another.\n *\n * Converts the human-readable amount string to the smallest unit (octas for APT,\n * or the appropriate unit for fungible tokens) using string-based arithmetic\n * to avoid floating-point precision issues.\n */\nexport const aptosTransferAmount = async (\n { amount, recipient, token, walletAccount }: TransferAmountParams,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n if (!isAptosWalletAccount(walletAccount)) {\n throw new InvalidParamError(\n 'Wallet account is not an Aptos wallet account'\n );\n }\n\n const provider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n const decimals = token?.decimals ?? APT_DECIMALS;\n const smallestUnitAmount = parseAmountToSmallestUnit({ amount, decimals });\n\n let transaction: AptosTransactionPayload;\n if (token?.address) {\n transaction = {\n function: '0x1::primary_fungible_store::transfer',\n functionArguments: [token.address, recipient, Number(smallestUnitAmount)],\n typeArguments: ['0x1::fungible_asset::Metadata'],\n };\n } else {\n transaction = {\n function: '0x1::coin::transfer',\n functionArguments: [recipient, Number(smallestUnitAmount)],\n typeArguments: ['0x1::aptos_coin::AptosCoin'],\n };\n }\n\n const result = await provider.signAndSubmitTransaction({\n transaction,\n walletAccount,\n });\n\n return { transactionHash: result.hash };\n};\n","import type { Network } from '@aptos-labs/ts-sdk';\nimport { Aptos, AptosConfig } from '@aptos-labs/ts-sdk';\nimport type {\n AccountInfo,\n AptosFeatures,\n AptosWallet,\n} from '@aptos-labs/wallet-standard';\nimport { UserResponseStatus } from '@aptos-labs/wallet-standard';\nimport {\n type DynamicClient,\n UserRejectedError,\n assertWalletAccountSigningAvailability,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n createWalletProviderEventEmitter,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { AptosWalletProvider } from '../../../AptosWalletProvider.types';\nimport { aptosTransferAmount } from '../../../utils/aptosTransferAmount';\n\ntype CreateWalletProviderFromAptosStandardWalletParams = {\n dynamicClient: DynamicClient;\n walletStandardWallet: AptosWallet;\n};\n\nexport const createWalletProviderFromAptosStandardWallet = ({\n dynamicClient,\n walletStandardWallet,\n}: CreateWalletProviderFromAptosStandardWalletParams): AptosWalletProvider => {\n const features: AptosFeatures = walletStandardWallet.features;\n\n const walletProviderType = WalletProviderEnum.BrowserExtension;\n\n const key = formatWalletProviderKey({\n chain: 'APTOS',\n displayName: walletStandardWallet.name,\n walletProviderType,\n });\n\n const getAutoConnectedAccount = ():\n | { address: string; publicKey: string }[]\n | undefined => {\n const accounts = walletStandardWallet.accounts;\n if (!accounts?.length || !accounts[0].publicKey || !accounts[0].address) {\n return;\n }\n\n return accounts.map((account) => ({\n address: account.address.toString(),\n publicKey: account.publicKey?.toString(),\n }));\n };\n\n const connect: AptosWalletProvider['connect'] = async () => {\n const autoConnectedAccounts = getAutoConnectedAccount();\n\n if (autoConnectedAccounts) {\n return {\n addresses: autoConnectedAccounts,\n };\n }\n\n const connectMethod = features['aptos:connect']?.connect;\n\n assertDefined(connectMethod, 'connect method not found in wallet features');\n\n const result = await connectMethod();\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'connect' });\n }\n\n return {\n addresses: [\n {\n address: result.args.address.toString(),\n publicKey: result.args.publicKey?.toString(),\n },\n ],\n };\n };\n\n const disconnect: AptosWalletProvider['disconnect'] = async () => {\n const disconnectMethod = features['aptos:disconnect']?.disconnect;\n\n // this should never happen as we check for all required features in hasAllRequiredFeatures\n // but we'll assert it just in case\n assertDefined(\n disconnectMethod,\n 'disconnect method not found in wallet features'\n );\n\n return disconnectMethod();\n };\n\n const getActiveNetworkId: AptosWalletProvider['getActiveNetworkId'] =\n async () => {\n const aptosNetwork = await features['aptos:network']?.network();\n\n if (!aptosNetwork?.chainId) {\n return getActiveNetworkIdFromLastKnownRegistry({\n client: dynamicClient,\n walletProviderKey: key,\n });\n }\n\n return { networkId: aptosNetwork.chainId.toString() };\n };\n\n const getAptosClient: AptosWalletProvider['getAptosClient'] = async ({\n walletAccount,\n }) => {\n const activeNetworkData = await getActiveNetworkData(\n { walletAccount },\n dynamicClient\n );\n\n assertDefined(\n activeNetworkData.networkData,\n 'No active network data found'\n );\n\n const { rpcUrls, cluster } = activeNetworkData.networkData;\n\n const url = rpcUrls.http[0];\n\n assertDefined(url, 'No RPC URL found for active network');\n\n const network = cluster as Network;\n const config = new AptosConfig({ fullnode: url, network });\n\n return new Aptos(config);\n };\n\n const getConnectedAccount = async (): Promise<AccountInfo | undefined> => {\n const getAccountMethod = features['aptos:account']?.account;\n\n if (!getAccountMethod) {\n return undefined;\n }\n\n return getAccountMethod();\n };\n\n const getConnectedAddresses: AptosWalletProvider['getConnectedAddresses'] =\n async () => {\n const account = await getConnectedAccount();\n\n if (account) {\n return {\n addresses: [account.address.toString()],\n };\n }\n\n return {\n addresses: [],\n };\n };\n\n const signTransaction: AptosWalletProvider['signTransaction'] = async ({\n asFeePayer,\n transaction,\n walletAccount,\n }) => {\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signTransactionMethod =\n features['aptos:signTransaction']?.signTransaction;\n\n assertDefined(\n signTransactionMethod,\n 'signTransaction method not found in wallet features'\n );\n\n const result = await signTransactionMethod(transaction, asFeePayer);\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signTransaction' });\n }\n\n return {\n signature: result.args,\n };\n };\n\n const signAndSubmitTransaction: AptosWalletProvider['signAndSubmitTransaction'] =\n async ({ transaction, walletAccount }) => {\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signAndSubmitMethod =\n features['aptos:signAndSubmitTransaction']?.signAndSubmitTransaction;\n\n assertDefined(\n signAndSubmitMethod,\n 'signAndSubmitTransaction method not found in wallet features'\n );\n\n const result = await signAndSubmitMethod({\n payload: transaction,\n });\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signAndSubmitTransaction' });\n }\n\n return {\n hash: result.args.hash,\n };\n };\n\n const signMessage: AptosWalletProvider['signMessage'] = async ({\n message,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account not found');\n\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signMessageMethod = features['aptos:signMessage']?.signMessage;\n\n assertDefined(\n signMessageMethod,\n 'signMessage method not found in wallet features'\n );\n\n const nonce = Date.now().toString();\n const result = await signMessageMethod({\n message,\n nonce,\n });\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signMessage' });\n }\n\n let publicKey: string | undefined =\n walletStandardWallet.accounts[0]?.publicKey?.toString();\n\n if (!publicKey) {\n const account = await getConnectedAccount();\n publicKey = account?.publicKey?.toString();\n }\n\n const signatureObj = {\n fullMessage: result.args.fullMessage,\n publicKey,\n signature: result.args.signature.toString(),\n };\n\n return { signature: JSON.stringify(signatureObj) };\n };\n\n const { cleanupEventEmitter, getEventEmitter } =\n createWalletProviderEventEmitter<VoidFunction>({\n removeEventListeners: ({ setupReturnValue }) => {\n assertDefined(setupReturnValue, 'Setup return value not defined');\n\n setupReturnValue();\n },\n\n setupEventListeners: ({\n handleAccountsChanged,\n handleNetworkChanged,\n }): VoidFunction => {\n const onAccountChange =\n features['aptos:onAccountChange']?.onAccountChange;\n\n if (onAccountChange) {\n void onAccountChange((account) => {\n handleAccountsChanged({\n addresses: account ? [account.address.toString()] : [],\n });\n });\n }\n\n const onNetworkChange =\n features['aptos:onNetworkChange']?.onNetworkChange;\n\n if (onNetworkChange) {\n void onNetworkChange((network) => {\n handleNetworkChanged({ networkId: network.chainId.toString() });\n });\n }\n\n return () => {};\n },\n\n supportedEvents: ['accountsChanged', 'networkChanged'],\n });\n\n const terminate: AptosWalletProvider['terminate'] = async () => {\n cleanupEventEmitter();\n };\n\n const walletProvider: AptosWalletProvider = {\n chain: 'APTOS',\n connect,\n disconnect,\n get events() {\n return getEventEmitter();\n },\n getActiveNetworkId,\n getAptosClient,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(walletStandardWallet.name),\n key,\n metadata: {\n displayName: walletStandardWallet.name,\n icon: walletStandardWallet.icon,\n },\n signAndSubmitTransaction,\n signMessage,\n signTransaction,\n terminate,\n transferAmount: (args) => aptosTransferAmount(args, dynamicClient),\n walletProviderType,\n };\n\n return walletProvider;\n};\n","import type {\n AptosWallet,\n MinimallyRequiredFeatures,\n} from '@aptos-labs/wallet-standard';\n\nconst REQUIRED_FEATURES: (keyof MinimallyRequiredFeatures)[] = [\n 'aptos:account',\n 'aptos:connect',\n 'aptos:disconnect',\n 'aptos:network',\n 'aptos:onAccountChange',\n 'aptos:onNetworkChange',\n 'aptos:signMessage',\n 'aptos:signTransaction',\n];\n\nexport const hasAllRequiredFeatures = (wallet: AptosWallet): boolean => {\n return Boolean(\n REQUIRED_FEATURES.every((feature) => feature in wallet.features)\n );\n};\n","import type { AptosWallet } from '@aptos-labs/wallet-standard';\nimport type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n WalletProviderPriority,\n getWalletProviderRegistry,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { createWalletProviderFromAptosStandardWallet } from '../createWalletProviderFromAptosStandardWallet';\nimport { hasAllRequiredFeatures } from '../hasAllRequiredFeatures';\n\nexport const registerAptosStandardWallet = (\n wallet: AptosWallet,\n client: DynamicClient\n) => {\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n if (hasAllRequiredFeatures(wallet)) {\n const walletProvider = createWalletProviderFromAptosStandardWallet({\n dynamicClient: client,\n walletStandardWallet: wallet,\n });\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD,\n walletProvider,\n });\n }\n};\n","import type { AptosWallet } from '@aptos-labs/wallet-standard';\nimport { getAptosWallets } from '@aptos-labs/wallet-standard';\nimport {\n getDefaultClient,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerAptosNetworkProviderBuilder } from '../../registerAptosNetworkProviderBuilder';\nimport { registerAptosStandardWallet } from '../utils/registerAptosStandardWallet';\n\nexport const APTOS_WALLET_STANDARD_EXTENSION_KEY = 'aptosWalletStandard';\n\n/**\n * Adds the Aptos Wallet Standard extension to the Dynamic client.\n *\n * This extension enables integration with wallets that implement the Aptos Wallet Standard (AIP-62),\n * automatically detecting and registering compatible wallets for use with the Dynamic SDK.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A function that can be used to remove Aptos Wallet Standard register event listener that was added.\n */\nexport const addAptosWalletStandardExtension = (\n client = getDefaultClient()\n): VoidFunction => {\n if (\n hasExtension({ extensionKey: APTOS_WALLET_STANDARD_EXTENSION_KEY }, client)\n ) {\n return () => {\n // noop\n };\n }\n\n registerExtension(\n { extensionKey: APTOS_WALLET_STANDARD_EXTENSION_KEY },\n client\n );\n\n registerAptosNetworkProviderBuilder(client);\n\n const { aptosWallets, on } = getAptosWallets();\n\n // Listen for new wallet registrations/announcements\n const removeListener = on('register', (wallet) => {\n registerAptosStandardWallet(wallet as AptosWallet, client);\n });\n\n // Register all wallets that are already registered/announced in the browser\n for (const wallet of aptosWallets) {\n registerAptosStandardWallet(wallet, client);\n }\n\n return removeListener;\n};\n"],"mappings":";;;;;;;;;;;;ACCA,MAAa,gBAAgB;;;;ACU7B,MAAa,oBAAoB,OAAO,EACtC,SACA,kBACqD;CAQrD,MAAM,UAAU,MAFI,IAAIA,yBALT,IAAIC,+BAAY;EAC7B,UAAU,YAAY,QAAQ,KAAK;EACnC,SAAS,YAAY;EACtB,CAAC,CAEmC,CAEH,WAAW;EAC3C,gBAAgB;EAEhB,OAAO;EACR,CAAC;AAEF,SAAQ,OAAO,QAAQ,GAAG,eAAe,UAAU;;;;;ACtBrD,MAAa,8BACX,iBAC0B;CAC1B,gEAA6B,SAAS,YAAY;CAClD,SAAS,YAAY;CACrB,YAAY,OAAO,EAAE,eAAe,EAClC,SAAS,MAAM,kB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,MAAMC,oBAAyD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,0BAA0B,WAAiC;AACtE,QAAO,QACL,kBAAkB,OAAO,YAAY,WAAW,OAAO,SAAS,CACjE;;;;;ACTH,MAAa,+BACX,QACA,WACG;CACH,MAAM,sFAAmD,OAAO;AAEhE,KAAI,uBAAuB,OAAO,EAAE;EAClC,MAAM,iBAAiB,4CAA4C;GACjE,eAAe;GACf,sBAAsB;GACvB,CAAC;AAEF,yBAAuB,SAAS;GAC9B,UAAUC,qDAAuB;GACjC;GACD,CAAC;;;;;;ACdN,MAAa,sCAAsC;;;;;;;;;;;AAYnD,MAAa,mCACX,8DAA2B,KACV;AACjB,qDACe,EAAE,cAAc,qCAAqC,EAAE,OAAO,CAE3E,cAAa;AAKf,sDACE,EAAE,cAAc,qCAAqC,EACrD,OACD;AAED,qCAAoC,OAAO;CAE3C,MAAM,EAAE,cAAc,yDAAwB;CAG9C,MAAM,iBAAiB,GAAG,aAAa,WAAW;AAChD,8BAA4B,QAAuB,OAAO;GAC1D;AAGF,MAAK,MAAM,UAAU,aACnB,6BAA4B,QAAQ,OAAO;AAG7C,QAAO"}
@@ -1,12 +1,12 @@
1
- import { WalletProviderPriority, assertDefined, createBaseNetworkProvider, createWalletProviderEventEmitter, formatWalletProviderGroupKey, formatWalletProviderKey, getActiveNetworkIdFromLastKnownRegistry, getDefaultClient, getNetworkProviderBuilderRegistry, getWalletProviderRegistry, hasExtension, registerExtension } from "@dynamic-labs-sdk/client/core";
1
+ import { WalletProviderPriority, assertDefined, createBaseNetworkProvider, createWalletProviderEventEmitter, formatWalletProviderGroupKey, formatWalletProviderKey, getActiveNetworkIdFromLastKnownRegistry, getDefaultClient, getNetworkProviderBuilderRegistry, getWalletProviderFromWalletAccount, getWalletProviderRegistry, hasExtension, parseAmountToSmallestUnit, registerExtension } from "@dynamic-labs-sdk/client/core";
2
2
  import { UserResponseStatus, getAptosWallets } from "@aptos-labs/wallet-standard";
3
3
  import { Aptos, AptosConfig } from "@aptos-labs/ts-sdk";
4
- import { UserRejectedError, assertWalletAccountSigningAvailability, getActiveNetworkData } from "@dynamic-labs-sdk/client";
4
+ import { BaseError, InvalidParamError, UserRejectedError, assertWalletAccountSigningAvailability, getActiveNetworkData } from "@dynamic-labs-sdk/client";
5
5
  import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
6
6
 
7
7
  //#region package.json
8
8
  var name = "@dynamic-labs-sdk/aptos";
9
- var version = "0.14.0";
9
+ var version = "0.15.0";
10
10
 
11
11
  //#endregion
12
12
  //#region src/utils/constants.ts
@@ -47,6 +47,71 @@ const registerAptosNetworkProviderBuilder = (client) => {
47
47
  });
48
48
  };
49
49
 
50
+ //#endregion
51
+ //#region src/errors/NotAptosProviderError/NotAptosProviderError.ts
52
+ var NotAptosProviderError = class extends BaseError {
53
+ providerKey;
54
+ constructor(params) {
55
+ super({
56
+ cause: null,
57
+ code: "not_aptos_provider_error",
58
+ docsUrl: null,
59
+ name: "NotAptosProviderError",
60
+ shortMessage: "Provider is not an Aptos wallet provider"
61
+ });
62
+ this.providerKey = params.providerKey;
63
+ }
64
+ };
65
+
66
+ //#endregion
67
+ //#region src/isAptosWalletAccount/isAptosWalletAccount.ts
68
+ const isAptosWalletAccount = (walletAccount) => walletAccount.chain === "APTOS";
69
+
70
+ //#endregion
71
+ //#region src/isAptosWalletProvider/isAptosWalletProvider.ts
72
+ const isAptosWalletProvider = (provider) => {
73
+ return provider.chain === "APTOS";
74
+ };
75
+
76
+ //#endregion
77
+ //#region src/utils/aptosTransferAmount/aptosTransferAmount.ts
78
+ const APT_DECIMALS = 8;
79
+ /**
80
+ * Transfers native APT or fungible tokens from one wallet to another.
81
+ *
82
+ * Converts the human-readable amount string to the smallest unit (octas for APT,
83
+ * or the appropriate unit for fungible tokens) using string-based arithmetic
84
+ * to avoid floating-point precision issues.
85
+ */
86
+ const aptosTransferAmount = async ({ amount, recipient, token, walletAccount }, client) => {
87
+ if (!isAptosWalletAccount(walletAccount)) throw new InvalidParamError("Wallet account is not an Aptos wallet account");
88
+ const provider = getWalletProviderFromWalletAccount({ walletAccount }, client);
89
+ if (!isAptosWalletProvider(provider)) throw new NotAptosProviderError({ providerKey: provider.key });
90
+ const smallestUnitAmount = parseAmountToSmallestUnit({
91
+ amount,
92
+ decimals: token?.decimals ?? APT_DECIMALS
93
+ });
94
+ let transaction;
95
+ if (token?.address) transaction = {
96
+ function: "0x1::primary_fungible_store::transfer",
97
+ functionArguments: [
98
+ token.address,
99
+ recipient,
100
+ Number(smallestUnitAmount)
101
+ ],
102
+ typeArguments: ["0x1::fungible_asset::Metadata"]
103
+ };
104
+ else transaction = {
105
+ function: "0x1::coin::transfer",
106
+ functionArguments: [recipient, Number(smallestUnitAmount)],
107
+ typeArguments: ["0x1::aptos_coin::AptosCoin"]
108
+ };
109
+ return { transactionHash: (await provider.signAndSubmitTransaction({
110
+ transaction,
111
+ walletAccount
112
+ })).hash };
113
+ };
114
+
50
115
  //#endregion
51
116
  //#region src/walletStandard/utils/createWalletProviderFromAptosStandardWallet/createWalletProviderFromAptosStandardWallet.ts
52
117
  const createWalletProviderFromAptosStandardWallet = ({ dynamicClient, walletStandardWallet }) => {
@@ -187,6 +252,7 @@ const createWalletProviderFromAptosStandardWallet = ({ dynamicClient, walletStan
187
252
  signMessage,
188
253
  signTransaction,
189
254
  terminate,
255
+ transferAmount: (args) => aptosTransferAmount(args, dynamicClient),
190
256
  walletProviderType
191
257
  };
192
258
  };
@@ -249,5 +315,5 @@ const addAptosWalletStandardExtension = (client = getDefaultClient()) => {
249
315
  };
250
316
 
251
317
  //#endregion
252
- export { name as n, version as r, addAptosWalletStandardExtension as t };
253
- //# sourceMappingURL=addAptosWalletStandardExtension-D8FQX2lh.esm.js.map
318
+ export { name as a, NotAptosProviderError as i, isAptosWalletProvider as n, version as o, isAptosWalletAccount as r, addAptosWalletStandardExtension as t };
319
+ //# sourceMappingURL=addAptosWalletStandardExtension-q6Gc5nMC.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addAptosWalletStandardExtension-q6Gc5nMC.esm.js","names":["transaction: AptosTransactionPayload","features: AptosFeatures","connect: AptosWalletProvider['connect']","disconnect: AptosWalletProvider['disconnect']","getActiveNetworkId: AptosWalletProvider['getActiveNetworkId']","getAptosClient: AptosWalletProvider['getAptosClient']","getConnectedAddresses: AptosWalletProvider['getConnectedAddresses']","signTransaction: AptosWalletProvider['signTransaction']","signAndSubmitTransaction: AptosWalletProvider['signAndSubmitTransaction']","signMessage: AptosWalletProvider['signMessage']","publicKey: string | undefined","terminate: AptosWalletProvider['terminate']","REQUIRED_FEATURES: (keyof MinimallyRequiredFeatures)[]"],"sources":["../package.json","../src/utils/constants.ts","../src/utils/fetchAptosBalance/fetchAptosBalance.ts","../src/utils/createAptosNetworkProvider/createAptosNetworkProvider.ts","../src/registerAptosNetworkProviderBuilder/registerAptosNetworkProviderBuilder.ts","../src/errors/NotAptosProviderError/NotAptosProviderError.ts","../src/isAptosWalletAccount/isAptosWalletAccount.ts","../src/isAptosWalletProvider/isAptosWalletProvider.ts","../src/utils/aptosTransferAmount/aptosTransferAmount.ts","../src/walletStandard/utils/createWalletProviderFromAptosStandardWallet/createWalletProviderFromAptosStandardWallet.ts","../src/walletStandard/utils/hasAllRequiredFeatures/hasAllRequiredFeatures.ts","../src/walletStandard/utils/registerAptosStandardWallet/registerAptosStandardWallet.ts","../src/walletStandard/addAptosWalletStandardExtension/addAptosWalletStandardExtension.ts"],"sourcesContent":["","// 1 APT = 10^8 octas (similar to 1 BTC = 10^8 satoshis)\nexport const OCTAS_PER_APT = 1e8;\n","import type { Network } from '@aptos-labs/ts-sdk';\nimport { Aptos, AptosConfig } from '@aptos-labs/ts-sdk';\nimport type { NetworkData } from '@dynamic-labs-sdk/client';\n\nimport { OCTAS_PER_APT } from '../constants';\n\ntype FetchAptosBalanceParams = {\n address: string;\n networkData: NetworkData;\n};\n\nexport const fetchAptosBalance = async ({\n address,\n networkData,\n}: FetchAptosBalanceParams): Promise<string | null> => {\n const config = new AptosConfig({\n fullnode: networkData.rpcUrls.http[0],\n network: networkData.cluster as Network,\n });\n\n const aptosClient = new Aptos(config);\n\n const balance = await aptosClient.getBalance({\n accountAddress: address,\n // APT coin type\n asset: '0x1::aptos_coin::AptosCoin',\n });\n\n return (Number(balance) / OCTAS_PER_APT).toString();\n};\n","import type { NetworkData } from '@dynamic-labs-sdk/client';\nimport { createBaseNetworkProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosNetworkProvider } from '../../AptosNetworkProvider.types';\nimport { fetchAptosBalance } from '../fetchAptosBalance';\n\nexport const createAptosNetworkProvider = (\n networkData: NetworkData\n): AptosNetworkProvider => ({\n ...createBaseNetworkProvider('APTOS', networkData),\n cluster: networkData.cluster,\n getBalance: async ({ address }) => ({\n balance: await fetchAptosBalance({\n address,\n networkData,\n }),\n }),\n});\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';\n\nimport { createAptosNetworkProvider } from '../utils/createAptosNetworkProvider';\n\nexport const registerAptosNetworkProviderBuilder = (\n client: DynamicClient\n): void => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n // If the Aptos network provider builder is already registered, return.\n if (networkProviderBuilderRegistry.get().get('APTOS')) {\n return;\n }\n\n networkProviderBuilderRegistry.register({\n builder: createAptosNetworkProvider,\n chain: 'APTOS',\n });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotAptosProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aptos_provider_error',\n docsUrl: null,\n name: 'NotAptosProviderError',\n shortMessage: 'Provider is not an Aptos wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\n\nexport const isAptosWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AptosWalletAccount => walletAccount.chain === 'APTOS';\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletProvider } from '../AptosWalletProvider.types';\n\nexport const isAptosWalletProvider = (\n provider: WalletProvider | AptosWalletProvider\n): provider is AptosWalletProvider => {\n return provider.chain === 'APTOS';\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { InvalidParamError } from '@dynamic-labs-sdk/client';\nimport {\n type TransferAmountParams,\n getWalletProviderFromWalletAccount,\n parseAmountToSmallestUnit,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosTransactionPayload } from '../../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../../errors/NotAptosProviderError';\nimport { isAptosWalletAccount } from '../../isAptosWalletAccount';\nimport { isAptosWalletProvider } from '../../isAptosWalletProvider';\n\nconst APT_DECIMALS = 8;\n\n/**\n * Transfers native APT or fungible tokens from one wallet to another.\n *\n * Converts the human-readable amount string to the smallest unit (octas for APT,\n * or the appropriate unit for fungible tokens) using string-based arithmetic\n * to avoid floating-point precision issues.\n */\nexport const aptosTransferAmount = async (\n { amount, recipient, token, walletAccount }: TransferAmountParams,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n if (!isAptosWalletAccount(walletAccount)) {\n throw new InvalidParamError(\n 'Wallet account is not an Aptos wallet account'\n );\n }\n\n const provider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n const decimals = token?.decimals ?? APT_DECIMALS;\n const smallestUnitAmount = parseAmountToSmallestUnit({ amount, decimals });\n\n let transaction: AptosTransactionPayload;\n if (token?.address) {\n transaction = {\n function: '0x1::primary_fungible_store::transfer',\n functionArguments: [token.address, recipient, Number(smallestUnitAmount)],\n typeArguments: ['0x1::fungible_asset::Metadata'],\n };\n } else {\n transaction = {\n function: '0x1::coin::transfer',\n functionArguments: [recipient, Number(smallestUnitAmount)],\n typeArguments: ['0x1::aptos_coin::AptosCoin'],\n };\n }\n\n const result = await provider.signAndSubmitTransaction({\n transaction,\n walletAccount,\n });\n\n return { transactionHash: result.hash };\n};\n","import type { Network } from '@aptos-labs/ts-sdk';\nimport { Aptos, AptosConfig } from '@aptos-labs/ts-sdk';\nimport type {\n AccountInfo,\n AptosFeatures,\n AptosWallet,\n} from '@aptos-labs/wallet-standard';\nimport { UserResponseStatus } from '@aptos-labs/wallet-standard';\nimport {\n type DynamicClient,\n UserRejectedError,\n assertWalletAccountSigningAvailability,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n createWalletProviderEventEmitter,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { AptosWalletProvider } from '../../../AptosWalletProvider.types';\nimport { aptosTransferAmount } from '../../../utils/aptosTransferAmount';\n\ntype CreateWalletProviderFromAptosStandardWalletParams = {\n dynamicClient: DynamicClient;\n walletStandardWallet: AptosWallet;\n};\n\nexport const createWalletProviderFromAptosStandardWallet = ({\n dynamicClient,\n walletStandardWallet,\n}: CreateWalletProviderFromAptosStandardWalletParams): AptosWalletProvider => {\n const features: AptosFeatures = walletStandardWallet.features;\n\n const walletProviderType = WalletProviderEnum.BrowserExtension;\n\n const key = formatWalletProviderKey({\n chain: 'APTOS',\n displayName: walletStandardWallet.name,\n walletProviderType,\n });\n\n const getAutoConnectedAccount = ():\n | { address: string; publicKey: string }[]\n | undefined => {\n const accounts = walletStandardWallet.accounts;\n if (!accounts?.length || !accounts[0].publicKey || !accounts[0].address) {\n return;\n }\n\n return accounts.map((account) => ({\n address: account.address.toString(),\n publicKey: account.publicKey?.toString(),\n }));\n };\n\n const connect: AptosWalletProvider['connect'] = async () => {\n const autoConnectedAccounts = getAutoConnectedAccount();\n\n if (autoConnectedAccounts) {\n return {\n addresses: autoConnectedAccounts,\n };\n }\n\n const connectMethod = features['aptos:connect']?.connect;\n\n assertDefined(connectMethod, 'connect method not found in wallet features');\n\n const result = await connectMethod();\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'connect' });\n }\n\n return {\n addresses: [\n {\n address: result.args.address.toString(),\n publicKey: result.args.publicKey?.toString(),\n },\n ],\n };\n };\n\n const disconnect: AptosWalletProvider['disconnect'] = async () => {\n const disconnectMethod = features['aptos:disconnect']?.disconnect;\n\n // this should never happen as we check for all required features in hasAllRequiredFeatures\n // but we'll assert it just in case\n assertDefined(\n disconnectMethod,\n 'disconnect method not found in wallet features'\n );\n\n return disconnectMethod();\n };\n\n const getActiveNetworkId: AptosWalletProvider['getActiveNetworkId'] =\n async () => {\n const aptosNetwork = await features['aptos:network']?.network();\n\n if (!aptosNetwork?.chainId) {\n return getActiveNetworkIdFromLastKnownRegistry({\n client: dynamicClient,\n walletProviderKey: key,\n });\n }\n\n return { networkId: aptosNetwork.chainId.toString() };\n };\n\n const getAptosClient: AptosWalletProvider['getAptosClient'] = async ({\n walletAccount,\n }) => {\n const activeNetworkData = await getActiveNetworkData(\n { walletAccount },\n dynamicClient\n );\n\n assertDefined(\n activeNetworkData.networkData,\n 'No active network data found'\n );\n\n const { rpcUrls, cluster } = activeNetworkData.networkData;\n\n const url = rpcUrls.http[0];\n\n assertDefined(url, 'No RPC URL found for active network');\n\n const network = cluster as Network;\n const config = new AptosConfig({ fullnode: url, network });\n\n return new Aptos(config);\n };\n\n const getConnectedAccount = async (): Promise<AccountInfo | undefined> => {\n const getAccountMethod = features['aptos:account']?.account;\n\n if (!getAccountMethod) {\n return undefined;\n }\n\n return getAccountMethod();\n };\n\n const getConnectedAddresses: AptosWalletProvider['getConnectedAddresses'] =\n async () => {\n const account = await getConnectedAccount();\n\n if (account) {\n return {\n addresses: [account.address.toString()],\n };\n }\n\n return {\n addresses: [],\n };\n };\n\n const signTransaction: AptosWalletProvider['signTransaction'] = async ({\n asFeePayer,\n transaction,\n walletAccount,\n }) => {\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signTransactionMethod =\n features['aptos:signTransaction']?.signTransaction;\n\n assertDefined(\n signTransactionMethod,\n 'signTransaction method not found in wallet features'\n );\n\n const result = await signTransactionMethod(transaction, asFeePayer);\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signTransaction' });\n }\n\n return {\n signature: result.args,\n };\n };\n\n const signAndSubmitTransaction: AptosWalletProvider['signAndSubmitTransaction'] =\n async ({ transaction, walletAccount }) => {\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signAndSubmitMethod =\n features['aptos:signAndSubmitTransaction']?.signAndSubmitTransaction;\n\n assertDefined(\n signAndSubmitMethod,\n 'signAndSubmitTransaction method not found in wallet features'\n );\n\n const result = await signAndSubmitMethod({\n payload: transaction,\n });\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signAndSubmitTransaction' });\n }\n\n return {\n hash: result.args.hash,\n };\n };\n\n const signMessage: AptosWalletProvider['signMessage'] = async ({\n message,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account not found');\n\n await assertWalletAccountSigningAvailability(\n { walletAccount },\n dynamicClient\n );\n\n const signMessageMethod = features['aptos:signMessage']?.signMessage;\n\n assertDefined(\n signMessageMethod,\n 'signMessage method not found in wallet features'\n );\n\n const nonce = Date.now().toString();\n const result = await signMessageMethod({\n message,\n nonce,\n });\n\n if (result.status !== UserResponseStatus.APPROVED) {\n throw new UserRejectedError({ action: 'signMessage' });\n }\n\n let publicKey: string | undefined =\n walletStandardWallet.accounts[0]?.publicKey?.toString();\n\n if (!publicKey) {\n const account = await getConnectedAccount();\n publicKey = account?.publicKey?.toString();\n }\n\n const signatureObj = {\n fullMessage: result.args.fullMessage,\n publicKey,\n signature: result.args.signature.toString(),\n };\n\n return { signature: JSON.stringify(signatureObj) };\n };\n\n const { cleanupEventEmitter, getEventEmitter } =\n createWalletProviderEventEmitter<VoidFunction>({\n removeEventListeners: ({ setupReturnValue }) => {\n assertDefined(setupReturnValue, 'Setup return value not defined');\n\n setupReturnValue();\n },\n\n setupEventListeners: ({\n handleAccountsChanged,\n handleNetworkChanged,\n }): VoidFunction => {\n const onAccountChange =\n features['aptos:onAccountChange']?.onAccountChange;\n\n if (onAccountChange) {\n void onAccountChange((account) => {\n handleAccountsChanged({\n addresses: account ? [account.address.toString()] : [],\n });\n });\n }\n\n const onNetworkChange =\n features['aptos:onNetworkChange']?.onNetworkChange;\n\n if (onNetworkChange) {\n void onNetworkChange((network) => {\n handleNetworkChanged({ networkId: network.chainId.toString() });\n });\n }\n\n return () => {};\n },\n\n supportedEvents: ['accountsChanged', 'networkChanged'],\n });\n\n const terminate: AptosWalletProvider['terminate'] = async () => {\n cleanupEventEmitter();\n };\n\n const walletProvider: AptosWalletProvider = {\n chain: 'APTOS',\n connect,\n disconnect,\n get events() {\n return getEventEmitter();\n },\n getActiveNetworkId,\n getAptosClient,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(walletStandardWallet.name),\n key,\n metadata: {\n displayName: walletStandardWallet.name,\n icon: walletStandardWallet.icon,\n },\n signAndSubmitTransaction,\n signMessage,\n signTransaction,\n terminate,\n transferAmount: (args) => aptosTransferAmount(args, dynamicClient),\n walletProviderType,\n };\n\n return walletProvider;\n};\n","import type {\n AptosWallet,\n MinimallyRequiredFeatures,\n} from '@aptos-labs/wallet-standard';\n\nconst REQUIRED_FEATURES: (keyof MinimallyRequiredFeatures)[] = [\n 'aptos:account',\n 'aptos:connect',\n 'aptos:disconnect',\n 'aptos:network',\n 'aptos:onAccountChange',\n 'aptos:onNetworkChange',\n 'aptos:signMessage',\n 'aptos:signTransaction',\n];\n\nexport const hasAllRequiredFeatures = (wallet: AptosWallet): boolean => {\n return Boolean(\n REQUIRED_FEATURES.every((feature) => feature in wallet.features)\n );\n};\n","import type { AptosWallet } from '@aptos-labs/wallet-standard';\nimport type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n WalletProviderPriority,\n getWalletProviderRegistry,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { createWalletProviderFromAptosStandardWallet } from '../createWalletProviderFromAptosStandardWallet';\nimport { hasAllRequiredFeatures } from '../hasAllRequiredFeatures';\n\nexport const registerAptosStandardWallet = (\n wallet: AptosWallet,\n client: DynamicClient\n) => {\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n if (hasAllRequiredFeatures(wallet)) {\n const walletProvider = createWalletProviderFromAptosStandardWallet({\n dynamicClient: client,\n walletStandardWallet: wallet,\n });\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD,\n walletProvider,\n });\n }\n};\n","import type { AptosWallet } from '@aptos-labs/wallet-standard';\nimport { getAptosWallets } from '@aptos-labs/wallet-standard';\nimport {\n getDefaultClient,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerAptosNetworkProviderBuilder } from '../../registerAptosNetworkProviderBuilder';\nimport { registerAptosStandardWallet } from '../utils/registerAptosStandardWallet';\n\nexport const APTOS_WALLET_STANDARD_EXTENSION_KEY = 'aptosWalletStandard';\n\n/**\n * Adds the Aptos Wallet Standard extension to the Dynamic client.\n *\n * This extension enables integration with wallets that implement the Aptos Wallet Standard (AIP-62),\n * automatically detecting and registering compatible wallets for use with the Dynamic SDK.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A function that can be used to remove Aptos Wallet Standard register event listener that was added.\n */\nexport const addAptosWalletStandardExtension = (\n client = getDefaultClient()\n): VoidFunction => {\n if (\n hasExtension({ extensionKey: APTOS_WALLET_STANDARD_EXTENSION_KEY }, client)\n ) {\n return () => {\n // noop\n };\n }\n\n registerExtension(\n { extensionKey: APTOS_WALLET_STANDARD_EXTENSION_KEY },\n client\n );\n\n registerAptosNetworkProviderBuilder(client);\n\n const { aptosWallets, on } = getAptosWallets();\n\n // Listen for new wallet registrations/announcements\n const removeListener = on('register', (wallet) => {\n registerAptosStandardWallet(wallet as AptosWallet, client);\n });\n\n // Register all wallets that are already registered/announced in the browser\n for (const wallet of aptosWallets) {\n registerAptosStandardWallet(wallet, client);\n }\n\n return removeListener;\n};\n"],"mappings":";;;;;;;;;;;;ACCA,MAAa,gBAAgB;;;;ACU7B,MAAa,oBAAoB,OAAO,EACtC,SACA,kBACqD;CAQrD,MAAM,UAAU,MAFI,IAAI,MALT,IAAI,YAAY;EAC7B,UAAU,YAAY,QAAQ,KAAK;EACnC,SAAS,YAAY;EACtB,CAAC,CAEmC,CAEH,WAAW;EAC3C,gBAAgB;EAEhB,OAAO;EACR,CAAC;AAEF,SAAQ,OAAO,QAAQ,GAAG,eAAe,UAAU;;;;;ACtBrD,MAAa,8BACX,iBAC0B;CAC1B,GAAG,0BAA0B,SAAS,YAAY;CAClD,SAAS,YAAY;CACrB,YAAY,OAAO,EAAE,eAAe,EAClC,SAAS,MAAM,kBAAkB;EAC/B;EACA;EACD,CAAC,EACH;CACF;;;;ACZD,MAAa,uCACX,WACS;CACT,MAAM,iCACJ,kCAAkC,OAAO;AAG3C,KAAI,+BAA+B,KAAK,CAAC,IAAI,QAAQ,CACnD;AAGF,gCAA+B,SAAS;EACtC,SAAS;EACT,OAAO;EACR,CAAC;;;;;ACjBJ,IAAa,wBAAb,cAA2C,UAAU;CACnD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;ACV9B,MAAa,wBACX,kBACwC,cAAc,UAAU;;;;ACFlE,MAAa,yBACX,aACoC;AACpC,QAAO,SAAS,UAAU;;;;;ACM5B,MAAM,eAAe;;;;;;;;AASrB,MAAa,sBAAsB,O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AAc,qCAAqC,EAAE,OAAO,CAE3E,cAAa;AAKf,mBACE,EAAE,cAAc,qCAAqC,EACrD,OACD;AAED,qCAAoC,OAAO;CAE3C,MAAM,EAAE,cAAc,OAAO,iBAAiB;CAG9C,MAAM,iBAAiB,GAAG,aAAa,WAAW;AAChD,8BAA4B,QAAuB,OAAO;GAC1D;AAGF,MAAK,MAAM,UAAU,aACnB,6BAA4B,QAAQ,OAAO;AAG7C,QAAO"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- const require_addAptosWalletStandardExtension = require('./addAptosWalletStandardExtension-nCf982HY.cjs.js');
1
+ const require_addAptosWalletStandardExtension = require('./addAptosWalletStandardExtension-DrKR-qte.cjs.js');
2
2
  let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
3
3
  let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
4
4
  let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
@@ -16,28 +16,6 @@ const addAptosExtension = (client = (0, _dynamic_labs_sdk_client_core.getDefault
16
16
  require_addAptosWalletStandardExtension.addAptosWalletStandardExtension(client);
17
17
  };
18
18
 
19
- //#endregion
20
- //#region src/errors/NotAptosProviderError/NotAptosProviderError.ts
21
- var NotAptosProviderError = class extends _dynamic_labs_sdk_client.BaseError {
22
- providerKey;
23
- constructor(params) {
24
- super({
25
- cause: null,
26
- code: "not_aptos_provider_error",
27
- docsUrl: null,
28
- name: "NotAptosProviderError",
29
- shortMessage: "Provider is not an Aptos wallet provider"
30
- });
31
- this.providerKey = params.providerKey;
32
- }
33
- };
34
-
35
- //#endregion
36
- //#region src/isAptosWalletProvider/isAptosWalletProvider.ts
37
- const isAptosWalletProvider = (provider) => {
38
- return provider.chain === "APTOS";
39
- };
40
-
41
19
  //#endregion
42
20
  //#region src/getAptosClient/getAptosClient.ts
43
21
  /**
@@ -51,7 +29,7 @@ const isAptosWalletProvider = (provider) => {
51
29
  */
52
30
  const getAptosClient = async ({ walletAccount }, client = (0, _dynamic_labs_sdk_client_core.getDefaultClient)()) => {
53
31
  const provider = (0, _dynamic_labs_sdk_client_core.getWalletProviderFromWalletAccount)({ walletAccount }, client);
54
- if (!isAptosWalletProvider(provider)) throw new NotAptosProviderError({ providerKey: provider.key });
32
+ if (!require_addAptosWalletStandardExtension.isAptosWalletProvider(provider)) throw new require_addAptosWalletStandardExtension.NotAptosProviderError({ providerKey: provider.key });
55
33
  return provider.getAptosClient({ walletAccount });
56
34
  };
57
35
 
@@ -59,10 +37,6 @@ const getAptosClient = async ({ walletAccount }, client = (0, _dynamic_labs_sdk_
59
37
  //#region src/isAptosNetworkProvider/isAptosNetworkProvider.ts
60
38
  const isAptosNetworkProvider = (networkProvider) => networkProvider.chain === "APTOS";
61
39
 
62
- //#endregion
63
- //#region src/isAptosWalletAccount/isAptosWalletAccount.ts
64
- const isAptosWalletAccount = (walletAccount) => walletAccount.chain === "APTOS";
65
-
66
40
  //#endregion
67
41
  //#region src/signAndSubmitTransaction/signAndSubmitTransaction.ts
68
42
  /**
@@ -76,7 +50,7 @@ const isAptosWalletAccount = (walletAccount) => walletAccount.chain === "APTOS";
76
50
  */
77
51
  const signAndSubmitTransaction = async ({ transaction, walletAccount }, client = (0, _dynamic_labs_sdk_client.getDefaultClient)()) => {
78
52
  const provider = (0, _dynamic_labs_sdk_client_core.getWalletProviderFromWalletAccount)({ walletAccount }, client);
79
- if (!isAptosWalletProvider(provider)) throw new NotAptosProviderError({ providerKey: provider.key });
53
+ if (!require_addAptosWalletStandardExtension.isAptosWalletProvider(provider)) throw new require_addAptosWalletStandardExtension.NotAptosProviderError({ providerKey: provider.key });
80
54
  return provider.signAndSubmitTransaction({
81
55
  transaction,
82
56
  walletAccount
@@ -96,7 +70,7 @@ const signAndSubmitTransaction = async ({ transaction, walletAccount }, client =
96
70
  */
97
71
  const signTransaction = async ({ asFeePayer, transaction, walletAccount }, client = (0, _dynamic_labs_sdk_client.getDefaultClient)()) => {
98
72
  const provider = (0, _dynamic_labs_sdk_client_core.getWalletProviderFromWalletAccount)({ walletAccount }, client);
99
- if (!isAptosWalletProvider(provider)) throw new NotAptosProviderError({ providerKey: provider.key });
73
+ if (!require_addAptosWalletStandardExtension.isAptosWalletProvider(provider)) throw new require_addAptosWalletStandardExtension.NotAptosProviderError({ providerKey: provider.key });
100
74
  return provider.signTransaction({
101
75
  asFeePayer,
102
76
  transaction,
@@ -109,12 +83,12 @@ const signTransaction = async ({ asFeePayer, transaction, walletAccount }, clien
109
83
  (0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_addAptosWalletStandardExtension.name, require_addAptosWalletStandardExtension.version);
110
84
 
111
85
  //#endregion
112
- exports.NotAptosProviderError = NotAptosProviderError;
86
+ exports.NotAptosProviderError = require_addAptosWalletStandardExtension.NotAptosProviderError;
113
87
  exports.addAptosExtension = addAptosExtension;
114
88
  exports.getAptosClient = getAptosClient;
115
89
  exports.isAptosNetworkProvider = isAptosNetworkProvider;
116
- exports.isAptosWalletAccount = isAptosWalletAccount;
117
- exports.isAptosWalletProvider = isAptosWalletProvider;
90
+ exports.isAptosWalletAccount = require_addAptosWalletStandardExtension.isAptosWalletAccount;
91
+ exports.isAptosWalletProvider = require_addAptosWalletStandardExtension.isAptosWalletProvider;
118
92
  exports.signAndSubmitTransaction = signAndSubmitTransaction;
119
93
  exports.signTransaction = signTransaction;
120
94
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","names":["BaseError","packageName","packageVersion"],"sources":["../src/addAptosExtension/addAptosExtension.ts","../src/errors/NotAptosProviderError/NotAptosProviderError.ts","../src/isAptosWalletProvider/isAptosWalletProvider.ts","../src/getAptosClient/getAptosClient.ts","../src/isAptosNetworkProvider/isAptosNetworkProvider.ts","../src/isAptosWalletAccount/isAptosWalletAccount.ts","../src/signAndSubmitTransaction/signAndSubmitTransaction.ts","../src/signTransaction/signTransaction.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addAptosWalletStandardExtension } from '../walletStandard/addAptosWalletStandardExtension';\n\n/**\n * Adds the Aptos extension to the Dynamic client.\n *\n * This is a convenience function that adds support for all of Aptos wallets that support the Aptos Wallet Standard,\n * like Petra, Backpack, OKX, Nightly, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addAptosExtension = (client = getDefaultClient()): void => {\n addAptosWalletStandardExtension(client);\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotAptosProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aptos_provider_error',\n docsUrl: null,\n name: 'NotAptosProviderError',\n shortMessage: 'Provider is not an Aptos wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletProvider } from '../AptosWalletProvider.types';\n\nexport const isAptosWalletProvider = (\n provider: WalletProvider | AptosWalletProvider\n): provider is AptosWalletProvider => {\n return provider.chain === 'APTOS';\n};\n","import {\n getDefaultClient,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosClient } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype GetAptosClientParams = {\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Retrieves an Aptos client from a wallet account.\n *\n * @param params.walletAccount - The wallet account to get the Aptos client for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A promise that resolves to an AptosClient instance\n * @throws NotAptosProviderError If the wallet account's provider is not an APTOS provider\n */\nexport const getAptosClient = async (\n { walletAccount }: GetAptosClientParams,\n client = getDefaultClient()\n): Promise<AptosClient> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.getAptosClient({ walletAccount });\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\n\nexport const isAptosNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AptosNetworkProvider => networkProvider.chain === 'APTOS';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\n\nexport const isAptosWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AptosWalletAccount => walletAccount.chain === 'APTOS';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosTransactionPayload } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignAndSubmitTransactionParams = {\n transaction: AptosTransactionPayload;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs and submits an Aptos transaction\n *\n * @param params.transaction - The transaction payload to sign and submit\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the transaction hash\n */\nexport const signAndSubmitTransaction = async (\n { transaction, walletAccount }: SignAndSubmitTransactionParams,\n client = getDefaultClient()\n): Promise<{ hash: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signAndSubmitTransaction({ transaction, walletAccount });\n};\n","import type { AnyRawTransaction } from '@aptos-labs/ts-sdk';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosSignTransactionOutput } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignTransactionParams = {\n asFeePayer?: boolean;\n transaction: AnyRawTransaction;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs an Aptos transaction\n * @param params.transaction - The transaction to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param params.asFeePayer - Whether to sign as the fee payer\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the signature output\n */\nexport const signTransaction = async (\n { asFeePayer, transaction, walletAccount }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<{ signature: AptosSignTransactionOutput }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ asFeePayer, transaction, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addAptosExtension } from '../addAptosExtension';\nexport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\nexport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nexport type {\n AptosClient,\n AptosSignTransactionOutput,\n AptosTransaction,\n AptosTransactionPayload,\n} from '../AptosWalletProvider.types';\nexport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nexport { getAptosClient } from '../getAptosClient';\nexport { isAptosNetworkProvider } from '../isAptosNetworkProvider';\nexport { isAptosWalletAccount } from '../isAptosWalletAccount';\nexport { isAptosWalletProvider } from '../isAptosWalletProvider';\nexport { signAndSubmitTransaction } from '../signAndSub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"}
1
+ {"version":3,"file":"index.cjs.js","names":["isAptosWalletProvider","NotAptosProviderError","isAptosWalletProvider","NotAptosProviderError","isAptosWalletProvider","NotAptosProviderError","packageName","packageVersion"],"sources":["../src/addAptosExtension/addAptosExtension.ts","../src/getAptosClient/getAptosClient.ts","../src/isAptosNetworkProvider/isAptosNetworkProvider.ts","../src/signAndSubmitTransaction/signAndSubmitTransaction.ts","../src/signTransaction/signTransaction.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addAptosWalletStandardExtension } from '../walletStandard/addAptosWalletStandardExtension';\n\n/**\n * Adds the Aptos extension to the Dynamic client.\n *\n * This is a convenience function that adds support for all of Aptos wallets that support the Aptos Wallet Standard,\n * like Petra, Backpack, OKX, Nightly, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addAptosExtension = (client = getDefaultClient()): void => {\n addAptosWalletStandardExtension(client);\n};\n","import {\n getDefaultClient,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosClient } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype GetAptosClientParams = {\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Retrieves an Aptos client from a wallet account.\n *\n * @param params.walletAccount - The wallet account to get the Aptos client for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A promise that resolves to an AptosClient instance\n * @throws NotAptosProviderError If the wallet account's provider is not an APTOS provider\n */\nexport const getAptosClient = async (\n { walletAccount }: GetAptosClientParams,\n client = getDefaultClient()\n): Promise<AptosClient> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.getAptosClient({ walletAccount });\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\n\nexport const isAptosNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AptosNetworkProvider => networkProvider.chain === 'APTOS';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosTransactionPayload } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignAndSubmitTransactionParams = {\n transaction: AptosTransactionPayload;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs and submits an Aptos transaction\n *\n * @param params.transaction - The transaction payload to sign and submit\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the transaction hash\n */\nexport const signAndSubmitTransaction = async (\n { transaction, walletAccount }: SignAndSubmitTransactionParams,\n client = getDefaultClient()\n): Promise<{ hash: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signAndSubmitTransaction({ transaction, walletAccount });\n};\n","import type { AnyRawTransaction } from '@aptos-labs/ts-sdk';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosSignTransactionOutput } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignTransactionParams = {\n asFeePayer?: boolean;\n transaction: AnyRawTransaction;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs an Aptos transaction\n * @param params.transaction - The transaction to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param params.asFeePayer - Whether to sign as the fee payer\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the signature output\n */\nexport const signTransaction = async (\n { asFeePayer, transaction, walletAccount }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<{ signature: AptosSignTransactionOutput }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ asFeePayer, transaction, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addAptosExtension } from '../addAptosExtension';\nexport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\nexport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nexport type {\n AptosClient,\n AptosSignTransactionOutput,\n AptosTransaction,\n AptosTransactionPayload,\n} from '../AptosWalletProvider.types';\nexport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nexport { getAptosClient } from '../getAptosClient';\nexport { isAptosNetworkProvider } from '../isAptosNetworkProvider';\nexport { isAptosWalletAccount } from '../isAptosWalletAccount';\nexport { isAptosWalletProvider } from '../isAptosWalletProvider';\nexport { signAndSubmitTransaction } from '../signAndSubmitTransaction';\nexport { signTransaction } from '../signTransaction';\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,qBAAqB,8DAA2B,KAAW;AACtE,yEAAgC,OAAO;;;;;;;;;;;;;;ACUzC,MAAa,iBAAiB,OAC5B,EAAE,iBACF,8DAA2B,KACF;CACzB,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAACA,8DAAsB,SAAS,CAClC,OAAM,IAAIC,8DAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,eAAe,EAAE,eAAe,CAAC;;;;;AClCnD,MAAa,0BACX,oBAC4C,gBAAgB,UAAU;;;;;;;;;;;;;ACgBxE,MAAa,2BAA2B,OACtC,EAAE,aAAa,iBACf,yDAA2B,KACG;CAC9B,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAACC,8DAAsB,SAAS,CAClC,OAAM,IAAIC,8DAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,yBAAyB;EAAE;EAAa;EAAe,CAAC;;;;;;;;;;;;;;ACb1E,MAAa,kBAAkB,OAC7B,EAAE,YAAY,aAAa,iBAC3B,yDAA2B,KAC4B;CACvD,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAACC,8DAAsB,SAAS,CAClC,OAAM,IAAIC,8DAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,gBAAgB;EAAE;EAAY;EAAa;EAAe,CAAC;;;;;mECjCxDC,8CAAaC,gDAAe"}
package/dist/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import { n as name, r as version, t as addAptosWalletStandardExtension } from "./addAptosWalletStandardExtension-D8FQX2lh.esm.js";
1
+ import { a as name, i as NotAptosProviderError, n as isAptosWalletProvider, o as version, r as isAptosWalletAccount, t as addAptosWalletStandardExtension } from "./addAptosWalletStandardExtension-q6Gc5nMC.esm.js";
2
2
  import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
3
3
  import { getDefaultClient, getWalletProviderFromWalletAccount } from "@dynamic-labs-sdk/client/core";
4
- import { BaseError, getDefaultClient as getDefaultClient$1 } from "@dynamic-labs-sdk/client";
4
+ import { getDefaultClient as getDefaultClient$1 } from "@dynamic-labs-sdk/client";
5
5
 
6
6
  //#region src/addAptosExtension/addAptosExtension.ts
7
7
  /**
@@ -16,28 +16,6 @@ const addAptosExtension = (client = getDefaultClient()) => {
16
16
  addAptosWalletStandardExtension(client);
17
17
  };
18
18
 
19
- //#endregion
20
- //#region src/errors/NotAptosProviderError/NotAptosProviderError.ts
21
- var NotAptosProviderError = class extends BaseError {
22
- providerKey;
23
- constructor(params) {
24
- super({
25
- cause: null,
26
- code: "not_aptos_provider_error",
27
- docsUrl: null,
28
- name: "NotAptosProviderError",
29
- shortMessage: "Provider is not an Aptos wallet provider"
30
- });
31
- this.providerKey = params.providerKey;
32
- }
33
- };
34
-
35
- //#endregion
36
- //#region src/isAptosWalletProvider/isAptosWalletProvider.ts
37
- const isAptosWalletProvider = (provider) => {
38
- return provider.chain === "APTOS";
39
- };
40
-
41
19
  //#endregion
42
20
  //#region src/getAptosClient/getAptosClient.ts
43
21
  /**
@@ -59,10 +37,6 @@ const getAptosClient = async ({ walletAccount }, client = getDefaultClient()) =>
59
37
  //#region src/isAptosNetworkProvider/isAptosNetworkProvider.ts
60
38
  const isAptosNetworkProvider = (networkProvider) => networkProvider.chain === "APTOS";
61
39
 
62
- //#endregion
63
- //#region src/isAptosWalletAccount/isAptosWalletAccount.ts
64
- const isAptosWalletAccount = (walletAccount) => walletAccount.chain === "APTOS";
65
-
66
40
  //#endregion
67
41
  //#region src/signAndSubmitTransaction/signAndSubmitTransaction.ts
68
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","names":["getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/addAptosExtension/addAptosExtension.ts","../src/errors/NotAptosProviderError/NotAptosProviderError.ts","../src/isAptosWalletProvider/isAptosWalletProvider.ts","../src/getAptosClient/getAptosClient.ts","../src/isAptosNetworkProvider/isAptosNetworkProvider.ts","../src/isAptosWalletAccount/isAptosWalletAccount.ts","../src/signAndSubmitTransaction/signAndSubmitTransaction.ts","../src/signTransaction/signTransaction.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addAptosWalletStandardExtension } from '../walletStandard/addAptosWalletStandardExtension';\n\n/**\n * Adds the Aptos extension to the Dynamic client.\n *\n * This is a convenience function that adds support for all of Aptos wallets that support the Aptos Wallet Standard,\n * like Petra, Backpack, OKX, Nightly, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addAptosExtension = (client = getDefaultClient()): void => {\n addAptosWalletStandardExtension(client);\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotAptosProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_aptos_provider_error',\n docsUrl: null,\n name: 'NotAptosProviderError',\n shortMessage: 'Provider is not an Aptos wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletProvider } from '../AptosWalletProvider.types';\n\nexport const isAptosWalletProvider = (\n provider: WalletProvider | AptosWalletProvider\n): provider is AptosWalletProvider => {\n return provider.chain === 'APTOS';\n};\n","import {\n getDefaultClient,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosClient } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype GetAptosClientParams = {\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Retrieves an Aptos client from a wallet account.\n *\n * @param params.walletAccount - The wallet account to get the Aptos client for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A promise that resolves to an AptosClient instance\n * @throws NotAptosProviderError If the wallet account's provider is not an APTOS provider\n */\nexport const getAptosClient = async (\n { walletAccount }: GetAptosClientParams,\n client = getDefaultClient()\n): Promise<AptosClient> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.getAptosClient({ walletAccount });\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\n\nexport const isAptosNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AptosNetworkProvider => networkProvider.chain === 'APTOS';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\n\nexport const isAptosWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is AptosWalletAccount => walletAccount.chain === 'APTOS';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosTransactionPayload } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignAndSubmitTransactionParams = {\n transaction: AptosTransactionPayload;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs and submits an Aptos transaction\n *\n * @param params.transaction - The transaction payload to sign and submit\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the transaction hash\n */\nexport const signAndSubmitTransaction = async (\n { transaction, walletAccount }: SignAndSubmitTransactionParams,\n client = getDefaultClient()\n): Promise<{ hash: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signAndSubmitTransaction({ transaction, walletAccount });\n};\n","import type { AnyRawTransaction } from '@aptos-labs/ts-sdk';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosSignTransactionOutput } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignTransactionParams = {\n asFeePayer?: boolean;\n transaction: AnyRawTransaction;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs an Aptos transaction\n * @param params.transaction - The transaction to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param params.asFeePayer - Whether to sign as the fee payer\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the signature output\n */\nexport const signTransaction = async (\n { asFeePayer, transaction, walletAccount }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<{ signature: AptosSignTransactionOutput }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ asFeePayer, transaction, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addAptosExtension } from '../addAptosExtension';\nexport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\nexport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nexport type {\n AptosClient,\n AptosSignTransactionOutput,\n AptosTransaction,\n AptosTransactionPayload,\n} from '../AptosWalletProvider.types';\nexport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nexport { getAptosClient } from '../getAptosClient';\nexport { isAptosNetworkProvider } from '../isAptosNetworkProvider';\nexport { isAptosWalletAccount } from '../isAptosWalletAccount';\nexport { isAptosWalletProvider } from '../isAptosWalletProvider';\nexport { signAndSubmitTransaction } from '../signAndSubmitTransaction';\nexport { signTransaction } from '../signTransaction';\n"],"mappings":";;;;;;;;;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":3,"file":"index.esm.js","names":["getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/addAptosExtension/addAptosExtension.ts","../src/getAptosClient/getAptosClient.ts","../src/isAptosNetworkProvider/isAptosNetworkProvider.ts","../src/signAndSubmitTransaction/signAndSubmitTransaction.ts","../src/signTransaction/signTransaction.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addAptosWalletStandardExtension } from '../walletStandard/addAptosWalletStandardExtension';\n\n/**\n * Adds the Aptos extension to the Dynamic client.\n *\n * This is a convenience function that adds support for all of Aptos wallets that support the Aptos Wallet Standard,\n * like Petra, Backpack, OKX, Nightly, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addAptosExtension = (client = getDefaultClient()): void => {\n addAptosWalletStandardExtension(client);\n};\n","import {\n getDefaultClient,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosClient } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype GetAptosClientParams = {\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Retrieves an Aptos client from a wallet account.\n *\n * @param params.walletAccount - The wallet account to get the Aptos client for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns A promise that resolves to an AptosClient instance\n * @throws NotAptosProviderError If the wallet account's provider is not an APTOS provider\n */\nexport const getAptosClient = async (\n { walletAccount }: GetAptosClientParams,\n client = getDefaultClient()\n): Promise<AptosClient> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.getAptosClient({ walletAccount });\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\n\nexport const isAptosNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is AptosNetworkProvider => networkProvider.chain === 'APTOS';\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosTransactionPayload } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignAndSubmitTransactionParams = {\n transaction: AptosTransactionPayload;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs and submits an Aptos transaction\n *\n * @param params.transaction - The transaction payload to sign and submit\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the transaction hash\n */\nexport const signAndSubmitTransaction = async (\n { transaction, walletAccount }: SignAndSubmitTransactionParams,\n client = getDefaultClient()\n): Promise<{ hash: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signAndSubmitTransaction({ transaction, walletAccount });\n};\n","import type { AnyRawTransaction } from '@aptos-labs/ts-sdk';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nimport type { AptosSignTransactionOutput } from '../AptosWalletProvider.types';\nimport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nimport { isAptosWalletProvider } from '../isAptosWalletProvider';\n\ntype SignTransactionParams = {\n asFeePayer?: boolean;\n transaction: AnyRawTransaction;\n walletAccount: AptosWalletAccount;\n};\n\n/**\n * Signs an Aptos transaction\n * @param params.transaction - The transaction to sign\n * @param params.walletAccount - The wallet account to sign the transaction with\n * @param params.asFeePayer - Whether to sign as the fee payer\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n *\n * @returns An object containing the signature output\n */\nexport const signTransaction = async (\n { asFeePayer, transaction, walletAccount }: SignTransactionParams,\n client = getDefaultClient()\n): Promise<{ signature: AptosSignTransactionOutput }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isAptosWalletProvider(provider)) {\n throw new NotAptosProviderError({ providerKey: provider.key });\n }\n\n return provider.signTransaction({ asFeePayer, transaction, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addAptosExtension } from '../addAptosExtension';\nexport type { AptosNetworkProvider } from '../AptosNetworkProvider.types';\nexport type { AptosWalletAccount } from '../AptosWalletAccount.types';\nexport type {\n AptosClient,\n AptosSignTransactionOutput,\n AptosTransaction,\n AptosTransactionPayload,\n} from '../AptosWalletProvider.types';\nexport { NotAptosProviderError } from '../errors/NotAptosProviderError';\nexport { getAptosClient } from '../getAptosClient';\nexport { isAptosNetworkProvider } from '../isAptosNetworkProvider';\nexport { isAptosWalletAccount } from '../isAptosWalletAccount';\nexport { isAptosWalletProvider } from '../isAptosWalletProvider';\nexport { signAndSubmitTransaction } from '../signAndSubmitTransaction';\nexport { signTransaction } from '../signTransaction';\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,qBAAqB,SAAS,kBAAkB,KAAW;AACtE,iCAAgC,OAAO;;;;;;;;;;;;;;ACUzC,MAAa,iBAAiB,OAC5B,EAAE,iBACF,SAAS,kBAAkB,KACF;CACzB,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,sBAAsB,SAAS,CAClC,OAAM,IAAI,sBAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,eAAe,EAAE,eAAe,CAAC;;;;;AClCnD,MAAa,0BACX,oBAC4C,gBAAgB,UAAU;;;;;;;;;;;;;ACgBxE,MAAa,2BAA2B,OACtC,EAAE,aAAa,iBACf,SAASA,oBAAkB,KACG;CAC9B,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,sBAAsB,SAAS,CAClC,OAAM,IAAI,sBAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,yBAAyB;EAAE;EAAa;EAAe,CAAC;;;;;;;;;;;;;;ACb1E,MAAa,kBAAkB,OAC7B,EAAE,YAAY,aAAa,iBAC3B,SAASC,oBAAkB,KAC4B;CACvD,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,sBAAsB,SAAS,CAClC,OAAM,IAAI,sBAAsB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGhE,QAAO,SAAS,gBAAgB;EAAE;EAAY;EAAa;EAAe,CAAC;;;;;ACjC7E,qBAAqBC,MAAaC,QAAe"}