@dynamic-labs/aptos 4.46.3 → 4.47.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 -7
- package/src/utils/AptosUiTransaction/AptosUiTransaction.cjs +6 -5
- package/src/utils/AptosUiTransaction/AptosUiTransaction.js +6 -5
- package/src/utils/getTransactionPayload/getTransactionPayload.cjs +30 -0
- package/src/utils/getTransactionPayload/getTransactionPayload.d.ts +12 -0
- package/src/utils/getTransactionPayload/getTransactionPayload.js +26 -0
- package/src/utils/getTransactionPayload/index.d.ts +1 -0
- package/src/wallet/AptosWallet.cjs +6 -5
- package/src/wallet/AptosWallet.js +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.47.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.47.0...v4.47.1) (2025-11-24)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add aptos non-native coins to sendBalance ([#9914](https://github.com/dynamic-labs/dynamic-auth/issues/9914)) ([0f0f855](https://github.com/dynamic-labs/dynamic-auth/commit/0f0f855229a052eb280831c81d235b0164f26ff3))
|
|
8
|
+
* add aptos non-native token sending to dynamic widget ([#9915](https://github.com/dynamic-labs/dynamic-auth/issues/9915)) ([c91c117](https://github.com/dynamic-labs/dynamic-auth/commit/c91c1172d5185c151f9b4cac1a0757f6d72304ca))
|
|
9
|
+
* **react-native:** add waas wallet upgrade to react-native ([#9936](https://github.com/dynamic-labs/dynamic-auth/issues/9936)) ([024366e](https://github.com/dynamic-labs/dynamic-auth/commit/024366e179b284353d0b05667e916a01520b2874))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* remove noise from wallet connect when it is disabled ([#9945](https://github.com/dynamic-labs/dynamic-auth/issues/9945)) ([ada6511](https://github.com/dynamic-labs/dynamic-auth/commit/ada6511e2d25351f1b63312eb4810752f6d95ad6))
|
|
15
|
+
|
|
16
|
+
## [4.47.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.3...v4.47.0) (2025-11-21)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add Google Drive backup functionality to widget ([#9899](https://github.com/dynamic-labs/dynamic-auth/issues/9899)) ([c787c5b](https://github.com/dynamic-labs/dynamic-auth/commit/c787c5baa7cf4ec4522418fdbe915923b1481312))
|
|
22
|
+
|
|
2
23
|
### [4.46.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.2...v4.46.3) (2025-11-20)
|
|
3
24
|
|
|
4
25
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/aptos",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.47.1",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@aptos-labs/ts-sdk": "5.1.1",
|
|
22
22
|
"@aptos-labs/wallet-standard": "0.5.2",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.47.1",
|
|
24
24
|
"@wallet-standard/core": "1.1.1",
|
|
25
25
|
"@wallet-standard/features": "1.0.3",
|
|
26
|
-
"@dynamic-labs/logger": "4.
|
|
27
|
-
"@dynamic-labs/types": "4.
|
|
28
|
-
"@dynamic-labs/utils": "4.
|
|
29
|
-
"@dynamic-labs/wallet-book": "4.
|
|
30
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
26
|
+
"@dynamic-labs/logger": "4.47.1",
|
|
27
|
+
"@dynamic-labs/types": "4.47.1",
|
|
28
|
+
"@dynamic-labs/utils": "4.47.1",
|
|
29
|
+
"@dynamic-labs/wallet-book": "4.47.1",
|
|
30
|
+
"@dynamic-labs/wallet-connector-core": "4.47.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {}
|
|
33
33
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
8
|
var constants = require('../constants/constants.cjs');
|
|
9
|
+
var getTransactionPayload = require('../getTransactionPayload/getTransactionPayload.cjs');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Aptos UI Transaction class for managing Aptos transactions in the UI.
|
|
@@ -152,11 +153,11 @@ class AptosUiTransaction {
|
|
|
152
153
|
// Create the transaction payload
|
|
153
154
|
if (nonNativeAddress && nonNativeValue) {
|
|
154
155
|
// Transfer non-native token
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
156
|
+
const transferAmount = Number(nonNativeValue);
|
|
157
|
+
return getTransactionPayload.getTransactionPayload(to, transferAmount, {
|
|
158
|
+
address: nonNativeAddress,
|
|
159
|
+
decimals: this.nonNativeDecimal,
|
|
160
|
+
});
|
|
160
161
|
}
|
|
161
162
|
if (value) {
|
|
162
163
|
// Transfer native APT
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { formatNumberText } from '@dynamic-labs/utils';
|
|
4
4
|
import { OCTAS_PER_APT } from '../constants/constants.js';
|
|
5
|
+
import { getTransactionPayload } from '../getTransactionPayload/getTransactionPayload.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Aptos UI Transaction class for managing Aptos transactions in the UI.
|
|
@@ -148,11 +149,11 @@ class AptosUiTransaction {
|
|
|
148
149
|
// Create the transaction payload
|
|
149
150
|
if (nonNativeAddress && nonNativeValue) {
|
|
150
151
|
// Transfer non-native token
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
};
|
|
152
|
+
const transferAmount = Number(nonNativeValue);
|
|
153
|
+
return getTransactionPayload(to, transferAmount, {
|
|
154
|
+
address: nonNativeAddress,
|
|
155
|
+
decimals: this.nonNativeDecimal,
|
|
156
|
+
});
|
|
156
157
|
}
|
|
157
158
|
if (value) {
|
|
158
159
|
// Transfer native APT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the appropriate transaction payload based on whether token.address exists.
|
|
8
|
+
* @param toAddress - Recipient address
|
|
9
|
+
* @param transferAmount - Amount to transfer (in smallest unit)
|
|
10
|
+
* @param token - Optional token information
|
|
11
|
+
* @returns The transaction payload data
|
|
12
|
+
*/
|
|
13
|
+
const getTransactionPayload = (toAddress, transferAmount, token) => {
|
|
14
|
+
if (token === null || token === void 0 ? void 0 : token.address) {
|
|
15
|
+
// Fungible token transfer
|
|
16
|
+
return {
|
|
17
|
+
function: '0x1::primary_fungible_store::transfer',
|
|
18
|
+
functionArguments: [token.address, toAddress, transferAmount],
|
|
19
|
+
typeArguments: ['0x1::fungible_asset::Metadata'],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// Regular coin transfer
|
|
23
|
+
return {
|
|
24
|
+
function: '0x1::coin::transfer',
|
|
25
|
+
functionArguments: [toAddress, transferAmount],
|
|
26
|
+
typeArguments: ['0x1::aptos_coin::AptosCoin'],
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.getTransactionPayload = getTransactionPayload;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InputGenerateTransactionPayloadData } from '@aptos-labs/ts-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the appropriate transaction payload based on whether token.address exists.
|
|
4
|
+
* @param toAddress - Recipient address
|
|
5
|
+
* @param transferAmount - Amount to transfer (in smallest unit)
|
|
6
|
+
* @param token - Optional token information
|
|
7
|
+
* @returns The transaction payload data
|
|
8
|
+
*/
|
|
9
|
+
export declare const getTransactionPayload: (toAddress: string, transferAmount: number, token?: {
|
|
10
|
+
address: string;
|
|
11
|
+
decimals?: number;
|
|
12
|
+
}) => InputGenerateTransactionPayloadData;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Returns the appropriate transaction payload based on whether token.address exists.
|
|
4
|
+
* @param toAddress - Recipient address
|
|
5
|
+
* @param transferAmount - Amount to transfer (in smallest unit)
|
|
6
|
+
* @param token - Optional token information
|
|
7
|
+
* @returns The transaction payload data
|
|
8
|
+
*/
|
|
9
|
+
const getTransactionPayload = (toAddress, transferAmount, token) => {
|
|
10
|
+
if (token === null || token === void 0 ? void 0 : token.address) {
|
|
11
|
+
// Fungible token transfer
|
|
12
|
+
return {
|
|
13
|
+
function: '0x1::primary_fungible_store::transfer',
|
|
14
|
+
functionArguments: [token.address, toAddress, transferAmount],
|
|
15
|
+
typeArguments: ['0x1::fungible_asset::Metadata'],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// Regular coin transfer
|
|
19
|
+
return {
|
|
20
|
+
function: '0x1::coin::transfer',
|
|
21
|
+
functionArguments: [toAddress, transferAmount],
|
|
22
|
+
typeArguments: ['0x1::aptos_coin::AptosCoin'],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { getTransactionPayload };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getTransactionPayload } from './getTransactionPayload';
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
+
var getTransactionPayload = require('../utils/getTransactionPayload/getTransactionPayload.cjs');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Aptos wallet implementation that provides chain-specific functionality
|
|
@@ -56,13 +57,13 @@ class AptosWallet extends walletConnectorCore.Wallet {
|
|
|
56
57
|
try {
|
|
57
58
|
// Calculate amount with proper decimals (APT has 8 decimals by default)
|
|
58
59
|
const decimals = (token === null || token === void 0 ? void 0 : token.decimals) || 8;
|
|
60
|
+
if ((token === null || token === void 0 ? void 0 : token.address) && token.decimals === undefined) {
|
|
61
|
+
throw new Error('Token decimals not provided');
|
|
62
|
+
}
|
|
59
63
|
const transferAmount = parseFloat(amount) * Math.pow(10, decimals);
|
|
64
|
+
const transactionPayload = getTransactionPayload.getTransactionPayload(toAddress, transferAmount, token);
|
|
60
65
|
// Sign and submit the transaction using the wallet provider
|
|
61
|
-
const txHash = yield this.signAndSubmitTransaction(
|
|
62
|
-
function: '0x1::coin::transfer',
|
|
63
|
-
functionArguments: [toAddress, transferAmount],
|
|
64
|
-
typeArguments: ['0x1::aptos_coin::AptosCoin'],
|
|
65
|
-
});
|
|
66
|
+
const txHash = yield this.signAndSubmitTransaction(transactionPayload);
|
|
66
67
|
return txHash;
|
|
67
68
|
}
|
|
68
69
|
catch (error) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { getTransactionPayload } from '../utils/getTransactionPayload/getTransactionPayload.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Aptos wallet implementation that provides chain-specific functionality
|
|
@@ -52,13 +53,13 @@ class AptosWallet extends Wallet {
|
|
|
52
53
|
try {
|
|
53
54
|
// Calculate amount with proper decimals (APT has 8 decimals by default)
|
|
54
55
|
const decimals = (token === null || token === void 0 ? void 0 : token.decimals) || 8;
|
|
56
|
+
if ((token === null || token === void 0 ? void 0 : token.address) && token.decimals === undefined) {
|
|
57
|
+
throw new Error('Token decimals not provided');
|
|
58
|
+
}
|
|
55
59
|
const transferAmount = parseFloat(amount) * Math.pow(10, decimals);
|
|
60
|
+
const transactionPayload = getTransactionPayload(toAddress, transferAmount, token);
|
|
56
61
|
// Sign and submit the transaction using the wallet provider
|
|
57
|
-
const txHash = yield this.signAndSubmitTransaction(
|
|
58
|
-
function: '0x1::coin::transfer',
|
|
59
|
-
functionArguments: [toAddress, transferAmount],
|
|
60
|
-
typeArguments: ['0x1::aptos_coin::AptosCoin'],
|
|
61
|
-
});
|
|
62
|
+
const txHash = yield this.signAndSubmitTransaction(transactionPayload);
|
|
62
63
|
return txHash;
|
|
63
64
|
}
|
|
64
65
|
catch (error) {
|