@dynamic-labs/aptos 4.43.0 → 4.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +7 -6
  5. package/src/connectors/AptosWalletConnector/AptosWalletConnector.cjs +46 -5
  6. package/src/connectors/AptosWalletConnector/AptosWalletConnector.d.ts +13 -2
  7. package/src/connectors/AptosWalletConnector/AptosWalletConnector.js +46 -5
  8. package/src/index.cjs +4 -0
  9. package/src/index.d.ts +2 -0
  10. package/src/index.js +2 -0
  11. package/src/injected/InjectedWalletBase.cjs +3 -3
  12. package/src/injected/InjectedWalletBase.js +3 -3
  13. package/src/injected/fetchInjectedWalletConnectors.cjs +52 -34
  14. package/src/injected/fetchInjectedWalletConnectors.d.ts +8 -5
  15. package/src/injected/fetchInjectedWalletConnectors.js +52 -34
  16. package/src/types.d.ts +3 -0
  17. package/src/utils/AptosUiTransaction/AptosUiTransaction.cjs +189 -0
  18. package/src/utils/AptosUiTransaction/AptosUiTransaction.d.ts +110 -0
  19. package/src/utils/AptosUiTransaction/AptosUiTransaction.js +185 -0
  20. package/src/utils/AptosUiTransaction/index.d.ts +1 -0
  21. package/src/utils/constants/constants.cjs +8 -0
  22. package/src/utils/constants/constants.d.ts +1 -0
  23. package/src/utils/constants/constants.js +4 -0
  24. package/src/utils/constants/index.d.ts +1 -0
  25. package/src/wallet/AptosWallet.cjs +5 -8
  26. package/src/wallet/AptosWallet.d.ts +2 -2
  27. package/src/wallet/AptosWallet.js +5 -8
  28. package/src/wallet/isAptosWallet/index.d.ts +1 -0
  29. package/src/wallet/isAptosWallet/isAptosWallet.cjs +8 -0
  30. package/src/wallet/isAptosWallet/isAptosWallet.d.ts +3 -0
  31. package/src/wallet/isAptosWallet/isAptosWallet.js +4 -0
  32. package/src/walletStandard/createAptosSignerFromWalletStandard.cjs +1 -1
  33. package/src/walletStandard/createAptosSignerFromWalletStandard.js +1 -1
@@ -1,4 +1,4 @@
1
- import type { AccountAuthenticator, AnyRawTransaction } from '@aptos-labs/ts-sdk';
1
+ import type { AccountAuthenticator, AnyRawTransaction, InputGenerateTransactionPayloadData } from '@aptos-labs/ts-sdk';
2
2
  import { Aptos } from '@aptos-labs/ts-sdk';
3
3
  import type { AccountInfo, AptosSignMessageInput, AptosSignMessageOutput, NetworkInfo, UserResponse } from '@aptos-labs/wallet-standard';
4
4
  import { Wallet } from '@dynamic-labs/wallet-connector-core';
@@ -70,7 +70,7 @@ export declare class AptosWallet extends Wallet<AptosWalletConnector> {
70
70
  * @param transaction - The transaction to sign and submit
71
71
  * @returns The transaction hash
72
72
  */
73
- signAndSubmitTransaction(transaction: AnyRawTransaction): Promise<string>;
73
+ signAndSubmitTransaction(transaction: InputGenerateTransactionPayloadData): Promise<string>;
74
74
  /**
75
75
  * Submits a pre-signed transaction to the network.
76
76
  *
@@ -53,15 +53,12 @@ class AptosWallet extends Wallet {
53
53
  // Calculate amount with proper decimals (APT has 8 decimals by default)
54
54
  const decimals = (token === null || token === void 0 ? void 0 : token.decimals) || 8;
55
55
  const transferAmount = parseFloat(amount) * Math.pow(10, decimals);
56
- // Create the transfer transaction
57
- const transaction = yield aptosClient.transferCoinTransaction({
58
- amount: transferAmount,
59
- coinType: token === null || token === void 0 ? void 0 : token.address,
60
- recipient: toAddress,
61
- sender: accountInfo.address, // If undefined, defaults to APT (0x1::aptos_coin::AptosCoin)
62
- });
63
56
  // Sign and submit the transaction using the wallet provider
64
- const txHash = yield this.signAndSubmitTransaction(transaction);
57
+ const txHash = yield this.signAndSubmitTransaction({
58
+ function: '0x1::coin::transfer',
59
+ functionArguments: [toAddress, transferAmount],
60
+ typeArguments: ['0x1::aptos_coin::AptosCoin'],
61
+ });
65
62
  return txHash;
66
63
  }
67
64
  catch (error) {
@@ -0,0 +1 @@
1
+ export * from './isAptosWallet';
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isAptosWallet = (wallet) => wallet.chain === 'APTOS';
7
+
8
+ exports.isAptosWallet = isAptosWallet;
@@ -0,0 +1,3 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { AptosWallet } from '../AptosWallet';
3
+ export declare const isAptosWallet: (wallet: Wallet) => wallet is AptosWallet;
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const isAptosWallet = (wallet) => wallet.chain === 'APTOS';
3
+
4
+ export { isAptosWallet };
@@ -135,7 +135,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, }) => {
135
135
  throw new Error('Sign and submit transaction not implemented by wallet');
136
136
  }
137
137
  const result = yield signAndSubmitMethod.signAndSubmitTransaction({
138
- transaction,
138
+ payload: transaction,
139
139
  });
140
140
  return result;
141
141
  });
@@ -131,7 +131,7 @@ const createAptosSignerFromWalletStandard = ({ wallet, }) => {
131
131
  throw new Error('Sign and submit transaction not implemented by wallet');
132
132
  }
133
133
  const result = yield signAndSubmitMethod.signAndSubmitTransaction({
134
- transaction,
134
+ payload: transaction,
135
135
  });
136
136
  return result;
137
137
  });