"use strict";
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
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());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoteTokenPool = void 0;
var web3_1 = require("@alephium/web3");
var RemoteTokenPool = /** @class */ (function () {
    function RemoteTokenPool(address, contractId, groupIndex, deployResult) {
        this.address = address;
        this.contractId = contractId;
        this.groupIndex = groupIndex;
        this.deployResult = deployResult;
    }
    RemoteTokenPool.deploy = function (signer, tokenBridgeId, tokenChainId, bridgeTokenId, totalBridged, symbol_, name_, decimals_, sequence_, _extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _deployResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, RemoteTokenPool.contract.deploy(signer, {
                            initialFields: {
                                tokenBridgeId: tokenBridgeId,
                                tokenChainId: tokenChainId,
                                bridgeTokenId: bridgeTokenId,
                                totalBridged: totalBridged,
                                symbol_: symbol_,
                                name_: name_,
                                decimals_: decimals_,
                                sequence_: sequence_,
                            },
                            initialAttoAlphAmount: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAttoAlphAmount,
                            initialTokenAmounts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialTokenAmounts,
                            issueTokenAmount: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.issueTokenAmount,
                            gasAmount: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.gasAmount,
                            gasPrice: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.gasPrice,
                        })];
                    case 1:
                        _deployResult = _a.sent();
                        return [2 /*return*/, new RemoteTokenPool(_deployResult.contractAddress, _deployResult.contractId, _deployResult.fromGroup, _deployResult)];
                }
            });
        });
    };
    RemoteTokenPool.connect = function (address, deployResult) {
        var contractId = web3_1.binToHex(web3_1.contractIdFromAddress(address));
        var groupIndex = parseInt(contractId.slice(-2));
        return new RemoteTokenPool(address, contractId, groupIndex, deployResult);
    };
    RemoteTokenPool.prototype.fetchState = function () {
        return __awaiter(this, void 0, void 0, function () {
            var state;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, RemoteTokenPool.contract.fetchState(this.address, this.groupIndex)];
                    case 1:
                        state = _a.sent();
                        return [2 /*return*/, __assign(__assign({}, state), { tokenBridgeId: state.fields["tokenBridgeId"], tokenChainId: state.fields["tokenChainId"], bridgeTokenId: state.fields["bridgeTokenId"], totalBridged: state.fields["totalBridged"], symbol_: state.fields["symbol_"], name_: state.fields["name_"], decimals_: state.fields["decimals_"], sequence_: state.fields["sequence_"] })];
                }
            });
        });
    };
    // This is used for testing contract functions
    RemoteTokenPool.stateForTest = function (tokenBridgeId, tokenChainId, bridgeTokenId, totalBridged, symbol_, name_, decimals_, sequence_, asset, address) {
        var _a;
        var newAsset = {
            alphAmount: (_a = asset === null || asset === void 0 ? void 0 : asset.alphAmount) !== null && _a !== void 0 ? _a : BigInt("1000000000000000000"),
            tokens: asset === null || asset === void 0 ? void 0 : asset.tokens,
        };
        return RemoteTokenPool.contract.toState({
            tokenBridgeId: tokenBridgeId,
            tokenChainId: tokenChainId,
            bridgeTokenId: bridgeTokenId,
            totalBridged: totalBridged,
            symbol_: symbol_,
            name_: name_,
            decimals_: decimals_,
            sequence_: sequence_,
        }, newAsset, address);
    };
    RemoteTokenPool.testCompleteTransfer = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 0, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("completeTransfer", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testPrepareTransfer = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 1, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPrivateMethod("prepareTransfer", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testPrepareCompleteTransfer = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 2, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPrivateMethod("prepareCompleteTransfer", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testNormalizeAmount = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 3, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("normalizeAmount", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testDeNormalizeAmount = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 4, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("deNormalizeAmount", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testName = function (_initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 5, testArgs: {}, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("name", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testSymbol = function (_initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 6, testArgs: {}, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("symbol", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testDecimals = function (_initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 7, testArgs: {}, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("decimals", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testUpdateDetails = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 8, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("updateDetails", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.testTransfer = function (args, _initFields, _extraParams) {
        var _a, _b, _c;
        return __awaiter(this, void 0, void 0, function () {
            var _initialAsset, _testParams, _testResult;
            return __generator(this, function (_d) {
                switch (_d.label) {
                    case 0:
                        _initialAsset = {
                            alphAmount: (_b = (_a = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _a === void 0 ? void 0 : _a.alphAmount) !== null && _b !== void 0 ? _b : BigInt("1000000000000000000"),
                            tokens: (_c = _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.initialAsset) === null || _c === void 0 ? void 0 : _c.tokens,
                        };
                        _testParams = __assign(__assign({}, _extraParams), { testMethodIndex: 9, testArgs: args, initialFields: _initFields, initialAsset: _initialAsset });
                        return [4 /*yield*/, RemoteTokenPool.contract.testPublicMethod("transfer", _testParams)];
                    case 1:
                        _testResult = _d.sent();
                        return [2 /*return*/, __assign(__assign({}, _testResult), { returns: _testResult.returns })];
                }
            });
        });
    };
    RemoteTokenPool.prototype.normalizeAmountCall = function (amount, decimals, _extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 3,
                            args: web3_1.toApiVals({ amount: amount, decimals: decimals }, ["amount", "decimals"], ["U256", "U256"]),
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["U256"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.prototype.deNormalizeAmountCall = function (amount, decimals, _extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 4,
                            args: web3_1.toApiVals({ amount: amount, decimals: decimals }, ["amount", "decimals"], ["U256", "U256"]),
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["U256"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.prototype.nameCall = function (_extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 5,
                            args: [],
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["ByteVec"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.prototype.symbolCall = function (_extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 6,
                            args: [],
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["ByteVec"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.prototype.decimalsCall = function (_extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 7,
                            args: [],
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["U256"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.prototype.transferCall = function (fromAddress, toAddress, amount, arbiterFee, nonce, _extraParams) {
        return __awaiter(this, void 0, void 0, function () {
            var _callResult;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, web3_1.web3
                            .getCurrentNodeProvider()
                            .contracts.postContractsCallContract({
                            group: this.groupIndex,
                            worldStateBlockHash: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.worldStateBlockHash,
                            txId: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.txId,
                            address: this.address,
                            methodIndex: 9,
                            args: web3_1.toApiVals({
                                fromAddress: fromAddress,
                                toAddress: toAddress,
                                amount: amount,
                                arbiterFee: arbiterFee,
                                nonce: nonce,
                            }, ["fromAddress", "toAddress", "amount", "arbiterFee", "nonce"], ["Address", "ByteVec", "U256", "U256", "ByteVec"]),
                            existingContracts: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.existingContracts,
                            inputAssets: _extraParams === null || _extraParams === void 0 ? void 0 : _extraParams.inputAssets,
                        })];
                    case 1:
                        _callResult = _a.sent();
                        return [2 /*return*/, web3_1.fromApiArray(_callResult.returns, ["ByteVec"])[0]];
                }
            });
        });
    };
    RemoteTokenPool.contract = web3_1.Contract.fromJson(JSON.parse("{\n  \"version\": \"v1.7.0\",\n  \"name\": \"RemoteTokenPool\",\n  \"bytecode\": \"080a404e40a640f54111412d4136413f41484168418d0101070a004025b31600160116021603160500021708170716061604464c041606160413c3038d7ea4c68000a7b11709160416091607ab16080c334c04160616091608aba00016072a16082aa100000005090240321600ce004113157b160443102f13117b1602ce03000317051603ce0300031706160616053113167b14010116056b44ce0244ce016744160143674416014416066b4417071605ce030004170816071608020000060a02402ace0014010116016744cc1706160616004113157b1603ce024113197b1604ce012f13197b1602ce03000417071605ce0300041708160716083313167b160716082b1709160916080201000202010e16011308334c081600130a160113082b832d0216000201000202010e16011308334c081600130a160113082b832c02160002010000000102a00202010000000102a00102010000000102ce0302010003030010b3ce004113157ba0031602310f7b1600a1011601a1021602a103010105070112b316011602160316040001170617051600b11606aca00016062ba100160502\",\n  \"codeHash\": \"beed1be1ba36def0fd93c0a453398674b180f8f26e0c404f30b3443ab33fe902\",\n  \"fieldsSig\": {\n    \"names\": [\n      \"tokenBridgeId\",\n      \"tokenChainId\",\n      \"bridgeTokenId\",\n      \"totalBridged\",\n      \"symbol_\",\n      \"name_\",\n      \"decimals_\",\n      \"sequence_\"\n    ],\n    \"types\": [\n      \"ByteVec\",\n      \"U256\",\n      \"ByteVec\",\n      \"U256\",\n      \"ByteVec\",\n      \"ByteVec\",\n      \"U256\",\n      \"U256\"\n    ],\n    \"isMutable\": [\n      false,\n      false,\n      false,\n      true,\n      true,\n      true,\n      false,\n      true\n    ]\n  },\n  \"eventsSig\": [],\n  \"functions\": [\n    {\n      \"name\": \"completeTransfer\",\n      \"usePreapprovedAssets\": true,\n      \"useAssetsInContract\": true,\n      \"isPublic\": true,\n      \"paramNames\": [\n        \"emitterChainId\",\n        \"amount\",\n        \"vaaTokenId\",\n        \"vaaTokenChainId\",\n        \"recipient\",\n        \"normalizedArbiterFee\",\n        \"caller\"\n      ],\n      \"paramTypes\": [\n        \"U256\",\n        \"U256\",\n        \"ByteVec\",\n        \"U256\",\n        \"Address\",\n        \"U256\",\n        \"Address\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false,\n        false,\n        false,\n        false,\n        false,\n        false\n      ],\n      \"returnTypes\": []\n    },\n    {\n      \"name\": \"prepareTransfer\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": false,\n      \"paramNames\": [\n        \"callerContractId\",\n        \"toAddress\",\n        \"amount\",\n        \"arbiterFee\",\n        \"nonce\"\n      ],\n      \"paramTypes\": [\n        \"ByteVec\",\n        \"ByteVec\",\n        \"U256\",\n        \"U256\",\n        \"ByteVec\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false,\n        false,\n        false,\n        false\n      ],\n      \"returnTypes\": [\n        \"ByteVec\",\n        \"U256\"\n      ]\n    },\n    {\n      \"name\": \"prepareCompleteTransfer\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": false,\n      \"paramNames\": [\n        \"callerContractId\",\n        \"emitterChainId\",\n        \"amount\",\n        \"vaaTokenId\",\n        \"vaaTokenChainId\",\n        \"normalizedArbiterFee\"\n      ],\n      \"paramTypes\": [\n        \"ByteVec\",\n        \"U256\",\n        \"U256\",\n        \"ByteVec\",\n        \"U256\",\n        \"U256\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false,\n        false,\n        false,\n        false,\n        false\n      ],\n      \"returnTypes\": [\n        \"U256\",\n        \"U256\"\n      ]\n    },\n    {\n      \"name\": \"normalizeAmount\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [\n        \"amount\",\n        \"decimals\"\n      ],\n      \"paramTypes\": [\n        \"U256\",\n        \"U256\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false\n      ],\n      \"returnTypes\": [\n        \"U256\"\n      ]\n    },\n    {\n      \"name\": \"deNormalizeAmount\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [\n        \"amount\",\n        \"decimals\"\n      ],\n      \"paramTypes\": [\n        \"U256\",\n        \"U256\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false\n      ],\n      \"returnTypes\": [\n        \"U256\"\n      ]\n    },\n    {\n      \"name\": \"name\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [],\n      \"paramTypes\": [],\n      \"paramIsMutable\": [],\n      \"returnTypes\": [\n        \"ByteVec\"\n      ]\n    },\n    {\n      \"name\": \"symbol\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [],\n      \"paramTypes\": [],\n      \"paramIsMutable\": [],\n      \"returnTypes\": [\n        \"ByteVec\"\n      ]\n    },\n    {\n      \"name\": \"decimals\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [],\n      \"paramTypes\": [],\n      \"paramIsMutable\": [],\n      \"returnTypes\": [\n        \"U256\"\n      ]\n    },\n    {\n      \"name\": \"updateDetails\",\n      \"usePreapprovedAssets\": false,\n      \"useAssetsInContract\": false,\n      \"isPublic\": true,\n      \"paramNames\": [\n        \"symbol\",\n        \"name\",\n        \"sequence\"\n      ],\n      \"paramTypes\": [\n        \"ByteVec\",\n        \"ByteVec\",\n        \"U256\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false,\n        false\n      ],\n      \"returnTypes\": []\n    },\n    {\n      \"name\": \"transfer\",\n      \"usePreapprovedAssets\": true,\n      \"useAssetsInContract\": true,\n      \"isPublic\": true,\n      \"paramNames\": [\n        \"fromAddress\",\n        \"toAddress\",\n        \"amount\",\n        \"arbiterFee\",\n        \"nonce\"\n      ],\n      \"paramTypes\": [\n        \"Address\",\n        \"ByteVec\",\n        \"U256\",\n        \"U256\",\n        \"ByteVec\"\n      ],\n      \"paramIsMutable\": [\n        false,\n        false,\n        false,\n        false,\n        false\n      ],\n      \"returnTypes\": [\n        \"ByteVec\"\n      ]\n    }\n  ]\n}"));
    return RemoteTokenPool;
}());
exports.RemoteTokenPool = RemoteTokenPool;
