@cardano-ogmios/client
Advanced tools
Comparing version 4.0.0-beta.9 to 4.0.0
@@ -20,3 +20,3 @@ "use strict"; | ||
tip: response.result.RollBackward.tip | ||
}, () => requestNext_1.requestNext(socket)); | ||
}, () => (0, requestNext_1.requestNext)(socket)); | ||
} | ||
@@ -28,3 +28,3 @@ else if ('RollForward' in response.result) { | ||
}, () => { | ||
requestNext_1.requestNext(socket); | ||
(0, requestNext_1.requestNext)(socket); | ||
}); | ||
@@ -48,3 +48,3 @@ } | ||
shutdown: () => new Promise(resolve => { | ||
util_1.ensureSocketIsOpen(socket); | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
socket.once('close', resolve); | ||
@@ -54,6 +54,6 @@ socket.close(); | ||
startSync: async (points, inFlight) => { | ||
const intersection = await findIntersect_1.findIntersect(context, points || [await util_1.createPointFromCurrentTip(context)]); | ||
util_1.ensureSocketIsOpen(socket); | ||
const intersection = await (0, findIntersect_1.findIntersect)(context, points || [await (0, util_1.createPointFromCurrentTip)(context)]); | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
for (let n = 0; n < (inFlight || 100); n += 1) { | ||
requestNext_1.requestNext(socket); | ||
(0, requestNext_1.requestNext)(socket); | ||
} | ||
@@ -60,0 +60,0 @@ return intersection; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const StateQuery_1 = require("../StateQuery/"); | ||
const findIntersect = (context, points) => StateQuery_1.Query({ | ||
const findIntersect = (context, points) => (0, StateQuery_1.Query)({ | ||
methodName: 'FindIntersect', | ||
@@ -9,0 +9,0 @@ args: { |
@@ -22,4 +22,4 @@ "use strict"; | ||
const createInteractionContext = async (errorHandler, closeHandler, options) => { | ||
const connection = exports.createConnectionObject(options === null || options === void 0 ? void 0 : options.connection); | ||
const health = await ServerHealth_1.getServerHealth(connection); | ||
const connection = (0, exports.createConnectionObject)(options === null || options === void 0 ? void 0 : options.connection); | ||
const health = await (0, ServerHealth_1.getServerHealth)(connection); | ||
return new Promise((resolve, reject) => { | ||
@@ -26,0 +26,0 @@ if (health.lastTipUpdate === null) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
const getServerHealth = async (connection) => { | ||
const response = await cross_fetch_1.default(`${connection.address.http}/health`); | ||
const response = await (0, cross_fetch_1.default)(`${connection.address.http}/health`); | ||
const responseJson = await response.json(); | ||
@@ -12,0 +12,0 @@ if (response.ok) { |
@@ -7,3 +7,3 @@ "use strict"; | ||
const isEraMismatch = (result) => result.eraMismatch !== undefined; | ||
const currentEpoch = (context) => Query_1.Query({ | ||
const currentEpoch = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -10,0 +10,0 @@ args: { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isProtocolParameters = (result) => result.minFeeCoefficient !== undefined; | ||
const currentProtocolParameters = (context) => Query_1.Query({ | ||
const currentProtocolParameters = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -11,0 +11,0 @@ args: { |
@@ -11,3 +11,3 @@ "use strict"; | ||
}; | ||
const delegationsAndRewards = (context, stakeKeyHashes) => Query_1.Query({ | ||
const delegationsAndRewards = (context, stakeKeyHashes) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -14,0 +14,0 @@ args: { |
@@ -10,3 +10,3 @@ "use strict"; | ||
}; | ||
const eraStart = (context) => Query_1.Query({ | ||
const eraStart = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -13,0 +13,0 @@ args: { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isGenesisConfig = (result) => result.systemStart !== undefined; | ||
const genesisConfig = (context) => Query_1.Query({ | ||
const genesisConfig = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -11,0 +11,0 @@ args: { |
@@ -8,5 +8,9 @@ export * from './currentEpoch'; | ||
export * from './nonMyopicMemberRewards'; | ||
export * from './poolIds'; | ||
export * from './poolParameters'; | ||
export * from './poolsRanking'; | ||
export * from './proposedProtocolParameters'; | ||
export * from './rewardsProvenance'; | ||
export * from './stakeDistribution'; | ||
export * from './utxo'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -20,5 +20,9 @@ "use strict"; | ||
__exportStar(require("./nonMyopicMemberRewards"), exports); | ||
__exportStar(require("./poolIds"), exports); | ||
__exportStar(require("./poolParameters"), exports); | ||
__exportStar(require("./poolsRanking"), exports); | ||
__exportStar(require("./proposedProtocolParameters"), exports); | ||
__exportStar(require("./rewardsProvenance"), exports); | ||
__exportStar(require("./stakeDistribution"), exports); | ||
__exportStar(require("./utxo"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isNonOriginPoint = (result) => result.slot !== undefined; | ||
const ledgerTip = (context) => Query_1.Query({ | ||
const ledgerTip = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -11,0 +11,0 @@ args: { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isNonMyopicMemberRewards = (result) => typeof Object.values(Object.values(result)[0])[0] === 'number'; | ||
const nonMyopicMemberRewards = (context, input) => Query_1.Query({ | ||
const nonMyopicMemberRewards = (context, input) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -11,0 +11,0 @@ args: { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isEraMismatch = (result) => result.eraMismatch !== undefined; | ||
const proposedProtocolParameters = (context) => Query_1.Query({ | ||
const proposedProtocolParameters = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -24,3 +24,3 @@ args: { | ||
} | ||
else if (util_1.isEmptyObject(response.result)) { | ||
else if ((0, util_1.isEmptyObject)(response.result)) { | ||
return resolve(null); | ||
@@ -27,0 +27,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isPoolDistribution = (result) => Object.values(result)[0].stake !== undefined; | ||
const stakeDistribution = (context) => Query_1.Query({ | ||
const stakeDistribution = (context) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
@@ -11,0 +11,0 @@ args: { |
@@ -1,4 +0,4 @@ | ||
import { Address, Utxo } from '@cardano-ogmios/schema'; | ||
import { Address, TxIn, Utxo } from '@cardano-ogmios/schema'; | ||
import { InteractionContext } from '../../Connection'; | ||
export declare const utxo: (context: InteractionContext, addresses: Address[]) => Promise<Utxo>; | ||
export declare const utxo: (context: InteractionContext, filters: Address[] | TxIn[]) => Promise<Utxo>; | ||
//# sourceMappingURL=utxo.d.ts.map |
@@ -17,7 +17,7 @@ "use strict"; | ||
}; | ||
const utxo = (context, addresses) => Query_1.Query({ | ||
const utxo = (context, filters) => (0, Query_1.Query)({ | ||
methodName: 'Query', | ||
args: { | ||
query: Array.isArray(addresses) && addresses.length > 0 && addresses[0] !== null | ||
? { utxo: addresses } | ||
query: Array.isArray(filters) && filters.length > 0 && filters[0] !== null | ||
? { utxo: filters } | ||
: 'utxo' | ||
@@ -24,0 +24,0 @@ } |
@@ -7,4 +7,4 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const Query = (request, response, context) => Request_1.send((socket) => new Promise((resolve, reject) => { | ||
const requestId = nanoid_1.nanoid(5); | ||
const Query = (request, response, context) => (0, Request_1.send)((socket) => new Promise((resolve, reject) => { | ||
const requestId = (0, nanoid_1.nanoid)(5); | ||
async function listener(data) { | ||
@@ -11,0 +11,0 @@ var _a; |
@@ -1,6 +0,8 @@ | ||
import { Address, Hash16, Lovelace, PointOrOrigin } from '@cardano-ogmios/schema'; | ||
import { Address, Hash16, Lovelace, PointOrOrigin, PoolId, TxIn } from '@cardano-ogmios/schema'; | ||
import { InteractionContext } from '../Connection'; | ||
import { currentEpoch, currentProtocolParameters, delegationsAndRewards, eraStart, genesisConfig, ledgerTip, nonMyopicMemberRewards, proposedProtocolParameters, stakeDistribution, utxo } from './queries'; | ||
import { currentEpoch, currentProtocolParameters, delegationsAndRewards, eraStart, genesisConfig, ledgerTip, nonMyopicMemberRewards, poolIds, poolParameters, poolsRanking, proposedProtocolParameters, rewardsProvenance, stakeDistribution, utxo } from './queries'; | ||
export interface StateQueryClient { | ||
context: InteractionContext; | ||
acquire: (point: PointOrOrigin) => Promise<StateQueryClient>; | ||
shutdown: () => Promise<void>; | ||
currentEpoch: () => ReturnType<typeof currentEpoch>; | ||
@@ -13,7 +15,9 @@ currentProtocolParameters: () => ReturnType<typeof currentProtocolParameters>; | ||
nonMyopicMemberRewards: (input: Lovelace[] | Hash16[]) => ReturnType<typeof nonMyopicMemberRewards>; | ||
point: PointOrOrigin; | ||
poolIds: () => ReturnType<typeof poolIds>; | ||
poolParameters: (pools: PoolId[]) => ReturnType<typeof poolParameters>; | ||
poolsRanking: () => ReturnType<typeof poolsRanking>; | ||
proposedProtocolParameters: () => ReturnType<typeof proposedProtocolParameters>; | ||
shutdown: () => Promise<void>; | ||
rewardsProvenance: () => ReturnType<typeof rewardsProvenance>; | ||
stakeDistribution: () => ReturnType<typeof stakeDistribution>; | ||
utxo: (addresses?: Address[]) => ReturnType<typeof utxo>; | ||
utxo: (filter?: Address[] | TxIn[]) => ReturnType<typeof utxo>; | ||
} | ||
@@ -20,0 +24,0 @@ export declare const createStateQueryClient: (context: InteractionContext, options?: { |
@@ -11,5 +11,75 @@ "use strict"; | ||
const { socket } = context; | ||
const point = (options === null || options === void 0 ? void 0 : options.point) !== undefined ? options.point : await util_1.createPointFromCurrentTip(context); | ||
return new Promise((resolve, reject) => { | ||
const requestId = nanoid_1.nanoid(5); | ||
const requestId = (0, nanoid_1.nanoid)(5); | ||
const createClient = () => resolve({ | ||
context, | ||
async acquire(point) { | ||
const client = await (0, exports.createStateQueryClient)(context, { point }); | ||
return Object.assign(this, client); | ||
}, | ||
shutdown: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return new Promise((resolve, reject) => { | ||
socket.once('close', () => resolve()); | ||
socket.once('error', e => reject(new errors_1.UnknownResultError(e))); | ||
socket.close(); | ||
}); | ||
}, | ||
currentEpoch: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.currentEpoch)(context); | ||
}, | ||
currentProtocolParameters: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.currentProtocolParameters)(context); | ||
}, | ||
delegationsAndRewards: (stakeKeyHashes) => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.delegationsAndRewards)(context, stakeKeyHashes); | ||
}, | ||
eraStart: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.eraStart)(context); | ||
}, | ||
genesisConfig: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.genesisConfig)(context); | ||
}, | ||
ledgerTip: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.ledgerTip)(context); | ||
}, | ||
nonMyopicMemberRewards: (input) => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.nonMyopicMemberRewards)(context, input); | ||
}, | ||
poolIds: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.poolIds)(context); | ||
}, | ||
poolParameters: (pools) => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.poolParameters)(context, pools); | ||
}, | ||
poolsRanking: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.poolsRanking)(context); | ||
}, | ||
proposedProtocolParameters: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.proposedProtocolParameters)(context); | ||
}, | ||
rewardsProvenance: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.rewardsProvenance)(context); | ||
}, | ||
stakeDistribution: () => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.stakeDistribution)(context); | ||
}, | ||
utxo: (filters) => { | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, queries_1.utxo)(context, filters); | ||
} | ||
}); | ||
socket.once('message', (message) => { | ||
@@ -21,68 +91,3 @@ const response = util_1.safeJSON.parse(message); | ||
if ('AcquireSuccess' in response.result) { | ||
return resolve({ | ||
context, | ||
currentEpoch: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.currentEpoch(context); | ||
}, | ||
currentProtocolParameters: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.currentProtocolParameters(context); | ||
}, | ||
delegationsAndRewards: (stakeKeyHashes) => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.delegationsAndRewards(context, stakeKeyHashes); | ||
}, | ||
eraStart: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.eraStart(context); | ||
}, | ||
genesisConfig: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.genesisConfig(context); | ||
}, | ||
ledgerTip: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.ledgerTip(context); | ||
}, | ||
nonMyopicMemberRewards: (input) => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.nonMyopicMemberRewards(context, input); | ||
}, | ||
point, | ||
proposedProtocolParameters: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.proposedProtocolParameters(context); | ||
}, | ||
shutdown: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return new Promise((resolve, reject) => { | ||
const releaseRequestId = nanoid_1.nanoid(5); | ||
socket.once('message', (message) => { | ||
socket.once('close', () => { | ||
const response = util_1.safeJSON.parse(message); | ||
if (response.reflection.requestId !== releaseRequestId) { | ||
return; | ||
} | ||
if (response.result === 'Released') { | ||
resolve(); | ||
} | ||
else { | ||
reject(new errors_1.UnknownResultError(response.result)); | ||
} | ||
}); | ||
socket.close(); | ||
}); | ||
socket.send(util_1.safeJSON.stringify(Object.assign(Object.assign({}, Request_1.baseRequest), { methodname: 'Release', mirror: { requestId: releaseRequestId } }))); | ||
}); | ||
}, | ||
stakeDistribution: () => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.stakeDistribution(context); | ||
}, | ||
utxo: (addresses) => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return queries_1.utxo(context, addresses); | ||
} | ||
}); | ||
createClient(); | ||
} | ||
@@ -112,3 +117,9 @@ else { | ||
}); | ||
socket.send(util_1.safeJSON.stringify(Object.assign(Object.assign({}, Request_1.baseRequest), { methodname: 'Acquire', args: { point }, mirror: { requestId } }))); | ||
if ((options === null || options === void 0 ? void 0 : options.point) !== undefined) { | ||
const point = options === null || options === void 0 ? void 0 : options.point; | ||
socket.send(util_1.safeJSON.stringify(Object.assign(Object.assign({}, Request_1.baseRequest), { methodname: 'Acquire', args: { point }, mirror: { requestId } }))); | ||
} | ||
else { | ||
createClient(); | ||
} | ||
}); | ||
@@ -115,0 +126,0 @@ }; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="node" /> | ||
import { AddressAttributesTooLarge, AlreadyDelegating, BadInputs, CollateralHasNonAdaAssets, CollateralIsScript, CollateralTooSmall, CollectErrors, DelegateNotRegistered, DuplicateGenesisVrf, ExecutionUnitsTooLarge, ExpiredUtxo, ExtraDataMismatch, ExtraRedeemers, FeeTooSmall, InsufficientFundsForMir, InsufficientGenesisSignatures, InvalidMetadata, InvalidWitnesses, MirNegativeTransferNotCurrentlyAllowed, MirProducesNegativeUpdate, MirTransferNotCurrentlyAllowed, MissingAtLeastOneInputUtxo, MissingCollateralInputs, MissingDatumHashesForInputs, MissingRequiredDatums, MissingRequiredSignatures, MissingScriptWitnesses, MissingTxMetadata, MissingTxMetadataHash, MissingVkWitnesses, NetworkMismatch, NonGenesisVoters, OutputTooSmall, OutsideForecast, OutsideOfValidityInterval, PoolCostTooSmall, PoolMetadataHashTooBig, ProtocolVersionCannotFollow, RewardAccountNotEmpty, RewardAccountNotExisting, ScriptWitnessNotValidating, StakeKeyAlreadyRegistered, StakeKeyNotRegistered, StakePoolNotRegistered, TooLateForMir, TooManyAssetsInOutput, TooManyCollateralInputs, TriesToForgeAda, TxMetadataHashMismatch, TxTooLarge, UnknownGenesisKey, UnknownOrIncompleteWithdrawals, UnredeemableScripts, UnspendableDatums, UnspendableScriptInputs, UpdateWrongEpoch, ValidationTagMismatch, ValueNotConserved, WrongCertificateType, WrongPoolCertificate, WrongRetirementEpoch } from '@cardano-ogmios/schema'; | ||
export declare type SubmitTxErrorShelley = AddressAttributesTooLarge | AlreadyDelegating | BadInputs | CollateralHasNonAdaAssets | CollateralIsScript | CollateralTooSmall | CollectErrors | DelegateNotRegistered | DuplicateGenesisVrf | ExecutionUnitsTooLarge | ExpiredUtxo | ExtraDataMismatch | ExtraRedeemers | FeeTooSmall | InsufficientFundsForMir | InsufficientGenesisSignatures | InvalidMetadata | InvalidWitnesses | MirNegativeTransferNotCurrentlyAllowed | MirProducesNegativeUpdate | MirTransferNotCurrentlyAllowed | MissingAtLeastOneInputUtxo | MissingCollateralInputs | MissingDatumHashesForInputs | MissingRequiredDatums | MissingRequiredSignatures | MissingScriptWitnesses | MissingTxMetadata | MissingTxMetadataHash | MissingVkWitnesses | NetworkMismatch | NonGenesisVoters | OutputTooSmall | OutsideForecast | OutsideOfValidityInterval | PoolCostTooSmall | PoolMetadataHashTooBig | ProtocolVersionCannotFollow | RewardAccountNotEmpty | RewardAccountNotExisting | ScriptWitnessNotValidating | StakeKeyAlreadyRegistered | StakeKeyNotRegistered | StakePoolNotRegistered | TooLateForMir | TooManyAssetsInOutput | TooManyCollateralInputs | TriesToForgeAda | TxMetadataHashMismatch | TxTooLarge | UnknownGenesisKey | UnknownOrIncompleteWithdrawals | UnredeemableScripts | UnspendableDatums | UnspendableScriptInputs | UpdateWrongEpoch | ValidationTagMismatch | ValueNotConserved | WrongCertificateType | WrongPoolCertificate | WrongRetirementEpoch; | ||
import { AddressAttributesTooLarge, AlreadyDelegating, BadInputs, CollateralHasNonAdaAssets, CollateralIsScript, CollateralTooSmall, CollectErrors, DelegateNotRegistered, DuplicateGenesisVrf, ExecutionUnitsTooLarge, ExpiredUtxo, ExtraDataMismatch, ExtraRedeemers, FeeTooSmall, InsufficientFundsForMir, InsufficientGenesisSignatures, InvalidMetadata, InvalidWitnesses, MirNegativeTransferNotCurrentlyAllowed, MirProducesNegativeUpdate, MirTransferNotCurrentlyAllowed, MissingAtLeastOneInputUtxo, MissingCollateralInputs, MissingDatumHashesForInputs, MissingRequiredDatums, MissingRequiredRedeemers, MissingRequiredSignatures, MissingScriptWitnesses, MissingTxMetadata, MissingTxMetadataHash, MissingVkWitnesses, NetworkMismatch, NonGenesisVoters, OutputTooSmall, OutsideForecast, OutsideOfValidityInterval, PoolCostTooSmall, PoolMetadataHashTooBig, ProtocolVersionCannotFollow, RewardAccountNotEmpty, RewardAccountNotExisting, ScriptWitnessNotValidating, StakeKeyAlreadyRegistered, StakeKeyNotRegistered, StakePoolNotRegistered, TooLateForMir, TooManyAssetsInOutput, TooManyCollateralInputs, TriesToForgeAda, TxMetadataHashMismatch, TxTooLarge, UnknownGenesisKey, UnknownOrIncompleteWithdrawals, UnspendableDatums, UnspendableScriptInputs, UpdateWrongEpoch, ValidationTagMismatch, ValueNotConserved, WrongCertificateType, WrongPoolCertificate, WrongRetirementEpoch } from '@cardano-ogmios/schema'; | ||
export declare type SubmitTxErrorShelley = AddressAttributesTooLarge | AlreadyDelegating | BadInputs | CollateralHasNonAdaAssets | CollateralIsScript | CollateralTooSmall | CollectErrors | DelegateNotRegistered | DuplicateGenesisVrf | ExecutionUnitsTooLarge | ExpiredUtxo | ExtraDataMismatch | ExtraRedeemers | FeeTooSmall | InsufficientFundsForMir | InsufficientGenesisSignatures | InvalidMetadata | InvalidWitnesses | MirNegativeTransferNotCurrentlyAllowed | MirProducesNegativeUpdate | MirTransferNotCurrentlyAllowed | MissingAtLeastOneInputUtxo | MissingCollateralInputs | MissingDatumHashesForInputs | MissingRequiredDatums | MissingRequiredRedeemers | MissingRequiredSignatures | MissingScriptWitnesses | MissingTxMetadata | MissingTxMetadataHash | MissingVkWitnesses | NetworkMismatch | NonGenesisVoters | OutputTooSmall | OutsideForecast | OutsideOfValidityInterval | PoolCostTooSmall | PoolMetadataHashTooBig | ProtocolVersionCannotFollow | RewardAccountNotEmpty | RewardAccountNotExisting | ScriptWitnessNotValidating | StakeKeyAlreadyRegistered | StakeKeyNotRegistered | StakePoolNotRegistered | TooLateForMir | TooManyAssetsInOutput | TooManyCollateralInputs | TriesToForgeAda | TxMetadataHashMismatch | TxTooLarge | UnknownGenesisKey | UnknownOrIncompleteWithdrawals | UnspendableDatums | UnspendableScriptInputs | UpdateWrongEpoch | ValidationTagMismatch | ValueNotConserved | WrongCertificateType | WrongPoolCertificate | WrongRetirementEpoch; | ||
export declare const errors: { | ||
@@ -564,6 +563,6 @@ InvalidWitnesses: { | ||
}; | ||
UnredeemableScripts: { | ||
assert: (item: SubmitTxErrorShelley) => item is UnredeemableScripts; | ||
MissingRequiredRedeemers: { | ||
assert: (item: SubmitTxErrorShelley) => item is MissingRequiredRedeemers; | ||
Error: { | ||
new (rawError: UnredeemableScripts): { | ||
new (rawError: MissingRequiredRedeemers): { | ||
name: string; | ||
@@ -570,0 +569,0 @@ message: string; |
@@ -394,8 +394,8 @@ "use strict"; | ||
}, | ||
UnredeemableScripts: { | ||
assert: (item) => item.unredeemableScripts !== undefined, | ||
Error: class UnredeemableScriptsError extends ts_custom_error_1.CustomError { | ||
MissingRequiredRedeemers: { | ||
assert: (item) => item.missingRequiredRedeemers !== undefined, | ||
Error: class MissingRequiredRedeemersError extends ts_custom_error_1.CustomError { | ||
constructor(rawError) { | ||
super(); | ||
this.message = util_1.safeJSON.stringify(rawError.unredeemableScripts); | ||
this.message = util_1.safeJSON.stringify(rawError.missingRequiredRedeemers); | ||
} | ||
@@ -402,0 +402,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
const isEraMismatch = (item) => item.eraMismatch !== undefined; | ||
const submitTx = (context, bytes) => StateQuery_1.Query({ | ||
const submitTx = (context, bytes) => (0, StateQuery_1.Query)({ | ||
methodName: 'SubmitTx', | ||
@@ -156,4 +156,4 @@ args: { bytes } | ||
} | ||
else if (errors_2.errors.UnredeemableScripts.assert(failure)) { | ||
return new errors_2.errors.UnredeemableScripts.Error(failure); | ||
else if (errors_2.errors.MissingRequiredRedeemers.assert(failure)) { | ||
return new errors_2.errors.MissingRequiredRedeemers.Error(failure); | ||
} | ||
@@ -160,0 +160,0 @@ else if (errors_2.errors.ExtraDataMismatch.assert(failure)) { |
@@ -11,7 +11,7 @@ "use strict"; | ||
submitTx: (bytes) => { | ||
util_1.ensureSocketIsOpen(socket); | ||
return submitTx_1.submitTx(context, bytes); | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
return (0, submitTx_1.submitTx)(context, bytes); | ||
}, | ||
shutdown: () => new Promise(resolve => { | ||
util_1.ensureSocketIsOpen(socket); | ||
(0, util_1.ensureSocketIsOpen)(socket); | ||
socket.once('close', resolve); | ||
@@ -18,0 +18,0 @@ socket.close(); |
import { WebSocket } from './IsomorphicWebSocket'; | ||
import { InteractionContext } from './Connection'; | ||
import { Block, BlockAllegra, BlockByron, BlockMary, BlockShelley, Point } from '@cardano-ogmios/schema'; | ||
import { Block, BlockAllegra, BlockAlonzo, BlockByron, BlockMary, BlockShelley, Point } from '@cardano-ogmios/schema'; | ||
export declare const safeJSON: { | ||
@@ -21,2 +21,5 @@ $: { | ||
}; | ||
export declare const isAlonzoBlock: (block: Block) => block is { | ||
alonzo: BlockAlonzo; | ||
}; | ||
export declare const isByronBlock: (block: Block) => block is { | ||
@@ -23,0 +26,0 @@ byron: BlockByron; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEmptyObject = exports.isShelleyBlock = exports.isMaryBlock = exports.isByronBlock = exports.isAllegraBlock = exports.ensureSocketIsOpen = exports.createPointFromCurrentTip = exports.safeJSON = void 0; | ||
exports.isEmptyObject = exports.isShelleyBlock = exports.isMaryBlock = exports.isByronBlock = exports.isAlonzoBlock = exports.isAllegraBlock = exports.ensureSocketIsOpen = exports.createPointFromCurrentTip = exports.safeJSON = void 0; | ||
const ChainSync_1 = require("./ChainSync"); | ||
@@ -12,3 +12,3 @@ const errors_1 = require("./errors"); | ||
exports.safeJSON = { | ||
$: json_bigint_1.default({ useNativeBigInt: true }), | ||
$: (0, json_bigint_1.default)({ useNativeBigInt: true }), | ||
sanitize(json) { | ||
@@ -49,3 +49,3 @@ if (typeof json === 'object' && json !== null) { | ||
const createPointFromCurrentTip = async (context) => { | ||
const { tip } = await ChainSync_1.findIntersect(context, ['origin']); | ||
const { tip } = await (0, ChainSync_1.findIntersect)(context, ['origin']); | ||
if (tip === 'origin') { | ||
@@ -68,2 +68,4 @@ throw new errors_1.TipIsOriginError(); | ||
exports.isAllegraBlock = isAllegraBlock; | ||
const isAlonzoBlock = (block) => block.alonzo !== undefined; | ||
exports.isAlonzoBlock = isAlonzoBlock; | ||
const isByronBlock = (block) => block.byron !== undefined; | ||
@@ -70,0 +72,0 @@ exports.isByronBlock = isByronBlock; |
{ | ||
"name": "@cardano-ogmios/client", | ||
"version": "4.0.0-beta.9", | ||
"version": "4.0.0", | ||
"description": "TypeScript client library for Cardano Ogmios", | ||
@@ -54,3 +54,3 @@ "engines": { | ||
"dependencies": { | ||
"@cardano-ogmios/schema": "4.0.0-beta.9", | ||
"@cardano-ogmios/schema": "4.0.0", | ||
"@types/json-bigint": "^1.0.1", | ||
@@ -60,3 +60,3 @@ "cross-fetch": "^3.1.4", | ||
"isomorphic-ws": "^4.0.1", | ||
"json-bigint": "^1.0.0", | ||
"json-bigint": "CardanoSolutions/json-bigint#d277387d", | ||
"nanoid": "^3.1.22", | ||
@@ -63,0 +63,0 @@ "ts-custom-error": "^3.2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
253215
175
3096
1
1
1
+ Added@cardano-ogmios/schema@4.0.0(transitive)
- Removed@cardano-ogmios/schema@4.0.0-beta.9(transitive)
- Removedbignumber.js@9.1.2(transitive)
- Removedjson-bigint@1.0.0(transitive)
Updated@cardano-ogmios/schema@4.0.0