@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.
- package/CHANGELOG.md +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -6
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.cjs +46 -5
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.d.ts +13 -2
- package/src/connectors/AptosWalletConnector/AptosWalletConnector.js +46 -5
- package/src/index.cjs +4 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/injected/InjectedWalletBase.cjs +3 -3
- package/src/injected/InjectedWalletBase.js +3 -3
- package/src/injected/fetchInjectedWalletConnectors.cjs +52 -34
- package/src/injected/fetchInjectedWalletConnectors.d.ts +8 -5
- package/src/injected/fetchInjectedWalletConnectors.js +52 -34
- package/src/types.d.ts +3 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.cjs +189 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.d.ts +110 -0
- package/src/utils/AptosUiTransaction/AptosUiTransaction.js +185 -0
- package/src/utils/AptosUiTransaction/index.d.ts +1 -0
- package/src/utils/constants/constants.cjs +8 -0
- package/src/utils/constants/constants.d.ts +1 -0
- package/src/utils/constants/constants.js +4 -0
- package/src/utils/constants/index.d.ts +1 -0
- package/src/wallet/AptosWallet.cjs +5 -8
- package/src/wallet/AptosWallet.d.ts +2 -2
- package/src/wallet/AptosWallet.js +5 -8
- package/src/wallet/isAptosWallet/index.d.ts +1 -0
- package/src/wallet/isAptosWallet/isAptosWallet.cjs +8 -0
- package/src/wallet/isAptosWallet/isAptosWallet.d.ts +3 -0
- package/src/wallet/isAptosWallet/isAptosWallet.js +4 -0
- package/src/walletStandard/createAptosSignerFromWalletStandard.cjs +1 -1
- 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:
|
|
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(
|
|
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';
|
|
@@ -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
|
});
|