@lucid-evolution/provider 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -45,7 +45,7 @@ var import_utils = require("@lucid-evolution/utils");
45
45
  // package.json
46
46
  var package_default = {
47
47
  name: "@lucid-evolution/provider",
48
- version: "0.1.6",
48
+ version: "0.1.7",
49
49
  description: "",
50
50
  main: "./dist/index.js",
51
51
  types: "./dist/index.d.ts",
@@ -359,9 +359,7 @@ var Kupmios = class {
359
359
  this.ogmiosUrl = ogmiosUrl;
360
360
  }
361
361
  async getProtocolParameters() {
362
- const client = await this.ogmiosWsp("Query", {
363
- query: "currentProtocolParameters"
364
- });
362
+ const client = await this.ogmiosWsp("queryLedgerState/protocolParameters");
365
363
  return new Promise((res, rej) => {
366
364
  client.addEventListener(
367
365
  "message",
@@ -369,27 +367,30 @@ var Kupmios = class {
369
367
  try {
370
368
  const { result } = JSON.parse(msg.data);
371
369
  const costModels = {};
372
- Object.keys(result.costModels).forEach((v) => {
370
+ Object.keys(result.plutusCostModels).forEach((v) => {
373
371
  const version = v.split(":")[1].toUpperCase();
374
372
  const plutusVersion = "Plutus" + version;
375
- costModels[plutusVersion] = result.costModels[v];
373
+ costModels[plutusVersion] = result.plutusCostModels[v];
376
374
  });
377
- const [memNum, memDenom] = result.prices.memory.split("/");
378
- const [stepsNum, stepsDenom] = result.prices.steps.split("/");
375
+ const [memNum, memDenom] = result.scriptExecutionPrices.memory.split("/");
376
+ const [stepsNum, stepsDenom] = result.scriptExecutionPrices.cpu.split("/");
379
377
  res({
380
378
  minFeeA: parseInt(result.minFeeCoefficient),
381
- minFeeB: parseInt(result.minFeeConstant),
379
+ minFeeB: parseInt(result.minFeeConstant.ada.lovelace),
382
380
  maxTxSize: parseInt(result.maxTxSize),
383
381
  maxValSize: parseInt(result.maxValueSize),
384
- keyDeposit: BigInt(result.stakeKeyDeposit),
385
- poolDeposit: BigInt(result.poolDeposit),
382
+ keyDeposit: BigInt(result.stakeCredentialDeposit.ada.lovelace),
383
+ poolDeposit: BigInt(result.stakePoolDeposit.ada.lovelace),
386
384
  priceMem: parseInt(memNum) / parseInt(memDenom),
387
385
  priceStep: parseInt(stepsNum) / parseInt(stepsDenom),
388
386
  maxTxExMem: BigInt(result.maxExecutionUnitsPerTransaction.memory),
389
- maxTxExSteps: BigInt(
390
- result.maxExecutionUnitsPerTransaction.steps
391
- ),
392
- coinsPerUtxoByte: BigInt(result.coinsPerUtxoByte),
387
+ maxTxExSteps: BigInt(result.maxExecutionUnitsPerTransaction.cpu),
388
+ // NOTE: coinsPerUtxoByte is now called utxoCostPerByte:
389
+ // https://github.com/IntersectMBO/cardano-node/pull/4141
390
+ // Ogmios v6.x calls it minUtxoDepositCoefficient according to the following
391
+ // documentation from its protocol parameters data model:
392
+ // https://github.com/CardanoSolutions/ogmios/blob/master/architectural-decisions/accepted/017-api-version-6-major-rewrite.md#protocol-parameters
393
+ coinsPerUtxoByte: BigInt(result.minUtxoDepositCoefficient),
393
394
  collateralPercentage: parseInt(result.collateralPercentage),
394
395
  maxCollateralInputs: parseInt(result.maxCollateralInputs),
395
396
  costModels
@@ -555,18 +556,17 @@ var Kupmios = class {
555
556
  })
556
557
  );
557
558
  }
558
- async ogmiosWsp(methodname, args) {
559
+ async ogmiosWsp(method, params = {}, id) {
559
560
  const client = new WebSocket(this.ogmiosUrl);
560
561
  await new Promise((res) => {
561
562
  client.addEventListener("open", () => res(1), { once: true });
562
563
  });
563
564
  client.send(
564
565
  JSON.stringify({
565
- type: "jsonwsp/request",
566
- version: "1.0",
567
- servicename: "ogmios",
568
- methodname,
569
- args
566
+ jsonrpc: "2.0",
567
+ method,
568
+ params,
569
+ id
570
570
  })
571
571
  );
572
572
  return client;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { applyDoubleCborEncoding } from "@lucid-evolution/utils";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@lucid-evolution/provider",
9
- version: "0.1.6",
9
+ version: "0.1.7",
10
10
  description: "",
11
11
  main: "./dist/index.js",
12
12
  types: "./dist/index.d.ts",
@@ -320,9 +320,7 @@ var Kupmios = class {
320
320
  this.ogmiosUrl = ogmiosUrl;
321
321
  }
322
322
  async getProtocolParameters() {
323
- const client = await this.ogmiosWsp("Query", {
324
- query: "currentProtocolParameters"
325
- });
323
+ const client = await this.ogmiosWsp("queryLedgerState/protocolParameters");
326
324
  return new Promise((res, rej) => {
327
325
  client.addEventListener(
328
326
  "message",
@@ -330,27 +328,30 @@ var Kupmios = class {
330
328
  try {
331
329
  const { result } = JSON.parse(msg.data);
332
330
  const costModels = {};
333
- Object.keys(result.costModels).forEach((v) => {
331
+ Object.keys(result.plutusCostModels).forEach((v) => {
334
332
  const version = v.split(":")[1].toUpperCase();
335
333
  const plutusVersion = "Plutus" + version;
336
- costModels[plutusVersion] = result.costModels[v];
334
+ costModels[plutusVersion] = result.plutusCostModels[v];
337
335
  });
338
- const [memNum, memDenom] = result.prices.memory.split("/");
339
- const [stepsNum, stepsDenom] = result.prices.steps.split("/");
336
+ const [memNum, memDenom] = result.scriptExecutionPrices.memory.split("/");
337
+ const [stepsNum, stepsDenom] = result.scriptExecutionPrices.cpu.split("/");
340
338
  res({
341
339
  minFeeA: parseInt(result.minFeeCoefficient),
342
- minFeeB: parseInt(result.minFeeConstant),
340
+ minFeeB: parseInt(result.minFeeConstant.ada.lovelace),
343
341
  maxTxSize: parseInt(result.maxTxSize),
344
342
  maxValSize: parseInt(result.maxValueSize),
345
- keyDeposit: BigInt(result.stakeKeyDeposit),
346
- poolDeposit: BigInt(result.poolDeposit),
343
+ keyDeposit: BigInt(result.stakeCredentialDeposit.ada.lovelace),
344
+ poolDeposit: BigInt(result.stakePoolDeposit.ada.lovelace),
347
345
  priceMem: parseInt(memNum) / parseInt(memDenom),
348
346
  priceStep: parseInt(stepsNum) / parseInt(stepsDenom),
349
347
  maxTxExMem: BigInt(result.maxExecutionUnitsPerTransaction.memory),
350
- maxTxExSteps: BigInt(
351
- result.maxExecutionUnitsPerTransaction.steps
352
- ),
353
- coinsPerUtxoByte: BigInt(result.coinsPerUtxoByte),
348
+ maxTxExSteps: BigInt(result.maxExecutionUnitsPerTransaction.cpu),
349
+ // NOTE: coinsPerUtxoByte is now called utxoCostPerByte:
350
+ // https://github.com/IntersectMBO/cardano-node/pull/4141
351
+ // Ogmios v6.x calls it minUtxoDepositCoefficient according to the following
352
+ // documentation from its protocol parameters data model:
353
+ // https://github.com/CardanoSolutions/ogmios/blob/master/architectural-decisions/accepted/017-api-version-6-major-rewrite.md#protocol-parameters
354
+ coinsPerUtxoByte: BigInt(result.minUtxoDepositCoefficient),
354
355
  collateralPercentage: parseInt(result.collateralPercentage),
355
356
  maxCollateralInputs: parseInt(result.maxCollateralInputs),
356
357
  costModels
@@ -516,18 +517,17 @@ var Kupmios = class {
516
517
  })
517
518
  );
518
519
  }
519
- async ogmiosWsp(methodname, args) {
520
+ async ogmiosWsp(method, params = {}, id) {
520
521
  const client = new WebSocket(this.ogmiosUrl);
521
522
  await new Promise((res) => {
522
523
  client.addEventListener("open", () => res(1), { once: true });
523
524
  });
524
525
  client.send(
525
526
  JSON.stringify({
526
- type: "jsonwsp/request",
527
- version: "1.0",
528
- servicename: "ogmios",
529
- methodname,
530
- args
527
+ jsonrpc: "2.0",
528
+ method,
529
+ params,
530
+ id
531
531
  })
532
532
  );
533
533
  return client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/provider",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",