Skip to content

Commit 5231fdd

Browse files
kumaryash90MananTank
authored andcommitted
fix units, return prepared tx
1 parent d27c6c4 commit 5231fdd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/thirdweb/src/assets/distribute-token.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { toUnits } from "src/utils/units.js";
12
import { distributeAsset } from "../extensions/assets/__generated__/AssetEntrypointERC20/write/distributeAsset.js";
2-
import { sendTransaction } from "../transaction/actions/send-transaction.js";
33
import type { ClientAndChainAndAccount } from "../utils/types.js";
44
import { getDeployedEntrypointERC20 } from "./get-entrypoint-erc20.js";
55
import type { DistributeContent } from "./types.js";
@@ -16,14 +16,11 @@ export async function distributeToken(options: DistrbuteTokenParams) {
1616
throw new Error(`Entrypoint not found on chain: ${options.chain.id}`);
1717
}
1818

19-
const transaction = distributeAsset({
19+
return distributeAsset({
2020
contract: entrypoint,
2121
asset: options.tokenAddress,
22-
contents: options.contents,
23-
});
24-
25-
return await sendTransaction({
26-
transaction,
27-
account: options.account,
22+
contents: options.contents.map((a) => {
23+
return { ...a, amount: toUnits(a.amount.toString(), 18) };
24+
}),
2825
});
2926
}

0 commit comments

Comments
 (0)