UNPKG

@ledgerhq/coin-canton

Version:
26 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildTransferInstruction = void 0; const sign_1 = require("../common-logic/transaction/sign"); const gateway_1 = require("../network/gateway"); const getTransactionStatus_1 = require("./getTransactionStatus"); const serialization_1 = require("./serialization"); const buildTransferInstruction = (signerContext) => async (currency, deviceId, account, partyId, contractId, type, reason) => { if ((0, serialization_1.isCantonAccount)(account)) { const topologyError = await (0, getTransactionStatus_1.validateTopology)(account); if (topologyError) { throw topologyError; } } const preparedTransaction = await (0, gateway_1.prepareTransferInstruction)(currency, partyId, { type, contract_id: contractId, ...(reason ? { reason } : {}), }); const { signature } = await signerContext(deviceId, async (signer) => { return await (0, sign_1.signTransaction)(signer, account.freshAddressPath, preparedTransaction); }); await (0, gateway_1.submitTransferInstruction)(currency, partyId, preparedTransaction.serialized, signature); }; exports.buildTransferInstruction = buildTransferInstruction; //# sourceMappingURL=acceptOffer.js.map