@maestro-org/typescript-sdk
Version:
TypeScript SDK for the Maestro Dapp Platform
949 lines (943 loc) • 169 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/index.ts
var src_exports = {};
__export(src_exports, {
AccountAction: () => AccountAction,
AccountRewardType: () => AccountRewardType,
AccountStakingRewardType: () => AccountStakingRewardType,
AccountsApi: () => AccountsApi,
AddressesApi: () => AddressesApi,
AssetTxsOrderEnum: () => AssetTxsOrderEnum,
AssetUpdatesOrderEnum: () => AssetUpdatesOrderEnum,
AssetUtxosOrderEnum: () => AssetUtxosOrderEnum,
AssetsApi: () => AssetsApi,
BlocksApi: () => BlocksApi,
Cip68AssetType: () => Cip68AssetType,
Configuration: () => Configuration,
DatumApi: () => DatumApi,
DatumOptionType: () => DatumOptionType,
EcosystemApi: () => EcosystemApi,
EpochsApi: () => EpochsApi,
GeneralApi: () => GeneralApi,
LedgerEra: () => LedgerEra,
MaestroClient: () => MaestroClient,
MirSource: () => MirSource,
NetworkId: () => NetworkId,
PaymentCredKind: () => PaymentCredKind,
PolicyTxsOrderEnum: () => PolicyTxsOrderEnum,
PolicyUtxosOrderEnum: () => PolicyUtxosOrderEnum,
PoolBlocksOrderEnum: () => PoolBlocksOrderEnum,
PoolHistoryOrderEnum: () => PoolHistoryOrderEnum,
PoolsApi: () => PoolsApi,
ScriptType: () => ScriptType,
ScriptsApi: () => ScriptsApi,
StakingCredKind: () => StakingCredKind,
TransactionManagerApi: () => TransactionManagerApi,
TransactionsApi: () => TransactionsApi,
TxStatus: () => TxStatus,
TxsByAddressOrderEnum: () => TxsByAddressOrderEnum,
TxsByPaymentCredOrderEnum: () => TxsByPaymentCredOrderEnum,
UtxoRefsAtAddressOrderEnum: () => UtxoRefsAtAddressOrderEnum,
UtxosByAddressOrderEnum: () => UtxosByAddressOrderEnum,
UtxosByPaymentCredOrderEnum: () => UtxosByPaymentCredOrderEnum,
VestingApi: () => VestingApi
});
module.exports = __toCommonJS(src_exports);
// src/base.ts
var BaseAPI = class {
constructor(configuration) {
this.configuration = configuration;
}
};
var RequiredError = class extends Error {
constructor(field, msg) {
super(msg);
this.field = field;
this.name = "RequiredError";
}
};
// src/common.ts
var DUMMY_BASE_URL = "https://example.com";
var HEADER_AMOUNTS_AS_STRING = {
"amounts-as-strings": "true"
};
var assertParamExists = (functionName, paramName, paramValue) => {
if (paramValue === null || paramValue === void 0) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`
);
}
};
var setApiKeyToObject = (targetObject, keyParamName, configuration) => {
targetObject[keyParamName] = configuration.apiKey;
};
function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
if (parameter == null)
return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
} else {
Object.keys(parameter).forEach(
(currentKey) => setFlattenedQueryParams(
urlSearchParams,
parameter[currentKey],
`${key}${key !== "" ? "." : ""}${currentKey}`
)
);
}
} else if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
} else {
urlSearchParams.set(key, parameter);
}
}
var setSearchParams = (url, ...objects) => {
const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
};
var serializeDataIfNeeded = (value, requestOptions, configuration) => {
const nonString = typeof value !== "string";
const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) : nonString;
return needsSerialization ? JSON.stringify(value !== void 0 ? value : {}) : value || "";
};
var toPathString = (url) => url.pathname + url.search + url.hash;
var createRequestFunction = (axiosArgs, configuration) => () => __async(void 0, null, function* () {
const axiosRequestArgs = __spreadProps(__spreadValues({}, axiosArgs.options), { url: configuration.baseUrl + axiosArgs.url });
return configuration.axiosInstance.request(axiosRequestArgs).then((response) => response.data);
});
// src/api/accounts/helpers.ts
var AccountsApiAxiosParamCreator = (configuration) => ({
/**
* Returns a list of addresses seen on-chain which use the specified stake key
* @summary Stake account addresses
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountAddressesQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAddresses: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountAddresses", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/addresses`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns a list of native assets which are owned by addresses with the specified stake key
* @summary Stake account assets
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {AccountAssetsQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAssets: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountAssets", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/assets`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns per-epoch history for the specified stake key
* @summary Stake account history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountHistoryQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountHistory: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountHistory", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/history`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns various information regarding a stake account
* @summary Stake account information
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountInfo: (stakeAddr, options = {}) => {
assertParamExists("accountInfo", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`)
* @summary Stake account rewards
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountRewardsQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountRewards: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountRewards", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/rewards`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`)
* @summary Stake account updates
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountUpdatesQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountUpdates: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountUpdates", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/updates`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns list of delegation actions relating to a stake account
* @summary Stake account delegation history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountDelegationHistoryQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountDelegationHistory: (stakeAddr, localVarQueryParameter = {}, options = {}) => {
assertParamExists("accountDelegationHistory", "stakeAddr", stakeAddr);
const localVarPath = `/accounts/{stake_addr}/delegations`.replace(
`{${"stake_addr"}}`,
encodeURIComponent(String(stakeAddr))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
}
});
var AccountsApiFp = (configuration) => {
const localVarAxiosParamCreator = AccountsApiAxiosParamCreator(configuration);
return {
/**
* Returns a list of addresses seen on-chain which use the specified stake key
* @summary Stake account addresses
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountAddressesQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAddresses(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns a list of native assets which are owned by addresses with the specified stake key
* @summary Stake account assets
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {AccountAssetsQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountAssets(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns per-epoch history for the specified stake key
* @summary Stake account history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountHistoryQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountHistory(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns list of delegation actions relating to a stake account
* @summary Stake account history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountDelegationHistoryQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountDelegationHistory(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountDelegationHistory(
stakeAddr,
queryParams,
options
);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns various information regarding a stake account
* @summary Stake account information
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountInfo(stakeAddr, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountInfo(stakeAddr, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`)
* @summary Stake account rewards
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountRewardsQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountRewards(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`)
* @summary Stake account updates
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountUpdatesQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
accountUpdates(stakeAddr, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
}
};
};
// src/api/accounts/index.ts
var AccountsApi = class extends BaseAPI {
/**
* Returns a list of addresses seen on-chain which use the specified stake key
* @summary Stake account addresses
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountAddressesQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountAddresses(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountAddresses(stakeAddr, queryParams, options)();
}
/**
* Returns a list of native assets which are owned by addresses with the specified stake key
* @summary Stake account assets
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {AccountAssetsQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountAssets(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountAssets(stakeAddr, queryParams, options)();
}
/**
* Returns per-epoch history for the specified stake key
* @summary Stake account history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountHistoryQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountHistory(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountHistory(stakeAddr, queryParams, options)();
}
/**
* * Returns list of delegation actions relating to a stake account
* @summary Stake account history
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountDelegationHistoryQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountDelegationHistory(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountDelegationHistory(stakeAddr, queryParams, options)();
}
/**
* Returns various information regarding a stake account
* @summary Stake account information
* @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\')
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountInfo(stakeAddr, options) {
return AccountsApiFp(this.configuration).accountInfo(stakeAddr, options)();
}
/**
* Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`)
* @summary Stake account rewards
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountRewardsQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountRewards(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountRewards(stakeAddr, queryParams, options)();
}
/**
* Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`)
* @summary Stake account updates
* @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\')
* @param {AccountUpdatesQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AccountsApi
*/
accountUpdates(stakeAddr, queryParams, options) {
return AccountsApiFp(this.configuration).accountUpdates(stakeAddr, queryParams, options)();
}
};
// src/api/addresses/helpers.ts
var AddressesApiAxiosParamCreator = (configuration) => ({
/**
* Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address
* @summary Decode address
* @param {string} address Address in bech32/hex/base58 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
decodeAddress: (address, options = {}) => {
assertParamExists("decodeAddress", "address", address);
const localVarPath = `/addresses/{address}/decode`.replace(
`{${"address"}}`,
encodeURIComponent(String(address))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Return total amount of assets, including ADA, in UTxOs controlled by a specific payment credential
* @summary Address Balance
* @param {string} credential Payment credential in bech32 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addressBalance: (credential, options = {}) => {
assertParamExists("addressBalance", "address", credential);
const localVarPath = `/addresses/cred/{credential}/balance`.replace(
`{${"credential"}}`,
encodeURIComponent(String(credential))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Address transaction count
* @param {string} address Address in bech32 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txCountByAddress: (address, options = {}) => {
assertParamExists("txCountByAddress", "address", address);
const localVarPath = `/addresses/{address}/transactions/count`.replace(
`{${"address"}}`,
encodeURIComponent(String(address))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Address transactions
* @param {string} address Address in bech32 format
* @param {TxsByAddressQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByAddress: (address, localVarQueryParameter, options = {}) => {
assertParamExists("txsByAddress", "address", address);
const localVarPath = `/addresses/{address}/transactions`.replace(
`{${"address"}}`,
encodeURIComponent(String(address))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Payment credential transactions
* @param {string} credential Payment credential in bech32 format
* @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByPaymentCred: (credential, localVarQueryParameter = {}, options = {}) => {
assertParamExists("txsByPaymentCred", "credential", credential);
const localVarPath = `/addresses/cred/{credential}/transactions`.replace(
`{${"credential"}}`,
encodeURIComponent(String(credential))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns transactions in which the specified payment credentials spent or received funds. Specifically, the transactions where: the payment credentials were used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Payment credentials transactions
* @param {Array<string>} requestBody Payment credentials in bech32 format
* @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByPaymentCreds: (requestBody, localVarQueryParameter = {}, options = {}) => {
assertParamExists("txsByPaymentCreds", "requestBody", requestBody);
const localVarPath = `/addresses/cred/transactions`;
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "POST" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
localVarHeaderParameter["Content-Type"] = "application/json";
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address
* @summary UTxO references at an address
* @param {string} address Address in bech32 format
* @param {UtxoRefsAtAddressQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxoRefsAtAddress: (address, localVarQueryParameter = {}, options = {}) => {
assertParamExists("utxoRefsAtAddress", "address", address);
const localVarPath = `/addresses/{address}/utxo_refs`.replace(
`{${"address"}}`,
encodeURIComponent(String(address))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Return detailed information on UTxOs controlled by an address
* @summary UTxOs at an address
* @param {string} address Address in bech32 format
* @param {UtxosByAddressQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxosByAddress: (address, localVarQueryParameter = {}, options = {}) => {
assertParamExists("utxosByAddress", "address", address);
const localVarPath = `/addresses/{address}/utxos`.replace(
`{${"address"}}`,
encodeURIComponent(String(address))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Return detailed information on UTxOs which are controlled by some address in the specified list of addresses
* @summary UTxOs at multiple addresses
* @param {Array<string>} requestBody
* @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxosByAddresses: (requestBody, localVarQueryParameter = {}, options = {}) => {
assertParamExists("utxosByAddresses", "requestBody", requestBody);
const localVarPath = `/addresses/utxos`;
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "POST" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
localVarHeaderParameter["Content-Type"] = "application/json";
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Return detailed information on UTxOs controlled by addresses which use the specified payment credential
* @summary UTxOs by payment credential
* @param {string} credential Payment credential in bech32 format
* @param {UtxosByPaymentCredQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxosByPaymentCred: (credential, localVarQueryParameter = {}, options = {}) => {
assertParamExists("utxosByPaymentCred", "credential", credential);
const localVarPath = `/addresses/cred/{credential}/utxos`.replace(
`{${"credential"}}`,
encodeURIComponent(String(credential))
);
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "GET" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
},
/**
* Return detailed information on UTxOs which are controlled by some payment credentials in the specified list of payment credentials
* @summary UTxOs at multiple payment credentials
* @param {Array<string>} requestBody
* @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxosByPaymentCreds: (requestBody, localVarQueryParameter = {}, options = {}) => {
assertParamExists("utxosByPaymentCreds", "requestBody", requestBody);
const localVarPath = `/addresses/cred/utxos`;
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
const { baseOptions } = configuration;
const localVarRequestOptions = __spreadValues(__spreadValues({ method: "POST" }, baseOptions), options);
const localVarHeaderParameter = {};
setApiKeyToObject(localVarHeaderParameter, "api-key", configuration);
localVarHeaderParameter["Content-Type"] = "application/json";
setSearchParams(localVarUrlObj, localVarQueryParameter);
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, localVarHeaderParameter), headersFromBaseOptions), options.headers), HEADER_AMOUNTS_AS_STRING);
localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
}
});
var AddressesApiFp = (configuration) => {
const localVarAxiosParamCreator = AddressesApiAxiosParamCreator(configuration);
return {
/**
* Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address
* @summary Decode address
* @param {string} address Address in bech32/hex/base58 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
decodeAddress(address, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.decodeAddress(address, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Return total amount of assets, including ADA, in UTxOs controlled by a specific payment credential
* @summary Address Balance
* @param {string} credential Payment credential in bech32 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addressBalance(credential, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.addressBalance(credential, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Address transaction count
* @param {string} address Address in bech32 format
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txCountByAddress(address, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.txCountByAddress(address, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Address transactions
* @param {string} address Address in bech32 format
* @param {TxsByAddressQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByAddress(address, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.txsByAddress(address, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Payment credential transactions
* @param {string} credential Payment credential in bech32 format
* @param {TxsByPaymentCredQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByPaymentCred(credential, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.txsByPaymentCred(credential, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns transactions in which the specified payment credentials spent or received funds. Specifically, the transactions where: the payment credentials were used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/).
* @summary Payment credentials transactions
* @param {Array<string>} requestBody Payment credentials in bech32 format
* @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
txsByPaymentCreds(requestBody, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.txsByPaymentCreds(requestBody, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address
* @summary UTxO references at an address
* @param {string} address Address in bech32 format
* @param {UtxoRefsAtAddressQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxoRefsAtAddress(address, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.utxoRefsAtAddress(address, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Return detailed information on UTxOs controlled by an address
* @summary UTxOs at an address
* @param {string} address Address in bech32 format
* @param {UtxosByAddressQueryParams} [queryParams] Query parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
utxosByAddress(address, queryParams, options) {
const localVarAxiosArgs = localVarAxiosParamCreator.utxosByAddress(address, queryParams, options);
return createRequestFunction(localVarAxiosArgs, configuration);
},
/**
* Return detailed information on UTxOs which are controlled by some address in the specified list of addresses
* @summary UTxOs at multiple addresses
* @param {Array<string>} requestBody
* @param {UtxosByAddressesQueryParams} [queryParams] Query parameters.
* @param