Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rosen-chains/cardano

Package Overview
Dependencies
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rosen-chains/cardano - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

5

dist/lib/CardanoChain.d.ts

@@ -133,4 +133,9 @@ import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';

PaymentTransactionFromJson: (jsonString: string) => CardanoTransaction;
/**
* generates transaction builder config using protocol params
* @returns TransactionBuilderConfig
*/
protected getTxBuilderConfig: () => Promise<CardanoWasm.TransactionBuilderConfig>;
}
export default CardanoChain;
//# sourceMappingURL=CardanoChain.d.ts.map

4

dist/lib/constants.d.ts

@@ -1,6 +0,4 @@

import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
declare const CARDANO_CHAIN = "cardano";
declare const ADA = "ada";
declare const txBuilderConfig: CardanoWasm.TransactionBuilderConfig;
export { txBuilderConfig, CARDANO_CHAIN, ADA };
export { CARDANO_CHAIN, ADA };
//# sourceMappingURL=constants.d.ts.map

@@ -1,23 +0,4 @@

import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
const CARDANO_CHAIN = 'cardano';
const ADA = 'ada';
const protocolParameters = {
minFeeA: CardanoWasm.BigNum.from_str('44'),
minFeeB: CardanoWasm.BigNum.from_str('155381'),
poolDeposit: CardanoWasm.BigNum.from_str('500000000'),
keyDeposit: CardanoWasm.BigNum.from_str('2000000'),
maxValueSize: 4000,
maxTxSize: 8000,
coinsPerUtxoWord: CardanoWasm.BigNum.from_str('34482'),
};
const linearFee = CardanoWasm.LinearFee.new(protocolParameters.minFeeA, protocolParameters.minFeeB);
const txBuilderConfig = CardanoWasm.TransactionBuilderConfigBuilder.new()
.fee_algo(linearFee)
.pool_deposit(protocolParameters.poolDeposit)
.key_deposit(protocolParameters.keyDeposit)
.max_value_size(protocolParameters.maxValueSize)
.max_tx_size(protocolParameters.maxTxSize)
.coins_per_utxo_word(protocolParameters.coinsPerUtxoWord)
.build();
export { txBuilderConfig, CARDANO_CHAIN, ADA };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssV0FBVyxNQUFNLDBDQUEwQyxDQUFDO0FBRXhFLE1BQU0sYUFBYSxHQUFHLFNBQVMsQ0FBQztBQUNoQyxNQUFNLEdBQUcsR0FBRyxLQUFLLENBQUM7QUFFbEIsTUFBTSxrQkFBa0IsR0FBRztJQUN6QixPQUFPLEVBQUUsV0FBVyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDO0lBQzFDLE9BQU8sRUFBRSxXQUFXLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUM7SUFDOUMsV0FBVyxFQUFFLFdBQVcsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQztJQUNyRCxVQUFVLEVBQUUsV0FBVyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDO0lBQ2xELFlBQVksRUFBRSxJQUFJO0lBQ2xCLFNBQVMsRUFBRSxJQUFJO0lBQ2YsZ0JBQWdCLEVBQUUsV0FBVyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFDO0NBQ3ZELENBQUM7QUFFRixNQUFNLFNBQVMsR0FBRyxXQUFXLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FDekMsa0JBQWtCLENBQUMsT0FBTyxFQUMxQixrQkFBa0IsQ0FBQyxPQUFPLENBQzNCLENBQUM7QUFFRixNQUFNLGVBQWUsR0FDbkIsV0FB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O0FBRWxCLE9BQU8sRUFBRSxhQUFhLEVBQUUsR0FBRyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJjb25zdCBDQVJEQU5PX0NIQUlOID0gJ2NhcmRhbm8nO1xuY29uc3QgQURBID0gJ2FkYSc7XG5cbmV4cG9ydCB7IENBUkRBTk9fQ0hBSU4sIEFEQSB9O1xuIl19
import { AbstractUtxoChainNetwork } from '@rosen-chains/abstract-chain';
import { CardanoTx, CardanoUtxo } from '../types';
import { CardanoProtocolParameters, CardanoTx, CardanoUtxo } from '../types';
import { CardanoRosenExtractor } from '@rosen-bridge/rosen-extractor';

@@ -23,4 +23,9 @@ import { Transaction } from '@emurgo/cardano-serialization-lib-nodejs';

abstract getUtxo: (boxId: string) => Promise<CardanoUtxo>;
/**
* gets required parameters of Cardano Protocol
* @returns an object containing required protocol parameters
*/
abstract getProtocolParameters: () => Promise<CardanoProtocolParameters>;
}
export default AbstractCardanoNetwork;
//# sourceMappingURL=AbstractCardanoNetwork.d.ts.map

@@ -5,2 +5,2 @@ import { AbstractUtxoChainNetwork } from '@rosen-chains/abstract-chain';

export default AbstractCardanoNetwork;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWJzdHJhY3RDYXJkYW5vTmV0d29yay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9uZXR3b3JrL0Fic3RyYWN0Q2FyZGFub05ldHdvcmsudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFLeEUsTUFBZSxzQkFBdUIsU0FBUSx3QkFHN0M7Q0FxQkE7QUFFRCxlQUFlLHNCQUFzQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQWJzdHJhY3RVdHhvQ2hhaW5OZXR3b3JrIH0gZnJvbSAnQHJvc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IGdldFByb3RvY29sUGFyYW1ldGVyczogKCkgPT4gUHJvbWlzZTxDYXJkYW5vUHJvdG9jb2xQYXJhbWV0ZXJzPjtcbn1cblxuZXhwb3J0IGRlZmF1bHQgQWJzdHJhY3RDYXJkYW5vTmV0d29yaztcbiJdfQ==

@@ -43,3 +43,12 @@ import { ChainConfigs, PaymentTransactionJsonModel } from '@rosen-chains/abstract-chain';

}
export { CardanoConfigs, CardanoAsset, CardanoAssetInfo, CardanoUtxo, CardanoBoxCandidate, CardanoTx, UtxoBoxesAssets, CardanoTransactionJsonModel, };
interface CardanoProtocolParameters {
minFeeA: number;
minFeeB: number;
poolDeposit: string;
keyDeposit: string;
maxValueSize: number;
maxTxSize: number;
coinsPerUtxoSize: string;
}
export { CardanoConfigs, CardanoAsset, CardanoAssetInfo, CardanoUtxo, CardanoBoxCandidate, CardanoTx, UtxoBoxesAssets, CardanoTransactionJsonModel, CardanoProtocolParameters, };
//# sourceMappingURL=types.d.ts.map
export {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9saWIvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7XG4gIENoYWluQ29uZmlncyxcbiAgUGF5bWVudFRyYW5zYWN0aW9uSnNvbk1vZGVsLFxufSBmcm9tICdAcm9zZW4tY2hhaW5zL2Fic3RyYWN0LWNoYWluJztcbmltcG9ydCB7IEJpZ051bSB9IGZyb20gJ0BlbXVyZ28vY2FyZGFuby1zZXJpYWxpemF0aW9uLWxpYi1ub2RlanMnO1xuXG5pbnRlcmZhY2UgQ2FyZGFub0NvbmZpZ3MgZXh0ZW5kcyBDaGFpbkNvbmZpZ3Mge1xuICBtaW5Cb3hWYWx1ZTogYmlnaW50O1xuICB0eFR0bDogbnVtYmVyO1xuICBhZ2dyZWdh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jb2luc1BlclV0eG9TaXplOiBzdHJpbmc7XG59XG5cbmV4cG9ydCB7XG4gIENhcmRhbm9Db25maWdzLFxuICBDYXJkYW5vQXNzZXQsXG4gIENhcmRhbm9Bc3NldEluZm8sXG4gIENhcmRhbm9VdHhvLFxuICBDYXJkYW5vQm94Q2FuZGlkYXRlLFxuICBDYXJkYW5vVHgsXG4gIFV0eG9Cb3hlc0Fzc2V0cyxcbiAgQ2FyZGFub1RyYW5zYWN0aW9uSnNvbk1vZGVsLFxuICBDYXJkYW5vUHJvdG9jb2xQYXJhbWV0ZXJzLFxufTtcbiJdfQ==

@@ -34,3 +34,3 @@ import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';

import cardanoUtils from './CardanoUtils';
import { CARDANO_CHAIN, txBuilderConfig } from './constants';
import { CARDANO_CHAIN } from './constants';
import AbstractCardanoNetwork from './network/AbstractCardanoNetwork';

@@ -163,3 +163,5 @@ import Serializer from './Serializer';

const txBuilder = CardanoWasm.TransactionBuilder.new(txBuilderConfig);
const txBuilder = CardanoWasm.TransactionBuilder.new(
await this.getTxBuilderConfig()
);
let orderValue = BigNum.zero();

@@ -782,4 +784,29 @@ const orderAssets: Map<string, bigint> = new Map();

CardanoTransaction.fromJson(jsonString);
/**
* generates transaction builder config using protocol params
* @returns TransactionBuilderConfig
*/
protected getTxBuilderConfig =
async (): Promise<CardanoWasm.TransactionBuilderConfig> => {
const params = await this.network.getProtocolParameters();
return CardanoWasm.TransactionBuilderConfigBuilder.new()
.fee_algo(
CardanoWasm.LinearFee.new(
CardanoWasm.BigNum.from_str(params.minFeeA.toString()),
CardanoWasm.BigNum.from_str(params.minFeeB.toString())
)
)
.pool_deposit(CardanoWasm.BigNum.from_str(params.poolDeposit))
.key_deposit(CardanoWasm.BigNum.from_str(params.keyDeposit))
.coins_per_utxo_byte(
CardanoWasm.BigNum.from_str(params.coinsPerUtxoSize)
)
.max_value_size(params.maxValueSize)
.max_tx_size(params.maxTxSize)
.prefer_pure_change(true)
.build();
};
}
export default CardanoChain;

@@ -1,31 +0,4 @@

import * as CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs';
const CARDANO_CHAIN = 'cardano';
const ADA = 'ada';
const protocolParameters = {
minFeeA: CardanoWasm.BigNum.from_str('44'),
minFeeB: CardanoWasm.BigNum.from_str('155381'),
poolDeposit: CardanoWasm.BigNum.from_str('500000000'),
keyDeposit: CardanoWasm.BigNum.from_str('2000000'),
maxValueSize: 4000,
maxTxSize: 8000,
coinsPerUtxoWord: CardanoWasm.BigNum.from_str('34482'),
};
const linearFee = CardanoWasm.LinearFee.new(
protocolParameters.minFeeA,
protocolParameters.minFeeB
);
const txBuilderConfig: CardanoWasm.TransactionBuilderConfig =
CardanoWasm.TransactionBuilderConfigBuilder.new()
.fee_algo(linearFee)
.pool_deposit(protocolParameters.poolDeposit)
.key_deposit(protocolParameters.keyDeposit)
.max_value_size(protocolParameters.maxValueSize)
.max_tx_size(protocolParameters.maxTxSize)
.coins_per_utxo_word(protocolParameters.coinsPerUtxoWord)
.build();
export { txBuilderConfig, CARDANO_CHAIN, ADA };
export { CARDANO_CHAIN, ADA };
import { AbstractUtxoChainNetwork } from '@rosen-chains/abstract-chain';
import { CardanoTx, CardanoUtxo } from '../types';
import { CardanoProtocolParameters, CardanoTx, CardanoUtxo } from '../types';
import { CardanoRosenExtractor } from '@rosen-bridge/rosen-extractor';

@@ -30,4 +30,10 @@ import { Transaction } from '@emurgo/cardano-serialization-lib-nodejs';

abstract getUtxo: (boxId: string) => Promise<CardanoUtxo>;
/**
* gets required parameters of Cardano Protocol
* @returns an object containing required protocol parameters
*/
abstract getProtocolParameters: () => Promise<CardanoProtocolParameters>;
}
export default AbstractCardanoNetwork;

@@ -55,2 +55,12 @@ import {

interface CardanoProtocolParameters {
minFeeA: number;
minFeeB: number;
poolDeposit: string;
keyDeposit: string;
maxValueSize: number;
maxTxSize: number;
coinsPerUtxoSize: string;
}
export {

@@ -65,2 +75,3 @@ CardanoConfigs,

CardanoTransactionJsonModel,
CardanoProtocolParameters,
};
{
"name": "@rosen-chains/cardano",
"version": "2.2.1",
"version": "2.3.0",
"description": "this project contains cardano chain for Rosen-bridge",

@@ -5,0 +5,0 @@ "main": "dist/lib/index.js",

import { AbstractCardanoNetwork } from '../../lib';
import { BlockInfo, ConfirmationStatus } from '@rosen-chains/abstract-chain';
import { CardanoTx, CardanoUtxo } from '../../lib/types';
import {
CardanoProtocolParameters,
CardanoTx,
CardanoUtxo,
} from '../../lib/types';
import { CardanoRosenExtractor } from '@rosen-bridge/rosen-extractor';
import { protocolParameters } from '../testUtils';

@@ -64,4 +69,7 @@ class TestCardanoNetwork extends AbstractCardanoNetwork {

};
getProtocolParameters = (): Promise<CardanoProtocolParameters> =>
Promise.resolve(protocolParameters);
}
export default TestCardanoNetwork;

@@ -118,1 +118,11 @@ import { randomBytes } from 'crypto';

export const generateRandomId = (): string => randomBytes(32).toString('hex');
export const protocolParameters = {
minFeeA: 44,
minFeeB: 155381,
poolDeposit: '500000000',
keyDeposit: '2000000',
maxValueSize: 4000,
maxTxSize: 8000,
coinsPerUtxoSize: '4311',
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc