@radixdlt/application
Version:
A JavaScript client library for interacting with the Radix Distributed Ledger.
33 lines • 2.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAPI = void 0;
const responseHandlers_1 = require("./responseHandlers");
const ramda_1 = require("ramda");
const callAPIWith = (call) => (method) => (handleResponse) => (params, headers) => (0, ramda_1.pipe)(() => call(method, params, headers), result => result.mapErr(e => [e]).andThen(handleResponse))();
exports.getAPI = (0, ramda_1.pipe)((call) => callAPIWith(call), callAPI => ({
gateway: callAPI('gatewayPost')(responseHandlers_1.handleGatewayResponse),
tokenInfo: callAPI('tokenPost')(responseHandlers_1.handleTokenInfoResponse),
nativeTokenInfo: callAPI('tokenNativePost')(responseHandlers_1.handleNativeTokenResponse),
stakePositions: callAPI('accountStakesPost')(responseHandlers_1.handleStakePositionsResponse),
unstakePositions: callAPI('accountUnstakesPost')(responseHandlers_1.handleUnstakePositionsResponse),
/*
deriveTokenIdentifier: callAPI('tokenDerivePost')(
handleDeriveTokenIdentifierResponse,
),
*/
accountBalances: callAPI('accountBalancesPost')(responseHandlers_1.handleAccountBalancesResponse),
accountTransactions: callAPI('accountTransactionsPost')(responseHandlers_1.handleAccountTransactionsResponse),
validator: callAPI('validatorPost')(responseHandlers_1.handleValidatorResponse),
validators: callAPI('validatorsPost')(responseHandlers_1.handleValidatorsResponse),
/*
transactionRules: callAPI('transactionRulesPost')(
handleTransactionRulesResponse,
),
*/
buildTransaction: callAPI('transactionBuildPost')(responseHandlers_1.handleBuildTransactionResponse),
finalizeTransaction: callAPI('transactionFinalizePost')(responseHandlers_1.handleFinalizeTransactionResponse),
submitTransaction: callAPI('transactionSubmitPost')(responseHandlers_1.handleSubmitTransactionResponse),
getTransaction: callAPI('transactionStatusPost')(responseHandlers_1.handleTransactionResponse),
recentTransactions: callAPI('transactionRecentPost')(responseHandlers_1.handleRecentTransactionResponse),
}));
//# sourceMappingURL=interface.js.map