Loading...
Loading...
Move to TypeScript type mapping in @aptos-labs/ts-sdk: u64/u128/u256 as bigint, address as string, TypeTag, functionArguments and typeArguments. Triggers on: 'typeArguments', 'functionArguments', 'Move to TypeScript', 'type mapping', 'TypeTag', 'bigint u128'.
npx skill4agent add iskysun96/aptos-agent-skills ts-sdk-types@aptos-labs/ts-sdkfunctionArgumentstypeArgumentsbigintfunctionArgumentsnumberstring"0x1"accountAddress.toString()AccountAddressInputtypeArguments["0x1::aptos_coin::AptosCoin"]coin::balancecoin::transferBigInt(result[0] as string)numberbigintbigintbalance<CoinType>| Move type | TypeScript type | Example |
|---|---|---|
| u8, u16, u32 | number | |
| u64 | number | bigint | Prefer bigint for large values |
| u128, u256 | bigint | |
| i8..i64 (Move 2.3+) | number | bigint | Use bigint for i64 when large |
| i128, i256 | bigint | |
| bool | boolean | |
| address | string | |
| signer | — | Not passed from TS; signer is the transaction sender |
| vector<u8> | Uint8Array | string (hex) | |
| vector<T> | T[] | |
| String | string | |
| Object<T> | string (object address) | |
| Option<T> | T | null | Value or |
// Move: public fun transfer<CoinType>(to: address, amount: u64)
await aptos.transaction.build.simple({
sender: account.accountAddress,
data: {
function: "0x1::coin::transfer",
typeArguments: ["0x1::aptos_coin::AptosCoin"],
functionArguments: [
"0xrecipient...", // address as string
1000n, // u64 as bigint (or number if small)
],
},
});address::module::StructName// Move: balance<CoinType>(addr): u64
typeArguments: ["0x1::aptos_coin::AptosCoin"]
// Move: transfer<CoinType>(to, amount)
typeArguments: ["0x1::aptos_coin::AptosCoin"]const result = await aptos.view({
payload: {
function: "0x1::coin::balance",
typeArguments: ["0x1::aptos_coin::AptosCoin"],
functionArguments: [accountAddress],
},
});
// result is an array; u128 often returned as string in JSON
const balance = BigInt(result[0] as string);import { TypeTag } from "@aptos-labs/ts-sdk";
// Parser for type tag strings
import { parseTypeTag } from "@aptos-labs/ts-sdk";
const tag = parseTypeTag("0x1::aptos_coin::AptosCoin");typeArgumentsfunctionArguments: [
nftObjectAddress.toString(), // or "0x..."
price,
]| Mistake | Correct approach |
|---|---|
| Passing number for u128 amount | Use |
| Omitting typeArguments for coin::balance | Add |
| Using result[0] as number for u128 | Use |
| Wrong order of functionArguments | Match Move parameter order exactly |
src/transactions/typeTag/src/transactions/instances/transactionArgument.ts