@tangany/waas
Version:
node.js SDK for Tangany Wallet as a Service API
38 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockchainWallet = void 0;
var t = require("typeforce");
/**
* Base for classes that provide an interface for wallet actions, e.g. on the Bitcoin or Ethereum blockchain.
*/
var BlockchainWallet = /** @class */ (function () {
function BlockchainWallet(waas, walletInstance) {
this.waas = waas;
this.walletInstance = walletInstance;
}
Object.defineProperty(BlockchainWallet.prototype, "wallet", {
get: function () {
t("String", this.walletInstance.wallet);
return this.walletInstance.wallet;
},
enumerable: false,
configurable: true
});
/**
* Determines the request id from an server response to an asynchronous request.
* The server always returns the location of the server resource that represents the status of the
* asynchronous request. From this, only the ID is extracted.
* @param serverResponse - Object that represents the raw server response of an asynchronous endpoint
*/
BlockchainWallet.prototype.extractRequestId = function (serverResponse) {
var statusUri = serverResponse.statusUri;
var matches = statusUri === null || statusUri === void 0 ? void 0 : statusUri.match(/(?!.*\/).+/);
if (!matches || matches.length > 1) {
throw new Error("The API call for asynchronously sending a transaction has returned an unexpected format");
}
return matches[0];
};
return BlockchainWallet;
}());
exports.BlockchainWallet = BlockchainWallet;
//# sourceMappingURL=blockchain-wallet.js.map