@arklabs/wallet-sdk
Version:
Bitcoin wallet SDK with Taproot and Ark integration
188 lines (187 loc) • 5.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Response = void 0;
var Response;
(function (Response) {
Response.walletInitialized = (id) => ({
type: "WALLET_INITIALIZED",
success: true,
id,
});
function error(id, message) {
return {
type: "ERROR",
success: false,
message,
id,
};
}
Response.error = error;
function settleEvent(id, event) {
return {
type: "SETTLE_EVENT",
success: true,
event,
id,
};
}
Response.settleEvent = settleEvent;
function settleSuccess(id, txid) {
return {
type: "SETTLE_SUCCESS",
success: true,
txid,
id,
};
}
Response.settleSuccess = settleSuccess;
function isSettleSuccess(response) {
return response.type === "SETTLE_SUCCESS" && response.success;
}
Response.isSettleSuccess = isSettleSuccess;
function isAddress(response) {
return response.type === "ADDRESS" && response.success === true;
}
Response.isAddress = isAddress;
function addresses(id, addresses) {
return {
type: "ADDRESS",
success: true,
addresses,
id,
};
}
Response.addresses = addresses;
function isAddressInfo(response) {
return response.type === "ADDRESS_INFO" && response.success === true;
}
Response.isAddressInfo = isAddressInfo;
function addressInfo(id, addressInfo) {
return {
type: "ADDRESS_INFO",
success: true,
addressInfo,
id,
};
}
Response.addressInfo = addressInfo;
function isBalance(response) {
return response.type === "BALANCE" && response.success === true;
}
Response.isBalance = isBalance;
function balance(id, balance) {
return {
type: "BALANCE",
success: true,
balance,
id,
};
}
Response.balance = balance;
function isCoins(response) {
return response.type === "COINS" && response.success === true;
}
Response.isCoins = isCoins;
function coins(id, coins) {
return {
type: "COINS",
success: true,
coins,
id,
};
}
Response.coins = coins;
function isVtxos(response) {
return response.type === "VTXOS" && response.success === true;
}
Response.isVtxos = isVtxos;
function vtxos(id, vtxos) {
return {
type: "VTXOS",
success: true,
vtxos,
id,
};
}
Response.vtxos = vtxos;
function isVirtualCoins(response) {
return response.type === "VIRTUAL_COINS" && response.success === true;
}
Response.isVirtualCoins = isVirtualCoins;
function virtualCoins(id, virtualCoins) {
return {
type: "VIRTUAL_COINS",
success: true,
virtualCoins,
id,
};
}
Response.virtualCoins = virtualCoins;
function isBoardingUtxos(response) {
return response.type === "BOARDING_UTXOS" && response.success === true;
}
Response.isBoardingUtxos = isBoardingUtxos;
function boardingUtxos(id, boardingUtxos) {
return {
type: "BOARDING_UTXOS",
success: true,
boardingUtxos,
id,
};
}
Response.boardingUtxos = boardingUtxos;
function isSendBitcoinSuccess(response) {
return (response.type === "SEND_BITCOIN_SUCCESS" &&
response.success === true);
}
Response.isSendBitcoinSuccess = isSendBitcoinSuccess;
function sendBitcoinSuccess(id, txid) {
return {
type: "SEND_BITCOIN_SUCCESS",
success: true,
txid,
id,
};
}
Response.sendBitcoinSuccess = sendBitcoinSuccess;
function isTransactionHistory(response) {
return (response.type === "TRANSACTION_HISTORY" && response.success === true);
}
Response.isTransactionHistory = isTransactionHistory;
function transactionHistory(id, transactions) {
return {
type: "TRANSACTION_HISTORY",
success: true,
transactions,
id,
};
}
Response.transactionHistory = transactionHistory;
function isWalletStatus(response) {
return response.type === "WALLET_STATUS" && response.success === true;
}
Response.isWalletStatus = isWalletStatus;
function walletStatus(id, walletInitialized) {
return {
type: "WALLET_STATUS",
success: true,
status: {
walletInitialized,
},
id,
};
}
Response.walletStatus = walletStatus;
function isClearResponse(response) {
return response.type === "CLEAR_RESPONSE";
}
Response.isClearResponse = isClearResponse;
function clearResponse(id, success) {
return {
type: "CLEAR_RESPONSE",
success,
id,
};
}
Response.clearResponse = clearResponse;
})(Response || (exports.Response = Response = {}));