New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@emurgo/yoroi-lib

Package Overview
Dependencies
Maintainers
0
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emurgo/yoroi-lib - npm Package Compare versions

Comparing version 0.15.6-alpha.2 to 0.15.6-alpha.3

1

dist/index.d.ts

@@ -12,2 +12,3 @@ import { BigNumber } from 'bignumber.js';

export * from './internals/tx';
export { DREP_ALWAYS_ABSTAIN, DREP_ALWAYS_NO_CONFIDENCE } from './internals/utils/transactions';
export * from './internals/plutus';

@@ -14,0 +15,0 @@ export * from './CIP30';

4

dist/internals/models.d.ts

@@ -16,3 +16,5 @@ import { BigNumber } from 'bignumber.js';

RegisterAndDelegate = 1,
Deregister = 2
Deregister = 2,
DelegateDrepOnly = 3,
RegisterAndDelegateDrep = 4
}

@@ -19,0 +21,0 @@ export declare const Bip44DerivationLevels: {

@@ -9,2 +9,4 @@ "use strict";

RegistrationStatus[RegistrationStatus["Deregister"] = 2] = "Deregister";
RegistrationStatus[RegistrationStatus["DelegateDrepOnly"] = 3] = "DelegateDrepOnly";
RegistrationStatus[RegistrationStatus["RegisterAndDelegateDrep"] = 4] = "RegisterAndDelegateDrep";
})(RegistrationStatus = exports.RegistrationStatus || (exports.RegistrationStatus = {}));

@@ -11,0 +13,0 @@ exports.Bip44DerivationLevels = {

/// <reference types="node" />
import * as WasmContract from '@emurgo/cross-csl-core';
import { Certificate, PublicKey } from '@emurgo/cross-csl-core';
import { AddressingAddress, CardanoAddressedUtxo, RegistrationStatus, RemoteUnspentOutput, Token } from '../models';
import { AddInputResult } from './index';
import { Certificate, PublicKey } from '@emurgo/cross-csl-core';
import { MultiToken } from '../multi-token';

@@ -22,3 +22,5 @@ import { CatalystRegistrationData } from "../tx";

export declare function isBigNumZero(wasm: WasmContract.WasmModuleProxy, b: WasmContract.BigNum): Promise<boolean>;
export declare function createDelegationCertificate(wasm: WasmContract.WasmModuleProxy, stakingKey: PublicKey, registrationStatus: RegistrationStatus, poolId: string | null): Promise<Array<Certificate>>;
export declare const DREP_ALWAYS_ABSTAIN = "ALWAYS_ABSTAIN";
export declare const DREP_ALWAYS_NO_CONFIDENCE = "ALWAYS_NO_CONFIDENCE";
export declare function createDelegationCertificate(wasm: WasmContract.WasmModuleProxy, stakingKey: PublicKey, registrationStatus: RegistrationStatus, poolOrDrepId: string | null, keyDeposit: string): Promise<Array<Certificate>>;
export declare function getDifferenceAfterTx(wasm: WasmContract.WasmModuleProxy, senderUtxos: CardanoAddressedUtxo[], txBody: WasmContract.TransactionBody, allUtxos: RemoteUnspentOutput[], stakingKey: PublicKey, defaultToken: Token): Promise<MultiToken>;

@@ -25,0 +27,0 @@ export declare const generateRegistrationMetadata: (wasm: WasmContract.WasmModuleProxy, votingPublicKeyHex: string, stakingPublicKeyHex: string, paymentAddress: string, nonce: number, useCIP36: boolean, signer: (hashedMetadata: Buffer) => Promise<string>) => Promise<WasmContract.AuxiliaryData>;

@@ -12,3 +12,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.buildLedgerCIP36Payload = exports.buildLedgerCIP15Payload = exports.generateRegistrationMetadata = exports.getDifferenceAfterTx = exports.createDelegationCertificate = exports.isBigNumZero = exports.cardanoValueFromRemoteFormat = exports.addUtxoInput = exports.minRequiredForChange = void 0;
exports.buildLedgerCIP36Payload = exports.buildLedgerCIP15Payload = exports.generateRegistrationMetadata = exports.getDifferenceAfterTx = exports.createDelegationCertificate = exports.DREP_ALWAYS_NO_CONFIDENCE = exports.DREP_ALWAYS_ABSTAIN = exports.isBigNumZero = exports.cardanoValueFromRemoteFormat = exports.addUtxoInput = exports.minRequiredForChange = void 0;
const models_1 = require("../models");

@@ -165,6 +165,17 @@ const addresses_1 = require("./addresses");

exports.isBigNumZero = isBigNumZero;
function createDelegationCertificate(wasm, stakingKey, registrationStatus, poolId) {
exports.DREP_ALWAYS_ABSTAIN = 'ALWAYS_ABSTAIN';
exports.DREP_ALWAYS_NO_CONFIDENCE = 'ALWAYS_NO_CONFIDENCE';
function parseDrep(wasm, drepId) {
return __awaiter(this, void 0, void 0, function* () {
if (drepId === exports.DREP_ALWAYS_ABSTAIN)
return wasm.DRep.newAlwaysAbstain();
if (drepId === exports.DREP_ALWAYS_NO_CONFIDENCE)
return wasm.DRep.newAlwaysNoConfidence();
return wasm.DRep.newKeyHash(yield wasm.Ed25519KeyHash.fromHex(drepId));
});
}
function createDelegationCertificate(wasm, stakingKey, registrationStatus, poolOrDrepId, keyDeposit) {
return __awaiter(this, void 0, void 0, function* () {
const credential = yield wasm.Credential.fromKeyhash(yield stakingKey.hash());
if (poolId === null) {
if (poolOrDrepId === null) {
if (registrationStatus === models_1.RegistrationStatus.Deregister) {

@@ -175,11 +186,25 @@ return [

}
return []; // no need to undelegate if no staking key registered
return []; // cannot undelegate unless unregistering
}
const result = [];
if (registrationStatus === models_1.RegistrationStatus.RegisterAndDelegate) {
// if unregistered, need to register first
result.push(yield wasm.Certificate.newStakeRegistration(yield wasm.StakeRegistration.new(credential)));
const keyDepositCoin = yield wasm.BigNum.fromStr(keyDeposit);
const isPoolDelegate = registrationStatus === models_1.RegistrationStatus.DelegateOnly || registrationStatus === models_1.RegistrationStatus.RegisterAndDelegate;
const isDrepDelegate = registrationStatus === models_1.RegistrationStatus.DelegateDrepOnly || registrationStatus === models_1.RegistrationStatus.RegisterAndDelegateDrep;
const isRegisterAlso = registrationStatus === models_1.RegistrationStatus.RegisterAndDelegate || registrationStatus === models_1.RegistrationStatus.RegisterAndDelegateDrep;
if (isPoolDelegate) {
const poolKeyHash = yield wasm.Ed25519KeyHash.fromHex(poolOrDrepId);
return isRegisterAlso ? [
yield wasm.Certificate.newStakeRegistrationAndDelegation(yield wasm.StakeRegistrationAndDelegation.new(credential, poolKeyHash, keyDepositCoin))
] : [
yield wasm.Certificate.newStakeDelegation(yield wasm.StakeDelegation.new(credential, poolKeyHash))
];
}
result.push(yield wasm.Certificate.newStakeDelegation(yield wasm.StakeDelegation.new(credential, yield wasm.Ed25519KeyHash.fromBytes(Buffer.from(poolId, 'hex')))));
return result;
if (isDrepDelegate) {
const drep = yield parseDrep(wasm, poolOrDrepId);
return isRegisterAlso ? [
yield wasm.Certificate.newVoteRegistrationAndDelegation(yield wasm.VoteRegistrationAndDelegation.new(credential, drep, keyDepositCoin))
] : [
yield wasm.Certificate.newVoteDelegation(yield wasm.VoteDelegation.new(credential, drep))
];
}
throw new Error(`Incorrect request for certificates! (${JSON.stringify({ stakingKey, registrationStatus, poolOrDrepId, keyDeposit })})`);
});

@@ -186,0 +211,0 @@ }

{
"name": "@emurgo/yoroi-lib",
"version": "0.15.6-alpha.2",
"version": "0.15.6-alpha.3",
"description": "",

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

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

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