import * as $ from "@manahippo/move-to-ts"; import {AptosDataCache, AptosParserRepo, DummyCache, AptosLocalCache} from "@manahippo/move-to-ts"; import {U8, U64, U128} from "@manahippo/move-to-ts"; import {u8, u64, u128} from "@manahippo/move-to-ts"; import {TypeParamDeclType, FieldDeclType} from "@manahippo/move-to-ts"; import {AtomicTypeTag, StructTag, TypeTag, VectorTag, SimpleStructTag} from "@manahippo/move-to-ts"; import {OptionTransaction} from "@manahippo/move-to-ts"; import {HexString, AptosClient, AptosAccount, TxnBuilderTypes, Types} from "aptos"; import * as Stdlib from "../stdlib"; import * as Controller from "./controller"; import * as Implements from "./implements"; export const packageName = "swap"; export const moduleAddress = new HexString("0x870723e9a8f6d07c350e79d63655de673fb24d0695c702f479c201ab7b055f41"); export const moduleName = "beneficiary"; export const ERR_EMERGENCY : U64 = u64("302"); export const ERR_NO_PERMISSIONS : U64 = u64("301"); export function withdraw_ ( account: HexString, $c: AptosDataCache, $p: TypeTag[], /* */ ): void { if (!!Controller.is_emergency_($c)) { throw $.abortCode($.copy(ERR_EMERGENCY)); } if (!((Implements.beneficiary_($c)).hex() === (Stdlib.Signer.address_of_(account, $c)).hex())) { throw $.abortCode($.copy(ERR_NO_PERMISSIONS)); } return Implements.withdraw_fee_(Stdlib.Signer.address_of_(account, $c), $c, [$p[0]]); } export function buildPayload_withdraw ( $p: TypeTag[], /* */ isJSON = false, ): TxnBuilderTypes.TransactionPayloadEntryFunction | Types.TransactionPayload_EntryFunctionPayload { const typeParamStrings = $p.map(t=>$.getTypeTagFullname(t)); return $.buildPayload( new HexString("0x870723e9a8f6d07c350e79d63655de673fb24d0695c702f479c201ab7b055f41"), "beneficiary", "withdraw", typeParamStrings, [], isJSON, ); } export function loadParsers(repo: AptosParserRepo) { } export class App { constructor( public client: AptosClient, public repo: AptosParserRepo, public cache: AptosLocalCache, ) { } get moduleAddress() {{ return moduleAddress; }} get moduleName() {{ return moduleName; }} payload_withdraw( $p: TypeTag[], /* */ isJSON = false, ): TxnBuilderTypes.TransactionPayloadEntryFunction | Types.TransactionPayload_EntryFunctionPayload { return buildPayload_withdraw($p, isJSON); } async withdraw( _account: AptosAccount, $p: TypeTag[], /* */ option?: OptionTransaction, _isJSON = false ) { const payload__ = buildPayload_withdraw($p, _isJSON); return $.sendPayloadTx(this.client, _account, payload__, option); } }