var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { binToHex } from "@alephium/web3";
import { createWrappedOnAlgorand, createWrappedOnSolana, createWrappedOnTerra, } from ".";
import { UpdateRemoteTokenPool } from "../alephium-contracts/ts/scripts";
import { Bridge__factory } from "../ethers-contracts";
export function updateRemoteTokenPoolOnAlph(signerProvider, attestTokenHandlerId, signedVAA) {
    return __awaiter(this, void 0, void 0, function* () {
        return UpdateRemoteTokenPool.execute(signerProvider, {
            initialFields: {
                attestTokenHandler: attestTokenHandlerId,
                vaa: binToHex(signedVAA)
            }
        });
    });
}
export function updateWrappedOnEth(tokenBridgeAddress, signer, signedVAA, overrides = {}) {
    return __awaiter(this, void 0, void 0, function* () {
        const bridge = Bridge__factory.connect(tokenBridgeAddress, signer);
        const v = yield bridge.updateWrapped(signedVAA, overrides);
        const receipt = yield v.wait();
        return receipt;
    });
}
export const updateWrappedOnTerra = createWrappedOnTerra;
export const updateWrappedOnSolana = createWrappedOnSolana;
export const updateWrappedOnAlgorand = createWrappedOnAlgorand;
