@effectai/sdk
Version:
Effect Network Javscript/Typescript SDK (for [https://effect.network](https://effect.network))
35 lines • 1.07 kB
JavaScript
import { Asset, ExtendedAsset, } from "@wharfkit/antelope";
export const withdraw = async ({ client, quantity }) => {
if (!client.session?.vAccount) {
throw new Error("vAccount is not set.");
}
const { transact, actor, authorization } = client.session;
const { contracts } = client.network.config.efx;
const quantityAsset = ExtendedAsset.from({
quantity: Asset.from(quantity, "EFX"),
contract: contracts.token,
});
const action = withdrawAction({
from_id: client.session.vAccount.id,
to_account: actor,
quantity: quantityAsset,
account: contracts.vaccount,
authorization,
memo: "",
});
return await transact({ action });
};
export const withdrawAction = ({ from_id, to_account, quantity, account, authorization, }) => {
return {
account,
name: "withdraw",
authorization,
data: {
from_id,
to_account,
quantity,
memo: "",
},
};
};
//# sourceMappingURL=withdraw.js.map