// Copyright © Endless // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 import { AnyNumber } from "../types"; import { transferFungibleAsset } from "../internal/fungibleAsset"; import { EndlessConfig } from "./endlessConfig"; import { Account } from "../account"; import { AccountAddressInput } from "../core"; import { InputGenerateTransactionOptions } from "../transactions"; import { SimpleTransaction } from "../transactions/instances/simpleTransaction"; /** * A class to query all `FungibleAsset` related queries on Endless. */ export class FungibleAsset { constructor(readonly config: EndlessConfig) {} /** * Transfer `amount` of fungible asset from sender's primary store to recipient's primary store. * * Use this method to transfer any fungible asset including fungible token. * * @example * const transaction = await endless.transferFungibleAsset({ * sender: alice, * fungibleAssetMetadataAddress: "0x123", * recipient: "0x456", * amount: 5 * }) * * @param sender The sender account * @param fungibleAssetMetadataAddress The fungible asset account address. * For example if you’re transferring USDT this would be the USDT address * @param recipient The recipient account address * @param amount Number of assets to transfer * * @returns A SimpleTransaction that can be simulated or submitted to chain. */ async transferFungibleAsset(args: { sender: Account; fungibleAssetMetadataAddress: AccountAddressInput; recipient: AccountAddressInput; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise { return transferFungibleAsset({ endlessConfig: this.config, ...args }); } }